8
8
# - Try scene without getConfig this is not needed as enum already loads settings
9
9
# - Added d2.80 support
10
10
# - updated user_preferences to preferences
11
+ # - Add warning when appPath is not set
11
12
####################
12
13
13
14
####################
100
101
# Changed
101
102
- Better check if we cancel or send file back to Blender > returns cancel or done report in bottom
102
103
103
- ## v.0.7.1
104
- ## 2021-11-10
104
+ ## v.0.7.1 - 2021-11-10
105
105
106
106
# Changed
107
107
- get path and files moved to its own function, same code was used 6 times
108
108
109
- ## v.0.7.2
110
- ## 2024-07-23
109
+ ## v.0.7.2 - 2024-07-23
111
110
112
111
# Fixed
113
112
- Changed parameter for OBJ importer and exporter.
114
113
115
- # Added
116
- - check for different Blender versions, they use different operators and parameters
117
- - Show alert for when custom path does not exist, path turns red
114
+ ## v.0.7.3 - 2024-07-24
118
115
119
- # Changed
120
- - info custom path is added to tooltip
121
- - Removed Local check, seems to be working now without issues perhaps due to new viewlayer system
116
+ # Fixed
117
+ - Export error if app path is not set, Panel shows red error with set app path option
122
118
123
119
124
120
####################
141
137
"description" : "Headus UVLayout Bridge - A bridge between Blender and Headus UVlayout for quick UVs unwrapping" ,
142
138
"location" : "3D VIEW > Properties > Headus UVlayout Panel" ,
143
139
"author" : "Rombout Versluijs // Titus Lavrov" ,
144
- "version" : (0 , 7 , 2 ),
140
+ "version" : (0 , 7 , 3 ),
145
141
"blender" : (2 , 80 , 0 ),
146
142
"wiki_url" : "https://github.com/schroef/uvlayout_bridge" ,
147
143
"tracker_url" : "https://github.com/schroef/uvlayout_bridge/issues" ,
167
163
from bpy_extras .io_utils import (ImportHelper , ExportHelper )
168
164
from . config .registers import get_hotkey_entry_item
169
165
166
+ #---Check OS---
167
+ # bpy.types.Scene.osSys = EnumProperty(
168
+ # items = (('0', "WIN", ''),('1', "OSX", '')),
169
+ # name = "OS check",
170
+ # description="Check what OS is used",
171
+ # default = '0')
172
+ #--SYS check Enummenus --#
173
+ scn = bpy .types .Scene
174
+ if platform == "darwin" :
175
+ scn .osSys = '1'
176
+ if platform == "win32" :
177
+ scn .osSys = '0'
178
+ print ("OS used: %s" % platform )
179
+
180
+
181
+
182
+ # return addon preferences
183
+ def get_addon_prefs (context ):
184
+ return context .preferences .addons [__name__ ].preferences
185
+
186
+
187
+ def app_path_set (context ):
188
+ addon_prefs = get_addon_prefs (context )
189
+ if platform == "win32" :
190
+ return addon_prefs .uvlb_winPath != 'Please set Application Path'
191
+ if platform == "darwin" :
192
+ return addon_prefs .versionUVL != 'Please choose version'
193
+
170
194
configFol = "config"
171
195
version = "Please choose version"
172
196
@@ -405,20 +429,6 @@ def updateIcon(self, context):
405
429
default = False ,
406
430
description = "Forces reimport of the out file from UVlayout. Sometimes import mismatches timing of UVlayout causing to not import proper output file." )
407
431
408
- #---Check OS---
409
- # bpy.types.Scene.osSys = EnumProperty(
410
- # items = (('0', "WIN", ''),('1', "OSX", '')),
411
- # name = "OS check",
412
- # description="Check what OS is used",
413
- # default = '0')
414
- #--SYS check Enummenus --#
415
- scn = bpy .types .Scene
416
- if platform == "darwin" :
417
- scn .osSys = '1'
418
- if platform == "win32" :
419
- scn .osSys = '0'
420
- print ("OS used: %s" % platform )
421
-
422
432
423
433
def is_local (context ):
424
434
#for ob in bpy.context.scene.objects:
@@ -822,7 +832,7 @@ def add_obj(obj):
822
832
if dropSet == 0 :
823
833
# loadAction = 'run UVLayout|Pack|Pack All' + '\n' +'run UVLayout|Plugin|Save'
824
834
# loadAction = "drop \ n auto obj \n auto dxf "
825
- loadAction = uvlb_mode + uvlb_uv_mode + uvlb_uv_weld + uvlb_uv_clean + uvlb_uv_deach + uvlb_uv_geom
835
+ loadAction = uvlb_mode + uvlb_uv_mode + uvlb_uv_weld + uvlb_uv_clean + uvlb_uv_deach + uvlb_uv_geom
826
836
827
837
f = open (file_setName , "w+" )
828
838
# print("Commands Sent: %s - %s" % (uvlb_mode, uvlb_uv_mode))
@@ -1223,16 +1233,22 @@ def draw(self, context):
1223
1233
layout = self .layout
1224
1234
scn = bpy .context .scene
1225
1235
obj = bpy .context .object
1236
+ addon_prefs = get_addon_prefs (context )
1237
+
1238
+ if platform == "win32" and (addon_prefs .uvlb_winPath == 'Please set Application Path' ):
1239
+ layout .alert = addon_prefs .uvlb_winPath == 'Please set Application Path'
1240
+ layout .label (text = "Application Path Headus UVLayout v2." )
1241
+ layout .prop (addon_prefs , "uvlb_winPath" , text = "" )
1226
1242
1227
1243
1228
1244
class VIEW3D_PT_load_options (UVLBRIDGE , Panel ):
1229
1245
bl_label = "Load Options"
1230
1246
bl_parent_id = "VIEW3D_PT_panel_uvlbridge"
1231
1247
1232
- # @classmethod
1233
- # def poll(cls, context):
1234
- # # Only allow in Object mode and for a selected mesh.
1235
- # return (context.object is not None and context.object.type == "MESH" )
1248
+ @classmethod
1249
+ def poll (cls , context ):
1250
+ # print(app_path_set(context))
1251
+ return app_path_set ( context )
1236
1252
1237
1253
def draw (self , context ):
1238
1254
layout = self .layout
@@ -1244,11 +1260,12 @@ def draw(self, context):
1244
1260
settingsBox = layout
1245
1261
uvlbHeader = settingsBox .split (factor = 0.9 )
1246
1262
column = uvlbHeader .column ()
1263
+
1247
1264
# column.row().label(text="Load Options:")
1248
1265
1249
1266
# column = uvlbHeader.column()
1250
1267
# column.row().prop(scn, "uvlb_help", text="", icon_value=custom_icons["help"].icon_id, emboss=False)
1251
-
1268
+
1252
1269
uvlbOptions = settingsBox .split (factor = 0.5 )
1253
1270
column = uvlbOptions .column ()
1254
1271
column .row ().label (text = "Mode:" )
@@ -1278,6 +1295,10 @@ class VIEW3D_PT_automation(UVLBRIDGE, Panel):
1278
1295
bl_label = " Automation"
1279
1296
bl_parent_id = "VIEW3D_PT_panel_uvlbridge"
1280
1297
1298
+ @classmethod
1299
+ def poll (cls , context ):
1300
+ return app_path_set (context )
1301
+
1281
1302
def draw_header (self , context ):
1282
1303
layout = self .layout
1283
1304
scn = bpy .context .scene
@@ -1316,7 +1337,7 @@ class VIEW3D_PT_uvchannel(UVLBRIDGE, Panel):
1316
1337
@classmethod
1317
1338
def poll (cls , context ):
1318
1339
scn = bpy .context .scene
1319
- return check_uv_channels (scn )
1340
+ return check_uv_channels (scn ) and app_path_set ( context )
1320
1341
1321
1342
def draw (self , context ):
1322
1343
layout = self .layout
@@ -1352,6 +1373,10 @@ class VIEW3D_PT_export_options(UVLBRIDGE, Panel):
1352
1373
bl_label = "OBJ Eport Options"
1353
1374
bl_parent_id = "VIEW3D_PT_panel_uvlbridge"
1354
1375
1376
+ @classmethod
1377
+ def poll (cls , context ):
1378
+ return app_path_set (context )
1379
+
1355
1380
def draw (self , context ):
1356
1381
layout = self .layout
1357
1382
scn = bpy .context .scene
@@ -1398,43 +1423,44 @@ def draw(self, context):
1398
1423
1399
1424
1400
1425
def uvl_panel_operator (self ,context ):
1401
- layout = self .layout
1402
- #-- START EXPORT --
1403
- layout .scale_y = 1.25
1404
- # row = layout.row(align=True)
1405
- # col = row.column(align=True)
1406
- col = layout .column (align = True )
1407
- row = col .row (align = True )
1408
- row .operator ("uvlb.export" , text = "Unwrap in UVlayout" , icon_value = custom_icons ["uvl" ].icon_id )
1409
- row .operator ("uvlb.send_tmpedit" , text = "" , icon = 'FILE_TICK' ) # TEMP RECOVER_LAST LOOP_BACK
1410
-
1411
- scn ,addon_prefs , UVLayoutPath , file_Name ,file_outName , file_setName , file_cmdName , uvl_exit_str , uvlObjs , Objs = get_path_files ()
1412
- # Make this cleaner > this section is used 3x > make single functon
1413
- # preferences = bpy.context.preferences
1414
- # addon_prefs = preferences.addons[__name__].preferences
1415
- # scn = bpy.context.scene
1426
+ if app_path_set (context ):
1427
+ layout = self .layout
1428
+ #-- START EXPORT --
1429
+ layout .scale_y = 1.25
1430
+ # row = layout.row(align=True)
1431
+ # col = row.column(align=True)
1432
+ col = layout .column (align = True )
1433
+ row = col .row (align = True )
1434
+ row .operator ("uvlb.export" , text = "Unwrap in UVlayout" , icon_value = custom_icons ["uvl" ].icon_id )
1435
+ row .operator ("uvlb.send_tmpedit" , text = "" , icon = 'FILE_TICK' ) # TEMP RECOVER_LAST LOOP_BACK
1436
+
1437
+ scn ,addon_prefs , UVLayoutPath , file_Name ,file_outName , file_setName , file_cmdName , uvl_exit_str , uvlObjs , Objs = get_path_files ()
1438
+ # Make this cleaner > this section is used 3x > make single functon
1439
+ # preferences = bpy.context.preferences
1440
+ # addon_prefs = preferences.addons[__name__].preferences
1441
+ # scn = bpy.context.scene
1416
1442
1417
- # #---Variables---
1418
- # if platform == "win32":
1419
- # UVLayoutPath = addon_prefs.uvlb_winPath
1443
+ # #---Variables---
1444
+ # if platform == "win32":
1445
+ # UVLayoutPath = addon_prefs.uvlb_winPath
1420
1446
1421
- # if scn.uvlb_pathEnable:
1422
- # path = scn.uvlb_customPath
1423
- # else:
1424
- # path = "" + tempfile.gettempdir()
1447
+ # if scn.uvlb_pathEnable:
1448
+ # path = scn.uvlb_customPath
1449
+ # else:
1450
+ # path = "" + tempfile.gettempdir()
1425
1451
1426
- # path = '/'.join(path.split('\\'))
1452
+ # path = '/'.join(path.split('\\'))
1427
1453
1428
- # file_outName = path + "Blender2UVLayout_TMP.out"
1429
-
1430
- # print(os.path.isfile(file_outName))
1431
- # print(os.path.exists(file_outName))
1432
- # print(file_outName)
1433
- ###################
1434
- if os .path .exists (file_outName ):
1435
- # if os.path.isfile(file_outName):
1436
- row = col .row (align = True )
1437
- row .operator ("uvlb.forced_reimport" , icon = 'RECOVER_LAST' ) # RECOVER_LAST LOOP_BACK
1454
+ # file_outName = path + "Blender2UVLayout_TMP.out"
1455
+
1456
+ # print(os.path.isfile(file_outName))
1457
+ # print(os.path.exists(file_outName))
1458
+ # print(file_outName)
1459
+ ###################
1460
+ if os .path .exists (file_outName ):
1461
+ # if os.path.isfile(file_outName):
1462
+ row = col .row (align = True )
1463
+ row .operator ("uvlb.forced_reimport" , icon = 'RECOVER_LAST' ) # RECOVER_LAST LOOP_BACK
1438
1464
1439
1465
1440
1466
#-- BRIDGE WM DIALOG POPUP MENU __#
@@ -1454,7 +1480,7 @@ def check(self, context):
1454
1480
@classmethod
1455
1481
def poll (cls , context ):
1456
1482
# Only allow in Object mode and for a selected mesh.
1457
- return (bpy .context .object is not None and bpy .context .object .type == "MESH" )
1483
+ return (bpy .context .object is not None and bpy .context .object .type == "MESH" ) and not app_path_set ( context )
1458
1484
1459
1485
def draw (self , context ):
1460
1486
layout = self .layout
@@ -1645,18 +1671,19 @@ def draw(self, context):
1645
1671
layout = self .layout
1646
1672
scene = context .scene
1647
1673
1648
-
1649
1674
if platform == "win32" :
1650
1675
box = layout .box ()
1651
1676
split = box .split ()
1652
1677
col = split .column ()
1678
+ col .alert = (self .uvlb_winPath == 'Please set Application Path' )
1653
1679
col .label (text = "Application Path Headus UVLayout v2." )
1654
1680
col .prop (self , "uvlb_winPath" , text = "" )
1655
1681
col .separator ()
1656
1682
if platform == "darwin" :
1657
1683
box = layout .box ()
1658
1684
split = box .split ()
1659
1685
col = split .column ()
1686
+ col .alert = (self .versionUVL == 'Please choose version' )
1660
1687
col .label (text = "Headus UVlayout Version:" )
1661
1688
col .prop (self ,"versionUVL" , text = "" )
1662
1689
col .label (text = "* No application path settings needed on OSX" )
@@ -1671,7 +1698,6 @@ def draw(self, context):
1671
1698
column .row ().label (text = "Custom export path:" )
1672
1699
if scene .uvlb_pathEnable :
1673
1700
row = column .row ()
1674
- # Not sure why but got error here for not being string?
1675
1701
row .alert = not os .path .exists (scene .uvlb_customPath )
1676
1702
row .prop (scene ,"uvlb_customPath" , text = "" )
1677
1703
0 commit comments