Code Cleanup: rename vars for detecting change to be more consistent

rename change/is_change/is_changed/modified -> changed
also use bools over int/short/char and once accidental float.
This commit is contained in:
Campbell Barton 2013-11-26 06:39:14 +11:00
parent 5928af11ef
commit 63caaa2b12
74 changed files with 655 additions and 645 deletions

View File

@ -476,7 +476,7 @@ void nodeClearActiveID(struct bNodeTree *ntree, short idtype);
struct bNode *nodeGetActiveTexture(struct bNodeTree *ntree);
void nodeUpdate(struct bNodeTree *ntree, struct bNode *node);
int nodeUpdateID(struct bNodeTree *ntree, struct ID *id);
bool nodeUpdateID(struct bNodeTree *ntree, struct ID *id);
void nodeUpdateInternalLinks(struct bNodeTree *ntree, struct bNode *node);
void nodeSynchronizeID(struct bNode *node, bool copy_to_id);

View File

@ -3315,7 +3315,7 @@ bool DM_is_valid(DerivedMesh *dm)
const bool do_fixes = false;
bool is_valid = true;
bool is_change = true;
bool changed = true;
is_valid &= BKE_mesh_validate_all_customdata(
dm->getVertDataLayout(dm),
@ -3323,7 +3323,7 @@ bool DM_is_valid(DerivedMesh *dm)
dm->getLoopDataLayout(dm),
dm->getPolyDataLayout(dm),
0, /* setting mask here isn't useful, gives false positives */
do_verbose, do_fixes, &is_change);
do_verbose, do_fixes, &changed);
is_valid &= BKE_mesh_validate_arrays(
NULL,
@ -3333,9 +3333,9 @@ bool DM_is_valid(DerivedMesh *dm)
dm->getLoopArray(dm), dm->getNumLoops(dm),
dm->getPolyArray(dm), dm->getNumPolys(dm),
dm->getVertDataArray(dm, CD_MDEFORMVERT),
do_verbose, do_fixes, &is_change);
do_verbose, do_fixes, &changed);
BLI_assert(is_change == false);
BLI_assert(changed == false);
return is_valid;
}

View File

@ -335,15 +335,15 @@ int bone_autoside_name(char name[MAXBONENAME], int UNUSED(strip_number), short a
* - otherwise, just append to end
*/
if (extension[0]) {
int change = 1;
bool changed = true;
while (change) { /* remove extensions */
change = 0;
while (changed) { /* remove extensions */
changed = false;
if (len > 2 && basename[len - 2] == '.') {
if (basename[len - 1] == 'L' || basename[len - 1] == 'R') { /* L R */
basename[len - 2] = '\0';
len -= 2;
change = 1;
changed = true;
}
}
else if (len > 3 && basename[len - 3] == '.') {
@ -352,7 +352,7 @@ int bone_autoside_name(char name[MAXBONENAME], int UNUSED(strip_number), short a
{
basename[len - 3] = '\0';
len -= 3;
change = 1;
changed = true;
}
}
else if (len > 4 && basename[len - 4] == '.') {
@ -361,7 +361,7 @@ int bone_autoside_name(char name[MAXBONENAME], int UNUSED(strip_number), short a
{
basename[len - 4] = '\0';
len -= 4;
change = 1;
changed = true;
}
}
}

View File

@ -3658,30 +3658,30 @@ bool BKE_nurb_check_valid_v(struct Nurb *nu)
bool BKE_nurb_order_clamp_u(struct Nurb *nu)
{
bool change = false;
bool changed = false;
if (nu->pntsu < nu->orderu) {
nu->orderu = nu->pntsu;
change = true;
changed = true;
}
if (((nu->flagu & CU_NURB_CYCLIC) == 0) && (nu->flagu & CU_NURB_BEZIER)) {
CLAMP(nu->orderu, 3, 4);
change = true;
changed = true;
}
return change;
return changed;
}
bool BKE_nurb_order_clamp_v(struct Nurb *nu)
{
bool change = false;
bool changed = false;
if (nu->pntsv < nu->orderv) {
nu->orderv = nu->pntsv;
change = true;
changed = true;
}
if (((nu->flagv & CU_NURB_CYCLIC) == 0) && (nu->flagv & CU_NURB_BEZIER)) {
CLAMP(nu->orderv, 3, 4);
change = true;
changed = true;
}
return change;
return changed;
}
bool BKE_nurb_type_convert(Nurb *nu, const short type, const bool use_handles)

View File

@ -1296,7 +1296,7 @@ bool CustomData_merge(const struct CustomData *source, struct CustomData *dest,
CustomDataLayer *layer, *newlayer;
void *data;
int i, type, number = 0, lasttype = -1, lastactive = 0, lastrender = 0, lastclone = 0, lastmask = 0, lastflag = 0;
bool change = false;
bool changed = false;
for (i = 0; i < source->totlayer; ++i) {
layer = &source->layers[i];
@ -1346,12 +1346,12 @@ bool CustomData_merge(const struct CustomData *source, struct CustomData *dest,
newlayer->active_clone = lastclone;
newlayer->active_mask = lastmask;
newlayer->flag |= lastflag & (CD_FLAG_EXTERNAL | CD_FLAG_IN_MEMORY);
change = true;
changed = true;
}
}
CustomData_update_typemap(dest);
return change;
return changed;
}
void CustomData_copy(const struct CustomData *source, struct CustomData *dest,

View File

@ -1466,7 +1466,8 @@ static void flush_update_node(Main *bmain, DagNode *node, unsigned int layer, in
{
DagAdjList *itA;
Object *ob, *obc;
int oldflag, changed = 0;
int oldflag;
bool changed = false;
unsigned int all_layer;
node->lasttime = curtime;

View File

@ -61,7 +61,7 @@
bool free_gpencil_strokes(bGPDframe *gpf)
{
bGPDstroke *gps, *gpsn;
bool modified = gpf->strokes.first != NULL;
bool changed = (gpf->strokes.first != NULL);
/* error checking */
if (gpf == NULL)
@ -76,7 +76,7 @@ bool free_gpencil_strokes(bGPDframe *gpf)
BLI_freelinkN(&gpf->strokes, gps);
}
return modified;
return changed;
}
/* Free all of a gp-layer's frames */
@ -473,18 +473,18 @@ bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, short addnew)
/* delete the given frame from a layer */
bool gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf)
{
bool modified = false;
bool changed = false;
/* error checking */
if (ELEM(NULL, gpl, gpf))
return false;
/* free the frame and its data */
modified = free_gpencil_strokes(gpf);
changed = free_gpencil_strokes(gpf);
BLI_freelinkN(&gpl->frames, gpf);
gpl->actframe = NULL;
return modified;
return changed;
}
/* get the active gp-layer for editing */

View File

@ -1815,13 +1815,13 @@ MaskLayerShape *BKE_mask_layer_shape_duplicate(MaskLayerShape *masklay_shape)
bool BKE_mask_layer_shape_unlink(MaskLayer *masklay, MaskLayerShape *masklay_shape)
{
bool modified = masklay_shape != NULL;
bool changed = (masklay_shape != NULL);
BLI_remlink(&masklay->splines_shapes, masklay_shape);
BKE_mask_layer_shape_free(masklay_shape);
return modified;
return changed;
}
static int mask_layer_shape_sort_cb(void *masklay_shape_a_ptr, void *masklay_shape_b_ptr)

View File

@ -2375,7 +2375,7 @@ bool BKE_mball_minmax_ex(MetaBall *mb, float min[3], float max[3],
{
const float scale = obmat ? mat4_to_scale(obmat) : 1.0f;
MetaElem *ml;
bool change = false;
bool changed = false;
float centroid[3], vec[3];
INIT_MINMAX(min, max);
@ -2398,11 +2398,11 @@ bool BKE_mball_minmax_ex(MetaBall *mb, float min[3], float max[3],
add_v3_fl(vec, scale_mb * i);
minmax_v3v3_v3(min, max, vec);
}
change = true;
changed = true;
}
}
return change;
return changed;
}

View File

@ -216,7 +216,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
MPoly *mpolys, unsigned int totpoly,
MDeformVert *dverts, /* assume totvert length */
const bool do_verbose, const bool do_fixes,
bool *r_change)
bool *r_changed)
{
# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = true; } (void)0
# define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1)
@ -854,7 +854,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
PRINT_MSG("%s: finished\n\n", __func__);
*r_change = (verts_fixed || vert_weights_fixed || do_polyloop_free || do_edge_free || do_edge_recalc || msel_fixed);
*r_changed = (verts_fixed || vert_weights_fixed || do_polyloop_free || do_edge_free || do_edge_recalc || msel_fixed);
return is_valid;
}
@ -963,7 +963,7 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
int BKE_mesh_validate(Mesh *me, const int do_verbose)
{
bool is_valid = true;
bool is_change;
bool changed;
if (do_verbose) {
printf("MESH: %s\n", me->id.name + 2);
@ -973,7 +973,7 @@ int BKE_mesh_validate(Mesh *me, const int do_verbose)
&me->vdata, &me->edata, &me->ldata, &me->pdata,
true,
do_verbose, true,
&is_change);
&changed);
is_valid &= BKE_mesh_validate_arrays(
me,
@ -984,9 +984,9 @@ int BKE_mesh_validate(Mesh *me, const int do_verbose)
me->mpoly, me->totpoly,
me->dvert,
do_verbose, true,
&is_change);
&changed);
if (is_change) {
if (changed) {
DAG_id_tag_update(&me->id, OB_RECALC_DATA);
return true;
}

View File

@ -2979,22 +2979,22 @@ void nodeUpdate(bNodeTree *ntree, bNode *node)
ntree->is_updating = FALSE;
}
int nodeUpdateID(bNodeTree *ntree, ID *id)
bool nodeUpdateID(bNodeTree *ntree, ID *id)
{
bNode *node;
int change = FALSE;
bool changed = false;
if (ELEM(NULL, id, ntree))
return change;
return changed;
/* avoid reentrant updates, can be caused by RNA update callbacks */
if (ntree->is_updating)
return change;
ntree->is_updating = TRUE;
return changed;
ntree->is_updating = true;
for (node = ntree->nodes.first; node; node = node->next) {
if (node->id == id) {
change = TRUE;
changed = true;
node->update |= NODE_UPDATE_ID;
if (node->typeinfo->updatefunc)
node->typeinfo->updatefunc(ntree, node);
@ -3008,7 +3008,7 @@ int nodeUpdateID(bNodeTree *ntree, ID *id)
}
ntree->is_updating = FALSE;
return change;
return changed;
}
void nodeUpdateInternalLinks(bNodeTree *ntree, bNode *node)

View File

@ -2411,7 +2411,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
BoundBox bb;
float vec[3];
int a;
bool change = false;
bool changed = false;
switch (ob->type) {
case OB_CURVE:
@ -2424,7 +2424,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
mul_m4_v3(ob->obmat, bb.vec[a]);
minmax_v3v3_v3(min_r, max_r, bb.vec[a]);
}
change = TRUE;
changed = true;
break;
}
case OB_LATTICE:
@ -2441,7 +2441,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
}
}
}
change = TRUE;
changed = true;
break;
}
case OB_ARMATURE:
@ -2459,7 +2459,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
minmax_v3v3_v3(min_r, max_r, vec);
change = TRUE;
changed = true;
}
}
}
@ -2476,7 +2476,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
mul_m4_v3(ob->obmat, bb.vec[a]);
minmax_v3v3_v3(min_r, max_r, bb.vec[a]);
}
change = TRUE;
changed = true;
}
break;
}
@ -2484,8 +2484,8 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
{
float ob_min[3], ob_max[3];
change = BKE_mball_minmax_ex(ob->data, ob_min, ob_max, ob->obmat, 0);
if (change) {
changed = BKE_mball_minmax_ex(ob->data, ob_min, ob_max, ob->obmat, 0);
if (changed) {
minmax_v3v3_v3(min_r, max_r, ob_min);
minmax_v3v3_v3(min_r, max_r, ob_max);
}
@ -2493,7 +2493,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
}
}
if (change == FALSE) {
if (changed == false) {
float size[3];
copy_v3_v3(size, ob->size);
@ -2539,7 +2539,7 @@ bool BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_m
minmax_v3v3_v3(r_min, r_max, vec);
}
ok = TRUE;
ok = true;
}
}
}

View File

@ -599,7 +599,7 @@ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sca
bUnitDef *unit;
char str_tmp[TEMP_STR_SIZE];
int change = 0;
int changed = 0;
if (usys == NULL || usys->units[0].name == NULL) {
return 0;
@ -618,7 +618,7 @@ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sca
for (unit = usys->units; unit->name; unit++) {
/* in case there are multiple instances */
while (unit_replace(str, len_max, str_tmp, scale_pref, unit))
change = 1;
changed = true;
}
unit = NULL;
@ -635,7 +635,7 @@ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sca
int ofs = 0;
/* in case there are multiple instances */
while ((ofs = unit_replace(str + ofs, len_max - ofs, str_tmp, scale_pref, unit)))
change = 1;
changed = true;
}
}
}
@ -643,7 +643,7 @@ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sca
}
unit = NULL;
if (change == 0) {
if (changed == 0) {
/* no units given so infer a unit from the previous string or default */
if (str_prev) {
/* see which units the original value had */
@ -701,7 +701,7 @@ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sca
}
}
return change;
return changed;
}
/* 45µm --> 45um */

View File

@ -413,22 +413,22 @@ void BLI_rctf_interp(rctf *rect, const rctf *rect_a, const rctf *rect_b, const f
bool BLI_rctf_clamp_pt_v(const struct rctf *rect, float xy[2])
{
bool change = false;
if (xy[0] < rect->xmin) { xy[0] = rect->xmin; change = true; }
if (xy[0] > rect->xmax) { xy[0] = rect->xmax; change = true; }
if (xy[1] < rect->ymin) { xy[1] = rect->ymin; change = true; }
if (xy[1] > rect->ymax) { xy[1] = rect->ymax; change = true; }
return change;
bool changed = false;
if (xy[0] < rect->xmin) { xy[0] = rect->xmin; changed = true; }
if (xy[0] > rect->xmax) { xy[0] = rect->xmax; changed = true; }
if (xy[1] < rect->ymin) { xy[1] = rect->ymin; changed = true; }
if (xy[1] > rect->ymax) { xy[1] = rect->ymax; changed = true; }
return changed;
}
bool BLI_rcti_clamp_pt_v(const struct rcti *rect, int xy[2])
{
bool change = false;
if (xy[0] < rect->xmin) { xy[0] = rect->xmin; change = true; }
if (xy[0] > rect->xmax) { xy[0] = rect->xmax; change = true; }
if (xy[1] < rect->ymin) { xy[1] = rect->ymin; change = true; }
if (xy[1] > rect->ymax) { xy[1] = rect->ymax; change = true; }
return change;
bool changed = false;
if (xy[0] < rect->xmin) { xy[0] = rect->xmin; changed = true; }
if (xy[0] > rect->xmax) { xy[0] = rect->xmax; changed = true; }
if (xy[1] < rect->ymin) { xy[1] = rect->ymin; changed = true; }
if (xy[1] > rect->ymax) { xy[1] = rect->ymax; changed = true; }
return changed;
}
bool BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, const float limit)

View File

@ -484,7 +484,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
const bool use_cyclic = BMO_slot_bool_get(op->slots_in, "use_cyclic") && (use_merge == false);
const int twist_offset = BMO_slot_int_get(op->slots_in, "twist_offset");
int count;
bool change = false;
bool changed = false;
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
@ -546,13 +546,13 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
if (use_pairs) {
el_store = el_store->next;
}
change = true;
changed = true;
}
cleanup:
BM_mesh_edgeloops_free(&eloops);
if (change) {
if (changed) {
if (use_merge == false) {
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_OUT);
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EDGE_OUT);

View File

@ -594,7 +594,7 @@ void bmo_grid_fill_exec(BMesh *bm, BMOperator *op)
const bool use_interp_simple = BMO_slot_bool_get(op->slots_in, "use_interp_simple");
int count;
bool change = false;
bool changed = false;
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
count = BM_mesh_edgeloops_find(bm, &eloops, bm_edge_test_cb, (void *)bm);
@ -690,14 +690,14 @@ void bmo_grid_fill_exec(BMesh *bm, BMOperator *op)
bm_grid_fill(bm, estore_a, estore_b, estore_rail_a, estore_rail_b,
mat_nr, use_smooth, use_interp_simple);
change = true;
changed = true;
cleanup:
BM_mesh_edgeloops_free(&eloops);
BM_mesh_edgeloops_free(&eloops_rail);
if (change) {
if (changed) {
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_OUT);
}
}

