UI: Add tooltips for texture shader node inputs

Pull Request: https://projects.blender.org/blender/blender/pulls/119641
This commit is contained in:
Bartosz Kosiorek
2024-06-06 20:17:06 +02:00
committed by Brecht Van Lommel
parent 5411ace289
commit 427e8ab881
7 changed files with 119 additions and 34 deletions

View File

@@ -4784,19 +4784,35 @@ static void def_sh_tex_sky(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "air_density", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Air", "Density of air molecules");
RNA_def_property_ui_text(prop,
"Air",
"Density of air molecules.\n"
"\u2022 0 - No air.\n"
"\u2022 1 - Clear day atmosphere.\n"
"\u2022 2 - Highly polluted day");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "dust_density", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Dust", "Density of dust molecules and water droplets");
RNA_def_property_ui_text(prop,
"Dust",
"Density of dust molecules and water droplets.\n"
"\u2022 0 - No dust.\n"
"\u2022 1 - Clear day atmosphere.\n"
"\u2022 5 - City like atmosphere.\n"
"\u2022 10 - Hazy day");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "ozone_density", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Ozone", "Density of ozone layer");
RNA_def_property_ui_text(prop,
"Ozone",
"Density of ozone layer.\n"
"\u2022 0 - No ozone.\n"
"\u2022 1 - Clear day atmosphere.\n"
"\u2022 2 - City like atmosphere");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
@@ -5070,28 +5086,36 @@ static void def_sh_tex_brick(StructRNA *srna)
RNA_def_property_int_sdna(prop, nullptr, "offset_freq");
RNA_def_property_int_default(prop, 2);
RNA_def_property_range(prop, 1, 99);
RNA_def_property_ui_text(prop, "Offset Frequency", "");
RNA_def_property_ui_text(
prop,
"Offset Frequency",
"How often rows are offset. A value of 2 gives an even/uneven pattern of rows");
RNA_def_property_update(prop, 0, "rna_Node_update");
prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, nullptr, "squash_freq");
RNA_def_property_int_default(prop, 2);
RNA_def_property_range(prop, 1, 99);
RNA_def_property_ui_text(prop, "Squash Frequency", "");
RNA_def_property_ui_text(
prop, "Squash Frequency", "How often rows consist of “squished” bricks");
RNA_def_property_update(prop, 0, "rna_Node_update");
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, nullptr, "offset");
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Offset Amount", "");
RNA_def_property_ui_text(
prop, "Offset Amount", "Determines the brick offset of the various rows");
RNA_def_property_update(prop, 0, "rna_Node_update");
prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, nullptr, "squash");
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_range(prop, 0.0f, 99.0f);
RNA_def_property_ui_text(prop, "Squash Amount", "");
RNA_def_property_ui_text(
prop,
"Squash Amount",
"Factor to adjust the bricks width for particular rows determined by the Offset Frequency");
RNA_def_property_update(prop, 0, "rna_Node_update");
}
@@ -8827,7 +8851,8 @@ static void def_tex_bricks(StructRNA *srna)
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, nullptr, "custom3");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Offset Amount", "");
RNA_def_property_ui_text(
prop, "Offset Amount", "Determines the brick offset of the various rows");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
@@ -8839,7 +8864,11 @@ static void def_tex_bricks(StructRNA *srna)
prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, nullptr, "custom4");
RNA_def_property_range(prop, 0.0f, 99.0f);
RNA_def_property_ui_text(prop, "Squash Amount", "");
RNA_def_property_ui_text(
prop,
"Squash Amount",
"Factor to adjust the bricks width for particular rows determined by the Offset Frequency");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);

View File

@@ -15,7 +15,11 @@ namespace blender::nodes::node_shader_ies_light_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Vector>("Vector").hide_value();
b.add_input<decl::Float>("Strength").default_value(1.0f).min(0.0f).max(1000000.0f);
b.add_input<decl::Float>("Strength")
.default_value(1.0f)
.min(0.0f)
.max(1000000.0f)
.description("Strength of the light source");
b.add_output<decl::Float>("Fac");
}

