From 73974017fac78eaa8f65768a2bfc46654055b3db Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 15 Apr 2002 22:31:28 +0000 Subject: [PATCH] eliminate MayaParameters --- pandatool/src/mayaegg/Sources.pp | 1 - pandatool/src/mayaegg/mayaParameters.cxx | 23 ------------ pandatool/src/mayaegg/mayaParameters.h | 38 -------------------- pandatool/src/mayaegg/mayaToEggConverter.cxx | 10 +++--- pandatool/src/mayaegg/mayaToEggConverter.h | 4 +++ pandatool/src/mayaprogs/mayaToEgg.cxx | 12 ++++--- pandatool/src/mayaprogs/mayaToEgg.h | 3 ++ 7 files changed, 21 insertions(+), 70 deletions(-) delete mode 100644 pandatool/src/mayaegg/mayaParameters.cxx delete mode 100644 pandatool/src/mayaegg/mayaParameters.h diff --git a/pandatool/src/mayaegg/Sources.pp b/pandatool/src/mayaegg/Sources.pp index 8c6d02a5e7..a99f4163c0 100644 --- a/pandatool/src/mayaegg/Sources.pp +++ b/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 \ diff --git a/pandatool/src/mayaegg/mayaParameters.cxx b/pandatool/src/mayaegg/mayaParameters.cxx deleted file mode 100644 index 108cd74c7e..0000000000 --- a/pandatool/src/mayaegg/mayaParameters.cxx +++ /dev/null @@ -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 -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#include "mayaParameters.h" - -bool MayaParameters::polygon_output = false; -double MayaParameters::polygon_tolerance = 0.01; -bool MayaParameters::ignore_transforms = false; diff --git a/pandatool/src/mayaegg/mayaParameters.h b/pandatool/src/mayaegg/mayaParameters.h deleted file mode 100644 index 1fdbce235d..0000000000 --- a/pandatool/src/mayaegg/mayaParameters.h +++ /dev/null @@ -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 -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#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 - diff --git a/pandatool/src/mayaegg/mayaToEggConverter.cxx b/pandatool/src/mayaegg/mayaToEggConverter.cxx index 10c7084b90..990a379d9b 100644 --- a/pandatool/src/mayaegg/mayaToEggConverter.cxx +++ b/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. diff --git a/pandatool/src/mayaegg/mayaToEggConverter.h b/pandatool/src/mayaegg/mayaToEggConverter.h index 81221ce009..527bc81732 100644 --- a/pandatool/src/mayaegg/mayaToEggConverter.h +++ b/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; }; diff --git a/pandatool/src/mayaprogs/mayaToEgg.cxx b/pandatool/src/mayaprogs/mayaToEgg.cxx index 112545cc83..dab2e9bb4a 100644 --- a/pandatool/src/mayaprogs/mayaToEgg.cxx +++ b/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(); diff --git a/pandatool/src/mayaprogs/mayaToEgg.h b/pandatool/src/mayaprogs/mayaToEgg.h index 1474377db2..ca47b7f90b 100644 --- a/pandatool/src/mayaprogs/mayaToEgg.h +++ b/pandatool/src/mayaprogs/mayaToEgg.h @@ -33,6 +33,9 @@ public: void run(); int _verbose; + bool _polygon_output; + double _polygon_tolerance; + bool _ignore_transforms; }; #endif