Answering my own question, to properly deal with array attributes, I
have to use MPlugs instead of directly wiring the attributes. MPlugs
come with functions to deal with the unsteady nature of array
attributes (MPlug.elementByLogicalIndex()).

Perhaps this is of help for someone else. Cheers!

  -André


On Nov 21, 12:05 pm, André Adam <[email protected]> wrote:
> Sorry if this is obvious, but perhaps someone can shed some light
> here; I am scripting DG connections right now and need access to the
> parentMatrix. The following MDGModifier call works as expected:
>
> oDGMod = api.MDGModifier()
> oDGMod.connect(self.oAnchor0,
> oDepNodeAnchor0.attribute('parentMatrix'), self.oNode,
> oNode.attribute('ParentMatrix0'))
> oDGMod.doIt()
>
> The problem is, once I break this connection and again call the
> script, the code above stops working and I get the following error:
>
> # Error: Connection not made: 'Pong2.parentMatrix[-1]' ->
> 'QuaternionBlendNode1.ParentMatrix0'.  Source node will not allow the
> connection. #
>
> I noticed in the connection editor, that parentMatrix now comes with a
> child called parentMatrix[0], which was not there when I did the
> initial connection. Is my parentMatrix attribute an array now? Why?
> And how can I make this reliably work when Maya decides to transmute
> attributes on the fly?
>
> Sorry again if this is something basic, but I can't seem to find
> anything on this in the docs.
>
> Thanks in advance for any hint! Cheers!
>
>   -André

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to