From 78f67d8afdd1d223f9c4268eb6b8bdfa0e0750da Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 3 Jun 2003 22:53:09 +0000 Subject: [PATCH] add has_user_data with type --- panda/src/egg/eggObject.I | 11 +++++++++++ panda/src/egg/eggObject.h | 1 + 2 files changed, 12 insertions(+) diff --git a/panda/src/egg/eggObject.I b/panda/src/egg/eggObject.I index 9280d0dcc5..90a50a220d 100644 --- a/panda/src/egg/eggObject.I +++ b/panda/src/egg/eggObject.I @@ -92,6 +92,17 @@ has_user_data() const { return !_user_data.is_null(); } +//////////////////////////////////////////////////////////////////// +// Function: EggObject::has_user_data +// Access: Public +// Description: Returns true if the user data pointer has been set +// and is of the indicated type, false otherwise. +//////////////////////////////////////////////////////////////////// +INLINE bool EggObject:: +has_user_data(TypeHandle type) const { + return !_user_data.is_null() && _user_data->is_of_type(type); +} + //////////////////////////////////////////////////////////////////// // Function: EggObject::clear_user_data // Access: Public diff --git a/panda/src/egg/eggObject.h b/panda/src/egg/eggObject.h index 6cb7ca124f..d34b2c88ca 100644 --- a/panda/src/egg/eggObject.h +++ b/panda/src/egg/eggObject.h @@ -40,6 +40,7 @@ public: INLINE void set_user_data(EggUserData *user_data); INLINE EggUserData *get_user_data() const; INLINE bool has_user_data() const; + INLINE bool has_user_data(TypeHandle type) const; INLINE void clear_user_data(); private: