From 63730a6e2c0e6df59da328de91c44dc48fa2a877 Mon Sep 17 00:00:00 2001 From: frohlich Date: Mon, 15 Jan 2007 19:01:20 +0000 Subject: [PATCH] Modified Files: animation.cxx: Add a visible configuration option to the pick animation. --- simgear/scene/model/animation.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index c6ef34d1..4f33f8ce 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -2161,18 +2161,19 @@ SGPickAnimation::createAnimationGroup(osg::Group& parent) osg::Group* commonGroup = new osg::Group; // Contains the normal geometry that is interactive - osg::Group* normalGroup = new osg::Group; + osg::ref_ptr normalGroup = new osg::Group; normalGroup->addChild(commonGroup); - SGSceneUserData* ud = SGSceneUserData::getOrCreateSceneUserData(normalGroup); - std::vector actions; - actions = getConfig()->getChildren("action"); - for (unsigned int i = 0; i < actions.size(); ++i) - ud->addPickCallback(new PickCallback(actions[i], getModelRoot())); // Used to render the geometry with just yellow edges osg::Group* highlightGroup = new osg::Group; highlightGroup->setNodeMask(SG_NODEMASK_PICK_BIT); highlightGroup->addChild(commonGroup); + SGSceneUserData* ud; + ud = SGSceneUserData::getOrCreateSceneUserData(highlightGroup); + std::vector actions; + actions = getConfig()->getChildren("action"); + for (unsigned int i = 0; i < actions.size(); ++i) + ud->addPickCallback(new PickCallback(actions[i], getModelRoot())); // prepare a state set that paints the edges of this object yellow osg::StateSet* stateSet = highlightGroup->getOrCreateStateSet(); @@ -2197,7 +2198,9 @@ SGPickAnimation::createAnimationGroup(osg::Group& parent) material->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0, 0, 0, 0)); stateSet->setAttribute(material, osg::StateAttribute::OVERRIDE); - parent.addChild(normalGroup); + // Only add normal geometry if configured + if (getConfig()->getBoolValue("visible", true)) + parent.addChild(normalGroup.get()); parent.addChild(highlightGroup); return commonGroup; -- 2.39.5