Skip to content

Commit

Permalink
FIX: AutoUV no longer breaks if an object uses an empty material slot.
Browse files Browse the repository at this point in the history
Adding a key shortcut to export the current scene.
  • Loading branch information
SolarLune committed Feb 6, 2024
1 parent 6666b50 commit 69a0e89
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tetra3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1616,7 +1616,8 @@ def execute(self, context):

for matIndex, mat in enumerate(obj.data.materials):

if mat.t3dAutoUV__:
# mat could be None if it's just the slot and no Material is selected
if mat and mat.t3dAutoUV__:

bpy.ops.object.mode_set(mode='EDIT')

Expand Down Expand Up @@ -1880,6 +1881,8 @@ def setFOV(self, value):

####

keymaps = []

def register():

bpy.utils.register_class(OBJECT_PT_tetra3d)
Expand Down Expand Up @@ -2031,6 +2034,14 @@ def register():
if not onLoad in bpy.app.handlers.load_post:
bpy.app.handlers.load_post.append(onLoad)

keyconfig = bpy.context.window_manager.keyconfigs.addon

kc = keyconfig.keymaps.new(name="Window", space_type='EMPTY')
shortcut = kc.keymap_items.new("export.tetra3dgltf", 'E', 'PRESS', ctrl=True, shift=True)

global keymaps
keymaps.append((kc, shortcut))

def unregister():
bpy.utils.unregister_class(OBJECT_PT_tetra3d)
bpy.utils.unregister_class(MESH_PT_tetra3d)
Expand Down Expand Up @@ -2127,6 +2138,13 @@ def unregister():
if onLoad in bpy.app.handlers.load_post:
bpy.app.handlers.load_post.remove(onLoad)

global keymaps

for keymap, shortcut in keymaps:
keymap.keymap_items.remove(shortcut)

keymaps.clear()

bpy.msgbus.clear_by_owner("tetra3d")

if __name__ == "__main__":
Expand Down

0 comments on commit 69a0e89

Please sign in to comment.