diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/armature/armature_intern.h | 49 | ||||
-rw-r--r-- | source/blender/editors/armature/poseSlide.c | 156 | ||||
-rw-r--r-- | source/blender/editors/armature/poseUtils.c | 280 | ||||
-rw-r--r-- | source/blender/editors/armature/poselib.c | 25 |
4 files changed, 349 insertions, 161 deletions
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 370018d5fca..04c113db3be 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -31,6 +31,19 @@ /* internal exports only */ struct wmOperatorType; +struct bContext; +struct Scene; +struct Object; +struct bAction; +struct bPoseChannel; + +struct bArmature; +struct EditBone; + +struct ListBase; +struct LinkData; + +/* ******************************************************* */ /* editarmature.c operators */ void ARMATURE_OT_bone_primitive_add(struct wmOperatorType *ot); @@ -119,7 +132,39 @@ void SKETCH_OT_cancel_stroke(struct wmOperatorType *ot); void SKETCH_OT_select(struct wmOperatorType *ot); /* ******************************************************* */ +/* Pose Tool Utilities (for PoseLib, Pose Sliding, etc.) */ +/* poseUtils.c */ + +/* Temporary data linking PoseChannels with the F-Curves they affect */ +typedef struct tPChanFCurveLink { + struct tPChanFCurveLink *next, *prev; + + ListBase fcurves; /* F-Curves for this PoseChannel (wrapped with LinkData) */ + struct bPoseChannel *pchan; /* Pose Channel which data is attached to */ + + char *pchan_path; /* RNA Path to this Pose Channel (needs to be freed when we're done) */ + + // TODO: need to include axis-angle here at some stage + float oldloc[3]; /* transform values at start of operator (to be restored before each modal step) */ + float oldrot[3]; + float oldscale[3]; + float oldquat[4]; +} tPChanFCurveLink; + +/* ----------- */ + +void poseAnim_mapping_get(struct bContext *C, ListBase *pfLinks, struct Object *ob, struct bAction *act); +void poseAnim_mapping_free(ListBase *pfLinks); + +void poseAnim_mapping_refresh(struct bContext *C, struct Scene *scene, struct Object *ob); +void poseAnim_mapping_reset(ListBase *pfLinks); +void poseAnim_mapping_autoKeyframe(struct bContext *C, struct Scene *scene, struct Object *ob, ListBase *pfLinks, float cframe); + +LinkData *poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, char *path); + +/* ******************************************************* */ /* PoseLib */ +/* poselib.c */ void POSELIB_OT_pose_add(struct wmOperatorType *ot); void POSELIB_OT_pose_remove(struct wmOperatorType *ot); @@ -128,6 +173,7 @@ void POSELIB_OT_browse_interactive(struct wmOperatorType *ot); /* ******************************************************* */ /* Pose Sliding Tools */ +/* poseSlide.c */ void POSE_OT_push(struct wmOperatorType *ot); void POSE_OT_relax(struct wmOperatorType *ot); @@ -135,9 +181,6 @@ void POSE_OT_breakdown(struct wmOperatorType *ot); /* ******************************************************* */ /* editarmature.c */ -struct bArmature; -struct EditBone; -struct ListBase; EditBone *make_boneList(struct ListBase *edbo, struct ListBase *bones, struct EditBone *parent, struct Bone *actBone); void BIF_sk_selectStroke(struct bContext *C, short mval[2], short extend); diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index be6d7d69b5f..1aa7ea07078 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -108,10 +108,6 @@ typedef struct tPoseSlideOp { ListBase pfLinks; /* links between posechannels and f-curves */ DLRBT_Tree keys; /* binary tree for quicker searching for keyframes (when applicable) */ - KeyingSet *ks_loc; /* builtin KeyingSet for keyframing locations */ - KeyingSet *ks_rot; /* builtin KeyingSet for keyframing rotations */ - KeyingSet *ks_scale;/* builtin KeyingSet for keyframing scale */ - int cframe; /* current frame number */ int prevFrame; /* frame before current frame (blend-from) */ int nextFrame; /* frame after current frame (blend-to) */ @@ -129,21 +125,6 @@ typedef enum ePoseSlide_Modes { POSESLIDE_BREAKDOWN, /* slide between the endpoint poses, finding a 'soft' spot */ } ePoseSlide_Modes; -/* Temporary data linking PoseChannels with the F-Curves they affect */ -typedef struct tPChanFCurveLink { - struct tPChanFCurveLink *next, *prev; - - ListBase fcurves; /* F-Curves for this PoseChannel */ - bPoseChannel *pchan; /* Pose Channel which data is attached to */ - - char *pchan_path; /* RNA Path to this Pose Channel (needs to be freed when we're done) */ - - float oldloc[3]; /* transform values at start of operator (to be restored before each modal step) */ - float oldrot[3]; - float oldscale[3]; - float oldquat[4]; -} tPChanFCurveLink; - /* ------------------------------------ */ /* operator init */ @@ -178,45 +159,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode) /* for each Pose-Channel which gets affected, get the F-Curves for that channel * and set the relevant transform flags... */ - CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) - { - ListBase curves = {NULL, NULL}; - int transFlags = action_get_item_transforms(act, pso->ob, pchan, &curves); - - pchan->flag &= ~(POSE_LOC|POSE_ROT|POSE_SIZE); - - /* check if any transforms found... */ - if (transFlags) { - /* make new linkage data */ - tPChanFCurveLink *pfl= MEM_callocN(sizeof(tPChanFCurveLink), "tPChanFCurveLink"); - PointerRNA ptr; - - pfl->fcurves= curves; - pfl->pchan= pchan; - - /* get the RNA path to this pchan - this needs to be freed! */ - RNA_pointer_create((ID *)pso->ob, &RNA_PoseBone, pchan, &ptr); - pfl->pchan_path= RNA_path_from_ID_to_struct(&ptr); - - /* add linkage data to operator data */ - BLI_addtail(&pso->pfLinks, pfl); - - /* set pchan's transform flags */ - if (transFlags & ACT_TRANS_LOC) - pchan->flag |= POSE_LOC; - if (transFlags & ACT_TRANS_ROT) - pchan->flag |= POSE_ROT; - if (transFlags & ACT_TRANS_SCALE) - pchan->flag |= POSE_SIZE; - - /* store current transforms */ - VECCOPY(pfl->oldloc, pchan->loc); - VECCOPY(pfl->oldrot, pchan->eul); - VECCOPY(pfl->oldscale, pchan->size); - QUATCOPY(pfl->oldquat, pchan->quat); - } - } - CTX_DATA_END; + poseAnim_mapping_get(C, &pso->pfLinks, pso->ob, act); /* set depsgraph flags */ /* make sure the lock is set OK, unlock can be accidentally saved? */ @@ -228,11 +171,6 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode) */ BLI_dlrbTree_init(&pso->keys); - /* get builtin KeyingSets */ - pso->ks_loc= ANIM_builtin_keyingset_get_named(NULL, "Location"); - pso->ks_rot= ANIM_builtin_keyingset_get_named(NULL, "Rotation"); - pso->ks_scale= ANIM_builtin_keyingset_get_named(NULL, "Scaling"); - /* return status is whether we've got all the data we were requested to get */ return 1; } @@ -244,21 +182,8 @@ static void pose_slide_exit (bContext *C, wmOperator *op) /* if data exists, clear its data and exit */ if (pso) { - tPChanFCurveLink *pfl, *pfln=NULL; - /* free the temp pchan links and their data */ - for (pfl= pso->pfLinks.first; pfl; pfl= pfln) { - pfln= pfl->next; - - /* free list of F-Curve reference links */ - BLI_freelistN(&pfl->fcurves); - - /* free pchan RNA Path */ - MEM_freeN(pfl->pchan_path); - - /* free link itself */ - BLI_freelinkN(&pso->pfLinks, pfl); - } + poseAnim_mapping_free(&pso->pfLinks); /* free RB-BST for keyframes (if it contained data) */ BLI_dlrbTree_free(&pso->keys); @@ -276,36 +201,8 @@ static void pose_slide_exit (bContext *C, wmOperator *op) /* helper for apply() / reset() - refresh the data */ static void pose_slide_refresh (bContext *C, tPoseSlideOp *pso) { - /* 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 ((pso->arm->flag & ARM_DELAYDEFORM)==0) - DAG_id_flush_update(&pso->ob->id, OB_RECALC_DATA); /* sets recalc flags */ - else - where_is_pose(pso->scene, pso->ob); - - /* note, notifier might evolve */ - WM_event_add_notifier(C, NC_OBJECT|ND_POSE, pso->ob); -} - -/* helper for apply() callabcks - find the next F-Curve with matching path... */ -static LinkData *find_next_fcurve_link (ListBase *fcuLinks, LinkData *prev, char *path) -{ - LinkData *first= (prev)? prev->next : (fcuLinks)? fcuLinks->first : NULL; - LinkData *ld; - - /* check each link to see if the linked F-Curve has a matching path */ - for (ld= first; ld; ld= ld->next) { - FCurve *fcu= (FCurve *)ld->data; - - /* check if paths match */ - if (strcmp(path, fcu->rna_path) == 0) - return ld; - } - - /* none found */ - return NULL; + /* wrapper around the generic version, allowing us to add some custom stuff later still */ + poseAnim_mapping_refresh(C, pso->scene, pso->ob); } /* helper for apply() - perform sliding for some 3-element vector */ @@ -322,7 +219,7 @@ static void pose_slide_apply_vec3 (tPoseSlideOp *pso, tPChanFCurveLink *pfl, flo cframe= (float)pso->cframe; /* using this path, find each matching F-Curve for the variables we're interested in */ - while ( (ld= find_next_fcurve_link(&pfl->fcurves, ld, path)) ) { + while ( (ld= poseAnim_mapping_getNextFCurve(&pfl->fcurves, ld, path)) ) { FCurve *fcu= (FCurve *)ld->data; float sVal, eVal; float w1, w2; @@ -422,7 +319,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl) cframe= (float)pso->cframe; /* using this path, find each matching F-Curve for the variables we're interested in */ - while ( (ld= find_next_fcurve_link(&pfl->fcurves, ld, path)) ) { + while ( (ld= poseAnim_mapping_getNextFCurve(&pfl->fcurves, ld, path)) ) { FCurve *fcu= (FCurve *)ld->data; /* assign this F-Curve to one of the relevant pointers... */ @@ -551,48 +448,15 @@ static void pose_slide_apply (bContext *C, wmOperator *op, tPoseSlideOp *pso) /* perform autokeyframing after changes were made + confirmed */ static void pose_slide_autoKeyframe (bContext *C, tPoseSlideOp *pso) { - /* insert keyframes as necessary if autokeyframing */ - if (autokeyframe_cfra_can_key(pso->scene, &pso->ob->id)) { - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - tPChanFCurveLink *pfl; - - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= &pso->ob->id; - - /* iterate over each pose-channel affected, applying the changes */ - for (pfl= pso->pfLinks.first; pfl; pfl= pfl->next) { - bPoseChannel *pchan= pfl->pchan; - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - - /* insert keyframes */ - if (pchan->flag & POSE_LOC) - modify_keyframes(pso->scene, &dsources, NULL, pso->ks_loc, MODIFYKEY_MODE_INSERT, (float)pso->cframe); - if (pchan->flag & POSE_ROT) - modify_keyframes(pso->scene, &dsources, NULL, pso->ks_rot, MODIFYKEY_MODE_INSERT, (float)pso->cframe); - if (pchan->flag & POSE_SIZE) - modify_keyframes(pso->scene, &dsources, NULL, pso->ks_scale, MODIFYKEY_MODE_INSERT, (float)pso->cframe); - } - } + /* wrapper around the generic call */ + poseAnim_mapping_autoKeyframe(C, pso->scene, pso->ob, &pso->pfLinks, (float)pso->cframe); } /* reset changes made to current pose */ static void pose_slide_reset (bContext *C, tPoseSlideOp *pso) { - tPChanFCurveLink *pfl; - - /* iterate over each pose-channel affected, restoring all channels to their original values */ - for (pfl= pso->pfLinks.first; pfl; pfl= pfl->next) { - bPoseChannel *pchan= pfl->pchan; - - /* just copy all the values over regardless of whether they changed or not */ - VECCOPY(pchan->loc, pfl->oldloc); - VECCOPY(pchan->eul, pfl->oldrot); - VECCOPY(pchan->size, pfl->oldscale); - QUATCOPY(pchan->quat, pfl->oldquat); - } + /* wrapper around the generic call, so that custom stuff can be added later */ + poseAnim_mapping_reset(&pso->pfLinks); } /* ------------------------------------ */ diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c new file mode 100644 index 00000000000..e2fc2bd4088 --- /dev/null +++ b/source/blender/editors/armature/poseUtils.c @@ -0,0 +1,280 @@ +/** + * $Id: + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung + * This is a new part of Blender + * + * Contributor(s): Joshua Leung + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <stdlib.h> +#include <stdio.h> +#include <stddef.h> +#include <string.h> +#include <math.h> +#include <float.h> + +#include "MEM_guardedalloc.h" + +#include "BLI_math.h" +#include "BLI_blenlib.h" +#include "BLI_dynstr.h" +#include "BLI_dlrbTree.h" + +#include "DNA_listBase.h" +#include "DNA_anim_types.h" +#include "DNA_action_types.h" +#include "DNA_armature_types.h" +#include "DNA_curve_types.h" +#include "DNA_object_types.h" +#include "DNA_object_force.h" +#include "DNA_scene_types.h" +#include "DNA_userdef_types.h" + +#include "BKE_animsys.h" +#include "BKE_action.h" +#include "BKE_armature.h" +#include "BKE_depsgraph.h" +#include "BKE_fcurve.h" +#include "BKE_object.h" + +#include "BKE_global.h" +#include "BKE_context.h" +#include "BKE_report.h" +#include "BKE_utildefines.h" + +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_types.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "BIF_gl.h" + +#include "ED_anim_api.h" +#include "ED_armature.h" +#include "ED_keyframes_draw.h" +#include "ED_keyframing.h" +#include "ED_keyframes_edit.h" +#include "ED_screen.h" + +#include "armature_intern.h" + +/* *********************************************** */ +/* Contents of this File: + * + * This file contains methods shared between Pose Slide and Pose Lib; + * primarily the functions in question concern Animato <-> Pose + * convenience functions, such as applying/getting pose values + * and/or inserting keyframes for these. + */ +/* *********************************************** */ +/* FCurves <-> PoseChannels Links */ + +/* helper for poseAnim_mapping_get() -> get the relevant F-Curves per PoseChannel */ +static void fcurves_to_pchan_links_get (ListBase *pfLinks, Object *ob, bAction *act, bPoseChannel *pchan) +{ + ListBase curves = {NULL, NULL}; + int transFlags = action_get_item_transforms(act, ob, pchan, &curves); + + pchan->flag &= ~(POSE_LOC|POSE_ROT|POSE_SIZE); + + /* check if any transforms found... */ + if (transFlags) { + /* make new linkage data */ + tPChanFCurveLink *pfl= MEM_callocN(sizeof(tPChanFCurveLink), "tPChanFCurveLink"); + PointerRNA ptr; + + pfl->fcurves= curves; + pfl->pchan= pchan; + + /* get the RNA path to this pchan - this needs to be freed! */ + RNA_pointer_create((ID *)ob, &RNA_PoseBone, pchan, &ptr); + pfl->pchan_path= RNA_path_from_ID_to_struct(&ptr); + + /* add linkage data to operator data */ + BLI_addtail(pfLinks, pfl); + + /* set pchan's transform flags */ + if (transFlags & ACT_TRANS_LOC) + pchan->flag |= POSE_LOC; + if (transFlags & ACT_TRANS_ROT) + pchan->flag |= POSE_ROT; + if (transFlags & ACT_TRANS_SCALE) + pchan->flag |= POSE_SIZE; + + /* store current transforms */ + // TODO: store axis-angle too? + VECCOPY(pfl->oldloc, pchan->loc); + VECCOPY(pfl->oldrot, pchan->eul); + VECCOPY(pfl->oldscale, pchan->size); + QUATCOPY(pfl->oldquat, pchan->quat); + } +} + + +/* get sets of F-Curves providing transforms for the bones in the Pose */ +// TODO: separate the inner workings out to another helper func, since we need option of whether to take selected or visible bones... +void poseAnim_mapping_get (bContext *C, ListBase *pfLinks, Object *ob, bAction *act) +{ + /* for each Pose-Channel which gets affected, get the F-Curves for that channel + * and set the relevant transform flags... + */ + CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) + { + fcurves_to_pchan_links_get(pfLinks, ob, act, pchan); + } + CTX_DATA_END; +} + +/* free F-Curve <-> PoseChannel links */ +void poseAnim_mapping_free (ListBase *pfLinks) +{ + tPChanFCurveLink *pfl, *pfln=NULL; + + /* free the temp pchan links and their data */ + for (pfl= pfLinks->first; pfl; pfl= pfln) { + pfln= pfl->next; + + /* free list of F-Curve reference links */ + BLI_freelistN(&pfl->fcurves); + + /* free pchan RNA Path */ + MEM_freeN(pfl->pchan_path); + + /* free link itself */ + BLI_freelinkN(pfLinks, pfl); + } +} + +/* ------------------------- */ + +/* helper for apply() / reset() - refresh the data */ +void poseAnim_mapping_refresh (bContext *C, Scene *scene, Object *ob) +{ + 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) + DAG_id_flush_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */ + else + where_is_pose(scene, ob); + + /* note, notifier might evolve */ + WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); +} + +/* reset changes made to current pose */ +void poseAnim_mapping_reset (ListBase *pfLinks) +{ + tPChanFCurveLink *pfl; + + /* iterate over each pose-channel affected, restoring all channels to their original values */ + for (pfl= pfLinks->first; pfl; pfl= pfl->next) { + bPoseChannel *pchan= pfl->pchan; + + /* just copy all the values over regardless of whether they changed or not */ + // TODO; include axis-angle here too? + VECCOPY(pchan->loc, pfl->oldloc); + VECCOPY(pchan->eul, pfl->oldrot); + VECCOPY(pchan->size, pfl->oldscale); + QUATCOPY(pchan->quat, pfl->oldquat); + } +} + +/* perform autokeyframing after changes were made + confirmed */ +void poseAnim_mapping_autoKeyframe (bContext *C, Scene *scene, Object *ob, ListBase *pfLinks, float cframe) +{ + static short keyingsets_need_init = 1; + static KeyingSet *ks_loc = NULL; + static KeyingSet *ks_rot = NULL; + static KeyingSet *ks_scale = NULL; + + /* get keyingsets the first time this is run? + * NOTE: it should be safe to store these static, since they're currently builtin ones + * but maybe later this may change, in which case this code needs to be revised! + */ + if (keyingsets_need_init) { + ks_loc= ANIM_builtin_keyingset_get_named(NULL, "Location"); + ks_rot= ANIM_builtin_keyingset_get_named(NULL, "Rotation"); + ks_scale= ANIM_builtin_keyingset_get_named(NULL, "Scaling"); + + keyingsets_need_init = 0; + } + + /* insert keyframes as necessary if autokeyframing */ + if (autokeyframe_cfra_can_key(scene, &ob->id)) { + bCommonKeySrc cks; + ListBase dsources = {&cks, &cks}; + tPChanFCurveLink *pfl; + + /* init common-key-source for use by KeyingSets */ + memset(&cks, 0, sizeof(bCommonKeySrc)); + cks.id= &ob->id; + + /* iterate over each pose-channel affected, applying the changes */ + for (pfl= pfLinks->first; pfl; pfl= pfl->next) { + bPoseChannel *pchan= pfl->pchan; + /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ + cks.pchan= pchan; + + /* insert keyframes */ + if (pchan->flag & POSE_LOC) + modify_keyframes(scene, &dsources, NULL, ks_loc, MODIFYKEY_MODE_INSERT, cframe); + if (pchan->flag & POSE_ROT) + modify_keyframes(scene, &dsources, NULL, ks_rot, MODIFYKEY_MODE_INSERT, cframe); + if (pchan->flag & POSE_SIZE) + modify_keyframes(scene, &dsources, NULL, ks_scale, MODIFYKEY_MODE_INSERT, cframe); + } + } +} + +/* ------------------------- */ + +/* find the next F-Curve for a PoseChannel with matching path... + * - path is not just the pfl rna_path, since that path doesn't have property info yet + */ +LinkData *poseAnim_mapping_getNextFCurve (ListBase *fcuLinks, LinkData *prev, char *path) +{ + LinkData *first= (prev)? prev->next : (fcuLinks)? fcuLinks->first : NULL; + LinkData *ld; + + /* check each link to see if the linked F-Curve has a matching path */ + for (ld= first; ld; ld= ld->next) { + FCurve *fcu= (FCurve *)ld->data; + + /* check if paths match */ + if (strcmp(path, fcu->rna_path) == 0) + return ld; + } + + /* none found */ + return NULL; +} + +/* *********************************************** */ diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 5cf44951c37..02194035ee9 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -83,9 +83,6 @@ /* ******* XXX ********** */ -static void BIF_undo_push() {} -static void error() {} - static void action_set_activemarker() {} /* ************************************************************* */ @@ -221,7 +218,7 @@ void poselib_validate_act (bAction *act) /* validate action and poselib */ if (act == NULL) { - error("No Action to validate"); + //error("No Action to validate"); return; } @@ -233,6 +230,7 @@ void poselib_validate_act (bAction *act) /* for each key, make sure there is a correspnding pose */ for (ak= keys.first; ak; ak= ak->next) { /* check if any pose matches this */ + // TODO: don't go looking through the list like this every time... for (marker= act->markers.first; marker; marker= marker->next) { if (IS_EQ(marker->frame, ak->cfra)) { marker->flag = -1; @@ -270,7 +268,7 @@ void poselib_validate_act (bAction *act) /* free temp memory */ BLI_freelistN((ListBase *)&keys); - BIF_undo_push("PoseLib Validate Action"); + //BIF_undo_push("PoseLib Validate Action"); } /* ************************************************************* */ @@ -627,18 +625,18 @@ typedef struct tPoseLib_PreviewData { bAction *act; /* poselib to use */ TimeMarker *marker; /* 'active' pose */ - short state; /* state of main loop */ - short redraw; /* redraw/update settings during main loop */ - short flag; /* flags for various settings */ - int selcount; /* number of selected elements to work on */ int totcount; /* total number of elements to work on */ - char headerstr[200]; /* Info-text to print in header */ + short state; /* state of main loop */ + short redraw; /* redraw/update settings during main loop */ + short flag; /* flags for various settings */ + short search_cursor; /* position of cursor in searchstr (cursor occurs before the item at the nominated index) */ char searchstr[64]; /* (Part of) Name to search for to filter poses that get shown */ char searchold[64]; /* Previously set searchstr (from last loop run), so that we can detected when to rebuild searchp */ - short search_cursor; /* position of cursor in searchstr (cursor occurs before the item at the nominated index) */ + + char headerstr[200]; /* Info-text to print in header */ } tPoseLib_PreviewData; /* defines for tPoseLib_PreviewData->state values */ @@ -1512,5 +1510,8 @@ void POSELIB_OT_browse_interactive (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; /* properties */ - RNA_def_int(ot->srna, "pose_index", -1, -2, INT_MAX, "Pose", "Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose)", 0, INT_MAX); + // TODO: make the pose_index into a proper enum instead of a cryptic int... + ot->prop= RNA_def_int(ot->srna, "pose_index", -1, -2, INT_MAX, "Pose", "Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose)", 0, INT_MAX); + // XXX: percentage vs factor? + RNA_def_float_factor(ot->srna, "blend_factor", 1.0f, 0.0f, 1.0f, "Blend Factor", "Amount that the pose is applied on top of the existing poses", 0.0f, 1.0f); } |