Script to isolate parent layer without effecting children?

i found some floating around the forum but they all turn off all the other layers and turn on all the child layers. i’d like to just isolate based off the parent layer leaving the on/off state of the children untouched. kind of like OneLayerOn but only effecting top level layers. thanks in advance.

Hello - if I find a moment I’ll make you something.
@kleerkoat - you want to select a layer to show, and have any sub-layers of that layer keep whatever visibility they already have, correct?

-Pascal

yeah, it would only operate on the visibility of the top level layers, leaving all child layers untouched. thank you so much!

I don’t understand - turning off a parent layer is supposed to turn off the child layers. That’s one of it’s main functions…

sorry, i’ve been having a hard time explaining things lately.

i just want to select a top level layer and turn off all other top level layers without doing anything to sublayers.

@pascal did you happen to find time to cook something? ty :wink:

Yes, I am being stupid about one part though so not done - I’ll get to it later today…

-Pascal

1 Like

I guess I’m also being dumb here, but if you turn off all top level layers - which also turns off all their sublayers - What do you have left that’s visible? Just the current layer (which cannot be turned off)?

maybe this might help, see how i only want to turn off the top layers? have i confused you even more? lmao

go from this

to this

No, that’s what I thought - you need to make the desired top level layer current because it is not turned off, and all the other top level layers are.

@kleerkoat - it seems a bit clunky still, but see if this gets you what you want…

TopLayerOn.py (1.7 KB)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

-Pascal

hmmm, not quite, this turns off all the sublayers, i would like it to only turn off parent layers not effecting any child layers objects.

i’m imagining it like this:
select object
get objects top parent layer
set parent layer current
select all other parent layers,
turn off those parent layers

i appreciate this. thank you.

As I stated above, you can’t… Turning off a parent layer turns off all its child layers. They should remain with the split lightbulb though, so when the parent layer is turned back on, the children of that layer that were on before should turn back on.

Does the script below do anything like what you want? (I haven’t looked at Pascal’s version)

OneLayerTreeOn2.py (879 Bytes)

nailed it!

i can probably do this, but could it do it by picking an object instead of the dialog box to speed it up a little? thank you so much!

I think this should work…

OneLayerTreeOn3.py (953 Bytes)

nailed it!! thank you!