Git Product home page Git Product logo

uvsquares's Introduction

UV Squares

Blender's UV Editor tool that reshapes UV quad selection into a grid.

Installation

Go to Edit > Preferences > Addons > Install and either select .zip file or the unzipped uv_squares.py file.

Location

UV Editor > N Panel > UV Squares

Support

If you need help with the addon or you want to support me back please do so over BlenderMarket ❤️: https://blendermarket.com/products/uv-squares

Affiliates

If you are advertising the addon through a blog/course/video please contact me and I will give you a percent of the sales!

Features

  • Reshape selected UV faces (quads) to grid of either:
    • equivalent squares (each square area is the same)
    • or by respect to shape of an active quad (area of rectangles can differ but they fit into straight lines)
  • convert multiple islands at once (select more than one separate UV chunk)
  • Align sequenced vertices on an axis (X or Y axis is determined by slope automatically):
    • make them equally distanced
  • Join selected faces/vertices to closest unselected vertices
  • Select single vertex and snap 2d cursor to it

Shortcut

  • Grid/Align: Alt + E

Notes

Aligning to axis

  • All vertices have to be ordered/sequenced by x/y value depending of X/Y axis that they are getting aligned to. Otherwise you will have swapped vertices in the result.
  • What script does here:
    • set pivot to cursor (sets it back after)
    • 2d cursor will snap to closest vertex and the alignment will be made at that verts x/y value, depending on the axis
    • restrict scale to axis (recognize X or Y by the slope)
    • scale to 0 to where the cursor has snapped

Reshaping to grid

  • Works on any UV selection shape of quad faces
  • You can specify an active quad by making it the last selected face. If not, one face will automatically be taken
  • 2d cursor is snapped to closest corner and is determining the direction for calculating the length of start and end of grid as well as length of one unit for square grid

Join vertices

  • Snaps selected vertices to closest non selected
    • For faces, if you want to connect islands back to their original place:
    • use stitch (shortcut: Alt V, while stitching press I to toggle island)

Development

  • When bumping versions increment both bl_info objects, one in __init__.py which is used for .zip install, and another in the main uv_squares.py file.

uvsquares's People

Contributors

joseconseco avatar marklescroart avatar mdtipton avatar moderlab avatar p2or avatar radivarig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uvsquares's Issues

not work

what happen with this ???
can we fix ??

blender_pUDfgGFobi
blender_0AoBFsiBSg
blender_rbWyN2Sqc6
blender_ulxcZP4TI9

Python script error in function "to grid by shape" (to square grid works fine)

Hello,

your blender script is great. I am using it in blender 2.81a (newest version)
But I think I found a bug.
As soon as I select "to grid by shape" - I get a traceback. (see attached picture)

Fehler_Grid

The function "to square grid" works fine.

The function "snap to axis" throws the following error:

Fehler_Snap_to_Axis

"Snap with equal distance" throws an error too:

Error_snap_with_equal_distance

OS: Linux Mint 19.3

Thanks for this plug-in!

Regards
Peter

To Grid By Shape in 2.91

I saw the previous post by boski05 but I haven't been able to find a work around for a similar problem in v2.91.2 with a newly installed copy of UV Squares.

Is there a solution for this or am I doing something wrong?

Here is the behaviour for reference.

Select linked 'L'
UV To Grid by Shape Before
Align 'To Grid By Shape'
UV To Grid by Shape After

Broken in Blender 3

Pressing on To Grid By Shape

Python: Traceback (most recent call last):
File "C:\Users\a\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 871, in execute
main(context, self)
File "C:\Users\a\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 52, in main
main1(obj, context, operator, square, snapToClosest)
File "C:\Users\a\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 144, in main1
main2(targetFace, island)
File "C:\Users\a\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 133, in main2
else: FollowActiveUV(operator, me, targetFace, faces)
File "C:\Users\a\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 480, in FollowActiveUV
bmesh.update_edit_mesh(me, loop_triangles=False)
TypeError: update_edit_mesh() takes at most 1 positional argument (2 given)

location: :-1

Pressing on To Square Grid

Python: Traceback (most recent call last):
File "C:\Users\a\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 857, in execute
main(context, self, True)
File "C:\Users\a\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 52, in main
main1(obj, context, operator, square, snapToClosest)
File "C:\Users\a\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 144, in main1
main2(targetFace, island)
File "C:\Users\a\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 132, in main2
if square: FollowActiveUV(operator, me, targetFace, faces, 'EVEN')
File "C:\Users\a\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 480, in FollowActiveUV
bmesh.update_edit_mesh(me, loop_triangles=False)
TypeError: update_edit_mesh() takes at most 1 positional argument (2 given)

