Przeglądaj źródła

eliminate MayaParameters

David Rose 24 lat temu
rodzic
commit
73974017fa

+ 0 - 1
pandatool/src/mayaegg/Sources.pp

@@ -17,7 +17,6 @@
   #define SOURCES \
     config_mayaegg.cxx config_mayaegg.h \
     mayaApi.cxx mayaApi.h \
-    mayaParameters.cxx mayaParameters.h \
     mayaShader.cxx mayaShader.h \
     mayaShaders.cxx mayaShaders.h \
     mayaToEggConverter.cxx mayaToEggConverter.h \

+ 0 - 23
pandatool/src/mayaegg/mayaParameters.cxx

@@ -1,23 +0,0 @@
-// Filename: mayaParameters.cxx
-// Created by:  drose (16Feb00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "mayaParameters.h"
-
-bool MayaParameters::polygon_output = false;
-double MayaParameters::polygon_tolerance = 0.01;
-bool MayaParameters::ignore_transforms = false;

+ 0 - 38
pandatool/src/mayaegg/mayaParameters.h

@@ -1,38 +0,0 @@
-// Filename: mayaParameters.h
-// Created by:  drose (16Feb00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef MAYAPARAMETERS_H
-#define MAYAPARAMETERS_H
-
-#include "pandatoolbase.h"
-
-////////////////////////////////////////////////////////////////////
-//       Class : MayaParameters
-// Description : This class is just used as a scope to hold the global
-//               parameters for the Maya converter.
-////////////////////////////////////////////////////////////////////
-class MayaParameters {
-public:
-  static bool polygon_output;
-  static double polygon_tolerance;
-  static bool ignore_transforms;
-};
-
-
-#endif
-

+ 6 - 4
pandatool/src/mayaegg/mayaToEggConverter.cxx

@@ -18,7 +18,6 @@
 
 #include "mayaToEggConverter.h"
 #include "mayaShader.h"
-#include "mayaParameters.h"
 #include "maya_funcs.h"
 #include "config_mayaegg.h"
 
@@ -70,6 +69,9 @@ MayaToEggConverter(const string &program_name) :
   _shaders(this)
 {
   _maya = MayaApi::open_api(program_name);
+  _polygon_output = false;
+  _polygon_tolerance = 0.01;
+  _ignore_transforms = false;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -328,7 +330,7 @@ process_node(const MDagPath &dag_path, EggData &data) {
 ////////////////////////////////////////////////////////////////////
 void MayaToEggConverter::
 get_transform(const MDagPath &dag_path, EggGroup *egg_group) {
-  if (MayaParameters::ignore_transforms) {
+  if (_ignore_transforms) {
     return;
   }
 
@@ -417,13 +419,13 @@ make_nurbs_surface(const MDagPath &dag_path, MFnNurbsSurface &surface,
 
   MayaShader *shader = _shaders.find_shader_for_node(surface.object());
 
-  if (MayaParameters::polygon_output) {
+  if (_polygon_output) {
     // If we want polygon output only, tesselate the NURBS and output
     // that.
     MTesselationParams params;
     params.setFormatType(MTesselationParams::kStandardFitFormat);
     params.setOutputType(MTesselationParams::kQuads);
-    params.setStdFractionalTolerance(MayaParameters::polygon_tolerance);
+    params.setStdFractionalTolerance(_polygon_tolerance);
 
     // We'll create the tesselation as a sibling of the NURBS surface.
     // That way we inherit all of the transformations.

+ 4 - 0
pandatool/src/mayaegg/mayaToEggConverter.h

@@ -94,6 +94,10 @@ public:
   MayaShaders _shaders;
   EggTextureCollection _textures;
   PT(MayaApi) _maya;
+
+  bool _polygon_output;
+  double _polygon_tolerance;
+  bool _ignore_transforms;
 };
 
 

+ 8 - 4
pandatool/src/mayaprogs/mayaToEgg.cxx

@@ -17,7 +17,6 @@
 ////////////////////////////////////////////////////////////////////
 
 #include "mayaToEgg.h"
-#include "mayaParameters.h"
 #include "mayaToEggConverter.h"
 #include "config_mayaegg.h"
 
@@ -45,14 +44,14 @@ MayaToEgg() :
      "Generate polygon output only.  Tesselate all NURBS surfaces to "
      "polygons via the built-in Maya tesselator.  The tesselation will "
      "be based on the tolerance factor given by -ptol.",
-     &MayaToEgg::dispatch_none, &MayaParameters::polygon_output);
+     &MayaToEgg::dispatch_none, &_polygon_output);
 
   add_option
     ("ptol", "tolerance", 0,
      "Specify the fit tolerance for Maya polygon tesselation.  The smaller "
      "the number, the more polygons will be generated.  The default is "
      "0.01.",
-     &MayaToEgg::dispatch_double, NULL, &MayaParameters::polygon_tolerance);
+     &MayaToEgg::dispatch_double, NULL, &_polygon_tolerance);
 
   add_option
     ("notrans", "", 0,
@@ -61,7 +60,7 @@ MayaToEgg() :
      "one big transform space.  Using this option doesn't change the "
      "position of objects in the scene, just the number of explicit "
      "transforms appearing in the resulting egg file.",
-     &MayaToEgg::dispatch_none, &MayaParameters::ignore_transforms);
+     &MayaToEgg::dispatch_none, &_ignore_transforms);
 
   add_option
     ("v", "", 0,
@@ -93,6 +92,11 @@ run() {
     exit(1);
   }
 
+  // Copy in the command-line parameters.
+  converter._polygon_output = _polygon_output;
+  converter._polygon_tolerance = _polygon_tolerance;
+  converter._ignore_transforms = _ignore_transforms;
+
   // Set the coordinate system to match Maya's.
   if (!_got_coordinate_system) {
     _coordinate_system = converter._maya->get_coordinate_system();

+ 3 - 0
pandatool/src/mayaprogs/mayaToEgg.h

@@ -33,6 +33,9 @@ public:
   void run();
 
   int _verbose;
+  bool _polygon_output;
+  double _polygon_tolerance;
+  bool _ignore_transforms;
 };
 
 #endif