[global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_Node_FindChildModelNodeByName")]
public static extern global::System.IntPtr FindChildModelNodeByName(global::System.Runtime.InteropServices.HandleRef model, string nodeName);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_Node_GetChildModelNodeCount")]
+ public static extern uint GetChildModelNodeCount(global::System.Runtime.InteropServices.HandleRef model);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_Node_GetChildModelNodeAt")]
+ public static extern global::System.IntPtr GetChildModelNodeAt(global::System.Runtime.InteropServices.HandleRef model, uint index);
}
}
}
/// <since_tizen> 10 </since_tizen>
public partial class Model : View
{
+ private bool isBuilt = false;
internal Model(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
{
}
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
this.PositionUsesPivotPoint = true;
+ ResourcesLoaded += OnResourcesLoaded;
}
/// <summary>
return scaleFactor;
}
+ private void OnResourcesLoaded(object sender, EventArgs e)
+ {
+ if(!isBuilt && this.ModelRoot != null)
+ {
+ this.ModelRoot.Build();
+ isBuilt = true;
+ }
+ }
+
+ /// <summary>
+ /// To make transitionSet instance be disposed.
+ /// </summary>
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ ResourcesLoaded -= OnResourcesLoaded;
+ base.Dispose(type);
+ }
+
/// <summary>
/// Release swigCPtr.
/// </summary>
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
+using System.Collections.Generic;
using Tizen.NUI;
using Tizen.NUI.Binding;
using Tizen.NUI.BaseComponents;
}
/// <summary>
- /// Removes Returns a child ModelNode object with a name that matches nodeName.
+ /// Returns a child ModelNode object with a name that matches nodeName.
/// </summary>
/// <param name="nodeName">The name of the child ModelNode object you want to find.</param>
/// <returns>Child ModelNode that has nodeName as name.</returns>
}
/// <summary>
+ /// Build C# ModelNode Tree
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal void Build()
+ {
+ List<ModelNode> childModelNodes = new List<ModelNode>();
+ uint childModelNodeCount = GetChildModelNodeCount();
+ for(uint i = 0; i < childModelNodeCount; ++i)
+ {
+ ModelNode modelNode = GetChildModelNodeAt(i);
+ childModelNodes.Add(modelNode);
+ modelNode.Build();
+ }
+
+ foreach(ModelNode node in childModelNodes)
+ {
+ this.Add(node);
+ }
+ }
+
+ /// <summary>
+ /// Gets the number of child objects in the ModelNode object.
+ /// </summary>
+ /// <returns>The number of childchild objects in the ModelNode object.</returns>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ private uint GetChildModelNodeCount()
+ {
+ uint ret = Interop.ModelNode.GetChildModelNodeCount(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Returns a child ModelNode object at the index.
+ /// </summary>
+ /// <param name="index">The index of child ModelNode object you want to find.</param>
+ /// <returns>Child ModelNode</returns>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ private ModelNode GetChildModelNodeAt(uint index)
+ {
+ global::System.IntPtr cPtr = Interop.ModelNode.GetChildModelNodeAt(SwigCPtr, index);
+ ModelNode ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as ModelNode;
+ if (ret == null)
+ {
+ // Store the value of PositionUsesAnchorPoint from dali object (Since View object automatically change PositionUsesPivotPoint value as false, we need to keep value.)
+ HandleRef handle = new HandleRef(this, cPtr);
+ bool originalPositionUsesAnchorPoint = Object.InternalGetPropertyBool(handle, View.Property.PositionUsesAnchorPoint);
+ handle = new HandleRef(null, IntPtr.Zero);
+
+ // Register new animatable into Registry.
+ ret = new ModelNode(cPtr, true);
+ ret.PositionUsesPivotPoint = originalPositionUsesAnchorPoint;
+ }
+ else
+ {
+ // We found matched NUI animatable. Reduce cPtr reference count.
+ HandleRef handle = new HandleRef(this, cPtr);
+ Tizen.NUI.Interop.BaseHandle.DeleteBaseHandle(handle);
+ handle = new HandleRef(null, IntPtr.Zero);
+ }
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
/// Release swigCPtr.
/// </summary>
// This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
private Geometry GetGeometry()
{
IntPtr cPtr = Interop.ModelPrimitive.GetGeometry(SwigCPtr);
+ Geometry ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Geometry;
+ if (ret == null)
+ {
+ HandleRef handle = new HandleRef(this, cPtr);
+ handle = new HandleRef(null, IntPtr.Zero);
+
+ ret = new Geometry(cPtr, true);
+ }
+ else
+ {
+ HandleRef handle = new HandleRef(this, cPtr);
+ Tizen.NUI.Interop.BaseHandle.DeleteBaseHandle(handle);
+ handle = new HandleRef(null, IntPtr.Zero);
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- Geometry ret = (cPtr == IntPtr.Zero) ? null : Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Geometry;
return ret;
}
[EditorBrowsable(EditorBrowsableState.Never)]
private Material GetMaterial()
{
- IntPtr cPtr = Interop.ModelPrimitive.GetMaterial(SwigCPtr);
+ global::System.IntPtr cPtr = Interop.ModelPrimitive.GetMaterial(SwigCPtr);
+ Material ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Material;
+ if (ret == null)
+ {
+ HandleRef handle = new HandleRef(this, cPtr);
+ handle = new HandleRef(null, IntPtr.Zero);
+
+ ret = new Material(cPtr, true);
+ }
+ else
+ {
+ HandleRef handle = new HandleRef(this, cPtr);
+ Tizen.NUI.Interop.BaseHandle.DeleteBaseHandle(handle);
+ handle = new HandleRef(null, IntPtr.Zero);
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- Material ret = (cPtr == IntPtr.Zero) ? null : Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Material;
return ret;
}