Index: /OpenSceneGraph/trunk/include/osg/StateAttribute
===================================================================
--- /OpenSceneGraph/trunk/include/osg/StateAttribute (revision 9599)
+++ /OpenSceneGraph/trunk/include/osg/StateAttribute (revision 10671)
@@ -17,4 +17,5 @@
 #include <osg/Export>
 #include <osg/Object>
+#include <osg/StateAttributeCallback>
 #include <osg/GL>
 
@@ -191,5 +192,7 @@
         
         StateAttribute(const StateAttribute& sa,const CopyOp& copyop=CopyOp::SHALLOW_COPY): 
-            Object(sa,copyop) {}
+            Object(sa,copyop),
+            _updateCallback(copyop(sa._updateCallback.get()))
+            {}
         
 
@@ -282,35 +285,26 @@
             return true;
         }
-        
-        struct Callback : public virtual osg::Object
-        {
-            Callback() {}
-
-            Callback(const Callback&,const CopyOp&) {}
-
-            META_Object(osg,Callback);
-
-            /** do customized update code.*/
-            virtual void operator () (StateAttribute*, NodeVisitor*) {}
-        };
+
+        // provide callback for backwards compatibility.
+        typedef osg::StateAttributeCallback Callback;
 
         /** Set the UpdateCallback which allows users to attach customize the updating of an object during the update traversal.*/
-        void setUpdateCallback(Callback* uc);
+        void setUpdateCallback(StateAttributeCallback* uc);
 
         /** Get the non const UpdateCallback.*/
-        Callback* getUpdateCallback() { return _updateCallback.get(); }
+        StateAttributeCallback* getUpdateCallback() { return _updateCallback.get(); }
 
         /** Get the const UpdateCallback.*/
-        const Callback* getUpdateCallback() const { return _updateCallback.get(); }
+        const StateAttributeCallback* getUpdateCallback() const { return _updateCallback.get(); }
 
 
         /** Set the EventCallback which allows users to attach customize the updating of an object during the Event traversal.*/
-        void setEventCallback(Callback* ec);
+        void setEventCallback(StateAttributeCallback* ec);
 
         /** Get the non const EventCallback.*/
-        Callback* getEventCallback() { return _eventCallback.get(); }
+        StateAttributeCallback* getEventCallback() { return _eventCallback.get(); }
 
         /** Get the const EventCallback.*/
-        const Callback* getEventCallback() const { return _eventCallback.get(); }
+        const StateAttributeCallback* getEventCallback() const { return _eventCallback.get(); }
 
     
@@ -344,6 +338,6 @@
         friend class osg::StateSet;
 
-        ref_ptr<Callback>   _updateCallback;
-        ref_ptr<Callback>   _eventCallback;
+        ref_ptr<StateAttributeCallback>   _updateCallback;
+        ref_ptr<StateAttributeCallback>   _eventCallback;
 };
 
Index: /OpenSceneGraph/trunk/include/osg/CopyOp
===================================================================
--- /OpenSceneGraph/trunk/include/osg/CopyOp (revision 10362)
+++ /OpenSceneGraph/trunk/include/osg/CopyOp (revision 10671)
@@ -25,4 +25,5 @@
 class StateSet;
 class StateAttribute;
+class StateAttributeCallback;
 class Uniform;
 class Node;
@@ -32,4 +33,5 @@
 class Shape;
 class NodeCallback;
