Gui: Use SO_SWITCH_NONE instead of -1.

This commit is contained in:
tritao
2025-01-22 22:13:13 +00:00
parent 1e6bdc9fd3
commit 4de3a1a99e

View File

@@ -283,7 +283,7 @@ public:
continue;
int count = pcSwitches[i]->getNumChildren();
if((index<0 && i==LinkView::SnapshotChild) || !count)
pcSwitches[i]->whichChild = -1;
pcSwitches[i]->whichChild = SO_SWITCH_NONE;
else if(count>pcLinked->getDefaultMode())
pcSwitches[i]->whichChild = pcLinked->getDefaultMode();
else
@@ -330,7 +330,7 @@ public:
for(int idx : indices) {
if(!pcSwitches[idx])
continue;
if(pcSwitches[idx]->whichChild.getValue()==-1)
if(pcSwitches[idx]->whichChild.getValue()==SO_SWITCH_NONE)
return false;
}
return true;
@@ -344,7 +344,7 @@ public:
if(!pcSwitches[idx])
continue;
if(!visible)
pcSwitches[idx]->whichChild = -1;
pcSwitches[idx]->whichChild = SO_SWITCH_NONE;
else if(pcSwitches[idx]->getNumChildren()>pcLinked->getDefaultMode())
pcSwitches[idx]->whichChild = pcLinked->getDefaultMode();
}
@@ -385,7 +385,7 @@ public:
pcLinkedSwitch.reset();
coinRemoveAllChildren(pcSnapshot);
pcModeSwitch->whichChild = -1;
pcModeSwitch->whichChild = SO_SWITCH_NONE;
coinRemoveAllChildren(pcModeSwitch);
SoSwitch *pcUpdateSwitch = pcModeSwitch;
@@ -1138,7 +1138,7 @@ void LinkView::setChildren(const std::vector<App::DocumentObject*> &children,
auto &info = *nodeArray[i];
info.isGroup = false;
info.groupIndex = -1;
info.pcSwitch->whichChild = (vis.size()<=i||vis[i])?0:-1;
info.pcSwitch->whichChild = (vis.size()<=i||vis[i])?0:SO_SWITCH_NONE;
info.link(obj);
if(obj->hasExtension(App::GroupExtension::getExtensionClassTypeId(),false)) {
info.isGroup = true;
@@ -1189,7 +1189,7 @@ void LinkView::setTransform(int index, const Base::Matrix4D &mat) {
void LinkView::setElementVisible(int idx, bool visible) {
if(idx>=0 && idx<(int)nodeArray.size())
nodeArray[idx]->pcSwitch->whichChild = visible?0:-1;
nodeArray[idx]->pcSwitch->whichChild = visible?0:SO_SWITCH_NONE;
}
bool LinkView::isElementVisible(int idx) const {