2.5 - Keying Sets Fixes
authorJoshua Leung <aligorith@gmail.com>
Mon, 17 Aug 2009 07:35:38 +0000 (07:35 +0000)
committerJoshua Leung <aligorith@gmail.com>
Mon, 17 Aug 2009 07:35:38 +0000 (07:35 +0000)
* 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.

release/ui/space_time.py
source/blender/editors/space_outliner/outliner.c
source/blender/makesrna/intern/rna_scene.c

index 645e3e2b4b4b4ed36acd8078a64e500e1d0536e4..59d72525230e92e2a0a6432cf690fd47a5c32652 100644 (file)
@@ -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")
 
index ac47c518c469e26f89ca07b23395f732e6b5bd43..0a48bfec47b2ae824ad73c9d65e3d728dd13ae68 100644 (file)
@@ -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 */
index 2a6d0961464e10eeebb40f41a619a7a6741c0e3b..f5b4a50889446a30ab6a793f832a478cf3f80433 100644 (file)
@@ -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);