Toponaming: Update element references of PropertyLinks everytime the program needs to access the values (#22785)

This commit is contained in:
drwho495
2025-08-18 11:11:49 -05:00
committed by GitHub
parent b1a423a390
commit a43e712700

View File

@@ -1573,6 +1573,7 @@ void PropertyLinkSub::onContainerRestored()
for (std::size_t i = 0; i < _cSubList.size(); ++i) {
_registerElementReference(_pcLinkSub, _cSubList[i], _ShadowSubList[i]);
}
updateElementReferences(_pcLinkSub);
}
void PropertyLinkSub::updateElementReference(DocumentObject* feature, bool reverse, bool notify)
@@ -2061,6 +2062,7 @@ void PropertyLinkSub::getLinks(std::vector<App::DocumentObject*>& objs,
{
if (all || _pcScope != LinkScope::Hidden) {
if (_pcLinkSub && _pcLinkSub->isAttachedToDocument()) {
updateElementReferences(_pcLinkSub);
objs.push_back(_pcLinkSub);
if (subs) {
*subs = getSubValues(newStyle);
@@ -3132,6 +3134,7 @@ void PropertyLinkSubList::getLinks(std::vector<App::DocumentObject*>& objs,
objs.reserve(objs.size() + _lValueList.size());
for (auto obj : _lValueList) {
if (obj && obj->isAttachedToDocument()) {
updateElementReferences(obj);
objs.push_back(obj);
}
}
@@ -4067,6 +4070,7 @@ void PropertyXLink::afterRestore()
if (!testFlag(LinkRestoreLabel) || !_pcLink || !_pcLink->isAttachedToDocument()) {
return;
}
setFlag(LinkRestoreLabel, false);
for (size_t i = 0; i < _SubList.size(); ++i) {
restoreLabelReference(_pcLink, _SubList[i], &_ShadowSubList[i]);
@@ -4081,6 +4085,8 @@ void PropertyXLink::onContainerRestored()
for (size_t i = 0; i < _SubList.size(); ++i) {
_registerElementReference(_pcLink, _SubList[i], _ShadowSubList[i]);
}
updateElementReferences(_pcLink);
}
void PropertyXLink::updateElementReference(DocumentObject* feature, bool reverse, bool notify)
@@ -4633,6 +4639,7 @@ void PropertyXLink::getLinks(std::vector<App::DocumentObject*>& objs,
bool newStyle) const
{
if ((all || _pcScope != LinkScope::Hidden) && _pcLink && _pcLink->isAttachedToDocument()) {
updateElementReferences(_pcLink, false);
objs.push_back(_pcLink);
if (subs && _SubList.size() == _ShadowSubList.size()) {
*subs = getSubValues(newStyle);
@@ -5367,6 +5374,8 @@ void PropertyXLinkSubList::getLinks(std::vector<App::DocumentObject*>& objs,
for (auto& l : _Links) {
auto obj = l.getValue();
if (obj && obj->isAttachedToDocument()) {
updateElementReferences(obj);
auto subnames = l.getSubValues(newStyle);
if (subnames.empty()) {
subnames.emplace_back("");