diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-04-01 02:36:13 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-04-01 02:36:13 +0400 |
commit | 3a28a7450596f46281431bd163b9a237eb481055 (patch) | |
tree | 54268464f1adc33111b7bb3afde1ce1c64bf5897 /source/blender/blenkernel | |
parent | 4861ddf350e776c09f319d6db7fb96634d952da6 (diff) |
Animato - Support for 'BuiltIn' and 'Relative' Keying Sets
When inserting keyframes in the 3D-View (support will be extended to other editors in due course) using the IKEY hotkey, the menu which appears will now consist of 3 parts:
* 'Active Keying Set' - this option allows you to use the user-defined KeyingSet which is active for the current scene (i.e. the one seen in the TimeLine/Outliner headers)
* User defined Keying Sets - a list of all such available KeyingSets is included, and entries can be chosen from there
* Built-In Keying Sets - see later...
To achieve this, several changes needed to be made first:
* Added support for 'relative' in addition to 'absolute' Keying Sets. Relative Keying Sets are Keying Sets which operate on data from the current context (i.e. a 'location' KeyingSet will add location keyframes for selected objects/bones/nodes as opposed to location keyframes for some particular object). The is a tentative 'templates' requirement system here, which still needs to be fully fleshed out.
* Added support for builtin Keying Sets (i.e. 'Location', 'Rotation', 'Scaling', and 'LocRot' as a few initial demonstrations), which replaces the temporary Insert Keyframe operator for the 3D-View (IKEY). These are effectively relative Keying Set definitions which are included in Blender by default and stored in a list separate from user-defined ones. Volunteer help in defining a few more of these for other editors will be welcome soon.
* Removed/replaced much of the crappy temporary Keyframing operator code, though a few tweaks could still be done.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_constraint.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 24 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 11 |
4 files changed, 33 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index 0d8c81a5a75..6e69906b71d 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -110,11 +110,13 @@ bConstraintTypeInfo *get_constraint_typeinfo(int type); /* Constraint function prototypes */ void unique_constraint_name(struct bConstraint *con, struct ListBase *list); -void free_constraints(struct ListBase *conlist); +void free_constraints(struct ListBase *list); void copy_constraints(struct ListBase *dst, struct ListBase *src); void relink_constraints(struct ListBase *list); void free_constraint_data(struct bConstraint *con); +struct bConstraint *constraints_get_active(struct ListBase *list); + /* Constraints + Proxies function prototypes */ void extract_proxylocal_constraints(struct ListBase *dst, struct ListBase *src); short proxylocked_constraints_owner(struct Object *ob, struct bPoseChannel *pchan); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 0097b30b685..ee72c374b5a 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -4,6 +4,7 @@ #include <stdio.h> #include <string.h> +#include <stddef.h> #include "MEM_guardedalloc.h" @@ -238,6 +239,9 @@ KeyingSet *BKE_keyingset_add (ListBase *list, const char name[], short flag, sho /* add KeyingSet to list */ BLI_addtail(list, ks); + /* make sure KeyingSet has a unique name (this helps with identification) */ + BLI_uniquename(list, ks, "Keying Set", offsetof(KeyingSet, name), 64); + /* return new KeyingSet for further editing */ return ks; } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index b238116f0a1..ed8562847a9 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3203,17 +3203,16 @@ void free_constraint_data (bConstraint *con) } /* Free all constraints from a constraint-stack */ -void free_constraints (ListBase *conlist) +void free_constraints (ListBase *list) { bConstraint *con; /* Free constraint data and also any extra data */ - for (con= conlist->first; con; con= con->next) { + for (con= list->first; con; con= con->next) free_constraint_data(con); - } /* Free the whole list */ - BLI_freelistN(conlist); + BLI_freelistN(list); } /* Reassign links that constraints have to other data (called during file loading?) */ @@ -3266,6 +3265,23 @@ void copy_constraints (ListBase *dst, ListBase *src) } } +/* finds the 'active' constraint in a constraint stack */ +bConstraint *constraints_get_active (ListBase *list) +{ + bConstraint *con; + + /* search for the first constraint with the 'active' flag set */ + if (list) { + for (con= list->first; con; con= con->next) { + if (con->flag & CONSTRAINT_ACTIVE) + return con; + } + } + + /* no active constraint found */ + return NULL; +} + /* -------- Constraints and Proxies ------- */ /* Rescue all constraints tagged as being CONSTRAINT_PROXY_LOCAL (i.e. added to bone that's proxy-synced in this file) */ diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 2dfa1db171f..3fa9457d86e 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -177,7 +177,7 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo float xminv=999999999.0f, xmaxv=-999999999.0f; float yminv=999999999.0f, ymaxv=-999999999.0f; short foundvert=0; - int i; + unsigned int i; if (fcu->totvert) { if (fcu->bezt) { @@ -418,7 +418,7 @@ void calchandles_fcurve (FCurve *fcu) void testhandles_fcurve (FCurve *fcu) { BezTriple *bezt; - int a; + unsigned int a; /* only beztriples have handles (bpoints don't though) */ if ELEM(NULL, fcu, fcu->bezt) @@ -475,7 +475,7 @@ void sort_time_fcurve (FCurve *fcu) /* currently, will only be needed when there are beztriples */ if (fcu->bezt) { BezTriple *bezt; - int a; + unsigned int a; /* loop over ALL points to adjust position in array and recalculate handles */ for (a=0, bezt=fcu->bezt; a < fcu->totvert; a++, bezt++) { @@ -509,7 +509,7 @@ void sort_time_fcurve (FCurve *fcu) /* This function tests if any BezTriples are out of order, thus requiring a sort */ short test_time_fcurve (FCurve *fcu) { - int a; + unsigned int a; /* sanity checks */ if (fcu == NULL) @@ -895,7 +895,8 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim { BezTriple *bezt, *prevbezt, *lastbezt; float v1[2], v2[2], v3[2], v4[2], opl[32], dx, fac; - int a, b; + unsigned int a; + int b; float cvalue = 0.0f; /* get pointers */ |