WorldViz User Forum  

Go Back   WorldViz User Forum > Plug-in development

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-28-2012, 05:59 AM
sleiN13 sleiN13 is offline
Member
 
Join Date: Dec 2008
Posts: 83
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?
Reply With Quote
  #2  
Old 08-30-2012, 09:44 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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);
Reply With Quote
  #3  
Old 09-03-2012, 12:48 AM
sleiN13 sleiN13 is offline
Member
 
Join Date: Dec 2008
Posts: 83
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Realistic Light and Shadows Using Vizard and 3DS Max jde Vizard 4 07-13-2012 10:58 AM
Vizard 4 Beta Testing farshizzo Announcements 0 02-01-2011 10:46 AM
Vizard 4 Beta Testing farshizzo Vizard 0 02-01-2011 10:46 AM
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 11:13 AM
Vizard tech tip: Text to Speech Jeff Vizard 1 01-15-2009 09:39 PM


All times are GMT -7. The time now is 05:14 AM.


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