doc->
InsertObject
(volumeBuilder,
nullptr
,
nullptr
);
Input Objects
A
VolumeBuilder
creates volumes based on various input objects. Such input objects are added or removed to the input objects list with these functions:
// This example adds the given scene object as a source object for the volume builder.
const
Int32
index = 0;
// add the given object
if
(volumeBuilder->
AddSceneObject
(
object
, index,
true
,
BOOLTYPE::UNION
,
MIXTYPE::NORMAL
) ==
false
)
return
maxon::UnexpectedError(
MAXON_SOURCE_LOCATION
);
// get the corresponding settings
BaseContainer
*
const
settings = volumeBuilder->
GetSettingsContainerForIndex
(index);
if
(settings ==
nullptr
)
return
maxon::UnexpectedError(
MAXON_SOURCE_LOCATION
);
// set settings
settings->
SetBool
(
ID_VOLUMEBUILDER_TAG_OPTIMIZEANDCLOSE
,
true
);
The objects in the input list are accessed with:
// This example loops through all input elements of the given
// VolumeBuilder object.
const
Int32
inputCount = volumeBuilder->
GetListEntryCount
();
for
(
Int32
i = 0; i < inputCount; ++i)
{
const
BaseObject
*
const
inputObject = volumeBuilder->
GetInputObject
(i);
if
(inputObject !=
nullptr
)
{
// get input name
const
maxon::String
name = inputObject->
GetName
();
DiagnosticOutput
(
"Object: @"
, name);
// check if child object
if
(volumeBuilder->
InputObjectIsChild
(i))
DiagnosticOutput
(
"(Child object)"
);
}
}
For each input object various settings can be set (see
tvolumebuilder.h
). The
BaseContainer
storing these settings is accessed with:
// This example gets the settings BaseContainer or the given input object.
BaseContainer
*
const
settings = volumeBuilder->
GetSettingsContainerForObject
(inputObject);
if
(settings ==
nullptr
)
return
maxon::UnexpectedError(
MAXON_SOURCE_LOCATION
);
settings->
SetBool
(
ID_VOLUMEBUILDER_TAG_USEPOINTS
,
true
);
settings->
SetFloat
(
ID_VOLUMEBUILDER_TAG_MESHRADIUS
, 10.0);
The bool mode (
BOOLTYPE
) of a given object is accessed with:
The mix mode (::MIXTYPE) of a given object is accessed with:
The functional state of an object in the list is accessed by:
The selection state of an object in the list is accessed with:
The
MIXVECTORTYPE
defines how vector data is handled:
// This example enables all selected input objects and disables un-selected objects.
const
Int32
objectCount = volumeBuilder->
GetListEntryCount
();
for
(
Int32
i = 0; i < objectCount; ++i)
{
const
Bool
selected = volumeBuilder->
GetSelected
(i);
if
(selected)
volumeBuilder->
SetEnable
(i,
true
);
else
volumeBuilder->
SetEnable
(i,
false
);
}
延伸阅读
void InsertObject(BaseObject *op, BaseObject *parent, BaseObject *pred, Bool checknames=false)
BaseContainer * GetSettingsContainerForObject(BaseObject *object) const
BaseObject * GetInputObject(Int32 index) const
@ ID_VOLUMEBUILDER_TAG_OPTIMIZEANDCLOSE
定义:
tvolumebuilder.h:28
#define MAXON_SOURCE_LOCATION
定义:
memoryallocationbase.h:66
void SetBool(Int32 id, Bool b)
定义:
c4d_basecontainer.h:498
@ ID_VOLUMEBUILDER_TAG_MESHRADIUS
定义:
tvolumebuilder.h:27
#define DiagnosticOutput(formatString,...)
定义:
debugdiagnostics.h:166
定义:
lib_volumebuilder.h:42
Int32 GetListEntryCount()
void SetEnable(Int32 index, Bool enable)
maxon::Int32 Int32
定义:
ge_sys_math.h:58
BaseContainer * GetSettingsContainerForIndex(Int32 index) const
Bool AddSceneObject(BaseObject *object, Int32 index, Bool enabled, BOOLTYPE boolMode, MIXTYPE mixMode)
void SetFloat(Int32 id, Float r)
定义:
c4d_basecontainer.h:533
Bool InputObjectIsChild(Int32 index) const
static VolumeBuilder * Alloc()
定义:
lib_volumebuilder.h:55
@ ID_VOLUMEBUILDER_TAG_USEPOINTS
定义:
tvolumebuilder.h:17
maxon::Bool Bool
定义:
ge_sys_math.h:53
String GetName() const
定义:
c4d_baselist.h:2318
Bool GetSelected(Int32 index) const
定义:
c4d_basecontainer.h:46