Improves for set folder path.
authorOscurart Eugenio Pignataro <info@oscurart.com.ar>
Sun, 4 Aug 2013 00:41:01 +0000 (00:41 +0000)
committerOscurart Eugenio Pignataro <info@oscurart.com.ar>
Sun, 4 Aug 2013 00:41:01 +0000 (00:41 +0000)
oscurart_mesh_cache_tools.py

index 1c0da1c..972cc78 100755 (executable)
@@ -166,19 +166,18 @@ class OscPc2iMporterCopy(bpy.types.Operator):
     bl_description = "Copy Filepath"
     bl_options = {'REGISTER', 'UNDO'}
 
-    @classmethod
-    def poll(cls, context):
-        return(bpy.context.scene.muu_pc2_relative_path != "")
-
     def execute(self, context):
         filefolder = os.path.dirname(bpy.data.filepath)
         os.chdir(filefolder)
-        if os.path.exists("%s" % (os.path.join(filefolder,bpy.context.scene.muu_pc2_relative_path))):
-            print("Folder Already Exists.")
+        if bpy.context.scene.muu_pc2_relative_path != "":            
+            if os.path.exists("%s" % (os.path.join(filefolder,bpy.context.scene.muu_pc2_relative_path))):
+                print("Folder Already Exists.")
+            else:
+                os.mkdir("%s" % (os.path.join(filefolder,bpy.context.scene.muu_pc2_relative_path)))
+            bpy.context.scene.muu_pc2_folder = "%s" % (os.path.join(filefolder,bpy.context.scene.muu_pc2_relative_path))
         else:
-            os.mkdir("%s" % (os.path.join(filefolder,bpy.context.scene.muu_pc2_relative_path)))
+            bpy.context.scene.muu_pc2_folder = "%s" % (filefolder)
 
-        bpy.context.scene.muu_pc2_folder = "%s" % (os.path.join(filefolder,bpy.context.scene.muu_pc2_relative_path))
         return {'FINISHED'}
 
 def OscLinkedGroupToLocal():