Index: panda/src/pgraph/pandaNode.h =================================================================== --- panda/src/pgraph/pandaNode.h (revision 3760) +++ panda/src/pgraph/pandaNode.h (working copy) @@ -202,15 +202,14 @@ void clear_tag(const string &key, Thread *current_thread = Thread::get_current_thread()); void get_tags(vector_string &keys) const; + void get_python_tags(vector_string &keys) const; #ifdef HAVE_PYTHON PyObject *get_tags() const; -#endif - -#ifdef HAVE_PYTHON void set_python_tag(const string &key, PyObject *value); PyObject *get_python_tag(const string &key) const; bool has_python_tag(const string &key) const; void clear_python_tag(const string &key); + PyObject *get_python_tags() const; #endif // HAVE_PYTHON INLINE bool has_tags() const; Index: panda/src/pgraph/pandaNode.cxx =================================================================== --- panda/src/pgraph/pandaNode.cxx (revision 3760) +++ panda/src/pgraph/pandaNode.cxx (working copy) @@ -1743,12 +1743,34 @@ } } +//////////////////////////////////////////////////////////////////// +// Function: Filename::get_python_tags +// Access: Published +// Description: Fills the given vector up with the +// list of Python tags on this PandaNode. +// +// It is the user's responsibility to ensure that the +// keys vector is empty before making this call; +// otherwise, the new files will be appended to it. +//////////////////////////////////////////////////////////////////// +void PandaNode:: +get_python_tags(vector_string &keys) const { + CDReader cdata(_cycler); + if (!cdata->_python_tag_data.empty()) { + PythonTagData::const_iterator ti = cdata->_python_tag_data.begin(); + while (ti != cdata->_python_tag_data.end()) { + keys.push_back((*ti).first); + ++ti; + } + } +} + #ifdef HAVE_PYTHON //////////////////////////////////////////////////////////////////// // Function: Filename::get_tags // Access: Published -// Description: This variant on get_tags returns a Python list -// of strings. +// Description: This variant on get_tags returns +// a Python list of strings. //////////////////////////////////////////////////////////////////// PyObject *PandaNode:: get_tags() const { @@ -1764,6 +1786,27 @@ return result; } + +//////////////////////////////////////////////////////////////////// +// Function: Filename::get_python_tags +// Access: Published +// Description: This variant on get_python_tags returns +// a Python list of strings. +//////////////////////////////////////////////////////////////////// +PyObject *PandaNode:: +get_python_tags() const { + vector_string keys; + get_python_tags(keys); + + PyObject *result = PyList_New(keys.size()); + for (size_t i = 0; i < keys.size(); ++i) { + const string &tag_name = keys[i]; + PyObject *str = PyString_FromStringAndSize(tag_name.data(), tag_name.size()); + PyList_SET_ITEM(result, i, str); + } + + return result; +} #endif // HAVE_PYTHON //////////////////////////////////////////////////////////////////// Index: panda/src/pgraph/nodePath.I =================================================================== --- panda/src/pgraph/nodePath.I (revision 3760) +++ panda/src/pgraph/nodePath.I (working copy) @@ -2223,6 +2223,22 @@ node()->get_tags(keys); } +//////////////////////////////////////////////////////////////////// +// Function: NodePath::get_python_tags +// Access: Published +// Description: Fills the given vector up with the +// list of Python tags on this PandaNode. +// +// It is the user's responsibility to ensure that the +// keys vector is empty before making this call; +// otherwise, the new files will be appended to it. +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +get_python_tags(vector_string &keys) const { + nassertv_always(!is_empty()); + node()->get_python_tags(keys); +} + #ifdef HAVE_PYTHON //////////////////////////////////////////////////////////////////// // Function: Filename::get_tags @@ -2239,6 +2255,22 @@ } return node()->get_tags(); } + +//////////////////////////////////////////////////////////////////// +// Function: Filename::get_python_tags +// Access: Published +// Description: This variant on get_python_tags returns a Python list +// of strings. Returns None if the NodePath is empty. +//////////////////////////////////////////////////////////////////// +INLINE PyObject *NodePath:: +get_python_tags() const { + // An empty NodePath returns None + if (is_empty()) { + Py_INCREF(Py_None); + return Py_None; + } + return node()->get_python_tags(); +} #endif // HAVE_PYTHON //////////////////////////////////////////////////////////////////// Index: panda/src/pgraph/nodePath.h =================================================================== --- panda/src/pgraph/nodePath.h (revision 3760) +++ panda/src/pgraph/nodePath.h (working copy) @@ -915,6 +915,8 @@ INLINE PyObject *get_tags() const; INLINE void set_python_tag(const string &key, PyObject *value); INLINE PyObject *get_python_tag(const string &key) const; + INLINE void get_python_tags(vector_string &keys) const; + INLINE PyObject *get_python_tags() const; INLINE bool has_python_tag(const string &key) const; INLINE void clear_python_tag(const string &key); INLINE PyObject *get_net_python_tag(const string &key) const;