On 29/08/2016 at 16:29, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R17
Platform: Windows ;
Language(s) : C++ ;
---------
So I have some code I've been hacking up here. I've loosely through trial and error and foum searches hacked together how to assign shaders in code, but the shader I'm working with now is a shader within a shader, I'm making assumptions assignment should be the same, but this doesn't appear to be the case.
if (_emissionShader) {
if (_emissionShader->GetType() == Xbitmap) {
// The renderer emission channel accept only one type of shader, the blah shader, within that you
// need to set the texture
BaseShader* soloShader = BaseShader::Alloc(ID_SOLO_SHADER);
BaseShader* shader = (BaseShader* )_emissionShader->GetClone(COPYFLAGS_0, nullptr);
soloShader->SetParameter(DescID(EFF_TEX_LINK), GeData(shader), DESCFLAGS_SET_0);
_newMaterial->SetParameter(DescID(EMISSION_SLOT), GeData(soloShader), DESCFLAGS_SET_0);
_newMaterial->InsertShader(soloShader);
_newMaterial->InsertShader(shader);
}
}
The Emission Channel has a slot that accepts a specifc shader, so I create that, then I get the clone of an Xbitmap I got from elsewhere. I set Solo Shader's Link field to the Xbitmap, then I set the emission channel to Solo shader itself. Inserting solo shader yields expected output, it is indeed linked, but inserting the Xbitmap doesn't make it appear in Solo Shader's interface.