feat: add NotifyPropertiesUpdated to Object and trigger on Transform changes for UI synchronization
This commit is contained in:
@@ -98,6 +98,11 @@ PropertyBase* Object::GetProperty(const std::string& name) const {
|
|||||||
return nullptr;
|
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.
|
// 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.
|
// However, since Object::serialize is a template in the header, we might need a helper here.
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,9 @@ public:
|
|||||||
const std::vector<PropertyBase*>& GetProperties() const;
|
const std::vector<PropertyBase*>& GetProperties() const;
|
||||||
PropertyBase* GetProperty(const std::string& name) 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 //
|
// PARAMETERS //
|
||||||
|
|
||||||
@@ -133,6 +136,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
virtual void Updated();
|
virtual void Updated();
|
||||||
|
virtual void PropertyUpdated();
|
||||||
|
|
||||||
// Qt4 style connector //
|
// Qt4 style connector //
|
||||||
static bool connect(const Object *ob1, const char *signal_name,
|
static bool connect(const Object *ob1, const char *signal_name,
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ public:
|
|||||||
this->rotation = Vector3f(euler(2), euler(1), euler(0));
|
this->rotation = Vector3f(euler(2), euler(1), euler(0));
|
||||||
|
|
||||||
this->SetMatrix(mat);
|
this->SetMatrix(mat);
|
||||||
|
this->NotifyPropertiesUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPosition(const Vector3f &v) {
|
void SetPosition(const Vector3f &v) {
|
||||||
@@ -248,6 +249,7 @@ public:
|
|||||||
|
|
||||||
void Updated() override {
|
void Updated() override {
|
||||||
this->SyncMatrix();
|
this->SyncMatrix();
|
||||||
|
this->NotifyPropertiesUpdated();
|
||||||
this->AffineTransform::Updated();
|
this->AffineTransform::Updated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user