View File

@ -1070,7 +1070,7 @@ void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op)
BMOIter siter;
BMEdge *e;
int count;
bool change = false;
bool changed = false;
const int cuts = BMO_slot_int_get(op->slots_in, "cuts");
const int interp_mode = BMO_slot_int_get(op->slots_in, "interp_mode");
@ -1166,7 +1166,7 @@ void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op)
bm_edgering_pair_ringsubd(bm, lpair, el_store_a, el_store_b,
interp_mode, cuts, smooth, falloff_cache);
bm_edgering_pair_store_free(lpair, interp_mode);
change = true;
changed = true;
}
else {
BMO_error_raise(bm, op, BMERR_INVALID_SELECTION,
@ -1217,7 +1217,7 @@ void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op)
bm_edgering_pair_ringsubd(bm, lpair, el_store_a, el_store_b,
interp_mode, cuts, smooth, falloff_cache);
bm_edgering_pair_store_free(lpair, interp_mode);
change = true;
changed = true;
}
BLI_assert(bm_verts_tag_count(bm) == 0);
@ -1229,7 +1229,7 @@ cleanup:
BM_mesh_edgeloops_free(&eloops_rim);
/* flag output */
if (change) {
if (changed) {
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_OUT);
}
}

View File

@ -2152,7 +2152,8 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
bAnimContext ac;
rcti rect;
short selectmode = 0;
int gesture_mode, extend;
int gesture_mode;
bool extend;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)

View File

@ -125,11 +125,11 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f
{
TimeMarker *marker;
float cfra = (float)CFRA;
int changed = 0;
int changed_tot = 0;
/* sanity check */
if (markers == NULL)
return changed;
return changed_tot;
/* affect selected markers - it's unlikely that we will want to affect all in this way? */
for (marker = markers->first; marker; marker = marker->next) {
@ -144,7 +144,7 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f
(side == 'R' && marker->frame >= cfra))
{
marker->frame += (int)floorf(value + 0.5f);
changed++;
changed_tot++;
}
break;
}
@ -152,14 +152,14 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f
{
/* rescale the distance between the marker and the current frame */
marker->frame = cfra + (int)floorf(((float)(marker->frame - cfra) * value) + 0.5f);
changed++;
changed_tot++;
break;
}
}
}
}
return changed;
return changed_tot;
}
/* --------------------------------- */
@ -1083,7 +1083,7 @@ static int ed_marker_select(bContext *C, const wmEvent *event, bool extend, bool
static int ed_marker_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
bool extend = RNA_boolean_get(op->ptr, "extend");
const bool extend = RNA_boolean_get(op->ptr, "extend");
bool camera = false;
#ifdef DURIAN_CAMERA_SWITCH
camera = RNA_boolean_get(op->ptr, "camera");
@ -1148,7 +1148,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
TimeMarker *marker;
float xminf, xmaxf, yminf, ymaxf;
int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
int extend = RNA_boolean_get(op->ptr, "extend");
bool extend = RNA_boolean_get(op->ptr, "extend");
rcti rect;
WM_operator_properties_border_to_rcti(op, &rect);
@ -1270,7 +1270,7 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
ListBase *markers = ED_context_get_markers(C);
TimeMarker *marker, *nmarker;
short changed = 0;
bool changed = false;
if (markers == NULL)
return OPERATOR_CANCELLED;
@ -1279,7 +1279,7 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
nmarker = marker->next;
if (marker->flag & SELECT) {
BLI_freelinkN(markers, marker);
changed = 1;
changed = true;
}
}

View File

@ -107,7 +107,7 @@ void delete_fcurve_key(FCurve *fcu, int index, short do_recalc)
bool delete_fcurve_keys(FCurve *fcu)
{
int i;
bool modified = false;
bool changed = false;
if (fcu->bezt == NULL) /* ignore baked curves */
return false;
@ -118,7 +118,7 @@ bool delete_fcurve_keys(FCurve *fcu)
memmove(&fcu->bezt[i], &fcu->bezt[i + 1], sizeof(BezTriple) * (fcu->totvert - i - 1));
fcu->totvert--;
i--;
modified = true;
changed = true;
}
}
@ -126,7 +126,7 @@ bool delete_fcurve_keys(FCurve *fcu)
if (fcu->totvert == 0)
clear_fcurve_keys(fcu);
return modified;
return changed;
}

View File

@ -1476,7 +1476,7 @@ void ANIM_OT_keyframe_delete(wmOperatorType *ot)
static int clear_anim_v3d_exec(bContext *C, wmOperator *op)
{
int num_removed = 0;
int removed_tot = 0;
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
@ -1517,7 +1517,7 @@ static int clear_anim_v3d_exec(bContext *C, wmOperator *op)
/* delete F-Curve completely */
if (can_delete) {
ANIM_fcurve_delete_from_animdata(NULL, adt, fcu);
num_removed++;
removed_tot++;
}
}
}
@ -1527,8 +1527,8 @@ static int clear_anim_v3d_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
if (num_removed > 0)
BKE_reportf(op->reports, RPT_INFO, "Deleted %d animation f-curves from selected objects", num_removed);
if (removed_tot > 0)
BKE_reportf(op->reports, RPT_INFO, "Deleted %d animation f-curves from selected objects", removed_tot);
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);

View File

@ -1117,7 +1117,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *op)
EditBone *curBone, *ebone_next;
bConstraint *con;
Object *obedit = CTX_data_edit_object(C); // XXX get from context
int removed_num = 0;
int removed_tot = 0;
arm = obedit->data;
/* cancel if nothing selected */
@ -1174,12 +1174,12 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *op)
if (curBone->flag & BONE_SELECTED) {
if (curBone == arm->act_edbone) arm->act_edbone = NULL;
ED_armature_edit_bone_remove(arm, curBone);
removed_num++;
removed_tot++;
}
}
}
BKE_reportf(op->reports, RPT_INFO, "Deleted %d bones", removed_num);
BKE_reportf(op->reports, RPT_INFO, "Deleted %d bones", removed_tot);
ED_armature_sync_selection(arm->edbo);

View File

