Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Thu, 1 Feb 2018 03:02:33 +0000 (14:02 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 1 Feb 2018 03:02:33 +0000 (14:02 +1100)
17 files changed:
release/scripts/modules/addon_utils.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/__init__.py
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/pbvh_bmesh.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenlib/BLI_array.h
source/blender/blenlib/BLI_buffer.h
source/blender/bmesh/operators/bmo_dissolve.c
source/blender/bmesh/operators/bmo_edgenet.c
source/blender/bmesh/operators/bmo_hull.c
source/blender/bmesh/operators/bmo_subdivide.c
source/blender/bmesh/tools/bmesh_bevel.c
source/blender/bmesh/tools/bmesh_separate.c
source/blender/editors/mesh/editmesh_intersect.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_parametrizer.c

index 51e3e65b78cc72143c475bfa8ea4dc1db3193bf9..97fc45189f25aba45cacc7f87320694450001a35 100644 (file)
@@ -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 "
index 2f3569338d527d3430a8478fc65d9ba12b194a18..cf07152d9797fb9dd1646cb1ad564d796a3d9945 100644 (file)
@@ -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:
 
index deeed2d1c057c0fc2c6d640ab4e6f549ac7033de..79d044c25bf9b8e8307a2c0502a85ecc55c19471 100644 (file)
@@ -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...
 
 
index cfeca50a751a4185498eb7e427d8f3c229c68a46..fbecf326d3287bebe4460b42639dff71e382d033 100644 (file)
@@ -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);
index e77edb21798b06da4e9b1fac877eb3e071c69c03..587cc78705736c9a9ef79c6e1950ad4a7fc3cac4 100644 (file)
@@ -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;
 
index 1c3ff3521265c6f860b14fc2130402dbfb6537ce..9280341b4e4dd25336a7caa6bc85ebd573668f56 100644 (file)
@@ -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++) {
index 3ffca818c0d52bf783cf62a2e1a3e591b2215d08..825acb18e91c97252648616b566b1e0e14130609 100644 (file)
@@ -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
 
 /**
index 0c0845daf19244f2dbf07f49b9449b9aef97b671..0d2ef0dc9b3d8505832dd79666ce5f92dadac478 100644 (file)
@@ -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
 
index 2df8e73c2b800b56c78d49c864f7f6095a4a6f93..5a2f07be70a1a7603d638d356f4124f335f3bb90 100644 (file)
@@ -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(&regwalker, bm, BMW_ISLAND_MANIFOLD,
index 64b092da5c8650dfccf4250e87fd325b5ec6bb4f..744ef866128b6766932e4bd2a9cfad2d254954f1 100644 (file)
@@ -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++;
        }
 
index 81ec2860cf73aa06b979497128392124ed81baf9..d52cb00e172246273679feff435f13f0a2a3affb 100644 (file)
@@ -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);
 
index 894129b4a332ad28dcce50b34948e506ceb2ac97..7d3419b591014c5064e59d62b92ef574185d8df5 100644 (file)
@@ -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);
index a18c4405a31d312bb70d8067f426f0f3f95e128c..51238c925050107c8fa27623857aa628ce464c78 100644 (file)
@@ -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);
                        }
index 287b4125330ece5a64f34e0d985a0ef697ba34b3..b3d0c3398858c2e4577c86f8b73e2549aa526997 100644 (file)
@@ -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);
        }
index 3498c6246d74be7b555acb6e86e235ecad4cae75..d681d904e74a9441011fbaf1ff8d54386b66ac68 100644 (file)
@@ -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;
index 03a5f4dddc89f63316b1ca1a3e4a6074c221c20a..479b43d50f0f247ca8268a64ae49c02926bff88a 100644 (file)
@@ -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;
index 29c908ff900aaafc2adad20a094fcc60f9e6f2ef..2a3a2b842230cd51b3f73c79d5dcf290f94a6f00 100644 (file)
@@ -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;