# Hide useless settings in geometry node modifier with python

**URL:** <https://blenderartists.org/t/hide-useless-settings-in-geometry-node-modifier-with-python/1469503>\
**Category:** Python Support\
**Created:** [June 18, 2023, 8:23pm UTC](https://blenderartists.org/t/hide-useless-settings-in-geometry-node-modifier-with-python/1469503 "2023-06-18T20:23:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![MartinZ](https://blenderartists.org/user_avatar/blenderartists.org/martinz/32/1437938_2.png) [@MartinZ](https://blenderartists.org/u/MartinZ)\
**Post date:** [June 20, 2023, 1:25pm UTC](https://blenderartists.org/t/hide-useless-settings-in-geometry-node-modifier-with-python/1469503/2 "2023-06-20T13:25:55Z")

</div>

I would generally recommend not to have any useless settings. Useless settings are useless in my opinion. Just don’t have them, because they have no use whatsoever. By definition, actually. 😃

Else than that, you could use an application handler to check the state of the input and then control `hide_in_modifier` properties of the inputs.

In order not to have to script everything every time, you could have some rules about what inputs are checkboxes for “collapsible tabs” and what inputs are items to be collapsed.

So I would use the description of the inputs. If the description contains the words “Toggle tab” it would be the toggle input and then the items that belong to it should contain it’s name followed by " -\>" and description (so that it’s always unique because “My tab” would later be found in “My tab 2” as well, but “My tab -\>” fixes that).

![collapse](https://blenderartists.org/uploads/default/original/4X/1/d/e/1ded7d038f01091dd03126583a660646f216d037.gif)

That’s the code. I added add-on stuff, so you could save it as .py file and install as add-on if you wanted:

```auto
bl_info = {
    "name": "Modifier collapsable inputs",
    "author": "Martynas Žiemys",
    "version": (1, 0),
    "blender": (3, 5, 1),
    "location": "",
    "description": "If input description contains 'Toggle tab' is a toggle input and the items that belong to it must contain it's name followed by ' ->' in the description",
    "warning": "",
    "doc_url": "",
    "category": "Modifiers",
}

import bpy
from bpy.app.handlers import persistent

@persistent
def GN_collapse_handler(dummy):
    tabs = []
    items = []

    for mod in bpy.context.object.modifiers:
        if mod.type != 'NODES':
            continue
        for input in mod.node_group.inputs:
            if "Toggle tab" in input.description:
                tabs.append(input)
            else:
                items.append(input)
        for item in items:
            for tab in tabs:
                if tab.name+" ->" in item.description:
                     item.hide_in_modifier = not mod[tab.identifier]
            

def register():
    bpy.app.handlers.depsgraph_update_post.append(GN_collapse_handler)

def unregister():
    bpy.app.handlers.depsgraph_update_post.remove(GN_collapse_handler)

if __name__ == " __main__":
    register()

```

Not sure if I am unregistering the handler correctly. That shouldn’t end the world though.

---

_[View the full topic](https://blenderartists.org/t/hide-useless-settings-in-geometry-node-modifier-with-python/1469503)._
