kMesh intermediateObject bug

kMesh intermediateObject bug

KasumiL5x
Participant Participant
868 Views
2 Replies
Message 1 of 3

kMesh intermediateObject bug

KasumiL5x
Participant
Participant

Hello again.

 

I have a callback setup using MDGMessage::addNodeAddedCallback, and have discovered that if you apply an extrude node to a triangulated mesh, then an intermediate mesh is created behind the scenes.  This part is expected and all good.  Upon the above callback being triggered, however, the isIntermediate flag is not set, but is set once the object is fully in the scene.

 

An example in pseudocode would be:

 

const MFnDagNode dagNode(theMObject);
if( dagNode.isIntermediateObject() ) {
  // ignore it, or whatever
}
// otherwise continue

 

 

 

Is there a way to know if the created node is intermediate at this stage (it seems to work with other objects, from what I recall)?  If not, please add some new callback that is only triggered once an object is fully ready, as I've encountered countless issues of a similar nature.

 

The reason I ask is that I must rely upon this callback for knowing when nodes are added in order to send them to networked clients.

 

Thanks once more,

Daniel

0 Likes
Accepted solutions (1)
869 Views
2 Replies
Replies (2)
Message 2 of 3

kevin.picott
Alumni
Alumni
Accepted solution
At the time when that callback is made there is no information available to tell you that the new node will eventually become an intermediate object. It's true of this type of poly operation but not all operations so for others it may be already set. I've filed an internal change request to ensure the flag is set before the callback is made.
 
In the meantime you can try this workaround. It's not pretty but it should get the job done.
 
  1. In your nodeAdded callback detect nodes that are potential intermediate objects; such nodes will be mesh shapes with a sibling shape sharing the same parent transformation
  2. Don't process those nodes yet, add them to a list
  3. Use MEventMessage::addEventCallback("idle", IdleFunc, nullptr) to add a new callback for the next idle event
  4. When you get that callback finish processing your list; at this point the flag will definitely be set
  5. Remove the callback once the list is processed


Kevin "Father of the DG" Picott

Senior Principal Engineer
0 Likes
Message 3 of 3

KasumiL5x
Participant
Participant
Thank you, that solution did the trick! 🙂
0 Likes