View File

@@ -22,35 +22,54 @@ static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b)
b.is_function_node();
b.add_input<decl::Vector>("Vector").min(-10000.0f).max(10000.0f).implicit_field(
implicit_field_inputs::position);
b.add_input<decl::Color>("Color1").default_value({0.8f, 0.8f, 0.8f, 1.0f});
b.add_input<decl::Color>("Color2").default_value({0.2f, 0.2f, 0.2f, 1.0f});
b.add_input<decl::Color>("Mortar").default_value({0.0f, 0.0f, 0.0f, 1.0f}).no_muted_links();
b.add_input<decl::Color>("Color1")
.default_value({0.8f, 0.8f, 0.8f, 1.0f})
.description("Color of the first reference brick");
b.add_input<decl::Color>("Color2")
.default_value({0.2f, 0.2f, 0.2f, 1.0f})
.description("Color of the second reference brick");
b.add_input<decl::Color>("Mortar")
.default_value({0.0f, 0.0f, 0.0f, 1.0f})
.no_muted_links()
.description("Color of the area between bricks");
b.add_input<decl::Float>("Scale")
.min(-1000.0f)
.max(1000.0f)
.default_value(5.0f)
.no_muted_links();
.no_muted_links()
.description("Scale of the texture");
b.add_input<decl::Float>("Mortar Size")
.min(0.0f)
.max(0.125f)
.default_value(0.02f)
.no_muted_links();
.no_muted_links()
.description(
"Size of the filling between the bricks (known as “mortar”). "
"0 means no mortar");
b.add_input<decl::Float>("Mortar Smooth")
.min(0.0f)
.max(1.0f)
.default_value(0.1f)
.no_muted_links();
b.add_input<decl::Float>("Bias").min(-1.0f).max(1.0f).no_muted_links();
.no_muted_links()
.description(
"Blurs/softens the edge between the mortar and the bricks. "
"This can be useful with a texture and displacement textures");
b.add_input<decl::Float>("Bias").min(-1.0f).max(1.0f).no_muted_links().description(
"The color variation between Color1 and Color2. "
"Values of -1 and 1 only use one of the two colors. "
"Values in between mix the colors");
b.add_input<decl::Float>("Brick Width")
.min(0.01f)
.max(100.0f)
.default_value(0.5f)
.no_muted_links();
.no_muted_links()
.description("Ratio of bricks width relative to the texture scale");
b.add_input<decl::Float>("Row Height")
.min(0.01f)
.max(100.0f)
.default_value(0.25f)
.no_muted_links();
.no_muted_links()
.description("Ratio of bricks row height relative to the texture scale");
b.add_output<decl::Color>("Color");
b.add_output<decl::Float>("Fac");
}

View File

@@ -16,13 +16,20 @@ static void sh_node_tex_checker_declare(NodeDeclarationBuilder &b)
b.is_function_node();
b.add_input<decl::Vector>("Vector").min(-10000.0f).max(10000.0f).implicit_field(
implicit_field_inputs::position);
b.add_input<decl::Color>("Color1").default_value({0.8f, 0.8f, 0.8f, 1.0f});
b.add_input<decl::Color>("Color2").default_value({0.2f, 0.2f, 0.2f, 1.0f});
b.add_input<decl::Color>("Color1")
.default_value({0.8f, 0.8f, 0.8f, 1.0f})
.description("Color of the first checker");
b.add_input<decl::Color>("Color2")
.default_value({0.2f, 0.2f, 0.2f, 1.0f})
.description("Color of the second checker");
b.add_input<decl::Float>("Scale")
.min(-10000.0f)
.max(10000.0f)
.default_value(5.0f)
.no_muted_links();
.no_muted_links()
.description(
"Overall texture scale.\n"
"The scale is a factor of the bounding box of the face divided by the Scale value");
b.add_output<decl::Color>("Color");
b.add_output<decl::Float>("Fac");
}

