MoData Class Reference

#include <c4d_baseeffectordata.h>

详细描述

Class for handling MoGraph motion data.

公共成员函数

Bool   SetWithEx (const MoDataEx &md)
void  清零 ( Bool reset)
Int   GetMemorySize (void)
AutoLock &  GetAutoLock (void)

私有成员函数

  MoData ()
  ~MoData ()
MoData &  operator= (const MoData &d)
MoData *  operator= ( MoData *d)

Alloc/Free

static MoData *  Alloc (void)
static void  Free ( MoData *&d)

Dirty

UInt32   GetDirty ( MDDIRTY mask= MDDIRTY::NONE ) const
void  SetDirty ( MDDIRTY mask= MDDIRTY::NONE )

Read/Write

Bool   读取 ( HyperFile *hf)
Bool   Write ( HyperFile *hf)

Arrays Length & Number

Bool   SetCount ( Int cnt)
Int   GetCount (void)
Int32   GetArrayCount (void)

Array Information

DescID   GetArrayDescID ( Int32 index) const
Int32   GetArrayID ( Int32 index) const
Int32   GetArrayIndexType ( Int32 index)
Int32   GetArrayType ( Int32 id)
Int   GetArrayIndex (const DescID &id)
Int   GetArrayIndex ( Int32 id)

Get/Set Data Container

BaseContainer *  GetDataInstance (const DescID &id)
BaseContainer *  GetDataInstance ( Int32 id=-1)
BaseContainer *  GetDataIndexInstance ( Int32 index)
BaseContainer   GetData ( Int32 id=-1)
void  SetData (const BaseContainer &bc, Int32 id=-1)

Add/Remove Array

Int32   AddArray (const DescID &id, const maxon::String &name= maxon::String (), Int32 default_flags=0)
Int32   AddArray ( Int32 id, Int32 type, const maxon::String &name= maxon::String (), Int32 default_flags=0)
Bool   RemoveArray (const DescID &id)
Bool   RemoveArray ( Int32 id)

Array Flags

Int32   GetFlags (const DescID &id)
Int32   GetFlags ( Int32 id)
Int32   GetIndexFlags ( Int32 index)
void  SetFlags (const DescID &id, Int32 flags)
void  SetFlags ( Int32 id, Int32 flags)
void  SetIndexFlags ( Int32 index, Int32 flags)
void  SetFlag (const DescID &id, Int32 flag)
void  SetFlag ( Int32 id, Int32 flag)
void  SetIndexFlag ( Int32 index, Int32 flag)
void  DelFlag (const DescID &id, Int32 flag)
void  DelFlag ( Int32 id, Int32 flag)
void  DelIndexFlag ( Int32 index, Int32 flag)

Array name

void  SetName (const DescID &id, const maxon::String &name)
void  SetName ( Int32 id, const maxon::String &name)
void  SetIndexName ( Int32 index, const maxon::String &name)
String   GetName (const DescID &id)
String   GetName ( Int32 id)
String   GetIndexName ( Int32 index)

Get Array By DescID

void *  GetArray (const DescID &id) const
MDArray < Char >  GetCharArray (const DescID &id, Char default_value=0) const
MDArray < UChar >  GetUCharArray (const DescID &id, UChar default_value=0) const
MDArray < Int32 >  GetLongArray (const DescID &id, Int32 default_value=0) const
MDArray < UInt32 >  GetULongArray (const DescID &id, UInt32 default_value=0) const
MDArray < Bool >  GetBoolArray (const DescID &id, Bool default_value=true) const
MDArray < Int64 >  GetLLongArray (const DescID &id, Int64 default_value=0) const
MDArray < Float >  GetRealArray (const DescID &id, Float default_value=1.0) const
MDArray < 矩阵 >  GetMatrixArray (const DescID &id, 矩阵 default_value= 矩阵 ()) const
MDArray < 向量 >  GetVectorArray (const DescID &id, 向量 default_value= 向量 ()) const

