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 Xspotshader

Xspotshader

Attributes

  • ENGLISH NAME : SpotsShader
  • NAME : Xspotshader
  • INCLUDE : Mpreview
  • INCLUDE : Xbase
  • PATH : sketch/description/xspotshader.res
  • PLUGIN : sketch
  • MAXON online help (may not exist): XSPOTSHADER

Elements

ID UI Name Type Parameters Cycle
SPOTSHADER_GAP_SHAPE Shape LONG DEFAULT
SPOTSHADER_GAP_SHAPE_CIRCLE Circle
SPOTSHADER_GAP_SHAPE_DIAMOND Diamond
SPOTSHADER_GAP_SHAPE_CHECKER Checker
SPOTSHADER_GAP_SHAPE_SQUARE Square
SPOTSHADER_GAP_SHAPE_ULINES LinesU
SPOTSHADER_GAP_SHAPE_VLINES LinesV
SPOTSHADER_GAP_SHAPE_GRID Grid
SPOTSHADER_GAP_SHAPE_TEXTURE Texture
SPOTSHADER_GAP_TEXTURE Texture SHADERLINK  
SPOTSHADER_GAP_COLOR GapColor COLOR OPEN
SPOTSHADER_CIRCLE_COLOR SpotColor COLOR OPEN
SPOTSHADER_SCALE Scale REAL
UNIT PERCENT
MIN 0.0
SPOTSHADER_SCALE_U U REAL
UNIT PERCENT
MIN 0.0
SPOTSHADER_SCALE_V V REAL
UNIT PERCENT
MIN 0.0
SPOTSHADER_ROTATE Rotate REAL
UNIT DEGREE
MIN 0.0
MAX 360.0
SPOTSHADER_SHADOW Shadow GRADIENT
ALPHA
ICC_BASEDOCUMENT
SPOTSHADER_DIFFUSE Diffuse GRADIENT
ALPHA
ICC_BASEDOCUMENT
SPOTSHADER_SPEC Specular GRADIENT
ALPHA
ICC_BASEDOCUMENT
SPOTSHADER_ILLUM Illumination GRADIENT
ALPHA
ICC_BASEDOCUMENT
SPOTSHADER_CAMERA Camera BOOL  
SPOTSHADER_LIGHTS Lights BOOL  
SPOTSHADER_SPECULAR Specular BOOL  
SPOTSHADER_ILLUMINATION Illumination BOOL  
SPOTSHADER_SHADOWS Shadows BOOL  
SPOTSHADER_INVERT Invert BOOL  
SPOTSHADER_INCEXC UseLights LONG  
SPOTSHADER_INCEXC_INCLUDE Include
SPOTSHADER_INCEXC_EXCLUDE Exclude
SPOTSHADER_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.Xspotshader)
    
    #You can set parameters two different ways. 
    #First way              
    shader[c4d.SPOTSHADER_GAP_SHAPE] = c4d.SPOTSHADER_GAP_SHAPE_CIRCLE
    shader[c4d.SPOTSHADER_SCALE] = 0.1
    shader[c4d.SPOTSHADER_SCALE_U] = 0.1
    shader[c4d.SPOTSHADER_SCALE_V] = 0.1
    shader[c4d.SPOTSHADER_ROTATE] = 0.1
    shader[c4d.SPOTSHADER_CAMERA] = True
    shader[c4d.SPOTSHADER_LIGHTS] = True
    shader[c4d.SPOTSHADER_SPECULAR] = True
    shader[c4d.SPOTSHADER_ILLUMINATION] = True
    shader[c4d.SPOTSHADER_SHADOWS] = True
    shader[c4d.SPOTSHADER_INVERT] = True
    shader[c4d.SPOTSHADER_INCEXC] = c4d.SPOTSHADER_INCEXC_INCLUDE
    
    #Second way, using the base container.
    bc = shader.GetDataInstance()
    bc.SetInt32(c4d.SPOTSHADER_GAP_SHAPE,c4d.SPOTSHADER_GAP_SHAPE_CIRCLE)
    bc.SetFloat(c4d.SPOTSHADER_SCALE,0.1)
    bc.SetFloat(c4d.SPOTSHADER_SCALE_U,0.1)
    bc.SetFloat(c4d.SPOTSHADER_SCALE_V,0.1)
    bc.SetFloat(c4d.SPOTSHADER_ROTATE,0.1)
    bc.SetBool(c4d.SPOTSHADER_CAMERA,True)
    bc.SetBool(c4d.SPOTSHADER_LIGHTS,True)
    bc.SetBool(c4d.SPOTSHADER_SPECULAR,True)
    bc.SetBool(c4d.SPOTSHADER_ILLUMINATION,True)
    bc.SetBool(c4d.SPOTSHADER_SHADOWS,True)
    bc.SetBool(c4d.SPOTSHADER_INVERT,True)
    bc.SetInt32(c4d.SPOTSHADER_INCEXC,c4d.SPOTSHADER_INCEXC_INCLUDE)

