Browse Source

more config tweaks

David Rose 21 years ago
parent
commit
dc46ad57dd

+ 1 - 2
direct/src/dcparser/dcFile.cxx

@@ -91,8 +91,7 @@ clear() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 bool DCFile::
 bool DCFile::
 read_all() {
 read_all() {
-  ConfigVariableList dc_files("dc-file", 0,
-                              "The list of dc files to load.");
+  ConfigVariableList dc_files("dc-file", "The list of dc files to load.");
 
 
   if (dc_files.size() == 0) {
   if (dc_files.size() == 0) {
     cerr << "No files specified via dc-file Config.prc variable!\n";
     cerr << "No files specified via dc-file Config.prc variable!\n";

+ 1 - 0
panda/src/express/config_express.N

@@ -18,6 +18,7 @@ forcetype ConfigVariableDouble
 forcetype ConfigVariableInt
 forcetype ConfigVariableInt
 forcetype ConfigVariableList
 forcetype ConfigVariableList
 forcetype ConfigVariableManager
 forcetype ConfigVariableManager
+forcetype ConfigVariableSearchPath
 forcetype ConfigVariableString
 forcetype ConfigVariableString
 
 
 forcetype istream
 forcetype istream

+ 1 - 0
panda/src/express/config_express.h

@@ -37,6 +37,7 @@
 #include "configVariableInt.h"
 #include "configVariableInt.h"
 #include "configVariableList.h"
 #include "configVariableList.h"
 #include "configVariableManager.h"
 #include "configVariableManager.h"
+#include "configVariableSearchPath.h"
 #include "configVariableString.h"
 #include "configVariableString.h"
 
 
 ConfigureDecl(config_express, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
 ConfigureDecl(config_express, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);

+ 6 - 6
panda/src/pstatclient/pStatProperties.cxx

@@ -273,17 +273,17 @@ initialize_collector_def(PStatClient *client, PStatCollectorDef *def) {
   }
   }
 
 
   ConfigVariableBool pstats_active
   ConfigVariableBool pstats_active
-    ("pstats-active-" + config_name, true, ConfigVariable::F_dynamic);
+    ("pstats-active-" + config_name, true, "", ConfigVariable::F_dynamic);
   ConfigVariableInt pstats_sort
   ConfigVariableInt pstats_sort
-    ("pstats-sort-" + config_name, def->_sort, ConfigVariable::F_dynamic);
+    ("pstats-sort-" + config_name, def->_sort, "", ConfigVariable::F_dynamic);
   ConfigVariableDouble pstats_scale
   ConfigVariableDouble pstats_scale
-    ("pstats-scale-" + config_name, def->_suggested_scale, ConfigVariable::F_dynamic);
+    ("pstats-scale-" + config_name, def->_suggested_scale, "", ConfigVariable::F_dynamic);
   ConfigVariableString pstats_units
   ConfigVariableString pstats_units
-    ("pstats-units-" + config_name, def->_level_units, ConfigVariable::F_dynamic);
+    ("pstats-units-" + config_name, def->_level_units, "", ConfigVariable::F_dynamic);
   ConfigVariableDouble pstats_factor
   ConfigVariableDouble pstats_factor
-    ("pstats-factor-" + config_name, 1.0, ConfigVariable::F_dynamic);
+    ("pstats-factor-" + config_name, 1.0, "", ConfigVariable::F_dynamic);
   ConfigVariableDouble pstats_color
   ConfigVariableDouble pstats_color
-    ("pstats-color-" + config_name, 0.0, ConfigVariable::F_dynamic);
+    ("pstats-color-" + config_name, 0.0, "", ConfigVariable::F_dynamic);
   
   
   if (pstats_active.has_value()) {
   if (pstats_active.has_value()) {
     def->_is_active = pstats_active;
     def->_is_active = pstats_active;

+ 20 - 9
panda/src/putil/config_util.cxx

@@ -40,6 +40,17 @@ ConfigureDef(config_util);
 NotifyCategoryDef(util, "");
 NotifyCategoryDef(util, "");
 NotifyCategoryDef(bam, util_cat);
 NotifyCategoryDef(bam, util_cat);
 
 
+#ifndef CPPPARSER
+ConfigVariableSearchPath model_path
+("model-path", "The default directories to search for all models and general files loaded into Panda.");
+
+ConfigVariableSearchPath texture_path
+("texture-path", "A special directory path to search for textures only.  Textures are also searched for along the model-path, so the use of texture-path is only useful if you have special directories that only contain textures.");
+
+ConfigVariableSearchPath sound_path
+("sound-path", "The directories to search for loaded sound and music files.");
+#endif  // CPPPARSER
+
 ConfigureFn(config_util) {
 ConfigureFn(config_util) {
   BamReaderParam::init_type();
   BamReaderParam::init_type();
   Configurable::init_type();
   Configurable::init_type();
@@ -71,20 +82,20 @@ ConfigureFn(config_util) {
 //
 //
 //const bool track_memory_usage = config_util.GetBool("track-memory-usage", false);
 //const bool track_memory_usage = config_util.GetBool("track-memory-usage", false);
 
 
-DSearchPath &
+// There is no longer any need for C++ code to call these functions to
+// access the various path variables; instead, new C++ code should
+// just access the path variables directly.
+ConfigVariableSearchPath &
 get_model_path() {
 get_model_path() {
-  static DSearchPath *model_path = NULL;
-  return get_config_path("model-path", model_path);
+  return model_path;
 }
 }
 
 
-DSearchPath &
+ConfigVariableSearchPath &
 get_texture_path() {
 get_texture_path() {
-  static DSearchPath *texture_path = NULL;
-  return get_config_path("texture-path", texture_path);
+  return texture_path;
 }
 }
 
 
-DSearchPath &
+ConfigVariableSearchPath &
 get_sound_path() {
 get_sound_path() {
-  static DSearchPath *sound_path = NULL;
-  return get_config_path("sound-path", sound_path);
+  return sound_path;
 }
 }

+ 9 - 6
panda/src/putil/config_util.h

@@ -21,6 +21,7 @@
 
 
 #include "pandabase.h"
 #include "pandabase.h"
 #include "notifyCategoryProxy.h"
 #include "notifyCategoryProxy.h"
+#include "configVariableSearchPath.h"
 #include "dconfig.h"
 #include "dconfig.h"
 
 
 class DSearchPath;
 class DSearchPath;
@@ -36,14 +37,16 @@ NotifyCategoryDecl(bam, EXPCL_PANDA, EXPTP_PANDA);
 
 
 //extern EXPCL_PANDA const bool track_memory_usage;
 //extern EXPCL_PANDA const bool track_memory_usage;
 
 
-// These are functions instead of constant variables because they are
-// computed based on the concatenation of all appearances of the
-// corresponding variable in the config files.
+extern EXPCL_PANDA ConfigVariableSearchPath model_path;
+extern EXPCL_PANDA ConfigVariableSearchPath texture_path;
+extern EXPCL_PANDA ConfigVariableSearchPath sound_path;
 
 
+// The above variables are also shadowed by these functions, so that
+// they can easily be accessed in the interpreter (e.g. Python).
 BEGIN_PUBLISH
 BEGIN_PUBLISH
-EXPCL_PANDA DSearchPath &get_model_path();
-EXPCL_PANDA DSearchPath &get_texture_path();
-EXPCL_PANDA DSearchPath &get_sound_path();
+EXPCL_PANDA ConfigVariableSearchPath &get_model_path();
+EXPCL_PANDA ConfigVariableSearchPath &get_texture_path();
+EXPCL_PANDA ConfigVariableSearchPath &get_sound_path();
 END_PUBLISH
 END_PUBLISH
 
 
 #endif /* __CONFIG_UTIL_H__ */
 #endif /* __CONFIG_UTIL_H__ */

+ 1 - 1
pandatool/src/eggbase/somethingToEgg.cxx

@@ -289,7 +289,7 @@ handle_args(Args &args) {
 bool SomethingToEgg::
 bool SomethingToEgg::
 post_command_line() {
 post_command_line() {
   // Prepend the source filename to the model path.
   // Prepend the source filename to the model path.
-  DSearchPath &model_path = get_model_path();
+  ConfigVariableSearchPath &model_path = get_model_path();
   Filename directory = _input_filename.get_dirname();
   Filename directory = _input_filename.get_dirname();
   if (directory.empty()) {
   if (directory.empty()) {
     directory = ".";
     directory = ".";