[Bf-blender-cvs] [3c09077e3b8] master: Paint Dirt: some small fixes
Sybren A. Stüvel
noreply at git.blender.org
Fri Feb 9 13:22:57 CET 2018
Commit: 3c09077e3b88a33d103875a7e0fd0f7ca0736046
Author: Sybren A. Stüvel
Date: Thu Feb 8 12:33:46 2018 +0100
Branches: master
https://developer.blender.org/rB3c09077e3b88a33d103875a7e0fd0f7ca0736046
Paint Dirt: some small fixes
- normalize → average the vector: the vector isn't normalized here, because
it doesn't necessarily becomes unit length. Instead, the sum is converted
to an average vector.
- angle is the acos()…: the dot product between the vertex normal and the
average direction of the connected vertices is computed, and not the
opposite.
- The initial `con` list was discarded immediately and replaced by a new
list.
- File didn't end with a newline.
===================================================================
M release/scripts/startup/bl_operators/vertexpaint_dirt.py
===================================================================
diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py
index c006e8e6e92..7042f42744c 100644
--- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py
+++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py
@@ -32,8 +32,6 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
vert_tone = array.array("f", [0.0]) * len(me.vertices)
# create lookup table for each vertex's connected vertices (via edges)
- con = []
-
con = [[] for i in range(len(me.vertices))]
# add connected verts
@@ -50,7 +48,7 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
for c in con[i]:
vec += (me.vertices[c].co - co).normalized()
- # normalize the vector by dividing by the number of connected verts
+ # average the vector by dividing by the number of connected verts
tot_con = len(con[i])
if tot_con == 0:
@@ -58,7 +56,9 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
vec /= tot_con
- # angle is the acos() of the dot product between vert and connected verts normals
+ # angle is the acos() of the dot product between normal and connected verts.
+ # > 90 degrees: convex
+ # < 90 degrees: concave
ang = acos(no.dot(vec))
# enforce min/max
@@ -186,4 +186,4 @@ class VertexPaintDirt(Operator):
classes = (
VertexPaintDirt,
-)
\ No newline at end of file
+)
More information about the Bf-blender-cvs
mailing list