Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Access BodyPaint Layer (BPLayer) Opacity

    SDK Help
    0
    4
    530
    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.
    • H
      Helper
      last edited by

      On 11/05/2017 at 23:20, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R17, R18 
      Platform:   Windows  ;   Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      Is there any way to access the opacity of a BodyPaint layer? I have tried reading the ID_PAINTLAYER_OPACITY value from the BaseContainer as well as GetParameter but it doesn't seem to work.

      For reference here is where the ID_PAINTLAYER_OPACITY is defined.

      http://www.gamelogicdesign.com/Description/Node?containerName=BPlayer

      And although I haven't tried it yet, since opacity didn't work, I would also like to access ID_PAINTLAYER_BLEND as well.

      Ideally I would like to be able to both read and write these values.

      Cheers,
      Kent

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 15/05/2017 at 03:02, xxxxxxxx wrote:

        Hello,

        at least in R18, setting ID_PAINTLAYER_OPACITY seems to work fine:

          
        // get texture  
        PaintTexture* texture = PaintTexture::GetSelectedTexture();  
        if (!texture)  
         return false;  
          
        // get layer  
        PaintLayer* layer = texture->GetFirstLayer();  
        if (!layer)  
         return false;  
          
        // change opacity  
          
        GeData data;  
        layer->GetParameter(ID_PAINTLAYER_OPACITY, data, DESCFLAGS_GET_0);  
          
        Float opacity = data.GetFloat();  
        opacity = opacity* 2.0;  
          
        layer->SetParameter(ID_PAINTLAYER_OPACITY, opacity, DESCFLAGS_SET_0);  
          
        // set blend mode  
        layer->SetParameter(ID_PAINTLAYER_BLEND, LAYER_MULTIPLY, DESCFLAGS_SET_0);  
          
          
        EventAdd();  
        

        best wishes,
        Sebastian

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 15/05/2017 at 14:23, xxxxxxxx wrote:

          I have only been testing with R17 so far. Great to know that its working in R18. My code was doing the exact same thing as what you have there. I will double check this all again, but its good to know that its working for you in R18.

          Cheers.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 26/05/2017 at 18:14, xxxxxxxx wrote:

            Just a follow up on this. Totally my own fault. I was missing an EventAdd();

            Silly mistake on my part. Thanks for testing.

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