From 43f9c7f2954fcc78e93e8a504328739a03807398 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 30 Jun 2015 03:25:30 +0200 Subject: [PATCH] Skip the Update traversal for inactive skeletons --- components/sceneutil/skeleton.cpp | 7 +++++++ components/sceneutil/skeleton.hpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/components/sceneutil/skeleton.cpp b/components/sceneutil/skeleton.cpp index 96941126b..5c2af4397 100644 --- a/components/sceneutil/skeleton.cpp +++ b/components/sceneutil/skeleton.cpp @@ -133,6 +133,13 @@ bool Skeleton::getActive() const return mActive; } +void Skeleton::traverse(osg::NodeVisitor& nv) +{ + if (!mActive && nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR && mLastFrameNumber != 0) + return; + osg::Group::traverse(nv); +} + Bone::Bone() : mNode(NULL) { diff --git a/components/sceneutil/skeleton.hpp b/components/sceneutil/skeleton.hpp index 1987fd4e8..d4418fa27 100644 --- a/components/sceneutil/skeleton.hpp +++ b/components/sceneutil/skeleton.hpp @@ -53,6 +53,8 @@ namespace SceneUtil bool getActive() const; + void traverse(osg::NodeVisitor& nv); + private: // The root bone is not a "real" bone, it has no corresponding node in the scene graph. // As far as the scene graph goes we support multiple root bones.