UI: Use consistent layout for custom operator UI

Operators are one of the last places in Blender to use older UI designs
that don't fit in with recent style conventions. This commit updates
these custom operator UI callbacks for consistency and clarity.

Some of the code is also simplified a lot. Some of the older operator layouts
were much more complex (in terms of code) than they needed to be.

See the differential revision for a before and after screenshot
of each operator.

Differential Revision: https://developer.blender.org/D8326
This commit is contained in:
Hans Goudey 2020-07-21 11:13:18 -04:00
parent c2b0c64843
commit 17ebbdf1c1
9 changed files with 237 additions and 304 deletions

View File

@ -158,99 +158,78 @@ static int wm_alembic_export_exec(bContext *C, wmOperator *op)
static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
{
uiLayout *box;
uiLayout *row;
uiLayout *col;
uiLayout *box, *row, *col, *sub;
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE);
uiItemL(box, IFACE_("Manual Transform"), ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "global_scale", 0, NULL, ICON_NONE);
uiItemR(box, imfptr, "global_scale", 0, NULL, ICON_NONE);
/* Scene Options */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Scene Options:"), ICON_SCENE_DATA);
uiItemL(row, IFACE_("Scene Options"), ICON_SCENE_DATA);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "start", 0, NULL, ICON_NONE);
col = uiLayoutColumn(box, false);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "end", 0, NULL, ICON_NONE);
sub = uiLayoutColumn(col, true);
uiItemR(sub, imfptr, "start", 0, IFACE_("Frame Start"), ICON_NONE);
uiItemR(sub, imfptr, "end", 0, IFACE_("End"), ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "xsamples", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "xsamples", 0, IFACE_("Samples Transform"), ICON_NONE);
uiItemR(col, imfptr, "gsamples", 0, IFACE_("Geometry"), ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "gsamples", 0, NULL, ICON_NONE);
sub = uiLayoutColumn(col, true);
uiItemR(sub, imfptr, "sh_open", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(sub, imfptr, "sh_close", UI_ITEM_R_SLIDER, IFACE_("Close"), ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "sh_open", 0, NULL, ICON_NONE);
uiItemS(col);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "sh_close", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "selected", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "renderable_only", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "visible_objects_only", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "flatten", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "flatten", 0, NULL, ICON_NONE);
sub = uiLayoutColumnWithHeading(col, true, IFACE_("Only"));
uiItemR(sub, imfptr, "selected", 0, IFACE_("Selected Objects"), ICON_NONE);
uiItemR(sub, imfptr, "renderable_only", 0, IFACE_("Renderable Objects"), ICON_NONE);
uiItemR(sub, imfptr, "visible_objects_only", 0, IFACE_("Visible Objects"), ICON_NONE);
/* Object Data */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Object Options:"), ICON_OBJECT_DATA);
uiItemL(row, IFACE_("Object Options"), ICON_OBJECT_DATA);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "uvs", 0, NULL, ICON_NONE);
col = uiLayoutColumn(box, false);
row = uiLayoutRow(box, false);
uiItemR(col, imfptr, "uvs", 0, NULL, ICON_NONE);
row = uiLayoutRow(col, false);
uiLayoutSetActive(row, RNA_boolean_get(imfptr, "uvs"));
uiItemR(row, imfptr, "packuv", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "uvs"));
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "normals", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "normals", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "vcolors", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "face_sets", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "curves_as_mesh", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "vcolors", 0, NULL, ICON_NONE);
uiItemS(col);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "face_sets", 0, NULL, ICON_NONE);
sub = uiLayoutColumnWithHeading(col, true, IFACE_("Subdivisions"));
uiItemR(sub, imfptr, "apply_subdiv", 0, IFACE_("Apply"), ICON_NONE);
uiItemR(sub, imfptr, "subdiv_schema", 0, IFACE_("Use Schema"), ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "subdiv_schema", 0, NULL, ICON_NONE);
uiItemS(col);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "apply_subdiv", 0, NULL, ICON_NONE);
col = uiLayoutColumn(box, false);
uiItemR(col, imfptr, "triangulate", 0, NULL, ICON_NONE);
sub = uiLayoutColumn(col, false);
uiLayoutSetActive(sub, RNA_boolean_get(imfptr, "triangulate"));
uiItemR(sub, imfptr, "quad_method", 0, IFACE_("Method Quads"), ICON_NONE);
uiItemR(sub, imfptr, "ngon_method", 0, IFACE_("Polygons"), ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "curves_as_mesh", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "triangulate", 0, NULL, ICON_NONE);
const bool triangulate = RNA_boolean_get(imfptr, "triangulate");
row = uiLayoutRow(box, false);
uiLayoutSetEnabled(row, triangulate);
uiItemR(row, imfptr, "quad_method", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiLayoutSetEnabled(row, triangulate);
uiItemR(row, imfptr, "ngon_method", 0, NULL, ICON_NONE);
/* Object Data */
/* Particle Data */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Particle Systems:"), ICON_PARTICLE_DATA);
uiItemL(row, IFACE_("Particle Systems"), ICON_PARTICLE_DATA);
col = uiLayoutColumn(box, true);
uiItemR(col, imfptr, "export_hair", 0, NULL, ICON_NONE);
@ -578,28 +557,25 @@ static int get_sequence_len(char *filename, int *ofs)
static void ui_alembic_import_settings(uiLayout *layout, PointerRNA *imfptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiLayout *box = uiLayoutBox(layout);
uiLayout *row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE);
uiItemL(row, IFACE_("Manual Transform"), ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "scale", 0, NULL, ICON_NONE);
uiItemR(box, imfptr, "scale", 0, NULL, ICON_NONE);
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Options:"), ICON_NONE);
uiItemL(row, IFACE_("Options"), ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "relative_path", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "set_frame_range", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "is_sequence", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "validate_meshes", 0, NULL, ICON_NONE);
uiLayout *col = uiLayoutColumn(box, false);
uiItemR(col, imfptr, "relative_path", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "set_frame_range", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "is_sequence", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "validate_meshes", 0, NULL, ICON_NONE);
}
static void wm_alembic_import_draw(bContext *UNUSED(C), wmOperator *op)

