Jump to content

[SOLVED] nodeReference downcast


photo

Recommended Posts

   {

   NodeReferencePtr node_ref = NodeReference::create(NodeRef);              // NodeRef is file parameter (.node)
    node_ref->setName("NodeReference_0");
    
    node_ref->release();
    Editor::get()->addNode(node_ref->getNode());

   NodePtr  node = Editor::get()->getNodeByName("NodeReference_0");
    ObjectMeshStaticPtr node1 = ObjectMeshStatic::cast(node);                           //return null
    ObjectMeshStaticPtr node2 = ObjectMeshStatic::cast(node);                           //return null

}

NodeRef is material_ball.node(material_ball's nodeReference).

 

material_ball's Original type is  ObjectMeshStatic. So I thought that I can cast to ObjectMeshStatic. but That casting return null.

How do I cast to ObjectMeshStatic?

Link to comment

Ok,  that link have something wrong ( 404 forbidden).

 

but I understand getReference() function. and  I get a workaround. 

              ObjectMeshStaticPtr node1 = ObjectMeshStatic::cast(NodeReference::cast(node)->getReference());

Thank you

 

If I editing node1 for something related to the ObjectMeshStatic class, would it apply to the node (NodeReference)?

Edited by dongju.jeong
Link to comment
  • silent changed the title to [SOLVED] nodeReference downcast
×
×
  • Create New...