Is there any way to get the input value and type of Geometry Nodes modifier I want to use these values in an addon, but these are not consistent, so I can't call it by using this command as sometimes it can be Input_3 despite its second input only
bpy.ops.object.geometry_nodes_input_attribute_toggle(prop_path="[\"Input_2_use_attribute\"]", modifier_name="GeometryNodes")
and I can't feed the values using this -
bpy.data.objects["Cube"].modifiers["GeometryNodes"]["Input_2_attribute_name"] = "UVMap"
as this will only work if the inputs are toggled to attribute only.
so is there any way to get the status of the input? and can we get all the inputs of a modifier and the input name and use Input name to make sure, we are feeding values for the right input, Like in the below example image second input's name is UVMap and I want to feed some value to the input of the modifier which has this particular name only and not by the name like Input_2
or is there any other better way of handling this situation?
Edit:
I have some doubts, like we need to use this command to toggle to attribute mode, and is there any other way of toggling? or is it the only way? bpy.ops.object.geometry_nodes_input_attribute_toggle(prop_path="[\"Input_2_use_attribute\"]", modifier_name="GeometryNodes")
as this method use "Inputs_2_use attribute
" as string and we can't assign this value to variable and use it dynamically.
object
key if you don't want to use the context :bpy.ops.object.geometry_nodes_input_attribute_toggle({"object": bpy.data.objects["Cube"]}, prop_path="[\"Input_2_use_attribute\"]", modifier_name="my_mod_name")
$\endgroup$