ZBrushCentral

Question: Trouble with Layers in ZScript

Hi Everyone. I’m writing a plug-in that needs to change layers value with code. So far I’m accessing the layers by name Tool:Layers:LayerName and it worked fine until I got more than 8 Layers. Then, the script started showing an error trying to access some layers (The ones not shown without scrolling). So I’m wondering if there’s another way to access a specific layer, or a way to make the code recognize the layer exist even if it’s not shown at the moment. I hope someone can help me. Thanks.

Layers are tricky. You need to set the scroll bar position so that the layer you want is at the top of the list. Then you can use the title of the Layer Intensity slider for the Layer path.

The attached script is for toggling record mode for the selected layer. I think it shows most of what you need to know for scripting layers.

ToggleRecord.txt (1.71 KB)ToggleRecord.txt (1.71 KB)

Thank you so much. Moving the scrollbar just before accesing the layer worked excelent.

This is aweome thanks gents. sadly if the layer names are duplicated then the scrollbar trick snags. I imported a bunch of shapes that had corrector shapes, but because a layer name can only be 15 lettters in length, it means than a lot of the layers got named the first part of the name only and became duplicates… sadness.

Try this script instead.ToggleLayers.txt (1.56 KB)

Awesome. Thanks Marcus!