nAttr = OpenMaya.MFnNumericAttribute() cAttr = OpenMaya.MFnCompoundAttribute()
aWeight = nAttr.create( "map", "map", OpenMaya.MFnNumericData.kFloat, 1.0 ) nAttr.setArray( True ) nAttr.setUsesArrayDataBuilder( True ) addAttribute( aWeight ) aTarget = cAttr.create( "target", "target" ) cAttr.addChild( aTargetMap ) cAttr.setArray( True ) cAttr.setUsesArrayDataBuilder( True ) addAttribute( aTarget ) Then you can connect node.target[%d].map to blendShape.inputTarget[0].inputTargetGroup[%d].targetWeights -Chad On Tue, Oct 14, 2008 at 12:30 PM, Chadrik <[EMAIL PROTECTED]> wrote: > > hi all, > > i've started reworking Pascal's colorAtPointNode to suit my purposes. > the end goal is to produce a node that cooperates with a blendshape to > allow the per-vertex weights to be dynamically controlled through a > shading network. > > i've modified the colorAtPointNode so that it takes a (blendshaped) > mesh as an input and evaluates a given shading network using its > normals/tangents/uvs/etc, but i'm not sure how to proceed with setting > up an output attribute that can be connected to the targetWeights > attribute of the blendshape (or if there is some entirely different > solution which might be better). the targetWeights attribute is a > multi-array of floats, one for each vertex in the blendshape mesh. so, > for a simple cube you would have 8 inputs, which are typically set by > painting weights: > > blendShape2.inputTarget[0].inputTargetGroup[0].targetWeights[0] > blendShape2.inputTarget[0].inputTargetGroup[0].targetWeights[1] > blendShape2.inputTarget[0].inputTargetGroup[0].targetWeights[2] > .... > blendShape2.inputTarget[0].inputTargetGroup[0].targetWeights[7] > > > so, i'm assuming if i create a multi output on my node with the same > number of elements, i can connect the arrays directly, like this: > > connectAttr vertexColorNode1.outScalarArray > blendShape2.inputTarget[0].inputTargetGroup[0].targetWeights; > > can anyone point me in the direction of some example code for creating > an output like this or pass along any insight? i've been digging > through the docs but there are so many examples its hard to find one > that's applicable. > > thanks, > chad > > > > -- www.chadvernon.com --~--~---------~--~----~------------~-------~--~----~ Yours, Maya-Python Club Team. -~----------~----~----~----~------~----~------~--~---
