From fd3086833afea8b414506de6bb9ab6a5beaa7faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 14 Aug 2020 16:45:35 +0200 Subject: Cleanup: IO, reduce code duplication in USD and Alembic exporters Move the object visibility check from Alembic/USD-specific code into the `io/common` module. No functional changes. --- source/blender/io/usd/intern/usd_writer_mesh.cc | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'source/blender/io/usd') diff --git a/source/blender/io/usd/intern/usd_writer_mesh.cc b/source/blender/io/usd/intern/usd_writer_mesh.cc index bd2c549e729..b27c68a41f6 100644 --- a/source/blender/io/usd/intern/usd_writer_mesh.cc +++ b/source/blender/io/usd/intern/usd_writer_mesh.cc @@ -52,27 +52,7 @@ USDGenericMeshWriter::USDGenericMeshWriter(const USDExporterContext &ctx) : USDA bool USDGenericMeshWriter::is_supported(const HierarchyContext *context) const { - Object *object = context->object; - bool is_dupli = context->duplicator != nullptr; - int base_flag; - - if (is_dupli) { - /* Construct the object's base flags from its dupli-parent, just like is done in - * deg_objects_dupli_iterator_next(). Without this, the visibility check below will fail. Doing - * this here, instead of a more suitable location in AbstractHierarchyIterator, prevents - * copying the Object for every dupli. */ - base_flag = object->base_flag; - object->base_flag = context->duplicator->base_flag | BASE_FROM_DUPLI; - } - - int visibility = BKE_object_visibility(object, - usd_export_context_.export_params.evaluation_mode); - - if (is_dupli) { - object->base_flag = base_flag; - } - - return (visibility & OB_VISIBLE_SELF) != 0; + return context->is_object_visible(usd_export_context_.export_params.evaluation_mode); } void USDGenericMeshWriter::do_write(HierarchyContext &context) -- cgit v1.2.3