Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NUI.Scene3D] Bug fix when we get ModelNode from Model #5648

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ internal Model(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemory
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;
}

/// <summary>
Expand All @@ -106,7 +106,7 @@ public Model(string modelUrl, string resourceDirectoryUrl = "") : this(Interop.M
public Model() : this(Interop.Model.ModelNew(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
this.PositionUsesAnchorPoint = true;
this.PositionUsesPivotPoint = true;
}

/// <summary>
Expand All @@ -117,6 +117,7 @@ public Model() : this(Interop.Model.ModelNew(), true)
public Model(Model model) : this(Interop.Model.NewModel(Model.getCPtr(model)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
this.PositionUsesPivotPoint = model.PositionUsesPivotPoint;
}

/// <summary>
Expand All @@ -128,6 +129,7 @@ internal Model Assign(Model model)
{
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;
}

Expand Down Expand Up @@ -199,8 +201,14 @@ public ModelNode FindChildModelNodeByName(string nodeName)
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
{
Expand Down Expand Up @@ -569,8 +577,14 @@ private ModelNode GetModelRoot()
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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ internal ModelNode(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMe
public ModelNode() : this(Interop.ModelNode.ModelNodeNew(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
this.PositionUsesAnchorPoint = true;
this.PositionUsesPivotPoint = true;
}

/// <summary>
Expand All @@ -80,6 +80,7 @@ internal ModelNode Assign(ModelNode modelNode)
{
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;
}

Expand Down Expand Up @@ -172,8 +173,14 @@ public ModelNode FindChildModelNodeByName(string nodeName)
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
{
Expand Down
Loading