Class MotionData

    Definition

    Namespace:
    Tizen.NUI.Scene3D
    Assembly:
    Tizen.NUI.Scene3D.dll

    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.

    public class MotionData : BaseHandle, INotifyPropertyChanged, IDisposable
    Inheritance
    object
    BindableObject
    Tizen.NUI.Binding.Element
    BaseHandle
    MotionData
    Implements
    System.ComponentModel.INotifyPropertyChanged
    System.IDisposable
    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.

    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.

    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.

    // 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
    public MotionData()
    Remarks

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

    View Source

    MotionData(int)

    Create an initialized motion data with duration.

    Declaration
    public MotionData(int durationMilliseconds)
    Parameters
    Type Name Description
    int durationMilliseconds

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

    Remarks

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

    View Source

    MotionData(MotionData)

    Copy constructor.

    Declaration
    public MotionData(MotionData motionData)
    Parameters
    Type Name Description
    MotionData motionData

    Source object to copy.

    Remarks

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

    Properties

    View Source

    Duration

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

    Declaration
    public int Duration { get; set; }
    Property Value
    Type Description
    int
    Remarks

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

    Methods

    View Source

    Add(MotionIndex, MotionValue)

    Append pair of MotionIndex and MotionValue to the list.

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

    MotionIndex to be added

    MotionValue value

    MotionValue to be added

    Remarks

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

    View Source

    Clear()

    Removes all stored motions.

    Declaration
    public void Clear()
    Remarks

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

    View Source

    GetIndex(uint)

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

    Declaration
    public MotionIndex GetIndex(uint index)
    Parameters
    Type Name Description
    uint index

    The index of motion data list

    Returns
    Type Description
    MotionIndex

    The MotionIndex at position. Or null.

    Remarks

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

    View Source

    GetMotionCount()

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

    Declaration
    public uint GetMotionCount()
    Returns
    Type Description
    uint

    The number of contained motions.

    Remarks

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

    View Source

    GetValue(uint)

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

    Declaration
    public MotionValue GetValue(uint index)
    Parameters
    Type Name Description
    uint index

    The index of motion data list

    Returns
    Type Description
    MotionValue

    The MotionValue at position. Or null.

    Remarks

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

    View Source

    LoadBlendShapeAnimation(string, bool)

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

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

    Name of json format file what we predefined.

    bool synchronousLoad

    Load synchronously or not. Default is async load.

    Remarks

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

    View Source

    LoadBlendShapeAnimationFromBuffer(string, bool)

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

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

    Contents of json format file what we predefined.

    bool synchronousLoad

    Load synchronously or not. Default is async load.

    Remarks

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

    View Source

    LoadMotionCaptureAnimation(string, Vector3, bool)

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

    Declaration
    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.

    bool 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:

    View Source

    LoadMotionCaptureAnimationFromBuffer(string, Vector3, bool)

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

    Declaration
    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.

    bool 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:

    Events

    View Source

    LoadCompleted

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

    Declaration
    public event EventHandler LoadCompleted
    Event Type
    Type Description
    System.EventHandler
    Remarks

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

    Implements

    System.ComponentModel.INotifyPropertyChanged
    System.IDisposable
    • View Source
    Back to top Copyright © 2016-2024 Samsung
    Generated by DocFX