Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2006-05-07 22:13:21 +0400
committerCampbell Barton <ideasman42@gmail.com>2006-05-07 22:13:21 +0400
commitf579a65cbc65deb4958263b20e0f4c8bf1880ea9 (patch)
tree2cdd33bcad8cef07d8a9c65f9f6770c9c9b7955c /release/scripts
parentcd3af13a1b1aaada000322373394c02cc6b773fb (diff)
fixed error with zero length normals (caused by zero area faces)
fixed rare bug - that a colour wasnt clamped between 0 and 255.
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/vertexpaint_selfshadow_ao.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/release/scripts/vertexpaint_selfshadow_ao.py b/release/scripts/vertexpaint_selfshadow_ao.py
index 7f5219f7f8a..2ba1c13794e 100644
--- a/release/scripts/vertexpaint_selfshadow_ao.py
+++ b/release/scripts/vertexpaint_selfshadow_ao.py
@@ -44,7 +44,7 @@ reload(BPyMesh)
def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_SCALE, PREF_SEL_ONLY):
-
+ Window.WaitCursor(1)
V=Mathutils.Vector
M=Mathutils.Matrix
Ang= Mathutils.AngleBetweenVecs
@@ -74,18 +74,12 @@ def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_SCALE, PREF_SEL_ONLY):
vert_tone_list[v.index].append(0)
continue # look at the next vert
- elif l1<l2: # face is facing away from the vert normal
- convex=1
- #if v.sel: print "convex"
- a= Ang(vno, fno)
- else: # l1>l2
- convex=-1# concave, darken.
- #if v.sel: print "concave"
- a= -Ang(vno, fno)
+ try: a= Ang(vno, fno)
+ except: a=0
- #a= Ang(vno, fno) * convex
+ # Concave
+ if l1>l2: a=-a
- #vert_tone[v.index] += a
vert_tone_list[v.index].append(a)
@@ -132,8 +126,10 @@ def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_SCALE, PREF_SEL_ONLY):
tone= (tone/tone_range)
tone= int(tone*255)
+ tone=min( max(tone, 0), 255)
f.col[i].r= f.col[i].g= f.col[i].b= tone
-
+
+ Window.WaitCursor(0)
def main():
scn= Scene.GetCurrent()