+
 
 /** Copy Op(erator) used to control whether shallow or deep copy is used
@@ -54,5 +56,5 @@
             DEEP_COPY_SHAPES            = 1<<9,
             DEEP_COPY_UNIFORMS          = 1<<10,
-            DEEP_COPY_NODECALLBACKS     = 1<<11,
+            DEEP_COPY_CALLBACKS         = 1<<11,
             DEEP_COPY_ALL               = 0x7FFFFFFF
         };
@@ -76,4 +78,5 @@
         virtual Uniform*        operator() (const Uniform* shape) const;
         virtual NodeCallback*   operator() (const NodeCallback* nodecallback) const;
+        virtual StateAttributeCallback* operator() (const StateAttributeCallback* stateattributecallback) const;
 
     protected:
Index: /OpenSceneGraph/trunk/include/osg/ImageSequence
===================================================================
--- /OpenSceneGraph/trunk/include/osg/ImageSequence (revision 8990)
+++ /OpenSceneGraph/trunk/include/osg/ImageSequence (revision 10671)
@@ -106,5 +106,5 @@
         virtual void update(NodeVisitor* nv);
 
-        struct OSG_EXPORT UpdateCallback : public osg::StateAttribute::Callback
+        struct OSG_EXPORT UpdateCallback : public osg::StateAttributeCallback
         {
             virtual void operator () (osg::StateAttribute* attr, osg::NodeVisitor* nv);
Index: /OpenSceneGraph/trunk/include/osgAnimation/UpdateCallback
===================================================================
--- /OpenSceneGraph/trunk/include/osgAnimation/UpdateCallback (revision 10593)
+++ /OpenSceneGraph/trunk/include/osgAnimation/UpdateCallback (revision 10671)
@@ -37,6 +37,4 @@
         virtual void updateLink() = 0;
         virtual const std::string& getName() const = 0;
-
-        virtual ~AnimationUpdateCallbackBase() {}
     };
 
@@ -131,5 +129,5 @@
 
 
-    class OSGANIMATION_EXPORT UpdateMaterial : public AnimationUpdateCallback<osg::StateAttribute::Callback>
+    class OSGANIMATION_EXPORT UpdateMaterial : public AnimationUpdateCallback<osg::StateAttributeCallback>
     {
     protected:
@@ -148,4 +146,5 @@
         bool needLink() const;
         bool link(osgAnimation::Channel* channel);
+        osgAnimation::Vec4Target* getDiffuse();
     };
 
Index: /OpenSceneGraph/trunk/src/osg/StateAttribute.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osg/StateAttribute.cpp (revision 9354)
+++ /OpenSceneGraph/trunk/src/osg/StateAttribute.cpp (revision 10671)
@@ -43,5 +43,5 @@
 
 
-void StateAttribute::setUpdateCallback(Callback* uc)
+void StateAttribute::setUpdateCallback(StateAttributeCallback* uc)
 {
     osg::notify(osg::INFO)<<"StateAttribute::Setting Update callbacks"<<std::endl;
@@ -70,5 +70,5 @@
 }
 
-void StateAttribute::setEventCallback(Callback* ec)
+void StateAttribute::setEventCallback(StateAttributeCallback* ec)
 {
     osg::notify(osg::INFO)<<"StateAttribute::Setting Event callbacks"<<std::endl;
Index: /OpenSceneGraph/trunk/src/osg/CopyOp.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osg/CopyOp.cpp (revision 10362)
+++ /OpenSceneGraph/trunk/src/osg/CopyOp.cpp (revision 10671)
@@ -19,4 +19,5 @@
 #include <osg/PrimitiveSet>
 #include <osg/Shape>
+#include <osg/StateAttribute>
 
 using namespace osg;
@@ -68,5 +69,5 @@
 NodeCallback* CopyOp::operator() (const NodeCallback* nc) const
 {
-    if (nc && _flags&DEEP_COPY_NODECALLBACKS)
+    if (nc && _flags&DEEP_COPY_CALLBACKS)
     {
         // deep copy the full chain of callback
@@ -86,2 +87,16 @@
         return const_cast<NodeCallback*>(nc);
 }
+
+
+StateAttributeCallback* CopyOp::operator() (const StateAttributeCallback* sc) const
+{
+    if (sc && _flags&DEEP_COPY_CALLBACKS)
+    {
+        // deep copy the full chain of callback
+        StateAttributeCallback* cb = dynamic_cast<StateAttributeCallback*>(sc->clone(*this));
+        return cb;
+    }
+    else
+        return const_cast<StateAttributeCallback*>(sc);
+}
+
Index: /OpenSceneGraph/trunk/src/osg/StateSet.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osg/StateSet.cpp (revision 9989)
+++ /OpenSceneGraph/trunk/src/osg/StateSet.cpp (revision 10671)
@@ -1674,5 +1674,5 @@
             ++itr)
         {
-            StateAttribute::Callback* callback = itr->second.first->getUpdateCallback();
+            StateAttributeCallback* callback = itr->second.first->getUpdateCallback();
             if (callback) (*callback)(itr->second.first.get(),nv);
         }
@@ -1687,5 +1687,5 @@
                 ++itr)
             {
-                StateAttribute::Callback* callback = itr->second.first->getUpdateCallback();
+                StateAttributeCallback* callback = itr->second.first->getUpdateCallback();
                 if (callback) (*callback)(itr->second.first.get(),nv);
             }
@@ -1748,5 +1748,5 @@
             ++itr)
         {
-            StateAttribute::Callback* callback = itr->second.first->getEventCallback();
+            StateAttributeCallback* callback = itr->second.first->getEventCallback();
             if (callback) (*callback)(itr->second.first.get(),nv);
         }
@@ -1761,5 +1761,5 @@
                 ++itr)
             {
-                StateAttribute::Callback* callback = itr->second.first->getEventCallback();
+                StateAttributeCallback* callback = itr->second.first->getEventCallback();
                 if (callback) (*callback)(itr->second.first.get(),nv);
             }
Index: /OpenSceneGraph/trunk/src/osg/CMakeLists.txt
===================================================================
--- /OpenSceneGraph/trunk/src/osg/CMakeLists.txt (revision 10650)
+++ /OpenSceneGraph/trunk/src/osg/CMakeLists.txt (revision 10671)
@@ -141,4 +141,5 @@
     ${HEADER_PATH}/State
     ${HEADER_PATH}/StateAttribute
+    ${HEADER_PATH}/StateAttributeCallback
     ${HEADER_PATH}/StateSet
     ${HEADER_PATH}/Stats
Index: /OpenSceneGraph/trunk/src/osgAnimation/UpdateCallback.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgAnimation/UpdateCallback.cpp (revision 10561)
+++ /OpenSceneGraph/trunk/src/osgAnimation/UpdateCallback.cpp (revision 10671)
@@ -123,5 +123,5 @@
 UpdateMaterial::UpdateMaterial(const UpdateMaterial& apc,const osg::CopyOp& copyop) 
     : osg::Object(apc, copyop),
-      AnimationUpdateCallback<osg::StateAttribute::Callback>(apc, copyop)
+      AnimationUpdateCallback<osg::StateAttributeCallback>(apc, copyop)
 {
     _diffuse = new osgAnimation::Vec4Target(apc._diffuse->getValue());
@@ -129,5 +129,5 @@
 
 UpdateMaterial::UpdateMaterial(const std::string& name):
-    AnimationUpdateCallback<osg::StateAttribute::Callback>(name)
+    AnimationUpdateCallback<osg::StateAttributeCallback>(name)
 {
     _diffuse = new osgAnimation::Vec4Target(osg::Vec4(1,0,1,1));
@@ -145,4 +145,6 @@
 }
 
+
+osgAnimation::Vec4Target* UpdateMaterial::getDiffuse() { return _diffuse.get(); }
 void UpdateMaterial::update(osg::Material& material) 
 {
Index: /OpenSceneGraph/trunk/src/osgPlugins/osg/StateAttribute.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/osg/StateAttribute.cpp (revision 9389)
+++ /OpenSceneGraph/trunk/src/osgPlugins/osg/StateAttribute.cpp (revision 10671)
@@ -30,10 +30,10 @@
     StateAttribute& stateAttribute = static_cast<StateAttribute&>(obj);
 
-    static ref_ptr<StateAttribute::Callback> s_callback = new osg::StateAttribute::Callback;
+    static ref_ptr<StateAttributeCallback> s_callback = new osg::StateAttributeCallback;
     while (fr.matchSequence("UpdateCallback {"))
     {
         //int entry = fr[0].getNoNestedBrackets();
         fr += 2;
-        StateAttribute::Callback* callback = dynamic_cast<StateAttribute::Callback*>(fr.readObjectOfType(*s_callback));
+        StateAttributeCallback* callback = dynamic_cast<StateAttributeCallback*>(fr.readObjectOfType(*s_callback));
         if (callback) {
             stateAttribute.setUpdateCallback(callback);
@@ -46,5 +46,5 @@
         //int entry = fr[0].getNoNestedBrackets();
         fr += 2;
-        StateAttribute::Callback* callback = dynamic_cast<StateAttribute::Callback*>(fr.readObjectOfType(*s_callback));
+        StateAttributeCallback* callback = dynamic_cast<StateAttributeCallback*>(fr.readObjectOfType(*s_callback));
         if (callback) {
             stateAttribute.setEventCallback(callback);
