From 1dbe71474d7ae41c44a92f5a93bc32d2abd20993 Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 12 Dec 2019 09:56:43 +0100 Subject: [PATCH] Utility/Node: Get[Position|Rotation|Scale) now defaults to local space --- ChangeLog.md | 1 + SDK/include/NDK/Canvas.inl | 2 +- SDK/src/NDK/BaseWidget.cpp | 2 +- include/Nazara/Utility/Node.hpp | 6 +++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index fe438cc97..e123b59cb 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -203,6 +203,7 @@ Nazara Engine: - ⚠ Constraint2D are no longer managed by references and are now handled objects - ⚠ Removed all Set methods from math classes taking their own type (e.g. Box::Set(Box)) - Added Matrix4::Decompose +- ⚠ Node::Get[Position|Rotation|Scale] now defaults to local space Nazara Development Kit: - Added ImageWidget (#139) diff --git a/SDK/include/NDK/Canvas.inl b/SDK/include/NDK/Canvas.inl index 75b642328..0e1cb38f5 100644 --- a/SDK/include/NDK/Canvas.inl +++ b/SDK/include/NDK/Canvas.inl @@ -59,7 +59,7 @@ namespace Ndk { WidgetEntry& entry = m_widgetEntries[index]; - Nz::Vector3f pos = entry.widget->GetPosition(); + Nz::Vector3f pos = entry.widget->GetPosition(Nz::CoordSys_Global); Nz::Vector2f size = entry.widget->GetSize(); entry.box.Set(pos.x, pos.y, pos.z, size.x, size.y, 1.f); diff --git a/SDK/src/NDK/BaseWidget.cpp b/SDK/src/NDK/BaseWidget.cpp index be7049938..c887f9402 100644 --- a/SDK/src/NDK/BaseWidget.cpp +++ b/SDK/src/NDK/BaseWidget.cpp @@ -336,7 +336,7 @@ namespace Ndk if (IsRegisteredToCanvas()) m_canvas->NotifyWidgetBoxUpdate(m_canvasIndex); - Nz::Vector2f widgetPos = Nz::Vector2f(GetPosition()); + Nz::Vector2f widgetPos = Nz::Vector2f(GetPosition(Nz::CoordSys_Global)); Nz::Vector2f widgetSize = GetSize(); Nz::Rectf widgetRect(widgetPos.x, widgetPos.y, widgetSize.x, widgetSize.y); diff --git a/include/Nazara/Utility/Node.hpp b/include/Nazara/Utility/Node.hpp index 6065d1e04..e4cb3cfb2 100644 --- a/include/Nazara/Utility/Node.hpp +++ b/include/Nazara/Utility/Node.hpp @@ -41,10 +41,10 @@ namespace Nz virtual Vector3f GetLeft() const; virtual NodeType GetNodeType() const; const Node* GetParent() const; - Vector3f GetPosition(CoordSys coordSys = CoordSys_Global) const; + Vector3f GetPosition(CoordSys coordSys = CoordSys_Local) const; virtual Vector3f GetRight() const; - Quaternionf GetRotation(CoordSys coordSys = CoordSys_Global) const; - Vector3f GetScale(CoordSys coordSys = CoordSys_Global) const; + Quaternionf GetRotation(CoordSys coordSys = CoordSys_Local) const; + Vector3f GetScale(CoordSys coordSys = CoordSys_Local) const; const Matrix4f& GetTransformMatrix() const; virtual Vector3f GetUp() const;