Panda3D
Loading...
Searching...
No Matches
eggGroupUniquifier.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file eggGroupUniquifier.h
10 * @author drose
11 * @date 2001-02-22
12 */
13
14#ifndef EGGGROUPUNIQUIFIER_H
15#define EGGGROUPUNIQUIFIER_H
16
17#include "pandabase.h"
18
19#include "eggNameUniquifier.h"
20
21/**
22 * This is a specialization of EggNameUniquifier to generate unique names for
23 * EggGroup nodes. It's not called automatically; you must invoke it yourself
24 * if you want it.
25 */
26class EXPCL_PANDA_EGG EggGroupUniquifier : public EggNameUniquifier {
27PUBLISHED:
28 explicit EggGroupUniquifier(bool filter_names = true);
29
30 virtual std::string get_category(EggNode *node);
31 virtual std::string filter_name(EggNode *node);
32 virtual std::string generate_name(EggNode *node,
33 const std::string &category, int index);
34
35private:
36 bool _filter_names;
37
38public:
39 static TypeHandle get_class_type() {
40 return _type_handle;
41 }
42 static void init_type() {
43 EggNameUniquifier::init_type();
44 register_type(_type_handle, "EggGroupUniquifier",
45 EggNameUniquifier::get_class_type());
46 }
47 virtual TypeHandle get_type() const {
48 return get_class_type();
49 }
50 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
51
52private:
53 static TypeHandle _type_handle;
54
55};
56
57#endif
This is a specialization of EggNameUniquifier to generate unique names for EggGroup nodes.
This is a handy class for guaranteeing unique node names in an egg hierarchy.
virtual std::string filter_name(EggNode *node)
Returns the name of the given node, or at least the name it should be.
virtual std::string generate_name(EggNode *node, const std::string &category, int index)
Generates a new name for the given node when its existing name clashes with some other node.
A base class for things that may be directly added into the egg hierarchy.
Definition eggNode.h:36
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...