Here you will find documentation on all the descriptions that Cinema 4D currently has. You can list them Alphabetically, by Type or Plugin . The sample Python and C++ code is automatically generated and in some cases may not be 100% correct. If something doesn't work then please refer to the official Cinema 4D SDK documentation for more information.

IDs and information for Xcelshader

Xcelshader

Attributes

  • ENGLISH NAME : CelShader
  • NAME : Xcelshader
  • INCLUDE : Mpreview
  • INCLUDE : Xbase
  • PATH : sketch/description/xcelshader.res
  • PLUGIN : sketch
  • MAXON online help (may not exist): XCELSHADER

Elements

ID UI Name Type Parameters Cycle
CELSHADER_SHADOW Shadow GRADIENT
COLOR
ICC_BASEDOCUMENT
CELSHADER_DIFFUSE Diffuse GRADIENT
COLOR
ICC_BASEDOCUMENT
CELSHADER_SPEC Specular GRADIENT
COLOR
ICC_BASEDOCUMENT
CELSHADER_ILLUM Illumination GRADIENT
ALPHA
ICC_BASEDOCUMENT
CELSHADER_BUMP UseBump BOOL  
CELSHADER_BACKFACE Backfacing BOOL  
CELSHADER_CAMERA Camera BOOL  
CELSHADER_LIGHTS Lights BOOL  
CELSHADER_SPECULAR Specular BOOL  
CELSHADER_ILLUMINATION Illumination BOOL  
CELSHADER_LIGHTSCOL UseLightColor BOOL  
CELSHADER_SHADOWS Shadows BOOL  
CELSHADER_SHADOWSTYPE Shadows LONG  
CELSHADER_SHADOWSTYPE_MULTIPLY Multiply
CELSHADER_SHADOWSTYPE_COLOR Color
CELSHADER_SHADOWSTYPE_LIGHTS LightShadow
CELSHADER_SHADOWSMODE Mode LONG  
CELSHADER_SHADOWSMODE_NORMAL Normal
CELSHADER_SHADOWSMODE_H Hue
CELSHADER_SHADOWSMODE_S Saturation
CELSHADER_SHADOWSMODE_V Value
CELSHADER_SHADOWSMODE_INV Invert BOOL  
CELSHADER_INCEXC UseLights LONG  
CELSHADER_INCEXC_INCLUDE Include
CELSHADER_INCEXC_EXCLUDE Exclude
CELSHADER_INCEXC_LIGHTS Lights IN_EXCLUDE
NUM_FLAGS 0
INIT_STATE 0
SEND_SELCHNGMSG 1

Example Code

The following code does not use the correct values when setting the data. You should check directly in C4D for the correct values that you should use in place of the ones that are shown. This code is just to show you how to access the values for getting and setting the parameters.

Python

import c4d
from c4d import gui
def main():
    shader = c4d.BaseShader(c4d.Xcelshader)
    
    #You can set parameters two different ways. 
    #First way              
    shader[c4d.CELSHADER_BUMP] = True
    shader[c4d.CELSHADER_BACKFACE] = True
    shader[c4d.CELSHADER_CAMERA] = True
    shader[c4d.CELSHADER_LIGHTS] = True
    shader[c4d.CELSHADER_SPECULAR] = True
    shader[c4d.CELSHADER_ILLUMINATION] = True
    shader[c4d.CELSHADER_LIGHTSCOL] = True
    shader[c4d.CELSHADER_SHADOWS] = True
    shader[c4d.CELSHADER_SHADOWSTYPE] = c4d.CELSHADER_SHADOWSTYPE_MULTIPLY
    shader[c4d.CELSHADER_SHADOWSMODE] = c4d.CELSHADER_SHADOWSMODE_NORMAL
    shader[c4d.CELSHADER_SHADOWSMODE_INV] = True
    shader[c4d.CELSHADER_INCEXC] = c4d.CELSHADER_INCEXC_INCLUDE
    
    #Second way, using the base container.
    bc = shader.GetDataInstance()
    bc.SetBool(c4d.CELSHADER_BUMP,True)
    bc.SetBool(c4d.CELSHADER_BACKFACE,True)
    bc.SetBool(c4d.CELSHADER_CAMERA,True)
    bc.SetBool(c4d.CELSHADER_LIGHTS,True)
    bc.SetBool(c4d.CELSHADER_SPECULAR,True)
    bc.SetBool(c4d.CELSHADER_ILLUMINATION,True)
    bc.SetBool(c4d.CELSHADER_LIGHTSCOL,True)
    bc.SetBool(c4d.CELSHADER_SHADOWS,True)
    bc.SetInt32(c4d.CELSHADER_SHADOWSTYPE,c4d.CELSHADER_SHADOWSTYPE_MULTIPLY)
    bc.SetInt32(c4d.CELSHADER_SHADOWSMODE,c4d.CELSHADER_SHADOWSMODE_NORMAL)
    bc.SetBool(c4d.CELSHADER_SHADOWSMODE_INV,True)
    bc.SetInt32(c4d.CELSHADER_INCEXC,c4d.CELSHADER_INCEXC_INCLUDE)