@ -174,7 +174,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, const wmEv
{
bArmature *arm;
EditBone *bone, *curBone, *next;
int extend = RNA_boolean_get(op->ptr, "extend");
const bool extend = RNA_boolean_get(op->ptr, "extend");
Object *obedit = CTX_data_edit_object(C);
arm = obedit->data;
@ -1157,7 +1157,7 @@ static int armature_shortest_path_pick_invoke(bContext *C, wmOperator *op, const
EditBone *ebone_src, *ebone_dst;
EditBone *ebone_isect_parent = NULL;
EditBone *ebone_isect_child[2];
bool change;
bool changed;
view3d_operator_needs_opengl(C);
@ -1195,25 +1195,25 @@ static int armature_shortest_path_pick_invoke(bContext *C, wmOperator *op, const
{
armature_shortest_path_select(arm, ebone_isect_parent, ebone_src, false, false);
armature_shortest_path_select(arm, ebone_isect_parent, ebone_dst, false, false);
change = true;
changed = true;
}
else {
/* unselectable */
change = false;
changed = false;
}
}
else {
if (armature_shortest_path_select(arm, ebone_src, ebone_dst, true, true)) {
armature_shortest_path_select(arm, ebone_src, ebone_dst, true, false);
change = true;
changed = true;
}
else {
/* unselectable */
change = false;
changed = false;
}
}
if (change) {
if (changed) {
arm->act_edbone = ebone_dst;
ED_armature_sync_selection(arm->edbo);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);

View File

@ -697,7 +697,7 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link)
static void RIG_reconnectControlBones(RigGraph *rg)
{
RigControl *ctrl;
int change = 1;
bool changed = true;
/* first pass, link to deform bones */
for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
@ -812,8 +812,8 @@ static void RIG_reconnectControlBones(RigGraph *rg)
/* second pass, make chains in control bones */
while (change) {
change = 0;
while (changed) {
changed = false;
for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
/* if control is not linked yet */
@ -865,7 +865,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
/* check if parent is already linked */
if (ctrl_parent && ctrl_parent->link) {
RIG_parentControl(ctrl, ctrl_parent->bone);
change = 1;
changed = true;
}
else {
/* check childs */
@ -873,7 +873,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
/* if a child is linked, link to that one */
if (ctrl_child->link && ctrl_child->bone->parent == ctrl->bone) {
RIG_parentControl(ctrl, ctrl_child->bone);
change = 1;
changed = true;
break;
}
}

View File

@ -105,7 +105,7 @@ static int poselib_get_free_index(bAction *act)
{
TimeMarker *marker;
int low = 0, high = 0;
short changed = 0;
bool changed = false;
/* sanity checks */
if (ELEM(NULL, act, act->markers.first)) return 1;
@ -115,7 +115,7 @@ static int poselib_get_free_index(bAction *act)
* Prevents problems with deleting then trying to add new poses [#27412]
*/
do {
changed = 0;
changed = false;
for (marker = act->markers.first; marker; marker = marker->next) {
/* only increase low if value is 1 greater than low, to find "gaps" where
@ -123,13 +123,13 @@ static int poselib_get_free_index(bAction *act)
*/
if (marker->frame == (low + 1)) {
low++;
changed = 1;
changed = true;
}
/* value replaces high if it is the highest value encountered yet */
if (marker->frame > high) {
high = marker->frame;
changed = 1;
changed = true;
}
}
} while (changed != 0);

View File

@ -266,7 +266,7 @@ static int pose_select_connected_invoke(bContext *C, wmOperator *op, const wmEve
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm = (bArmature *)ob->data;
Bone *bone, *curBone, *next = NULL;
int extend = RNA_boolean_get(op->ptr, "extend");
const bool extend = RNA_boolean_get(op->ptr, "extend");
view3d_operator_needs_opengl(C);
@ -628,13 +628,13 @@ void POSE_OT_select_hierarchy(wmOperatorType *ot)
/* -------------------------------------- */
static short pose_select_same_group(bContext *C, Object *ob, bool extend)
static bool pose_select_same_group(bContext *C, Object *ob, bool extend)
{
bArmature *arm = (ob) ? ob->data : NULL;
bPose *pose = (ob) ? ob->pose : NULL;
char *group_flags;
int numGroups = 0;
short changed = 0, tagged = 0;
bool changed = false, tagged = false;
/* sanity checks */
if (ELEM3(NULL, ob, pose, arm))
@ -656,7 +656,7 @@ static short pose_select_same_group(bContext *C, Object *ob, bool extend)
/* keep track of group as group to use later? */
if (pchan->bone->flag & BONE_SELECTED) {
group_flags[pchan->agrp_index] = 1;
tagged = 1;
tagged = true;
}
/* deselect all bones before selecting new ones? */
@ -674,7 +674,7 @@ static short pose_select_same_group(bContext *C, Object *ob, bool extend)
/* check if the group used by this bone is counted */
if (group_flags[pchan->agrp_index]) {
pchan->bone->flag |= BONE_SELECTED;
changed = 1;
changed = true;
}
}
}
@ -687,11 +687,11 @@ static short pose_select_same_group(bContext *C, Object *ob, bool extend)
return changed;
}
static short pose_select_same_layer(bContext *C, Object *ob, bool extend)
static bool pose_select_same_layer(bContext *C, Object *ob, bool extend)
{
bPose *pose = (ob) ? ob->pose : NULL;
bArmature *arm = (ob) ? ob->data : NULL;
short changed = 0;
bool changed = false;
int layers = 0;
if (ELEM3(NULL, ob, pose, arm))
@ -718,7 +718,7 @@ static short pose_select_same_layer(bContext *C, Object *ob, bool extend)
/* if bone is on a suitable layer, and the bone can have its selection changed, select it */
if ((layers & pchan->bone->layer) && (pchan->bone->flag & BONE_UNSELECTABLE) == 0) {
pchan->bone->flag |= BONE_SELECTED;
changed = 1;
changed = true;
}
}
CTX_DATA_END;
@ -726,14 +726,14 @@ static short pose_select_same_layer(bContext *C, Object *ob, bool extend)
return changed;
}
static int pose_select_same_keyingset(bContext *C, Object *ob, bool extend)
static bool pose_select_same_keyingset(bContext *C, Object *ob, bool extend)
{
KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C));
KS_Path *ksp;
bArmature *arm = (ob) ? ob->data : NULL;
bPose *pose = (ob) ? ob->pose : NULL;
short changed = 0;
bool changed = false;
/* sanity checks: validate Keying Set and object */
if ((ks == NULL) || (ANIM_validate_keyingset(C, NULL, ks) != 0))
@ -768,7 +768,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, bool extend)
/* select if bone is visible and can be affected */
if (PBONE_SELECTABLE(arm, pchan->bone)) {
pchan->bone->flag |= BONE_SELECTED;
changed = 1;
changed = true;
}
}
@ -786,8 +786,8 @@ static int pose_select_grouped_exec(bContext *C, wmOperator *op)
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm = (bArmature *)ob->data;
short extend = RNA_boolean_get(op->ptr, "extend");
short changed = 0;
const bool extend = RNA_boolean_get(op->ptr, "extend");
bool changed = false;
/* sanity check */
if (ob->pose == NULL)

View File

@ -2307,11 +2307,12 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
BezTriple *bezt, *beztOrig;
BPoint *bp, *bpOrig;
float val, newval, offset;
int a, i, change = 0;
int a, i;
bool changed = false;
for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->bezt) {
change = 0;
changed = false;
beztOrig = MEM_dupallocN(nu->bezt);
for (bezt = &nu->bezt[1], a = 1; a < nu->pntsu - 1; a++, bezt++) {
if (bezt->f2 & SELECT) {
@ -2324,12 +2325,13 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
bezt->vec[0][i] += offset;
bezt->vec[2][i] += offset;
}
change = 1;
changed = true;
}
}
MEM_freeN(beztOrig);
if (change)
if (changed) {
BKE_nurb_handles_calc(nu);
}
}
else if (nu->bp) {
bpOrig = MEM_dupallocN(nu->bp);
@ -3568,7 +3570,7 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
ListBase *editnurb = object_editcurve_get(obedit);
Nurb *nu;
bool change = false;
bool changed = false;
const bool use_handles = RNA_boolean_get(op->ptr, "use_handles");
const int type = RNA_enum_get(op->ptr, "type");
@ -3582,11 +3584,11 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
if (BKE_nurb_type_convert(nu, type, use_handles) == false)
BKE_report(op->reports, RPT_ERROR, "No conversion possible");
else
change = true;
changed = true;
}
}
if (change) {
if (changed) {
if (ED_curve_updateAnimPaths(obedit->data))
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);

View File

@ -212,7 +212,7 @@ void ED_gplayer_frames_select_border(bGPDlayer *gpl, float min, float max, short
bool ED_gplayer_frames_delete(bGPDlayer *gpl)
{
bGPDframe *gpf, *gpfn;
bool modified = false;
bool changed = false;
/* error checking */
if (gpl == NULL)
@ -223,10 +223,10 @@ bool ED_gplayer_frames_delete(bGPDlayer *gpl)
gpfn = gpf->next;
if (gpf->flag & GP_FRAME_SELECT)
modified |= gpencil_layer_delframe(gpl, gpf);
changed |= gpencil_layer_delframe(gpl, gpf);
}
return modified;
return changed;
}
/* Duplicate selected frames from given gp-layer */

View File

@ -68,8 +68,8 @@ void ED_mask_draw_frames(struct Mask *mask, struct ARegion *ar, const int cfra,
/* mask_shapekey.c */
void ED_mask_layer_shape_auto_key(struct MaskLayer *masklay, const int frame);
int ED_mask_layer_shape_auto_key_all(struct Mask *mask, const int frame);
int ED_mask_layer_shape_auto_key_select(struct Mask *mask, const int frame);
bool ED_mask_layer_shape_auto_key_all(struct Mask *mask, const int frame);
bool ED_mask_layer_shape_auto_key_select(struct Mask *mask, const int frame);
/* ----------- Mask AnimEdit API ------------------ */
short ED_masklayer_frames_looper(struct MaskLayer *masklay, struct Scene *scene,

View File

@ -155,7 +155,7 @@ void UI_view2d_totRect_set(struct View2D *v2d, int width, int height);
void UI_view2d_totRect_set_resize(struct View2D *v2d, int width, int height, int resize);
/* per tab offsets, returns 1 if tab changed */
int UI_view2d_tab_set(struct View2D *v2d, int tab);
bool UI_view2d_tab_set(struct View2D *v2d, int tab);
/* view matrix operations */
void UI_view2d_view_ortho(struct View2D *v2d);

View File

@ -721,7 +721,7 @@ static bool ui_drag_toggle_set_xy_xy(bContext *C, ARegion *ar, const bool is_set
{
/* popups such as layers won't re-evaluate on redraw */
const bool do_check = (ar->regiontype == RGN_TYPE_TEMPORARY);
bool change = false;
bool changed = false;
uiBlock *block;
for (block = ar->uiblocks.first; block; block = block->next) {
@ -749,7 +749,7 @@ static bool ui_drag_toggle_set_xy_xy(bContext *C, ARegion *ar, const bool is_set
if (do_check) {
ui_check_but(but);
}
change = true;
changed = true;
}
}
/* done */
@ -759,7 +759,7 @@ static bool ui_drag_toggle_set_xy_xy(bContext *C, ARegion *ar, const bool is_set
}
}
return change;
return changed;
}
static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const int xy_input[2])
@ -1630,14 +1630,14 @@ static bool ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data)
{
char *str = data->str;
const int len = strlen(str);
bool change = false;
bool changed = false;
if (but->selsta != but->selend && len) {
memmove(str + but->selsta, str + but->selend, (len - but->selend) + 1);
change = true;
changed = true;
}
but->pos = but->selend = but->selsta;
return change;
return changed;
}
/* note, but->block->aspect is used here, when drawing button style is getting scaled too */
@ -1925,19 +1925,19 @@ static bool ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directi
static bool ui_textedit_autocomplete(bContext *C, uiBut *but, uiHandleButtonData *data)
{
char *str;
bool change = true;
bool changed = true;
str = data->str;
if (data->searchbox)
change = ui_searchbox_autocomplete(C, data->searchbox, but, data->str);
changed = ui_searchbox_autocomplete(C, data->searchbox, but, data->str);
else
change = but->autocomplete_func(C, str, but->autofunc_arg);
changed = but->autocomplete_func(C, str, but->autofunc_arg);
but->pos = strlen(str);
but->selsta = but->selend = but->pos;
return change;
return changed;
}
/* mode for ui_textedit_copypaste() */

View File

@ -174,7 +174,7 @@ static void view2d_masks(View2D *v2d, int check_scrollers)
*/
void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
{
short tot_changed = 0, do_init;
bool tot_changed = false, do_init;
uiStyle *style = UI_GetStyle();
do_init = (v2d->flag & V2D_IS_INITIALISED) == 0;
@ -937,11 +937,11 @@ void UI_view2d_totRect_set(View2D *v2d, int width, int height)
}
int UI_view2d_tab_set(View2D *v2d, int tab)
bool UI_view2d_tab_set(View2D *v2d, int tab)
{
float default_offset[2] = {0.0f, 0.0f};
float *offset, *new_offset;
int changed = 0;
bool changed = false;
/* if tab changed, change offset */
if (tab != v2d->tab_cur && v2d->tab_offset) {
@ -958,7 +958,7 @@ int UI_view2d_tab_set(View2D *v2d, int tab)
/* validation should happen in subsequent totRect_set */
changed = 1;
changed = true;
}
/* resize array if needed */

View File

@ -1288,10 +1288,10 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar,
}
if (smooth_viewtx && fac > FLT_EPSILON) {
int changed = FALSE;
bool changed = false;
if (BLI_rctf_compare(&sms.new_cur, &v2d->cur, FLT_EPSILON) == FALSE)
changed = TRUE;
changed = true;
/* The new view is different from the old one
* so animate the view */

View File

@ -210,7 +210,7 @@ void ED_masklayer_frames_select_border(MaskLayer *masklay, float min, float max,
bool ED_masklayer_frames_delete(MaskLayer *masklay)
{
MaskLayerShape *masklay_shape, *masklay_shape_next;
bool modified = false;
bool changed = false;
/* error checking */
if (masklay == NULL)
@ -222,11 +222,11 @@ bool ED_masklayer_frames_delete(MaskLayer *masklay)
if (masklay_shape->flag & MASK_SHAPE_SELECT) {
BKE_mask_layer_shape_unlink(masklay, masklay_shape);
modified = true;
changed = true;
}
}
return modified;
return changed;
}
/* Duplicate selected frames from given mask-layer */

View File

@ -1073,12 +1073,12 @@ static int mask_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
int change = FALSE;
bool changed = false;
/* do actual selection */
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
MaskSpline *spline;
int change_layer = FALSE;
bool changed_layer = false;
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
@ -1087,19 +1087,19 @@ static int mask_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
for (spline = masklay->splines.first; spline; spline = spline->next) {
if (ED_mask_spline_select_check(spline)) {
BKE_mask_spline_direction_switch(masklay, spline);
change = TRUE;
change_layer = TRUE;
changed = true;
changed_layer = true;
}
}
if (change_layer) {
if (changed_layer) {
if (IS_AUTOKEY_ON(scene)) {
ED_mask_layer_shape_auto_key(masklay, CFRA);
}
}
}
if (change) {
if (changed) {
/* TODO: only update this spline */
BKE_mask_update_display(mask, CFRA);
@ -1136,12 +1136,12 @@ static int mask_normals_make_consistent_exec(bContext *C, wmOperator *UNUSED(op)
MaskLayer *masklay;
int i;
int change = FALSE;
bool changed = false;
/* do actual selection */
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
MaskSpline *spline;
int change_layer = FALSE;
bool changed_layer = false;
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
@ -1153,20 +1153,20 @@ static int mask_normals_make_consistent_exec(bContext *C, wmOperator *UNUSED(op)
if (MASKPOINT_ISSEL_ANY(point)) {
BKE_mask_calc_handle_point_auto(spline, point, FALSE);
change = TRUE;
change_layer = TRUE;
changed = true;
changed_layer = true;
}
}
}
if (change_layer) {
if (changed_layer) {
if (IS_AUTOKEY_ON(scene)) {
ED_mask_layer_shape_auto_key(masklay, CFRA);
}
}
}
if (change) {
if (changed) {
/* TODO: only update this spline */
BKE_mask_update_display(mask, CFRA);
@ -1204,7 +1204,7 @@ static int set_handle_type_exec(bContext *C, wmOperator *op)
MaskLayer *masklay;
int handle_type = RNA_enum_get(op->ptr, "type");
bool change = false;
bool changed = false;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
MaskSpline *spline;
@ -1222,13 +1222,13 @@ static int set_handle_type_exec(bContext *C, wmOperator *op)
BezTriple *bezt = &point->bezt;
bezt->h1 = bezt->h2 = handle_type;
change = true;
changed = true;
}
}
}
}
if (change) {
if (changed) {
WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
DAG_id_tag_update(&mask->id, 0);
@ -1269,14 +1269,14 @@ static int mask_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
int changed = FALSE;
bool changed = false;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
if (masklay->restrictflag & OB_RESTRICT_VIEW) {
ED_mask_layer_select_set(masklay, TRUE);
masklay->restrictflag &= ~OB_RESTRICT_VIEW;
changed = 1;
changed = true;
}
}
@ -1312,7 +1312,7 @@ static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
const int unselected = RNA_boolean_get(op->ptr, "unselected");
int changed = FALSE;
bool changed = false;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
@ -1325,7 +1325,7 @@ static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
ED_mask_layer_select_set(masklay, FALSE);
masklay->restrictflag |= OB_RESTRICT_VIEW;
changed = 1;
changed = true;
if (masklay == BKE_mask_layer_active(mask)) {
BKE_mask_layer_active_set(mask, NULL);
}
@ -1334,7 +1334,7 @@ static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
else {
if (!ED_mask_layer_select_check(masklay)) {
masklay->restrictflag |= OB_RESTRICT_VIEW;
changed = 1;
changed = true;
if (masklay == BKE_mask_layer_active(mask)) {
BKE_mask_layer_active_set(mask, NULL);
}
@ -1376,7 +1376,7 @@ static int mask_feather_weight_clear_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene = CTX_data_scene(C);
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
int changed = FALSE;
bool changed = false;
int i;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
@ -1393,7 +1393,7 @@ static int mask_feather_weight_clear_exec(bContext *C, wmOperator *UNUSED(op))
if (MASKPOINT_ISSEL_ANY(point)) {
BezTriple *bezt = &point->bezt;
bezt->weight = 0.0f;
changed = TRUE;
changed = true;
}
}
}

View File

@ -412,7 +412,8 @@ static int border_select_exec(bContext *C, wmOperator *op)
rcti rect;
rctf rectf;
int change = FALSE, mode, extend;
int mode;
bool changed = false, extend;
/* get rectangle from operator */
WM_operator_properties_border_to_rcti(op, &rect);
@ -450,12 +451,12 @@ static int border_select_exec(bContext *C, wmOperator *op)
BKE_mask_point_select_set_handle(point, FALSE);
}
change = TRUE;
changed = true;
}
}
}
if (change) {
if (changed) {
ED_mask_select_flush_all(mask);
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
@ -486,7 +487,7 @@ void MASK_OT_select_border(wmOperatorType *ot)
WM_operator_properties_gesture_border(ot, TRUE);
}
static int do_lasso_select_mask(bContext *C, const int mcords[][2], short moves, short select)
static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves, short select)
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
@ -496,7 +497,7 @@ static int do_lasso_select_mask(bContext *C, const int mcords[][2], short moves,
int i;
rcti rect;
int change = FALSE;
bool changed = false;
/* get rectangle from operator */
BLI_lasso_boundbox(&rect, mcords, moves);
@ -533,18 +534,18 @@ static int do_lasso_select_mask(bContext *C, const int mcords[][2], short moves,
BKE_mask_point_select_set_handle(point, select);
}
change = TRUE;
changed = true;
}
}
}
if (change) {
if (changed) {
ED_mask_select_flush_all(mask);
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
}
return change;
return changed;
}
static int clip_lasso_select_exec(bContext *C, wmOperator *op)
@ -610,8 +611,9 @@ static int circle_select_exec(bContext *C, wmOperator *op)
MaskLayer *masklay;
int i;
int x, y, radius, width, height, mode, change = FALSE;
float zoomx, zoomy, offset[2], ellipse[2];
int x, y, radius, width, height, mode;
bool changed = false;
/* get operator properties */
x = RNA_int_get(op->ptr, "x");
@ -649,13 +651,13 @@ static int circle_select_exec(bContext *C, wmOperator *op)
BKE_mask_point_select_set(point, mode == GESTURE_MODAL_SELECT);
BKE_mask_point_select_set_handle(point, mode == GESTURE_MODAL_SELECT);
change = TRUE;
changed = true;
}
}
}
}
if (change) {
if (changed) {
ED_mask_select_flush_all(mask);
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
@ -703,7 +705,7 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE
int is_handle = 0;
const float threshold = 19;
int change = FALSE;
bool changed = false;
ED_mask_mouse_pos(sa, ar, event->mval, co);
@ -714,10 +716,10 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE
masklay->act_spline = spline;
masklay->act_point = point;
change = TRUE;
changed = true;
}
if (change) {
if (changed) {
ED_mask_select_flush_all(mask);
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
@ -750,7 +752,7 @@ static int mask_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
int change = FALSE;
bool changed = false;
/* do actual selection */
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
@ -763,12 +765,12 @@ static int mask_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
for (spline = masklay->splines.first; spline; spline = spline->next) {
if (ED_mask_spline_select_check(spline)) {
ED_mask_spline_select_set(spline, TRUE);
change = TRUE;
changed = true;
}
}
}
if (change) {
if (changed) {
ED_mask_select_flush_all(mask);
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);

View File

@ -60,7 +60,7 @@ static int mask_shape_key_insert_exec(bContext *C, wmOperator *UNUSED(op))
const int frame = CFRA;
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
int change = FALSE;
bool changed = false;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
MaskLayerShape *masklay_shape;
@ -71,10 +71,10 @@ static int mask_shape_key_insert_exec(bContext *C, wmOperator *UNUSED(op))
masklay_shape = BKE_mask_layer_shape_verify_frame(masklay, frame);
BKE_mask_layer_shape_from_mask(masklay, masklay_shape);
change = TRUE;
changed = true;
}
if (change) {
if (changed) {
WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
DAG_id_tag_update(&mask->id, 0);
@ -106,7 +106,7 @@ static int mask_shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
const int frame = CFRA;
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
int change = FALSE;
bool changed = false;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
MaskLayerShape *masklay_shape;
@ -119,11 +119,11 @@ static int mask_shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
if (masklay_shape) {
BKE_mask_layer_shape_unlink(masklay, masklay_shape);
change = TRUE;
changed = true;
}
}
if (change) {
if (changed) {
WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
DAG_id_tag_update(&mask->id, OB_RECALC_DATA);
@ -155,7 +155,7 @@ static int mask_shape_key_feather_reset_exec(bContext *C, wmOperator *UNUSED(op)
const int frame = CFRA;
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
int change = FALSE;
bool changed = false;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
@ -208,14 +208,14 @@ static int mask_shape_key_feather_reset_exec(bContext *C, wmOperator *UNUSED(op)
// printf("%s: skipping\n", __func__);
}
change = TRUE;
changed = true;
}
BKE_mask_layer_shape_free(masklay_shape_reset);
}
}
if (change) {
if (changed) {
WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
DAG_id_tag_update(&mask->id, 0);
@ -255,7 +255,7 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
const int frame = CFRA;
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
int change = FALSE;
bool changed = false;
const short do_feather = RNA_boolean_get(op->ptr, "feather");
const short do_location = RNA_boolean_get(op->ptr, "location");
@ -371,7 +371,7 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
BKE_mask_layer_shape_free(masklay_shape_tmp);
}
change = TRUE;
changed = true;
}
}
@ -380,7 +380,7 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
}
}
if (change) {
if (changed) {
WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
DAG_id_tag_update(&mask->id, 0);
@ -421,23 +421,23 @@ void ED_mask_layer_shape_auto_key(MaskLayer *masklay, const int frame)
BKE_mask_layer_shape_from_mask(masklay, masklay_shape);
}
int ED_mask_layer_shape_auto_key_all(Mask *mask, const int frame)
bool ED_mask_layer_shape_auto_key_all(Mask *mask, const int frame)
{
MaskLayer *masklay;
int change = FALSE;
bool changed = false;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
ED_mask_layer_shape_auto_key(masklay, frame);
change = TRUE;
changed = true;
}
return change;
return changed;
}
int ED_mask_layer_shape_auto_key_select(Mask *mask, const int frame)
bool ED_mask_layer_shape_auto_key_select(Mask *mask, const int frame)
{
MaskLayer *masklay;
int change = FALSE;
bool changed = false;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
@ -446,8 +446,8 @@ int ED_mask_layer_shape_auto_key_select(Mask *mask, const int frame)
}
ED_mask_layer_shape_auto_key(masklay, frame);
change = TRUE;
changed = true;
}
return change;
return changed;
}

View File

@ -1811,7 +1811,7 @@ bool EDBM_select_interior_faces(BMEditMesh *em)
BMFace *efa;
BMEdge *eed;
bool ok;
bool change = false;
bool changed = false;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
@ -1828,11 +1828,11 @@ bool EDBM_select_interior_faces(BMEditMesh *em)
if (ok) {
BM_face_select_set(bm, efa, true);
change = true;
changed = true;
}
}
return change;
return changed;
}

View File