Get Array By ID

void *  GetArray ( Int32 id, MD_TYPE type= MD_TYPE::MD_NONE ) const
MDArray < Char >  GetCharArray ( Int32 id, Char default_value=0) const
MDArray < UChar >  GetUCharArray ( Int32 id, UChar default_value=0) const
MDArray < Int32 >  GetLongArray ( Int32 id, Int32 default_value=0) const
MDArray < UInt32 >  GetULongArray ( Int32 id, UInt32 default_value=0) const
MDArray < Bool >  GetBoolArray ( Int32 id, Bool default_value=true) const
MDArray < Int64 >  GetLLongArray ( Int32 id, Int64 default_value=0) const
MDArray < Float >  GetRealArray ( Int32 id, Float default_value=1.0) const
MDArray < 矩阵 >  GetMatrixArray ( Int32 id, 矩阵 default_value= 矩阵 ()) const
MDArray < 向量 >  GetVectorArray ( Int32 id, 向量 default_value= 向量 ()) const

Get Array By Index

void *  GetIndexArray ( Int32 index) const
MDArray < Char >  GetCharIndexArray ( Int32 index) const
MDArray < UChar >  GetUCharIndexArray ( Int32 index) const
MDArray < Int32 >  GetLongIndexArray ( Int32 index) const
MDArray < UInt32 >  GetULongIndexArray ( Int32 index) const
MDArray < Bool >  GetBoolIndexArray ( Int32 index) const
MDArray < Int64 >  GetLLongIndexArray ( Int32 index) const
MDArray < Float >  GetRealIndexArray ( Int32 index) const
MDArray < 矩阵 >  GetMatrixIndexArray ( Int32 index) const
MDArray < 向量 >  GetVectorIndexArray ( Int32 index) const

Copy/Merge

Bool   CopyTo ( MoData *dest, Bool merge_data=false, Int max_count=-1)
Bool   MergeData ( MoData *source, Float percent)

杂项

void  Flush (void)
void  SetOffset ( Int offset=0)
void  SetLimit ( Int limit=-1)

构造函数 & 析构函数文档编制

◆  MoData()

MoData () private

◆  ~MoData()

~ MoData () private

成员函数文档编制

◆  operator=() [1/2]

MoData & operator= ( const MoData &  d )
private

◆  operator=() [2/2]

MoData * operator= ( MoData *  d )
private

◆  Alloc()

static MoData * Alloc ( void  )
static

Allocates a motion data. Destroy the allocated motion data with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

返回
The allocated motion data, or nullptr if the allocation failed.

◆  Free()

static void Free ( MoData *&  d )
static

Destructs motion data allocated with Alloc() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

参数
[in,out] d The motion data to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆  GetDirty()

UInt32 GetDirty ( MDDIRTY   mask = MDDIRTY::NONE ) const

Gets the dirty count. Can be used to check if something has changed.

参数
[in] mask The dirty flag mask. Can be a combination of: DIRTYFLAGS
返回
The dirty count.

◆  SetDirty()

void SetDirty ( MDDIRTY   mask = MDDIRTY::NONE )

Marks the data as dirty.

参数
[in] mask The dirty flag mask. Can be a combination of: DIRTYFLAGS

◆  SetWithEx()

Bool SetWithEx ( const MoDataEx &  md )

Initializes the data with MoDataEx.

参数
[in] md The data to use for initializing.
返回
true if motion data was successfully initialized, otherwise false .

◆  Clear()

void Clear ( Bool   reset )

Clears the data in the arrays.

参数
[in] reset 若 true , the arrays will be filled with their default values.

◆  Read()

Bool 读取 ( HyperFile *  hf )

Reads the data from a hyper file.

参数
[in] hf The hyper file to read from. The caller owns the pointed hyper file.
返回
true if the data was read, otherwise false .

◆  Write()

Bool Write ( HyperFile *  hf )

Writes the data to a hyper file.

