diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-06-12 10:44:49 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-06-12 10:44:49 +0400 |
commit | 74884754d221a97c487d4c3630ceb4412b726863 (patch) | |
tree | e5afa88e820cb8b81a7281f9c151e8df8177d784 /source/blender | |
parent | 4f9846b6a13184c504682853beb2647b4a77e9ac (diff) |
NLA SoC: Added menus including the operators coded already
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_nla/nla_header.c | 102 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 28 |
4 files changed, 109 insertions, 25 deletions
diff --git a/source/blender/editors/space_nla/nla_header.c b/source/blender/editors/space_nla/nla_header.c index 7ce7536878b..0d42c544a3f 100644 --- a/source/blender/editors/space_nla/nla_header.c +++ b/source/blender/editors/space_nla/nla_header.c @@ -57,6 +57,9 @@ #include "ED_screen.h" #include "BIF_gl.h" +#include "BIF_transform.h" + +#include "RNA_access.h" #include "WM_api.h" #include "WM_types.h" @@ -74,37 +77,84 @@ enum { /* ************************ header area region *********************** */ -static void do_viewmenu(bContext *C, void *arg, int event) + +static void nla_viewmenu(bContext *C, uiLayout *layout, void *arg_unused) { + bScreen *sc= CTX_wm_screen(C); + ScrArea *sa= CTX_wm_area(C); + Scene *scene= CTX_data_scene(C); + SpaceNla *snla= (SpaceNla*)CTX_wm_space_data(C); + PointerRNA spaceptr; + + /* retrieve state */ + RNA_pointer_create(&sc->id, &RNA_SpaceNLA, snla, &spaceptr); + + /* create menu */ + uiItemO(layout, NULL, ICON_MENU_PANEL, "NLAEDIT_OT_properties"); + + uiItemS(layout); + + uiItemR(layout, NULL, 0, &spaceptr, "show_cframe_indicator", 0, 0, 0); + if (snla->flag & SNLA_DRAWTIME) + uiItemO(layout, "Show Frames", 0, "ANIM_OT_time_toggle"); + else + uiItemO(layout, "Show Seconds", 0, "ANIM_OT_time_toggle"); + + uiItemS(layout); + + if (scene->flag & SCE_NLA_EDIT_ON) + uiItemO(layout, NULL, 0, "NLAEDIT_OT_tweakmode_exit"); + else + uiItemO(layout, NULL, 0, "NLAEDIT_OT_tweakmode_enter"); + + uiItemS(layout); + + uiItemO(layout, NULL, 0, "NLA_OT_view_all"); + + if (sa->full) + uiItemO(layout, NULL, 0, "SCREEN_OT_screen_full_area"); // "Tile Window", Ctrl UpArrow + else + uiItemO(layout, NULL, 0, "SCREEN_OT_screen_full_area"); // "Maximize Window", Ctr DownArrow } -static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) +static void nla_selectmenu(bContext *C, uiLayout *layout, void *arg_unused) { - ScrArea *curarea= CTX_wm_area(C); - uiBlock *block; - short yco= 0, menuwidth=120; + uiItemO(layout, NULL, 0, "NLAEDIT_OT_select_all_toggle"); + uiItemBooleanO(layout, "Invert All", 0, "NLAEDIT_OT_select_all_toggle", "invert", 1); - block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_viewmenu, NULL); + uiItemS(layout); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); + uiItemO(layout, NULL, 0, "NLAEDIT_OT_select_border"); + uiItemBooleanO(layout, "Border Axis Range", 0, "NLAEDIT_OT_select_border", "axis_range", 1); +} + +static void nla_edit_transformmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + // XXX these operators may change for NLA... + uiItemEnumO(layout, "Grab/Move", 0, "TFM_OT_transform", "mode", TFM_TIME_TRANSLATE); + uiItemEnumO(layout, "Extend", 0, "TFM_OT_transform", "mode", TFM_TIME_EXTEND); + uiItemEnumO(layout, "Scale", 0, "TFM_OT_transform", "mode", TFM_TIME_SCALE); +} + +static void nla_editmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemMenuF(layout, "Transform", 0, nla_edit_transformmenu); - if(curarea->headertype==HEADERTOP) { - uiBlockSetDirection(block, UI_DOWN); - } - else { - uiBlockSetDirection(block, UI_TOP); - uiBlockFlipOrder(block); - } + uiItemS(layout); - uiTextBoundsBlock(block, 50); - uiEndBlock(C, block); + uiItemO(layout, NULL, 0, "NLA_OT_add_tracks"); + uiItemBooleanO(layout, "Add Tracks Above Selected", 0, "NLA_OT_add_tracks", "above_selected", 1); + + uiItemO(layout, NULL, 0, "NLAEDIT_OT_split"); - return block; + uiItemS(layout); + + uiItemO(layout, NULL, 0, "NLAEDIT_OT_delete"); } +/* ------------------ */ + static void do_nla_buttons(bContext *C, void *arg, int event) { switch (event) { @@ -132,9 +182,17 @@ void nla_header_buttons(const bContext *C, ARegion *ar) int xmax; xmax= GetButStringLength("View"); - uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C), - "View", xco, yco-2, xmax-3, 24, ""); - xco+=XIC+xmax; + uiDefMenuBut(block, nla_viewmenu, NULL, "View", xco, yco, xmax-3, 20, ""); + xco+= xmax; + + xmax= GetButStringLength("Select"); + uiDefMenuBut(block, nla_selectmenu, NULL, "Select", xco, yco, xmax-3, 20, ""); + xco+= xmax; + + xmax= GetButStringLength("Edit"); + uiDefMenuBut(block, nla_editmenu, NULL, "Edit", xco, yco, xmax-3, 20, ""); + xco+= xmax; + } uiBlockSetEmboss(block, UI_EMBOSS); diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index c7abd8f7f83..3740633b576 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -696,8 +696,11 @@ enum { #define IMS_INFILESLI 4 /* nla->flag */ + // depreceated #define SNLA_ALLKEYED (1<<0) + // depreceated #define SNLA_ACTIVELAYERS (1<<1) + #define SNLA_DRAWTIME (1<<2) #define SNLA_NOTRANSKEYCULL (1<<3) #define SNLA_NODRAWCFRANUM (1<<4) diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 1a8bf88d1cc..d1fd3d78074 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -365,6 +365,7 @@ extern StructRNA RNA_Space; extern StructRNA RNA_Space3DView; extern StructRNA RNA_SpaceButtonsWindow; extern StructRNA RNA_SpaceImageEditor; +extern StructRNA RNA_SpaceNLA; extern StructRNA RNA_SpaceOutliner; extern StructRNA RNA_SpaceSequenceEditor; extern StructRNA RNA_SpaceTextEditor; diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 5de80cce2b5..1b776b727ce 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -92,10 +92,10 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr) /*case SPACE_SOUND: return &RNA_SpaceAudioWindow; case SPACE_ACTION: - return &RNA_SpaceDopeSheetEditor; + return &RNA_SpaceDopeSheetEditor;*/ case SPACE_NLA: - return &RNA_SpaceNLAEditor; - case SPACE_SCRIPT: + return &RNA_SpaceNLA; + /*case SPACE_SCRIPT: return &RNA_SpaceScriptsWindow; case SPACE_TIME: return &RNA_SpaceTimeline; @@ -757,6 +757,27 @@ static void rna_def_space_text(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Replace Text", "Text to replace selected text with using the replace tool."); } +static void rna_def_space_nla(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "SpaceNLA", "Space"); + RNA_def_struct_sdna(srna, "SpaceNla"); + RNA_def_struct_ui_text(srna, "Space Nla Editor", "NLA editor space data."); + + /* display */ + prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SNLA_DRAWTIME); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX for now, only set with operator + RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames."); + + prop= RNA_def_property(srna, "show_cframe_indicator", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NODRAWCFRANUM); + RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line."); + +} + void RNA_def_space(BlenderRNA *brna) { rna_def_space(brna); @@ -767,6 +788,7 @@ void RNA_def_space(BlenderRNA *brna) rna_def_background_image(brna); rna_def_space_3dview(brna); rna_def_space_buttons(brna); + rna_def_space_nla(brna); } #endif |