fix T47484: Added proper error reporting for Collada Exporter
This commit is contained in:
parent
edf9e8d4dc
commit
4e95807db3
Notes:
blender-bot
2023-02-14 08:12:25 +01:00
Referenced by issue #47484, Crash on exporting collada file from menu
|
@ -178,7 +178,7 @@ static COLLADABU::NativeString make_temp_filepath(const char *name, const char *
|
|||
// COLLADA allows this through multiple <channel>s in <animation>.
|
||||
// For this to work, we need to know objects that use a certain action.
|
||||
|
||||
void DocumentExporter::exportCurrentScene(Scene *sce)
|
||||
int DocumentExporter::exportCurrentScene(Scene *sce)
|
||||
{
|
||||
PointerRNA sceneptr, unit_settings;
|
||||
PropertyRNA *system; /* unused , *scale; */
|
||||
|
@ -331,8 +331,13 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
|
|||
|
||||
// Finally move the created document into place
|
||||
int status = BLI_rename(native_filename.c_str(), this->export_settings->filepath);
|
||||
fprintf(stdout, "Collada moved buffer : %s (Status: %d)\n", this->export_settings->filepath, status);
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
fprintf(stdout, "Collada: Can't move buffer %s\n", native_filename.c_str());
|
||||
fprintf(stdout, " to its destination %s\n", this->export_settings->filepath);
|
||||
fprintf(stdout, "Reason : %s\n", errno ? strerror(errno) : "unknown error");
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void DocumentExporter::exportScenes(const char *filename)
|
||||
|
|
|
@ -39,7 +39,7 @@ class DocumentExporter
|
|||
{
|
||||
public:
|
||||
DocumentExporter(const ExportSettings *export_settings);
|
||||
void exportCurrentScene(Scene *sce);
|
||||
int exportCurrentScene(Scene *sce);
|
||||
void exportScenes(const char *filename);
|
||||
private:
|
||||
const ExportSettings *export_settings;
|
||||
|
|
|
@ -133,11 +133,11 @@ int collada_export(Scene *sce,
|
|||
}
|
||||
|
||||
DocumentExporter exporter(&export_settings);
|
||||
exporter.exportCurrentScene(sce);
|
||||
int status = exporter.exportCurrentScene(sce);
|
||||
|
||||
BLI_linklist_free(export_settings.export_set, NULL);
|
||||
|
||||
return export_count;
|
||||
return (status) ? -1:export_count;
|
||||
}
|
||||
|
||||
/* end extern C */
|
||||
|
|
|
@ -175,6 +175,10 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
|
|||
BKE_report(op->reports, RPT_WARNING, "Export file is empty");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else if (export_count < 0) {
|
||||
BKE_report(op->reports, RPT_WARNING, "Error during export (see Console)");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else {
|
||||
char buff[100];
|
||||
sprintf(buff, "Exported %d Objects", export_count);
|
||||
|
|
Loading…
Reference in New Issue