[Bf-blender-cvs] [b3a659dd167] sybren-usd: USD: Avoid writing invisible particle emitter meshes
Sybren A. Stüvel
noreply at git.blender.org
Fri Jul 12 15:21:15 CEST 2019
Commit: b3a659dd167daee904b2b4f28bc78add49392988
Author: Sybren A. Stüvel
Date: Fri Jul 12 15:20:02 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rBb3a659dd167daee904b2b4f28bc78add49392988
USD: Avoid writing invisible particle emitter meshes
===================================================================
M source/blender/usd/intern/usd_writer_mesh.cc
M source/blender/usd/intern/usd_writer_mesh.h
===================================================================
diff --git a/source/blender/usd/intern/usd_writer_mesh.cc b/source/blender/usd/intern/usd_writer_mesh.cc
index d8807157f53..18992beab1b 100644
--- a/source/blender/usd/intern/usd_writer_mesh.cc
+++ b/source/blender/usd/intern/usd_writer_mesh.cc
@@ -10,14 +10,29 @@ extern "C" {
#include "BKE_library.h"
#include "BKE_material.h"
+#include "DEG_depsgraph.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
+#include "DNA_particle_types.h"
}
USDGenericMeshWriter::USDGenericMeshWriter(const USDExporterContext &ctx) : USDAbstractWriter(ctx)
{
}
+bool USDGenericMeshWriter::is_supported(const Object *object) const
+{
+ // Reject meshes that have a particle system that should have its emitter hidden.
+ if (object->particlesystem.first != NULL) {
+ char check_flag = export_params.evaluation_mode == DAG_EVAL_RENDER ? OB_DUPLI_FLAG_RENDER :
+ OB_DUPLI_FLAG_VIEWPORT;
+ return object->duplicator_visibility_flag & check_flag;
+ }
+
+ return true;
+}
+
void USDGenericMeshWriter::do_write(HierarchyContext &context)
{
Object *object_eval = context.object;
diff --git a/source/blender/usd/intern/usd_writer_mesh.h b/source/blender/usd/intern/usd_writer_mesh.h
index 3fef22dd2b5..aea49fe9523 100644
--- a/source/blender/usd/intern/usd_writer_mesh.h
+++ b/source/blender/usd/intern/usd_writer_mesh.h
@@ -13,6 +13,7 @@ class USDGenericMeshWriter : public USDAbstractWriter {
USDGenericMeshWriter(const USDExporterContext &ctx);
protected:
+ virtual bool is_supported(const Object *object) const override;
virtual void do_write(HierarchyContext &context) override;
virtual Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) = 0;
More information about the Bf-blender-cvs
mailing list