Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    using python Layerset - Generate Alpha option?

    Cinema 4D SDK
    python sdk
    2
    5
    781
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      peter
      last edited by

      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.

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @peter
        last edited by ferdinand

        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 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

        P 1 Reply Last reply Reply Quote 1
        • P
          peter @ferdinand
          last edited by peter

          @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.

          ferdinandF 1 Reply Last reply Reply Quote 0
          • ferdinandF
            ferdinand @peter
            last edited by ferdinand

            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

            P 1 Reply Last reply Reply Quote 1
            • P
              peter @ferdinand
              last edited by

              @ferdinand

              Thanks for the advice.

              i'm going to try Have a nice day today

              1 Reply Last reply Reply Quote 0
              • First post
                Last post