IO: Remove visible_objects_only property for USD and Alembic export
To help reduce confusion, remove this property as we believe it has little to no actual utility. Visibility, instead, remains controlled with the `evaluation_mode` option. Ref #134012 See PR for discussion and description of what effect this option used to have. Pull Request: https://projects.blender.org/blender/blender/pulls/144600
This commit is contained in:
committed by
Jesse Yurkovich
parent
c08d42aebf
commit
7c75651b3b
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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!";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user