Unsolved using python Layerset - Generate Alpha option?

Hello everyone.

I am stuck at a dead end wall while working on python.

Checkbutton.png
using python
Layerset
I want to turn on the Generate Alpha option.

CallButton() and
I tried Layerset.SetMode (mode), etc.
Failed.

====================================
SDK.png

Thank you for your sincere help.

Hello @peter,

Welcome to the Plugin Café forum and the Cinema 4D development community, it is great to have you with us!

Getting Started

Before creating your next postings, we would recommend making yourself accustomed with our Forum and Support Guidelines, as they line out details about the Maxon SDK Group support procedures. Of special importance are:

About your First Question

What you want to do is unfortunately not possible. The internal C++ implementation of LayerSet has two methods named GetCalcAlpha and SetCalcAlpha. They have never been propagated to the public C++ class LayerSet and therefore also never have been exposed on the Python class of the same name. There is also no undocumented flag trickery you could do, as the Get/SetCalcAlpha methods use a private bool field on the internal interface and not any flags you could set from the public API.

Cheers,
Ferdinand

MAXON SDK Specialist
developers.maxon.net

@ferdinand

Thank you so much for your kind reply.

This is sad news for me.

Layer Name.png

If so, keep the settings fixed. Is there a way to change only the name assigned to the layer?

layerSet = c4d.LayerSet()
layerSet.SetMode(c4d.LAYERSETMODE_LAYERS)
layerSet.AddLayer('RL_Image\LHand\02_Seven')

The AddLayer( ) command resets the existing settings.

Hello @peter,

LayerSet is just the data type for the LayerSetCustumGui, which in turn is a shallow front-end for selecting layers in a c4d.bitmaps.MultipassBitmap. When you want to do any substantial work on layered bitmaps, e.g., rename layers, you will have to use that class. There you can of course also generate an alpha channel if you want to, but you won't have the full automatism of LayerSetCustumGui of just having to toggle a boolean. But doing that manually is also not really rocket science, just write an alpha channel from the RGB channel lightness values (plus some filtering if you want to apply any).

Cheers,
Ferdinand

MAXON SDK Specialist
developers.maxon.net

@ferdinand

Thanks for the advice.

i'm going to try Have a nice day today