diff options
author | Hans Goudey <h.goudey@me.com> | 2020-08-12 21:19:05 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-08-12 21:19:05 +0300 |
commit | 31705201dddebf7e3be5c4533b89f380aad1ede1 (patch) | |
tree | 53c8be86b15e9ebd96dd60cad52e6acac8ce2324 /source/blender/editors/armature | |
parent | ea4c327c977223922c41c889fa2bd51403409dca (diff) | |
parent | 337b6d075880ea44ff5183804a387dc98673ffb9 (diff) |
Merge branch 'master' into active-fcurve-keyframe
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/armature_intern.h | 5 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_relations.c | 1 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_skinning.c | 6 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_utils.c | 14 | ||||
-rw-r--r-- | source/blender/editors/armature/meshlaplacian.c | 8 | ||||
-rw-r--r-- | source/blender/editors/armature/meshlaplacian.h | 5 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_lib.c | 13 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_slide.c | 12 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_transform.c | 15 |
9 files changed, 41 insertions, 38 deletions
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 08d82bf13c9..9a04425a083 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -21,8 +21,7 @@ * \ingroup edarmature */ -#ifndef __ARMATURE_INTERN_H__ -#define __ARMATURE_INTERN_H__ +#pragma once /* internal exports only */ struct wmOperatorType; @@ -289,5 +288,3 @@ int bone_looper(struct Object *ob, struct Bone *bone, void *data, int (*bone_func)(struct Object *, struct Bone *, void *)); - -#endif /* __ARMATURE_INTERN_H__ */ diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index 0dd35fb9fdc..a737916e9a2 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -384,6 +384,7 @@ int ED_armature_join_objects_exec(bContext *C, wmOperator *op) BLI_remlink(curarm->edbo, curbone); BLI_addtail(arm->edbo, curbone); + /* Pose channel is moved from one storage to another, its UUID is still unique. */ BLI_remlink(&opose->chanbase, pchan); BLI_addtail(&pose->chanbase, pchan); BKE_pose_channels_hash_free(opose); diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index b3c58f2575b..ea9b0eb92b9 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -342,9 +342,9 @@ static void add_verts_to_dgroups(ReportList *reports, /* create an array of root and tip positions transformed into * global coords */ - root = MEM_callocN(numbones * sizeof(float) * 3, "root"); - tip = MEM_callocN(numbones * sizeof(float) * 3, "tip"); - selected = MEM_callocN(numbones * sizeof(int), "selected"); + root = MEM_callocN(sizeof(float[3]) * numbones, "root"); + tip = MEM_callocN(sizeof(float[3]) * numbones, "tip"); + selected = MEM_callocN(sizeof(int) * numbones, "selected"); for (j = 0; j < numbones; j++) { bone = bonelist[j]; diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index b2e329deee7..04c1ec97841 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -229,7 +229,7 @@ EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], const ui return NULL; } -void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]) +void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3]) { float delta[3], roll; @@ -246,20 +246,20 @@ void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]) } } - vec_roll_to_mat3_normalized(delta, roll, mat); + vec_roll_to_mat3_normalized(delta, roll, r_mat); } -void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]) +void ED_armature_ebone_to_mat4(EditBone *ebone, float r_mat[4][4]) { float m3[3][3]; ED_armature_ebone_to_mat3(ebone, m3); - copy_m4_m3(mat, m3); - copy_v3_v3(mat[3], ebone->head); + copy_m4_m3(r_mat, m3); + copy_v3_v3(r_mat[3], ebone->head); } -void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]) +void ED_armature_ebone_from_mat3(EditBone *ebone, const float mat[3][3]) { float vec[3], roll; const float len = len_v3v3(ebone->head, ebone->tail); @@ -270,7 +270,7 @@ void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]) ebone->roll = roll; } -void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]) +void ED_armature_ebone_from_mat4(EditBone *ebone, const float mat[4][4]) { float mat3[3][3]; diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 11066595e2e..75ffd31854a 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -223,7 +223,7 @@ static LaplacianSystem *laplacian_system_construct_begin(int totvert, int totfac sys->verts = MEM_callocN(sizeof(float *) * totvert, "LaplacianSystemVerts"); sys->vpinned = MEM_callocN(sizeof(char) * totvert, "LaplacianSystemVpinned"); - sys->faces = MEM_callocN(sizeof(int) * 3 * totface, "LaplacianSystemFaces"); + sys->faces = MEM_callocN(sizeof(int[3]) * totface, "LaplacianSystemFaces"); sys->totvert = 0; sys->totface = 0; @@ -296,7 +296,7 @@ static void laplacian_system_construct_end(LaplacianSystem *sys) } if (sys->storeweights) { - sys->fweights = MEM_callocN(sizeof(float) * 3 * totface, "LaplacianFWeight"); + sys->fweights = MEM_callocN(sizeof(float[3]) * totface, "LaplacianFWeight"); } for (a = 0, face = sys->faces; a < totface; a++, face++) { @@ -568,7 +568,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys) float fnor[3]; int a, v1, v2, v3, (*face)[3]; - sys->heat.vnors = MEM_callocN(sizeof(float) * 3 * sys->totvert, "HeatVNors"); + sys->heat.vnors = MEM_callocN(sizeof(float[3]) * sys->totvert, "HeatVNors"); for (a = 0, face = sys->faces; a < sys->totface; a++, face++) { v1 = (*face)[0]; @@ -1762,7 +1762,7 @@ void ED_mesh_deform_bind_callback(MeshDeformModifierData *mmd, memset(&mdb, 0, sizeof(MeshDeformBind)); /* get mesh and cage mesh */ - mdb.vertexcos = MEM_callocN(sizeof(float) * 3 * totvert, "MeshDeformCos"); + mdb.vertexcos = MEM_callocN(sizeof(float[3]) * totvert, "MeshDeformCos"); mdb.totvert = totvert; mdb.cagemesh = cagemesh; diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h index 0a9e6e878e4..0405e361b2f 100644 --- a/source/blender/editors/armature/meshlaplacian.h +++ b/source/blender/editors/armature/meshlaplacian.h @@ -20,8 +20,7 @@ * \ingroup edarmature */ -#ifndef __MESHLAPLACIAN_H__ -#define __MESHLAPLACIAN_H__ +#pragma once //#define RIGID_DEFORM @@ -70,5 +69,3 @@ void rigid_deform_end(int cancel); /* Harmonic Coordinates */ /* ED_mesh_deform_bind_callback(...) defined in ED_armature.h */ - -#endif diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 6ce9ed06f1a..c9d0478270a 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -1023,7 +1023,8 @@ static void poselib_backup_free_data(tPoseLib_PreviewData *pld) * - gets the string to print in the header * - this code is based on the code for extract_pose_from_action in blenkernel/action.c */ -static void poselib_apply_pose(tPoseLib_PreviewData *pld) +static void poselib_apply_pose(tPoseLib_PreviewData *pld, + const AnimationEvalContext *anim_eval_context) { PointerRNA *ptr = &pld->rna_ptr; bArmature *arm = pld->arm; @@ -1049,6 +1050,8 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld) group_ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE); ked.f1 = ((float)frame) - 0.5f; ked.f2 = ((float)frame) + 0.5f; + AnimationEvalContext anim_context_at_frame = BKE_animsys_eval_context_construct_at( + anim_eval_context, frame); /* start applying - only those channels which have a key at this point in time! */ for (agrp = act->groups.first; agrp; agrp = agrp->next) { @@ -1075,7 +1078,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld) } if (ok) { - animsys_evaluate_action_group(ptr, act, agrp, (float)frame); + animsys_evaluate_action_group(ptr, act, agrp, &anim_context_at_frame); } } } @@ -1150,7 +1153,11 @@ static void poselib_preview_apply(bContext *C, wmOperator *op) /* pose should be the right one to draw (unless we're temporarily not showing it) */ if ((pld->flag & PL_PREVIEW_SHOWORIGINAL) == 0) { RNA_int_set(op->ptr, "pose_index", BLI_findindex(&pld->act->markers, pld->marker)); - poselib_apply_pose(pld); + struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); + + const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( + depsgraph, 0.0f /* poselib_apply_pose() determines its own evaluation time. */); + poselib_apply_pose(pld, &anim_eval_context); } else { RNA_int_set(op->ptr, "pose_index", -2); /* -2 means don't apply any pose */ diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index 8df9c99896e..e60270bc3f0 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -251,7 +251,7 @@ static int pose_slide_init(bContext *C, wmOperator *op, ePoseSlide_Modes mode) */ BLI_dlrbTree_init(&pso->keys); - /* initialise numeric input */ + /* Initialize numeric input. */ initNumInput(&pso->num); pso->num.idx_max = 0; /* one axis */ pso->num.val_flag[0] |= NUM_NO_NEGATIVE; @@ -1310,7 +1310,7 @@ static int pose_slide_push_invoke(bContext *C, wmOperator *op, const wmEvent *ev pso = op->customdata; - /* initialise percentage so that it won't pop on first mouse move */ + /* Initialize percentage so that it won't pop on first mouse move. */ pose_slide_mouse_update_percentage(pso, op, event); /* do common setup work */ @@ -1370,7 +1370,7 @@ static int pose_slide_relax_invoke(bContext *C, wmOperator *op, const wmEvent *e pso = op->customdata; - /* initialise percentage so that it won't pop on first mouse move */ + /* Initialize percentage so that it won't pop on first mouse move. */ pose_slide_mouse_update_percentage(pso, op, event); /* do common setup work */ @@ -1429,7 +1429,7 @@ static int pose_slide_push_rest_invoke(bContext *C, wmOperator *op, const wmEven pso = op->customdata; - /* initialise percentage so that it won't pop on first mouse move */ + /* Initialize percentage so that it won't pop on first mouse move. */ pose_slide_mouse_update_percentage(pso, op, event); /* do common setup work */ @@ -1489,7 +1489,7 @@ static int pose_slide_relax_rest_invoke(bContext *C, wmOperator *op, const wmEve pso = op->customdata; - /* initialise percentage so that it won't pop on first mouse move */ + /* Initialize percentage so that it won't pop on first mouse move. */ pose_slide_mouse_update_percentage(pso, op, event); /* do common setup work */ @@ -1549,7 +1549,7 @@ static int pose_slide_breakdown_invoke(bContext *C, wmOperator *op, const wmEven pso = op->customdata; - /* initialise percentage so that it won't pop on first mouse move */ + /* Initialize percentage so that it won't pop on first mouse move. */ pose_slide_mouse_update_percentage(pso, op, event); /* do common setup work */ diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index 1d2bf152777..a6cf8552ca4 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -1219,7 +1219,9 @@ static int pose_clear_user_transforms_exec(bContext *C, wmOperator *op) ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); Scene *scene = CTX_data_scene(C); - float cframe = (float)CFRA; + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); + const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(depsgraph, + (float)CFRA); const bool only_select = RNA_boolean_get(op->ptr, "only_selected"); FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob) { @@ -1240,7 +1242,8 @@ static int pose_clear_user_transforms_exec(bContext *C, wmOperator *op) workob.adt = ob->adt; workob.pose = dummyPose; - BKE_animsys_evaluate_animdata(&workob.id, workob.adt, cframe, ADT_RECALC_ANIM, false); + BKE_animsys_evaluate_animdata( + &workob.id, workob.adt, &anim_eval_context, ADT_RECALC_ANIM, false); /* copy back values, but on selected bones only */ for (pchan = dummyPose->chanbase.first; pchan; pchan = pchan->next) { @@ -1259,10 +1262,8 @@ static int pose_clear_user_transforms_exec(bContext *C, wmOperator *op) MEM_freeN(dummyPose); } else { - /* no animation, so just reset whole pose to rest pose - * (cannot just restore for selected though) - */ - BKE_pose_rest(ob->pose); + /* No animation, so just reset to the rest pose. */ + BKE_pose_rest(ob->pose, only_select); } /* notifiers and updates */ @@ -1279,7 +1280,7 @@ void POSE_OT_user_transforms_clear(wmOperatorType *ot) /* identifiers */ ot->name = "Clear User Transforms"; ot->idname = "POSE_OT_user_transforms_clear"; - ot->description = "Reset pose on selected bones to keyframed state"; + ot->description = "Reset pose bone transforms to keyframed state"; /* callbacks */ ot->exec = pose_clear_user_transforms_exec; |