[Bf-extensions-cvs] [3fe71eb6] master: io_coat3D: Fix exchange folder bug

Kalle-Samuli Riihikoski noreply at git.blender.org
Tue Oct 13 15:41:01 CEST 2020


Commit: 3fe71eb650918b0c5b50fd7900e973c45f5569b8
Author: Kalle-Samuli Riihikoski
Date:   Tue Oct 13 16:40:56 2020 +0300
Branches: master
https://developer.blender.org/rBA3fe71eb650918b0c5b50fd7900e973c45f5569b8

io_coat3D: Fix exchange folder bug

===================================================================

M	io_coat3D/__init__.py

===================================================================

diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py
index 27f6084d..1fe5a6f9 100644
--- a/io_coat3D/__init__.py
+++ b/io_coat3D/__init__.py
@@ -72,24 +72,29 @@ def every_3_seconds():
     global liveUpdate
     global mTime
     global foundExchangeFolder
-    coat3D = bpy.context.scene.coat3D
+    try:
+        coat3D = bpy.context.scene.coat3D
+ 
 
-    if(foundExchangeFolder == False):
-        foundExchangeFolder, global_exchange_folder = folders.InitFolders()
+        if(foundExchangeFolder == False):
+            foundExchangeFolder, global_exchange_folder = folders.InitFolders()
 
-    Export_folder  = coat3D.exchangeFolder
-    Export_folder += ('%sexport.txt' % (os.sep))
+        Export_folder  = coat3D.exchangeFolder
+        Export_folder += ('%sexport.txt' % (os.sep))
 
-    if (os.path.isfile(Export_folder) and mTime != os.path.getmtime(Export_folder)):
+        if (os.path.isfile(Export_folder) and mTime != os.path.getmtime(Export_folder)):
 
-        for objekti in bpy.data.objects:
-            if(objekti.coat3D.applink_mesh):
-                tex.updatetextures(objekti)
+            for objekti in bpy.data.objects:
+                if(objekti.coat3D.applink_mesh):
+                    tex.updatetextures(objekti)
 
-        mTime = os.path.getmtime(Export_folder)
-    
-    if (os.path.normpath(global_exchange_folder) != os.path.normpath(coat3D.exchangeFolder) and coat3D.exchangeFolder != ''):
-        folders.updateExchangeFile(coat3D.exchangeFolder)
+            mTime = os.path.getmtime(Export_folder)
+        
+        if (os.path.normpath(global_exchange_folder) != os.path.normpath(coat3D.exchangeFolder) and coat3D.exchangeFolder != ''):
+            folders.updateExchangeFile(coat3D.exchangeFolder)
+
+    except:
+        pass
     
     return 3.0
 
@@ -261,12 +266,12 @@ class SCENE_OT_folder(bpy.types.Operator):
     bl_options = {'UNDO'}
 
     def invoke(self, context, event):
+        global foundExchangeFolder
         coat3D = bpy.context.scene.coat3D
         if(os.path.isdir(coat3D.exchangeFolder)):
-            coat3D.exchange_found = True
-            #bpy.coat3D['status'] = 1
+            foundExchangeFolder= True
         else:
-            coat3D.exchange_found = False
+            foundExchangeFolder = False
 
         return {'FINISHED'}
 
@@ -1324,6 +1329,7 @@ class SCENE_PT_Main(bpy.types.Panel):
     def draw(self, context):
         layout = self.layout
         coat3D = bpy.context.scene.coat3D
+        global foundExchangeFolder
 
         if(foundExchangeFolder == False):
             row = layout.row()
@@ -1946,6 +1952,8 @@ def register():
         default=True
     )
 
+    
+
 
     from bpy.utils import register_class
     for cls in classes:



More information about the Bf-extensions-cvs mailing list