4
$\begingroup$

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?

$\endgroup$
1

1 Answer 1

3
$\begingroup$

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.

$\endgroup$
5
  • $\begingroup$ 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 $\endgroup$
    – Revln9
    Jan 16, 2022 at 1:43
  • 1
    $\begingroup$ 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. $\endgroup$ Jan 16, 2022 at 1:45
  • 1
    $\begingroup$ You're very welcome. I look forward to seeing what you accomplish. $\endgroup$ Jan 16, 2022 at 1:46
  • $\begingroup$ I have trouble understanding this one. As I understand it layout.prop returns None. Did I miss something ? docs.blender.org/api/current/… $\endgroup$
    – Gorgious
    May 29, 2022 at 12:14
  • $\begingroup$ @Gorgious I think that is a documentation bug. IIRC I did test the code before I posted. $\endgroup$ May 29, 2022 at 17:07

Not the answer you're looking for? Browse other questions tagged .