Ttexture
Attributes
-
ENGLISH NAME : MaterialTag
-
NAME : Ttexture
-
INCLUDE : Tbase
-
PATH : c4dplugin/description/ttexture.res
-
PLUGIN : c4dplugin
-
MAXON online help (may not exist): TTEXTURE
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.Ttexture)
doc.InsertObject(obj)
c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
#You can set parameters two different ways.
#First way
tag[c4d.TEXTURETAG_RESTRICTION] = "Hello World"
tag[c4d.TEXTURETAG_PROJECTION] = c4d.TEXTURETAG_PROJECTION_SPHERICAL
tag[c4d.TEXTURETAG_PROJECTIONDISPLAY] = c4d.TEXTURETAG_PROJECTIONDISPLAY_NONE
tag[c4d.TEXTURETAG_SIDE] = c4d.TEXTURETAG_SIDE_FRONTANDBACK
tag[c4d.TEXTURETAG_CAMERA_FILMASPECT] = 0.1
tag[c4d.TEXTURETAG_CAMERA_FILMPRESET] = c4d.TEXTURETAG_CAMERA_FILMPRESET_CUSTOM
tag[c4d.TEXTURETAG_CAMERA_PIXELASPECT] = 0.1
tag[c4d.TEXTURETAG_CAMERA_PIXELPRESET] = c4d.TEXTURETAG_CAMERA_PIXELPRESET_CUSTOM
tag[c4d.TEXTURETAG_MIX] = True
tag[c4d.TEXTURETAG_TILE] = True
tag[c4d.TEXTURETAG_SEAMLESS] = True
tag[c4d.TEXTURETAG_UVBUMP] = True
tag[c4d.TEXTURETAG_OFFSETX] = 0.1
tag[c4d.TEXTURETAG_OFFSETY] = 0.1
tag[c4d.TEXTURETAG_LENGTHX] = 0.1
tag[c4d.TEXTURETAG_LENGTHY] = 0.1
tag[c4d.TEXTURETAG_TILESX] = 0.1
tag[c4d.TEXTURETAG_TILESY] = 0.1
tag[c4d.TEXTURETAG_REPETITIONX] = 0.1
tag[c4d.TEXTURETAG_REPETITIONY] = 0.1
tag[c4d.TEXTURETAG_POSITION] = c4d.Vector(1.0,1.0,1.0)
tag[c4d.TEXTURETAG_SIZE] = c4d.Vector(1.0,1.0,1.0)
tag[c4d.TEXTURETAG_ROTATION] = c4d.Vector(1.0,1.0,1.0)
#Second way, using the base container.
bc = tag.GetDataInstance()
bc.SetString(c4d.TEXTURETAG_RESTRICTION,"Hello World")
bc.SetInt32(c4d.TEXTURETAG_PROJECTION,c4d.TEXTURETAG_PROJECTION_SPHERICAL)
bc.SetInt32(c4d.TEXTURETAG_PROJECTIONDISPLAY,c4d.TEXTURETAG_PROJECTIONDISPLAY_NONE)
bc.SetInt32(c4d.TEXTURETAG_SIDE,c4d.TEXTURETAG_SIDE_FRONTANDBACK)
bc.SetFloat(c4d.TEXTURETAG_CAMERA_FILMASPECT,0.1)
bc.SetInt32(c4d.TEXTURETAG_CAMERA_FILMPRESET,c4d.TEXTURETAG_CAMERA_FILMPRESET_CUSTOM)
bc.SetFloat(c4d.TEXTURETAG_CAMERA_PIXELASPECT,0.1)
bc.SetInt32(c4d.TEXTURETAG_CAMERA_PIXELPRESET,c4d.TEXTURETAG_CAMERA_PIXELPRESET_CUSTOM)
bc.SetBool(c4d.TEXTURETAG_MIX,True)
bc.SetBool(c4d.TEXTURETAG_TILE,True)
bc.SetBool(c4d.TEXTURETAG_SEAMLESS,True)
bc.SetBool(c4d.TEXTURETAG_UVBUMP,True)
bc.SetFloat(c4d.TEXTURETAG_OFFSETX,0.1)
bc.SetFloat(c4d.TEXTURETAG_OFFSETY,0.1)
bc.SetFloat(c4d.TEXTURETAG_LENGTHX,0.1)
bc.SetFloat(c4d.TEXTURETAG_LENGTHY,0.1)
bc.SetFloat(c4d.TEXTURETAG_TILESX,0.1)
bc.SetFloat(c4d.TEXTURETAG_TILESY,0.1)
bc.SetFloat(c4d.TEXTURETAG_REPETITIONX,0.1)
bc.SetFloat(c4d.TEXTURETAG_REPETITIONY,0.1)
bc.SetVector(c4d.TEXTURETAG_POSITION, c4d.Vector(1.0,1.0,1.0)
bc.SetVector(c4d.TEXTURETAG_SIZE, c4d.Vector(1.0,1.0,1.0)
bc.SetVector(c4d.TEXTURETAG_ROTATION, c4d.Vector(1.0,1.0,1.0)
if __name__=='__main__':
main()
C++
#include "c4d.h"
#include "../c4dplugin/description/ttexture.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(Ttexture);
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(TEXTURETAG_RESTRICTION),GeData("Hello World"),flags);
pTag->SetParameter(DescID(TEXTURETAG_PROJECTION),GeData(TEXTURETAG_PROJECTION_SPHERICAL),flags);
pTag->SetParameter(DescID(TEXTURETAG_PROJECTIONDISPLAY),GeData(TEXTURETAG_PROJECTIONDISPLAY_NONE),flags);
pTag->SetParameter(DescID(TEXTURETAG_SIDE),GeData(TEXTURETAG_SIDE_FRONTANDBACK),flags);
pTag->SetParameter(DescID(TEXTURETAG_CAMERA_FILMASPECT),GeData(0.1),flags);
pTag->SetParameter(DescID(TEXTURETAG_CAMERA_FILMPRESET),GeData(TEXTURETAG_CAMERA_FILMPRESET_CUSTOM),flags);
pTag->SetParameter(DescID(TEXTURETAG_CAMERA_PIXELASPECT),GeData(0.1),flags);
pTag->SetParameter(DescID(TEXTURETAG_CAMERA_PIXELPRESET),GeData(TEXTURETAG_CAMERA_PIXELPRESET_CUSTOM),flags);
pTag->SetParameter(DescID(TEXTURETAG_MIX),GeData(true),flags);
pTag->SetParameter(DescID(TEXTURETAG_TILE),GeData(true),flags);
pTag->SetParameter(DescID(TEXTURETAG_SEAMLESS),GeData(true),flags);
pTag->SetParameter(DescID(TEXTURETAG_UVBUMP),GeData(true),flags);
pTag->SetParameter(DescID(TEXTURETAG_OFFSETX),GeData(0.1),flags);
pTag->SetParameter(DescID(TEXTURETAG_OFFSETY),GeData(0.1),flags);
pTag->SetParameter(DescID(TEXTURETAG_LENGTHX),GeData(0.1),flags);
pTag->SetParameter(DescID(TEXTURETAG_LENGTHY),GeData(0.1),flags);
pTag->SetParameter(DescID(TEXTURETAG_TILESX),GeData(0.1),flags);
pTag->SetParameter(DescID(TEXTURETAG_TILESY),GeData(0.1),flags);
pTag->SetParameter(DescID(TEXTURETAG_REPETITIONX),GeData(0.1),flags);
pTag->SetParameter(DescID(TEXTURETAG_REPETITIONY),GeData(0.1),flags);
pTag->SetParameter(DescID(TEXTURETAG_POSITION),GeData(Vector(1.0,1.0,1.0)),flags);
pTag->SetParameter(DescID(TEXTURETAG_SIZE),GeData(Vector(1.0,1.0,1.0)),flags);
pTag->SetParameter(DescID(TEXTURETAG_ROTATION),GeData(Vector(1.0,1.0,1.0)),flags);
pTag->Message(MSG_UPDATE);
//Second way, using the base container.
BaseContainer *bc = pTag->GetDataInstance();
bc->SetString(TEXTURETAG_RESTRICTION,"Hello World");
bc->SetInt32(TEXTURETAG_PROJECTION,TEXTURETAG_PROJECTION_SPHERICAL);
bc->SetInt32(TEXTURETAG_PROJECTIONDISPLAY,TEXTURETAG_PROJECTIONDISPLAY_NONE);
bc->SetInt32(TEXTURETAG_SIDE,TEXTURETAG_SIDE_FRONTANDBACK);
bc->SetFloat(TEXTURETAG_CAMERA_FILMASPECT,0.1);
bc->SetInt32(TEXTURETAG_CAMERA_FILMPRESET,TEXTURETAG_CAMERA_FILMPRESET_CUSTOM);
bc->SetFloat(TEXTURETAG_CAMERA_PIXELASPECT,0.1);
bc->SetInt32(TEXTURETAG_CAMERA_PIXELPRESET,TEXTURETAG_CAMERA_PIXELPRESET_CUSTOM);
bc->SetBool(TEXTURETAG_MIX,true);
bc->SetBool(TEXTURETAG_TILE,true);
bc->SetBool(TEXTURETAG_SEAMLESS,true);
bc->SetBool(TEXTURETAG_UVBUMP,true);
bc->SetFloat(TEXTURETAG_OFFSETX,0.1);
bc->SetFloat(TEXTURETAG_OFFSETY,0.1);
bc->SetFloat(TEXTURETAG_LENGTHX,0.1);
bc->SetFloat(TEXTURETAG_LENGTHY,0.1);
bc->SetFloat(TEXTURETAG_TILESX,0.1);
bc->SetFloat(TEXTURETAG_TILESY,0.1);
bc->SetFloat(TEXTURETAG_REPETITIONX,0.1);
bc->SetFloat(TEXTURETAG_REPETITIONY,0.1);
bc->SetVector(TEXTURETAG_POSITION, c4d.Vector(1.0,1.0,1.0);
bc->SetVector(TEXTURETAG_SIZE, c4d.Vector(1.0,1.0,1.0);
bc->SetVector(TEXTURETAG_ROTATION, c4d.Vector(1.0,1.0,1.0);
pTag->Message(MSG_UPDATE);
}
Buttons
This node has buttons. Buttons can manually be executed by calling the following code
Python
c4d.CallButton(tag,c4d.TEXTURETAG_STOPINTERACTIVEMAPPING)
c4d.CallButton(tag,c4d.TEXTURETAG_CAMERA_CALCULATE)
C++
DescriptionCommand dc;
dc.id = DescID(TEXTURETAG_STOPINTERACTIVEMAPPING);
pTag->Message(MSG_DESCRIPTION_COMMAND, &dc);
DescriptionCommand dc;
dc.id = DescID(TEXTURETAG_CAMERA_CALCULATE);
pTag->Message(MSG_DESCRIPTION_COMMAND, &dc);