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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2019-07-15 19:06:32 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-07-15 19:10:26 +0300
commit0b255661435ab7021db3acafe15abe6ea0b946b5 (patch)
treedeaf24971da2a67ec779ab61a845989e4efb4fb2 /source
parent9cdd2df277b3b9b2949aee4f869b276f79ca17f4 (diff)
Fix T66955: Cannot delete data from file in outliner.
That switch on ID types had not been updated since quiet some time it’d seem... Using the ID_Type enum type now, so this should not happen again (compiler will yell at you if you forget to add here any new ID type ;) ). Also had to change a bit the code layout then, to deal with fake NLA ID type... Note that for now, Screen IDs remain excluded from the ID menu usage, due to T67004.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index a618f8ef4c2..89eb3b9d953 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -109,8 +109,9 @@ static void set_operation_types(SpaceOutliner *soops,
}
}
else {
- int idcode = GS(tselem->id->name);
- switch (idcode) {
+ const int idcode = (int)GS(tselem->id->name);
+ bool is_standard_id = false;
+ switch ((ID_Type)idcode) {
case ID_SCE:
*scenelevel = 1;
break;
@@ -134,21 +135,47 @@ static void set_operation_types(SpaceOutliner *soops,
case ID_KE:
case ID_WO:
case ID_AC:
- case ID_NLA:
case ID_TXT:
case ID_GR:
case ID_LS:
case ID_LI:
- if (*idlevel == 0) {
- *idlevel = idcode;
- }
- else if (*idlevel != idcode) {
- *idlevel = -1;
- }
- if (ELEM(*datalevel, TSE_VIEW_COLLECTION_BASE, TSE_SCENE_COLLECTION_BASE)) {
- *datalevel = 0;
- }
+ case ID_VF:
+ case ID_NT:
+ case ID_BR:
+ case ID_PA:
+ case ID_GD:
+ case ID_MC:
+ case ID_MSK:
+ case ID_PAL:
+ case ID_PC:
+ case ID_CF:
+ case ID_WS:
+ case ID_LP:
+ is_standard_id = true;
break;
+ case ID_WM:
+ case ID_SCR:
+ /* Those are ignored here. */
+ /* Note: while Screens should be manageable here, deleting a screen used by a workspace
+ * will cause crashes when trying to use that workspace, so for now let's play minimal,
+ * safe change. */
+ break;
+ }
+ if (idcode == ID_NLA) {
+ /* Fake one, not an actual ID type... */
+ is_standard_id = true;
+ }
+
+ if (is_standard_id) {
+ if (*idlevel == 0) {
+ *idlevel = idcode;
+ }
+ else if (*idlevel != idcode) {
+ *idlevel = -1;
+ }
+ if (ELEM(*datalevel, TSE_VIEW_COLLECTION_BASE, TSE_SCENE_COLLECTION_BASE)) {
+ *datalevel = 0;
+ }
}
}
}