mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-18 04:33:04 -04:00
Fix some of the maxegg bugs
This commit is contained in:
parent
be4f9efc17
commit
083827c649
@ -538,10 +538,16 @@ void MaxEggPlugin::DoExport() {
|
||||
}
|
||||
|
||||
UINT mask = MB_OK;
|
||||
if (bad > 0) mask |= MB_ICONEXCLAMATION;
|
||||
else mask |= MB_ICONINFORMATION;
|
||||
|
||||
MessageBox(hMaxEggParams, status.str().c_str(), "Panda3D Export results", mask);
|
||||
if (good == 0 && bad == 0) {
|
||||
mask |= MB_ICONEXCLAMATION;
|
||||
MessageBox(hMaxEggParams, "Nothing to export!", "Panda3D Export results", mask);
|
||||
} else {
|
||||
if (bad > 0) mask |= MB_ICONEXCLAMATION;
|
||||
else mask |= MB_ICONINFORMATION;
|
||||
|
||||
MessageBox(hMaxEggParams, status.str().c_str(), "Panda3D Export results", mask);
|
||||
}
|
||||
|
||||
int pviewed = 0;
|
||||
if (pview && good > 0) {
|
||||
|
@ -237,6 +237,8 @@ MaxEggOptions::MaxEggOptions() {
|
||||
_path_replace = new PathReplace;
|
||||
_path_replace->_path_store = PS_relative;
|
||||
_export_whole_scene = true;
|
||||
_export_all_frames = true;
|
||||
_successful = false;
|
||||
}
|
||||
|
||||
BOOL CALLBACK MaxOptionsDialogProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
@ -419,7 +421,6 @@ MaxOptionsDialog::MaxOptionsDialog() :
|
||||
_max_frame(0),
|
||||
_checked(true),
|
||||
_choosing_nodes(false),
|
||||
_successful(false),
|
||||
_prev_type(AT_model)
|
||||
{
|
||||
}
|
||||
@ -431,7 +432,7 @@ MaxOptionsDialog::~MaxOptionsDialog ()
|
||||
|
||||
void MaxOptionsDialog::UpdateUI(HWND hWnd) {
|
||||
int typeButton = IDC_MODEL;
|
||||
int anim_exp = _start_frame == INT_MIN ? IDC_EXP_ALL_FRAMES : IDC_EXP_SEL_FRAMES;
|
||||
int anim_exp = _export_all_frames ? IDC_EXP_ALL_FRAMES : IDC_EXP_SEL_FRAMES;
|
||||
int model_exp = _export_whole_scene ? IDC_EXPORT_ALL : IDC_EXPORT_SELECTED;
|
||||
|
||||
switch (_anim_type) {
|
||||
@ -553,6 +554,7 @@ bool MaxOptionsDialog::UpdateFromUI(HWND hWnd) {
|
||||
_anim_type = newAnimType;
|
||||
_double_sided = IsDlgButtonChecked(hWnd, IDC_CHECK1);
|
||||
_export_whole_scene = IsDlgButtonChecked(hWnd, IDC_EXPORT_ALL);
|
||||
_export_all_frames = IsDlgButtonChecked(hWnd, IDC_EXP_ALL_FRAMES);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -607,6 +609,7 @@ IOResult MaxOptionsDialog::Save(ISave *isave) {
|
||||
ChunkSave(isave, CHUNK_DBL_SIDED, _double_sided);
|
||||
ChunkSave(isave, CHUNK_EGG_CHECKED, _checked);
|
||||
ChunkSave(isave, CHUNK_EXPORT_FULL, _export_whole_scene);
|
||||
ChunkSave(isave, CHUNK_ALL_FRAMES, _export_all_frames);
|
||||
isave->BeginChunk(CHUNK_NODE_LIST);
|
||||
for (int i = 0; i < _node_list.size(); i++)
|
||||
ChunkSave(isave, CHUNK_NODE_HANDLE, _node_list[i]);
|
||||
@ -628,6 +631,7 @@ IOResult MaxOptionsDialog::Load(ILoad *iload) {
|
||||
case CHUNK_DBL_SIDED: _double_sided = ChunkLoadBool(iload); break;
|
||||
case CHUNK_EGG_CHECKED: _checked = ChunkLoadBool(iload); break;
|
||||
case CHUNK_EXPORT_FULL: _export_whole_scene = ChunkLoadBool(iload); break;
|
||||
case CHUNK_ALL_FRAMES: _export_all_frames = ChunkLoadBool(iload); break;
|
||||
case CHUNK_NODE_LIST:
|
||||
res = iload->OpenChunk();
|
||||
while (res == IO_OK) {
|
||||
|
@ -29,6 +29,7 @@ extern HINSTANCE hInstance;
|
||||
#define CHUNK_FILENAME 0x1106
|
||||
#define CHUNK_SHORTNAME 0x1107
|
||||
#define CHUNK_EXPORT_FULL 0x1108
|
||||
#define CHUNK_ALL_FRAMES 0x1109
|
||||
#define CHUNK_NODE_LIST 0x1200
|
||||
#define CHUNK_NODE_HANDLE 0x1201
|
||||
|
||||
@ -61,7 +62,9 @@ struct MaxEggOptions
|
||||
int _start_frame;
|
||||
int _end_frame;
|
||||
bool _double_sided;
|
||||
bool _successful;
|
||||
bool _export_whole_scene;
|
||||
bool _export_all_frames;
|
||||
char _file_name[2048];
|
||||
char _short_name[256];
|
||||
PT(PathReplace) _path_replace;
|
||||
@ -76,7 +79,6 @@ class MaxOptionsDialog : public MaxEggOptions
|
||||
int _min_frame, _max_frame;
|
||||
bool _checked;
|
||||
bool _choosing_nodes;
|
||||
bool _successful;
|
||||
MaxEggOptions::Anim_Type _prev_type;
|
||||
|
||||
MaxOptionsDialog();
|
||||
|
@ -75,11 +75,15 @@ bool MaxToEggConverter::convert(MaxEggOptions *options) {
|
||||
int start_frame = anim_range.Start()/GetTicksPerFrame();
|
||||
int end_frame = anim_range.End()/GetTicksPerFrame();
|
||||
|
||||
if (_options->_start_frame < start_frame) _options->_start_frame = start_frame;
|
||||
if (_options->_start_frame > end_frame) _options->_start_frame = end_frame;
|
||||
if (_options->_end_frame < start_frame) _options->_end_frame = start_frame;
|
||||
if (_options->_end_frame > end_frame) _options->_end_frame = end_frame;
|
||||
if (_options->_end_frame < _options->_start_frame) _options->_end_frame = _options->_start_frame;
|
||||
if (!_options->_export_all_frames) {
|
||||
if (_options->_start_frame < start_frame) _options->_start_frame = start_frame;
|
||||
if (_options->_start_frame > end_frame) _options->_start_frame = end_frame;
|
||||
if (_options->_end_frame < start_frame) _options->_end_frame = start_frame;
|
||||
if (_options->_end_frame > end_frame) _options->_end_frame = end_frame;
|
||||
if (_options->_end_frame < _options->_start_frame) _options->_end_frame = _options->_start_frame;
|
||||
start_frame = _options->_start_frame;
|
||||
end_frame = _options->_end_frame;
|
||||
}
|
||||
|
||||
int frame_inc = 1;
|
||||
int output_frame_rate = GetFrameRate();
|
||||
@ -116,7 +120,7 @@ bool MaxToEggConverter::convert(MaxEggOptions *options) {
|
||||
break;
|
||||
|
||||
case AC_both:
|
||||
|
||||
// both: Put a model and its animation into the same egg file.
|
||||
_options->_anim_type = MaxEggOptions::AT_model;
|
||||
if (!convert_char_model()) {
|
||||
all_ok = false;
|
||||
@ -137,6 +141,8 @@ bool MaxToEggConverter::convert(MaxEggOptions *options) {
|
||||
_egg_data->remove_unused_vertices(true);
|
||||
}
|
||||
|
||||
_options->_successful = all_ok;
|
||||
|
||||
if (all_ok) {
|
||||
Filename fn = Filename::from_os_specific(_options->_file_name);
|
||||
return _egg_data->write_egg(fn);
|
||||
|
Loading…
x
Reference in New Issue
Block a user