diff options
author | Janne Karhu <jhkarh@gmail.com> | 2011-01-23 17:04:31 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2011-01-23 17:04:31 +0300 |
commit | fa38da021cd08409f1bda4722a6cf8a607f86838 (patch) | |
tree | 08d2b4ed4ea17436ef6176efadaac4d910c8c4fb /source/blender/editors/object | |
parent | eafbb9221e483010bda5e336f935005006f78e89 (diff) |
Some ui reorganization of the physics tab:
* Before the different simulations all had a panel with an "add this" button making the whole tab look really messy. It also rarely makes sense to have more than one or two physics things enabled for a single object, so having all the panels in the tab just added a great deal of visual clutter.
* Now there is a single "enable physics for" panel at the top that allows for enable/disable of any simulation. All actual physics panels are hidden until a simulation is enabled.
* There was no "add" button for force fields before, but I added a toggle between "none" and "force" to unify the ui even further.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 35 | ||||
-rw-r--r-- | source/blender/editors/object/object_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 1 |
3 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 1465c231f41..94955e3c815 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -50,6 +50,7 @@ #include "DNA_property_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "DNA_object_force.h" #include "DNA_meshdata_types.h" #include "DNA_vfont_types.h" @@ -59,6 +60,7 @@ #include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_curve.h" +#include "BKE_effect.h" #include "BKE_depsgraph.h" #include "BKE_font.h" #include "BKE_image.h" @@ -1500,6 +1502,39 @@ void copy_attr_menu(Main *bmain, Scene *scene, View3D *v3d) copy_attr(bmain, scene, v3d, event); } +/* ******************* force field toggle operator ***************** */ + +static int forcefield_toggle_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *ob = CTX_data_active_object(C); + + if(ob->pd == NULL) + ob->pd = object_add_collision_fields(PFIELD_FORCE); + + if(ob->pd->forcefield == 0) + ob->pd->forcefield = PFIELD_FORCE; + else + ob->pd->forcefield = 0; + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_forcefield_toggle(wmOperatorType *ot) +{ + + /* identifiers */ + ot->name= "Toggle Force Field"; + ot->description = "Toggle object's force field"; + ot->idname= "OBJECT_OT_forcefield_toggle"; + + /* api callbacks */ + ot->exec= forcefield_toggle_exec; + ot->poll= ED_operator_object_active_editable; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /* ********************************************** */ /* Motion Paths */ diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 6c0a154090f..ca441e8d634 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -84,6 +84,7 @@ void OBJECT_OT_shade_smooth(struct wmOperatorType *ot); void OBJECT_OT_shade_flat(struct wmOperatorType *ot); void OBJECT_OT_paths_calculate(struct wmOperatorType *ot); void OBJECT_OT_paths_clear(struct wmOperatorType *ot); +void OBJECT_OT_forcefield_toggle(struct wmOperatorType *ot); void OBJECT_OT_game_property_new(struct wmOperatorType *ot); void OBJECT_OT_game_property_remove(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 903c40026f7..6662d5b5f0a 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -77,6 +77,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_shade_flat); WM_operatortype_append(OBJECT_OT_paths_calculate); WM_operatortype_append(OBJECT_OT_paths_clear); + WM_operatortype_append(OBJECT_OT_forcefield_toggle); WM_operatortype_append(OBJECT_OT_parent_set); WM_operatortype_append(OBJECT_OT_parent_no_inverse_set); |