Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/metaball/mball_edit.c
| Show First 20 Lines • Show All 450 Lines • ▼ Show 20 Lines | for (uint ob_index = 0; ob_index < objects_len; ob_index++) { | ||||
| /* This gives a consistent result regardless of object order. */ | /* This gives a consistent result regardless of object order. */ | ||||
| if (ob_index) { | if (ob_index) { | ||||
| seed_iter += BLI_ghashutil_strhash_p(obedit->id.name); | seed_iter += BLI_ghashutil_strhash_p(obedit->id.name); | ||||
| } | } | ||||
| RNG *rng = BLI_rng_new_srandom(seed_iter); | RNG *rng = BLI_rng_new_srandom(seed_iter); | ||||
| for (MetaElem *ml = mb->editelems->first; ml; ml = ml->next) { | LISTBASE_FOREACH (MetaElem *, ml, mb->editelems) { | ||||
| if (BLI_rng_get_float(rng) < randfac) { | if (BLI_rng_get_float(rng) < randfac) { | ||||
| if (select) { | if (select) { | ||||
| ml->flag |= SELECT; | ml->flag |= SELECT; | ||||
| } | } | ||||
| else { | else { | ||||
| ml->flag &= ~SELECT; | ml->flag &= ~SELECT; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | |||||
| /* Unhide all edited MetaElems */ | /* Unhide all edited MetaElems */ | ||||
| static int reveal_metaelems_exec(bContext *C, wmOperator *op) | static int reveal_metaelems_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *obedit = CTX_data_edit_object(C); | Object *obedit = CTX_data_edit_object(C); | ||||
| MetaBall *mb = (MetaBall *)obedit->data; | MetaBall *mb = (MetaBall *)obedit->data; | ||||
| const bool select = RNA_boolean_get(op->ptr, "select"); | const bool select = RNA_boolean_get(op->ptr, "select"); | ||||
| bool changed = false; | bool changed = false; | ||||
| for (MetaElem *ml = mb->editelems->first; ml; ml = ml->next) { | LISTBASE_FOREACH (MetaElem *, ml, mb->editelems) { | ||||
| if (ml->flag & MB_HIDE) { | if (ml->flag & MB_HIDE) { | ||||
| SET_FLAG_FROM_TEST(ml->flag, select, SELECT); | SET_FLAG_FROM_TEST(ml->flag, select, SELECT); | ||||
| ml->flag &= ~MB_HIDE; | ml->flag &= ~MB_HIDE; | ||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| } | } | ||||
| if (changed) { | if (changed) { | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_DATA, mb); | WM_event_add_notifier(C, NC_GEOM | ND_DATA, mb); | ||||
| ▲ Show 20 Lines • Show All 181 Lines • Show Last 20 Lines | |||||