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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-10-26 10:52:08 +0300
committerBastien Montagne <bastien@blender.org>2021-10-26 10:52:08 +0300
commitee743204b0b7fddd4a3cf315f2996467ca786500 (patch)
tree0622a978d3911692655579502467c5cb1737fd90 /source
parent5f9b00a07ebdec1a95837063e781b37d8534b11e (diff)
Cleanup: build warnings.
`NULL` instead of `nullptr` in cpp code, and `else` statements after returns.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/icons.cc2
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_operators.c90
2 files changed, 46 insertions, 46 deletions
diff --git a/source/blender/blenkernel/intern/icons.cc b/source/blender/blenkernel/intern/icons.cc
index c48f3934a19..f820b345c59 100644
--- a/source/blender/blenkernel/intern/icons.cc
+++ b/source/blender/blenkernel/intern/icons.cc
@@ -363,7 +363,7 @@ PreviewImage **BKE_previewimg_id_get_p(const ID *id)
Object *ob = (Object *)id;
/* Currently, only object types with real geometry can be rendered as preview. */
if (!OB_TYPE_IS_GEOMETRY(ob->type)) {
- return NULL;
+ return nullptr;
}
return &ob->preview;
}
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_operators.c b/source/blender/windowmanager/xr/intern/wm_xr_operators.c
index 652e357b6d5..308abc4fca4 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_operators.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_operators.c
@@ -449,10 +449,8 @@ static bool wm_xr_navigation_grab_is_locked(const XrGrabData *data, const bool b
if (bimanual) {
return data->loc_lock && data->rot_lock && data->scale_lock;
}
- else {
- /* Ignore scale lock, as one-handed interaction cannot change navigation scale. */
- return data->loc_lock && data->rot_lock;
- }
+ /* Ignore scale lock, as one-handed interaction cannot change navigation scale. */
+ return data->loc_lock && data->rot_lock;
}
static void wm_xr_navigation_grab_apply(wmXrData *xr,
@@ -558,17 +556,17 @@ static int wm_xr_navigation_grab_modal(bContext *C, wmOperator *op, const wmEven
dispatching (see #wm_xr_session_action_states_interpret()). For modal XR operators, modal
handling starts when an input is "pressed" (action state exceeds the action threshold) and
ends when the input is "released" (state falls below the threshold). */
- if (event->val == KM_PRESS) {
- return OPERATOR_RUNNING_MODAL;
- }
- else if (event->val == KM_RELEASE) {
- wm_xr_grab_uninit(op);
- return OPERATOR_FINISHED;
+ switch (event->val) {
+ case KM_PRESS:
+ return OPERATOR_RUNNING_MODAL;
+ case KM_RELEASE:
+ wm_xr_grab_uninit(op);
+ return OPERATOR_FINISHED;
+ default:
+ BLI_assert_unreachable();
+ wm_xr_grab_uninit(op);
+ return OPERATOR_CANCELLED;
}
-
- BLI_assert_unreachable();
- wm_xr_grab_uninit(op);
- return OPERATOR_CANCELLED;
}
static void WM_OT_xr_navigation_grab(wmOperatorType *ot)
@@ -1317,39 +1315,41 @@ static int wm_xr_navigation_teleport_modal(bContext *C, wmOperator *op, const wm
wm_xr_raycast_update(op, xr, actiondata);
- if (event->val == KM_PRESS) {
- return OPERATOR_RUNNING_MODAL;
- }
- else if (event->val == KM_RELEASE) {
- XrRaycastData *data = op->customdata;
- bool selectable_only, teleport_axes[3];
- float teleport_t, teleport_ofs, ray_dist;
-
- RNA_boolean_get_array(op->ptr, "teleport_axes", teleport_axes);
- teleport_t = RNA_float_get(op->ptr, "interpolation");
- teleport_ofs = RNA_float_get(op->ptr, "offset");
- selectable_only = RNA_boolean_get(op->ptr, "selectable_only");
- ray_dist = RNA_float_get(op->ptr, "distance");
-
- wm_xr_navigation_teleport(C,
- xr,
- data->origin,
- data->direction,
- &ray_dist,
- selectable_only,
- teleport_axes,
- teleport_t,
- teleport_ofs);
-
- wm_xr_raycast_uninit(op);
+ switch (event->val) {
+ case KM_PRESS:
+ return OPERATOR_RUNNING_MODAL;
+ case KM_RELEASE: {
+ XrRaycastData *data = op->customdata;
+ bool selectable_only, teleport_axes[3];
+ float teleport_t, teleport_ofs, ray_dist;
+
+ RNA_boolean_get_array(op->ptr, "teleport_axes", teleport_axes);
+ teleport_t = RNA_float_get(op->ptr, "interpolation");
+ teleport_ofs = RNA_float_get(op->ptr, "offset");
+ selectable_only = RNA_boolean_get(op->ptr, "selectable_only");
+ ray_dist = RNA_float_get(op->ptr, "distance");
+
+ wm_xr_navigation_teleport(C,
+ xr,
+ data->origin,
+ data->direction,
+ &ray_dist,
+ selectable_only,
+ teleport_axes,
+ teleport_t,
+ teleport_ofs);
+
+ wm_xr_raycast_uninit(op);
+
+ return OPERATOR_FINISHED;
+ }
+ default:
- return OPERATOR_FINISHED;
+ /* XR events currently only support press and release. */
+ BLI_assert_unreachable();
+ wm_xr_raycast_uninit(op);
+ return OPERATOR_CANCELLED;
}
-
- /* XR events currently only support press and release. */
- BLI_assert_unreachable();
- wm_xr_raycast_uninit(op);
- return OPERATOR_CANCELLED;
}
static void WM_OT_xr_navigation_teleport(wmOperatorType *ot)