allow comma-separated tokens

This commit is contained in:
David Rose 2003-07-21 18:40:53 +00:00
parent 4bf8b08394
commit ad064f541f
3 changed files with 33 additions and 8 deletions

View File

@ -59,17 +59,17 @@ EggOptchar() {
&EggOptchar::dispatch_none, &_list_hierarchy_p);
add_option
("keep", "joint", 0,
"Keep the named joint (or slider) in the character, even if it does "
("keep", "joint[,joint...]", 0,
"Keep the named joints (or sliders) in the character, even if they do "
"not appear to be needed by the animation.",
&EggOptchar::dispatch_vector_string, NULL, &_keep_components);
&EggOptchar::dispatch_vector_string_comma, NULL, &_keep_components);
add_option
("expose", "joint", 0,
"Expose the named joint by flagging it with a DCS attribute, so "
"it can be found in the scene graph when the character is loaded, and "
"objects can be parented to it. This implies -keep.",
&EggOptchar::dispatch_vector_string, NULL, &_expose_components);
("expose", "joint[,joint...]", 0,
"Expose the named joints by flagging them with a DCS attribute, so "
"each one can be found in the scene graph when the character is loaded, "
"and objects can be parented to it. This implies -keep.",
&EggOptchar::dispatch_vector_string_comma, NULL, &_expose_components);
add_option
("keepall", "", 0,

View File

@ -1015,6 +1015,30 @@ dispatch_vector_string(const string &, const string &arg, void *var) {
return true;
}
////////////////////////////////////////////////////////////////////
// Function: ProgramBase::dispatch_vector_string_comma
// Access: Protected, Static
// Description: Similar to dispatch_vector_string, but a comma is
// allowed to separate multiple tokens in one argument,
// without having to repeat the argument for each token.
//
// The data pointer is to a vector_string variable.
////////////////////////////////////////////////////////////////////
bool ProgramBase::
dispatch_vector_string_comma(const string &, const string &arg, void *var) {
vector_string *ip = (vector_string *)var;
vector_string words;
tokenize(arg, words, ",");
vector_string::const_iterator wi;
for (wi = words.begin(); wi != words.end(); ++wi) {
(*ip).push_back(*wi);
}
return true;
}
////////////////////////////////////////////////////////////////////
// Function: ProgramBase::dispatch_filename
// Access: Protected, Static

View File

@ -98,6 +98,7 @@ protected:
static bool dispatch_color(const string &opt, const string &arg, void *var);
static bool dispatch_string(const string &opt, const string &arg, void *var);
static bool dispatch_vector_string(const string &opt, const string &arg, void *var);
static bool dispatch_vector_string_comma(const string &opt, const string &arg, void *var);
static bool dispatch_filename(const string &opt, const string &arg, void *var);
static bool dispatch_search_path(const string &opt, const string &arg, void *var);
static bool dispatch_coordinate_system(const string &opt, const string &arg, void *var);