FieldInfo Struct Reference

#include <c4d_fielddata.h>

Detailed Description

Thread local information for this field sample invocation.

Public Member Functions

 FieldInfo ()=default
 
 FieldInfo (FieldInfo &&src)
 
 ~FieldInfo ()=default
 
 MAXON_OPERATOR_MOVE_ASSIGNMENT (FieldInfo)
 
Bool IsValid () const
 
Bool IsPopulated () const
 
maxon::Result< void > CopyFrom (const FieldInfo &src)
 

Static Public Member Functions

static maxon::Result< FieldInfoCreate (BaseList2D *caller, FIELDSAMPLE_FLAG callingFlags=FIELDSAMPLE_FLAG::VALUE)
 
static maxon::Result< FieldInfoCreate (BaseList2D *caller, const FieldInput &inputs, FIELDSAMPLE_FLAG callingFlags=FIELDSAMPLE_FLAG::VALUE, Int threadIndex=0, Int threadCount=0)
 
static maxon::Result< FieldInfoCreate (BaseList2D *caller, BaseDocument *doc, FIELDSAMPLE_FLAG callingFlags, const FieldInput &inputs)
 
static maxon::Result< FieldInfoCreate (const FieldCallerStack &caller, BaseDocument *doc, FIELDSAMPLE_FLAG callingFlags, const FieldInput &inputs)
 
static FieldInfo Create (FIELDSAMPLE_FLAG callingFlags, BaseThread *thread, BaseDocument *document, Int currentThreadIndex, Int threadCount, const FieldInput &inputs=FieldInput())
 
static maxon::Result< FieldInfoCreate (FIELDSAMPLE_FLAG callingFlags, BaseThread *thread, BaseDocument *doc, Int currentThreadIndex, Int threadCount, const FieldInput &inputs, const FieldCallerStack &caller)
 
static maxon::Result< FieldInfoCreate (FIELDSAMPLE_FLAG callingFlags, BaseThread *thread, BaseDocument *doc, Int currentThreadIndex, Int threadCount, const FieldInput &inputs, const std::initializer_list< BaseList2D * > &callers)
 

Public Attributes

FIELDSAMPLE_FLAG _flags
 
Int _threadIndex
 
Int _totalThreadCount
 
BaseThread_callerThread
 
BaseDocument_doc
 
FieldInput _inputData
 
FieldCallerStack _callerStack
 

Private Member Functions

 MAXON_DISALLOW_COPY_AND_ASSIGN (FieldInfo)
 

Constructor & Destructor Documentation

◆ FieldInfo() [1/2]

FieldInfo ( )
default

◆ FieldInfo() [2/2]

FieldInfo ( FieldInfo &&  src)

◆ ~FieldInfo()

~FieldInfo ( )
default

Member Function Documentation

◆ MAXON_OPERATOR_MOVE_ASSIGNMENT()

MAXON_OPERATOR_MOVE_ASSIGNMENT ( FieldInfo  )

◆ IsValid()

Bool IsValid ( ) const

Checks if the FieldInfo data is valid. Default (empty) FieldInfo is considered valid.

◆ IsPopulated()

Bool IsPopulated ( ) const

Checks if the FieldInfo is valid and non-empty (all content should be set and ready for sampling)

◆ CopyFrom()

maxon::Result<void> CopyFrom ( const FieldInfo src)

Copies content from the supplied FieldInfo.

Parameters
[in]srcThe source info.
Returns
A maxon::Result.

◆ Create() [1/7]

static maxon::Result<FieldInfo> Create ( BaseList2D caller,
FIELDSAMPLE_FLAG  callingFlags = FIELDSAMPLE_FLAG::VALUE 
)
static

Creates a FieldInfo while relaying potential allocation errors. On error, the result will contain a default FieldInfo structure.

Parameters
[in]callerThe caller object, should belong to the document being used.
[in]callingFlags(Optional) The channel sampling flags expected to be used for sampling.
Returns
A maxon::Result containing the resulting FieldInfo, _inputData will not be populated, if you use this with the "Direct" sampling methods of the FieldList without populating _inputData you will encounter problematic behavior that could lead to crashes.

◆ Create() [2/7]

static maxon::Result<FieldInfo> Create ( BaseList2D caller,
const FieldInput inputs,
FIELDSAMPLE_FLAG  callingFlags = FIELDSAMPLE_FLAG::VALUE,
Int  threadIndex = 0,
Int  threadCount = 0 
)
static

Creates a FieldInfo while relaying potential allocation errors. On error, the result will contain a default FieldInfo structure.

