Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c
| Show All 35 Lines | |||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_deform.h" | #include "BKE_deform.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_object_deform.h" | #include "BKE_object_deform.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "DEG_depsgraph_build.h" | |||||
| /* Only for blend modes. */ | /* Only for blend modes. */ | ||||
| #include "IMB_imbuf.h" | #include "IMB_imbuf.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "paint_intern.h" /* own include */ | #include "paint_intern.h" /* own include */ | ||||
| Show All 36 Lines | if ((modob = modifiers_isDeformedByArmature(ob))) { | ||||
| Bone *actbone = ((bArmature *)modob->data)->act_bone; | Bone *actbone = ((bArmature *)modob->data)->act_bone; | ||||
| if (actbone) { | if (actbone) { | ||||
| bPoseChannel *pchan = BKE_pose_channel_find_name(modob->pose, actbone->name); | bPoseChannel *pchan = BKE_pose_channel_find_name(modob->pose, actbone->name); | ||||
| if (pchan) { | if (pchan) { | ||||
| bDeformGroup *dg = defgroup_find_name(ob, pchan->name); | bDeformGroup *dg = defgroup_find_name(ob, pchan->name); | ||||
| if (dg == NULL) { | if (dg == NULL) { | ||||
| dg = BKE_object_defgroup_add_name(ob, pchan->name); /* sets actdef */ | dg = BKE_object_defgroup_add_name(ob, pchan->name); /* sets actdef */ | ||||
| DEG_relations_tag_update(CTX_data_main(C)); | |||||
| } | } | ||||
| else { | else { | ||||
| int actdef = 1 + BLI_findindex(&ob->defbase, dg); | int actdef = 1 + BLI_findindex(&ob->defbase, dg); | ||||
| BLI_assert(actdef >= 0); | BLI_assert(actdef >= 0); | ||||
| ob->actdef = actdef; | ob->actdef = actdef; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (BLI_listbase_is_empty(&ob->defbase)) { | if (BLI_listbase_is_empty(&ob->defbase)) { | ||||
| BKE_object_defgroup_add(ob); | BKE_object_defgroup_add(ob); | ||||
| DEG_relations_tag_update(CTX_data_main(C)); | |||||
| } | } | ||||
| /* ensure we don't try paint onto an invalid group */ | /* ensure we don't try paint onto an invalid group */ | ||||
| if (ob->actdef <= 0) { | if (ob->actdef <= 0) { | ||||
| BKE_report(reports, RPT_WARNING, "No active vertex group for painting, aborting"); | BKE_report(reports, RPT_WARNING, "No active vertex group for painting, aborting"); | ||||
| return false; | return false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 203 Lines • Show Last 20 Lines | |||||