diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_color.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_color.c | 62 |
1 files changed, 28 insertions, 34 deletions
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index aa1164068d8..f91be9ae1e9 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -54,13 +54,14 @@ #include "BKE_colorband.h" #include "BKE_colortools.h" -#include "BKE_depsgraph.h" #include "BKE_image.h" #include "BKE_movieclip.h" #include "BKE_node.h" #include "BKE_sequencer.h" #include "BKE_linestyle.h" +#include "DEG_depsgraph.h" + #include "ED_node.h" #include "IMB_colormanagement.h" @@ -113,6 +114,12 @@ static void rna_CurveMapping_white_level_set(PointerRNA *ptr, const float *value curvemapping_set_black_white(cumap, NULL, NULL); } +static void rna_CurveMapping_tone_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ + WM_main_add_notifier(NC_NODE | NA_EDITED, NULL); + WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); +} + static void rna_CurveMapping_clipminx_range(PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax)) { @@ -159,17 +166,6 @@ static char *rna_ColorRamp_path(PointerRNA *ptr) ID *id = ptr->id.data; switch (GS(id->name)) { - case ID_MA: /* material has 2 cases - diffuse and specular */ - { - Material *ma = (Material *)id; - - if (ptr->data == ma->ramp_col) - path = BLI_strdup("diffuse_ramp"); - else if (ptr->data == ma->ramp_spec) - path = BLI_strdup("specular_ramp"); - break; - } - case ID_NT: { bNodeTree *ntree = (bNodeTree *)id; @@ -244,22 +240,6 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) ID *id = ptr->id.data; switch (GS(id->name)) { - case ID_MA: /* 2 cases for material - diffuse and spec */ - { - Material *ma = (Material *)id; - - /* try diffuse first */ - if (ma->ramp_col) { - RNA_pointer_create(id, &RNA_ColorRamp, ma->ramp_col, &ramp_ptr); - COLRAMP_GETPATH; - } - /* try specular if not diffuse */ - if (!path && ma->ramp_spec) { - RNA_pointer_create(id, &RNA_ColorRamp, ma->ramp_spec, &ramp_ptr); - COLRAMP_GETPATH; - } - break; - } case ID_NT: { bNodeTree *ntree = (bNodeTree *)id; @@ -315,7 +295,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * { Material *ma = ptr->id.data; - DAG_id_tag_update(&ma->id, 0); + DEG_id_tag_update(&ma->id, 0); WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma); break; } @@ -335,7 +315,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * { Tex *tex = ptr->id.data; - DAG_id_tag_update(&tex->id, 0); + DEG_id_tag_update(&tex->id, 0); WM_main_add_notifier(NC_TEXTURE, tex); break; } @@ -350,7 +330,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * { ParticleSettings *part = ptr->id.data; - DAG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO); + DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO); WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, part); } default: @@ -446,7 +426,7 @@ static void rna_ColorManagedDisplaySettings_display_device_update(Main *UNUSED(b IMB_colormanagement_validate_settings(&scene->display_settings, &scene->view_settings); - DAG_id_tag_update(id, 0); + DEG_id_tag_update(id, 0); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); } } @@ -581,7 +561,7 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain, Scene if (GS(id->name) == ID_IM) { Image *ima = (Image *) id; - DAG_id_tag_update(&ima->id, 0); + DEG_id_tag_update(&ima->id, 0); BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_COLORMANAGE); @@ -664,7 +644,7 @@ static void rna_ColorManagement_update(Main *UNUSED(bmain), Scene *UNUSED(scene) return; if (GS(id->name) == ID_SCE) { - DAG_id_tag_update(id, 0); + DEG_id_tag_update(id, 0); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); } } @@ -783,11 +763,25 @@ static void rna_def_curvemapping(BlenderRNA *brna) PropertyRNA *prop; FunctionRNA *func; + static const EnumPropertyItem tone_items[] = { + {CURVE_TONE_STANDARD, "STANDARD", 0, "Standard", ""}, + {CURVE_TONE_WEIGHTED_STANDARD, "WEIGHTED", 0, "Weighted Standard", ""}, + {CURVE_TONE_FILMLIKE, "FILMLIKE", 0, "Film like", ""}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "CurveMapping", NULL); 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, "tone", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "tone"); + RNA_def_property_enum_items(prop, tone_items); + RNA_def_property_ui_text(prop, "Tone", "Tone of the curve"); + RNA_def_property_update(prop, 0, "rna_CurveMapping_tone_update"); + + 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"); |