Pooks
Pooks

Reputation: 2585

How do I add a field for a message attribute from another node to the Attribute Editor?

Suppose I have 3 nodes called GrandParent, Parent and Child. Child is connected to Parent and Parent is connected to GrandParent by Message attributes.

I would like to add a custom field in the Attribute Editor for GrandParent that refers to Child. Basically, a field for the message attribute of Parent receiving the connection to Child, but show that field in GrandParent.

It would look like what you get with editorTemplate -label "Brush Details" -addControl "child"; in AEParentTemplate.mel where child is the Message attribute for connecting a Child node. Message attribute

Except that I would like to add this to the Attribute Editor for GrandParent.

I managed to add other attributes from Parent to GrandParent by using editorTemplate -callCustom "parent_new" "parent_replace" in AEGrandParent.mel. In parent_new I create a dummy Parent node

string $dummyParent = `createNode -skipSelect "Parent"`;

And I use it to add fields from Parent to the attribute editor of GrandParent. For example attrFieldSliderGrp -attribute ($dummyParent + ".numericValue") adds a field and slider for a float attribute called numericValue in Parent. I can do the same for a color attribute with attrColorSliderGrp -label $tmpStr -attribute ($dummyParent + ".color")

Then at the end of parent_new I delete the temporary node and I keep the values in the fields updated in parent_replace by updating the attribute reference for the fields (for example attrFieldSliderGrp -e -attribute "parentNode1.numericValue" "parentNumericValueField";).

My problem is that I can't find how to do the same for a Message attribute. I tried creating a attrFieldGrp with attrFieldGrp -attribute ($dummyParent + ".child"); but this crashes Maya 2014. I tried the same with attrControlGrp attrControlGrp -attribute ($dummyParent + ".child"); which gives an error that Message attributes are not supported by attrControlGrp.

Any idea how this can be achieved?

Upvotes: 1

Views: 1179

Answers (1)

Pooks
Pooks

Reputation: 2585

The solution was simply to use attrNavigationControlGrp to create the control. This control does not need the dummy Parent node and will create the UI for node connections.

Upvotes: 0

Related Questions