Thread: Sdk
View Single Post
  #14  
Old 05-20-2011, 11:22 PM
dcnieho dcnieho is offline
Member
 
Join Date: Feb 2011
Posts: 59
Dear Farshizzo,

Looking at the code more (and the C++ implementation of viz:ata), is it true that it is possible to pass an arbitrary number of arguments (with arbitrary names and somewhat arbitrary datatypes) through the Python interface to the C++ extension code? That's great! But how would one go about that at the Python side? Hmm, looking at the code in viz.VizExtensionNode and viz.VizExtension maybe its not possible yet). Anyway, that would be very cool! I do see I am able to pass back to Python arbitrary data structures (because lists and such are supported! and with some hacking any other Python datatype i see)

Another question is how to set error conditions in the C++ code and communicate them to the Python code? In the old code, one could say ((VizCustomNodeObj*)custom)->status = 0; in some functions (but not CommandCustomNode sadly) which would cause Vizard to communicate an error ocurred. Is it possible through the interface defined in pyerrors.h? If something is possible, could you add an example?

Lastly, I'm happy to see the void MyExtension::update(const viz::Event &e) function, that seems useful! Some questions though:
1) From inside this function, is it possible to retrieve pointers to the Nodes/Sensors/Textures attached to the extension to perform operations on them and/or pass data along?
2) I see that the viz::Event object has function for getting the X, Y and Z input arguments, amongst others. How are these set?
3) related to that, is it possible to override the update call from Python? I'd like to define my own function to run every frame (I now do that using vizact.ontimer(0,self.stim.update), where self.stim.update is a function i defined) where it does some processing and then passes some data along to the plugin. If you answer to 1) is no, I guess I'll keep doing what I'm doing now?

Thank you for the answers!
Best,
Dee
Reply With Quote