Digital humans the art of the digital double
Ever wanted to know how digital doubles are created in the movie industry? This course will give you an insight into how it's done.
# 1 07-10-2010 , 04:57 PM
ben hobden's Avatar
Subscriber
Join Date: Jul 2008
Location: Chelmsford, Essex, UK
Posts: 1,162

Creating multiple proxy onjects

Does anyone know of a way I can speed up creating proxy objects of the geometry in a scene. Say I have a scene where ther are 100 seperate pieces of geometry. If I want to smooth them all, I have to convert each one to a sub div surface or create a proxy object, in turn, one by one. You dont seem to be able to select more than object and smooth them. Am I right...and I just have to do each one in turn?

# 2 07-10-2010 , 05:12 PM
bendingiscool's Avatar
Subscriber
Join Date: Jul 2006
Location: London
Posts: 567
This sounds like a very simple MEL/Python task, select all your objects, and in a python tab run this...


import maya.cmds as mc

sel = mc.ls(sl=True)

for i in range(len(sel)):
polyToSub = mc.polyToSubdiv(sel[i])
mc.hide(sel[i])

give me a shout if have problems...

cheers,
Chris

# 3 07-10-2010 , 05:20 PM
ben hobden's Avatar
Subscriber
Join Date: Jul 2008
Location: Chelmsford, Essex, UK
Posts: 1,162

Originally posted by bendingiscool
This sounds like a very simple MEL/Python task, select all your objects, and in a python tab run this...


import maya.cmds as mc

sel = mc.ls(sl=True)

for i in range(len(sel)):
polyToSub = mc.polyToSubdiv(sel[i])
mc.hide(sel[i])

give me a shout if have problems...

cheers,
Chris

Hi Chris. Thanks. I never use Python or MEL, and dont know how to use either. Can I just copy and paste all that into the python box under the viewport and hit enter? Will I need all the objects selected when doing so? Will I not need to add any semi-colons anywhere? at the end of each line? (I have a vague familiarity with php)

# 4 07-10-2010 , 06:13 PM
ben hobden's Avatar
Subscriber
Join Date: Jul 2008
Location: Chelmsford, Essex, UK
Posts: 1,162
Enetered this into the Python Tab of the Script editor, and this is the error message I got on execution


# Error: ('expected an indented block', ('<maya console>', 5, 9, 'polyToSub = mc.polyToSubdiv(sel[i])'))

# 5 07-10-2010 , 09:12 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Python doesn't require end of line syntax, such as semi-colons, however, it does require you to define grouped statements by way of whitespace.
What this means is that you will have to tab in the two lines after "for in in range..."

The whitespace was obviously lost when bendingiscool pasted in the code here.

Edit: Should be like this:

import maya.cmds as mc

sel = mc.ls(sl=True)

for i in range(len(sel)):
[tab] polyToSub = mc.polyToSubdiv(sel[i])
[tab] mc.hide(sel[i])

#replace the [tab] with an actual tab user added image

# 6 07-10-2010 , 09:26 PM
ben hobden's Avatar
Subscriber
Join Date: Jul 2008
Location: Chelmsford, Essex, UK
Posts: 1,162
Cheers stwert, I know it must be doable cause Ive just seen a tutorial where the guy uses a smooth button he has created on his shelf from a MEL script.

I did each piece individually in the end, but I will have to go through the process again at some point over the next few days and wil give this a try again then.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads