GSoC 2021 : UV Editor Improvements - Weekly Reports

Weekly reports on the UV Editor improvements project will be shared on this post.
Here’s a link to my proposal : User:Sidd017/Proposal - Blender Developer Wiki

Design task for the project can be found here : ⚓ T88990 UV Editor Improvements - GSoC 2021

Separate post for feedback can be found here : GSoC 2021: UV Editor Improvements - Feedback

Community Bonding period (17 May - 7th June)

Progress so far (17th June - 31st May) :

  • Very little activity till 25th May due to college exams
  • Contacted my mentor (Campbell Barton) on
  • Studied the code related to the pack islands operator. Specific focus on box packing - code in boxpack_2d.c and uvedit_islands.c
  • Experimenting with the pack islands operator code to understand how it works

Final week

Until 7th June I plan to :

  • Continue studying the code related to the UV editor. More focused on :
    1. Operators in uvedit_unwrap_ops.c
    2. uvedit_islands.c
    3. bmesh_query_uv.c
    4. ED_uvedit.h
    5. Boxpack_2d.c
  • Review the ideas in my proposal and update them
  • Plan a meeting with Daniel Bystedt to discuss ideas and finalize implementation details

Community Bonding period - Final week (31 May to 6 June)

  • Meeting with Daniel Bystedt to discuss and finalize implementation details for ideas in the proposal. Main points of discussion :
    • The original idea of packing UVs to correct/desired UDIM was limited to only work when the user had a UDIM texture present in the UV editor. It was agreed that the user should never need a UDIM sequence to dictate how the UV will pack or unwrap. Task description/design was updated accordingly.
    • It was agreed that making the increment snapping value (default : 0.0625 units) user-editable in the UV editor didn’t have many practical benefits. Use cases for this are limited and would create problems in UV workflows. Further discussion with mentor is required for this.
    • Adding an option to the new pack islands to area operator, where the user can decide if they want islands to be scaled when packing UVs.
  • Revised working order for GSoC tasks is listed below :
    • Pack UV islands to correct/specified UDIM (T78397) :
    • Pack UV islands to box area (T78398)
    • Dynamic Grid (T78389)
    • Grid snapping in the UV editor (T78391)
    • Make increment snapping value user-editable in the UV editor (No task created on d.b.o. Original idea can be found in proposal)
  • Started and completed a rough implementation for the first task - pack islands to correct/specified UDIM.
  • Experimented with the code in overlay_grid.c, mostly changing the UDIM grid density.
  • Figured out how to toggle/hide operator properties in the UI
  • Continued study of the box packing algorithm used in Boxpack_2d.c

Plans for next week - 7 June to 13 June

Official coding period for GSoC starts this week

  • Complete implementation of task - Pack islands to correct/desired UDIM
  • Start working on the implementation for next task - Pack islands to box area. Look for a new box packing algorithm that can work with different areas, similar to BLI_box_pack_2d_fixedarea() .
  • Create a new design task on phabricator for GSoC related tasks. Similar to - (T77408)
  • Discuss with mentor about the usability of idea - Make increment snapping value user-editable in the UV editor

Week 1 : 7 June to 13 June

  • Created a new branch - soc-2021-uv-editor-improvements
  • Created a new design task - (T88990)
  • Completed implementation of first task (Pack islands to correct/specified UDIM) - commit link (pending review)
    • 2 new options added to the pack islands operator
      Screenshot (237)
    • Closest UDIM will pack the selected islands to the UDIM they were originally placed on. If the selected islands were not placed on any UDIM tile they will be packed to the nearest UDIM tile
    • Specified UDIM will let the user define the UDIM they want to pack the selected islands to
      Screenshot (238)
    • Implementation works with UDIM grid and UDIM textures
  • Submitted a patch for a minor fix (D11582). This is implemented in the soc-2021-uv-editor-improvements branch
  • Started working on the second task - Pack islands to box area

I couldn’t work this weekend since I got vaccinated on Saturday (12 June) and was down with fever.

Plans for next week - 14 June to 20 June

  • Continue working on the second task - pack islands to box area
  • Test the implementation for the first task
    • Refactor the code and cleanup - create smaller functions to simplify logic
    • Investigate bugs or deviations from intended behavior

Thanks for your contribution!
I personally have several proposals:

  1. Alignment tools: can be used to manually align and arrange uv islands, works just like 2D graphic softwares adobe illustrator or inkscape etc.
  2. Average islands scale according to the active island: the way Average islands scale command currently works is to scale every selected island to match a ratio. By adding a option, to make it possible to set the active island to be the base or reference, keeping it untouched and scale others.
  3. Export UV Layout with real world units: by now, blender can exports vector file formats as SVG and EPS, consider supporting pdf format and keep it’s size and unit the same as the meshs’ size and unit. A very good reference implent is a addon comes with blender called “Export Paper Model”.

