copy a shape node, get an instance..?

24 views
Skip to first unread message

kevco...@gmail.com

unread,
Oct 9, 2014, 8:38:54 PM10/9/14
to python_in...@googlegroups.com
Hey Guys,

Working on a tool right now that will copy a shapenode to all the selected transform nodes. But it seems to be giving me instances when I duplicate the shape. what's going on here?


import pymel.core as pm

def copyShape( objects ):
source = objects.pop()
for target in objects:
pm.delete( target.getShapes() )
dupShape = pm.duplicate( source.getShape(), addShape=True )[0]
dupShape.setParent( target, add=True, shape=True )
source.deselect()


sel = pm.ls(sl=1)
copyShape(sel)

kevco...@gmail.com

unread,
Oct 10, 2014, 12:21:25 PM10/10/14
to python_in...@googlegroups.com, kevco...@gmail.com
okay, this is driving me crazy now. I know I'm missing something, caue this should be real simple. get the shape node, duplicate the shape node, parent the duplicated shape node.

But when I parent the duplicated shape node. it parents an instance of the duplicated shape node. I just need a duplicate, not an instance.

there must be a way to do this, different from what I'm trying. what's going on here?

Kev

kevco...@gmail.com

unread,
Oct 10, 2014, 2:11:32 PM10/10/14
to python_in...@googlegroups.com, kevco...@gmail.com
oh I feel stupid now. I guess the flags -add & -shape when used together, basically give you an instance. I needed to use the relative flag instead of add. Doh

Kev

Reply all
Reply to author
Forward
0 new messages