From 61b2ac04e37b59dc6feae941e43fc8256b2864ca Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 17 Aug 2009 07:35:38 +0000 Subject: 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. --- source/blender/makesrna/intern/rna_scene.c | 53 +++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) (limited to 'source/blender/makesrna') 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); -- cgit v1.2.3