diff options
-rw-r--r-- | source/blender/editors/metaball/mball_edit.c | 95 |
1 files changed, 72 insertions, 23 deletions
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 386fa1efa95..84e52c0b0eb 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -58,6 +58,10 @@ #include "mball_intern.h" +/* -------------------------------------------------------------------- */ +/** \name Edit Mode Functions + * \{ */ + /* This function is used to free all MetaElems from MetaBall */ void ED_mball_editmball_free(Object *obedit) { @@ -93,6 +97,31 @@ void ED_mball_editmball_load(Object *UNUSED(obedit)) { } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Selection + * \{ */ + +bool ED_mball_deselect_all_multi(bContext *C) +{ + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); + ViewContext vc; + ED_view3d_viewcontext_init(C, &vc, depsgraph); + uint bases_len = 0; + Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data( + vc.view_layer, vc.v3d, &bases_len); + bool changed_multi = BKE_mball_deselect_all_multi_ex(bases, bases_len); + MEM_freeN(bases); + return changed_multi; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Add Meta Primitive Utility + * \{ */ + /** * Add meta-element primitive to meta-ball object (which is in edit mode). */ @@ -128,7 +157,11 @@ MetaElem *ED_mball_add_primitive( return ml; } -/***************************** Select/Deselect operator *****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Select/Deselect Operator + * \{ */ /* Select or deselect all MetaElements */ static int mball_select_all_exec(bContext *C, wmOperator *op) @@ -185,8 +218,11 @@ void MBALL_OT_select_all(wmOperatorType *ot) WM_operator_properties_select_all(ot); } +/** \} */ + /* -------------------------------------------------------------------- */ -/* Select Similar */ +/** \name Select Similar Operator + * \{ */ enum { SIMMBALL_TYPE = 1, @@ -438,9 +474,12 @@ void MBALL_OT_select_similar(wmOperatorType *ot) RNA_def_float(ot->srna, "threshold", 0.1, 0.0, FLT_MAX, "Threshold", "", 0.01, 1.0); } -/***************************** Select random operator *****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Select Random Operator + * \{ */ -/* Random metaball selection */ static int select_random_metaelems_exec(bContext *C, wmOperator *op) { const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT); @@ -504,7 +543,11 @@ void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot) WM_operator_properties_select_random(ot); } -/***************************** Duplicate operator *****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Duplicate Meta-Ball Operator + * \{ */ /* Duplicate selected MetaElements */ static int duplicate_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) @@ -556,9 +599,14 @@ void MBALL_OT_duplicate_metaelems(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/***************************** Delete operator *****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Delete Meta-Ball Operator + * + * Delete all selected MetaElems (not MetaBall). + * \{ */ -/* Delete all selected MetaElems (not MetaBall) */ static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { ViewLayer *view_layer = CTX_data_view_layer(C); @@ -611,9 +659,12 @@ void MBALL_OT_delete_metaelems(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/***************************** Hide operator *****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Hide Meta-Elements Operator + * \{ */ -/* Hide selected MetaElems */ static int hide_metaelems_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); @@ -656,9 +707,12 @@ void MBALL_OT_hide_metaelems(wmOperatorType *ot) ot->srna, "unselected", false, "Unselected", "Hide unselected rather than selected"); } -/***************************** Unhide operator *****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Un-Hide Meta-Elements Operator + * \{ */ -/* Unhide all edited MetaElems */ static int reveal_metaelems_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); @@ -699,6 +753,12 @@ void MBALL_OT_reveal_metaelems(wmOperatorType *ot) RNA_def_boolean(ot->srna, "select", true, "Select", ""); } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Select Pick Utility + * \{ */ + /* Select MetaElement with mouse click (user can select radius circle or * stiffness circle) */ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle) @@ -841,15 +901,4 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool dese return false; } -bool ED_mball_deselect_all_multi(bContext *C) -{ - Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); - ViewContext vc; - ED_view3d_viewcontext_init(C, &vc, depsgraph); - uint bases_len = 0; - Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data( - vc.view_layer, vc.v3d, &bases_len); - bool changed_multi = BKE_mball_deselect_all_multi_ex(bases, bases_len); - MEM_freeN(bases); - return changed_multi; -} +/** \} */ |