WIP: UV Editor Edge Slide #110868
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#110868
Loading…
Reference in New Issue
No description provided.
Delete Branch "Melissa-Goon/blender:gsoc2023-edge-slide"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This addresses this request for the addition of an edge slide tool to the UV Editor. This feature would allow users to slide UVs towards adjacent edges, providing more convenient ways to edit UV maps.
Possible future improvements:
This is not a full review, this patch makes
BM_vert_step_fan_loop_uv
into a public function, then removes theBM_ELEM_TAG
check.That check is needed for UV rip logic. I'd suggest to make a version of BM_vert_step_fan_loop_uv that takes a function which can be used to filter the faces that are stepped over. This way it's possible to reuse the function in both cases.
4630b95f86
to19bcb7462b
@ -0,0 +49,4 @@
/* -------------------------------------------------------------------- */
/** \name Transform (Edge UV Slide)
* \{ */
typedef struct EdgeSlideUV {
Can be
struct EdgeSlideUV { .. };
(this was a C-convention that changed since your project started and code moved to C++).Also, add doxygen comments before each member, helps readability and clarifies the purpose.
@ -0,0 +52,4 @@
typedef struct EdgeSlideUV {
blender::Vector<BMLoop *> loops; /*Loops associated with this uv*/
BMLoop *side_loop[2];
float sides[2][2];
sides
is not a very meaningful name, without checking the type is could be an index or represent loops themselves.Could be
slide_uv
for e.g.Also, suggest to use
float2 sides[2]
which means you can assign them more easily.Can then be replaced with:
@ -0,0 +63,4 @@
blender::Vector<EdgeSlideUV> *esuvs = static_cast<blender::Vector<EdgeSlideUV> *>(
custom_data->data);
if (esuvs == NULL) {
Note then this is expected to be
nullptr
(also NULL -> nullptr).@ -0,0 +83,4 @@
int i = 0;
BM_ITER_ELEM (loop_v, &lv_iter, v_orig, BM_LOOPS_OF_VERT) {
if (i == 2) {
Explain why this is needed. It also seems likely that using the first 2 loops would give arbitrary results (as the first 2 may be different depending on the internal ordering of data), this is is not a problem explain why in a comment.
@ -0,0 +86,4 @@
if (i == 2) {
break;
}
if (BM_loop_uv_share_vert_check(loop_v, orig_loop, offsets.uv) &&
From reading the body of this code it looks like there is some chance
i
enters the for loop as1
then gets set to 2 or 3.. which would cause out of bounds access foresuv.side_loop[i]
.If the logic guarantees this is never the case, add assertions this never happens and note why.
@ -0,0 +89,4 @@
if (BM_loop_uv_share_vert_check(loop_v, orig_loop, offsets.uv) &&
(loop_v->f == e->l->f || loop_v->f == e->l->radial_next->f))
{
if (!BM_ELEM_CD_GET_BOOL(loop_v->next, offsets.select_vert) &&
Suggestion: use a for loop to access
next/prev
members, avoids duplicating code.This avoids code duplication.
@ -0,0 +138,4 @@
esuv.side_loop[i] = loop_v->next;
i++;
/*Tag all loops of the side so the same side isn't picked twice*/
Suggestion: use a for loop to access
next/prev
members, avoids duplicating code. (see other comment).@ -0,0 +333,4 @@
}
}
/*Any vertex w/ 3+ connected selected edges is ignored*/
*picky* All text comments should be C-style, surrounding spaces & be full sentences.
/* Any vertex with 3+ connected selected edges is ignored. */
@ -0,0 +483,4 @@
blender::Vector<EdgeSlideUV> *slide_edge_loops = static_cast<blender::Vector<EdgeSlideUV> *>(
TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data);
for (int i = 0; i < (*slide_edge_loops).size(); i++) {
Include an explanation for what this loop does (why find the longest edge?).
@ -0,0 +484,4 @@
TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data);
for (int i = 0; i < (*slide_edge_loops).size(); i++) {
float side0_len = len_v2v2((*slide_edge_loops)[i].sides[0], (*slide_edge_loops)[i].orig_uv);
When finding the maximum length, use
len_squared_v2v2
, avoids an unnecessarysqrtf
.@ -0,0 +499,4 @@
if (side_len_max > max_len) {
max_len = side_len_max;
start_uv = (*slide_edge_loops)[i].orig_uv;
(*slide_edge_loops)
seems redundant,slide_edge_loops
can be used here.7ef546a2a4
to34acc9e4f6
34acc9e4f6
toe4b1aa8640
e4b1aa8640
to50cf368bad
@ -0,0 +515,4 @@
static void initEdgeUVSlide(TransInfo *t, wmOperator *op)
{
blender::Vector<EdgeSlideUV> *esd;
t->mode = TFM_UV_EDGE_SLIDE;
source/blender/editors/transform/transform_mode_edge_uv_slide.cc:513:1: error: control reaches end of non-void function [-Werror=return-type]
A subdivided cube is asserting in a simple test:
Pressing G should transform, pressing G-twice should use edge-slide, see how transform in the 3D view works.
@ -0,0 +509,4 @@
if (event->type == MOUSEMOVE) {
calcEdgeSlideCustomPointsUV(t);
return TREDRAW_NOTHING;
}
Missing return.
@ -0,0 +1,554 @@
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2001-2002 NaN
shouldn't be copyright holder, use:50cf368bad
tob5c05035d7
b5c05035d7
to7955fe31f8
@ -0,0 +75,4 @@
custom_data->data = nullptr;
}
void calc_side_loops_from_single_terminating_uv(BMEdge *edge,
Should be
static
.@ -0,0 +121,4 @@
}
}
void calc_side_loops_from_pair(BMLoop *orig_loop, EdgeSlideUV &esuv, BMUVOffsets offsets)
Should be
static
.@ -0,0 +156,4 @@
}
}
void flip_and_set_sides(blender::Vector<EdgeSlideUV> &slide_uv, BMUVOffsets offsets)
Should be
static
.When sliding an edge on a subdivided cube, one of the end-point vertices isn't sliding.
7955fe31f8
to4e0376443a
4e0376443a
to9266ad6d24
9266ad6d24
to4664d33772
4664d33772
to4f2d0463a9
058d06aec8
tod1a48b0c04
d1a48b0c04
todb10f55343
db10f55343
toa896a42d59
@ -0,0 +595,4 @@
static void calcEdgeSlideCustomPointsUV(TransInfo *t)
{
float max_len = 0;
use
_length
suffix,_len
is used for integer lengths in quite a few places still.@ -0,0 +596,4 @@
static void calcEdgeSlideCustomPointsUV(TransInfo *t)
{
float max_len = 0;
float *start_uv, *end_uv;
In some cases, testing with a single vertex
start_uv
isn't initialized, causing a crash.@ -0,0 +599,4 @@
float *start_uv, *end_uv;
int start_region[2], end_region[2];
blender::Vector<EdgeSlideUV> slide_edge_loops = *(static_cast<blender::Vector<EdgeSlideUV> *>(
This should be a pointer or a reference (by convention pointers are used elsewhere... so that can be used here too).
@ -0,0 +646,4 @@
static void initEdgeUVSlide(TransInfo *t, wmOperator * /*op*/)
{
blender::Vector<EdgeSlideUV> *esd;
Move into nested scope (avoids accidental/uninitialized use).
a896a42d59
toc6df8e4264
c6df8e4264
to9bab4bb17d
I'm not a big fan of the idea of creating a new mode, which does the same thing as the existing one, but is made to only work on UVs.
The transform code has "convert" files and "mode" files.
The purpose of "convert" is to allow multiple types of elements (Meshes, UVS, Curves) to work in the same "mode".
But Edge Slide (and Vert Slide) are different because they only work for Meshes. Which is bad since in theory it could also work for Curves, Armatures, Grease Pencil...
Creating another mode just for UVs seems to make the situation worse.
The ideal, in my opinion, would be to adapt the existing Edge Slide (and Vert Slide) to work with UVs as well.
But if this is not possible, the PR description must make clear why.
@mano-wii agree. Using a separate mode was more straightforward to begin with (to avoid having to solve integration issues), but eventually they should be merged unless there is a good reason not to.
Committed in
aaadb5005e
Also added a note to the release notes:
https://projects.blender.org/blender/blender-developer-docs/src/branch/main/docs/release_notes/4.2/modeling.md
Pull request closed