Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

Access BodyPaint Layer (BPLayer) Opacity

 Post Reply Post Reply
Author
Message
kbar View Drop Down
Member
Member
Avatar

Joined: 2009 Feb 12
Location: New Zealand
Online Status: Online
Posts: 53
Post Options Post Options   Quote kbar Quote  Post ReplyReply Direct Link To This Post Topic: Access BodyPaint Layer (BPLayer) Opacity
    Posted: 2017 May 11 at 11:20pm

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
Back to Top
S_Bach View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2011 Jun 27
Online Status: Offline
Posts: 1285
Post Options Post Options   Quote S_Bach Quote  Post ReplyReply Direct Link To This Post Posted: 2017 May 15 at 3:02am
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
SDK Support Engineer
Back to Top
kbar View Drop Down
Member
Member
Avatar

Joined: 2009 Feb 12
Location: New Zealand
Online Status: Online
Posts: 53
Post Options Post Options   Quote kbar Quote  Post ReplyReply Direct Link To This Post Posted: 2017 May 15 at 2:23pm
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.
Back to Top
kbar View Drop Down
Member
Member
Avatar

Joined: 2009 Feb 12
Location: New Zealand
Online Status: Online
Posts: 53
Post Options Post Options   Quote kbar Quote  Post ReplyReply Direct Link To This Post Posted: 2017 May 26 at 6:14pm
Just a follow up on this. Totally my own fault. I was missing an EventAdd();

Silly mistake on my part. Thanks for testing.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.