@ -200,7 +200,7 @@ static EnumPropertyItem prop_similar_types[] = {
static bool mball_select_similar_type(MetaBall *mb)
{
MetaElem *ml;
bool change = false;
bool changed = false;
for (ml = mb->editelems->first; ml; ml = ml->next) {
if (ml->flag & SELECT) {
@ -210,20 +210,20 @@ static bool mball_select_similar_type(MetaBall *mb)
if ((ml_iter->flag & SELECT) == 0) {
if (ml->type == ml_iter->type) {
ml_iter->flag |= SELECT;
change = true;
changed = true;
}
}
}
}
}
return change;
return changed;
}
static bool mball_select_similar_radius(MetaBall *mb, const float thresh)
{
MetaElem *ml;
bool change = false;
bool changed = false;
for (ml = mb->editelems->first; ml; ml = ml->next) {
if (ml->flag & SELECT) {
@ -233,20 +233,20 @@ static bool mball_select_similar_radius(MetaBall *mb, const float thresh)
if ((ml_iter->flag & SELECT) == 0) {
if (fabsf(ml_iter->rad - ml->rad) <= (thresh * ml->rad)) {
ml_iter->flag |= SELECT;
change = true;
changed = true;
}
}
}
}
}
return change;
return changed;
}
static bool mball_select_similar_stiffness(MetaBall *mb, const float thresh)
{
MetaElem *ml;
bool change = false;
bool changed = false;
for (ml = mb->editelems->first; ml; ml = ml->next) {
if (ml->flag & SELECT) {
@ -256,21 +256,21 @@ static bool mball_select_similar_stiffness(MetaBall *mb, const float thresh)
if ((ml_iter->flag & SELECT) == 0) {
if (fabsf(ml_iter->s - ml->s) <= thresh) {
ml_iter->flag |= SELECT;
change = true;
changed = true;
}
}
}
}
}
return change;
return changed;
}
static bool mball_select_similar_rotation(MetaBall *mb, const float thresh)
{
const float thresh_rad = thresh * (float)M_PI_2;
MetaElem *ml;
bool change = false;
bool changed = false;
for (ml = mb->editelems->first; ml; ml = ml->next) {
if (ml->flag & SELECT) {
@ -299,14 +299,14 @@ static bool mball_select_similar_rotation(MetaBall *mb, const float thresh)
angle_normalized_v3v3(ml_mat[2], ml_iter_mat[2])) < thresh_rad)
{
ml_iter->flag |= SELECT;
change = true;
changed = true;
}
}
}
}
}
return change;
return changed;
}
static int mball_select_similar_exec(bContext *C, wmOperator *op)
@ -316,27 +316,27 @@ static int mball_select_similar_exec(bContext *C, wmOperator *op)
int type = RNA_enum_get(op->ptr, "type");
float thresh = RNA_float_get(op->ptr, "threshold");
bool change = false;
bool changed = false;
switch (type) {
case SIMMBALL_TYPE:
change = mball_select_similar_type(mb);
changed = mball_select_similar_type(mb);
break;
case SIMMBALL_RADIUS:
change = mball_select_similar_radius(mb, thresh);
changed = mball_select_similar_radius(mb, thresh);
break;
case SIMMBALL_STIFFNESS:
change = mball_select_similar_stiffness(mb, thresh);
changed = mball_select_similar_stiffness(mb, thresh);
break;
case SIMMBALL_ROTATION:
change = mball_select_similar_rotation(mb, thresh);
changed = mball_select_similar_rotation(mb, thresh);
break;
default:
BLI_assert(0);
break;
}
if (change) {
if (changed) {
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, mb);
}

View File

@ -137,7 +137,7 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
View3D *v3d = sa->spacedata.first;
Scene *scene = CTX_data_scene(C);
Base *base;
int changed = 0;
bool changed = false;
/* XXX need a context loop to handle such cases */
for (base = FIRSTBASE; base; base = base->next) {
@ -145,7 +145,7 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
base->flag |= SELECT;
base->object->flag = base->flag;
base->object->restrictflag &= ~OB_RESTRICT_VIEW;
changed = 1;
changed = true;
}
}
if (changed) {
@ -177,7 +177,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
short changed = 0;
bool changed = false;
const int unselected = RNA_boolean_get(op->ptr, "unselected");
CTX_DATA_BEGIN(C, Base *, base, visible_bases)
@ -187,7 +187,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
base->flag &= ~SELECT;
base->object->flag = base->flag;
base->object->restrictflag |= OB_RESTRICT_VIEW;
changed = 1;
changed = true;
if (base == BASACT) {
ED_base_object_activate(C, NULL);
}
@ -196,7 +196,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
else {
if (!(base->flag & SELECT)) {
base->object->restrictflag |= OB_RESTRICT_VIEW;
changed = 1;
changed = true;
if (base == BASACT) {
ED_base_object_activate(C, NULL);
}
@ -237,14 +237,14 @@ void OBJECT_OT_hide_view_set(wmOperatorType *ot)
/* 99% same as above except no need for scene refreshing (TODO, update render preview) */
static int object_hide_render_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
short changed = 0;
bool changed = false;
/* XXX need a context loop to handle such cases */
CTX_DATA_BEGIN(C, Object *, ob, selected_editable_objects)
{
if (ob->restrictflag & OB_RESTRICT_RENDER) {
ob->restrictflag &= ~OB_RESTRICT_RENDER;
changed = 1;
changed = true;
}
}
CTX_DATA_END;

View File

@ -216,7 +216,7 @@ static EnumPropertyItem prop_select_linked_types[] = {
#if 0
static int object_select_all_by_ipo(bContext *C, Ipo *ipo)
{
int changed = FALSE;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
@ -224,7 +224,7 @@ static int object_select_all_by_ipo(bContext *C, Ipo *ipo)
base->flag |= SELECT;
base->object->flag = base->flag;
changed = TRUE;
changed = true;
}
}
CTX_DATA_END;
@ -233,9 +233,9 @@ static int object_select_all_by_ipo(bContext *C, Ipo *ipo)
}
#endif
static int object_select_all_by_obdata(bContext *C, void *obdata)
static bool object_select_all_by_obdata(bContext *C, void *obdata)
{
int changed = FALSE;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
@ -244,7 +244,7 @@ static int object_select_all_by_obdata(bContext *C, void *obdata)
base->flag |= SELECT;
base->object->flag = base->flag;
changed = TRUE;
changed = true;
}
}
}
@ -253,9 +253,9 @@ static int object_select_all_by_obdata(bContext *C, void *obdata)
return changed;
}
static int object_select_all_by_material_texture(bContext *C, int use_texture, Material *mat, Tex *tex)
static bool object_select_all_by_material_texture(bContext *C, int use_texture, Material *mat, Tex *tex)
{
int changed = FALSE;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
@ -270,7 +270,7 @@ static int object_select_all_by_material_texture(bContext *C, int use_texture, M
if (!use_texture) {
if (mat1 == mat) {
base->flag |= SELECT;
changed = TRUE;
changed = true;
}
}
else if (mat1 && use_texture) {
@ -278,7 +278,7 @@ static int object_select_all_by_material_texture(bContext *C, int use_texture, M
if (mat1->mtex[b]) {
if (tex == mat1->mtex[b]->tex) {
base->flag |= SELECT;
changed = TRUE;
changed = true;
break;
}
}
@ -294,9 +294,9 @@ static int object_select_all_by_material_texture(bContext *C, int use_texture, M
return changed;
}
static int object_select_all_by_dup_group(bContext *C, Object *ob)
static bool object_select_all_by_dup_group(bContext *C, Object *ob)
{
int changed = FALSE;
bool changed = false;
Group *dup_group = (ob->transflag & OB_DUPLIGROUP) ? ob->dup_group : NULL;
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
@ -307,7 +307,7 @@ static int object_select_all_by_dup_group(bContext *C, Object *ob)
base->flag |= SELECT;
base->object->flag = base->flag;
changed = TRUE;
changed = true;
}
}
}
@ -316,9 +316,9 @@ static int object_select_all_by_dup_group(bContext *C, Object *ob)
return changed;
}
static int object_select_all_by_particle(bContext *C, Object *ob)
static bool object_select_all_by_particle(bContext *C, Object *ob)
{
int changed = FALSE;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
@ -331,7 +331,7 @@ static int object_select_all_by_particle(bContext *C, Object *ob)
for (psys_act = ob->particlesystem.first; psys_act; psys_act = psys_act->next) {
if (psys->part == psys_act->part) {
base->flag |= SELECT;
changed = TRUE;
changed = true;
break;
}
}
@ -349,9 +349,9 @@ static int object_select_all_by_particle(bContext *C, Object *ob)
return changed;
}
static int object_select_all_by_library(bContext *C, Library *lib)
static bool object_select_all_by_library(bContext *C, Library *lib)
{
int changed = FALSE;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
@ -360,7 +360,7 @@ static int object_select_all_by_library(bContext *C, Library *lib)
base->flag |= SELECT;
base->object->flag = base->flag;
changed = TRUE;
changed = true;
}
}
}
@ -369,9 +369,9 @@ static int object_select_all_by_library(bContext *C, Library *lib)
return changed;
}
static int object_select_all_by_library_obdata(bContext *C, Library *lib)
static bool object_select_all_by_library_obdata(bContext *C, Library *lib)
{
int changed = FALSE;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
@ -380,7 +380,7 @@ static int object_select_all_by_library_obdata(bContext *C, Library *lib)
base->flag |= SELECT;
base->object->flag = base->flag;
changed = TRUE;
changed = true;
}
}
}
@ -392,7 +392,7 @@ static int object_select_all_by_library_obdata(bContext *C, Library *lib)
void ED_object_select_linked_by_id(bContext *C, ID *id)
{
int idtype = GS(id->name);
int changed = FALSE;
bool changed = false;
if (OB_DATA_SUPPORT_ID(idtype)) {
changed = object_select_all_by_obdata(C, id);
@ -414,7 +414,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *ob;
int nr = RNA_enum_get(op->ptr, "type");
short changed = FALSE, extend;
bool changed = false, extend;
extend = RNA_boolean_get(op->ptr, "extend");
@ -533,16 +533,16 @@ static EnumPropertyItem prop_select_grouped_types[] = {
{0, NULL, 0, NULL, NULL}
};
static short select_grouped_children(bContext *C, Object *ob, int recursive)
static bool select_grouped_children(bContext *C, Object *ob, const bool recursive)
{
short changed = 0;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
if (ob == base->object->parent) {
if (!(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
}
if (recursive)
@ -553,12 +553,12 @@ static short select_grouped_children(bContext *C, Object *ob, int recursive)
return changed;
}
static short select_grouped_parent(bContext *C) /* Makes parent active and de-selected OBACT */
static bool select_grouped_parent(bContext *C) /* Makes parent active and de-selected OBACT */
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
short changed = 0;
bool changed = false;
Base *baspar, *basact = CTX_data_active_base(C);
if (!basact || !(basact->object->parent)) return 0; /* we know OBACT is valid */
@ -570,16 +570,16 @@ static short select_grouped_parent(bContext *C) /* Makes parent active and de-se
ED_base_object_select(basact, BA_DESELECT);
ED_base_object_select(baspar, BA_SELECT);
ED_base_object_activate(C, baspar);
changed = 1;
changed = true;
}
return changed;
}
#define GROUP_MENU_MAX 24
static short select_grouped_group(bContext *C, Object *ob) /* Select objects in the same group as the active */
static bool select_grouped_group(bContext *C, Object *ob) /* Select objects in the same group as the active */
{
short changed = 0;
bool changed = false;
Group *group, *ob_groups[GROUP_MENU_MAX];
int group_count = 0, i;
uiPopupMenu *pup;
@ -600,7 +600,7 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in
{
if (!(base->flag & SELECT) && BKE_group_object_exists(group, base->object)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
}
}
CTX_DATA_END;
@ -620,12 +620,12 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in
return changed; /* The operator already handle this! */
}
static short select_grouped_object_hooks(bContext *C, Object *ob)
static bool select_grouped_object_hooks(bContext *C, Object *ob)
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
short changed = 0;
bool changed = false;
Base *base;
ModifierData *md;
HookModifierData *hmd;
@ -637,7 +637,7 @@ static short select_grouped_object_hooks(bContext *C, Object *ob)
base = BKE_scene_base_find(scene, hmd->object);
if (base && (BASE_SELECTABLE(v3d, base))) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
}
}
}
@ -647,25 +647,25 @@ static short select_grouped_object_hooks(bContext *C, Object *ob)
/* Select objects with the same parent as the active (siblings),
* parent can be NULL also */
static short select_grouped_siblings(bContext *C, Object *ob)
static bool select_grouped_siblings(bContext *C, Object *ob)
{
short changed = 0;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
if ((base->object->parent == ob->parent) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
}
}
CTX_DATA_END;
return changed;
}
static short select_similar_lamps(bContext *C, Object *ob)
static bool select_similar_lamps(bContext *C, Object *ob)
{
Lamp *la = ob->data;
short changed = 0;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
@ -673,88 +673,88 @@ static short select_similar_lamps(bContext *C, Object *ob)
Lamp *la_test = base->object->data;
if ((la->type == la_test->type) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
}
}
}
CTX_DATA_END;
return changed;
}
static short select_similar_pass_index(bContext *C, Object *ob)
static bool select_similar_pass_index(bContext *C, Object *ob)
{
char changed = 0;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
if ((base->object->index == ob->index) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
}
}
CTX_DATA_END;
return changed;
}
static short select_grouped_type(bContext *C, Object *ob)
static bool select_grouped_type(bContext *C, Object *ob)
{
short changed = 0;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
if ((base->object->type == ob->type) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
}
}
CTX_DATA_END;
return changed;
}
static short select_grouped_layer(bContext *C, Object *ob)
static bool select_grouped_layer(bContext *C, Object *ob)
{
char changed = 0;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
if ((base->lay & ob->lay) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
}
}
CTX_DATA_END;
return changed;
}
static short select_grouped_index_object(bContext *C, Object *ob)
static bool select_grouped_index_object(bContext *C, Object *ob)
{
char changed = 0;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
if ((base->object->index == ob->index) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
}
}
CTX_DATA_END;
return changed;
}
static short select_grouped_color(bContext *C, Object *ob)
static bool select_grouped_color(bContext *C, Object *ob)
{
char changed = 0;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
if (!(base->flag & SELECT) && (compare_v3v3(base->object->col, ob->col, 0.005f))) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
}
}
CTX_DATA_END;
return changed;
}
static short objects_share_gameprop(Object *a, Object *b)
static bool objects_share_gameprop(Object *a, Object *b)
{
bProperty *prop;
/*make a copy of all its properties*/
@ -766,25 +766,25 @@ static short objects_share_gameprop(Object *a, Object *b)
return 0;
}
static short select_grouped_gameprops(bContext *C, Object *ob)
static bool select_grouped_gameprops(bContext *C, Object *ob)
{
char changed = 0;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
if (!(base->flag & SELECT) && (objects_share_gameprop(base->object, ob))) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
}
}
CTX_DATA_END;
return changed;
}
static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob))
static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob))
{
KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C));
short changed = 0;
bool changed = false;
/* firstly, validate KeyingSet */
if ((ks == NULL) || (ANIM_validate_keyingset(C, NULL, ks) != 0))
@ -806,7 +806,7 @@ static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob))
/* if id matches, select then stop looping (match found) */
if (ksp->id == (ID *)base->object) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
changed = true;
break;
}
}
@ -822,7 +822,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *ob;
int nr = RNA_enum_get(op->ptr, "type");
short changed = 0, extend;
bool changed = false, extend;
extend = RNA_boolean_get(op->ptr, "extend");
@ -830,7 +830,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
ED_base_object_select(base, BA_DESELECT);
changed = 1;
changed = true;
}
CTX_DATA_END;
}

View File

@ -341,16 +341,16 @@ static int shape_key_remove_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Object *ob = ED_object_context(C);
bool change = false;
bool changed = false;
if (RNA_boolean_get(op->ptr, "all")) {
change = ED_object_shape_key_remove_all(bmain, ob);
changed = ED_object_shape_key_remove_all(bmain, ob);
}
else {
change = ED_object_shape_key_remove(bmain, ob);
changed = ED_object_shape_key_remove(bmain, ob);
}
if (change) {
if (changed) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);

View File

