Fix T93873: Wrong limits for color socket exposed to modifier

Limit the min and max of the IDProperty for the node group input
from 0 to infinity, and the soft min and max between 0 and 1.

Thanks to @PratikPB2123 for investigation.
This commit is contained in:
Hans Goudey 2022-02-21 13:01:37 -05:00
parent b7171d1b82
commit be6bcaa8c1
Notes: blender-bot 2023-02-14 08:08:56 +01:00
Referenced by issue #93873, GeoNode color attribute swatch on modifier frontend behaves wrong
1 changed files with 4 additions and 0 deletions

View File

@ -435,6 +435,10 @@ static IDProperty *id_property_create_from_socket(const bNodeSocket &socket)
ui_data->base.rna_subtype = PROP_COLOR;
ui_data->default_array = (double *)MEM_mallocN(sizeof(double[4]), __func__);
ui_data->default_array_len = 4;
ui_data->min = 0.0;
ui_data->max = FLT_MAX;
ui_data->soft_min = 0.0;
ui_data->soft_max = 1.0;
for (const int i : IndexRange(4)) {
ui_data->default_array[i] = double(value->value[i]);
}