Skip to content

Commit

Permalink
force context update in edit mode
Browse files Browse the repository at this point in the history
  • Loading branch information
rpopovici committed Feb 6, 2019
1 parent 17242a7 commit 2f82ce4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mesh_select_overlapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ def select_overlapping(context, overlapping, distance, intersections, inset, cop
# Deselect all first
#bpy.ops.mesh.select_all(action = 'DESELECT')

# force context update in edit mode
# apparently there's a bug in scene.update()
bpy.context.scene.update()
mode = bpy.context.object.mode
if mode != 'OBJECT':
bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.object.mode_set(mode = mode)

# select in context
(vertex_mode, edge_mode, face_mode) = bpy.context.tool_settings.mesh_select_mode

Expand Down Expand Up @@ -358,6 +366,10 @@ class SelectOverlapping(bpy.types.Operator):
description = "Angle tolerance between coplanar faces",
)

@classmethod
def poll(cls, context):
return context.active_object is not None and context.active_object.type == 'MESH'

def execute(self, context):
select_overlapping(context, self.overlapping, self.distance, self.intersections, self.inset, self.coplanar, self.tolerance, self.angle)
return {'FINISHED'}
Expand Down

0 comments on commit 2f82ce4

Please sign in to comment.