Hello everyone.
I have a problem with Mplug.
I try to create inputs in MFnNumericsAttribute array in connectionMade function of my MPxNode.
--------------------------------------------------------------------------------------------------
# Function when connection made in node
def connectionMade(self, plug, otherPlug, asSrc):
if not asSrc and plug == self.aSourceGeometry:
self.add_weights_attributes(plug)
return OpenMayaMPx.MPxNode.connectionMade(self, plug, otherPlug, asSrc)
# Add weights attributes from source geometry cvs
def add_weights_attributes(self, plug):
# Plug Datas
sourceGeometryHandle = OpenMaya.MPlug(self.thisMObject(), self.aSourceGeometry)
sourceGeometryObject = sourceGeometryHandle.asMObject()
weightsHandle = OpenMaya.MPlug(self.thisMObject(), self.aInputWeights)
# Curve
mfnCurve = OpenMaya.MFnNurbsCurve(sourceGeometryObject)
numCVs = mfnCurve.numCVs()
# Set Num of weights element
weightsHandle.setNumElements(numCVs)
--------------------------------------------------------------------------------------------------
I wish that when I connect a geometry in my node It adds as many inputs in my MFnNumericAttribut there points.
I thought it was this command "setNumElements" but nothing happens ...