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:
o.modifiers.active.node_group = bpy.data.node_groups[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