Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_convert_armature.c
| Show First 20 Lines • Show All 695 Lines • ▼ Show 20 Lines | if (data) { | ||||
| pseudoinverse_m3_m3(td->smtx, td->mtx, PSEUDOINVERSE_EPSILON); | pseudoinverse_m3_m3(td->smtx, td->mtx, PSEUDOINVERSE_EPSILON); | ||||
| } | } | ||||
| } | } | ||||
| /* store reference to first constraint */ | /* store reference to first constraint */ | ||||
| td->con = pchan->constraints.first; | td->con = pchan->constraints.first; | ||||
| } | } | ||||
| void createTransPose(TransInfo *t) | static void createTransPose(bContext *UNUSED(C), TransInfo *t) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(t->context); | Main *bmain = CTX_data_main(t->context); | ||||
| t->data_len_all = 0; | t->data_len_all = 0; | ||||
| bool has_translate_rotate_buf[2] = {false, false}; | bool has_translate_rotate_buf[2] = {false, false}; | ||||
| bool *has_translate_rotate = (t->mode == TFM_TRANSLATION) ? has_translate_rotate_buf : NULL; | bool *has_translate_rotate = (t->mode == TFM_TRANSLATION) ? has_translate_rotate_buf : NULL; | ||||
| ▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | if (has_translate_rotate[1]) { | ||||
| t->mode = TFM_ROTATION; | t->mode = TFM_ROTATION; | ||||
| } | } | ||||
| else { | else { | ||||
| t->mode = TFM_RESIZE; | t->mode = TFM_RESIZE; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void createTransArmatureVerts(TransInfo *t) | static void createTransArmatureVerts(bContext *UNUSED(C), TransInfo *t) | ||||
| { | { | ||||
| t->data_len_all = 0; | t->data_len_all = 0; | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| EditBone *ebo, *eboflip; | EditBone *ebo, *eboflip; | ||||
| bArmature *arm = tc->obedit->data; | bArmature *arm = tc->obedit->data; | ||||
| ListBase *edbo = arm->edbo; | ListBase *edbo = arm->edbo; | ||||
| bool mirror = ((arm->flag & ARM_MIRROR_EDIT) != 0); | bool mirror = ((arm->flag & ARM_MIRROR_EDIT) != 0); | ||||
| ▲ Show 20 Lines • Show All 293 Lines • ▼ Show 20 Lines | if (arm->flag & ARM_MIRROR_EDIT) { | ||||
| parent->rad_tail = ebo->rad_head; | parent->rad_tail = ebo->rad_head; | ||||
| } | } | ||||
| } | } | ||||
| bid++; | bid++; | ||||
| } | } | ||||
| } | } | ||||
| void recalcData_edit_armature(TransInfo *t) | static void recalcData_edit_armature(TransInfo *t) | ||||
| { | { | ||||
| if (t->state != TRANS_CANCEL) { | if (t->state != TRANS_CANCEL) { | ||||
| applySnappingIndividual(t); | applySnappingIndividual(t); | ||||
| } | } | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| bArmature *arm = tc->obedit->data; | bArmature *arm = tc->obedit->data; | ||||
| ListBase *edbo = arm->edbo; | ListBase *edbo = arm->edbo; | ||||
| ▲ Show 20 Lines • Show All 206 Lines • ▼ Show 20 Lines | if (!(pose->flag & POSE_MIRROR_EDIT)) { | ||||
| return; | return; | ||||
| } | } | ||||
| for (PoseInitData_Mirror *pid = tc->custom.type.data; pid->pchan; pid++) { | for (PoseInitData_Mirror *pid = tc->custom.type.data; pid->pchan; pid++) { | ||||
| pose_mirror_info_restore(pid); | pose_mirror_info_restore(pid); | ||||
| } | } | ||||
| } | } | ||||
| void recalcData_pose(TransInfo *t) | static void recalcData_pose(TransInfo *t) | ||||
| { | { | ||||
| if (t->mode == TFM_BONESIZE) { | if (t->mode == TFM_BONESIZE) { | ||||
| /* Handle the exception where for TFM_BONESIZE in edit mode we pretend to be | /* Handle the exception where for TFM_BONESIZE in edit mode we pretend to be | ||||
| * in pose mode (to use bone orientation matrix), | * in pose mode (to use bone orientation matrix), | ||||
| * in that case we have to do mirroring as well. */ | * in that case we have to do mirroring as well. */ | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| Object *ob = tc->poseobj; | Object *ob = tc->poseobj; | ||||
| bArmature *arm = ob->data; | bArmature *arm = ob->data; | ||||
| ▲ Show 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | static void pose_grab_with_ik_clear(Main *bmain, Object *ob) | ||||
| } | } | ||||
| if (relations_changed) { | if (relations_changed) { | ||||
| /* TODO(sergey): Consider doing partial update only. */ | /* TODO(sergey): Consider doing partial update only. */ | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| } | } | ||||
| } | } | ||||
| void special_aftertrans_update__pose(bContext *C, TransInfo *t) | static void special_aftertrans_update__pose(bContext *C, TransInfo *t) | ||||
| { | { | ||||
| Object *ob; | Object *ob; | ||||
| if (t->mode == TFM_BONESIZE) { | if (t->mode == TFM_BONESIZE) { | ||||
| /* Handle the exception where for TFM_BONESIZE in edit mode we pretend to be | /* Handle the exception where for TFM_BONESIZE in edit mode we pretend to be | ||||
| * in pose mode (to use bone orientation matrix), | * in pose mode (to use bone orientation matrix), | ||||
| * in that case we don't do operations like auto-keyframing. */ | * in that case we don't do operations like auto-keyframing. */ | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | GSET_ITER (gs_iter, motionpath_updates) { | ||||
| ob = BLI_gsetIterator_getKey(&gs_iter); | ob = BLI_gsetIterator_getKey(&gs_iter); | ||||
| ED_pose_recalculate_paths(C, t->scene, ob, range); | ED_pose_recalculate_paths(C, t->scene, ob, range); | ||||
| } | } | ||||
| BLI_gset_free(motionpath_updates, NULL); | BLI_gset_free(motionpath_updates, NULL); | ||||
| } | } | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| TransConvertTypeInfo TransConvertType_EditArmature = { | |||||
| /* flags */ (T_EDIT | T_POINTS), | |||||
| /* createTransData */ createTransArmatureVerts, | |||||
| /* recalcData */ recalcData_edit_armature, | |||||
| /* special_aftertrans_update */ NULL, | |||||
| }; | |||||
| TransConvertTypeInfo TransConvertType_Pose = { | |||||
| /* flags */ 0, | |||||
| /* createTransData */ createTransPose, | |||||
| /* recalcData */ recalcData_pose, | |||||
| /* special_aftertrans_update */ special_aftertrans_update__pose, | |||||
| }; | |||||