misc edits

- fix for missing None check with recent 'Hidden Wire' draw option.
- avoid int overflow with mesh selection.
- remove ';' outside of functions.
This commit is contained in:
Campbell Barton 2013-07-20 15:07:57 +00:00
parent 8ff67f12c7
commit 49c61e169b
8 changed files with 14 additions and 13 deletions

@ -2540,7 +2540,7 @@ class VIEW3D_PT_view3d_display(Panel):
view = context.space_data
scene = context.scene
gs = scene.game_settings
ob = context.object
obj = context.object
col = layout.column()
col.prop(view, "show_only_render")
@ -2580,7 +2580,7 @@ class VIEW3D_PT_view3d_display(Panel):
if view.use_matcap:
col.template_icon_view(view, "matcap_icon")
col.prop(view, "show_backface_culling")
if ob.mode == 'EDIT' and view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}:
if obj and obj.mode == 'EDIT' and view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}:
col.prop(view, "show_occlude_wire")
layout.separator()

@ -72,7 +72,7 @@ struct BVHTree {
/* optimization, ensure we stay small */
BLI_STATIC_ASSERT((sizeof(void *) == 8 && sizeof(BVHTree) <= 48) ||
(sizeof(void *) == 4 && sizeof(BVHTree) <= 32),
"over sized");
"over sized")
typedef struct BVHOverlapData {
BVHTree *tree1, *tree2;
@ -603,6 +603,7 @@ static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data)
data->branches_on_level[0] = 1;
/* We could stop the loop first (but I am lazy to find out when) */
/* note: this often causes integer overflow, may be worth avoiding? - campbell */
for (depth = 1; depth < 32; depth++) {
data->branches_on_level[depth] = data->branches_on_level[depth - 1] * data->tree_type;
data->leafs_per_child[depth] = data->leafs_per_child[depth - 1] / data->tree_type;

@ -812,12 +812,12 @@ static int mask_select_more_less(bContext *C, bool more)
int i;
bool start_sel, end_sel, prev_sel, cur_sel, cyclic = spline->flag & MASK_SPLINE_CYCLIC;
// reselect point if any handle is selected to make the result more predictable
/* reselect point if any handle is selected to make the result more predictable */
for (i = 0; i < spline->tot_point; i++) {
BKE_mask_point_select_set(spline->points + i, MASKPOINT_ISSEL_ANY(spline->points + i));
}
// select more/less does not affect empty/single point splines
/* select more/less does not affect empty/single point splines */
if (spline->tot_point < 2) {
continue;
}

@ -460,7 +460,7 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist, const bool sel, c
0, NULL, NULL);
}
eve = BM_vert_at_index(vc->em->bm, index - 1);
eve = index ? BM_vert_at_index(vc->em->bm, index - 1) : NULL;
if (eve && distance < *r_dist) {
*r_dist = distance;
@ -552,7 +552,7 @@ BMEdge *EDBM_edge_find_nearest(ViewContext *vc, float *r_dist)
view3d_validate_backbuf(vc);
index = view3d_sample_backbuf_rect(vc, vc->mval, 50, bm_solidoffs, bm_wireoffs, &distance, 0, NULL, NULL);
eed = BM_edge_at_index(vc->em->bm, index - 1);
eed = index ? BM_edge_at_index(vc->em->bm, index - 1) : NULL;
if (eed && distance < *r_dist) {
*r_dist = distance;
@ -625,7 +625,7 @@ BMFace *EDBM_face_find_nearest(ViewContext *vc, float *r_dist)
view3d_validate_backbuf(vc);
index = view3d_sample_backbuf(vc, vc->mval[0], vc->mval[1]);
efa = BM_face_at_index(vc->em->bm, index - 1);
efa = index ? BM_face_at_index(vc->em->bm, index - 1) : NULL;
if (efa) {
struct { float mval_fl[2]; float dist; BMFace *toFace; } data;

@ -1200,7 +1200,7 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int
*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
}
if ((*index) <= 0 || (*index) > (unsigned int)me->totpoly)
if ((*index) == 0 || (*index) > (unsigned int)me->totpoly)
return false;
(*index)--;
@ -1321,7 +1321,7 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
}
if ((*index) <= 0 || (*index) > (unsigned int)me->totvert)
if ((*index) == 0 || (*index) > (unsigned int)me->totvert)
return false;
(*index)--;

@ -333,7 +333,7 @@ int imapaint_pick_face(ViewContext *vc, const int mval[2], unsigned int *index,
/* sample only on the exact position */
*index = view3d_sample_backbuf(vc, mval[0], mval[1]);
if ((*index) <= 0 || (*index) > (unsigned int)totface) {
if ((*index) == 0 || (*index) > (unsigned int)totface) {
return 0;
}

@ -61,7 +61,7 @@
/* the types are from the jpeg lib */
static void jpeg_error(j_common_ptr cinfo)
#ifdef __GNUC__
__attribute__((noreturn));
__attribute__((noreturn))
#endif
;
static void init_source(j_decompress_ptr cinfo);

@ -972,7 +972,7 @@ static int rna_Mesh_polygon_string_layers_length(PointerRNA *ptr)
}
/* Skin vertices */
DEFINE_CUSTOMDATA_LAYER_COLLECTION(skin_vertice, vdata, CD_MVERT_SKIN);
DEFINE_CUSTOMDATA_LAYER_COLLECTION(skin_vertice, vdata, CD_MVERT_SKIN)
static char *rna_MeshSkinVertexLayer_path(PointerRNA *ptr)
{