From 8f5a4a2453887e37b51bb131176b0efbd0e9b42e Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 6 Jul 2021 10:20:14 +0200 Subject: Alembic export: evaluation mode option This option will determine visibility on either render or the viewport visibility. Same for modifer settings. So it will either evaluate the depsgrah with DAG_EVAL_RENDER or DAG_EVAL_VIEWPORT. This not only makes it more flexible, it is also a lot clearer which visibility / modfier setting is taken into account (up until now, this was always considered to be DAG_EVAL_RENDER) This option was always present in the USD exporter, this just brings Alembic in line with that. ref. T89594 Maniphest Tasks: T89594 Differential Revision: https://developer.blender.org/D11820 --- source/blender/io/alembic/ABC_alembic.h | 3 +++ source/blender/io/alembic/exporter/abc_export_capi.cc | 3 +-- source/blender/io/alembic/exporter/abc_writer_abstract.cc | 2 +- source/blender/io/alembic/exporter/abc_writer_mesh.cc | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'source/blender/io') diff --git a/source/blender/io/alembic/ABC_alembic.h b/source/blender/io/alembic/ABC_alembic.h index 958122ae9e7..3d1391ac2a4 100644 --- a/source/blender/io/alembic/ABC_alembic.h +++ b/source/blender/io/alembic/ABC_alembic.h @@ -19,6 +19,8 @@ * \ingroup balembic */ +#include "DEG_depsgraph.h" + #ifdef __cplusplus extern "C" { #endif @@ -62,6 +64,7 @@ struct AlembicExportParams { bool export_particles; bool export_custom_properties; bool use_instancing; + enum eEvaluationMode evaluation_mode; /* See MOD_TRIANGULATE_NGON_xxx and MOD_TRIANGULATE_QUAD_xxx * in DNA_modifier_types.h */ diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc index 5b8998a0b1a..efe04d64cc3 100644 --- a/source/blender/io/alembic/exporter/abc_export_capi.cc +++ b/source/blender/io/alembic/exporter/abc_export_capi.cc @@ -213,8 +213,7 @@ bool ABC_export(Scene *scene, job->export_ok = false; BLI_strncpy(job->filename, filepath, sizeof(job->filename)); - job->depsgraph = DEG_graph_new( - job->bmain, scene, view_layer, DAG_EVAL_RENDER /* TODO(Sybren): params->evaluation_mode */); + job->depsgraph = DEG_graph_new(job->bmain, scene, view_layer, params->evaluation_mode); job->params = *params; bool export_ok = false; diff --git a/source/blender/io/alembic/exporter/abc_writer_abstract.cc b/source/blender/io/alembic/exporter/abc_writer_abstract.cc index 27b5c2fa2a4..910e04f3bf5 100644 --- a/source/blender/io/alembic/exporter/abc_writer_abstract.cc +++ b/source/blender/io/alembic/exporter/abc_writer_abstract.cc @@ -137,7 +137,7 @@ void ABCAbstractWriter::update_bounding_box(Object *object) void ABCAbstractWriter::write_visibility(const HierarchyContext &context) { - const bool is_visible = context.is_object_visible(DAG_EVAL_RENDER); + const bool is_visible = context.is_object_visible(args_.export_params->evaluation_mode); Alembic::Abc::OObject abc_object = get_alembic_object(); if (!abc_visibility_.valid()) { diff --git a/source/blender/io/alembic/exporter/abc_writer_mesh.cc b/source/blender/io/alembic/exporter/abc_writer_mesh.cc index fd7db005dd2..7ffb61e1d1b 100644 --- a/source/blender/io/alembic/exporter/abc_writer_mesh.cc +++ b/source/blender/io/alembic/exporter/abc_writer_mesh.cc @@ -162,7 +162,7 @@ ModifierData *ABCGenericMeshWriter::get_liquid_sim_modifier(Scene *scene, Object bool ABCGenericMeshWriter::is_supported(const HierarchyContext *context) const { if (args_.export_params->visible_objects_only) { - return context->is_object_visible(DAG_EVAL_RENDER); + return context->is_object_visible(args_.export_params->evaluation_mode); } return true; } -- cgit v1.2.3