Compare commits
1 Commits
curve-node
...
tmp-Timeli
Author | SHA1 | Date | |
---|---|---|---|
9637e4e65f |
@@ -35,16 +35,31 @@ class TIME_HT_editor_buttons(Header):
|
|||||||
scene = context.scene
|
scene = context.scene
|
||||||
toolsettings = context.tool_settings
|
toolsettings = context.tool_settings
|
||||||
screen = context.screen
|
screen = context.screen
|
||||||
|
|
||||||
|
# XXX: Nasty layout hacks ------------------------------
|
||||||
|
MAX_WIDTH = context.area.width
|
||||||
|
UI_UNIT_X = 20.0
|
||||||
|
UI_DPI_FAC = context.user_preferences.system.ui_scale
|
||||||
|
|
||||||
|
# 7 for playback, 17 for frame nums (4 per control + 1 + 1), + menus
|
||||||
|
total_content_width = (18 + 8 + 16) * UI_UNIT_X * UI_DPI_FAC
|
||||||
|
|
||||||
|
free_space = MAX_WIDTH - total_content_width
|
||||||
|
if free_space < 0:
|
||||||
|
spacer_scale = 0.1
|
||||||
|
else:
|
||||||
|
spacer_scale = (free_space / 2) / (UI_UNIT_X * UI_DPI_FAC)
|
||||||
|
#print("area width = %s, total_content = %s, spacer_scale = %s" % (MAX_WIDTH, total_content_width, spacer_scale))
|
||||||
|
|
||||||
|
# XXX: Nasty layout hacks end ---------------------------
|
||||||
|
|
||||||
layout.separator() # XXX: This should be dynamic (e.g. layout.separator(stretch=1.0))
|
row = layout.row()
|
||||||
layout.separator()
|
row.alignment = 'EXPAND'
|
||||||
layout.separator()
|
row.scale_x = spacer_scale
|
||||||
layout.separator()
|
row.spacer()
|
||||||
layout.separator()
|
|
||||||
layout.separator()
|
|
||||||
layout.separator()
|
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
|
row.alignment = 'CENTER'
|
||||||
row.prop(toolsettings, "use_keyframe_insert_auto", text="", toggle=True)
|
row.prop(toolsettings, "use_keyframe_insert_auto", text="", toggle=True)
|
||||||
|
|
||||||
row.operator("screen.frame_jump", text="", icon='REW').end = False
|
row.operator("screen.frame_jump", text="", icon='REW').end = False
|
||||||
@@ -67,34 +82,34 @@ class TIME_HT_editor_buttons(Header):
|
|||||||
row.operator("screen.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True
|
row.operator("screen.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True
|
||||||
row.operator("screen.frame_jump", text="", icon='FF').end = True
|
row.operator("screen.frame_jump", text="", icon='FF').end = True
|
||||||
|
|
||||||
layout.separator() # XXX: This should be dynamic (e.g. layout.separator(stretch=1.0))
|
row = layout.row()
|
||||||
layout.separator()
|
row.alignment = 'EXPAND'
|
||||||
layout.separator()
|
row.scale_x = spacer_scale
|
||||||
layout.separator()
|
row.spacer()
|
||||||
layout.separator()
|
|
||||||
layout.separator()
|
|
||||||
layout.separator()
|
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.scale_x = 0.95
|
row.alignment = 'RIGHT'
|
||||||
|
|
||||||
|
subrow = row.row()
|
||||||
|
subrow.scale_x = 0.95
|
||||||
if scene.show_subframe:
|
if scene.show_subframe:
|
||||||
row.prop(scene, "frame_float", text="")
|
subrow.prop(scene, "frame_float", text="")
|
||||||
else:
|
else:
|
||||||
row.prop(scene, "frame_current", text="")
|
subrow.prop(scene, "frame_current", text="")
|
||||||
|
|
||||||
layout.separator()
|
row.separator()
|
||||||
layout.separator()
|
row.separator()
|
||||||
|
|
||||||
row = layout.row(align=True)
|
subrow = row.row(align=True)
|
||||||
row.prop(scene, "use_preview_range", text="", toggle=True)
|
subrow.prop(scene, "use_preview_range", text="", toggle=True)
|
||||||
sub = row.row(align=True)
|
subsub = subrow.row(align=True)
|
||||||
sub.scale_x = 0.8
|
subsub.scale_x = 0.8
|
||||||
if not scene.use_preview_range:
|
if not scene.use_preview_range:
|
||||||
sub.prop(scene, "frame_start", text="Start")
|
subsub.prop(scene, "frame_start", text="Start")
|
||||||
sub.prop(scene, "frame_end", text="End")
|
subsub.prop(scene, "frame_end", text="End")
|
||||||
else:
|
else:
|
||||||
sub.prop(scene, "frame_preview_start", text="Start")
|
subsub.prop(scene, "frame_preview_start", text="Start")
|
||||||
sub.prop(scene, "frame_preview_end", text="End")
|
subsub.prop(scene, "frame_preview_end", text="End")
|
||||||
|
|
||||||
|
|
||||||
class TIME_MT_editor_menus(Menu):
|
class TIME_MT_editor_menus(Menu):
|
||||||
|
@@ -1105,6 +1105,7 @@ void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int
|
|||||||
void uiItemM(uiLayout *layout, struct bContext *C, const char *menuname, const char *name, int icon); /* menu */
|
void uiItemM(uiLayout *layout, struct bContext *C, const char *menuname, const char *name, int icon); /* menu */
|
||||||
void uiItemV(uiLayout *layout, const char *name, int icon, int argval); /* value */
|
void uiItemV(uiLayout *layout, const char *name, int icon, int argval); /* value */
|
||||||
void uiItemS(uiLayout *layout); /* separator */
|
void uiItemS(uiLayout *layout); /* separator */
|
||||||
|
void uiItemSpacer(uiLayout *layout); /* separator that stretches */
|
||||||
|
|
||||||
void uiItemPopoverPanel_ptr(
|
void uiItemPopoverPanel_ptr(
|
||||||
uiLayout *layout, struct bContext *C,
|
uiLayout *layout, struct bContext *C,
|
||||||
|
@@ -2113,6 +2113,18 @@ void uiItemS(uiLayout *layout)
|
|||||||
uiDefBut(block, (is_menu) ? UI_BTYPE_SEPR_LINE : UI_BTYPE_SEPR, 0, "", 0, 0, space, space, NULL, 0.0, 0.0, 0, 0, "");
|
uiDefBut(block, (is_menu) ? UI_BTYPE_SEPR_LINE : UI_BTYPE_SEPR, 0, "", 0, 0, space, space, NULL, 0.0, 0.0, 0, 0, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* spacer item - a separator that stretches out by default */
|
||||||
|
void uiItemSpacer(uiLayout *layout)
|
||||||
|
{
|
||||||
|
uiBlock *block = layout->root->block;
|
||||||
|
uiBut *but;
|
||||||
|
int space = UI_UNIT_X;
|
||||||
|
|
||||||
|
UI_block_layout_set_current(block, layout);
|
||||||
|
but = uiDefBut(block, UI_BTYPE_SEPR, 0, "", 0, 0, space, space, NULL, 0.0, 0.0, 0, 0, "");
|
||||||
|
//printf(" spacer: s = %p -> L = %p\n", but, layout);
|
||||||
|
}
|
||||||
|
|
||||||
/* level items */
|
/* level items */
|
||||||
void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg)
|
void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg)
|
||||||
{
|
{
|
||||||
@@ -2331,6 +2343,7 @@ static void ui_litem_layout_row(uiLayout *litem)
|
|||||||
{
|
{
|
||||||
min_flag = false;
|
min_flag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((neww < minw || min_flag) && w != 0) {
|
if ((neww < minw || min_flag) && w != 0) {
|
||||||
/* fixed size */
|
/* fixed size */
|
||||||
@@ -2360,7 +2373,8 @@ static void ui_litem_layout_row(uiLayout *litem)
|
|||||||
|
|
||||||
for (item = litem->items.first; item; item = item->next) {
|
for (item = litem->items.first; item; item = item->next) {
|
||||||
ui_item_size(item, &itemw, &itemh);
|
ui_item_size(item, &itemw, &itemh);
|
||||||
minw = ui_litem_min_width(itemw);
|
//minw = ui_litem_min_width(itemw);
|
||||||
|
minw = itemw;
|
||||||
|
|
||||||
if (item->flag & UI_ITEM_FIXED) {
|
if (item->flag & UI_ITEM_FIXED) {
|
||||||
/* fixed minimum size items */
|
/* fixed minimum size items */
|
||||||
|
@@ -718,6 +718,9 @@ void RNA_api_ui_layout(StructRNA *srna)
|
|||||||
|
|
||||||
func = RNA_def_function(srna, "separator", "uiItemS");
|
func = RNA_def_function(srna, "separator", "uiItemS");
|
||||||
RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items");
|
RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items");
|
||||||
|
|
||||||
|
func = RNA_def_function(srna, "spacer", "uiItemSpacer");
|
||||||
|
RNA_def_function_ui_description(func, "Item. Inserts empty space into layout between items that can grow and shrink as needed");
|
||||||
|
|
||||||
/* context */
|
/* context */
|
||||||
func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
|
func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
|
||||||
|
Reference in New Issue
Block a user