|
18 | 18 | "author": "mattedickson",
|
19 | 19 | "wiki_url": "https://github.com/mattedicksoncom/blender-xatlas/",
|
20 | 20 | "tracker_url": "https://github.com/mattedicksoncom/blender-xatlas/issues",
|
21 |
| - "version": (0, 0, 7), |
| 21 | + "version": (0, 0, 8), |
22 | 22 | "blender": (2, 83, 0),
|
23 | 23 | "location": "3D View > Toolbox",
|
24 | 24 | "category": "Object",
|
|
43 | 43 | from queue import Queue, Empty
|
44 | 44 | import string
|
45 | 45 |
|
| 46 | +import uuid |
| 47 | + |
46 | 48 |
|
47 | 49 | import importlib
|
48 | 50 | sys.path.append(__path__)
|
@@ -202,6 +204,11 @@ def get_collectionNames(self, context):
|
202 | 204 | colllectionNames.append((collection.name, collection.name, ""))
|
203 | 205 | return colllectionNames
|
204 | 206 |
|
| 207 | +def gen_safe_name(): |
| 208 | + genId = uuid.uuid4().hex |
| 209 | + # genId = "u_" + genId.replace("-","_") |
| 210 | + return "u_" + genId |
| 211 | + |
205 | 212 | class PG_SharedProperties (PropertyGroup):
|
206 | 213 |
|
207 | 214 | unwrapSelection : EnumProperty(
|
@@ -360,13 +367,16 @@ def execute(self, context):
|
360 | 367 | self.report({"WARNING"}, "Nothing Selected, please select Something")
|
361 | 368 | return {'FINISHED'}
|
362 | 369 |
|
363 |
| - #store the names of objects |
| 370 | + #store the names of objects to be lightmapped |
364 | 371 | rename_dict = dict()
|
| 372 | + safe_dict = dict() |
365 | 373 |
|
366 | 374 | #make sure all the objects have ligthmap uvs
|
367 | 375 | for obj in selected_objects:
|
368 | 376 | if obj.type == 'MESH':
|
369 |
| - rename_dict[obj.name] = obj.name |
| 377 | + safe_name = gen_safe_name(); |
| 378 | + rename_dict[obj.name] = (obj.name,safe_name) |
| 379 | + safe_dict[safe_name] = obj.name |
370 | 380 | context.view_layer.objects.active = obj
|
371 | 381 | if obj.data.users > 1:
|
372 | 382 | obj.data = obj.data.copy() #make single user copy
|
@@ -417,6 +427,7 @@ def execute(self, context):
|
417 | 427 | #Will strip this down further later
|
418 | 428 | fakeFile = StringIO()
|
419 | 429 | export_obj_simple.save(
|
| 430 | + rename_dict=rename_dict, |
420 | 431 | context=bpy.context,
|
421 | 432 | filepath=fakeFile,
|
422 | 433 | mainUVChoiceType=sharedProperties.mainUVChoiceType,
|
@@ -586,7 +597,7 @@ class uvObject:
|
586 | 597 | bpy.ops.object.select_all(action='DESELECT')
|
587 | 598 |
|
588 | 599 | obTest = importObject
|
589 |
| - |
| 600 | + obTest.obName = safe_dict[obTest.obName] #probably shouldn't just replace it |
590 | 601 | bpy.context.scene.objects[obTest.obName].select_set(True)
|
591 | 602 | context.view_layer.objects.active = bpy.context.scene.objects[obTest.obName]
|
592 | 603 | bpy.ops.object.mode_set(mode = 'OBJECT')
|
@@ -659,8 +670,8 @@ class uvObject:
|
659 | 670 |
|
660 | 671 | #select the original objects that were selected
|
661 | 672 | for objectName in rename_dict:
|
662 |
| - if objectName in bpy.context.scene.objects: |
663 |
| - current_object = bpy.context.scene.objects[objectName] |
| 673 | + if objectName[0] in bpy.context.scene.objects: |
| 674 | + current_object = bpy.context.scene.objects[objectName[0]] |
664 | 675 | current_object.select_set(True)
|
665 | 676 | context.view_layer.objects.active = current_object
|
666 | 677 |
|
|
0 commit comments