Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c146
1 files changed, 93 insertions, 53 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 55693f8e53f..30889bb25f6 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -70,43 +70,43 @@ EnumPropertyItem node_socket_type_items[] = {
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem node_math_items[] = {
-{ 0, "ADD", 0, "Add", ""},
-{ 1, "SUBTRACT", 0, "Subtract", ""},
-{ 2, "MULTIPLY", 0, "Multiply", ""},
-{ 3, "DIVIDE", 0, "Divide", ""},
-{ 4, "SINE", 0, "Sine", ""},
-{ 5, "COSINE", 0, "Cosine", ""},
-{ 6, "TANGENT", 0, "Tangent", ""},
-{ 7, "ARCSINE", 0, "Arcsine", ""},
-{ 8, "ARCCOSINE", 0, "Arccosine", ""},
-{ 9, "ARCTANGENT", 0, "Arctangent", ""},
-{10, "POWER", 0, "Power", ""},
-{11, "LOGARITHM", 0, "Logarithm", ""},
-{12, "MINIMUM", 0, "Minimum", ""},
-{13, "MAXIMUM", 0, "Maximum", ""},
-{14, "ROUND", 0, "Round", ""},
-{15, "LESS_THAN", 0, "Less Than", ""},
-{16, "GREATER_THAN", 0, "Greater Than", ""},
-{0, NULL, 0, NULL, NULL}};
+ { 0, "ADD", 0, "Add", ""},
+ { 1, "SUBTRACT", 0, "Subtract", ""},
+ { 2, "MULTIPLY", 0, "Multiply", ""},
+ { 3, "DIVIDE", 0, "Divide", ""},
+ { 4, "SINE", 0, "Sine", ""},
+ { 5, "COSINE", 0, "Cosine", ""},
+ { 6, "TANGENT", 0, "Tangent", ""},
+ { 7, "ARCSINE", 0, "Arcsine", ""},
+ { 8, "ARCCOSINE", 0, "Arccosine", ""},
+ { 9, "ARCTANGENT", 0, "Arctangent", ""},
+ {10, "POWER", 0, "Power", ""},
+ {11, "LOGARITHM", 0, "Logarithm", ""},
+ {12, "MINIMUM", 0, "Minimum", ""},
+ {13, "MAXIMUM", 0, "Maximum", ""},
+ {14, "ROUND", 0, "Round", ""},
+ {15, "LESS_THAN", 0, "Less Than", ""},
+ {16, "GREATER_THAN", 0, "Greater Than", ""},
+ {0, NULL, 0, NULL, NULL}};
EnumPropertyItem node_vec_math_items[] = {
-{0, "ADD", 0, "Add", ""},
-{1, "SUBTRACT", 0, "Subtract", ""},
-{2, "AVERAGE", 0, "Average", ""},
-{3, "DOT_PRODUCT", 0, "Dot Product", ""},
-{4, "CROSS_PRODUCT", 0, "Cross Product", ""},
-{5, "NORMALIZE", 0, "Normalize", ""},
-{0, NULL, 0, NULL, NULL}};
+ {0, "ADD", 0, "Add", ""},
+ {1, "SUBTRACT", 0, "Subtract", ""},
+ {2, "AVERAGE", 0, "Average", ""},
+ {3, "DOT_PRODUCT", 0, "Dot Product", ""},
+ {4, "CROSS_PRODUCT", 0, "Cross Product", ""},
+ {5, "NORMALIZE", 0, "Normalize", ""},
+ {0, NULL, 0, NULL, NULL}};
EnumPropertyItem node_filter_items[] = {
-{0, "SOFTEN", 0, "Soften", ""},
-{1, "SHARPEN", 0, "Sharpen", ""},
-{2, "LAPLACE", 0, "Laplace", ""},
-{3, "SOBEL", 0, "Sobel", ""},
-{4, "PREWITT", 0, "Prewitt", ""},
-{5, "KIRSCH", 0, "Kirsch", ""},
-{6, "SHADOW", 0, "Shadow", ""},
-{0, NULL, 0, NULL, NULL}};
+ {0, "SOFTEN", 0, "Soften", ""},
+ {1, "SHARPEN", 0, "Sharpen", ""},
+ {2, "LAPLACE", 0, "Laplace", ""},
+ {3, "SOBEL", 0, "Sobel", ""},
+ {4, "PREWITT", 0, "Prewitt", ""},
+ {5, "KIRSCH", 0, "Kirsch", ""},
+ {6, "SHADOW", 0, "Shadow", ""},
+ {0, NULL, 0, NULL, NULL}};
EnumPropertyItem prop_noise_basis_items[] = {
{SHD_NOISE_PERLIN, "PERLIN", 0, "Perlin", ""},
@@ -124,11 +124,13 @@ EnumPropertyItem prop_noise_type_items[] = {
{SHD_NOISE_HARD, "HARD", 0, "Hard", ""},
{0, NULL, 0, NULL, NULL}};
+#if 0
EnumPropertyItem prop_wave_items[] = {
{SHD_WAVE_SINE, "SINE", 0, "Sine", "Uses a sine wave to produce bands"},
{SHD_WAVE_SAW, "SAW", 0, "Saw", "Uses a saw wave to produce bands"},
{SHD_WAVE_TRI, "TRI", 0, "Tri", "Uses a triangle wave to produce bands"},
{0, NULL, 0, NULL, NULL}};
+#endif
/* Add any new socket value subtype here.
* When adding a new subtype here, make sure you also add it
@@ -755,6 +757,13 @@ static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *rep
return NULL;
}
+static void rna_Mapping_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ bNode *node = ptr->data;
+ init_tex_mapping(node->storage);
+ rna_Node_update(bmain, scene, ptr);
+}
+
#else
static EnumPropertyItem prop_image_layer_items[] = {
@@ -1095,12 +1104,43 @@ static void def_sh_material(StructRNA *srna)
static void def_sh_mapping(StructRNA *srna)
{
PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
- prop= RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "storage");
- RNA_def_property_struct_type(prop, "TexMapping");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Mapping", "Texture coordinate mapping settings");
+ prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); /* Not PROP_XYZ, this is now in radians, no more degrees */
+ RNA_def_property_float_sdna(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Rotation", "");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_ui_text(prop, "Scale", "");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "min");
+ RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "max");
+ RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop= RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
+ RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop= RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
+ RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
}
static void def_sh_geometry(StructRNA *srna)
@@ -1928,17 +1968,17 @@ static void def_cmp_chroma_matte(StructRNA *srna)
RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
- prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "t1");
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
- RNA_def_property_range(prop, 1.0f, 80.0f);
+ RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(80.0f));
RNA_def_property_ui_text(prop, "Acceptance", "Tolerance for a color to be considered a keying color");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "t2");
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
- RNA_def_property_range(prop, 0.0f, 30.0f);
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(30.0f));
RNA_def_property_ui_text(prop, "Cutoff", "Tolerance below which colors will be considered as exact matches");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
@@ -2103,9 +2143,9 @@ static void def_cmp_defocus(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
/* TODO: angle in degrees */
- prop = RNA_def_property(srna, "angle", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "rotation");
- RNA_def_property_range(prop, 0, 90);
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "rotation");
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(90.0f));
RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset in degrees");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
@@ -2271,15 +2311,15 @@ static void def_cmp_dblur(StructRNA *srna)
RNA_def_property_ui_text(prop, "Distance", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "angle");
- RNA_def_property_range(prop, 0.0f, 360.0f);
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(360.0f));
RNA_def_property_ui_text(prop, "Angle", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "spin");
- RNA_def_property_range(prop, -360.0f, 360.0f);
+ RNA_def_property_range(prop, DEG2RADF(-360.0f), DEG2RADF(360.0f));
RNA_def_property_ui_text(prop, "Spin", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
@@ -2393,10 +2433,10 @@ static void def_cmp_glare(StructRNA *srna)
RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "angle_offset", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "angle_ofs");
- RNA_def_property_range(prop, 0, 180);
- RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset in degrees");
+ prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle_ofs");
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE);