Merge branch 'blender-v3.6-release'

This commit is contained in:
Chris Blackbourn
2023-06-01 11:53:58 +12:00
3 changed files with 51 additions and 28 deletions

View File

@@ -57,6 +57,7 @@
#include "PIL_time.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "ED_image.h"
@@ -1190,7 +1191,7 @@ static void uvedit_pack_islands_multi(const Scene *scene,
bool only_selected_faces = params->only_selected_faces;
bool only_selected_uvs = params->only_selected_uvs;
const bool ignore_pinned = params->pin_method == ED_UVPACK_PIN_IGNORED;
const bool ignore_pinned = params->pin_method == ED_UVPACK_PIN_IGNORE;
if (ignore_pinned && params->pin_unselected) {
only_selected_faces = false;
only_selected_uvs = false;
@@ -1502,11 +1503,17 @@ static int pack_islands_exec(bContext *C, wmOperator *op)
}
pack_island_params.setFromUnwrapOptions(options);
pack_island_params.rotate_method = eUVPackIsland_RotationMethod(
RNA_enum_get(op->ptr, "rotate_method"));
if (RNA_boolean_get(op->ptr, "rotate")) {
pack_island_params.rotate_method = eUVPackIsland_RotationMethod(
RNA_enum_get(op->ptr, "rotate_method"));
}
else {
pack_island_params.rotate_method = ED_UVPACK_ROTATION_NONE;
}
pack_island_params.scale_to_fit = RNA_boolean_get(op->ptr, "scale");
pack_island_params.merge_overlap = RNA_boolean_get(op->ptr, "merge_overlap");
pack_island_params.pin_method = eUVPackIsland_PinMethod(RNA_enum_get(op->ptr, "pin_method"));
pack_island_params.pin_method = eUVPackIsland_PinMethod(RNA_enum_get(op->ptr, "pin"));
pack_island_params.margin_method = eUVPackIsland_MarginMethod(
RNA_enum_get(op->ptr, "margin_method"));
pack_island_params.margin = RNA_float_get(op->ptr, "margin");
@@ -1562,7 +1569,6 @@ static const EnumPropertyItem pack_margin_method_items[] = {
};
static const EnumPropertyItem pack_rotate_method_items[] = {
{ED_UVPACK_ROTATION_NONE, "NONE", 0, "No rotation", "No rotation is applied to the islands"},
RNA_ENUM_ITEM_SEPR,
{ED_UVPACK_ROTATION_AXIS_ALIGNED,
"AXIS_ALIGNED",
@@ -1579,27 +1585,48 @@ static const EnumPropertyItem pack_rotate_method_items[] = {
};
static const EnumPropertyItem pack_shape_method_items[] = {
{ED_UVPACK_SHAPE_CONCAVE, "CONCAVE", 0, "Exact shape (Concave)", "Uses exact geometry"},
{ED_UVPACK_SHAPE_CONVEX, "CONVEX", 0, "Boundary shape (Convex)", "Uses convex hull"},
{ED_UVPACK_SHAPE_CONCAVE, "CONCAVE", 0, "Exact Shape (Concave)", "Uses exact geometry"},
{ED_UVPACK_SHAPE_CONVEX, "CONVEX", 0, "Boundary Shape (Convex)", "Uses convex hull"},
RNA_ENUM_ITEM_SEPR,
{ED_UVPACK_SHAPE_AABB, "AABB", 0, "Bounding box", "Uses bounding boxes"},
{ED_UVPACK_SHAPE_AABB, "AABB", 0, "Bounding Box", "Uses bounding boxes"},
{0, nullptr, 0, nullptr, nullptr},
};
static const EnumPropertyItem pinned_islands_method_items[] = {
{ED_UVPACK_PIN_DEFAULT, "DEFAULT", 0, "Default", "Pin information is not used"},
{ED_UVPACK_PIN_IGNORED, "IGNORED", 0, "Ignored", "Pinned islands are not packed"},
{ED_UVPACK_PIN_LOCK_SCALE, "SCALE", 0, "Locked scale", "Pinned islands won't rescale"},
{ED_UVPACK_PIN_LOCK_ROTATION, "ROTATION", 0, "Locked rotation", "Pinned islands won't rotate"},
{ED_UVPACK_PIN_PACK, "PACK", 0, "Pack", "Pinned islands are packed normally"},
{ED_UVPACK_PIN_LOCK_SCALE, "SCALE", 0, "Lock Scale", "Pinned islands won't rescale"},
{ED_UVPACK_PIN_LOCK_ROTATION, "ROTATION", 0, "Lock Rotation", "Pinned islands won't rotate"},
{ED_UVPACK_PIN_LOCK_ROTATION_SCALE,
"ROTATION_SCALE",
0,
"Locked rotation and scale",
"Lock Rotation and Scale",
"Pinned islands will translate only"},
{ED_UVPACK_PIN_LOCK_ALL, "LOCKED", 0, "Locked position", "Pinned islands are locked in place"},
{ED_UVPACK_PIN_LOCK_ALL, "LOCKED", 0, "Lock in Place", "Pinned islands are locked in place"},
{ED_UVPACK_PIN_IGNORE, "IGNORE", 0, "Ignore", "Pinned islands are not packed"},
{0, nullptr, 0, nullptr, nullptr},
};
static void uv_pack_islands_ui(bContext *C, wmOperator *op)
{
uiLayout *layout = op->layout;
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, op->ptr, "shape_method", 0, nullptr, ICON_NONE);
uiItemR(layout, op->ptr, "scale", 0, nullptr, ICON_NONE);
uiItemR(layout, op->ptr, "rotate", 0, nullptr, ICON_NONE);
uiLayout *sub = uiLayoutRow(layout, true);
uiLayoutSetActive(sub, RNA_boolean_get(op->ptr, "rotate"));
uiItemR(sub, op->ptr, "rotate_method", 0, nullptr, ICON_NONE);
uiItemS(layout);
uiItemR(layout, op->ptr, "margin_method", 0, nullptr, ICON_NONE);
uiItemR(layout, op->ptr, "margin", 0, nullptr, ICON_NONE);
uiItemS(layout);
uiItemR(layout, op->ptr, "pin", 0, nullptr, ICON_NONE);
uiItemR(layout, op->ptr, "merge_overlap", 0, nullptr, ICON_NONE);
uiItemR(layout, op->ptr, "udim_source", 0, nullptr, ICON_NONE);
uiItemS(layout);
}
void UV_OT_pack_islands(wmOperatorType *ot)
{
static const EnumPropertyItem pack_target[] = {
@@ -1637,10 +1664,12 @@ void UV_OT_pack_islands(wmOperatorType *ot)
#else
ot->invoke = WM_operator_props_popup_confirm;
#endif
ot->ui = uv_pack_islands_ui;
ot->poll = ED_operator_uvedit;
/* properties */
RNA_def_enum(ot->srna, "udim_source", pack_target, PACK_UDIM_SRC_CLOSEST, "Pack to", "");
RNA_def_boolean(ot->srna, "rotate", true, "Rotate", "Rotate islands to improve layout");
RNA_def_enum(ot->srna,
"rotate_method",
pack_rotate_method_items,
@@ -1649,7 +1678,7 @@ void UV_OT_pack_islands(wmOperatorType *ot)
"");
RNA_def_boolean(ot->srna, "scale", true, "Scale", "Scale islands to fill unit square");
RNA_def_boolean(
ot->srna, "merge_overlap", false, "Merge Overlapped", "Overlapping islands stick together");
ot->srna, "merge_overlap", false, "Merge Overlapping", "Overlapping islands stick together");
RNA_def_enum(ot->srna,
"margin_method",
pack_margin_method_items,
@@ -1658,12 +1687,8 @@ void UV_OT_pack_islands(wmOperatorType *ot)
"");
RNA_def_float_factor(
ot->srna, "margin", 0.001f, 0.0f, 1.0f, "Margin", "Space between islands", 0.0f, 1.0f);
RNA_def_enum(ot->srna,
"pin_method",
pinned_islands_method_items,
ED_UVPACK_PIN_DEFAULT,
"Pinned Islands",
"");
RNA_def_enum(
ot->srna, "pin", pinned_islands_method_items, ED_UVPACK_PIN_PACK, "Pinned Islands", "");
RNA_def_enum(ot->srna,
"shape_method",
pack_shape_method_items,
@@ -2385,7 +2410,7 @@ void ED_uvedit_live_unwrap(const Scene *scene, Object **objects, int objects_len
blender::geometry::UVPackIsland_Params pack_island_params;
pack_island_params.setFromUnwrapOptions(options);
pack_island_params.rotate_method = ED_UVPACK_ROTATION_ANY;
pack_island_params.pin_method = ED_UVPACK_PIN_IGNORED;
pack_island_params.pin_method = ED_UVPACK_PIN_IGNORE;
pack_island_params.margin_method = ED_UVPACK_MARGIN_SCALED;
pack_island_params.margin = scene->toolsettings->uvcalc_margin;
@@ -2527,7 +2552,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
blender::geometry::UVPackIsland_Params pack_island_params;
pack_island_params.setFromUnwrapOptions(options);
pack_island_params.rotate_method = ED_UVPACK_ROTATION_ANY;
pack_island_params.pin_method = ED_UVPACK_PIN_IGNORED;
pack_island_params.pin_method = ED_UVPACK_PIN_IGNORE;
pack_island_params.margin_method = eUVPackIsland_MarginMethod(
RNA_enum_get(op->ptr, "margin_method"));
pack_island_params.margin = RNA_float_get(op->ptr, "margin");

View File

@@ -49,12 +49,11 @@ enum eUVPackIsland_ShapeMethod {
};
enum eUVPackIsland_PinMethod {
ED_UVPACK_PIN_IGNORED = 0,
ED_UVPACK_PIN_DEFAULT,
ED_UVPACK_PIN_IGNORE = 0,
ED_UVPACK_PIN_PACK,
ED_UVPACK_PIN_LOCK_ROTATION,
ED_UVPACK_PIN_LOCK_ROTATION_SCALE,
ED_UVPACK_PIN_LOCK_SCALE,
ED_UVPACK_PIN_LOCK_TRANSLATION,
ED_UVPACK_PIN_LOCK_ALL, /* Lock translation, rotation and scale. */
};

View File

@@ -339,7 +339,7 @@ UVPackIsland_Params::UVPackIsland_Params()
only_selected_faces = false;
use_seams = false;
correct_aspect = false;
pin_method = ED_UVPACK_PIN_DEFAULT;
pin_method = ED_UVPACK_PIN_PACK;
pin_unselected = false;
merge_overlap = false;
margin = 0.001f;
@@ -1988,7 +1988,6 @@ bool PackIsland::can_translate_(const UVPackIsland_Params &params) const
}
switch (params.pin_method) {
case ED_UVPACK_PIN_LOCK_ALL:
case ED_UVPACK_PIN_LOCK_TRANSLATION:
return false;
default:
return true;