diff options
author | Joerg Mueller <nexyon@gmail.com> | 2011-08-23 00:31:46 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2011-08-23 00:31:46 +0400 |
commit | f0d5abfcb2b54f6fd7a24220e81e0c88a914d87f (patch) | |
tree | 328a631d447ea7c7be2a757d092065c721090f82 /release | |
parent | 1d529d83a0693693878749110a05d8b0fa929d0f (diff) | |
parent | 6a374d266d8213629f74a9f4c9a4984ddf59ef4c (diff) |
Merging trunk up to r39637.
Diffstat (limited to 'release')
29 files changed, 675 insertions, 379 deletions
diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index c965169ff04..4b5e3eeb066 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -426,7 +426,7 @@ def ngon_tesselate(from_data, indices, fix_loops=True): # See if its flipped the wrong way. flip = None for fi in fill: - if flip != None: + if flip is not None: break for i, vi in enumerate(fi): if vi == 0 and fi[i - 1] == 1: diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py index 1c4518c4feb..056b3478c2b 100644 --- a/release/scripts/startup/bl_operators/add_mesh_torus.py +++ b/release/scripts/startup/bl_operators/add_mesh_torus.py @@ -88,36 +88,62 @@ class AddTorus(Operator): bl_label = "Add Torus" bl_options = {'REGISTER', 'UNDO'} - major_radius = FloatProperty(name="Major Radius", + major_radius = FloatProperty( + name="Major Radius", description=("Radius from the origin to the " "center of the cross sections"), - default=1.0, min=0.01, max=100.0) - minor_radius = FloatProperty(name="Minor Radius", + min=0.01, max=100.0, + default=1.0, + ) + minor_radius = FloatProperty( + name="Minor Radius", description="Radius of the torus' cross section", - default=0.25, min=0.01, max=100.0) - major_segments = IntProperty(name="Major Segments", + min=0.01, max=100.0, + default=0.25, + ) + major_segments = IntProperty( + name="Major Segments", description="Number of segments for the main ring of the torus", - default=48, min=3, max=256) - minor_segments = IntProperty(name="Minor Segments", + min=3, max=256, + default=48, + ) + minor_segments = IntProperty( + name="Minor Segments", description="Number of segments for the minor ring of the torus", - default=12, min=3, max=256) - use_abso = BoolProperty(name="Use Int+Ext Controls", + min=3, max=256, + default=12, + ) + use_abso = BoolProperty( + name="Use Int+Ext Controls", description="Use the Int / Ext controls for torus dimensions", - default=False) - abso_major_rad = FloatProperty(name="Exterior Radius", + default=False, + ) + abso_major_rad = FloatProperty( + name="Exterior Radius", description="Total Exterior Radius of the torus", - default=1.0, min=0.01, max=100.0) - abso_minor_rad = FloatProperty(name="Inside Radius", + min=0.01, max=100.0, + default=1.0, + ) + abso_minor_rad = FloatProperty( + name="Inside Radius", description="Total Interior Radius of the torus", - default=0.5, min=0.01, max=100.0) + min=0.01, max=100.0, + default=0.5, + ) # generic transform props - view_align = BoolProperty(name="Align to View", - default=False) - location = FloatVectorProperty(name="Location", - subtype='TRANSLATION') - rotation = FloatVectorProperty(name="Rotation", - subtype='EULER') + view_align = BoolProperty( + name="Align to View", + default=False, + ) + location = FloatVectorProperty( + name="Location", + subtype='TRANSLATION', + ) + rotation = FloatVectorProperty( + name="Rotation", + subtype='EULER', + ) def execute(self, context): diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py index 4114381f3dc..5f6583754e9 100644 --- a/release/scripts/startup/bl_operators/mesh.py +++ b/release/scripts/startup/bl_operators/mesh.py @@ -74,11 +74,11 @@ class MeshMirrorUV(Operator): bl_label = "Copy Mirrored UV coords" bl_options = {'REGISTER', 'UNDO'} - direction = EnumProperty(items=( - ('POSITIVE', "Positive", ""), - ('NEGATIVE', "Negative", "")), - name="Axis Direction", - description="") + direction = EnumProperty( + name="Axis Direction", + items=(('POSITIVE', "Positive", ""), + ('NEGATIVE', "Negative", "")), + ) @classmethod def poll(cls, context): diff --git a/release/scripts/startup/bl_operators/nla.py b/release/scripts/startup/bl_operators/nla.py index 4b4630fdd4e..d6b40d7e6cd 100644 --- a/release/scripts/startup/bl_operators/nla.py +++ b/release/scripts/startup/bl_operators/nla.py @@ -121,7 +121,7 @@ def bake(frame_start, # incase animation data hassnt been created atd = obj.animation_data_create() - if action == None: + if action is None: action = bpy.data.actions.new("Action") atd.action = action diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index 413f0e8db9e..88f863b8e55 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -195,8 +195,12 @@ class SubdivisionSet(Operator): bl_label = "Subdivision Set" bl_options = {'REGISTER', 'UNDO'} - level = IntProperty(name="Level", - default=1, min=-100, max=100, soft_min=-6, soft_max=6) + level = IntProperty( + name="Level", + min=-100, max=100, + soft_min=-6, soft_max=6, + default=1, + ) relative = BoolProperty( name="Relative", diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py index d4a3d826f2f..50e9bfb5b98 100644 --- a/release/scripts/startup/bl_operators/object_align.py +++ b/release/scripts/startup/bl_operators/object_align.py @@ -351,33 +351,34 @@ class AlignObjects(Operator): description=("Enables high quality calculation of the " "bounding box for perfect results on complex " "shape meshes with rotation/scale (Slow)"), - default=True) - - align_mode = EnumProperty(items=( - ('OPT_1', "Negative Sides", ""), - ('OPT_2', "Centers", ""), - ('OPT_3', "Positive Sides", "")), - name="Align Mode:", - description="", - default='OPT_2') - - relative_to = EnumProperty(items=( - ('OPT_1', "Scene Origin", ""), - ('OPT_2', "3D Cursor", ""), - ('OPT_3', "Selection", ""), - ('OPT_4', "Active", "")), - name="Relative To:", - description="", - default='OPT_4') - - align_axis = EnumProperty(items=( - ('X', "X", ""), - ('Y', "Y", ""), - ('Z', "Z", ""), - ), - name="Align", - description="Align to axis", - options={'ENUM_FLAG'}) + default=True, + ) + align_mode = EnumProperty( + name="Align Mode:", + items=(('OPT_1', "Negative Sides", ""), + ('OPT_2', "Centers", ""), + ('OPT_3', "Positive Sides", ""), + ), + default='OPT_2', + ) + relative_to = EnumProperty( + name="Relative To:", + items=(('OPT_1', "Scene Origin", ""), + ('OPT_2', "3D Cursor", ""), + ('OPT_3', "Selection", ""), + ('OPT_4', "Active", ""), + ), + default='OPT_4', + ) + align_axis = EnumProperty( + name="Align", + description="Align to axis", + items=(('X', "X", ""), + ('Y', "Y", ""), + ('Z', "Z", ""), + ), + options={'ENUM_FLAG'}, + ) @classmethod def poll(cls, context): diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py index cd206da3a8e..48b547980d4 100644 --- a/release/scripts/startup/bl_operators/object_quick_effects.py +++ b/release/scripts/startup/bl_operators/object_quick_effects.py @@ -51,19 +51,25 @@ class QuickFur(Operator): bl_label = "Quick Fur" bl_options = {'REGISTER', 'UNDO'} - density = EnumProperty(items=( - ('LIGHT', "Light", ""), - ('MEDIUM', "Medium", ""), - ('HEAVY', "Heavy", "")), - name="Fur Density", - description="", - default='MEDIUM') - - view_percentage = IntProperty(name="View %", - default=10, min=1, max=100, soft_min=1, soft_max=100) - - length = FloatProperty(name="Length", - default=0.1, min=0.001, max=100, soft_min=0.01, soft_max=10) + density = EnumProperty( + name="Fur Density", + items=(('LIGHT', "Light", ""), + ('MEDIUM', "Medium", ""), + ('HEAVY', "Heavy", "")), + default='MEDIUM', + ) + view_percentage = IntProperty( + name="View %", + min=1, max=100, + soft_min=1, soft_max=100, + default=10, + ) + length = FloatProperty( + name="Length", + min=0.001, max=100, + soft_min=0.01, soft_max=10, + default=0.1, + ) def execute(self, context): fake_context = bpy.context.copy() @@ -110,31 +116,50 @@ class QuickExplode(Operator): bl_label = "Quick Explode" bl_options = {'REGISTER', 'UNDO'} - style = EnumProperty(items=( - ('EXPLODE', "Explode", ""), - ('BLEND', "Blend", "")), - name="Explode Style", - description="", - default='EXPLODE') - - amount = IntProperty(name="Amount of pieces", - default=100, min=2, max=10000, soft_min=2, soft_max=10000) - - frame_duration = IntProperty(name="Duration", - default=50, min=1, max=300000, soft_min=1, soft_max=10000) - - frame_start = IntProperty(name="Start Frame", - default=1, min=1, max=300000, soft_min=1, soft_max=10000) + style = EnumProperty( + name="Explode Style", + items=(('EXPLODE', "Explode", ""), + ('BLEND', "Blend", "")), + default='EXPLODE', + ) + amount = IntProperty( + name="Amount of pieces", + min=2, max=10000, + soft_min=2, soft_max=10000, + default=100, + ) + frame_duration = IntProperty( + name="Duration", + min=1, max=300000, + soft_min=1, soft_max=10000, + default=50, + ) - frame_end = IntProperty(name="End Frame", - default=10, min=1, max=300000, soft_min=1, soft_max=10000) + frame_start = IntProperty( + name="Start Frame", + min=1, max=300000, + soft_min=1, soft_max=10000, + default=1, + ) + frame_end = IntProperty( + name="End Frame", + min=1, max=300000, + soft_min=1, soft_max=10000, + default=10, + ) - velocity = FloatProperty(name="Outwards Velocity", - default=1, min=0, max=300000, soft_min=0, soft_max=10) + velocity = FloatProperty( + name="Outwards Velocity", + min=0, max=300000, + soft_min=0, soft_max=10, + default=1, + ) - fade = BoolProperty(name="Fade", - description="Fade the pieces over time.", - default=True) + fade = BoolProperty( + name="Fade", + description="Fade the pieces over time.", + default=True, + ) def execute(self, context): fake_context = bpy.context.copy() @@ -272,12 +297,11 @@ class QuickSmoke(Operator): bl_options = {'REGISTER', 'UNDO'} style = EnumProperty( + name="Smoke Style", items=(('STREAM', "Stream", ""), ('PUFF', "Puff", ""), ('FIRE', "Fire", ""), ), - name="Smoke Style", - description="", default='STREAM', ) @@ -390,19 +414,16 @@ class QuickFluid(Operator): bl_options = {'REGISTER', 'UNDO'} style = EnumProperty( + name="Fluid Style", items=(('INFLOW', "Inflow", ""), - ('BASIC', "Basic", ""), - ), - name="Fluid Style", - description="", - default='BASIC', - ) + ('BASIC', "Basic", "")), + default='BASIC', + ) initial_velocity = FloatVectorProperty( name="Initial Velocity", description="Initial velocity of the fluid", + min=-100.0, max=100.0, default=(0.0, 0.0, 0.0), - min=-100.0, - max=100.0, subtype='VELOCITY', ) show_flows = BoolProperty( diff --git a/release/scripts/startup/bl_operators/object_randomize_transform.py b/release/scripts/startup/bl_operators/object_randomize_transform.py index f65e3d27d83..7aea18487f3 100644 --- a/release/scripts/startup/bl_operators/object_randomize_transform.py +++ b/release/scripts/startup/bl_operators/object_randomize_transform.py @@ -145,9 +145,12 @@ class RandomizeLocRotSize(Operator): default=False, ) - '''scale_min = FloatProperty(name="Minimun Scale Factor", - description="Lowest scale percentage possible", - default=0.15, min=-1.0, max=1.0, precision=3)''' + '''scale_min = FloatProperty( + name="Minimun Scale Factor", + description="Lowest scale percentage possible", + min=-1.0, max=1.0, precision=3, + default=0.15, + )''' scale = FloatVectorProperty( name="Scale", diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py index d2f85c8d7c7..856e182279a 100644 --- a/release/scripts/startup/bl_operators/sequencer.py +++ b/release/scripts/startup/bl_operators/sequencer.py @@ -82,8 +82,12 @@ class SequencerCutMulticam(Operator): bl_label = "Cut multicam" bl_options = {'REGISTER', 'UNDO'} - camera = IntProperty(name="Camera", - default=1, min=1, max=32, soft_min=1, soft_max=32) + camera = IntProperty( + name="Camera", + min=1, max=32, + soft_min=1, soft_max=32, + default=1, + ) @classmethod def poll(cls, context): diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py index 6b1c6e1be98..060fe400045 100644 --- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -552,7 +552,6 @@ class LightMapPack(Operator): PREF_CONTEXT = bpy.props.EnumProperty( name="Selection", - description="", items=(("SEL_FACES", "Selected Faces", "Space all UVs evently"), ("ALL_FACES", "All Faces", "Average space UVs edge length of each loop"), ("ALL_OBJECTS", "Selected Mesh Object", "Average space UVs edge length of each loop") diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py index 8afd6c104e0..23838588f43 100644 --- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py +++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py @@ -178,7 +178,7 @@ def pointInEdges(pt, edges): intersectCount = 0 for ed in edges: xi, yi = lineIntersection2D(x1,y1, x2,y2, ed[0][0], ed[0][1], ed[1][0], ed[1][1]) - if xi != None: # Is there an intersection. + if xi is not None: # Is there an intersection. intersectCount+=1 return intersectCount % 2 @@ -1110,21 +1110,28 @@ class SmartProject(Operator): bl_label = "Smart UV Project" bl_options = {'REGISTER', 'UNDO'} - angle_limit = FloatProperty(name="Angle Limit", + angle_limit = FloatProperty( + name="Angle Limit", description="lower for more projection groups, higher for less distortion", - default=66.0, min=1.0, max=89.0) - - island_margin = FloatProperty(name="Island Margin", + min=1.0, max=89.0, + default=66.0, + ) + island_margin = FloatProperty( + name="Island Margin", description="Margin to reduce bleed from adjacent islands", - default=0.0, min=0.0, max=1.0) - - user_area_weight = FloatProperty(name="Area Weight", + min=0.0, max=1.0, + default=0.0, + ) + user_area_weight = FloatProperty( + name="Area Weight", description="Weight projections vector by faces with larger areas", - default=0.0, min=0.0, max=1.0) + min=0.0, max=1.0, + default=0.0, + ) @classmethod def poll(cls, context): - return context.active_object != None + return context.active_object is not None def execute(self, context): main(context, diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py index facde82f812..4c78adb7161 100644 --- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py +++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py @@ -151,11 +151,35 @@ class VertexPaintDirt(Operator): bl_label = "Dirty Vertex Colors" bl_options = {'REGISTER', 'UNDO'} - blur_strength = FloatProperty(name="Blur Strength", description="Blur strength per iteration", default=1.0, min=0.01, max=1.0) - blur_iterations = IntProperty(name="Blur Iterations", description="Number times to blur the colors. (higher blurs more)", default=1, min=0, max=40) - clean_angle = FloatProperty(name="Highlight Angle", description="Less then 90 limits the angle used in the tonal range", default=180.0, min=0.0, max=180.0) - dirt_angle = FloatProperty(name="Dirt Angle", description="Less then 90 limits the angle used in the tonal range", default=0.0, min=0.0, max=180.0) - dirt_only = BoolProperty(name="Dirt Only", description="Dont calculate cleans for convex areas", default=False) + blur_strength = FloatProperty( + name="Blur Strength", + description="Blur strength per iteration", + min=0.01, max=1.0, + default=1.0, + ) + blur_iterations = IntProperty( + name="Blur Iterations", + description="Number times to blur the colors. (higher blurs more)", + min=0, max=40, + default=1, + ) + clean_angle = FloatProperty( + name="Highlight Angle", + description="Less then 90 limits the angle used in the tonal range", + min=0.0, max=180.0, + default=180.0, + ) + dirt_angle = FloatProperty( + name="Dirt Angle", + description="Less then 90 limits the angle used in the tonal range", + min=0.0, max=180.0, + default=0.0, + ) + dirt_only = BoolProperty( + name="Dirt Only", + description="Dont calculate cleans for convex areas", + default=False, + ) def execute(self, context): import time diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index fe75c54e60e..aa09a088c4f 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -20,8 +20,12 @@ import bpy from bpy.types import Menu, Operator -from bpy.props import StringProperty, BoolProperty, IntProperty, \ - FloatProperty, EnumProperty +from bpy.props import (StringProperty, + BoolProperty, + IntProperty, + FloatProperty, + EnumProperty, + ) from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear @@ -39,23 +43,30 @@ class MESH_OT_delete_edgeloop(Operator): return {'CANCELLED'} -rna_path_prop = StringProperty(name="Context Attributes", - description="rna context string", maxlen=1024, default="") +rna_path_prop = StringProperty( + name="Context Attributes", + description="rna context string", + maxlen=1024, + ) -rna_reverse_prop = BoolProperty(name="Reverse", - description="Cycle backwards", default=False) +rna_reverse_prop = BoolProperty( + name="Reverse", + description="Cycle backwards", + default=False, + ) -rna_relative_prop = BoolProperty(name="Relative", +rna_relative_prop = BoolProperty( + name="Relative", description="Apply relative to the current value (delta)", - default=False) + default=False, + ) def context_path_validate(context, data_path): - import sys try: value = eval("context.%s" % data_path) if data_path else Ellipsis - except AttributeError: - if "'NoneType'" in str(sys.exc_info()[1]): + except AttributeError as e: + if str(e).startswith("'NoneType'"): # One of the items in the rna path is None, just ignore this value = Ellipsis else: @@ -65,16 +76,65 @@ def context_path_validate(context, data_path): return value +def operator_value_is_undo(value): + if value in {None, Ellipsis}: + return False + + # typical properties or objects + id_data = getattr(value, "id_data", Ellipsis) + + if id_data is None: + return False + elif id_data is Ellipsis: + # handle mathutils types + id_data = getattr(getattr(value, "owner", None), "id_data", None) + + if id_data is None: + return False + + # return True if its a non window ID type + return (isinstance(id_data, bpy.types.ID) and + (not isinstance(id_data, (bpy.types.WindowManager, + bpy.types.Screen, + bpy.types.Scene, + bpy.types.Brush, + )))) + + +def operator_path_is_undo(context, data_path): + # note that if we have data paths that use strings this could fail + # luckily we dont do this! + # + # When we cant find the data owner assume no undo is needed. + data_path_head, data_path_sep, data_path_tail = data_path.rpartition(".") + + if not data_path_head: + return False + + value = context_path_validate(context, data_path_head) + + return operator_value_is_undo(value) + + +def operator_path_undo_return(context, data_path): + return {'FINISHED'} if operator_path_is_undo(context, data_path) else {'CANCELLED'} + + +def operator_value_undo_return(value): + return {'FINISHED'} if operator_value_is_undo(value) else {'CANCELLED'} + + def execute_context_assign(self, context): - if context_path_validate(context, self.data_path) is Ellipsis: + data_path = self.data_path + if context_path_validate(context, data_path) is Ellipsis: return {'PASS_THROUGH'} if getattr(self, "relative", False): - exec("context.%s+=self.value" % self.data_path) + exec("context.%s += self.value" % data_path) else: - exec("context.%s=self.value" % self.data_path) + exec("context.%s = self.value" % data_path) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) class BRUSH_OT_active_index_set(Operator): @@ -82,15 +142,21 @@ class BRUSH_OT_active_index_set(Operator): bl_idname = "brush.active_index_set" bl_label = "Set Brush Number" - mode = StringProperty(name="mode", - description="Paint mode to set brush for", maxlen=1024) - index = IntProperty(name="number", - description="Brush number") + mode = StringProperty( + name="mode", + description="Paint mode to set brush for", + maxlen=1024, + ) + index = IntProperty( + name="number", + description="Brush number", + ) _attr_dict = {"sculpt": "use_paint_sculpt", "vertex_paint": "use_paint_vertex", "weight_paint": "use_paint_weight", - "image_paint": "use_paint_image"} + "image_paint": "use_paint_image", + } def execute(self, context): attr = self._attr_dict.get(self.mode) @@ -112,8 +178,11 @@ class WM_OT_context_set_boolean(Operator): bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = BoolProperty(name="Value", - description="Assignment value", default=True) + value = BoolProperty( + name="Value", + description="Assignment value", + default=True, + ) execute = execute_context_assign @@ -125,7 +194,11 @@ class WM_OT_context_set_int(Operator): # same as enum bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = IntProperty(name="Value", description="Assign value", default=0) + value = IntProperty( + name="Value", + description="Assign value", + default=0, + ) relative = rna_relative_prop execute = execute_context_assign @@ -138,17 +211,23 @@ class WM_OT_context_scale_int(Operator): bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = FloatProperty(name="Value", description="Assign value", default=1.0) - always_step = BoolProperty(name="Always Step", - description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.", - default=True) + value = FloatProperty( + name="Value", + description="Assign value", + default=1.0, + ) + always_step = BoolProperty( + name="Always Step", + description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.", + default=True, + ) def execute(self, context): - if context_path_validate(context, self.data_path) is Ellipsis: + data_path = self.data_path + if context_path_validate(context, data_path) is Ellipsis: return {'PASS_THROUGH'} value = self.value - data_path = self.data_path if value == 1.0: # nothing to do return {'CANCELLED'} @@ -160,11 +239,12 @@ class WM_OT_context_scale_int(Operator): else: add = "-1" func = "min" - exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (data_path, func, data_path, data_path, add)) + exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % + (data_path, func, data_path, data_path, add)) else: - exec("context.%s *= value" % self.data_path) + exec("context.%s *= value" % data_path) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) class WM_OT_context_set_float(Operator): # same as enum @@ -174,8 +254,11 @@ class WM_OT_context_set_float(Operator): # same as enum bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = FloatProperty(name="Value", - description="Assignment value", default=0.0) + value = FloatProperty( + name="Value", + description="Assignment value", + default=0.0, + ) relative = rna_relative_prop execute = execute_context_assign @@ -188,8 +271,11 @@ class WM_OT_context_set_string(Operator): # same as enum bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = StringProperty(name="Value", - description="Assign value", maxlen=1024, default="") + value = StringProperty( + name="Value", + description="Assign value", + maxlen=1024, + ) execute = execute_context_assign @@ -201,9 +287,11 @@ class WM_OT_context_set_enum(Operator): bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = StringProperty(name="Value", + value = StringProperty( + name="Value", description="Assignment value (as a string)", - maxlen=1024, default="") + maxlen=1024, + ) execute = execute_context_assign @@ -215,15 +303,18 @@ class WM_OT_context_set_value(Operator): bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = StringProperty(name="Value", + value = StringProperty( + name="Value", description="Assignment value (as a string)", - maxlen=1024, default="") + maxlen=1024, + ) def execute(self, context): - if context_path_validate(context, self.data_path) is Ellipsis: + data_path = self.data_path + if context_path_validate(context, data_path) is Ellipsis: return {'PASS_THROUGH'} - exec("context.%s=%s" % (self.data_path, self.value)) - return {'FINISHED'} + exec("context.%s = %s" % (data_path, self.value)) + return operator_path_undo_return(context, data_path) class WM_OT_context_toggle(Operator): @@ -235,14 +326,14 @@ class WM_OT_context_toggle(Operator): data_path = rna_path_prop def execute(self, context): + data_path = self.data_path - if context_path_validate(context, self.data_path) is Ellipsis: + if context_path_validate(context, data_path) is Ellipsis: return {'PASS_THROUGH'} - exec("context.%s=not (context.%s)" % - (self.data_path, self.data_path)) + exec("context.%s = not (context.%s)" % (data_path, data_path)) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) class WM_OT_context_toggle_enum(Operator): @@ -252,23 +343,30 @@ class WM_OT_context_toggle_enum(Operator): bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value_1 = StringProperty(name="Value", \ - description="Toggle enum", maxlen=1024, default="") - - value_2 = StringProperty(name="Value", \ - description="Toggle enum", maxlen=1024, default="") + value_1 = StringProperty( + name="Value", + description="Toggle enum", + maxlen=1024, + ) + value_2 = StringProperty( + name="Value", + description="Toggle enum", + maxlen=1024, + ) def execute(self, context): + data_path = self.data_path - if context_path_validate(context, self.data_path) is Ellipsis: + if context_path_validate(context, data_path) is Ellipsis: return {'PASS_THROUGH'} - exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \ - (self.data_path, self.value_1,\ - self.value_2, self.data_path, - self.value_2)) + exec("context.%s = ('%s', '%s')[context.%s != '%s']" % + (data_path, self.value_1, + self.value_2, data_path, + self.value_2, + )) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) class WM_OT_context_cycle_int(Operator): @@ -292,7 +390,7 @@ class WM_OT_context_cycle_int(Operator): else: value += 1 - exec("context.%s=value" % data_path) + exec("context.%s = value" % data_path) if value != eval("context.%s" % data_path): # relies on rna clamping int's out of the range @@ -301,9 +399,9 @@ class WM_OT_context_cycle_int(Operator): else: value = -1 << 31 - exec("context.%s=value" % data_path) + exec("context.%s = value" % data_path) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) class WM_OT_context_cycle_enum(Operator): @@ -316,15 +414,15 @@ class WM_OT_context_cycle_enum(Operator): reverse = rna_reverse_prop def execute(self, context): - - value = context_path_validate(context, self.data_path) + data_path = self.data_path + value = context_path_validate(context, data_path) if value is Ellipsis: return {'PASS_THROUGH'} orig_value = value # Have to get rna enum values - rna_struct_str, rna_prop_str = self.data_path.rsplit('.', 1) + rna_struct_str, rna_prop_str = data_path.rsplit('.', 1) i = rna_prop_str.find('[') # just incse we get "context.foo.bar[0]" @@ -354,8 +452,8 @@ class WM_OT_context_cycle_enum(Operator): advance_enum = enums[orig_index + 1] # set the new value - exec("context.%s=advance_enum" % self.data_path) - return {'FINISHED'} + exec("context.%s = advance_enum" % data_path) + return operator_path_undo_return(context, data_path) class WM_OT_context_cycle_array(Operator): @@ -381,9 +479,9 @@ class WM_OT_context_cycle_array(Operator): array.append(array.pop(0)) return array - exec("context.%s=cycle(context.%s[:])" % (data_path, data_path)) + exec("context.%s = cycle(context.%s[:])" % (data_path, data_path)) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) class WM_MT_context_menu_enum(Menu): @@ -426,8 +524,11 @@ class WM_OT_context_set_id(Operator): bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = StringProperty(name="Value", - description="Assign value", maxlen=1024, default="") + value = StringProperty( + name="Value", + description="Assign value", + maxlen=1024, + ) def execute(self, context): value = self.value @@ -449,16 +550,21 @@ class WM_OT_context_set_id(Operator): if id_iter: value_id = getattr(bpy.data, id_iter).get(value) - exec("context.%s=value_id" % data_path) + exec("context.%s = value_id" % data_path) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) -doc_id = StringProperty(name="Doc ID", - description="", maxlen=1024, default="", options={'HIDDEN'}) +doc_id = StringProperty( + name="Doc ID", + maxlen=1024, + options={'HIDDEN'}, + ) -doc_new = StringProperty(name="Edit Description", - description="", maxlen=1024, default="") +doc_new = StringProperty( + name="Edit Description", + maxlen=1024, + ) data_path_iter = StringProperty( description="The data path relative to the context, must point to an iterable.") @@ -476,12 +582,13 @@ class WM_OT_context_collection_boolean_set(Operator): data_path_iter = data_path_iter data_path_item = data_path_item - type = EnumProperty(items=( - ('TOGGLE', "Toggle", ""), - ('ENABLE', "Enable", ""), - ('DISABLE', "Disable", ""), - ), - name="Type") + type = EnumProperty( + name="Type", + items=(('TOGGLE', "Toggle", ""), + ('ENABLE', "Enable", ""), + ('DISABLE', "Disable", ""), + ), + ) def execute(self, context): data_path_iter = self.data_path_iter @@ -507,6 +614,10 @@ class WM_OT_context_collection_boolean_set(Operator): items_ok.append(item) + # avoid undo push when nothing to do + if not items_ok: + return {'CANCELLED'} + if self.type == 'ENABLE': is_set = True elif self.type == 'DISABLE': @@ -518,20 +629,26 @@ class WM_OT_context_collection_boolean_set(Operator): for item in items_ok: exec(exec_str) - return {'FINISHED'} + return operator_value_undo_return(item) class WM_OT_context_modal_mouse(Operator): '''Adjust arbitrary values with mouse input''' bl_idname = "wm.context_modal_mouse" bl_label = "Context Modal Mouse" - bl_options = {'GRAB_POINTER', 'BLOCKING', 'INTERNAL'} + bl_options = {'GRAB_POINTER', 'BLOCKING', 'UNDO', 'INTERNAL'} data_path_iter = data_path_iter data_path_item = data_path_item - input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta") - invert = BoolProperty(default=False, description="Invert the mouse input") + input_scale = FloatProperty( + description="Scale the mouse movement by this value before applying the delta", + default=0.01, + ) + invert = BoolProperty( + description="Invert the mouse input", + default=False, + ) initial_x = IntProperty(options={'HIDDEN'}) def _values_store(self, context): @@ -584,12 +701,13 @@ class WM_OT_context_modal_mouse(Operator): self._values_delta(delta) elif 'LEFTMOUSE' == event_type: + item = next(iter(self._values.keys())) self._values_clear() - return {'FINISHED'} + return operator_value_undo_return(item) elif event_type in {'RIGHTMOUSE', 'ESC'}: self._values_restore() - return {'FINISHED'} + return {'CANCELLED'} return {'RUNNING_MODAL'} @@ -613,11 +731,13 @@ class WM_OT_url_open(Operator): bl_idname = "wm.url_open" bl_label = "" - url = StringProperty(name="URL", description="URL to open") + url = StringProperty( + name="URL", + description="URL to open", + ) def execute(self, context): import webbrowser - _webbrowser_bug_fix() webbrowser.open(self.url) return {'FINISHED'} @@ -627,7 +747,11 @@ class WM_OT_path_open(Operator): bl_idname = "wm.path_open" bl_label = "" - filepath = StringProperty(name="File Path", maxlen=1024, subtype='FILE_PATH') + filepath = StringProperty( + name="File Path", + maxlen=1024, + subtype='FILE_PATH', + ) def execute(self, context): import sys @@ -662,9 +786,11 @@ class WM_OT_doc_view(Operator): doc_id = doc_id if bpy.app.version_cycle == "release": - _prefix = "http://www.blender.org/documentation/blender_python_api_%s%s_release" % ("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char) + _prefix = ("http://www.blender.org/documentation/blender_python_api_%s%s_release" % + ("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char)) else: - _prefix = "http://www.blender.org/documentation/blender_python_api_%s" % "_".join(str(v) for v in bpy.app.version) + _prefix = ("http://www.blender.org/documentation/blender_python_api_%s" % + "_".join(str(v) for v in bpy.app.version)) def _nested_class_string(self, class_string): ls = [] @@ -682,8 +808,8 @@ class WM_OT_doc_view(Operator): class_name, class_prop = id_split if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop): - url = '%s/bpy.ops.%s.html#bpy.ops.%s.%s' % \ - (self._prefix, class_name, class_name, class_prop) + url = ("%s/bpy.ops.%s.html#bpy.ops.%s.%s" % + (self._prefix, class_name, class_name, class_prop)) else: # detect if this is a inherited member and use that name instead @@ -696,14 +822,13 @@ class WM_OT_doc_view(Operator): # It so happens that epydoc nests these, not sphinx # class_name_full = self._nested_class_string(class_name) - url = '%s/bpy.types.%s.html#bpy.types.%s.%s' % \ - (self._prefix, class_name, class_name, class_prop) + url = ("%s/bpy.types.%s.html#bpy.types.%s.%s" % + (self._prefix, class_name, class_name, class_prop)) else: return {'PASS_THROUGH'} import webbrowser - _webbrowser_bug_fix() webbrowser.open(url) return {'FINISHED'} @@ -780,17 +905,36 @@ class WM_OT_doc_edit(Operator): return wm.invoke_props_dialog(self, width=600) -rna_path = StringProperty(name="Property Edit", - description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'}) +rna_path = StringProperty( + name="Property Edit", + description="Property data_path edit", + maxlen=1024, + options={'HIDDEN'}, + ) + +rna_value = StringProperty( + name="Property Value", + description="Property value edit", + maxlen=1024, + ) -rna_value = StringProperty(name="Property Value", - description="Property value edit", maxlen=1024, default="") +rna_property = StringProperty( + name="Property Name", + description="Property name edit", + maxlen=1024, + ) -rna_property = StringProperty(name="Property Name", - description="Property name edit", maxlen=1024, default="") +rna_min = FloatProperty( + name="Min", + default=0.0, + precision=3, + ) -rna_min = FloatProperty(name="Min", default=0.0, precision=3) -rna_max = FloatProperty(name="Max", default=1.0, precision=3) +rna_max = FloatProperty( + name="Max", + default=1.0, + precision=3, + ) class WM_OT_properties_edit(Operator): @@ -804,7 +948,9 @@ class WM_OT_properties_edit(Operator): value = rna_value min = rna_min max = rna_max - description = StringProperty(name="Tip", default="") + description = StringProperty( + name="Tip", + ) def execute(self, context): data_path = self.data_path @@ -857,14 +1003,15 @@ class WM_OT_properties_edit(Operator): return {'FINISHED'} def invoke(self, context, event): + data_path = self.data_path - if not self.data_path: + if not data_path: self.report({'ERROR'}, "Data path not set") return {'CANCELLED'} self._last_prop = [self.property] - item = eval("context.%s" % self.data_path) + item = eval("context.%s" % data_path) # setup defaults prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # dont create @@ -885,7 +1032,8 @@ class WM_OT_properties_add(Operator): data_path = rna_path def execute(self, context): - item = eval("context.%s" % self.data_path) + data_path = self.data_path + item = eval("context.%s" % data_path) def unique_name(names): prop = 'prop' @@ -908,10 +1056,13 @@ class WM_OT_properties_context_change(Operator): bl_idname = "wm.properties_context_change" bl_label = "" - context = StringProperty(name="Context", maxlen=32) + context = StringProperty( + name="Context", + maxlen=32, + ) def execute(self, context): - context.space_data.context = (self.context) + context.space_data.context = self.context return {'FINISHED'} @@ -924,7 +1075,8 @@ class WM_OT_properties_remove(Operator): property = rna_property def execute(self, context): - item = eval("context.%s" % self.data_path) + data_path = self.data_path + item = eval("context.%s" % data_path) del item[self.property] return {'FINISHED'} @@ -933,7 +1085,10 @@ class WM_OT_keyconfig_activate(Operator): bl_idname = "wm.keyconfig_activate" bl_label = "Activate Keyconfig" - filepath = StringProperty(name="File Path", maxlen=1024) + filepath = StringProperty( + name="File Path", + maxlen=1024, + ) def execute(self, context): bpy.utils.keyconfig_set(self.filepath) @@ -961,7 +1116,10 @@ class WM_OT_appconfig_activate(Operator): bl_idname = "wm.appconfig_activate" bl_label = "Activate Application Configuration" - filepath = StringProperty(name="File Path", maxlen=1024) + filepath = StringProperty( + name="File Path", + maxlen=1024, + ) def execute(self, context): import os @@ -1021,65 +1179,3 @@ class WM_OT_copy_prev_settings(Operator): return {'FINISHED'} return {'CANCELLED'} - - -def _webbrowser_bug_fix(): - # test for X11 - import os - - if os.environ.get("DISPLAY"): - - # BSD licenced code copied from python, temp fix for bug - # http://bugs.python.org/issue11432, XXX == added code - def _invoke(self, args, remote, autoraise): - # XXX, added imports - import io - import subprocess - import time - - raise_opt = [] - if remote and self.raise_opts: - # use autoraise argument only for remote invocation - autoraise = int(autoraise) - opt = self.raise_opts[autoraise] - if opt: - raise_opt = [opt] - - cmdline = [self.name] + raise_opt + args - - if remote or self.background: - inout = io.open(os.devnull, "r+") - else: - # for TTY browsers, we need stdin/out - inout = None - # if possible, put browser in separate process group, so - # keyboard interrupts don't affect browser as well as Python - setsid = getattr(os, 'setsid', None) - if not setsid: - setsid = getattr(os, 'setpgrp', None) - - p = subprocess.Popen(cmdline, close_fds=True, # XXX, stdin=inout, - stdout=(self.redirect_stdout and inout or None), - stderr=inout, preexec_fn=setsid) - if remote: - # wait five secons. If the subprocess is not finished, the - # remote invocation has (hopefully) started a new instance. - time.sleep(1) - rc = p.poll() - if rc is None: - time.sleep(4) - rc = p.poll() - if rc is None: - return True - # if remote call failed, open() will try direct invocation - return not rc - elif self.background: - if p.poll() is None: - return True - else: - return False - else: - return not p.wait() - - import webbrowser - webbrowser.UnixBrowser._invoke = _invoke diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index 5fab3b7fd38..778571632b2 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -103,7 +103,10 @@ def register(): items.extend([(cat, cat, "") for cat in sorted(items_unique)]) return items - WindowManager.addon_search = StringProperty(name="Search", description="Search within the selected filter") + WindowManager.addon_search = StringProperty( + name="Search", + description="Search within the selected filter", + ) WindowManager.addon_filter = EnumProperty( items=addon_filter_items, name="Category", diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py index f484d7b59e1..5255af40951 100644 --- a/release/scripts/startup/bl_ui/properties_data_camera.py +++ b/release/scripts/startup/bl_ui/properties_data_camera.py @@ -107,7 +107,7 @@ class DATA_PT_camera(CameraButtonsPanel, Panel): col = split.column() - if cam.dof_object != None: + if cam.dof_object is not None: col.enabled = False col.prop(cam, "dof_distance", text="Distance") diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index 03243d1153b..6f58f060504 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -156,7 +156,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel): if part: split = layout.split(percentage=0.65) if part.type == 'HAIR': - if psys != None and psys.is_edited: + if psys is not None and psys.is_edited: split.operator("particle.edited_clear", text="Free Edit") else: row = split.row() @@ -166,12 +166,12 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel): row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(part, "hair_step") - if psys != None and psys.is_edited: + if psys is not None and psys.is_edited: if psys.is_global_hair: layout.operator("particle.connect_hair") else: layout.operator("particle.disconnect_hair") - elif psys != None and part.type == 'REACTOR': + elif psys is not None and part.type == 'REACTOR': split.enabled = particle_panel_enabled(context, psys) split.prop(psys, "reactor_target_object") split.prop(psys, "reactor_target_particle_system", text="Particle System") @@ -654,7 +654,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel): if settings is None: return False - if psys != None and psys.point_cache.use_external: + if psys is not None and psys.point_cache.use_external: return False return settings.physics_type == 'BOIDS' and engine in cls.COMPAT_ENGINES diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index ead65b92c3f..0172fbcbadd 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -414,6 +414,10 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, Panel): row = col.row() row.active = tex.use_normal_map row.prop(slot, "normal_map_space", text="") + + row = col.row() + row.active = not tex.use_normal_map + row.prop(tex, "use_derivative_map") col.prop(tex, "use_mipmap") row = col.row() @@ -1025,12 +1029,14 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel): # only show bump settings if activated but not for normalmap images row = layout.row() - row.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) - - row.prop(tex, "bump_method", text="Method") + + sub = row.row() + sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and (tex.texture.use_normal_map or tex.texture.use_derivative_map)) + sub.prop(tex, "bump_method", text="Method") + # the space setting is supported for: derivmaps + bumpmaps (DEFAULT,BEST_QUALITY), not for normalmaps sub = row.row() - sub.active = tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'} + sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) and ((tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'}) or (tex.texture.type == 'IMAGE' and tex.texture.use_derivative_map)) sub.prop(tex, "bump_objectspace", text="Space") diff --git a/release/scripts/startup/bl_ui/space_console.py b/release/scripts/startup/bl_ui/space_console.py index d457a66def8..cbbefa01a3c 100644 --- a/release/scripts/startup/bl_ui/space_console.py +++ b/release/scripts/startup/bl_ui/space_console.py @@ -41,7 +41,7 @@ class CONSOLE_MT_console(Menu): def draw(self, context): layout = self.layout - + layout.operator("console.clear") layout.operator("console.copy") layout.operator("console.paste") @@ -141,7 +141,11 @@ class ConsoleLanguage(Operator): '''Set the current language for this console''' bl_idname = "console.language" bl_label = "Console Language" - language = StringProperty(name="Language", maxlen=32, default="") + + language = StringProperty( + name="Language", + maxlen=32, + ) def execute(self, context): sc = context.space_data diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index a2a51f9587f..5ed79f45fbc 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -106,7 +106,7 @@ class DOPESHEET_HT_header(Header): row.menu("DOPESHEET_MT_select") row.menu("DOPESHEET_MT_marker") - if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action != None): + if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action is not None): row.menu("DOPESHEET_MT_channel") elif st.mode == 'GPENCIL': row.menu("DOPESHEET_MT_gpencil_channel") diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 5d72482ce9c..97b5d8457e0 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -387,7 +387,7 @@ class IMAGE_HT_header(Header): row = layout.row(align=True) row.prop(toolsettings, "use_snap", text="") - row.prop(toolsettings, "snap_element", text="", icon_only=True) + row.prop(toolsettings, "snap_target", text="") mesh = context.edit_object.data layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="") @@ -452,7 +452,7 @@ class IMAGE_PT_game_properties(Panel): split = layout.split() col = split.column() - + col.prop(ima, "use_animation") sub = col.column(align=True) sub.active = ima.use_animation @@ -507,7 +507,7 @@ class IMAGE_PT_view_waveform(Panel): layout = self.layout sima = context.space_data - + layout.template_waveform(sima, "scopes") row = layout.split(percentage=0.75) row.prop(sima.scopes, "waveform_alpha") @@ -544,9 +544,9 @@ class IMAGE_PT_sample_line(Panel): def draw(self, context): layout = self.layout - + sima = context.space_data - + layout.operator("image.sample_line") layout.template_histogram(sima, "sample_histogram") layout.prop(sima.sample_histogram, "mode") @@ -564,9 +564,9 @@ class IMAGE_PT_scope_sample(Panel): def draw(self, context): layout = self.layout - + sima = context.space_data - + row = layout.row() row.prop(sima.scopes, "use_full_resolution") sub = row.row() @@ -613,14 +613,14 @@ class IMAGE_PT_view_properties(Panel): col = layout.column() col.label("Cursor Location:") col.row().prop(uvedit, "cursor_location", text="") - + col.separator() - + col.label(text="UVs:") col.row().prop(uvedit, "edge_draw_type", expand=True) split = layout.split() - + col = split.column() col.prop(uvedit, "show_faces") col.prop(uvedit, "show_smooth_edges", text="Smooth") diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index 28990328c46..7f5a5f231cf 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -194,7 +194,7 @@ class INFO_MT_mesh_add(Menu): def draw(self, context): layout = self.layout - + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane") layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube") @@ -215,7 +215,7 @@ class INFO_MT_curve_add(Menu): def draw(self, context): layout = self.layout - + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier") layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle") @@ -246,7 +246,7 @@ class INFO_MT_surface_add(Menu): def draw(self, context): layout = self.layout - + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve") layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle") @@ -262,7 +262,7 @@ class INFO_MT_armature_add(Menu): def draw(self, context): layout = self.layout - + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA') diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 732a38308b0..79565030e56 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -1107,7 +1107,10 @@ class WM_OT_addon_disable(Operator): bl_idname = "wm.addon_disable" bl_label = "Disable Add-On" - module = StringProperty(name="Module", description="Module name of the addon to disable") + module = StringProperty( + name="Module", + description="Module name of the addon to disable", + ) def execute(self, context): addon_utils.disable(self.module) @@ -1119,16 +1122,35 @@ class WM_OT_addon_install(Operator): bl_idname = "wm.addon_install" bl_label = "Install Add-On..." - overwrite = BoolProperty(name="Overwrite", description="Remove existing addons with the same ID", default=True) + overwrite = BoolProperty( + name="Overwrite", + description="Remove existing addons with the same ID", + default=True, + ) target = EnumProperty( name="Target Path", items=(('DEFAULT', "Default", ""), - ('PREFS', "User Prefs", ""))) + ('PREFS', "User Prefs", "")), + ) - filepath = StringProperty(name="File Path", description="File path to write file to") - filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'}) - filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'}) - filter_glob = StringProperty(default="*.py;*.zip", options={'HIDDEN'}) + filepath = StringProperty( + name="File Path", + description="File path to write file to", + ) + filter_folder = BoolProperty( + name="Filter folders", + default=True, + options={'HIDDEN'}, + ) + filter_python = BoolProperty( + name="Filter python", + default=True, + options={'HIDDEN'}, + ) + filter_glob = StringProperty( + default="*.py;*.zip", + options={'HIDDEN'}, + ) @staticmethod def _module_remove(path_addons, module): @@ -1265,7 +1287,10 @@ class WM_OT_addon_remove(Operator): bl_idname = "wm.addon_remove" bl_label = "Remove Add-On" - module = StringProperty(name="Module", description="Module name of the addon to remove") + module = StringProperty( + name="Module", + description="Module name of the addon to remove", + ) @staticmethod def path_from_addon(module): @@ -1313,7 +1338,10 @@ class WM_OT_addon_expand(Operator): bl_idname = "wm.addon_expand" bl_label = "" - module = StringProperty(name="Module", description="Module name of the addon to expand") + module = StringProperty( + name="Module", + description="Module name of the addon to expand", + ) def execute(self, context): module_name = self.module diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index 6a81ff5830e..9ed1591cbf3 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -533,12 +533,31 @@ class WM_OT_keyconfig_import(Operator): bl_idname = "wm.keyconfig_import" bl_label = "Import Key Configuration..." - filepath = StringProperty(name="File Path", description="Filepath to write file to", default="keymap.py") - filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'}) - filter_text = BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'}) - filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'}) - - keep_original = BoolProperty(name="Keep original", description="Keep original file after copying to configuration folder", default=True) + filepath = StringProperty( + name="File Path", + description="Filepath to write file to", + default="keymap.py", + ) + filter_folder = BoolProperty( + name="Filter folders", + default=True, + options={'HIDDEN'}, + ) + filter_text = BoolProperty( + name="Filter text", + default=True, + options={'HIDDEN'}, + ) + filter_python = BoolProperty( + name="Filter python", + default=True, + options={'HIDDEN'}, + ) + keep_original = BoolProperty( + name="Keep original", + description="Keep original file after copying to configuration folder", + default=True, + ) def execute(self, context): from os.path import basename @@ -580,10 +599,26 @@ class WM_OT_keyconfig_export(Operator): bl_idname = "wm.keyconfig_export" bl_label = "Export Key Configuration..." - filepath = StringProperty(name="File Path", description="Filepath to write file to", default="keymap.py") - filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'}) - filter_text = BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'}) - filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'}) + filepath = StringProperty( + name="File Path", + description="Filepath to write file to", + default="keymap.py", + ) + filter_folder = BoolProperty( + name="Filter folders", + default=True, + options={'HIDDEN'}, + ) + filter_text = BoolProperty( + name="Filter text", + default=True, + options={'HIDDEN'}, + ) + filter_python = BoolProperty( + name="Filter python", + default=True, + options={'HIDDEN'}, + ) def execute(self, context): if not self.filepath: @@ -673,7 +708,10 @@ class WM_OT_keymap_restore(Operator): bl_idname = "wm.keymap_restore" bl_label = "Restore Key Map(s)" - all = BoolProperty(name="All Keymaps", description="Restore all keymaps to default") + all = BoolProperty( + name="All Keymaps", + description="Restore all keymaps to default", + ) def execute(self, context): wm = context.window_manager @@ -693,7 +731,10 @@ class WM_OT_keyitem_restore(Operator): bl_idname = "wm.keyitem_restore" bl_label = "Restore Key Map Item" - item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove") + item_id = IntProperty( + name="Item Identifier", + description="Identifier of the item to remove", + ) @classmethod def poll(cls, context): @@ -737,7 +778,10 @@ class WM_OT_keyitem_remove(Operator): bl_idname = "wm.keyitem_remove" bl_label = "Remove Key Map Item" - item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove") + item_id = IntProperty( + name="Item Identifier", + description="Identifier of the item to remove", + ) @classmethod def poll(cls, context): diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 864d59f0cdb..b71593add96 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1049,7 +1049,7 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel): ob = context.active_object col = layout.column() - col.active = ob.vertex_groups.active != None + col.active = ob.vertex_groups.active is not None col.operator("object.vertex_group_normalize_all", text="Normalize All") col.operator("object.vertex_group_normalize", text="Normalize") col.operator("object.vertex_group_invert", text="Invert") diff --git a/release/scripts/templates/addon_add_object.py b/release/scripts/templates/addon_add_object.py index 98517fd97a0..833ac600995 100644 --- a/release/scripts/templates/addon_add_object.py +++ b/release/scripts/templates/addon_add_object.py @@ -45,10 +45,12 @@ class OBJECT_OT_add_object(bpy.types.Operator, AddObjectHelper): bl_description = "Create a new Mesh Object" bl_options = {'REGISTER', 'UNDO'} - scale = FloatVectorProperty(name='scale', - default=(1.0, 1.0, 1.0), - subtype='TRANSLATION', - description='scaling') + scale = FloatVectorProperty( + name='scale', + default=(1.0, 1.0, 1.0), + subtype='TRANSLATION', + description='scaling', + ) def execute(self, context): diff --git a/release/scripts/templates/operator_export.py b/release/scripts/templates/operator_export.py index 4cf943a53b7..b1d53e6ee0c 100644 --- a/release/scripts/templates/operator_export.py +++ b/release/scripts/templates/operator_export.py @@ -24,22 +24,30 @@ class ExportSomeData(bpy.types.Operator, ExportHelper): # ExportHelper mixin class uses this filename_ext = ".txt" - filter_glob = StringProperty(default="*.txt", options={'HIDDEN'}) + filter_glob = StringProperty( + default="*.txt", + options={'HIDDEN'}, + ) # List of operator properties, the attributes will be assigned # to the class instance from the operator settings before calling. - use_setting = BoolProperty(name="Example Boolean", description="Example Tooltip", default=True) - - type = EnumProperty(items=(('OPT_A', "First Option", "Description one"), - ('OPT_B', "Second Option", "Description two."), - ), - name="Example Enum", - description="Choose between two items", - default='OPT_A') + use_setting = BoolProperty( + name="Example Boolean", + description="Example Tooltip", + default=True, + ) + + type = EnumProperty( + name="Example Enum", + description="Choose between two items", + items=(('OPT_A', "First Option", "Description one"), + ('OPT_B', "Second Option", "Description two.")), + default='OPT_A', + ) @classmethod def poll(cls, context): - return context.active_object != None + return context.active_object is not None def execute(self, context): return write_some_data(context, self.filepath, self.use_setting) diff --git a/release/scripts/templates/operator_mesh_add.py b/release/scripts/templates/operator_mesh_add.py index 10d23a6712d..d89b7e82f77 100644 --- a/release/scripts/templates/operator_mesh_add.py +++ b/release/scripts/templates/operator_mesh_add.py @@ -43,25 +43,38 @@ class AddBox(bpy.types.Operator): bl_label = "Add Box" bl_options = {'REGISTER', 'UNDO'} - width = FloatProperty(name="Width", + width = FloatProperty( + name="Width", description="Box Width", - default=1.0, min=0.01, max=100.0) - - height = FloatProperty(name="Height", + min=0.01, max=100.0, + default=1.0, + ) + height = FloatProperty( + name="Height", description="Box Height", - default=1.0, min=0.01, max=100.0) - - depth = FloatProperty(name="Depth", + min=0.01, max=100.0, + default=1.0, + ) + depth = FloatProperty( + name="Depth", description="Box Depth", - default=1.0, min=0.01, max=100.0) + min=0.01, max=100.0, + default=1.0, + ) # generic transform props - view_align = BoolProperty(name="Align to View", - default=False) - location = FloatVectorProperty(name="Location", - subtype='TRANSLATION') - rotation = FloatVectorProperty(name="Rotation", - subtype='EULER') + view_align = BoolProperty( + name="Align to View", + default=False, + ) + location = FloatVectorProperty( + name="Location", + subtype='TRANSLATION', + ) + rotation = FloatVectorProperty( + name="Rotation", + subtype='EULER', + ) def execute(self, context): diff --git a/release/scripts/templates/operator_modal_view3d.py b/release/scripts/templates/operator_modal_view3d.py index 925449835ca..263bf72f129 100644 --- a/release/scripts/templates/operator_modal_view3d.py +++ b/release/scripts/templates/operator_modal_view3d.py @@ -8,7 +8,10 @@ class ViewOperator(bpy.types.Operator): bl_idname = "view3d.modal_operator" bl_label = "Simple View Operator" - offset = FloatVectorProperty(name="Offset", size=3) + offset = FloatVectorProperty( + name="Offset", + size=3, + ) def execute(self, context): v3d = context.space_data diff --git a/release/scripts/templates/operator_simple.py b/release/scripts/templates/operator_simple.py index 8348c7a95b1..05d9afc0ad1 100644 --- a/release/scripts/templates/operator_simple.py +++ b/release/scripts/templates/operator_simple.py @@ -13,7 +13,7 @@ class SimpleOperator(bpy.types.Operator): @classmethod def poll(cls, context): - return context.active_object != None + return context.active_object is not None def execute(self, context): main(context) |