UV: Add "Invert Pins" to the menu in the uv editor
Thanks Robert Rioux for the suggestion. Pull Request: https://projects.blender.org/blender/blender/pulls/109187
This commit is contained in:
committed by
Chris Blackbourn
parent
a3bfd6e20d
commit
4f6ce68500
@@ -428,6 +428,7 @@ class IMAGE_MT_uvs(Menu):
|
||||
|
||||
layout.operator("uv.pin").clear = False
|
||||
layout.operator("uv.pin", text="Unpin").clear = True
|
||||
layout.operator("uv.pin", text="Invert Pins").invert = True
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
||||
@@ -1343,6 +1343,7 @@ static int uv_pin_exec(bContext *C, wmOperator *op)
|
||||
BMIter iter, liter;
|
||||
const ToolSettings *ts = scene->toolsettings;
|
||||
const bool clear = RNA_boolean_get(op->ptr, "clear");
|
||||
const bool invert = RNA_boolean_get(op->ptr, "invert");
|
||||
const bool synced_selection = (ts->uv_flag & UV_SYNC_SELECTION) != 0;
|
||||
|
||||
uint objects_len = 0;
|
||||
@@ -1371,7 +1372,12 @@ static int uv_pin_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (uvedit_uv_select_test(scene, l, offsets)) {
|
||||
changed = true;
|
||||
BM_ELEM_CD_SET_BOOL(l, offsets.pin, !clear);
|
||||
if (invert) {
|
||||
BM_ELEM_CD_SET_BOOL(l, offsets.pin, !BM_ELEM_CD_GET_BOOL(l, offsets.pin));
|
||||
}
|
||||
else {
|
||||
BM_ELEM_CD_SET_BOOL(l, offsets.pin, !clear);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1402,6 +1408,11 @@ static void UV_OT_pin(wmOperatorType *ot)
|
||||
/* properties */
|
||||
RNA_def_boolean(
|
||||
ot->srna, "clear", false, "Clear", "Clear pinning for the selection instead of setting it");
|
||||
RNA_def_boolean(ot->srna,
|
||||
"invert",
|
||||
false,
|
||||
"Invert",
|
||||
"Invert pinning for the selection instead of setting it");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
Reference in New Issue
Block a user