Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_vgroup.c
| Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_object_deform.h" | #include "BKE_object_deform.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_lattice.h" | #include "BKE_lattice.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_build.h" | |||||
| #include "DNA_armature_types.h" | #include "DNA_armature_types.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| ▲ Show 20 Lines • Show All 2,581 Lines • ▼ Show 20 Lines | static bool vertex_group_vert_select_mesh_poll(bContext *C) | ||||
| return (BKE_object_is_in_editmode_vgroup(ob) || BKE_object_is_in_wpaint_select_vert(ob)); | return (BKE_object_is_in_editmode_vgroup(ob) || BKE_object_is_in_wpaint_select_vert(ob)); | ||||
| } | } | ||||
| static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op)) | static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Object *ob = ED_object_context(C); | Object *ob = ED_object_context(C); | ||||
| BKE_object_defgroup_add(ob); | BKE_object_defgroup_add(ob); | ||||
| DEG_relations_tag_update(CTX_data_main(C)); | |||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data); | WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void OBJECT_OT_vertex_group_add(wmOperatorType *ot) | void OBJECT_OT_vertex_group_add(wmOperatorType *ot) | ||||
| Show All 18 Lines | static int vertex_group_remove_exec(bContext *C, wmOperator *op) | ||||
| if (RNA_boolean_get(op->ptr, "all")) | if (RNA_boolean_get(op->ptr, "all")) | ||||
| BKE_object_defgroup_remove_all(ob); | BKE_object_defgroup_remove_all(ob); | ||||
| else if (RNA_boolean_get(op->ptr, "all_unlocked")) | else if (RNA_boolean_get(op->ptr, "all_unlocked")) | ||||
| BKE_object_defgroup_remove_all_ex(ob, true); | BKE_object_defgroup_remove_all_ex(ob, true); | ||||
| else | else | ||||
| vgroup_delete_active(ob); | vgroup_delete_active(ob); | ||||
| 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)); | |||||
| WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data); | WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void OBJECT_OT_vertex_group_remove(wmOperatorType *ot) | void OBJECT_OT_vertex_group_remove(wmOperatorType *ot) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op)) | static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Object *ob = ED_object_context(C); | Object *ob = ED_object_context(C); | ||||
| vgroup_duplicate(ob); | vgroup_duplicate(ob); | ||||
| 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)); | |||||
| 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_VERTEX_GROUP, ob->data); | WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void OBJECT_OT_vertex_group_copy(wmOperatorType *ot) | void OBJECT_OT_vertex_group_copy(wmOperatorType *ot) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 514 Lines • ▼ Show 20 Lines | ED_vgroup_mirror(ob, | ||||
| RNA_boolean_get(op->ptr, "all_groups"), | RNA_boolean_get(op->ptr, "all_groups"), | ||||
| RNA_boolean_get(op->ptr, "use_topology"), | RNA_boolean_get(op->ptr, "use_topology"), | ||||
| &totmirr, | &totmirr, | ||||
| &totfail); | &totfail); | ||||
| ED_mesh_report_mirror(op, totmirr, totfail); | ED_mesh_report_mirror(op, totmirr, totfail); | ||||
| 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)); | |||||
| 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); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot) | void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | 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) { | ||||
| 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)); | |||||
| 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++; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 622 Lines • Show Last 20 Lines | |||||