/* * Copyright(c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using System; using System.ComponentModel; using System.Collections.Generic; using Tizen.NUI; namespace Tizen.NUI.Scene3D { /// /// Specialized to control blend shape. /// We can control the blend shape by index (when we set BlendShapeId as IndexKey), /// or by name (when we set BlendShapeId as StringKey). /// /// /// should be float type. /// /// /// /// BlendShapeIndex blendShapeIndex0 = new BlendShapeIndex(new PropertyKey("nodeName"), new PropertyKey(0u)); /// BlendShapeIndex blendShapeIndex1 = new BlendShapeIndex(new PropertyKey("nodeName"), new PropertyKey("Target_1")); /// /// // We can change the property later. /// BlendShapeIndex blendShapeIndex2 = new BlendShapeIndex; /// blendShapeIndex2.ModelNodeId = new PropertyKey("nodeName"); /// blendShapeIndex2.BlendShapeId = new PropertyKey("Target_2"); /// /// /// /// Specially, if ModelNodeId is invalid and BlendShapeId is StringKey, /// It will control all ModelNode that has the inputed blend shape name. /// /// /// // If "node0" and "node1" has same BlendShape named "Smile", /// // blendShapeIndexAll will control both nodes. /// BlendShapeIndex blendShapeIndexAll = new BlendShapeIndex(new PropertyKey("Smile")); /// /// BlendShapeIndex blendShapeIndex0 = new BlendShapeIndex(new PropertyKey("node0"), new PropertyKey("Smile")); /// BlendShapeIndex blendShapeIndex1 = new BlendShapeIndex(new PropertyKey("node1"), new PropertyKey("Smile")); /// /// /// 11 public class BlendShapeIndex : MotionIndex { /// /// Create an initialized blend shape index. /// /// 11 public BlendShapeIndex() : this(Interop.MotionIndex.BlendShapeIndexNew(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Create an initialized blend shape index with invalid node ID, and given blend shape ID. /// /// Blend shape ID for this motion index /// 11 public BlendShapeIndex(PropertyKey blendShapeId) : this(Interop.MotionIndex.BlendShapeIndexNew(PropertyKey.getCPtr(blendShapeId)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Create an initialized blend shape index with given node ID and blend shape ID. /// /// Node ID for this motion index /// Blend shape ID for this motion index /// 11 public BlendShapeIndex(PropertyKey modelNodeId, PropertyKey blendShapeId) : this(Interop.MotionIndex.BlendShapeIndexNew(PropertyKey.getCPtr(modelNodeId), PropertyKey.getCPtr(blendShapeId)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Create an initialized blend shape index with invalid node ID, and given blend shape string ID. /// /// Blend shape string ID for this motion index /// 11 public BlendShapeIndex(string blendShapeName) : this(Interop.MotionIndex.BlendShapeIndexNew(PropertyKey.getCPtr(new PropertyKey(blendShapeName))), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Create an initialized blend shape index with given node string ID and blend shape string ID. /// /// Node string ID for this motion index /// Blend shape string ID for this motion index /// 11 public BlendShapeIndex(string modelNodeName, string blendShapeName) : this(Interop.MotionIndex.BlendShapeIndexNew(PropertyKey.getCPtr(new PropertyKey(modelNodeName)), PropertyKey.getCPtr(new PropertyKey(blendShapeName))), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Copy constructor. /// /// Source object to copy. /// 11 public BlendShapeIndex(BlendShapeIndex blendShapeIndex) : this(Interop.MotionIndex.NewBlendShapeIndex(BlendShapeIndex.getCPtr(blendShapeIndex)), true, false) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Assignment operator. /// /// Source object to be assigned. /// Reference to this. internal BlendShapeIndex Assign(BlendShapeIndex blendShapeIndex) { BlendShapeIndex ret = new BlendShapeIndex(Interop.MotionIndex.BlendShapeIndexAssign(SwigCPtr, BlendShapeIndex.getCPtr(blendShapeIndex)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal BlendShapeIndex(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn) { } internal BlendShapeIndex(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister) { } /// /// The key of blend shape. /// /// 11 public PropertyKey BlendShapeId { get { return GetBlendShapeId(); } set { SetBlendShapeId(value); } } internal void SetBlendShapeId(PropertyKey blendShapeId) { Interop.MotionIndex.SetBlendShapeId(SwigCPtr, Property.getCPtr(blendShapeId)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal PropertyKey GetBlendShapeId() { IntPtr cPtr = Interop.MotionIndex.GetBlendShapeId(SwigCPtr); PropertyKey ret = new PropertyKey(cPtr, true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Release swigCPtr. /// // This will be public opened. [EditorBrowsable(EditorBrowsableState.Never)] protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr) { Interop.MotionIndex.DeleteBlendShapeIndex(swigCPtr); } } }