Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

connect in MFnCompoundAttribute?

connect in MFnCompoundAttribute?

egoldid1
Advocate Advocate
513 Views
1 Reply
Message 1 of 2

connect in MFnCompoundAttribute?

egoldid1
Advocate
Advocate
hi!.my node has this attribute:
 
 
MFnCompoundAttribute compoundAttr;
MFnNumericAttribute numericAttr;
compoundsGRPAttr = compoundAttr.create("compounds", "comps");
compoundAttr.setArray(true);
 
indexAttr = numericAttr.create("index", "index", MFnNumericData::kInt, 0.0);
 
compoundAttr.addChild(indexAttr);
 
stat = addAttribute(compoundsGRPAttr);
if (!stat) { stat.perror("addAttribute"); return stat; }
 
 
now, i want run one function when, one plug, connected to indexAttr... how can i do it? (c++ api)
and how i can connect the one node plug(the specified plug) to one of indexAttrs?
 
Excuse me,I don't speak English as well as you....
0 Likes
514 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
void myNode::connectToIndex(unsigned int idx, MPlug srcPlug)
{
    MPlug compoundPlug(thisMObject(), compoundsGRPAttr);
    MPlug indexPlug = compoundPlug.elementByLogicalIndex(idx).child(indexAttr);
    MDGModifier dgmod;
    dgmod.connect(srcPlug, indexPlug);
    dgmod.doIt();
}