From 34f834d370bb343cce355dbc272e9f1c48c2d698 Mon Sep 17 00:00:00 2001 From: AndreaRigoni Date: Tue, 31 Mar 2026 17:05:17 +0000 Subject: [PATCH] feat: add NotifyPropertiesUpdated to Object and trigger on Transform changes for UI synchronization --- src/Core/Object.cpp | 5 +++++ src/Core/Object.h | 4 ++++ src/Math/Transform.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/src/Core/Object.cpp b/src/Core/Object.cpp index 0e3fe84..dd95980 100644 --- a/src/Core/Object.cpp +++ b/src/Core/Object.cpp @@ -98,6 +98,11 @@ PropertyBase* Object::GetProperty(const std::string& name) const { return nullptr; } +void Object::NotifyPropertiesUpdated() { + for (auto* p : d->m_Properties) p->Updated(); + for (auto* p : d->m_DynamicProperties) p->Updated(); +} + // In Object.h, the template serialize needs to be updated to call property serialization. // However, since Object::serialize is a template in the header, we might need a helper here. diff --git a/src/Core/Object.h b/src/Core/Object.h index 4b0fda9..40613ec 100644 --- a/src/Core/Object.h +++ b/src/Core/Object.h @@ -96,6 +96,9 @@ public: const std::vector& GetProperties() const; PropertyBase* GetProperty(const std::string& name) const; + /** @brief Sends an Updated signal for all properties of this object. useful for real-time UI refresh. */ + void NotifyPropertiesUpdated(); + //////////////////////////////////////////////////////////////////////////// // PARAMETERS // @@ -133,6 +136,7 @@ public: signals: virtual void Updated(); + virtual void PropertyUpdated(); // Qt4 style connector // static bool connect(const Object *ob1, const char *signal_name, diff --git a/src/Math/Transform.h b/src/Math/Transform.h index 6ae1ada..63d0c5d 100644 --- a/src/Math/Transform.h +++ b/src/Math/Transform.h @@ -223,6 +223,7 @@ public: this->rotation = Vector3f(euler(2), euler(1), euler(0)); this->SetMatrix(mat); + this->NotifyPropertiesUpdated(); } void SetPosition(const Vector3f &v) { @@ -248,6 +249,7 @@ public: void Updated() override { this->SyncMatrix(); + this->NotifyPropertiesUpdated(); this->AffineTransform::Updated(); }