diff options
-rw-r--r-- | release/scripts/modules/addon_utils.py | 35 | ||||
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 51 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/__init__.py | 51 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pbvh_bmesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 10 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_array.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_buffer.h | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_dissolve.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_edgenet.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_hull.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_subdivide.c | 10 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_separate.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_intersect.c | 2 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_parametrizer.c | 2 |
17 files changed, 99 insertions, 82 deletions
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index 51e3e65b78c..97fc45189f2 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -77,8 +77,8 @@ def modules_refresh(module_cache=addons_fake_modules): ModuleType = type(ast) try: file_mod = open(mod_path, "r", encoding='UTF-8') - except OSError as e: - print("Error opening file %r: %s" % (mod_path, e)) + except OSError as ex: + print("Error opening file %r: %s" % (mod_path, ex)) return None with file_mod: @@ -89,10 +89,10 @@ def modules_refresh(module_cache=addons_fake_modules): while not l.startswith("bl_info"): try: l = line_iter.readline() - except UnicodeDecodeError as e: + except UnicodeDecodeError as ex: if not error_encoding: error_encoding = True - print("Error reading file as UTF-8:", mod_path, e) + print("Error reading file as UTF-8:", mod_path, ex) return None if len(l) == 0: @@ -101,10 +101,10 @@ def modules_refresh(module_cache=addons_fake_modules): lines.append(l) try: l = line_iter.readline() - except UnicodeDecodeError as e: + except UnicodeDecodeError as ex: if not error_encoding: error_encoding = True - print("Error reading file as UTF-8:", mod_path, e) + print("Error reading file as UTF-8:", mod_path, ex) return None data = "".join(lines) @@ -182,9 +182,11 @@ def modules_refresh(module_cache=addons_fake_modules): mod = None if mod is None: - mod = fake_module(mod_name, - mod_path, - force_support=force_support) + mod = fake_module( + mod_name, + mod_path, + force_support=force_support, + ) if mod: module_cache[mod_name] = mod @@ -200,9 +202,12 @@ def modules(module_cache=addons_fake_modules, *, refresh=True): modules._is_first = False mod_list = list(module_cache.values()) - mod_list.sort(key=lambda mod: (mod.bl_info["category"], - mod.bl_info["name"], - )) + mod_list.sort( + key=lambda mod: ( + mod.bl_info["category"], + mod.bl_info["name"], + ) + ) return mod_list modules._is_first = True @@ -220,8 +225,10 @@ def check(module_name): loaded_default = module_name in _user_preferences.addons mod = sys.modules.get(module_name) - loaded_state = ((mod is not None) and - getattr(mod, "__addon_enabled__", Ellipsis)) + loaded_state = ( + (mod is not None) and + getattr(mod, "__addon_enabled__", Ellipsis) + ) if loaded_state is Ellipsis: print("Warning: addon-module %r found module " diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 2f3569338d5..cf07152d979 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -59,8 +59,8 @@ rna_relative_prop = BoolProperty( def context_path_validate(context, data_path): try: value = eval("context.%s" % data_path) if data_path else Ellipsis - except AttributeError as e: - if str(e).startswith("'NoneType'"): + except AttributeError as ex: + if str(ex).startswith("'NoneType'"): # One of the items in the rna path is None, just ignore this value = Ellipsis else: @@ -159,11 +159,12 @@ class BRUSH_OT_active_index_set(Operator): description="Brush number", ) - _attr_dict = {"sculpt": "use_paint_sculpt", - "vertex_paint": "use_paint_vertex", - "weight_paint": "use_paint_weight", - "image_paint": "use_paint_image", - } + _attr_dict = { + "sculpt": "use_paint_sculpt", + "vertex_paint": "use_paint_vertex", + "weight_paint": "use_paint_weight", + "image_paint": "use_paint_image", + } def execute(self, context): attr = self._attr_dict.get(self.mode) @@ -1018,11 +1019,12 @@ class WM_OT_doc_view_manual(Operator): if url is None: self.report( - {'WARNING'}, - "No reference available %r, " - "Update info in 'rna_manual_reference.py' " - "or callback to bpy.utils.manual_map()" % - self.doc_id) + {'WARNING'}, + "No reference available %r, " + "Update info in 'rna_manual_reference.py' " + "or callback to bpy.utils.manual_map()" % + self.doc_id + ) return {'CANCELLED'} else: import webbrowser @@ -1112,7 +1114,7 @@ class WM_OT_properties_edit(Operator): "use_soft_limits": self.use_soft_limits, "soft_range": (self.soft_min, self.soft_max), "hard_range": (self.min, self.max), - } + } def execute(self, context): from rna_prop_ui import ( @@ -1233,8 +1235,9 @@ class WM_OT_properties_edit(Operator): self.soft_min = prop_ui.get("soft_min", self.min) self.soft_max = prop_ui.get("soft_max", self.max) self.use_soft_limits = ( - self.min != self.soft_min or - self.max != self.soft_max) + self.min != self.soft_min or + self.max != self.soft_max + ) # store for comparison self._cmp_props = self._cmp_props_get() @@ -1603,8 +1606,8 @@ class WM_OT_keyconfig_import(Operator): shutil.copy(self.filepath, path) else: shutil.move(self.filepath, path) - except Exception as e: - self.report({'ERROR'}, "Installing keymap failed: %s" % e) + except Exception as ex: + self.report({'ERROR'}, "Installing keymap failed: %s" % ex) return {'CANCELLED'} # sneaky way to check we're actually running the code. @@ -1838,12 +1841,14 @@ class WM_OT_addon_enable(Operator): info_ver = info.get("blender", (0, 0, 0)) if info_ver > bpy.app.version: - self.report({'WARNING'}, - ("This script was written Blender " - "version %d.%d.%d and might not " - "function (correctly), " - "though it is enabled" % - info_ver)) + self.report( + {'WARNING'}, + "This script was written Blender " + "version %d.%d.%d and might not " + "function (correctly), " + "though it is enabled" % + info_ver + ) return {'FINISHED'} else: diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index deeed2d1c05..79d044c25bf 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -109,17 +109,21 @@ def register(): register_class(cls) # space_userprefs.py - from bpy.props import StringProperty, EnumProperty + from bpy.props import ( + EnumProperty, + StringProperty, + ) from bpy.types import WindowManager def addon_filter_items(self, context): import addon_utils - items = [('All', "All", "All Add-ons"), - ('User', "User", "All Add-ons Installed by User"), - ('Enabled', "Enabled", "All Enabled Add-ons"), - ('Disabled', "Disabled", "All Disabled Add-ons"), - ] + items = [ + ('All', "All", "All Add-ons"), + ('User', "User", "All Add-ons Installed by User"), + ('Enabled', "Enabled", "All Enabled Add-ons"), + ('Disabled', "Disabled", "All Disabled Add-ons"), + ] items_unique = set() @@ -131,26 +135,27 @@ def register(): return items WindowManager.addon_search = StringProperty( - name="Search", - description="Search within the selected filter", - options={'TEXTEDIT_UPDATE'}, - ) + name="Search", + description="Search within the selected filter", + options={'TEXTEDIT_UPDATE'}, + ) WindowManager.addon_filter = EnumProperty( - items=addon_filter_items, - name="Category", - description="Filter add-ons by category", - ) + items=addon_filter_items, + name="Category", + description="Filter add-ons by category", + ) WindowManager.addon_support = EnumProperty( - items=[('OFFICIAL', "Official", "Officially supported"), - ('COMMUNITY', "Community", "Maintained by community developers"), - ('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)") - ], - name="Support", - description="Display support level", - default={'OFFICIAL', 'COMMUNITY'}, - options={'ENUM_FLAG'}, - ) + items=[ + ('OFFICIAL', "Official", "Officially supported"), + ('COMMUNITY', "Community", "Maintained by community developers"), + ('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)") + ], + name="Support", + description="Display support level", + default={'OFFICIAL', 'COMMUNITY'}, + options={'ENUM_FLAG'}, + ) # done... diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index cfeca50a751..fbecf326d32 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -3719,7 +3719,7 @@ void DM_init_origspace(DerivedMesh *dm) BKE_mesh_calc_poly_normal(mp, l, mv, p_nor); axis_dominant_v3_to_m3(mat, p_nor); - BLI_array_empty(vcos_2d); + BLI_array_clear(vcos_2d); BLI_array_reserve(vcos_2d, mp->totloop); for (j = 0; j < mp->totloop; j++, l++) { mul_v3_m3v3(co, mat, mv[l->v].co); diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index e77edb21798..587cc787057 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -1326,7 +1326,7 @@ static void pbvh_bmesh_collapse_edge( /* Note: this could be done with BM_vert_splice(), but that * requires handling other issues like duplicate edges, so doesn't * really buy anything. */ - BLI_buffer_empty(deleted_faces); + BLI_buffer_clear(deleted_faces); BMLoop *l; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 1c3ff352126..9280341b4e4 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -361,7 +361,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, #ifdef USE_DYNSIZE CCGVertHDL fverts[nverts]; #else - BLI_array_empty(fverts); + BLI_array_clear(fverts); BLI_array_grow_items(fverts, nverts); #endif @@ -400,7 +400,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, #ifdef USE_DYNSIZE CCGVertHDL fverts[nverts]; #else - BLI_array_empty(fverts); + BLI_array_clear(fverts); BLI_array_grow_items(fverts, nverts); #endif @@ -744,7 +744,7 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss, #ifdef USE_DYNSIZE CCGVertHDL fVerts[mp->totloop]; #else - BLI_array_empty(fVerts); + BLI_array_clear(fVerts); BLI_array_grow_items(fVerts, mp->totloop); #endif @@ -4583,7 +4583,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, *((int *)ccgSubSurf_getFaceUserData(ss, f)) = vertNum; #ifndef USE_DYNSIZE - BLI_array_empty(loopidx); + BLI_array_clear(loopidx); BLI_array_grow_items(loopidx, numVerts); #endif for (s = 0; s < numVerts; s++) { @@ -4591,7 +4591,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, } #ifndef USE_DYNSIZE - BLI_array_empty(vertidx); + BLI_array_clear(vertidx); BLI_array_grow_items(vertidx, numVerts); #endif for (s = 0; s < numVerts; s++) { diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h index 3ffca818c0d..825acb18e91 100644 --- a/source/blender/blenlib/BLI_array.h +++ b/source/blender/blenlib/BLI_array.h @@ -151,7 +151,7 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static, /** * resets the logical size of an array to zero, but doesn't * free the memory. */ -#define BLI_array_empty(arr) \ +#define BLI_array_clear(arr) \ { _##arr##_count = 0; } (void)0 /** diff --git a/source/blender/blenlib/BLI_buffer.h b/source/blender/blenlib/BLI_buffer.h index 0c0845daf19..0d2ef0dc9b3 100644 --- a/source/blender/blenlib/BLI_buffer.h +++ b/source/blender/blenlib/BLI_buffer.h @@ -77,7 +77,7 @@ enum { (BLI_buffer_at(buffer_, type_, (buffer_)->count - 1) = val_) \ ) -#define BLI_buffer_empty(buffer_) { \ +#define BLI_buffer_clear(buffer_) { \ (buffer_)->count = 0; \ } (void)0 diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 2df8e73c2b8..5a2f07be70a 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -166,7 +166,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) continue; } - BLI_array_empty(faces); + BLI_array_clear(faces); faces = NULL; /* forces different allocatio */ BMW_init(®walker, bm, BMW_ISLAND_MANIFOLD, diff --git a/source/blender/bmesh/operators/bmo_edgenet.c b/source/blender/bmesh/operators/bmo_edgenet.c index 64b092da5c8..744ef866128 100644 --- a/source/blender/bmesh/operators/bmo_edgenet.c +++ b/source/blender/bmesh/operators/bmo_edgenet.c @@ -186,7 +186,7 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op) BLI_array_count_set(edges2, BLI_array_count(edges)); } - BLI_array_empty(edges); + BLI_array_clear(edges); count++; } diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index 81ec2860cf7..d52cb00e172 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -521,7 +521,7 @@ static void hull_from_bullet( int j; /* Get face vertex indices */ - BLI_array_empty(fvi); + BLI_array_clear(fvi); BLI_array_grow_items(fvi, len); plConvexHullGetFaceVertices(hull, i, fvi); diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 894129b4a33..7d3419b5910 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -1011,8 +1011,8 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) /* figure out which pattern to use */ - BLI_array_empty(edges); - BLI_array_empty(verts); + BLI_array_clear(edges); + BLI_array_clear(verts); BLI_array_grow_items(edges, face->len); BLI_array_grow_items(verts, face->len); @@ -1140,7 +1140,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) face = fd->face; /* figure out which pattern to use */ - BLI_array_empty(verts); + BLI_array_clear(verts); pat = fd->pat; @@ -1148,8 +1148,8 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) int vlen; /* ok, no pattern. we still may be able to do something */ - BLI_array_empty(loops); - BLI_array_empty(loops_split); + BLI_array_clear(loops); + BLI_array_clear(loops_split); /* for case of two edges, connecting them shouldn't be too hard */ BLI_array_grow_items(loops, face->len); diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index a18c4405a31..51238c92505 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -3736,7 +3736,7 @@ static int bevel_edge_order_extend(BMesh *bm, BevVert *bv, int i) tryj = bevel_edge_order_extend(bm, bv, j + 1); if (tryj > bestj || (tryj == bestj && edges_face_connected_at_vert(bv->edges[tryj].e, bv->edges[0].e))) { bestj = tryj; - BLI_array_empty(save_path); + BLI_array_clear(save_path); for (k = j + 1; k <= bestj; k++) { BLI_array_append(save_path, bv->edges[k].e); } diff --git a/source/blender/bmesh/tools/bmesh_separate.c b/source/blender/bmesh/tools/bmesh_separate.c index 287b4125330..b3d0c339885 100644 --- a/source/blender/bmesh/tools/bmesh_separate.c +++ b/source/blender/bmesh/tools/bmesh_separate.c @@ -122,7 +122,7 @@ void BM_mesh_separate_faces( /* Perform the split */ BM_face_loop_separate_multi(bm, loop_split.data, loop_split.count); - BLI_buffer_empty(&loop_split); + BLI_buffer_clear(&loop_split); } } while ((l_iter = l_iter->next) != l_first); } diff --git a/source/blender/editors/mesh/editmesh_intersect.c b/source/blender/editors/mesh/editmesh_intersect.c index 3498c6246d7..d681d904e74 100644 --- a/source/blender/editors/mesh/editmesh_intersect.c +++ b/source/blender/editors/mesh/editmesh_intersect.c @@ -400,7 +400,7 @@ static void bm_face_split_by_edges( bm, f, edge_net_temp_buf->data, edge_net_temp_buf->count, &face_arr, &face_arr_len); - BLI_buffer_empty(edge_net_temp_buf); + BLI_buffer_clear(edge_net_temp_buf); if (face_arr_len) { int i; diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 03a5f4dddc8..479b43d50f0 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1704,7 +1704,7 @@ static int uv_remove_doubles_exec(bContext *C, wmOperator *op) float uv_min[2]; float uv_max[2]; - BLI_array_empty(loop_arr); + BLI_array_clear(loop_arr); BLI_array_append(loop_arr, vert_arr[uv_a_index].uv_loop); uv_a = vert_arr[uv_a_index].uv_loop->uv; diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 29c908ff900..2a3a2b84223 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -2185,7 +2185,7 @@ static void p_chart_simplify_compute(PChart *chart) e->u.nextcollapse = NULL; /* pop edge collapse out of heap one by one */ - while (!BLI_heap_empty(heap)) { + while (!BLI_heap_is_empty(heap)) { if (ncollapsed == NCOLLAPSE) break; |