diff --git a/source/blender/editors/io/io_alembic.cc b/source/blender/editors/io/io_alembic.cc index 7ac45fcdd1a..18a194195eb 100644 --- a/source/blender/editors/io/io_alembic.cc +++ b/source/blender/editors/io/io_alembic.cc @@ -119,7 +119,6 @@ static wmOperatorStatus wm_alembic_export_exec(bContext *C, wmOperator *op) params.apply_subdiv = RNA_boolean_get(op->ptr, "apply_subdiv"); params.curves_as_mesh = RNA_boolean_get(op->ptr, "curves_as_mesh"); params.flatten_hierarchy = RNA_boolean_get(op->ptr, "flatten"); - params.visible_objects_only = RNA_boolean_get(op->ptr, "visible_objects_only"); params.face_sets = RNA_boolean_get(op->ptr, "face_sets"); params.use_subdiv_schema = RNA_boolean_get(op->ptr, "subdiv_schema"); params.export_hair = RNA_boolean_get(op->ptr, "export_hair"); @@ -164,7 +163,6 @@ static void ui_alembic_export_settings(const bContext *C, uiLayout *layout, Poin if (CTX_wm_space_file(C)) { uiLayout *sub = &col->column(true, IFACE_("Include")); sub->prop(ptr, "selected", UI_ITEM_NONE, IFACE_("Selection Only"), ICON_NONE); - sub->prop(ptr, "visible_objects_only", UI_ITEM_NONE, IFACE_("Visible Only"), ICON_NONE); } } @@ -356,12 +354,6 @@ void WM_OT_alembic_export(wmOperatorType *ot) RNA_def_boolean( ot->srna, "selected", false, "Selected Objects Only", "Export only selected objects"); - RNA_def_boolean(ot->srna, - "visible_objects_only", - false, - "Visible Objects Only", - "Export only objects that are visible"); - RNA_def_boolean(ot->srna, "flatten", false, diff --git a/source/blender/editors/io/io_usd.cc b/source/blender/editors/io/io_usd.cc index 9caac133547..8fcefbe7a0f 100644 --- a/source/blender/editors/io/io_usd.cc +++ b/source/blender/editors/io/io_usd.cc @@ -306,7 +306,6 @@ static wmOperatorStatus wm_usd_export_exec(bContext *C, wmOperator *op) USDExportParams params; params.export_animation = RNA_boolean_get(op->ptr, "export_animation"); params.selected_objects_only = RNA_boolean_get(op->ptr, "selected_objects_only"); - params.visible_objects_only = RNA_boolean_get(op->ptr, "visible_objects_only"); params.export_meshes = RNA_boolean_get(op->ptr, "export_meshes"); params.export_lights = RNA_boolean_get(op->ptr, "export_lights"); @@ -385,7 +384,6 @@ static void wm_usd_export_draw(bContext *C, wmOperator *op) uiLayout *sub = &col->column(true, IFACE_("Include")); if (CTX_wm_space_file(C)) { sub->prop(ptr, "selected_objects_only", UI_ITEM_NONE, std::nullopt, ICON_NONE); - sub->prop(ptr, "visible_objects_only", UI_ITEM_NONE, std::nullopt, ICON_NONE); } sub->prop(ptr, "export_animation", UI_ITEM_NONE, std::nullopt, ICON_NONE); @@ -570,13 +568,6 @@ void WM_OT_usd_export(wmOperatorType *ot) "Only export selected objects. Unselected parents of selected objects are " "exported as empty transform"); - RNA_def_boolean(ot->srna, - "visible_objects_only", - true, - "Visible Only", - "Only export visible objects. Invisible parents of exported objects are " - "exported as empty transforms"); - prop = RNA_def_string(ot->srna, "collection", nullptr, MAX_ID_NAME - 2, "Collection", nullptr); RNA_def_property_flag(prop, PROP_HIDDEN); diff --git a/source/blender/io/alembic/ABC_alembic.h b/source/blender/io/alembic/ABC_alembic.h index 49c61c1f598..e5f33bf0a79 100644 --- a/source/blender/io/alembic/ABC_alembic.h +++ b/source/blender/io/alembic/ABC_alembic.h @@ -42,7 +42,6 @@ struct AlembicExportParams { bool apply_subdiv; bool curves_as_mesh; bool flatten_hierarchy; - bool visible_objects_only; bool face_sets; bool use_subdiv_schema; bool packuv; diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc index ae02dc5b0da..2c57639f829 100644 --- a/source/blender/io/alembic/exporter/abc_export_capi.cc +++ b/source/blender/io/alembic/exporter/abc_export_capi.cc @@ -63,11 +63,8 @@ static bool build_depsgraph(ExportJobData *job) DEG_graph_build_from_collection(job->depsgraph, collection); } - else if (job->params.visible_objects_only) { - DEG_graph_build_from_view_layer(job->depsgraph); - } else { - DEG_graph_build_for_all_objects(job->depsgraph); + DEG_graph_build_from_view_layer(job->depsgraph); } return true; diff --git a/source/blender/io/alembic/exporter/abc_writer_mesh.cc b/source/blender/io/alembic/exporter/abc_writer_mesh.cc index 8b90f9dbd67..f26d346d571 100644 --- a/source/blender/io/alembic/exporter/abc_writer_mesh.cc +++ b/source/blender/io/alembic/exporter/abc_writer_mesh.cc @@ -126,10 +126,7 @@ bool ABCGenericMeshWriter::export_as_subdivision_surface(Object *ob_eval) const bool ABCGenericMeshWriter::is_supported(const HierarchyContext *context) const { - if (args_.export_params->visible_objects_only) { - return context->is_object_visible(args_.export_params->evaluation_mode); - } - return true; + return context->is_object_visible(args_.export_params->evaluation_mode); } void ABCGenericMeshWriter::do_write(HierarchyContext &context) diff --git a/source/blender/io/usd/intern/usd_capi_export.cc b/source/blender/io/usd/intern/usd_capi_export.cc index d0bd06c0584..eab38f87a75 100644 --- a/source/blender/io/usd/intern/usd_capi_export.cc +++ b/source/blender/io/usd/intern/usd_capi_export.cc @@ -803,11 +803,8 @@ bool USD_export(const bContext *C, DEG_graph_build_from_collection(job->depsgraph, collection); } - else if (job->params.visible_objects_only) { - DEG_graph_build_from_view_layer(job->depsgraph); - } else { - DEG_graph_build_for_all_objects(job->depsgraph); + DEG_graph_build_from_view_layer(job->depsgraph); } bool export_ok = false; diff --git a/source/blender/io/usd/intern/usd_writer_mesh.cc b/source/blender/io/usd/intern/usd_writer_mesh.cc index 47c3cf41e42..640067d6a48 100644 --- a/source/blender/io/usd/intern/usd_writer_mesh.cc +++ b/source/blender/io/usd/intern/usd_writer_mesh.cc @@ -50,10 +50,7 @@ USDGenericMeshWriter::USDGenericMeshWriter(const USDExporterContext &ctx) : USDA bool USDGenericMeshWriter::is_supported(const HierarchyContext *context) const { - if (usd_export_context_.export_params.visible_objects_only) { - return context->is_object_visible(usd_export_context_.export_params.evaluation_mode); - } - return true; + return context->is_object_visible(usd_export_context_.export_params.evaluation_mode); } /* Get the last subdiv modifier, regardless of enable/disable status */ diff --git a/source/blender/io/usd/tests/usd_export_test.cc b/source/blender/io/usd/tests/usd_export_test.cc index 51580c4f5f1..270f13e0c26 100644 --- a/source/blender/io/usd/tests/usd_export_test.cc +++ b/source/blender/io/usd/tests/usd_export_test.cc @@ -210,7 +210,6 @@ TEST_F(UsdExportTest, usd_export_rain_mesh) params.export_materials = false; params.export_normals = true; params.export_uvmaps = false; - params.visible_objects_only = true; bool result = USD_export(context, output_filename.c_str(), ¶ms, false, nullptr); ASSERT_TRUE(result) << "Writing to " << output_filename << " failed!"; diff --git a/source/blender/io/usd/usd.hh b/source/blender/io/usd/usd.hh index 5ca6bb40b45..fe1f752c62c 100644 --- a/source/blender/io/usd/usd.hh +++ b/source/blender/io/usd/usd.hh @@ -127,7 +127,6 @@ enum eUSDSceneUnits { struct USDExportParams { bool export_animation = false; bool selected_objects_only = false; - bool visible_objects_only = true; bool export_meshes = true; bool export_lights = true; diff --git a/tests/python/alembic_export_tests.py b/tests/python/alembic_export_tests.py index 947f7dafc98..e615d0c3c2a 100644 --- a/tests/python/alembic_export_tests.py +++ b/tests/python/alembic_export_tests.py @@ -180,7 +180,7 @@ class HierarchicalAndFlatExportTest(AbstractAlembicTest): def test_hierarchical_export(self, tempdir: pathlib.Path): abc = tempdir / 'cubes_hierarchical.abc' script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \ - "visible_objects_only=True, flatten=False)" % abc.as_posix() + "flatten=False)" % abc.as_posix() self.run_blender('cubes-hierarchy.blend', script) # Now check the resulting Alembic file. @@ -198,7 +198,7 @@ class HierarchicalAndFlatExportTest(AbstractAlembicTest): def test_flat_export(self, tempdir: pathlib.Path): abc = tempdir / 'cubes_flat.abc' script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \ - "visible_objects_only=True, flatten=True)" % abc.as_posix() + "flatten=True)" % abc.as_posix() self.run_blender('cubes-hierarchy.blend', script) # Now check the resulting Alembic file. @@ -219,7 +219,7 @@ class DupliGroupExportTest(AbstractAlembicTest): def test_hierarchical_export(self, tempdir: pathlib.Path): abc = tempdir / 'dupligroup_hierarchical.abc' script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \ - "visible_objects_only=True, flatten=False)" % abc.as_posix() + "flatten=False)" % abc.as_posix() self.run_blender('dupligroup-scene.blend', script) # Now check the resulting Alembic file. @@ -237,7 +237,7 @@ class DupliGroupExportTest(AbstractAlembicTest): def test_flat_export(self, tempdir: pathlib.Path): abc = tempdir / 'dupligroup_hierarchical.abc' script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \ - "visible_objects_only=True, flatten=True)" % abc.as_posix() + "flatten=True)" % abc.as_posix() self.run_blender('dupligroup-scene.blend', script) # Now check the resulting Alembic file. @@ -315,7 +315,7 @@ class CurveExportTest(AbstractAlembicTest): def test_export_single_curve(self, tempdir: pathlib.Path): abc = tempdir / 'single-curve.abc' script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \ - "visible_objects_only=True, flatten=False)" % abc.as_posix() + "flatten=False)" % abc.as_posix() self.run_blender('single-curve.blend', script) # Now check the resulting Alembic file. @@ -336,7 +336,7 @@ class HairParticlesExportTest(AbstractAlembicTest): def _do_test(self, tempdir: pathlib.Path, export_hair: bool, export_particles: bool) -> pathlib.Path: abc = tempdir / 'hair-particles.abc' script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \ - "visible_objects_only=True, flatten=False, " \ + "flatten=False, " \ "export_hair=%r, export_particles=%r, as_background_job=False)" \ % (abc.as_posix(), export_hair, export_particles) self.run_blender('hair-particles.blend', script) @@ -402,7 +402,7 @@ class UVMapExportTest(AbstractAlembicTest): basename = 'T77021-multiple-uvmaps-animated-mesh' abc = tempdir / f'{basename}.abc' script = f"import bpy; bpy.ops.wm.alembic_export(filepath='{abc.as_posix()}', start=1, end=1, " \ - f"visible_objects_only=True, flatten=False)" + f"flatten=False)" self.run_blender(f'{basename}.blend', script) self.maxDiff = 1000 @@ -451,7 +451,7 @@ class LongNamesExportTest(AbstractAlembicTest): def test_export_long_names(self, tempdir: pathlib.Path): abc = tempdir / 'long-names.abc' script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \ - "visible_objects_only=False, flatten=False)" % abc.as_posix() + "flatten=False)" % abc.as_posix() self.run_blender('long-names.blend', script) name_parts = [ @@ -535,41 +535,6 @@ class LongNamesExportTest(AbstractAlembicTest): self.assertIn('.faceCounts', abcprop) -class InvisibleObjectExportTest(AbstractAlembicTest): - """Export an object which is invisible. - - This test only tests a small subset of the functionality that is required to - export invisible objects. It just tests that the visibility property is - written, and that it has the correct initial value. This is a limitation - caused by these tests relying on ``abcls``. - """ - - @with_tempdir - def test_hierarchical_export(self, tempdir: pathlib.Path): - abc = tempdir / 'visibility.abc' - script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=2, " \ - "visible_objects_only=False)" % abc.as_posix() - self.run_blender('visibility.blend', script) - - def test(cube_name: str, expect_visible: bool): - returncode, output = self.abcls('-va', f'{abc}/{cube_name}') - if returncode: - self.fail(f"abcls failed: {output}") - output = output.strip() - self.assertEqual(f'Cube .xform visible {int(expect_visible)}', output) - - # This cube is always visible. - test('VisibleCube', True) - - # This cube is never visible, and thus will not be pulled into the - # depsgraph by the standard builder, only by the all-objects builder. - test('InvisibleCube', False) - - # This cube has animated visibility, and thus will be pulled into the - # depsgraph by the standard builder as well as the all-objects builder. - test('InvisibleAnimatedCube', False) - - class CustomPropertiesExportTest(AbstractAlembicTest): """Test export of custom properties."""