From b9a4752694ab838bd2f49f8146f917a7755be10a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 8 Sep 2007 07:21:12 +0000 Subject: [PATCH] Flesh out a bit more of the view IO support --- src/osgPlugins/osgViewer/View.cpp | 32 +++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/osgViewer/View.cpp b/src/osgPlugins/osgViewer/View.cpp index 0a36bdd5c..a3358bcf3 100644 --- a/src/osgPlugins/osgViewer/View.cpp +++ b/src/osgPlugins/osgViewer/View.cpp @@ -23,9 +23,37 @@ osgDB::RegisterDotOsgWrapperProxy View_Proxy bool View_readLocalData(osg::Object &obj, osgDB::Input &fr) { osgViewer::View& view = static_cast(obj); - bool itAdvanced = false; + bool iteratorAdvanced = false; - return itAdvanced; + osg::ref_ptr readObject; + while((readObject=fr.readObjectOfType(osgDB::type_wrapper())).valid()) + { + view.setCamera(static_cast(readObject.get())); + iteratorAdvanced = true; + } + + if (fr.matchSequence("Slaves {")) + { + int entry = fr[0].getNoNestedBrackets(); + + fr += 2; + + while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) + { + readObject = fr.readObjectOfType(osgDB::type_wrapper()); + if (readObject.valid()) view.addSlave(static_cast(readObject.get())); + else ++fr; + } + + // skip trainling '}' + ++fr; + + iteratorAdvanced = true; + + } + + + return iteratorAdvanced; } bool View_writeLocalData(const osg::Object &obj, osgDB::Output &fw)