Modifiy several input of a geometry node group at once

Hi, i have tested a script to inject value for differents input of a geometry node instance selection

I want to make it more generic, to reuses this script with a different geometry node with different input but i don’t know if it’s even possible without interface, i want to check specified geometry node input, change value for some of them, freeze input i don’t want to modify and apply those modification for a selection. Don’t know if i am clear

this is my code:

import bpy

lenght = 2
width = 2
height = 2.5
pillar_nbr = 2
deck_high = 0.5
deck_gap = 0.8
arch_high = 1.75
arch_gap = 0.01
pillar_width = -0.8
pillar_gap = 0.3
geonode_source = "Pont_type02" #Type de pont : type01 avec origine centroide, type02 origine à une extremité
'''A Faire :'''
'''Metre en place des conditions : Si la longueur du pont est superieur à tant alors le nombre de pillier = x'''

for o in bpy.context.selected_objects: =[geonode_source]

    #On force en float car le python blender ne convertit pas le int en float 
    #o.modifiers[geonode_source]["Input_2"] = lenght    # longueur de pont
    #o.modifiers[geonode_source]["Input_5"] = width     # largeur de pont
    o.modifiers[geonode_source]["Input_4"] = float(height)   # hauteur de pont 
    o.modifiers[geonode_source]["Input_3"] = float(pillar_nbr)    # nombre de pilier
    o.modifiers[geonode_source]["Input_14"] = float(deck_high)    # hauteur tablier
    o.modifiers[geonode_source]["Input_15"] = float(deck_gap)     # decalage tablier
    o.modifiers[geonode_source]["Input_16"] = float(arch_high)    # hauteur arche
    o.modifiers[geonode_source]["Input_17"] = float(arch_gap)     # decalage arche
    o.modifiers[geonode_source]["Input_18"] = float(pillar_width) # largeur pilier
    o.modifiers[geonode_source]["Input_19"] = float(pillar_gap)   # decalage pilier

Hello ! So, where does your script fall short on what you’re trying to achieve ?

my script is working but it is binding to this particular node. what I want is to make it versatile and to be able to use it on many different nodes. I am looking for a solution to read all the attributes of a node, list them and allow them to be varied or not in order to assign them to a selection. it’s a quick summary and I don’t know what is possible or what it implies, I think I have to make an interface, but this one would be built differently depending on the node… is this relevant?

Yes, very relevant.

I’ve done something similar to display GN inputs in the 3D viewport. Maybe you can take something from it.

Escpecially you can infer the input name from the input. input.identifier

1 Like