ed.koffeman Posted November 17, 2015 Share Posted November 17, 2015 Code: void Vehicle::setMeshSkinned( const Variable& v ) { ObjectMeshSkinnedPtr m = VariableToType<ObjectMeshSkinnedPtr>( Interpreter::get(), v ).value; } I get compile-time errors: … unigine\sim_windows_2.0_src\include\UnigineInterpreter.h(1450): error C2440: 'type cast' : cannot convert from 'void *' to 'Unigine::ObjectMeshSkinnedPtr' 1> No constructor could take the source type, or constructor overload resolution was ambiguous … unigine\sim_windows_2.0_src\include\UnigineInterpreter.h(1450) : while compiling class template member function 'Unigine::VariableToType<Unigine::ObjectMeshSkinnedPtr>::VariableToType(void *,const Unigine::Variable &)' … Vehicle.cpp(90) : see reference to function template instantiation 'Unigine::VariableToType<Unigine::ObjectMeshSkinnedPtr>::VariableToType(void *,const Unigine::Variable &)' being compiled … Vehicle.cpp(90) : see reference to class template instantiation 'Unigine::VariableToType<Unigine::ObjectMeshSkinnedPtr>' being compiled If instead I try: void Vehicle::setMeshSkinned( ObjectMeshSkinnedPtr mesh ) { } Then it fails to compile this when registering the method: my_vehicleClass->addFunction( "setMeshSkinned", &SoapProxyVehicle::setMeshSkinned ); I have also tried passing in a NodePtr instead, and trying to cast it to an ObjectMeshSkinnnedPtr but I can't see a legal method for doing that. Is there a better way to get access to the ObjectMeshSkinned? Link to comment
maxi Posted November 18, 2015 Share Posted November 18, 2015 Hi Ed, Use the following code: using namespace Unigine; void ClassName::setMeshSkinned(Variable &o) { ObjectMeshSkinnedPtr m = ObjectMeshSkinned::create(o.getObject(Unigine::Engine::get()->getEditorInterpreter())); } Link to comment
ed.koffeman Posted November 18, 2015 Author Share Posted November 18, 2015 Thank you - it worked, once I changed the Interpreter getting to "Interpreter::get()". Link to comment
Recommended Posts