[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18745] branches/blender2.5/blender/source /blender: Animato:
Joshua Leung
aligorith at gmail.com
Fri Jan 30 09:10:32 CET 2009
Revision: 18745
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18745
Author: aligorith
Date: 2009-01-30 09:10:31 +0100 (Fri, 30 Jan 2009)
Log Message:
-----------
Animato:
* Drivers view in Graph Editor now displays drivers only, instead of displaying normal Animation data.
* 'Materials' channel is now only shown under an Object when there are Materials with animation data...
* Hid more debug prints behind debug flag. These should be removed...
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/blenkernel/intern/constraint.c
branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c
branches/blender2.5/blender/source/blender/blenkernel/intern/key.c
branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
branches/blender2.5/blender/source/blender/editors/animation/anim_ipo_utils.c
branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_draw.c
branches/blender2.5/blender/source/blender/editors/space_ipo/space_ipo.c
branches/blender2.5/blender/source/blender/makesdna/DNA_anim_types.h
Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/constraint.c 2009-01-30 03:35:05 UTC (rev 18744)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/constraint.c 2009-01-30 08:10:31 UTC (rev 18745)
@@ -1886,6 +1886,7 @@
printf("do Action Constraint %s - Ob %s Pchan %s \n", con->name, cob->ob->id.name+2, (cob->pchan)?cob->pchan->name:NULL);
/* Get the appropriate information from the action */
+ // XXX probably we might need some special filtering methods to make this more efficient
if (cob->type == CONSTRAINT_OBTYPE_BONE) {
Object workob;
bPose *pose;
Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c 2009-01-30 03:35:05 UTC (rev 18744)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c 2009-01-30 08:10:31 UTC (rev 18745)
@@ -20,6 +20,7 @@
#include "BKE_fcurve.h"
#include "BKE_curve.h"
+#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_utildefines.h"
@@ -489,6 +490,7 @@
/* error check for missing pointer... */
if (id == NULL) {
printf("Error: driver doesn't have any valid target to use \n");
+ if (G.f & G_DEBUG) printf("\tpath = %s [%d] \n", path, index);
driver->flag |= DRIVER_FLAG_INVALID;
return 0.0f;
}
Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/key.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/key.c 2009-01-30 03:35:05 UTC (rev 18744)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/key.c 2009-01-30 08:10:31 UTC (rev 18745)
@@ -646,7 +646,7 @@
if(key->from==NULL) return;
- printf("do_rel_key() \n");
+ if (G.f & G_DEBUG) printf("do_rel_key() \n");
if( GS(key->from->name)==ID_ME ) {
ofs[0]= sizeof(MVert);
@@ -683,14 +683,14 @@
if(kb!=key->refkey) {
float icuval= kb->curval;
- printf("\tdo rel key %s : %s = %f \n", key->id.name+2, kb->name, icuval);
+ if (G.f & G_DEBUG) printf("\tdo rel key %s : %s = %f \n", key->id.name+2, kb->name, icuval);
/* only with value, and no difference allowed */
if(!(kb->flag & KEYBLOCK_MUTE) && icuval!=0.0f && kb->totelem==tot) {
KeyBlock *refb;
float weight, *weights= kb->weights;
- printf("\t\tnot skipped \n");
+ if (G.f & G_DEBUG) printf("\t\tnot skipped \n");
poin= basispoin;
from= kb->data;
@@ -762,7 +762,7 @@
if(key->from==0) return;
- printf("do_key() \n");
+ if (G.f & G_DEBUG) printf("do_key() \n");
if( GS(key->from->name)==ID_ME ) {
ofs[0]= sizeof(MVert);
@@ -1024,10 +1024,10 @@
/* prevent python from screwing this up? anyhoo, the from pointer could be dropped */
me->key->from= (ID *)me;
- printf("do mesh key ob:%s me:%s ke:%s \n", ob->id.name+2, me->id.name+2, me->key->id.name+2);
+ if (G.f & G_DEBUG) printf("do mesh key ob:%s me:%s ke:%s \n", ob->id.name+2, me->id.name+2, me->key->id.name+2);
if(me->key->slurph && me->key->type!=KEY_RELATIVE ) {
- printf("\tslurph key\n");
+ if (G.f & G_DEBUG) printf("\tslurph key\n");
delta= me->key->slurph;
delta/= me->totvert;
@@ -1071,7 +1071,7 @@
if(me->key->type==KEY_RELATIVE) {
KeyBlock *kb;
- printf("\tdo relative \n");
+ if (G.f & G_DEBUG) printf("\tdo relative \n");
for(kb= me->key->block.first; kb; kb= kb->next)
kb->weights= get_weights_array(ob, kb->vgroup);
@@ -1084,7 +1084,7 @@
}
}
else {
- printf("\tdo absolute \n");
+ if (G.f & G_DEBUG) printf("\tdo absolute \n");
ctime= bsystem_time(scene, ob, (float)scene->r.cfra, 0.0f); // xxx old cruft
Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c 2009-01-30 03:35:05 UTC (rev 18744)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c 2009-01-30 08:10:31 UTC (rev 18745)
@@ -1028,6 +1028,12 @@
act->flag ^= ACT_COLLAPSED;
}
break;
+ case ANIMTYPE_FILLDRIVERS:
+ {
+ AnimData *adt= (AnimData* )ale->data;
+ adt->flag ^= ADT_DRIVERS_COLLAPSED;
+ }
+ break;
case ANIMTYPE_FILLMATD:
{
Object *ob= (Object *)ale->data;
@@ -1126,6 +1132,11 @@
else {
/* select/deselect */
fcu->flag ^= FCURVE_SELECTED;
+
+ if (fcu->flag & FCURVE_SELECTED)
+ fcu->flag |= FCURVE_ACTIVE;
+ else
+ fcu->flag &= ~FCURVE_ACTIVE;
}
}
break;
Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c 2009-01-30 03:35:05 UTC (rev 18744)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c 2009-01-30 08:10:31 UTC (rev 18745)
@@ -221,7 +221,7 @@
sipo->ads->source= (ID *)ac->scene;
sipo->ads->filterflag |= ADS_FILTER_ONLYDRIVERS;
- ac->datatype= ANIMCONT_FCURVES;
+ ac->datatype= ANIMCONT_DRIVERS;
ac->data= sipo->ads;
ac->mode= sipo->mode;
@@ -306,6 +306,9 @@
/* quick macro to test if AnimData is usable */
#define ANIMDATA_HAS_KEYS(id) ((id)->adt && (id)->adt->action)
+/* quick macro to test if AnimData is usable for drivers */
+#define ANIMDATA_HAS_DRIVERS(id) ((id)->adt && (id)->adt->drivers.first)
+
/* ----------- 'Private' Stuff --------------- */
/* this function allocates memory for a new bAnimListElem struct for the
@@ -351,6 +354,17 @@
ale->datatype= ALE_ACT;
}
break;
+ case ANIMTYPE_FILLDRIVERS:
+ {
+ AnimData *adt= (AnimData *)data;
+
+ ale->flag= adt->flag;
+
+ // XXX... drivers don't show summary for now
+ ale->key_data= NULL;
+ ale->datatype= ALE_NONE;
+ }
+ break;
case ANIMTYPE_FILLMATD:
{
Object *ob= (Object *)data;
@@ -694,10 +708,30 @@
static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
{
+ ListBase mats = {NULL, NULL};
+ LinkData *ld;
+
bAnimListElem *ale=NULL;
Object *ob= base->object;
- int items = 0;
+ int items=0, a=0;
+ /* firstly check that we actuallly have some materials, by gathering all materials in a temp list */
+ for (a=0; a < ob->totcol; a++) {
+ Material *ma= give_current_material(ob, a);
+
+ /* for now, if no material returned, skip (this shouldn't confuse the user I hope) */
+ if (ELEM3(NULL, ma, ma->adt, ma->adt->action)) continue;
+
+ /* make a temp list elem for this */
+ ld= MEM_callocN(sizeof(LinkData), "DopeSheet-MaterialCache");
+ ld->data= ma;
+ BLI_addtail(&mats, ld);
+ }
+
+ /* if there were no channels found, no need to carry on */
+ if (mats.first == NULL)
+ return 0;
+
/* include materials-expand widget? */
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
ale= make_new_animlistelem(ob, ANIMTYPE_FILLMATD, base, ANIMTYPE_OBJECT, (ID *)ob);
@@ -709,15 +743,10 @@
/* add materials? */
if (FILTER_MAT_OBJC(ob) || (filter_mode & ANIMFILTER_CURVESONLY)) {
- short a;
-
- /* for each material, either add channels separately, or as ipo-block */
- for (a=0; a<ob->totcol; a++) {
- Material *ma= give_current_material(ob, a);
+ /* for each material in cache, add channels */
+ for (ld= mats.first; ld; ld= ld->next) {
+ Material *ma= (Material *)ld->data;
- /* for now, if no material returned, skip (this shouldn't confuse the user I hope) */
- if (ELEM3(NULL, ma, ma->adt, ma->adt->action)) 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) {
@@ -728,7 +757,7 @@
}
}
- /* add material's ipo-curve channels? */
+ /* add material's F-Curve channels? */
if (FILTER_MAT_OBJD(ma) || (filter_mode & ANIMFILTER_CURVESONLY)) {
//items += animdata_filter_ipocurves(anim_data, ma->ipo, filter_mode, base, ANIMTYPE_OBJECT, (ID *)ma);
// XXX the 'owner' info here is still subject to improvement
@@ -737,6 +766,9 @@
}
}
+ /* free cache */
+ BLI_freelistN(&mats);
+
/* return the number of items added to the list */
return items;
}
@@ -746,6 +778,7 @@
bAnimListElem *ale=NULL;
Object *ob= base->object;
IdAdtTemplate *iat= ob->data;
+ AnimData *adt= iat->adt;
short type=0, expanded=0;
int items= 0;
@@ -777,6 +810,10 @@
break;
}
+ /* special exception for drivers instead of action */
+ if (ads->filterflag & ADS_FILTER_ONLYDRIVERS)
+ expanded= EXPANDED_DRVD(adt);
+
/* include data-expand widget? */
if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {
ale= make_new_animlistelem(iat, type, base, ANIMTYPE_OBJECT, (ID *)iat);
@@ -785,8 +822,15 @@
/* add object-data animation channels? */
if ((expanded) || (filter_mode & ANIMFILTER_CURVESONLY)) {
- // XXX the 'owner' info here is still subject to improvement
- items += animdata_filter_action(anim_data, iat->adt->action, filter_mode, iat, type, (ID *)iat);
+ /* Action or Drivers? */
+ if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS) == 0) {
+ // XXX the 'owner' info here is still subject to improvement
+ items += animdata_filter_action(anim_data, iat->adt->action, filter_mode, iat, type, (ID *)iat);
+ }
+ else {
+ // need to make the ownertype normal object here... (maybe type should be a separate one for clarity?)
+ items += animdata_filter_fcurves(anim_data, adt->drivers.first, NULL, iat, type, filter_mode, (ID *)iat);
+ }
}
/* return the number of items added to the list */
@@ -817,40 +861,88 @@
if ( (EXPANDED_OBJC(ob) == 0) && !(filter_mode & ANIMFILTER_CURVESONLY) )
return items;
- /* Action? */
- if (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/) {
- AnimData *adt= ob->adt;
-
- /* include action-expand widget? */
- if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
- ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLACTD, base, ANIMTYPE_OBJECT, (ID *)ob);
- if (ale) {
- BLI_addtail(anim_data, ale);
- items++;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list