Osds
Attributes
-
ENGLISH NAME : SubdivisionSurface
-
NAME : Osds
-
INCLUDE : Obase
-
PATH : objects/description/osds.res
-
PLUGIN : objects
-
MAXON online help (may not exist): OSDS
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.Osds)
doc.InsertObject(obj)
c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
#You can set parameters two different ways.
#First way
obj[c4d.SDSOBJECT_TYPE] = c4d.SDSOBJECT_TYPE_CM
obj[c4d.SDSOBJECT_R12_COMPATIBILITY] = True
obj[c4d.SDSOBJECT_SUBEDITOR_CM] = 1
obj[c4d.SDSOBJECT_SUBRAY_CM] = 1
obj[c4d.SDSOBJECT_SUBDIVIDE_UV] = c4d.SDSOBJECT_SUBDIVIDE_UV_STANDARD
obj[c4d.SDSOBJECT_OSD_FVAR_BOUNDARY_METHOD] = c4d.SDSOBJECT_OSD_FVAR_BOUNDARY_METHOD_BOUNDARIES
obj[c4d.SDSOBJECT_OSD_BOUNDARY_METHOD] = c4d.SDSOBJECT_OSD_BOUNDARY_METHOD_EDGEONLY
obj[c4d.SDSOBJECT_OSD_CATMARK_TRI_SUBD] = c4d.SDSOBJECT_OSD_CATMARK_TRI_SUBD_CATMARK
obj[c4d.SDSOBJECT_OSD_EDGE_CREASE] = c4d.SDSOBJECT_OSD_EDGE_CREASE_UNIFORM
obj[c4d.SDSOBJECT_OSD_ADAPTIVE_TESSELLATION_LEVEL] = 1
#Second way, using the base container.
bc = obj.GetDataInstance()
bc.SetInt32(c4d.SDSOBJECT_TYPE,c4d.SDSOBJECT_TYPE_CM)
bc.SetBool(c4d.SDSOBJECT_R12_COMPATIBILITY,True)
bc.SetInt32(c4d.SDSOBJECT_SUBEDITOR_CM,1)
bc.SetInt32(c4d.SDSOBJECT_SUBRAY_CM,1)
bc.SetInt32(c4d.SDSOBJECT_SUBDIVIDE_UV,c4d.SDSOBJECT_SUBDIVIDE_UV_STANDARD)
bc.SetInt32(c4d.SDSOBJECT_OSD_FVAR_BOUNDARY_METHOD,c4d.SDSOBJECT_OSD_FVAR_BOUNDARY_METHOD_BOUNDARIES)
bc.SetInt32(c4d.SDSOBJECT_OSD_BOUNDARY_METHOD,c4d.SDSOBJECT_OSD_BOUNDARY_METHOD_EDGEONLY)
bc.SetInt32(c4d.SDSOBJECT_OSD_CATMARK_TRI_SUBD,c4d.SDSOBJECT_OSD_CATMARK_TRI_SUBD_CATMARK)
bc.SetInt32(c4d.SDSOBJECT_OSD_EDGE_CREASE,c4d.SDSOBJECT_OSD_EDGE_CREASE_UNIFORM)
bc.SetInt32(c4d.SDSOBJECT_OSD_ADAPTIVE_TESSELLATION_LEVEL,1)
if __name__=='__main__':
main()
C++
#include "c4d.h"
#include "../objects/description/osds.h"
void SampleFunction()
{
BaseDocument *pDoc = GetActiveDocument();
BaseObject *pObject = BaseObject::Alloc(Osds);
pDoc->InsertObject(pObject);
pDoc->StartUndo();
pDoc->AddUndo(UNDO_NEW,pObject);
pDoc->EndUndo();
EventAdd(EVENT_FORCEREDRAW);
//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;
pObject->SetParameter(DescID(SDSOBJECT_TYPE),GeData(SDSOBJECT_TYPE_CM),flags);
pObject->SetParameter(DescID(SDSOBJECT_R12_COMPATIBILITY),GeData(true),flags);
pObject->SetParameter(DescID(SDSOBJECT_SUBEDITOR_CM),GeData(1),flags);
pObject->SetParameter(DescID(SDSOBJECT_SUBRAY_CM),GeData(1),flags);
pObject->SetParameter(DescID(SDSOBJECT_SUBDIVIDE_UV),GeData(SDSOBJECT_SUBDIVIDE_UV_STANDARD),flags);
pObject->SetParameter(DescID(SDSOBJECT_OSD_FVAR_BOUNDARY_METHOD),GeData(SDSOBJECT_OSD_FVAR_BOUNDARY_METHOD_BOUNDARIES),flags);
pObject->SetParameter(DescID(SDSOBJECT_OSD_BOUNDARY_METHOD),GeData(SDSOBJECT_OSD_BOUNDARY_METHOD_EDGEONLY),flags);
pObject->SetParameter(DescID(SDSOBJECT_OSD_CATMARK_TRI_SUBD),GeData(SDSOBJECT_OSD_CATMARK_TRI_SUBD_CATMARK),flags);
pObject->SetParameter(DescID(SDSOBJECT_OSD_EDGE_CREASE),GeData(SDSOBJECT_OSD_EDGE_CREASE_UNIFORM),flags);
pObject->SetParameter(DescID(SDSOBJECT_OSD_ADAPTIVE_TESSELLATION_LEVEL),GeData(1),flags);
pObject->Message(MSG_UPDATE);
//Second way, using the base container.
BaseContainer *bc = pObject->GetDataInstance();
bc->SetInt32(SDSOBJECT_TYPE,SDSOBJECT_TYPE_CM);
bc->SetBool(SDSOBJECT_R12_COMPATIBILITY,true);
bc->SetInt32(SDSOBJECT_SUBEDITOR_CM,1);
bc->SetInt32(SDSOBJECT_SUBRAY_CM,1);
bc->SetInt32(SDSOBJECT_SUBDIVIDE_UV,SDSOBJECT_SUBDIVIDE_UV_STANDARD);
bc->SetInt32(SDSOBJECT_OSD_FVAR_BOUNDARY_METHOD,SDSOBJECT_OSD_FVAR_BOUNDARY_METHOD_BOUNDARIES);
bc->SetInt32(SDSOBJECT_OSD_BOUNDARY_METHOD,SDSOBJECT_OSD_BOUNDARY_METHOD_EDGEONLY);
bc->SetInt32(SDSOBJECT_OSD_CATMARK_TRI_SUBD,SDSOBJECT_OSD_CATMARK_TRI_SUBD_CATMARK);
bc->SetInt32(SDSOBJECT_OSD_EDGE_CREASE,SDSOBJECT_OSD_EDGE_CREASE_UNIFORM);
bc->SetInt32(SDSOBJECT_OSD_ADAPTIVE_TESSELLATION_LEVEL,1);
pObject->Message(MSG_UPDATE);
}