[Bf-extensions-cvs] [1efa00c3] master: Bsurfaces: Fixing some problem. Addon work but need redesign.

Spivak Vladimir cwolf3d noreply at git.blender.org
Sat May 4 15:44:59 CEST 2019


Commit: 1efa00c323609a571fb1456a02f39e6909c4500d
Author: Spivak Vladimir (cwolf3d)
Date:   Sat May 4 16:43:22 2019 +0300
Branches: master
https://developer.blender.org/rBA1efa00c323609a571fb1456a02f39e6909c4500d

Bsurfaces: Fixing some problem.
Addon work but need redesign.

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

M	mesh_bsurfaces.py

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

diff --git a/mesh_bsurfaces.py b/mesh_bsurfaces.py
index 04168fd7..deae842b 100644
--- a/mesh_bsurfaces.py
+++ b/mesh_bsurfaces.py
@@ -310,9 +310,9 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
         edges_lengths_sum = 0
         for i in range(0, len(verts_ordered)):
             if i == 0:
-                prev_v_co = matrix * verts_ordered[i].co
+                prev_v_co = matrix @ verts_ordered[i].co
             else:
-                v_co = matrix * verts_ordered[i].co
+                v_co = matrix @ verts_ordered[i].co
 
                 v_difs = [prev_v_co[0] - v_co[0], prev_v_co[1] - v_co[1], prev_v_co[2] - v_co[2]]
                 edge_length = abs(sqrt(v_difs[0] * v_difs[0] + v_difs[1] * v_difs[1] + v_difs[2] * v_difs[2]))
@@ -405,7 +405,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
         # from grease pencil and wasn't made by hand, delete it
         if not self.using_external_curves:
             try:
-                bpy.ops.object.select_all(action='DESELECT')
+                bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
                 self.original_curve.select_set(True)
                 bpy.context.view_layer.objects.active = self.original_curve
 
@@ -413,11 +413,11 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
             except:
                 pass
 
-            bpy.ops.object.select_all(action='DESELECT')
+            bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
             self.main_object.select_set(True)
             bpy.context.view_layer.objects.active = self.main_object
         else:
-            bpy.ops.object.select_all(action='DESELECT')
+            bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
             self.original_curve.select_set(True)
             self.main_object.select_set(True)
             bpy.context.view_layer.objects.active = self.main_object
@@ -1001,7 +1001,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
                                     )
                 self.main_object.modifiers[m_idx].show_viewport = False
 
-        bpy.ops.object.select_all(action='DESELECT')
+        bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
         ob_original_splines.select_set(True)
         bpy.context.view_layer.objects.active = ob_original_splines
 
@@ -1127,7 +1127,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
 
                 self.crosshatch_merge_distance = shortest_dist / 3
 
-            bpy.ops.object.select_all(action='DESELECT')
+            bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
             ob_splines.select_set(True)
             bpy.context.view_layer.objects.active = ob_splines
 
@@ -1290,11 +1290,11 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
                                                     # actual segment, coords of intersection point
                                                     all_intersections.append(
                                                             (i, t, percent1,
-                                                            ob_splines.matrix_world * intersec_coords[0])
+                                                            ob_splines.matrix_world @ intersec_coords[0])
                                                             )
                                                     all_intersections.append(
                                                             (i2, t2, percent2,
-                                                            ob_splines.matrix_world * intersec_coords[1])
+                                                            ob_splines.matrix_world @ intersec_coords[1])
                                                             )
 
                         checked_splines.append(i)
@@ -1315,7 +1315,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
 
         # Delete all duplicates
         for o in objects_to_delete:
-            bpy.ops.object.select_all(action='DESELECT')
+            bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
             o.select_set(True)
             bpy.context.view_layer.objects.active = o
             bpy.ops.object.delete()
@@ -1363,7 +1363,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
         ob.data = me
         bpy.context.collection.objects.link(ob)
 
-        bpy.ops.object.select_all(action='DESELECT')
+        bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
         ob.select_set(True)
         bpy.context.view_layer.objects.active = ob
 
@@ -1542,14 +1542,14 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
         bpy.context.collection.objects.link(ob_surface)
 
         # Delete final points temporal object
