#include <c4d_basedocument.h>
详细描述
This class allows to perform some functions on all of the objects in a hierarchy.
范例:
struct
ExampleStruct
{
Int32
parent_state;
};
class
ExampleHierarchy :
public
层次结构
{
public
:
virtual
void
*
Alloc
(
void
) {
return
NewObjPtr
(ExampleStruct); }
virtual
void
Free
(
void
*data) { ExampleStruct *es = (ExampleStruct*)data;
DeleteObj
(es); }
virtual
void
CopyTo
(
void
*
src
,
void
*dst) { *((ExampleStruct*)dst) = *((ExampleStruct*)
src
); }
virtual
Bool
Do
(
void
*data,
BaseObject
*op,
const
矩阵
&mg,
Bool
controlobject);
};
Bool
ExampleHierarchy::Do(
void
*data,
BaseObject
*op,
const
矩阵
&mg,
Bool
controlobject)
{
ExampleStruct* dt = (ExampleStruct*)data;
Int32
mode = op->
GetRenderMode
();
if
(mode !=
MODE_UNDEF
)
// if mode is MODE_ON or MODE_OFF
d->parent_state = mode;
// Important: Do this parent-data inheritance always, even if you do not evaluate an object
// Reason: A child of an invisible control object might be visible again...
if
(controlobject)
return
true
;
// This object is not visible, has been used by generator
if
(op->
GetType
() !=
Opolygon
)
return
true
;
// We cannot use this
// Do something with polygonized object op
// The object has matrix mg and local data dt
return
true
;
}
公共成员函数
|
virtual void *
|
Alloc
(void)=0
|
virtual void
|
Free
(void *data)=0
|
virtual void
|
CopyTo
(void *src, void *dst)=0
|
virtual
Bool
|
Do
(void *data,
BaseObject
*op, const
矩阵
&mg,
Bool
controlobject)=0
|
Bool
|
Run
(
BaseDocument
*
doc
,
Bool
spheres,
Float
lod,
Bool
uselod,
BUILDFLAGS
flags, void *startdata,
BaseThread
*
bt
)
|
成员函数文档编制
◆
Alloc()
virtual void* Alloc
|
(
|
void
|
|
)
|
|
|
pure virtual
|
Override the method to allocate the private data for a single level in the hierarchy.
Cinema 4D
itself will pass the parent matrix but all other data that might be needed must be passed down the hierarchy using a private data structure and this is where it is allocated.
-
返回
-
The private data that is allocated.
◆
Free()
virtual void Free
|
(
|
void *
|
data
|
)
|
|
|
pure virtual
|
Override the method so that the private data allocated in
Alloc()
can be freed.
-
参数
-
[in,out]
|
data
|
The private data to free.
|
◆
CopyTo()
virtual void CopyTo
|
(
|
void *
|
src
,
|
|
|
void *
|
dst
|
|
)
|
|
|
|
pure virtual
|
Override the method so that the private data can be copied.
-
参数
-
[in]
|
src
|
The source private data to copy from.
|
[out]
|
dst
|
The destination private data to copy to.
|
◆
Do()
Override the method to be called for every object, virtual and non-virtual, in the hierarchy run.
-
参数
-
[in]
|
data
|
The private data allocated in
Alloc()
.
|
[in]
|
op
|
The object the function is being called for.
|
[in]
|
mg
|
The global matrix for this object down the hierarchy chain.
|
[in]
|
controlobject
|
若
true
then the object has been used by a generator and usually will no longer be used (but the routine goes through all objects in any case).
|
-
返回
-
true
if the function was successful and the run through the hierarchy should continue, otherwise
false
.
◆
Run()
Performs
Do()
on all objects (virtual and non-virtual) in the hierarchy.
Using this class will build all caches for dirty objects for the entire hierarchy, this can be time intensive and should be used carefully.
If a polygon object is needed it is generally faster to call
SendModelingCommand()
with
MCOMMAND_CURRENTSTATETOOBJECT
.
-
参数
-
[in]
|
doc
|
The document with the objects you want to process.
|
[in]
|
spheres
|
若
true
the process will not polygonize perfect spheres.
|
[in]
|
lod
|
The level of detail to use.
|
[in]
|
uselod
|
若
true
the level of detail
lod
should be evaluated.
|
[in]
|
flags
|
The build flags are:
BUILDFLAGS
注意:
Either
BUILDFLAGS::INTERNALRENDERER
or
BUILDFLAGS::EXTERNALRENDERER
must be set because some generators check for these flags and generate different results.
For example the Metaball object has different settings in the edit dialog for internal and external rendering.
|
[in]
|
startdata
|
The initial private data to pass into the hierarchy.
|
[in]
|
bt
|
The custom thread, or
nullptr
if called from the main
Cinema 4D
thread.
|
-
返回
-
The success of calling
Do()
for each object.
Member Data Documentation
◆
doc
◆
bt
#define Opolygon
Polygon - PolygonObject.
定义:
ge_prepass.h:975
virtual void * Alloc(void)=0
#define DeleteObj(obj)
定义:
newobj.h:159
#define NewObjPtr(T,...)
Deprecated.
定义:
newobj.h:113
virtual void Free(void *data)=0
Int32 GetRenderMode(void) const
const T & src
定义:
apibase.h:2525
virtual Bool Do(void *data, BaseObject *op, const Matrix &mg, Bool controlobject)=0
#define MODE_UNDEF
The object is enabled by default, but the state of any parent object is used if it is enabled or disa...
定义:
c4d_baseobject.h:37
maxon::Int32 Int32
定义:
ge_sys_math.h:58
virtual void CopyTo(void *src, void *dst)=0
maxon::Bool Bool
定义:
ge_sys_math.h:53
定义:
c4d_basedocument.h:1477
Int32 GetType() const
定义:
c4d_baselist.h:1348