View File

@@ -18,8 +18,13 @@ static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_input<decl::Vector>("Vector").implicit_field(implicit_field_inputs::position);
b.add_input<decl::Float>("Scale").min(-1000.0f).max(1000.0f).default_value(5.0f);
b.add_input<decl::Float>("Distortion").min(-1000.0f).max(1000.0f).default_value(1.0f);
b.add_input<decl::Float>("Scale").min(-1000.0f).max(1000.0f).default_value(5.0f).description(
"Scale of the texture");
b.add_input<decl::Float>("Distortion")
.min(-1000.0f)
.max(1000.0f)
.default_value(1.0f)
.description("Amount of distortion");
b.add_output<decl::Color>("Color").no_muted_links();
b.add_output<decl::Float>("Fac").no_muted_links();
}

View File

@@ -23,16 +23,33 @@ static void sh_node_tex_wave_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_input<decl::Vector>("Vector").implicit_field(implicit_field_inputs::position);
b.add_input<decl::Float>("Scale").min(-1000.0f).max(1000.0f).default_value(5.0f);
b.add_input<decl::Float>("Distortion").min(-1000.0f).max(1000.0f).default_value(0.0f);
b.add_input<decl::Float>("Detail").min(0.0f).max(15.0f).default_value(2.0f);
b.add_input<decl::Float>("Detail Scale").min(-1000.0f).max(1000.0f).default_value(1.0f);
b.add_input<decl::Float>("Scale").min(-1000.0f).max(1000.0f).default_value(5.0f).description(
"Overall texture scale");
b.add_input<decl::Float>("Distortion")
.min(-1000.0f)
.max(1000.0f)
.default_value(0.0f)
.description("Amount of distortion of the wave");
b.add_input<decl::Float>("Detail").min(0.0f).max(15.0f).default_value(2.0f).description(
"Amount of distortion noise detail");
b.add_input<decl::Float>("Detail Scale")
.min(-1000.0f)
.max(1000.0f)
.default_value(1.0f)
.description("Scale of distortion noise");
b.add_input<decl::Float>("Detail Roughness")
.min(0.0f)
.max(1.0f)
.default_value(0.5f)
.subtype(PROP_FACTOR);
b.add_input<decl::Float>("Phase Offset").min(-1000.0f).max(1000.0f).default_value(0.0f);
.subtype(PROP_FACTOR)
.description("Blend between a smoother noise pattern, and rougher with sharper peaks");
b.add_input<decl::Float>("Phase Offset")
.min(-1000.0f)
.max(1000.0f)
.default_value(0.0f)
.description(
"Position of the wave along the Bands Direction.\n"
"This can be used as an input for more control over the distortion");
b.add_output<decl::Color>("Color").no_muted_links();
b.add_output<decl::Float>("Fac").no_muted_links();
}

View File

@@ -20,10 +20,14 @@ static void sh_node_tex_white_noise_declare(NodeDeclarationBuilder &b)
b.is_function_node();
b.add_input<decl::Vector>("Vector").min(-10000.0f).max(10000.0f).implicit_field(
implicit_field_inputs::position);
b.add_input<decl::Float>("W").min(-10000.0f).max(10000.0f).make_available([](bNode &node) {
/* Default to 1 instead of 4, because it is faster. */
node.custom1 = 1;
});
b.add_input<decl::Float>("W")
.min(-10000.0f)
.max(10000.0f)
.make_available([](bNode &node) {
/* Default to 1 instead of 4, because it is faster. */
node.custom1 = 1;
})
.description("Value used as seed in 1D and 4D dimensions");
b.add_output<decl::Float>("Value");
b.add_output<decl::Color>("Color");
}