From 00fae51fc13d2a10d254ca85a9d25e1420ce099c Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Tue, 25 Nov 2008 23:14:00 +0000 Subject: [PATCH] * Added 'Particle System' entries as children of particle system modifiers in the outliner. Clicking on one activates it and takes you to the object buttons - it's a lot better to see what's going on than a little < 1 Part 5 > that gives very little indication. --- source/blender/include/BIF_editparticle.h | 1 + source/blender/include/BIF_outliner.h | 1 + source/blender/src/editparticle.c | 16 ++++++++++++ source/blender/src/outliner.c | 30 +++++++++++++++++++++++ 4 files changed, 48 insertions(+) diff --git a/source/blender/include/BIF_editparticle.h b/source/blender/include/BIF_editparticle.h index aecaee31d53..2db9aacc96b 100644 --- a/source/blender/include/BIF_editparticle.h +++ b/source/blender/include/BIF_editparticle.h @@ -46,6 +46,7 @@ void PE_create_particle_edit(struct Object *ob, struct ParticleSystem *psys); void PE_free_particle_edit(struct ParticleSystem *psys); void PE_change_act(void *ob_v, void *act_v); +void PE_change_act_psys(struct Object *ob, struct ParticleSystem *psys); int PE_can_edit(struct ParticleSystem *psys); /* access */ diff --git a/source/blender/include/BIF_outliner.h b/source/blender/include/BIF_outliner.h index fcd206bb828..e357f37286c 100644 --- a/source/blender/include/BIF_outliner.h +++ b/source/blender/include/BIF_outliner.h @@ -80,6 +80,7 @@ typedef struct TreeElement { #define TSE_SEQUENCE 26 #define TSE_SEQ_STRIP 27 #define TSE_SEQUENCE_DUP 28 +#define TSE_LINKED_PSYS 29 /* outliner search flags */ #define OL_FIND 0 diff --git a/source/blender/src/editparticle.c b/source/blender/src/editparticle.c index 21192d50333..0538bcb98d7 100644 --- a/source/blender/src/editparticle.c +++ b/source/blender/src/editparticle.c @@ -165,6 +165,22 @@ void PE_change_act(void *ob_v, void *act_v) } } +void PE_change_act_psys(Object *ob, ParticleSystem *psys) +{ + ParticleSystem *p; + + if((p=psys_get_current(ob))) + p->flag &= ~PSYS_CURRENT; + + psys->flag |= PSYS_CURRENT; + + if(psys_check_enabled(ob, psys)) { + if(G.f & G_PARTICLEEDIT && !psys->edit) + PE_create_particle_edit(ob, psys); + PE_recalc_world_cos(ob, psys); + } +} + /* always gets atleast the first particlesystem even if PSYS_CURRENT flag is not set */ ParticleSystem *PE_get_current(Object *ob) { diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c index 8e3e44c06de..e6ffa128310 100644 --- a/source/blender/src/outliner.c +++ b/source/blender/src/outliner.c @@ -50,6 +50,7 @@ #include "DNA_nla_types.h" #include "DNA_object_types.h" #include "DNA_oops_types.h" +#include "DNA_particle_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" @@ -87,6 +88,7 @@ #include "BIF_editarmature.h" #include "BIF_editdeform.h" #include "BIF_editnla.h" +#include "BIF_editparticle.h" #include "BIF_editview.h" #include "BIF_editconstraint.h" #include "BIF_gl.h" @@ -715,6 +717,13 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i outliner_add_element(soops, &te->subtree, ((ArmatureModifierData*) md)->object, te, TSE_LINKED_OB, 0); } else if (md->type==eModifierType_Hook) { outliner_add_element(soops, &te->subtree, ((HookModifierData*) md)->object, te, TSE_LINKED_OB, 0); + } else if (md->type==eModifierType_ParticleSystem) { + TreeElement *ten; + ParticleSystem *psys= ((ParticleSystemModifierData*) md)->psys; + + ten = outliner_add_element(soops, &te->subtree, ob, te, TSE_LINKED_PSYS, 0); + ten->directdata = psys; + ten->name = psys->part->id.name+2; } } } @@ -1965,6 +1974,19 @@ static int tree_element_active_modifier(TreeElement *te, TreeStoreElem *tselem, return 0; } +static int tree_element_active_psys(TreeElement *te, TreeStoreElem *tselem, int set) +{ + if(set) { + Object *ob= (Object *)tselem->id; + ParticleSystem *psys= te->directdata; + + PE_change_act_psys(ob, psys); + extern_set_butspace(F7KEY, 0); + } + + return 0; +} + static int tree_element_active_constraint(TreeElement *te, TreeStoreElem *tselem, int set) { if(set) { @@ -2094,6 +2116,9 @@ static int tree_element_type_active(SpaceOops *soops, TreeElement *te, TreeStore if(set) tree_element_active_object(soops, te); else if(tselem->id==(ID *)OBACT) return 1; break; + case TSE_LINKED_PSYS: + return tree_element_active_psys(te, tselem, set); + break; case TSE_POSE_BASE: return tree_element_active_pose(te, tselem, set); break; @@ -3203,6 +3228,8 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen BIF_icon_draw(x, y, ICON_MODIFIER); break; case TSE_LINKED_OB: BIF_icon_draw(x, y, ICON_OBJECT); break; + case TSE_LINKED_PSYS: + BIF_icon_draw(x, y, ICON_PARTICLES); break; case TSE_MODIFIER: { Object *ob= (Object *)tselem->id; @@ -3230,6 +3257,9 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen BIF_icon_draw(x, y, ICON_MOD_SOFT); break; case eModifierType_Boolean: BIF_icon_draw(x, y, ICON_MOD_BOOLEAN); break; + case eModifierType_ParticleSystem: + case eModifierType_ParticleInstance: + BIF_icon_draw(x, y, ICON_PARTICLES); break; default: BIF_icon_draw(x, y, ICON_DOT); break; }