Finally, wish your project in smooth progress!


Thanks @baoyu !

Regarding your proposals

  1. For alignment tools, there’s a similar task created here : ⚓ T78408 Arrange and align selected uv islands .
  2. Average islands scale according to the active island : The idea does seem like a nice addition to the existing average islands scale operator. I’ve added it to a separate list of secondary tasks and will look into it once I’ve completed my primary deliverables.
  3. Export UV Layout with real world units : This actually falls out of scope for the summer of code project, since I’m primarily working with the UV editor.

Indeed, your thoughts make sense. Appreciate! :grin:

1 Like

Week 2 : 14 June to 20 June

Completed a basic implementation of the second task - Pack islands to box area (T78398)

A few issues with the new operator that need to be resolved

  • When scale islands is disabled, islands that do not fit within the packing area are transformed to the bottom left corner where they will overlap with other islands
  • Zooming in/out in the UV editor changes the packing area when the operator is used again by modifying one it’s properties

Plans for next week - 21 June to 27 June

  • Fix issues with the new operator listed above
  • Start and complete implementation for next task - Dynamic grid (T78389)
  • Schedule a short meeting with mentor to resolve a few design issues

10 posts were merged into an existing topic: GSoC 2021: UV Editor Improvements - Feedback

Week 3 : 21 June to 27 June

  • Implemented Dynamic Grid as described in design task - T78389
  • Worked on replicating Grid behavior of the 3D viewport in the UV/Image Editor. Specifically adding more/less divisions to the grid when zooming in/out in the viewport.
    • Investigated the code used for drawing the grid overlay in the 3D viewport and UV/Image editor. Also studied relevant shaders - grid_vert.glsl and grid_frag.glsl
    • Implemented a rough version of the grid in the UV editor. Currently working on a patch for the same.
  • Added a property for displaying packing area coordinates in the pack islands to area operator
  • Minor cleanup and fix

Plans for next week - 28 June to 4 July

  • Work on clean-up, refactoring and bug fixing.
  • Complete the implementation for improved UV editor grid. A few design decisions need to be finalized with mentor
  • Look into the implementation for the next task - Grid snapping in the UV editor

Week 4 : 28 June to 4 July

Plans for next week - 5 July to 11 July

  • Update the design task T88990 and add details about the progress made so far.
  • Start working on the 4th task - Grid snapping in UV editor and hopefully complete it this week.

Week 5 : 5 July to 11 July

  • Added Absolute grid snap in UV editor :
    • Initial plan was to add Grid snapping as a new snapping option, but since it only affects UVs during translation/moving, I decided to add it as a toggle instead.
      Screenshot (272)
    • This replicates the same option found in the 3D viewport and makes it more consistent across both editors
    • Works with the new subdividing grid, and dynamic grid as well
  • Did some general testing on the soc branch, to identify any bugs or issues that need to be addressed. Apart from some minor issues I didn’t notice anything serious.
  • Worked on a small improvement for pack islands to area operator
    • Island rotation when scale islands is disabled is inefficient in the current implementation.
    • Tried implementing a better solution for this, but has some issues that need to be resolved

Due to some unfortunate events, this week wasn’t much productive.

Plans for next week - 12 July to 18 July

First evaluation this week

  • Complete the small improvement for pack islands to area operator
  • Work on clean up and refactoring for the work done so far
  • Short meeting with mentor to discuss further tasks

Week 6 : 12 July to 18 July

Completed an implementation of UV Offset operator (T78405)

  • Selected UVs can be moved with an offset that is specified by 2 different sets of key maps
    • CTRL + ARROW KEYS - Offset is the distance between 2 UDIMs
    • ALT + ARROW KEYS - Offset is one dynamic grid unit
  • A few bugs need to be addressed when using this operator with UV sync selection

Started working on T76545 - Edge selection support for UV editing

  • Mostly spent time studying the code in uvedit_select.c
  • Work for this task will be uploaded as a separate patch since I want to get an early review on this
  • Started working on some minor changes in the selection code. Mostly adding use cases for new selection flag (MLOOPUV_EDGESEL)
  • Current solution I’m working on ensures that each MLoopUV is associated with a UV vertex and edge. Each UV edge will be formed by 2 consecutive loops in the same face and setting the edge selection flag for the first loop ensures that the edge for that loop is marked as selected.
  • This solution ensures that if 2 continuous UV vertices are selected and the edge selection flag is not set for their corresponding UV edge, then that edge will not be marked as selected in the UV editor. This overcomes the current limitation which marks an UV edge as selected by only checking if the 2 associated UV vertices are selected.
  • I’m still working on how to draw selected UV edges and flushing selection between vertices and edges. For the drawing part I suspect most of the work to be done in overlay_edit_uv.c and draw_cache_extract_mesh_extractors.c

