Skip to content

Commit

Permalink
Merge pull request #24 from sketchfab/bug/threading-crash_D3D-2521
Browse files Browse the repository at this point in the history
[#D3D-2521] Fixes crash by using C4DThreading instead of threading pa…
  • Loading branch information
AurL authored Apr 9, 2018
2 parents c5aabe9 + 0e87fad commit 784c54a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Sketchfab-Exporter.pyp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
Sketchfab Exporter v1.2.2
Sketchfab Exporter v1.3.5
Copyright: Erwin Santacruz 2012 (www.990adjustments.com)
Written for CINEMA 4D R13 - R15
Name-US: Sketchfab Exporter v1.2.2
Name-US: Sketchfab Exporter v1.3.5
Description-US: Model exporter for Sketchfab.com
Expand All @@ -14,6 +14,7 @@ Modified Date: 03/16/13

import c4d
from c4d import documents, gui, plugins, bitmaps, storage
from c4d.threading import C4DThread

import datetime
import os
Expand Down Expand Up @@ -57,7 +58,7 @@ __sketchfab__ = "http://sketchfab.com"
__twitter__ = "@990adjustments"
__email__ = "[email protected]"
__plugin_title__ = "Sketchfab Exporter"
__version__ = "1.3.0"
__version__ = "1.3.5"
__copyright_year__ = datetime.datetime.now().year
__plugin_id__ = 1029390

Expand Down Expand Up @@ -182,18 +183,18 @@ This program comes with ABSOLUTELY NO WARRANTY. For details, please visit\nhttp:
zipObject.write(os.path.join(path, 'tex', f))


class PublishModelThread(threading.Thread):
class PublishModelThread(C4DThread):
"""Class that publishes 3D model to Sketchfab.com."""

def __init__(self, data, title, activeDoc, activeDocPath, enable_animation):
threading.Thread.__init__(self)
C4DThread.__init__(self)
self.data = data
self.title = title
self.activeDoc = activeDoc
self.activeDocPath = activeDocPath
self.enable_animation = enable_animation

def run(self):
def Main(self):
global g_uploaded
global g_error

Expand Down Expand Up @@ -772,8 +773,8 @@ Your API token can be found in your dashboard at sketchfab.com", c4d.GEMB_OK)
data['isPublished'] = auto_publish

self.publish = PublishModelThread(data, title, activeDoc, activeDocPath, enable_animation)
self.publish.setDaemon(True)
self.publish.start()
self.publish.Start()
self.publish.Wait(True)

return True

Expand Down

0 comments on commit 784c54a

Please sign in to comment.