@ -380,7 +380,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
float rsmat[3][3], obmat[3][3], iobmat[3][3], mat[4][4], scale;
bool change = true;
bool changed = true;
/* first check if we can execute */
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
@ -391,14 +391,14 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
BKE_reportf(reports, RPT_ERROR,
"Cannot apply to a multi user: Object \"%s\", %s \"%s\", aborting",
ob->id.name + 2, BKE_idcode_to_name(GS(obdata->name)), obdata->name + 2);
change = false;
changed = false;
}
if (obdata->lib) {
BKE_reportf(reports, RPT_ERROR,
"Cannot apply to library data: Object \"%s\", %s \"%s\", aborting",
ob->id.name + 2, BKE_idcode_to_name(GS(obdata->name)), obdata->name + 2);
change = false;
changed = false;
}
}
@ -412,22 +412,22 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
BKE_reportf(reports, RPT_ERROR,
"Rotation/Location can't apply to a 2D curve: Object \"%s\", %s \"%s\", aborting",
ob->id.name + 2, BKE_idcode_to_name(GS(obdata->name)), obdata->name + 2);
change = false;
changed = false;
}
if (cu->key) {
BKE_reportf(reports, RPT_ERROR,
"Can't apply to a curve with shape-keys: Object \"%s\", %s \"%s\", aborting",
ob->id.name + 2, BKE_idcode_to_name(GS(obdata->name)), obdata->name + 2);
change = false;
changed = false;
}
}
}
CTX_DATA_END;
if (!change)
if (!changed)
return OPERATOR_CANCELLED;
change = false;
changed = false;
/* now execute */
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
@ -592,11 +592,11 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
change = true;
changed = true;
}
CTX_DATA_END;
if (!change) {
if (!changed) {
BKE_report(reports, RPT_WARNING, "Objects have no data to transform");
return OPERATOR_CANCELLED;
}
@ -608,7 +608,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
int change = 0;
bool changed = false;
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
@ -619,11 +619,11 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
/* update for any children that may get moved */
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
change = 1;
changed = true;
}
CTX_DATA_END;
if (!change)
if (!changed)
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);

View File

@ -2811,7 +2811,7 @@ static bool vgroup_active_remove_verts(Object *ob, const bool allverts, bDeformG
{
MDeformVert *dv;
const int def_nr = BLI_findindex(&ob->defbase, dg);
bool change = false;
bool changed = false;
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
@ -2830,7 +2830,7 @@ static bool vgroup_active_remove_verts(Object *ob, const bool allverts, bDeformG
if (dv && dv->dw && (allverts || BM_elem_flag_test(eve, BM_ELEM_SELECT))) {
MDeformWeight *dw = defvert_find_index(dv, def_nr);
defvert_remove_group(dv, dw); /* dw can be NULL */
change = true;
changed = true;
}
}
}
@ -2848,7 +2848,7 @@ static bool vgroup_active_remove_verts(Object *ob, const bool allverts, bDeformG
if (dv->dw && (allverts || (mv->flag & SELECT))) {
MDeformWeight *dw = defvert_find_index(dv, def_nr);
defvert_remove_group(dv, dw); /* dw can be NULL */
change = true;
changed = true;
}
}
}
@ -2870,13 +2870,13 @@ static bool vgroup_active_remove_verts(Object *ob, const bool allverts, bDeformG
dw = defvert_find_index(dv, def_nr);
defvert_remove_group(dv, dw); /* dw can be NULL */
change = true;
changed = true;
}
}
}
}
return change;
return changed;
}
static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
@ -3077,16 +3077,16 @@ static void vgroup_assign_verts(Object *ob, const float weight)
/* removes from all defgroup, if allverts==0 only selected vertices */
static bool vgroup_remove_verts(Object *ob, int allverts)
{
bool change = false;
bool changed = false;
/* To prevent code redundancy, we just use vgroup_active_remove_verts, but that
* only operates on the active vgroup. So we iterate through all groups, by changing
* active group index
*/
bDeformGroup *dg;
for (dg = ob->defbase.first; dg; dg = dg->next) {
change |= vgroup_active_remove_verts(ob, allverts, dg);
changed |= vgroup_active_remove_verts(ob, allverts, dg);
}
return change;
return changed;
}
/********************** vertex group operators *********************/
@ -3965,22 +3965,22 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot)
static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
{
Object *obact = ED_object_context(C);
int change = 0;
int changed_tot = 0;
int fail = 0;
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
if (obact != ob) {
if (ED_vgroup_array_copy(ob, obact)) change++;
if (ED_vgroup_array_copy(ob, obact)) changed_tot++;
else fail++;
}
}
CTX_DATA_END;
if ((change == 0 && fail == 0) || fail) {
if ((changed_tot == 0 && fail == 0) || fail) {
BKE_reportf(op->reports, RPT_ERROR,
"Copy vertex groups to selected: %d done, %d failed (object data must have matching indices)",
change, fail);
changed_tot, fail);
}
return OPERATOR_FINISHED;
@ -4010,7 +4010,7 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op)
char dg_act_name[MAX_VGROUP_NAME]; /* may be freed so copy */
int fail = 0;
bool change = false;
bool changed = false;
WT_VertexGroupMode vertex_group_mode = RNA_enum_get(op->ptr, "group_select_mode");
WT_Method method = RNA_enum_get(op->ptr, "method");
@ -4060,7 +4060,7 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op)
}
if (ed_vgroup_transfer_weight(ob_act, ob_src, dg_src, scene, method, replace_mode, op)) {
change = true;
changed = true;
}
else {
fail++;
@ -4072,7 +4072,7 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op)
bDeformGroup *dg_src;
for (dg_src = ob_src->defbase.first; dg_src; dg_src = dg_src->next) {
if (ed_vgroup_transfer_weight(ob_act, ob_src, dg_src, scene, method, replace_mode, op)) {
change = true;
changed = true;
}
else {
fail++;
@ -4088,7 +4088,7 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
if (change) {
if (changed) {
/* possible the active vertex group changed because of adding/removing */
/* note!, dg_act may be realloc'd, only check its not NULL */

View File

@ -2978,7 +2978,7 @@ static void brush_puff(PEData *data, int point_index)
float co_prev[3], co[3]; /* track key coords as we loop (global-space) */
float fac = 0.0f, length_accum = 0.0f;
bool puff_volume = false;
bool change = false;
bool changed = false;
zero_v3(ofs_prev);
@ -3056,7 +3056,7 @@ static void brush_puff(PEData *data, int point_index)
* keys that come after */
sub_v3_v3v3(ofs_prev, key->co, dco);
}
change = true;
changed = true;
}
else {
@ -3116,7 +3116,7 @@ static void brush_puff(PEData *data, int point_index)
}
}
if (change)
if (changed)
point->flag |= PEP_EDIT_RECALC;
}

View File

