Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_edit.c
| Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | |||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| #include "GPU_material.h" | #include "GPU_material.h" | ||||
| #include "outliner_intern.h" | #include "outliner_intern.h" | ||||
| static void outliner_show_active(SpaceOutliner *space_outliner, | |||||
| ARegion *region, | |||||
| TreeElement *te, | |||||
| ID *id); | |||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Highlight on Cursor Motion Operator | /** \name Highlight on Cursor Motion Operator | ||||
| * \{ */ | * \{ */ | ||||
| static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) | static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | static TreeElement *outliner_item_rename_find_hovered(const SpaceOutliner *space_outliner, | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *event) | static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| ARegion *region = CTX_wm_region(C); | ARegion *region = CTX_wm_region(C); | ||||
| View2D *v2d = ®ion->v2d; | |||||
| SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); | SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); | ||||
| const bool use_active = RNA_boolean_get(op->ptr, "use_active"); | const bool use_active = RNA_boolean_get(op->ptr, "use_active"); | ||||
| TreeElement *te = use_active ? outliner_item_rename_find_active(space_outliner, op->reports) : | TreeElement *te = use_active ? outliner_item_rename_find_active(space_outliner, op->reports) : | ||||
| outliner_item_rename_find_hovered(space_outliner, region, event); | outliner_item_rename_find_hovered(space_outliner, region, event); | ||||
| if (!te) { | if (!te) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| /* Force element into view */ | |||||
| outliner_show_active(space_outliner, region, te, TREESTORE(te)->id); | |||||
| int size_y = BLI_rcti_size_y(&v2d->mask) + 1; | |||||
| int ytop = (te->ys + (size_y / 2)); | |||||
| int delta_y = ytop - v2d->cur.ymax; | |||||
| outliner_scroll_view(region, delta_y); | |||||
| do_item_rename(region, te, TREESTORE(te), op->reports); | do_item_rename(region, te, TREESTORE(te), op->reports); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void OUTLINER_OT_item_rename(wmOperatorType *ot) | void OUTLINER_OT_item_rename(wmOperatorType *ot) | ||||
| { | { | ||||
| ot->name = "Rename"; | ot->name = "Rename"; | ||||
| ▲ Show 20 Lines • Show All 1,952 Lines • Show Last 20 Lines | |||||