参数
[in] hf The hyper file to write to. The caller owns the pointed hyper file.
返回
true if the data was written, otherwise false .

◆  GetMemorySize()

Int GetMemorySize ( void  )

Gets the size of the data in bytes.

返回
The size of the data.

◆  SetCount()

Bool SetCount ( Int   cnt )

Sets the length of the arrays.

参数
[in] cnt The new length of the arrays.
返回
true if the length was set, otherwise false .

◆  GetCount()

Int GetCount ( void  )

Gets the length of the arrays.

返回
The length of the arrays.

◆  GetArrayCount()

Int32 GetArrayCount ( void  )

Gets the number of arrays.

返回
The number of arrays.

◆  GetArrayDescID()

DescID GetArrayDescID ( Int32   index ) const

Gets the description ID for the specified array index .

参数
[in] index The array index. 0 <= index < GetArrayCount()
返回
The description ID.

◆  GetArrayID()

Int32 GetArrayID ( Int32   index ) const

Gets the ID for the specified array index .

参数
[in] index The array index. 0 <= index < GetArrayCount()
返回
The array ID: MODATA_IDS

◆  GetArrayIndexType()

Int32 GetArrayIndexType ( Int32   index )

Gets the data type of the specified array index .

参数
[in] index The array index. 0 <= index < GetArrayCount()
返回
The data type: DTYPE

◆  GetArrayType()

Int32 GetArrayType ( Int32   id )

Gets the data type of the specified array id .

参数
[in] id The array ID: MODATA_IDS
返回
The type: DTYPE

◆  GetArrayIndex() [1/2]

Int GetArrayIndex ( const DescID &  id )

Gets the array index for the specified description id .

参数
[in] id The description ID.
返回
The array index.

◆  GetArrayIndex() [2/2]

Int GetArrayIndex ( Int32   id )

Gets the array index for the specified array id .

参数
[in] id The array ID: MODATA_IDS
返回
The array index.

◆  GetDataInstance() [1/2]

BaseContainer * GetDataInstance ( const DescID &  id )

Gets a pointer to the container for the specified array description id .

参数
[in] id The description ID.
返回
A pointer to the internal container. The motion data object owns the pointed container.

◆  GetDataInstance() [2/2]

BaseContainer * GetDataInstance ( Int32   id = -1 )

Gets a pointer to the container for the specified array id .

参数
[in] id The array ID: MODATA_IDS
返回
A pointer to the internal container. The motion data object owns the pointed container.

◆  GetDataIndexInstance()

BaseContainer * GetDataIndexInstance ( Int32   index )

Gets a pointer to the container for the specified array index .

参数
[in] index The array index. 0 <= index < GetArrayCount()
返回
A pointer to the internal container. The motion data object owns the pointed container.

◆  GetData()

BaseContainer GetData ( Int32   id = -1 )

Gets a copy of the container for the specified array id .

参数
[in] id The array ID: MODATA_IDS
返回
A copy of the array's container.

◆  SetData()

void SetData ( const BaseContainer &  bc ,
Int32   id = -1  
)

Sets the the container for the specified array id .

参数
[in] bc The container to set.
[in] id The array ID: MODATA_IDS

◆  GetAutoLock()

AutoLock & GetAutoLock ( void  )

Must be used to lock the class with AutoLocker prior to accessing the MoData values directly to prevent threading issues and therefore crashes.

AutoLocker al(modata.GetAutoLock());
返回
The AutoLock used for locking the class.

◆  AddArray() [1/2]

Int32 AddArray ( const DescID &  id ,
const maxon::String &  name = maxon::String() ,
Int32   default_flags = 0  
)

Adds the specified array.

参数
[in] id The description ID of the array.
[in] name The name of the array.
[in] default_flags The default flags: MOGENFLAG
返回
The index of the added array or NOTOK if the method failed.

◆  AddArray() [2/2]

Int32 AddArray ( Int32   id ,
Int32   type ,
const maxon::String &  name = maxon::String() ,
Int32   default_flags = 0  
)