@ -123,7 +123,7 @@ static int rigidbody_con_add_exec(bContext *C, wmOperator *op)
RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene);
Object *ob = (scene) ? OBACT : NULL;
int type = RNA_enum_get(op->ptr, "type");
bool change;
bool changed;
/* sanity checks */
if (ELEM(NULL, scene, rbw)) {
@ -131,9 +131,9 @@ static int rigidbody_con_add_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
/* apply to active object */
change = ED_rigidbody_constraint_add(scene, ob, type, op->reports);
changed = ED_rigidbody_constraint_add(scene, ob, type, op->reports);
if (change) {
if (changed) {
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);

View File

@ -145,12 +145,12 @@ static int rigidbody_object_add_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
int type = RNA_enum_get(op->ptr, "type");
bool change;
bool changed;
/* apply to active object */
change = ED_rigidbody_object_add(scene, ob, type, op->reports);
changed = ED_rigidbody_object_add(scene, ob, type, op->reports);
if (change) {
if (changed) {
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
@ -187,15 +187,15 @@ static int rigidbody_object_remove_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
bool change = false;
bool changed = false;
/* apply to active object */
if (!ELEM(NULL, ob, ob->rigidbody_object)) {
ED_rigidbody_object_remove(scene, ob);
change = true;
changed = true;
}
if (change) {
if (changed) {
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
@ -233,15 +233,15 @@ static int rigidbody_objects_add_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
int type = RNA_enum_get(op->ptr, "type");
bool change = false;
bool changed = false;
/* create rigid body objects and add them to the world's group */
CTX_DATA_BEGIN(C, Object *, ob, selected_objects) {
change |= ED_rigidbody_object_add(scene, ob, type, op->reports);
changed |= ED_rigidbody_object_add(scene, ob, type, op->reports);
}
CTX_DATA_END;
if (change) {
if (changed) {
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
@ -277,19 +277,19 @@ void RIGIDBODY_OT_objects_add(wmOperatorType *ot)
static int rigidbody_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
bool change = false;
bool changed = false;
/* apply this to all selected objects... */
CTX_DATA_BEGIN(C, Object *, ob, selected_objects)
{
if (ob->rigidbody_object) {
ED_rigidbody_object_remove(scene, ob);
change = true;
changed = true;
}
}
CTX_DATA_END;
if (change) {
if (changed) {
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
@ -325,7 +325,7 @@ void RIGIDBODY_OT_objects_remove(wmOperatorType *ot)
static int rigidbody_objects_shape_change_exec(bContext *C, wmOperator *op)
{
int shape = RNA_enum_get(op->ptr, "type");
bool change = false;
bool changed = false;
/* apply this to all selected objects... */
CTX_DATA_BEGIN(C, Object *, ob, selected_objects)
@ -339,12 +339,12 @@ static int rigidbody_objects_shape_change_exec(bContext *C, wmOperator *op)
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
change = true;
changed = true;
}
}
CTX_DATA_END;
if (change) {
if (changed) {
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
@ -555,7 +555,7 @@ static int rigidbody_objects_calc_mass_exec(bContext *C, wmOperator *op)
{
int material = RNA_enum_get(op->ptr, "material");
float density;
bool change = false;
bool changed = false;
/* get density (kg/m^3) to apply */
if (material >= 0) {
@ -592,12 +592,12 @@ static int rigidbody_objects_calc_mass_exec(bContext *C, wmOperator *op)
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
change = true;
changed = true;
}
}
CTX_DATA_END;
if (change) {
if (changed) {
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);

View File

@ -1566,12 +1566,13 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
Panel *panel;
View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;
int x, y, xco, yco, w, em, triangle, open, newcontext = 0;
int x, y, xco, yco, w, em, triangle, open;
bool is_context_new = 0;
int redo;
int scroll;
if (contextnr >= 0)
newcontext = UI_view2d_tab_set(v2d, contextnr);
is_context_new = UI_view2d_tab_set(v2d, contextnr);
/* before setting the view */
if (vertical) {
@ -1683,7 +1684,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
}
else {
/* don't jump back when panels close or hide */
if (!newcontext)
if (!is_context_new)
x = max_ii(x, v2d->cur.xmax);
y = -y;
}

View File

@ -100,7 +100,8 @@ static void partialvis_update_mesh(Object *ob,
MVert *mvert;
float *paint_mask;
int *vert_indices;
int any_changed = 0, any_visible = 0, totvert, i;
int totvert, i;
bool any_changed = false, any_visible = false;
BKE_pbvh_node_num_verts(pbvh, node, NULL, &totvert);
BKE_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
@ -118,11 +119,11 @@ static void partialvis_update_mesh(Object *ob,
v->flag |= ME_HIDE;
else
v->flag &= ~ME_HIDE;
any_changed = 1;
any_changed = true;
}
if (!(v->flag & ME_HIDE))
any_visible = 1;
any_visible = true;
}
if (any_changed) {
@ -143,8 +144,9 @@ static void partialvis_update_grids(Object *ob,
CCGElem **grids;
CCGKey key;
BLI_bitmap **grid_hidden;
int any_visible = 0;
int *grid_indices, totgrid, any_changed, i;
int *grid_indices, totgrid, i;
bool any_changed = false, any_visible = false;
/* get PBVH data */
BKE_pbvh_node_get_grids(pbvh, node,
@ -154,8 +156,7 @@ static void partialvis_update_grids(Object *ob,
BKE_pbvh_get_grid_key(pbvh, &key);
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
any_changed = 0;
for (i = 0; i < totgrid; i++) {
int any_hidden = 0;
int g = grid_indices[i], x, y;
@ -178,8 +179,8 @@ static void partialvis_update_grids(Object *ob,
* grid */
MEM_freeN(gh);
grid_hidden[g] = NULL;
any_changed = 1;
any_visible = 1;
any_changed = true;
any_visible = true;
continue;
}
@ -195,14 +196,14 @@ static void partialvis_update_grids(Object *ob,
BLI_BITMAP_MODIFY(gh, y * key.grid_size + x,
action == PARTIALVIS_HIDE);
any_changed = 1;
any_changed = true;
}
/* keep track of whether any elements are still hidden */
if (BLI_BITMAP_GET(gh, y * key.grid_size + x))
any_hidden = 1;
any_hidden = true;
else
any_visible = 1;
any_visible = true;
}
}
@ -227,8 +228,8 @@ static void partialvis_update_bmesh_verts(BMesh *bm,
PartialVisAction action,
PartialVisArea area,
float planes[4][4],
int *any_changed,
int *any_visible)
bool *any_changed,
bool *any_visible)
{
GSetIterator gs_iter;
@ -244,24 +245,24 @@ static void partialvis_update_bmesh_verts(BMesh *bm,
BM_elem_flag_enable(v, BM_ELEM_HIDDEN);
else
BM_elem_flag_disable(v, BM_ELEM_HIDDEN);
(*any_changed) = TRUE;
(*any_changed) = true;
}
if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN))
(*any_visible) = TRUE;
(*any_visible) = true;
}
}
static void partialvis_update_bmesh(Object *ob,
PBVH *pbvh,
PBVHNode *node,
PartialVisAction action,
PartialVisArea area,
float planes[4][4])
PBVH *pbvh,
PBVHNode *node,
PartialVisAction action,
PartialVisArea area,
float planes[4][4])
{
BMesh *bm;
GSet *unique, *other;
int any_changed = 0, any_visible = 0;
bool any_changed = false, any_visible = false;
bm = BKE_pbvh_get_bmesh(pbvh);
unique = BKE_pbvh_bmesh_node_unique_verts(node);
@ -270,20 +271,20 @@ static void partialvis_update_bmesh(Object *ob,
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
partialvis_update_bmesh_verts(bm,
unique,
action,
area,
planes,
&any_changed,
&any_visible);
unique,
action,
area,
planes,
&any_changed,
&any_visible);
partialvis_update_bmesh_verts(bm,
other,
action,
area,
planes,
&any_changed,
&any_visible);
other,
action,
area,
planes,
&any_changed,
&any_visible);
if (any_changed) {
BKE_pbvh_node_mark_rebuild_draw(node);

View File

@ -1088,7 +1088,7 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
{
ViewContext vc;
Mesh *me;
short change = FALSE;
bool changed = false;
view3d_set_viewcontext(C, &vc);
me = BKE_mesh_from_object(vc.obact);
@ -1122,11 +1122,11 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
const int vgroup_active = vc.obact->actdef - 1;
float vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
BKE_brush_weight_set(vc.scene, brush, vgroup_weight);
change = TRUE;
changed = true;
}
}
if (change) {
if (changed) {
/* not really correct since the brush didnt change, but redraws the toolbar */
WM_main_add_notifier(NC_BRUSH | NA_EDITED, NULL); /* ts->wpaint->paint.brush */
@ -1468,14 +1468,14 @@ static float redistribute_change(MDeformVert *ndv, const int defbase_tot,
float totchange, float total_valid,
char do_auto_normalize)
{
float was_change;
bool changed;
float change;
float oldval;
MDeformWeight *ndw;
int i;
do {
/* assume there is no change until you see one */
was_change = FALSE;
changed = false;
/* change each group by the same amount each time */
change = totchange / total_valid;
for (i = 0; i < ndv->totweight && total_valid && totchange; i++) {
@ -1507,14 +1507,14 @@ static float redistribute_change(MDeformVert *ndv, const int defbase_tot,
}
/* see if there was a change */
if (oldval != ndw->weight) {
was_change = TRUE;
changed = true;
}
}
}
}
/* don't go again if there was no change, if there is no valid group,
* or there is no change left */
} while (was_change && total_valid && totchange);
} while (changed && total_valid && totchange);
/* left overs */
return totchange;
}

View File

@ -785,7 +785,7 @@ static bool delete_action_keys(bAnimContext *ac)
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
bool modified = false;
bool changed = false;
/* filter data */
if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
@ -797,17 +797,17 @@ static bool delete_action_keys(bAnimContext *ac)
/* loop through filtered data and delete selected keys */
for (ale = anim_data.first; ale; ale = ale->next) {
if (ale->type == ANIMTYPE_GPLAYER) {
modified |= ED_gplayer_frames_delete((bGPDlayer *)ale->data);
changed |= ED_gplayer_frames_delete((bGPDlayer *)ale->data);
}
else if (ale->type == ANIMTYPE_MASKLAYER) {
modified |= ED_masklayer_frames_delete((MaskLayer *)ale->data);
changed |= ED_masklayer_frames_delete((MaskLayer *)ale->data);
}
else {
FCurve *fcu = (FCurve *)ale->key_data;
AnimData *adt = ale->adt;
/* delete selected keyframes only */
modified |= delete_fcurve_keys(fcu);
changed |= delete_fcurve_keys(fcu);
/* Only delete curve too if it won't be doing anything anymore */
if ((fcu->totvert == 0) && (list_has_suitable_fmodifier(&fcu->modifiers, 0, FMI_TYPE_GENERATE_CURVE) == 0))
@ -818,7 +818,7 @@ static bool delete_action_keys(bAnimContext *ac)
/* free filtered list */
BLI_freelistN(&anim_data);
return modified;
return changed;
}
/* ------------------- */
@ -826,14 +826,14 @@ static bool delete_action_keys(bAnimContext *ac)
static int actkeys_delete_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
bool modified;
bool changed;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* delete keyframes */
modified = delete_action_keys(&ac);
changed = delete_action_keys(&ac);
/* validate keyframes after editing */
if (!ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
@ -842,7 +842,7 @@ static int actkeys_delete_exec(bContext *C, wmOperator *op)
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
if (modified)
if (changed)
BKE_report(op->reports, RPT_INFO, "Deleted selected keyframes");
return OPERATOR_FINISHED;

View File

@ -305,7 +305,8 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
bAnimContext ac;
rcti rect;
short mode = 0, selectmode = 0;
int gesture_mode, extend;
int gesture_mode;
bool extend;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)

View File

@ -96,7 +96,7 @@ static int dopesheet_select_channel_exec(bContext *C, wmOperator *op)
MovieTrackingDopesheetChannel *channel;
ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object);
float location[2];
int extend = RNA_boolean_get(op->ptr, "extend");
const bool extend = RNA_boolean_get(op->ptr, "extend");
int current_channel_index = 0, channel_index;
RNA_float_get_array(op->ptr, "location", location);

View File

@ -320,7 +320,7 @@ void CLIP_OT_graph_select(wmOperatorType *ot)
typedef struct BorderSelectuserData {
rctf rect;
int mode;
bool change, extend;
bool changed, extend;
} BorderSelectuserData;
static void border_select_cb(void *userdata, MovieTrackingTrack *UNUSED(track),
@ -341,7 +341,7 @@ static void border_select_cb(void *userdata, MovieTrackingTrack *UNUSED(track),
else
marker->flag &= ~flag;
data->change = TRUE;
data->changed = true;
}
else if (!data->extend) {
marker->flag &= ~MARKER_GRAPH_SEL;
@ -369,13 +369,13 @@ static int border_select_graph_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(&ar->v2d, rect.xmin, rect.ymin, &userdata.rect.xmin, &userdata.rect.ymin);
UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &userdata.rect.xmax, &userdata.rect.ymax);
userdata.change = false;
userdata.changed = false;
userdata.mode = RNA_int_get(op->ptr, "gesture_mode");
userdata.extend = RNA_boolean_get(op->ptr, "extend");
clip_graph_tracking_values_iterate_track(sc, act_track, &userdata, border_select_cb, NULL, NULL);
if (userdata.change) {
if (userdata.changed) {
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
return OPERATOR_FINISHED;

View File

@ -243,7 +243,7 @@ static int delete_track_exec(bContext *C, wmOperator *op)
ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
MovieTrackingTrack *track = tracksbase->first, *next;
MovieTrackingPlaneTrack *plane_track, *next_plane_track;
bool modified = false;
bool changed = false;
/* Delete selected plane tracks. */
for (plane_track = plane_tracks_base->first;
@ -255,7 +255,7 @@ static int delete_track_exec(bContext *C, wmOperator *op)
if (plane_track->flag & SELECT) {
BKE_tracking_plane_track_free(plane_track);
BLI_freelinkN(plane_tracks_base, plane_track);
modified = true;
changed = true;
}
}
@ -272,7 +272,7 @@ static int delete_track_exec(bContext *C, wmOperator *op)
/* nothing selected now, unlock view so it can be scrolled nice again */
sc->flag &= ~SC_LOCK_SELECTION;
if (modified) {
if (changed) {
BKE_report(op->reports, RPT_INFO, "Deleted all selected tracks");
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
}

View File

@ -402,7 +402,7 @@ static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ARegion *ar = CTX_wm_region(C);
float co[2];
int extend = RNA_boolean_get(op->ptr, "extend");
const bool extend = RNA_boolean_get(op->ptr, "extend");
if (!extend) {
MovieTrackingTrack *track = tracking_marker_check_slide(C, event, NULL, NULL, NULL);
@ -461,7 +461,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
rcti rect;
rctf rectf;
bool change = false;
bool changed = false;
int mode, extend;
int framenr = ED_space_clip_get_clip_frame_number(sc);
@ -491,7 +491,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT);
}
change = true;
changed = true;
}
}
@ -521,11 +521,11 @@ static int border_select_exec(bContext *C, wmOperator *op)
}
}
change = true;
changed = true;
}
}
if (change) {
if (changed) {
BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
@ -570,7 +570,7 @@ static int do_lasso_select_marker(bContext *C, const int mcords[][2], const shor
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
rcti rect;
bool change = false;
bool changed = false;
int framenr = ED_space_clip_get_clip_frame_number(sc);
/* get rectangle from operator */
@ -597,7 +597,7 @@ static int do_lasso_select_marker(bContext *C, const int mcords[][2], const shor
BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT);
}
change = true;
changed = true;
}
}
@ -631,17 +631,17 @@ static int do_lasso_select_marker(bContext *C, const int mcords[][2], const shor
}
}
change = true;
changed = true;
}
}
if (change) {
if (changed) {
BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
}
return change;
return changed;
}
static int clip_lasso_select_exec(bContext *C, wmOperator *op)
@ -715,7 +715,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
int x, y, radius, width, height, mode;
bool change = false;
bool changed = false;
float zoomx, zoomy, offset[2], ellipse[2];
int framenr = ED_space_clip_get_clip_frame_number(sc);
@ -747,7 +747,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
else
BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT);
change = true;
changed = true;
}
}
@ -774,11 +774,11 @@ static int circle_select_exec(bContext *C, wmOperator *op)
}
}
change = true;
changed = true;
}
}
if (change) {
if (changed) {
BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);

View File

@ -272,8 +272,8 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
ARegion *ar = CTX_wm_region(C);
rcti rect;
FileSelect ret;
int extend = RNA_boolean_get(op->ptr, "extend");
short select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
const bool select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
const bool extend = RNA_boolean_get(op->ptr, "extend");
WM_operator_properties_border_to_rcti(op, &rect);
@ -319,9 +319,9 @@ static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
SpaceFile *sfile = CTX_wm_space_file(C);
FileSelect ret;
rcti rect;
int extend = RNA_boolean_get(op->ptr, "extend");
int fill = RNA_boolean_get(op->ptr, "fill");
int do_diropen = RNA_boolean_get(op->ptr, "open");
const bool extend = RNA_boolean_get(op->ptr, "extend");
const bool fill = RNA_boolean_get(op->ptr, "fill");
const bool do_diropen = RNA_boolean_get(op->ptr, "open");
if (ar->regiontype != RGN_TYPE_WINDOW)
return OPERATOR_CANCELLED;

View File

@ -877,7 +877,7 @@ static bool delete_graph_keys(bAnimContext *ac)
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
bool modified = false;
bool changed = false;
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
@ -889,7 +889,7 @@ static bool delete_graph_keys(bAnimContext *ac)
AnimData *adt = ale->adt;
/* delete selected keyframes only */
modified |= delete_fcurve_keys(fcu);
changed |= delete_fcurve_keys(fcu);
/* Only delete curve too if it won't be doing anything anymore */
if ((fcu->totvert == 0) &&
@ -903,7 +903,7 @@ static bool delete_graph_keys(bAnimContext *ac)
/* free filtered list */
BLI_freelistN(&anim_data);
return modified;
return changed;
}
/* ------------------- */
@ -911,14 +911,14 @@ static bool delete_graph_keys(bAnimContext *ac)
static int graphkeys_delete_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
bool modified;
bool changed;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* delete keyframes */
modified = delete_graph_keys(&ac);
changed = delete_graph_keys(&ac);
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
@ -926,7 +926,7 @@ static int graphkeys_delete_exec(bContext *C, wmOperator *op)
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
if (modified)
if (changed)
BKE_report(op->reports, RPT_INFO, "Deleted selected keyframes");
return OPERATOR_FINISHED;

View File

@ -223,7 +223,7 @@ static int borderselect_exec(bContext *C, wmOperator *op)
ARegion *ar = CTX_wm_region(C);
ReportList *reports = CTX_wm_reports(C);
int report_mask = info_report_mask(sinfo);
int extend = RNA_boolean_get(op->ptr, "extend");
const bool extend = RNA_boolean_get(op->ptr, "extend");
Report *report_min, *report_max, *report;
//View2D *v2d = UI_view2d_fromcontext(C);
@ -231,7 +231,7 @@ static int borderselect_exec(bContext *C, wmOperator *op)
rcti rect;
//rctf rectf, rq;
short selecting = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
const bool select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
//int mval[2];
WM_operator_properties_border_to_rcti(op, &rect);
@ -287,7 +287,7 @@ static int borderselect_exec(bContext *C, wmOperator *op)
if ((report->type & report_mask) == 0)
continue;
if (selecting)
if (select)
report->flag |= SELECT;
else
report->flag &= ~SELECT;

View File

@ -448,7 +448,7 @@ static int node_borderselect_exec(bContext *C, wmOperator *op)
rcti rect;
rctf rectf;
int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
int extend = RNA_boolean_get(op->ptr, "extend");
const bool extend = RNA_boolean_get(op->ptr, "extend");
WM_operator_properties_border_to_rcti(op, &rect);
@ -573,7 +573,7 @@ void NODE_OT_select_circle(wmOperatorType *ot)
/* ****** Lasso Select ****** */
static int do_lasso_select_node(bContext *C, const int mcords[][2], short moves, short select)
static bool do_lasso_select_node(bContext *C, const int mcords[][2], short moves, short select)
{
SpaceNode *snode = CTX_wm_space_node(C);
bNode *node;
@ -581,7 +581,7 @@ static int do_lasso_select_node(bContext *C, const int mcords[][2], short moves,
ARegion *ar = CTX_wm_region(C);
rcti rect;
int change = FALSE;
bool changed = false;
/* get rectangle from operator */
BLI_lasso_boundbox(&rect, mcords, moves);
@ -601,15 +601,15 @@ static int do_lasso_select_node(bContext *C, const int mcords[][2], short moves,
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], INT_MAX))
{
nodeSetSelected(node, select);
change = TRUE;
changed = true;
}
}
if (change) {
if (changed) {
WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL);
}
return change;
return changed;
}
static int node_lasso_select_exec(bContext *C, wmOperator *op)

View File

@ -273,18 +273,18 @@ static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), const wmEve
SpaceOops *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
bool change = false;
bool changed = false;
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval + 1);
for (te = soops->tree.first; te; te = te->next) {
if (do_outliner_item_rename(C, ar, soops, te, fmval)) {
change = true;
changed = true;
break;
}
}
return change ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH;
return changed ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH;
}

View File

@ -78,7 +78,7 @@ static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *se
{
TreeElement *te;
TreeStoreElem *tselem;
int change = 0;
bool changed = false;
for (te = lb->first; te && *index >= 0; te = te->next, (*index)--) {
tselem = TREESTORE(te);
@ -101,7 +101,7 @@ static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *se
else
tselem->flag &= ~TSE_SELECTED;
change |= 1;
changed |= true;
}
}
else if (TSELEM_OPEN(tselem, soops)) {
@ -113,12 +113,12 @@ static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *se
* function correctly
*/
(*index)--;
change |= outliner_select(soops, &te->subtree, index, selecting);
changed |= outliner_select(soops, &te->subtree, index, selecting);
(*index)++;
}
}
return change;
return changed;
}
/* ****************************************************** */

View File

