Panda3D

Loading...
Searching...
No Matches
somethingToEggConverter.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 somethingToEggConverter.h
10 * @author drose
11 * @date 2001-04-17
12 */
13
14#ifndef SOMETHINGTOEGGCONVERTER_H
15#define SOMETHINGTOEGGCONVERTER_H
16
17#include "pandatoolbase.h"
18
19#include "filename.h"
20#include "config_putil.h" // for get_model_path()
21#include "animationConvert.h"
22#include "pathReplace.h"
23#include "pointerTo.h"
24#include "distanceUnit.h"
25#include "pandaNode.h"
26
27 class EggData;
28 class EggGroupNode;
29 class LoaderOptions;
30
31/**
32 * This is a base class for a family of converter classes that manage a
33 * conversion from some file type to egg format.
34 *
35 * Classes of this type can be used to implement xxx2egg converter programs,
36 * as well as LoaderFileTypeXXX run-time loaders.
37 */
38 class SomethingToEggConverter {
39 public:
40 SomethingToEggConverter();
41 SomethingToEggConverter(const SomethingToEggConverter &copy);
42 virtual ~SomethingToEggConverter();
43
44 virtual SomethingToEggConverter *make_copy()=0;
45
46 INLINE void clear_error();
47 INLINE bool had_error() const;
48
49 INLINE void set_path_replace(PathReplace *path_replace);
50 INLINE PathReplace *get_path_replace();
51 INLINE const PathReplace *get_path_replace() const;
52
53 // These methods dealing with animation and frame rate are only relevant to
54 // converter types that understand animation.
55 INLINE void set_animation_convert(AnimationConvert animation_convert);
56 INLINE AnimationConvert get_animation_convert() const;
57
58 INLINE void set_character_name(const std::string &character_name);
59 INLINE const std::string &get_character_name() const;
60
61 INLINE void set_start_frame(double start_frame);
62 INLINE bool has_start_frame() const;
63 INLINE double get_start_frame() const;
64 INLINE void clear_start_frame();
65
66 INLINE void set_end_frame(double end_frame);
67 INLINE bool has_end_frame() const;
68 INLINE double get_end_frame() const;
69 INLINE void clear_end_frame();
70
71 INLINE void set_frame_inc(double frame_inc);
72 INLINE bool has_frame_inc() const;
73 INLINE double get_frame_inc() const;
74 INLINE void clear_frame_inc();
75
76 INLINE void set_neutral_frame(double neutral_frame);
77 INLINE bool has_neutral_frame() const;
78 INLINE double get_neutral_frame() const;
79 INLINE void clear_neutral_frame();
80
81 INLINE void set_input_frame_rate(double input_frame_rate);
82 INLINE bool has_input_frame_rate() const;
83 INLINE double get_input_frame_rate() const;
84 INLINE void clear_input_frame_rate();
85
86 INLINE void set_output_frame_rate(double output_frame_rate);
87 INLINE bool has_output_frame_rate() const;
88 INLINE double get_output_frame_rate() const;
89 INLINE void clear_output_frame_rate();
90
91 INLINE static double get_default_frame_rate();
92
93 INLINE void set_merge_externals(bool merge_externals);
94 INLINE bool get_merge_externals() const;
95
96 void set_egg_data(EggData *egg_data);
97 INLINE void clear_egg_data();
98 INLINE EggData *get_egg_data();
99
100 virtual std::string get_name() const=0;
101 virtual std::string get_extension() const=0;
102 virtual std::string get_additional_extensions() const;
103 virtual bool supports_compressed() const;
104 virtual bool supports_convert_to_node(const LoaderOptions &options) const;
105
106 virtual bool convert_file(const Filename &filename)=0;
107 virtual PT(PandaNode) convert_to_node(const LoaderOptions &options, const Filename &filename);
108 virtual DistanceUnit get_input_units();
109
110 bool handle_external_reference(EggGroupNode *egg_parent,
111 const Filename &ref_filename);
112
113 INLINE Filename convert_model_path(const Filename &orig_filename);
114
115 // Set this true to treat errors as warnings and generate output anyway.
116 bool _allow_errors;
117
118 protected:
119 PT(PathReplace) _path_replace;
120
121 AnimationConvert _animation_convert;
122 std::string _character_name;
123 double _start_frame;
124 double _end_frame;
125 double _frame_inc;
126 double _neutral_frame;
127 double _input_frame_rate; // frames per second
128 double _output_frame_rate; // frames per second
129 enum ControlFlags {
130 CF_start_frame = 0x0001,
131 CF_end_frame = 0x0002,
132 CF_frame_inc = 0x0004,
133 CF_neutral_frame = 0x0008,
134 CF_input_frame_rate = 0x0010,
135 CF_output_frame_rate = 0x0020,
136 };
137 int _control_flags;
138
139 bool _merge_externals;
140
141 PT(EggData) _egg_data;
142
143 bool _error;
144};
145
146#include "somethingToEggConverter.I"
147
148#endif
animationConvert.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
AnimationConvert
AnimationConvert
This enumerated type lists the methods by which animation from an animation package might be represen...
Definition animationConvert.h:23
EggData
This is the primary interface into all the egg data, and the root of the egg file structure.
Definition eggData.h:37
EggGroupNode
A base class for nodes in the hierarchy that are not leaf nodes.
Definition eggGroupNode.h:46
Filename
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
LoaderOptions
Specifies parameters that may be passed to the loader.
Definition loaderOptions.h:23
PandaNode
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
PathReplace
This encapsulates the user's command-line request to replace existing, incorrect pathnames to models ...
Definition pathReplace.h:36
SomethingToEggConverter::had_error
bool had_error() const
Returns true if an error was detected during the conversion process (unless _allow_errors is true),...
Definition somethingToEggConverter.I:28
SomethingToEggConverter::clear_end_frame
void clear_end_frame()
Removes the value previously set by set_end_frame().
Definition somethingToEggConverter.I:174
SomethingToEggConverter::get_animation_convert
AnimationConvert get_animation_convert() const
Returns how source animation will be converted into egg structures.
Definition somethingToEggConverter.I:75
SomethingToEggConverter::convert_model_path
Filename convert_model_path(const Filename &orig_filename)
Converts the indicated model filename to a relative or absolute or whatever filename,...
Definition somethingToEggConverter.I:389
SomethingToEggConverter::clear_input_frame_rate
void clear_input_frame_rate()
Removes the value previously set by set_input_frame_rate().
Definition somethingToEggConverter.I:295
SomethingToEggConverter::get_input_units
virtual DistanceUnit get_input_units()
This may be called after convert_file() has been called and returned true, indicating a successful co...
Definition somethingToEggConverter.cxx:107
SomethingToEggConverter::supports_compressed
virtual bool supports_compressed() const
Returns true if this file type can transparently load compressed files (with a .pz extension),...
Definition somethingToEggConverter.cxx:84
SomethingToEggConverter::clear_start_frame
void clear_start_frame()
Removes the value previously set by set_start_frame().
Definition somethingToEggConverter.I:133
SomethingToEggConverter::has_output_frame_rate
bool has_output_frame_rate() const
Returns true if the frame rate has been explicitly specified via set_output_frame_rate(),...
Definition somethingToEggConverter.I:316
SomethingToEggConverter::has_start_frame
bool has_start_frame() const
Returns true if the starting frame has been explicitly specified via set_start_frame(),...
Definition somethingToEggConverter.I:115
SomethingToEggConverter::set_input_frame_rate
void set_input_frame_rate(double input_frame_rate)
Specifies the number of frames per second that is represented by the "frame" unit in the animation pa...
Definition somethingToEggConverter.I:267
SomethingToEggConverter::clear_output_frame_rate
void clear_output_frame_rate()
Removes the value previously set by set_output_frame_rate().
Definition somethingToEggConverter.I:334
SomethingToEggConverter::get_path_replace
PathReplace * get_path_replace()
Returns a pointer to the PathReplace object associated with this converter.
Definition somethingToEggConverter.I:47
SomethingToEggConverter::clear_frame_inc
void clear_frame_inc()
Removes the value previously set by set_frame_inc().
Definition somethingToEggConverter.I:216
SomethingToEggConverter::get_egg_data
EggData * get_egg_data()
Returns the EggData structure.
Definition somethingToEggConverter.I:380
SomethingToEggConverter::get_input_frame_rate
double get_input_frame_rate() const
Returns the value set by a previous call to set_input_frame_rate().
Definition somethingToEggConverter.I:286
SomethingToEggConverter::has_neutral_frame
bool has_neutral_frame() const
Returns true if the neutral frame has been explicitly specified via set_neutral_frame(),...
Definition somethingToEggConverter.I:236
SomethingToEggConverter::clear_neutral_frame
void clear_neutral_frame()
Removes the value previously set by set_neutral_frame().
Definition somethingToEggConverter.I:254
SomethingToEggConverter::get_merge_externals
bool get_merge_externals() const
Returns the current state of the merge_externals flag.
Definition somethingToEggConverter.I:364
SomethingToEggConverter::set_end_frame
void set_end_frame(double end_frame)
Specifies the ending frame of the animation to convert, in the units specified by set_input_frame_rat...
Definition somethingToEggConverter.I:145
SomethingToEggConverter::set_animation_convert
void set_animation_convert(AnimationConvert animation_convert)
Specifies how source animation will be converted into egg structures.
Definition somethingToEggConverter.I:67
SomethingToEggConverter::set_character_name
void set_character_name(const std::string &character_name)
Specifies the name of the character generated.
Definition somethingToEggConverter.I:85
SomethingToEggConverter::set_merge_externals
void set_merge_externals(bool merge_externals)
Sets the merge_externals flag.
Definition somethingToEggConverter.I:355
SomethingToEggConverter::get_frame_inc
double get_frame_inc() const
Returns the value set by a previous call to set_frame_inc().
Definition somethingToEggConverter.I:207
SomethingToEggConverter::get_default_frame_rate
static double get_default_frame_rate()
Returns the default frame rate if nothing is specified for input_frame_rate or output_frame_rate,...
Definition somethingToEggConverter.I:345
SomethingToEggConverter::set_path_replace
void set_path_replace(PathReplace *path_replace)
Replaces the PathReplace object (which specifies how to mangle paths from the source to the destinati...
Definition somethingToEggConverter.I:37
SomethingToEggConverter::get_output_frame_rate
double get_output_frame_rate() const
Returns the value set by a previous call to set_output_frame_rate().
Definition somethingToEggConverter.I:325
SomethingToEggConverter::get_end_frame
double get_end_frame() const
Returns the value set by a previous call to set_end_frame().
Definition somethingToEggConverter.I:165
SomethingToEggConverter::handle_external_reference
bool handle_external_reference(EggGroupNode *egg_parent, const Filename &ref_filename)
Handles an external reference in the source file.
Definition somethingToEggConverter.cxx:135
SomethingToEggConverter::set_neutral_frame
void set_neutral_frame(double neutral_frame)
Specifies the frame of animation to represent the neutral pose of the model.
Definition somethingToEggConverter.I:226
SomethingToEggConverter::set_output_frame_rate
void set_output_frame_rate(double output_frame_rate)
Specifies the number of frames per second that the resulting animation should be played at.
Definition somethingToEggConverter.I:306
SomethingToEggConverter::get_additional_extensions
virtual std::string get_additional_extensions() const
Returns a space-separated list of extension, in addition to the one returned by get_extension(),...
Definition somethingToEggConverter.cxx:75
SomethingToEggConverter::set_start_frame
void set_start_frame(double start_frame)
Specifies the starting frame of the animation to convert, in the units specified by set_input_frame_r...
Definition somethingToEggConverter.I:104
SomethingToEggConverter::has_input_frame_rate
bool has_input_frame_rate() const
Returns true if the frame rate has been explicitly specified via set_input_frame_rate(),...
Definition somethingToEggConverter.I:277
SomethingToEggConverter::clear_error
void clear_error()
Resets the error flag to the no-error state.
Definition somethingToEggConverter.I:19
SomethingToEggConverter::supports_convert_to_node
virtual bool supports_convert_to_node(const LoaderOptions &options) const
Returns true if this converter can directly convert the model type to internal Panda memory structure...
Definition somethingToEggConverter.cxx:96
SomethingToEggConverter::set_frame_inc
void set_frame_inc(double frame_inc)
Specifies the increment between frames to extract.
Definition somethingToEggConverter.I:187
SomethingToEggConverter::get_start_frame
double get_start_frame() const
Returns the value set by a previous call to set_start_frame().
Definition somethingToEggConverter.I:124
SomethingToEggConverter::get_character_name
const std::string & get_character_name() const
Returns the name of the character generated.
Definition somethingToEggConverter.I:93
SomethingToEggConverter::get_neutral_frame
double get_neutral_frame() const
Returns the value set by a previous call to set_neutral_frame().
Definition somethingToEggConverter.I:245
SomethingToEggConverter::set_egg_data
void set_egg_data(EggData *egg_data)
Sets the egg data that will be filled in when convert_file() is called.
Definition somethingToEggConverter.cxx:66
SomethingToEggConverter::has_frame_inc
bool has_frame_inc() const
Returns true if the frame increment has been explicitly specified via set_frame_inc(),...
Definition somethingToEggConverter.I:198
SomethingToEggConverter::has_end_frame
bool has_end_frame() const
Returns true if the ending frame has been explicitly specified via set_end_frame(),...
Definition somethingToEggConverter.I:156
SomethingToEggConverter::clear_egg_data
void clear_egg_data()
Sets the EggData to NULL and makes the converter invalid.
Definition somethingToEggConverter.I:372
config_putil.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
distanceUnit.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DistanceUnit
DistanceUnit
This enumerated type lists all the kinds of units we're likely to come across in model conversion pro...
Definition distanceUnit.h:23
filename.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandaNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pathReplace.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
somethingToEggConverter.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.