#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).
Public Types | |
| using | IsAllocType = std::true_type |
Private Member Functions | |
| C4D_Falloff () | |
| ~C4D_Falloff () | |
Alloc/Free | |
| static C4D_Falloff * | Alloc (BaseContainer *parentBc, Int cType=0) |
| static void | Free (C4D_Falloff *&node) |
| static void | Free (const C4D_Falloff *&node) |
Dirty | |
| void | SetDirty () |
| Int32 | GetDirty (BaseList2D *op, const BaseDocument *doc) |
Matrix | |
| void | SetMg (const Matrix &mg) |
| const Matrix & | GetMg () const |
Mode | |
| Bool | SetMode (Int32 type) |
| Int32 | GetMode () const |
Handle | |
| Int32 | GetHandleCount () const |
| void | GetHandle (Int32 i, HandleInfo &info) const |
| void | SetHandle (Int32 i, Vector p, const HandleInfo &info) |
| using IsAllocType = std::true_type |
|
private |
|
private |
|
static |
Allocates a falloff. Destroy the allocated falloff with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
| [in] | parentBc | Container of the parent object where all data is stored |
| [in] | cType | (Optional) the type. |
|
static |
|
static |
| BaseContainer* GetContainerInstance | ( | ) |
Gets the last container the falloff should try to use.
| void SetDirty | ( | ) |
Sets the falloff dirty.
| Int32 GetDirty | ( | BaseList2D * | op, |
| const BaseDocument * | doc | ||
| ) |
Gets the falloff dirty value.
| [in] | doc | The document. |
| void SetMg | ( | const Matrix & | mg | ) |
Sets the falloff's matrix.
| [in] | mg | The new matrix. |
| const Matrix& GetMg | ( | ) | const |
Gets the falloff's matrix.
Sets the falloff mode.
| [in] | type | The new falloff mode. |
| Int32 GetMode | ( | ) | const |
Gets the falloff mode.
| void SetTime | ( | BaseTime | time | ) |
Sets the current falloff time.
Used for the animated Spline GUI offset, not for any other values currently.
| [in] | time | The new falloff time. |
| Bool InitFalloff | ( | const BaseDocument * | doc = nullptr, |
| const BaseObject * | op = nullptr |
||
| ) |
Initializes the falloff.
| [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 InitFalloff | ( | const BaseDocument * | doc, |
| const BaseObject * | op, | ||
| FalloffDataData & | data | ||
| ) | const |
| Bool PreSample | ( | const BaseList2D * | op, |
| const BaseDocument * | doc, | ||
| const FieldInput & | inputs, | ||
| FieldOutput & | result, | ||
| const FalloffDataData & | data, | ||
| FIELDSAMPLE_FLAG | flags | ||
| ) | const |
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. |
| void Sample | ( | const BaseList2D * | op, |
| const Vector & | p, | ||
| Float * | result, | ||
| const FieldOutput * | fieldSamples, | ||
| const FalloffDataData & | data, | ||
| Bool | usespline = true, |
||
| Float | weight = 0.0_f, |
||
| Int | index = -1 |
||
| ) | const |
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 BaseList2D * | op, |
| const Vector * | p, | ||
| Float * | result, | ||
| Int | count, | ||
| const FalloffDataData & | data, | ||
| Bool | usespline = true, |
||
| Float | weight = 0.0_f |
||
| ) | const |
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 | ( | ) | const |
Checks to see whether the Falloff has any sampling content.
| Bool AddFalloffToDescription | ( | const BaseList2D * | op, |
| Description * | description, | ||
| DESCFLAGS_DESC | flags, | ||
| Bool | showValue = true, |
||
| Bool | showColor = false, |
||
| Bool | showDirection = false, |
||
| Bool | showRotation = false |
||
| ) | const |
Adds the falloff to a description.
| [in] | description | The description to add the falloff GUI to. |
| [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 | ( | BaseList2D * | op, |
| Int32 | id, | ||
| void * | m_data = nullptr |
||
| ) |
Sends messages to the falloff.
| [in] | id | The message type: MSG |
| [in,out] | m_data | The message data. The sender owns the pointed data. |
| Int32 GetHandleCount | ( | ) | const |
Gets the number of handles for the falloff.
| void GetHandle | ( | Int32 | i, |
| HandleInfo & | info | ||
| ) | const |
Gets a handle for the falloff.
| [in] | i | The handle index. |
| [out] | info | Filled with the information for handle i. |
| void SetHandle | ( | Int32 | i, |
| Vector | p, | ||
| const HandleInfo & | info | ||
| ) |
Called to set a handle for the falloff.
| [in] | i | The handle index. |
| [in] | p | The new position for handle i. |
| [out] | info | The information for handle i. |
| Bool Draw | ( | BaseList2D * | op, |
| BaseDraw * | bd, | ||
| BaseDrawHelp * | bh, | ||
| DRAWPASS | drawpass | ||
| ) |
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 |
| Bool CopyTo | ( | C4D_Falloff * | dest, |
| BaseList2D * | destPtr | ||
| ) | const |
Copies the falloff.
| [out] | dest | The destination falloff. |
Disables falloff parameters when falloff type is infinite.
| [in] | id | The parameter id. |
| [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 | ) |
When working with Fields this sets the channel flags that control how the FieldLIst will display.
| [in] | flags | The flags to set. |
| maxon::Result<Bool> GetAccessedObjects | ( | const BaseList2D * | op, |
| METHOD_ID | method, | ||
| AccessedObjectsCallback & | access | ||
| ) | const |