[Bf-blender-cvs] [1c1be5bdf4f] master: Fix T90862: Texts in Outliner can have wrong icon

Philipp Oeser noreply at git.blender.org
Tue Sep 14 10:01:22 CEST 2021


Commit: 1c1be5bdf4fb9be0658b7d0b1ac13c563a003f1a
Author: Philipp Oeser
Date:   Mon Aug 30 15:36:39 2021 +0200
Branches: master
https://developer.blender.org/rB1c1be5bdf4fb9be0658b7d0b1ac13c563a003f1a

Fix T90862: Texts in Outliner can have wrong icon

In contrast to the Filebrowser, the Outliner (Blender File view) did not
distinguish icons for text-based formats (if they have a filepath this
can be done though).

Maniphest Tasks: T90862

Differential Revision: https://developer.blender.org/D12347

===================================================================

M	source/blender/editors/space_outliner/outliner_draw.c

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index db37c8c1c8c..a094dfb0834 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -32,6 +32,7 @@
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_sequence_types.h"
+#include "DNA_text_types.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
@@ -59,6 +60,7 @@
 #include "DEG_depsgraph_build.h"
 
 #include "ED_armature.h"
+#include "ED_fileselect.h"
 #include "ED_outliner.h"
 #include "ED_screen.h"
 
@@ -2625,9 +2627,17 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
         case ID_NLA:
           data.icon = ICON_NLA;
           break;
-        case ID_TXT:
-          data.icon = ICON_SCRIPT;
+        case ID_TXT: {
+          Text *text = (Text *)tselem->id;
+          if (text->filepath == NULL || (text->flags & TXT_ISMEM)) {
+            data.icon = ICON_FILE_TEXT;
+          }
+          else {
+            /* Helps distinguish text-based formats like the filebrowser does. */
+            data.icon = ED_file_extension_icon(text->filepath);
+          }
           break;
+        }
         case ID_GR:
           data.icon = ICON_OUTLINER_COLLECTION;
           break;



More information about the Bf-blender-cvs mailing list