[Bf-blender-cvs] [fd71798e2f2] sybren-usd: USD: reduce hair colours to one colour per hair strand

Sybren A. Stüvel noreply at git.blender.org
Tue Jul 23 11:17:15 CEST 2019


Commit: fd71798e2f21b76621f16147d0c4c7754fe93ee9
Author: Sybren A. Stüvel
Date:   Tue Jul 23 11:17:01 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rBfd71798e2f21b76621f16147d0c4c7754fe93ee9

USD: reduce hair colours to one colour per hair strand

The colours weren't written correctly, so this just reduces the amount of
data that's written. This'll probably be used until we decide to evaluate
the hair material.

===================================================================

M	source/blender/usd/intern/usd_writer_hair.cc

===================================================================

diff --git a/source/blender/usd/intern/usd_writer_hair.cc b/source/blender/usd/intern/usd_writer_hair.cc
index 37bc6a00c9b..9b53659ed6a 100644
--- a/source/blender/usd/intern/usd_writer_hair.cc
+++ b/source/blender/usd/intern/usd_writer_hair.cc
@@ -36,9 +36,7 @@ void USDHairWriter::do_write(HierarchyContext &context)
 
   pxr::VtArray<pxr::GfVec3f> points;
   pxr::VtIntArray curve_point_counts;
-  pxr::VtArray<pxr::GfVec3f> colors;
   curve_point_counts.reserve(psys->totpart);
-  colors.reserve(psys->totpart);
 
   ParticleCacheKey *strand;
   for (int strand_index = 0; strand_index < psys->totpart; ++strand_index) {
@@ -46,7 +44,6 @@ void USDHairWriter::do_write(HierarchyContext &context)
 
     int point_count = strand->segments + 1;
     curve_point_counts.push_back(point_count);
-    colors.push_back(pxr::GfVec3f(strand->col));
 
     for (int point_index = 0; point_index < point_count; ++point_index, ++strand) {
       points.push_back(pxr::GfVec3f(strand->co));
@@ -55,11 +52,11 @@ void USDHairWriter::do_write(HierarchyContext &context)
 
   curves.CreatePointsAttr().Set(points, timecode);
   curves.CreateCurveVertexCountsAttr().Set(curve_point_counts, timecode);
-  curves.CreateDisplayColorAttr(pxr::VtValue(colors));
 
   if (psys->totpart > 0) {
-    // pxr::VtArray<pxr::GfVec3f> colors;
-    // colors.push_back(pxr::GfVec3f(cache[0]->col));
+    pxr::VtArray<pxr::GfVec3f> colors;
+    colors.push_back(pxr::GfVec3f(cache[0]->col));
+    curves.CreateDisplayColorAttr().Set(pxr::VtValue(colors), timecode);
   }
 }



More information about the Bf-blender-cvs mailing list