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.
This commit is contained in:
Brecht Van Lommel 2019-05-01 19:27:05 +02:00
parent 51347be24e
commit ffaf91b5fc
2 changed files with 33 additions and 48 deletions

View File

@ -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? */

View File

@ -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);
}