Plans for next week - 19 July to 25 July

  • Continue working on the task - Edge selection support for UV editor.
  • Spend sometime to work on cleanup for the soc branch

Week 7 : 19 July to 25 July

Worked on T76545 - Edge selection support for UV editing. I decided to not commit the work done for this to the soc branch and created a separate patch instead.
Work in progress patch for this task : ⚙ D12028 UV: Edge selection support

  • Reverted the changes made in the commit ( rB9fa29fe7652a), which removed the UV edge selection flag (MLOOPUV_EDGESEL)
  • Refactored the existing element selection functions for vertex, edge and face selection to use the UV edge selection flag.
  • Added new functions for selecting UV vertices and edges that share the same location (on mesh or in UV space)
  • Sticky selection modes now respect the current UV selection modes with a few exceptions (design tradeoffs). This means, edge selection mode will only allow edges to be selected and similar case for other UV selection modes as well. This fixes the previous behavior where edge selection+sticky vertex would allow edges and a few stray vertices to be selected as well.
  • Made changes to the UV select all operator to use the edge selection flag. As a temporary fix, invert all for face and island selection modes, both use the logic used for vertex selection mode as fallback.
  • Added a penalty factor to uv_find_nearest_edge() similar to the one used in uv_find_nearest_vert(). Previously with sticky selection disabled, if 2 UV edges shared the same position, then trying to select any of the 2 edges would always select a particular (fixed) edge instead.

Presently, there’s no way to visually differentiate between a selected UV edge and a state where only 2 consecutive UV vertices are selected (edge between them isn’t selected).
I tried experimenting with the shaders but finally decided to work on this later since I was unable to come up with a temporary fix for this.

Due to some time constraints, I couldn’t work on code cleanup for the soc branch this week.

Plans for next week - 26 July to 1 August

  • Work on refactoring the existing UV selection operators (box, lasso, circle)
  • Work on flushing selections between vertices and edges.
  • Spend sometime to work on cleanup for the soc branch (hopefully)

Week 8 : 26 July to 1 August

  • Added edge selection support for UV operators :
    • Mouse select
    • Box select
    • Circle select
    • Lasso select
    • Select/deselect all
    • Invert selection
    • Select more/less
  • Edge and Face selection in UV editor should now function similar to how they work in the 3D viewport. (with UV sync selection disabled)
    New UV face selection behavior is demonstrated below (for comparison with current master behavior, refer T78757):

    New UV edge selection behavior :
  • Added functions for flushing UV selections between verts and edges (mode independent flushing). Flushing based on selection modes is currently not implemented since switching between UV selection modes is not done using an operator.
  • Fixed a bug introduced in last week’s implementation
    • With edge select + sticky location mode, trying to deselect an edge would deselect the neighboring edges as well.
    • This was actually caused by an invalid selection state where the neighboring edges were marked as selected but one of their vertices was not selected.

Plans for next week - 2 August to 8 August

  • Code cleanup
  • Provide builds of the soc branch and D12028, so that users can test/play with implemented features, provide feedback and report any bugs that need to be fixed
  • If time permits, work on edge selection support for edge loop and edge ring select operators

6 posts were merged into an existing topic: GSoC 2021: UV Editor Improvements - Feedback

Week 9 : 2 August to 8 August

Plans for next week - 9 August to 15 August

I have some college work that will keep me occupied till 12th August (Thursday).

  • Work on cleanup, testing and fixes
  • If time permits, work on adding edge selection support for UV select path and UV rip tool.

Week 10 : 9 August to 15 August

Final week of GSoC coding period. This week I mostly worked on clean up and testing implemented features on both soc branches.

  • I had some college work that kept me busy for a few days so I couldn’t work on adding edge selection support for UV select path and Rip tool.
  • Updated D12028 to reflect all the changes made on the soc-2021-uv-edge-select-support branch
  • Updated experimental builds for users to test. The builds are available at Blender Builds - under branch names :
    • soc-2021-uv-editor-improvements
    • soc-2021-uv-edge-select-support
  • Notable change : Subdividing grid for the UV editor now starts with a size of 8x8 (previously 4x4) and zooming in will further subdivide each grid division into smaller 8x8 grid units.

Plans for final week : 16 August to 23 August

Prepare for final GSoC evaluations

  • Continue with cleanup and fixes
  • Prepare patches for code submission (both soc branches)
  • Prepare Final Report and documentation