Blender Python ... Function.result expected a set, not a NoneType

I came to a weird thing in my addon (attached) I have this function that’s inside a class right below where I’m setting the state of all these buttons in my add on preferences to true or false so that so that I could disable or re enable all the buttons with one click… the first if statement returns falls but blender expects a set instead of a none type… How could I rewrite this so it returns a set…

the relevant code is before I didn’t include the code that was in my init_py

because it was too long and it might seem out of context if I pasted part of it so you can always look at the attached file… you can install this add on and test it out it’s in a working state it’s just issue on the buttons… oddly enough I’m not getting a line output on the error message in the console Is that because it’s a runtime error?

Thanks in advance for any help on this (276.9 KB)

class SSM_OT_ToggleAllButtons(bpy.types.Operator):
    bl_idname = "ssm_preferences.toggle_all_buttons"
    bl_label = "Toggle All Buttons"

    def execute(self, context):
        # get the current scene
        manager = context.scene.super_solid_mode
        if manager.Toggle == True:
            manager.optimized_map = False
            manager.clean_up = False
            manager.auto_mode = False
            manager.auto_mode_pbr = False
            manager.auto_mode_poliigon = False
            manager.auto_mode_wrangler = False

            manager.set_frame = False
            manager.skip_frames = False
            manager.open_keyframe = False
            manager.full_screen = False
            manager.switch_object = False
            manager.switch_edit = False
            manager.switch_pose = False
            manager.switch_sculpt = False
            manager.show_overlays = False
            manager.toggle_xray = False
            manager.switch_wire = False
            manager.switch_solid = False
            manager.switch_mat = False
            manager.switch_render = False

            manager.undo_redo = False
            manager.all_skey = False
            manager.childless_empties = False
            manager.frame_nodes = False
            manager.add_sound = False
            manager.add_movie = False
            manager.split_clip = False
            manager.delete_clip = False

            manager.to_timeline_s = False
            manager.to_timeline_se = False
            manager.to_timeline_ds = False
            manager.to_timeline_ge = False

            manager.to_sequencer_t = False
            manager.to_sequencer_se = False
            manager.to_sequencer_ds = False
            manager.to_sequencer_ge = False

            manager.to_shader_editor_t = False
            manager.to_shader_editor_s = False
            manager.to_shader_editor_ne = False
            manager.to_shader_editor_ds = False
            manager.to_shader_editor_ge = False

            manager.to_dope_sheet_t = False
            manager.to_dope_sheet_se = False
            manager.to_dope_sheet_s = False
            manager.to_dope_sheet_ge = False

            manager.to_graph_editor_t = False
            manager.to_graph_editor_ds = False
            manager.to_graph_editor_s = False
            manager.to_graph_editor_se = False

            manager.Extreme_pbr_patch = False

            manager.empty_func = False
            manager.show_gizmo = False
            manager.Toggle = False

        elif manager.Toggle == False:
            manager.optimized_map = True
            manager.clean_up = True
            manager.auto_mode = True
            manager.auto_mode_pbr = True
            manager.auto_mode_poliigon = True
            manager.auto_mode_wrangler = True

            manager.set_frame = True
            manager.skip_frames = True
            manager.open_keyframe = True
            manager.full_screen = True
            manager.switch_object = True
            manager.switch_edit = True
            manager.switch_pose = True
            manager.switch_sculpt = True
            manager.show_overlays = True
            manager.toggle_xray = True
            manager.switch_wire = True
            manager.switch_solid = True
            manager.switch_mat = True
            manager.switch_render = True

            manager.undo_redo = True
            manager.all_skey = True
            manager.childless_empties = True
            manager.frame_nodes = True
            manager.add_sound = True
            manager.add_movie = True
            manager.split_clip = True
            manager.delete_clip = True

            manager.to_timeline_s = True
            manager.to_timeline_se = True
            manager.to_timeline_ds = True
            manager.to_timeline_ge = True

            manager.to_sequencer_t = True
            manager.to_sequencer_se = True
            manager.to_sequencer_ds = True
            manager.to_sequencer_ge = True

            manager.to_shader_editor_t = True
            manager.to_shader_editor_s = True
            manager.to_shader_editor_ne = True
            manager.to_shader_editor_ds = True
            manager.to_shader_editor_ge = True

            manager.to_dope_sheet_t = True
            manager.to_dope_sheet_se = True
            manager.to_dope_sheet_s = True
            manager.to_dope_sheet_ge = True

            manager.to_graph_editor_t = True
            manager.to_graph_editor_ds = True
            manager.to_graph_editor_s = True
            manager.to_graph_editor_se = True

            manager.Extreme_pbr_patch = True

            manager.empty_func = True
            manager.show_gizmo = True

            manager.Toggle = True
            return {'FINISHED'}

    # Disable All Button
        if manager.Toggle:
            label = 'Disable All Buttons'
            depr = True
            label = 'Enable All Buttons'
            depr = False
        row_main.operator("ssm_preferences.toggle_all_buttons", text=label , emboss = True,  depress=depr)
class SSM_Properties(bpy.types.PropertyGroup):
    Toggle: BoolProperty(
        name="Toggle button for all",
        description="Turn off or on all the buttons",
        default = True

is part of an if statement

To be more specific, this error appears if you return nothing instead of {‘FINISHED’} or {‘CANCELLED’}

1 Like

ohh crap So I had my return in the wrong place Thank you so much I looked everywhere in that code

1 Like

i’m gonna update that add on a lot That’s the latest update But if you want a free code PM me so then you get all future updates it’s rated as a top add on

1 Like

Anytime and thanks for the offer, I did check your add-on out. I might buy it in the future actually! Good luck!

a free code would include all future updates…i’m currently working on a beta that installs OpenCV…and I plan to incorporate OpenCV technology to speed up/make more beautiful…your animation workflow…its available on Gumroad…just the install part… You could only uninstall the addon manually but that’s the only way this is possible🙂 thanks for helping me figure out this issue

For what it’s worth your code follows some kind of anti pattern here, you don’t really need an if statement :

            state = not manager.Toggle 
            manager.optimized_map = state 
            manager.clean_up = state 
            manager.auto_mode = state 
            manager.auto_mode_pbr = state 
            manager.auto_mode_poliigon = state 
            manager.auto_mode_wrangler = state 


Also be careful with outdated comments, they can lead to wrong interpretations of your code. I think no comment is better than a false or incomplete comment : # get the current scene

I’m releasing another update pretty soon here so I’ll take a look at those things. Thank you for letting me know