Animato Bugfixes:
* Fixed bug in with RNA-paths. String identifiers (i.e. some_collection["somekey"]) were not getting handled at all due to wrong indices it seems. I don't know of any other code using this, so hopefully there aren't any unintended bugs caused by this. This means that bone animation now works again. * Added a few more sanity checks to file-reading code, and heaps of extra prints everywhere else for debugging purposes (these will be removed in due course).
This commit is contained in:
@@ -484,29 +484,35 @@ static FCurve *icu_to_fcu (IpoCurve *icu, char *actname, char *constname)
|
||||
* - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet)
|
||||
*/
|
||||
// XXX we need to cope with the nasty old 'bitflag' curves... that will be a task for later
|
||||
// XXX we also need to correct values for object-rotation curves
|
||||
fcu->totvert= icu->totvert;
|
||||
|
||||
if (icu->bezt) {
|
||||
BezTriple *dst, *src;
|
||||
|
||||
/* allocate new array for keyframes/beztriples */
|
||||
fcu->bezt= MEM_callocN(sizeof(BezTriple)*fcu->totvert, "BezTriples");
|
||||
|
||||
/* check if we need to set interpolation settings (thus doing it the 'slow' way) */
|
||||
if (icu->ipo != IPO_MIXED) {
|
||||
BezTriple *dst, *src;
|
||||
/* loop through copying all BezTriples individually, as we need to modify a few things */
|
||||
for (dst=fcu->bezt, src=icu->bezt; i < fcu->totvert; i++, dst++, src++) {
|
||||
/* firstly, copy BezTriple data */
|
||||
*dst= *src;
|
||||
|
||||
/* loop through copying all BezTriples, as we need to set interpolation settings too */
|
||||
for (dst=fcu->bezt, src=icu->bezt; i < fcu->totvert; i++, dst++, src++) {
|
||||
/* firstly, copy BezTriple data */
|
||||
*dst= *src;
|
||||
|
||||
/* now copy interpolation from curve */
|
||||
/* now copy interpolation from curve (if not already set) */
|
||||
if (icu->ipo != IPO_MIXED)
|
||||
dst->ipo= icu->ipo;
|
||||
|
||||
/* correct values for object rotation curves - they were degrees/10 */
|
||||
// XXX for now, just make them into degrees
|
||||
if ((icu->blocktype == ID_OB) && ELEM3(icu->adrcode, OB_ROT_X, OB_ROT_Y, OB_ROT_Z)) {
|
||||
dst->vec[0][0] *= 10.0f;
|
||||
dst->vec[1][0] *= 10.0f;
|
||||
dst->vec[2][0] *= 10.0f;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* interpolation already set (from AnimSys2 branch) */
|
||||
memcpy(fcu->bezt, icu->bezt, sizeof(BezTriple)*fcu->totvert);
|
||||
}
|
||||
|
||||
/* free this data now */
|
||||
MEM_freeN(icu->bezt);
|
||||
}
|
||||
else if (icu->bp) {
|
||||
/* TODO: need to convert from BPoint type to the more compact FPoint type... but not priority, since no data used this */
|
||||
@@ -568,7 +574,6 @@ static FCurve *icu_to_fcu (IpoCurve *icu, char *actname, char *constname)
|
||||
static void ipo_to_animdata (ID *id, Ipo *ipo, char *actname, char *constname)
|
||||
{
|
||||
AnimData *adt= BKE_animdata_from_id(id);
|
||||
bAction *act= adt->action;
|
||||
//bActionGroup *grp;
|
||||
IpoCurve *icu, *icn;
|
||||
FCurve *fcu;
|
||||
@@ -576,6 +581,10 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char *actname, char *constname)
|
||||
/* sanity check */
|
||||
if ELEM(NULL, id, ipo)
|
||||
return;
|
||||
if (adt == NULL) {
|
||||
printf("ERROR ipo_to_animdata(): adt invalid \n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s curves:%d \n",
|
||||
id->name+2, ipo->id.name+2, (actname)?actname:"<None>", (constname)?constname:"<None>",
|
||||
@@ -609,11 +618,13 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char *actname, char *constname)
|
||||
/* conversion path depends on whether it's a driver or not */
|
||||
if (fcu->driver == NULL) {
|
||||
/* try to get action */
|
||||
if (adt->action == NULL)
|
||||
act= adt->action= add_empty_action("ConvertedAction"); // XXX we need a better name for this...
|
||||
if (adt->action == NULL) {
|
||||
adt->action= add_empty_action("ConvertedAction"); // XXX we need a better name for this...
|
||||
printf("added new action \n");
|
||||
}
|
||||
|
||||
/* add F-Curve to action */
|
||||
BLI_addtail(&act->curves, fcu);
|
||||
BLI_addtail(&adt->action->curves, fcu);
|
||||
}
|
||||
else {
|
||||
/* add F-Curve to AnimData's drivers */
|
||||
@@ -646,6 +657,7 @@ static void action_to_animdata (ID *id, bAction *act)
|
||||
/* check if we need to set this Action as the AnimData's action */
|
||||
if (adt->action == NULL) {
|
||||
/* set this Action as AnimData's Action */
|
||||
printf("act_to_adt - set adt action to act \n");
|
||||
adt->action= act;
|
||||
}
|
||||
|
||||
|
||||
@@ -289,16 +289,10 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
|
||||
|
||||
ale->data= data;
|
||||
ale->type= datatype;
|
||||
// XXX what is the point of the owner data?
|
||||
ale->owner= owner;
|
||||
ale->ownertype= ownertype;
|
||||
|
||||
if ((owner) && (ownertype == ANIMTYPE_FCURVE)) {
|
||||
FCurve *ofcu= (FCurve *)owner;
|
||||
ale->grp= ofcu->grp;
|
||||
}
|
||||
else
|
||||
ale->grp= NULL;
|
||||
|
||||
/* do specifics */
|
||||
switch (datatype) {
|
||||
case ANIMTYPE_OBJECT:
|
||||
@@ -664,7 +658,7 @@ static int animdata_filter_gpencil (ListBase *anim_data, bScreen *sc, int filter
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 // XXX old anim sys
|
||||
|
||||
static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
|
||||
{
|
||||
bAnimListElem *ale=NULL;
|
||||
@@ -672,7 +666,7 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads,
|
||||
int items = 0;
|
||||
|
||||
/* include materials-expand widget? */
|
||||
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & (ANIMFILTER_IPOKEYS|ANIMFILTER_ONLYFCU))) {
|
||||
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
|
||||
ale= make_new_animlistelem(ob, ANIMTYPE_FILLMATD, base, ANIMTYPE_OBJECT);
|
||||
if (ale) {
|
||||
BLI_addtail(anim_data, ale);
|
||||
@@ -681,7 +675,7 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads,
|
||||
}
|
||||
|
||||
/* add materials? */
|
||||
if (FILTER_MAT_OBJC(ob) || (filter_mode & ANIMFILTER_IPOKEYS) || (filter_mode & ANIMFILTER_ONLYFCU)) {
|
||||
if (FILTER_MAT_OBJC(ob) || (filter_mode & ANIMFILTER_CURVESONLY)) {
|
||||
short a;
|
||||
|
||||
/* for each material, either add channels separately, or as ipo-block */
|
||||
@@ -689,11 +683,11 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads,
|
||||
Material *ma= give_current_material(ob, a);
|
||||
|
||||
/* for now, if no material returned, skip (this shouldn't confuse the user I hope) */
|
||||
if (ELEM(NULL, ma, ma->ipo)) continue;
|
||||
if (ELEM(NULL, ma, ma->adt)) continue;
|
||||
|
||||
/* include material-expand widget? */
|
||||
// hmm... do we need to store the index of this material in the array anywhere?
|
||||
if (filter_mode & (ANIMFILTER_CHANNELS|ANIMFILTER_IPOKEYS)) {
|
||||
if (filter_mode & ANIMFILTER_CHANNELS) {
|
||||
ale= make_new_animlistelem(ma, ANIMTYPE_DSMAT, base, ANIMTYPE_OBJECT);
|
||||
if (ale) {
|
||||
BLI_addtail(anim_data, ale);
|
||||
@@ -702,10 +696,8 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads,
|
||||
}
|
||||
|
||||
/* add material's ipo-curve channels? */
|
||||
if ( (FILTER_MAT_OBJD(ma) || (filter_mode & ANIMFILTER_ONLYFCU)) &&
|
||||
!(filter_mode & ANIMFILTER_IPOKEYS) )
|
||||
{
|
||||
items += animdata_filter_ipocurves(anim_data, ma->ipo, filter_mode, base, ANIMTYPE_OBJECT, (ID *)ma);
|
||||
if (FILTER_MAT_OBJD(ma) || (filter_mode & ANIMFILTER_CURVESONLY)) {
|
||||
//items += animdata_filter_ipocurves(anim_data, ma->ipo, filter_mode, base, ANIMTYPE_OBJECT, (ID *)ma);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,6 +707,8 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads,
|
||||
return items;
|
||||
}
|
||||
|
||||
#if 0 // XXX old anim sys
|
||||
|
||||
static int animdata_filter_dopesheet_cam (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
|
||||
{
|
||||
bAnimListElem *ale=NULL;
|
||||
@@ -826,7 +820,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
|
||||
AnimData *adt= ob->adt;
|
||||
|
||||
/* include action-expand widget? */
|
||||
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & (ANIMFILTER_CURVESONLY))) {
|
||||
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
|
||||
ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLACTD, base, ANIMTYPE_OBJECT);
|
||||
if (ale) {
|
||||
ale->id= (ID *)ob; // err.... is this a good idea?
|
||||
@@ -846,7 +840,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
|
||||
/* ShapeKeys? */
|
||||
if ((key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)) {
|
||||
/* include shapekey-expand widget? */
|
||||
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & (ANIMFILTER_IPOKEYS|ANIMFILTER_ONLYFCU))) {
|
||||
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
|
||||
ale= make_new_animlistelem(key, ANIMTYPE_DSSKEY, base, ANIMTYPE_OBJECT);
|
||||
if (ale) {
|
||||
BLI_addtail(anim_data, ale);
|
||||
@@ -855,15 +849,18 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
|
||||
}
|
||||
|
||||
/* add channels */
|
||||
if (FILTER_SKE_OBJD(key) || (filter_mode & ANIMFILTER_IPOKEYS) || (filter_mode & ANIMFILTER_ONLYFCU)) {
|
||||
if (FILTER_SKE_OBJD(key) || (filter_mode & ANIMFILTER_CURVESONLY)) {
|
||||
items += animdata_filter_shapekey(anim_data, key, filter_mode, ob, ANIMTYPE_OBJECT);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Materials? */
|
||||
if ((ob->totcol) && !(ads->filterflag & ADS_FILTER_NOMAT))
|
||||
items += animdata_filter_dopesheet_mats(anim_data, ads, base, filter_mode);
|
||||
|
||||
#if 0
|
||||
/* Object Data */
|
||||
switch (ob->type) {
|
||||
case OB_CAMERA: /* ------- Camera ------------ */
|
||||
@@ -888,7 +885,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif // XXX fixme...
|
||||
#endif
|
||||
|
||||
/* return the number of items added to the list */
|
||||
return items;
|
||||
@@ -936,6 +933,7 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
|
||||
/* only selected should be shown */
|
||||
continue;
|
||||
}
|
||||
#if 0
|
||||
if ((ads->filterflag & ADS_FILTER_NOARM) && (ob->type == OB_ARMATURE)) {
|
||||
/* not showing armatures */
|
||||
continue;
|
||||
@@ -944,6 +942,7 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
|
||||
/* not showing objects that aren't armatures */
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* check filters for datatypes */
|
||||
actOk= (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/);
|
||||
|
||||
@@ -93,10 +93,9 @@ typedef struct bAnimListElem {
|
||||
void *key_data; /* motion data - ipo or ipo-curve */
|
||||
short datatype; /* type of motion data to expect */
|
||||
|
||||
struct ID *id; /* ID block (ID_SC, ID_SCE, or ID_OB) that owns the channel */
|
||||
struct bActionGroup *grp; /* action group that owns the channel (only for Action/Dopesheet) */
|
||||
struct ID *id; /* ID block that channel is attached to (may be used */
|
||||
|
||||
void *owner; /* will either be an action channel or fake ipo-channel (for keys) */
|
||||
void *owner; /* group or channel which acts as this channel's owner */
|
||||
short ownertype; /* type of owner */
|
||||
} bAnimListElem;
|
||||
|
||||
|
||||
@@ -617,11 +617,11 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
|
||||
{
|
||||
FCurve *fcu = (FCurve *)ale->data;
|
||||
|
||||
indent = 2;
|
||||
indent = 0;
|
||||
protect = -1; // for now, until this can be supported by others
|
||||
|
||||
group= (ale->grp) ? 1 : 0;
|
||||
grp= ale->grp;
|
||||
//group= (ale->grp) ? 1 : 0;
|
||||
//grp= ale->grp;
|
||||
|
||||
if (ale->id) {
|
||||
if (GS(ale->id->name) == ID_MA)
|
||||
|
||||
@@ -1469,14 +1469,17 @@ int RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prope
|
||||
return 0;
|
||||
|
||||
len= strlen(token);
|
||||
printf("RNA path identifier strlen = %d \n", len);
|
||||
|
||||
/* check for "" to see if it is a string */
|
||||
if(len >= 2 && *token == '"' && token[len-2] == '"') {
|
||||
if(len >= 2 && token[0] == '"' && token[len-1] == '"') {
|
||||
/* strip away "" */
|
||||
token[len-2]= 0;
|
||||
token[len-1]= 0;
|
||||
printf("RNA path identifier - string %s \n", token+1);
|
||||
RNA_property_collection_lookup_string(&curptr, prop, token+1, &nextptr);
|
||||
}
|
||||
else {
|
||||
printf("RNA path identifier - int %s \n", token);
|
||||
/* otherwise do int lookup */
|
||||
intkey= atoi(token);
|
||||
RNA_property_collection_lookup_int(&curptr, prop, intkey, &nextptr);
|
||||
|
||||
Reference in New Issue
Block a user