i played around with this a bit, and i see that the weirdness is
really in MPlug.__eq__.
MSelectionList.getPlug effectively calls selectAncestorLogicalIndex
before returning the plug to you. reworking the example below, i see
that an index of a plug array and the plug array itself evaluate to
the same plug. this is not terribly intuitive:
import maya.OpenMaya as api
sel = api.MSelectionList()
sel.add( 'persp' )
obj = api.MObject()
sel.getDependNode( 0, obj )
#fn = api.MFnDependencyNode( obj )
fn = api.MFnDagNode( obj )
sel.add( 'persp.worldMatrix' )
plug1 = api.MPlug()
sel.getPlug(1, plug1)
plug2 = fn.findPlug('worldMatrix', False)
print plug1.isArray() # False
print plug2.isArray() # True
print plug1 == plug2 # True
On Oct 22, 6:26 pm, Chadrik <[EMAIL PROTECTED]> wrote:
> ah yes, thanks again, Doppleganger.
>
> but do you have any idea why the plug from the MSelectionList would
> work? it would make sense if somehow the MSelectionList returned
> worldMatrix[0], but they all appear to be the same plug.
>
> -chad
>
> On Oct 22, 6:09 pm, "Chad Vernon" <[EMAIL PROTECTED]> wrote:
>
> > worldMatrix is an array attribute because an instance can have multiple
> > worldMatrices. So you need to do something like:
>
> > plug = fn.findPlug('worldMatrix')
> > plug = plug.selectAncestorLogicalIndex(0, plug.attribute())
>
> > -Chad
>
> > On Wed, Oct 22, 2008 at 6:04 PM, Chadrik <[EMAIL PROTECTED]> wrote:
>
> > > that last line should say plug3 not plug2. doh!
>
> > > -chad
>
> > --www.chadvernon.com
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---