Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-09-23 11:18:43 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-09-23 11:22:46 +0300
commita6b16cfd801faf0e7ec933fd516227d8e2bc2a2c (patch)
tree8082e27a2e6159507e5bd8f25f7876cbd7f337b9 /source/blender/editors/object
parent286909ded74390e3ad5d97560fa6ff34012acce8 (diff)
Cleanup: remove 'r_' prefix for variables
This is for return arguments, also remove redundant NULL check.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_modes.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c
index 79846b42c65..cde70107d29 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -402,18 +402,17 @@ bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, struct Object
/* -------------------------------------------------------------------- */
/** \name Switch Object
*
- * Enters the same mode of the current active object in another object, leaving the mode of the
- *current object.
- *
+ * Enters the same mode of the current active object in another object,
+ * leaving the mode of the current object.
* \{ */
static bool object_switch_object_poll(bContext *C)
{
- Object *ob = CTX_data_active_object(C);
if (!CTX_wm_region_view3d(C)) {
return false;
}
- return ob && ELEM(ob->mode, OB_MODE_EDIT, OB_MODE_SCULPT);
+ const Object *ob = CTX_data_active_object(C);
+ return ob && (ob->mode & (OB_MODE_EDIT | OB_MODE_SCULPT));
}
static int object_switch_object_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
@@ -435,11 +434,11 @@ static int object_switch_object_invoke(bContext *C, wmOperator *UNUSED(op), cons
float ray_co[3], ray_no[3];
float ray_dist = BVH_RAYCAST_DIST_MAX;
- int r_index;
+ int index_dummy;
ED_view3d_win_to_origin(ar, mouse, ray_co);
ED_view3d_win_to_vector(ar, mouse, ray_no);
- Object *r_ob = NULL;
+ Object *ob_dst = NULL;
bool ret = ED_transform_snap_object_project_ray_ex(sctx,
depsgraph,
@@ -451,33 +450,34 @@ static int object_switch_object_invoke(bContext *C, wmOperator *UNUSED(op), cons
&ray_dist,
global_loc,
global_normal,
- &r_index,
- &r_ob,
+ &index_dummy,
+ &ob_dst,
(float(*)[4])r_obmat);
ED_transform_snap_object_context_destroy(sctx);
- Object *c_ob = CTX_data_active_object(C);
- if (!ret || r_ob == NULL) {
+ if (!ret || ob_dst == NULL) {
return OPERATOR_CANCELLED;
}
- if (r_ob == NULL || r_ob == c_ob) {
+
+ Object *ob_src = CTX_data_active_object(C);
+ if (ob_dst == ob_src) {
return OPERATOR_CANCELLED;
}
- eObjectMode last_mode = (eObjectMode)c_ob->mode;
- if (!ED_object_mode_compat_test(r_ob, last_mode)) {
+ eObjectMode last_mode = (eObjectMode)ob_src->mode;
+ if (!ED_object_mode_compat_test(ob_dst, last_mode)) {
return OPERATOR_CANCELLED;
}
- ED_object_mode_generic_exit(bmain, depsgraph, scene, c_ob);
+ ED_object_mode_generic_exit(bmain, depsgraph, scene, ob_src);
- Object *ob_orig = DEG_get_original_object(r_ob);
- Base *base = BKE_view_layer_base_find(view_layer, ob_orig);
+ Object *ob_dst_orig = DEG_get_original_object(ob_dst);
+ Base *base = BKE_view_layer_base_find(view_layer, ob_dst_orig);
BKE_view_layer_base_deselect_all(view_layer);
BKE_view_layer_base_select_and_set_active(view_layer, base);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- ob_orig = DEG_get_original_object(r_ob);
+ ob_dst_orig = DEG_get_original_object(ob_dst);
ED_object_mode_set(C, last_mode);
/* Update the viewport rotation origin to the mouse cursor. */