Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2011-04-25 17:47:15 +0400
committerThomas Dinges <blender@dingto.org>2011-04-25 17:47:15 +0400
commitd6e03d2c56840f9f671ea66654f934cde7bab635 (patch)
treeb4bdfa37a47738b6ceafd27e92acb2ec24ca3018 /source
parent70d059161b81993a154d8e7c65ed940739791687 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_templates.c23
-rw-r--r--source/blender/makesrna/intern/rna_space.c2
2 files changed, 23 insertions, 2 deletions
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}};