if __name__=='__main__':
    main()
             

C++

#include "c4d.h"
#include "../sketch/description/xspotshader.h"
void SampleFunction()
{
    BaseDocument *pDoc = GetActiveDocument();
    BaseShader *pShader = BaseShader::Alloc(Xspotshader);  
    
    //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(SPOTSHADER_GAP_SHAPE),GeData(SPOTSHADER_GAP_SHAPE_CIRCLE),flags);
    pShader->SetParameter(DescID(SPOTSHADER_SCALE),GeData(0.1),flags);
    pShader->SetParameter(DescID(SPOTSHADER_SCALE_U),GeData(0.1),flags);
    pShader->SetParameter(DescID(SPOTSHADER_SCALE_V),GeData(0.1),flags);
    pShader->SetParameter(DescID(SPOTSHADER_ROTATE),GeData(0.1),flags);
    pShader->SetParameter(DescID(SPOTSHADER_CAMERA),GeData(true),flags);
    pShader->SetParameter(DescID(SPOTSHADER_LIGHTS),GeData(true),flags);
    pShader->SetParameter(DescID(SPOTSHADER_SPECULAR),GeData(true),flags);
    pShader->SetParameter(DescID(SPOTSHADER_ILLUMINATION),GeData(true),flags);
    pShader->SetParameter(DescID(SPOTSHADER_SHADOWS),GeData(true),flags);
    pShader->SetParameter(DescID(SPOTSHADER_INVERT),GeData(true),flags);
    pShader->SetParameter(DescID(SPOTSHADER_INCEXC),GeData(SPOTSHADER_INCEXC_INCLUDE),flags);
    pShader->Message(MSG_UPDATE);            

    //Second way, using the base container.
    BaseContainer *bc =     pShader->GetDataInstance();
    bc->SetInt32(SPOTSHADER_GAP_SHAPE,SPOTSHADER_GAP_SHAPE_CIRCLE);
    bc->SetFloat(SPOTSHADER_SCALE,0.1);
    bc->SetFloat(SPOTSHADER_SCALE_U,0.1);
    bc->SetFloat(SPOTSHADER_SCALE_V,0.1);
    bc->SetFloat(SPOTSHADER_ROTATE,0.1);
    bc->SetBool(SPOTSHADER_CAMERA,true);
    bc->SetBool(SPOTSHADER_LIGHTS,true);
    bc->SetBool(SPOTSHADER_SPECULAR,true);
    bc->SetBool(SPOTSHADER_ILLUMINATION,true);
    bc->SetBool(SPOTSHADER_SHADOWS,true);
    bc->SetBool(SPOTSHADER_INVERT,true);
    bc->SetInt32(SPOTSHADER_INCEXC,SPOTSHADER_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"
SPOTSHADER_SHADOW
GeData data; pShader->GetParameter(DescID(SPOTSHADER_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(SPOTSHADER_SHADOW),data,DESCFLAGS_SET_PARAM_SET));
SPOTSHADER_DIFFUSE
pShader->GetParameter(DescID(SPOTSHADER_DIFFUSE),data,DESCFLAGS_GET_PARAM_GET));
SPOTSHADER_SPEC
pShader->GetParameter(DescID(SPOTSHADER_SPEC),data,DESCFLAGS_GET_PARAM_GET));
SPOTSHADER_ILLUM
pShader->GetParameter(DescID(SPOTSHADER_ILLUM),data,DESCFLAGS_GET_PARAM_GET));