CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 01-09-2013, 12:43 AM   #1
EightBit
Lord of the posts
Mitch Rosefelt
OutThereSumwhere, USA
 
Join Date: Jan 2008
Posts: 1,044
Get worldMatrix idx w/Python?

I'm working with instances and I want to determine which worldMatrix[] they are linked to.
So if
cmds.ls('transform34|fridgeDoor|fridgeDoorShape', dag=True, ap=True)
returns 3 instances, how do I find out which worldMatrix each is connected to?
Thanks.
__________________
If animation couldn't change the world, it wouldn't be such a Micky-Mouse place.
 
Old 01-09-2013, 01:16 AM   #2
gmask
Obfuscator
 
gmask's Avatar
gmask
Power Sitting
Topanga, USA
 
Join Date: Oct 2002
Posts: 6,937
I think you want
cmds.listRelatives('transform34|fridgeDoor|fridgeD oorShape', f=True, ap=True)

this should return the list of unique transform nodes
__________________
blah blah blah
 
Old 01-09-2013, 02:54 AM   #3
EightBit
Lord of the posts
Mitch Rosefelt
OutThereSumwhere, USA
 
Join Date: Jan 2008
Posts: 1,044
That does return the transform nodes, but I need shapeNode. worldMatrix[X] so I can connect it to a pfxToonShape along the lines of this:
cmds.connectAttr (shapeTmp+'.outMesh', 'pfxToonShape.inputSurface[' + str(nextToonIdx) + '].surface')
cmds.connectAttr (shapeTmp+'.worldMatrix[X]', 'pfxToonShape.inputSurface[' + str(nextToonIdx) + '].inputWorldMatrix')
__________________
If animation couldn't change the world, it wouldn't be such a Micky-Mouse place.
 
Old 01-09-2013, 08:41 AM   #4
zoharl
A newbie
 
zoharl's Avatar
portfolio
Zohar
Wellington, New Zealand
 
Join Date: Mar 2009
Posts: 1,821
So get the name of the shapes by listing relatives of type mesh, and connect their worldMatirx attribute/plug in an eval command.

Last edited by zoharl : 01-09-2013 at 08:45 AM.
 
Old 01-09-2013, 02:52 PM   #5
EightBit
Lord of the posts
Mitch Rosefelt
OutThereSumwhere, USA
 
Join Date: Jan 2008
Posts: 1,044
The cmds.ls() command in the OP returns the shapeNodes.
Do you have code for "connect their worldMatirx attribute/plug in an eval command"?
Thx.
__________________
If animation couldn't change the world, it wouldn't be such a Micky-Mouse place.
 
Old 01-09-2013, 03:11 PM   #6
zoharl
A newbie
 
zoharl's Avatar
portfolio
Zohar
Wellington, New Zealand
 
Join Date: Mar 2009
Posts: 1,821
Sorry, I don't follow. The connectAttr in your second post should do it, you asked how to get the shapes. What exactly are you missing? Can you supply a full example / code (e.g. use a sphere mesh) that construct the objects (use the echo all in the script editor), and tell us exactly what's not working?
 
Old 01-09-2013, 05:14 PM   #7
EightBit
Lord of the posts
Mitch Rosefelt
OutThereSumwhere, USA
 
Join Date: Jan 2008
Posts: 1,044
The connectAttr requires a .worldMatrix index. In my post I used .worldMatrix[X], because that's what I'm trying to figure out.
However, following your suggestion, I created a simple test scene and discovered that there is a better way(?) to connect an instance to the pfxToonShape:
Connect
instanceTransform.worldMatrix[0] to the pfxToonShape.inputSurface[X].inputWorldMatrix
and connect the
shape node.outMesh to pfxToonShape.inputSurface[X].surface
In fact, it doesn't appear that the shapeNode contains a worldMatrix[] attr for each instance.
Thanks for the suggestion.
__________________
If animation couldn't change the world, it wouldn't be such a Micky-Mouse place.
 
Old 01-09-2013, 05:14 PM   #8
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:28 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.