1
1

Compare commits

...

3 Commits

17 changed files with 242 additions and 293 deletions

View File

@@ -43,7 +43,8 @@ class MotionPathButtonsPanel:
if mps.type == 'CURRENT_FRAME':
col = layout.column(align=True)
col.prop(mps, "frame_before", text="Frame Range Before")
col.label(text="Frame Range")
col.prop(mps, "frame_before", text="Before")
col.prop(mps, "frame_after", text="After")
col.prop(mps, "frame_step", text="Step")
elif mps.type == 'RANGE':
@@ -55,7 +56,8 @@ class MotionPathButtonsPanel:
else:
sub.operator("object.paths_range_update", text="", icon='TIME')
sub = row.column(align=True)
sub.prop(mps, "frame_start", text="Frame Range Start")
sub.label(text="Frame Range")
sub.prop(mps, "frame_start", text="Start")
sub.prop(mps, "frame_end", text="End")
sub.prop(mps, "frame_step", text="Step")
@@ -63,9 +65,11 @@ class MotionPathButtonsPanel:
col = layout.column(align=True)
col.enabled = False
if bones:
col.prop(mpath, "frame_start", text="Bone Cache From")
col.label(text="Bone Cache")
col.prop(mpath, "frame_start", text="From")
else:
col.prop(mpath, "frame_start", text="Cache From")
col.label(text="Cache")
col.prop(mpath, "frame_start", text="From")
col.prop(mpath, "frame_end", text="To")
row = layout.row(align=True)

View File

@@ -54,48 +54,51 @@ class OBJECT_PT_transform(ObjectButtonsPanel, Panel):
ob = context.object
# Location.
col = flow.column()
row = col.row(align=True)
row.prop(ob, "location")
row.use_property_decorate = False
row.prop(ob, "lock_location", text="", emboss=False, icon='DECORATE_UNLOCKED')
sub = row.column(align=True)
sub.use_property_decorate = False
sub.label(text="") # Empty row for alignment (matches the property name).
sub.prop(ob, "lock_location", text="", emboss=False, icon='DECORATE_UNLOCKED')
# Rotation.
col = flow.column()
row = col.row(align=True)
left = row.column(align=True)
if ob.rotation_mode == 'QUATERNION':
col = flow.column()
row = col.row(align=True)
row.prop(ob, "rotation_quaternion", text="Rotation")
sub = row.column(align=True)
sub.use_property_decorate = False
sub.prop(ob, "lock_rotation_w", text="", emboss=False, icon='DECORATE_UNLOCKED')
sub.prop(ob, "lock_rotation", text="", emboss=False, icon='DECORATE_UNLOCKED')
left.prop(ob, "rotation_quaternion", text="Rotation")
right = row.column(align=True)
right.use_property_decorate = False
right.label(text="") # Empty row for alignment (matches the property name).
right.prop(ob, "lock_rotation_w", text="", emboss=False, icon='DECORATE_UNLOCKED')
right.prop(ob, "lock_rotation", text="", emboss=False, icon='DECORATE_UNLOCKED')
elif ob.rotation_mode == 'AXIS_ANGLE':
# row.column().label(text="Rotation")
#row.column().prop(pchan, "rotation_angle", text="Angle")
#row.column().prop(pchan, "rotation_axis", text="Axis")
col = flow.column()
row = col.row(align=True)
row.prop(ob, "rotation_axis_angle", text="Rotation")
sub = row.column(align=True)
sub.use_property_decorate = False
sub.prop(ob, "lock_rotation_w", text="", emboss=False, icon='DECORATE_UNLOCKED')
sub.prop(ob, "lock_rotation", text="", emboss=False, icon='DECORATE_UNLOCKED')
left.prop(ob, "rotation_axis_angle", text="Rotation")
right = row.column(align=True)
right.use_property_decorate = False
right.label(text="") # Empty row for alignment (matches the property name).
right.prop(ob, "lock_rotation_w", text="", emboss=False, icon='DECORATE_UNLOCKED')
right.prop(ob, "lock_rotation", text="", emboss=False, icon='DECORATE_UNLOCKED')
else:
col = flow.column()
row = col.row(align=True)
row.prop(ob, "rotation_euler", text="Rotation")
row.use_property_decorate = False
row.prop(ob, "lock_rotation", text="", emboss=False, icon='DECORATE_UNLOCKED')
left.prop(ob, "rotation_euler", text="Rotation")
right = row.column(align=True)
right.use_property_decorate = False
right.label(text="") # Empty row for alignment (matches the property name).
right.prop(ob, "lock_rotation", text="", emboss=False, icon='DECORATE_UNLOCKED')
# Rotation Mode.
row = left.row(align=True)
row.prop(ob, "rotation_mode", text="")
# Scale.
col = flow.column()
row = col.row(align=True)
row.prop(ob, "scale")
row.use_property_decorate = False
row.prop(ob, "lock_scale", text="", emboss=False, icon='DECORATE_UNLOCKED')
row = layout.row(align=True)
row.prop(ob, "rotation_mode")
row.label(text="", icon='BLANK1')
sub = row.column(align=True)
sub.use_property_decorate = False
sub.label(text="") # Empty row for alignment (matches the property name).
sub.prop(ob, "lock_scale", text="", emboss=False, icon='DECORATE_UNLOCKED')
class OBJECT_PT_delta_transform(ObjectButtonsPanel, Panel):

