diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-01 20:27:05 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-02 17:03:39 +0300 |
commit | ffaf91b5fc03f91e1fc90bd2f1d5dc5aa75656ff (patch) | |
tree | a2751ad82d28c37df483ed9269187e7f7de74d1e /source/blender/editors/armature | |
parent | 51347be24e474a3ad3d38a75d0060ca91b8a9794 (diff) |
Pose slide / relax: fix various issues
* Fix operator adjust settings not working.
* Fix modal operator not working when invoked from search menu.
* Fix tagging to be correct for new depsgraph.
* Fix pose relax doing nothing when start and end frames match
even if the current frame value is different.
* Remove odd 0.3..0.7 limit in adjust operator settings panel.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/pose_slide.c | 62 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_utils.c | 19 |
2 files changed, 33 insertions, 48 deletions
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index a984691064a..d683c599f7b 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -335,12 +335,6 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, Object *ob, flo /* next/end */ eVal = evaluate_fcurve(fcu, nextFrameF); - /* if both values are equal, don't do anything */ - if (IS_EQF(sVal, eVal)) { - (*val) = sVal; - return; - } - /* calculate the relative weights of the endpoints */ if (pso->mode == POSESLIDE_BREAKDOWN) { /* get weights from the percentage control */ @@ -982,35 +976,41 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) case LEFTMOUSE: /* confirm */ case RETKEY: case PADENTER: { - /* return to normal cursor and header status */ - ED_area_status_text(pso->sa, NULL); - WM_cursor_modal_restore(win); + if (event->val == KM_PRESS) { + /* return to normal cursor and header status */ + ED_area_status_text(pso->sa, NULL); + WM_cursor_modal_restore(win); - /* insert keyframes as required... */ - pose_slide_autoKeyframe(C, pso); - pose_slide_exit(op); + /* insert keyframes as required... */ + pose_slide_autoKeyframe(C, pso); + pose_slide_exit(op); - /* done! */ - return OPERATOR_FINISHED; + /* done! */ + return OPERATOR_FINISHED; + } + break; } case ESCKEY: /* cancel */ case RIGHTMOUSE: { - /* return to normal cursor and header status */ - ED_area_status_text(pso->sa, NULL); - WM_cursor_modal_restore(win); + if (event->val == KM_PRESS) { + /* return to normal cursor and header status */ + ED_area_status_text(pso->sa, NULL); + WM_cursor_modal_restore(win); - /* reset transforms back to original state */ - pose_slide_reset(pso); + /* reset transforms back to original state */ + pose_slide_reset(pso); - /* depsgraph updates + redraws */ - pose_slide_refresh(C, pso); + /* depsgraph updates + redraws */ + pose_slide_refresh(C, pso); - /* clean up temp data */ - pose_slide_exit(op); + /* clean up temp data */ + pose_slide_exit(op); - /* canceled! */ - return OPERATOR_CANCELLED; + /* canceled! */ + return OPERATOR_CANCELLED; + } + break; } /* Percentage Chane... */ @@ -1162,8 +1162,8 @@ static void pose_slide_opdef_properties(wmOperatorType *ot) 1.0f, "Percentage", "Weighting factor for which keyframe is favored more", - 0.3, - 0.7); + 0.0, + 1.0); RNA_def_int(ot->srna, "prev_frame", @@ -1254,7 +1254,7 @@ void POSE_OT_push(wmOperatorType *ot) ot->poll = ED_operator_posemode; /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_USE_EVAL_DATA; /* Properties */ pose_slide_opdef_properties(ot); @@ -1316,7 +1316,7 @@ void POSE_OT_relax(wmOperatorType *ot) ot->poll = ED_operator_posemode; /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_USE_EVAL_DATA; /* Properties */ pose_slide_opdef_properties(ot); @@ -1378,7 +1378,7 @@ void POSE_OT_breakdown(wmOperatorType *ot) ot->poll = ED_operator_posemode; /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_USE_EVAL_DATA; /* Properties */ pose_slide_opdef_properties(ot); @@ -1783,7 +1783,7 @@ void POSE_OT_propagate(wmOperatorType *ot) ot->poll = ED_operator_posemode; /* XXX: needs selected bones! */ /* flag */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA; /* properties */ /* TODO: add "fade out" control for tapering off amount of propagation as time goes by? */ diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c index c94ada2942a..a1f763ac57d 100644 --- a/source/blender/editors/armature/pose_utils.c +++ b/source/blender/editors/armature/pose_utils.c @@ -220,24 +220,9 @@ void poseAnim_mapping_free(ListBase *pfLinks) /* ------------------------- */ /* helper for apply() / reset() - refresh the data */ -void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob) +void poseAnim_mapping_refresh(bContext *C, Scene *UNUSED(scene), Object *ob) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); - bArmature *arm = (bArmature *)ob->data; - - /* old optimize trick... this enforces to bypass the depgraph - * - note: code copied from transform_generics.c -> recalcData() - */ - /* FIXME: shouldn't this use the builtin stuff? */ - if ((arm->flag & ARM_DELAYDEFORM) == 0) { - DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); /* sets recalc flags */ - } - else { - BKE_pose_where_is(depsgraph, scene, ob); - } - - /* otherwise animation doesn't get updated */ - DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE); + DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); } |