![]() |
|
#1
|
|||
|
|||
|
Help with VizExtension.command?
I'm working to port a new version of our volume rendered over to C++ as a Vizard extension, but I'm running into some issues using the VizExtension.command method.
I followed your documentation, and I can construct a simple cube when I call my extensions .addNode() method. However, when I try to use the .command method Vizard crashes on me every time. Specifically, I'm just trying to send back bogus data from the C++ extension to Python using the data.set() method. MyExtension Header Code:
#pragma once
#include <viz\Extension>
#include <viz\python>
#include "MyNode.h"
class MyExtension : public viz::Extension
{
public:
MyExtension(void);
virtual const char* getName() const;
virtual viz::Referenced* createNode(viz::Data &data);
virtual void command( viz::Data& data);
protected:
virtual ~MyExtension(void);
protected:
osg::ref_ptr<viz::ExtensionOSGNode> node_;
};
Code:
#include "MyExtension.h"
MyExtension::MyExtension(void)
{
}
MyExtension::~MyExtension(void)
{
}
const char* MyExtension::getName() const
{
return "My Extension";
}
viz::Referenced* MyExtension::createNode(viz::Data &data)
{
node_ = new DummyNode;
return node_.get();
}
void MyExtension::command( viz::Data& data )
{
int command = data.getInt( "command" );
switch(command)
{
case 1: //Passing in the camera's normal
float tempX = data.getFloat("x");
data.set( PYTHON_RETURN_OBJECT, PYTHON_STRING("This is a test.") );
break;
}
}
extern "C" __declspec(dllexport) viz::Extension* CreateVizardExtension(viz::Data &data)
{
return new MyExtension();
}
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|