View File

@@ -142,30 +142,34 @@ class RENDER_PT_dimensions(RenderButtonsPanel, Panel):
scene = context.scene
rd = scene.render
col = layout.column(align=True)
col.prop(rd, "resolution_x", text="Resolution X")
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
col = flow.column(align=True)
col.label(text="Resolution")
col.prop(rd, "resolution_x", text="X")
col.prop(rd, "resolution_y", text="Y")
col.prop(rd, "resolution_percentage", text="%")
col = layout.column(align=True)
col.prop(rd, "pixel_aspect_x", text="Aspect X")
col = flow.column(align=True)
col.label(text="Frame Range")
col.prop(scene, "frame_start", text="Start")
col.prop(scene, "frame_end", text="End")
col.prop(scene, "frame_step", text="Step")
col = flow.column(align=True)
col.label(text="Aspect Ratio")
col.prop(rd, "pixel_aspect_x", text="X")
col.prop(rd, "pixel_aspect_y", text="Y")
col = layout.column(align=True)
col = flow.column(align=True)
col.prop(rd, "use_border", text="Border")
sub = col.column(align=True)
sub.active = rd.use_border
sub.prop(rd, "use_crop_to_border", text="Crop")
col = layout.column(align=True)
col.prop(scene, "frame_start", text="Frame Start")
col.prop(scene, "frame_end", text="End")
col.prop(scene, "frame_step", text="Step")
col = layout.split()
col.alignment = 'RIGHT'
col = flow.column(align=True)
col.label(text="Frame Rate")
self.draw_framerate(layout, col, rd)
self.draw_framerate(flow, col, rd)
class RENDER_PT_frame_remapping(RenderButtonsPanel, Panel):
@@ -252,9 +256,9 @@ class RENDER_PT_stamp(RenderButtonsPanel, Panel):
col = flow.column()
col.prop(rd, "use_stamp_strip_meta", text="Use Strip Metadata")
row = layout.split(factor=0.3)
row.prop(rd, "use_stamp_note", text="Note")
sub = row.row()
col = layout.column()
col.prop(rd, "use_stamp_note", text="Note")
sub = col.column()
sub.active = rd.use_stamp_note
sub.prop(rd, "stamp_note_text", text="")

View File

@@ -156,6 +156,7 @@ class USERPREF_PT_interface(Panel):
col.label(text="Development:")
col.prop(view, "show_tooltips_python")
col.prop(view, "show_developer_ui")
col.prop(view, "layout_row_enums")
row = split.row()
row.separator()

View File

@@ -3892,15 +3892,15 @@ class VIEW3D_PT_view3d_properties(Panel):
layout.use_property_split = True
layout.use_property_decorate = False # No animation.
flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
col = flow.column()
col = layout.column()
subcol = col.column()
subcol.active = bool(view.region_3d.view_perspective != 'CAMERA' or view.region_quadviews)
subcol.prop(view, "lens", text="Focal Length")
subcol = col.column(align=True)
subcol.prop(view, "clip_start", text="Clip Start")
subcol.label(text="Clip")
subcol.prop(view, "clip_start", text="Start")
subcol.prop(view, "clip_end", text="End")
subcol.separator()

View File

@@ -993,8 +993,10 @@ void uiLayoutSetScaleX(uiLayout *layout, float scale);
void uiLayoutSetScaleY(uiLayout *layout, float scale);
void uiLayoutSetUnitsX(uiLayout *layout, float unit);
void uiLayoutSetUnitsY(uiLayout *layout, float unit);
void uiLayoutSetSpacing(uiLayout *layout, short spacing);
void uiLayoutSetEmboss(uiLayout *layout, char emboss);
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep);
void uiLayoutSetGroupItems(uiLayout *layout, bool group_items);
void uiLayoutSetPropSingleCol(uiLayout *layout, bool is_sep);
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep);
int uiLayoutGetOperatorContext(uiLayout *layout);
@@ -1008,8 +1010,10 @@ float uiLayoutGetScaleX(uiLayout *layout);
float uiLayoutGetScaleY(uiLayout *layout);
float uiLayoutGetUnitsX(uiLayout *layout);
float uiLayoutGetUnitsY(uiLayout *layout);
short uiLayoutGetSpacing(uiLayout *layout);
int uiLayoutGetEmboss(uiLayout *layout);
bool uiLayoutGetPropSep(uiLayout *layout);
bool uiLayoutGetGroupItems(uiLayout *layout);
bool uiLayoutGetPropSingleCol(uiLayout *layout);
bool uiLayoutGetPropDecorate(uiLayout *layout);
/* layout specifiers */

