Class MotionData

Definition

Namespace:
Tizen.NUI.Scene3D
Assembly:
Tizen.NUI.Scene3D.dll
API Level:
11

List of model motion definitions. Each motion has pair of MotionIndex and MotionValue. MotionIndex is abstract class that specify the target of motion. MotionValue is destination value of target for the motion. It can be expressed with PropertyValue or KeyFrames.

C#
Copy
public class MotionData : BaseHandle, IDynamicResourceHandler, IElement, INameScope, IElementController, System.IDisposable
Inheritance
Implements
Remarks

We don't check duplicated MotionIndex internally. We don't check MotionValue type is matched with MotionIndex.

Examples

We can generate list of motions by MotionIndex and MotionValue classes.

Copy
MotionData motionData = new MotionData(3.0f); // Make MotionIndex with MotionPropertyIndex // Make MotionValue with PropertyValue motionData.Add(new MotionPropertyIndex(new PropertyKey("nodeName"), new PropertyKey("color")), new MotionValue(new PropertyValue(Color.Red))); // Make MotionIndex with MotionTransformIndex // Make MotionValue with Dali::KeyFrames KeyFrames keyFrames = new KeyFrames(); keyFrames.Add(0.0f, 0.0f); keyFrames.Add(0.0f, 1.0f); motionData.Add(new MotionTransformIndex(new PropertyKey("nodeName"), MotionTransformIndex.TransformType.PositionX), new MotionValue(keyFrames)); // Make MotionIndex with BlendShapeIndex motionData.Add(new BlendShapeIndex(new PropertyKey("nodeName"), new PropertyKey("blendShapeName")), motionData.GetValue(1u));

We can request to load MotionData from file or buffer asynchronously. If load completed, LoadCompleted event will be invoked. If we try to load before LoadCompleted event invoked, previous load request cancel and only latest request loaded.

Copy
MotionData motionData = new MotionData(); motionData.LoadCompleted += OnLoadCompleted; motionData.LoadBvh("bvhFilename.bvh", Vector3.One); ... void OnLoadCompleted(object o, event e) { MotionData motionData = o as MotionData; /// Do something. }

We can generate animation of Scene3D.Model from MotionData class. Or, just set values.

Copy
// Generate animation from loaded Model Animation animation = model.GenerateMotionDataAnimation(motionData); animation.Play(); // Set values from loaded Model. model2.SetMotionData(motionData);

Constructors

View Source

MotionData()

Create an initialized, empty motion data.

Declaration
C#
Copy
public MotionData()
API Level: 11
View Source

MotionData(Int32)

Create an initialized motion data with duration.

Declaration
C#
Copy
public MotionData(int durationMilliseconds)
Parameters
Type Name Description
Int32 durationMilliseconds

Duration of an Animation generated from this motion data, in milliseconds.

API Level: 11
View Source

MotionData(MotionData)

Copy constructor.

Declaration
C#
Copy
public MotionData(MotionData motionData)
Parameters
Type Name Description
MotionData motionData

Source object to copy.

API Level: 11

Properties

View Source

Duration

Get or set the duration of this motion data in milliseconds.

Declaration
C#
Copy
public int Duration { get; set; }
Property Value
Type Description
Int32
API Level: 11

Methods

View Source

Add(MotionIndex, MotionValue)

Append pair of MotionIndex and MotionValue to the list.

Declaration
C#
Copy
public void Add(MotionIndex index, MotionValue value)
Parameters
Type Name Description
MotionIndex index

MotionIndex to be added

MotionValue value

MotionValue to be added

API Level: 11
View Source

Clear()

Removes all stored motions.

Declaration
C#
Copy
public void Clear()
API Level: 11
View Source

Dispose(DisposeTypes)

you can override it to clean-up your own resources.

Declaration
C#
Copy
protected override void Dispose(DisposeTypes type)
Parameters
Type Name Description
DisposeTypes type

DisposeTypes

Overrides
View Source

GetIndex(UInt32)

Get MotionIndex at position, or null if invalid index was given.

Declaration
C#
Copy
public MotionIndex GetIndex(uint index)
Parameters
Type Name Description
UInt32 index

The index of motion data list

Returns
Type Description
MotionIndex

The MotionIndex at position. Or null.

API Level: 11
View Source

GetMotionCount()

Get the number of contained MotionIndex / MotionValue pair what this hold.

Declaration
C#
Copy
public uint GetMotionCount()
Returns
Type Description
UInt32

The number of contained motions.

API Level: 11
View Source

GetValue(UInt32)

Get MotionValue at position, or null if invalid index was given.

Declaration
C#
Copy
public MotionValue GetValue(uint index)
Parameters
Type Name Description
UInt32 index

The index of motion data list

Returns
Type Description
MotionValue

The MotionValue at position. Or null.

API Level: 11
View Source

LoadBlendShapeAnimation(String, Boolean)

Load blendshape animation from json file. After load completed, LoadCompleted event will be invoked.

Declaration
C#
Copy
public void LoadBlendShapeAnimation(string blendShapeFilename, bool synchronousLoad = false)
Parameters
Type Name Description
String blendShapeFilename

Name of json format file what we predefined.

Boolean synchronousLoad

Load synchronously or not. Default is async load.

API Level: 11
View Source

LoadBlendShapeAnimationFromBuffer(String, Boolean)

Load morphing animation from json string. After load completed, LoadCompleted event will be invoked.

Declaration
C#
Copy
public void LoadBlendShapeAnimationFromBuffer(string blendShapeBuffer, bool synchronousLoad = false)
Parameters
Type Name Description
String blendShapeBuffer

Contents of json format file what we predefined.

Boolean synchronousLoad

Load synchronously or not. Default is async load.

API Level: 11
View Source

LoadMotionCaptureAnimation(String, Vector3, Boolean)

Load motion capture animation. We support bvh format. After load completes, LoadCompleted event will be invoked.

Declaration
C#
Copy
public void LoadMotionCaptureAnimation(string motionCaptureFilename, Vector3 scale = null, bool synchronousLoad = false)
Parameters
Type Name Description
String motionCaptureFilename

Name of motion capture format file.

Vector3 scale

Scale value of motion capture animation match with model.

Boolean synchronousLoad

Load synchronously or not. Default is async load.

Remarks

Scale is additional scale factor of motion capture animation. It is possible that Model's scale may not match with motion capture animation scale. If scale is null, default value will be used:

API Level: 11
View Source

LoadMotionCaptureAnimationFromBuffer(String, Vector3, Boolean)

Load motion capture animation from string. We support bvh format. After load completes, LoadCompleted event will be invoked.

Declaration
C#
Copy
public void LoadMotionCaptureAnimationFromBuffer(string motionCaptureBuffer, Vector3 scale = null, bool synchronousLoad = false)
Parameters
Type Name Description
String motionCaptureBuffer

Contents of motion capture format string.

Vector3 scale

Scale value of motion capture animation match with model.

Boolean synchronousLoad

Load synchronously or not. Default is async load.

Remarks

Scale is additional scale factor of motion capture animation. It is possible that Model's scale may not match with motion capture animation scale. If scale is null, default value will be used:

API Level: 11
View Source

ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef)

Release swigCPtr.

Declaration
C#
Copy
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
Parameters
Type Name Description
System.Runtime.InteropServices.HandleRef swigCPtr

Events

View Source

LoadCompleted

LoadCompleted event. It will be invoked only for latest load request.

Declaration
C#
Copy
public event EventHandler LoadCompleted
Event Type
Type Description
EventHandler
API Level: 11

Implements

Extension Methods