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-02-12 04:11:29 +0300
committerJoshua Leung <aligorith@gmail.com>2009-02-12 04:11:29 +0300
commit9733eebd60237a841f1876557c55b78e353ae961 (patch)
tree522aad12ea9d1f50e3c5b9e96ca9a75f9e6ac00c /source/blender/editors
parent9ad8f1cf6a1911516ebf48e268995bc0357ecf2c (diff)
KeyingSets: More work on preparing the UI
KeyingSets can now be added/removed. Next up, the code for the operators to add items to Keying Sets.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/keyframing.c19
-rw-r--r--source/blender/editors/include/ED_keyframing.h2
-rw-r--r--source/blender/editors/space_outliner/outliner.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_header.c95
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c13
-rw-r--r--source/blender/editors/space_time/space_time.c10
-rw-r--r--source/blender/editors/space_time/time_header.c2
7 files changed, 130 insertions, 15 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 42ed4fddc99..08ee83277a8 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -877,23 +877,32 @@ enum {
/* Build menu-string of available keying-sets (allocates memory for string)
* NOTE: mode must not be longer than 64 chars
*/
-char *ANIM_build_keyingsets_menu (ListBase *list)
+char *ANIM_build_keyingsets_menu (ListBase *list, short for_edit)
{
DynStr *pupds= BLI_dynstr_new();
KeyingSet *ks;
char buf[64];
char *str;
+ int i;
/* add title first */
BLI_dynstr_append(pupds, "Keying Sets%t|");
- /* add dummy entry for none-active */
- BLI_dynstr_append(pupds, "<No Keying Set Active>%x0|");
+ /* add dummy entries for none-active */
+ if (for_edit) {
+ BLI_dynstr_append(pupds, "Add New%x-1|");
+ BLI_dynstr_append(pupds, " %x0|");
+ }
+ else
+ BLI_dynstr_append(pupds, "<No Keying Set Active>%x0|");
/* loop through keyingsets, adding them */
- for (ks= list->first; ks; ks= ks->next) {
+ for (ks=list->first, i=1; ks; ks=ks->next, i++) {
+ if (for_edit == 0)
+ BLI_dynstr_append(pupds, "KS: ");
+
BLI_dynstr_append(pupds, ks->name);
- BLI_snprintf( buf, 64, "%s", ((ks->next)?"|":"") );
+ BLI_snprintf( buf, 64, "%%x%d%s", i, ((ks->next)?"|":"") );
BLI_dynstr_append(pupds, buf);
}
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index e7441188fc3..d310066c999 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -84,7 +84,7 @@ short deletekey(struct ID *id, const char group[], const char rna_path[], int ar
/* Generate menu of KeyingSets */
-char *ANIM_build_keyingsets_menu(struct ListBase *list);
+char *ANIM_build_keyingsets_menu(struct ListBase *list, short for_edit);
/* Main Keyframe Management operators:
* These handle keyframes management from various spaces. They will handle the menus
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 7d06c98577d..dafe0cb4e03 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -3105,8 +3105,10 @@ static KeyingSet *verify_active_keyingset(Scene *scene, short add)
/* add if none found */
// XXX the default settings have yet to evolve
- if ((add) && (ks==NULL))
+ if ((add) && (ks==NULL)) {
ks= BKE_keyingset_add(&scene->keyingsets, "KeyingSet", KEYINGSET_ABSOLUTE, 0);
+ scene->active_keyingset= BLI_countlist(&scene->keyingsets);
+ }
return ks;
}
diff --git a/source/blender/editors/space_outliner/outliner_header.c b/source/blender/editors/space_outliner/outliner_header.c
index 7add3f85ea0..f5b93254693 100644
--- a/source/blender/editors/space_outliner/outliner_header.c
+++ b/source/blender/editors/space_outliner/outliner_header.c
@@ -30,6 +30,7 @@
#include <stdio.h>
#include "DNA_ID.h"
+#include "DNA_anim_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
@@ -39,6 +40,7 @@
#include "BLI_blenlib.h"
+#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -159,15 +161,51 @@ static uiBlock *outliner_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
return block;
}
-#define B_REDR 1
+enum {
+ B_REDR = 1,
+
+ B_KEYINGSET_CHANGE,
+ B_KEYINGSET_REMOVE,
+} eOutlinerHeader_Events;
+
static void do_outliner_buttons(bContext *C, void *arg, int event)
{
ScrArea *sa= CTX_wm_area(C);
+ Scene *scene= CTX_data_scene(C);
switch(event) {
case B_REDR:
ED_area_tag_redraw(sa);
break;
+
+ case B_KEYINGSET_CHANGE:
+ /* add a new KeyingSet if active is -1 */
+ if (scene->active_keyingset == -1) {
+ // XXX the default settings have yet to evolve... need to keep this in sync with the
+ BKE_keyingset_add(&scene->keyingsets, "KeyingSet", KEYINGSET_ABSOLUTE, 0);
+ scene->active_keyingset= BLI_countlist(&scene->keyingsets);
+ }
+
+ /* redraw regions with KeyingSet info */
+ WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, scene);
+ break;
+
+ case B_KEYINGSET_REMOVE:
+ /* remove the active KeyingSet */
+ if (scene->active_keyingset) {
+ KeyingSet *ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
+
+ /* firstly free KeyingSet's data, then free the KeyingSet itself */
+ if (ks) {
+ BKE_keyingset_free(ks);
+ BLI_freelinkN(&scene->keyingsets, ks);
+ scene->active_keyingset= 0;
+ }
+ }
+
+ /* redraw regions with KeyingSet info */
+ WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, scene);
+ break;
}
}
@@ -175,6 +213,7 @@ static void do_outliner_buttons(bContext *C, void *arg, int event)
void outliner_header_buttons(const bContext *C, ARegion *ar)
{
ScrArea *sa= CTX_wm_area(C);
+ Scene *scene= CTX_data_scene(C);
SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C);
uiBlock *block;
int xco, yco= 3, xmax;
@@ -201,13 +240,63 @@ void outliner_header_buttons(const bContext *C, ARegion *ar)
}
//if (outliner->type==SO_OUTLINER) {
+ /* data selector*/
if(G.main->library.first)
uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10|Datablocks %x11|User Preferences %x12", xco, yco, 120, 20, &soutliner->outlinevis, 0, 0, 0, 0, "");
else
- uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10|Datablocks %x11|User Preferences %x12", xco, yco, 120, 20, &soutliner->outlinevis, 0, 0, 0, 0, "");
+ uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10|Datablocks %x11|User Preferences %x12", xco, yco, 120, 20, &soutliner->outlinevis, 0, 0, 0, 0, "");
+ xco += 120;
+
+ /* KeyingSet editing buttons */
+ if ((soutliner->flag & SO_HIDE_KEYINGSETINFO)==0 && (soutliner->outlinevis==SO_DATABLOCKS)) {
+ KeyingSet *ks= NULL;
+ char *menustr= NULL;
+
+ xco+= (int)(XIC*1.5);
+
+ if (scene->active_keyingset)
+ ks= (KeyingSet *)BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
+
+ uiBlockBeginAlign(block);
+ /* currently 'active' KeyingSet */
+ menustr= ANIM_build_keyingsets_menu(&scene->keyingsets, 1);
+ uiDefButI(block, MENU, B_KEYINGSET_CHANGE, menustr, xco,yco, 18,20, &scene->active_keyingset, 0, 0, 0, 0, "Browse Keying Sets");
+ MEM_freeN(menustr);
+ xco += 18;
+
+ /* currently 'active' KeyingSet - change name */
+ if (ks) {
+ /* active KeyingSet */
+ uiDefBut(block, TEX, B_KEYINGSET_CHANGE,"", xco,yco,120,20, ks->name, 0, 63, 0, 0, "Name of Active Keying Set");
+ xco += 120;
+ uiDefIconBut(block, BUT, B_KEYINGSET_REMOVE, VICON_X, xco, yco, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove this Keying Set");
+ xco += 20;
+ }
+ else {
+ /* no active KeyingSet... so placeholder instead */
+ uiDefBut(block, LABEL, 0,"<No Keying Set Active>", xco,yco,140,20, NULL, 0, 63, 0, 0, "Name of Active Keying Set");
+ xco += 140;
+ }
+ uiBlockEndAlign(block);
+
+ /* current 'active' KeyingSet */
+ if (ks) {
+ xco += 5;
+
+ /* operator buttons to add/remove selected items from set */
+ uiBlockBeginAlign(block);
+ // XXX the icons here are temporary
+ uiDefIconButO(block, BUT, "OUTLINER_OT_keyingset_remove_selected", WM_OP_INVOKE_REGION_WIN, ICON_ZOOMOUT, xco,yco,XIC,YIC, "Remove selected properties from active Keying Set (Alt-K)");
+ xco += XIC;
+ uiDefIconButO(block, BUT, "OUTLINER_OT_keyingset_add_selected", WM_OP_INVOKE_REGION_WIN, ICON_ZOOMIN, xco,yco,XIC,YIC, "Add selected properties to active Keying Set (K)");
+ xco += XIC;
+ uiBlockEndAlign(block);
+ }
+
+ xco += XIC*2;
+ }
//}
-
/* always as last */
UI_view2d_totRect_set(&ar->v2d, xco+XIC+100, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin));
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 69f57d507b9..b8187309c0d 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -119,6 +119,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_OB_ACTIVE:
case ND_OB_SELECT:
case ND_MODE:
+ case ND_KEYINGSET:
ED_region_tag_redraw(ar);
break;
}
@@ -170,6 +171,17 @@ static void outliner_header_area_free(ARegion *ar)
{
}
+static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn)
+{
+ /* context changes */
+ switch(wmn->category) {
+ case NC_SCENE:
+ if(wmn->data == ND_KEYINGSET)
+ ED_region_tag_redraw(ar);
+ break;
+ }
+}
+
/* ******************** default callbacks for outliner space ***************** */
static SpaceLink *outliner_new(const bContext *C)
@@ -289,6 +301,7 @@ void ED_spacetype_outliner(void)
art->init= outliner_header_area_init;
art->draw= outliner_header_area_draw;
art->free= outliner_header_area_free;
+ art->listener= outliner_header_area_listener;
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index d28fdc7f371..3df57208bbd 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -207,11 +207,13 @@ static void time_header_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
switch(wmn->category) {
-
case NC_SCENE:
- if(wmn->data==ND_FRAME)
- ED_region_tag_redraw(ar);
- break;
+ switch (wmn->data) {
+ case ND_FRAME:
+ case ND_KEYINGSET:
+ ED_region_tag_redraw(ar);
+ break;
+ }
}
}
diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c
index 1f03530b680..38c0f2dfc1d 100644
--- a/source/blender/editors/space_time/time_header.c
+++ b/source/blender/editors/space_time/time_header.c
@@ -542,7 +542,7 @@ void time_header_buttons(const bContext *C, ARegion *ar)
xco+= 16;
- menustr= ANIM_build_keyingsets_menu(&scene->keyingsets);
+ menustr= ANIM_build_keyingsets_menu(&scene->keyingsets, 0);
uiDefButI(block, MENU, B_DIFF,
menustr,
xco, yco, (int)5.5*XIC, YIC, &(scene->active_keyingset), 0, 1, 0, 0,