How to remove a sublayer

   743   5   1
User Avatar
Member
3 posts
Joined: Jan. 2014
Offline
I'm trying to remove an incoming sublayer using Find Sublayers / Remove Found Sublayers as described in the docs for the Sublayer node. Is there any particular trick to the patterns that are accepted? I've tried things like "*mySublayer*", "*/mySublayer.usd", as well as the full path as displayed in the Scene Graph Layers panel. None of these seem to have any effect. The layer I want to remove does already exist on disk, so it seems like it should work despite the caveat in the docs.

I'm in 19.5.569 on linux. Thanks!
Edited by Alec Bartsch - Aug. 28, 2024 23:07:41
Alec Bartsch
User Avatar
Member
3 posts
Joined: Jan. 2014
Offline
Follow-up question: is "removing" a layer the same as "muting" it, under the hood? I was able to work around the problem by doing this in a Python Script LOP:

node = hou.pwd()
stage = node.editableStage()

stage.MuteLayer (node.evalParm("setsLayer"))

But it's not an ideal solution because of the way python LOPs sometimes cook and sometimes don't.
Alec Bartsch
User Avatar
Member
162 posts
Joined: Nov. 2016
Offline
Hi,

You can use the Configure Stage LOP to mute layers:



I haven't used it before but looks like it does what you are looking for.

Cheers!
User Avatar
Staff
4521 posts
Joined: July 2005
Offline
There was a bug in the sublayer removal code that made it not work in some cases where you want to remove multiple sublayers. This was fixed in 20.5, but the fix was not backported. But if you're only removing a single sublayer, then I would expect the Sublayer LOP to be up to the task.

Muting (conceptually) can have an equivalent effect, but goes about it in a very different way. In particular, muting information is not stored in the USD stage, so when you save the USD the muted layer will "come back", but a "removed" sublayer will stay removed. Further, muting with python the way you've done it there is completely unsupported in Solaris. It may appear to work for a little while, but will break at some point. The Configure Stage LOP can mute layers in a "Solaris friendly" way, if muting is in fact what you want to do, but layer muting doesn't support the use of wildcards in the layer path. You would need to explicitly specify the full path to the layer(s) you want to mute.
User Avatar
Member
3 posts
Joined: Jan. 2014
Offline
Ah interesting, so it sounds like "removing" is doing some kind of list-editing on the sublayers metadata? For my use case muting an explicit path is just fine, and Configure Stage is working great. Thanks Mark and cdordelly!

Just to confirm my understanding, if Sublayer were working as advertised then either a pattern like */set.usd or an explicit path should be ok?
Alec Bartsch
User Avatar
Staff
4521 posts
Joined: July 2005
Offline
Yes, "removing" is actually editing the layer metadata that lists the sublayers composed onto the stage. This may be a good or bad thing, depending on whether you want to modify the USD layer permanently, or just turn off the layer for the current Houdini session (in which case muting is probably the right approach).

And yes, sublayer removal should (and in 20.5 I would claim that it does) support patterns like "*/set.usd" or an explicit path.
  • Quick Links