About
NodeData based classic plugin classes can implement NodeData::GetDParameter(). This allows to define the values of parameters accessed with C4DAtom::GetParameter(). This is done to handle data that is not stored in the object's BaseContainer. It is also used to create parameters that depend on the value of other parameters or element properties.
NodeData::GetDParameter() corresponds to C4DAtom::GetParameter().
- Note
- In most cases, when implementing NodeData::GetDParameter(), one will also need to implement NodeData::SetDParameter(). For example, if the value is stored in a member variable.
Usage
NodeData::GetDParameter() is called when the value of a parameter is accessed with C4DAtom::GetParameter(). It is possible to define or change the returned value.
{
if (node == nullptr)
return false;
switch (id[0].id)
{
case EXAMPLE_GENERATOR_PARAMETER_NOT_BC:
{
return true;
}
}
return SUPER::GetDParameter(node, id, t_data, flags);
}
- Note
- Such member variables must also be handled in NodeData::Read(), NodeData::Write(), NodeData::CopyTo() and NodeData::SetDParameter().
The arguments of the function are:
- The node itself.
- The parameter DescID in question.
- A GeData object to return the read parameter value.
- These flags:
Certain cases have to be handled with special functions:
Further Examples
{
if (node == nullptr)
return false;
switch (id[0].id)
{
case EXAMPLE_TAG_VOLUME:
{
if (tag != nullptr)
{
if (hostObject != nullptr)
{
{
{
volume = (4.0 / 3.0) *
maxon::PI * radius * radius * radius;
break;
}
{
volume =
maxon::PI * radius * radius * height;
break;
}
default: break;
}
}
}
return true;
}
}
return SUPER::GetDParameter(node, id, t_data, flags);
}
Further Reading