Jump to content

LOP question! How to make a switch-if in solaris


Recommended Posts

Hello!

I'm doing my own implemantation of a LOD system in LOP that need to ingest a lot of primitives automaticaly. This is for a terrain system.

In sop, I will have multiple tiles that will have different resolution (and so, different LOD) available.

My idea, in solaris, is with multiple for loop, it will go to each tile, for each LOD, and then try to import the corresponding tile's LOD, if the LOD primitive exist in the scene graph, add it to a variant set named LOD.

What I don't want is to have empty variants in the set with no geometry.

 

 

So far, everything works except the filtering. I can't find an expression that test correctly the presence of the prim to put in a switch. (and make a switch-if, like in sop)

I've tried a python node that test the prim existence and write a Context Variable that can be used by the switch. It doesn't seem to work. I tried to use that same python script to directly change the switch parameter. It has very inconsistent results and I would prefer to avoid this solution.

Right now, I have stumble upon this webpage (https://openusd.org/docs/Authoring-Variants.html) to create my own variant in python. But it seems overkill for my need.

Another possibility is to create all variants, then go back and remove the empty ones. But for some reasons, REMOVING variants is not documented anywhere I've look, only adding.

 

Can someone with a better understang of solaris help me? That would be very appreciated!

Link to comment
Share on other sites

Found a work around with expression.

The function loplastmodifiedprim(<lop_path>) return the last modified prim of any node.

So if one drops a generic node that does nothing (editproperties by exemple) but has a lop primitive selection field. One can put the path of the primitive that one want to test in the selection field. Then use the function on the node. If the primitive is valid, it will return the path of the prim, if it is invalid (the prim doesnt exist) it will return an empty string

Then with a simple strlength(<string>) one get a numerical that can drive the input switch.

 

And it works way better than the python script that drive the switch.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...