Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/metaball/mball_edit.c
| Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "mball_intern.h" | #include "mball_intern.h" | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Edit Mode Functions | /** \name Edit Mode Functions | ||||
| * \{ */ | * \{ */ | ||||
| /* This function is used to free all MetaElems from MetaBall */ | |||||
| void ED_mball_editmball_free(Object *obedit) | void ED_mball_editmball_free(Object *obedit) | ||||
| { | { | ||||
| MetaBall *mb = (MetaBall *)obedit->data; | MetaBall *mb = (MetaBall *)obedit->data; | ||||
| mb->editelems = NULL; | mb->editelems = NULL; | ||||
| mb->lastelem = NULL; | mb->lastelem = NULL; | ||||
| } | } | ||||
| /* This function is called, when MetaBall Object is | |||||
| * switched from object mode to edit mode */ | |||||
| void ED_mball_editmball_make(Object *obedit) | void ED_mball_editmball_make(Object *obedit) | ||||
| { | { | ||||
| MetaBall *mb = (MetaBall *)obedit->data; | MetaBall *mb = (MetaBall *)obedit->data; | ||||
| MetaElem *ml; /*, *newml;*/ | MetaElem *ml; /*, *newml;*/ | ||||
| ml = mb->elems.first; | ml = mb->elems.first; | ||||
| while (ml) { | while (ml) { | ||||
| if (ml->flag & SELECT) { | if (ml->flag & SELECT) { | ||||
| mb->lastelem = ml; | mb->lastelem = ml; | ||||
| } | } | ||||
| ml = ml->next; | ml = ml->next; | ||||
| } | } | ||||
| mb->editelems = &mb->elems; | mb->editelems = &mb->elems; | ||||
| } | } | ||||
| /* This function is called, when MetaBall Object switched from | |||||
| * edit mode to object mode. List of MetaElements is copied | |||||
| * from object->data->edit_elems to object->data->elems. */ | |||||
| void ED_mball_editmball_load(Object *UNUSED(obedit)) | void ED_mball_editmball_load(Object *UNUSED(obedit)) | ||||
| { | { | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Selection | /** \name Selection | ||||
| Show All 13 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Add Meta Primitive Utility | /** \name Add Meta Primitive Utility | ||||
| * \{ */ | * \{ */ | ||||
| /** | |||||
| * Add meta-element primitive to meta-ball object (which is in edit mode). | |||||
| */ | |||||
| MetaElem *ED_mball_add_primitive( | MetaElem *ED_mball_add_primitive( | ||||
| bContext *UNUSED(C), Object *obedit, bool obedit_is_new, float mat[4][4], float dia, int type) | bContext *UNUSED(C), Object *obedit, bool obedit_is_new, float mat[4][4], float dia, int type) | ||||
| { | { | ||||
| MetaBall *mball = (MetaBall *)obedit->data; | MetaBall *mball = (MetaBall *)obedit->data; | ||||
| MetaElem *ml; | MetaElem *ml; | ||||
| /* Deselect all existing metaelems */ | /* Deselect all existing metaelems */ | ||||
| ml = mball->editelems->first; | ml = mball->editelems->first; | ||||
| ▲ Show 20 Lines • Show All 618 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Select Pick Utility | /** \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) | bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| static MetaElem *startelem = NULL; | static MetaElem *startelem = NULL; | ||||
| ViewContext vc; | ViewContext vc; | ||||
| int a, hits; | int a, hits; | ||||
| uint buffer[MAXPICKBUF]; | uint buffer[MAXPICKBUF]; | ||||
| rcti rect; | rcti rect; | ||||
| ▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines | |||||