fix [#33715] Dirty Vertex Colors display problem since 2.65a

This commit is contained in:
Campbell Barton
2013-01-03 07:01:41 +00:00
parent d8d24bdebd
commit 84f229536a

View File

@@ -127,13 +127,14 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
col[0] = tone * col[0] col[0] = tone * col[0]
col[1] = tone * col[1] col[1] = tone * col[1]
col[2] = tone * col[2] col[2] = tone * col[2]
me.update()
return {'FINISHED'} return {'FINISHED'}
import bpy import bpy
from bpy.types import Operator from bpy.types import Operator
from bpy.props import FloatProperty, IntProperty, BoolProperty from bpy.props import FloatProperty, IntProperty, BoolProperty
from math import pi
class VertexPaintDirt(Operator): class VertexPaintDirt(Operator):
@@ -156,14 +157,16 @@ class VertexPaintDirt(Operator):
clean_angle = FloatProperty( clean_angle = FloatProperty(
name="Highlight Angle", name="Highlight Angle",
description="Less than 90 limits the angle used in the tonal range", description="Less than 90 limits the angle used in the tonal range",
min=0.0, max=180.0, min=0.0, max=pi,
default=180.0, default=pi,
unit="ROTATION",
) )
dirt_angle = FloatProperty( dirt_angle = FloatProperty(
name="Dirt Angle", name="Dirt Angle",
description="Less than 90 limits the angle used in the tonal range", description="Less than 90 limits the angle used in the tonal range",
min=0.0, max=180.0, min=0.0, max=pi,
default=0.0, default=0.0,
unit="ROTATION",
) )
dirt_only = BoolProperty( dirt_only = BoolProperty(
name="Dirt Only", name="Dirt Only",
@@ -171,20 +174,21 @@ class VertexPaintDirt(Operator):
default=False, default=False,
) )
@classmethod
def poll(cls, context):
obj = context.object
return (obj and obj.type == 'MESH')
def execute(self, context): def execute(self, context):
import time import time
from math import radians from math import radians
obj = context.object obj = context.object
if not obj or obj.type != 'MESH':
self.report({'ERROR'}, "Error, no active mesh object, aborting")
return {'CANCELLED'}
mesh = obj.data mesh = obj.data
t = time.time() t = time.time()
ret = applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, radians(self.dirt_angle), radians(self.clean_angle), self.dirt_only) ret = applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, self.dirt_angle, self.clean_angle, self.dirt_only)
print('Dirt calculated in %.6f' % (time.time() - t)) print('Dirt calculated in %.6f' % (time.time() - t))