diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-02-08 14:33:46 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-02-09 12:35:03 +0300 |
commit | 3c09077e3b88a33d103875a7e0fd0f7ca0736046 (patch) | |
tree | cfa925960d9b0e791b6025dc26cac61807ea1b39 /release/scripts/startup/bl_operators/vertexpaint_dirt.py | |
parent | 07ccb8b97c71eff0cbf1da4465fef5c46cd6d58f (diff) |
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.
Diffstat (limited to 'release/scripts/startup/bl_operators/vertexpaint_dirt.py')
-rw-r--r-- | release/scripts/startup/bl_operators/vertexpaint_dirt.py | 10 |
1 files changed, 5 insertions, 5 deletions
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 +) |