Panda3D
config_ptloader.cxx
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 config_ptloader.cxx
10  * @author drose
11  * @date 2001-04-26
12  */
13 
14 #include "config_ptloader.h"
15 
16 // This needs to be included first to work around a bug in OSX 10.4.
17 #if defined(HAVE_FCOLLADA) && defined(IS_OSX)
18 #include "daeToEggConverter.h"
19 #endif
20 
22 
23 #include "config_flt.h"
24 #include "fltToEggConverter.h"
25 #include "config_lwo.h"
26 #include "lwoToEggConverter.h"
27 #include "dxfToEggConverter.h"
28 #include "vrmlToEggConverter.h"
29 #include "objToEggConverter.h"
30 #include "eggToObjConverter.h"
31 #include "config_xfile.h"
32 #include "xFileToEggConverter.h"
33 
34 // Windows freaks out if this input is placed earlier.
35 #if defined(HAVE_FCOLLADA) && !defined(IS_OSX)
36 #include "daeToEggConverter.h"
37 #endif
38 
39 #include "dconfig.h"
40 #include "loaderFileTypeRegistry.h"
41 #include "eggData.h"
42 
43 ConfigureDef(config_ptloader);
44 NotifyCategoryDef(ptloader, "");
45 
46 ConfigureFn(config_ptloader) {
48 }
49 
51 ("ptloader-units", DU_invalid,
52  PRC_DESC("Specifies the preferred units into which models will be converted "
53  "when using libptloader to automatically convert files to Panda "
54  "at load time, via e.g. \"pview myMayaFile.mb\"."));
55 
56 ConfigVariableBool ptloader_load_node
57 ("ptloader-load-node", true,
58  PRC_DESC("Specify true to allow libptloader to invoke the more efficient "
59  "but possibly-experimental code to load model files directly into "
60  "PandaNode when possible. Specify false to force the loading to "
61  "always go through the egg library, which is more likely to be "
62  "reliable."));
63 
64 /**
65  * Initializes the library. This must be called at least once before any of
66  * the functions or classes in this library can be used. Normally it will be
67  * called by the static initializers and need not be called explicitly, but
68  * special cases exist.
69  */
70 void
72  static bool initialized = false;
73  if (initialized) {
74  return;
75  }
76  initialized = true;
77 
78  LoaderFileTypePandatool::init_type();
79 
81 
82  init_liblwo();
85 
86  init_libflt();
89 
92 
94  reg->register_type(new LoaderFileTypePandatool(vrml));
95 
96  init_libxfile();
98  reg->register_type(new LoaderFileTypePandatool(xfile));
99 
100  ObjToEggConverter *obj_egg = new ObjToEggConverter;
101  EggToObjConverter *egg_obj = new EggToObjConverter;
102  reg->register_type(new LoaderFileTypePandatool(obj_egg, egg_obj));
103 
104 // #ifdef HAVE_FCOLLADA DAEToEggConverter *dae = new DAEToEggConverter;
105 // reg->register_type(new LoaderFileTypePandatool(dae)); #endif
106 
107 #ifdef HAVE_MAYA
108  // Register the Maya converter as a deferred type. We don't compile it in
109  // directly, because it's big and bulky; we don't need to force people to
110  // load up libmayaloader (and, along with it, all of the Maya API libraries)
111  // until they actually try to load a Maya file.
112  reg->register_deferred_type("mb", "mayaloader");
113  reg->register_deferred_type("ma", "mayaloader");
114 #endif
115 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_deferred_type(const std::string &extension, const std::string &library)
Records a type associated with a particular extension to be loaded in the future.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void init_liblwo()
Initializes the library.
Definition: config_lwo.cxx:68
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void init_libflt()
Initializes the library.
Definition: config_flt.cxx:74
This is a convenience class to specialize ConfigVariable as a boolean type.
static LoaderFileTypeRegistry * get_global_ptr()
Returns a pointer to the global LoaderFileTypeRegistry object.
void init_libptloader()
Initializes the library.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class supervises the construction of an EggData structure from the data represented by the FltHe...
void register_type(LoaderFileType *type)
Defines a new LoaderFileType in the universe.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Convert an Obj file to egg data.
This class supervises the construction of an EggData structure from a VRML file.
This class specializes ConfigVariable as an enumerated type.
This class maintains the set of all known LoaderFileTypes in the universe.
This class supervises the construction of an EggData structure from the data represented by the LwoHe...
void init_libxfile()
Initializes the library.
This defines the Loader interface to files whose converters are defined within the Pandatool package ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Convert an obj file to egg data.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class supervises the construction of an EggData structure from a DXF file.