diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-11 17:32:20 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-11 17:32:20 +0400 |
commit | b775f1bb322a6277916c24ca282b899532a52e96 (patch) | |
tree | acb675f4b9c744edf26bf65b359d150488974d4f /source | |
parent | 0096a3dee2082d5dd15278a2e5627b6446f18e0a (diff) |
2.5:
* Code to start moving 3D view header and panels to python, at
the moment the View menu and one empty panel is in python. The
C header code is wrapped in one template, so parts of that can
be moved over while still keeping things working.
* Fix for mistake in RNA enum commit yesterday, and some warning
fixes.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 23 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_header.c | 93 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 3 |
6 files changed, 16 insertions, 115 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 67438120eef..66089272737 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -622,6 +622,7 @@ void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *i ListBase uiTemplateList(uiLayout *layout, struct PointerRNA *ptr, char *propname, struct PointerRNA *activeptr, char *activeprop, int rows, int columns, int compact); void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C); void uiTemplateOperatorSearch(uiLayout *layout); +void uiTemplateHeader3D(uiLayout *layout, struct bContext *C); /* items */ void uiItemO(uiLayout *layout, char *name, int icon, char *opname); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index f122412fdd6..e39ed800e0c 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1757,9 +1757,9 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in short changed = 0; Base *base; Group *group, *ob_groups[GROUP_MENU_MAX]; - char str[10 + (24*GROUP_MENU_MAX)]; - char *p = str; - int group_count=0, menu, i; + //char str[10 + (24*GROUP_MENU_MAX)]; + //char *p = str; + int group_count=0; //, menu, i; for ( group=G.main->group.first; group && group_count < GROUP_MENU_MAX; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 9b6b70eb396..718b74e5225 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -490,30 +490,13 @@ static void view3d_header_area_init(wmWindowManager *wm, ARegion *ar) ListBase *keymap= WM_keymap_listbase(wm, "View3D Generic", SPACE_VIEW3D, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - - UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); + + ED_region_header_init(ar); } static void view3d_header_area_draw(const bContext *C, ARegion *ar) { - float col[3]; - - /* clear */ - if(ED_screen_area_active(C)) - UI_GetThemeColor3fv(TH_HEADER, col); - else - UI_GetThemeColor3fv(TH_HEADERDESEL, col); - - glClearColor(col[0], col[1], col[2], 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); - - view3d_header_buttons(C, ar); - - /* restore view matrix? */ - UI_view2d_view_restore(C); + ED_region_header(C, ar); } static void view3d_header_area_listener(ARegion *ar, wmNotifier *wmn) diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 387c3c7626a..e68a1c8a10a 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -636,86 +636,6 @@ static void do_view3d_viewmenu(bContext *C, void *arg, int event) } #endif -static void view3d_view_viewnavmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ -// uiItemO(layout, NULL, 0, "VIEW3D_OT_view_fly_mode"); - -// uiItemS(layout); - - uiItemsEnumO(layout, "VIEW3D_OT_view_orbit", "type"); - - uiItemS(layout); - - uiItemsEnumO(layout, "VIEW3D_OT_view_pan", "type"); - - uiItemS(layout); - - uiItemFloatO(layout, "Zoom in", 0, "VIEW3D_OT_zoom", "delta", 1.0f); - uiItemFloatO(layout, "Zoom out", 0, "VIEW3D_OT_zoom", "delta", -1.0f); - -} -static void view3d_view_alignviewmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - -} - -static void view3d_viewmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - ScrArea *sa= CTX_wm_area(C); - - uiItemO(layout, NULL, ICON_MENU_PANEL, "VIEW3D_OT_properties"); - uiItemO(layout, NULL, ICON_MENU_PANEL, "VIEW3D_OT_toolbar"); - -// uiItemO(layout, ICON_MENU_PANEL, "VIEW3D_OT_toggle_transform_orientations_panel"); // Transform Orientations... -// uiItemO(layout, ICON_MENU_PANEL, "VIEW3D_OT_toggle_render_preview_panel"); // render preview... -// uiItemO(layout, ICON_MENU_PANEL, "VIEW3D_OT_toggle_view_properties_panel"); // View Properties.... -// uiItemO(layout, ICON_MENU_PANEL, "VIEW3D_OT_toggle_background_image_panel"); // Background Image.... -// uiItemO(layout, ICON_MENU_PANEL, "VIEW3D_OT_toggle_grease_pencil_panel"); // Grease Pencil.... - - uiItemS(layout); - - uiItemEnumO(layout, NULL, 0, "VIEW3D_OT_viewnumpad", "type", V3D_VIEW_CAMERA); - uiItemEnumO(layout, NULL, 0, "VIEW3D_OT_viewnumpad", "type", V3D_VIEW_TOP); - uiItemEnumO(layout, NULL, 0, "VIEW3D_OT_viewnumpad", "type", V3D_VIEW_FRONT); - uiItemEnumO(layout, NULL, 0, "VIEW3D_OT_viewnumpad", "type", V3D_VIEW_RIGHT); - - //uiItemMenuF(layout, "Cameras", view3d_view_camerasmenu); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "VIEW3D_OT_view_persportho"); - - uiItemS(layout); - -// uiItemO(layout, NULL, 0, "VIEW3D_OT_view_show_all_layers"); - -// uiItemS(layout); - -// uiItemO(layout, NULL, 0, "VIEW3D_OT_view_local_view"); -// uiItemO(layout, NULL, 0, "VIEW3D_OT_view_global_view"); - -// uiItemS(layout); - - uiItemMenuF(layout, "View Navigation", 0, view3d_view_viewnavmenu); - uiItemMenuF(layout, "Align View", 0, view3d_view_alignviewmenu); - - uiItemS(layout); - - uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN); - - uiItemO(layout, NULL, 0, "VIEW3D_OT_clip_border"); - uiItemO(layout, NULL, 0, "VIEW3D_OT_zoom_border"); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "VIEW3D_OT_view_center"); - uiItemO(layout, NULL, 0, "VIEW3D_OT_view_all"); - - uiItemS(layout); - - 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 -} #if 0 static uiBlock *view3d_viewmenu(bContext *C, ARegion *ar, void *arg_unused) { @@ -4344,7 +4264,6 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o RegionView3D *rv3d= wm_region_view3d(C); short xmax, xco= *xcoord; - /* compensate for local mode when setting up the viewing menu/iconrow values */ if(rv3d->view==7) rv3d->viewbut= 1; else if(rv3d->view==1) rv3d->viewbut= 2; @@ -4355,11 +4274,6 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o * menu is drawn wider than it should be. The ypos of -2 is to make it properly fill the * height of the header */ - xmax= GetButStringLength("View"); - uiDefMenuBut(block, view3d_viewmenu, NULL, "View", xco, yco, xmax-3, 20, ""); - //uiDefPulldownBut(block, view3d_viewmenu, NULL, "View", xco, yco, xmax-3, 20, ""); - xco+= xmax; - xmax= GetButStringLength("Select"); if (obedit) { if (ob && ob->type == OB_MESH) { @@ -4495,8 +4409,9 @@ static void header_xco_step(ARegion *ar, int *xco, int *yco, int *maxco, int ste } } -void view3d_header_buttons(const bContext *C, ARegion *ar) +void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) { + ARegion *ar= CTX_wm_region(C); ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; Scene *scene= CTX_data_scene(C); @@ -4506,11 +4421,9 @@ void view3d_header_buttons(const bContext *C, ARegion *ar) uiBlock *block; int a, xco, maxco=0, yco= 3; - block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS); + block= uiLayoutFreeBlock(layout); uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL); - xco= ED_area_header_standardbuttons(C, block, yco); - if((sa->flag & HEADER_NO_PULLDOWN)==0) view3d_header_pulldowns(C, block, ob, &xco, yco); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index f20df81d6ad..d6ca03c85a2 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -650,9 +650,10 @@ void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, En if(C && eprop->itemf) { *item= eprop->itemf(C, ptr, free); - if(totitem) + if(totitem) { for(tot=0; (*item)[tot].identifier; tot++); - *totitem= tot; + *totitem= tot; + } } else { *item= eprop->item; diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 363891e0f24..404befc9bb2 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -273,6 +273,9 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_function_flag(func, FUNC_USE_CONTEXT); func= RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch"); + + func= RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); } #endif |