Skip to content

Commit 18a5a73

Browse files
committed
v1.1.2
1 parent 8c4fb56 commit 18a5a73

9 files changed

Lines changed: 55 additions & 3334 deletions

File tree

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# UVgami
22

3-
**Note: This add-on requires a commercial binary found [here](https://uvgami.gumroad.com/l/uvgami).**
4-
53
![UVgami](https://user-images.githubusercontent.com/65575771/211176523-4b9f7aa1-0994-4c54-928f-e0ec319052d9.gif)
64

7-
Effortlessly unwrap your 3D models with UVgami! With just one click, this powerful add-on applies an advanced algorithm to automatically UV unwrap your meshes, minimizing stretching and seams. Plus, the concurrent batch unwrap feature allows you to unwrap multiple meshes simultaneously, saving you even more time. If you want to simplify the process of preparing your models for texturing and streamline your 3D modelling workflow, give UVgami a try today!
5+
![Elephant](https://github.com/DanielBoxer/UVgami/assets/65575771/07dd8351-5acb-493d-b35e-422d8da35a7f)
6+
7+
![Elephant 2](https://github.com/DanielBoxer/UVgami/assets/65575771/bc33389b-b902-4334-85ec-fa637dce0fbb)
8+
9+
![Seam Restrictions](https://github.com/DanielBoxer/UVgami/assets/65575771/632fb52f-b9fc-4b98-a3ed-c8b679fe3102)
10+
11+
![Ostrich](https://github.com/DanielBoxer/UVgami/assets/65575771/44f181df-7d06-4b35-aa32-3ef380a5c986)
12+
13+
![Rhino](https://github.com/DanielBoxer/UVgami/assets/65575771/12b691fc-4ff6-4462-9dbc-b615a85bf7fc)

__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,14 @@
6666
UVGAMI_PG_properties,
6767
UVGAMI_AP_preferences,
6868
)
69-
from .src.updater import addon_updater_ops
7069

7170

7271
bl_info = {
7372
"name": "UVgami",
7473
"author": "Daniel Boxer",
7574
"description": "Automatic UV unwrapping",
7675
"blender": (2, 90, 0),
77-
"version": (1, 1, 1),
76+
"version": (1, 1, 2),
7877
"location": "View3D > Sidebar > UVgami",
7978
"category": "UV",
8079
"doc_url": "",
@@ -120,10 +119,6 @@
120119

121120

122121
def register():
123-
try:
124-
addon_updater_ops.register(bl_info)
125-
except ValueError:
126-
pass
127122
for cls in classes:
128123
bpy.utils.register_class(cls)
129124
bpy.types.Scene.uvgami = bpy.props.PointerProperty(type=UVGAMI_PG_properties)

src/manager.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ def __init__(self):
3535

3636
def start(self):
3737
self.starting_count = len(self.active)
38-
if bpy.context.scene.uvgami.concurrent:
38+
props = bpy.context.scene.uvgami
39+
if props.concurrent:
3940
active_copy = self.active.copy()
40-
for unwrap_idx in range(int(multiprocessing.cpu_count() / 2 - 1)):
41+
for unwrap_idx in range(props.max_cores):
4142
# if there are more cores than meshes
4243
if unwrap_idx == len(active_copy):
4344
break
@@ -50,7 +51,7 @@ def start(self):
5051
self.found_invalid_objects = False
5152
self.finished_count = 0
5253
self.cancelled_count = 0
53-
self.unknown_error = False
54+
self.error_code = 0
5455
self.license_error = None
5556
self.current_viewer = None
5657
self.is_viewer_active = False
@@ -186,9 +187,15 @@ def start_next(self):
186187
"errors", "Some meshes were not able to be unwrapped"
187188
)
188189

189-
if self.unknown_error:
190-
msg.append("An unknown error occurred.")
191-
logger.add_data("errors", "An unknown error occurred")
190+
if self.error_code != 0:
191+
# convert unsigned int
192+
THRESHOLD = 2147483648
193+
ADJUSTMENT = 4294967296
194+
if self.error_code >= THRESHOLD:
195+
self.error_code -= ADJUSTMENT
196+
err_msg = f"An unknown error occurred: {self.error_code}"
197+
msg.append(err_msg)
198+
logger.add_data("errors", err_msg)
192199

193200
if self.license_error is not None:
194201
msg.append(self.license_error)

src/ops/start.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ def execute(self, context):
7373
)
7474
return {"CANCELLED"}
7575

76-
if not prefs.license_key:
77-
self.report(
78-
{"ERROR"},
79-
"License is not set. Set the license in the add-on preferences",
80-
)
81-
return {"CANCELLED"}
82-
8376
# platform check
8477
if (
8578
platform.system() == "Windows"
@@ -388,7 +381,7 @@ def execute(self, context):
388381
"filepath": str(path),
389382
"export_selected_objects": True,
390383
"export_normals": False,
391-
"export_uv": False,
384+
"export_uv": props.import_uvs,
392385
"export_materials": False,
393386
"apply_modifiers": False,
394387
"forward_axis": "Y",
@@ -413,7 +406,7 @@ def execute(self, context):
413406
filepath=str(path),
414407
use_selection=True,
415408
use_normals=False,
416-
use_uvs=False,
409+
use_uvs=props.import_uvs,
417410
use_materials=False,
418411
use_blen_objects=False,
419412
use_mesh_modifiers=False,

src/ui/panels.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ def draw(self, context):
145145
row.label(icon="SOLO_OFF", text="Quality")
146146
row.prop(props, "quality", text="")
147147

148+
split = box.split(factor=0.7)
149+
split.label(icon="IMPORT", text="Import UVs")
150+
split.prop(props, "import_uvs")
151+
148152
split = box.split(factor=0.7)
149153
split.label(icon="MOD_TRIANGULATE", text="Preserve Mesh")
150154
split.prop(props, "untriangulate")
@@ -174,6 +178,11 @@ def draw(self, context):
174178
split.label(icon="CON_ROTLIKE", text="Concurrent")
175179
split.prop(props, "concurrent")
176180

181+
if props.concurrent:
182+
split = box.split()
183+
split.label(icon="SYSTEM", text="Cores")
184+
split.prop(props, "max_cores", slider=True)
185+
177186
row = box.row()
178187
row.label(text="Finish", icon="TEMP")
179188
row.prop(props, "early_stop")
@@ -186,7 +195,7 @@ def draw(self, context):
186195

187196
if props.use_cuts:
188197
row = box.row()
189-
row.prop(props, "cut_type",expand=True)
198+
row.prop(props, "cut_type", expand=True)
190199

191200
if props.use_cuts and props.cut_type == "EVEN":
192201
split = box.split()
@@ -370,9 +379,11 @@ def draw(self, context):
370379
row = box.row()
371380
row.alignment = "CENTER"
372381
row.label(
373-
text="No previous unwraps"
374-
if get_preferences().show_info
375-
else "Info is off"
382+
text=(
383+
"No previous unwraps"
384+
if get_preferences().show_info
385+
else "Info is off"
386+
)
376387
)
377388

378389

src/ui/props.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import bpy
55
import pathlib
66
import platform
7+
import multiprocessing
78
from ..utils import get_dir_path, get_preferences
8-
from ..updater import addon_updater_ops
99

1010

1111
class UVGAMI_PG_properties(bpy.types.PropertyGroup):
@@ -24,6 +24,9 @@ class UVGAMI_PG_properties(bpy.types.PropertyGroup):
2424
),
2525
default="MEDIUM",
2626
)
27+
import_uvs: bpy.props.BoolProperty(
28+
name="", description="Use the UV map on the mesh as input"
29+
)
2730
# preserve mesh
2831
untriangulate: bpy.props.BoolProperty(
2932
name="",
@@ -55,6 +58,13 @@ class UVGAMI_PG_properties(bpy.types.PropertyGroup):
5558
"or if the mesh is made up of multiple joined meshes"
5659
),
5760
)
61+
max_cores: bpy.props.IntProperty(
62+
name="",
63+
description="The maximum number of processor cores to use for concurrent mode",
64+
default=int(multiprocessing.cpu_count() / 2 - 1),
65+
max=multiprocessing.cpu_count(),
66+
min=1,
67+
)
5868
early_stop: bpy.props.IntProperty(
5969
name="",
6070
description=(
@@ -173,6 +183,7 @@ class UVGAMI_PG_properties(bpy.types.PropertyGroup):
173183
fix_scale: bpy.props.BoolProperty(
174184
name="Average Islands Scale",
175185
description="Scale UV islands based on their actual size",
186+
default=True,
176187
)
177188
preview_unwrap_sharp: bpy.props.BoolProperty(
178189
name="",
@@ -232,7 +243,6 @@ class UVGAMI_AP_preferences(bpy.types.AddonPreferences):
232243
description="Show information about previous unwraps in the info panel",
233244
default=True,
234245
)
235-
license_key: bpy.props.StringProperty(name="", description="Enter your license key")
236246
viewer_workspace: bpy.props.StringProperty(
237247
name="Viewer Workspace",
238248
description=(
@@ -297,10 +307,6 @@ def draw(self, context):
297307
):
298308
row.operator("uvgami.setup_wsl")
299309

300-
split = box.split(factor=0.2)
301-
split.label(text="License Key")
302-
split.prop(self, "license_key")
303-
304310
box = layout.box()
305311

306312
cf = box.column_flow(columns=3)
@@ -345,5 +351,3 @@ def draw(self, context):
345351
row = box.row()
346352
row.label(icon="WORKSPACE")
347353
row.prop(self, "viewer_workspace")
348-
349-
addon_updater_ops.update_settings_ui(self, context)

src/unwrap.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import collections
1212
import threading
1313
import numpy
14-
import datetime
1514
from .utils import (
1615
check_collection,
1716
check_exists,
@@ -43,7 +42,7 @@ def __init__(
4342
vertex_count,
4443
shade_smooth,
4544
auto_smooth,
46-
merge_cuts
45+
merge_cuts,
4746
):
4847
self.name = name
4948
self.input_name = input_name
@@ -109,9 +108,8 @@ def start_unwrap(self):
109108
elif s_weight == 1:
110109
s = "25"
111110

112-
k = prefs.license_key
113111
args = []
114-
shared_args = f"-u {u} -s {s} -k {k} -r uvgami.com:5000"
112+
shared_args = f"-u {u} -s {s}"
115113

116114
if platform.system() == "Windows" and engine_path.suffix == "":
117115
input_path = get_linux_path(self.path)
@@ -163,16 +161,8 @@ def poll_folder(self):
163161
elif ret_code == 107:
164162
msg = "Invalid UV Input"
165163
move_to_invalid = True
166-
elif ret_code == 108:
167-
manager.license_error = "Invalid License"
168-
elif ret_code == 109:
169-
manager.license_error = "Can't Connect To License Server"
170-
elif ret_code == 110:
171-
manager.license_error = "License Already Registered"
172-
elif ret_code == 500:
173-
manager.license_error = "License Server Error"
174164
else:
175-
manager.unknown_error = True
165+
manager.error_code = ret_code
176166

177167
if move_to_invalid:
178168
if prefs.invalid_collection:

0 commit comments

Comments
 (0)