How to rename/remove/reparent prims with Python?
457 2 1- alexmajewski
- Member
- 28 posts
- Joined: 8月 2017
- Offline
- goldleaf
- スタッフ
- 4200 posts
- Joined: 9月 2007
- Offline
- alexmajewski
- Member
- 28 posts
- Joined: 8月 2017
- Offline
Thanks goldleaf I did like you said with full success.
If anyone finds this post in the future, here's a minimal example of reparenting a prim (it requires the layer to be flattened first):
And to my understanding, if we plan to make more operations, we should add
Other ways and examples on reparenting, renaming or removing can be found in the USD Survival Guide, here. [lucascheller.github.io]
If anyone finds this post in the future, here's a minimal example of reparenting a prim (it requires the layer to be flattened first):
from pxr import Sdf node = hou.pwd() layer = node.editableLayer() cube_path = Sdf.Path("/Cube") new_cube_path = Sdf.Path("/Objects/Cube") edit = Sdf.BatchNamespaceEdit() edit.Add(cube_path, new_cube_path) if not layer.Apply(edit): raise Exception("Failed to apply layer edit!")
with Sdf.ChangeBlock():
before the
edit = Sdf.BatchNamespaceEdit()
Other ways and examples on reparenting, renaming or removing can be found in the USD Survival Guide, here. [lucascheller.github.io]
-
- Quick Links