Revision: 23650 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23650 Author: aligorith Date: 2009-10-06 05:05:20 +0200 (Tue, 06 Oct 2009)
Log Message: ----------- Several fixes: * Code for generating 'Object' summary of Keyframes for DopeSheet (which is also used by the TimeLine for getting keyframes to draw) now considers materials, object data, and particles too. * Rearranged the way that keyframing-related settings were presented in the User Preferences. The way the settings were grouped was plain confusing, and based on biased views from the old system. For the record, 'needed'+'visual' are always considered when inserting keyframes, 'always' is for autokeyframing, and default interpolation is only used for newly created F-Curves. * Fixed bug #19472 - Scroll wheel scrolls in the wrong direction for enum-menus that were flipped (i.e. window type menu and 3d-view mode selector). Modified Paths: -------------- trunk/blender/release/scripts/ui/space_userpref.py trunk/blender/source/blender/editors/animation/keyframes_draw.c trunk/blender/source/blender/editors/animation/keyframes_edit.c trunk/blender/source/blender/editors/interface/interface_handlers.c trunk/blender/source/blender/editors/space_graph/graph_edit.c Modified: trunk/blender/release/scripts/ui/space_userpref.py =================================================================== --- trunk/blender/release/scripts/ui/space_userpref.py 2009-10-06 02:56:11 UTC (rev 23649) +++ trunk/blender/release/scripts/ui/space_userpref.py 2009-10-06 03:05:20 UTC (rev 23650) @@ -199,14 +199,13 @@ sub1 = sub.column() sub1.itemL(text="Keyframing:") sub1.itemR(edit, "use_visual_keying") - sub1.itemR(edit, "new_interpolation_type", text="New F-Curves") + sub1.itemR(edit, "auto_keyframe_insert_available", text="Only Insert Available") + sub1.itemR(edit, "auto_keyframe_insert_needed", text="Only Insert Needed") sub1.itemS() + sub1.itemL(text="New F-Curve Defaults:") + sub1.itemR(edit, "new_interpolation_type", text="Interpolation") + sub1.itemS() sub1.itemR(edit, "auto_keying_enable", text="Auto Keyframing") - sub2 = sub1.column() - sub2.enabled = edit.auto_keying_enable - sub2.row().itemR(edit, "auto_keying_mode", expand=True) - sub2.itemR(edit, "auto_keyframe_insert_available", text="Only Insert Available") - sub2.itemR(edit, "auto_keyframe_insert_needed", text="Only Insert Needed") sub1.itemS() sub1.itemS() Modified: trunk/blender/source/blender/editors/animation/keyframes_draw.c =================================================================== --- trunk/blender/source/blender/editors/animation/keyframes_draw.c 2009-10-06 02:56:11 UTC (rev 23649) +++ trunk/blender/source/blender/editors/animation/keyframes_draw.c 2009-10-06 03:05:20 UTC (rev 23650) @@ -54,10 +54,11 @@ #include "DNA_screen_types.h" #include "DNA_scene_types.h" #include "DNA_space_types.h" -#include "DNA_constraint_types.h" #include "DNA_key_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" +#include "DNA_meta_types.h" +#include "DNA_particle_types.h" #include "DNA_userdef_types.h" #include "DNA_gpencil_types.h" #include "DNA_windowmanager_types.h" @@ -656,26 +657,91 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *blocks) { Key *key= ob_get_key(ob); - - if (ob) { - int filterflag; + int filterflag= (ads)? ads->filterflag : 0; + + /* sanity check */ + if (ob == NULL) + return; - /* get filterflag */ - if (ads) - filterflag= ads->filterflag; - else - filterflag= 0; + /* Add action keyframes */ + if (ob->adt && ob->adt->action) + action_to_keylist(ob->adt, ob->adt->action, keys, blocks); + + /* Add shapekey keyframes (only if dopesheet allows, if it is available) */ + if ((key && key->adt && key->adt->action) && !(filterflag & ADS_FILTER_NOSHAPEKEYS)) + action_to_keylist(key->adt, key->adt->action, keys, blocks); + + /* Add material keyframes */ + if ((ob->totcol) && !(filterflag & ADS_FILTER_NOMAT)) { + int a; - /* Add action keyframes */ - if (ob->adt && ob->adt->action) - action_to_keylist(ob->adt, ob->adt->action, keys, blocks); - - /* Add shapekey keyframes (only if dopesheet allows, if it is available) */ - if ((key && key->adt && key->adt->action) && !(filterflag & ADS_FILTER_NOSHAPEKEYS)) - action_to_keylist(key->adt, key->adt->action, keys, blocks); + for (a=0; a < ob->totcol; a++) { + Material *ma= give_current_material(ob, a); - // TODO: restore materials, and object data, etc. + /* there might not be a material */ + if (ELEM(NULL, ma, ma->adt)) + continue; + + /* add material's data */ + action_to_keylist(ma->adt, ma->adt->action, keys, blocks); + } } + + /* Add object data keyframes */ + switch (ob->type) { + case OB_CAMERA: /* ------- Camera ------------ */ + { + Camera *ca= (Camera *)ob->data; + + if ((ca->adt) && !(filterflag & ADS_FILTER_NOCAM)) + action_to_keylist(ca->adt, ca->adt->action, keys, blocks); + } + break; + case OB_LAMP: /* ---------- Lamp ----------- */ + { + Lamp *la= (Lamp *)ob->data; + + if ((la->adt) && !(filterflag & ADS_FILTER_NOLAM)) + action_to_keylist(la->adt, la->adt->action, keys, blocks); + } + break; + case OB_CURVE: /* ------- Curve ---------- */ + { + Curve *cu= (Curve *)ob->data; + + if ((cu->adt) && !(filterflag & ADS_FILTER_NOCUR)) + action_to_keylist(cu->adt, cu->adt->action, keys, blocks); + } + break; + case OB_MBALL: /* ------- MetaBall ---------- */ + { + MetaBall *mb= (MetaBall *)ob->data; + + if ((mb->adt) && !(filterflag & ADS_FILTER_NOMBA)) + action_to_keylist(mb->adt, mb->adt->action, keys, blocks); + } + break; + case OB_ARMATURE: /* ------- Armature ---------- */ + { + bArmature *arm= (bArmature *)ob->data; + + if ((arm->adt) && !(filterflag & ADS_FILTER_NOARM)) + action_to_keylist(arm->adt, arm->adt->action, keys, blocks); + } + break; + } + + /* Add Particle System Keyframes */ + if ((ob->particlesystem.first) && !(filterflag & ADS_FILTER_NOPART)) { + ParticleSystem *psys = ob->particlesystem.first; + + for(; psys; psys=psys->next) { + if (ELEM(NULL, psys->part, psys->part->adt)) + continue; + else + action_to_keylist(psys->part->adt, psys->part->adt->action, keys, blocks); + } + } } void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree *blocks) Modified: trunk/blender/source/blender/editors/animation/keyframes_edit.c =================================================================== --- trunk/blender/source/blender/editors/animation/keyframes_edit.c 2009-10-06 02:56:11 UTC (rev 23649) +++ trunk/blender/source/blender/editors/animation/keyframes_edit.c 2009-10-06 03:05:20 UTC (rev 23650) @@ -36,9 +36,15 @@ #include "DNA_anim_types.h" #include "DNA_action_types.h" +#include "DNA_armature_types.h" +#include "DNA_camera_types.h" #include "DNA_curve_types.h" #include "DNA_key_types.h" +#include "DNA_lamp_types.h" +#include "DNA_material_types.h" #include "DNA_object_types.h" +#include "DNA_meta_types.h" +#include "DNA_particle_types.h" #include "DNA_space_types.h" #include "DNA_scene_types.h" #include "DNA_world_types.h" @@ -46,6 +52,7 @@ #include "BKE_action.h" #include "BKE_fcurve.h" #include "BKE_key.h" +#include "BKE_material.h" #include "BKE_utildefines.h" #include "ED_anim_api.h" @@ -195,15 +202,101 @@ return 0; /* firstly, Object's own AnimData */ - if (ob->adt) - adt_keys_bezier_loop(bed, ob->adt, bezt_ok, bezt_cb, fcu_cb, filterflag); + if (ob->adt) { + if (adt_keys_bezier_loop(bed, ob->adt, bezt_ok, bezt_cb, fcu_cb, filterflag)) + return 1; + } /* shapekeys */ - if ((key && key->adt) && !(filterflag & ADS_FILTER_NOSHAPEKEYS)) - adt_keys_bezier_loop(bed, key->adt, bezt_ok, bezt_cb, fcu_cb, filterflag); + if ((key && key->adt) && !(filterflag & ADS_FILTER_NOSHAPEKEYS)) { + if (adt_keys_bezier_loop(bed, key->adt, bezt_ok, bezt_cb, fcu_cb, filterflag)) + return 1; + } - // FIXME: add materials, etc. (but drawing code doesn't do it yet too! :) + /* Add material keyframes */ + if ((ob->totcol) && !(filterflag & ADS_FILTER_NOMAT)) { + int a; + + for (a=0; a < ob->totcol; a++) { + Material *ma= give_current_material(ob, a); + + /* there might not be a material */ + if (ELEM(NULL, ma, ma->adt)) + continue; + + /* add material's data */ + if (adt_keys_bezier_loop(bed, ma->adt, bezt_ok, bezt_cb, fcu_cb, filterflag)) + return 1; + } + } + /* Add object data keyframes */ + switch (ob->type) { + case OB_CAMERA: /* ------- Camera ------------ */ + { + Camera *ca= (Camera *)ob->data; + + if ((ca->adt) && !(filterflag & ADS_FILTER_NOCAM)) { + if (adt_keys_bezier_loop(bed, ca->adt, bezt_ok, bezt_cb, fcu_cb, filterflag)) + return 1; + } + } + break; + case OB_LAMP: /* ---------- Lamp ----------- */ + { + Lamp *la= (Lamp *)ob->data; + + if ((la->adt) && !(filterflag & ADS_FILTER_NOLAM)) { + if (adt_keys_bezier_loop(bed, la->adt, bezt_ok, bezt_cb, fcu_cb, filterflag)) + return 1; + } + } + break; + case OB_CURVE: /* ------- Curve ---------- */ + { + Curve *cu= (Curve *)ob->data; + + if ((cu->adt) && !(filterflag & ADS_FILTER_NOCUR)) { + if (adt_keys_bezier_loop(bed, cu->adt, bezt_ok, bezt_cb, fcu_cb, filterflag)) + return 1; + } + } + break; + case OB_MBALL: /* ------- MetaBall ---------- */ + { + MetaBall *mb= (MetaBall *)ob->data; + + if ((mb->adt) && !(filterflag & ADS_FILTER_NOMBA)) { + if (adt_keys_bezier_loop(bed, mb->adt, bezt_ok, bezt_cb, fcu_cb, filterflag)) + return 1; + } + } + break; + case OB_ARMATURE: /* ------- Armature ---------- */ + { + bArmature *arm= (bArmature *)ob->data; + + if ((arm->adt) && !(filterflag & ADS_FILTER_NOARM)) { + if (adt_keys_bezier_loop(bed, arm->adt, bezt_ok, bezt_cb, fcu_cb, filterflag)) + return 1; + } + } + break; + } + + /* Add Particle System Keyframes */ + if ((ob->particlesystem.first) && !(filterflag & ADS_FILTER_NOPART)) { + ParticleSystem *psys = ob->particlesystem.first; + + for(; psys; psys=psys->next) { + if (ELEM(NULL, psys->part, psys->part->adt)) + continue; + + if (adt_keys_bezier_loop(bed, psys->part->adt, bezt_ok, bezt_cb, fcu_cb, filterflag)) + return 1; + } + } + return 0; } Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c =================================================================== --- trunk/blender/source/blender/editors/interface/interface_handlers.c 2009-10-06 02:56:11 UTC (rev 23649) +++ trunk/blender/source/blender/editors/interface/interface_handlers.c 2009-10-06 03:05:20 UTC (rev 23650) @@ -4230,28 +4230,20 @@ if(event->val==KM_PRESS) { but= ui_but_find_activated(ar); if(but) { - if(ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) { - if(block->direction & UI_TOP) but= ui_but_prev(but); - else but= ui_but_next(but); - } - else { - if(block->direction & UI_TOP) but= ui_but_next(but); - else but= ui_but_prev(but); - } + if(ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) + but= ui_but_next(but); + else + but= ui_but_prev(but); if(but) ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE); } if(!but) { - if(ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) { - if(block->direction & UI_TOP) bt= ui_but_first(block); - else bt= ui_but_last(block); - } - else { - if(block->direction & UI_TOP) bt= ui_but_last(block); - else bt= ui_but_first(block); - } + if(ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs