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
This commit is contained in:
@@ -63,10 +63,26 @@
|
|||||||
# include "WM_api.h"
|
# include "WM_api.h"
|
||||||
# include "WM_types.h"
|
# include "WM_types.h"
|
||||||
|
|
||||||
|
# include "DEG_depsgraph.h"
|
||||||
|
|
||||||
# include "io_alembic.h"
|
# include "io_alembic.h"
|
||||||
|
|
||||||
# include "ABC_alembic.h"
|
# include "ABC_alembic.h"
|
||||||
|
|
||||||
|
const EnumPropertyItem rna_enum_abc_export_evaluation_mode_items[] = {
|
||||||
|
{DAG_EVAL_RENDER,
|
||||||
|
"RENDER",
|
||||||
|
0,
|
||||||
|
"Render",
|
||||||
|
"Use Render settings for object visibility, modifier settings, etc"},
|
||||||
|
{DAG_EVAL_VIEWPORT,
|
||||||
|
"VIEWPORT",
|
||||||
|
0,
|
||||||
|
"Viewport",
|
||||||
|
"Use Viewport settings for object visibility, modifier settings, etc"},
|
||||||
|
{0, NULL, 0, NULL, NULL},
|
||||||
|
};
|
||||||
|
|
||||||
static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||||
{
|
{
|
||||||
if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
|
if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
|
||||||
@@ -136,6 +152,7 @@ static int wm_alembic_export_exec(bContext *C, wmOperator *op)
|
|||||||
.triangulate = RNA_boolean_get(op->ptr, "triangulate"),
|
.triangulate = RNA_boolean_get(op->ptr, "triangulate"),
|
||||||
.quad_method = RNA_enum_get(op->ptr, "quad_method"),
|
.quad_method = RNA_enum_get(op->ptr, "quad_method"),
|
||||||
.ngon_method = RNA_enum_get(op->ptr, "ngon_method"),
|
.ngon_method = RNA_enum_get(op->ptr, "ngon_method"),
|
||||||
|
.evaluation_mode = RNA_enum_get(op->ptr, "evaluation_mode"),
|
||||||
|
|
||||||
.global_scale = RNA_float_get(op->ptr, "global_scale"),
|
.global_scale = RNA_float_get(op->ptr, "global_scale"),
|
||||||
};
|
};
|
||||||
@@ -195,6 +212,9 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
|
|||||||
uiItemR(sub, imfptr, "selected", 0, IFACE_("Selected Objects"), ICON_NONE);
|
uiItemR(sub, imfptr, "selected", 0, IFACE_("Selected Objects"), ICON_NONE);
|
||||||
uiItemR(sub, imfptr, "visible_objects_only", 0, IFACE_("Visible Objects"), ICON_NONE);
|
uiItemR(sub, imfptr, "visible_objects_only", 0, IFACE_("Visible Objects"), ICON_NONE);
|
||||||
|
|
||||||
|
col = uiLayoutColumn(box, true);
|
||||||
|
uiItemR(col, imfptr, "evaluation_mode", 0, NULL, ICON_NONE);
|
||||||
|
|
||||||
/* Object Data */
|
/* Object Data */
|
||||||
box = uiLayoutBox(layout);
|
box = uiLayoutBox(layout);
|
||||||
row = uiLayoutRow(box, false);
|
row = uiLayoutRow(box, false);
|
||||||
@@ -460,6 +480,14 @@ void WM_OT_alembic_export(wmOperatorType *ot)
|
|||||||
"This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
|
"This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
|
||||||
"to run as a background job");
|
"to run as a background job");
|
||||||
|
|
||||||
|
RNA_def_enum(ot->srna,
|
||||||
|
"evaluation_mode",
|
||||||
|
rna_enum_abc_export_evaluation_mode_items,
|
||||||
|
DAG_EVAL_RENDER,
|
||||||
|
"Use Settings for",
|
||||||
|
"Determines visibility of objects, modifier settings, and other areas where there "
|
||||||
|
"are different settings for viewport and rendering");
|
||||||
|
|
||||||
/* This dummy prop is used to check whether we need to init the start and
|
/* This dummy prop is used to check whether we need to init the start and
|
||||||
* end frame values to that of the scene's, otherwise they are reset at
|
* end frame values to that of the scene's, otherwise they are reset at
|
||||||
* every change, draw update. */
|
* every change, draw update. */
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
* \ingroup balembic
|
* \ingroup balembic
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "DEG_depsgraph.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@@ -62,6 +64,7 @@ struct AlembicExportParams {
|
|||||||
bool export_particles;
|
bool export_particles;
|
||||||
bool export_custom_properties;
|
bool export_custom_properties;
|
||||||
bool use_instancing;
|
bool use_instancing;
|
||||||
|
enum eEvaluationMode evaluation_mode;
|
||||||
|
|
||||||
/* See MOD_TRIANGULATE_NGON_xxx and MOD_TRIANGULATE_QUAD_xxx
|
/* See MOD_TRIANGULATE_NGON_xxx and MOD_TRIANGULATE_QUAD_xxx
|
||||||
* in DNA_modifier_types.h */
|
* in DNA_modifier_types.h */
|
||||||
|
|||||||
@@ -213,8 +213,7 @@ bool ABC_export(Scene *scene,
|
|||||||
job->export_ok = false;
|
job->export_ok = false;
|
||||||
BLI_strncpy(job->filename, filepath, sizeof(job->filename));
|
BLI_strncpy(job->filename, filepath, sizeof(job->filename));
|
||||||
|
|
||||||
job->depsgraph = DEG_graph_new(
|
job->depsgraph = DEG_graph_new(job->bmain, scene, view_layer, params->evaluation_mode);
|
||||||
job->bmain, scene, view_layer, DAG_EVAL_RENDER /* TODO(Sybren): params->evaluation_mode */);
|
|
||||||
job->params = *params;
|
job->params = *params;
|
||||||
|
|
||||||
bool export_ok = false;
|
bool export_ok = false;
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ void ABCAbstractWriter::update_bounding_box(Object *object)
|
|||||||
|
|
||||||
void ABCAbstractWriter::write_visibility(const HierarchyContext &context)
|
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();
|
Alembic::Abc::OObject abc_object = get_alembic_object();
|
||||||
|
|
||||||
if (!abc_visibility_.valid()) {
|
if (!abc_visibility_.valid()) {
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ ModifierData *ABCGenericMeshWriter::get_liquid_sim_modifier(Scene *scene, Object
|
|||||||
bool ABCGenericMeshWriter::is_supported(const HierarchyContext *context) const
|
bool ABCGenericMeshWriter::is_supported(const HierarchyContext *context) const
|
||||||
{
|
{
|
||||||
if (args_.export_params->visible_objects_only) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user