Node properties seem to miss range limit validation

In Blender FloatProperty and IntProperty have soft and hard limits for values that can be assigned. The soft limits soft_min and soft_max is what the sliders in the UI use by default. The hard limits hard_min and hard_max should be the allowed range of values that can be entered manually or assigned through the Python API. This seems to be true for the properties is the general users interface, however it does not apply to the property of nodes.

For example the property bpy.context.scene.eevee.bloom_threshold has hard limits set to 0.0 and 100000.0, which are the values retrieved through bpy.context.scene.eevee.bl_rna.properties["bloom_threshold"].hard_min and bpy.context.scene.eevee.bl_rna.properties["bloom_threshold"].hard_max respectively. Assigning values outside of the min-max-range is not possible.

However if you test the validation on material nodes, e.g. the Principled BSDF you can assign values that are outside of the range. For example the Metallic property is supposed to have hard min of 0.0 and a hard max of 1.0. These values where retrieved through the RNA.

property = bpy.context.view_layer.objects.active.active_material.node_tree.nodes["Principled BSDF"].inputs["Metallic"].bl_rna.properties["default_value"]
print(f"hard max: {property.hard_max}")
print(f"hard min: {property.hard_min}")

It’s possible to manually assign values higher than 1.0 in the UI as well as through the Python API.

Is this a missing input validation or have I misunderstood the purpose of the hard limits?

1 Like