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': if mps.type == 'CURRENT_FRAME':
col = layout.column(align=True) 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_after", text="After")
col.prop(mps, "frame_step", text="Step") col.prop(mps, "frame_step", text="Step")
elif mps.type == 'RANGE': elif mps.type == 'RANGE':
@@ -55,7 +56,8 @@ class MotionPathButtonsPanel:
else: else:
sub.operator("object.paths_range_update", text="", icon='TIME') sub.operator("object.paths_range_update", text="", icon='TIME')
sub = row.column(align=True) 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_end", text="End")
sub.prop(mps, "frame_step", text="Step") sub.prop(mps, "frame_step", text="Step")
@@ -63,9 +65,11 @@ class MotionPathButtonsPanel:
col = layout.column(align=True) col = layout.column(align=True)
col.enabled = False col.enabled = False
if bones: if bones:
col.prop(mpath, "frame_start", text="Bone Cache From") col.label(text="Bone Cache")
col.prop(mpath, "frame_start", text="From")
else: 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") col.prop(mpath, "frame_end", text="To")
row = layout.row(align=True) row = layout.row(align=True)

View File

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

View File

@@ -142,30 +142,34 @@ class RENDER_PT_dimensions(RenderButtonsPanel, Panel):
scene = context.scene scene = context.scene
rd = scene.render rd = scene.render
col = layout.column(align=True) flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
col.prop(rd, "resolution_x", text="Resolution X")
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_y", text="Y")
col.prop(rd, "resolution_percentage", text="%") col.prop(rd, "resolution_percentage", text="%")
col = layout.column(align=True) col = flow.column(align=True)
col.prop(rd, "pixel_aspect_x", text="Aspect X") 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.prop(rd, "pixel_aspect_y", text="Y")
col = layout.column(align=True) col = flow.column(align=True)
col.prop(rd, "use_border", text="Border") col.prop(rd, "use_border", text="Border")
sub = col.column(align=True) sub = col.column(align=True)
sub.active = rd.use_border sub.active = rd.use_border
sub.prop(rd, "use_crop_to_border", text="Crop") sub.prop(rd, "use_crop_to_border", text="Crop")
col = layout.column(align=True) col = flow.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.label(text="Frame Rate") col.label(text="Frame Rate")
self.draw_framerate(layout, col, rd) self.draw_framerate(flow, col, rd)
class RENDER_PT_frame_remapping(RenderButtonsPanel, Panel): class RENDER_PT_frame_remapping(RenderButtonsPanel, Panel):
@@ -252,9 +256,9 @@ class RENDER_PT_stamp(RenderButtonsPanel, Panel):
col = flow.column() col = flow.column()
col.prop(rd, "use_stamp_strip_meta", text="Use Strip Metadata") col.prop(rd, "use_stamp_strip_meta", text="Use Strip Metadata")
row = layout.split(factor=0.3) col = layout.column()
row.prop(rd, "use_stamp_note", text="Note") col.prop(rd, "use_stamp_note", text="Note")
sub = row.row() sub = col.column()
sub.active = rd.use_stamp_note sub.active = rd.use_stamp_note
sub.prop(rd, "stamp_note_text", text="") sub.prop(rd, "stamp_note_text", text="")

View File

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

View File

@@ -3892,15 +3892,15 @@ class VIEW3D_PT_view3d_properties(Panel):
layout.use_property_split = True layout.use_property_split = True
layout.use_property_decorate = False # No animation. 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 = layout.column()
col = flow.column()
subcol = col.column() subcol = col.column()
subcol.active = bool(view.region_3d.view_perspective != 'CAMERA' or view.region_quadviews) subcol.active = bool(view.region_3d.view_perspective != 'CAMERA' or view.region_quadviews)
subcol.prop(view, "lens", text="Focal Length") subcol.prop(view, "lens", text="Focal Length")
subcol = col.column(align=True) 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.prop(view, "clip_end", text="End")
subcol.separator() subcol.separator()

View File

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

View File