View File

@ -266,7 +266,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
{
uiLayout *bbox, *box, *row, *col, *split;
uiLayout *box, *row, *col, *sub;
bool include_animations = RNA_boolean_get(imfptr, "include_animations");
int ui_section = RNA_enum_get(imfptr, "prop_bc_export_ui_section");
@ -279,161 +279,126 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
bool sampling = animation_type == BC_ANIMATION_EXPORT_SAMPLES;
/* Export Options: */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
row = uiLayoutRow(layout, false);
uiItemR(row, imfptr, "prop_bc_export_ui_section", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
if (ui_section == BC_UI_SECTION_MAIN) {
/* =================== */
/* Export Data options */
/* =================== */
/* Export data options. */
box = uiLayoutBox(layout);
col = uiLayoutColumn(box, false);
uiItemR(col, imfptr, "selected", 0, NULL, ICON_NONE);
sub = uiLayoutColumn(col, false);
uiLayoutSetEnabled(sub, RNA_boolean_get(imfptr, "selected"));
uiItemR(sub, imfptr, "include_children", 0, NULL, ICON_NONE);
uiItemR(sub, imfptr, "include_armatures", 0, NULL, ICON_NONE);
uiItemR(sub, imfptr, "include_shapekeys", 0, NULL, ICON_NONE);
bbox = uiLayoutBox(layout);
row = uiLayoutRow(bbox, false);
uiItemL(row, IFACE_("Global Orientation:"), ICON_ORIENTATION_GLOBAL);
row = uiLayoutRow(bbox, false);
uiItemR(row, imfptr, "export_global_forward_selection", 0, "", ICON_NONE);
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Global Orientation"), ICON_ORIENTATION_GLOBAL);
row = uiLayoutRow(bbox, false);
uiItemR(row, imfptr, "export_global_up_selection", 0, "", ICON_NONE);
row = uiLayoutRow(bbox, false);
uiItemR(row, imfptr, "apply_global_orientation", 0, NULL, ICON_NONE);
uiItemR(box, imfptr, "apply_global_orientation", 0, IFACE_("Apply"), ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "selected", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "include_children", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "include_armatures", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "include_shapekeys", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
uiItemR(row,
imfptr,
"export_global_forward_selection",
UI_ITEM_R_EXPAND,
IFACE_("Forward Axis"),
ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(
row, imfptr, "export_global_up_selection", UI_ITEM_R_EXPAND, IFACE_("Up Axis"), ICON_NONE);
/* Texture options */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Texture Options:"), ICON_TEXTURE_DATA);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "active_uv_only", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "use_texture_copies", 1, NULL, ICON_NONE);
}
else if (ui_section == BC_UI_SECTION_GEOMETRY) {
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Export Data Options:"), ICON_MESH_DATA);
row = uiLayoutRow(box, false);
split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
col = uiLayoutColumn(split, false);
uiItemR(col, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
col = uiLayoutColumn(split, false);
uiItemR(col, imfptr, "export_mesh_type_selection", 0, "", ICON_NONE);
uiLayoutSetEnabled(col, RNA_boolean_get(imfptr, "apply_modifiers"));
uiItemL(box, IFACE_("Texture Options"), ICON_TEXTURE_DATA);
col = uiLayoutColumn(box, false);
uiItemR(col, imfptr, "triangulate", 1, NULL, ICON_NONE);
uiItemR(col, imfptr, "use_texture_copies", 0, NULL, ICON_NONE);
row = uiLayoutRowWithHeading(col, true, IFACE_("UV"));
uiItemR(row, imfptr, "active_uv_only", 0, IFACE_("Only Selected Map"), ICON_NONE);
}
else if (ui_section == BC_UI_SECTION_GEOMETRY) {
box = uiLayoutBox(layout);
uiItemL(box, IFACE_("Export Data Options"), ICON_MESH_DATA);
col = uiLayoutColumn(box, false);
uiItemR(col, imfptr, "triangulate", 0, NULL, ICON_NONE);
row = uiLayoutRowWithHeading(col, true, IFACE_("Apply Modifiers"));
uiItemR(row, imfptr, "apply_modifiers", 0, "", ICON_NONE);
sub = uiLayoutColumn(row, false);
uiLayoutSetActive(sub, RNA_boolean_get(imfptr, "apply_modifiers"));
uiItemR(sub, imfptr, "export_mesh_type_selection", 0, "", ICON_NONE);
row = uiLayoutRow(box, false);
split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
uiItemL(split, IFACE_("Transformation Type"), ICON_NONE);
if (RNA_boolean_get(imfptr, "include_animations")) {
uiItemR(split, imfptr, "export_animation_transformation_type_selection", 0, "", ICON_NONE);
uiItemR(col, imfptr, "export_animation_transformation_type_selection", 0, NULL, ICON_NONE);
}
else {
uiItemR(split, imfptr, "export_object_transformation_type_selection", 0, "", ICON_NONE);
uiItemR(col, imfptr, "export_object_transformation_type_selection", 0, NULL, ICON_NONE);
}
}
else if (ui_section == BC_UI_SECTION_ARMATURE) {
/* Armature options */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Armature Options:"), ICON_ARMATURE_DATA);
uiItemL(box, IFACE_("Armature Options"), ICON_ARMATURE_DATA);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "deform_bones_only", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "open_sim", 0, NULL, ICON_NONE);
col = uiLayoutColumn(box, false);
uiItemR(col, imfptr, "deform_bones_only", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "open_sim", 0, NULL, ICON_NONE);
}
else if (ui_section == BC_UI_SECTION_ANIMATION) {
/* Animation options. */
box = uiLayoutBox(layout);
uiItemR(box, imfptr, "include_animations", 0, NULL, ICON_NONE);
/* ====================== */
/* Animation Data options */
/* ====================== */
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "include_animations", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
col = uiLayoutColumn(box, false);
row = uiLayoutRow(col, false);
uiLayoutSetActive(row, include_animations);
uiItemR(row, imfptr, "export_animation_type_selection", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiLayoutSetEnabled(row, include_animations);
row = uiLayoutRow(box, false);
split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
uiItemL(split, IFACE_("Transformation Type"), ICON_NONE);
uiLayoutSetActive(row, include_animations && animation_type == BC_ANIMATION_EXPORT_SAMPLES);
if (RNA_boolean_get(imfptr, "include_animations")) {
uiItemR(split, imfptr, "export_animation_transformation_type_selection", 0, "", ICON_NONE);
uiItemR(box, imfptr, "export_animation_transformation_type_selection", 0, NULL, ICON_NONE);
}
else {
uiItemR(split, imfptr, "export_object_transformation_type_selection", 0, "", ICON_NONE);
uiItemR(box, imfptr, "export_object_transformation_type_selection", 0, NULL, ICON_NONE);
}
uiLayoutSetEnabled(row, include_animations && animation_type == BC_ANIMATION_EXPORT_SAMPLES);
row = uiLayoutColumn(box, false);
row = uiLayoutColumn(col, false);
uiLayoutSetActive(row,
include_animations &&
(animation_transformation_type == BC_TRANSFORMATION_TYPE_DECOMPOSED ||
animation_type == BC_ANIMATION_EXPORT_KEYS));
uiItemR(row, imfptr, "keep_smooth_curves", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row,
include_animations &&
(animation_transformation_type == BC_TRANSFORMATION_TYPE_DECOMPOSED ||
animation_type == BC_ANIMATION_EXPORT_KEYS));
row = uiLayoutColumn(box, false);
uiItemR(row, imfptr, "sampling_rate", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, sampling && include_animations);
sub = uiLayoutColumn(col, false);
uiLayoutSetActive(sub, sampling && include_animations);
uiItemR(sub, imfptr, "sampling_rate", 0, NULL, ICON_NONE);
uiItemR(sub, imfptr, "keep_keyframes", 0, NULL, ICON_NONE);
row = uiLayoutColumn(box, false);
uiItemR(row, imfptr, "keep_keyframes", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, sampling && include_animations);
row = uiLayoutColumn(box, false);
uiItemR(row, imfptr, "keep_flat_curves", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, include_animations);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "include_all_actions", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, include_animations);
sub = uiLayoutColumn(col, false);
uiLayoutSetActive(sub, include_animations);
uiItemR(sub, imfptr, "keep_flat_curves", 0, NULL, ICON_NONE);
uiItemR(sub, imfptr, "include_all_actions", 0, NULL, ICON_NONE);
}
else if (ui_section == BC_UI_SECTION_COLLADA) {
/* Collada options: */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Collada Options:"), ICON_MODIFIER);
uiItemL(row, IFACE_("Collada Options"), ICON_MODIFIER);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "use_object_instantiation", 1, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "use_blender_profile", 1, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "sort_by_name", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "keep_bind_info", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "limit_precision", 0, NULL, ICON_NONE);
col = uiLayoutColumn(box, false);
uiItemR(col, imfptr, "use_object_instantiation", 1, NULL, ICON_NONE);
uiItemR(col, imfptr, "use_blender_profile", 1, NULL, ICON_NONE);
uiItemR(col, imfptr, "sort_by_name", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "keep_bind_info", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "limit_precision", 0, NULL, ICON_NONE);
}
}
@ -464,28 +429,28 @@ void WM_OT_collada_export(wmOperatorType *ot)
struct StructRNA *func = ot->srna;
static const EnumPropertyItem prop_bc_export_mesh_type[] = {
{BC_MESH_TYPE_VIEW, "view", 0, "View", "Apply modifier's view settings"},
{BC_MESH_TYPE_VIEW, "view", 0, "Viewport", "Apply modifier's viewport settings"},
{BC_MESH_TYPE_RENDER, "render", 0, "Render", "Apply modifier's render settings"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_bc_export_global_forward[] = {
{BC_GLOBAL_FORWARD_X, "X", 0, "X Forward", "Global Forward is positive X Axis"},
{BC_GLOBAL_FORWARD_Y, "Y", 0, "Y Forward", "Global Forward is positive Y Axis"},
{BC_GLOBAL_FORWARD_Z, "Z", 0, "Z Forward", "Global Forward is positive Z Axis"},
{BC_GLOBAL_FORWARD_MINUS_X, "-X", 0, "-X Forward", "Global Forward is negative X Axis"},
{BC_GLOBAL_FORWARD_MINUS_Y, "-Y", 0, "-Y Forward", "Global Forward is negative Y Axis"},
{BC_GLOBAL_FORWARD_MINUS_Z, "-Z", 0, "-Z Forward", "Global Forward is negative Z Axis"},
{BC_GLOBAL_FORWARD_X, "X", 0, "X", "Global Forward is positive X Axis"},
{BC_GLOBAL_FORWARD_Y, "Y", 0, "Y", "Global Forward is positive Y Axis"},
{BC_GLOBAL_FORWARD_Z, "Z", 0, "Z", "Global Forward is positive Z Axis"},
{BC_GLOBAL_FORWARD_MINUS_X, "-X", 0, "-X", "Global Forward is negative X Axis"},
{BC_GLOBAL_FORWARD_MINUS_Y, "-Y", 0, "-Y", "Global Forward is negative Y Axis"},
{BC_GLOBAL_FORWARD_MINUS_Z, "-Z", 0, "-Z", "Global Forward is negative Z Axis"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_bc_export_global_up[] = {
{BC_GLOBAL_UP_X, "X", 0, "X Up", "Global UP is positive X Axis"},
{BC_GLOBAL_UP_Y, "Y", 0, "Y Up", "Global UP is positive Y Axis"},
{BC_GLOBAL_UP_Z, "Z", 0, "Z Up", "Global UP is positive Z Axis"},
{BC_GLOBAL_UP_MINUS_X, "-X", 0, "-X Up", "Global UP is negative X Axis"},
{BC_GLOBAL_UP_MINUS_Y, "-Y", 0, "-Y Up", "Global UP is negative Y Axis"},
{BC_GLOBAL_UP_MINUS_Z, "-Z", 0, "-Z Up", "Global UP is negative Z Axis"},
{BC_GLOBAL_UP_X, "X", 0, "X", "Global UP is positive X Axis"},
{BC_GLOBAL_UP_Y, "Y", 0, "Y", "Global UP is positive Y Axis"},
{BC_GLOBAL_UP_Z, "Z", 0, "Z", "Global UP is positive Z Axis"},
{BC_GLOBAL_UP_MINUS_X, "-X", 0, "-X", "Global UP is negative X Axis"},
{BC_GLOBAL_UP_MINUS_Y, "-Y", 0, "-Y", "Global UP is negative Y Axis"},
{BC_GLOBAL_UP_MINUS_Z, "-Z", 0, "-Z", "Global UP is negative Z Axis"},
{0, NULL, 0, NULL, NULL},
};
@ -618,7 +583,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
RNA_def_boolean(func,
"deform_bones_only",
false,
"Deform Bones only",
"Deform Bones Only",
"Only export deforming bones with armatures");
RNA_def_boolean(
@ -671,7 +636,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
RNA_def_boolean(func,
"keep_flat_curves",
0,
"All keyed curves",
"All Keyed Curves",
"Export also curves which have only one key or are totally flat");
RNA_def_boolean(
@ -809,37 +774,29 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr)
{
uiLayout *box, *row;
uiLayout *box, *col;
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
/* Import Options: */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Import Data Options:"), ICON_MESH_DATA);
uiItemL(box, IFACE_("Import Data Options"), ICON_MESH_DATA);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "import_units", 0, NULL, ICON_NONE);
uiItemR(box, imfptr, "import_units", 0, NULL, ICON_NONE);
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Armature Options:"), ICON_MESH_DATA);
uiItemL(box, IFACE_("Armature Options"), ICON_ARMATURE_DATA);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "fix_orientation", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "find_chains", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "auto_connect", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "min_chain_length", 0, NULL, ICON_NONE);
col = uiLayoutColumn(box, false);
uiItemR(col, imfptr, "fix_orientation", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "find_chains", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "auto_connect", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "min_chain_length", 0, NULL, ICON_NONE);
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "keep_bind_info", 0, NULL, ICON_NONE);
uiItemR(box, imfptr, "keep_bind_info", 0, NULL, ICON_NONE);
}
static void wm_collada_import_draw(bContext *UNUSED(C), wmOperator *op)

View File

@ -145,21 +145,23 @@ static void wm_usd_export_draw(bContext *UNUSED(C), wmOperator *op)
uiLayoutSetPropSep(layout, true);
col = uiLayoutColumn(layout, true);
uiLayout *box = uiLayoutBox(layout);
col = uiLayoutColumn(box, true);
uiItemR(col, ptr, "selected_objects_only", 0, NULL, ICON_NONE);
col = uiLayoutColumn(layout, true);
col = uiLayoutColumn(box, true);
uiItemR(col, ptr, "export_animation", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "export_hair", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "export_uvmaps", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "export_normals", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "export_materials", 0, NULL, ICON_NONE);
col = uiLayoutColumn(layout, true);
col = uiLayoutColumn(box, true);
uiItemR(col, ptr, "evaluation_mode", 0, NULL, ICON_NONE);
uiLayout *box = uiLayoutBox(layout);
uiItemL(box, IFACE_("Experimental:"), ICON_NONE);
box = uiLayoutBox(layout);
uiItemL(box, IFACE_("Experimental"), ICON_NONE);
uiItemR(box, ptr, "use_instancing", 0, NULL, ICON_NONE);
}

View File

@ -938,36 +938,25 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void edbm_bevel_ui(bContext *C, wmOperator *op)
{
uiLayout *layout = op->layout;
uiLayout *row, *col, *split;
uiLayout *col, *row;
PointerRNA ptr, toolsettings_ptr;
PropertyRNA *prop;
const char *offset_name;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
int profile_type = RNA_enum_get(&ptr, "profile_type");
int offset_type = RNA_enum_get(&ptr, "offset_type");
if (RNA_enum_get(&ptr, "offset_type") == BEVEL_AMT_PERCENT) {
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, &ptr, "offset_type", 0, NULL, ICON_NONE);
if (offset_type == BEVEL_AMT_PERCENT) {
uiItemR(layout, &ptr, "offset_pct", 0, NULL, ICON_NONE);
}
else {
prop = RNA_struct_find_property(op->ptr, "offset_type");
RNA_property_enum_name_gettexted(
C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &offset_name);
uiItemR(layout, &ptr, "offset", 0, offset_name, ICON_NONE);
uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
}
row = uiLayoutRow(layout, true);
uiItemR(row, &ptr, "offset_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
split = uiLayoutSplit(layout, 0.5f, true);
col = uiLayoutColumn(split, true);
uiItemR(col, &ptr, "vertex_only", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "clamp_overlap", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "loop_slide", 0, NULL, ICON_NONE);
col = uiLayoutColumn(split, true);
uiItemR(col, &ptr, "mark_seam", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "mark_sharp", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "harden_normals", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "segments", 0, NULL, ICON_NONE);
if (ELEM(profile_type, BEVEL_PROFILE_SUPERELLIPSE, BEVEL_PROFILE_CUSTOM)) {
@ -980,23 +969,32 @@ static void edbm_bevel_ui(bContext *C, wmOperator *op)
}
uiItemR(layout, &ptr, "material", 0, NULL, ICON_NONE);
uiItemL(layout, "Miter Type:", ICON_NONE);
uiItemR(layout, &ptr, "miter_outer", 0, "Outer", ICON_NONE);
uiItemR(layout, &ptr, "miter_inner", 0, "Inner", ICON_NONE);
col = uiLayoutColumn(layout, true);
uiItemR(col, &ptr, "harden_normals", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "vertex_only", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "clamp_overlap", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "loop_slide", 0, NULL, ICON_NONE);
col = uiLayoutColumnWithHeading(layout, true, IFACE_("Mark"));
uiItemR(col, &ptr, "mark_seam", 0, IFACE_("Seams"), ICON_NONE);
uiItemR(col, &ptr, "mark_sharp", 0, IFACE_("Sharp"), ICON_NONE);
uiItemS(layout);
uiItemR(layout, &ptr, "miter_outer", 0, IFACE_("Miter Outer"), ICON_NONE);
uiItemR(layout, &ptr, "miter_inner", 0, IFACE_("Inner"), ICON_NONE);
if (RNA_enum_get(&ptr, "miter_inner") == BEVEL_MITER_ARC) {
uiItemR(layout, &ptr, "spread", 0, NULL, ICON_NONE);
}
uiItemL(layout, "Face Strength Mode:", ICON_NONE);
row = uiLayoutRow(layout, true);
uiItemR(row, &ptr, "face_strength_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemS(layout);
uiItemL(layout, "Intersection Type:", ICON_NONE);
row = uiLayoutRow(layout, true);
uiItemR(row, &ptr, "vmesh_method", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(layout, &ptr, "face_strength_mode", 0, IFACE_("Face Strength"), ICON_NONE);
uiItemR(layout, &ptr, "vmesh_method", 0, IFACE_("Intersection Type"), ICON_NONE);
uiItemL(layout, "Profile Type:", ICON_NONE);
row = uiLayoutRow(layout, true);
uiItemS(layout);
row = uiLayoutRow(layout, false);
uiItemR(row, &ptr, "profile_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
if (profile_type == BEVEL_PROFILE_CUSTOM) {
/* Get an RNA pointer to ToolSettings to give to the curve profile template code. */
@ -1156,7 +1154,7 @@ void MESH_OT_bevel(wmOperatorType *ot)
-1,
-1,
INT_MAX,
"Material",
"Material Index",
"Material for bevel faces (-1 means use adjacent faces)",
-1,
100);

View File

@ -3677,7 +3677,10 @@ static void edbm_blend_from_shape_ui(bContext *C, wmOperator *op)
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_id_pointer_create((ID *)me->key, &ptr_key);
uiItemPointerR(layout, &ptr, "shape", &ptr_key, "key_blocks", "", ICON_SHAPEKEY_DATA);
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemPointerR(layout, &ptr, "shape", &ptr_key, "key_blocks", NULL, ICON_SHAPEKEY_DATA);
uiItemR(layout, &ptr, "blend", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "add", 0, NULL, ICON_NONE);
}
@ -5587,25 +5590,26 @@ static bool edbm_decimate_check(bContext *UNUSED(C), wmOperator *UNUSED(op))
static void edbm_decimate_ui(bContext *UNUSED(C), wmOperator *op)
{
uiLayout *layout = op->layout, *box, *row, *col;
uiLayout *layout = op->layout, *row, *col, *sub;
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, &ptr, "ratio", 0, NULL, ICON_NONE);
box = uiLayoutBox(layout);
uiItemR(box, &ptr, "use_vertex_group", 0, NULL, ICON_NONE);
col = uiLayoutColumn(box, false);
uiItemR(layout, &ptr, "use_vertex_group", 0, NULL, ICON_NONE);
col = uiLayoutColumn(layout, false);
uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_vertex_group"));
uiItemR(col, &ptr, "vertex_group_factor", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "invert_vertex_group", 0, NULL, ICON_NONE);
box = uiLayoutBox(layout);
uiItemR(box, &ptr, "use_symmetry", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, true);
uiLayoutSetActive(row, RNA_boolean_get(&ptr, "use_symmetry"));
uiItemR(row, &ptr, "symmetry_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
row = uiLayoutRowWithHeading(layout, true, IFACE_("Symmetry"));
uiItemR(row, &ptr, "use_symmetry", 0, "", ICON_NONE);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_symmetry"));
uiItemR(sub, &ptr, "symmetry_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
void MESH_OT_decimate(wmOperatorType *ot)
@ -8403,6 +8407,8 @@ static void edbm_point_normals_ui(bContext *C, wmOperator *op)
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiLayoutSetPropSep(layout, true);
/* Main auto-draw call */
uiDefAutoButsRNA(layout, &ptr, point_normals_draw_check_prop, NULL, NULL, '\0', false);
}
@ -8875,6 +8881,8 @@ static void edbm_average_normals_ui(bContext *C, wmOperator *op)
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiLayoutSetPropSep(layout, true);
/* Main auto-draw call */
uiDefAutoButsRNA(layout, &ptr, average_normals_draw_check_prop, NULL, NULL, '\0', false);
}

View File

@ -2752,6 +2752,8 @@ static void object_convert_ui(bContext *UNUSED(C), wmOperator *op)
uiLayout *layout = op->layout;
PointerRNA ptr;
uiLayoutSetPropSep(layout, true);
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
uiItemR(layout, &ptr, "target", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "keep_original", 0, NULL, ICON_NONE);

View File

@ -205,6 +205,8 @@ static void screenshot_draw(bContext *UNUSED(C), wmOperator *op)
ScreenshotData *scd = op->customdata;
PointerRNA ptr;
uiLayoutSetPropSep(layout, true);
/* image template */
RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &scd->im_format, &ptr);
uiTemplateImageSettings(layout, &ptr, false);

View File

@ -564,6 +564,9 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op)
PropertyRNA *prop_codec;
PropertyRNA *prop_bitrate;
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
AUD_Container container = RNA_enum_get(op->ptr, "container");
AUD_Codec codec = RNA_enum_get(op->ptr, "codec");

View File

@ -2595,7 +2595,7 @@ static int image_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
static void image_new_draw(bContext *UNUSED(C), wmOperator *op)
{
uiLayout *split, *col[2];
uiLayout *col;
uiLayout *layout = op->layout;
PointerRNA ptr;
#if 0
@ -2607,33 +2607,18 @@ static void image_new_draw(bContext *UNUSED(C), wmOperator *op)
/* copy of WM_operator_props_dialog_popup() layout */
split = uiLayoutSplit(layout, 0.5f, false);
col[0] = uiLayoutColumn(split, false);
col[1] = uiLayoutColumn(split, false);
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemL(col[0], IFACE_("Name"), ICON_NONE);
uiItemR(col[1], &ptr, "name", 0, "", ICON_NONE);
uiItemL(col[0], IFACE_("Width"), ICON_NONE);
uiItemR(col[1], &ptr, "width", 0, "", ICON_NONE);
uiItemL(col[0], IFACE_("Height"), ICON_NONE);
uiItemR(col[1], &ptr, "height", 0, "", ICON_NONE);
uiItemL(col[0], IFACE_("Color"), ICON_NONE);
uiItemR(col[1], &ptr, "color", 0, "", ICON_NONE);
uiItemL(col[0], "", ICON_NONE);
uiItemR(col[1], &ptr, "alpha", 0, NULL, ICON_NONE);
uiItemL(col[0], IFACE_("Generated Type"), ICON_NONE);
uiItemR(col[1], &ptr, "generated_type", 0, "", ICON_NONE);
uiItemL(col[0], "", ICON_NONE);
uiItemR(col[1], &ptr, "float", 0, NULL, ICON_NONE);
uiItemL(col[0], "", ICON_NONE);
uiItemR(col[1], &ptr, "tiled", 0, NULL, ICON_NONE);
col = uiLayoutColumn(layout, false);
uiItemR(col, &ptr, "name", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "width", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "height", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "color", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "alpha", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "generated_type", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "float", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "tiled", 0, NULL, ICON_NONE);
#if 0
if (is_multiview) {