-
首页
-
C4D R23.110 C++ SDK
#include <c4d_nodedata.h>
详细描述
A data class for creating node plugins.
-
注意
-
See the derived classes for creating standard node plugins, like objects, tags and materials.
使用
RegisterNodePlugin()
to register a node plugin.
描述
|
virtual
Bool
|
GetDDescription
(
GeListNode
*node,
描述
*description,
DESCFLAGS_DESC
&flags)
|
virtual
Bool
|
GetDParameter
(
GeListNode
*node, const
DescID
&id,
GeData
&t_data,
DESCFLAGS_GET
&flags)
|
virtual
Bool
|
SetDParameter
(
GeListNode
*node, const
DescID
&id, const
GeData
&t_data,
DESCFLAGS_SET
&flags)
|
virtual
Bool
|
GetDEnabling
(
GeListNode
*node, const
DescID
&id, const
GeData
&t_data,
DESCFLAGS_ENABLE
flags, const
BaseContainer
*itemdesc)
|
virtual
Bool
|
TranslateDescID
(
GeListNode
*node, const
DescID
&id,
DescID
&res_id,
C4DAtom
*&res_at)
|
构造函数 & 析构函数文档编制
◆
NodeData()
Default constructor.
-
由于
-
R17.032
成员函数文档编制
◆
Get()
Gets the
GeListNode
connected with the
NodeData
instance.
-
返回
-
The list node connected with this instance.
Cinema 4D
owns the pointed node.
◆
Init()
Called when a new instance of the node data is allocated.
Allocate and initialize member variables of the node data class here. Fill also the container of the node data and connected nodes with default values:
Bool
BlinkerKey::Init(
GeListNode
*node)
{
BaseKey *op = (BaseKey*) node;
BaseContainer
*data = op->GetDataInstance();
data->
SetFloat
(BLINKERKEY_NUMBER, 1.0);
data->
SetFloat
(BLINKERKEY_STRENGTH, 1.0);
data->
SetBool
(BLINKERKEY_SOFT,
false
);
return
true
;
}
-
注意
-
If the node data class has a constructor it is called as usual before, but at that time there is no
GeListNode
link established.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
-
返回
-
true
若
node
was initialized, otherwise
false
.
Reimplemented in
EffectorData
,和
GvOperatorData
.
◆
Free()
Called when a node data instance is deallocated.
Deallocate member variables of the node data class here.
-
注意
-
If the node data class has a destructor it is called as usual after.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
Reimplemented in
EffectorData
.
◆
Read()
Called when a node is loaded from a file.
-
警告
-
If at least one of
Read()
,
Write()
and
CopyTo()
is implemented, it is recommended to implement all three, otherwise data might be lost.
Read any member variable for the node data class.
范例:
hf->ReadLong(&offset);
hf->
ReadBool
(&object_access);
For future extensions of the node data check the
level
and only read the appropriate values:
if
(level >= 0)
{
hf->ReadLong(&offset);
hf->
ReadBool
(&object_access);
}
if
(level >= 1)
{
hf->ReadReal(&new_feature);
}
-
注意
-
Init()
is called before
Read()
.
-
警告
-
It is recommended to store as much as possible in the
node
's container as
Cinema 4D
handles the reading of those values automatically. Only use member variables when necessary.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[in]
|
hf
|
The hyper file to read from.
Cinema 4D
owns the pointed hyper file.
|
[in]
|
level
|
The plugin level is similar to a version number. The default level is
0
.
Increase this for new revisions of a plugin to allow for forward and backward compatibility.
As an example you may have updated a plugin. If you now need to write additional information for new member variables or changed types for old members increase the level.
During loading either a
0
is passed (if the file was written by the old plugin) or
1
(if the file was written by the new plugin). This allows to easily write/read new values.
For forward and backward compatibility to work any existing read order from a given level must not be changed.
Cinema 4D
skips any new settings automatically if they have not been read.
level
is only useful if variables are written/read in
NodeData::Write
/NodeData::Read.
If all values are stored in the
node
's container, you do not have to deal with the level.
|
-
返回
-
true
若
node
was read, otherwise
false
.
◆
Write()
Called when a node is saved to a file.
-
警告
-
If at least one of
Read()
,
Write()
and
CopyTo()
is implemented, it is recommended to implement all three, otherwise data might be lost.
Write any member variable for the node data class.
范例:
hf->WriteLong(offset);
hf->
WriteBool
(object_access);
For future extensions of the node data make sure to introduce a new level when writing new values:
// Level 0
hf->WriteLong(offset);
hf->
WriteBool
(object_access);
// Level 1
hf->WriteReal(new_feature);
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[in]
|
hf
|
The hyper file to write to.
Cinema 4D
owns the pointed hyper file.
|
-
返回
-
true
若
node
was written, otherwise
false
.
◆
CopyTo()
Called when a node is duplicated.
-
警告
-
If at least one of
Read()
,
Write()
and
CopyTo()
is implemented, it is recommended to implement all three, otherwise data might be lost.
Copy any member variable for the node plugin. Simply transfer from
this
to
dest
and/or
snode
to
dnode
:
dest->offset = offset;
dest->object_access = object_access;
-
注意
-
Init()
is called for the destination node before.
-
警告
-
It is recommended to store as much as possible in the node's container as
Cinema 4D
handles the copying of those values automatically. Only use member variables when necessary.
-
参数
-
[out]
|
dest
|
The destination node data.
Cinema 4D
owns the pointed node.
|
[in]
|
snode
|
The source node. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[out]
|
dnode
|
The destination node.
Cinema 4D
owns the pointed node.
|
[in]
|
flags
|
The copy flags:
COPYFLAGS
|
[in]
|
trn
|
An alias translator for the operation. Can be
nullptr
. The sender owns the pointed alias translator.
|
-
返回
-
true
若
node
was copied, otherwise
false
.
Reimplemented in
EffectorData
.
◆
Message()
Called when a node receives messages.
-
另请参阅
-
C4DAtom::Message
-
注意
-
Some notification messages are automatically passed along to branches:
MSG_POINTS_CHANGED
,
MSG_POLYGONS_CHANGED
and
MSG_SEGMENTS_CHANGED
. This is for convenience and historical reasons.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[in]
|
type
|
The message type:
MSG
|
[in,out]
|
data
|
The message data. The sender owns the pointed data.
|
-
返回
-
true
or
false
depending on the message
type
.
Reimplemented in
EffectorData
.
◆
GetBubbleHelp()
Called to create a contextual bubble help and status bar information for the node.
-
注意
-
When dealing with strings it is advised to use the string resources files and the GeLoadString function.
This keeps the plugin easy to localize for any language to support and makes full use of the language features of
Cinema 4D
.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[in]
|
str
|
The bubble help string.
|
◆
GetDocument()
Called to tell
Cinema 4D
how to retrieve the document for the
node
.
Any call to
GeListNode::GetDocument()
ends up here.
-
注意
-
Useful if new BaseList elements are defined.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
-
返回
-
The document for the
node
.
◆
GetBranchInfo()
Called to specify that the node acts as a container of other nodes.
This is for instance used by the animator module to make sure that the nodes are animated. Simply fill in the passed array:
info[0].head = myHead;
info[0].name =
"MyName"
;
...
info[1].head = myOtherHead;
...
return 2;
// 2 elements filled
-
注意
-
For the standard node types, for example objects, it is not needed to override
GetBranchInfo
.
Cinema 4D
already knows that objects contain tags.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[out]
|
info
|
An array of max
BranchInfo
structures to fill in.
Cinema 4D
owns the pointed array.
|
[in]
|
max
|
The number of
BranchInfo
structures in the info array.
|
[in]
|
flags
|
The get branch info flags:
GETBRANCHINFO
|
-
返回
-
The number of
BranchInfo
elements filled in the
info
array.
◆
IsInstanceOf()
Called to check if the
node
is an instance of a base
type
.
-
另请参阅
-
C4DAtom::IsInstanceOf
.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[in]
|
type
|
The type to check.
|
-
返回
-
true
若
node
is an instance of the given
type
, otherwise
false
.
Reimplemented in
EffectorData
.
◆
GetDDescription()
Called to add parameters to the description for the node.
Modify the passed
description
as needed, set the appropriate
flags
and then make sure to include a call to the parent at the end:
return
SUPER::GetDDescription(data, description, flags, parentdescription);
-
注意
-
If only a description resource is used it is not needed to overload
GetDDescription
.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[in,out]
|
description
|
The node's description to add the parameters to.
Cinema 4D
owns the pointed description.
|
[in,out]
|
flags
|
The flags for the description operation:
DESCFLAGS_DESC
|
-
返回
-
true
if successful, otherwise
false
. It is recommended to include a call to the parent function as last return.
Reimplemented in
EffectorData
,和
GvOperatorData
.
◆
GetDParameter()
Called to override the reading of description parameters.
Necessary for parameters that are not simply stored in the node's container, e.g. the global position of an object.
Modify the passed
t_data
if the right
id
is provided, and set the appropriate
flags
. Then make sure to include a call to the parent at the end:
return
SUPER::GetDParameter(data,
id
, t_data, flags);
-
注意
-
If only a description resource is used it is not needed to overload
GetDParameter
.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[in]
|
id
|
The ID of the parameter.
|
[out]
|
t_data
|
The parameter data to return.
Cinema 4D
owns the pointed data.
|
[in,out]
|
flags
|
The flags for the description operation:
DESCFLAGS_GET
|
-
返回
-
true
if successful, otherwise
false
. It is recommended to include a call to the parent function as last return.
Reimplemented in
GvOperatorData
.
◆
SetDParameter()
Called to override the writing of parameters.
Read the passed
t_data
if the right
id
was provided, store the data, and set the appropriate
flags
. Then make sure to include a call to the parent at the end:
return
SUPER::SetDParameter(data,
id
, t_data, flags);
-
注意
-
If only a description resource is used it is not needed to overload
SetDParameter
.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[in]
|
id
|
The ID of the parameter.
|
[in]
|
t_data
|
The parameter data to set.
Cinema 4D
owns the pointed data.
|
[in,out]
|
flags
|
The flags for the description operation:
DESCFLAGS_SET
|
-
返回
-
true
if successful, otherwise
false
. It is recommended to include a call to the parent function as last return.
Reimplemented in
GvOperatorData
.
◆
GetDEnabling()
Called to decide which description parameters should be enabled or disabled.
Can be used both for parameters that are stored in the node's description and for dynamic parameters.
Read the passed
t_data
if the right
id
was provided, and return
true
to enable the parameter or
false
to disable it. Then make sure to include a call to the parent at the end:
return
SUPER::GetDEnabling(data,
id
, t_data, flags, itemdesc);
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[in]
|
id
|
The ID of the parameter.
|
[in]
|
t_data
|
The parameter data.
Cinema 4D
owns the pointed data.
|
[in]
|
flags
|
Not used.
|
[in]
|
itemdesc
|
The parameter's description, encoded to a container as described in
描述
.
|
-
返回
-
true
if the parameter should be enabled, otherwise
false
. It is recommended to include a call to the parent function as last return.
Reimplemented in
EffectorData
,和
GvOperatorData
.
◆
TranslateDescID()
Called by the Attribute Manager for every object and every description ID.
Gives a node data the opportunity to route a description ID in the description of a
GeListNode
to another one.
For example used for tags that are embedded in an object description so that the keyframer for a tag property creates the track on the tag and not on the object.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[in]
|
id
|
The source description ID.
|
[out]
|
res_id
|
Assign the target description ID.
|
[out]
|
res_at
|
Assign the target object.
|
-
返回
-
true
if successful, otherwise
false
.
◆
IsDocumentRelated()
Called by the Attribute Manager for correct undo handling.
-
警告
-
Should not be overloaded by regular plugins and should be used with extra care. If
false
is returned no undo is possible.
-
参数
-
[in]
|
node
|
The
GeListNode
connected with the
NodeData
instance. Equal to
Get()
. Provided for speed and convenience.
Cinema 4D
owns the pointed node.
|
[in]
|
docrelated
|
赋值
true
if the node is part of the document, otherwise
false
.
|
-
返回
-
true
if successful, otherwise
false
.
Reimplemented in
SculptBrushModifierData
.
Member Data Documentation
◆
private_link
void SetBool(Int32 id, Bool b)
定义:
c4d_basecontainer.h:498
Represents a C4DAtom that resides in a 4D list.
定义:
c4d_baselist.h:1767
void SetFloat(Int32 id, Float r)
定义:
c4d_basecontainer.h:533
maxon::Bool Bool
定义:
ge_sys_math.h:53
定义:
c4d_basecontainer.h:46