mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-14 07:46:39 -04:00
add -D option
This commit is contained in:
parent
a641f3d0cb
commit
b8da3c6c32
@ -233,6 +233,10 @@ help() {
|
|||||||
" After displaying the models, immediately take a screenshot and\n"
|
" After displaying the models, immediately take a screenshot and\n"
|
||||||
" exit.\n\n"
|
" exit.\n\n"
|
||||||
|
|
||||||
|
" -D\n"
|
||||||
|
" Delete the model files after loading them (presumably this option\n"
|
||||||
|
" will only be used when loading a temporary model file).\n\n"
|
||||||
|
|
||||||
" -V\n"
|
" -V\n"
|
||||||
" Report the current version of Panda, and exit.\n\n"
|
" Report the current version of Panda, and exit.\n\n"
|
||||||
|
|
||||||
@ -260,10 +264,11 @@ main(int argc, char *argv[]) {
|
|||||||
int hierarchy_match_flags = PartGroup::HMF_ok_part_extra |
|
int hierarchy_match_flags = PartGroup::HMF_ok_part_extra |
|
||||||
PartGroup::HMF_ok_anim_extra;
|
PartGroup::HMF_ok_anim_extra;
|
||||||
Filename screenshotfn;
|
Filename screenshotfn;
|
||||||
|
bool delete_models = false;
|
||||||
|
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
extern int optind;
|
extern int optind;
|
||||||
static const char *optflags = "acls:Vhi";
|
static const char *optflags = "acls:DVhi";
|
||||||
int flag = getopt(argc, argv, optflags);
|
int flag = getopt(argc, argv, optflags);
|
||||||
|
|
||||||
while (flag != EOF) {
|
while (flag != EOF) {
|
||||||
@ -290,6 +295,10 @@ main(int argc, char *argv[]) {
|
|||||||
screenshotfn = optarg;
|
screenshotfn = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'D':
|
||||||
|
delete_models = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
report_version();
|
report_version();
|
||||||
return 1;
|
return 1;
|
||||||
@ -343,6 +352,16 @@ main(int argc, char *argv[]) {
|
|||||||
window->load_default_model(framework.get_models());
|
window->load_default_model(framework.get_models());
|
||||||
} else {
|
} else {
|
||||||
window->load_models(framework.get_models(), argc, argv);
|
window->load_models(framework.get_models(), argc, argv);
|
||||||
|
|
||||||
|
if (delete_models) {
|
||||||
|
for (int i = 1; i < argc && argv[i] != (char *)NULL; i++) {
|
||||||
|
Filename model = Filename::from_os_specific(argv[i]);
|
||||||
|
if (model.exists()) {
|
||||||
|
nout << "Deleting " << model << "\n";
|
||||||
|
model.unlink();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
window->loop_animations(hierarchy_match_flags);
|
window->loop_animations(hierarchy_match_flags);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user