@@ -67,9 +67,6 @@
/* Show an icon button after each RNA button to use to quickly set keyframes, /* 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. */ * this is a way to display animation/driven/override status, see T54951. */
#define UI_PROP_DECORATE #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 *************************/ /************************ Structs and Defines *************************/
@@ -80,8 +77,6 @@
return_statement; \ return_statement; \
} (void)0 \ } (void)0 \
#define UI_ITEM_PROP_SEP_DIVIDE 0.5f
/* uiLayoutRoot */ /* uiLayoutRoot */
typedef struct uiLayoutRoot { typedef struct uiLayoutRoot {
@@ -139,11 +134,12 @@ enum {
UI_ITEM_MIN = 1 << 1, UI_ITEM_MIN = 1 << 1,
UI_ITEM_BOX_ITEM = 1 << 2, /* The item is "inside" a box item */ 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). /* 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 = 1 << 4,
UI_ITEM_PROP_DECORATE_NO_PAD = 1 << 5,
}; };
typedef struct uiButtonItem { 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( static void ui_item_array(
uiLayout *layout, uiBlock *block, const char *name, int icon, uiLayout *layout, uiBlock *block, const char *name, int icon,
PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int UNUSED(h), 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; uiStyle *style = layout->root->style;
uiBut *but; uiBut *but;
@@ -453,7 +450,7 @@ static void ui_item_array(
UI_block_layout_set_current(block, sub); UI_block_layout_set_current(block, sub);
/* create label */ /* 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, ""); 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 */ /* layout for known array subtypes */
char str[3] = {'\0'}; char str[3] = {'\0'};
if (!icon_only && show_text) { if (!icon_only && show_embedded_text) {
if (type != PROP_BOOLEAN) { if (type != PROP_BOOLEAN) {
str[1] = ':'; str[1] = ':';
} }
@@ -585,11 +582,11 @@ static void ui_item_array(
RNA_property_boolean_get_array(ptr, prop, boolarr); 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++) { for (a = 0; a < len; a++) {
int width_item; int width_item;
if (!icon_only && show_text) { if (!icon_only && show_embedded_text) {
str[0] = RNA_property_array_item_char(prop, a); str[0] = RNA_property_array_item_char(prop, a);
} }
if (boolarr) { if (boolarr) {
@@ -640,6 +637,7 @@ static void ui_item_enum_expand(
uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop,
const char *uiname, int h, bool icon_only) 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: /* XXX The way this function currently handles uiname parameter is insane and inconsistent with general UI API:
* * uiname is the *enum property* label. * * 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. * * 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; int itemw, icon, value;
bool free; bool free;
bool radial = (layout->root->type == UI_LAYOUT_PIEMENU); bool radial = (layout->root->type == UI_LAYOUT_PIEMENU);
const bool single_col = ((layout->item.flag & UI_ITEM_PROP_SINGLE_COL) != 0);
if (radial) if (radial)
RNA_property_enum_items_gettexted_all(block->evil_C, ptr, prop, &item_array, NULL, &free); RNA_property_enum_items_gettexted_all(block->evil_C, ptr, prop, &item_array, NULL, &free);
@@ -695,6 +694,9 @@ static void ui_item_enum_expand(
continue; continue;
} }
if (single_col)
name = icon_only ? "" : item->name ;
else
name = (!uiname || uiname[0]) ? item->name : ""; name = (!uiname || uiname[0]) ? item->name : "";
icon = item->icon; icon = item->icon;
value = item->value; value = item->value;
@@ -748,7 +750,6 @@ static uiBut *ui_item_with_label(
PropertyType type; PropertyType type;
PropertySubType subtype; PropertySubType subtype;
int prop_but_width = w_hint; 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. */ /* Always align item with label since text is already given enough space not to overlap. */
sub = uiLayoutRow(layout, true); sub = uiLayoutRow(layout, true);
@@ -757,10 +758,6 @@ static uiBut *ui_item_with_label(
if (name[0]) { if (name[0]) {
int w_label; int w_label;
if (use_prop_sep) {
w_label = (int)((w_hint * 2) * UI_ITEM_PROP_SEP_DIVIDE);
}
else {
if (ui_layout_variable_size(layout)) { if (ui_layout_variable_size(layout)) {
/* w_hint is width for label in this case. Use a default width for property button(s) */ /* w_hint is width for label in this case. Use a default width for property button(s) */
prop_but_width = UI_UNIT_X * 5; prop_but_width = UI_UNIT_X * 5;
@@ -769,13 +766,8 @@ static uiBut *ui_item_with_label(
else { 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, ""); 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;
}
} }
type = RNA_property_type(prop); type = RNA_property_type(prop);
@@ -812,17 +804,6 @@ static uiBut *ui_item_with_label(
x, y, prop_but_width, h); 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); UI_block_layout_set_current(block, layout);
return but; return but;
} }
@@ -1487,7 +1468,7 @@ static void ui_item_rna_size(
if (index == RNA_NO_INDEX && len > 0) { if (index == RNA_NO_INDEX && len > 0) {
if (!name[0] && icon == ICON_NONE) if (!name[0] && icon == ICON_NONE)
h = 0; h = 0;
if (layout->item.flag & UI_ITEM_PROP_SEP) if (layout->item.flag & UI_ITEM_PROP_SINGLE_COL)
h = 0; h = 0;
if (ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) if (ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER))
h += 2 * UI_UNIT_Y; h += 2 * UI_UNIT_Y;
@@ -1513,76 +1494,61 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
{ {
uiBlock *block = layout->root->block; uiBlock *block = layout->root->block;
uiBut *but = NULL; uiBut *but = NULL;
PropertyType type;
char namestr[UI_MAX_NAME_STR]; char namestr[UI_MAX_NAME_STR];
int len, w, h; /* Retrive property information. */
bool slider, toggle, expand, icon_only, no_bg, compact; const PropertyType type = RNA_property_type(prop);
bool is_array; const int prop_flag = RNA_property_flag(prop);
const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0); 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 #ifdef UI_PROP_DECORATE
struct { struct {
bool use_prop_decorate; bool use_prop_decorate; /* If this property should have an animation decorator. */
int len; int len;
uiLayout *layout; uiLayout *layout;
uiBut *but; uiBut *but;
} ui_decorate = { } ui_decorate = {
.use_prop_decorate = ( .use_prop_decorate = (
((layout->item.flag & UI_ITEM_PROP_DECORATE) != 0) && ((layout->item.flag & UI_ITEM_PROP_DECORATE) != 0) &&
(use_prop_sep && ptr->id.data && id_can_have_animdata(ptr->id.data))), (ptr->id.data && id_can_have_animdata(ptr->id.data)) &&
single_col),
}; };
#endif /* UI_PROP_DECORATE */ #endif /* UI_PROP_DECORATE */
UI_block_layout_set_current(block, layout); UI_block_layout_set_current(block, layout);
/* retrieve info */ /* Set the icon for this item. */
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 = "";
}
}
if (icon == ICON_NONE) if (icon == ICON_NONE)
icon = RNA_property_ui_icon(prop); icon = RNA_property_ui_icon(prop);
if (flag & UI_ITEM_R_ICON_ONLY) { /* Set the display name (label) for this item. */
/* pass */ 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)) { /* Adjust the display name depending on how the item will be displayed. */
if (use_prop_sep == false) { if (icon_only || (type == PROP_ENUM && index != RNA_ENUM_VALUE && compact)) {
name = ui_item_name_add_colon(name, namestr);
}
}
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 = ""; name = "";
} }
else { else if (can_have_embedded_text) {
if (use_prop_sep == false) {
name = ui_item_name_add_colon(name, namestr); name = ui_item_name_add_colon(name, namestr);
} }
}
}
/* menus and pie-menus don't show checkbox without this */ /* menus and pie-menus don't show checkbox without this */
if ((layout->root->type == UI_LAYOUT_MENU) || if ((layout->root->type == UI_LAYOUT_MENU) ||
/* use checkboxes only as a fallback in pie-menu's, when no icon is defined */ /* use checkboxes only as a fallback in pie-menu's, when no icon is defined */
((layout->root->type == UI_LAYOUT_PIEMENU) && (icon == ICON_NONE))) ((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 (type == PROP_BOOLEAN && ((is_array == false) || (index != RNA_NO_INDEX))) {
if (prop_flag & PROP_ICONS_CONSECUTIVE) { if (prop_flag & PROP_ICONS_CONSECUTIVE) {
icon = ICON_CHECKBOX_DEHLT; /* but->iconadd will set to correct icon */ 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)) { /* Get the size for this item. */
flag |= UI_ITEM_R_EXPAND; int w, h;
}
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 */
ui_item_rna_size(layout, name, icon, ptr, prop, index, icon_only, compact, &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) { if (no_bg) {
layout->emboss = UI_EMBOSS_NONE; layout->emboss = UI_EMBOSS_NONE;
} }
/* Split the label / property. */ /* For the new single-column layout in 2.8:
if (use_prop_sep) { - Add a label with the property's name on top of the control for the value, depending on the property type.
uiLayout *layout_row = NULL; - Add the animation decorator, if the property supports it.
#ifdef UI_PROP_DECORATE */
if (ui_decorate.use_prop_decorate) { bool label_on_top = false;
layout_row = uiLayoutRow(layout, true); if (single_col)
layout_row->space = 0; {
ui_decorate.len = max_ii(1, len); /* Should this property be displayed as an array of subproperties? */
}
#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); const PropertySubType subtype = RNA_property_subtype(prop);
uiLayout *layout_split; const bool should_display_array = ((index == RNA_NO_INDEX && is_array) &&
#ifdef UI_PROP_SEP_ICON_WIDTH_EXCEPTION ((!expand && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA, PROP_DIRECTION)) == 0));
if (type == PROP_BOOLEAN && (icon == ICON_NONE) && !icon_only) {
layout_split = uiLayoutRow(layout_row ? layout_row : layout, true); /* Decide if this item should have the label on top of the control or embedded in it. */
} /* property with separate label */
else label_on_top = should_display_array || type == PROP_STRING || type == PROP_POINTER ||
#endif /* UI_PROP_SEP_ICON_WIDTH_EXCEPTION */ (type == PROP_ENUM && ((U.flag & TEMP_USER_PROP_1LINE_ENUM) == 0) || expand);
{ if (label_on_top) {
layout_split = uiLayoutSplit( /* Display a label with the property name. */
layout_row ? layout_row : layout, if (name && name[0] != '\0') {
UI_ITEM_PROP_SEP_DIVIDE, true); layout = uiLayoutColumn(layout, 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( but = uiDefBut(
block, UI_BTYPE_LABEL, 0, name, block, UI_BTYPE_LABEL, 0, name,
0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); 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;
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). */
/* 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 = ""; 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 #ifdef UI_PROP_DECORATE
if (ui_decorate.use_prop_decorate) { if (ui_decorate.use_prop_decorate) {
ui_decorate.layout = uiLayoutColumn(layout_row, true); /* Make a row to set the value on the left and the animation decorator on the right.
ui_decorate.layout->space = 0; For arrays, the sub-properties are arranged in a colunm inside this row. */
UI_block_layout_set_current(block, layout); 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;
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; ui_decorate.but = block->buttons.last;
/* Clear after. */ /* Set the active layout to put the value control in. */
layout->item.flag |= UI_ITEM_PROP_DECORATE_NO_PAD; UI_block_layout_set_current(block, layout_value);
layout = layout_value;
} }
#endif /* UI_PROP_DECORATE */ #endif /* UI_PROP_DECORATE */
} }
/* End split. */
/* array property */ /* array property */
if (index == RNA_NO_INDEX && is_array) { if (index == RNA_NO_INDEX && is_array) {
ui_item_array( ui_item_array(
layout, block, name, icon, ptr, prop, len, 0, 0, w, h, layout, block, name, icon, ptr, prop, array_len, 0, 0, w, h,
expand, slider, toggle, icon_only, compact, !use_prop_sep); expand, slider, toggle, icon_only, compact, true, !single_col);
} }
/* enum item */ /* enum item */
else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) { 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 */ /* expanded enum */
else if (type == PROP_ENUM && expand) { 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 */ /* property with separate label */
else if (type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) { 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); UI_but_flag_enable(but, UI_BUT_LIST_ITEM);
} }
#ifdef UI_PROP_DECORATE #ifdef UI_PROP_DECORATE
if (ui_decorate.use_prop_decorate) { if (ui_decorate.use_prop_decorate) {
const bool is_anim = RNA_property_animateable(ptr, prop); 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; 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; int i;
for (i = 0; i < ui_decorate.len && but_decorate; i++) { for (i = 0; i < ui_decorate.len && but_decorate; i++) {
/* The icons are set in 'ui_but_anim_flag' */ /* 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; but_decorate = but->next;
} }
BLI_assert(ELEM(i, 1, ui_decorate.len)); 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) { /* Ensure text isn't added to icon_only buttons. */
layout->emboss = prev_emboss;
}
/* ensure text isn't added to icon_only buttons */
if (but && icon_only) { if (but && icon_only) {
BLI_assert(but->str[0] == '\0'); BLI_assert(but->str[0] == '\0');
} }
@@ -2069,7 +1970,8 @@ void uiItemPointerR_prop(
StructRNA *icontype; StructRNA *icontype;
int w, h; int w, h;
char namestr[UI_MAX_NAME_STR]; 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); type = RNA_property_type(prop);
if (!ELEM(type, PROP_POINTER, PROP_STRING, PROP_ENUM)) { if (!ELEM(type, PROP_POINTER, PROP_STRING, PROP_ENUM)) {
@@ -2095,9 +1997,8 @@ void uiItemPointerR_prop(
if (!name) if (!name)
name = RNA_property_ui_name(prop); name = RNA_property_ui_name(prop);
if (use_prop_sep == false) { if (!single_col)
name = ui_item_name_add_colon(name, namestr); name = ui_item_name_add_colon(name, namestr);
}
/* create button */ /* create button */
block = uiLayoutGetBlock(layout); 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->redalert = layout->redalert;
litem->w = layout->w; litem->w = layout->w;
litem->emboss = layout->emboss; 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); BLI_addtail(&layout->items, litem);
} }
@@ -3867,24 +3768,19 @@ void uiLayoutSetUnitsY(uiLayout *layout, float unit)
layout->units[1] = unit; layout->units[1] = unit;
} }
void uiLayoutSetSpacing(uiLayout *layout, short spacing)
{
layout->space = spacing;
}
void uiLayoutSetEmboss(uiLayout *layout, char emboss) void uiLayoutSetEmboss(uiLayout *layout, char emboss)
{ {
layout->emboss = emboss; layout->emboss = emboss;
} }
bool uiLayoutGetPropSep(uiLayout *layout) void uiLayoutSetPropSingleCol(uiLayout *layout, bool is_sep)
{ {
return (layout->item.flag & UI_ITEM_PROP_SEP) != 0; SET_FLAG_FROM_TEST(layout->item.flag, is_sep, UI_ITEM_PROP_SINGLE_COL);
}
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;
} }
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep) void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
@@ -3942,6 +3838,11 @@ float uiLayoutGetUnitsY(uiLayout *layout)
return layout->units[1]; return layout->units[1];
} }
short uiLayoutGetSpacing(uiLayout *layout)
{
return layout->space;
}
int uiLayoutGetEmboss(uiLayout *layout) int uiLayoutGetEmboss(uiLayout *layout)
{ {
if (layout->emboss == UI_EMBOSS_UNDEFINED) { 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 *******************/ /********************** Layout *******************/
static void ui_item_scale(uiLayout *litem, const float scale[2]) 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 = MEM_callocN(sizeof(uiLayout), "uiLayout");
layout->item.type = ITEM_LAYOUT_ROOT; 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->item.flag = UI_ITEM_PROP_DECORATE;
layout->x = x; layout->x = x;

View File

@@ -4338,7 +4338,7 @@ eAutoPropButsReturn uiTemplateOperatorPropertyButs(
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiLayoutSetPropSep(layout, true); uiLayoutSetPropSingleCol(layout, true);
/* main draw call */ /* main draw call */
return_info = uiDefAutoButsRNA( 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, ':'); drawstr_right = strchr(drawstr + but->ofs, ':');
if (drawstr_right) { if (drawstr_right) {
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); drawstr_left_len = (drawstr_right - drawstr);
#endif
while (*drawstr_right == ' ') { while (*drawstr_right == ' ') {
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_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_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, "SCREEN_OT_redo_last", F6KEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "SCRIPT_OT_reload", F8KEY, KM_PRESS, 0, 0);
#endif #endif
WM_keymap_verify_item(keymap, "SCRIPT_OT_reload", F8KEY, KM_PRESS, 0, 0);
/* files */ /* files */
WM_keymap_add_item(keymap, "FILE_OT_execute", RETKEY, KM_PRESS, 0, 0); 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); col = uiLayoutColumn(layout, false);
uiLayoutSetPropSep(col, true); uiLayoutSetPropSingleCol(col, true);
uiLayoutSetPropDecorate(col, false); uiLayoutSetPropDecorate(col, false);
uiItemR(col, imfptr, "file_format", 0, NULL, ICON_NONE); 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); col = uiLayoutColumn(layout, false);
uiLayoutSetPropSep(col, true); uiLayoutSetPropSingleCol(col, true);
uiLayoutSetPropDecorate(col, false); uiLayoutSetPropDecorate(col, false);
uiItemR(col, ptr, "views_format", UI_ITEM_R_EXPAND, NULL, ICON_NONE); 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; uiLayout *split, *colsub;
split = uiLayoutSplit(layout, 0.8f, false); split = uiLayoutSplit(layout, 0.8f, false);
uiLayoutSetSpacing(split, 0);
if (ptr->type == &RNA_PoseBone) { if (ptr->type == &RNA_PoseBone) {
PointerRNA boneptr; 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); uiItemR(colsub, ptr, "lock_location", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_DECORATE_UNLOCKED);
split = uiLayoutSplit(layout, 0.8f, false); split = uiLayoutSplit(layout, 0.8f, false);
uiLayoutSetSpacing(split, 0);
switch (RNA_enum_get(ptr, "rotation_mode")) { switch (RNA_enum_get(ptr, "rotation_mode")) {
case ROT_MODE_QUAT: /* quaternion */ 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); uiItemR(layout, ptr, "rotation_mode", 0, "", ICON_NONE);
split = uiLayoutSplit(layout, 0.8f, false); split = uiLayoutSplit(layout, 0.8f, false);
uiLayoutSetSpacing(split, 0);
colsub = uiLayoutColumn(split, true); colsub = uiLayoutColumn(split, true);
uiItemR(colsub, ptr, "scale", 0, NULL, ICON_NONE); uiItemR(colsub, ptr, "scale", 0, NULL, ICON_NONE);
colsub = uiLayoutColumn(split, true); colsub = uiLayoutColumn(split, true);

View File

@@ -708,6 +708,7 @@ typedef enum eUserPref_Flag {
USER_NONEGFRAMES = (1 << 24), USER_NONEGFRAMES = (1 << 24),
USER_TXT_TABSTOSPACES_DISABLE = (1 << 25), USER_TXT_TABSTOSPACES_DISABLE = (1 << 25),
USER_TOOLTIPS_PYTHON = (1 << 26), USER_TOOLTIPS_PYTHON = (1 << 26),
TEMP_USER_PROP_1LINE_ENUM = (1 << 27),
} eUserPref_Flag; } eUserPref_Flag;
/* bPathCompare.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) 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) 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) static bool rna_UILayout_property_decorate_get(PointerRNA *ptr)

View File

@@ -113,8 +113,15 @@ static void rna_uiItemR(
/* Get translated name (label). */ /* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate); 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 |= (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 |= (toggle) ? UI_ITEM_R_TOGGLE : 0;
flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0; flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
flag |= (event) ? UI_ITEM_R_EVENT : 0; flag |= (event) ? UI_ITEM_R_EVENT : 0;
@@ -709,6 +716,7 @@ void RNA_api_ui_layout(StructRNA *srna)
api_ui_item_common(func); api_ui_item_common(func);
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); 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, "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"); func = RNA_def_function(srna, "menu", "rna_uiItemM");
parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu"); 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", prop, "Developer Extras",
"Show options for developers (edit source in context menu, geometry indices)"); "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); 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_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"); RNA_def_property_ui_text(prop, "Display Object Info", "Display objects name and frame number in 3D view");