Ways to repath prim paths in the scene graph tree

   5205   7   1
User Avatar
Member
15 posts
Joined: May 2014
Offline
Hey,

Let's start with this little scene example. I did a pack primitives on 3 objects at /obj/ level and when I'm SOPimporting them, I get this scene graph tree :



I don't really like the automatic path that has been done here : /myAsset_instGeo/op_/obj/myAsset. I would prefer to have this layout :



So, for now, I've been experimenting 3 ways in order to solve this :

1 - By creating, beforehand, a string attribute that…. :


… will be used by the sopImport through the Path Attributes parameter :


2 - Following the example that I saw on that extremely cool scene done by Yuquing Chen [www.sidefx.com] (if I'm not mistaken), which is using reference nodes.



3 - By using the stagemanager node and moving/deleting things manually

—-

I'm cool with the 1st solution. I just find it a little bit not so straightforward. The 2nd solution seems hacky to me, for my use case, and is not procedural. The 3rd one is handy for the artist, but can be “dangerous” and looks hard to automate (I didn't try, though).

Which makes me ask this :

Did I miss a node that can do this in a clean, simple and procedural way ? Like a search and replace for prim paths that can support the usual expressions and wildcards.

I wouldn't be against a python snippet as well ^^. I'm a “python hobbyist” and I'm always failing at navigating into those kind of c++ api documentation [graphics.pixar.com].. haha

Cheers
Edited by pgu - April 9, 2020 19:47:01

Attachments:
sop_to_lop_instances.hip (130.5 KB)

User Avatar
Member
1746 posts
Joined: May 2006
Offline
The default for path attribute is ‘path,name’, so if it finds path first, it'll use that. You don't really want the full packed hierarchy path that houdini uses, only the end name (you'll define your own hierarchy in lops). Change it to just ‘name’.

Also set packed prims to ‘create xforms’, kind authoring to ‘nested groups and components’, that seems to match your screenshot.






*edit*

Silly me, I just read your message more closely, you already did that. You should be able to define your name attribute without having to hand make it in sops, gimme a sec…
Edited by mestela - April 9, 2020 21:11:46

Attachments:
sopimport_lops_parameters.PNG (54.5 KB)
sopimport_lops_sgt.PNG (10.8 KB)
sop_to_lop_instances_me.hiplc (122.5 KB)

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
1746 posts
Joined: May 2006
Offline
You could use an assemble, it'll make the names for you. It's just piece0, piece1. piece2 etc. but saves you having to hand type it.

Attachments:
sop_to_lop_instances_me_assemble.hiplc (130.4 KB)

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
1746 posts
Joined: May 2006
Offline
… and then use a name sop to do a quick rename in sops if the generic names bother you.

Attachments:
name_sop_packed.PNG (49.4 KB)

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
15 posts
Joined: May 2014
Offline
Hey Matt,

Thanks for helping me out ! This is helping me to reduce the numbers of sop nodes and probably optimize everything a little bit more .

From your input, I'm then guessing that there is no lop node that would act as prim path remapper. Would it be because it's not something that would have a daily use ? Am I thinking in a backward way regarding the logic of this ? (I'm starting at this, so it would be likely it)

Thanks !
Edited by pgu - April 11, 2020 09:13:43
User Avatar
Staff
4447 posts
Joined: July 2005
Offline
The stage manager LOP is the only one that has this sort of capability. In addition to the tree view you can switch to the regular parameter dialog view, which would let you do somewhat procedural operations after the fact. But ceertainly if you can set up your scene hierarchy at the SOP level, that's definitely going the be the most efficient way to do this. And the most flexible, given all the attribute manipulation tools already available in SOPs.
User Avatar
Member
15 posts
Joined: May 2014
Offline
Hello,

Sorry for the delay response. Thanks mtucker for this information .

Cheers
User Avatar
Member
44 posts
Joined: March 2023
Offline
Seems this is a good place to ask aswel.

How whould i change a primitive`s path programatically using VEX or Python ?

Currently, I'm stuck as I can't get these to work
https://www.sidefx.com/forum/topic/89395/?page=1#post-387297 [www.sidefx.com]
  • Quick Links