protected override bool connectObjectAndConstraint(MDGModifier modifier) { MObject transform = transformObject(); if (transform.isNull) { throw new InvalidOperationException("Failed to get transformObject()"); } MFnTransform transformFn = new MFnTransform(transform); MVector translate = transformFn.getTranslation(MSpace.Space.kTransform); MPlug translatePlug = transformFn.findPlug("translate"); if (MPlug.FreeToChangeState.kFreeToChange == translatePlug.isFreeToChange()) { MFnNumericData nd = new MFnNumericData(); MObject translateData = nd.create(MFnNumericData.Type.k3Double); nd.setData3Double(translate.x, translate.y, translate.z); modifier.newPlugValue(translatePlug, translateData); connectObjectAttribute(MPxTransform.geometry, GeometrySurfaceConstraint.constraintGeometry, false); } connectObjectAttribute(MPxTransform.parentInverseMatrix, GeometrySurfaceConstraint.constraintParentInverseMatrix, true, true); return(true); }