Get worldMatrix idx w/Python?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  01 January 2013
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.
 
  01 January 2013
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
 
  01 January 2013
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.
 
  01 January 2013
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 January 2013 at 08:45 AM.
 
  01 January 2013
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.
 
  01 January 2013
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?
 
  01 January 2013
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.
 
  01 January 2013
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



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 10:37 PM.


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