mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
handle texture paths properly
This commit is contained in:
parent
12e9117087
commit
6c130c35be
@ -42,18 +42,8 @@ EggToBam() :
|
|||||||
// provide it as an option to the user.
|
// provide it as an option to the user.
|
||||||
remove_option("f");
|
remove_option("f");
|
||||||
|
|
||||||
add_option
|
add_path_replace_options();
|
||||||
("tp", "path", 0,
|
add_path_store_options();
|
||||||
"Add the indicated colon-delimited paths to the texture-path. This "
|
|
||||||
"option may also be repeated to add multiple paths.",
|
|
||||||
&EggToBam::dispatch_search_path, NULL, &get_texture_path());
|
|
||||||
|
|
||||||
add_option
|
|
||||||
("kp", "", 0,
|
|
||||||
"Keep the texture paths exactly as they are specified in the egg file, "
|
|
||||||
"as relative paths, rather than storing them as full paths or as "
|
|
||||||
"whatever is specified by the bam-texture-mode Configrc variable.",
|
|
||||||
&EggToBam::dispatch_none, &_keep_paths);
|
|
||||||
|
|
||||||
add_option
|
add_option
|
||||||
("fl", "flag", 0,
|
("fl", "flag", 0,
|
||||||
@ -106,13 +96,6 @@ EggToBam() :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void EggToBam::
|
void EggToBam::
|
||||||
run() {
|
run() {
|
||||||
if (_keep_paths) {
|
|
||||||
// If the user specified -kp, we need to set a couple of Configrc
|
|
||||||
// variables directly to achieve this.
|
|
||||||
egg_keep_texture_pathnames = true;
|
|
||||||
bam_texture_mode = BTM_fullpath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_has_egg_flatten) {
|
if (_has_egg_flatten) {
|
||||||
// If the user specified some -fl, we need to set the
|
// If the user specified some -fl, we need to set the
|
||||||
// corresponding Configrc variable.
|
// corresponding Configrc variable.
|
||||||
@ -165,6 +148,30 @@ run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggToBam::handle_args
|
||||||
|
// Access: Protected, Virtual
|
||||||
|
// Description: Does something with the additional arguments on the
|
||||||
|
// command line (after all the -options have been
|
||||||
|
// parsed). Returns true if the arguments are good,
|
||||||
|
// false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool EggToBam::
|
||||||
|
handle_args(ProgramBase::Args &args) {
|
||||||
|
// If the user specified a path store option, we need to set the
|
||||||
|
// bam-texture-mode Configrc variable directly to support this
|
||||||
|
// (otherwise the bam code will do what it wants to do anyway).
|
||||||
|
if (_got_path_store) {
|
||||||
|
bam_texture_mode = BTM_unchanged;
|
||||||
|
} else {
|
||||||
|
// Otherwise, the default path store is absolute; then the
|
||||||
|
// bam-texture-mode can do the appropriate thing to it.
|
||||||
|
_path_replace->_path_store = PS_absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EggToSomething::handle_args(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
EggToBam prog;
|
EggToBam prog;
|
||||||
|
@ -33,7 +33,10 @@ public:
|
|||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
bool _keep_paths;
|
protected:
|
||||||
|
virtual bool handle_args(Args &args);
|
||||||
|
|
||||||
|
private:
|
||||||
bool _has_egg_flatten;
|
bool _has_egg_flatten;
|
||||||
int _egg_flatten;
|
int _egg_flatten;
|
||||||
bool _ls;
|
bool _ls;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user