forked from bartvdbraak/blender
2.5 Buttons Window:
* WIP Commit: Started wrapping the buttons header to python. Still disabled due to some display problems.
This commit is contained in:
parent
6b15024f4a
commit
c549e75c16
36
release/ui/space_buttons.py
Normal file
36
release/ui/space_buttons.py
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
import bpy
|
||||
|
||||
class Buttons_HT_header(bpy.types.Header):
|
||||
__space_type__ = "BUTTONS_WINDOW"
|
||||
__idname__ = "BUTTONS_HT_header"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
so = context.space_data
|
||||
scene = context.scene
|
||||
|
||||
layout.template_header(context)
|
||||
|
||||
if context.area.show_menus:
|
||||
row = layout.row(align=True)
|
||||
row.itemM(context, "Buttons_MT_view", text="View")
|
||||
|
||||
row = layout.row()
|
||||
row.itemR(so, "buttons_context", expand=True, text="")
|
||||
row.itemR(scene, "current_frame")
|
||||
|
||||
class Buttons_MT_view(bpy.types.Menu):
|
||||
__space_type__ = "BUTTONS_WINDOW"
|
||||
__label__ = "View"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
so = context.space_data
|
||||
|
||||
col = layout.column()
|
||||
col.itemR(so, "panel_alignment", expand=True)
|
||||
|
||||
bpy.types.register(Buttons_HT_header)
|
||||
bpy.types.register(Buttons_MT_view)
|
@ -220,14 +220,23 @@ void buttons_keymap(struct wmWindowManager *wm)
|
||||
|
||||
}
|
||||
|
||||
//#define PY_HEADER
|
||||
/* add handlers, stuff you only do once or on area/region changes */
|
||||
static void buttons_header_area_init(wmWindowManager *wm, ARegion *ar)
|
||||
{
|
||||
#ifdef PY_HEADER
|
||||
ED_region_header_init(ar);
|
||||
#else
|
||||
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void buttons_header_area_draw(const bContext *C, ARegion *ar)
|
||||
{
|
||||
#ifdef PY_HEADER
|
||||
ED_region_header(C, ar);
|
||||
#else
|
||||
|
||||
float col[3];
|
||||
|
||||
/* clear */
|
||||
@ -243,6 +252,7 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar)
|
||||
UI_view2d_view_ortho(C, &ar->v2d);
|
||||
|
||||
buttons_header_buttons(C, ar);
|
||||
#endif
|
||||
|
||||
/* restore view matrix? */
|
||||
UI_view2d_view_restore(C);
|
||||
|
@ -575,18 +575,17 @@ static void rna_def_space_buttons(BlenderRNA *brna)
|
||||
PropertyRNA *prop;
|
||||
|
||||
static EnumPropertyItem buttons_context_items[] = {
|
||||
{BCONTEXT_SCENE, "SCENE", 0, "Scene", ""},
|
||||
{BCONTEXT_WORLD, "WORLD", 0, "World", ""},
|
||||
{BCONTEXT_OBJECT, "OBJECT", 0, "Object", ""},
|
||||
{BCONTEXT_DATA, "DATA", 0, "Data", ""},
|
||||
{BCONTEXT_MATERIAL, "MATERIAL", 0, "Material", ""},
|
||||
{BCONTEXT_TEXTURE, "TEXTURE", 0, "Texture", ""},
|
||||
{BCONTEXT_PARTICLE, "PARTICLE", 0, "Particle", ""},
|
||||
{BCONTEXT_PHYSICS, "PHYSICS", 0, "Physics", ""},
|
||||
{BCONTEXT_GAME, "GAME", 0, "Game", ""},
|
||||
{BCONTEXT_BONE, "BONE", 0, "Bone", ""},
|
||||
{BCONTEXT_MODIFIER, "MODIFIER", 0, "Modifier", ""},
|
||||
{BCONTEXT_CONSTRAINT, "CONSTRAINT", 0, "Constraint", ""},
|
||||
{BCONTEXT_SCENE, "SCENE", ICON_SCENE, "Scene", "Scene"},
|
||||
{BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"},
|
||||
{BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"},
|
||||
{BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraint", "Constraint"},
|
||||
{BCONTEXT_MODIFIER, "MODIFIER", ICON_MODIFIER, "Modifier", "Modifier"},
|
||||
{BCONTEXT_DATA, "DATA", 0, "Data", "Data"},
|
||||
{BCONTEXT_BONE, "BONE", ICON_BONE_DATA, "Bone", "Bone"},
|
||||
{BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
|
||||
{BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"},
|
||||
{BCONTEXT_PARTICLE, "PARTICLE", ICON_PARTICLES, "Particle", "Particle"},
|
||||
{BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
static EnumPropertyItem panel_alignment_items[] = {
|
||||
@ -602,11 +601,13 @@ static void rna_def_space_buttons(BlenderRNA *brna)
|
||||
RNA_def_property_enum_sdna(prop, NULL, "mainb");
|
||||
RNA_def_property_enum_items(prop, buttons_context_items);
|
||||
RNA_def_property_ui_text(prop, "Buttons Context", "The type of active data to display and edit in the buttons window");
|
||||
RNA_def_property_update(prop, NC_WINDOW, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "panel_alignment", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "align");
|
||||
RNA_def_property_enum_items(prop, panel_alignment_items);
|
||||
RNA_def_property_ui_text(prop, "Panel Alignment", "Arrangement of the panels within the buttons window");
|
||||
RNA_def_property_update(prop, NC_WINDOW, NULL);
|
||||
|
||||
/* pinned data */
|
||||
prop= RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
|
||||
|
Loading…
Reference in New Issue
Block a user