Adds the specified array.

参数
[in] id The array ID: MODATA_IDS
[in] type The type: DTYPE
[in] name The name of the array.
[in] default_flags The default flags: MOGENFLAG
返回
The index of the added array or NOTOK if the method failed.

◆  RemoveArray() [1/2]

Bool RemoveArray ( const DescID &  id )

Removes the specified array.

参数
[in] id The description ID of the array.
返回
true if the array was removed, otherwise false .

◆  RemoveArray() [2/2]

Bool RemoveArray ( Int32   id )

Removes the specified array.

参数
[in] id The array ID: MODATA_IDS
返回
true if the array was removed, otherwise false .

◆  GetFlags() [1/2]

Int32 GetFlags ( const DescID &  id )

Unused .

◆  GetFlags() [2/2]

Int32 GetFlags ( Int32   id )

Unused .

◆  GetIndexFlags()

Int32 GetIndexFlags ( Int32   index )

Unused .

◆  SetFlags() [1/2]

void SetFlags ( const DescID &  id ,
Int32   flags  
)

Unused .

◆  SetFlags() [2/2]

void SetFlags ( Int32   id ,
Int32   flags  
)

Unused .

◆  SetIndexFlags()

void SetIndexFlags ( Int32   index ,
Int32   flags  
)

Unused .

◆  SetFlag() [1/2]

void SetFlag ( const DescID &  id ,
Int32   flag  
)

Unused .

◆  SetFlag() [2/2]

void SetFlag ( Int32   id ,
Int32   flag  
)

Unused .

◆  SetIndexFlag()

void SetIndexFlag ( Int32   index ,
Int32   flag  
)

Unused .

◆  DelFlag() [1/2]

void DelFlag ( const DescID &  id ,
Int32   flag  
)

Unused .

◆  DelFlag() [2/2]

void DelFlag ( Int32   id ,
Int32   flag  
)

Unused .

◆  DelIndexFlag()

void DelIndexFlag ( Int32   index ,
Int32   flag  
)

Unused .

◆  SetName() [1/2]

void SetName ( const DescID &  id ,
const maxon::String &  name  
)

Sets the name for the specified array description id .

参数
[in] id The description ID of the array.
[in] name The name of the array to set.

◆  SetName() [2/2]

void SetName ( Int32   id ,
const maxon::String &  name  
)

Sets the name for the specified array id .

参数
[in] id The array ID: MODATA_IDS
[in] name The name of the array to set.

◆  SetIndexName()

void SetIndexName ( Int32   index ,
const maxon::String &  name  
)

Sets the name for the specified array index .

参数
[in] index The array index. 0 <= index < GetArrayCount()
[in] name The name of the array to set.

◆  GetName() [1/2]

String GetName ( const DescID &  id )

Gets the name of the specified array description id .

参数
[in] id The description ID of the array.
返回
The name of the array.

◆  GetName() [2/2]

String GetName ( Int32   id )

Gets the name of the specified array id .

参数
[in] id The array ID: MODATA_IDS
返回
The name of the array.

◆  GetIndexName()

String GetIndexName ( Int32   index )

Gets the name of the specified array index .

参数
[in] index The array index. 0 <= index < GetArrayCount()
返回
The name of the array.

◆  GetArray() [1/2]

void* GetArray ( const DescID &  id ) const

Gets a void pointer to an array.

参数
[in] id The description ID of the array.
返回
The pointer to the array.

◆  GetCharArray() [1/2]

MDArray < Char > GetCharArray ( const DescID &  id ,
Char   default_value = 0  
) const

Gets a Char array.

参数
[in] id The description ID of the array.
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetUCharArray() [1/2]

MDArray < UChar > GetUCharArray ( const DescID &  id ,
UChar   default_value = 0  
) const

Gets a UChar array.

参数
[in] id The description ID of the array.
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetLongArray() [1/2]

