Solved How to add Layers Shader - C++


How to add Layers Shader that contain two layers (Bitmap shader and Hue/Saturation/Lightness effects) with HSL -100 %.

BaseMaterial *Mat = BaseMaterial::Alloc(Mmaterial);
if (!Mat)
	return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);

BaseContainer *Data = Mat->GetDataInstance();
if (!Data)
	return true;

BaseShader* bsXlayer = BaseShader::Alloc(Xlayer);
if (!bsXlayer)
	return false;



Hi mfersaoui, thanks for reaching out us.

With regard to your question, whilst it's actually possible to query for the layers belonging to a certain Layer Shader, it's not possible to programmatically add new layers with the current API implementation.

Here you can find an old discussion on the argument.

Best, Riccardo

Hi Riccardo,
Thank you, I will try to import my material from a scene file.


I have another question, is it possible to edit the Blur Offset and Blur Scale of shader via c++?



"Blur Offset" and "Blur Scale" are parameters of the BaseShader class, so you should be able to access these parameters like any other parameter; if in doubt, they should be available in the shader's BaseContainer. See xbase.h.


Thank you.