|
129 | 129 | - Dialog operator now uses duplicate of panel by using wm.call_panel > easier and no double code
|
130 | 130 | - Automation is either pack or optimize, running both commands wasnt doing anything since optimize also packs uvs
|
131 | 131 |
|
132 |
| -## [v0.7.41] - 2024-07-2 |
| 132 | +## [v0.7.41] - 2024-07-25 |
133 | 133 | # Fixed
|
134 | 134 | - missing check for OSX app path set
|
135 | 135 |
|
| 136 | +## [v0.7.5] - 2024-07-25 |
| 137 | +# Added |
| 138 | +- uv channel poreview when switch number. this switches uvmap index so we actually can see preview easier |
| 139 | +
|
136 | 140 | ####################
|
137 | 141 | ## TODO
|
138 | 142 | - Seams need to be updated after new import > 0.6.8 still shows old seams
|
|
144 | 148 | - Save custom file in dot file next to blend file, now ini file is still per app
|
145 | 149 | - Add better check when UVlayout is canceled, currently it states that all is done
|
146 | 150 | - Autopack sometimes closes without saving on OSX
|
147 |
| -
|
| 151 | +- When switching UV Channel, make it switch in the panel so we see preview |
148 | 152 | ####################
|
149 | 153 | '''
|
150 | 154 |
|
|
153 | 157 | "description": "Headus UVLayout Bridge - A bridge between Blender and Headus UVlayout for quick UVs unwrapping",
|
154 | 158 | "location": "3D VIEW > Properties > Headus UVlayout Panel",
|
155 | 159 | "author": "Rombout Versluijs // Titus Lavrov",
|
156 |
| - "version": (0, 7, 41), |
| 160 | + "version": (0, 7, 5), |
157 | 161 | "blender": (2, 80, 0),
|
158 | 162 | "wiki_url": "https://github.com/schroef/uvlayout_bridge",
|
159 | 163 | "tracker_url": "https://github.com/schroef/uvlayout_bridge/issues",
|
@@ -210,10 +214,80 @@ def customPath_exists(context):
|
210 | 214 | scn = context.scene
|
211 | 215 | return os.path.exists(scn.uvlb_customPath)
|
212 | 216 |
|
| 217 | +# def object_color_type_items(self,context) |
| 218 | + |
| 219 | +# return colors |
| 220 | + |
| 221 | +def toggle_texture_preview(self,context): |
| 222 | + context = bpy.context |
| 223 | + scn = context.scene |
| 224 | + VIEW3D_PT_shading = bpy.types.VIEW3D_PT_shading |
| 225 | + shading = VIEW3D_PT_shading.get_shading(context) |
| 226 | + if scn.uvlb_uvPreview == True: |
| 227 | + if shading.color_type != 'TEXTURE': |
| 228 | + scn.object_color_types = shading.color_type |
| 229 | + shading.color_type = 'TEXTURE' |
| 230 | + else: |
| 231 | + shading.color_type = scn.object_color_types |
| 232 | + #toggle actrive UVMAP index |
| 233 | + ob = context.active_object |
| 234 | + scn=context.scene |
| 235 | + ob.data.uv_layers.active_index = scn.uvlb_uv_channel-1 |
| 236 | + |
| 237 | +def update_uvchannel_index(self,context): |
| 238 | + '''channels uv channel index so we see preview in 3dv when switching''' |
| 239 | + # switch uv map index |
| 240 | + ob = context.active_object |
| 241 | + scn=context.scene |
| 242 | + ob.data.uv_layers.active_index = scn.uvlb_uv_channel-1 |
| 243 | + |
| 244 | + # set overlay preview |
| 245 | + context.scene.uvlb_uvPreview = True |
| 246 | + toggle_texture_preview(context, context) |
| 247 | + |
| 248 | +# WIP make it toggle both ways, so if we change index in UVMAPS panel also update int prop |
| 249 | +# b3d example GGET/SET |
| 250 | +# https://b3d.interplanety.org/en/dynamically-setting-the-max-and-min-values-%E2%80%8B%E2%80%8Bfor-a-custorm-property-in-the-blender-python-api/ |
| 251 | +def get_uvchannels(self): |
| 252 | + uv_channels = bpy.context.active_object.data.uv_layers |
| 253 | + # # print(self.get('uvlb_uv_channel')) |
| 254 | + # if self.get('uvlb_uv_channel',1) > len(uv_channels)-1: |
| 255 | + # print("1") |
| 256 | + # return self.get('uvlb_uv_channel') |
| 257 | + # elif uv_channels.active_index+1 < self.get('uvlb_uv_channel'): |
| 258 | + # print("2") |
| 259 | + # return uv_channels.active_index +1 |
| 260 | + # elif self.get('uvlb_uv_channel',1) < uv_channels.active_index+1: |
| 261 | + # print("3") |
| 262 | + # return self.get('uvlb_uv_channel') |
| 263 | + # else: |
| 264 | + # return 1 |
| 265 | + return self.get('uvlb_uv_channel', 1) |
| 266 | + |
| 267 | +def set_uvchannels(self, value): |
| 268 | + uv_channels = bpy.context.active_object.data.uv_layers |
| 269 | + if uv_channels: |
| 270 | + if value > len(uv_channels): |
| 271 | + value = len(uv_channels) |
| 272 | + if value < len(uv_channels): |
| 273 | + value = 1 |
| 274 | + else: |
| 275 | + value = 1 |
| 276 | + self['uvlb_uv_channel'] = value |
| 277 | + |
| 278 | + |
| 279 | +# def get_uvchannels_index(self,context): |
| 280 | +# '''Get uv channels active_index''' |
| 281 | +# if context.scene and context.active_object: |
| 282 | +# ob = context.active_object |
| 283 | +# if ob.data.uv_layers != None: |
| 284 | +# return ob.data.uv_layers.active_index + 1 |
| 285 | + |
| 286 | + |
| 287 | +#-- LOAD / SET CONFIG FILE --# |
213 | 288 | configFol = "config"
|
214 | 289 | version = "Please choose version"
|
215 | 290 |
|
216 |
| -#-- LOAD / SET CONFIG FILE --# |
217 | 291 | def setConfig(self, context):
|
218 | 292 | '''Save Custom Path in config file when property is updated
|
219 | 293 | :param context: context
|
@@ -318,14 +392,37 @@ def updateIcon(self, context):
|
318 | 392 | update = setConfig)
|
319 | 393 |
|
320 | 394 |
|
| 395 | + |
321 | 396 | #-- BRIDGE ADDON OPTIONS --#
|
322 | 397 | #---UV Channel selector---
|
323 | 398 | scn.uvlb_uv_channel = IntProperty(
|
324 | 399 | name = "Map",
|
325 |
| - description = "Select a UV channel for editing in export.", |
| 400 | + description = "Select a UV channel for editing in export. Shows UV channel when setting number for easy preview", |
326 | 401 | default = 1,
|
327 |
| - min = 1, |
328 |
| - max = 8) |
| 402 | + get=get_uvchannels, |
| 403 | + set=set_uvchannels, |
| 404 | + # get=lambda self: get_uvchannels(self), |
| 405 | + # set=lambda self, value: set_uvchannels(self, value), |
| 406 | + # min = 1, |
| 407 | + # max = get_uvchannels, |
| 408 | + update = update_uvchannel_index) |
| 409 | + |
| 410 | +scn.object_color_types = EnumProperty( |
| 411 | + items = (('MATERIAL', 'MATERIAL',''), |
| 412 | + ('OBJECT','OBJECT',''), |
| 413 | + ('VERTEX','VERTEX',''), |
| 414 | + ('SINGLE','SINGLE',''), |
| 415 | + ('RANDOM','RANDOM',''), |
| 416 | + ('TEXTURE','TEXTURE','')), |
| 417 | + name = "Color Type", |
| 418 | + description = "Overlayer object Color Type in 3dView", |
| 419 | + default = 'MATERIAL') |
| 420 | + |
| 421 | +scn.uvlb_uvPreview = BoolProperty( |
| 422 | + name="UV Preview", |
| 423 | + description = "Preview UV channel in 3dView, enables texture preview.", |
| 424 | + default = False, |
| 425 | + update = toggle_texture_preview) |
329 | 426 |
|
330 | 427 | scn.spaceName = BoolProperty(
|
331 | 428 | name="Spaces in Name",
|
@@ -362,6 +459,12 @@ def updateIcon(self, context):
|
362 | 459 | name = "Mode",
|
363 | 460 | description = "POLY or SUBD",
|
364 | 461 | default = 'EDITMODE_HLT')
|
| 462 | +scn.iconMode = EnumProperty( |
| 463 | + items = (('EDITMODE_HLT', "EDITMODE_HLT", ''), |
| 464 | + ('MOD_SUBSURF', "MOD_SUBSURF", '')), |
| 465 | + name = "Mode", |
| 466 | + description = "POLY or SUBD", |
| 467 | + default = 'EDITMODE_HLT') |
365 | 468 |
|
366 | 469 | scn.iconUVMode = EnumProperty(
|
367 | 470 | items = (('TEXTURE', "TEXTURE", ''),('GROUP_UVS', "GROUP_UVS", '')),
|
@@ -1304,9 +1407,16 @@ def draw(self, context):
|
1304 | 1407 | layout.use_property_decorate = False # No animation.
|
1305 | 1408 | obj = bpy.context.object
|
1306 | 1409 |
|
1307 |
| - uvMapBox = layout |
1308 |
| - uvMapChannel = uvMapBox.row() |
| 1410 | + # uvMapBox = layout |
| 1411 | + # uvMapChannel = uvMapBox.split(factor=0.3) |
| 1412 | + col = layout.column(align=True) |
| 1413 | + uvMapChannel = col.row(align=True) |
| 1414 | + if scn.uvlb_uvPreview: |
| 1415 | + icon_uv = 'HIDE_OFF' |
| 1416 | + else: |
| 1417 | + icon_uv = 'HIDE_ON' |
1309 | 1418 | uvMapChannel.prop(scn, "uvlb_uv_channel", icon="GROUP_UVS")
|
| 1419 | + uvMapChannel.prop(scn, "uvlb_uvPreview", text='', icon=icon_uv) |
1310 | 1420 |
|
1311 | 1421 | def check_for_mods(scn):
|
1312 | 1422 | #--Get selected objects---
|
|
0 commit comments