[Bf-blender-cvs] [176f8947cd5] sybren-usd: USD: Write mesh single/doublesidedness
Sybren A. Stüvel
noreply at git.blender.org
Fri Jul 12 14:16:29 CEST 2019
Commit: 176f8947cd50f6a472dce67451b201bf74ae6dc1
Author: Sybren A. Stüvel
Date: Fri Jul 12 12:22:15 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB176f8947cd50f6a472dce67451b201bf74ae6dc1
USD: Write mesh single/doublesidedness
USD seems to support neither per-material nor per-face-group
double-sidedness, so we just use the flag from the first non-empty
material slot. If there is no material we default to double-sidedness.
===================================================================
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 7ce3102d864..14b5761ead9 100644
--- a/source/blender/usd/intern/usd_writer_mesh.cc
+++ b/source/blender/usd/intern/usd_writer_mesh.cc
@@ -192,10 +192,21 @@ void USDGenericMeshWriter::assign_materials(
pxr::UsdShadeMaterial usd_material = ensure_usd_material(material);
usd_material.Bind(usd_mesh.GetPrim());
+
+ /* USD seems to support neither per-material nor per-face-group double-sidedness, so we just
+ * use the flag from the first non-empty material slot. */
+ usd_mesh.CreateDoubleSidedAttr(
+ pxr::VtValue((material->blend_flag & MA_BL_CULL_BACKFACE) == 0));
+
mesh_material_bound = true;
break;
}
+ if (!mesh_material_bound) {
+ /* Blender defaults to double-sided, but USD to single-sided. */
+ usd_mesh.CreateDoubleSidedAttr(pxr::VtValue(true));
+ }
+
if (!mesh_material_bound || usd_face_groups.size() < 2) {
/* Either all material slots were empty or there is only one material in use. As geometry
* subsets are only written when actually used to assign a material, and the mesh already has
More information about the Bf-blender-cvs
mailing list