Panda3D
config_mayaegg.cxx
1 // Filename: config_mayaegg.cxx
2 // Created by: drose (15Apr02)
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 #include "config_mayaegg.h"
16 #include "mayaEggGroupUserData.h"
17 #include "mayaNodeDesc.h"
18 #include "mayaBlendDesc.h"
19 #include "configVariableBool.h"
20 
21 #include "dconfig.h"
22 
23 Configure(config_mayaegg);
24 NotifyCategoryDef(mayaegg, ":maya");
25 
26 ConfigureFn(config_mayaegg) {
27  init_libmayaegg();
28 }
29 
30 // These control the default behavior of the mayaegg converter, but
31 // not necessarily the default behavior of the maya2egg command-line
32 // tool (which has its own defaults).
33 
34 // Should we respect the Maya double-sided flag (true) or ignore it
35 // and assume everything is single-sided (false)?
36 bool maya_default_double_sided;
37 
38 // Should we apply vertex color even when a texture is applied (true)
39 // or only when no texture is applied or the vertex-color egg flag is
40 // set (false)?
41 bool maya_default_vertex_color;
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: init_libmayaegg
45 // Description: Initializes the library. This must be called at
46 // least once before any of the functions or classes in
47 // this library can be used. Normally it will be
48 // called by the static initializers and need not be
49 // called explicitly, but special cases exist.
50 ////////////////////////////////////////////////////////////////////
51 void
52 init_libmayaegg() {
53  static bool initialized = false;
54  if (initialized) {
55  return;
56  }
57  initialized = true;
58 
59  MayaEggGroupUserData::init_type();
60  MayaNodeDesc::init_type();
61  MayaBlendDesc::init_type();
62 
63  // For some reason, static init is not reliably running when this is
64  // loaded as a plug-in of a plug-in. Initialize these explicitly
65  // here.
66  maya_default_double_sided = ConfigVariableBool("maya-default-double-sided", false).get_value();
67  maya_default_vertex_color = ConfigVariableBool("maya-default-vertex-color", true).get_value();
68 
69 }
70 
This is a convenience class to specialize ConfigVariable as a boolean type.
bool get_value() const
Returns the variable's value.