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
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2019-12-20 19:35:12 +0300
committerAntonio Vazquez <blendergit@gmail.com>2019-12-20 19:35:26 +0300
commit39112a4f7b2b5e65dd73b13215e9df67f27ab88a (patch)
treeaafc1aad9a04327d9e26b4ac4b9ac74affa5a0e1 /source/blender/editors/space_outliner
parent5804f18b1fc56166ca0caa573beec67d697d1132 (diff)
UI: Remove orphan datablocks directly from File->Clean Up menu
Actually, to purge orphans datablock you need go to Outliner, enable Orphan mode and press Purge button (that sometimes is out of the view because the window is too narrow). To have this option hidden make very difficult to users use and understand what means orphan data, so this patch just adds a new Clean Up menu to File menu with this option. This menu could be used in the future for more clean up options. To have a general Clean Up menu is common used in other softwares. Reviewed By: billreynish, mont29 Differential Revision: https://developer.blender.org/D6445
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index c8a6c2a87e3..8c4df1d7a7b 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -1311,7 +1311,8 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
outliner_show_active(so, ar, te, id);
}
- /* Also open back from the active_element (only done for the first found occurance of ID though). */
+ /* Also open back from the active_element (only done for the first found occurance of ID
+ * though). */
outliner_show_active(so, ar, active_element, id);
/* Center view on first element found */
@@ -2176,9 +2177,15 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
static bool ed_operator_outliner_id_orphans_active(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
- if ((sa) && (sa->spacetype == SPACE_OUTLINER)) {
- SpaceOutliner *so = CTX_wm_space_outliner(C);
- return (so->outlinevis == SO_ID_ORPHANS);
+ if (sa != NULL) {
+ if (sa->spacetype == SPACE_TOPBAR) {
+ return true;
+ }
+
+ if (sa->spacetype == SPACE_OUTLINER) {
+ SpaceOutliner *so = CTX_wm_space_outliner(C);
+ return (so->outlinevis == SO_ID_ORPHANS);
+ }
}
return 0;
}
@@ -2245,6 +2252,7 @@ static int outliner_orphans_purge_invoke(bContext *C, wmOperator *op, const wmEv
static int outliner_orphans_purge_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
+ ScrArea *sa = CTX_wm_area(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
int num_tagged[INDEX_ID_MAX] = {0};
@@ -2271,7 +2279,9 @@ static int outliner_orphans_purge_exec(bContext *C, wmOperator *op)
* outliner several mouse events can be handled in one cycle without
* handling notifiers/redraw which leads to deleting the same object twice.
* cleanup tree here to prevent such cases. */
- outliner_cleanup_tree(soops);
+ if ((sa != NULL) && (sa->spacetype == SPACE_OUTLINER)) {
+ outliner_cleanup_tree(soops);
+ }
DEG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);