diff options
-rw-r--r-- | release/scripts/io/export_fbx.py | 5 | ||||
-rw-r--r-- | release/scripts/io/export_mdd.py | 10 | ||||
-rw-r--r-- | release/scripts/io/export_ply.py | 5 | ||||
-rw-r--r-- | release/scripts/modules/bpy/__init__.py | 1 | ||||
-rw-r--r-- | release/scripts/modules/bpy_types.py | 20 | ||||
-rw-r--r-- | release/scripts/modules/rigify/leg_quadruped_generic.py | 5 | ||||
-rw-r--r-- | release/scripts/modules/rigify/spine_pivot_flex.py | 1 | ||||
-rw-r--r-- | release/scripts/modules/rna_info.py | 150 | ||||
-rw-r--r-- | release/scripts/op/add_armature_human.py | 4 | ||||
-rw-r--r-- | release/scripts/op/screen_play_rendered_anim.py | 51 | ||||
-rw-r--r-- | release/scripts/op/uvcalc_smart_project.py | 2 | ||||
-rw-r--r-- | release/scripts/op/vertexpaint_dirt.py | 9 | ||||
-rw-r--r-- | release/scripts/ui/properties_data_armature.py | 2 | ||||
-rw-r--r-- | release/scripts/ui/space_time.py | 1 | ||||
-rw-r--r-- | release/scripts/ui/space_userpref.py | 81 | ||||
-rw-r--r-- | release/scripts/ui/space_view3d.py | 11 | ||||
-rw-r--r-- | release/scripts/ui/space_view3d_toolbar.py | 3 | ||||
-rw-r--r-- | release/test/rna_array.py | 2 |
18 files changed, 189 insertions, 174 deletions
diff --git a/release/scripts/io/export_fbx.py b/release/scripts/io/export_fbx.py index 25e79bbf214..1899e4f4a84 100644 --- a/release/scripts/io/export_fbx.py +++ b/release/scripts/io/export_fbx.py @@ -3361,7 +3361,7 @@ class ExportFBX(bpy.types.Operator): # to the class instance from the operator settings before calling. - path = StringProperty(name="File Path", description="File path used for exporting the FBX file", maxlen= 1024, default= "") + path = StringProperty(name="File Path", description="File path used for exporting the FBX file", maxlen= 1024, default="") EXP_OBS_SELECTED = BoolProperty(name="Selected Objects", description="Export selected objects on visible layers", default=True) # EXP_OBS_SCENE = BoolProperty(name="Scene Objects", description="Export all objects in this scene", default=True) @@ -3387,7 +3387,7 @@ class ExportFBX(bpy.types.Operator): BATCH_ENABLE = BoolProperty(name="Enable Batch", description="Automate exporting multiple scenes or groups to files", default=False) BATCH_GROUP = BoolProperty(name="Group > File", description="Export each group as an FBX file, if false, export each scene as an FBX file", default=False) BATCH_OWN_DIR = BoolProperty(name="Own Dir", description="Create a dir for each exported file", default=True) - BATCH_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen= 1024, default="") + BATCH_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen=1024, default="") def poll(self, context): @@ -3467,4 +3467,3 @@ def menu_func(self, context): self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX...").path = default_path menu_item = bpy.types.INFO_MT_file_export.append(menu_func) - diff --git a/release/scripts/io/export_mdd.py b/release/scripts/io/export_mdd.py index 7d0e49d48ce..dd394d7b1eb 100644 --- a/release/scripts/io/export_mdd.py +++ b/release/scripts/io/export_mdd.py @@ -96,7 +96,7 @@ def write(filename, sce, ob, PREF_STARTFRAME, PREF_ENDFRAME, PREF_FPS): numverts = len(me.verts) - numframes = PREF_ENDFRAME-PREF_STARTFRAME + 1 + numframes = PREF_ENDFRAME - PREF_STARTFRAME + 1 PREF_FPS = float(PREF_FPS) f = open(filename, 'wb') #no Errors yet:Safe to create file @@ -104,7 +104,7 @@ def write(filename, sce, ob, PREF_STARTFRAME, PREF_ENDFRAME, PREF_FPS): f.write(pack(">2i", numframes, numverts)) # Write the frame times (should we use the time IPO??) - f.write( pack(">%df" % (numframes), *[frame / PREF_FPS for frame in range(numframes)]) ) # seconds + f.write(pack(">%df" % (numframes), *[frame / PREF_FPS for frame in range(numframes)])) # seconds #rest frame needed to keep frames in sync """ @@ -159,8 +159,8 @@ class ExportMDD(bpy.types.Operator): # List of operator properties, the attributes will be assigned # to the class instance from the operator settings before calling. - path = StringProperty(name="File Path", description="File path used for exporting the MDD file", maxlen= 1024, default= "") - fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default= 25) + path = StringProperty(name="File Path", description="File path used for exporting the MDD file", maxlen=1024) + fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default=25) start_frame = IntProperty(name="Start Frame", description="Start frame for baking", min=minframe, max=maxframe, default=1) end_frame = IntProperty(name="End Frame", description="End frame for baking", min=minframe, max=maxframe, default=250) @@ -182,7 +182,7 @@ class ExportMDD(bpy.types.Operator): bpy.types.register(ExportMDD) -# Add to a menu + def menu_func(self, context): default_path = bpy.data.filename.replace(".blend", ".mdd") self.layout.operator(ExportMDD.bl_idname, text="Vertex Keyframe Animation (.mdd)...").path = default_path diff --git a/release/scripts/io/export_ply.py b/release/scripts/io/export_ply.py index 15b65e8d2fd..f3f4948fc57 100644 --- a/release/scripts/io/export_ply.py +++ b/release/scripts/io/export_ply.py @@ -180,7 +180,7 @@ def write(filename, scene, ob, \ normal_key = rvec3d(normal) if faceUV: - uvcoord = uv[j][0], 1.0-uv[j][1] + uvcoord = uv[j][0], 1.0 - uv[j][1] uvcoord_key = rvec2d(uvcoord) elif vertexUV: uvcoord = v.uvco[0], 1.0 - v.uvco[1] @@ -246,7 +246,7 @@ def write(filename, scene, ob, \ file.write('\n') for pf in ply_faces: - if len(pf)==3: + if len(pf) == 3: file.write('3 %d %d %d\n' % tuple(pf)) else: file.write('4 %d %d %d %d\n' % tuple(pf)) @@ -318,6 +318,7 @@ class ExportPLY(bpy.types.Operator): bpy.types.register(ExportPLY) + def menu_func(self, context): default_path = bpy.data.filename.replace(".blend", ".ply") self.layout.operator(ExportPLY.bl_idname, text="Stanford (.ply)...").path = default_path diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py index 8e7e74e2743..5fd0d17630d 100644 --- a/release/scripts/modules/bpy/__init__.py +++ b/release/scripts/modules/bpy/__init__.py @@ -85,7 +85,6 @@ def _main(): # a bit nasty but this prevents help() and input() from locking blender # Ideally we could have some way for the console to replace sys.stdin but # python would lock blender while waiting for a return value, not easy :| - import sys sys.stdin = None # if "-d" in sys.argv: # Enable this to measure startup speed diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 50e8d8ded93..4af724fa3f6 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -265,10 +265,10 @@ class Mesh(bpy_types.ID): optionaly, seams are edge keys that will be removed """ - OTHER_INDEX = 2,3,0,1 # opposite face index + OTHER_INDEX = 2, 3, 0, 1 # opposite face index if faces is None: - faces= self.faces + faces = self.faces edges = {} @@ -286,7 +286,7 @@ class Mesh(bpy_types.ID): edge_loops = [] for edkey, ed_adj in edges.items(): - if 0 <len(ed_adj) < 3: # 1 or 2 + if 0 < len(ed_adj) < 3: # 1 or 2 # Seek the first edge context_loop = [edkey, ed_adj[0]] edge_loops.append(context_loop) @@ -304,7 +304,7 @@ class Mesh(bpy_types.ID): ed_adj = edges[context_loop[-1]] if len(ed_adj) != 2: - if other_dir and flipped==False: # the original edge had 2 other edges + if other_dir and flipped == False: # the original edge had 2 other edges flipped = True # only flip the list once context_loop.reverse() ed_adj[:] = [] @@ -319,7 +319,7 @@ class Mesh(bpy_types.ID): break i = ed_adj.index(context_loop[-2]) - context_loop.append( ed_adj[ not i] ) + context_loop.append(ed_adj[not i]) # Dont look at this again ed_adj[:] = [] @@ -379,21 +379,22 @@ class Macro(StructRNA, metaclass=OrderedMeta): class Menu(StructRNA): __slots__ = () - + @classmethod def _dyn_menu_initialize(cls): draw_funcs = getattr(cls.draw, "_draw_funcs", None) if draw_funcs is None: + def draw_ls(*args): for func in draw_ls._draw_funcs: func(*args) - + draw_funcs = draw_ls._draw_funcs = [cls.draw] cls.draw = draw_ls - + return draw_funcs - + @classmethod def append(cls, draw_func): """Prepend an draw function to this menu, takes the same arguments as the menus draw function.""" @@ -436,4 +437,3 @@ class Menu(StructRNA): """ import bpy self.path_menu(bpy.utils.preset_paths(self.preset_subdir), self.preset_operator) - diff --git a/release/scripts/modules/rigify/leg_quadruped_generic.py b/release/scripts/modules/rigify/leg_quadruped_generic.py index 3f7275e48c0..5f8f274c963 100644 --- a/release/scripts/modules/rigify/leg_quadruped_generic.py +++ b/release/scripts/modules/rigify/leg_quadruped_generic.py @@ -19,9 +19,8 @@ # <pep8 compliant> import bpy -from rigify import RigifyError, get_layer_dict -from rigify_utils import bone_class_instance, copy_bone_simple, blend_bone_list, get_side_name, get_base_name, add_pole_target_bone -from rna_prop_ui import rna_idprop_ui_prop_get +from rigify import RigifyError +from rigify_utils import bone_class_instance, copy_bone_simple, add_pole_target_bone from Mathutils import Vector METARIG_NAMES = "hips", "thigh", "shin", "foot", "toe" diff --git a/release/scripts/modules/rigify/spine_pivot_flex.py b/release/scripts/modules/rigify/spine_pivot_flex.py index 7f74028ddfb..895a5d854c0 100644 --- a/release/scripts/modules/rigify/spine_pivot_flex.py +++ b/release/scripts/modules/rigify/spine_pivot_flex.py @@ -90,6 +90,7 @@ def metarig_template(): pbone = obj.pose.bones['rib_cage'] pbone['type'] = 'spine_pivot_flex' + def metarig_definition(obj, orig_bone_name): ''' The bone given is the second in a chain. diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py index 2a70feec9dd..45bb46917af 100644 --- a/release/scripts/modules/rna_info.py +++ b/release/scripts/modules/rna_info.py @@ -16,6 +16,8 @@ # # ##### END GPL LICENSE BLOCK ##### +# <pep8 compliant> + # classes for extracting info from blenders internal classes import bpy @@ -23,22 +25,28 @@ import bpy # use to strip python paths script_paths = bpy.utils.script_paths() + def range_str(val): - if val < -10000000: return '-inf' - if val > 10000000: return 'inf' - if type(val)==float: - return '%g' % val + if val < -10000000: + return '-inf' + elif val > 10000000: + return 'inf' + elif type(val) == float: + return '%g' % val else: return str(val) + def float_as_string(f): val_str = "%g" % f if '.' not in val_str and '-' not in val_str: # value could be 1e-05 val_str += '.0' return val_str + class InfoStructRNA: global_lookup = {} + def __init__(self, rna_type): self.bl_rna = rna_type @@ -65,15 +73,15 @@ class InfoStructRNA: def get_bases(self): bases = [] item = self - + while item: item = item.base if item: bases.append(item) - + return bases - def get_nested_properties(self, ls = None): + def get_nested_properties(self, ls=None): if not ls: ls = self.properties[:] @@ -87,10 +95,9 @@ class InfoStructRNA: py_class = getattr(bpy.types, self.identifier) for attr_str in dir(py_class): if attr_str.startswith("_"): - continue + continue attrs.append((attr_str, getattr(py_class, attr_str))) return attrs - def get_py_properties(self): properties = [] @@ -98,7 +105,7 @@ class InfoStructRNA: if type(attr) is property: properties.append((identifier, attr)) return properties - + def get_py_functions(self): import types functions = [] @@ -106,7 +113,7 @@ class InfoStructRNA: if type(attr) is types.FunctionType: functions.append((identifier, attr)) return functions - + def __repr__(self): txt = '' @@ -126,6 +133,7 @@ class InfoStructRNA: class InfoPropertyRNA: global_lookup = {} + def __init__(self, rna_prop): self.bl_prop = rna_prop self.identifier = rna_prop.identifier @@ -151,7 +159,7 @@ class InfoPropertyRNA: self.fixed_type = GetInfoStructRNA(fixed_type) # valid for pointer/collections else: self.fixed_type = None - + if self.type == "enum": self.enum_items[:] = rna_prop.items.keys() @@ -172,35 +180,37 @@ class InfoPropertyRNA: self.default_str = str(self.default) self.srna = GetInfoStructRNA(rna_prop.srna) # valid for pointer/collections - + def get_default_string(self): # pointer has no default, just set as None if self.type == "pointer": - return "None" + return "None" elif self.type == "string": - return '"' + self.default_str + '"' + return '"' + self.default_str + '"' elif self.type == "enum": if self.default_str: - return "'" + self.default_str + "'" + return "'" + self.default_str + "'" else: return "" return self.default_str - + def get_arg_default(self, force=True): default = self.get_default_string() if default and (force or self.is_required == False): return "%s=%s" % (self.identifier, default) return self.identifier - + def __repr__(self): txt = '' txt += ' * ' + self.identifier + ': ' + self.description return txt + class InfoFunctionRNA: global_lookup = {} + def __init__(self, rna_func): self.bl_func = rna_func self.identifier = rna_func.identifier @@ -213,8 +223,8 @@ class InfoFunctionRNA: def build(self): rna_func = self.bl_func parent_id = rna_func - - for rna_id, rna_prop in rna_func.parameters.items(): + + for rna_prop in rna_func.parameters.values(): prop = GetInfoPropertyRNA(rna_prop, parent_id) if rna_prop.use_return: self.return_value = prop @@ -233,14 +243,15 @@ class InfoFunctionRNA: class InfoOperatorRNA: global_lookup = {} + def __init__(self, rna_op): self.bl_op = rna_op self.identifier = rna_op.identifier - + mod, name = self.identifier.split("_OT_", 1) self.module_name = mod.lower() self.func_name = name - + # self.name = rna_func.name # functions have no name! self.description = rna_op.description.strip() @@ -252,7 +263,7 @@ class InfoOperatorRNA: for rna_id, rna_prop in rna_op.properties.items(): if rna_id == "rna_type": continue - + prop = GetInfoPropertyRNA(rna_prop, parent_id) self.args.append(prop) @@ -271,24 +282,14 @@ class InfoOperatorRNA: # clear the prefix for p in script_paths: source_path = source_path.split(p)[-1] - + if source_path[0] in "/\\": - source_path= source_path[1:] - + source_path = source_path[1:] + return source_path, op_code.co_firstlineno else: return None, None -''' - def __repr__(self): - txt = '' - txt += ' * ' + self.identifier + '(' - - for arg in self.args: - txt += arg.identifier + ', ' - txt += '): ' + self.description - return txt -''' def _GetInfoRNA(bl_rna, cls, parent_id=''): @@ -306,23 +307,27 @@ def _GetInfoRNA(bl_rna, cls, parent_id=''): def GetInfoStructRNA(bl_rna): return _GetInfoRNA(bl_rna, InfoStructRNA) + def GetInfoPropertyRNA(bl_rna, parent_id): return _GetInfoRNA(bl_rna, InfoPropertyRNA, parent_id) + def GetInfoFunctionRNA(bl_rna, parent_id): return _GetInfoRNA(bl_rna, InfoFunctionRNA, parent_id) + def GetInfoOperatorRNA(bl_rna): return _GetInfoRNA(bl_rna, InfoOperatorRNA) + def BuildRNAInfo(): # Use for faster lookups # use rna_struct.identifier as the key for each dict - rna_struct_dict = {} # store identifier:rna lookups - rna_full_path_dict = {} # store the result of full_rna_struct_path(rna_struct) - rna_children_dict = {} # store all rna_structs nested from here - rna_references_dict = {} # store a list of rna path strings that reference this type - rna_functions_dict = {} # store all functions directly in this type (not inherited) + rna_struct_dict = {} # store identifier:rna lookups + rna_full_path_dict = {} # store the result of full_rna_struct_path(rna_struct) + rna_children_dict = {} # store all rna_structs nested from here + rna_references_dict = {} # store a list of rna path strings that reference this type + rna_functions_dict = {} # store all functions directly in this type (not inherited) rna_words = set() def rna_id_ignore(rna_id): @@ -351,8 +356,10 @@ def BuildRNAInfo(): # def write_func(rna_func, ident): def base_id(rna_struct): - try: return rna_struct.base.identifier - except: return '' # invalid id + try: + return rna_struct.base.identifier + except: + return "" # invalid id #structs = [(base_id(rna_struct), rna_struct.identifier, rna_struct) for rna_struct in bpy.doc.structs.values()] ''' @@ -364,8 +371,7 @@ def BuildRNAInfo(): for rna_type_name in dir(bpy.types): rna_type = getattr(bpy.types, rna_type_name) - try: rna_struct = rna_type.bl_rna - except: rna_struct = None + rna_struct = getattr(rna_type, "bl_rna", None) if rna_struct: #if not rna_type_name.startswith('__'): @@ -373,7 +379,7 @@ def BuildRNAInfo(): identifier = rna_struct.identifier if not rna_id_ignore(identifier): - structs.append( (base_id(rna_struct), identifier, rna_struct) ) + structs.append((base_id(rna_struct), identifier, rna_struct)) # Simple lookup rna_struct_dict[identifier] = rna_struct @@ -382,12 +388,12 @@ def BuildRNAInfo(): rna_full_path_dict[identifier] = full_rna_struct_path(rna_struct) # Store a list of functions, remove inherited later - rna_functions_dict[identifier]= list(rna_struct.functions) + rna_functions_dict[identifier] = list(rna_struct.functions) # fill in these later - rna_children_dict[identifier]= [] - rna_references_dict[identifier]= [] + rna_children_dict[identifier] = [] + rna_references_dict[identifier] = [] else: @@ -417,11 +423,11 @@ def BuildRNAInfo(): data = structs.pop(i) ok = False while i < len(structs): - if structs[i][1]==rna_base: - structs.insert(i+1, data) # insert after the item we depend on. + if structs[i][1] == rna_base: + structs.insert(i + 1, data) # insert after the item we depend on. ok = True break - i+=1 + i += 1 if not ok: print('Dependancy "%s" could not be found for "%s"' % (identifier, rna_base)) @@ -439,37 +445,40 @@ def BuildRNAInfo(): rna_base_func_keys = [f.identifier for f in rna_struct_dict[rna_base].functions] else: rna_base_prop_keys = [] - rna_base_func_keys= [] + rna_base_func_keys = [] # rna_struct_path = full_rna_struct_path(rna_struct) rna_struct_path = rna_full_path_dict[identifier] for rna_prop_identifier, rna_prop in rna_struct.properties.items(): - if rna_prop_identifier=='RNA': continue - if rna_id_ignore(rna_prop_identifier): continue - if rna_prop_identifier in rna_base_prop_keys: continue + if rna_prop_identifier == 'RNA' or \ + rna_id_ignore(rna_prop_identifier) or \ + rna_prop_identifier in rna_base_prop_keys: + continue for rna_prop_ptr in (getattr(rna_prop, "fixed_type", None), getattr(rna_prop, "srna", None)): # Does this property point to me? if rna_prop_ptr: - rna_references_dict[rna_prop_ptr.identifier].append( "%s.%s" % (rna_struct_path, rna_prop_identifier) ) + rna_references_dict[rna_prop_ptr.identifier].append("%s.%s" % (rna_struct_path, rna_prop_identifier)) for rna_func in rna_struct.functions: for rna_prop_identifier, rna_prop in rna_func.parameters.items(): - if rna_prop_identifier=='RNA': continue - if rna_id_ignore(rna_prop_identifier): continue - if rna_prop_identifier in rna_base_func_keys: continue - + if rna_prop_identifier == 'RNA' or \ + rna_id_ignore(rna_prop_identifier) or \ + rna_prop_identifier in rna_base_func_keys: + continue - try: rna_prop_ptr = rna_prop.fixed_type - except: rna_prop_ptr = None + try: + rna_prop_ptr = rna_prop.fixed_type + except: + rna_prop_ptr = None # Does this property point to me? if rna_prop_ptr: - rna_references_dict[rna_prop_ptr.identifier].append( "%s.%s" % (rna_struct_path, rna_func.identifier) ) + rna_references_dict[rna_prop_ptr.identifier].append("%s.%s" % (rna_struct_path, rna_func.identifier)) # Store nested children @@ -479,11 +488,11 @@ def BuildRNAInfo(): if rna_base: - rna_funcs = rna_functions_dict[identifier] + rna_funcs = rna_functions_dict[identifier] if rna_funcs: # Remove inherited functions if we have any - rna_base_funcs = rna_functions_dict__copy[rna_base] - rna_funcs[:] = [f for f in rna_funcs if f not in rna_base_funcs] + rna_base_funcs = rna_functions_dict__copy[rna_base] + rna_funcs[:] = [f for f in rna_funcs if f not in rna_base_funcs] rna_functions_dict__copy.clear() del rna_functions_dict__copy @@ -499,7 +508,7 @@ def BuildRNAInfo(): # continue #write_struct(rna_struct, '') - info_struct= GetInfoStructRNA(rna_struct) + info_struct = GetInfoStructRNA(rna_struct) if rna_base: info_struct.base = GetInfoStructRNA(rna_struct_dict[rna_base]) info_struct.nested = GetInfoStructRNA(rna_struct.nested) @@ -525,7 +534,7 @@ def BuildRNAInfo(): prop.build() if func.return_value: func.return_value.build() - + # now for operators op_mods = dir(bpy.ops) @@ -551,9 +560,8 @@ def BuildRNAInfo(): for rna_prop in rna_info.args: rna_prop.build() - + #for rna_info in InfoStructRNA.global_lookup.values(): # print(rna_info) return InfoStructRNA.global_lookup, InfoFunctionRNA.global_lookup, InfoOperatorRNA.global_lookup, InfoPropertyRNA.global_lookup - diff --git a/release/scripts/op/add_armature_human.py b/release/scripts/op/add_armature_human.py index e618ed51ee5..afc3c8bd065 100644 --- a/release/scripts/op/add_armature_human.py +++ b/release/scripts/op/add_armature_human.py @@ -23,6 +23,7 @@ from math import cos, sin, pi # could this be stored elsewhere? + def metarig_template(): # generated by rigify.write_meta_rig bpy.ops.object.mode_set(mode='EDIT') @@ -613,7 +614,8 @@ class AddHuman(bpy.types.Operator): bpy.types.register(AddHuman) # Add to a menu -menu_func = (lambda self, context: self.layout.operator(AddHuman.bl_idname, icon='OUTLINER_OB_ARMATURE', text="Human (Meta-Rig)")) +menu_func = (lambda self, context: self.layout.operator(AddHuman.bl_idname, + icon='OUTLINER_OB_ARMATURE', text="Human (Meta-Rig)")) bpy.types.INFO_MT_armature_add.append(menu_func) diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py index 40173879787..a8c97010cce 100644 --- a/release/scripts/op/screen_play_rendered_anim.py +++ b/release/scripts/op/screen_play_rendered_anim.py @@ -17,37 +17,40 @@ # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # ***** END GPL LICENCE BLOCK ***** -# -------------------------------------------------------------------------- + +# <pep8 compliant> # History # # Originally written by Matt Ebb import bpy -import subprocess, os, platform +import subprocess +import os +import platform # from BKE_add_image_extension() img_format_exts = { - 'IRIS':'.rgb', - 'RADHDR':'.hdr', - 'PNG':'png', - 'TARGA':'tga', - 'RAWTARGA':'tga', - 'BMP':'bmp', - 'TIFF':'tif', - 'OPENEXR':'exr', - 'MULTILAYER':'exr', - 'CINEON':'cin', - 'DPX':'dpx', - 'JPEG':'jpg', - 'JPEG2000':'jp2', - 'QUICKTIME_QTKIT':'mov', - 'QUICKTIME_CARBON':'mov', - 'AVIRAW':'avi', - 'AVIJPEG':'avi', - 'AVICODEC':'avi', - 'XVID':'avi', - 'THEORA':'ogg', + 'IRIS': '.rgb', + 'RADHDR': '.hdr', + 'PNG': 'png', + 'TARGA': 'tga', + 'RAWTARGA': 'tga', + 'BMP': 'bmp', + 'TIFF': 'tif', + 'OPENEXR': 'exr', + 'MULTILAYER': 'exr', + 'CINEON': 'cin', + 'DPX': 'dpx', + 'JPEG': 'jpg', + 'JPEG2000': 'jp2', + 'QUICKTIME_QTKIT': 'mov', + 'QUICKTIME_CARBON': 'mov', + 'AVIRAW': 'avi', + 'AVIJPEG': 'avi', + 'AVICODEC': 'avi', + 'XVID': 'avi', + 'THEORA': 'ogg', } movie_formats = ('QUICKTIME_QTKIT', @@ -56,8 +59,8 @@ movie_formats = ('QUICKTIME_QTKIT', 'AVIJPEG', 'AVICODEC', 'XVID', - 'THEORA' - ) + 'THEORA') + def guess_player_path(preset): if preset == 'BLENDER24': diff --git a/release/scripts/op/uvcalc_smart_project.py b/release/scripts/op/uvcalc_smart_project.py index 6da6020f85b..0cf2a650973 100644 --- a/release/scripts/op/uvcalc_smart_project.py +++ b/release/scripts/op/uvcalc_smart_project.py @@ -1109,6 +1109,8 @@ def main(context, island_margin, projection_limit): """ from bpy.props import * + + class SmartProject(bpy.types.Operator): '''This script projection unwraps the selected faces of a mesh. it operates on all selected mesh objects, and can be used unwrap selected faces, or all faces.''' bl_idname = "uv.smart_project" diff --git a/release/scripts/op/vertexpaint_dirt.py b/release/scripts/op/vertexpaint_dirt.py index f029541dbca..5731d08a438 100644 --- a/release/scripts/op/vertexpaint_dirt.py +++ b/release/scripts/op/vertexpaint_dirt.py @@ -158,18 +158,17 @@ class VertexPaintDirt(bpy.types.Operator): dirt_only = BoolProperty(name="Dirt Only", description="Dont calculate cleans for convex areas", default=False) def execute(self, context): - sce = context.scene - ob = context.object + obj = context.object - if not ob or ob.type != 'MESH': + if not obj or obj.type != 'MESH': print('Error, no active mesh object, aborting.') return('CANCELLED',) - me = ob.data + mesh = obj.data t = time.time() - applyVertexDirt(me, self.properties.blur_iterations, self.properties.blur_strength, math.radians(self.properties.dirt_angle), math.radians(self.properties.clean_angle), self.properties.dirt_only) + applyVertexDirt(mesh, self.properties.blur_iterations, self.properties.blur_strength, math.radians(self.properties.dirt_angle), math.radians(self.properties.clean_angle), self.properties.dirt_only) print('Dirt calculated in %.6f' % (time.time() - t)) diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py index 3b1ea8cc34c..28cf215fa62 100644 --- a/release/scripts/ui/properties_data_armature.py +++ b/release/scripts/ui/properties_data_armature.py @@ -254,7 +254,7 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel): row = layout.row() row.prop(ob.pose, "ik_solver") - + if itasc: layout.prop(itasc, "mode", expand=True) simulation = (itasc.mode == 'SIMULATION') diff --git a/release/scripts/ui/space_time.py b/release/scripts/ui/space_time.py index e328fa9e31b..a991c9de75f 100644 --- a/release/scripts/ui/space_time.py +++ b/release/scripts/ui/space_time.py @@ -102,6 +102,7 @@ class TIME_MT_view(bpy.types.Menu): layout.operator("marker.camera_bind") + class TIME_MT_frame(bpy.types.Menu): bl_label = "Frame" diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index 99cab8f9ac2..7abc21f0670 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -23,13 +23,13 @@ KM_HIERARCHY = [ ('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit ('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot ('Screen Editing', 'EMPTY', 'WINDOW', []), # resizing, action corners - ]), + ]), ('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region) ('View2D Buttons List', 'EMPTY', 'WINDOW', []), # view 2d with buttons navigation ('Header', 'EMPTY', 'WINDOW', []), # header stuff (per region) ('Grease Pencil', 'EMPTY', 'WINDOW', []), # grease pencil stuff (per region) - + ('3D View', 'VIEW_3D', 'WINDOW', [ # view 3d navigation and generic stuff (select, transform) ('Object Mode', 'EMPTY', 'WINDOW', []), ('Mesh', 'EMPTY', 'WINDOW', []), @@ -38,23 +38,23 @@ KM_HIERARCHY = [ ('Metaball', 'EMPTY', 'WINDOW', []), ('Lattice', 'EMPTY', 'WINDOW', []), ('Font', 'EMPTY', 'WINDOW', []), - + ('Pose', 'EMPTY', 'WINDOW', []), - + ('Vertex Paint', 'EMPTY', 'WINDOW', []), ('Weight Paint', 'EMPTY', 'WINDOW', []), ('Face Mask', 'EMPTY', 'WINDOW', []), ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d ('Sculpt', 'EMPTY', 'WINDOW', []), - + ('Armature Sketch', 'EMPTY', 'WINDOW', []), ('Particle', 'EMPTY', 'WINDOW', []), - + ('Object Non-modal', 'EMPTY', 'WINDOW', []), # mode change - + ('3D View Generic', 'VIEW_3D', 'WINDOW', []) # toolbar and properties ]), - + ('Frames', 'EMPTY', 'WINDOW', []), # frame navigation (per region) ('Markers', 'EMPTY', 'WINDOW', []), # markers (per region) ('Animation', 'EMPTY', 'WINDOW', []), # frame change on click, preview range (per region) @@ -73,16 +73,16 @@ KM_HIERARCHY = [ ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d ('Image Generic', 'IMAGE_EDITOR', 'WINDOW', []) ]), - + ('Timeline', 'TIMELINE', 'WINDOW', []), ('Outliner', 'OUTLINER', 'WINDOW', []), - + ('Node Editor', 'NODE_EDITOR', 'WINDOW', [ ('Node Generic', 'NODE_EDITOR', 'WINDOW', []) ]), ('Sequencer', 'SEQUENCE_EDITOR', 'WINDOW', []), ('Logic Editor', 'LOGIC_EDITOR', 'WINDOW', []), - + ('File Browser', 'FILE_BROWSER', 'WINDOW', [ ('File Browser Main', 'FILE_BROWSER', 'WINDOW', []), ('File Browser Buttons', 'FILE_BROWSER', 'WINDOW', []) @@ -93,7 +93,7 @@ KM_HIERARCHY = [ ('Script', 'SCRIPTS_WINDOW', 'WINDOW', []), ('Text', 'TEXT_EDITOR', 'WINDOW', []), ('Console', 'CONSOLE', 'WINDOW', []), - + ('View3D Gesture Circle', 'EMPTY', 'WINDOW', []), ('Gesture Border', 'EMPTY', 'WINDOW', []), ('Standard Modal Map', 'EMPTY', 'WINDOW', []), @@ -511,8 +511,6 @@ class USERPREF_PT_system(bpy.types.Panel): sub.template_color_ramp(system, "weight_color_range", expand=True) - - class USERPREF_PT_theme(bpy.types.Panel): bl_space_type = 'USER_PREFERENCES' bl_label = "Themes" @@ -1262,10 +1260,10 @@ class USERPREF_PT_input(bpy.types.Panel): userpref = context.user_preferences return (userpref.active_section == 'INPUT') - def draw_entry(self, kc, entry, col, level = 0): + def draw_entry(self, kc, entry, col, level=0): idname, spaceid, regionid, children = entry - km = kc.find_keymap(idname, space_type = spaceid, region_type = regionid) + km = kc.find_keymap(idname, space_type=spaceid, region_type=regionid) if km: self.draw_km(kc, km, children, col, level) @@ -1274,9 +1272,9 @@ class USERPREF_PT_input(bpy.types.Panel): indentpx = 16 if level == 0: level = 0.0001 # Tweak so that a percentage of 0 won't split by half - indent = level*indentpx / bpy.context.region.width + indent = level * indentpx / bpy.context.region.width - split=layout.split(percentage=indent) + split = layout.split(percentage=indent) col = split.column() col = split.column() return col @@ -1317,7 +1315,7 @@ class USERPREF_PT_input(bpy.types.Panel): self.draw_kmi(kc, km, kmi, col, level + 1) # "Add New" at end of keymap item list - col = self.indented_layout(col, level+1) + col = self.indented_layout(col, level + 1) subcol = col.split(percentage=0.2).column() subcol.active = km.user_defined subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN') @@ -1332,7 +1330,6 @@ class USERPREF_PT_input(bpy.types.Panel): for entry in children: self.draw_entry(kc, entry, col, level + 1) - def draw_kmi(self, kc, km, kmi, layout, level): layout.set_context_pointer("keyitem", kmi) @@ -1548,13 +1545,15 @@ bpy.types.register(USERPREF_PT_input) from bpy.props import * + class WM_OT_keyconfig_test(bpy.types.Operator): "Test keyconfig for conflicts." bl_idname = "wm.keyconfig_test" bl_label = "Test Key Configuration for Conflicts" - - def testEntry(self, kc, entry, src = None, parent = None): + + def testEntry(self, kc, entry, src=None, parent=None): result = False + def kmistr(kmi): if km.modal: s = ["kmi = km.add_modal_item(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)] @@ -1574,9 +1573,9 @@ class WM_OT_keyconfig_test(bpy.types.Operator): s.append(", oskey=True") if kmi.key_modifier and kmi.key_modifier != 'NONE': s.append(", key_modifier=\'%s\'" % kmi.key_modifier) - + s.append(")\n") - + props = kmi.properties if props is not None: @@ -1586,16 +1585,16 @@ class WM_OT_keyconfig_test(bpy.types.Operator): value = _string_value(value) if value != "": s.append("kmi.properties.%s = %s\n" % (pname, value)) - + return "".join(s).strip() - + idname, spaceid, regionid, children = entry - km = kc.find_keymap(idname, space_type = spaceid, region_type = regionid) - + km = kc.find_keymap(idname, space_type=spaceid, region_type=regionid) + if km: km = km.active() - + if src: for item in km.items: if src.compare(item): @@ -1605,14 +1604,14 @@ class WM_OT_keyconfig_test(bpy.types.Operator): print(km.name) print(kmistr(item)) result = True - + for child in children: if self.testEntry(kc, child, src, parent): result = True else: for i in range(len(km.items)): src = km.items[i] - + for child in children: if self.testEntry(kc, child, src, km): result = True @@ -1625,29 +1624,30 @@ class WM_OT_keyconfig_test(bpy.types.Operator): print(kmistr(src)) print(kmistr(item)) result = True - + for child in children: if self.testEntry(kc, child): result = True - + return result - + def testConfig(self, kc): result = False for entry in KM_HIERARCHY: if self.testEntry(kc, entry): result = True return result - + def execute(self, context): wm = context.manager kc = wm.default_keyconfig - + if self.testConfig(kc): print("CONFLICT") - + return {'FINISHED'} + def _string_value(value): result = "" if isinstance(value, str): @@ -1674,7 +1674,8 @@ def _string_value(value): print("Export key configuration: can't write ", value) return result - + + class WM_OT_keyconfig_export(bpy.types.Operator): "Export key configuration to a python script." bl_idname = "wm.keyconfig_export" @@ -1775,6 +1776,7 @@ class WM_OT_keymap_restore(bpy.types.Operator): return {'FINISHED'} + class WM_OT_keyitem_restore(bpy.types.Operator): "Restore key map item." bl_idname = "wm.keyitem_restore" @@ -1793,7 +1795,8 @@ class WM_OT_keyitem_restore(bpy.types.Operator): km.restore_item_to_default(kmi) return {'FINISHED'} - + + class WM_OT_keyitem_add(bpy.types.Operator): "Add key map item." bl_idname = "wm.keyitem_add" diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 831b900579a..5563b727487 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -1146,17 +1146,16 @@ class VIEW3D_MT_edit_mesh_selection_mode(bpy.types.Menu): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - path = "tool_settings.edit_select_vertex;tool_settings.edit_select_edge;tool_settings.edit_select_face" - prop = layout.operator("wm.context_set_value", text="Vertex") + prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL') prop.value = "(True, False, False)" prop.path = "tool_settings.mesh_selection_mode" - prop = layout.operator("wm.context_set_value", text="Edge") + prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL') prop.value = "(False, True, False)" prop.path = "tool_settings.mesh_selection_mode" - prop = layout.operator("wm.context_set_value", text="Face") + prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL') prop.value = "(False, False, True)" prop.path = "tool_settings.mesh_selection_mode" @@ -1361,7 +1360,8 @@ class VIEW3D_MT_edit_curve_segments(bpy.types.Menu): layout.operator("curve.subdivide") layout.operator("curve.switch_direction") - + + class VIEW3D_MT_edit_curve_specials(bpy.types.Menu): bl_label = "Specials" @@ -1375,6 +1375,7 @@ class VIEW3D_MT_edit_curve_specials(bpy.types.Menu): layout.operator("curve.smooth") layout.operator("curve.smooth_radius") + class VIEW3D_MT_edit_curve_showhide(VIEW3D_MT_showhide): _operator_name = "curve" diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index 15902215d84..ed4116f8845 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -840,7 +840,7 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel): sub = col.column() row = sub.row() row.active = (settings.tool == 'CLONE') - + row.prop(ipaint, "use_clone_layer", text="Clone") row.menu("VIEW3D_MT_tools_projectpaint_clone", text=context.active_object.data.uv_texture_clone.name) @@ -857,7 +857,6 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel): prop.path = "active_object.data.uv_texture_clone_index" prop.value = i - class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu): bl_label = "Mask Layer" diff --git a/release/test/rna_array.py b/release/test/rna_array.py index 6c6539f5509..4474f050609 100644 --- a/release/test/rna_array.py +++ b/release/test/rna_array.py @@ -16,8 +16,6 @@ # # ##### END GPL LICENSE BLOCK ##### -# <pep8 compliant> - import unittest import random |