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 Xmg_color

Xmg_color

Attributes

  • ENGLISH NAME : MoGraphColorShader
  • NAME : Xmg_color
  • INCLUDE : Xbase
  • PATH : mograph/description/xmg_color.res
  • PLUGIN : mograph
  • MAXON online help (may not exist): XMG_COLOR

Elements

ID UI Name Type Parameters Cycle
MGCOLORSHADER_MODE Channel LONG  
MGCOLORSHADER_MODE_COLOR Color
MGCOLORSHADER_MODE_INDEXRATIO IndexRatio
MGCOLORSHADER_INVERT InvertOutput BOOL  
MGCOLORSHADER_SPLINE Spline SPLINE
SHOWGRID_H
SHOWGRID_V
MINSIZE_H 120
MINSIZE_V 90
EDIT_H
EDIT_V
X_MIN 0
X_MAX 1
Y_MIN 0
Y_MAX 1
X_STEPS 1
Y_STEPS 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.Xmg_color)
    
    #You can set parameters two different ways. 
    #First way              
    shader[c4d.MGCOLORSHADER_MODE] = c4d.MGCOLORSHADER_MODE_COLOR
    shader[c4d.MGCOLORSHADER_INVERT] = True
    
    #Second way, using the base container.
    bc = shader.GetDataInstance()
    bc.SetInt32(c4d.MGCOLORSHADER_MODE,c4d.MGCOLORSHADER_MODE_COLOR)
    bc.SetBool(c4d.MGCOLORSHADER_INVERT,True)

if __name__=='__main__':
    main()
             

C++

#include "c4d.h"
#include "../mograph/description/xmg_color.h"
void SampleFunction()
{
    BaseDocument *pDoc = GetActiveDocument();
    BaseShader *pShader = BaseShader::Alloc(Xmg_color);  
    
    //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(MGCOLORSHADER_MODE),GeData(MGCOLORSHADER_MODE_COLOR),flags);
    pShader->SetParameter(DescID(MGCOLORSHADER_INVERT),GeData(true),flags);
    pShader->Message(MSG_UPDATE);            

    //Second way, using the base container.
    BaseContainer *bc =     pShader->GetDataInstance();
    bc->SetInt32(MGCOLORSHADER_MODE,MGCOLORSHADER_MODE_COLOR);
    bc->SetBool(MGCOLORSHADER_INVERT,true);
    pShader->Message(MSG_UPDATE);                                                      
}