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).
This commit is contained in:
Joshua Leung 2009-10-06 03:05:20 +00:00
parent 04b60b4324
commit 3fe274b072
5 changed files with 195 additions and 49 deletions

@ -199,14 +199,13 @@ class USERPREF_PT_edit(bpy.types.Panel):
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()

@ -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,25 +657,90 @@ void scene_to_keylist(bDopeSheet *ads, Scene *sce, DLRBT_Tree *keys, DLRBT_Tree
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);
}
}
}

@ -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,14 +202,100 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
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;
}

@ -4230,28 +4230,20 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
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))
bt= ui_but_last(block);
else
bt= ui_but_first(block);
if(bt)
ui_handle_button_activate(C, ar, bt, BUTTON_ACTIVATE);

@ -1332,12 +1332,8 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
* - only rotation curves
* - for pchan curves, make sure we're only using the euler curves
*/
if (ELEM(0, fcu->rna_path, strstr(fcu->rna_path, "rotation")))
if (strstr(fcu->rna_path, "rotation_euler") == 0)
continue;
if (strstr(fcu->rna_path, "pose.pose_channels")) {
if (strstr(fcu->rna_path, "rotation_euler") == 0)
continue;
}
/* check if current set of 3-curves is suitable to add this curve to
* - things like whether the current set of curves is 'full' should be checked later only