diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-08-17 11:35:38 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-08-17 11:35:38 +0400 |
commit | 61b2ac04e37b59dc6feae941e43fc8256b2864ca (patch) | |
tree | 0c1578e3f7b2931b6187af46e315aee5dcefe708 /source | |
parent | 97db057a4cb872b5fecc027d1fcfface00d84ce3 (diff) |
2.5 - Keying Sets Fixes
* Properly wrapped Keying Sets in RNA. Now the timeline header shows a popup for choosing KeyingSets instead of the nasty index button.
* Fixed bugs in Outliner code for adding/removing array elements to Keying Sets. This makes it possible to add only the x and z location settings for an object for example.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 53 |
2 files changed, 50 insertions, 7 deletions
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index ac47c518c46..0a48bfec47b 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -3926,7 +3926,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa short groupmode= KSP_GROUP_KSNAME; /* check if RNA-property described by this selected element is an animateable prop */ - if ((tselem->type == TSE_RNA_PROPERTY) && RNA_property_animateable(&te->rnaptr, te->directdata)) { + if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM) && RNA_property_animateable(&te->rnaptr, te->directdata)) { /* get id + path + index info from the selected element */ tree_element_to_path(soops, te, tselem, &id, &path, &array_index, &flag, &groupmode); @@ -3963,8 +3963,6 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa /* free path, since it had to be generated */ MEM_freeN(path); } - - } /* go over sub-tree */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 2a6d0961464..f5b4a508894 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -53,6 +53,7 @@ EnumPropertyItem prop_mode_items[] ={ #ifdef RNA_RUNTIME +#include "DNA_anim_types.h" #include "DNA_node_types.h" #include "BKE_context.h" @@ -175,6 +176,41 @@ static void rna_Scene_frame_update(bContext *C, PointerRNA *ptr) //ED_update_for_newframe(C); } +static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr) +{ + Scene *scene= (Scene *)ptr->data; + return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, BLI_findlink(&scene->keyingsets, scene->active_keyingset-1)); +} + +static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value) +{ + Scene *scene= (Scene *)ptr->data; + KeyingSet *ks= (KeyingSet*)value.data; + scene->active_keyingset= BLI_findindex(&scene->keyingsets, ks) + 1; +} + +static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr) +{ + Scene *scene= (Scene *)ptr->data; + return MAX2(scene->active_keyingset-1, 0); +} + +static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value) +{ + Scene *scene= (Scene *)ptr->data; + scene->active_keyingset= value+1; +} + +static void rna_Scene_active_keying_set_index_range(PointerRNA *ptr, int *min, int *max) +{ + Scene *scene= (Scene *)ptr->data; + + *min= 0; + *max= BLI_countlist(&scene->keyingsets)-1; + *max= MAX2(0, *max); +} + + static char *rna_SceneRenderData_path(PointerRNA *ptr) { return BLI_sprintfN("render_data"); @@ -1793,15 +1829,24 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sequence Editor", ""); /* Keying Sets */ - // TODO: hide the fact that active keyingset is an int? - prop= RNA_def_property(srna, "keyingsets", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "keying_sets", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "keyingsets", NULL); RNA_def_property_struct_type(prop, "KeyingSet"); RNA_def_property_ui_text(prop, "Keying Sets", "Keying Sets for this Scene."); + RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); - prop= RNA_def_property(srna, "active_keyingset", PROP_INT, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop= RNA_def_property(srna, "active_keying_set", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "KeyingSet"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL); + RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes."); + RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); + + prop= RNA_def_property(srna, "active_keying_set_index", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "active_keyingset"); + RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", "rna_Scene_active_keying_set_index_range"); RNA_def_property_ui_text(prop, "Active Keying Set", "Current Keying Set index."); + RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); /* Tool Settings */ prop= RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NEVER_NULL); |