Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-10-06 07:05:20 +0400
committerJoshua Leung <aligorith@gmail.com>2009-10-06 07:05:20 +0400
commit3fe274b072df205614da150df9c3743f2b1b422a (patch)
tree7167f16e52784fd9e46c2f55aca9c68c8268e796
parent04b60b43241614a7bea6ac862a0281adca98820a (diff)
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).
-rw-r--r--release/scripts/ui/space_userpref.py11
-rw-r--r--source/blender/editors/animation/keyframes_draw.c100
-rw-r--r--source/blender/editors/animation/keyframes_edit.c103
-rw-r--r--source/blender/editors/interface/interface_handlers.c24
-rw-r--r--source/blender/editors/space_graph/graph_edit.c6
5 files changed, 195 insertions, 49 deletions
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index a9126d2c7f1..15e6c7ee4be 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -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()
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index e8b25f70b06..d0b5e12c9df 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -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;
-
- /* get filterflag */
- if (ads)
- filterflag= ads->filterflag;
- else
- filterflag= 0;
+ int filterflag= (ads)? ads->filterflag : 0;
+
+ /* sanity check */
+ if (ob == NULL)
+ return;
- /* Add action keyframes */
- if (ob->adt && ob->adt->action)
- action_to_keylist(ob->adt, ob->adt->action, keys, blocks);
+ /* 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 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);
+
+ /* 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;
- // TODO: restore materials, and object data, etc.
+ 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);
+ }
}
}
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 65f7d845b29..7f0d3b4503d 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -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;
+ }
+
+ /* Add material keyframes */
+ if ((ob->totcol) && !(filterflag & ADS_FILTER_NOMAT)) {
+ int a;
- // FIXME: add materials, etc. (but drawing code doesn't do it yet too! :)
+ 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;
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index c60c94a9c4d..bbf8df00b88 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -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);
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 3e0f9760773..22272479e4a 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -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