MotionTrackerObject Manual

内容表

关于

The MotionTrackerObject class represents a Cinema 4D motion tracker object. It provides read-only access to properties of the loaded video footage and the created 2D tracks.

MotionTrackerObject objects are an instance of Omotiontracker .

Access

A MotionTrackerObject object can be accessed like any other object.

// This example accesses the Motion Tracker object // to print the used footage filename to the console.

// check if an object is selected and if it is a Motion Tracker object BaseObject * const obj = doc-> GetActiveObject (); if (obj == nullptr || !obj-> IsInstanceOf ( Omotiontracker )) return maxon::IllegalArgumentError( MAXON_SOURCE_LOCATION );

const MotionTrackerObject * const moTrackObject = static_cast< MotionTrackerObject * > (obj);
MtFootageData * footage = moTrackObject-> GetFootageData (); if (footage == nullptr ) return maxon::UnexpectedError( MAXON_SOURCE_LOCATION ); const Filename footageName = footage-> GetFootageName (); ApplicationOutput ( "Footage: " + footageName. GetString ());

// do not forget to free the copy MtFootageData::Free (footage);

Allocation/Deallocation

MotionTrackerObject objects are created with the usual tools:

// This example creates a new motion tracker object and adds it to the scene. MotionTrackerObject * const moTrackObj = MotionTrackerObject::Alloc (); if (moTrackObj == nullptr ) return maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION ); moTrackObj-> SetName ( "New Motion Tracker" _s); doc-> InsertObject (moTrackObj, nullptr , nullptr );

参数

The standard object parameters of the Motion Tracker object can be accessed with C4DAtom::GetParameter() and C4DAtom::SetParameter() . The parameter IDs are defined in omotiontracker.h .

Additionally, footage information can be accessed with MotionTrackerObject::GetFootageData() (see below).

Access Data

Internal data of a MotionTrackerObject can be accessed by acquiring specialised data containers that store information on the footage and the 2D tracking data.

MtFootageData Manual and Mt2dTrackData / Mt2dTrack / MtData Manual .

// This example accesses both footage data and track data // from the given MotionTrackerObject.

// access MtFootageData MtFootageData * footage = moTrackObject-> GetFootageData (); if (footage == nullptr ) return maxon::UnexpectedError( MAXON_SOURCE_LOCATION ); const Int32 firstFrame = footage-> GetFirstFrameNumber (); const Int32 lastFrame = footage-> GetLastFrameNumber (); const String firstFrameStr = String::IntToString (firstFrame); const String lastFrameStr = String::IntToString (lastFrame); ApplicationOutput ( "Footage Range: " + firstFrameStr + " - " + lastFrameStr);

// do not forget to free the copy MtFootageData::Free (footage);

// access Mt2dTrackData Mt2dTrackData * trackData = moTrackObject-> Get2dTrackData (); if (trackData == nullptr ) return maxon::UnexpectedError( MAXON_SOURCE_LOCATION ); const Int32 trackCount = trackData-> GetTrackCount (); ApplicationOutput ( "Track Count: " + String::IntToString (trackCount));

// do not forget to free the copy Mt2dTrackData::Free (trackData);

延伸阅读

Mt2dTrackData
定义: lib_motiontracker.h:70
BaseDocument::InsertObject
void InsertObject(BaseObject *op, BaseObject *parent, BaseObject *pred, Bool checknames=false)
Mt2dTrackData::GetTrackCount
Int32 GetTrackCount() const
BaseObject
定义: c4d_baseobject.h:224
Mt2dTrackData::Free
static void Free(Mt2dTrackData *&p)
Filename
Manages file and path names.
定义: c4d_file.h:93
MtFootageData::GetFootageName
Filename GetFootageName() const
MAXON_SOURCE_LOCATION
#define MAXON_SOURCE_LOCATION
定义: memoryallocationbase.h:66
MotionTrackerObject::Get2dTrackData
Mt2dTrackData * Get2dTrackData() const
Omotiontracker
#define Omotiontracker
Motion tracker.
定义: ge_prepass.h:1034
Filename::GetString
String GetString(void) const
String
定义: c4d_string.h:38
String::IntToString
static String IntToString(Int32 v)
定义: c4d_string.h:495
MotionTrackerObject::GetFootageData
MtFootageData * GetFootageData() const
BaseList2D::SetName
void SetName(const maxon::String &name)
定义: c4d_baselist.h:2324
MtFootageData
定义: lib_motiontracker.h:273
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
ApplicationOutput
#define ApplicationOutput(formatString,...)
定义: debugdiagnostics.h:207
MtFootageData::GetLastFrameNumber
Int32 GetLastFrameNumber() const
BaseDocument::GetActiveObject
BaseObject * GetActiveObject(void)
C4DAtom::IsInstanceOf
Bool IsInstanceOf(Int32 id) const
定义: c4d_baselist.h:1373
MtFootageData::Free
static void Free(MtFootageData *&p)
MotionTrackerObject
定义: lib_motiontracker.h:357
MtFootageData::GetFirstFrameNumber
Int32 GetFirstFrameNumber() const
MotionTrackerObject::Alloc
static MotionTrackerObject * Alloc()

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1