From 108f3284a7311068e3bb7742f813b4612c70dd03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 14 Aug 2020 16:48:39 +0200 Subject: USD: Allow exporting of invisible objects The fix for T75936 made it possible to export invisible objects to Alembic. This commit applies the same approach to the USD exporter. The USD and Alembic code is slightly different in terms of where in the exported file the visibility attribute is stored. In USD the visibility is used to prune the scene graph, and thus there are only two options: "hidden" and "inherited". Setting the visiblity of a node in the scene graph to "hidden" immediately hides all its children. To allow hidden parents with visible children, the visibility is stored on the object data (so the geometry/camera/lamp/etc) instead. --- source/blender/editors/io/io_usd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/editors/io') diff --git a/source/blender/editors/io/io_usd.c b/source/blender/editors/io/io_usd.c index 096dc44c758..45ea52bdebc 100644 --- a/source/blender/editors/io/io_usd.c +++ b/source/blender/editors/io/io_usd.c @@ -113,6 +113,7 @@ static int wm_usd_export_exec(bContext *C, wmOperator *op) MEM_SAFE_FREE(op->customdata); const bool selected_objects_only = RNA_boolean_get(op->ptr, "selected_objects_only"); + const bool visible_objects_only = RNA_boolean_get(op->ptr, "visible_objects_only"); const bool export_animation = RNA_boolean_get(op->ptr, "export_animation"); const bool export_hair = RNA_boolean_get(op->ptr, "export_hair"); const bool export_uvmaps = RNA_boolean_get(op->ptr, "export_uvmaps"); @@ -128,6 +129,7 @@ static int wm_usd_export_exec(bContext *C, wmOperator *op) export_normals, export_materials, selected_objects_only, + visible_objects_only, use_instancing, evaluation_mode, }; @@ -149,6 +151,7 @@ static void wm_usd_export_draw(bContext *UNUSED(C), wmOperator *op) col = uiLayoutColumn(box, true); uiItemR(col, ptr, "selected_objects_only", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "visible_objects_only", 0, NULL, ICON_NONE); col = uiLayoutColumn(box, true); uiItemR(col, ptr, "export_animation", 0, NULL, ICON_NONE); @@ -191,6 +194,13 @@ void WM_OT_usd_export(struct wmOperatorType *ot) "Only selected objects are exported. Unselected parents of selected objects are " "exported as empty transform"); + RNA_def_boolean(ot->srna, + "visible_objects_only", + true, + "Visible Only", + "Only visible objects are exported. Invisible parents of exported objects are " + "exported as empty transform"); + RNA_def_boolean(ot->srna, "export_animation", false, -- cgit v1.2.3