Compare commits
23 Commits
temp-ui-cp
...
soc-2021-u
Author | SHA1 | Date | |
---|---|---|---|
dbc41b30f8 | |||
99a2af76d1 | |||
139606bd37 | |||
4e6f73e5df | |||
7f8f2ff1a8 | |||
52822b218d | |||
90707ca72f | |||
29deaaee00 | |||
fdc9318360 | |||
64d640d196 | |||
2766e00ecf | |||
6f61cd90cc | |||
70824abc3f | |||
a7f24a8307 | |||
752c840f1e | |||
ddbbbf40f6 | |||
a4af0f530c | |||
a342ea1cf5 | |||
e88563e472 | |||
db821af172 | |||
d6e02d92e1 | |||
8b3b353caf | |||
035fa7985d |
@@ -2,9 +2,10 @@
|
||||
#pragma BLENDER_REQUIRE(common_overlay_lib.glsl)
|
||||
|
||||
layout(lines) in;
|
||||
layout(triangle_strip, max_vertices = 4) out;
|
||||
layout(triangle_strip, max_vertices = 6) out;
|
||||
|
||||
in float selectionFac[2];
|
||||
in float edgeSelectionFac[2];
|
||||
flat in vec2 stippleStart[2];
|
||||
noperspective in vec2 stipplePos[2];
|
||||
|
||||
@@ -35,6 +36,12 @@ void main()
|
||||
vec2 ss_pos[2];
|
||||
vec4 pos0 = gl_in[0].gl_Position;
|
||||
vec4 pos1 = gl_in[1].gl_Position;
|
||||
/* TODO(verify): Calculating edge-center in clip space might cause errors due to precision loss?? */
|
||||
vec4 edgeCenter = (pos0 + pos1) / 2.0;
|
||||
bool is_edge_selected = edgeSelectionFac[0] == 1.0;
|
||||
/* Depth value as specified in vertex shader */
|
||||
edgeCenter.z = is_edge_selected ? 0.25 : 0.35;
|
||||
|
||||
ss_pos[0] = pos0.xy / pos0.w;
|
||||
ss_pos[1] = pos1.xy / pos1.w;
|
||||
|
||||
@@ -54,8 +61,14 @@ void main()
|
||||
vec2 line_perp = vec2(-line_dir.y, line_dir.x);
|
||||
vec2 edge_ofs = line_perp * sizeViewportInv * ceil(half_size);
|
||||
|
||||
vec2 stippleStartCenter, stipplePosCenter;
|
||||
/* TODO(stipple pattern): Probable incorrect implementation - used as specified in vertex shader */
|
||||
stippleStartCenter = stipplePosCenter = 500.0 + 500.0 * (edgeCenter.xy / edgeCenter.w);
|
||||
|
||||
do_vertex(pos0, selectionFac[0], stippleStart[0], stipplePos[0], half_size, edge_ofs.xy);
|
||||
do_vertex(pos0, selectionFac[0], stippleStart[0], stipplePos[0], -half_size, -edge_ofs.xy);
|
||||
do_vertex(edgeCenter, edgeSelectionFac[0], stippleStartCenter, stipplePosCenter, half_size, edge_ofs.xy);
|
||||
do_vertex(edgeCenter, edgeSelectionFac[0], stippleStartCenter, stipplePosCenter, -half_size, -edge_ofs.xy);
|
||||
do_vertex(pos1, selectionFac[1], stippleStart[1], stipplePos[1], half_size, edge_ofs.xy);
|
||||
do_vertex(pos1, selectionFac[1], stippleStart[1], stipplePos[1], -half_size, -edge_ofs.xy);
|
||||
|
||||
|
@@ -6,6 +6,7 @@ in vec2 au;
|
||||
in int flag;
|
||||
|
||||
out float selectionFac;
|
||||
out float edgeSelectionFac;
|
||||
noperspective out vec2 stipplePos;
|
||||
flat out vec2 stippleStart;
|
||||
|
||||
@@ -20,7 +21,9 @@ void main()
|
||||
half_pixel_offset;
|
||||
|
||||
bool is_select = (flag & VERT_UV_SELECT) != 0;
|
||||
bool is_edge_selected = (flag & EDGE_UV_SELECT) != 0;
|
||||
selectionFac = is_select ? 1.0 : 0.0;
|
||||
edgeSelectionFac = is_edge_selected ? 1.0 : 0.0;
|
||||
/* Move selected edges to the top
|
||||
* Vertices are between 0.0 and 0.2, Edges between 0.2 and 0.4
|
||||
* actual pixels are at 0.75, 1.0 is used for the background. */
|
||||
|
@@ -149,6 +149,13 @@ void uvedit_edge_select_set_with_sticky(const struct SpaceImage *sima,
|
||||
const bool select,
|
||||
const bool do_history,
|
||||
const uint cd_loop_uv_offset);
|
||||
void uvedit_edge_select_shared_location(const struct Scene *scene,
|
||||
struct BMEditMesh *em,
|
||||
struct BMLoop *l,
|
||||
const bool select,
|
||||
const bool use_mesh_location,
|
||||
const bool do_history,
|
||||
const uint cd_loop_uv_offset);
|
||||
void uvedit_edge_select_set(const struct Scene *scene,
|
||||
struct BMEditMesh *em,
|
||||
struct BMLoop *l,
|
||||
@@ -172,6 +179,13 @@ void uvedit_uv_select_set_with_sticky(const struct SpaceImage *sima,
|
||||
const bool select,
|
||||
const bool do_history,
|
||||
const uint cd_loop_uv_offset);
|
||||
void uvedit_uv_select_shared_location(const struct Scene *scene,
|
||||
struct BMEditMesh *em,
|
||||
struct BMLoop *l,
|
||||
const bool select,
|
||||
const bool use_mesh_location,
|
||||
const bool do_history,
|
||||
const uint cd_loop_uv_offset);
|
||||
void uvedit_uv_select_set(const struct Scene *scene,
|
||||
struct BMEditMesh *em,
|
||||
struct BMLoop *l,
|
||||
|
@@ -86,11 +86,13 @@ bool uv_find_nearest_vert_multi(struct Scene *scene,
|
||||
bool uv_find_nearest_edge(struct Scene *scene,
|
||||
struct Object *obedit,
|
||||
const float co[2],
|
||||
const float penalty,
|
||||
struct UvNearestHit *hit);
|
||||
bool uv_find_nearest_edge_multi(struct Scene *scene,
|
||||
struct Object **objects,
|
||||
const uint objects_len,
|
||||
const float co[2],
|
||||
const float penalty,
|
||||
struct UvNearestHit *hit);
|
||||
|
||||
/**
|
||||
@@ -132,6 +134,17 @@ BMLoop *uv_find_nearest_loop_from_edge(struct Scene *scene,
|
||||
struct BMEdge *e,
|
||||
const float co[2]);
|
||||
|
||||
/* flush uv selection */
|
||||
void uv_flush_vert_to_edge(struct Scene *scene,
|
||||
struct BMEditMesh *em,
|
||||
const int cd_loop_uv_offset);
|
||||
void uv_flush_edge_to_vert(struct Scene *scene,
|
||||
struct BMEditMesh *em,
|
||||
const int cd_loop_uv_offset);
|
||||
void uv_flush_edge_to_vert_with_sticky_loc(struct Scene *scene,
|
||||
struct BMEditMesh *em,
|
||||
const int cd_loop_uv_offset);
|
||||
|
||||
/* utility tool functions */
|
||||
|
||||
void uvedit_live_unwrap_update(struct SpaceImage *sima,
|
||||
|
@@ -627,7 +627,7 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve
|
||||
|
||||
else if (uv_selectmode & UV_SELECT_EDGE) {
|
||||
UvNearestHit hit = UV_NEAREST_HIT_INIT_MAX(®ion->v2d);
|
||||
if (!uv_find_nearest_edge(scene, obedit, co, &hit)) {
|
||||
if (!uv_find_nearest_edge(scene, obedit, co, 0.0f, &hit)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -2561,7 +2561,7 @@ static StitchState *stitch_select(bContext *C,
|
||||
return state;
|
||||
}
|
||||
}
|
||||
else if (uv_find_nearest_edge_multi(scene, ssc->objects, ssc->objects_len, co, &hit)) {
|
||||
else if (uv_find_nearest_edge_multi(scene, ssc->objects, ssc->objects_len, co, 0.0f, &hit)) {
|
||||
/* find StitchState from hit->ob */
|
||||
StitchState *state = NULL;
|
||||
for (uint ob_index = 0; ob_index < ssc->objects_len; ob_index++) {
|
||||
|
@@ -347,7 +347,7 @@ typedef struct MLoopUV {
|
||||
|
||||
/** #MLoopUV.flag */
|
||||
enum {
|
||||
/* MLOOPUV_DEPRECATED = (1 << 0), MLOOPUV_EDGESEL removed */
|
||||
MLOOPUV_EDGESEL = (1 << 0),
|
||||
MLOOPUV_VERTSEL = (1 << 1),
|
||||
MLOOPUV_PINNED = (1 << 2),
|
||||
};
|
||||
|
@@ -2102,6 +2102,10 @@ static void rna_def_mloopuv(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_VERTSEL);
|
||||
RNA_def_property_ui_text(prop, "UV Select", "");
|
||||
|
||||
prop = RNA_def_property(srna, "select_edge", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_EDGESEL);
|
||||
RNA_def_property_ui_text(prop, "UV Edge Select", "");
|
||||
}
|
||||
|
||||
static void rna_def_mloopcol(BlenderRNA *brna)
|
||||
|
@@ -72,6 +72,7 @@ static int bpy_bmloopuv_uv_set(BPy_BMLoopUV *self, PyObject *value, void *UNUSED
|
||||
|
||||
PyDoc_STRVAR(bpy_bmloopuv_flag__pin_uv_doc, "UV pin state.\n\n:type: boolean");
|
||||
PyDoc_STRVAR(bpy_bmloopuv_flag__select_doc, "UV select state.\n\n:type: boolean");
|
||||
PyDoc_STRVAR(bpy_bmloopuv_flag__select_edge_doc, "UV edge select state.\n\n:type: boolean");
|
||||
|
||||
static PyObject *bpy_bmloopuv_flag_get(BPy_BMLoopUV *self, void *flag_p)
|
||||
{
|
||||
@@ -109,6 +110,11 @@ static PyGetSetDef bpy_bmloopuv_getseters[] = {
|
||||
(setter)bpy_bmloopuv_flag_set,
|
||||
bpy_bmloopuv_flag__select_doc,
|
||||
(void *)MLOOPUV_VERTSEL},
|
||||
{"select_edge",
|
||||
(getter)bpy_bmloopuv_flag_get,
|
||||
(setter)bpy_bmloopuv_flag_set,
|
||||
bpy_bmloopuv_flag__select_edge_doc,
|
||||
(void *)MLOOPUV_EDGESEL},
|
||||
|
||||
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
Reference in New Issue
Block a user