Search - User list
Full Version: Does Lop Import not support primitive path patterns?
Root » Solaris and Karma » Does Lop Import not support primitive path patterns?
Ashen
I'm trying to dynamically select a camera that I know will exist somewhere in the USD tree (under /cameras/**) but I do not know its exact location or name. I was hoping that I could use the expression `/cameras/** & %type:Camera` but that only seems to work on the primitive paths in Solaris, not on OBJ level nodes like LopImportCamera.

Any suggestions for alternate ways to do this sort of fuzzy primitive lookup in the OBJ context?
antc
LopImportCamera can only represent a single camera and a fuzzy lookup might match multiple. In lops you could try creating a reference to the first camera found under /cameras, that then gives you a fixed/known name to use in the obj node. Something like this in python lop might work.

node = hou.pwd()
stage = node.editableStage()
cameras = stage.GetPrimAtPath('/cameras')
for prim in Usd.PrimRange(cameras):
    if UsdGeom.Camera(prim):
        stage.DefinePrim('/obj_cam').GetReferences().AddInternalReference(prim.GetPath())
        break

and then point the LopImportCamera node at /obj_cam
Ashen
Yeah, I figured it was probably due to something like that. I was just hoping that there might be a way to limit the result to the first match returned or something.

Still, using an internal reference is an interesting idea. Do you know if that would cause issues with the USD structure? Would that reference then show up in exported .usd files?
antc
Ashen
Would that reference then show up in exported .usd files?
It depends what branch you export. The LopImportCamera requires a lop node so you could have the node that's adding the reference live outside the branch you plan to export. You could also use a context option to switch off these kinds of extras during export.

One thing to watch for is if you have a more complex transform hierarchy above the camera. Referencing just the camera prim won't magically bring along the parent transforms (or any other inherited attributes) so make sure to reference the appropriate parent prim if needed.
cwhite
Using a primitive pattern will be supported for the LOP Import Camera node in the next major release.
(If there are multiple matches, a warning will be issued and one of the primitives will be chosen)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB