Fix T96399: New 3.1 OBJ exporter is missing Path Mode setting

New OBJ exporter is missing "Path Mode" setting for exporting .mtl
files. The options that used to be available were: Auto, Absolute,
Relative, Match, Strip Path, Copy. All of them are important. The new
behavior (without any UI option to control it) curiously does not match
any of the previous setting. New behavior is like "Relative, but to the
source blender file, and not the destination export file".

Most of the previous logic was only present in Python based code
(bpy_extras.io_utils.path_reference and friends). The bulk of this
commit is porting that to C++.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14906
This commit is contained in:
2022-05-10 11:34:42 +03:00
parent 1dd1772419
commit 3bc037a7eb
13 changed files with 226 additions and 23 deletions

View File

@@ -9,6 +9,7 @@
#include "BKE_context.h"
#include "BLI_path_util.h"
#include "DEG_depsgraph.h"
#include "IO_path_util_types.h"
#ifdef __cplusplus
extern "C" {
@@ -37,6 +38,8 @@ static const int TOTAL_AXES = 3;
struct OBJExportParams {
/** Full path to the destination .OBJ file. */
char filepath[FILE_MAX];
/** Pretend that destination file folder is this, if non-empty. Used only for tests. */
char file_base_for_tests[FILE_MAX];
/** Full path to current blender file (used for comments in output). */
const char *blen_filepath;
@@ -62,6 +65,7 @@ struct OBJExportParams {
bool export_materials;
bool export_triangulated_mesh;
bool export_curves_as_nurbs;
ePathReferenceMode path_mode;
/* Grouping options. */
bool export_object_groups;