diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-05-19 21:13:33 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-05-19 21:13:33 +0400 |
commit | 40ae17d2f6e2d5dbbe89321491572035c304872c (patch) | |
tree | 7f39fe42977a45878352e34d7bfdc1820ed980ff /source/blender/makesrna/intern/rna_ui.c | |
parent | 861398542f8ba71dd4783886adda21544d939763 (diff) |
UI
* Fix buttons jumping around when resizing and zoom. Part of this was
adding a tiny a 0.001f offset in UI_view2d_view_ortho, otherwise the
rounding is unpredictable (used to be 0.375f, but that was disabled).
* Fix various issues with zooming, panning panels. V2D_LOCKOFS_X/Y is
now taken into account in more places in the view2d code, to avoid
zooming into the center or panning out of the view.
* Remove "Free" align mode in buttons window (it's not really useful).
* View3D/Graph/Image editors now use the same PanelType system as the
buttons window, means some deprecated panel code could be removed.
* Some small visual tweaks for panels.
* View 2D Reset operator (Home key), to reset zoom and panning for panels.
* Added argument to set number buttons as sliders (slider=True for itemR).
* Ignore labels for button alignment (doesn't look right).
* Fix some use of context.main in py scripts, should get data from active
object instead.
* Fix autotexspace -> auto_texspace in py script.
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 405ae9a0f74..a3e48f629cb 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -111,6 +111,22 @@ static void panel_draw(const bContext *C, Panel *pnl) RNA_parameter_list_free(list); } +static void panel_draw_header(const bContext *C, Panel *pnl) +{ + PointerRNA ptr; + ParameterList *list; + FunctionRNA *func; + + RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->py_srna, pnl, &ptr); + func= RNA_struct_find_function(&ptr, "draw_header"); + + list= RNA_parameter_list_create(&ptr, func); + RNA_parameter_set_lookup(list, "context", &C); + pnl->type->py_call(&ptr, func, list); + + RNA_parameter_list_free(list); +} + static void rna_Panel_unregister(const bContext *C, StructRNA *type) { ARegionType *art; @@ -169,6 +185,7 @@ static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, voi pt->poll= (have_function[0])? panel_poll: NULL; pt->draw= (have_function[1])? panel_draw: NULL; + pt->draw_header= (have_function[2])? panel_draw_header: NULL; BLI_addtail(&art->paneltypes, pt); @@ -429,6 +446,11 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_function_flag(func, FUNC_REGISTER); RNA_def_pointer(func, "context", "Context", "", ""); + func= RNA_def_function(srna, "draw_header", NULL); + RNA_def_function_ui_description(func, "Draw buttons into the panel header UI layout."); + RNA_def_function_flag(func, FUNC_REGISTER); + RNA_def_pointer(func, "context", "Context", "", ""); + prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "UILayout"); |