PDA

View Full Version : Vizard 3 sensor plugin


sleiN13
08-28-2012, 06:59 AM
I'm trying to port a Vizard 4 (sensor + extension) plugin I wrote to also work with Vizard 3.

So far I got all the basic sensor stuff working, but in vizard 4 I got access to some custom python functions for the tracker. I would also like to port these to the vizard 3 plugin but I can't figure out how to add the functionality.

The sensor example code only uses the Command() function to recieve communication. The PythonPluging example does add some new python callable functions but I can't combine the two.

Is there somewhere an example on how I could do all this?

farshizzo
08-30-2012, 10:44 AM
Are you referring to customizing the extension interface within the C++ plugin using the Python_SetExtensionCode function? If so, you can still customize the interface in Vizard 3.0. Instead of using Python_SetExtensionCode, you need to use PyRun_SimpleString. You also need to add the following to the end of the code string:
"viz.upgradeExtension('myextension.dle',MyExtension )\n"
Where myextension.dle is replace with the name of your plugin file and MyExtension is the name of your custom extension class. Here is a more complete example:
char *code = "class MyExtension(viz.VizExtension):\n"
" def mymethod(self, value):\n"
" self.command(1,'',value)\n"
"viz.upgradeExtension('myextension.dle',MyExtension )\n";
PyRun_SimpleString(code);

sleiN13
09-03-2012, 01:48 AM
What is the correct way of returning values in de command function, Vizard 4 had a nice .set() method. I can't seem to find something similar in the vizard 3 example codes.

I did see you could extend the float data array but I would also like to be able to return some strings with certain tracker error messages.