Hello everyone!
I have wrote a little script to parent shapes of multiple curve objects. The problem is that when I execute the code, in the viewport all children curves have their parent position. But this is only visual error. If I right-click on the object and choose controlVertex from marking menu it shows me the real position of the CVs.
Another thing is if I execute the first block of code and then second one it works fine.
It is very difficult to explain. Here is what you should do to see this error.
Create three Circles:
Circle1 rotation = 0 , 0, 0
Circle2 rotation = 0, 0, 90
Circle3 rotation = 90, 0, 90
Now execute this code
selectedObjects = cmds.ls(selection=True)
cmds.parent()
cmds.makeIdentity(apply=True,t=True, r=True, s=True, normal=False, preserveNormals=True)
selectedChildren = cmds.ls(selection=True)
selectedShapes =cmds.listRelatives( selectedChildren, c=True, fullPath=True)
cmds.select(clear=True)
for shape in selectedShapes:
cmds.parent(shape, selectedObjects[len(selectedObjects)-1], r=True, s=True)
finalObject = cmds.pickWalk(direction='up')
children = cmds.listRelatives(children=True, type='transform', fullPath=True)
cmds.delete(children)
To see real position of the shapes one must right-click on the object and then choose Control Vertex.
Now try to do the same thing but first execute the code before [b]for-in loop[/b] and then the rest of the code. It will work fine.
And the last thing. It does not happen if I do Freeze Transformations manually.