just a note, I had a chat with someone and it seems I could get the
DataBuilder in a command from MPlug... also I had some mistake in
initialize method. But please comment anyway if you have something to
say, as I might come back with other problem with this thing.

On Oct 25, 9:52 pm, Jakub Krompolc <syntet...@googlemail.com> wrote:
> hello, I`m working on python deformer plugin. It`s a node that will
> hold several arrays of float values. Those arrays are all under one
> compound attribute (set as array as well). I want the same workflow as
> Maya blendShape, so user will run a command and add another array when
> he wants. The deformer will then compute final result based on arrays
> that user added.
> First I have set both compound and values attributes as using
> arrayDataBuilder, but this only works under the node, not in the
> command. But the array creation in the node would need to be triggered
> by command somehow.
> What I`m doing now is trying to use MPlug in command using
> selectAncestorLogicalIndexwhich could create the data, but I`m getting
> different errors as if the array couldn`t be made - maybe auto-
> creation only works on single value elements?
>
> Then I have another idea, to make int attribute on a node with number
> of arrays. The node would always create one more array if the int
> value is the same as current size of array. The command would change
> this value to value+1 and so on. This way there would always be one
> "free" array for the command to use it and set values. But it sounds
> hacky... does anyone know the right way of doing this?
>
> this is part of the command, array creation part (which doesn`t work):
>
>         #compound attr
>         listPlug = OpenMaya.MPlug( deformNode, deformerName.list )
>         listSize = listPlug.numElements()
>
>         #values attr
>         valuesPlug = OpenMaya.MPlug( deformNode, deformerName.values )
>         valuesPlug.selectAncestorLogicalIndex( listSize,
> deformerName.list )
>
>         pointSize = 1000 #example, size of mesh points
>         for i in range( pointSize ):
>             valuesPlug.selectAncestorLogicalIndex( i,
> deformerName.values )
>             valuesPlug.setValue( 1.2 ) #some value
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to