Panda3D
fltExternalReference.h
1 // Filename: fltExternalReference.h
2 // Created by: drose (30Aug00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef FLTEXTERNALREFERENCE_H
16 #define FLTEXTERNALREFERENCE_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "fltBead.h"
21 
22 #include "filename.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : FltExternalReference
26 // Description : An external reference to another flt file (possibly
27 // to a specific bead within the flt file).
28 ////////////////////////////////////////////////////////////////////
29 class FltExternalReference : public FltBead {
30 public:
32 
33  virtual void apply_converted_filenames();
34  virtual void output(ostream &out) const;
35 
36  enum Flags {
37  F_color_palette_override = 0x80000000,
38  F_material_palette_override = 0x40000000,
39  F_texture_palette_override = 0x20000000,
40  F_line_style_palette_override = 0x10000000,
41  F_sound_palette_override = 0x08000000,
42  F_light_palette_override = 0x04000000
43  };
44 
45  string _orig_filename;
46  Filename _converted_filename;
47  string _bead_id;
48  int _flags;
49 
50  Filename get_ref_filename() const;
51  void set_ref_filename(const Filename &filename);
52 
53 protected:
54  virtual bool extract_record(FltRecordReader &reader);
55  virtual bool build_record(FltRecordWriter &writer) const;
56 
57 public:
58  virtual TypeHandle get_type() const {
59  return get_class_type();
60  }
61  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
62  static TypeHandle get_class_type() {
63  return _type_handle;
64  }
65  static void init_type() {
66  FltBead::init_type();
67  register_type(_type_handle, "FltExternalReference",
68  FltBead::get_class_type());
69  }
70 
71 private:
72  static TypeHandle _type_handle;
73 };
74 
75 #endif
76 
77 
virtual void output(ostream &out) const
Writes a quick one-line description of the record, but not its children.
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...
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:33
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:48
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
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.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85