-
首页
-
C4D R23.110 C++ SDK
C4D_Falloff Class Reference
#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).
-
注意
-
To add a falloff to a description use
AddFalloffToDescription
.
公共成员函数
|
BaseContainer
*
|
GetContainerInstance
(void)
|
void
|
SetTime
(
BaseTime
time,
BaseContainer
*bc=nullptr)
|
Bool
|
InitFalloff
(
BaseContainer
*bc=nullptr,
BaseDocument
*doc=nullptr,
BaseObject
*op=nullptr)
|
Bool
|
PreSample
(
BaseDocument
*doc,
BaseList2D
*op, const
FieldInput
&inputs,
FIELDSAMPLE_FLAG
flags)
|
const
FieldOutput
*
|
GetSamples
()
|
void
|
Sample
(const
向量
&p,
Float
*result,
Bool
usespline=true,
Float
weight=0.0_f,
BaseList2D
*op=nullptr,
Int
index=-1)
|
void
|
MultiSample
(const
向量
*p,
Float
*result,
Int
count,
Bool
usespline=true,
Float
weight=0.0_f,
BaseList2D
*op=nullptr)
|
Bool
|
HasContent
(
BaseContainer
*bc) const
|
Bool
|
AddFalloffToDescription
(
描述
*description,
BaseContainer
*bc,
DESCFLAGS_DESC
flags,
Bool
showValue=true,
Bool
showColor=false,
Bool
showDirection=false,
Bool
showRotation=false)
|
Bool
|
消息
(
Int32
id,
BaseContainer
*bc=nullptr, void *m_data=nullptr)
|
Bool
|
Draw
(
BaseDraw
*bd,
BaseDrawHelp
*bh,
DRAWPASS
drawpass,
BaseContainer
*bc=nullptr)
|
Bool
|
CopyTo
(
C4D_Falloff
*dest) const
|
Bool
|
GetDEnabling
(const
DescID
&id, const
BaseContainer
&bc,
Bool
&enabled)
|
Bool
|
IsFields
() const
|
FIELDLIST_FLAGS
|
GetChannelFlags
() const
|
void
|
SetChannelFlags
(
FIELDLIST_FLAGS
flags,
BaseContainer
*bc)
|
构造函数 & 析构函数文档编制
◆
C4D_Falloff()
◆
~C4D_Falloff()
成员函数文档编制
◆
Alloc()
Allocates a falloff. Destroy the allocated falloff with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
参数
-
[in]
|
cType
|
(Optional) the type.
|
-
返回
-
The allocated falloff, or
nullptr
if the allocation failed.
◆
Free()
Destructs falloffs allocated with
Alloc()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
参数
-
[in,out]
|
node
|
The falloff to destruct. If the pointer is
nullptr
nothing happens. The pointer is assigned
nullptr
afterwards.
|
◆
GetContainerInstance()
Gets the last container the falloff should try to use.
-
注意
-
If the falloff has not been given a container at any point it will generate one internally.
-
警告
-
Can be
nullptr
. If the falloff has been initialized at some point with a container, but subsequently the original container is no longer available this could be a bad pointer.
-
返回
-
The container instance.
◆
SetDirty()
Sets the falloff dirty.
◆
GetDirty()
Gets the falloff dirty value.
-
注意
-
Useful for checking if the falloff needs to be resampled.
-
参数
-
[in]
|
doc
|
The document.
|
[in]
|
bc
|
Optionally pass the container of the object owning the falloff (recommended).
|
-
返回
-
The dirty value.
◆
SetMg()
Sets the falloff's matrix.
-
参数
-
◆
GetMg()
Gets the falloff's matrix.
-
返回
-
The matrix.
◆
SetData()
Sets the falloff's data directly.
-
参数
-
[in]
|
falldata
|
The new falloff's data.
|
◆
GetData()
Gets the falloff's data.
-
返回
-
The falloff's data.
◆
SetMode()
Sets the falloff mode.
-
注意
-
The falloff mode is normally the falloff's ID (see
ofalloff_panel.h
).
-
参数
-
[in]
|
type
|
The new falloff mode.
|
[in]
|
bc
|
Optionally pass the container of the object owning the falloff (recommended).
|
-
返回
-
true
if the mode was set, otherwise
false
.
◆
GetMode()
Gets the falloff mode.
-
注意
-
The fallof's mode is normally the falloff's ID (see
ofalloff_panel.h
).
-
返回
-
The falloff's mode.
◆
SetTime()
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).
|
◆
InitFalloff()
Initializes the falloff.
-
警告
-
Always call before the sample routines.
-
注意
-
It is recommended to fill at least one of the settings, however not compulsory.
-
参数
-
[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.
|
-
返回
-
true
if successful, otherwise
false
.
◆
PreSample()
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.
|
-
返回
-
true if it succeeds, false if it fails.
◆
GetSamples()
Gets the samples calculated by PreSample.
-
返回
-
null if there are no samples, else the samples.
◆
Sample()
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).
|
◆
MultiSample()
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.
|
◆
HasContent()
Checks to see whether the Falloff has any sampling content.
-
参数
-
[in]
|
bc
|
The basecontainer of the owning object.
|
-
返回
-
True if content, false if not.
◆
AddFalloffToDescription()
Adds the falloff to a description.
-
注意
-
Use this function within the implementation of
NodeData::GetDDescription
.
-
参数
-
[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
.
|
-
返回
-
true
if successful, otherwise
false
.
◆
Message()
Sends messages to the falloff.
-
注意
-
Use this function from within the implementation of
NodeData::Message
to pass all messages on to the falloff, or just send a message with it normally as needed.
-
参数
-
[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.
|
-
返回
-
true
if successful, otherwise
false
.
◆
GetHandleCount()
Gets the number of handles for the falloff.
-
注意
-
Use this function from within the implementation of
ObjectData::GetHandleCount
.
-
参数
-
[in]
|
bc
|
Optionally pass the container of the object owning the falloff (recommended). Necessary to have user controllable handles.
|
-
返回
-
The handle count.
◆
GetHandle()
Gets a handle for the falloff.
-
注意
-
Use this function from within the implementation of
ObjectData::GetHandle
.
-
参数
-
[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
.
|
◆
SetHandle()
Called to set a handle for the falloff.
-
注意
-
Use this function from within the implementation of
ObjectData::SetHandle
.
-
参数
-
[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
.
|
◆
Draw()
Draws the falloff in the viewport.
-
注意
-
Use this function from within the implementation of
ObjectData::Draw
or
ToolData::Draw
.
-
参数
-
[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).
|
-
返回
-
true
if successful, otherwise
false
.
◆
CopyTo()
Copies the falloff.
-
注意
-
Use this function from within the implementation of
NodeData::CopyTo
; necessary for handles to work correctly with the undo system in
Cinema 4D
.
-
参数
-
[out]
|
dest
|
The destination falloff.
|
-
返回
-
true
if successful, otherwise
false
.
◆
GetDEnabling()
Disables falloff parameters when falloff type is infinite.
-
由于
-
R19.SP2
-
注意
-
Use this function within the implementation of
NodeData::GetDEnabling()
:
Bool
MyNodeDataObject::GetDEnabling(
GeListNode
*node,
const
DescID
&
id
,
const
GeData
&t_data,
DESCFLAGS_ENABLE
flags,
const
BaseContainer
*itemdesc)
{
if
(!node)
return
true
;
if
(_fallOff)
// _fallOff is C4D_Falloff* type
{
BaseObject
* op = (
BaseObject
*)node;
if
(op)
{
BaseContainer
* bc = op->
GetDataInstance
();
if
(bc)
{
Bool
enabled =
true
;
Bool
handled = m_pFallOff->GetDEnabling(
id
, *bc, enabled);
if
(handled)
return
enabled;
}
}
}
return
SUPER::GetDEnabling(node,
id
, t_data, flags, itemdesc);
}
-
参数
-
[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.
|
-
返回
-
true
if handled, otherwise
false
.
◆
IsFields()
Checks whether the Falloff is using fields or not.
-
返回
-
@true if the falloff is using fields rather than old falloffs}
◆
GetChannelFlags()
When working with Fields this retrieves the current display channel flags for the
FieldList
-
返回
-
The channel flags.
◆
SetChannelFlags()
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.
|
const BaseContainer * GetDataInstance() const
定义:
c4d_baselist.h:2283
定义:
lib_description.h:327
Represents a C4DAtom that resides in a 4D list.
定义:
c4d_baselist.h:1767
DESCFLAGS_ENABLE
定义:
ge_prepass.h:3132
maxon::Bool Bool
定义:
ge_sys_math.h:53
定义:
c4d_basecontainer.h:46