MDArray < Int32 > GetLongArray ( const DescID &  id ,
Int32   default_value = 0  
) const

Gets an Int32 / Long array.

参数
[in] id The description ID of the array.
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetULongArray() [1/2]

MDArray < UInt32 > GetULongArray ( const DescID &  id ,
UInt32   default_value = 0  
) const

Gets a UInt32 / ULong array.

参数
[in] id The description ID of the array.
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetBoolArray() [1/2]

MDArray < Bool > GetBoolArray ( const DescID &  id ,
Bool   default_value = true  
) const

Gets a Bool array.

参数
[in] id The description ID of the array.
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetLLongArray() [1/2]

MDArray < Int64 > GetLLongArray ( const DescID &  id ,
Int64   default_value = 0  
) const

Gets an Int64 / LLong array.

参数
[in] id The description ID of the array.
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetRealArray() [1/2]

MDArray < Float > GetRealArray ( const DescID &  id ,
Float   default_value = 1.0  
) const

Gets a Float /Real array.

参数
[in] id The description ID of the array.
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetMatrixArray() [1/2]

MDArray < 矩阵 > GetMatrixArray ( const DescID &  id ,
矩阵   default_value = Matrix()  
) const

Gets a 矩阵 array.

参数
[in] id The description ID of the array.
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetVectorArray() [1/2]

MDArray < 向量 > GetVectorArray ( const DescID &  id ,
向量   default_value = Vector()  
) const

Gets a 向量 array.

参数
[in] id The description ID of the array.
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetArray() [2/2]

void* GetArray ( Int32   id ,
MD_TYPE   type = MD_TYPE::MD_NONE  
) const

Gets a void pointer to an array.

参数
[in] id The ID of the array: MODATA_IDS
[in] type The type of the array: MD_TYPE
返回
The pointer to the array.

◆  GetCharArray() [2/2]

MDArray < Char > GetCharArray ( Int32   id ,
Char   default_value = 0  
) const

Gets a Char array.

参数
[in] id The ID of the array: MODATA_IDS
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetUCharArray() [2/2]

MDArray < UChar > GetUCharArray ( Int32   id ,
UChar   default_value = 0  
) const

Gets a UChar array.

参数
[in] id The ID of the array: MODATA_IDS
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetLongArray() [2/2]

MDArray < Int32 > GetLongArray ( Int32   id ,
Int32   default_value = 0  
) const

Gets an Int32 /Long array.

参数
[in] id The ID of the array: MODATA_IDS
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetULongArray() [2/2]

MDArray < UInt32 > GetULongArray ( Int32   id ,
UInt32   default_value = 0  
) const

Gets a UInt32 /ULong array.

参数
[in] id The ID of the array: MODATA_IDS
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetBoolArray() [2/2]

MDArray < Bool > GetBoolArray ( Int32   id ,
Bool   default_value = true  
) const

Gets a Bool array.

参数
[in] id The ID of the array: MODATA_IDS
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetLLongArray() [2/2]

MDArray < Int64 > GetLLongArray ( Int32   id ,
Int64   default_value = 0  
) const

Gets a Int64 /LLong array.

参数
[in] id The ID of the array: MODATA_IDS
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetRealArray() [2/2]

MDArray < Float > GetRealArray ( Int32   id ,
Float   default_value = 1.0  
) const

Gets a Float /Real array.

参数
[in] id The ID of the array: MODATA_IDS
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetMatrixArray() [2/2]

MDArray < 矩阵 > GetMatrixArray ( Int32   id ,
矩阵   default_value = Matrix()  
) const

Gets a 矩阵 array.

参数
[in] id The ID of the array: MODATA_IDS
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetVectorArray() [2/2]

MDArray < 向量 > GetVectorArray ( Int32   id ,
向量   default_value = Vector()  
) const

Gets a 向量 array.

参数
[in] id The ID of the array: MODATA_IDS
[in] default_value The default value of the array.
返回
The retrieved array.

◆  GetIndexArray()