location: :-1

Blender 2.91 - Installed and Enabled, but not Showing up in the N Panel

Hello,

I'm terribly sorry to bother you. I am working in Blender 2.91, and I have installed the UvSquares addon per the instructions and enabled it. No error messages were generated, but it is not visible in the UV Editing tab > N Panel. checking and un-checking to enable/disable has no effect.

I have restarted blender, tried removing and re-installing the addon, and tried both install methods (via the .ZIP file and the python file alone)

Is this addon supported in Blender 2.91? Do you have any suggestions for me?

Doesn't work in Blender 3.0

I had this error when tried to run UV square tool

location: <unknown location>:-1
Error: Python: Traceback (most recent call last):
  File "C:\Users\Vas_v13\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 871, in execute
    main(context, self)
  File "C:\Users\Vas_v13\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 52, in main
    main1(obj, context, operator, square, snapToClosest)
  File "C:\Users\Vas_v13\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 144, in main1
    main2(targetFace, island)
  File "C:\Users\Vas_v13\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 133, in main2
    else: FollowActiveUV(operator, me, targetFace, faces)
  File "C:\Users\Vas_v13\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\UvSquares-master\uv_squares.py", line 480, in FollowActiveUV
    bmesh.update_edit_mesh(me, False)
TypeError: update_edit_mesh() takes at most 1 positional argument (2 given)

UV Squares not working on Blender 3.2

Hello. UV Squares in Blender 3.2 is not working.
I get this error when I applied "to grid by shape".
The addon doesn't work, and throws this error:

Python: Traceback (most recent call last):
File "C:\Users\3DCompositor\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\UvSquares-master\uv_squares.py", line 857, in execute
main(context, self, True)
File "C:\Users\3DCompositor\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\UvSquares-master\uv_squares.py", line 52, in main
main1(obj, context, operator, square, snapToClosest)
File "C:\Users\3DCompositor\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\UvSquares-master\uv_squares.py", line 144, in main1
main2(targetFace, island)
File "C:\Users\3DCompositor\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\UvSquares-master\uv_squares.py", line 132, in main2
if square: FollowActiveUV(operator, me, targetFace, faces, 'EVEN')
File "C:\Users\3DCompositor\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\UvSquares-master\uv_squares.py", line 480, in FollowActiveUV
bmesh.update_edit_mesh(me, False)
TypeError: update_edit_mesh() takes at most 1 positional argument (2 given)

Issues with new blender

This addon doesn't seem to want to install on Blender 2.75. I am using windows 10.

When I try to add it, nothing happens. When looking for it in the addons list it isn't there.

Works only with active objects.

Hi, there is a problem when You have multiple object selected and You try to work with all of them at once. For example You can only ractangle uv island from active object, its not working with other selected objects. :/

Best regards,
PM

Addon is non-responsive.

Pressing any of the functional buttons does not yield any results. The UV is not modified in any way, and I have tried all of them.
image

question with educational reason

What do you mean exactly with this and how does it work? I do not understand the concept very well
"Please disable 'Keep UV and edit mesh in sync'"

def main(context, operator, square = False, snapToClosest = False):
    if context.scene.tool_settings.use_uv_select_sync:
        operator.report({'ERROR'}, "Please disable 'Keep UV and edit mesh in sync'")
        # context.scene.tool_settings.use_uv_select_sync = False
        return

Divison by zero

Hello,

I have just experienced an issue with the following line:

fac = edge_lengths[l_b[2].edge.index][0] / edge_lengths[l_a[1].edge.index][0]

When two vertices are on the same coordinates due to extruding and accidentally not moving, there will be a division-by-zero error.

Maybe displaying a report message about that possible mistake would be good.

if EXTEND_MODE == 'LENGTH_AVERAGE':
    try:
        fac = edge_lengths[l_b[2].edge.index][0] / edge_lengths[l_a[1].edge.index][0]
    except ZeroDivisonError:
        operator.report({'ERROR'}, "Two vertices have same coordinates! Aborting...")
        # Abort action...
elif EXTEND_MODE == 'LENGTH':

I hope that helps you.

Best regards and stay healthy,

Maik Wöhl

Copyright

