[Bf-blender-cvs] [33954860c88] sybren-usd: USD: replaced throwing temp C++ exception with BLI_assert() call
Sybren A. Stüvel
noreply at git.blender.org
Thu Jul 25 15:41:58 CEST 2019
Commit: 33954860c88f75597f41ad98afd717e6ec36b156
Author: Sybren A. Stüvel
Date: Thu Jul 25 14:46:13 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB33954860c88f75597f41ad98afd717e6ec36b156
USD: replaced throwing temp C++ exception with BLI_assert() call
The exception was for making things easier to debug for me. Now the issues
are gracefully ignored when things go bad, which is better for users.
No functional changes.
===================================================================
M source/blender/usd/intern/usd_writer_mesh.cc
===================================================================
diff --git a/source/blender/usd/intern/usd_writer_mesh.cc b/source/blender/usd/intern/usd_writer_mesh.cc
index 3bcad763018..c50910ce8f9 100644
--- a/source/blender/usd/intern/usd_writer_mesh.cc
+++ b/source/blender/usd/intern/usd_writer_mesh.cc
@@ -6,6 +6,8 @@
#include <pxr/usd/usdShade/materialBindingAPI.h>
extern "C" {
+#include "BLI_assert.h"
+
#include "BKE_anim.h"
#include "BKE_library.h"
#include "BKE_material.h"
@@ -123,25 +125,27 @@ void USDGenericMeshWriter::write_mesh(HierarchyContext &context, Mesh *mesh)
// This object data is instanced, just reference the original instead of writing a copy.
if (context.export_path == context.original_export_path) {
printf("USD ref error: export path is reference path: %s\n", context.export_path.c_str());
- throw "JEEKL";
+ BLI_assert(!"USD reference error");
+ return;
}
pxr::SdfPath ref_path(context.original_export_path);
- if (usd_mesh.GetPrim().GetReferences().AddInternalReference(ref_path)) {
- /* The material path will be of the form </_materials/{material name}>, which is outside the
- subtree pointed to by ref_path. As a result, the referenced data is not allowed to point out
- of its own subtree. It does work when we override the material with exactly the same path,
- though.*/
- assign_materials(context, usd_mesh, usd_mesh_data.face_groups);
+ if (!usd_mesh.GetPrim().GetReferences().AddInternalReference(ref_path)) {
+ /* See this URL for a description fo why referencing may fail"
+ * https://graphics.pixar.com/usd/docs/api/class_usd_references.html#Usd_Failing_References
+ */
+ printf("USD Export warning: unable to add reference from %s to %s, not instancing object\n",
+ context.export_path.c_str(),
+ context.original_export_path.c_str());
return;
}
- /* See
- https://graphics.pixar.com/usd/docs/api/class_usd_references.html#Usd_Failing_References
- * for a description fo why referencing may fail. */
- printf("USD Export warning: unable to add reference from %s to %s, not instancing object\n",
- context.export_path.c_str(),
- context.original_export_path.c_str());
- throw "JE MOEDER";
+ /* The material path will be of the form </_materials/{material name}>, which is outside the
+ subtree pointed to by ref_path. As a result, the referenced data is not allowed to point out
+ of its own subtree. It does work when we override the material with exactly the same path,
+ though.*/
+ assign_materials(context, usd_mesh, usd_mesh_data.face_groups);
+ return;
}
+
usd_mesh.CreatePointsAttr().Set(usd_mesh_data.points, timecode);
usd_mesh.CreateFaceVertexCountsAttr().Set(usd_mesh_data.face_vertex_counts, timecode);
usd_mesh.CreateFaceVertexIndicesAttr().Set(usd_mesh_data.face_indices, timecode);
More information about the Bf-blender-cvs
mailing list