4

I have a bunch of geometry nodes inputs exposed on a UI panel. I used the layout prop to do so

gm = object.modifiers.get("nodes")

col.prop(gm, '["Input_13"]', text="Min_Size") col.prop(gm, '["Input_14"]', text="Max_Size") col.prop(gm, '["Input_10"]', text="Offset")

I want to have the ability to set a min max values and also to put an update function for each property.

How can i do that?

Gorgious
  • 30,723
  • 2
  • 44
  • 101
Revln9
  • 227
  • 1
  • 7

1 Answers1

3

The prop function returns the item it used. You can modify the state of that of item. Change your col.prop to something like

prop = col.prop(gm, '["Input_13"]',  text="Min_Size")
prop.min = -3.0e-38
prop.max = 3.0e-38
prop.hard_min = -3.0e-38
prop.hard_max = 3.0e-38

et cetera if you want to change the min and max values. You would of course replace my numeric values with whatever ones you wanted to use.

Marty Fouts
  • 33,070
  • 10
  • 35
  • 79
  • Good to know thanks , and i found out that geometry nodes inputs do have min max values for floats and integers on the group panel – Revln9 Jan 16 '22 at 01:43
  • 1
    The props are the same kind as any other so that means they use things like StringProperty and FloatProperty, so the floats will have exactly the same set of instance variables as a FloatProperty. – Marty Fouts Jan 16 '22 at 01:45
  • 1
    You're very welcome. I look forward to seeing what you accomplish. – Marty Fouts Jan 16 '22 at 01:46
  • I have trouble understanding this one. As I understand it layout.prop returns None. Did I miss something ? https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.prop – Gorgious May 29 '22 at 12:14
  • @Gorgious I think that is a documentation bug. IIRC I did test the code before I posted. – Marty Fouts May 29 '22 at 17:07