#include <c4d_falloffdata.h>
@markprivate Represents a falloff. Allows to sample falloffs.
It is very simple in use: allocate it, call InitFalloff() first then Sample() giving it a point in world space.
Many of the methods are there for use within NodeData/ ObjectData/ToolData plugins and should be called within their likewise counterparts.
For instance Draw should be called from within the corresponding NodeData/ ObjectData/ToolData Draw override, then the falloff will be drawn in the viewport.
C4D_Falloff normally needs a container, this is usually the object's container, from this it gets and sets its own parameters for the description (though they can be set directly using the helper functions).
Private Member Functions | |
C4D_Falloff () | |
~C4D_Falloff () | |
Alloc/Free | |
static C4D_Falloff * | Alloc (Int cType=0) |
static void | Free (C4D_Falloff *&node) |
Dirty | |
void | SetDirty () |
Int32 | GetDirty (BaseDocument *doc, BaseContainer *bc=nullptr) |
Matrix | |
void | SetMg (Matrix mg) |
Matrix | GetMg () |
Data | |
void | SetData (FalloffDataData falldata) |
FalloffDataData | GetData () |
Mode | |
Bool | SetMode (Int32 type, BaseContainer *bc=nullptr) |
Int32 | GetMode () |
Handle | |
Int32 | GetHandleCount (BaseContainer *bc=nullptr) |
void | GetHandle (Int32 i, BaseContainer *bc, HandleInfo &info) |
void | SetHandle (Int32 i, Vector p, BaseContainer *bc, const HandleInfo &info) |
|
private |
|
private |
|
static |
|
static |
BaseContainer* GetContainerInstance | ( | ) |
Gets the last container the falloff should try to use.
void SetDirty | ( | ) |
Sets the falloff dirty.
Int32 GetDirty | ( | BaseDocument * | doc, |
BaseContainer * | bc = nullptr |
||
) |
Gets the falloff dirty value.
[in] | doc | The document. |
[in] | bc | Optionally pass the container of the object owning the falloff (recommended). |
void SetMg | ( | Matrix | mg | ) |
Sets the falloff's matrix.
[in] | mg | The new matrix. |
Matrix GetMg | ( | ) |
Gets the falloff's matrix.
void SetData | ( | FalloffDataData | falldata | ) |
Sets the falloff's data directly.
[in] | falldata | The new falloff's data. |
FalloffDataData GetData | ( | ) |
Gets the falloff's data.
Bool SetMode | ( | Int32 | type, |
BaseContainer * | bc = nullptr |
||
) |
Sets the falloff mode.
[in] | type | The new falloff mode. |
[in] | bc | Optionally pass the container of the object owning the falloff (recommended). |
Int32 GetMode | ( | ) |
Gets the falloff mode.
void SetTime | ( | BaseTime | time, |
BaseContainer * | bc = nullptr |
||
) |
Sets the current falloff time.
Used for the animated Spline GUI offset, not for any other values currently.
[in] | time | The new falloff time. |
[in] | bc | Optionally pass the container of the object owning the falloff (recommended). |
Bool InitFalloff | ( | BaseContainer * | bc = nullptr , |
BaseDocument * | doc = nullptr , |
||
BaseObject * | op = nullptr |
||
) |
Initializes the falloff.
[in] | bc | Optional container of the object owning the falloff. If given the FalloffDataData will be extracted from this container. |
[in] | doc | Optional document used to retrieve the current time for the animation of the Spline GUI offset. |
[in] | op | Optional object used to set the matrix if given, and if no container is given for bc, its container will be used instead. |
Bool PreSample | ( | BaseDocument * | doc, |
BaseList2D * | op, | ||
const FieldInput & | inputs, | ||
FIELDSAMPLE_FLAG | flags | ||
) |
Pre-samples an array of points for much faster usage with fields. Sampling result will be stored internally until the next call to PreSample. Use GetSamples() to read pre-sampling result. Only used with fields. If falloff is in legacy mode, PreSample will return true and do mothing. Use PreSample to allow calls to Sample within parallel for loops.
[in] | doc | The document. |
[in] | op | The object. |
[in] | inputs | The point array to sample. |
[in] | flags | The sampling flags. |
const FieldOutput* GetSamples | ( | ) |
Gets the samples calculated by PreSample.
void Sample | ( | const Vector & | p, |
Float * | result, | ||
Bool | usespline = true , |
||
Float | weight = 0.0_f , |
||
BaseList2D * | op = nullptr , |
||
Int | index = -1 |
||
) |
Samples the falloff for any point in space. NOTE: Do not call Sample within a parallel for loop when using fields without PreSample called first. When using fields: -If user calls PreSample first, Sample will quickly return the pre-sampled result. This case is thread safe. -If PreSample was not called, Sample will sample the fields. This case is not thread safe. When using legacy falloffs: -Sample supports parallel for loops.
[in] | p | The point to sample in global space (ignored with pre-sampling). |
[out] | result | Assigned the sampled value. |
[in] | usespline | Use the GUI spline if it exists (default, ignored with pre-sampling). |
[in] | weight | Weight offset. Equivalent of adding this value to the falloff result before clamping (optional, ignored with fields). |
[in] | op | the object (ignored with pre-sampling). |
[in] | index | zero-based index of the sample (when using pre-sampling). |
void MultiSample | ( | const Vector * | p, |
Float * | result, | ||
Int | count, | ||
Bool | usespline = true , |
||
Float | weight = 0.0_f , |
||
BaseList2D * | op = nullptr |
||
) |
Samples the falloff for an array of points in space. The result will be returned in the Float array but also stored internally, overwriting the last PreSample call result.
[in] | p | The array of points to sample. The caller owns the pointed array. |
[out] | result | Assigned the sampled values. |
[in] | count | The size of array p. |
[in] | usespline | Use the GUI spline if it exists (default). |
[in] | weight | An optional weight offset. Equivalent of adding this value to the falloff result before clamping. |
[in] | op | (Optional) the object. |
Bool HasContent | ( | BaseContainer * | bc | ) | const |
Checks to see whether the Falloff has any sampling content.
[in] | bc | The basecontainer of the owning object. |
Bool AddFalloffToDescription | ( | Description * | description, |
BaseContainer * | bc, | ||
DESCFLAGS_DESC | flags, | ||
Bool | showValue = true , |
||
Bool | showColor = false , |
||
Bool | showDirection = false , |
||
Bool | showRotation = false |
||
) |
Adds the falloff to a description.
[in] | description | The description to add the falloff GUI to. |
[in] | bc | Optionally pass the container of the object owning the falloff. |
[in] | flags | GetDescription flags. |
[in] | showValue | (Optional) True to show, false to hide the value channel of the FieldList. |
[in] | showColor | (Optional) True to show, false to hide the color channel of the FieldList. |
[in] | showDirection | (Optional) True to show, false to hide the direction channel of the FieldList. |
[in] | showRotation | (Optional) True to show, false to hide the rotation channel of the FieldList. |
Bool Message | ( | Int32 | id, |
BaseContainer * | bc = nullptr , |
||
void * | m_data = nullptr |
||
) |
Sends messages to the falloff.
[in] | id | The message type: MSG |
[in] | bc | Optionally pass the container of the object owning the falloff. |
[in,out] | m_data | The message data. The sender owns the pointed data. |
Int32 GetHandleCount | ( | BaseContainer * | bc = nullptr | ) |
Gets the number of handles for the falloff.
[in] | bc | Optionally pass the container of the object owning the falloff (recommended). Necessary to have user controllable handles. |
void GetHandle | ( | Int32 | i, |
BaseContainer * | bc, | ||
HandleInfo & | info | ||
) |
Gets a handle for the falloff.
[in] | i | The handle index. |
[in] | bc | The falloff's container; normally this is the owning object's container. |
[out] | info | Filled with the information for handle i. |
void SetHandle | ( | Int32 | i, |
Vector | p, | ||
BaseContainer * | bc, | ||
const HandleInfo & | info | ||
) |
Called to set a handle for the falloff.
[in] | i | The handle index. |
[in] | p | The new position for handle i. |
[in] | bc | The falloff's container; normally this is the owning object's container. |
[out] | info | The information for handle i. |
Bool Draw | ( | BaseDraw * | bd, |
BaseDrawHelp * | bh, | ||
DRAWPASS | drawpass, | ||
BaseContainer * | bc = nullptr |
||
) |
Draws the falloff in the viewport.
[in] | bd | The editor's view. The caller owns the pointed base draw. |
[in] | bh | The editor's view help. The caller owns the pointed base draw help. |
[in] | drawpass | The draw pass: DRAWPASS |
[in] | bc | Optionally pass the container of the object owning the falloff (recommended). |
Bool CopyTo | ( | C4D_Falloff * | dest | ) | const |
Copies the falloff.
[out] | dest | The destination falloff. |
Bool GetDEnabling | ( | const DescID & | id, |
const BaseContainer & | bc, | ||
Bool & | enabled | ||
) |
Disables falloff parameters when falloff type is infinite.
[in] | id | The parameter id. |
[in] | bc | The falloff's container; normally this is the owning object's container. |
[out] | enabled | The parameter enabled state. |
Bool IsFields | ( | ) | const |
Checks whether the Falloff is using fields or not.
FIELDLIST_FLAGS GetChannelFlags | ( | ) | const |
When working with Fields this retrieves the current display channel flags for the FieldList
void SetChannelFlags | ( | FIELDLIST_FLAGS | flags, |
BaseContainer * | bc | ||
) |
When working with Fields this sets the channel flags that control how the FieldLIst will display.
[in] | flags | The flags to set. |
[in,out] | bc | If non-null the container of the object the C4D_Falloff belongs to. |