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.
This commit is contained in:
Thomas Dinges
2011-04-25 13:47:15 +00:00
parent 70d059161b
commit d6e03d2c56
3 changed files with 35 additions and 2 deletions

View File

@@ -837,6 +837,18 @@ class WM_OT_properties_add(bpy.types.Operator):
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)'''

View File

@@ -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);
}

View File

@@ -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}};