How to set prims at certain path in Awrangle.

   2432   7   4
User Avatar
Member
44 posts
Joined: 3月 2023
Offline
Hello I`m trying to set all primitives at a certain path with this code but it doesn't work.
Anyone know what might work ?

Primitives:
`lopinputprim('.', 0)`

VEX:
if(usd_kind(0, @primpath) == "component")
{
@primpath = "/ASSET/geo/render" +@primpath;
}


primitives:
%type:Mesh

VEX:

@primpath = "/ASSET/geo/render/test";
printf(@primpath);


I`ve also tried with python but apparently the get children function doesn`t exist ?
import pxr

import hou

stage = hou.pwd().editableStage()
root_prim = stage.GetPrimAtPath("/")


# Loop through all child prims under the root prim
for child_prim in root_prim.getChildren():
    # Check if the child prim is a component and perform action
    if child_prim.getTypeName() == "Xform" and child_prim.getPurpose() == "component":
        print(child_prim.GetName())
Edited by nicolaas.tanghe - 2023年3月16日 17:04:50
User Avatar
スタッフ
502 posts
Joined: 6月 2020
Offline
Before answering the detailed questions here, I want to take a step back and ask what you're trying to achieve. I just want to make sure we give you useful answers/information.
User Avatar
Member
44 posts
Joined: 3月 2023
Offline
Example:
my scene graph looks like this.

|---example
| |-geo
|
|---geo
| |-spaceship
|---blablabla
| |-blablabla



Im trying to move geo/* to example/geo/ with keeping the geo configured the way it is configured at example/geo
in a wrangle or if not possible in a python scipt.
Edited by nicolaas.tanghe - 2023年3月19日 15:49:51
User Avatar
スタッフ
502 posts
Joined: 6月 2020
Offline
Ah, I see. Shuffling USD prims around like that isn't really possible this way. The best we have to offer at present are the Stage Manager and the Graft Branches LOPs.
User Avatar
Member
44 posts
Joined: 3月 2023
Offline
Oh that`s to bad,
Would be a great addition i think.

I`ll use the graft branch then THX for the time and effort.
User Avatar
スタッフ
502 posts
Joined: 6月 2020
Offline
nicolaas.tanghe
Would be a great addition i think.

Yes, restructuring the scenegraph is a commonly requested feature. It's definitely on our mind (and I believe on Pixar's as well)
User Avatar
スタッフ
4199 posts
Joined: 9月 2007
Offline
There is also the Restructure Scene Graph LOP [www.sidefx.com] that can do some measure of restructuring (reparenting, renaming, removing). It requires sub-layer flattening of the inputs, but is another option to keep in mind for these sorts of cases.
I'm o.d.d.
User Avatar
Member
21 posts
Joined: 3月 2016
Offline
Not sure if I'm asking the same question as above, but I'm trying to use the restructure scene graph node to tidy up an older usd stage that I have without having to go back to the original graph and re-author everything. Unfortunately I'm running into an issue when reparenting some instancable prims and their respective prototype prim. When I reparent the instances, they retain their reference path, but when I move the prototype as expected this breaks the instances. Is there any way to change that path with vex after reparenting or is it a python thing?
  • Quick Links