Via Select Box Operator
Example in blender version 2.91,2, after running script, adding Box Select operator with range options (arbitrarily labelled
Select UV Image Bounds) to UV editors select menu.
AFAICT the select box operator uses normalized image 0-1 coordinates in the UV editor, as does the cursor, totally debunking this assertion in question.
Unfortunately, this one works with mouse coordinates instead of 0-1
space coordinates which makes it totally useless.
To which case can add the select box operator to a menu in the UV editor space, set the selection to our range and exec the operator so it does not wait for input via the UI.
Appended as choice
Select UV Image Bounds in the select menu of UV / Image Editor.
def draw(self, context):
layout = self.layout
layout.operator_context = 'EXEC_DEFAULT'
op = layout.operator('uv.select_box', text="Select UV Image Bounds")
op.mode = 'SET'
op.xmin = 0
op.xmax = 1
op.ymin = 0
op.ymax = 1
op.wait_for_input = False
op.pinned = False
PS May notice that in GIF some UV verts are shown selected outside the 0-1 range when in sync selection mode. This is because a vert can have many uvs (1 per loop) and need only one assoc. UV in range for all to be selected.
Run this script in object mode.
Can do this pretty quickly using the
foreach_set methods to quickly get and set data.
import numpy as np
ob = bpy.context.object
me = ob.data
uv_layer = me.uv_layers.active
# get uv values
uvs = np.empty((2 * len(me.loops), 1))
u, v = uvs.reshape((-1, 2)).T
(u >= 0) & (u <= 1),
(v >= 0) & (v <= 1)
PS. Relatively new to numpy. Feel there could be a quicker way still to create the True / False mask directly from
uvs above. Please advise re any tips in this direction.