Core: Update expressions on property rename

This includes both expressions in generic containers and in
spreadsheets.
This commit is contained in:
Pieter Hijma
2025-05-18 15:16:31 +02:00
committed by Yorik van Havre
parent 18d87df6f1
commit 5bdfba3a1a
4 changed files with 35 additions and 0 deletions

View File

@@ -1577,6 +1577,17 @@ void PropertySheet::onRelabeledDocument(const App::Document& doc)
}
}
void PropertySheet::onRenameDynamicProperty(const App::Property& prop, const char* oldName)
{
ObjectIdentifier oldNameId = ObjectIdentifier(prop.getContainer(), std::string(oldName));
ObjectIdentifier newNameId = ObjectIdentifier(prop);
const std::map<ObjectIdentifier, ObjectIdentifier> paths = {
{oldNameId, newNameId},
};
renameObjectIdentifiers(paths);
}
void PropertySheet::renameObjectIdentifiers(
const std::map<App::ObjectIdentifier, App::ObjectIdentifier>& paths)
{

View File

@@ -51,6 +51,7 @@ public:
std::map<App::ObjectIdentifier, const App::Expression*> getExpressions() const override;
void setExpressions(std::map<App::ObjectIdentifier, App::ExpressionPtr>&& exprs) override;
void onRelabeledDocument(const App::Document& doc) override;
void onRenameDynamicProperty(const App::Property& prop, const char* oldName) override;
void updateElementReference(App::DocumentObject* feature,
bool reverse = false,