On 11/05/2017 at 23:20, xxxxxxxx wrote:
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.
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.
On 15/05/2017 at 03:02, xxxxxxxx wrote:
at least in R18, setting ID_PAINTLAYER_OPACITY seems to work fine:
// get texture
PaintTexture* texture = PaintTexture::GetSelectedTexture();
// get layer
PaintLayer* layer = texture->GetFirstLayer();
// change opacity
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);
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.
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.