Tweaked MultiSwitch IO

This commit is contained in:
Robert Osfield
2003-11-25 16:07:32 +00:00
parent 72ba462251
commit 953bbd85e8
2 changed files with 13 additions and 1 deletions

View File

@@ -66,7 +66,7 @@ class SG_EXPORT MultiSwitch : public osg::Group
void setActiveSwitchSet(unsigned int switchSet) { _activeSwitchSet = switchSet; }
/** Get which of the available switch set lists to use.*/
unsigned int getActiveSwitchSet(unsigned int switchSet) { return _activeSwitchSet; }
unsigned int getActiveSwitchSet() const { return _activeSwitchSet; }
typedef std::vector<bool> ValueList;
typedef std::vector<ValueList> SwitchSetList;

View File

@@ -52,6 +52,16 @@ bool MultiSwitch_readLocalData(Object& obj, Input& fr)
}
}
if (fr.matchSequence("ActiveSwitchSet %i"))
{
unsigned int switchSet;
fr[1].getUInt(switchSet);
fr+=2;
sw.setActiveSwitchSet(switchSet);
}
if (fr.matchSequence("ValueList %i {"))
{
int entry = fr[0].getNoNestedBrackets();
@@ -91,6 +101,8 @@ bool MultiSwitch_writeLocalData(const Object& obj, Output& fw)
fw.indent()<<"NewChildDefaultValue "<<sw.getNewChildDefaultValue()<<std::endl;
fw.indent()<<"ActiveSwitchSet "<<sw.getActiveSwitchSet()<<std::endl;
unsigned int pos = 0;
const osgSim::MultiSwitch::SwitchSetList& switchset = sw.getSwitchSetList();
for(osgSim::MultiSwitch::SwitchSetList::const_iterator sitr=switchset.begin();