@ -826,8 +826,8 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
* may generate strips with the same name (which will mess up animdata)
*/
static int cut_seq_list(Scene *scene, ListBase *slist, int cutframe,
Sequence * (*cut_seq)(Scene *, Sequence *, int))
static bool cut_seq_list(Scene *scene, ListBase *slist, int cutframe,
Sequence * (*cut_seq)(Scene *, Sequence *, int))
{
Sequence *seq, *seq_next_iter;
Sequence *seq_first_new = NULL;
@ -1569,7 +1569,7 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
int cut_side, cut_hard, cut_frame;
int changed;
bool changed;
cut_frame = RNA_int_get(op->ptr, "frame");
cut_hard = RNA_enum_get(op->ptr, "type");
@ -2481,20 +2481,20 @@ static int find_next_prev_edit(Scene *scene, int cfra,
return cfra;
}
static int strip_jump_internal(Scene *scene,
const short side,
const short do_skip_mute, const short do_center)
static bool strip_jump_internal(Scene *scene,
const short side,
const short do_skip_mute, const short do_center)
{
int change = FALSE;
bool changed = false;
int cfra = CFRA;
int nfra = find_next_prev_edit(scene, cfra, side, do_skip_mute, do_center);
if (nfra != cfra) {
CFRA = nfra;
change = TRUE;
changed = true;
}
return change;
return changed;
}
static int sequencer_strip_jump_poll(bContext *C)

View File

@ -188,7 +188,7 @@ static void select_neighbor_from_last(Scene *scene, int lr)
{
Sequence *seq = BKE_sequencer_active_get(scene);
Sequence *neighbor;
int change = 0;
bool changed = false;
if (seq) {
neighbor = find_neighboring_sequence(scene, seq, lr, -1);
if (neighbor) {
@ -207,10 +207,10 @@ static void select_neighbor_from_last(Scene *scene, int lr)
break;
}
seq->flag |= SELECT;
change = 1;
changed = true;
}
}
if (change) {
if (changed) {
}
}
#endif
@ -553,14 +553,15 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
/* run recursively to select linked */
static int select_more_less_seq__internal(Scene *scene, int sel, int linked)
static bool select_more_less_seq__internal(Scene *scene, bool sel, const bool linked)
{
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq, *neighbor;
int change = 0;
bool changed = false;
int isel;
if (ed == NULL) return 0;
if (ed == NULL)
return changed;
if (sel) {
sel = SELECT;
@ -587,20 +588,20 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked)
if (sel) { neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
else neighbor->flag &= ~SELECT;
if (linked == 0) neighbor->tmp = (Sequence *)1;
change = 1;
changed = true;
}
neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, isel);
if (neighbor) {
if (sel) { neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
else neighbor->flag &= ~SELECT;
if (linked == 0) neighbor->tmp = (void *)1;
change = 1;
changed = true;
}
}
}
}
return change;
return changed;
}
@ -850,8 +851,8 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
Sequence *seq;
rcti rect;
rctf rectf, rq;
short selecting = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
int extend = RNA_boolean_get(op->ptr, "extend");
const bool select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
const bool extend = RNA_boolean_get(op->ptr, "extend");
int mval[2];
if (ed == NULL)
@ -870,7 +871,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
seq_rectf(seq, &rq);
if (BLI_rctf_isect(&rq, &rectf, NULL)) {
if (selecting) seq->flag |= SELECT;
if (select) seq->flag |= SELECT;
else seq->flag &= ~SEQ_ALLSEL;
recurs_sel_seq(seq);
}
@ -930,16 +931,16 @@ static EnumPropertyItem sequencer_prop_select_grouped_types[] = {
#define SEQ_USE_DATA(_seq) (ELEM3(_seq->type, SEQ_TYPE_SCENE, SEQ_TYPE_MOVIECLIP, SEQ_TYPE_MASK) || SEQ_HAS_PATH(_seq))
static short select_grouped_type(Editing *ed, Sequence *actseq)
static bool select_grouped_type(Editing *ed, Sequence *actseq)
{
Sequence *seq;
short changed = FALSE;
bool changed = false;
SEQP_BEGIN (ed, seq)
{
if (seq->type == actseq->type) {
seq->flag |= SELECT;
changed = TRUE;
changed = true;
}
}
SEQ_END;
@ -947,17 +948,17 @@ static short select_grouped_type(Editing *ed, Sequence *actseq)
return changed;
}
static short select_grouped_type_basic(Editing *ed, Sequence *actseq)
static bool select_grouped_type_basic(Editing *ed, Sequence *actseq)
{
Sequence *seq;
short changed = FALSE;
bool changed = false;
short is_sound = SEQ_IS_SOUND(actseq);
SEQP_BEGIN (ed, seq)
{
if (is_sound ? SEQ_IS_SOUND(seq) : !SEQ_IS_SOUND(seq)) {
seq->flag |= SELECT;
changed = TRUE;
changed = true;
}
}
SEQ_END;
@ -965,17 +966,17 @@ static short select_grouped_type_basic(Editing *ed, Sequence *actseq)
return changed;
}
static short select_grouped_type_effect(Editing *ed, Sequence *actseq)
static bool select_grouped_type_effect(Editing *ed, Sequence *actseq)
{
Sequence *seq;
short changed = FALSE;
bool changed = false;
short is_effect = SEQ_IS_EFFECT(actseq);
SEQP_BEGIN (ed, seq)
{
if (is_effect ? SEQ_IS_EFFECT(seq) : !SEQ_IS_EFFECT(seq)) {
seq->flag |= SELECT;
changed = TRUE;
changed = true;
}
}
SEQ_END;
@ -983,10 +984,10 @@ static short select_grouped_type_effect(Editing *ed, Sequence *actseq)
return changed;
}
static short select_grouped_data(Editing *ed, Sequence *actseq)
static bool select_grouped_data(Editing *ed, Sequence *actseq)
{
Sequence *seq;
short changed = FALSE;
bool changed = false;
char *dir = actseq->strip ? actseq->strip->dir : NULL;
if (!SEQ_USE_DATA(actseq))
@ -997,7 +998,7 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
{
if (SEQ_HAS_PATH(seq) && seq->strip && strcmp(seq->strip->dir, dir) == 0) {
seq->flag |= SELECT;
changed = TRUE;
changed = true;
}
}
SEQ_END;
@ -1008,7 +1009,7 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
{
if (seq->type == SEQ_TYPE_SCENE && seq->scene == sce) {
seq->flag |= SELECT;
changed = TRUE;
changed = true;
}
}
SEQ_END;
@ -1019,7 +1020,7 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
{
if (seq->type == SEQ_TYPE_MOVIECLIP && seq->clip == clip) {
seq->flag |= SELECT;
changed = TRUE;
changed = true;
}
}
SEQ_END;
@ -1030,7 +1031,7 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
{
if (seq->type == SEQ_TYPE_MASK && seq->mask == mask) {
seq->flag |= SELECT;
changed = TRUE;
changed = true;
}
}
SEQ_END;
@ -1039,10 +1040,10 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
return changed;
}
static short select_grouped_effect(Editing *ed, Sequence *actseq)
static bool select_grouped_effect(Editing *ed, Sequence *actseq)
{
Sequence *seq;
short changed = FALSE;
bool changed = false;
short effects[SEQ_TYPE_EFFECT_MAX + 1];
int i;
@ -1063,7 +1064,7 @@ static short select_grouped_effect(Editing *ed, Sequence *actseq)
if (seq->seq1) seq->seq1->flag |= SELECT;
if (seq->seq2) seq->seq2->flag |= SELECT;
if (seq->seq3) seq->seq3->flag |= SELECT;
changed = TRUE;
changed = true;
}
}
SEQ_END;
@ -1071,16 +1072,16 @@ static short select_grouped_effect(Editing *ed, Sequence *actseq)
return changed;
}
static short select_grouped_time_overlap(Editing *ed, Sequence *actseq)
static bool select_grouped_time_overlap(Editing *ed, Sequence *actseq)
{
Sequence *seq;
short changed = FALSE;
bool changed = false;
SEQP_BEGIN (ed, seq)
{
if (!((seq->startdisp >= actseq->enddisp) || (seq->enddisp < actseq->startdisp))) {
seq->flag |= SELECT;
changed = TRUE;
changed = true;
}
}
SEQ_END;
@ -1088,10 +1089,10 @@ static short select_grouped_time_overlap(Editing *ed, Sequence *actseq)
return changed;
}
static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
static bool select_grouped_effect_link(Editing *ed, Sequence *actseq)
{
Sequence *seq = NULL;
short changed = FALSE;
bool changed = false;
short is_audio = ((actseq->type == SEQ_TYPE_META) || SEQ_IS_SOUND(actseq));
int startdisp = actseq->startdisp;
int enddisp = actseq->enddisp;
@ -1131,7 +1132,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
seq->tmp = SET_INT_IN_POINTER(TRUE);
seq->flag |= SELECT;
changed = TRUE;
changed = true;
/* Unfortunately, we must restart checks from the beginning. */
BKE_sequence_iterator_end(&iter);
@ -1141,7 +1142,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
/* Video strips bellow active one, or any strip for audio (order do no matters here!). */
else if (seq->machine < machine || is_audio) {
seq->flag |= SELECT;
changed = TRUE;
changed = true;
}
}
BKE_sequence_iterator_end(&iter);
@ -1159,7 +1160,7 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
Editing *ed = BKE_sequencer_editing_get(scene, 0);
Sequence *seq, *actseq = BKE_sequencer_active_get(scene);
int type = RNA_enum_get(op->ptr, "type");
short changed = 0, extend;
bool changed = false, extend;
extend = RNA_boolean_get(op->ptr, "extend");
@ -1172,7 +1173,7 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
SEQP_BEGIN (ed, seq)
{
seq->flag &= ~SELECT;
changed = TRUE;
changed = true;
}
SEQ_END;
}

View File

@ -234,28 +234,28 @@ static void sequencer_refresh(const bContext *C, ScrArea *sa)
SpaceSeq *sseq = (SpaceSeq *)sa->spacedata.first;
ARegion *ar_main = sequencer_find_region(sa, RGN_TYPE_WINDOW);
ARegion *ar_preview = sequencer_find_region(sa, RGN_TYPE_PREVIEW);
int view_changed = 0;
bool view_changed = false;
switch (sseq->view) {
case SEQ_VIEW_SEQUENCE:
if (ar_main && (ar_main->flag & RGN_FLAG_HIDDEN)) {
ar_main->flag &= ~RGN_FLAG_HIDDEN;
ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
view_changed = 1;
view_changed = true;
}
if (ar_preview && !(ar_preview->flag & RGN_FLAG_HIDDEN)) {
ar_preview->flag |= RGN_FLAG_HIDDEN;
ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
WM_event_remove_handlers((bContext *)C, &ar_preview->handlers);
view_changed = 1;
view_changed = true;
}
if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
ar_main->alignment = RGN_ALIGN_NONE;
view_changed = 1;
view_changed = true;
}
if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) {
ar_preview->alignment = RGN_ALIGN_NONE;
view_changed = 1;
view_changed = true;
}
break;
case SEQ_VIEW_PREVIEW:
@ -263,42 +263,42 @@ static void sequencer_refresh(const bContext *C, ScrArea *sa)
ar_main->flag |= RGN_FLAG_HIDDEN;
ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
WM_event_remove_handlers((bContext *)C, &ar_main->handlers);
view_changed = 1;
view_changed = true;
}
if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) {
ar_preview->flag &= ~RGN_FLAG_HIDDEN;
ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
ar_preview->v2d.cur = ar_preview->v2d.tot;
view_changed = 1;
view_changed = true;
}
if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
ar_main->alignment = RGN_ALIGN_NONE;
view_changed = 1;
view_changed = true;
}
if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) {
ar_preview->alignment = RGN_ALIGN_NONE;
view_changed = 1;
view_changed = true;
}
break;
case SEQ_VIEW_SEQUENCE_PREVIEW:
if (ar_main && (ar_main->flag & RGN_FLAG_HIDDEN)) {
ar_main->flag &= ~RGN_FLAG_HIDDEN;
ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
view_changed = 1;
view_changed = true;
}
if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) {
ar_preview->flag &= ~RGN_FLAG_HIDDEN;
ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
ar_preview->v2d.cur = ar_preview->v2d.tot;
view_changed = 1;
view_changed = true;
}
if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
ar_main->alignment = RGN_ALIGN_NONE;
view_changed = 1;
view_changed = true;
}
if (ar_preview && ar_preview->alignment != RGN_ALIGN_TOP) {
ar_preview->alignment = RGN_ALIGN_TOP;
view_changed = 1;
view_changed = true;
}
break;
}

View File

