Index: include/osgAnimation/RigGeometry
===================================================================
--- include/osgAnimation/RigGeometry	(revision 4944)
+++ include/osgAnimation/RigGeometry	(working copy)
@@ -40,8 +40,14 @@
  
         const Skeleton* getSkeleton() const;
         Skeleton* getSkeleton();
-        // will be used by the update callback to init correctly the rig mesh
-        void setSkeleton(Skeleton*);
+
+        // Sets the skeleton according to which the source geometry is deformed.
+        // If not set a parental search will be performed automatically upon update
+        // traversal.
+        //
+        // @note Depending on whether or not the given skeleton is a parent of this
+        //       node either a weak or a strong reference will be used internally.
+        void setSkeleton(Skeleton *skeleton);
         
         void setNeedToComputeMatrix(bool state) { _needToComputeMatrix = state;}
         bool getNeedToComputeMatrix() const { return _needToComputeMatrix;}
@@ -80,7 +86,12 @@
 
         osg::Matrix _matrixFromSkeletonToGeometry;
         osg::Matrix _invMatrixFromSkeletonToGeometry;
-        osg::observer_ptr<Skeleton> _root;
+
+        // A weak reference when the skeleton is our parent
+        osg::observer_ptr<Skeleton> _rootWeak;
+
+        // Otherwise we keep a strong reference
+        osg::ref_ptr<Skeleton> _rootStrong;
         bool _needToComputeMatrix;
  
         struct FindNearestParentSkeleton : public osg::NodeVisitor
Index: src/osgAnimation/RigGeometry.cpp
===================================================================
--- src/osgAnimation/RigGeometry.cpp	(revision 4944)
+++ src/osgAnimation/RigGeometry.cpp	(working copy)
@@ -16,6 +16,7 @@
 #include <osgAnimation/RigGeometry>
 #include <osgAnimation/RigTransformSoftware>
 #include <sstream>
+#include <algorithm>
 #include <osg/GL2Extensions>
 
 using namespace osgAnimation;
@@ -114,13 +115,13 @@
 
 void RigGeometry::computeMatrixFromRootSkeleton()
 {
-    if (!_root.valid())
+    if (getSkeleton() == NULL)
     {
         OSG_WARN << "Warning " << className() <<"::computeMatrixFromRootSkeleton if you have this message it means you miss to call buildTransformer(Skeleton* root), or your RigGeometry (" << getName() <<") is not attached to a Skeleton subgraph" << std::endl;
         return;
     }
-    osg::MatrixList mtxList = getParent(0)->getWorldMatrices(_root.get());
-    osg::Matrix notRoot = _root->getMatrix();
+    osg::MatrixList mtxList = getParent(0)->getWorldMatrices(getSkeleton());
+    osg::Matrix notRoot = getSkeleton()->getMatrix();
     _matrixFromSkeletonToGeometry = mtxList[0] * osg::Matrix::inverse(notRoot);
     _invMatrixFromSkeletonToGeometry = osg::Matrix::inverse(_matrixFromSkeletonToGeometry);
     _needToComputeMatrix = false;
@@ -196,11 +197,48 @@
     }
 }
 
+const Skeleton* RigGeometry::getSkeleton() const 
+{
+    return _rootWeak.valid() ? _rootWeak.get() : _rootStrong.get();
+}
+
+Skeleton* RigGeometry::getSkeleton()
+{
+    return _rootWeak.valid() ? _rootWeak.get() : _rootStrong.get();
+}
+
+void RigGeometry::setSkeleton(Skeleton* root) 
+{
+    if(getSkeleton() == root)
+    {
+        return;
+    }
+
+    _rootStrong = NULL;
+    _rootWeak = NULL;
+
+    ParentList parents = getParents();
+
+    for(ParentList::iterator itr = parents.begin();
+        itr != parents.end(); ++itr)
+    {
+        osg::NodePathList parentPaths = (*itr)->getParentalNodePaths();
+        for(osg::NodePathList::iterator pitr = parentPaths.begin();
+            pitr != parentPaths.end(); ++pitr)
+        {
+            osg::NodePath::iterator it = std::find(pitr->begin(), pitr->end(), root);
+            if(it != pitr->end())
+            {
+                _rootWeak = root;
+                return;
+            }
+        }
+    }
+
+    _rootStrong = root;
+}
+
 const VertexInfluenceSet& RigGeometry::getVertexInfluenceSet() const { return _vertexInfluenceSet;}
-
-const Skeleton* RigGeometry::getSkeleton() const { return _root.get(); }
-Skeleton* RigGeometry::getSkeleton() { return _root.get(); }
-void RigGeometry::setSkeleton(Skeleton* root) { _root = root;}
 RigTransform* RigGeometry::getRigTransformImplementation() { return _rigTransformImplementation.get(); }
 void RigGeometry::setRigTransformImplementation(RigTransform* rig) { _rigTransformImplementation = rig; }
 
Index: src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp
===================================================================
--- src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp	(revision 4944)
+++ src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp	(working copy)
@@ -74,5 +74,6 @@
                          "osg::Object osg::Drawable osg::Geometry osgAnimation::RigGeometry" )
 {
     ADD_USER_SERIALIZER( InfluenceMap );  // _vertexInfluenceMap
+    ADD_OBJECT_SERIALIZER( Skeleton, osgAnimation::Skeleton, NULL );  // _root
     ADD_OBJECT_SERIALIZER( SourceGeometry, osg::Geometry, NULL );  // _geometry
 }
