Panda3D
fltExternalReference.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 fltExternalReference.h
10  * @author drose
11  * @date 2000-08-30
12  */
13 
14 #ifndef FLTEXTERNALREFERENCE_H
15 #define FLTEXTERNALREFERENCE_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "fltBead.h"
20 
21 #include "filename.h"
22 
23 /**
24  * An external reference to another flt file (possibly to a specific bead
25  * within the flt file).
26  */
27 class FltExternalReference : public FltBead {
28 public:
30 
31  virtual void apply_converted_filenames();
32  virtual void output(std::ostream &out) const;
33 
34  enum Flags {
35  F_color_palette_override = 0x80000000,
36  F_material_palette_override = 0x40000000,
37  F_texture_palette_override = 0x20000000,
38  F_line_style_palette_override = 0x10000000,
39  F_sound_palette_override = 0x08000000,
40  F_light_palette_override = 0x04000000
41  };
42 
43  std::string _orig_filename;
44  Filename _converted_filename;
45  std::string _bead_id;
46  int _flags;
47 
48  Filename get_ref_filename() const;
49  void set_ref_filename(const Filename &filename);
50 
51 protected:
52  virtual bool extract_record(FltRecordReader &reader);
53  virtual bool build_record(FltRecordWriter &writer) const;
54 
55 public:
56  virtual TypeHandle get_type() const {
57  return get_class_type();
58  }
59  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
60  static TypeHandle get_class_type() {
61  return _type_handle;
62  }
63  static void init_type() {
64  FltBead::init_type();
65  register_type(_type_handle, "FltExternalReference",
66  FltBead::get_class_type());
67  }
68 
69 private:
70  static TypeHandle _type_handle;
71 };
72 
73 #endif
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly.
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
virtual void apply_converted_filenames()
Walks the hierarchy at this record and below and copies the _converted_filename record into the _orig...
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(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_ref_filename(const Filename &filename)
Changes the name of the referenced file.
A base class for any of a broad family of flt records that represent particular beads in the hierarch...
Definition: fltBead.h:29
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:44
virtual void output(std::ostream &out) const
Writes a quick one-line description of the record, but not its children.
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
An external reference to another flt file (possibly to a specific bead within the flt file).
Filename get_ref_filename() const
Returns the name of the referenced file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81