void* GetIndexArray ( Int32   index ) const

Gets a void pointer to an array.

参数
[in] index The index of the array: 0 <= index < GetArrayCount()
返回
The pointer to the array.

◆  GetCharIndexArray()

MDArray < Char > GetCharIndexArray ( Int32   index ) const

Gets a Char array.

参数
[in] index The index of the array: 0 <= index < GetArrayCount()
返回
The retrieved array.

◆  GetUCharIndexArray()

MDArray < UChar > GetUCharIndexArray ( Int32   index ) const

Gets a UChar array.

参数
[in] index The index of the array: 0 <= index < GetArrayCount()
返回
The retrieved array.

◆  GetLongIndexArray()

MDArray < Int32 > GetLongIndexArray ( Int32   index ) const

Gets an Int32 /Long array.

参数
[in] index The index of the array: 0 <= index < GetArrayCount()
返回
The retrieved array.

◆  GetULongIndexArray()

MDArray < UInt32 > GetULongIndexArray ( Int32   index ) const

Gets a UInt32 /ULong array.

参数
[in] index The index of the array: 0 <= index < GetArrayCount()
返回
The retrieved array.

◆  GetBoolIndexArray()

MDArray < Bool > GetBoolIndexArray ( Int32   index ) const

Gets a Bool array.

参数
[in] index The index of the array: 0 <= index < GetArrayCount()
返回
The retrieved array.

◆  GetLLongIndexArray()

MDArray < Int64 > GetLLongIndexArray ( Int32   index ) const

Gets a Int64 /LLong array.

参数
[in] index The index of the array: 0 <= index < GetArrayCount()
返回
The retrieved array.

◆  GetRealIndexArray()

MDArray < Float > GetRealIndexArray ( Int32   index ) const

Gets a Float /Real array.

参数
[in] index The index of the array: 0 <= index < GetArrayCount()
返回
The retrieved array.

◆  GetMatrixIndexArray()

MDArray < 矩阵 > GetMatrixIndexArray ( Int32   index ) const

Gets a 矩阵 array.

参数
[in] index The index of the array: 0 <= index < GetArrayCount()
返回
The retrieved array.

◆  GetVectorIndexArray()

MDArray < 向量 > GetVectorIndexArray ( Int32   index ) const

Gets a 向量 array.

参数
[in] index The index of the array: 0 <= index < GetArrayCount()
返回
The retrieved array.

◆  CopyTo()

Bool CopyTo ( MoData *  dest ,
Bool   merge_data = false ,
Int   max_count = -1  
)

Copies the MoGraph data to dest .

参数
[in] dest The destination MoGraph data. The caller owns the pointed data.
[in] merge_data 若 true the source and destination data are merged. If false a straight one-to-one copy is made.
For instance if the source contains a matrix array and the destination a matrix and a real array the real array will still exist after the merge action.
[in] max_count The maximum number of array elements to copy. This limits the array size of the copy.
返回
true if the MoGraph data was copied, otherwise false .

◆  MergeData()

Bool MergeData ( MoData *  source ,
Float   percent  
)

Merges the MoGraph data with another.

参数
[in] source The source MoGraph data. The caller owns the pointed data.
[in] percent The blend factor for the merge of the data, going from 0.0 to 1.0 ( 0 to 100% ).
返回
true if the MoGraph data was merged, otherwise false .

◆  Flush()

void Flush ( void  )

Flushes the MoGraph data.
All data is cleared and the arrays are freed.

◆  SetOffset()

void SetOffset ( Int   offset = 0 )

Sets an offset from the beginning of the arrays, for example array[0] becomes array[offset].

参数
[in] offset The array offset: 0 <= offset < GetCount()

◆  SetLimit()

void SetLimit ( Int   limit = -1 )

Sets a limit for the array. All data is kept internally. Can be useful for certain cases for instance merging.

参数
[in] limit The array limit: 0 <= limit < GetCount()
AutoLocker
定义: c4d_thread.h:297