diff --git a/build_files/buildbot/master_unpack.py b/build_files/buildbot/master_unpack.py index f97e53384b0..612b686b49a 100644 --- a/build_files/buildbot/master_unpack.py +++ b/build_files/buildbot/master_unpack.py @@ -94,11 +94,11 @@ if platform == '': sys.exit(1) # extract -dir = 'public_html/download' +directory = 'public_html/download' try: zf = z.open(package) - f = file(os.path.join(dir, packagename), "wb") + f = file(os.path.join(directory, packagename), "wb") shutil.copyfileobj(zf, f) @@ -112,10 +112,10 @@ except Exception, ex: # remove other files from the same platform try: - for f in os.listdir(dir): + for f in os.listdir(directory): if platform.lower() in f.lower(): if f != packagename: - os.remove(os.path.join(dir, f)) + os.remove(os.path.join(directory, f)) except Exception, ex: sys.stderr.write('Failed to remove old packages: %s\n' % str(ex)) sys.exit(1) diff --git a/build_files/buildbot/slave_pack.py b/build_files/buildbot/slave_pack.py index 74d00bf9249..effe7751915 100644 --- a/build_files/buildbot/slave_pack.py +++ b/build_files/buildbot/slave_pack.py @@ -41,12 +41,12 @@ if builder.find('scons') != -1: sys.exit(retcode) # clean release directory if it already exists -dir = 'release' +directory = 'release' -if os.path.exists(dir): - for f in os.listdir(dir): - if os.path.isfile(os.path.join(dir, f)): - os.remove(os.path.join(dir, f)) +if os.path.exists(directory): + for f in os.listdir(directory): + if os.path.isfile(os.path.join(directory, f)): + os.remove(os.path.join(directory, f)) # create release package try: @@ -56,7 +56,7 @@ except Exception, ex: sys.exit(1) # find release directory, must exist this time -if not os.path.exists(dir): +if not os.path.exists(directory): sys.stderr.write("Failed to find release directory.\n") sys.exit(1) @@ -64,8 +64,8 @@ if not os.path.exists(dir): file = None filepath = None -for f in os.listdir(dir): - rf = os.path.join(dir, f) +for f in os.listdir(directory): + rf = os.path.join(directory, f) if os.path.isfile(rf) and f.startswith('blender'): file = f filepath = rf diff --git a/build_files/cmake/cmake_qtcreator_project.py b/build_files/cmake/cmake_qtcreator_project.py index 1bad1835434..601cf865ab4 100644 --- a/build_files/cmake/cmake_qtcreator_project.py +++ b/build_files/cmake/cmake_qtcreator_project.py @@ -114,7 +114,6 @@ def cmake_advanced_info(): """ def create_eclipse_project(CMAKE_DIR): - import sys if sys.platform == "win32": cmd = 'cmake %r -G"Eclipse CDT4 - MinGW Makefiles"' % CMAKE_DIR else: @@ -125,7 +124,7 @@ def cmake_advanced_info(): includes = [] defines = [] - import os + create_eclipse_project(CMAKE_DIR) diff --git a/build_files/cmake/example_scripts/make_quicky.py b/build_files/cmake/example_scripts/make_quicky.py index d7c43f4b86e..a4e0d3371f1 100755 --- a/build_files/cmake/example_scripts/make_quicky.py +++ b/build_files/cmake/example_scripts/make_quicky.py @@ -43,8 +43,8 @@ def main(): targets = set() # collect targets - file = open("Makefile", "r") - for line in file: + makefile = open("Makefile", "r") + for line in makefile: line = line.rstrip() if not line or line[0] in ". \t@$#": continue @@ -59,7 +59,7 @@ def main(): continue targets.add(line) - file.close() + makefile.close() # remove cmake targets bad = set([ diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index 62a9f691acf..3877f711b7f 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -107,7 +107,7 @@ def modules(module_cache): import traceback traceback.print_exc() raise - + return mod else: return None @@ -246,7 +246,6 @@ def disable(module_name, default_set=True): :type module_name: string """ import sys - import traceback import bpy_types as _bpy_types mod = sys.modules.get(module_name) @@ -259,6 +258,7 @@ def disable(module_name, default_set=True): try: mod.unregister() except: + import traceback traceback.print_exc() else: print("addon_utils.disable", module_name, "not loaded") diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index cb2349eab1d..b7c52a35fdf 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -347,7 +347,6 @@ def keyconfig_set(filepath): print("loading preset:", filepath) keyconfigs = _bpy.context.window_manager.keyconfigs - kc_orig = keyconfigs.active keyconfigs_old = keyconfigs[:] diff --git a/release/scripts/modules/bpyml_ui.py b/release/scripts/modules/bpyml_ui.py index 2462dd60e3e..1e0522974d1 100644 --- a/release/scripts/modules/bpyml_ui.py +++ b/release/scripts/modules/bpyml_ui.py @@ -65,7 +65,7 @@ def _parse_rna_args(base, py_node): def _call_recursive(context, base, py_node): - prop = base.bl_rna.properties.get(py_node[TAG]) + # prop = base.bl_rna.properties.get(py_node[TAG]) if py_node[TAG] in base.bl_rna.properties: value = py_node[ARGS].get("expr") if value: @@ -73,7 +73,7 @@ def _call_recursive(context, base, py_node): setattr(base, py_node[TAG], value) else: value = py_node[ARGS]['value'] # have to have this - setattr(base, name, value) + setattr(base, py_node[TAG], value) else: args = _parse_rna_args(base, py_node) func_new = getattr(base, py_node[TAG]) diff --git a/release/scripts/modules/mesh_utils.py b/release/scripts/modules/mesh_utils.py index f65aa8b306f..5bacff7b0cc 100644 --- a/release/scripts/modules/mesh_utils.py +++ b/release/scripts/modules/mesh_utils.py @@ -19,7 +19,7 @@ # -def mesh_linked_faces(me): +def mesh_linked_faces(mesh): ''' Splits the mesh into connected parts, these parts are returned as lists of faces. diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py index 73119a6e216..b50bb2dc3cc 100644 --- a/release/scripts/startup/bl_operators/object_quick_effects.py +++ b/release/scripts/startup/bl_operators/object_quick_effects.py @@ -18,7 +18,6 @@ # -import mathutils from mathutils import Vector import bpy from bpy.props import BoolProperty, EnumProperty, IntProperty, FloatProperty, FloatVectorProperty @@ -80,6 +79,7 @@ class MakeFur(bpy.types.Operator): return {'FINISHED'} + def obj_bb_minmax(obj, min_co, max_co): for i in range(0, 8): bb_vec = Vector((obj.bound_box[i][0], obj.bound_box[i][1], obj.bound_box[i][2])) * obj.matrix_world @@ -91,6 +91,7 @@ def obj_bb_minmax(obj, min_co, max_co): max_co[1] = max(bb_vec[1], max_co[1]) max_co[2] = max(bb_vec[2], max_co[2]) + class MakeSmoke(bpy.types.Operator): bl_idname = "object.make_smoke" bl_label = "Make Smoke" @@ -148,8 +149,8 @@ class MakeSmoke(bpy.types.Operator): obj.name = "Smoke Domain" # give the smoke some room above the flows - obj.location = 0.5 * (max_co + min_co) + Vector((0,0,1)) - obj.scale = 0.5 * (max_co - min_co) + Vector((1,1,2)) + obj.location = 0.5 * (max_co + min_co) + Vector((0.0, 0.0, 1.0)) + obj.scale = 0.5 * (max_co - min_co) + Vector((1.0, 1.0, 2.0)) # setup smoke domain bpy.ops.object.modifier_add({"object": obj}, type='SMOKE') @@ -261,8 +262,8 @@ class MakeFluid(bpy.types.Operator): # give the fluid some room below the flows and scale with initial velocity v = 0.5 * self.initial_velocity - obj.location = 0.5 * (max_co + min_co) + Vector((0,0,-1)) + v - obj.scale = 0.5 * (max_co - min_co) + Vector((1,1,2)) + Vector((abs(v[0]), abs(v[1]), abs(v[2]))) + obj.location = 0.5 * (max_co + min_co) + Vector((0.0, 0.0, -1.0)) + v + obj.scale = 0.5 * (max_co - min_co) + Vector((1.0, 1.0, 2.0)) + Vector((abs(v[0]), abs(v[1]), abs(v[2]))) # setup smoke domain bpy.ops.object.modifier_add({"object": obj}, type='FLUID_SIMULATION') @@ -279,7 +280,7 @@ class MakeFluid(bpy.types.Operator): mat.specular_intensity = 1 mat.specular_hardness = 100 mat.use_transparency = True - mat.alpha = 0 + mat.alpha = 0.0 mat.transparency_method = 'RAYTRACE' mat.raytrace_transparency.ior = 1.33 mat.raytrace_transparency.depth = 4 diff --git a/release/scripts/startup/bl_operators/object_randomize_transform.py b/release/scripts/startup/bl_operators/object_randomize_transform.py index d72c600ef78..9dc5086086f 100644 --- a/release/scripts/startup/bl_operators/object_randomize_transform.py +++ b/release/scripts/startup/bl_operators/object_randomize_transform.py @@ -84,7 +84,7 @@ def randomize_selected(seed, delta, loc, rot, scale, scale_even): uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0) -from bpy.props import IntProperty, BoolProperty, FloatProperty, FloatVectorProperty +from bpy.props import IntProperty, BoolProperty, FloatVectorProperty class RandomizeLocRotSize(bpy.types.Operator): diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index e6f71ef9573..1cef67dc710 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -19,7 +19,6 @@ # import bpy -import os class AddPresetBase(): diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 6ed46191099..a77ff0ce5e3 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -859,6 +859,7 @@ class WM_OT_keyconfig_activate(bpy.types.Operator): bpy.utils.keyconfig_set(self.filepath) return {'FINISHED'} + class WM_OT_appconfig_default(bpy.types.Operator): bl_idname = "wm.appconfig_default" bl_label = "Default Application Configuration" @@ -868,13 +869,14 @@ class WM_OT_appconfig_default(bpy.types.Operator): context.window_manager.keyconfigs.active = context.window_manager.keyconfigs.default - filepath = os.path.join(bpy.utils.preset_paths("interaction")[0], "blender.py") - + filepath = os.path.join(bpy.utils.preset_paths("interaction")[0], "blender.py") + if os.path.exists(filepath): - bpy.ops.script.execute_preset(filepath = filepath, menu_idname = "USERPREF_MT_interaction_presets") - + bpy.ops.script.execute_preset(filepath=filepath, menu_idname="USERPREF_MT_interaction_presets") + return {'FINISHED'} + class WM_OT_appconfig_activate(bpy.types.Operator): bl_idname = "wm.appconfig_activate" bl_label = "Activate Application Configuration" @@ -884,14 +886,15 @@ class WM_OT_appconfig_activate(bpy.types.Operator): def execute(self, context): import os bpy.utils.keyconfig_set(self.filepath) - + filepath = self.filepath.replace("keyconfig", "interaction") - + if os.path.exists(filepath): - bpy.ops.script.execute_preset(filepath = filepath, menu_idname = "USERPREF_MT_interaction_presets") - + bpy.ops.script.execute_preset(filepath=filepath, menu_idname="USERPREF_MT_interaction_presets") + return {'FINISHED'} + class WM_OT_sysinfo(bpy.types.Operator): '''Generate System Info''' bl_idname = "wm.sysinfo" diff --git a/release/scripts/startup/bl_ui/properties_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py index ac25c643cab..cebe58291d8 100644 --- a/release/scripts/startup/bl_ui/properties_animviz.py +++ b/release/scripts/startup/bl_ui/properties_animviz.py @@ -17,8 +17,6 @@ # ##### END GPL LICENSE BLOCK ##### # -import bpy - # Generic Panels (Independent of DataType) diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index 09915b03926..014aead3c08 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -889,7 +889,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel): split = layout.split(percentage=0.33) split.label(text="Split uv's:") split.prop(part, "billboard_uv_split", text="Number of splits") - + if psys: col = layout.column() col.active = part.billboard_uv_split > 1 diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 69fe7c3d948..a81561de93f 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -21,7 +21,7 @@ import bpy import os import addon_utils -from bpy.props import StringProperty, BoolProperty, EnumProperty +from bpy.props import StringProperty, BoolProperty def ui_items_general(col, context): @@ -119,6 +119,7 @@ class USERPREF_MT_interaction_presets(bpy.types.Menu): preset_operator = "script.execute_preset" draw = bpy.types.Menu.draw_preset + class USERPREF_MT_appconfigs(bpy.types.Menu): bl_label = "AppPresets" preset_subdir = "keyconfig" @@ -130,6 +131,7 @@ class USERPREF_MT_appconfigs(bpy.types.Menu): # now draw the presets bpy.types.Menu.draw_preset(self, context) + class USERPREF_MT_splash(bpy.types.Menu): bl_label = "Splash" diff --git a/release/scripts/templates/operator_modal_timer.py b/release/scripts/templates/operator_modal_timer.py index d8c218f67ea..d2267191cf5 100644 --- a/release/scripts/templates/operator_modal_timer.py +++ b/release/scripts/templates/operator_modal_timer.py @@ -1,5 +1,4 @@ import bpy -from bpy.props import IntProperty, FloatProperty class ModalTimerOperator(bpy.types.Operator): diff --git a/source/tests/bl_run_operators.py b/source/tests/bl_run_operators.py index f1f21d3bd71..668b4e69228 100644 --- a/source/tests/bl_run_operators.py +++ b/source/tests/bl_run_operators.py @@ -113,11 +113,6 @@ def ctx_editmode_mball(): bpy.ops.object.mode_set(mode='EDIT') -def ctx_editmode_mball(): - bpy.ops.object.metaball_add() - bpy.ops.object.mode_set(mode='EDIT') - - def ctx_editmode_text(): bpy.ops.object.text_add() bpy.ops.object.mode_set(mode='EDIT')