Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_vgroup.c
| Show First 20 Lines • Show All 3,886 Lines • ▼ Show 20 Lines | |||||
| static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op) | static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *obact = ED_object_context(C); | Object *obact = ED_object_context(C); | ||||
| int changed_tot = 0; | int changed_tot = 0; | ||||
| int fail = 0; | int fail = 0; | ||||
| CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { | CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { | ||||
| if (obact != ob) { | if (obact != ob && BKE_object_supports_vertex_groups(ob)) { | ||||
| if (ED_vgroup_array_copy(ob, obact)) { | if (ED_vgroup_array_copy(ob, obact)) { | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| DEG_relations_tag_update(CTX_data_main(C)); | DEG_relations_tag_update(CTX_data_main(C)); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob); | WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob); | ||||
| changed_tot++; | changed_tot++; | ||||
| } | } | ||||
| else { | else { | ||||
| fail++; | fail++; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| CTX_DATA_END; | CTX_DATA_END; | ||||
| if ((changed_tot == 0 && fail == 0) || fail) { | if ((changed_tot == 0 && fail == 0) || fail) { | ||||
| BKE_reportf(op->reports, | BKE_reportf(op->reports, | ||||
| RPT_ERROR, | RPT_ERROR, | ||||
| "Copy vertex groups to selected: %d done, %d failed (object data must have " | "Copy vertex groups to selected: %d done, %d failed (object data must support " | ||||
| "matching indices)", | "vertex groups and have matching indices)", | ||||
| changed_tot, | changed_tot, | ||||
| fail); | fail); | ||||
| } | } | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void OBJECT_OT_vertex_group_copy_to_selected(wmOperatorType *ot) | void OBJECT_OT_vertex_group_copy_to_selected(wmOperatorType *ot) | ||||
| ▲ Show 20 Lines • Show All 671 Lines • Show Last 20 Lines | |||||