more config tweaks

This commit is contained in:
David Rose 2004-10-25 21:06:39 +00:00
parent 9d234b8e0f
commit dc46ad57dd
7 changed files with 39 additions and 24 deletions

View File

@ -91,8 +91,7 @@ clear() {
////////////////////////////////////////////////////////////////////
bool DCFile::
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) {
cerr << "No files specified via dc-file Config.prc variable!\n";

View File

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

View File

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

View File

@ -273,17 +273,17 @@ initialize_collector_def(PStatClient *client, PStatCollectorDef *def) {
}
ConfigVariableBool pstats_active
("pstats-active-" + config_name, true, ConfigVariable::F_dynamic);
("pstats-active-" + config_name, true, "", ConfigVariable::F_dynamic);
ConfigVariableInt pstats_sort
("pstats-sort-" + config_name, def->_sort, ConfigVariable::F_dynamic);
("pstats-sort-" + config_name, def->_sort, "", ConfigVariable::F_dynamic);
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
("pstats-units-" + config_name, def->_level_units, ConfigVariable::F_dynamic);
("pstats-units-" + config_name, def->_level_units, "", ConfigVariable::F_dynamic);
ConfigVariableDouble pstats_factor
("pstats-factor-" + config_name, 1.0, ConfigVariable::F_dynamic);
("pstats-factor-" + config_name, 1.0, "", ConfigVariable::F_dynamic);
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()) {
def->_is_active = pstats_active;

View File

@ -40,6 +40,17 @@ ConfigureDef(config_util);
NotifyCategoryDef(util, "");
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) {
BamReaderParam::init_type();
Configurable::init_type();
@ -71,20 +82,20 @@ ConfigureFn(config_util) {
//
//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() {
static DSearchPath *model_path = NULL;
return get_config_path("model-path", model_path);
return model_path;
}
DSearchPath &
ConfigVariableSearchPath &
get_texture_path() {
static DSearchPath *texture_path = NULL;
return get_config_path("texture-path", texture_path);
return texture_path;
}
DSearchPath &
ConfigVariableSearchPath &
get_sound_path() {
static DSearchPath *sound_path = NULL;
return get_config_path("sound-path", sound_path);
return sound_path;
}

View File

@ -21,6 +21,7 @@
#include "pandabase.h"
#include "notifyCategoryProxy.h"
#include "configVariableSearchPath.h"
#include "dconfig.h"
class DSearchPath;
@ -36,14 +37,16 @@ NotifyCategoryDecl(bam, EXPCL_PANDA, EXPTP_PANDA);
//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
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
#endif /* __CONFIG_UTIL_H__ */

View File

@ -289,7 +289,7 @@ handle_args(Args &args) {
bool SomethingToEgg::
post_command_line() {
// 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();
if (directory.empty()) {
directory = ".";