Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_vgroup.c
| Show First 20 Lines • Show All 3,129 Lines • ▼ Show 20 Lines | void OBJECT_OT_vertex_group_invert(wmOperatorType *ot) | ||||
| RNA_def_boolean(ot->srna, "auto_assign", true, "Add Weights", | RNA_def_boolean(ot->srna, "auto_assign", true, "Add Weights", | ||||
| "Add verts from groups that have zero weight before inverting"); | "Add verts from groups that have zero weight before inverting"); | ||||
| RNA_def_boolean(ot->srna, "auto_remove", true, "Remove Weights", | RNA_def_boolean(ot->srna, "auto_remove", true, "Remove Weights", | ||||
| "Remove verts from groups that have zero weight after inverting"); | "Remove verts from groups that have zero weight after inverting"); | ||||
| } | } | ||||
| static int vertex_group_smooth_exec(bContext *C, wmOperator *op) | static int vertex_group_smooth_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *ob = ED_object_context(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| uint objects_len = 0; | |||||
| Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); | |||||
| for (uint ob_index = 0; ob_index < objects_len; ob_index++) { | |||||
| Object *ob = objects[ob_index]; | |||||
| const float fac = RNA_float_get(op->ptr, "factor"); | const float fac = RNA_float_get(op->ptr, "factor"); | ||||
| const int repeat = RNA_int_get(op->ptr, "repeat"); | const int repeat = RNA_int_get(op->ptr, "repeat"); | ||||
| eVGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); | eVGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); | ||||
| const float fac_expand = RNA_float_get(op->ptr, "expand"); | const float fac_expand = RNA_float_get(op->ptr, "expand"); | ||||
| int subset_count, vgroup_tot; | int subset_count, vgroup_tot; | ||||
| const bool *vgroup_validmap = BKE_object_defgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); | const bool *vgroup_validmap = BKE_object_defgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); | ||||
| vgroup_smooth_subset(ob, vgroup_validmap, vgroup_tot, subset_count, fac, repeat, fac_expand); | vgroup_smooth_subset(ob, vgroup_validmap, vgroup_tot, subset_count, fac, repeat, fac_expand); | ||||
| MEM_freeN((void *)vgroup_validmap); | MEM_freeN((void *)vgroup_validmap); | ||||
| DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); | WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); | ||||
| } | |||||
| MEM_freeN(objects); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void OBJECT_OT_vertex_group_smooth(wmOperatorType *ot) | void OBJECT_OT_vertex_group_smooth(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Smooth Vertex Weights"; | ot->name = "Smooth Vertex Weights"; | ||||
| ot->idname = "OBJECT_OT_vertex_group_smooth"; | ot->idname = "OBJECT_OT_vertex_group_smooth"; | ||||
| ▲ Show 20 Lines • Show All 836 Lines • Show Last 20 Lines | |||||