[Bf-extensions-cvs] [089cfd12] blender-v2.90-release: PLY: show import/export status with cursor

Mikhail Rachinskiy noreply at git.blender.org
Thu Jul 23 12:49:38 CEST 2020


Commit: 089cfd12a5511829aafad3790417a5218955a3ad
Author: Mikhail Rachinskiy
Date:   Thu Jul 23 14:39:19 2020 +0400
Branches: blender-v2.90-release
https://developer.blender.org/rBA089cfd12a5511829aafad3790417a5218955a3ad

PLY: show import/export status with cursor

Later I would like to show progress by percentage, but not yet sure on how to better calculate it and triger update.

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

M	io_mesh_ply/__init__.py

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

diff --git a/io_mesh_ply/__init__.py b/io_mesh_ply/__init__.py
index 2cfb09c3..1a69c346 100644
--- a/io_mesh_ply/__init__.py
+++ b/io_mesh_ply/__init__.py
@@ -84,6 +84,8 @@ class ImportPLY(bpy.types.Operator, ImportHelper):
         import os
         from . import import_ply
 
+        context.window.cursor_set('WAIT')
+
         paths = [
             os.path.join(self.directory, name.name)
             for name in self.files
@@ -95,6 +97,8 @@ class ImportPLY(bpy.types.Operator, ImportHelper):
         for path in paths:
             import_ply.load(self, context, path)
 
+        context.window.cursor_set('DEFAULT')
+
         return {'FINISHED'}
 
 
@@ -150,6 +154,8 @@ class ExportPLY(bpy.types.Operator, ExportHelper):
         from mathutils import Matrix
         from . import export_ply
 
+        context.window.cursor_set('WAIT')
+
         keywords = self.as_keywords(
             ignore=(
                 "axis_forward",
@@ -165,11 +171,10 @@ class ExportPLY(bpy.types.Operator, ExportHelper):
         ).to_4x4() @ Matrix.Scale(self.global_scale, 4)
         keywords["global_matrix"] = global_matrix
 
-        filepath = self.filepath
-        filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
-
         export_ply.save(context, **keywords)
 
+        context.window.cursor_set('DEFAULT')
+
         return {'FINISHED'}
 
     def draw(self, context):



More information about the Bf-extensions-cvs mailing list