[Bf-extensions-cvs] [ef030f05] master: Converted from auto to manual update AutoLoft

Spivak Vladimir cwolf3d noreply at git.blender.org
Mon Sep 2 23:22:33 CEST 2019


Commit: ef030f05337293a50573325eed17f7ffa83831c4
Author: Spivak Vladimir (cwolf3d)
Date:   Tue Sep 3 00:21:27 2019 +0300
Branches: master
https://developer.blender.org/rBACef030f05337293a50573325eed17f7ffa83831c4

Converted from auto to manual update AutoLoft

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

M	curve_tools/__init__.py
M	curve_tools/auto_loft.py

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

diff --git a/curve_tools/__init__.py b/curve_tools/__init__.py
index c1e61282..5ae767a9 100644
--- a/curve_tools/__init__.py
+++ b/curve_tools/__init__.py
@@ -288,6 +288,7 @@ class VIEW3D_PT_CurvePanel(Panel):
                 layout.label(text=o.name)
             # layout.prop(o, '["autoloft"]', toggle=True)
             layout.prop(wm, "auto_loft", toggle=True)
+            layout.operator("curvetools2.update_auto_loft_curves")
 
         # Advanced options
         box1 = self.layout.box()
diff --git a/curve_tools/auto_loft.py b/curve_tools/auto_loft.py
index a8bab35c..2d0e6e68 100644
--- a/curve_tools/auto_loft.py
+++ b/curve_tools/auto_loft.py
@@ -39,17 +39,17 @@ class OperatorAutoLoftCurves(Operator):
                            "description": "Auto loft from %s to %s" % (curve0.name, curve1.name),
                            "curve0": curve0.name,
                            "curve1": curve1.name}
-        print(loftobj['_RNA_UI'].to_dict())
-        self.report({'INFO'}, "OperatorAutoLoftCurves.execute()")
+        #print(loftobj['_RNA_UI'].to_dict())
+        #self.report({'INFO'}, "OperatorAutoLoftCurves.execute()")
 
         return {'FINISHED'}
 
 
 class AutoLoftModalOperator(Operator):
     """Auto Loft"""
-    bl_idname = "wm.auto_loft_curve"
-    bl_label = "Auto Loft"
-    bl_description = "Lofts selected curves"
+    bl_idname = "curvetools2.update_auto_loft_curves"
+    bl_label = "Update Auto Loft"
+    bl_description = "Update Lofts selected curves"
 
     _timer = None
     @classmethod
@@ -57,37 +57,21 @@ class AutoLoftModalOperator(Operator):
         # two curves selected.
         return True
 
-    def modal(self, context, event):
-        scene = context.scene
-        wm = context.window_manager
-        if event.type in {'ESC'}:
-            wm.auto_loft = False
-
-        if not wm.auto_loft:
-            self.cancel(context)
-            return {'CANCELLED'}
-
-        if event.type == 'TIMER':
-            lofters = [o for o in scene.objects if "autoloft" in o.keys()]
-            # quick hack
-            #print("TIMER", lofters)
-
-            for loftmesh in lofters:
-                loftmesh.hide_select = True
-                rna = loftmesh['_RNA_UI']["autoloft"].to_dict()
-                curve0 = scene.objects.get(rna["curve0"])
-                curve1 = scene.objects.get(rna["curve1"])
-                if curve0 and curve1:
-                    ls = LoftedSurface(Curve(curve0), Curve(curve1), loftmesh.name)
-                    ls.bMesh.to_mesh(loftmesh.data)
-
-        return {'PASS_THROUGH'}
-
     def execute(self, context):
-        wm = context.window_manager
-        self._timer = wm.event_timer_add(0.1, context.window)
-        wm.modal_handler_add(self)
-        return {'RUNNING_MODAL'}
+        scene = context.scene
+        lofters = [o for o in scene.objects if "autoloft" in o.keys()]
+        # quick hack
+        #print("TIMER", lofters)
+
+        for loftmesh in lofters:
+            loftmesh.hide_select = True
+            rna = loftmesh['_RNA_UI']["autoloft"].to_dict()
+            curve0 = scene.objects.get(rna["curve0"])
+            curve1 = scene.objects.get(rna["curve1"])
+            if curve0 and curve1:
+                ls = LoftedSurface(Curve(curve0), Curve(curve1), loftmesh.name)
+                ls.bMesh.to_mesh(loftmesh.data)
+        return {'FINISHED'}
 
     def cancel(self, context):
         wm = context.window_manager
@@ -104,8 +88,7 @@ def register():
     bpy.utils.register_class(AutoLoftModalOperator)
     bpy.utils.register_class(OperatorAutoLoftCurves)
     bpy.types.WindowManager.auto_loft = BoolProperty(default=False,
-                                                     name="Auto Loft",
-                                                     update=run_auto_loft)
+                                                     name="Auto Loft")
     bpy.context.window_manager.auto_loft = False
 
 def unregister():



More information about the Bf-extensions-cvs mailing list