Group Instead Of Dummy

In Max Script, if you want to create a group, you should have something to be inside the group first. i.e.

group something
group selection

So far, I only know how to create an empty Group via Max SDK.

INode *child;
Object *obj = (Object*)CreateInstance(HELPER_CLASS_ID, Class_ID(DUMMY_CLASS_ID,0));
IDerivedObject *dobj = CreateDerivedObject(obj);
child = GetCOREInterface()->CreateObjectNode(dobj);
child->SetName(some_name);
// attach to another INode*
parent->AttachChild(child);
// attach another INode* to it
child->AttachChild(grandChild);

Wait a minute. This creates a Dummy, not a Group! A Dummy is quite a different thing. It cannot be closed. It’s bounding box does not respond to stuff under it. If you delete a Dummy, stuff under it will still be there. OK, there is some trick: as long as you type:

child->SetGroupHead(1);

It will be a Group! Also there is something I don’t understand: after an API mesh object (say grandChild) is created, I should attach it to an existing Group. Unless I call:

grandChild->SetGroupMember(1);

It will fail. I suggest that is due to a mesh object cannot be a group head. Just like only Transform node can have children in Maya. Because I want to put everything in the same hierarchical order as they are in Maya, a mesh cannot have any child should not bother me in this case.

Advertisements

Leave a comment

Filed under Max Script, Max SDK

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s