#include "BLI_arithb.h"
#include "DNA_action_types.h"
+#include "DNA_constraint_types.h"
#include "DNA_curve_types.h"
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
return 0;
}
-/* This function is used to loop over the IPO curves (and subsequently the keyframes in them) */
+/* This function is used to loop over the IPO curves in the given IPO (and subsequently the keyframes in them) */
short ANIM_ipo_keys_bezier_loop(BeztEditData *bed, Ipo *ipo, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, IcuEditFunc icu_cb)
{
IpoCurve *icu;
/* -------------------------------- Further Abstracted ----------------------------- */
+/* This function is used to loop over the keyframe data in an Action Group */
+static short agrp_keys_bezier_loop(BeztEditData *bed, bActionGroup *agrp, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, IcuEditFunc icu_cb)
+{
+ bActionChannel *achan;
+ bConstraintChannel *conchan;
+
+ /* only iterate over the action-channels and their sub-channels that are in this group */
+ for (achan= agrp->channels.first; achan && achan->grp==agrp; achan= achan->next) {
+ if (ANIM_ipo_keys_bezier_loop(bed, achan->ipo, bezt_ok, bezt_cb, icu_cb))
+ return 1;
+
+ for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
+ if (ANIM_ipo_keys_bezier_loop(bed, conchan->ipo, bezt_ok, bezt_cb, icu_cb))
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/* This function is used to loop over the keyframe data in an Action Group */
+static short act_keys_bezier_loop(BeztEditData *bed, bAction *act, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, IcuEditFunc icu_cb)
+{
+ bActionChannel *achan;
+ bConstraintChannel *conchan;
+
+ for (achan= act->chanbase.first; achan; achan= achan->next) {
+ if (ANIM_ipo_keys_bezier_loop(bed, achan->ipo, bezt_ok, bezt_cb, icu_cb))
+ return 1;
+
+ for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
+ if (ANIM_ipo_keys_bezier_loop(bed, conchan->ipo, bezt_ok, bezt_cb, icu_cb))
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/* --- */
+
+
/* This function is used to apply operation to all keyframes, regardless of the type */
short ANIM_animchannel_keys_bezier_loop(BeztEditData *bed, bAnimListElem *ale, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, IcuEditFunc icu_cb)
{
/* method to use depends on the type of keyframe data */
switch (ale->datatype) {
+ /* direct keyframe data (these loops are exposed) */
case ALE_ICU: /* ipo-curve */
return ANIM_icu_keys_bezier_loop(bed, ale->key_data, bezt_ok, bezt_cb, icu_cb);
case ALE_IPO: /* ipo */
return ANIM_ipo_keys_bezier_loop(bed, ale->key_data, bezt_ok, bezt_cb, icu_cb);
+ /* indirect 'summaries' (these are not exposed) */
case ALE_GROUP: /* action group */
- //return group_keys_bezier_loop(bed, ale->data, bezt_ok, bezt_cb, icu_cb);
- break;
+ return agrp_keys_bezier_loop(bed, (bActionGroup *)ale->data, bezt_ok, bezt_cb, icu_cb);
+ case ALE_ACT: /* action */
+ return act_keys_bezier_loop(bed, (bAction *)ale->data, bezt_ok, bezt_cb, icu_cb);
}
return 0;
// TRANSFORM_FIX_ME
//transform_aspect_ratio_tface_uv(&aspx, &aspy);
+ aspx= aspy= 1.0f;
divx= v2d->mask.xmax-v2d->mask.xmin;
divy= v2d->mask.ymax-v2d->mask.ymin;
if (t->state != TRANS_RUNNING)
{
/* handle restoring objects */
- if(t->state == TRANS_CANCEL)
+ if(t->state == TRANS_CANCEL) {
if(t->spacetype == SPACE_NODE)
restoreTransNodes(t);
else
restoreTransObjects(t); // calls recalcData()
+ }
/* free data */
postTrans(t);
{
View2D *v2d = &t->ar->v2d;
float cval[2], sval[2];
- char str[200];
/* calculate translation amount from mouse movement - in 'node-grid space' */
UI_view2d_region_to_view(v2d, mval[0], mval[1], &cval[0], &cval[1]);
t->values[0] = cval[0] - sval[0];
t->values[1] = cval[1] - sval[1];
-
+
applyNodeTranslate(t);
recalcData(t);