Python API - Sop Import

   1538   2   0
User Avatar
Member
39 posts
Joined: Jan. 2012
Offline
I am looking to create references to SOP geometry in LOPS using the python API and a Python LOP, and am having issues with the “op:” syntax and resolving the path.

Here is a small snippet of what I am doing.
assets = ["foo", "baa"]
sop_paths = ["/stage/primitives/my_foo", "/stage/primitives/my_baa"]

base_prim = stage.DefinePrim('/base_prim', 'Xform')

for i in range(len(assets)):
    base_prim.GetPrim().GetReferences().AddReferences(sop_paths[i])


I can see when I use a sop_import_lop and inspect the stage the references(payloads) are using the op: syntax
@op:/stage/primitives/my_foo.sop:SDF_FORMAT_ARGS:globalauthortimesamples=0&pathprefix=/sopimport1&t=7.125@

I have tried some string formatting to match the above, but it feels very ugly and potentially dangerous.
"op:{}.sop:SDF_FORMAT_ARGS:globalauthortimesamples=0&pathprefix=/sopimport1&t=7.125".format(sop_paths[i])


The reasoning behind doing this programatically, is it will feed into some much larger import logic including variants/purpose, and is currently pure python API.

Cheers,
Aaron.
www.aaronauty.com
User Avatar
Staff
4444 posts
Joined: July 2005
Offline
The SOP Import LOP does more than just create a reference/sublayer to an “op:” path. You cannot do the equivalent with a Python LOP. But it's easy to use a For Each LOP to iterate over a series of SOP paths.
User Avatar
Member
39 posts
Joined: Jan. 2012
Offline
I thought that might have been the case. The data has to come from somewhere.

I am playing with nested looping at the moment. Cheers.
www.aaronauty.com
  • Quick Links