From ff9dc1986e6c9a54fd0bb228e8813551e6baa042 Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Thu, 3 Feb 2022 07:56:55 -0500 Subject: Split Python OBJ importer and exporter, enabling only the importer. This is from patch D13988. It removes the "- New" from the menu of the new obj exporter, changes the default addon to just io_import_obj, and does the right versioning thing. Also disables the python tests for the old python exporter. --- release/scripts/startup/bl_ui/space_topbar.py | 2 +- source/blender/blenkernel/intern/blendfile.c | 2 +- source/blender/blenloader/intern/versioning_userdef.c | 7 +++++++ tests/python/CMakeLists.txt | 5 +++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 99abc60db6f..513c1c2ae2e 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -481,7 +481,7 @@ class TOPBAR_MT_file_export(Menu): bl_owner_use_filter = False def draw(self, _context): - self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj) - New") + self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj)") if bpy.app.build_options.collada: self.layout.operator("wm.collada_export", text="Collada (Default) (.dae)") diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index 819f786a2d0..86c2593e2e6 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -621,12 +621,12 @@ UserDef *BKE_blendfile_userdef_from_defaults(void) const char *addons[] = { "io_anim_bvh", "io_curve_svg", + "io_import_obj", "io_mesh_ply", "io_mesh_stl", "io_mesh_uv_layout", "io_scene_fbx", "io_scene_gltf2", - "io_scene_obj", "io_scene_x3d", "cycles", "pose_library", diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index 064d7977c68..520059649e6 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -973,6 +973,13 @@ void blo_do_versions_userdef(UserDef *userdef) */ { /* Keep this block, even when empty. */ + if (!USER_VERSION_ATLEAST(301, 7)) { + /* io_scene_obj directory is gone, split into io_import_obj and io_export_obj, + * with io_import_obj enabled by default and io_export_obj replaced by the C++ version. + */ + BKE_addon_remove_safe(&userdef->addons, "io_scene_obj"); + BKE_addon_ensure(&userdef->addons, "io_import_obj"); + } } LISTBASE_FOREACH (bTheme *, btheme, &userdef->themes) { diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index d6575436bd6..63dcdc0f925 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -324,7 +324,10 @@ add_blender_test( ) endif() +if(FALSE) # OBJ Export tests +# Disabled because new C++ Obj exporter has C++ tests. + add_blender_test( export_obj_cube ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend @@ -345,8 +348,6 @@ add_blender_test( --md5=a733ae4fa4a591ea9b0912da3af042de --md5_method=FILE ) -# disabled until updated & working -if(FALSE) add_blender_test( export_obj_all_objects ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend -- cgit v1.2.3