Layer Material Alpha - Not Possible in API?
-
I've looked all over and can't find a way to accomplish this - is it not at all possible to set the alpha/transparency of a layer's material via the Ruby API?
-
You cannot set a layer's "material".
You can set a layer's "color".
That "color" can have an alpha setting, so it can be seen as transparent.
Unfortunately this alpha setting is only accessible manually.
Trying to set it through the API will always default it to 255, although the RGB values are accessible ! -
Yeah, from what I've read, under the hood the layer DOES have a true material, but the API only allows access to the color via the layer.color command for some reason - I tried setting the alpha on the layer.color and you're right, it only affects the color and not the true material, forcing you to have to use the mouse like a pleb in order to get transparency in Color By Layer mode. I really, really wish there was a true layer.material method... or even a hack via my own routine to do it, but apparently not.
-
It's not long ago that
layer.color=...
was introduced.
But don't hold your breath for new methods...
I think that 'they' have other fish to fry... -
You could make a set of your desired layers, with various transparent colors [even textures?] etc, and then save that model as a 'template'.
Then if it's the default, when you open a new model it has those layers preset.
You could also write a simple script to import the otherwise empty 'template' SKP [note that it perhaps needs a cpoint so it 'exists' for import-purposes ?] - then if one of the layers with a preset color is 'missing' - e.g. it's been purged - you reimport things... -
I don't know - I may do something like that, but I probably won't. I have a new tool I made as part of my plugin and it creates a draw layer for different defined area types, and I just wanted it to have some level of transparency automatically so it didn't totally cover what may be underneath. But, I think I'll leave it alone for now. I just just figured I must have been missing something, as setting the layer appearance seems very... basic, to be a missing feature.
Advertisement