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 Xpshader

Xpshader

Attributes

  • ENGLISH NAME : X-ParticleShader
  • NAME : Xpshader
  • INCLUDE : Mpreview
  • INCLUDE : Xbase
  • PATH : res/description/xpshader.res
  • PLUGIN : X-Particles
  • MAXON online help (may not exist): XPSHADER

Elements

ID UI Name Type Parameters Cycle
XSPR_EMITTER Emitter LINK  
XSPR_COLOR_MODE Mode LONG  
XSPR_MODE_PARTICLE UseParticleColor
XSPR_MODE_RANDOM RandomColor
XSPR_MODE_RANGRADIENT Random(fromGradient)
XSPR_MODE_PARAMDEP Parameter-Dependent
XSPR_MODE_USEMODVALUE ModifierSetsValue
XSPR_PARTICLE_GRADIENT ColorGradient GRADIENT
COLOR
ICC_BASEDOCUMENT
XSPR_PARTICLE_PARAMETER ParticleParameter LONG  
XSPR_PARAM_LIFE ParticleLife
XSPR_PARAM_AGE Age
XSPR_PARAM_AGERANGE AgeRange
XSPR_PARAM_SPEED Speed
XSPR_PARAM_SPEEDRANGE SpeedRange
XSPR_REVERSE_EFFECT InvertEffect BOOL  
XSPR_PARTICLE_AGE_MIN MinimumAge LONG
MIN 0
STEP 1
XSPR_PARTICLE_AGE_MAX MaximumAge LONG
MIN 0
STEP 1
XSPR_PARTICLE_SPEED_MIN MinimumSpeed REAL
STEP 1.0
UNIT METER
XSPR_PARTICLE_SPEED_MAX MaximumSpeed REAL
STEP 1.0
UNIT METER
XSPR_TEXTURE Texture SHADERLINK  
XSPR_PARTICLE_BLEND BlendMode LONG  
XSPR_BLEND_MULTIPLY Multiply
XSPR_BLEND_ADD Add
XSPR_BLEND_SUBTRACT Subtract
XSPR_HELP_BUTTON BITMAPBUTTON  
XSPR_VIDMAN_BUTTON BITMAPBUTTON  
XSPR_RESET ResettoDefaults BUTTON  

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.Xpshader)
    
    #You can set parameters two different ways. 
    #First way              
    shader[c4d.XSPR_COLOR_MODE] = c4d.XSPR_MODE_PARTICLE
    shader[c4d.XSPR_PARTICLE_PARAMETER] = c4d.XSPR_PARAM_LIFE
    shader[c4d.XSPR_REVERSE_EFFECT] = True
    shader[c4d.XSPR_PARTICLE_AGE_MIN] = 1
    shader[c4d.XSPR_PARTICLE_AGE_MAX] = 1
    shader[c4d.XSPR_PARTICLE_SPEED_MIN] = 0.1
    shader[c4d.XSPR_PARTICLE_SPEED_MAX] = 0.1
    shader[c4d.XSPR_PARTICLE_BLEND] = c4d.XSPR_BLEND_MULTIPLY
    
    #Second way, using the base container.
    bc = shader.GetDataInstance()
    bc.SetInt32(c4d.XSPR_COLOR_MODE,c4d.XSPR_MODE_PARTICLE)
    bc.SetInt32(c4d.XSPR_PARTICLE_PARAMETER,c4d.XSPR_PARAM_LIFE)
    bc.SetBool(c4d.XSPR_REVERSE_EFFECT,True)
    bc.SetInt32(c4d.XSPR_PARTICLE_AGE_MIN,1)
    bc.SetInt32(c4d.XSPR_PARTICLE_AGE_MAX,1)
    bc.SetFloat(c4d.XSPR_PARTICLE_SPEED_MIN,0.1)
    bc.SetFloat(c4d.XSPR_PARTICLE_SPEED_MAX,0.1)
    bc.SetInt32(c4d.XSPR_PARTICLE_BLEND,c4d.XSPR_BLEND_MULTIPLY)

if __name__=='__main__':
    main()
             

C++

#include "c4d.h"
#include "../res/description/xpshader.h"
void SampleFunction()
{
    BaseDocument *pDoc = GetActiveDocument();
    BaseShader *pShader = BaseShader::Alloc(Xpshader);  
    
    //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(XSPR_COLOR_MODE),GeData(XSPR_MODE_PARTICLE),flags);
    pShader->SetParameter(DescID(XSPR_PARTICLE_PARAMETER),GeData(XSPR_PARAM_LIFE),flags);
    pShader->SetParameter(DescID(XSPR_REVERSE_EFFECT),GeData(true),flags);
    pShader->SetParameter(DescID(XSPR_PARTICLE_AGE_MIN),GeData(1),flags);
    pShader->SetParameter(DescID(XSPR_PARTICLE_AGE_MAX),GeData(1),flags);
    pShader->SetParameter(DescID(XSPR_PARTICLE_SPEED_MIN),GeData(0.1),flags);
    pShader->SetParameter(DescID(XSPR_PARTICLE_SPEED_MAX),GeData(0.1),flags);
    pShader->SetParameter(DescID(XSPR_PARTICLE_BLEND),GeData(XSPR_BLEND_MULTIPLY),flags);
    pShader->Message(MSG_UPDATE);            

    //Second way, using the base container.
    BaseContainer *bc =     pShader->GetDataInstance();
    bc->SetInt32(XSPR_COLOR_MODE,XSPR_MODE_PARTICLE);
    bc->SetInt32(XSPR_PARTICLE_PARAMETER,XSPR_PARAM_LIFE);
    bc->SetBool(XSPR_REVERSE_EFFECT,true);
    bc->SetInt32(XSPR_PARTICLE_AGE_MIN,1);
    bc->SetInt32(XSPR_PARTICLE_AGE_MAX,1);
    bc->SetFloat(XSPR_PARTICLE_SPEED_MIN,0.1);
    bc->SetFloat(XSPR_PARTICLE_SPEED_MAX,0.1);
    bc->SetInt32(XSPR_PARTICLE_BLEND,XSPR_BLEND_MULTIPLY);
    pShader->Message(MSG_UPDATE);                                                      
}
             

Buttons

This node has buttons. Buttons can manually be executed by calling the following code

Python

c4d.CallButton(shader,c4d.XSPR_HELP_BUTTON)
c4d.CallButton(shader,c4d.XSPR_VIDMAN_BUTTON)
c4d.CallButton(shader,c4d.XSPR_RESET)

C++

DescriptionCommand dc;
dc.id = DescID(XSPR_HELP_BUTTON);             
pShader->Message(MSG_DESCRIPTION_COMMAND, &dc);

DescriptionCommand dc; dc.id = DescID(XSPR_VIDMAN_BUTTON); pShader->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc; dc.id = DescID(XSPR_RESET); pShader->Message(MSG_DESCRIPTION_COMMAND, &dc);

Gradients

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

Python


C++

           
#include "customgui_gradient.h"
XSPR_PARTICLE_GRADIENT
GeData data; pShader->GetParameter(DescID(XSPR_PARTICLE_GRADIENT),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(XSPR_PARTICLE_GRADIENT),data,DESCFLAGS_SET_PARAM_SET));