diff options
Diffstat (limited to 'source/blender/editors/metaball/mball_edit.c')
-rw-r--r-- | source/blender/editors/metaball/mball_edit.c | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 62ebe84e078..48750e9c6b8 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -1,4 +1,4 @@ -/** +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -35,6 +35,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_rand.h" +#include "BLI_utildefines.h" #include "DNA_meta_types.h" #include "DNA_object_types.h" @@ -47,6 +48,7 @@ #include "BKE_context.h" #include "BKE_mball.h" +#include "ED_mball.h" #include "ED_screen.h" #include "ED_view3d.h" #include "ED_transform.h" @@ -55,6 +57,8 @@ #include "WM_api.h" #include "WM_types.h" +#include "mball_intern.h" + /* This function is used to free all MetaElems from MetaBall */ void free_editMball(Object *obedit) { @@ -84,26 +88,24 @@ void make_editMball(Object *obedit) /* This function is called, when MetaBall Object switched from * edit mode to object mode. List od MetaElements is copied * from object->data->edit_elems to object->data->elems. */ -void load_editMball(Object *obedit) +void load_editMball(Object *UNUSED(obedit)) { } /* Add metaelem primitive to metaball object (which is in edit mode) */ -MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int newname) +MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int UNUSED(newname)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mball = (MetaBall*)obedit->data; MetaElem *ml; - if(!obedit) return NULL; - /* Deselect all existing metaelems */ ml= mball->editelems->first; while(ml) { ml->flag &= ~SELECT; ml= ml->next; } - + ml= add_metaball_element(mball, type); copy_v3_v3(&ml->x, mat[3]); @@ -177,7 +179,7 @@ void MBALL_OT_select_all(wmOperatorType *ot) /***************************** Select inverse operator *****************************/ /* Invert metaball selection */ -static int select_inverse_metaelems_exec(bContext *C, wmOperator *op) +static int select_inverse_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb = (MetaBall*)obedit->data; @@ -266,7 +268,7 @@ void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot) /***************************** Duplicate operator *****************************/ /* Duplicate selected MetaElements */ -static int duplicate_metaelems_exec(bContext *C, wmOperator *op) +static int duplicate_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb = (MetaBall*)obedit->data; @@ -284,13 +286,13 @@ static int duplicate_metaelems_exec(bContext *C, wmOperator *op) ml= ml->prev; } WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + DAG_id_tag_update(obedit->data, 0); } return OPERATOR_FINISHED; } -static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { int retv= duplicate_metaelems_exec(C, op); @@ -325,7 +327,7 @@ void MBALL_OT_duplicate_metaelems(wmOperatorType *ot) /***************************** Delete operator *****************************/ /* Delete all selected MetaElems (not MetaBall) */ -static int delete_metaelems_exec(bContext *C, wmOperator *op) +static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb= (MetaBall*)obedit->data; @@ -343,7 +345,7 @@ static int delete_metaelems_exec(bContext *C, wmOperator *op) ml= next; } WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + DAG_id_tag_update(obedit->data, 0); } return OPERATOR_FINISHED; @@ -372,28 +374,18 @@ static int hide_metaelems_exec(bContext *C, wmOperator *op) Object *obedit= CTX_data_edit_object(C); MetaBall *mb= (MetaBall*)obedit->data; MetaElem *ml; - int hide_unselected= RNA_boolean_get(op->ptr, "unselected"); + const int invert= RNA_boolean_get(op->ptr, "unselected") ? SELECT : 0; ml= mb->editelems->first; if(ml) { - /* Hide unselected metaelems */ - if(hide_unselected) { - while(ml){ - if(!(ml->flag & SELECT)) - ml->flag |= MB_HIDE; - ml= ml->next; - } - /* Hide selected metaelems */ - } else { - while(ml){ - if(ml->flag & SELECT) - ml->flag |= MB_HIDE; - ml= ml->next; - } + while(ml){ + if((ml->flag & SELECT) != invert) + ml->flag |= MB_HIDE; + ml= ml->next; } WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + DAG_id_tag_update(obedit->data, 0); } return OPERATOR_FINISHED; @@ -420,7 +412,7 @@ void MBALL_OT_hide_metaelems(wmOperatorType *ot) /***************************** Unhide operator *****************************/ /* Unhide all edited MetaElems */ -static int reveal_metaelems_exec(bContext *C, wmOperator *op) +static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb= (MetaBall*)obedit->data; @@ -434,7 +426,7 @@ static int reveal_metaelems_exec(bContext *C, wmOperator *op) ml= ml->next; } WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + DAG_id_tag_update(obedit->data, 0); } return OPERATOR_FINISHED; @@ -606,7 +598,7 @@ static void free_undoMball(void *lbv) MEM_freeN(lb); } -ListBase *metaball_get_editelems(Object *ob) +static ListBase *metaball_get_editelems(Object *ob) { if(ob && ob->type==OB_MBALL) { struct MetaBall *mb= (struct MetaBall*)ob->data; @@ -623,7 +615,7 @@ static void *get_data(bContext *C) } /* this is undo system for MetaBalls */ -void undo_push_mball(bContext *C, char *name) +void undo_push_mball(bContext *C, const char *name) { undo_editmode_push(C, name, get_data, free_undoMball, undoMball_to_editMball, editMball_to_undoMball, NULL); } |