using python Layerset - Generate Alpha option?
-
Hello everyone.
I am stuck at a dead end wall while working on python.
using python
Layerset
I want to turn on the Generate Alpha option.CallButton() and
I tried Layerset.SetMode (mode), etc.
Failed.====================================
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:
- Support Procedures: Scope of Support: Lines out the things we will do and what we will not do.
- Support Procedures: Confidential Data: Most questions should be accompanied by code but code cannot always be shared publicly. This section explains how to share code confidentially with Maxon.
- Forum Structure and Features: Lines out how the forum works.
- Structure of a Question: Lines out how to ask a good technical question. It is not mandatory to follow this exactly, but you should follow the idea of keeping things short and mentioning your primary question in a clear manner.
About your First Question
What you want to do is unfortunately not possible. The internal C++ implementation of
LayerSet
has two methods namedGetCalcAlpha
andSetCalcAlpha
. 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 theGet/SetCalcAlpha
methods use a privatebool
field on the internal interface and not any flags you could set from the public API.Cheers,
Ferdinand -
Thank you so much for your kind reply.
This is sad news for me.
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 ofLayerSetCustumGui
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 -