Revision: 36327
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36327
Author: dingto
Date: 2011-04-25 13:47:15 +0000 (Mon, 25 Apr 2011)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_operators/wm.py
trunk/blender/source/blender/editors/interface/interface_templates.c
trunk/blender/source/blender/makesrna/intern/rna_space.c
Modified: trunk/blender/release/scripts/startup/bl_operators/wm.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/wm.py 2011-04-25
12:39:53 UTC (rev 36326)
+++ trunk/blender/release/scripts/startup/bl_operators/wm.py 2011-04-25
13:47:15 UTC (rev 36327)
@@ -837,7 +837,19 @@
item[property] = 1.0
return {'FINISHED'}
+class WM_OT_properties_context_change(bpy.types.Operator):
+ "Change the context tab in a Properties Window"
+ bl_idname = "wm.properties_context_change"
+ bl_label = ""
+ context = StringProperty(name="Context", maxlen=32)
+
+ def execute(self, context):
+ context.space_data.context = (self.context)
+
+ return {'FINISHED'}
+
+
class WM_OT_properties_remove(bpy.types.Operator):
'''Internal use (edit a property data_path)'''
bl_idname = "wm.properties_remove"
Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c
2011-04-25 12:39:53 UTC (rev 36326)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c
2011-04-25 13:47:15 UTC (rev 36327)
@@ -673,6 +673,22 @@
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(ELEM5(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 @@
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);
}
Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c 2011-04-25
12:39:53 UTC (rev 36326)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c 2011-04-25
13:47:15 UTC (rev 36327)
@@ -1436,7 +1436,7 @@
{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}};
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs