From 75a3e9add214fecfd2a0a6e3cc69bcfe2af523c3 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Mon, 23 Oct 2023 11:50:27 +0900 Subject: [PATCH] [NUI.Scene3D][API10] Bug fix when we get ModelNode from Model Since View constructor automatically change 'PositionUsesPivotPoint' value as false, some logic might changed when we Register ModelNode newly. Signed-off-by: Eunki, Hong --- src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs | 18 ++++++++++++++++-- .../src/public/ModelComponents/ModelNode.cs | 9 ++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs b/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs index c830773..784f46b 100755 --- a/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs +++ b/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs @@ -95,7 +95,7 @@ namespace Tizen.NUI.Scene3D public Model(string modelUrl, string resourceDirectoryUrl = "") : this(Interop.Model.ModelNew(modelUrl, resourceDirectoryUrl), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - this.PositionUsesAnchorPoint = true; + this.PositionUsesPivotPoint = true; } /// @@ -106,7 +106,7 @@ namespace Tizen.NUI.Scene3D public Model() : this(Interop.Model.ModelNew(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - this.PositionUsesAnchorPoint = true; + this.PositionUsesPivotPoint = true; } /// @@ -117,6 +117,7 @@ namespace Tizen.NUI.Scene3D public Model(Model model) : this(Interop.Model.NewModel(Model.getCPtr(model)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + this.PositionUsesPivotPoint = model.PositionUsesPivotPoint; } /// @@ -128,6 +129,7 @@ namespace Tizen.NUI.Scene3D { Model ret = new Model(Interop.Model.ModelAssign(SwigCPtr, Model.getCPtr(model)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + ret.PositionUsesPivotPoint = model.PositionUsesPivotPoint; return ret; } @@ -199,8 +201,14 @@ namespace Tizen.NUI.Scene3D 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 { @@ -568,8 +576,14 @@ namespace Tizen.NUI.Scene3D 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 { diff --git a/src/Tizen.NUI.Scene3D/src/public/ModelComponents/ModelNode.cs b/src/Tizen.NUI.Scene3D/src/public/ModelComponents/ModelNode.cs index 8974205..1f23f10 100755 --- a/src/Tizen.NUI.Scene3D/src/public/ModelComponents/ModelNode.cs +++ b/src/Tizen.NUI.Scene3D/src/public/ModelComponents/ModelNode.cs @@ -58,7 +58,7 @@ namespace Tizen.NUI.Scene3D public ModelNode() : this(Interop.ModelNode.ModelNodeNew(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - this.PositionUsesAnchorPoint = true; + this.PositionUsesPivotPoint = true; } /// @@ -80,6 +80,7 @@ namespace Tizen.NUI.Scene3D { ModelNode ret = new ModelNode(Interop.ModelNode.ModelNodeAssign(SwigCPtr, ModelNode.getCPtr(modelNode)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + ret.PositionUsesPivotPoint = modelNode.PositionUsesPivotPoint; return ret; } @@ -172,8 +173,14 @@ namespace Tizen.NUI.Scene3D 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 { -- 2.7.4