You need to set the attribute to an array type, and if you want to build 
it, you need to use the setUsesArrayBuilder as well.

On Monday, January 11, 2016 at 8:23:52 AM UTC-8, Rémi Deletrain wrote:
>
> 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 ...
>
> Someone an idea? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/109a0071-b019-485b-abdc-41b0bff00509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to