[Bf-extensions-cvs] [dbf84283] blender2.8: improve 3b feature.

Kalle-Samuli Riihikoski noreply at git.blender.org
Sat Sep 1 17:46:32 CEST 2018


Commit: dbf84283e9851c419dff6fd57735ac5ccaae4784
Author: Kalle-Samuli Riihikoski
Date:   Sat Sep 1 18:44:49 2018 +0300
Branches: blender2.8
https://developer.blender.org/rBAdbf84283e9851c419dff6fd57735ac5ccaae4784

improve 3b feature.

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

M	io_coat3D/__init__.py

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

diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py
index 6499cb82..48ef8556 100644
--- a/io_coat3D/__init__.py
+++ b/io_coat3D/__init__.py
@@ -279,15 +279,34 @@ class SCENE_OT_opencoat(bpy.types.Operator):
     def invoke(self, context, event):
         coat3D = bpy.context.selected_objects[0].coat3D.applink_3b_path
         print('3b osoite on:',coat3D)
-        if running() == False:
-            os.popen('"' + 'C:\\Program Files\\3D-Coat-V4.8.21\\3D-CoatDX64C.exe' + '" ' + coat3D)
-            print('C:\\Program Files\\3D-Coat-V4.8.21\\3D-CoatDX64C.exe ' + coat3D)
-        else:
-            importfile = bpy.context.scene.coat3D.exchangedir
-            importfile += ('%simport.txt' % (os.sep))
-            file = open(importfile, "w")
-            file.write("%s" % (coat3D))
-            file.close()
+        platform = os.sys.platform
+        prog_path = os.environ['PROGRAMFILES']
+        if (platform == 'win32'):
+            index = 0
+            for file in os.listdir(prog_path):
+                if index == 0:
+                    if file.startswith('3D-Coat-V4'):
+                        modi = os.path.getmtime(prog_path + os.sep + file)
+                        active_3dcoat = prog_path + os.sep + file
+                        index += 1
+                else:
+                    if file.startswith('3D-Coat-V4'):
+                        if(os.path.getmtime(prog_path + os.sep + file) > modi):
+                            modi = os.path.getmtime(prog_path + os.sep + file)
+                            active_3dcoat = prog_path + os.sep + file
+
+            print('haippaa',active_3dcoat)
+            if running() == False:
+                os.popen('"' + active_3dcoat + os.sep + '3D-CoatDX64C.exe' '" ' + coat3D)
+                print('C:\\Program Files\\3D-Coat-V4.8.21\\3D-CoatDX64C.exe ' + coat3D)
+            else:
+                importfile = bpy.context.scene.coat3D.exchangedir
+                importfile += ('%simport.txt' % (os.sep))
+                file = open(importfile, "w")
+                file.write("%s" % (coat3D))
+                file.write("\n%s" % (coat3D))
+                file.write("\n[3B]")
+                file.close()
 
 
         return {'FINISHED'}



More information about the Bf-extensions-cvs mailing list