-        bpy.ops.object.select_all(action='DESELECT')
+        bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
         final_points_ob.select_set(True)
         bpy.context.view_layer.objects.active = final_points_ob
 
         bpy.ops.object.delete()
 
         # Delete isolated verts if there are any
-        bpy.ops.object.select_all(action='DESELECT')
+        bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
         ob_surface.select_set(True)
         bpy.context.view_layer.objects.active = ob_surface
 
@@ -1687,13 +1687,13 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
                             self.main_object.data.vertices[main_object_related_vert_idx].select_set(True)
 
         # Delete duplicated object
-        bpy.ops.object.select_all(action='DESELECT')
+        bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
         final_ob_duplicate.select_set(True)
         bpy.context.view_layer.objects.active = final_ob_duplicate
         bpy.ops.object.delete()
 
         # Join crosshatched surface and main object
-        bpy.ops.object.select_all(action='DESELECT')
+        bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
         ob_surface.select_set(True)
         self.main_object.select_set(True)
         bpy.context.view_layer.objects.active = self.main_object
@@ -1898,7 +1898,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
 
         bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
 
-        bpy.ops.object.select_all(action='DESELECT')
+        bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
         self.main_splines.select_set(True)
         bpy.context.view_layer.objects.active = self.main_splines
 
@@ -2450,7 +2450,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
 
                 spline_bp_count = len(spline.bezier_points)
 
-                bpy.ops.object.select_all(action='DESELECT')
+                bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
                 ob_simplified_curve[i].select_set(True)
                 bpy.context.view_layer.objects.active = ob_simplified_curve[i]
 
@@ -2495,7 +2495,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
                             ob_simplified_curve[i].data.splines[0].bezier_points[t].co
 
                 # Delete the temporal curve
-                bpy.ops.object.select_all(action='DESELECT')
+                bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
                 ob_simplified_curve[i].select_set(True)
                 bpy.context.view_layer.objects.active = ob_simplified_curve[i]
 
@@ -2634,7 +2634,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
                 last_v = v
                 vert_num_in_spline += 1
 
-        bpy.ops.object.select_all(action='DESELECT')
+        bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
         ob_ctrl_pts.select_set(True)
         bpy.context.view_layer.objects.active = ob_ctrl_pts
 
@@ -2776,7 +2776,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
                 ob_spline_U.data.splines[0].use_cyclic_u = False
 
             splines_U_objects.append(ob_spline_U)
-            bpy.ops.object.select_all(action='DESELECT')
+            bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
             ob_spline_U.select_set(True)
             bpy.context.view_layer.objects.active = ob_spline_U
 
@@ -2980,14 +2980,14 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
                             surface_splines_parsed[len(surface_splines_parsed) - 1][i] = verts_middle_position_co
 
         # Delete object with control points and object from grease pencil conversion
-        bpy.ops.object.select_all(action='DESELECT')
+        bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
         ob_ctrl_pts.select_set(True)
         bpy.context.view_layer.objects.active = ob_ctrl_pts
 
         bpy.ops.object.delete()
 
         for sp_ob in splines_U_objects:
-            bpy.ops.object.select_all(action='DESELECT')
+            bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
             sp_ob.select_set(True)
             bpy.context.view_layer.objects.active = sp_ob
 
@@ -3043,9 +3043,9 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
 
     def execute(self, context):
 
-        bpy.context.preferences.edit.use_global_undo = False
-        
         self.main_object = bpy.context.view_layer.objects.active
+        
+        bpy.context.preferences.edit.use_global_undo = False
 
         if not self.is_fill_faces:
             bpy.ops.wm.context_set_value(data_path='tool_settings.mesh_select_mode',
@@ -3068,7 +3068,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
             #bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
             bpy.ops.object.mode_set(mode='OBJECT')
 
-            bpy.ops.object.select_all(action='DESELECT')
+            bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
             self.main_splines.select_set(True)
             bpy.context.view_layer.objects.active = self.main_splines
 
@@ -3092,7 +3092,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
                 strokes_for_rectangular_surface = True
                 strokes_for_crosshatch = False
 
-            bpy.ops.object.select_all(action='DESELECT')
+            bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
             s

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list