Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_armature.c
| Show First 20 Lines • Show All 475 Lines • ▼ Show 20 Lines | if (mode == GP_ARMATURE_AUTO) { | ||||
| * bone is closest. | * bone is closest. | ||||
| */ | */ | ||||
| gpencil_add_verts_to_dgroups(C, ob, ob_arm, ratio, decay); | gpencil_add_verts_to_dgroups(C, ob, ob_arm, ratio, decay); | ||||
| } | } | ||||
| DEG_relations_tag_update(CTX_data_main(C)); | DEG_relations_tag_update(CTX_data_main(C)); | ||||
| } | } | ||||
| bool ED_gpencil_add_armature_weights( | bool ED_gpencil_add_armature(const bContext *C, ReportList *reports, Object *ob, Object *ob_arm) | ||||
| const bContext *C, ReportList *reports, Object *ob, Object *ob_arm, int mode) | |||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| if (ob == NULL) { | if (ob == NULL) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| Show All 17 Lines | bool ED_gpencil_add_armature(const bContext *C, ReportList *reports, Object *ob, Object *ob_arm) | ||||
| else { | else { | ||||
| if (ob_arm != mmd->object) { | if (ob_arm != mmd->object) { | ||||
| BKE_report(reports, | BKE_report(reports, | ||||
| RPT_ERROR, | RPT_ERROR, | ||||
| "The existing Armature modifier is already using a different Armature object"); | "The existing Armature modifier is already using a different Armature object"); | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| return true; | |||||
| } | |||||
| bool ED_gpencil_add_armature_weights( | |||||
| const bContext *C, ReportList *reports, Object *ob, Object *ob_arm, int mode) | |||||
| { | |||||
| if (ob == NULL) { | |||||
| return false; | |||||
| } | |||||
| bool success = ED_gpencil_add_armature(C, reports, ob, ob_arm); | |||||
| /* add weights */ | /* add weights */ | ||||
| if (success) { | |||||
| gpencil_object_vgroup_calc_from_armature(C, ob, ob_arm, mode, DEFAULT_RATIO, DEFAULT_DECAY); | gpencil_object_vgroup_calc_from_armature(C, ob, ob_arm, mode, DEFAULT_RATIO, DEFAULT_DECAY); | ||||
| } | |||||
| return true; | return success; | ||||
| } | } | ||||
| /* ***************** Generate armature weights ************************** */ | /* ***************** Generate armature weights ************************** */ | ||||
| static bool gpencil_generate_weights_poll(bContext *C) | static bool gpencil_generate_weights_poll(bContext *C) | ||||
| { | { | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| if (ob == NULL) { | if (ob == NULL) { | ||||
| return false; | return false; | ||||
| ▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines | |||||