if __name__=='__main__':
    main()
             

C++

#include "c4d.h"
#include "../sketch/description/xcelshader.h"
void SampleFunction()
{
    BaseDocument *pDoc = GetActiveDocument();
    BaseShader *pShader = BaseShader::Alloc(Xcelshader);  
    
    //You can set parameters two different ways. 

    //First way              
    //Some objects do not store all their data in the container. You need to use GetParameter()/SetParameter() instead. 

    DESCFLAGS_SET flags = DESCFLAGS_SET_PARAM_SET;
    pShader->SetParameter(DescID(CELSHADER_BUMP),GeData(true),flags);
    pShader->SetParameter(DescID(CELSHADER_BACKFACE),GeData(true),flags);
    pShader->SetParameter(DescID(CELSHADER_CAMERA),GeData(true),flags);
    pShader->SetParameter(DescID(CELSHADER_LIGHTS),GeData(true),flags);
    pShader->SetParameter(DescID(CELSHADER_SPECULAR),GeData(true),flags);
    pShader->SetParameter(DescID(CELSHADER_ILLUMINATION),GeData(true),flags);
    pShader->SetParameter(DescID(CELSHADER_LIGHTSCOL),GeData(true),flags);
    pShader->SetParameter(DescID(CELSHADER_SHADOWS),GeData(true),flags);
    pShader->SetParameter(DescID(CELSHADER_SHADOWSTYPE),GeData(CELSHADER_SHADOWSTYPE_MULTIPLY),flags);
    pShader->SetParameter(DescID(CELSHADER_SHADOWSMODE),GeData(CELSHADER_SHADOWSMODE_NORMAL),flags);
    pShader->SetParameter(DescID(CELSHADER_SHADOWSMODE_INV),GeData(true),flags);
    pShader->SetParameter(DescID(CELSHADER_INCEXC),GeData(CELSHADER_INCEXC_INCLUDE),flags);
    pShader->Message(MSG_UPDATE);            

    //Second way, using the base container.
    BaseContainer *bc =     pShader->GetDataInstance();
    bc->SetBool(CELSHADER_BUMP,true);
    bc->SetBool(CELSHADER_BACKFACE,true);
    bc->SetBool(CELSHADER_CAMERA,true);
    bc->SetBool(CELSHADER_LIGHTS,true);
    bc->SetBool(CELSHADER_SPECULAR,true);
    bc->SetBool(CELSHADER_ILLUMINATION,true);
    bc->SetBool(CELSHADER_LIGHTSCOL,true);
    bc->SetBool(CELSHADER_SHADOWS,true);
    bc->SetInt32(CELSHADER_SHADOWSTYPE,CELSHADER_SHADOWSTYPE_MULTIPLY);
    bc->SetInt32(CELSHADER_SHADOWSMODE,CELSHADER_SHADOWSMODE_NORMAL);
    bc->SetBool(CELSHADER_SHADOWSMODE_INV,true);
    bc->SetInt32(CELSHADER_INCEXC,CELSHADER_INCEXC_INCLUDE);
    pShader->Message(MSG_UPDATE);                                                      
}
             

Gradients

This node has gradients. Gradients can manually be edited by calling the following code

Python


C++

           
#include "customgui_gradient.h"
CELSHADER_SHADOW
GeData data; pShader->GetParameter(DescID(CELSHADER_SHADOW),data,DESCFLAGS_GET_PARAM_GET)); Gradient *pGradient = (Gradient*)data.GetCustomDataType(CUSTOMDATATYPE_GRADIENT); if(pGradient) { //must be set before any knot is set pGradient->SetData(GRADIENT_MODE, GeData(GRADIENTMODE_ALPHA)); GradientKnot k1, k2; k1.col = Vector(0.0, 0.0, 1.0); k1.pos = 0.0; k2.col = 1.0; k2.pos = 1.0; pGradient->InsertKnot(k1); pGradient->InsertKnot(k2); } pShader->SetParameter(DescID(CELSHADER_SHADOW),data,DESCFLAGS_SET_PARAM_SET));
CELSHADER_DIFFUSE
pShader->GetParameter(DescID(CELSHADER_DIFFUSE),data,DESCFLAGS_GET_PARAM_GET));
CELSHADER_SPEC
pShader->GetParameter(DescID(CELSHADER_SPEC),data,DESCFLAGS_GET_PARAM_GET));
CELSHADER_ILLUM
pShader->GetParameter(DescID(CELSHADER_ILLUM),data,DESCFLAGS_GET_PARAM_GET));