Parameters
[in]callerThe caller object, should belong to the document being used.
[in]inputsThe inputs that will be sampled.
[in]callingFlags(Optional) The channel sampling flags expected to be used for sampling.
[in]threadIndex(Optional) Zero-based index of the thread within the current MP loop alternatively just 0 for the initial thread.
[in]threadCount(Optional) Number of threads to be used, 0 or lower to automatically calculate for MP invocation.
Returns
A maxon::Result containing the resulting FieldInfo.

◆ Create() [3/7]

static maxon::Result<FieldInfo> Create ( BaseList2D caller,
BaseDocument doc,
FIELDSAMPLE_FLAG  callingFlags,
const FieldInput inputs 
)
static

Creates a FieldInfo while relaying potential allocation errors. On error, the result will contain a default FieldInfo structure.

Parameters
[in]callerThe caller object, should belong to the document being used.
[in]docThe document to sample.
[in]callingFlagsThe channel sampling flags expected to be used for sampling.
[in]inputsThe inputs that will be sampled.
Returns
A maxon::Result containing the resulting FieldInfo.

◆ Create() [4/7]

static maxon::Result<FieldInfo> Create ( const FieldCallerStack caller,
BaseDocument doc,
FIELDSAMPLE_FLAG  callingFlags,
const FieldInput inputs 
)
static

Creates a FieldInfo while relaying potential allocation errors. On error, the result will contain a default FieldInfo structure.

Parameters
[in]callerThe caller stack object.
[in]docThe document to sample.
[in]callingFlagsThe channel sampling flags expected to be used for sampling.
[in]inputsThe inputs that will be sampled.
Returns
A maxon::Result containing the resulting FieldInfo.

◆ Create() [5/7]

static FieldInfo Create ( FIELDSAMPLE_FLAG  callingFlags,
BaseThread thread,
BaseDocument document,
Int  currentThreadIndex,
Int  threadCount,
const FieldInput inputs = FieldInput() 
)
static

Creates an incomplete FieldInfo that the user has to fill in with a FieldCallerStack. This overload cannot fail.

Parameters
[in]callingFlagsThe channels to sample.
[in]threadThe caller thread.
[in]documentThe document to sample.
[in]currentThreadIndexThe thread index that will sample those points.
[in]threadCountThe total thread count.
[in]inputsThe full point list.
Returns
The created FieldInfo.

◆ Create() [6/7]

static maxon::Result<FieldInfo> Create ( FIELDSAMPLE_FLAG  callingFlags,
BaseThread thread,
BaseDocument doc,
Int  currentThreadIndex,
Int  threadCount,
const FieldInput inputs,
const FieldCallerStack caller 
)
static

Creates a FieldInfo while relaying potential allocation errors. On error, the result will contain a default FieldInfo structure.

Parameters
[in]callingFlagsThe channels to sample.
[in]threadThe caller thread.
[in]docThe document to sample.
[in]currentThreadIndexThe thread index that will sample those points.
[in]threadCountThe total thread count.
[in]inputsThe full point list.
[in]callerThe caller stack.
Returns
A maxon::Result containing the resulting FieldInfo.

◆ Create() [7/7]

static maxon::Result<FieldInfo> Create ( FIELDSAMPLE_FLAG  callingFlags,
BaseThread thread,
BaseDocument doc,
Int  currentThreadIndex,
Int  threadCount,
const FieldInput inputs,
const std::initializer_list< BaseList2D * > &  callers 
)
static

Creates a FieldInfo while relaying potential allocation errors. On error, the result will contain a default FieldInfo structure.

Parameters
[in]callingFlagsThe channels to sample.
[in]threadThe caller thread.
[in]docThe document to sample.
[in]currentThreadIndexThe thread index that will sample those points.
[in]threadCountThe total thread count.
[in]inputsThe full point list.
[in]callersAn initializer list to build the stack, first item is base of stack.
Returns
A maxon::Result containing the resulting FieldInfo.

◆ MAXON_DISALLOW_COPY_AND_ASSIGN()

MAXON_DISALLOW_COPY_AND_ASSIGN ( FieldInfo  )
private

Member Data Documentation

◆ _flags

The current flags represent which channels are available and should be sampled.

◆ _threadIndex

Int _threadIndex

The current thread index.

◆ _totalThreadCount

Int _totalThreadCount

The number of threads active for this execution.

◆ _callerThread

BaseThread* _callerThread

The calling thread @required.

◆ _doc

BaseDocument* _doc

The calling document @required.

◆ _inputData

FieldInput _inputData

The input data to be sampled, caller owns this object @required.

◆ _callerStack

FieldCallerStack _callerStack

A list of objects that called this calculation as well as an ID for the invocation chain, useful if you need to hash data to a specific caller, this uses the memory addresses of the callers so the value could change on undo/redo and will change on document load @required.