2 * Copyright(c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.Runtime.InteropServices;
20 using System.ComponentModel;
22 using Tizen.NUI.Binding;
23 using Tizen.NUI.BaseComponents;
25 namespace Tizen.NUI.Scene3D
28 /// Model is a Class to show 3D mesh objects.
29 /// Model supports glTF 2.0 and DLI model formats.
30 /// Physically Based Rendering with Image Based Lighting is also supported.
34 /// Since NUI uses a left-handed coordinate system, loaded models are transformed into a left-handed coordinate system with Y pointing down.
35 /// The Animations defined in the glTF or DLI are also loaded and can be retrieved by using <see cref="GetAnimation(uint)"/> and <see cref="GetAnimation(string)"/> methods.
36 /// The number of animation is also retrieved by GetAnimationCount() method.
38 /// Model also supports Physically Based Rendering(PBR) with Image Based Lighting(IBL).
39 /// For the IBL, two cube map textures(diffuse and specular) are required.
40 /// Model supports 4 types layout for Cube Map: Vertical/Horizontal Cross layouts, and Vertical/Horizontal Array layouts.
41 /// And also, ktx format with cube map is supported.
43 /// The model and IBL textures start to be loaded asynchronously when the Model object is on Window.
44 /// ResourcesLoaded signal notifies that the loading of the model and IBL resources have been completed.
45 /// If Model or IBL is requested to be loaded before the other loading is completed, the ResourcesLoaded signal is called after all resources are loaded.
46 /// <see cref="GetAnimation(uint)"/> and <see cref="GetAnimation(string)"/> methods can be used after the model loading is finished.
48 /// By default, the loaded mesh has its own size and <see cref="PivotPoint"/> inferred from position of vertices.
49 /// The <see cref="PivotPoint"/> can be modified after model loading is finished.
50 /// If user set size property, the mesh will be scaled to the input size.
51 /// Default value of <see cref="ParentOrigin"/> of the Model is Center.
56 /// Model model = new Model(modelUrl)
58 /// Size = new Size(width, height),
60 /// model.ResourcesLoaded += (s, e) =>
62 /// model.PivotPoint = new Vector3(0.5f, 0.5f, 0.5f); // Use center as a Pivot.
64 /// int animationCount = model.GetAnimationCount();
65 /// if(animationCount > 0)
67 /// // Play an Animation of index 0.
68 /// model.GetAnimation(0).Play();
71 /// model.SetImageBasedLightSource(diffuseUrl, specularUrl, scaleFactor);
72 /// window.Add(model);
76 /// <since_tizen> 10 </since_tizen>
77 public partial class Model : View
79 private bool isBuilt = false;
80 internal Model(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
84 internal Model(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, true, cRegister)
89 /// Create an initialized Model.
91 /// <param name="modelUrl">model file url.(e.g. glTF, and DLI).</param>
92 /// <param name="resourceDirectoryUrl"> The url to derectory containing resources: binary, image etc.</param>
94 /// If resourceDirectoryUrl is empty, the parent directory url of modelUrl is used for resource url.
96 /// http://tizen.org/privilege/mediastorage for local files in media storage.
97 /// http://tizen.org/privilege/externalstorage for local files in external storage.
99 /// <since_tizen> 10 </since_tizen>
100 public Model(string modelUrl, string resourceDirectoryUrl = "") : this(Interop.Model.ModelNew(modelUrl, resourceDirectoryUrl), true)
102 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103 this.PositionUsesPivotPoint = true;
104 ResourcesLoaded += OnResourcesLoaded;
108 /// Create an initialized Model.
110 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public Model() : this(Interop.Model.ModelNew(), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
115 this.PositionUsesPivotPoint = true;
119 /// Copy constructor.
121 /// <param name="model">Source object to copy.</param>
122 /// <since_tizen> 10 </since_tizen>
123 public Model(Model model) : this(Interop.Model.NewModel(Model.getCPtr(model)), true, false)
125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 this.PositionUsesPivotPoint = model.PositionUsesPivotPoint;
130 /// Assignment operator.
132 /// <param name="model">Source object to be assigned.</param>
133 /// <returns>Reference to this.</returns>
134 internal Model Assign(Model model)
136 Model ret = new Model(Interop.Model.ModelAssign(SwigCPtr, Model.getCPtr(model)), false);
137 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138 ret.PositionUsesPivotPoint = model.PositionUsesPivotPoint;
143 /// Set/Get the ImageBasedLight ScaleFactor.
144 /// Scale factor controls light source intensity in [0.0f, 1.0f]
146 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
147 [EditorBrowsable(EditorBrowsableState.Never)]
148 public float ImageBasedLightScaleFactor
152 SetImageBasedLightScaleFactor(value);
156 return GetImageBasedLightScaleFactor();
161 /// Retrieves root ModelNode of this Model.
163 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
164 [EditorBrowsable(EditorBrowsableState.Never)]
165 public ModelNode ModelRoot
169 return GetModelRoot();
174 /// Adds modelNode to this Model.
176 /// <param name="modelNode">Root of a ModelNode tree</param>
177 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 public void AddModelNode(ModelNode modelNode)
181 Interop.Model.AddModelNode(SwigCPtr, ModelNode.getCPtr(modelNode));
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186 /// Removes modelNode from this Model.
188 /// <param name="modelNode">Root of a ModelNode tree to be removed</param>
189 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
190 [EditorBrowsable(EditorBrowsableState.Never)]
191 public void RemoveModelNode(ModelNode modelNode)
193 Interop.Model.RemoveModelNode(SwigCPtr, ModelNode.getCPtr(modelNode));
194 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198 /// Removes Returns a child ModelNode object with a name that matches nodeName.
200 /// <param name="nodeName">The name of the child ModelNode object you want to find.</param>
201 /// <returns>Child ModelNode that has nodeName as name.</returns>
202 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
203 [EditorBrowsable(EditorBrowsableState.Never)]
204 public ModelNode FindChildModelNodeByName(string nodeName)
206 global::System.IntPtr cPtr = Interop.Model.FindChildModelNodeByName(SwigCPtr, nodeName);
207 ModelNode ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as ModelNode;
210 // Store the value of PositionUsesAnchorPoint from dali object (Since View object automatically change PositionUsesPivotPoint value as false, we need to keep value.)
211 HandleRef handle = new HandleRef(this, cPtr);
213 // Use original value as 'true' if we got invalid ModelNode.
214 bool originalPositionUsesAnchorPoint = (cPtr == global::System.IntPtr.Zero || !Tizen.NUI.Interop.BaseHandle.HasBody(handle)) || Object.InternalGetPropertyBool(handle, View.Property.PositionUsesAnchorPoint);
215 handle = new HandleRef(null, IntPtr.Zero);
217 // Register new animatable into Registry.
218 ret = new ModelNode(cPtr, true);
221 ret.PositionUsesPivotPoint = originalPositionUsesAnchorPoint;
226 // We found matched NUI animatable. Reduce cPtr reference count.
227 HandleRef handle = new HandleRef(this, cPtr);
228 Tizen.NUI.Interop.BaseHandle.DeleteBaseHandle(handle);
229 handle = new HandleRef(null, IntPtr.Zero);
231 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
236 /// Changes Image Based Light according to the given input textures.
238 /// <param name="diffuseUrl">The path of Cube map image that will be used as a diffuse IBL source.</param>
239 /// <param name="specularUrl">The path of Cube map image that will be used as a specular IBL source.</param>
240 /// <param name="scaleFactor">Scale factor that controls light source intensity in [0.0f, 1.0f]. Default value is 1.0f.</param>
242 /// http://tizen.org/privilege/mediastorage for local files in media storage.
243 /// http://tizen.org/privilege/externalstorage for local files in external storage.
245 /// <since_tizen> 10 </since_tizen>
246 public void SetImageBasedLightSource(string diffuseUrl, string specularUrl, float scaleFactor = 1.0f)
248 Interop.Model.SetImageBasedLightSource(SwigCPtr, diffuseUrl, specularUrl, scaleFactor);
249 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253 /// Gets number of animations that has been loaded from model file.
256 /// This method should be called after Model load has been finished.
258 /// <returns>The number of loaded animations.</returns>
259 /// <since_tizen> 10 </since_tizen>
260 public uint GetAnimationCount()
262 uint ret = Interop.Model.GetAnimationCount(SwigCPtr);
263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
268 /// Gets animation at the index.
271 /// This method should be called after Model load has been finished.
273 /// <param name="index">Index of animation to be retrieved.</param>
274 /// <returns>Animation at the index.</returns>
275 /// <since_tizen> 10 </since_tizen>
276 public Animation GetAnimation(uint index)
278 global::System.IntPtr cPtr = Interop.Model.GetAnimation(SwigCPtr, index);
279 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Animation;
282 // Register new animation into Registry.
283 ret = new Animation(cPtr, true);
287 // We found matched NUI animation. Reduce cPtr reference count.
288 HandleRef handle = new HandleRef(this, cPtr);
289 Tizen.NUI.Interop.Animation.DeleteAnimation(handle);
290 handle = new HandleRef(null, IntPtr.Zero);
292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
297 /// Retrieves animation with the given name.
298 /// Note: This method should be called after Model load finished.
300 /// <param name="name">String name of animation to be retrieved.</param>
301 /// <returns>Animation that has the given name.</returns>
302 /// <since_tizen> 10 </since_tizen>
303 public Animation GetAnimation(string name)
305 global::System.IntPtr cPtr = Interop.Model.GetAnimation(SwigCPtr, name);
306 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Animation;
309 // Register new animation into Registry.
310 ret = new Animation(cPtr, true);
314 // We found matched NUI animation. Reduce cPtr reference count.
315 HandleRef handle = new HandleRef(this, cPtr);
316 Tizen.NUI.Interop.Animation.DeleteAnimation(handle);
317 handle = new HandleRef(null, IntPtr.Zero);
319 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
324 /// Gets number of camera parameters that has been loaded from model file.
327 /// This method should be called after Model load has been finished.
329 /// <returns>The number of loaded camera parameters.</returns>
330 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
331 [EditorBrowsable(EditorBrowsableState.Never)]
332 public uint GetCameraCount()
334 uint ret = Interop.Model.GetCameraCount(SwigCPtr);
335 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340 /// Generate Camera using camera parameters at the index.
341 /// If camera parameter is valid, create new Camera.
342 /// Else, return empty Handle.
345 /// This method should be called after Model load has been finished.
347 /// <param name="index">Index of camera to be generated.</param>
348 /// <returns>Generated Camera by the index, or empty Handle if generation failed.</returns>
349 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
350 [EditorBrowsable(EditorBrowsableState.Never)]
351 public Camera GenerateCamera(uint index)
353 global::System.IntPtr cPtr = Interop.Model.GenerateCamera(SwigCPtr, index);
354 Camera ret = new Camera(cPtr, true); // Always create new camera.
355 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
360 /// Apply camera parameters at the index to inputed Camera.
361 /// If camera parameter is valid and camera is not empty, apply parameters.
362 /// It will change camera's transform and near / far / fov or orthographic size / aspect ratio (if defined)
365 /// This method should be called after Model load has been finished.
367 /// <param name="index">Index of camera to be retrieved.</param>
368 /// <param name="camera">Camera to be applied parameter.</param>
369 /// <returns>True if Apply successed. False otherwise.</returns>
370 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
371 [EditorBrowsable(EditorBrowsableState.Never)]
372 public bool ApplyCamera(uint index, Camera camera)
375 if (camera?.HasBody() == true)
377 ret = Interop.Model.ApplyCamera(SwigCPtr, index, Camera.getCPtr(camera));
378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
384 /// Load bvh animation and assign to model.
385 /// Scale is additional scale factor of bvh animation. It is possible that
386 /// Model's scale may not matched with bvh animation scale.
387 /// If scale is null, default use as Vector3.ONE
389 /// <param name="bvhFilename">Name of bvh format file.</param>
390 /// <param name="scale">Scale value of bvh animation match with model.</param>
391 /// <param name="translateRootFromModelNode">Whether we should translate the bvh root from it's ModelNode position or not.</param>
392 /// <returns>Animaion of bvh</returns>
393 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
394 [EditorBrowsable(EditorBrowsableState.Never)]
395 [Obsolete("Do not use this LoadBvhAnimation. Use MotionData.LoadMotionCaptureAnimation and GenerateMotionDataAnimation instead.")]
396 public Animation LoadBvhAnimation(string bvhFilename, Vector3 scale = null, bool translateRootFromModelNode = true)
398 global::System.IntPtr cPtr = Interop.Model.LoadBvhAnimation(SwigCPtr, bvhFilename, Vector3.getCPtr(scale), translateRootFromModelNode);
399 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Animation;
402 // Register new animation into Registry.
403 ret = new Animation(cPtr, true);
407 // We found matched NUI animation. Reduce cPtr reference count.
408 HandleRef handle = new HandleRef(this, cPtr);
409 Tizen.NUI.Interop.Animation.DeleteAnimation(handle);
410 handle = new HandleRef(null, IntPtr.Zero);
412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
417 /// Load bvh animation and assign to model.
418 /// Scale is additional scale factor of bvh animation. It is possible that
419 /// Model's scale may not matched with bvh animation scale.
420 /// If scale is null, default use as Vector3.ONE
422 /// <param name="bvhBuffer">Contents of bvh format file.</param>
423 /// <param name="scale">Scale value of bvh animation match with model.</param>
424 /// <param name="translateRootFromModelNode">Whether we should translate the bvh root from it's ModelNode position or not.</param>
425 /// <returns>Animaion of bvh</returns>
426 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
427 [EditorBrowsable(EditorBrowsableState.Never)]
428 [Obsolete("Do not use this LoadBvhAnimationFromBuffer. Use MotionData.LoadMotionCaptureAnimationFromBuffer and GenerateMotionDataAnimation instead.")]
429 public Animation LoadBvhAnimationFromBuffer(string bvhBuffer, Vector3 scale = null, bool translateRootFromModelNode = true)
431 global::System.IntPtr cPtr = Interop.Model.LoadBvhAnimationFromBuffer(SwigCPtr, bvhBuffer, bvhBuffer.Length, Vector3.getCPtr(scale), translateRootFromModelNode);
432 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Animation;
435 // Register new animation into Registry.
436 ret = new Animation(cPtr, true);
440 // We found matched NUI animation. Reduce cPtr reference count.
441 HandleRef handle = new HandleRef(this, cPtr);
442 Tizen.NUI.Interop.Animation.DeleteAnimation(handle);
443 handle = new HandleRef(null, IntPtr.Zero);
445 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
450 /// Load facial animation and assign to model.
452 /// <param name="facialFilename">Name of json format file what we predefined.</param>
453 /// <returns>Animaion of facial</returns>
454 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
455 [EditorBrowsable(EditorBrowsableState.Never)]
456 [Obsolete("Do not use this LoadFacialAnimation. Use MotionData.LoadBlendShapeAnimation and GenerateMotionDataAnimation instead.")]
457 public Animation LoadFacialAnimation(string facialFilename)
459 return LoadBlendShapeAnimation(facialFilename);
463 /// Load facial animation and assign to model.
465 /// <param name="facialBuffer">Contents of json format file what we predefined.</param>
466 /// <returns>Animaion of facial</returns>
467 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
468 [EditorBrowsable(EditorBrowsableState.Never)]
469 [Obsolete("Do not use this LoadFacialAnimationFromBuffer. Use MotionData.LoadBlendShapeAnimationFromBuffer and GenerateMotionDataAnimation instead.")]
470 public Animation LoadFacialAnimationFromBuffer(string facialBuffer)
472 return LoadBlendShapeAnimationFromBuffer(facialBuffer);
476 /// Load blendshape animation and assign to model from json file.
478 /// <param name="jsonFilename">Name of json format file what we predefined.</param>
479 /// <returns>Animaion of facial</returns>
480 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
481 [EditorBrowsable(EditorBrowsableState.Never)]
482 [Obsolete("Do not use this LoadBlendShapeAnimation. Use MotionData.LoadBlendShapeAnimation and GenerateMotionDataAnimation instead.")]
483 public Animation LoadBlendShapeAnimation(string jsonFilename)
485 global::System.IntPtr cPtr = Interop.Model.LoadBlendShapeAnimation(SwigCPtr, jsonFilename);
486 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Animation;
489 // Register new animation into Registry.
490 ret = new Animation(cPtr, true);
494 // We found matched NUI animation. Reduce cPtr reference count.
495 HandleRef handle = new HandleRef(this, cPtr);
496 Tizen.NUI.Interop.Animation.DeleteAnimation(handle);
497 handle = new HandleRef(null, IntPtr.Zero);
499 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
504 /// Load morphing animation and assign to model from json string.
506 /// <param name="jsonBuffer">Contents of json format file what we predefined.</param>
507 /// <returns>Animaion of facial</returns>
508 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
509 [EditorBrowsable(EditorBrowsableState.Never)]
510 [Obsolete("Do not use this LoadBlendShapeAnimationFromBuffer. Use MotionData.LoadBlendShapeAnimationFromBuffer and GenerateMotionDataAnimation instead.")]
511 public Animation LoadBlendShapeAnimationFromBuffer(string jsonBuffer)
513 global::System.IntPtr cPtr = Interop.Model.LoadBlendShapeAnimationFromBuffer(SwigCPtr, jsonBuffer, jsonBuffer.Length);
514 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Animation;
517 // Register new animation into Registry.
518 ret = new Animation(cPtr, true);
522 // We found matched NUI animation. Reduce cPtr reference count.
523 HandleRef handle = new HandleRef(this, cPtr);
524 Tizen.NUI.Interop.Animation.DeleteAnimation(handle);
525 handle = new HandleRef(null, IntPtr.Zero);
527 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
532 /// Generate animation by MotionData.
533 /// If there is no animatable item for MotionData, return null.
535 /// <param name="motionData">Source motion data.</param>
536 /// <returns>Generated animation from then given motion data, or null if there is no animatable item in <paramref name="motionData"/></returns>
537 /// <since_tizen> 11 </since_tizen>
538 public Animation GenerateMotionDataAnimation(MotionData motionData)
540 global::System.IntPtr cPtr = Interop.Model.GenerateMotionDataAnimation(SwigCPtr, MotionData.getCPtr(motionData));
541 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Animation;
544 // Register new animation into Registry.
545 ret = new Animation(cPtr, true);
549 // We found matched NUI animation. Reduce cPtr reference count.
550 HandleRef handle = new HandleRef(this, cPtr);
551 Tizen.NUI.Interop.Animation.DeleteAnimation(handle);
552 handle = new HandleRef(null, IntPtr.Zero);
554 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
556 // It is possible if there is no animatable properties exist on inputed motionData.
557 // In this case, let we return null.
567 /// Set values from MotionData.
568 /// Note that this method doesn not apply KeyFrames animation.
569 /// If you want to apply the animation, please use <see cref="GenerateMotionDataAnimation(MotionData)"/> and play the result.
571 /// <param name="motionData">Source motion data.</param>
572 /// <since_tizen> 11 </since_tizen>
573 public void SetMotionData(MotionData motionData)
575 Interop.Model.SetMotionData(SwigCPtr, MotionData.getCPtr(motionData));
576 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
580 /// Retrieves model root Actor.
582 /// <returns>Root View of the model.</returns>
583 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
584 [EditorBrowsable(EditorBrowsableState.Never)]
585 private ModelNode GetModelRoot()
587 global::System.IntPtr cPtr = Interop.Model.GetModelRoot(SwigCPtr);
588 ModelNode ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as ModelNode;
591 // Store the value of PositionUsesAnchorPoint from dali object (Since View object automatically change PositionUsesPivotPoint value as false, we need to keep value.)
592 HandleRef handle = new HandleRef(this, cPtr);
594 // Use original value as 'true' if we got invalid ModelNode.
595 bool originalPositionUsesAnchorPoint = (cPtr == global::System.IntPtr.Zero || !Tizen.NUI.Interop.BaseHandle.HasBody(handle)) || Object.InternalGetPropertyBool(handle, View.Property.PositionUsesAnchorPoint);
596 handle = new HandleRef(null, IntPtr.Zero);
598 // Register new animatable into Registry.
599 ret = new ModelNode(cPtr, true);
602 ret.PositionUsesPivotPoint = originalPositionUsesAnchorPoint;
607 // We found matched NUI animatable. Reduce cPtr reference count.
608 HandleRef handle = new HandleRef(this, cPtr);
609 Tizen.NUI.Interop.BaseHandle.DeleteBaseHandle(handle);
610 handle = new HandleRef(null, IntPtr.Zero);
612 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
617 /// Set the ImageBasedLight ScaleFactor.
619 /// <param name="scaleFactor">Scale factor that controls light source intensity in [0.0f, 1.0f].</param>
620 private void SetImageBasedLightScaleFactor(float scaleFactor)
622 Interop.Model.SetImageBasedLightScaleFactor(SwigCPtr, scaleFactor);
623 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
627 /// Get the ImageBasedLight ScaleFactor.
629 /// <returns>ImageBasedLightScaleFactor that controls light source intensity.</returns>
630 private float GetImageBasedLightScaleFactor()
632 float scaleFactor = Interop.Model.GetImageBasedLightScaleFactor(SwigCPtr);
633 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
637 private void OnResourcesLoaded(object sender, EventArgs e)
639 if (!isBuilt && this.ModelRoot != null)
641 this.ModelRoot.Build();
647 /// To make transitionSet instance be disposed.
649 protected override void Dispose(DisposeTypes type)
656 ResourcesLoaded -= OnResourcesLoaded;
661 /// Release swigCPtr.
663 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
664 [EditorBrowsable(EditorBrowsableState.Never)]
665 protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
667 Interop.Model.DeleteModel(swigCPtr);