diff options
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_edit.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_edit.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 8eb53d0d7b9..345ac353c11 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -117,9 +117,7 @@ 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 bool children) +static TreeElement *outliner_dropzone_element(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 */ @@ -129,7 +127,7 @@ static TreeElement *outliner_dropzone_element( /* Not it. Let's look at its children. */ if (children && (TREESTORE(te)->flag & TSE_CLOSED) == 0 && (te->subtree.first)) { for (te = te->subtree.first; te; te = te->next) { - TreeElement *te_valid = outliner_dropzone_element(soops, te, fmval, children); + TreeElement *te_valid = outliner_dropzone_element(te, fmval, children); if (te_valid) return te_valid; } @@ -143,7 +141,7 @@ TreeElement *outliner_dropzone_find(const SpaceOops *soops, const float fmval[2] TreeElement *te; for (te = soops->tree.first; te; te = te->next) { - TreeElement *te_valid = outliner_dropzone_element(soops, te, fmval, children); + TreeElement *te_valid = outliner_dropzone_element(te, fmval, children); if (te_valid) return te_valid; } @@ -164,7 +162,7 @@ static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement /* all below close/open? */ if (all) { tselem->flag &= ~TSE_CLOSED; - outliner_set_flag(soops, &te->subtree, TSE_CLOSED, !outliner_has_one_flag(soops, &te->subtree, TSE_CLOSED, 1)); + outliner_set_flag(&te->subtree, TSE_CLOSED, !outliner_has_one_flag(&te->subtree, TSE_CLOSED, 1)); } else { if (tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED; @@ -252,7 +250,7 @@ void item_rename_cb( do_item_rename(ar, te, tselem, reports); } -static int do_outliner_item_rename(ReportList *reports, ARegion *ar, SpaceOops *soops, TreeElement *te, const float mval[2]) +static int do_outliner_item_rename(ReportList *reports, ARegion *ar, TreeElement *te, const float mval[2]) { if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) { TreeStoreElem *tselem = TREESTORE(te); @@ -266,7 +264,7 @@ static int do_outliner_item_rename(ReportList *reports, ARegion *ar, SpaceOops * } for (te = te->subtree.first; te; te = te->next) { - if (do_outliner_item_rename(reports, ar, soops, te, mval)) return 1; + if (do_outliner_item_rename(reports, ar, te, mval)) return 1; } return 0; } @@ -282,7 +280,7 @@ static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *even UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]); for (te = soops->tree.first; te; te = te->next) { - if (do_outliner_item_rename(op->reports, ar, soops, te, fmval)) { + if (do_outliner_item_rename(op->reports, ar, te, fmval)) { changed = true; break; } @@ -713,20 +711,20 @@ void lib_reload_cb( /* Apply Settings ------------------------------- */ -static int outliner_count_levels(SpaceOops *soops, ListBase *lb, const int curlevel) +static int outliner_count_levels(ListBase *lb, const int curlevel) { TreeElement *te; int level = curlevel, lev; for (te = lb->first; te; te = te->next) { - lev = outliner_count_levels(soops, &te->subtree, curlevel + 1); + lev = outliner_count_levels(&te->subtree, curlevel + 1); if (lev > level) level = lev; } return level; } -int outliner_has_one_flag(SpaceOops *soops, ListBase *lb, short flag, const int curlevel) +int outliner_has_one_flag(ListBase *lb, short flag, const int curlevel) { TreeElement *te; TreeStoreElem *tselem; @@ -736,13 +734,13 @@ int outliner_has_one_flag(SpaceOops *soops, ListBase *lb, short flag, const int tselem = TREESTORE(te); if (tselem->flag & flag) return curlevel; - level = outliner_has_one_flag(soops, &te->subtree, flag, curlevel + 1); + level = outliner_has_one_flag(&te->subtree, flag, curlevel + 1); if (level) return level; } return 0; } -void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short set) +void outliner_set_flag(ListBase *lb, short flag, short set) { TreeElement *te; TreeStoreElem *tselem; @@ -751,7 +749,7 @@ void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short set) tselem = TREESTORE(te); if (set == 0) tselem->flag &= ~flag; else tselem->flag |= flag; - outliner_set_flag(soops, &te->subtree, flag, set); + outliner_set_flag(&te->subtree, flag, set); } } @@ -964,10 +962,10 @@ static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op)) SpaceOops *soops = CTX_wm_space_outliner(C); ARegion *ar = CTX_wm_region(C); - if (outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1)) - outliner_set_flag(soops, &soops->tree, TSE_CLOSED, 0); + if (outliner_has_one_flag(&soops->tree, TSE_CLOSED, 1)) + outliner_set_flag(&soops->tree, TSE_CLOSED, 0); else - outliner_set_flag(soops, &soops->tree, TSE_CLOSED, 1); + outliner_set_flag(&soops->tree, TSE_CLOSED, 1); ED_region_tag_redraw(ar); @@ -996,10 +994,10 @@ static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op)) ARegion *ar = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); - if (outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1)) - outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0); + if (outliner_has_one_flag(&soops->tree, TSE_SELECTED, 1)) + outliner_set_flag(&soops->tree, TSE_SELECTED, 0); else - outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 1); + outliner_set_flag(&soops->tree, TSE_SELECTED, 1); soops->storeflag |= SO_TREESTORE_REDRAW; @@ -1097,13 +1095,13 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op)) if (obact->mode & OB_MODE_POSE) { bPoseChannel *pchan = CTX_data_active_pose_bone(C); if (pchan) { - te = outliner_find_posechannel(so, &te_obact->subtree, pchan); + te = outliner_find_posechannel(&te_obact->subtree, pchan); } } else if (obact->mode & OB_MODE_EDIT) { EditBone *ebone = CTX_data_active_bone(C); if (ebone) { - te = outliner_find_editbone(so, &te_obact->subtree, ebone); + te = outliner_find_editbone(&te_obact->subtree, ebone); } } } @@ -1298,7 +1296,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so /* Show One Level ----------------------------------------------- */ /* helper function for Show/Hide one level operator */ -static void outliner_openclose_level(SpaceOops *soops, ListBase *lb, int curlevel, int level, int open) +static void outliner_openclose_level(ListBase *lb, int curlevel, int level, int open) { TreeElement *te; TreeStoreElem *tselem; @@ -1313,7 +1311,7 @@ static void outliner_openclose_level(SpaceOops *soops, ListBase *lb, int curleve if (curlevel >= level) tselem->flag |= TSE_CLOSED; } - outliner_openclose_level(soops, &te->subtree, curlevel + 1, level, open); + outliner_openclose_level(&te->subtree, curlevel + 1, level, open); } } @@ -1324,13 +1322,13 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op) const bool add = RNA_boolean_get(op->ptr, "open"); int level; - level = outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1); + level = outliner_has_one_flag(&soops->tree, TSE_CLOSED, 1); if (add == 1) { - if (level) outliner_openclose_level(soops, &soops->tree, 1, level, 1); + if (level) outliner_openclose_level(&soops->tree, 1, level, 1); } else { - if (level == 0) level = outliner_count_levels(soops, &soops->tree, 0); - if (level) outliner_openclose_level(soops, &soops->tree, 1, level - 1, 0); + if (level == 0) level = outliner_count_levels(&soops->tree, 0); + if (level) outliner_openclose_level(&soops->tree, 1, level - 1, 0); } ED_region_tag_redraw(ar); @@ -1361,7 +1359,7 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot) /* Show Hierarchy ----------------------------------------------- */ /* helper function for tree_element_shwo_hierarchy() - recursively checks whether subtrees have any objects*/ -static int subtree_has_objects(SpaceOops *soops, ListBase *lb) +static int subtree_has_objects(ListBase *lb) { TreeElement *te; TreeStoreElem *tselem; @@ -1369,7 +1367,7 @@ static int subtree_has_objects(SpaceOops *soops, ListBase *lb) for (te = lb->first; te; te = te->next) { tselem = TREESTORE(te); if (tselem->type == 0 && te->idcode == ID_OB) return 1; - if (subtree_has_objects(soops, &te->subtree)) return 1; + if (subtree_has_objects(&te->subtree)) return 1; } return 0; } @@ -1390,7 +1388,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase else tselem->flag &= ~TSE_CLOSED; } else if (te->idcode == ID_OB) { - if (subtree_has_objects(soops, &te->subtree)) tselem->flag &= ~TSE_CLOSED; + if (subtree_has_objects(&te->subtree)) tselem->flag &= ~TSE_CLOSED; else tselem->flag |= TSE_CLOSED; } } |