[Bf-blender-cvs] [a0fa3de] master: Fix T43624: Freestyle uses wrong colour on second Line Set with textured lines in Cycles.
Tamito Kajiyama
noreply at git.blender.org
Mon Mar 9 04:55:20 CET 2015
Commit: a0fa3de267f8c09ed6c7a72716d9dab49dfd4c2c
Author: Tamito Kajiyama
Date: Sat Mar 7 10:35:54 2015 +0900
Branches: master
https://developer.blender.org/rBa0fa3de267f8c09ed6c7a72716d9dab49dfd4c2c
Fix T43624: Freestyle uses wrong colour on second Line Set with textured lines in Cycles.
This is a regression introduced by rBd8b00a3bf5c1 (Freestyle: memory
consumption optimization in stroke rendering).
The issue was caused by uninitialized MPoly::mat_nr values. Before the
stroke rendering optimization, individual Freestyle strokes were
represented by distinct mesh objects, and thus MPoly::mat_nr was left
unset (i.e., was always zero). Now that the stroke rendering optimization
has been done and mesh objects may represent multiple strokes of different
materials, MPoly::mat_nr had to be properly set to the material index that
refers to the material of the poly face.
===================================================================
M source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
===================================================================
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
index 70de246..f304e8a 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
@@ -730,7 +730,6 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
it != itend; ++it)
{
mesh->mat[material_index] = (*it)->getMaterial();
- material_index++;
vector<Strip*>& strips = (*it)->getStrips();
for (vector<Strip*>::const_iterator s = strips.begin(), send = strips.end(); s != send; ++s) {
@@ -811,6 +810,7 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
// poly
polys->loopstart = loop_index;
polys->totloop = 3;
+ polys->mat_nr = material_index;
++polys;
// Even and odd loops connect triangles vertices differently
@@ -909,6 +909,7 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
}
} // loop over strip vertices
} // loop over strips
+ material_index++;
} // loop over strokes
test_object_materials(freestyle_bmain, (ID *)mesh);
More information about the Bf-blender-cvs
mailing list