public static bool BindBlendShapeCtl(MFnBlendShapeDeformer bs, MDagPath ctlDagPath = null) { //MFnDependencyNode ctlNode = new MFnDependencyNode(ctlDagPath.node); if (bs == null) { Debug.Log("null blendShape"); return(false); } //Debug.Log("here i am"); if (ctlDagPath == null) { ctlDagPath = BasicFunc.CreateCTL_Crystal("ctl_bs_" + bs.name); } MFnDependencyNode ctlNode = new MFnDependencyNode(ctlDagPath.node); MPlug weightPlug = bs.findPlug(ConstantValue.plugName_blendShapeWeight); int count = (int)weightPlug.numElements; //Debug.Log("target count:" + count); MDGModifier dGModifier = new MDGModifier(); for (int i = 0; i < count; i++) { //Debug.Log("process:" + i); MPlug singleWeightPlug = weightPlug.elementByLogicalIndex((uint)i); string weightName = singleWeightPlug.name.Split('.').Last(); MPlug ctlAttrPlug = AddFloatAttr(ctlDagPath, weightName); dGModifier.connect(ctlAttrPlug, singleWeightPlug); } dGModifier.doIt(); return(true); }