cleanup: use bool args & redundant casts
This commit is contained in:
@@ -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)
|
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_float_set_array(drop->ptr, "color", drag_info->color);
|
||||||
RNA_boolean_set(drop->ptr, "gamma", drag_info->gamma_corrected);
|
RNA_boolean_set(drop->ptr, "gamma", drag_info->gamma_corrected);
|
||||||
|
|||||||
@@ -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))
|
static int node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
|
||||||
{
|
{
|
||||||
if (drag->type == WM_DRAG_ID) {
|
if (drag->type == WM_DRAG_ID) {
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
if (GS(id->name) == ID_IM)
|
if (GS(id->name) == ID_IM)
|
||||||
return 1;
|
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))
|
static int node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
|
||||||
{
|
{
|
||||||
if (drag->type == WM_DRAG_ID) {
|
if (drag->type == WM_DRAG_ID) {
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
if (GS(id->name) == ID_MSK)
|
if (GS(id->name) == ID_MSK)
|
||||||
return 1;
|
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)
|
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);
|
RNA_string_set(drop->ptr, "name", id->name + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
|
static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
|
||||||
{
|
{
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
RNA_string_set(drop->ptr, "name", id->name + 2);
|
RNA_string_set(drop->ptr, "name", id->name + 2);
|
||||||
|
|||||||
@@ -97,7 +97,9 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te
|
|||||||
}
|
}
|
||||||
#endif
|
#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))) {
|
if ((fmval[1] > te->ys) && (fmval[1] < (te->ys + UI_UNIT_Y))) {
|
||||||
/* name and first icon */
|
/* name and first icon */
|
||||||
@@ -116,7 +118,7 @@ static TreeElement *outliner_dropzone_element(const SpaceOops *soops, TreeElemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Used for drag and drop parenting */
|
/* 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;
|
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]);
|
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
|
||||||
|
|
||||||
/* Find object hovered over */
|
/* Find object hovered over */
|
||||||
te = outliner_dropzone_find(soops, fmval, 1);
|
te = outliner_dropzone_find(soops, fmval, true);
|
||||||
|
|
||||||
if (te) {
|
if (te) {
|
||||||
RNA_string_set(op->ptr, "parent", te->name);
|
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]);
|
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
|
||||||
|
|
||||||
/* Find object hovered over */
|
/* Find object hovered over */
|
||||||
te = outliner_dropzone_find(soops, fmval, 0);
|
te = outliner_dropzone_find(soops, fmval, false);
|
||||||
|
|
||||||
if (te) {
|
if (te) {
|
||||||
Base *base;
|
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]);
|
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
|
||||||
|
|
||||||
/* Find object hovered over */
|
/* Find object hovered over */
|
||||||
te = outliner_dropzone_find(soops, fmval, 1);
|
te = outliner_dropzone_find(soops, fmval, true);
|
||||||
|
|
||||||
if (te) {
|
if (te) {
|
||||||
RNA_string_set(op->ptr, "object", te->name);
|
RNA_string_set(op->ptr, "object", te->name);
|
||||||
|
|||||||
@@ -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);
|
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);
|
void OUTLINER_OT_item_activate(struct wmOperatorType *ot);
|
||||||
|
|||||||
@@ -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]);
|
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
|
||||||
|
|
||||||
if (drag->type == WM_DRAG_ID) {
|
if (drag->type == WM_DRAG_ID) {
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
if (GS(id->name) == ID_OB) {
|
if (GS(id->name) == ID_OB) {
|
||||||
/* Ensure item under cursor is valid drop target */
|
/* 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) {
|
if (te && te->idcode == ID_OB && TREESTORE(te)->type == 0) {
|
||||||
Scene *scene;
|
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)
|
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);
|
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) {
|
if (drag->type == WM_DRAG_ID) {
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
if (GS(id->name) == ID_OB) {
|
if (GS(id->name) == ID_OB) {
|
||||||
if (((Object *)id)->parent) {
|
if (((Object *)id)->parent) {
|
||||||
if ((te = outliner_dropzone_find(soops, fmval, 1))) {
|
if ((te = outliner_dropzone_find(soops, fmval, true))) {
|
||||||
TreeStoreElem *tselem = TREESTORE(te);
|
TreeStoreElem *tselem = TREESTORE(te);
|
||||||
|
|
||||||
switch (te->idcode) {
|
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)
|
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);
|
RNA_string_set(drop->ptr, "dragged_obj", id->name + 2);
|
||||||
|
|
||||||
/* Set to simple parent clear type. Avoid menus for drag and drop if possible.
|
/* 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]);
|
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
|
||||||
|
|
||||||
if (drag->type == WM_DRAG_ID) {
|
if (drag->type == WM_DRAG_ID) {
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
if (GS(id->name) == ID_OB) {
|
if (GS(id->name) == ID_OB) {
|
||||||
/* Ensure item under cursor is valid drop target */
|
/* 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);
|
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)
|
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);
|
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]);
|
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
|
||||||
|
|
||||||
if (drag->type == WM_DRAG_ID) {
|
if (drag->type == WM_DRAG_ID) {
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
if (GS(id->name) == ID_MA) {
|
if (GS(id->name) == ID_MA) {
|
||||||
/* Ensure item under cursor is valid drop target */
|
/* 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);
|
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)
|
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);
|
RNA_string_set(drop->ptr, "material", id->name + 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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))
|
static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
|
||||||
{
|
{
|
||||||
if (drag->type == WM_DRAG_ID) {
|
if (drag->type == WM_DRAG_ID) {
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
if (GS(id->name) == ID_OB)
|
if (GS(id->name) == ID_OB)
|
||||||
return 1;
|
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))
|
static int view3d_group_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
|
||||||
{
|
{
|
||||||
if (drag->type == WM_DRAG_ID) {
|
if (drag->type == WM_DRAG_ID) {
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
if (GS(id->name) == ID_GR)
|
if (GS(id->name) == ID_GR)
|
||||||
return 1;
|
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))
|
static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
|
||||||
{
|
{
|
||||||
if (drag->type == WM_DRAG_ID) {
|
if (drag->type == WM_DRAG_ID) {
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
if (GS(id->name) == ID_MA)
|
if (GS(id->name) == ID_MA)
|
||||||
return 1;
|
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))
|
static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
|
||||||
{
|
{
|
||||||
if (drag->type == WM_DRAG_ID) {
|
if (drag->type == WM_DRAG_ID) {
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
if (GS(id->name) == ID_IM)
|
if (GS(id->name) == ID_IM)
|
||||||
return 1;
|
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)
|
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);
|
RNA_string_set(drop->ptr, "name", id->name + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void view3d_group_drop_copy(wmDrag *drag, wmDropBox *drop)
|
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;
|
drop->opcontext = WM_OP_EXEC_DEFAULT;
|
||||||
RNA_string_set(drop->ptr, "name", id->name + 2);
|
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)
|
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);
|
RNA_string_set(drop->ptr, "name", id->name + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void view3d_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
|
static void view3d_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
|
||||||
{
|
{
|
||||||
ID *id = (ID *)drag->poin;
|
ID *id = drag->poin;
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
RNA_string_set(drop->ptr, "name", id->name + 2);
|
RNA_string_set(drop->ptr, "name", id->name + 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user