Skip to content

Transform your 3D texturing workflow with the power of generative AI, directly within Blender!

reset an emptied number field to its default

sakalondfdf9e5933372
diff --git a/stablegen/ui/studio.py b/stablegen/ui/studio.py
index d0e6bf7..5bcc6f6 100644
--- a/stablegen/ui/studio.py
+++ b/stablegen/ui/studio.py
@@ -481,7 +481,10 @@ class StudioSession:
raise ReferenceError('The adapter list changed while this value was being edited.')
binding, text = edit['binding'], edit['buffer'].text
prop = binding.rna(bpy.context)
- value = float(text) if prop.type == 'FLOAT' else int(text) if prop.type == 'INT' else text
+ if prop.type in {'INT', 'FLOAT'} and not text.strip():
+ value = prop.default # an emptied number resets to its default
+ else:
+ value = float(text) if prop.type == 'FLOAT' else int(text) if prop.type == 'INT' else text
if binding.value(bpy.context) != value:
self.write_binding(binding, value)
self.refresh()