[Bf-extensions-cvs] [7685aa17] blender-v2.93-release: Fix T93189: Missing UNDO operator options for Curve Tools addon

Jesse Yurkovich noreply at git.blender.org
Mon Sep 19 14:59:14 CEST 2022


Commit: 7685aa17ce3d01264797245729d7c3b2ddcb43d4
Author: Jesse Yurkovich
Date:   Sat Aug 13 17:36:46 2022 -0700
Branches: blender-v2.93-release
https://developer.blender.org/rBA7685aa17ce3d01264797245729d7c3b2ddcb43d4

Fix T93189: Missing UNDO operator options for Curve Tools addon

A variety of operators were missing appropriate bl_options for correct
undo support.

This results in either crashes (auto loft, bi-rail) or other odd
behaviors around returning the scene to the correct previous state
(sometimes having to hit ctrl-z twice to undo once, sometimes undo skips
steps, etc.)

Differential Revision: https://developer.blender.org/D13283

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

M	curve_tools/auto_loft.py
M	curve_tools/operators.py
M	curve_tools/splines_sequence.py

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

diff --git a/curve_tools/auto_loft.py b/curve_tools/auto_loft.py
index c0711196..21fc740c 100644
--- a/curve_tools/auto_loft.py
+++ b/curve_tools/auto_loft.py
@@ -10,6 +10,7 @@ class OperatorAutoLoftCurves(Operator):
     bl_idname = "curvetools.create_auto_loft"
     bl_label = "Loft"
     bl_description = "Lofts selected curves"
+    bl_options = {'UNDO'}
 
     @classmethod
     def poll(cls, context):
diff --git a/curve_tools/operators.py b/curve_tools/operators.py
index 2b1fe12d..3d1e2ba7 100644
--- a/curve_tools/operators.py
+++ b/curve_tools/operators.py
@@ -143,6 +143,7 @@ class OperatorOriginToSpline0Start(bpy.types.Operator):
     bl_idname = "curvetools.operatororigintospline0start"
     bl_label = "OriginToSpline0Start"
     bl_description = "Sets the origin of the active/selected curve to the starting point of the (first) spline. Nice for curve modifiers"
+    bl_options = {'UNDO'}
 
 
     @classmethod
@@ -180,6 +181,7 @@ class OperatorIntersectCurves(bpy.types.Operator):
     bl_idname = "curvetools.operatorintersectcurves"
     bl_label = "Intersect"
     bl_description = "Intersects selected curves"
+    bl_options = {'UNDO'}
 
 
     @classmethod
@@ -231,6 +233,7 @@ class OperatorLoftCurves(bpy.types.Operator):
     bl_idname = "curvetools.operatorloftcurves"
     bl_label = "Loft"
     bl_description = "Lofts selected curves"
+    bl_options = {'UNDO'}
 
 
     @classmethod
@@ -256,6 +259,7 @@ class OperatorSweepCurves(bpy.types.Operator):
     bl_idname = "curvetools.operatorsweepcurves"
     bl_label = "Sweep"
     bl_description = "Sweeps the active curve along to other curve (rail)"
+    bl_options = {'UNDO'}
 
 
     @classmethod
@@ -281,6 +285,7 @@ class OperatorBirail(bpy.types.Operator):
     bl_idname = "curvetools.operatorbirail"
     bl_label = "Birail"
     bl_description = "Generates a birailed surface from 3 selected curves -- in order: rail1, rail2 and profile"
+    bl_options = {'UNDO'}
 
 
     @classmethod
@@ -304,6 +309,7 @@ class OperatorSplinesSetResolution(bpy.types.Operator):
     bl_idname = "curvetools.operatorsplinessetresolution"
     bl_label = "SplinesSetResolution"
     bl_description = "Sets the resolution of all splines"
+    bl_options = {'UNDO'}
 
 
     @classmethod
@@ -328,6 +334,7 @@ class OperatorSplinesRemoveZeroSegment(bpy.types.Operator):
     bl_idname = "curvetools.operatorsplinesremovezerosegment"
     bl_label = "SplinesRemoveZeroSegment"
     bl_description = "Removes splines with no segments -- they seem to creep up, sometimes"
+    bl_options = {'UNDO'}
 
 
     @classmethod
@@ -362,6 +369,7 @@ class OperatorSplinesRemoveShort(bpy.types.Operator):
     bl_idname = "curvetools.operatorsplinesremoveshort"
     bl_label = "SplinesRemoveShort"
     bl_description = "Removes splines with a length smaller than the threshold"
+    bl_options = {'UNDO'}
 
 
     @classmethod
@@ -391,6 +399,7 @@ class OperatorSplinesJoinNeighbouring(bpy.types.Operator):
     bl_idname = "curvetools.operatorsplinesjoinneighbouring"
     bl_label = "SplinesJoinNeighbouring"
     bl_description = "Joins neighbouring splines within a distance smaller than the threshold"
+    bl_options = {'UNDO'}
 
 
     @classmethod
diff --git a/curve_tools/splines_sequence.py b/curve_tools/splines_sequence.py
index d861a1ee..cc5f6680 100644
--- a/curve_tools/splines_sequence.py
+++ b/curve_tools/splines_sequence.py
@@ -232,6 +232,7 @@ class RearrangeSpline(bpy.types.Operator):
     bl_idname = "curvetools.rearrange_spline"
     bl_label = "Rearrange Spline"
     bl_description = "Rearrange Spline"
+    bl_options = {'UNDO'}
 
     Types = [('NEXT', "Next", "next"),
              ('PREV', "Prev", "prev")]



More information about the Bf-extensions-cvs mailing list