WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Plug-in development (https://forum.worldviz.com/forumdisplay.php?f=8)
-   -   Vizard 3 sensor plugin (https://forum.worldviz.com/showthread.php?t=4322)

sleiN13 08-28-2012 05:59 AM

Vizard 3 sensor plugin
 
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 09: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:
Code:

"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:
Code:

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 12: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.


All times are GMT -7. The time now is 11:56 AM.

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