Merge branch 'master' into blender2.8
This commit is contained in:
@@ -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 "
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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...
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user