diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-03 11:01:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-03 11:01:41 +0400 |
commit | 84f229536afceb78e10ebc7f5ff443eb01692188 (patch) | |
tree | 840278f18eb79514b419325579669609c9a4cb77 /release/scripts/startup/bl_operators/vertexpaint_dirt.py | |
parent | d8d24bdebd4544825c57e86a47bf796fe8ead64b (diff) |
fix [#33715] Dirty Vertex Colors display problem since 2.65a
Diffstat (limited to 'release/scripts/startup/bl_operators/vertexpaint_dirt.py')
-rw-r--r-- | release/scripts/startup/bl_operators/vertexpaint_dirt.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py index bfbde2f4b07..e2a820b761a 100644 --- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py +++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py @@ -127,13 +127,14 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, col[0] = tone * col[0] col[1] = tone * col[1] col[2] = tone * col[2] - + me.update() return {'FINISHED'} import bpy from bpy.types import Operator from bpy.props import FloatProperty, IntProperty, BoolProperty +from math import pi class VertexPaintDirt(Operator): @@ -156,14 +157,16 @@ class VertexPaintDirt(Operator): clean_angle = FloatProperty( name="Highlight Angle", description="Less than 90 limits the angle used in the tonal range", - min=0.0, max=180.0, - default=180.0, + min=0.0, max=pi, + default=pi, + unit="ROTATION", ) dirt_angle = FloatProperty( name="Dirt Angle", 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, + unit="ROTATION", ) dirt_only = BoolProperty( name="Dirt Only", @@ -171,20 +174,21 @@ class VertexPaintDirt(Operator): default=False, ) + @classmethod + def poll(cls, context): + obj = context.object + return (obj and obj.type == 'MESH') + def execute(self, context): import time from math import radians - obj = context.object - - if not obj or obj.type != 'MESH': - self.report({'ERROR'}, "Error, no active mesh object, aborting") - return {'CANCELLED'} + obj = context.object mesh = obj.data 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)) |