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.
This commit is contained in:
Joshua Leung 2009-08-17 07:35:38 +00:00
parent 97db057a4c
commit 61b2ac04e3
3 changed files with 53 additions and 10 deletions

@ -39,7 +39,7 @@ class TIME_HT_header(bpy.types.Header):
layout.itemS()
row = layout.row(align=True)
row.itemO("screen.frame_jump", text="", icon='ICON_REW')
row.item_booleanO("screen.frame_jump", "end", False, text="", icon='ICON_REW')
row.item_booleanO("screen.keyframe_jump", "next", False, text="", icon='ICON_PREV_KEYFRAME')
if not screen.animation_playing:
row.item_booleanO("screen.animation_play", "reverse", True, text="", icon='ICON_PLAY_REVERSE')
@ -67,9 +67,9 @@ class TIME_HT_header(bpy.types.Header):
subsub.itemR(tools, "record_with_nla", toggle=True)
layout.itemS()
row = layout.row(align=True)
row.itemR(scene, "active_keyingset")
row.itemR(scene, "active_keying_set", text="")
row.itemO("anim.insert_keyframe", text="", icon="ICON_KEY_HLT")
row.itemO("anim.delete_keyframe", text="", icon="ICON_KEY_DEHLT")

@ -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 */

@ -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);