I have been googling this and can't find an answer. I defined a float property that creates a number spinner in my UI that allows me to move an object back and forth. I would like to clamp this value dynamically so I can't use the built-in FloatProperty clamp values. The code below should work, yet it seems to reset the value to the default value when it should get clamped.
def SetPos(self, context):
self['left'] = Clamp(self['left'],0,1)
def register():
bpy.types.Object.left = FloatProperty(name="left", default=0.34, unit="LENGTH", update=SetPos)
Another issue is that I don't see how to change an enumproperty through script. I can see in the python console it just assigns the string value to the prop like
bpy.context.object.myEnum = 'BLA'
but when I do an assignment like that myself, the UI does not update.
Clampmethod ? – Gorgious Feb 01 '21 at 07:58minandmaxfields of the properties ? – Gorgious Feb 01 '21 at 09:06bpy.propsproperty. – batFINGER Feb 01 '21 at 15:07