View File

@@ -67,9 +67,6 @@
/* Show an icon button after each RNA button to use to quickly set keyframes,
* this is a way to display animation/driven/override status, see T54951. */
#define UI_PROP_DECORATE
/* Alternate draw mode where some buttons can use single icon width,
* giving more room for the text at the expense of nicely aligned text. */
#define UI_PROP_SEP_ICON_WIDTH_EXCEPTION
/************************ Structs and Defines *************************/
@@ -80,8 +77,6 @@
return_statement; \
} (void)0 \
#define UI_ITEM_PROP_SEP_DIVIDE 0.5f
/* uiLayoutRoot */
typedef struct uiLayoutRoot {
@@ -139,11 +134,12 @@ enum {
UI_ITEM_MIN = 1 << 1,
UI_ITEM_BOX_ITEM = 1 << 2, /* The item is "inside" a box item */
UI_ITEM_PROP_SEP = 1 << 3,
/* If an item is included in a layout adhering to the new Blender 2.8 single column layout. */
UI_ITEM_PROP_SINGLE_COL = 1 << 3,
/* Show an icon button next to each property (to set keyframes, show status).
* Enabled by default, depends on 'UI_ITEM_PROP_SEP'. */
* Enabled by default, depends on 'UI_ITEM_PROP_SINGLE_COL'. */
UI_ITEM_PROP_DECORATE = 1 << 4,
UI_ITEM_PROP_DECORATE_NO_PAD = 1 << 5,
};
typedef struct uiButtonItem {
@@ -436,7 +432,8 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index)
static void ui_item_array(
uiLayout *layout, uiBlock *block, const char *name, int icon,
PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int UNUSED(h),
bool expand, bool slider, bool toggle, bool icon_only, bool compact, bool show_text)
bool expand, bool slider, bool toggle, bool icon_only, bool compact,
bool show_embedded_text, bool show_prop_name)
{
uiStyle *style = layout->root->style;
uiBut *but;
@@ -453,7 +450,7 @@ static void ui_item_array(
UI_block_layout_set_current(block, sub);
/* create label */
if (name[0] && show_text) {
if (name && name[0] && show_prop_name) {
uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
}
@@ -573,7 +570,7 @@ static void ui_item_array(
/* layout for known array subtypes */
char str[3] = {'\0'};
if (!icon_only && show_text) {
if (!icon_only && show_embedded_text) {
if (type != PROP_BOOLEAN) {
str[1] = ':';
}
@@ -585,11 +582,11 @@ static void ui_item_array(
RNA_property_boolean_get_array(ptr, prop, boolarr);
}
const char *str_buf = show_text ? str: "";
const char *str_buf = show_embedded_text ? str: "";
for (a = 0; a < len; a++) {
int width_item;
if (!icon_only && show_text) {
if (!icon_only && show_embedded_text) {
str[0] = RNA_property_array_item_char(prop, a);
}
if (boolarr) {
@@ -640,6 +637,7 @@ static void ui_item_enum_expand(
uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop,
const char *uiname, int h, bool icon_only)
{
/* XXX Maybe now is the time! */
/* XXX The way this function currently handles uiname parameter is insane and inconsistent with general UI API:
* * uiname is the *enum property* label.
* * when it is NULL or empty, we do not draw *enum items* labels, this doubles the icon_only parameter.
@@ -655,6 +653,7 @@ static void ui_item_enum_expand(
int itemw, icon, value;
bool free;
bool radial = (layout->root->type == UI_LAYOUT_PIEMENU);
const bool single_col = ((layout->item.flag & UI_ITEM_PROP_SINGLE_COL) != 0);
if (radial)
RNA_property_enum_items_gettexted_all(block->evil_C, ptr, prop, &item_array, NULL, &free);
@@ -695,7 +694,10 @@ static void ui_item_enum_expand(
continue;
}
name = (!uiname || uiname[0]) ? item->name : "";
if (single_col)
name = icon_only ? "" : item->name ;
else
name = (!uiname || uiname[0]) ? item->name : "";
icon = item->icon;
value = item->value;
itemw = ui_text_icon_width(block->curlayout, icon_only ? "" : name, icon, 0);
@@ -748,7 +750,6 @@ static uiBut *ui_item_with_label(
PropertyType type;
PropertySubType subtype;
int prop_but_width = w_hint;
const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0);
/* Always align item with label since text is already given enough space not to overlap. */
sub = uiLayoutRow(layout, true);
@@ -757,25 +758,16 @@ static uiBut *ui_item_with_label(
if (name[0]) {
int w_label;
if (use_prop_sep) {
w_label = (int)((w_hint * 2) * UI_ITEM_PROP_SEP_DIVIDE);
if (ui_layout_variable_size(layout)) {
/* w_hint is width for label in this case. Use a default width for property button(s) */
prop_but_width = UI_UNIT_X * 5;
w_label = w_hint;
}
else {
if (ui_layout_variable_size(layout)) {
/* w_hint is width for label in this case. Use a default width for property button(s) */
prop_but_width = UI_UNIT_X * 5;
w_label = w_hint;
}
else {
w_label = w_hint / 3;
}
w_label = w_hint / 3;
}
uiBut *but_label = uiDefBut(block, UI_BTYPE_LABEL, 0, name, x, y, w_label, h, NULL, 0.0, 0.0, 0, 0, "");
if (use_prop_sep) {
but_label->drawflag |= UI_BUT_TEXT_RIGHT;
but_label->drawflag &= ~UI_BUT_TEXT_LEFT;
}
uiDefBut(block, UI_BTYPE_LABEL, 0, name, x, y, w_label, h, NULL, 0.0, 0.0, 0, 0, "");
}
type = RNA_property_type(prop);
@@ -812,17 +804,6 @@ static uiBut *ui_item_with_label(
x, y, prop_but_width, h);
}
#ifdef UI_PROP_DECORATE
/* Only for alignment. */
if (layout->item.flag & UI_ITEM_PROP_SEP) {
if ((layout->item.flag & UI_ITEM_PROP_DECORATE) &&
(layout->item.flag & UI_ITEM_PROP_DECORATE_NO_PAD) == 0)
{
uiItemL(sub, NULL, ICON_BLANK1);
}
}
#endif /* UI_PROP_DECORATE */
UI_block_layout_set_current(block, layout);
return but;
}
@@ -1487,7 +1468,7 @@ static void ui_item_rna_size(
if (index == RNA_NO_INDEX && len > 0) {
if (!name[0] && icon == ICON_NONE)
h = 0;
if (layout->item.flag & UI_ITEM_PROP_SEP)
if (layout->item.flag & UI_ITEM_PROP_SINGLE_COL)
h = 0;
if (ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER))
h += 2 * UI_UNIT_Y;
@@ -1513,76 +1494,61 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
{
uiBlock *block = layout->root->block;
uiBut *but = NULL;
PropertyType type;
char namestr[UI_MAX_NAME_STR];
int len, w, h;
bool slider, toggle, expand, icon_only, no_bg, compact;
bool is_array;
const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0);
/* Retrive property information. */
const PropertyType type = RNA_property_type(prop);
const int prop_flag = RNA_property_flag(prop);
const bool slider = (flag & UI_ITEM_R_SLIDER) != 0;
const bool toggle = (flag & UI_ITEM_R_TOGGLE) != 0;
const bool expand = (flag & UI_ITEM_R_EXPAND) != 0;
const bool icon_only = (flag & UI_ITEM_R_ICON_ONLY) != 0;
const bool no_bg = (flag & UI_ITEM_R_NO_BG) != 0;
const bool compact = (flag & UI_ITEM_R_COMPACT) != 0;
const bool is_array = RNA_property_array_check(prop);
const int array_len = (is_array) ? RNA_property_array_length(ptr, prop) : 0;
/* If this item is included in a layout adhering to the new Blender 2.8 single column layout. */
const bool single_col = ((layout->item.flag & UI_ITEM_PROP_SINGLE_COL) != 0);
const bool can_have_embedded_text = ELEM(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER);
#ifdef UI_PROP_DECORATE
struct {
bool use_prop_decorate;
bool use_prop_decorate; /* If this property should have an animation decorator. */
int len;
uiLayout *layout;
uiBut *but;
} ui_decorate = {
.use_prop_decorate = (
((layout->item.flag & UI_ITEM_PROP_DECORATE) != 0) &&
(use_prop_sep && ptr->id.data && id_can_have_animdata(ptr->id.data))),
((layout->item.flag & UI_ITEM_PROP_DECORATE) != 0) &&
(ptr->id.data && id_can_have_animdata(ptr->id.data)) &&
single_col),
};
#endif /* UI_PROP_DECORATE */
UI_block_layout_set_current(block, layout);
/* retrieve info */
type = RNA_property_type(prop);
is_array = RNA_property_array_check(prop);
len = (is_array) ? RNA_property_array_length(ptr, prop) : 0;
/* set name and icon */
if (!name) {
if ((flag & UI_ITEM_R_ICON_ONLY) == 0) {
name = RNA_property_ui_name(prop);
}
else {
name = "";
}
}
/* Set the icon for this item. */
if (icon == ICON_NONE)
icon = RNA_property_ui_icon(prop);
if (flag & UI_ITEM_R_ICON_ONLY) {
/* pass */
/* Set the display name (label) for this item. */
if (!name && !icon_only) {
/* No name suplied: use the defined name for this property. */
name = RNA_property_ui_name(prop);
}
else if (ELEM(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER)) {
if (use_prop_sep == false) {
name = ui_item_name_add_colon(name, namestr);
}
/* Adjust the display name depending on how the item will be displayed. */
if (icon_only || (type == PROP_ENUM && index != RNA_ENUM_VALUE && compact)) {
name = "";
}
else if (type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX) {
if (use_prop_sep == false) {
name = ui_item_name_add_colon(name, namestr);
}
}
else if (type == PROP_ENUM && index != RNA_ENUM_VALUE) {
if (flag & UI_ITEM_R_COMPACT) {
name = "";
}
else {
if (use_prop_sep == false) {
name = ui_item_name_add_colon(name, namestr);
}
}
else if (can_have_embedded_text) {
name = ui_item_name_add_colon(name, namestr);
}
/* menus and pie-menus don't show checkbox without this */
if ((layout->root->type == UI_LAYOUT_MENU) ||
/* use checkboxes only as a fallback in pie-menu's, when no icon is defined */
((layout->root->type == UI_LAYOUT_PIEMENU) && (icon == ICON_NONE)))
{
int prop_flag = RNA_property_flag(prop);
if (type == PROP_BOOLEAN && ((is_array == false) || (index != RNA_NO_INDEX))) {
if (prop_flag & PROP_ICONS_CONSECUTIVE) {
icon = ICON_CHECKBOX_DEHLT; /* but->iconadd will set to correct icon */
@@ -1608,135 +1574,72 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
}
}
if ((type == PROP_ENUM) && (RNA_property_flag(prop) & PROP_ENUM_FLAG)) {
flag |= UI_ITEM_R_EXPAND;
}
slider = (flag & UI_ITEM_R_SLIDER) != 0;
toggle = (flag & UI_ITEM_R_TOGGLE) != 0;
expand = (flag & UI_ITEM_R_EXPAND) != 0;
icon_only = (flag & UI_ITEM_R_ICON_ONLY) != 0;
no_bg = (flag & UI_ITEM_R_NO_BG) != 0;
compact = (flag & UI_ITEM_R_COMPACT) != 0;
/* get size */
/* Get the size for this item. */
int w, h;
ui_item_rna_size(layout, name, icon, ptr, prop, index, icon_only, compact, &w, &h);
int prev_emboss = layout->emboss;
if (no_bg) {
layout->emboss = UI_EMBOSS_NONE;
}
/* Split the label / property. */
if (use_prop_sep) {
uiLayout *layout_row = NULL;
#ifdef UI_PROP_DECORATE
/* For the new single-column layout in 2.8:
- Add a label with the property's name on top of the control for the value, depending on the property type.
- Add the animation decorator, if the property supports it.
*/
bool label_on_top = false;
if (single_col)
{
/* Should this property be displayed as an array of subproperties? */
const PropertySubType subtype = RNA_property_subtype(prop);
const bool should_display_array = ((index == RNA_NO_INDEX && is_array) &&
((!expand && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA, PROP_DIRECTION)) == 0));
/* Decide if this item should have the label on top of the control or embedded in it. */
/* property with separate label */
label_on_top = should_display_array || type == PROP_STRING || type == PROP_POINTER ||
(type == PROP_ENUM && ((U.flag & TEMP_USER_PROP_1LINE_ENUM) == 0) || expand);
if (label_on_top) {
/* Display a label with the property name. */
if (name && name[0] != '\0') {
layout = uiLayoutColumn(layout, true);
but = uiDefBut(
block, UI_BTYPE_LABEL, 0, name,
0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
but->drawflag |= UI_BUT_TEXT_LEFT;
but->drawflag &= ~UI_BUT_TEXT_RIGHT;
}
/* Don't show the display name in the value control
(Note: string must exist or it might be created later). */
name = "";
}
#ifdef UI_PROP_DECORATE
if (ui_decorate.use_prop_decorate) {
layout_row = uiLayoutRow(layout, true);
/* Make a row to set the value on the left and the animation decorator on the right.
For arrays, the sub-properties are arranged in a colunm inside this row. */
uiLayout *layout_row = uiLayoutRow(layout, false);
/* Don't align the property controller with the animation decorator in order to
show rounded corners, but remove the spacing. */
layout_row->space = 0;
ui_decorate.len = max_ii(1, len);
}
#endif /* UI_PROP_DECORATE */
if (name[0] == '\0') {
/* Ensure we get a column when text is not set. */
layout = uiLayoutColumn(layout_row ? layout_row : layout, true);
layout->space = 0;
}
else {
const PropertySubType subtype = RNA_property_subtype(prop);
uiLayout *layout_split;
#ifdef UI_PROP_SEP_ICON_WIDTH_EXCEPTION
if (type == PROP_BOOLEAN && (icon == ICON_NONE) && !icon_only) {
layout_split = uiLayoutRow(layout_row ? layout_row : layout, true);
}
else
#endif /* UI_PROP_SEP_ICON_WIDTH_EXCEPTION */
{
layout_split = uiLayoutSplit(
layout_row ? layout_row : layout,
UI_ITEM_PROP_SEP_DIVIDE, true);
}
layout_split->space = 0;
uiLayout *layout_sub = uiLayoutColumn(layout_split, true);
layout_sub->space = 0;
if ((index == RNA_NO_INDEX && is_array) &&
((!expand && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA, PROP_DIRECTION)) == 0))
{
char name_with_suffix[UI_MAX_DRAW_STR + 2];
char str[2] = {'\0'};
for (int a = 0; a < len; a++) {
str[0] = RNA_property_array_item_char(prop, a);
const bool use_prefix = (a == 0 && name && name[0]);
if (use_prefix) {
char *s = name_with_suffix;
s += STRNCPY_RLEN(name_with_suffix, name);
*s++ = ' ';
*s++ = str[0];
*s++ = '\0';
}
but = uiDefBut(
block, UI_BTYPE_LABEL, 0, use_prefix ? name_with_suffix : str,
0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
but->drawflag |= UI_BUT_TEXT_RIGHT;
but->drawflag &= ~UI_BUT_TEXT_LEFT;
}
}
else {
if (name) {
but = uiDefBut(
block, UI_BTYPE_LABEL, 0, name,
0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
but->drawflag |= UI_BUT_TEXT_RIGHT;
but->drawflag &= ~UI_BUT_TEXT_LEFT;
}
}
/* Watch out! We can only write into the new layout now. */
if ((type == PROP_ENUM) && (flag & UI_ITEM_R_EXPAND)) {
/* Expanded enums each have their own name. */
/* Often expanded enum's are better arranged into a row, so check the existing layout. */
if (ui_layout_local_dir(layout) == UI_LAYOUT_HORIZONTAL) {
layout = uiLayoutRow(layout_split, true);
}
else {
layout = uiLayoutColumn(layout_split, true);
}
}
else {
name = "";
layout = uiLayoutColumn(layout_split, true);
}
layout->space = 0;
#ifdef UI_PROP_SEP_ICON_WIDTH_EXCEPTION
if (type == PROP_BOOLEAN && (icon == ICON_NONE) && !icon_only) {
w = UI_UNIT_X;
}
#endif /* UI_PROP_SEP_ICON_WIDTH_EXCEPTION */
}
#ifdef UI_PROP_DECORATE
if (ui_decorate.use_prop_decorate) {
ui_decorate.layout = uiLayoutColumn(layout_row, true);
ui_decorate.layout->space = 0;
UI_block_layout_set_current(block, layout);
uiLayout *layout_value = uiLayoutColumn(layout_row, true);
uiLayout *layout_decor = uiLayoutColumn(layout_row, true);
ui_decorate.layout = layout_decor;
ui_decorate.len = max_ii(1, array_len);
ui_decorate.but = block->buttons.last;
/* Clear after. */
layout->item.flag |= UI_ITEM_PROP_DECORATE_NO_PAD;
/* Set the active layout to put the value control in. */
UI_block_layout_set_current(block, layout_value);
layout = layout_value;
}
#endif /* UI_PROP_DECORATE */
#endif /* UI_PROP_DECORATE */
}
/* End split. */
/* array property */
if (index == RNA_NO_INDEX && is_array) {
ui_item_array(
layout, block, name, icon, ptr, prop, len, 0, 0, w, h,
expand, slider, toggle, icon_only, compact, !use_prop_sep);
layout, block, name, icon, ptr, prop, array_len, 0, 0, w, h,
expand, slider, toggle, icon_only, compact, true, !single_col);
}
/* enum item */
else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) {
@@ -1749,7 +1652,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
}
/* expanded enum */
else if (type == PROP_ENUM && expand) {
ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only);
ui_item_enum_expand(single_col ? uiLayoutRow(layout, true) : layout, block, ptr, prop, name, h, icon_only);
}
/* property with separate label */
else if (type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
@@ -1778,13 +1681,17 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
UI_but_flag_enable(but, UI_BUT_LIST_ITEM);
}
#ifdef UI_PROP_DECORATE
#ifdef UI_PROP_DECORATE
if (ui_decorate.use_prop_decorate) {
const bool is_anim = RNA_property_animateable(ptr, prop);
/* Set the active layout to the one saved earlier. */
uiLayout *layout_decor = ui_decorate.layout;
layout_decor->emboss = UI_EMBOSS_NONE;
UI_block_layout_set_current(block, layout_decor);
/* Create a button for the decorator and associate it with the property or subprop it controls. */
uiBut *but_decorate = ui_decorate.but ? ui_decorate.but->next : block->buttons.first;
uiLayout *layout_col = uiLayoutColumn(ui_decorate.layout, false);
layout_col->space = 0;
layout_col->emboss = UI_EMBOSS_NONE;
int i;
for (i = 0; i < ui_decorate.len && but_decorate; i++) {
/* The icons are set in 'ui_but_anim_flag' */
@@ -1809,16 +1716,10 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
but_decorate = but->next;
}
BLI_assert(ELEM(i, 1, ui_decorate.len));
layout->item.flag &= ~UI_ITEM_PROP_DECORATE_NO_PAD;
}
#endif /* UI_PROP_DECORATE */
#endif /* UI_PROP_DECORATE */
if (no_bg) {
layout->emboss = prev_emboss;
}
/* ensure text isn't added to icon_only buttons */
/* Ensure text isn't added to icon_only buttons. */
if (but && icon_only) {
BLI_assert(but->str[0] == '\0');
}
@@ -2069,7 +1970,8 @@ void uiItemPointerR_prop(
StructRNA *icontype;
int w, h;
char namestr[UI_MAX_NAME_STR];
const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0);
const bool single_col = ((layout->item.flag & UI_ITEM_PROP_SINGLE_COL) != 0);
type = RNA_property_type(prop);
if (!ELEM(type, PROP_POINTER, PROP_STRING, PROP_ENUM)) {
@@ -2095,9 +1997,8 @@ void uiItemPointerR_prop(
if (!name)
name = RNA_property_ui_name(prop);
if (use_prop_sep == false) {
if (!single_col)
name = ui_item_name_add_colon(name, namestr);
}
/* create button */
block = uiLayoutGetBlock(layout);
@@ -3607,7 +3508,7 @@ static void ui_litem_init_from_parent(uiLayout *litem, uiLayout *layout, int ali
litem->redalert = layout->redalert;
litem->w = layout->w;
litem->emboss = layout->emboss;
litem->item.flag = (layout->item.flag & (UI_ITEM_PROP_SEP | UI_ITEM_PROP_DECORATE));
litem->item.flag = (layout->item.flag & (UI_ITEM_PROP_SINGLE_COL | UI_ITEM_PROP_DECORATE));
BLI_addtail(&layout->items, litem);
}
@@ -3867,24 +3768,19 @@ void uiLayoutSetUnitsY(uiLayout *layout, float unit)
layout->units[1] = unit;
}
void uiLayoutSetSpacing(uiLayout *layout, short spacing)
{
layout->space = spacing;
}
void uiLayoutSetEmboss(uiLayout *layout, char emboss)
{
layout->emboss = emboss;
}
bool uiLayoutGetPropSep(uiLayout *layout)
void uiLayoutSetPropSingleCol(uiLayout *layout, bool is_sep)
{
return (layout->item.flag & UI_ITEM_PROP_SEP) != 0;
}
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
{
SET_FLAG_FROM_TEST(layout->item.flag, is_sep, UI_ITEM_PROP_SEP);
}
bool uiLayoutGetPropDecorate(uiLayout *layout)
{
return (layout->item.flag & UI_ITEM_PROP_DECORATE) != 0;
SET_FLAG_FROM_TEST(layout->item.flag, is_sep, UI_ITEM_PROP_SINGLE_COL);
}
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
@@ -3942,6 +3838,11 @@ float uiLayoutGetUnitsY(uiLayout *layout)
return layout->units[1];
}
short uiLayoutGetSpacing(uiLayout *layout)
{
return layout->space;
}
int uiLayoutGetEmboss(uiLayout *layout)
{
if (layout->emboss == UI_EMBOSS_UNDEFINED) {
@@ -3952,6 +3853,16 @@ int uiLayoutGetEmboss(uiLayout *layout)
}
}
bool uiLayoutGetPropSingleCol(uiLayout *layout)
{
return (layout->item.flag & UI_ITEM_PROP_SINGLE_COL) != 0;
}
bool uiLayoutGetPropDecorate(uiLayout *layout)
{
return (layout->item.flag & UI_ITEM_PROP_DECORATE) != 0;
}
/********************** Layout *******************/
static void ui_item_scale(uiLayout *litem, const float scale[2])
@@ -4217,7 +4128,7 @@ uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int s
layout = MEM_callocN(sizeof(uiLayout), "uiLayout");
layout->item.type = ITEM_LAYOUT_ROOT;
/* Only used when 'UI_ITEM_PROP_SEP' is set. */
/* Only used when 'UI_ITEM_PROP_SINGLE_COL' is set. */
layout->item.flag = UI_ITEM_PROP_DECORATE;
layout->x = x;

View File

@@ -4338,7 +4338,7 @@ eAutoPropButsReturn uiTemplateOperatorPropertyButs(
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropSingleCol(layout, true);
/* main draw call */
return_info = uiDefAutoButsRNA(

View File

@@ -1943,7 +1943,12 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
drawstr_right = strchr(drawstr + but->ofs, ':');
if (drawstr_right) {
drawstr_right++;
#define UI_PROP_DONT_SHOW_COLONS
#ifdef UI_PROP_DONT_SHOW_COLONS
drawstr_left_len = (drawstr_right-1 - drawstr);
#else
drawstr_left_len = (drawstr_right - drawstr);
#endif
while (*drawstr_right == ' ') {
drawstr_right++;

View File

@@ -4950,8 +4950,8 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "SCREEN_OT_repeat_history", RKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_verify_item(keymap, "SCREEN_OT_region_flip", F5KEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "SCREEN_OT_redo_last", F6KEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "SCRIPT_OT_reload", F8KEY, KM_PRESS, 0, 0);
#endif
WM_keymap_verify_item(keymap, "SCRIPT_OT_reload", F8KEY, KM_PRESS, 0, 0);
/* files */
WM_keymap_add_item(keymap, "FILE_OT_execute", RETKEY, KM_PRESS, 0, 0);

View File

@@ -1059,7 +1059,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, bool color_ma
col = uiLayoutColumn(layout, false);
uiLayoutSetPropSep(col, true);
uiLayoutSetPropSingleCol(col, true);
uiLayoutSetPropDecorate(col, false);
uiItemR(col, imfptr, "file_format", 0, NULL, ICON_NONE);
@@ -1183,7 +1183,7 @@ static void uiTemplateViewsFormat(uiLayout *layout, PointerRNA *ptr, PointerRNA
col = uiLayoutColumn(layout, false);
uiLayoutSetPropSep(col, true);
uiLayoutSetPropSingleCol(col, true);
uiLayoutSetPropDecorate(col, false);
uiItemR(col, ptr, "views_format", UI_ITEM_R_EXPAND, NULL, ICON_NONE);

View File

@@ -926,6 +926,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
uiLayout *split, *colsub;
split = uiLayoutSplit(layout, 0.8f, false);
uiLayoutSetSpacing(split, 0);
if (ptr->type == &RNA_PoseBone) {
PointerRNA boneptr;
@@ -943,6 +944,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
uiItemR(colsub, ptr, "lock_location", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_DECORATE_UNLOCKED);
split = uiLayoutSplit(layout, 0.8f, false);
uiLayoutSetSpacing(split, 0);
switch (RNA_enum_get(ptr, "rotation_mode")) {
case ROT_MODE_QUAT: /* quaternion */
@@ -981,6 +983,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "rotation_mode", 0, "", ICON_NONE);
split = uiLayoutSplit(layout, 0.8f, false);
uiLayoutSetSpacing(split, 0);
colsub = uiLayoutColumn(split, true);
uiItemR(colsub, ptr, "scale", 0, NULL, ICON_NONE);
colsub = uiLayoutColumn(split, true);

View File

@@ -708,6 +708,7 @@ typedef enum eUserPref_Flag {
USER_NONEGFRAMES = (1 << 24),
USER_TXT_TABSTOSPACES_DISABLE = (1 << 25),
USER_TOOLTIPS_PYTHON = (1 << 26),
TEMP_USER_PROP_1LINE_ENUM = (1 << 27),
} eUserPref_Flag;
/* bPathCompare.flag */

View File

@@ -985,12 +985,12 @@ static void rna_UILayout_emboss_set(PointerRNA *ptr, int value)
static bool rna_UILayout_property_split_get(PointerRNA *ptr)
{
return uiLayoutGetPropSep(ptr->data);
return uiLayoutGetPropSingleCol(ptr->data);
}
static void rna_UILayout_property_split_set(PointerRNA *ptr, bool value)
{
uiLayoutSetPropSep(ptr->data, value);
uiLayoutSetPropSingleCol(ptr->data, value);
}
static bool rna_UILayout_property_decorate_get(PointerRNA *ptr)

View File

@@ -113,8 +113,15 @@ static void rna_uiItemR(
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
/* Enum properties that allow multiple values to be selected should be expanded. */
if ((RNA_property_type(prop) == PROP_ENUM) && (RNA_property_flag(prop) & PROP_ENUM_FLAG) && !expand) {
RNA_warning("expand was false for multi value enum %s.%s", RNA_struct_identifier(ptr->type), propname);
expand = true;
}
/* Compose the flag. */
flag |= (slider) ? UI_ITEM_R_SLIDER : 0;
flag |= (expand) ? UI_ITEM_R_EXPAND : 0;
flag |= (expand ) ? UI_ITEM_R_EXPAND : 0;
flag |= (toggle) ? UI_ITEM_R_TOGGLE : 0;
flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
flag |= (event) ? UI_ITEM_R_EVENT : 0;
@@ -709,6 +716,7 @@ void RNA_api_ui_layout(StructRNA *srna)
api_ui_item_common(func);
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
RNA_def_property_ui_text(parm, "Group Following Items", "XXX");
func = RNA_def_function(srna, "menu", "rna_uiItemM");
parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");

View File

@@ -3595,6 +3595,11 @@ static void rna_def_userdef_view(BlenderRNA *brna)
prop, "Developer Extras",
"Show options for developers (edit source in context menu, geometry indices)");
prop = RNA_def_property(srna, "layout_row_enums", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", TEMP_USER_PROP_1LINE_ENUM);
RNA_def_property_ui_text(prop, "UI Layout: 1 line enums",
"Show enums with the label and the options list in a row instead of a column");
prop = RNA_def_property(srna, "show_object_info", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DRAWVIEWINFO);
RNA_def_property_ui_text(prop, "Display Object Info", "Display objects name and frame number in 3D view");