Fix #82514: Default Value for Viewport Display Color's Alpha Wrong.

For now duplicate default diffuse color values into RNA code too. Sad
work-around, but fixes the problem, until we get rid of hacks like
'interpret 4 consecutive floats in DNA as an array of 4 floats in RNA'.
This commit is contained in:
Bastien Montagne
2024-08-27 13:16:10 +02:00
parent 92733a9415
commit 7ff1d5d9e4
2 changed files with 5 additions and 0 deletions

View File

@@ -14,6 +14,7 @@
/** \name Material Struct
* \{ */
/* Keep RGBA diffuse defaults in sync with #rna_def_material_display in rna_material.cc */
#define _DNA_DEFAULT_Material \
{ \
.r = 0.8, \

View File

@@ -453,6 +453,10 @@ static void rna_def_material_display(StructRNA *srna)
RNA_def_property_array(prop, 4);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the material");
/* See #82514 for details, for now re-define defaults here. Keep in sync with
* #DNA_material_defaults.h */
static float diffuse_color_default[4] = {0.8f, 0.8f, 0.8f, 1.0f};
RNA_def_property_float_array_default(prop, diffuse_color_default);
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
prop = RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);