@ -2464,7 +2464,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
float min[3], max[3];
bool change = false;
bool changed = false;
if (center) {
/* in 2.4x this also move the cursor to (0, 0, 0) (with shift+c). */
@ -2479,7 +2479,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
for (base = scene->base.first; base; base = base->next) {
if (BASE_VISIBLE(v3d, base)) {
change = true;
changed = true;
if (skip_camera && base->object == v3d->camera) {
continue;
@ -2488,7 +2488,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
BKE_object_minmax(base->object, min, max, false);
}
}
if (!change) {
if (!changed) {
ED_region_tag_redraw(ar);
/* TODO - should this be cancel?
* I think no, because we always move the cursor, with or without

View File

@ -335,7 +335,7 @@ static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo *ruler_info)
bGPDstroke *gps;
RulerItem *ruler_item;
const char *ruler_name = RULER_ID;
bool change = false;
bool changed = false;
if (scene->gpd == NULL) {
scene->gpd = gpencil_data_addnew("GPencil");
@ -377,16 +377,16 @@ static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo *ruler_info)
}
gps->flag = GP_STROKE_3DSPACE;
BLI_addtail(&gpf->strokes, gps);
change = true;
changed = true;
}
return change;
return changed;
}
static bool view3d_ruler_from_gpencil(bContext *C, RulerInfo *ruler_info)
{
Scene *scene = CTX_data_scene(C);
bool change = false;
bool changed = false;
if (scene->gpd) {
bGPDlayer *gpl;
@ -407,7 +407,7 @@ static bool view3d_ruler_from_gpencil(bContext *C, RulerInfo *ruler_info)
pt++;
}
ruler_item->flag |= RULERITEM_USE_ANGLE;
change = true;
changed = true;
}
else if (gps->totpoints == 2) {
RulerItem *ruler_item = ruler_item_add(ruler_info);
@ -415,14 +415,14 @@ static bool view3d_ruler_from_gpencil(bContext *C, RulerInfo *ruler_info)
copy_v3_v3(ruler_item->co[j], &pt->x);
pt++;
}
change = true;
changed = true;
}
}
}
}
}
return change;
return changed;
}
/* -------------------------------------------------------------------- */

View File

@ -236,7 +236,7 @@ typedef struct LassoSelectUserData {
/* runtime */
int pass;
bool is_done;
bool is_change;
bool is_changed;
} LassoSelectUserData;
static void view3d_userdata_lassoselect_init(LassoSelectUserData *r_data,
@ -256,7 +256,7 @@ static void view3d_userdata_lassoselect_init(LassoSelectUserData *r_data,
/* runtime */
r_data->pass = 0;
r_data->is_done = false;
r_data->is_change = false;
r_data->is_changed = false;
}
static int view3d_selectable_data(bContext *C)
@ -357,9 +357,9 @@ static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChann
{
if (data->select) pchan->bone->flag |= BONE_SELECTED;
else pchan->bone->flag &= ~BONE_SELECTED;
data->is_change = true;
data->is_changed = true;
}
data->is_change |= is_point_done;
data->is_changed |= is_point_done;
}
}
static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[][2], short moves, const bool select)
@ -383,7 +383,7 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[]
pose_foreachScreenBone(&vc_tmp, do_lasso_select_pose__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
if (data.is_change) {
if (data.is_changed) {
bArmature *arm = ob->data;
if (arm->flag & ARM_HAS_VIZ_DEPS) {
/* mask modifier ('armature' mode), etc. */
@ -647,10 +647,10 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo
{
if (data->select) ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
data->is_change = true;
data->is_changed = true;
}
data->is_change |= is_point_done;
data->is_changed |= is_point_done;
}
}
@ -670,7 +670,7 @@ static void do_lasso_select_armature(ViewContext *vc, const int mcords[][2], sho
armature_foreachScreenBone(vc, do_lasso_select_armature__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
if (data.is_change) {
if (data.is_changed) {
bArmature *arm = vc->obedit->data;
ED_armature_sync_selection(arm->edbo);
ED_armature_validate_active(arm);
@ -687,7 +687,7 @@ static void do_lasso_select_mball__doSelectElem(void *userData, struct MetaElem
{
if (data->select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
data->is_change = true;
data->is_changed = true;
}
}
static void do_lasso_select_meta(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
@ -1003,7 +1003,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
{
const int name_index = RNA_enum_get(op->ptr, "name");
const bool toggle = RNA_boolean_get(op->ptr, "toggle");
bool change = false;
bool changed = false;
const char *name = object_mouse_select_menu_data[name_index].idname;
if (!toggle) {
@ -1011,7 +1011,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
{
if (base->flag & SELECT) {
ED_base_object_select(base, BA_DESELECT);
change = true;
changed = true;
}
}
CTX_DATA_END;
@ -1023,7 +1023,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
if (STREQ(name, base->object->id.name + 2)) {
ED_base_object_activate(C, base);
ED_base_object_select(base, BA_SELECT);
change = true;
changed = true;
}
}
CTX_DATA_END;
@ -1032,7 +1032,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
memset(object_mouse_select_menu_data, 0, sizeof(object_mouse_select_menu_data));
/* undo? */
if (change) {
if (changed) {
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@ -1454,7 +1454,7 @@ static bool mouse_select(bContext *C, const int mval[2],
if (basact->object->type == OB_CAMERA) {
if (BASACT == basact) {
int i, hitresult;
int changed = 0;
bool changed = false;
for (i = 0; i < hits; i++) {
hitresult = buffer[3 + (i * 4)];
@ -1476,7 +1476,7 @@ static bool mouse_select(bContext *C, const int mval[2],
track = BKE_tracking_track_get_indexed(&clip->tracking, hitresult >> 16, &tracksbase);
if (TRACK_SELECTED(track) && extend) {
changed = 0;
changed = false;
BKE_tracking_track_deselect(track, TRACK_AREA_ALL);
}
else {
@ -1487,7 +1487,7 @@ static bool mouse_select(bContext *C, const int mval[2],
BKE_tracking_track_select(tracksbase, track, TRACK_AREA_ALL, extend);
if (oldsel != (TRACK_SELECTED(track) ? 1 : 0))
changed = 1;
changed = true;
}
basact->flag |= SELECT;
@ -1593,7 +1593,7 @@ typedef struct BoxSelectUserData {
/* runtime */
int pass;
bool is_done;
bool is_change;
bool is_changed;
} BoxSelectUserData;
static void view3d_userdata_boxselect_init(BoxSelectUserData *r_data,
@ -1610,7 +1610,7 @@ static void view3d_userdata_boxselect_init(BoxSelectUserData *r_data,
/* runtime */
r_data->pass = 0;
r_data->is_done = false;
r_data->is_change = false;
r_data->is_changed = false;
}
bool edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2])
@ -2320,7 +2320,7 @@ typedef struct CircleSelectUserData {
float radius_squared;
/* runtime */
bool is_change;
bool is_changed;
} CircleSelectUserData;
static void view3d_userdata_circleselect_init(CircleSelectUserData *r_data,
@ -2336,7 +2336,7 @@ static void view3d_userdata_circleselect_init(CircleSelectUserData *r_data,
r_data->radius_squared = rad * rad;
/* runtime */
r_data->is_change = false;
r_data->is_changed = false;
}
static void mesh_circle_doSelectVert(void *userData, BMVert *eve, const float screen_co[2], int UNUSED(index))
@ -2579,10 +2579,10 @@ static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChan
{
if (data->select) pchan->bone->flag |= BONE_SELECTED;
else pchan->bone->flag &= ~BONE_SELECTED;
data->is_change = true;
data->is_changed = true;
}
data->is_change |= is_point_done;
data->is_changed |= is_point_done;
}
}
static void pose_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
@ -2595,7 +2595,7 @@ static void pose_circle_select(ViewContext *vc, const bool select, const int mva
pose_foreachScreenBone(vc, do_circle_select_pose__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
if (data.is_change) {
if (data.is_changed) {
bArmature *arm = vc->obact->data;
WM_main_add_notifier(NC_OBJECT | ND_BONE_SELECT, vc->obact);
@ -2665,10 +2665,10 @@ static void do_circle_select_armature__doSelectBone(void *userData, struct EditB
{
if (data->select) ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
data->is_change = true;
data->is_changed = true;
}
data->is_change |= is_point_done;
data->is_changed |= is_point_done;
}
}
static void armature_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
@ -2682,7 +2682,7 @@ static void armature_circle_select(ViewContext *vc, const bool select, const int
armature_foreachScreenBone(vc, do_circle_select_armature__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
if (data.is_change) {
if (data.is_changed) {
ED_armature_sync_selection(arm->edbo);
ED_armature_validate_active(arm);
WM_main_add_notifier(NC_OBJECT | ND_BONE_SELECT, vc->obedit);
@ -2696,7 +2696,7 @@ static void do_circle_select_mball__doSelectElem(void *userData, struct MetaElem
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
if (data->select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
data->is_change = true;
data->is_changed = true;
}
}
static void mball_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
@ -2741,7 +2741,7 @@ static bool object_circle_select(ViewContext *vc, const bool select, const int m
Scene *scene = vc->scene;
const float radius_squared = rad * rad;
const float mval_fl[2] = {mval[0], mval[1]};
bool is_change = false;
bool changed = false;
const int select_flag = select ? SELECT : 0;
@ -2754,13 +2754,13 @@ static bool object_circle_select(ViewContext *vc, const bool select, const int m
{
if (len_squared_v2v2(mval_fl, screen_co) <= radius_squared) {
ED_base_object_select(base, select ? BA_SELECT : BA_DESELECT);
is_change = true;
changed = true;
}
}
}
}
return is_change;
return changed;
}
/* not a real operator, only for circle test */

View File

@ -692,14 +692,14 @@ bool ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3])
/* metaballs are an exception */
if (obedit->type == OB_MBALL) {
float ob_min[3], ob_max[3];
bool change;
bool changed;
change = BKE_mball_minmax_ex(obedit->data, ob_min, ob_max, obedit->obmat, SELECT);
if (change) {
changed = BKE_mball_minmax_ex(obedit->data, ob_min, ob_max, obedit->obmat, SELECT);
if (changed) {
minmax_v3v3_v3(min, max, ob_min);
minmax_v3v3_v3(min, max, ob_max);
}
return change;
return changed;
}
if (ED_transverts_check_obedit(obedit))

View File

@ -1268,16 +1268,16 @@ static int localview_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = CTX_wm_view3d(C);
bool change;
bool changed;
if (v3d->localvd) {
change = view3d_localview_exit(bmain, scene, sa);
changed = view3d_localview_exit(bmain, scene, sa);
}
else {
change = view3d_localview_init(bmain, scene, sa, op->reports);
changed = view3d_localview_init(bmain, scene, sa, op->reports);
}
if (change) {
if (changed) {
DAG_id_type_tag(bmain, ID_OB);
ED_area_tag_redraw(CTX_wm_area(C));

View File

@ -640,7 +640,7 @@ bool ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float r_min[2],
BMIter iter, liter;
MTexPoly *tf;
MLoopUV *luv;
bool change = false;
bool changed = false;
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
const int cd_poly_tex_offset = CustomData_get_offset(&em->bm->pdata, CD_MTEXPOLY);
@ -656,12 +656,12 @@ bool ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float r_min[2],
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
minmax_v2v2_v2(r_min, r_max, luv->uv);
change = true;
changed = true;
}
}
}
return change;
return changed;
}
static bool ED_uvedit_median(Scene *scene, Image *ima, Object *obedit, float co[2])
@ -699,22 +699,22 @@ static bool ED_uvedit_median(Scene *scene, Image *ima, Object *obedit, float co[
static bool uvedit_center(Scene *scene, Image *ima, Object *obedit, float cent[2], char mode)
{
bool change = false;
bool changed = false;
if (mode == V3D_CENTER) { /* bounding box */
float min[2], max[2];
if (ED_uvedit_minmax(scene, ima, obedit, min, max)) {
mid_v2_v2v2(cent, min, max);
change = true;
changed = true;
}
}
else {
if (ED_uvedit_median(scene, ima, obedit, cent)) {
change = true;
changed = true;
}
}
return change;
return changed;
}
/************************** find nearest ****************************/
@ -2461,7 +2461,7 @@ static int uv_select_split_exec(bContext *C, wmOperator *op)
BMIter iter, liter;
MTexPoly *tf;
MLoopUV *luv;
bool change = false;
bool changed = false;
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
const int cd_poly_tex_offset = CustomData_get_offset(&bm->pdata, CD_MTEXPOLY);
@ -2504,11 +2504,11 @@ static int uv_select_split_exec(bContext *C, wmOperator *op)
luv->flag &= ~MLOOPUV_VERTSEL;
}
change = true;
changed = true;
}
}
if (change) {
if (changed) {
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, NULL);
return OPERATOR_FINISHED;
}
@ -2796,7 +2796,7 @@ static int uv_border_select_exec(bContext *C, wmOperator *op)
MLoopUV *luv;
rcti rect;
rctf rectf;
bool change, pinned, select, extend;
bool changed, pinned, select, extend;
const bool use_face_center = (ts->uv_flag & UV_SYNC_SELECTION) ?
(ts->selectmode == SCE_SELECT_FACE) :
(ts->uv_selectmode == UV_SELECT_FACE);
@ -2823,7 +2823,7 @@ static int uv_border_select_exec(bContext *C, wmOperator *op)
/* handle face selection mode */
float cent[2];
change = false;
changed = false;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
/* assume not touched */
@ -2834,19 +2834,19 @@ static int uv_border_select_exec(bContext *C, wmOperator *op)
uv_poly_center(efa, cent, cd_loop_uv_offset);
if (BLI_rctf_isect_pt_v(&rectf, cent)) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
change = true;
changed = true;
}
}
}
/* (de)selects all tagged faces and deals with sticky modes */
if (change) {
if (changed) {
uv_select_flush_from_tag_face(sima, scene, obedit, select);
}
}
else {
/* other selection modes */
change = true;
changed = true;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
tf = BM_ELEM_CD_GET_VOID_P(efa, cd_poly_tex_offset);
@ -2871,7 +2871,7 @@ static int uv_border_select_exec(bContext *C, wmOperator *op)
}
}
if (change) {
if (changed) {
uv_select_sync_flush(ts, em, select);
if (ts->uv_flag & UV_SYNC_SELECTION) {
@ -2947,7 +2947,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
float zoomx, zoomy, offset[2], ellipse[2];
int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
const bool select = (gesture_mode == GESTURE_MODAL_SELECT);
bool change = false;
bool changed = false;
const bool use_face_center = (ts->uv_flag & UV_SYNC_SELECTION) ?
(ts->selectmode == SCE_SELECT_FACE) :
(ts->uv_selectmode == UV_SELECT_FACE);
@ -2971,7 +2971,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
/* do selection */
if (use_face_center) {
change = FALSE;
changed = false;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
BM_elem_flag_disable(efa, BM_ELEM_TAG);
/* assume not touched */
@ -2980,13 +2980,13 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
uv_poly_center(efa, cent, cd_loop_uv_offset);
if (uv_inside_circle(cent, offset, ellipse)) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
change = TRUE;
changed = true;
}
}
}
/* (de)selects all tagged faces and deals with sticky modes */
if (change) {
if (changed) {
uv_select_flush_from_tag_face(sima, scene, obedit, select);
}
}
@ -2994,12 +2994,12 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
change |= uv_select_inside_ellipse(em, scene, select, offset, ellipse, l, luv, cd_loop_uv_offset);
changed |= uv_select_inside_ellipse(em, scene, select, offset, ellipse, l, luv, cd_loop_uv_offset);
}
}
}
if (change) {
if (changed) {
uv_select_sync_flush(ts, em, select);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
@ -3057,7 +3057,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mo
BMLoop *l;
MTexPoly *tf;
int screen_uv[2];
bool change = false;
bool changed = false;
rcti rect;
BLI_lasso_boundbox(&rect, mcords, moves);
@ -3074,13 +3074,13 @@ static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mo
BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
{
BM_elem_flag_enable(efa, BM_ELEM_TAG);
change = true;
changed = true;
}
}
}
/* (de)selects all tagged faces and deals with sticky modes */
if (change) {
if (changed) {
uv_select_flush_from_tag_face(sima, scene, obedit, select);
}
}
@ -3096,7 +3096,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mo
BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
{
uvedit_uv_select_set(em, scene, l, select, false, cd_loop_uv_offset);
change = true;
changed = true;
}
}
}
@ -3104,7 +3104,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mo
}
}
if (change) {
if (changed) {
uv_select_sync_flush(scene->toolsettings, em, select);
if (ts->uv_flag & UV_SYNC_SELECTION) {
@ -3112,7 +3112,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mo
}
}
return change;
return changed;
}
static int uv_lasso_select_exec(bContext *C, wmOperator *op)
@ -3122,14 +3122,14 @@ static int uv_lasso_select_exec(bContext *C, wmOperator *op)
if (mcords) {
bool select;
bool change;
bool changed;
select = !RNA_boolean_get(op->ptr, "deselect");
change = do_lasso_select_mesh_uv(C, mcords, mcords_tot, select);
changed = do_lasso_select_mesh_uv(C, mcords, mcords_tot, select);
MEM_freeN((void *)mcords);
return change ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
return OPERATOR_PASS_THROUGH;
@ -3184,19 +3184,19 @@ static int uv_snap_cursor_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
bool change = false;
bool changed = false;
switch (RNA_enum_get(op->ptr, "target")) {
case 0:
uv_snap_cursor_to_pixels(sima);
change = true;
changed = true;
break;
case 1:
change = uv_snap_cursor_to_selection(scene, ima, obedit, sima);
changed = uv_snap_cursor_to_selection(scene, ima, obedit, sima);
break;
}
if (!change)
if (!changed)
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, sima);
@ -3235,7 +3235,7 @@ static bool uv_snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, cons
BMIter iter, liter;
MTexPoly *tface;
MLoopUV *luv;
bool change = false;
bool changed = false;
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
const int cd_poly_tex_offset = CustomData_get_offset(&em->bm->pdata, CD_MTEXPOLY);
@ -3249,12 +3249,12 @@ static bool uv_snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, cons
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
copy_v2_v2 (luv->uv, cursor);
change = true;
changed = true;
}
}
}
return change;
return changed;
}
static bool uv_snap_uvs_offset(Scene *scene, Image *ima, Object *obedit, const float offset[2])
@ -3265,7 +3265,7 @@ static bool uv_snap_uvs_offset(Scene *scene, Image *ima, Object *obedit, const f
BMIter iter, liter;
MTexPoly *tface;
MLoopUV *luv;
bool change = false;
bool changed = false;
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
const int cd_poly_tex_offset = CustomData_get_offset(&em->bm->pdata, CD_MTEXPOLY);
@ -3279,15 +3279,15 @@ static bool uv_snap_uvs_offset(Scene *scene, Image *ima, Object *obedit, const f
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
add_v2_v2(luv->uv, offset);
change = true;
changed = true;
}
}
}
return change;
return changed;
}
static int uv_snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obedit)
static bool uv_snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obedit)
{
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
@ -3296,7 +3296,7 @@ static int uv_snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *
BMIter iter, liter, lsubiter;
MTexPoly *tface;
MLoopUV *luv;
bool change = false;
bool changed = false;
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
const int cd_poly_tex_offset = CustomData_get_offset(&bm->pdata, CD_MTEXPOLY);
@ -3335,14 +3335,14 @@ static int uv_snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *
if (uv_tot) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
mul_v2_v2fl(luv->uv, uv, 1.0f / (float)uv_tot);
change = true;
changed = true;
}
}
}
}
}
return change;
return changed;
}
static bool uv_snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit)
@ -3356,7 +3356,7 @@ static bool uv_snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit
MLoopUV *luv;
int width = 0, height = 0;
float w, h;
bool change = false;
bool changed = false;
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
const int cd_poly_tex_offset = CustomData_get_offset(&em->bm->pdata, CD_MTEXPOLY);
@ -3377,10 +3377,10 @@ static bool uv_snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit
}
}
change = true;
changed = true;
}
return change;
return changed;
}
static int uv_snap_selection_exec(bContext *C, wmOperator *op)
@ -3389,14 +3389,14 @@ static int uv_snap_selection_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
bool change = false;
bool changed = false;
switch (RNA_enum_get(op->ptr, "target")) {
case 0:
change = uv_snap_uvs_to_pixels(sima, scene, obedit);
changed = uv_snap_uvs_to_pixels(sima, scene, obedit);
break;
case 1:
change = uv_snap_uvs_to_cursor(scene, ima, obedit, sima->cursor);
changed = uv_snap_uvs_to_cursor(scene, ima, obedit, sima->cursor);
break;
case 2:
{
@ -3404,16 +3404,16 @@ static int uv_snap_selection_exec(bContext *C, wmOperator *op)
if (uvedit_center(scene, ima, obedit, center, sima->around)) {
float offset[2];
sub_v2_v2v2(offset, sima->cursor, center);
change = uv_snap_uvs_offset(scene, ima, obedit, offset);
changed = uv_snap_uvs_offset(scene, ima, obedit, offset);
}
break;
}
case 3:
change = uv_snap_uvs_to_adjacent_unselected(scene, ima, obedit);
changed = uv_snap_uvs_to_adjacent_unselected(scene, ima, obedit);
break;
}
if (!change)
if (!changed)
return OPERATOR_CANCELLED;
uvedit_live_unwrap_update(sima, scene, obedit);

View File

@ -235,7 +235,7 @@ int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, short c
void WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */
void WM_operator_properties_sanitize(struct PointerRNA *ptr, const bool no_context); /* make props context sensitive or not */
int WM_operator_properties_default(struct PointerRNA *ptr, const bool do_update);
bool WM_operator_properties_default(struct PointerRNA *ptr, const bool do_update);
void WM_operator_properties_reset(struct wmOperator *op);
void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot);

View File

@ -890,7 +890,7 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event)
#if 1 /* may want to disable operator remembering previous state for testing */
bool WM_operator_last_properties_init(wmOperator *op)
{
bool change = false;
bool changed = false;
if (op->type->last_properties) {
PropertyRNA *iterprop;
@ -916,7 +916,7 @@ bool WM_operator_last_properties_init(wmOperator *op)
idp_dst->flag |= IDP_FLAG_GHOST;
IDP_ReplaceInGroup(op->properties, idp_dst);
change = true;
changed = true;
}
}
}
@ -924,7 +924,7 @@ bool WM_operator_last_properties_init(wmOperator *op)
RNA_PROP_END;
}
return change;
return changed;
}
bool WM_operator_last_properties_store(wmOperator *op)

View File

@ -863,9 +863,9 @@ void WM_operator_properties_sanitize(PointerRNA *ptr, const bool no_context)
* \note, theres nothing specific to operators here.
* this could be made a general function.
*/
int WM_operator_properties_default(PointerRNA *ptr, const bool do_update)
bool WM_operator_properties_default(PointerRNA *ptr, const bool do_update)
{
int is_change = FALSE;
bool changed = false;
RNA_STRUCT_BEGIN (ptr, prop)
{
switch (RNA_property_type(prop)) {
@ -874,14 +874,14 @@ int WM_operator_properties_default(PointerRNA *ptr, const bool do_update)
StructRNA *ptype = RNA_property_pointer_type(ptr, prop);
if (ptype != &RNA_Struct) {
PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
is_change |= WM_operator_properties_default(&opptr, do_update);
changed |= WM_operator_properties_default(&opptr, do_update);
}
break;
}
default:
if ((do_update == false) || (RNA_property_is_set(ptr, prop) == FALSE)) {
if (RNA_property_reset(ptr, prop, -1)) {
is_change = 1;
changed = true;
}
}
break;
@ -889,7 +889,7 @@ int WM_operator_properties_default(PointerRNA *ptr, const bool do_update)
}
RNA_STRUCT_END;
return is_change;
return changed;
}
/* remove all props without PROP_SKIP_SAVE */