NodeData::SetDParameter() Manual

内容表

关于

NodeData based classic plugin classes can implement NodeData::SetDParameter() . This allows to change parameters that are set and it allows to react to this event. This is typically done to handle data that is not stored in the object's BaseContainer . It is also used to change parameter values when another parameter was changed.

NodeData::SetDParameter() corresponds to C4DAtom::SetParameter() .

注意
In most cases, when implementing NodeData::SetDParameter() , one will also need to implement NodeData::GetDParameter() . For example, if the value is stored in a member variable.

用法

NodeData::SetDParameter() is called when the value of a parameter is set with C4DAtom::SetParameter() . It is possible to change this value before it is stored in the element's BaseContainer .

Bool SetDParameter( GeListNode * node, const DescID & id , const GeData & t_data, DESCFLAGS_SET & flags) { if (node == nullptr ) return false ;
switch ( id [0]. id ) { // This parameter will not be stored in the BaseContainer case EXAMPLE_GENERATOR_PARAMETER_NOT_BC: { // store the set value in a member variable. _value = t_data. GetInt32 ();

// mark parameter as set flags |= DESCFLAGS_SET::PARAM_SET ;

// return from the function, don't call the function of the base class. return true ; } // This example sets the value of another parameter based on the value of the given parameter.

case EXAMPLE_GENERATOR_PARAMETER_VALUE: { const Int32 twice = t_data. GetInt32 () * 2; node-> SetParameter (EXAMPLE_GENERATOR_PARAMETER_VALUE_TWICE, twice, DESCFLAGS_SET::NONE );
break ; } } return SUPER::SetDParameter(node, id , t_data, flags); }
注意
Such member variables must also be handled in NodeData::Read() , NodeData::Write() , NodeData::CopyTo() and NodeData::GetDParameter() .

The arguments of the function are:

If the parameter is set through user-interaction in the Attribute Manager the message MSG_DESCRIPTION_POSTSETPARAMETER will be sent to the element. See also 交互 .

Certain cases have to be handled with special functions:

注意
It is not safe to call DrawViews() from NodeData::SetDParameter() .

延伸阅读

DescID
定义: lib_description.h:327
DESCFLAGS_SET::NONE
@ NONE
None.
GeListNode
Represents a C4DAtom that resides in a 4D list.
定义: c4d_baselist.h:1767
C4DAtom::SetParameter
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
GeData::GetInt32
Int32 GetInt32(void) const
定义: c4d_gedata.h:427
GeData
定义: c4d_gedata.h:82
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
DESCFLAGS_SET
DESCFLAGS_SET
定义: ge_prepass.h:3113
DESCFLAGS_SET::PARAM_SET
@ PARAM_SET
Parameter set.
Bool
maxon::Bool Bool
定义: ge_sys_math.h:53

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1