More fixes to max exporter

This commit is contained in:
rdb 2008-10-28 17:50:58 +00:00
parent 1243548892
commit 80f14fc6ac
2 changed files with 35 additions and 13 deletions

View File

@ -526,13 +526,26 @@ void MaxEggPlugin::DoExport() {
for (int i = 0; i < numEggs; i++) {
if (eggList[i]->_checked) {
MaxToEggConverter converter;
if (converter.convert((MaxEggOptions*)eggList[i])) {
good += 1;
status << "Successfully created " << eggList[i]->_short_name << ".egg\n";
// If "auto overwrite" was not checked and the file exists,
// ask if the user wishes to overwrite the file
bool do_write = true;
if (!autoOverwrite && Filename::from_os_specific(eggList[i]->_file_name).exists()) {
char msg[1024];
sprintf(msg, "Overwrite file \"%s.egg\"?", eggList[i]->_short_name);
do_write = (MessageBox(hMaxEggParams, msg, "Panda3D Exporter", MB_YESNO | MB_ICONQUESTION) == IDYES);
}
if (do_write) {
MaxToEggConverter converter;
if (converter.convert((MaxEggOptions*)eggList[i])) {
good += 1;
status << "Successfully created " << eggList[i]->_short_name << ".egg\n";
} else {
bad += 1;
status << "Could not export " << eggList[i]->_short_name << ".egg\n";
}
} else {
bad += 1;
status << "Could not export " << eggList[i]->_short_name << ".egg\n";
status << "Skipped file " << eggList[i]->_short_name << ".egg\n";
}
}
}
@ -544,8 +557,7 @@ void MaxEggPlugin::DoExport() {
MessageBox(hMaxEggParams, "Nothing to export!", "Panda3D Export results", mask);
} else {
if (bad > 0) mask |= MB_ICONEXCLAMATION;
else mask |= MB_ICONINFORMATION;
else mask |= MB_ICONINFORMATION;
MessageBox(hMaxEggParams, status.str().c_str(), "Panda3D Export results", mask);
}
@ -554,16 +566,21 @@ void MaxEggPlugin::DoExport() {
for (i = 0; i < numEggs; i++) {
if (eggList[i]->_checked && eggList[i]->_successful) {
if (eggList[i]->_anim_type != MaxEggOptions::AT_chan) {
char buf[1024];
PROCESS_INFORMATION pi;
STARTUPINFO si;
memset(&si,0,sizeof(si));
si.cb= sizeof(si);
sprintf(buf, "pview %s.egg?", eggList[i]->_short_name);
char cmdLine[2048];
sprintf(cmdLine, "pview \"%s\"", eggList[i]->_file_name);
// If we have just one model and animation file, pview them both
if (numEggs == 2 && eggList[i]->_anim_type == MaxEggOptions::AT_model &&
eggList[1-i]->_checked && eggList[1-i]->_successful &&
eggList[1-i]->_anim_type == MaxEggOptions::AT_chan) {
sprintf(cmdLine, "pview \"%s\" \"%s\"", eggList[i]->_file_name, eggList[1-i]->_file_name);
} else {
sprintf(cmdLine, "pview \"%s\"", eggList[i]->_file_name);
}
CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, CREATE_NEW_CONSOLE,
NULL, NULL, &si, &pi);
pviewed += 1;

View File

@ -95,7 +95,7 @@ bool MaxToEggConverter::convert(MaxEggOptions *options) {
} else {
all_ok = _tree.build_complete_hierarchy(_options->_max_interface->GetRootNode(), &_options->_node_list.front(), _options->_node_list.size());
}
if (all_ok) {
switch (_options->_anim_type) {
case MaxEggOptions::AT_pose:
@ -119,7 +119,7 @@ bool MaxToEggConverter::convert(MaxEggOptions *options) {
output_frame_rate);
break;
case AC_both:
case MaxEggOptions::AT_both:
// both: Put a model and its animation into the same egg file.
_options->_anim_type = MaxEggOptions::AT_model;
if (!convert_char_model()) {
@ -130,12 +130,17 @@ bool MaxToEggConverter::convert(MaxEggOptions *options) {
output_frame_rate)) {
all_ok = false;
}
// Set the type back to AT_both
_options->_anim_type = MaxEggOptions::AT_both;
break;
default:
all_ok = false;
};
reparent_decals(_egg_data);
}
if (all_ok) {
_egg_data->recompute_tangent_binormal_auto();
_egg_data->remove_unused_vertices(true);