diff options
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tree.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tree.c | 76 |
1 files changed, 70 insertions, 6 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 60058c82283..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" @@ -244,14 +246,12 @@ static TreeElement *outliner_add_element(SpaceOutliner *space_outliner, /* -------------------------------------------------------- */ /** - * Check if an element type needs a full rebuild if the open/collapsed state changes. - * These element types don't add children if collapsed. - * - * This current check isn't great really. A per element-type flag would be preferable. + * Check if a display mode needs a full rebuild if the open/collapsed state changes. + * Element types in these modes don't actually add children if collapsed, so the rebuild is needed. */ -bool outliner_element_needs_rebuild_on_open_change(const TreeStoreElem *tselem) +bool outliner_mode_requires_always_rebuild(const SpaceOutliner *space_outliner) { - return ELEM(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_KEYMAP); + return ELEM(space_outliner->outlinevis, SO_DATA_API); } /* special handling of hierarchical non-lib data */ @@ -552,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; |