Bsurfaces: Use context temp override to avoid deprecation #104486
@ -1389,7 +1389,8 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||||||
self.is_crosshatch = False
|
self.is_crosshatch = False
|
||||||
|
|
||||||
# Delete all duplicates
|
# Delete all duplicates
|
||||||
bpy.ops.object.delete({"selected_objects": objects_to_delete})
|
with bpy.context.temp_override(selected_objects=objects_to_delete):
|
||||||
|
bpy.ops.object.delete('EXEC_REGION_WIN')
|
||||||
|
|
||||||
# If the main object has modifiers, turn their "viewport view status" to
|
# If the main object has modifiers, turn their "viewport view status" to
|
||||||
# what it was before the forced deactivation above
|
# what it was before the forced deactivation above
|
||||||
@ -1610,7 +1611,8 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||||||
ob_surface.scale = (1.0, 1.0, 1.0)
|
ob_surface.scale = (1.0, 1.0, 1.0)
|
||||||
|
|
||||||
# Delete final points temporal object
|
# Delete final points temporal object
|
||||||
bpy.ops.object.delete({"selected_objects": [final_points_ob]})
|
with bpy.context.temp_override(selected_objects=[final_points_ob]):
|
||||||
|
bpy.ops.object.delete('EXEC_REGION_WIN')
|
||||||
|
|
||||||
# Delete isolated verts if there are any
|
# Delete isolated verts if there are any
|
||||||
bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
|
bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
|
||||||
@ -1749,7 +1751,8 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||||||
self.main_object.data.vertices[main_object_related_vert_idx].select = True
|
self.main_object.data.vertices[main_object_related_vert_idx].select = True
|
||||||
|
|
||||||
# Delete duplicated object
|
# Delete duplicated object
|
||||||
bpy.ops.object.delete({"selected_objects": [final_ob_duplicate]})
|
with bpy.context.temp_override(selected_objects=[final_ob_duplicate]):
|
||||||
|
bpy.ops.object.delete('EXEC_REGION_WIN')
|
||||||
|
|
||||||
# Join crosshatched surface and main object
|
# Join crosshatched surface and main object
|
||||||
bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
|
bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
|
||||||
@ -2539,7 +2542,8 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||||||
ob_simplified_curve[i].data.splines[0].bezier_points[t].co
|
ob_simplified_curve[i].data.splines[0].bezier_points[t].co
|
||||||
|
|
||||||
# Delete the temporal curve
|
# Delete the temporal curve
|
||||||
bpy.ops.object.delete({"selected_objects": [ob_simplified_curve[i]]})
|
with bpy.context.temp_override(selected_objects=[ob_simplified_curve[i]]):
|
||||||
|
bpy.ops.object.delete('EXEC_REGION_WIN')
|
||||||
|
|
||||||
# Get the coords of the points distributed along the sketched strokes,
|
# Get the coords of the points distributed along the sketched strokes,
|
||||||
# with proportions-U of the first selection
|
# with proportions-U of the first selection
|
||||||
@ -3019,9 +3023,11 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||||||
surface_splines_parsed[len(surface_splines_parsed) - 1][i] = verts_middle_position_co
|
surface_splines_parsed[len(surface_splines_parsed) - 1][i] = verts_middle_position_co
|
||||||
|
|
||||||
# Delete object with control points and object from grease pencil conversion
|
# Delete object with control points and object from grease pencil conversion
|
||||||
bpy.ops.object.delete({"selected_objects": [ob_ctrl_pts]})
|
with bpy.context.temp_override(selected_objects=[ob_ctrl_pts]):
|
||||||
|
bpy.ops.object.delete('EXEC_REGION_WIN')
|
||||||
|
|
||||||
bpy.ops.object.delete({"selected_objects": splines_U_objects})
|
with bpy.context.temp_override(selected_objects=splines_U_objects):
|
||||||
|
bpy.ops.object.delete('EXEC_REGION_WIN')
|
||||||
|
|
||||||
# Generate surface
|
# Generate surface
|
||||||
|
|
||||||
@ -3176,7 +3182,8 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||||||
mat.roughness = 0.0
|
mat.roughness = 0.0
|
||||||
self.main_splines.data.materials.append(mat)
|
self.main_splines.data.materials.append(mat)
|
||||||
else:
|
else:
|
||||||
bpy.ops.object.delete({"selected_objects": [self.main_splines]})
|
with bpy.context.temp_override(selected_objects=[self.main_splines]):
|
||||||
|
bpy.ops.object.delete('EXEC_REGION_WIN')
|
||||||
|
|
||||||
# Delete grease pencil strokes
|
# Delete grease pencil strokes
|
||||||
if self.strokes_type == "GP_STROKES" and not self.stopping_errors:
|
if self.strokes_type == "GP_STROKES" and not self.stopping_errors:
|
||||||
@ -3275,7 +3282,8 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||||||
# executions of this operator, with the reserved names used here
|
# executions of this operator, with the reserved names used here
|
||||||
for o in bpy.data.objects:
|
for o in bpy.data.objects:
|
||||||
if o.name.find("SURFSKIO_") != -1:
|
if o.name.find("SURFSKIO_") != -1:
|
||||||
bpy.ops.object.delete({"selected_objects": [o]})
|
with bpy.context.temp_override(selected_objects=[o]):
|
||||||
|
bpy.ops.object.delete('EXEC_REGION_WIN')
|
||||||
|
|
||||||
bpy.context.view_layer.objects.active = self.original_curve
|
bpy.context.view_layer.objects.active = self.original_curve
|
||||||
|
|
||||||
@ -3413,7 +3421,8 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||||||
self.average_gp_segment_length = segments_lengths_sum / segments_count
|
self.average_gp_segment_length = segments_lengths_sum / segments_count
|
||||||
|
|
||||||
# Delete temporary strokes curve object
|
# Delete temporary strokes curve object
|
||||||
bpy.ops.object.delete({"selected_objects": [self.temporary_curve]})
|
with bpy.context.temp_override(selected_objects=[self.temporary_curve]):
|
||||||
|
bpy.ops.object.delete('EXEC_REGION_WIN')
|
||||||
|
|
||||||
# Set again since "execute()" will turn it again to its initial value
|
# Set again since "execute()" will turn it again to its initial value
|
||||||
self.execute(context)
|
self.execute(context)
|
||||||
@ -3434,7 +3443,8 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
|
bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
|
||||||
bpy.ops.object.delete({"selected_objects": [self.original_curve]})
|
with bpy.context.temp_override(selected_objects=[self.original_curve]):
|
||||||
|
bpy.ops.object.delete('EXEC_REGION_WIN')
|
||||||
bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
|
bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@ -4062,7 +4072,8 @@ class CURVE_OT_SURFSK_reorder_splines(Operator):
|
|||||||
bpy.context.object.name = curve_original_name
|
bpy.context.object.name = curve_original_name
|
||||||
|
|
||||||
# Delete all unused objects
|
# Delete all unused objects
|
||||||
bpy.ops.object.delete({"selected_objects": objects_to_delete})
|
with bpy.context.temp_override(selected_objects=objects_to_delete):
|
||||||
|
bpy.ops.object.delete('EXEC_REGION_WIN')
|
||||||
|
|
||||||
bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
|
bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
|
||||||
bpy.data.objects[curve_original_name].select_set(True)
|
bpy.data.objects[curve_original_name].select_set(True)
|
||||||
|
Loading…
Reference in New Issue
Block a user