1

When I call edge ring from a custom panel operator and then try to do some more editing I get an error that says "No edge rings found"

The error does not happen when I click on edge ring from the menu or when I call it straight from python without having it on an operator in a panel.

here's an example of the steps I do. 1 - select one edge 2 - click on the custom operator edge ring 3 - go to edge - subdivide edge ring 4 - as soon as I try to modify a parameter of the subdivide edge ring it breaks, my selection is reset and I get an error in the log.

enter image description here

anything wrong with my code maybe?

import bpy


class SELECTION_OT_ring2(bpy.types.Operator):
    bl_idname = "selection.ring2"
    bl_label = "Ring"
    bl_description= "Select a ring of connected Edges."

    @classmethod
    def poll(cls, context):
        if context.object is None:
            return False
        if context.mode != 'EDIT_MESH':
            return False
        if context.active_object.mode != 'EDIT':
            return False        
        if len(context.selected_objects) < 1:
            return False

        return True

    def execute(self, context):
        # The actual command
        bpy.ops.mesh.loop_multi_select(ring=True)

        return {'FINISHED'}

# simple panel from the template examples
class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        layout = self.layout
        row = layout.row()
        row.operator("selection.ring2")


def register():
    bpy.utils.register_class(HelloWorldPanel)
    bpy.utils.register_class(SELECTION_OT_ring2)


def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)
    bpy.utils.unregister_class(SELECTION_OT_ring2)


if __name__ == "__main__":
    register()

Thanks!

Phantom
  • 39
  • 3
  • 1
    Candidate for the bug tracker. https://blender.stackexchange.com/questions/1377/best-place-to-put-bug-reports – batFINGER Apr 01 '20 at 06:18

1 Answers1

0

Not sure if it's meant to be that way, but I found a fix. By adding this to the operator, there is no more problem.

bl_options = {'UNDO'}

I suppose the ring function requires it somehow.

Phantom
  • 39
  • 3