From 9859f3110b9818053ccb77ad824a68b48c6f03c1 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 21 May 2014 09:06:17 +0000 Subject: [PATCH] Renamed callbacks to avoid overlap with Node callbacks --- include/osg/Drawable | 26 +++++++++++++------------- src/osg/Drawable.cpp | 24 ++++++++++++------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/osg/Drawable b/include/osg/Drawable index 530e516d2..fca8401a7 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -145,7 +145,7 @@ class OSG_EXPORT Drawable : public Node if(!_boundingSphereComputed) { _boundingBox = _initialBound; - + if (_computeBoundCallback.valid()) _boundingBox.expandBy(_computeBoundCallback->computeBound(*this)); else @@ -292,13 +292,13 @@ class OSG_EXPORT Drawable : public Node virtual void setUpdateCallback(UpdateCallback* ac); /** Get the non const UpdateCallback.*/ - UpdateCallback* getUpdateCallback() { return _updateCallback.get(); } + UpdateCallback* getUpdateCallback() { return _drawableUpdateCallback.get(); } /** Get the const UpdateCallback.*/ - const UpdateCallback* getUpdateCallback() const { return _updateCallback.get(); } + const UpdateCallback* getUpdateCallback() const { return _drawableUpdateCallback.get(); } /** Return whether this Drawable has update callbacks associated with it, and therefore must be traversed.*/ - bool requiresUpdateTraversal() const { return _updateCallback.valid() || (_stateset.valid() && _stateset->requiresUpdateTraversal()); } + bool requiresUpdateTraversal() const { return _drawableUpdateCallback.valid() || (_stateset.valid() && _stateset->requiresUpdateTraversal()); } struct EventCallback : public virtual osg::Object @@ -317,13 +317,13 @@ class OSG_EXPORT Drawable : public Node virtual void setEventCallback(EventCallback* ac); /** Get the non const EventCallback.*/ - EventCallback* getEventCallback() { return _eventCallback.get(); } + EventCallback* getEventCallback() { return _drawableEventCallback.get(); } /** Get the const EventCallback.*/ - const EventCallback* getEventCallback() const { return _eventCallback.get(); } + const EventCallback* getEventCallback() const { return _drawableEventCallback.get(); } /** Return whether this Drawable has event callbacks associated with it, and therefore must be traversed.*/ - bool requiresEventTraversal() const { return _eventCallback.valid() || (_stateset.valid() && _stateset->requiresEventTraversal()); } + bool requiresEventTraversal() const { return _drawableEventCallback.valid() || (_stateset.valid() && _stateset->requiresEventTraversal()); } struct CullCallback : public virtual osg::Object @@ -342,13 +342,13 @@ class OSG_EXPORT Drawable : public Node }; /** Set the CullCallback which allows users to customize the culling of Drawable during the cull traversal.*/ - virtual void setCullCallback(CullCallback* cc) { _cullCallback=cc; } + virtual void setCullCallback(CullCallback* cc) { _drawableCullCallback=cc; } /** Get the non const CullCallback.*/ - CullCallback* getCullCallback() { return _cullCallback.get(); } + CullCallback* getCullCallback() { return _drawableCullCallback.get(); } /** Get the const CullCallback.*/ - const CullCallback* getCullCallback() const { return _cullCallback.get(); } + const CullCallback* getCullCallback() const { return _drawableCullCallback.get(); } @@ -798,10 +798,10 @@ class OSG_EXPORT Drawable : public Node typedef osg::buffered_value GLObjectList; mutable GLObjectList _globjList; - ref_ptr _updateCallback; - ref_ptr _eventCallback; + ref_ptr _drawableUpdateCallback; + ref_ptr _drawableEventCallback; - ref_ptr _cullCallback; + ref_ptr _drawableCullCallback; ref_ptr _drawCallback; }; diff --git a/src/osg/Drawable.cpp b/src/osg/Drawable.cpp index a3d5e68fd..c32a2edc3 100644 --- a/src/osg/Drawable.cpp +++ b/src/osg/Drawable.cpp @@ -249,9 +249,9 @@ Drawable::Drawable(const Drawable& drawable,const CopyOp& copyop): _useDisplayList(drawable._useDisplayList), _supportsVertexBufferObjects(drawable._supportsVertexBufferObjects), _useVertexBufferObjects(drawable._useVertexBufferObjects), - _updateCallback(drawable._updateCallback), - _eventCallback(drawable._eventCallback), - _cullCallback(drawable._cullCallback), + _drawableUpdateCallback(drawable._drawableUpdateCallback), + _drawableEventCallback(drawable._drawableEventCallback), + _drawableCullCallback(drawable._drawableCullCallback), _drawCallback(drawable._drawCallback) { setStateSet(copyop(drawable._stateset.get())); @@ -328,9 +328,9 @@ void Drawable::setThreadSafeRefUnref(bool threadSafe) Object::setThreadSafeRefUnref(threadSafe); if (_stateset.valid()) _stateset->setThreadSafeRefUnref(threadSafe); - if (_updateCallback.valid()) _updateCallback->setThreadSafeRefUnref(threadSafe); - if (_eventCallback.valid()) _eventCallback->setThreadSafeRefUnref(threadSafe); - if (_cullCallback.valid()) _cullCallback->setThreadSafeRefUnref(threadSafe); + if (_drawableUpdateCallback.valid()) _drawableUpdateCallback->setThreadSafeRefUnref(threadSafe); + if (_drawableEventCallback.valid()) _drawableEventCallback->setThreadSafeRefUnref(threadSafe); + if (_drawableCullCallback.valid()) _drawableCullCallback->setThreadSafeRefUnref(threadSafe); if (_drawCallback.valid()) _drawCallback->setThreadSafeRefUnref(threadSafe); } @@ -470,13 +470,13 @@ void Drawable::dirtyDisplayList() void Drawable::setUpdateCallback(UpdateCallback* ac) { - if (_updateCallback==ac) return; + if (_drawableUpdateCallback==ac) return; int delta = 0; - if (_updateCallback.valid()) --delta; + if (_drawableUpdateCallback.valid()) --delta; if (ac) ++delta; - _updateCallback = ac; + _drawableUpdateCallback = ac; if (delta!=0 && !(_stateset.valid() && _stateset->requiresUpdateTraversal())) { @@ -491,13 +491,13 @@ void Drawable::setUpdateCallback(UpdateCallback* ac) void Drawable::setEventCallback(EventCallback* ac) { - if (_eventCallback==ac) return; + if (_drawableEventCallback==ac) return; int delta = 0; - if (_eventCallback.valid()) --delta; + if (_drawableEventCallback.valid()) --delta; if (ac) ++delta; - _eventCallback = ac; + _drawableEventCallback = ac; if (delta!=0 && !(_stateset.valid() && _stateset->requiresEventTraversal())) {