From d6e03d2c56840f9f671ea66654f934cde7bab635 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 25 Apr 2011 13:47:15 +0000 Subject: 2.5 Interface: * Implemented a new operator "WM_OT_properties_context_change" to switch to a different tab inside the properties window. * This is used now inside the Modifier tab for Simulation Modifiers. Based on a mockup by Janne Karhu: http://www.pasteall.org/pic/11261 http://www.pasteall.org/pic/11262 Rather than having a delete button there anymore, the button changes the context to Physics/Particles, where you can edit the settings and delete the actual simulation. --- .../editors/interface/interface_templates.c | 23 +++++++++++++++++++++- source/blender/makesrna/intern/rna_space.c | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 01e785ef88c..94f12911d33 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -673,6 +673,22 @@ static int modifier_can_delete(ModifierData *md) return 1; } +// Check wheter Modifier is a simulation or not, this is used for switching to the physics/particles context tab +static int modifier_is_simulation(ModifierData *md) +{ + // Physic Tab + if(ELEM6(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke, eModifierType_Softbody, eModifierType_Surface)) { + return 1; + } + // Particle Tab + else if (md->type == eModifierType_ParticleSystem) { + return 2; + } + else { + return 0; + } +} + static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, ModifierData *md, int index, int cageIndex, int lastCageIndex) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); @@ -765,8 +781,13 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif uiBlockEndAlign(block); uiBlockSetEmboss(block, UI_EMBOSSN); - if (modifier_can_delete(md)) + // When Modifier is a simulation, show button to switch to context rather than the delete button. + if (modifier_can_delete(md) && !modifier_is_simulation(md)) uiItemO(row, "", ICON_X, "OBJECT_OT_modifier_remove"); + if (modifier_is_simulation(md) == 1) + uiItemStringO(row, "", ICON_BUTS, "WM_OT_properties_context_change", "context", "PHYSICS"); + else if (modifier_is_simulation(md) == 2) + uiItemStringO(row, "", ICON_BUTS, "WM_OT_properties_context_change", "context", "PARTICLES"); uiBlockSetEmboss(block, UI_EMBOSS); } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 6fad664943d..ba33fc7feda 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1436,7 +1436,7 @@ static void rna_def_space_buttons(BlenderRNA *brna) {BCONTEXT_BONE_CONSTRAINT, "BONE_CONSTRAINT", ICON_CONSTRAINT, "Bone Constraints", "Bone Constraints"}, {BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"}, {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"}, - {BCONTEXT_PARTICLE, "PARTICLE", ICON_PARTICLES, "Particle", "Particle"}, + {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle"}, {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"}, {0, NULL, 0, NULL, NULL}}; -- cgit v1.2.3