From 61008f86b7b7b3c438cdafd7c7642663e832d196 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 17 Oct 2003 22:18:51 +0000 Subject: [PATCH] work around static init failure on windows --- pandatool/src/mayaegg/config_mayaegg.cxx | 11 +++++++++-- pandatool/src/mayaegg/config_mayaegg.h | 4 ++-- pandatool/src/mayaegg/mayaToEggConverter.cxx | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pandatool/src/mayaegg/config_mayaegg.cxx b/pandatool/src/mayaegg/config_mayaegg.cxx index 468d2734a2..95d9620c5e 100644 --- a/pandatool/src/mayaegg/config_mayaegg.cxx +++ b/pandatool/src/mayaegg/config_mayaegg.cxx @@ -35,12 +35,12 @@ ConfigureFn(config_mayaegg) { // Should we respect the Maya double-sided flag (true) or ignore it // and assume everything is single-sided (false)? -const bool maya_default_double_sided = config_mayaegg.GetBool("maya-default-double-sided", false); +bool maya_default_double_sided; // Should we apply vertex color even when a texture is applied (true) // or only when no texture is applied or the vertex-color egg flag is // set (false)? -const bool maya_default_vertex_color = config_mayaegg.GetBool("maya-default-vertex-color", true); +bool maya_default_vertex_color; //////////////////////////////////////////////////////////////////// // Function: init_libmayaegg @@ -60,5 +60,12 @@ init_libmayaegg() { MayaEggGroupUserData::init_type(); MayaNodeDesc::init_type(); + + // For some reason, static init is not reliably running when this is + // loaded as a plug-in of a plug-in. Initialize these explicitly + // here. + maya_default_double_sided = config_mayaegg.GetBool("maya-default-double-sided", false); + maya_default_vertex_color = config_mayaegg.GetBool("maya-default-vertex-color", true); + } diff --git a/pandatool/src/mayaegg/config_mayaegg.h b/pandatool/src/mayaegg/config_mayaegg.h index 5e7e9cb236..3a28947520 100644 --- a/pandatool/src/mayaegg/config_mayaegg.h +++ b/pandatool/src/mayaegg/config_mayaegg.h @@ -24,8 +24,8 @@ NotifyCategoryDeclNoExport(mayaegg); -extern const bool maya_default_double_sided; -extern const bool maya_default_vertex_color; +extern bool maya_default_double_sided; +extern bool maya_default_vertex_color; extern void init_libmayaegg(); diff --git a/pandatool/src/mayaegg/mayaToEggConverter.cxx b/pandatool/src/mayaegg/mayaToEggConverter.cxx index d7de76f0db..ff12beb1a5 100644 --- a/pandatool/src/mayaegg/mayaToEggConverter.cxx +++ b/pandatool/src/mayaegg/mayaToEggConverter.cxx @@ -84,6 +84,9 @@ MayaToEggConverter:: MayaToEggConverter(const string &program_name) : _program_name(program_name) { + // Make sure the library is properly initialized. + init_libmayaegg(); + _from_selection = false; _polygon_output = false; _polygon_tolerance = 0.01;