diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-09 15:42:01 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-09 15:43:01 +0300 |
commit | 2ca8230f67db3d6c4693d0a2e0997dfd5de43091 (patch) | |
tree | d8d7e5c7a15a68f7b27fde0dc7939cbfcf71cf4a /source/blender/makesrna/intern/rna_color.c | |
parent | 09ce794dc8c6cf5e406532651576e6b86dfd9232 (diff) | |
parent | fb565ddb681f39cbe47e91d11e5b728bb4314a7b (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/makesrna/intern/rna_color.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_color.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 8e090937605..67fb58b6208 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -75,7 +75,7 @@ static int rna_CurveMapping_curves_length(PointerRNA *ptr) for (len = 0; len < CM_TOT; len++) if (!cumap->cm[len].curve) break; - + return len; } @@ -154,11 +154,11 @@ static void rna_CurveMapping_clipmaxy_range(PointerRNA *ptr, float *min, float * static char *rna_ColorRamp_path(PointerRNA *ptr) { char *path = NULL; - + /* handle the cases where a single data-block may have 2 ramp types */ if (ptr->id.data) { ID *id = ptr->id.data; - + switch (GS(id->name)) { case ID_NT: { @@ -166,7 +166,7 @@ static char *rna_ColorRamp_path(PointerRNA *ptr) bNode *node; PointerRNA node_ptr; char *node_path; - + for (node = ntree->nodes.first; node; node = node->next) { if (ELEM(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) { if (node->storage == ptr->data) { @@ -182,14 +182,14 @@ static char *rna_ColorRamp_path(PointerRNA *ptr) } break; } - + case ID_LS: { /* may be NULL */ path = BKE_linestyle_path_to_color_ramp((FreestyleLineStyle *)id, (ColorBand *)ptr->data); break; } - + default: /* everything else just uses 'color_ramp' */ path = BLI_strdup("color_ramp"); @@ -200,7 +200,7 @@ static char *rna_ColorRamp_path(PointerRNA *ptr) /* everything else just uses 'color_ramp' */ path = BLI_strdup("color_ramp"); } - + return path; } @@ -210,7 +210,7 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) PropertyRNA *prop; char *path = NULL; int index; - + /* helper macro for use here to try and get the path * - this calls the standard code for getting a path to a texture... */ @@ -232,13 +232,13 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) /* FIXME: this is a very slow way to do it, but it will have to suffice... */ if (ptr->id.data) { ID *id = ptr->id.data; - + switch (GS(id->name)) { case ID_NT: { bNodeTree *ntree = (bNodeTree *)id; bNode *node; - + for (node = ntree->nodes.first; node; node = node->next) { if (ELEM(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) { RNA_pointer_create(id, &RNA_ColorRamp, node->storage, &ramp_ptr); @@ -272,10 +272,10 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) } } } - + /* cleanup the macro we defined */ #undef COLRAMP_GETPATH - + return path; } @@ -283,12 +283,12 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * { if (ptr->id.data) { ID *id = ptr->id.data; - + switch (GS(id->name)) { case ID_MA: { Material *ma = ptr->id.data; - + DEG_id_tag_update(&ma->id, 0); WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma); break; @@ -323,7 +323,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * case ID_PA: { ParticleSettings *part = ptr->id.data; - + DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO); WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, part); } @@ -761,7 +761,7 @@ static void rna_def_curvemapping(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "CurveMapping", "Curve mapping to map color, vector and scalar values to other values using " "a user defined curve"); - + prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_DO_CLIP); RNA_def_property_ui_text(prop, "Clip", "Force the curve view to fit a defined boundary"); @@ -828,7 +828,7 @@ static void rna_def_color_ramp_element(BlenderRNA *brna) RNA_def_struct_sdna(srna, "CBData"); RNA_def_struct_path_func(srna, "rna_ColorRampElement_path"); RNA_def_struct_ui_text(srna, "Color Ramp Element", "Element defining a color at a position in the color ramp"); - + prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "r"); RNA_def_property_array(prop, 4); @@ -893,7 +893,7 @@ static void rna_def_color_ramp(BlenderRNA *brna) {COLBAND_INTERP_CONSTANT, "CONSTANT", 0, "Constant", ""}, {0, NULL, 0, NULL, NULL} }; - + static const EnumPropertyItem prop_mode_items[] = { {COLBAND_BLEND_RGB, "RGB", 0, "RGB", ""}, {COLBAND_BLEND_HSV, "HSV", 0, "HSV", ""}, @@ -913,7 +913,7 @@ static void rna_def_color_ramp(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ColorBand"); RNA_def_struct_path_func(srna, "rna_ColorRamp_path"); RNA_def_struct_ui_text(srna, "Color Ramp", "Color ramp mapping a scalar value to a color"); - + prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_COLOR); RNA_def_property_collection_sdna(prop, NULL, "data", "tot"); RNA_def_property_struct_type(prop, "ColorRampElement"); @@ -948,7 +948,7 @@ static void rna_def_color_ramp(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Total", "Total number of elements"); RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); #endif - + func = RNA_def_function(srna, "evaluate", "rna_ColorRamp_eval"); RNA_def_function_ui_description(func, "Evaluate ColorRamp"); parm = RNA_def_float(func, "position", 1.0f, 0.0f, 1.0f, "Position", "Evaluate ColorRamp at position", 0.0f, 1.0f); @@ -964,7 +964,7 @@ static void rna_def_histogram(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - + static const EnumPropertyItem prop_mode_items[] = { {HISTO_MODE_LUMA, "LUMA", 0, "Luma", "Luma"}, {HISTO_MODE_RGB, "RGB", 0, "RGB", "Red Green Blue"}, @@ -977,7 +977,7 @@ static void rna_def_histogram(BlenderRNA *brna) srna = RNA_def_struct(brna, "Histogram", NULL); RNA_def_struct_ui_text(srna, "Histogram", "Statistical view of the levels of color in an image"); - + prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mode"); RNA_def_property_enum_items(prop, prop_mode_items); @@ -1006,12 +1006,12 @@ static void rna_def_scopes(BlenderRNA *brna) srna = RNA_def_struct(brna, "Scopes", NULL); RNA_def_struct_ui_text(srna, "Scopes", "Scopes for statistical view of an image"); - + prop = RNA_def_property(srna, "use_full_resolution", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, "Scopes", "sample_full", 1); RNA_def_property_ui_text(prop, "Full Sample", "Sample every pixel of the image"); RNA_def_property_update(prop, 0, "rna_Scopes_update"); - + prop = RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, "Scopes", "accuracy"); RNA_def_property_range(prop, 0.0, 100.0); |