Hi everybody,
I'm trying to add a viewpoint to the viewpoint list and I can't sort it out.
Basically I capture the current position of the viewer, I create a viewpoint in an INodeObject, and all that works properly. But when I add the INode to the current scene, the new viewpoint is not displayed in the viewpoint list.
Here's the C++ code:
if (SUCCEEDED(Engine->CreateNodeFromString(ViewpointVrmlCode.AllocSysString(), &vpNode) &&SUCCEEDED(Engine->get_RootNodes(&nodes))
&&SUCCEEDED(nodes->Add(vpNode, NULL)))
return TRUE;
It always returns TRUE. I thought it could be just a matter of Refresh(), but it didn't work.
How can I add a new viewpoint, given that the get_Viewpoints list is read-only?
Do I have to refresh in some way the plugin controls to see the new viewpoint? How can I get the controls refreshed?
I'm working on VC++6/Cortona 4.1/Windows Vista.
First of all, do you have serious concerns about using Cortona 4.1, since version 5.1 is available for download? It has backward compatibility with 4.1, of course.
Note, that "nodes->Add(vpNode, NULL)" never succeeds because of invalid second argument (it cannot be NULL, so method call fails with E_POINTER error). According to COM/OLE rules, when you need to omit an optional argument for a method, you should pass a VARIANT of type VT_ERROR with its scode member set to DISP_E_PARAMNOTFOUND.
CComVariant optional(DISP_E_PARAMNOTFOUND, VT_ERROR);
nodes->Add(vpNode, &optional);