Does using this plugin in my project violate copyright?

Support tris to square ratio

Hello, please, a tri face to a 1:1 square ratio would be super helpful and it's a feature in no other addon (trust me, I looked into each one of them)

Python error

Blender 3.3
Unwrapping a 'flat' donut plane - to Grid by Shape

Am I using this tool incorrectly?

image

2.8x required....

Problem : the zip folder direct download creates 2.8x reqd issues when i tried to install it in 2.82 here..
Solved it by installing the actual "uv_squares.py" only directly ..

Syntax warnings from improperly formatted comparisons

They recently bumped the python version for the Blender dailies, which means that using identity checks on literals — using is and is not instead of == and != when you're doing comparisons with numbers and strings — will now produce syntax warnings.

It looks like there's only a handful to fix, but I figured it'd be helpful to know in advance, so you don't have to deal with a bunch of duplicate reports when 2.93 ships.

"To Grid By Shape" error in update_edit_mesh()

Using Blender 3.0.1 and UvSquares 0.14.1 (freshly downloaded from here).

While trying to use "To Grid By Shape", I got an error dialog, pointing to line 480 of uv_squares.py - apparently, "bmesh.update_edit_mesh()" only takes one argument, but two are given.

Removing the second argument restores functionality.

Thanks for this fantastic add-on! :-)

keymaps registration error when running `blender -b --python-console`

http://www.dalaifelinto.com/?p=1153 reminds us that blender can also be accessed as a python console.

blender -b --python-console

uvsquares causes an exception, and I know why this happens.

Exception in module register(): ...\Blender\2.82\scripts\addons\UvSquares-master\__init__.py
Traceback (most recent call last):
  File "...\Blender 2.82\2.82\scripts\modules\addon_utils.py", line 382, in enable
    mod.register()
  File "...\Blender\2.82\scripts\addons\UvSquares-master\uv_squares.py", line 991, in register
    km = wm.keyconfigs.addon.keymaps.new(name='UV Editor', space_type='EMPTY')
AttributeError: 'NoneType' object has no attribute 'keymaps'
Traceback (most recent call last):
  File "...\Blender 2.82\2.82\scripts\modules\addon_utils.py", line 351, in enable
    mod = __import__(module_name)

In background mode there's no such thing has keyconfigs.user, because headless mode doesn't need key combos.

Not a serious bug, but worth fixing.

Error in the newest version of Blender

Blender version: 3.1.2
Windows version: Windows-10-10.0.19044-SP0
Python version: 3.10.2

Steps to replicate: Open up a new Blender file, unwrapping the default cube and using any part of the addon on the unwrap

uv_squares.py, line 906, in execute
bl_options = {'REGISTER', 'UNDO'}

uv_squares.py, line 49, in main
uv_squares.py, line 57, in main
# context.scene.tool_settings.use_uv_select sync = False
AttributeError: module 'time' has no attribute 'clock'

location: <unknown location>:-1

UvSquares_v1.14.2.zip won't install with Blender 3.6

Hi,

Just to let you know.

UvSquares_v1.14.2.zip won't install with Blender 3.6.

Enabling the module gives the following error.

File "whereItIsSupposedToBe\addon_utils.py", line 333, in enable mod = import(module_name)
ModuleNotFoundError: No module named 'UvSquares-master'

Regards.

Issue with Blender 4

I'm having an issue with the addon and blender 4.0.1. I can install the addon without issue but when I try to use it I receive this traceback.

Python: Traceback (most recent call last): File "C:\Users\Ollie\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\UvSquares-master\uv_squares.py", line 871, in execute main(context, self) File "C:\Users\Ollie\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\UvSquares-master\uv_squares.py", line 52, in main main1(obj, context, operator, square, snapToClosest) File "C:\Users\Ollie\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\UvSquares-master\uv_squares.py", line 144, in main1 main2(targetFace, island) File "C:\Users\Ollie\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\UvSquares-master\uv_squares.py", line 133, in main2 else: FollowActiveUV(operator, me, targetFace, faces) File "C:\Users\Ollie\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\UvSquares-master\uv_squares.py", line 480, in FollowActiveUV bmesh.update_edit_mesh(me, loop_triangles=False) TypeError: update_edit_mesh() takes at most 1 positional argument (2 given)

I've tested and all works in 3.6

Interestingly, removing the loop_triangles=False from line 480 seems to make it work, though I'm sure this breaks functionality elsewhere.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.