[Bf-blender-cvs] [2c34e09b08f] master: Outliner: Include gpencil modifiers and effects in the tree

Nathan Craddock noreply at git.blender.org
Tue Aug 25 18:05:43 CEST 2020


Commit: 2c34e09b08fb65dd4c8b587847887564f7ec0bd4
Author: Nathan Craddock
Date:   Tue Aug 25 09:44:35 2020 -0600
Branches: master
https://developer.blender.org/rB2c34e09b08fb65dd4c8b587847887564f7ec0bd4

Outliner: Include gpencil modifiers and effects in the tree

Grease pencil modifiers already had defined outliner icons, but had
never been included in the tree. This adds the modifiers and the shader
effects to the tree.

Part of T68498

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

M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_outliner/outliner_tree.c
M	source/blender/makesdna/DNA_outliner_types.h

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

diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index cf6a86ba6d7..277ecc60669 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -2188,7 +2188,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
           GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, tselem->nr);
           switch ((GpencilModifierType)md->type) {
             case eGpencilModifierType_Noise:
-              data.icon = ICON_RNDCURVE;
+              data.icon = ICON_MOD_NOISE;
               break;
             case eGpencilModifierType_Subdiv:
               data.icon = ICON_MOD_SUBSURF;
@@ -2232,6 +2232,15 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
             case eGpencilModifierType_Armature:
               data.icon = ICON_MOD_ARMATURE;
               break;
+            case eGpencilModifierType_Multiply:
+              data.icon = ICON_GP_MULTIFRAME_EDITING;
+              break;
+            case eGpencilModifierType_Time:
+              data.icon = ICON_MOD_TIME;
+              break;
+            case eGpencilModifierType_Texture:
+              data.icon = ICON_TEXTURE;
+              break;
 
               /* Default */
             default:
@@ -2354,6 +2363,11 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
         data.icon = ICON_OUTLINER_DATA_GP_LAYER;
         break;
       }
+      case TSE_GPENCIL_EFFECT_BASE:
+      case TSE_GPENCIL_EFFECT:
+        data.drag_id = tselem->id;
+        data.icon = ICON_SHADERFX;
+        break;
       default:
         data.icon = ICON_DOT;
         break;
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 9e3cbabf283..22a7019ab91 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -32,6 +32,7 @@
 #include "DNA_camera_types.h"
 #include "DNA_collection_types.h"
 #include "DNA_constraint_types.h"
+#include "DNA_gpencil_modifier_types.h"
 #include "DNA_gpencil_types.h"
 #include "DNA_hair_types.h"
 #include "DNA_key_types.h"
@@ -46,6 +47,7 @@
 #include "DNA_pointcloud_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_sequence_types.h"
+#include "DNA_shader_fx_types.h"
 #include "DNA_simulation_types.h"
 #include "DNA_speaker_types.h"
 #include "DNA_volume_types.h"
@@ -550,6 +552,70 @@ static void outliner_add_object_contents(SpaceOutliner *space_outliner,
     }
   }
 
+  /* Grease Pencil modifiers. */
+  if (!BLI_listbase_is_empty(&ob->greasepencil_modifiers)) {
+    TreeElement *ten_mod = outliner_add_element(
+        space_outliner, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0);
+
+    ten_mod->name = IFACE_("Modifiers");
+    int index;
+    LISTBASE_FOREACH_INDEX (GpencilModifierData *, md, &ob->greasepencil_modifiers, index) {
+      TreeElement *ten = outliner_add_element(
+          space_outliner, &ten_mod->subtree, ob, ten_mod, TSE_MODIFIER, index);
+      ten->name = md->name;
+      ten->directdata = md;
+
+      if (md->type == eGpencilModifierType_Armature) {
+        outliner_add_element(space_outliner,
+                             &ten->subtree,
+                             ((ArmatureGpencilModifierData *)md)->object,
+                             ten,
+                             TSE_LINKED_OB,
+                             0);
+      }
+      else if (md->type == eGpencilModifierType_Hook) {
+        outliner_add_element(space_outliner,
+                             &ten->subtree,
+                             ((HookGpencilModifierData *)md)->object,
+                             ten,
+                             TSE_LINKED_OB,
+                             0);
+      }
+      else if (md->type == eGpencilModifierType_Lattice) {
+        outliner_add_element(space_outliner,
+                             &ten->subtree,
+                             ((LatticeGpencilModifierData *)md)->object,
+                             ten,
+                             TSE_LINKED_OB,
+                             0);
+      }
+    }
+  }
+
+  /* Grease Pencil effects. */
+  if (!BLI_listbase_is_empty(&ob->shader_fx)) {
+    TreeElement *ten_fx = outliner_add_element(
+        space_outliner, &te->subtree, ob, te, TSE_GPENCIL_EFFECT_BASE, 0);
+
+    ten_fx->name = IFACE_("Effects");
+    int index;
+    LISTBASE_FOREACH_INDEX (ShaderFxData *, fx, &ob->shader_fx, index) {
+      TreeElement *ten = outliner_add_element(
+          space_outliner, &ten_fx->subtree, ob, ten_fx, TSE_GPENCIL_EFFECT, index);
+      ten->name = fx->name;
+      ten->directdata = fx;
+
+      if (fx->type == eShaderFxType_Swirl) {
+        outliner_add_element(space_outliner,
+                             &ten->subtree,
+                             ((SwirlShaderFxData *)fx)->object,
+                             ten,
+                             TSE_LINKED_OB,
+                             0);
+      }
+    }
+  }
+
   /* vertex groups */
   if (ob->defbase.first) {
     bDeformGroup *defgroup;
diff --git a/source/blender/makesdna/DNA_outliner_types.h b/source/blender/makesdna/DNA_outliner_types.h
index 46c8b1570e3..52d466fdbdd 100644
--- a/source/blender/makesdna/DNA_outliner_types.h
+++ b/source/blender/makesdna/DNA_outliner_types.h
@@ -109,6 +109,8 @@ enum {
 #define TSE_SCENE_COLLECTION_BASE 39
 #define TSE_VIEW_COLLECTION_BASE 40
 #define TSE_SCENE_OBJECTS_BASE 41
+#define TSE_GPENCIL_EFFECT_BASE 42
+#define TSE_GPENCIL_EFFECT 43
 
 /* Check whether given TreeStoreElem should have a real ID in its ->id member. */
 #define TSE_IS_REAL_ID(_tse) \



More information about the Bf-blender-cvs mailing list