Tdisplay
Attributes
-
ENGLISH NAME : DisplayTag
-
NAME : Tdisplay
-
INCLUDE : Tbase
-
PATH : c4dplugin/description/tdisplay.res
-
PLUGIN : c4dplugin
-
MAXON online help (may not exist): TDISPLAY
Elements
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():
obj = c4d.BaseObject(c4d.Osphere)
tag = obj.MakeTag(c4d.Tdisplay)
doc.InsertObject(obj)
c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
#You can set parameters two different ways.
#First way
tag[c4d.DISPLAYTAG_AFFECT_DISPLAYMODE] = True
tag[c4d.DISPLAYTAG_SDISPLAYMODE] = c4d.DISPLAYTAG_SDISPLAY_GOURAUD
tag[c4d.DISPLAYTAG_WDISPLAYMODE] = c4d.DISPLAYTAG_WDISPLAY_WIREFRAME
tag[c4d.DISPLAYTAG_VDISPLAYMODE] = c4d.DISPLAYTAG_VDISPLAY_DIRECTION
tag[c4d.DISPLAYTAG_AFFECT_LEVELOFDETAIL] = True
tag[c4d.DISPLAYTAG_LEVELOFDETAIL] = 0.1
tag[c4d.DISPLAYTAG_AFFECT_VISIBILITY] = True
tag[c4d.DISPLAYTAG_VISIBILITY] = 0.1
tag[c4d.DISPLAYTAG_AFFECT_BACKFACECULLING] = True
tag[c4d.DISPLAYTAG_BACKFACECULLING] = True
tag[c4d.DISPLAYTAG_AFFECT_TEXTURES] = True
tag[c4d.DISPLAYTAG_TEXTURES] = True
tag[c4d.DISPLAYTAG_AFFECT_REFLECTIONS] = True
tag[c4d.DISPLAYTAG_REFLECTIONS] = True
tag[c4d.DISPLAYTAG_AFFECT_TESSELLATION] = True
tag[c4d.DISPLAYTAG_TESSELLATION] = True
tag[c4d.ONION_USE] = True
tag[c4d.ONION_MODE] = c4d.ONION_MODE_OBJECT
tag[c4d.ONION_SCALE] = 0.1
tag[c4d.ONION_PSIZE] = 1
tag[c4d.ONION_DISPLAYMODE] = c4d.ONION_DISPLAY_GOURAUD
tag[c4d.ONION_XRAY] = True
tag[c4d.ONION_FRAMES_BEFORE] = 1
tag[c4d.ONION_FRAMES_AFTER] = 1
tag[c4d.ONION_FRAMES_STEP] = 1
tag[c4d.ONION_ONLY_RANGE] = True
tag[c4d.ONION_USE_KEYS] = True
tag[c4d.ONION_KEYS_BEFORE] = 1
tag[c4d.ONION_KEYS_AFTER] = 1
tag[c4d.ONION_USE_CUSTOM] = True
tag[c4d.ONION_CUSTOM] = "Hello World"
tag[c4d.ONION_CACHE] = True
#Second way, using the base container.
bc = tag.GetDataInstance()
bc.SetBool(c4d.DISPLAYTAG_AFFECT_DISPLAYMODE,True)
bc.SetInt32(c4d.DISPLAYTAG_SDISPLAYMODE,c4d.DISPLAYTAG_SDISPLAY_GOURAUD)
bc.SetInt32(c4d.DISPLAYTAG_WDISPLAYMODE,c4d.DISPLAYTAG_WDISPLAY_WIREFRAME)
bc.SetInt32(c4d.DISPLAYTAG_VDISPLAYMODE,c4d.DISPLAYTAG_VDISPLAY_DIRECTION)
bc.SetBool(c4d.DISPLAYTAG_AFFECT_LEVELOFDETAIL,True)
bc.SetFloat(c4d.DISPLAYTAG_LEVELOFDETAIL,0.1)
bc.SetBool(c4d.DISPLAYTAG_AFFECT_VISIBILITY,True)
bc.SetFloat(c4d.DISPLAYTAG_VISIBILITY,0.1)
bc.SetBool(c4d.DISPLAYTAG_AFFECT_BACKFACECULLING,True)
bc.SetBool(c4d.DISPLAYTAG_BACKFACECULLING,True)
bc.SetBool(c4d.DISPLAYTAG_AFFECT_TEXTURES,True)
bc.SetBool(c4d.DISPLAYTAG_TEXTURES,True)
bc.SetBool(c4d.DISPLAYTAG_AFFECT_REFLECTIONS,True)
bc.SetBool(c4d.DISPLAYTAG_REFLECTIONS,True)
bc.SetBool(c4d.DISPLAYTAG_AFFECT_TESSELLATION,True)
bc.SetBool(c4d.DISPLAYTAG_TESSELLATION,True)
bc.SetBool(c4d.ONION_USE,True)
bc.SetInt32(c4d.ONION_MODE,c4d.ONION_MODE_OBJECT)
bc.SetFloat(c4d.ONION_SCALE,0.1)
bc.SetInt32(c4d.ONION_PSIZE,1)
bc.SetInt32(c4d.ONION_DISPLAYMODE,c4d.ONION_DISPLAY_GOURAUD)
bc.SetBool(c4d.ONION_XRAY,True)
bc.SetInt32(c4d.ONION_FRAMES_BEFORE,1)
bc.SetInt32(c4d.ONION_FRAMES_AFTER,1)
bc.SetInt32(c4d.ONION_FRAMES_STEP,1)
bc.SetBool(c4d.ONION_ONLY_RANGE,True)
bc.SetBool(c4d.ONION_USE_KEYS,True)
bc.SetInt32(c4d.ONION_KEYS_BEFORE,1)
bc.SetInt32(c4d.ONION_KEYS_AFTER,1)
bc.SetBool(c4d.ONION_USE_CUSTOM,True)
bc.SetString(c4d.ONION_CUSTOM,"Hello World")
bc.SetBool(c4d.ONION_CACHE,True)
if __name__=='__main__':
main()
C++
#include "c4d.h"
#include "../c4dplugin/description/tdisplay.h"
void SampleFunction()
{
BaseDocument *pDoc = GetActiveDocument();
BaseObject *pObject = BaseObject::Alloc(Osphere);
pDoc->InsertObject(pObject);
pDoc->StartUndo();
pDoc->AddUndo(UNDOTYPE_NEW,pObject);
pDoc->EndUndo();
pDoc->StartUndo();
BaseTag *pTag = pObject->MakeTag(Tdisplay);
pDoc->AddUndo(UNDOTYPE_NEW,pTag);
pDoc->EndUndo();
pObject->Message(MSG_UPDATE);
//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;
pTag->SetParameter(DescID(DISPLAYTAG_AFFECT_DISPLAYMODE),GeData(true),flags);
pTag->SetParameter(DescID(DISPLAYTAG_SDISPLAYMODE),GeData(DISPLAYTAG_SDISPLAY_GOURAUD),flags);
pTag->SetParameter(DescID(DISPLAYTAG_WDISPLAYMODE),GeData(DISPLAYTAG_WDISPLAY_WIREFRAME),flags);
pTag->SetParameter(DescID(DISPLAYTAG_VDISPLAYMODE),GeData(DISPLAYTAG_VDISPLAY_DIRECTION),flags);
pTag->SetParameter(DescID(DISPLAYTAG_AFFECT_LEVELOFDETAIL),GeData(true),flags);
pTag->SetParameter(DescID(DISPLAYTAG_LEVELOFDETAIL),GeData(0.1),flags);
pTag->SetParameter(DescID(DISPLAYTAG_AFFECT_VISIBILITY),GeData(true),flags);
pTag->SetParameter(DescID(DISPLAYTAG_VISIBILITY),GeData(0.1),flags);
pTag->SetParameter(DescID(DISPLAYTAG_AFFECT_BACKFACECULLING),GeData(true),flags);
pTag->SetParameter(DescID(DISPLAYTAG_BACKFACECULLING),GeData(true),flags);
pTag->SetParameter(DescID(DISPLAYTAG_AFFECT_TEXTURES),GeData(true),flags);
pTag->SetParameter(DescID(DISPLAYTAG_TEXTURES),GeData(true),flags);
pTag->SetParameter(DescID(DISPLAYTAG_AFFECT_REFLECTIONS),GeData(true),flags);
pTag->SetParameter(DescID(DISPLAYTAG_REFLECTIONS),GeData(true),flags);
pTag->SetParameter(DescID(DISPLAYTAG_AFFECT_TESSELLATION),GeData(true),flags);
pTag->SetParameter(DescID(DISPLAYTAG_TESSELLATION),GeData(true),flags);
pTag->SetParameter(DescID(ONION_USE),GeData(true),flags);
pTag->SetParameter(DescID(ONION_MODE),GeData(ONION_MODE_OBJECT),flags);
pTag->SetParameter(DescID(ONION_SCALE),GeData(0.1),flags);
pTag->SetParameter(DescID(ONION_PSIZE),GeData(1),flags);
pTag->SetParameter(DescID(ONION_DISPLAYMODE),GeData(ONION_DISPLAY_GOURAUD),flags);
pTag->SetParameter(DescID(ONION_XRAY),GeData(true),flags);
pTag->SetParameter(DescID(ONION_FRAMES_BEFORE),GeData(1),flags);
pTag->SetParameter(DescID(ONION_FRAMES_AFTER),GeData(1),flags);
pTag->SetParameter(DescID(ONION_FRAMES_STEP),GeData(1),flags);
pTag->SetParameter(DescID(ONION_ONLY_RANGE),GeData(true),flags);
pTag->SetParameter(DescID(ONION_USE_KEYS),GeData(true),flags);
pTag->SetParameter(DescID(ONION_KEYS_BEFORE),GeData(1),flags);
pTag->SetParameter(DescID(ONION_KEYS_AFTER),GeData(1),flags);
pTag->SetParameter(DescID(ONION_USE_CUSTOM),GeData(true),flags);
pTag->SetParameter(DescID(ONION_CUSTOM),GeData("Hello World"),flags);
pTag->SetParameter(DescID(ONION_CACHE),GeData(true),flags);
pTag->Message(MSG_UPDATE);
//Second way, using the base container.
BaseContainer *bc = pTag->GetDataInstance();
bc->SetBool(DISPLAYTAG_AFFECT_DISPLAYMODE,true);
bc->SetInt32(DISPLAYTAG_SDISPLAYMODE,DISPLAYTAG_SDISPLAY_GOURAUD);
bc->SetInt32(DISPLAYTAG_WDISPLAYMODE,DISPLAYTAG_WDISPLAY_WIREFRAME);
bc->SetInt32(DISPLAYTAG_VDISPLAYMODE,DISPLAYTAG_VDISPLAY_DIRECTION);
bc->SetBool(DISPLAYTAG_AFFECT_LEVELOFDETAIL,true);
bc->SetFloat(DISPLAYTAG_LEVELOFDETAIL,0.1);
bc->SetBool(DISPLAYTAG_AFFECT_VISIBILITY,true);
bc->SetFloat(DISPLAYTAG_VISIBILITY,0.1);
bc->SetBool(DISPLAYTAG_AFFECT_BACKFACECULLING,true);
bc->SetBool(DISPLAYTAG_BACKFACECULLING,true);
bc->SetBool(DISPLAYTAG_AFFECT_TEXTURES,true);
bc->SetBool(DISPLAYTAG_TEXTURES,true);
bc->SetBool(DISPLAYTAG_AFFECT_REFLECTIONS,true);
bc->SetBool(DISPLAYTAG_REFLECTIONS,true);
bc->SetBool(DISPLAYTAG_AFFECT_TESSELLATION,true);
bc->SetBool(DISPLAYTAG_TESSELLATION,true);
bc->SetBool(ONION_USE,true);
bc->SetInt32(ONION_MODE,ONION_MODE_OBJECT);
bc->SetFloat(ONION_SCALE,0.1);
bc->SetInt32(ONION_PSIZE,1);
bc->SetInt32(ONION_DISPLAYMODE,ONION_DISPLAY_GOURAUD);
bc->SetBool(ONION_XRAY,true);
bc->SetInt32(ONION_FRAMES_BEFORE,1);
bc->SetInt32(ONION_FRAMES_AFTER,1);
bc->SetInt32(ONION_FRAMES_STEP,1);
bc->SetBool(ONION_ONLY_RANGE,true);
bc->SetBool(ONION_USE_KEYS,true);
bc->SetInt32(ONION_KEYS_BEFORE,1);
bc->SetInt32(ONION_KEYS_AFTER,1);
bc->SetBool(ONION_USE_CUSTOM,true);
bc->SetString(ONION_CUSTOM,"Hello World");
bc->SetBool(ONION_CACHE,true);
pTag->Message(MSG_UPDATE);
}
Buttons
This node has buttons. Buttons can manually be executed by calling the following code
Python
c4d.CallButton(tag,c4d.ONION_CALCULATE)
c4d.CallButton(tag,c4d.ONION_DELCACHE)
C++
DescriptionCommand dc;
dc.id = DescID(ONION_CALCULATE);
pTag->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(ONION_DELCACHE);
pTag->Message(MSG_DESCRIPTION_COMMAND, &dc);