From 23afc6161c48968cffaaa695df1f1a5fd613b428 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Tue, 30 May 2023 22:21:17 +0300 Subject: [PATCH] IO: remove OBJ and PLY Python add-ons (#104503, #104504) With C++ based built-in implementations having both more features and way better performance, it's time to retire the add-ons. Implements #104503 and #104504. Pull Request: https://projects.blender.org/blender/blender/pulls/108440 --- scripts/startup/bl_ui/space_topbar.py | 4 +- source/blender/blenkernel/intern/blendfile.cc | 2 - .../blenloader/intern/versioning_userdef.c | 6 + source/blender/makesrna/intern/rna_image.c | 4 - tests/python/CMakeLists.txt | 121 ------------------ 5 files changed, 8 insertions(+), 129 deletions(-) diff --git a/scripts/startup/bl_ui/space_topbar.py b/scripts/startup/bl_ui/space_topbar.py index 53cd5072c9af..3f79315527a9 100644 --- a/scripts/startup/bl_ui/space_topbar.py +++ b/scripts/startup/bl_ui/space_topbar.py @@ -476,7 +476,7 @@ def draw(self, _context): if bpy.app.build_options.io_wavefront_obj: self.layout.operator("wm.obj_import", text="Wavefront (.obj)") if bpy.app.build_options.io_ply: - self.layout.operator("wm.ply_import", text="Stanford PLY (.ply) (experimental)") + self.layout.operator("wm.ply_import", text="Stanford PLY (.ply)") if bpy.app.build_options.io_stl: self.layout.operator("wm.stl_import", text="STL (.stl) (experimental)") @@ -506,7 +506,7 @@ def draw(self, _context): if bpy.app.build_options.io_wavefront_obj: self.layout.operator("wm.obj_export", text="Wavefront (.obj)") if bpy.app.build_options.io_ply: - self.layout.operator("wm.ply_export", text="Stanford PLY (.ply) (experimental)") + self.layout.operator("wm.ply_export", text="Stanford PLY (.ply)") class TOPBAR_MT_file_external_data(Menu): diff --git a/source/blender/blenkernel/intern/blendfile.cc b/source/blender/blenkernel/intern/blendfile.cc index 53b2baa8c2c0..0434104b3d75 100644 --- a/source/blender/blenkernel/intern/blendfile.cc +++ b/source/blender/blenkernel/intern/blendfile.cc @@ -749,12 +749,10 @@ UserDef *BKE_blendfile_userdef_from_defaults(void) const char *addons[] = { "io_anim_bvh", "io_curve_svg", - "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 7016fc537e74..0678b39a3e19 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -824,6 +824,12 @@ void blo_do_versions_userdef(UserDef *userdef) } } + if (!USER_VERSION_ATLEAST(400, 4)) { + /* obj and ply python addons were removed. */ + BKE_addon_remove_safe(&userdef->addons, "io_mesh_ply"); + BKE_addon_remove_safe(&userdef->addons, "io_scene_obj"); + } + /** * Versioning code until next subversion bump goes here. * diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 3933ab813da5..53a7792dc358 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -1286,10 +1286,6 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Image Tiles", "Tiles of the image"); rna_def_udim_tiles(brna, prop); - /* - * Image.has_data and Image.depth are temporary, - * Update import_obj.py when they are replaced (Arystan) - */ prop = RNA_def_property(srna, "has_data", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_Image_has_data_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index b2135b60e225..8f080926f5d3 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -314,127 +314,6 @@ add_blender_test( # ------------------------------------------------------------------------------ # IO TESTS -# OBJ Import tests -# disabled until updated & working -if(FALSE) -add_blender_test( - import_obj_cube - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/cube.obj'\) - --md5=39cce4bacac2d1b18fc470380279bc15 --md5_method=SCENE - --write-blend=${TEST_OUT_DIR}/io_tests/import_obj_cube.blend -) - -add_blender_test( - import_obj_nurbs_cyclic - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/nurbs_cyclic.obj'\) - --md5=ad3c307e5883224a0492378cd32691ab --md5_method=SCENE - --write-blend=${TEST_OUT_DIR}/io_tests/import_obj_nurbs_cyclic.blend -) - -add_blender_test( - import_obj_makehuman - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/makehuman.obj'\) - --md5=c9f78b185e58358daa4ecaecfa75464e --md5_method=SCENE - --write-blend=${TEST_OUT_DIR}/io_tests/import_obj_makehuman.blend -) -endif() - -# OBJ Export tests -add_blender_test( - export_obj_cube - ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/io_tests/export_obj_cube.obj',use_selection=False\) - --md5_source=${TEST_OUT_DIR}/io_tests/export_obj_cube.obj - --md5_source=${TEST_OUT_DIR}/io_tests/export_obj_cube.mtl - --md5=e80660437ad9bfe082849641c361a233 --md5_method=FILE -) - -add_blender_test( - export_obj_nurbs - ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/io_tests/export_obj_nurbs.obj',use_selection=False,use_nurbs=True\) - --md5_source=${TEST_OUT_DIR}/io_tests/export_obj_nurbs.obj - --md5_source=${TEST_OUT_DIR}/io_tests/export_obj_nurbs.mtl - --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 - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/io_tests/export_obj_all_objects.obj',use_selection=False,use_nurbs=True\) - --md5_source=${TEST_OUT_DIR}/io_tests/export_obj_all_objects.obj - --md5_source=${TEST_OUT_DIR}/io_tests/export_obj_all_objects.mtl - --md5=04b3ed97cede07a19548fc518ce9f8ca --md5_method=FILE -) -endif() - - - -# PLY Import tests -add_blender_test( - import_ply_cube - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/cube_ascii.ply'\) - --md5=527134343c27fc0ea73115b85fbfd3ac --md5_method=SCENE - --write-blend=${TEST_OUT_DIR}/io_tests/import_ply_cube.blend -) - -add_blender_test( - import_ply_bunny - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/bunny2.ply'\) - --md5=6ea5b8533400a17accf928b8fd024eaa --md5_method=SCENE - --write-blend=${TEST_OUT_DIR}/io_tests/import_ply_bunny.blend -) - -add_blender_test( - import_ply_small_holes - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/many_small_holes.ply'\) - --md5=c3093e26ecae5b6d59fbbcf2a0d0b39f --md5_method=SCENE - --write-blend=${TEST_OUT_DIR}/io_tests/import_ply_small_holes.blend -) - -# PLY Export -# disabled until updated & working -if(FALSE) -add_blender_test( - export_ply_cube_all_data - ${TEST_SRC_DIR}/io_tests/blend_geometry/cube_all_data.blend - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/io_tests/export_ply_cube_all_data.ply'\) - --md5_source=${TEST_OUT_DIR}/io_tests/export_ply_cube_all_data.ply - --md5=6adc3748ceae8298496f99d0e7e76c15 --md5_method=FILE -) - -add_blender_test( - export_ply_suzanne_all_data - ${TEST_SRC_DIR}/io_tests/blend_geometry/suzanne_all_data.blend - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/io_tests/export_ply_suzanne_all_data.ply'\) - --md5_source=${TEST_OUT_DIR}/io_tests/export_ply_suzanne_all_data.ply - --md5=68ba23f02efd6511bfd093f45f703221 --md5_method=FILE -) -endif() - -add_blender_test( - export_ply_vertices # lame, add a better one - ${TEST_SRC_DIR}/io_tests/blend_geometry/vertices.blend - --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- - --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/io_tests/export_ply_vertices.ply'\) - --md5_source=${TEST_OUT_DIR}/io_tests/export_ply_vertices.ply - --md5=ee6ce2e69c1d9a7418ff0548f6338f70 --md5_method=FILE -) - - # STL Import tests # disabled until updated & working if(FALSE)