PDA

View Full Version : plugins help


paulpars
08-11-2006, 12:45 PM
Does anyone know a bit about how the plugins work (i'm using the custom node plugin) so that they could answer a few questions about them? Thanks.

Gladsomebeast
08-11-2006, 01:46 PM
If I don't know the answer, then I'll find it. What do ya need to know?

paulpars
08-11-2006, 02:14 PM
in the main.cxx file there is an option to change the size of the data field to any value in order to put values into the data field. I don't understand how this works or how to store data so it can be retrieved from vizard. Also, in the notes it says you can perform a command on the plugin by calling custom.command(0,’’,0,0,0,0). Would you be able to explain how this works?

Gladsomebeast
08-11-2006, 03:18 PM
The data field is used to pass floats back to Vizard. You can add plugins to scripts and call get() on them to access the values in the plugin's data field.

custom = viz.add('customnode.dlc')
print custom.get()

custom.get() will return a list of floats. The lenght of this list is defined by the dataSize field that you set in the InitCustomNode function. Sensor plugins use this to pass data to Vizard. See the sensor plugin sample for an example of how you can fill the plugin's data field with values that can be accessed in Vizard.

When you call command() on a plugin in Vizard, the CommandCustomNode function of the plugin is called with the arguments you passed it in Vizard. Check out the test*.py scripts in the root directory of the plugin SDK to see some examples of how command() is used.