Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-08-14 17:48:39 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-08-17 18:56:05 +0300
commit108f3284a7311068e3bb7742f813b4612c70dd03 (patch)
tree914ac8b6bf08e4c2f340ed4fe16198a93f6f4ee1 /source/blender/io/usd/intern/usd_writer_mesh.cc
parent271361e31f9e4bdd222b78833a42a5b268da3e89 (diff)
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.
Diffstat (limited to 'source/blender/io/usd/intern/usd_writer_mesh.cc')
-rw-r--r--source/blender/io/usd/intern/usd_writer_mesh.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/io/usd/intern/usd_writer_mesh.cc b/source/blender/io/usd/intern/usd_writer_mesh.cc
index b27c68a41f6..75d1ca605d4 100644
--- a/source/blender/io/usd/intern/usd_writer_mesh.cc
+++ b/source/blender/io/usd/intern/usd_writer_mesh.cc
@@ -42,6 +42,8 @@
#include "DNA_object_fluidsim_types.h"
#include "DNA_particle_types.h"
+#include <iostream>
+
namespace blender {
namespace io {
namespace usd {
@@ -52,7 +54,10 @@ USDGenericMeshWriter::USDGenericMeshWriter(const USDExporterContext &ctx) : USDA
bool USDGenericMeshWriter::is_supported(const HierarchyContext *context) const
{
- return context->is_object_visible(usd_export_context_.export_params.evaluation_mode);
+ if (usd_export_context_.export_params.visible_objects_only) {
+ return context->is_object_visible(usd_export_context_.export_params.evaluation_mode);
+ }
+ return true;
}
void USDGenericMeshWriter::do_write(HierarchyContext &context)
@@ -149,6 +154,8 @@ void USDGenericMeshWriter::write_mesh(HierarchyContext &context, Mesh *mesh)
const pxr::SdfPath &usd_path = usd_export_context_.usd_path;
pxr::UsdGeomMesh usd_mesh = pxr::UsdGeomMesh::Define(stage, usd_path);
+ write_visibility(context, timecode, usd_mesh);
+
USDMeshData usd_mesh_data;
get_geometry_data(mesh, usd_mesh_data);