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#Copypublic 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.
CopyMotionData 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.
CopyMotionData 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
Declaration
C#Copypublic MotionData()
API Level: 11
Declaration
C#Copypublic MotionData(int durationMilliseconds)
Parameters
Type | Name | Description |
---|---|---|
Int32 | durationMilliseconds | Duration of an Animation generated from this motion data, in milliseconds. |
API Level: 11
Declaration
C#Copypublic MotionData(MotionData motionData)
Parameters
Type | Name | Description |
---|---|---|
MotionData | motionData | Source object to copy. |
API Level: 11
Properties
Declaration
C#Copypublic int Duration { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
API Level: 11
Methods
Declaration
C#Copypublic 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
Declaration
C#Copypublic void Clear()
API Level: 11
Declaration
C#Copyprotected override void Dispose(DisposeTypes type)
Parameters
Type | Name | Description |
---|---|---|
DisposeTypes | type | DisposeTypes |
Overrides
Declaration
C#Copypublic 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
GetMotionCount()
Get the number of contained MotionIndex / MotionValue pair what this hold.
Declaration
C#Copypublic uint GetMotionCount()
Returns
Type | Description |
---|---|
UInt32 | The number of contained motions. |
API Level: 11
Declaration
C#Copypublic 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
LoadBlendShapeAnimation(String, Boolean)
Load blendshape animation from json file. After load completed, LoadCompleted event will be invoked.
Declaration
C#Copypublic 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
LoadBlendShapeAnimationFromBuffer(String, Boolean)
Load morphing animation from json string. After load completed, LoadCompleted event will be invoked.
Declaration
C#Copypublic 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
LoadMotionCaptureAnimation(String, Vector3, Boolean)
Load motion capture animation. We support bvh format. After load completes, LoadCompleted event will be invoked.
Declaration
C#Copypublic 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
LoadMotionCaptureAnimationFromBuffer(String, Vector3, Boolean)
Load motion capture animation from string. We support bvh format. After load completes, LoadCompleted event will be invoked.
Declaration
C#Copypublic 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
Declaration
C#Copyprotected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.InteropServices.HandleRef | swigCPtr |
Events
Declaration
C#Copypublic event EventHandler LoadCompleted
Event Type
Type | Description |
---|---|
EventHandler |