Notifications
Clear all

[Closed] SDK Question: How do I make a node display upon creation?

I’ve noticed that if I create a scene node using anything other than a CreateMouseCallback, it doesn’t actually display until I click in one of the viewports. I checked and this is also the case with the example from Lesson5a from the help:

  // Create an object 
  SampleGObject *myGeomObj = new SampleGObject();
  INode *nod = ip->CreateObjectNode(myGeomObj);
  TimeValue t (0);
  Matrix3 tm(1);
  node->SetNodeTM(t, tm);

In my case I’m making a helper and I’ve tried forcing it to call my Draw function directly after creating it, but without luck. It’s a small issue but if I don’t know how to fix it, it’s the sort of thing that will plague me in creating any future plugins…

5 Replies

It just sound like you have not done a redraw Viewport.

ip->RedrawViews(ip->GetTime());

I can’t believe it was that simple! I was convinced that the issue was specific to the particular node so I kept looking for a solution in that direction. Just goes to show that making assumptions is one of the biggest obstacles to solving problems!

assumptions with the max sdk! haha
glad that was it.

You don’t need to set the transform to Matrix3(1) either, as that’s the default of a created node.

Thanks, but the identity matrix is just there as a placeholder. I’m actually working on getting the actual value to go there now but I need to figure out how to create a matrix from a ray in the SDK…