X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=libs%2Fscenelib.h;h=e1c05d464d8ba5ee096c55f6f08c2a122db47e9e;hb=ec255b5639a353343c8b8b6b049839d262713480;hp=2b4b6007bb45fd69aa6bcc37ca5e9afc53a2e9ae;hpb=e4287c28bb2dafedc81c66e63951d947cfbeb225;p=xonotic%2Fnetradiant.git diff --git a/libs/scenelib.h b/libs/scenelib.h index 2b4b6007..e1c05d46 100644 --- a/libs/scenelib.h +++ b/libs/scenelib.h @@ -22,6 +22,7 @@ #if !defined ( INCLUDED_SCENELIB_H ) #define INCLUDED_SCENELIB_H +#include "globaldefs.h" #include "iscenegraph.h" #include "iselection.h" @@ -106,9 +107,9 @@ NodeType() : m_typeId( NODETYPEID_NONE ){ void initialise(){ m_typeId = GlobalSceneGraph().getNodeTypeId( Name() ); } -typedef MemberCaller, &NodeType::initialise> InitialiseCaller; +typedef MemberCaller, void(), &NodeType::initialise> InitialiseCaller; TypeId getTypeId(){ -#if defined( _DEBUG ) +#if GDEF_DEBUG ASSERT_MESSAGE( m_typeId != NODETYPEID_NONE, "node-type " << makeQuoted( Name() ) << " used before being initialised" ); #endif return m_typeId; @@ -166,6 +167,8 @@ class Symbiot { public: virtual void release() = 0; +virtual ~Symbiot(){ +} }; private: @@ -223,8 +226,18 @@ bool visible(){ bool excluded(){ return ( m_state & eExcluded ) != 0; } +bool operator<( const scene::Node& other ){ + return this < &other; +} +bool operator==( const scene::Node& other ){ + return this == &other; +} +bool operator!=( const scene::Node& other ){ + return this != &other; +} }; + class NullNode : public Node::Symbiot { NodeTypeCastTable m_casts; @@ -276,16 +289,6 @@ inline TransformNode* Node_getTransformNode( scene::Node& node ){ return NodeTypeCast::cast( node ); } -inline bool operator<( scene::Node& node, scene::Node& other ){ - return &node < &other; -} -inline bool operator==( scene::Node& node, scene::Node& other ){ - return &node == &other; -} -inline bool operator!=( scene::Node& node, scene::Node& other ){ - return !::operator==( node, other ); -} - inline scene::Node& NewNullNode(){ return ( new scene::NullNode )->node(); @@ -439,9 +442,9 @@ InstanceType() : m_typeId( INSTANCETYPEID_NONE ){ void initialise(){ m_typeId = GlobalSceneGraph().getInstanceTypeId( Name() ); } -typedef MemberCaller, &InstanceType::initialise> InitialiseCaller; +typedef MemberCaller, void(), &InstanceType::initialise> InitialiseCaller; TypeId getTypeId(){ -#if defined( _DEBUG ) +#if GDEF_DEBUG ASSERT_MESSAGE( m_typeId != INSTANCETYPEID_NONE, "instance-type " << makeQuoted( Name() ) << " used before being initialised" ); #endif return m_typeId; @@ -572,8 +575,8 @@ mutable bool m_childSelected; mutable bool m_childSelectedChanged; mutable bool m_parentSelected; mutable bool m_parentSelectedChanged; -Callback m_childSelectedChangedCallback; -Callback m_transformChangedCallback; +Callback m_childSelectedChangedCallback; +Callback m_transformChangedCallback; void evaluateTransform() const { @@ -671,7 +674,7 @@ void transformChanged(){ GlobalSceneGraph().traverse_subgraph( TransformChangedWalker(), m_path ); boundsChanged(); } -void setTransformChangedCallback( const Callback& callback ){ +void setTransformChangedCallback( const Callback& callback ){ m_transformChangedCallback = callback; } @@ -708,7 +711,7 @@ bool childSelected() const { return m_childSelected; } -void setChildSelectedChangedCallback( const Callback& callback ){ +void setChildSelectedChangedCallback( const Callback& callback ){ m_childSelectedChangedCallback = callback; } void selectedChanged(){ @@ -931,10 +934,10 @@ virtual void decrement() = 0; class SimpleCounter : public Counter { -Callback m_countChanged; +Callback m_countChanged; std::size_t m_count; public: -void setCountChangedCallback( const Callback& countChanged ){ +void setCountChangedCallback( const Callback& countChanged ){ m_countChanged = countChanged; } void increment(){