WorldViz User Forum

WorldViz User Forum (
-   Plug-in development (
-   -   Setting dataSize for the modifier plugin (

Joran 03-17-2010 09:14 AM

Setting dataSize for the modifier plugin

I started developing my first modifier plugin for Vizard (see So what I am making is a modifier that gets the depth buffer information from a Camera. I have it working okay, the only part left is returning the data to the python script.

At the moment I use a fixed size texture (say 8 by 8). And I set the dataSize to 8 * 8 in the InitModifier procedure. As far as I understand each instance of the modifier will get it's own buffer of 64 floats. But I want to have a different texturesizes, which leads to a different dataSize for each instance. Is there some way to do this? Can I just change the dataSize, free up the data field and allocate a new buffer in the PerformModifier procedure?

Greetings, Joran.

farshizzo 03-18-2010 10:41 AM

Yes, you can manually reallocate the data field. Just make sure that you set the dataSize member to the new size.

However, in your case I would suggest directly creating Python objects within your modifier plugin. For example, if you wanted to make some raw byte data available to your script, you could do the following:

PyObject *imageData = PyString_FromStringAndSize(buffer,bufferLen);

//Add python object to __main__ module

After this code is executed, there will be an myImageData variable available in the __main__ scope of your script.

All times are GMT -7. The time now is 02:41 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC