Skip to content

Commit e8e4060

Browse files
authored
Merge pull request #67 from rock-core/fix_tranformation_annotation
fix: set frame annotation for new transformation correctly
2 parents 3b73ec9 + 8a66829 commit e8e4060

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/TransformerGraph.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ class DescriptionVisitor: public ::osg::NodeVisitor
349349
//////////////////////////////////////////////////////////////////
350350
//////////////////////////////////////////////////////////////////
351351

352+
bool TransformerGraph::frameAnnotation = true;
353+
352354
osg::Node *TransformerGraph::create(const std::string &name)
353355
{
354356
return createFrame(name,true,0.1);
@@ -597,6 +599,14 @@ bool TransformerGraph::setTransformation(osg::Node &transformer,const std::strin
597599
link->setName("link");
598600
switch_node->replaceChild(old_node,link);
599601
nodeLink = dynamic_cast<vizkit::NodeLink*>(link);
602+
603+
// if the transformations are added after the user
604+
// desiable the transformation annotation
605+
// the transformation should be turned off in the osg graph
606+
if (frameAnnotation)
607+
switch_node->setAllChildrenOn();
608+
else
609+
switch_node->setAllChildrenOff();
600610
}
601611

602612
return true;
@@ -629,6 +639,7 @@ std::vector<std::string> TransformerGraph::getFrameNames(osg::Node &transformer)
629639
void TransformerGraph::showFrameAnnotation(osg::Node &transformer,bool value)
630640
{
631641
AnnotationSetter::set(transformer,value);
642+
frameAnnotation = value;
632643
}
633644

634645
bool TransformerGraph::areFrameAnnotationVisible(osg::Node &transformer)

src/TransformerGraph.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ namespace vizkit3d
207207
*/
208208
static void detachNode(osg::Node &transformer,osg::Node &node);
209209

210+
211+
static bool frameAnnotation;
212+
210213
};
211214

212215
}

0 commit comments

Comments
 (0)