From b7525978059c0815f211348a8cabd5bd098b3d7c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 6 Feb 2015 18:16:46 +1100 Subject: cleanup: use bool args & redundant casts --- source/blender/editors/interface/interface_ops.c | 2 +- source/blender/editors/space_node/space_node.c | 8 ++++---- .../blender/editors/space_outliner/outliner_edit.c | 12 ++++++----- .../editors/space_outliner/outliner_intern.h | 2 +- .../editors/space_outliner/space_outliner.c | 24 +++++++++++----------- source/blender/editors/space_view3d/space_view3d.c | 16 +++++++-------- 6 files changed, 33 insertions(+), 31 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 9bd09b571db..19e389154e4 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -858,7 +858,7 @@ int UI_drop_color_poll(struct bContext *C, wmDrag *drag, const wmEvent *UNUSED(e void UI_drop_color_copy(wmDrag *drag, wmDropBox *drop) { - uiDragColorHandle *drag_info = (uiDragColorHandle *)drag->poin; + uiDragColorHandle *drag_info = drag->poin; RNA_float_set_array(drop->ptr, "color", drag_info->color); RNA_boolean_set(drop->ptr, "gamma", drag_info->gamma_corrected); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index e3baddef158..62cb0bc73cd 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -668,7 +668,7 @@ static void node_main_area_draw(const bContext *C, ARegion *ar) static int node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (GS(id->name) == ID_IM) return 1; } @@ -682,7 +682,7 @@ static int node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent * static int node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (GS(id->name) == ID_MSK) return 1; } @@ -691,14 +691,14 @@ static int node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent static void node_id_drop_copy(wmDrag *drag, wmDropBox *drop) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; RNA_string_set(drop->ptr, "name", id->name + 2); } static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (id) { RNA_string_set(drop->ptr, "name", id->name + 2); diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 9502ac50a44..9514a04e46f 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -97,7 +97,9 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te } #endif -static TreeElement *outliner_dropzone_element(const SpaceOops *soops, TreeElement *te, const float fmval[2], const int children) +static TreeElement *outliner_dropzone_element( + const SpaceOops *soops, TreeElement *te, + const float fmval[2], const bool children) { if ((fmval[1] > te->ys) && (fmval[1] < (te->ys + UI_UNIT_Y))) { /* name and first icon */ @@ -116,7 +118,7 @@ static TreeElement *outliner_dropzone_element(const SpaceOops *soops, TreeElemen } /* Used for drag and drop parenting */ -TreeElement *outliner_dropzone_find(const SpaceOops *soops, const float fmval[2], const int children) +TreeElement *outliner_dropzone_find(const SpaceOops *soops, const float fmval[2], const bool children) { TreeElement *te; @@ -1502,7 +1504,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event) UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]); /* Find object hovered over */ - te = outliner_dropzone_find(soops, fmval, 1); + te = outliner_dropzone_find(soops, fmval, true); if (te) { RNA_string_set(op->ptr, "parent", te->name); @@ -1717,7 +1719,7 @@ static int scene_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event) UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]); /* Find object hovered over */ - te = outliner_dropzone_find(soops, fmval, 0); + te = outliner_dropzone_find(soops, fmval, false); if (te) { Base *base; @@ -1787,7 +1789,7 @@ static int material_drop_invoke(bContext *C, wmOperator *op, const wmEvent *even UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]); /* Find object hovered over */ - te = outliner_dropzone_find(soops, fmval, 1); + te = outliner_dropzone_find(soops, fmval, true); if (te) { RNA_string_set(op->ptr, "object", te->name); diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 317d33dd3e2..c7ac561734a 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -205,7 +205,7 @@ void group_toggle_renderability_cb(struct bContext *C, struct Scene *scene, Tree void item_rename_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem); -TreeElement *outliner_dropzone_find(const struct SpaceOops *soops, const float fmval[2], const int children); +TreeElement *outliner_dropzone_find(const struct SpaceOops *soops, const float fmval[2], const bool children); /* ...................................................... */ void OUTLINER_OT_item_activate(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 504d9628d98..171a11c114e 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -98,10 +98,10 @@ static int outliner_parent_drop_poll(bContext *C, wmDrag *drag, const wmEvent *e UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]); if (drag->type == WM_DRAG_ID) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (GS(id->name) == ID_OB) { /* Ensure item under cursor is valid drop target */ - TreeElement *te = outliner_dropzone_find(soops, fmval, 1); + TreeElement *te = outliner_dropzone_find(soops, fmval, true); if (te && te->idcode == ID_OB && TREESTORE(te)->type == 0) { Scene *scene; @@ -129,7 +129,7 @@ static int outliner_parent_drop_poll(bContext *C, wmDrag *drag, const wmEvent *e static void outliner_parent_drop_copy(wmDrag *drag, wmDropBox *drop) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; RNA_string_set(drop->ptr, "child", id->name + 2); } @@ -148,10 +148,10 @@ static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent * } if (drag->type == WM_DRAG_ID) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (GS(id->name) == ID_OB) { if (((Object *)id)->parent) { - if ((te = outliner_dropzone_find(soops, fmval, 1))) { + if ((te = outliner_dropzone_find(soops, fmval, true))) { TreeStoreElem *tselem = TREESTORE(te); switch (te->idcode) { @@ -171,7 +171,7 @@ static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent * static void outliner_parent_clear_copy(wmDrag *drag, wmDropBox *drop) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; RNA_string_set(drop->ptr, "dragged_obj", id->name + 2); /* Set to simple parent clear type. Avoid menus for drag and drop if possible. @@ -188,10 +188,10 @@ static int outliner_scene_drop_poll(bContext *C, wmDrag *drag, const wmEvent *ev UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]); if (drag->type == WM_DRAG_ID) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (GS(id->name) == ID_OB) { /* Ensure item under cursor is valid drop target */ - TreeElement *te = outliner_dropzone_find(soops, fmval, 0); + TreeElement *te = outliner_dropzone_find(soops, fmval, false); return (te && te->idcode == ID_SCE && TREESTORE(te)->type == 0); } } @@ -200,7 +200,7 @@ static int outliner_scene_drop_poll(bContext *C, wmDrag *drag, const wmEvent *ev static void outliner_scene_drop_copy(wmDrag *drag, wmDropBox *drop) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; RNA_string_set(drop->ptr, "object", id->name + 2); } @@ -213,10 +213,10 @@ static int outliner_material_drop_poll(bContext *C, wmDrag *drag, const wmEvent UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]); if (drag->type == WM_DRAG_ID) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (GS(id->name) == ID_MA) { /* Ensure item under cursor is valid drop target */ - TreeElement *te = outliner_dropzone_find(soops, fmval, 1); + TreeElement *te = outliner_dropzone_find(soops, fmval, true); return (te && te->idcode == ID_OB && TREESTORE(te)->type == 0); } } @@ -225,7 +225,7 @@ static int outliner_material_drop_poll(bContext *C, wmDrag *drag, const wmEvent static void outliner_material_drop_copy(wmDrag *drag, wmDropBox *drop) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; RNA_string_set(drop->ptr, "material", id->name + 2); } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 17cecc3dc1d..25085368dac 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -564,7 +564,7 @@ static void view3d_main_area_exit(wmWindowManager *wm, ARegion *ar) static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (GS(id->name) == ID_OB) return 1; } @@ -574,7 +574,7 @@ static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent static int view3d_group_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (GS(id->name) == ID_GR) return 1; } @@ -584,7 +584,7 @@ static int view3d_group_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEve static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (GS(id->name) == ID_MA) return 1; } @@ -594,7 +594,7 @@ static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (GS(id->name) == ID_IM) return 1; } @@ -641,14 +641,14 @@ static int view3d_ima_mesh_drop_poll(bContext *C, wmDrag *drag, const wmEvent *e static void view3d_ob_drop_copy(wmDrag *drag, wmDropBox *drop) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; RNA_string_set(drop->ptr, "name", id->name + 2); } static void view3d_group_drop_copy(wmDrag *drag, wmDropBox *drop) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; drop->opcontext = WM_OP_EXEC_DEFAULT; RNA_string_set(drop->ptr, "name", id->name + 2); @@ -656,14 +656,14 @@ static void view3d_group_drop_copy(wmDrag *drag, wmDropBox *drop) static void view3d_id_drop_copy(wmDrag *drag, wmDropBox *drop) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; RNA_string_set(drop->ptr, "name", id->name + 2); } static void view3d_id_path_drop_copy(wmDrag *drag, wmDropBox *drop) { - ID *id = (ID *)drag->poin; + ID *id = drag->poin; if (id) { RNA_string_set(drop->ptr, "name", id->name + 2); -- cgit v1.2.3