now it doesn`t error but still not adding all element, only 1 it
seems:

        valuesPlug = listPlug.child(listCount)

        for i in range(100):
             elem = valuesPlug.elementByLogicalIndex(i)
             elem.setFloat(0.1)

       arraySize = valuesPlug. numElements()

after adding value to 100 different indexes of new array I thought the
size would be 100 as well, but I`m getting 1.

On Oct 29, 10:44 pm, Jakub Krompolc <[email protected]> wrote:
> actually I tried this before and now I`m getting same problem, that
> the plug doesn`t exist. this is part of the code
>
>         listPlug = OpenMaya.MPlug( nodeObject, node.list )
>         listCount = listPlug.numElements()
>         valuesPlug = listPlug.elementByLogicalIndex(listCount)
>
>         for i in range(100):
>              elem = valuesPlug.elementByLogicalIndex(i)
>
> after this I get error, so it seems the plug wasn`t actually created.
> The list is compound attribute which is set as array and values is
> child attribute, also array, but holds array of floats. Maybe I should
> select the child plug not by elementByLogicalIndex but using child()
> function. And use elementByLogicalIndex only for single value
> elements...
>
> On Oct 29, 1:22 am, Jakub Krompolc <[email protected]> wrote:
>
>
>
> > thanks. I didn`t get to work on this again yet, but just went through
> > this PDF ILM skinning from A.Maiolo, couple of helpful notes about
> > array attributeshttp://www.angelfire.com/ex2/andreamaiolo/skinningAtILM.pdf
>
> > On Oct 28, 4:19 pm, Chad Vernon <[email protected]> wrote:
>
> > > No, you cannot use arrayDataBuilder outside of the compute or deform
> > > methods.
>
> > > On Wed, Oct 28, 2009 at 7:09 AM, Jakub Krompolc 
> > > <[email protected]>wrote:
>
> > > > thanks Chad! will try that. do you think I should still use
> > > > buildDataAttribute? I think this wouldn`t make sense anymore...
>
> > > > Jakub
>
> > > > On Oct 28, 3:18 am, Chad Vernon <[email protected]> wrote:
> > > > > MPlug.elementByLogicalIndex(n) will automatically create a plug at 
> > > > > that
> > > > > index if one doesn't exist there. So your command just needs to find 
> > > > > the
> > > > > next available index. MPlug.getExistingArrayAttributeIndices will give
> > > > you
> > > > > the current indices.
>
> > > > > -Chad
>
> > > > > On Tue, Oct 27, 2009 at 7:03 PM, Jakub Krompolc <
> > > > [email protected]>wrote:
>
> > > > > > I`m trying to use arrayDataBuilder in the command, but it seems I
> > > > > > can`t do that without dataBlock. And as documentation says "The data
> > > > > > block is only valid during the compute method of the depend node", 
> > > > > > it
> > > > > > looks like you can`t generate array attributes using command itself,
> > > > > > even the node specified...
> > > > > > I have made a trigger system (using int value on the node that 
> > > > > > command
> > > > > > changes) to make array in "deform time" of node and this works, but
> > > > > > there`s no clean way described for this. skin algorithm example
> > > > > > (Writing Creature Deformers DVD) and weighstNode.cpp both don`t show
> > > > > > how you technique how user can add his new array. Say, if you`re
> > > > > > making a blendShape with multiple targets.
> > > > > > Anyone knows more elegant way?
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to