diff --git a/panda/src/event/eventParameter.I b/panda/src/event/eventParameter.I index 4c78c799e7..9cecb4d842 100644 --- a/panda/src/event/eventParameter.I +++ b/panda/src/event/eventParameter.I @@ -23,7 +23,7 @@ TypeHandle EventStoreValue::_type_handle; //////////////////////////////////////////////////////////////////// // Function: EventParameter::Default constructor -// Access: Public +// Access: Published // Description: Defines an EventParameter that stores nothing: the // "empty" parameter. //////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ EventParameter() { //////////////////////////////////////////////////////////////////// // Function: EventParameter::Pointer constructor -// Access: Public +// Access: Published // Description: Defines an EventParameter that stores a pointer to // any kind of TypedWritableReferenceCount object. This // is the most general constructor. @@ -49,7 +49,7 @@ EventParameter(const TypedWritableReferenceCount *ptr) : _ptr((TypedWritableRefe //////////////////////////////////////////////////////////////////// // Function: EventParameter::Pointer constructor -// Access: Public +// Access: Published // Description: Defines an EventParameter that stores a pointer to // a TypedReferenceCount object. Note that a // TypedReferenceCount is not the same kind of pointer @@ -68,7 +68,7 @@ EventParameter(const TypedReferenceCount *ptr) : _ptr(new EventStoreTypedRefCoun //////////////////////////////////////////////////////////////////// // Function: EventParameter::Integer constructor -// Access: Public +// Access: Published // Description: Defines an EventParameter that stores an integer // value. //////////////////////////////////////////////////////////////////// @@ -78,7 +78,7 @@ EventParameter(int value) : _ptr(new EventStoreInt(value)) { } //////////////////////////////////////////////////////////////////// // Function: EventParameter::Double constructor -// Access: Public +// Access: Published // Description: Defines an EventParameter that stores a // floating-point value. //////////////////////////////////////////////////////////////////// @@ -88,7 +88,7 @@ EventParameter(double value) : _ptr(new EventStoreDouble(value)) { } //////////////////////////////////////////////////////////////////// // Function: EventParameter::String constructor -// Access: Public +// Access: Published // Description: Defines an EventParameter that stores a string value. //////////////////////////////////////////////////////////////////// INLINE EventParameter:: @@ -96,7 +96,7 @@ EventParameter(const string &value) : _ptr(new EventStoreString(value)) { } //////////////////////////////////////////////////////////////////// // Function: EventParameter::Wstring constructor -// Access: Public +// Access: Published // Description: Defines an EventParameter that stores a wstring value. //////////////////////////////////////////////////////////////////// INLINE EventParameter:: @@ -105,7 +105,7 @@ EventParameter(const wstring &value) : _ptr(new EventStoreWstring(value)) { } //////////////////////////////////////////////////////////////////// // Function: EventParameter::Copy constructor -// Access: Public +// Access: Published // Description: //////////////////////////////////////////////////////////////////// INLINE EventParameter:: @@ -114,7 +114,7 @@ EventParameter(const EventParameter &other) : _ptr(other._ptr) { } //////////////////////////////////////////////////////////////////// // Function: EventParameter::Copy assignment operator -// Access: Public +// Access: Published // Description: //////////////////////////////////////////////////////////////////// INLINE EventParameter &EventParameter:: @@ -125,7 +125,7 @@ operator = (const EventParameter &other) { //////////////////////////////////////////////////////////////////// // Function: EventParameter::Destructor -// Access: Public +// Access: Published // Description: //////////////////////////////////////////////////////////////////// INLINE EventParameter:: @@ -134,7 +134,7 @@ INLINE EventParameter:: //////////////////////////////////////////////////////////////////// // Function: EventParameter::is_empty -// Access: Public +// Access: Published // Description: Returns true if the EventParameter is the empty // parameter, storing nothing, or false otherwise. //////////////////////////////////////////////////////////////////// @@ -145,7 +145,7 @@ is_empty() const { //////////////////////////////////////////////////////////////////// // Function: EventParameter::is_int -// Access: Public +// Access: Published // Description: Returns true if the EventParameter stores an integer // value, false otherwise. //////////////////////////////////////////////////////////////////// @@ -159,7 +159,7 @@ is_int() const { //////////////////////////////////////////////////////////////////// // Function: EventParameter::get_int_value -// Access: Public +// Access: Published // Description: Retrieves the value stored in the EventParameter. It // is only valid to call this if is_int() has already // returned true. @@ -175,7 +175,7 @@ get_int_value() const { //////////////////////////////////////////////////////////////////// // Function: EventParameter::is_double -// Access: Public +// Access: Published // Description: Returns true if the EventParameter stores a double // floating-point value, false otherwise. //////////////////////////////////////////////////////////////////// @@ -189,7 +189,7 @@ is_double() const { //////////////////////////////////////////////////////////////////// // Function: EventParameter::get_double_value -// Access: Public +// Access: Published // Description: Retrieves the value stored in the EventParameter. It // is only valid to call this if is_double() has already // returned true. @@ -202,7 +202,7 @@ get_double_value() const { //////////////////////////////////////////////////////////////////// // Function: EventParameter::is_string -// Access: Public +// Access: Published // Description: Returns true if the EventParameter stores a string // value, false otherwise. //////////////////////////////////////////////////////////////////// @@ -216,7 +216,7 @@ is_string() const { //////////////////////////////////////////////////////////////////// // Function: EventParameter::get_string_value -// Access: Public +// Access: Published // Description: Retrieves the value stored in the EventParameter. It // is only valid to call this if is_string() has already // returned true. @@ -229,7 +229,7 @@ get_string_value() const { //////////////////////////////////////////////////////////////////// // Function: EventParameter::is_wstring -// Access: Public +// Access: Published // Description: Returns true if the EventParameter stores a wstring // value, false otherwise. //////////////////////////////////////////////////////////////////// @@ -243,7 +243,7 @@ is_wstring() const { //////////////////////////////////////////////////////////////////// // Function: EventParameter::get_wstring_value -// Access: Public +// Access: Published // Description: Retrieves the value stored in the EventParameter. It // is only valid to call this if is_wstring() has already // returned true. @@ -256,7 +256,7 @@ get_wstring_value() const { //////////////////////////////////////////////////////////////////// // Function: EventParameter::is_typed_ref_count -// Access: Public +// Access: Published // Description: Returns true if the EventParameter stores a // TypedReferenceCount pointer, false otherwise. Note // that a TypedReferenceCount is not exactly the same @@ -273,7 +273,7 @@ is_typed_ref_count() const { //////////////////////////////////////////////////////////////////// // Function: EventParameter::get_typed_ref_count_value -// Access: Public +// Access: Published // Description: Retrieves the value stored in the EventParameter. It // is only valid to call this if is_typed_ref_count() // has already returned true. @@ -286,7 +286,7 @@ get_typed_ref_count_value() const { //////////////////////////////////////////////////////////////////// // Function: EventParameter::get_ptr -// Access: Public +// Access: Published // Description: Retrieves a pointer to the actual value stored in the // parameter. The TypeHandle of this pointer may be // examined to determine the actual type of parameter it @@ -316,7 +316,7 @@ EventStoreValueBase() { //////////////////////////////////////////////////////////////////// // Function: EventStoreTypedRefCount::Constructor -// Access: Public +// Access: Published // Description: //////////////////////////////////////////////////////////////////// INLINE EventStoreTypedRefCount:: @@ -327,7 +327,7 @@ EventStoreTypedRefCount(const TypedReferenceCount *value) : //////////////////////////////////////////////////////////////////// // Function: EventStoreTypedRefCount::set_value -// Access: Public +// Access: Published // Description: Changes the value stored in the parameter. It is // dangerous to do this for a parameter already added to // an event, since the parameters may be shared. @@ -340,7 +340,7 @@ set_value(const TypedReferenceCount *value) { //////////////////////////////////////////////////////////////////// // Function: EventStoreTypedRefCount::get_value -// Access: Public +// Access: Published // Description: Retrieves the value stored in the parameter. //////////////////////////////////////////////////////////////////// INLINE TypedReferenceCount *EventStoreTypedRefCount:: diff --git a/panda/src/event/eventParameter.cxx b/panda/src/event/eventParameter.cxx index c7a6472088..c29cfc40ea 100644 --- a/panda/src/event/eventParameter.cxx +++ b/panda/src/event/eventParameter.cxx @@ -29,7 +29,7 @@ TypeHandle EventStoreTypedRefCount::_type_handle; //////////////////////////////////////////////////////////////////// // Function: EventParameter::output -// Access: Public +// Access: Published // Description: //////////////////////////////////////////////////////////////////// void EventParameter:: @@ -49,7 +49,7 @@ output(ostream &out) const { //////////////////////////////////////////////////////////////////// // Function: EventStoreValueBase::Destructor -// Access: Public, Virtual +// Access: Published, Virtual // Description: //////////////////////////////////////////////////////////////////// EventStoreValueBase:: @@ -58,7 +58,7 @@ EventStoreValueBase:: //////////////////////////////////////////////////////////////////// // Function: EventStoreTypedRefCount::Destructor -// Access: Public, Virtual +// Access: Published, Virtual // Description: //////////////////////////////////////////////////////////////////// EventStoreTypedRefCount:: @@ -67,7 +67,7 @@ EventStoreTypedRefCount:: //////////////////////////////////////////////////////////////////// // Function: EventStoreTypedRefCount::output -// Access: Public, Virtual +// Access: Published, Virtual // Description: //////////////////////////////////////////////////////////////////// void EventStoreTypedRefCount:: diff --git a/panda/src/event/eventParameter.h b/panda/src/event/eventParameter.h index a7b27928cf..2f97826d44 100644 --- a/panda/src/event/eventParameter.h +++ b/panda/src/event/eventParameter.h @@ -90,6 +90,8 @@ INLINE ostream &operator << (ostream &out, const EventParameter ¶m); class EXPCL_PANDA EventStoreValueBase : public TypedWritableReferenceCount { public: INLINE EventStoreValueBase(); + +PUBLISHED: virtual ~EventStoreValueBase(); virtual void output(ostream &out) const=0; @@ -118,7 +120,7 @@ private: // TypedWritableReferenceCount. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA EventStoreTypedRefCount : public EventStoreValueBase { -public: +PUBLISHED: INLINE EventStoreTypedRefCount(const TypedReferenceCount *value); virtual ~EventStoreTypedRefCount(); @@ -127,6 +129,7 @@ public: virtual void output(ostream &out) const; +public: PT(TypedReferenceCount) _value; public: diff --git a/panda/src/pgraph/Sources.pp b/panda/src/pgraph/Sources.pp index 84e13d2e0a..fb20413185 100644 --- a/panda/src/pgraph/Sources.pp +++ b/panda/src/pgraph/Sources.pp @@ -45,6 +45,7 @@ depthWriteAttrib.I depthWriteAttrib.h \ directionalLight.I directionalLight.h \ drawMaskAttrib.I drawMaskAttrib.h \ + eventStorePandaNode.I eventStorePandaNode.h \ fadeLodNode.I fadeLodNode.h fadeLodNodeData.h \ findApproxLevelEntry.I findApproxLevelEntry.h \ findApproxPath.I findApproxPath.h \ @@ -150,6 +151,7 @@ depthWriteAttrib.cxx \ directionalLight.cxx \ drawMaskAttrib.cxx \ + eventStorePandaNode.cxx \ fadeLodNode.cxx fadeLodNodeData.cxx \ findApproxLevelEntry.cxx \ findApproxPath.cxx \ @@ -252,6 +254,7 @@ depthWriteAttrib.I depthWriteAttrib.h \ directionalLight.I directionalLight.h \ drawMaskAttrib.I drawMaskAttrib.h \ + eventStorePandaNode.I eventStorePandaNode.h \ fadeLodNode.I fadeLodNode.h fadeLodNodeData.h \ fog.I fog.h \ fogAttrib.I fogAttrib.h \ diff --git a/panda/src/pgraph/config_pgraph.cxx b/panda/src/pgraph/config_pgraph.cxx index 6906d6cdbf..58c9c5388d 100644 --- a/panda/src/pgraph/config_pgraph.cxx +++ b/panda/src/pgraph/config_pgraph.cxx @@ -41,6 +41,7 @@ #include "depthWriteAttrib.h" #include "directionalLight.h" #include "drawMaskAttrib.h" +#include "eventStorePandaNode.h" #include "fadeLodNode.h" #include "fadeLodNodeData.h" #include "fog.h" @@ -313,6 +314,7 @@ init_libpgraph() { DepthWriteAttrib::init_type(); DirectionalLight::init_type(); DrawMaskAttrib::init_type(); + EventStorePandaNode::init_type(); FadeLODNode::init_type(); FadeLODNodeData::init_type(); Fog::init_type(); diff --git a/panda/src/pgraph/eventStorePandaNode.I b/panda/src/pgraph/eventStorePandaNode.I new file mode 100644 index 0000000000..c0581f71ca --- /dev/null +++ b/panda/src/pgraph/eventStorePandaNode.I @@ -0,0 +1,52 @@ +// Filename: eventStorePandaNode.I +// Created by: drose (13Sep06) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://etc.cmu.edu/panda3d/docs/license/ . +// +// To contact the maintainers of this program write to +// panda3d-general@lists.sourceforge.net . +// +//////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////// +// Function: EventStorePandaNode::Constructor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE EventStorePandaNode:: +EventStorePandaNode(const PandaNode *value) : + _value((PandaNode *)value) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: EventStorePandaNode::set_value +// Access: Published +// Description: Changes the value stored in the parameter. It is +// dangerous to do this for a parameter already added to +// an event, since the parameters may be shared. +//////////////////////////////////////////////////////////////////// +INLINE void EventStorePandaNode:: +set_value(const PandaNode *value) { + _value = (PandaNode *)value; +} + + +//////////////////////////////////////////////////////////////////// +// Function: EventStorePandaNode::get_value +// Access: Published +// Description: Retrieves the value stored in the parameter. +//////////////////////////////////////////////////////////////////// +INLINE PandaNode *EventStorePandaNode:: +get_value() const { + return _value; +} diff --git a/panda/src/pgraph/eventStorePandaNode.cxx b/panda/src/pgraph/eventStorePandaNode.cxx new file mode 100644 index 0000000000..a266a8edcd --- /dev/null +++ b/panda/src/pgraph/eventStorePandaNode.cxx @@ -0,0 +1,45 @@ +// Filename: eventStorePandaNode.cxx +// Created by: drose (13Sep06) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://etc.cmu.edu/panda3d/docs/license/ . +// +// To contact the maintainers of this program write to +// panda3d-general@lists.sourceforge.net . +// +//////////////////////////////////////////////////////////////////// + +#include "eventStorePandaNode.h" + +TypeHandle EventStorePandaNode::_type_handle; + +//////////////////////////////////////////////////////////////////// +// Function: EventStorePandaNode::Destructor +// Access: Published, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +EventStorePandaNode:: +~EventStorePandaNode() { +} + +//////////////////////////////////////////////////////////////////// +// Function: EventStorePandaNode::output +// Access: Published, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +void EventStorePandaNode:: +output(ostream &out) const { + if (_value == (PandaNode *)NULL) { + out << "(empty)"; + + } else { + out << *_value; + } +} diff --git a/panda/src/pgraph/eventStorePandaNode.h b/panda/src/pgraph/eventStorePandaNode.h new file mode 100644 index 0000000000..b1c718d1b8 --- /dev/null +++ b/panda/src/pgraph/eventStorePandaNode.h @@ -0,0 +1,64 @@ +// Filename: eventStorePandaNode.h +// Created by: drose (13Sep06) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://etc.cmu.edu/panda3d/docs/license/ . +// +// To contact the maintainers of this program write to +// panda3d-general@lists.sourceforge.net . +// +//////////////////////////////////////////////////////////////////// + +#ifndef EVENTSTOREPANDANODE_H +#define EVENTSTOREPANDANODE_H + +#include "pandabase.h" +#include "eventParameter.h" +#include "pandaNode.h" + +//////////////////////////////////////////////////////////////////// +// Class : EventStorePandaNode +// Description : A class object for storing specifically objects of +// type PandaNode. +//////////////////////////////////////////////////////////////////// +class EXPCL_PANDA EventStorePandaNode : public EventStoreValueBase { +PUBLISHED: + INLINE EventStorePandaNode(const PandaNode *value); + virtual ~EventStorePandaNode(); + + INLINE void set_value(const PandaNode *value); + INLINE PandaNode *get_value() const; + + virtual void output(ostream &out) const; + +public: + PT(PandaNode) _value; + +public: + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + EventStoreValueBase::init_type(); + register_type(_type_handle, "EventStorePandaNode", + EventStoreValueBase::get_class_type()); + } + +private: + static TypeHandle _type_handle; +}; + +#include "eventStorePandaNode.I" + +#endif diff --git a/panda/src/pgraph/pgraph_composite2.cxx b/panda/src/pgraph/pgraph_composite2.cxx index 6c720a49a6..24cbdaf64e 100644 --- a/panda/src/pgraph/pgraph_composite2.cxx +++ b/panda/src/pgraph/pgraph_composite2.cxx @@ -15,6 +15,7 @@ #include "alphaTestAttrib.cxx" #include "directionalLight.cxx" #include "drawMaskAttrib.cxx" +#include "eventStorePandaNode.cxx" #include "fadeLodNode.cxx" #include "fadeLodNodeData.cxx" #include "findApproxPath.cxx"