diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/makesrna/intern/rna_palette.c | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/makesrna/intern/rna_palette.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_palette.c | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/source/blender/makesrna/intern/rna_palette.c b/source/blender/makesrna/intern/rna_palette.c index 1f411a8d15d..7b35092dea4 100644 --- a/source/blender/makesrna/intern/rna_palette.c +++ b/source/blender/makesrna/intern/rna_palette.c @@ -31,58 +31,59 @@ #ifdef RNA_RUNTIME -#include "DNA_brush_types.h" +# include "DNA_brush_types.h" -#include "BKE_paint.h" -#include "BKE_report.h" +# include "BKE_paint.h" +# include "BKE_report.h" static PaletteColor *rna_Palette_color_new(Palette *palette) { - PaletteColor *color = BKE_palette_color_add(palette); - return color; + PaletteColor *color = BKE_palette_color_add(palette); + return color; } static void rna_Palette_color_remove(Palette *palette, ReportList *reports, PointerRNA *color_ptr) { - PaletteColor *color = color_ptr->data; + PaletteColor *color = color_ptr->data; - if (BLI_findindex(&palette->colors, color) == -1) { - BKE_reportf(reports, RPT_ERROR, "Palette '%s' does not contain color given", palette->id.name + 2); - return; - } + if (BLI_findindex(&palette->colors, color) == -1) { + BKE_reportf( + reports, RPT_ERROR, "Palette '%s' does not contain color given", palette->id.name + 2); + return; + } - BKE_palette_color_remove(palette, color); + BKE_palette_color_remove(palette, color); - RNA_POINTER_INVALIDATE(color_ptr); + RNA_POINTER_INVALIDATE(color_ptr); } static void rna_Palette_color_clear(Palette *palette) { - BKE_palette_clear(palette); + BKE_palette_clear(palette); } static PointerRNA rna_Palette_active_color_get(PointerRNA *ptr) { - Palette *palette = ptr->data; - PaletteColor *color; + Palette *palette = ptr->data; + PaletteColor *color; - color = BLI_findlink(&palette->colors, palette->active_color); + color = BLI_findlink(&palette->colors, palette->active_color); - if (color) - return rna_pointer_inherit_refine(ptr, &RNA_PaletteColor, color); + if (color) + return rna_pointer_inherit_refine(ptr, &RNA_PaletteColor, color); - return rna_pointer_inherit_refine(ptr, NULL, NULL); + return rna_pointer_inherit_refine(ptr, NULL, NULL); } static void rna_Palette_active_color_set(PointerRNA *ptr, PointerRNA value) { - Palette *palette = ptr->data; - PaletteColor *color = value.data; - - /* -1 is ok for an unset index */ - if (color == NULL) - palette->active_color = -1; - else - palette->active_color = BLI_findindex(&palette->colors, color); + Palette *palette = ptr->data; + PaletteColor *color = value.data; + + /* -1 is ok for an unset index */ + if (color == NULL) + palette->active_color = -1; + else + palette->active_color = BLI_findindex(&palette->colors, color); } #else @@ -90,90 +91,89 @@ static void rna_Palette_active_color_set(PointerRNA *ptr, PointerRNA value) /* palette.colors */ static void rna_def_palettecolors(BlenderRNA *brna, PropertyRNA *cprop) { - StructRNA *srna; - PropertyRNA *prop; - - FunctionRNA *func; - PropertyRNA *parm; - - RNA_def_property_srna(cprop, "PaletteColors"); - srna = RNA_def_struct(brna, "PaletteColors", NULL); - RNA_def_struct_sdna(srna, "Palette"); - RNA_def_struct_ui_text(srna, "Palette Splines", "Collection of palette colors"); - - func = RNA_def_function(srna, "new", "rna_Palette_color_new"); - RNA_def_function_ui_description(func, "Add a new color to the palette"); - parm = RNA_def_pointer(func, "color", "PaletteColor", "", "The newly created color"); - RNA_def_function_return(func, parm); - - func = RNA_def_function(srna, "remove", "rna_Palette_color_remove"); - RNA_def_function_ui_description(func, "Remove a color from the palette"); - RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm = RNA_def_pointer(func, "color", "PaletteColor", "", "The color to remove"); - RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); - RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); - - func = RNA_def_function(srna, "clear", "rna_Palette_color_clear"); - RNA_def_function_ui_description(func, "Remove all colors from the palette"); - - prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "PaletteColor"); - RNA_def_property_pointer_funcs(prop, "rna_Palette_active_color_get", "rna_Palette_active_color_set", NULL, NULL); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Active Palette Color", ""); + StructRNA *srna; + PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "PaletteColors"); + srna = RNA_def_struct(brna, "PaletteColors", NULL); + RNA_def_struct_sdna(srna, "Palette"); + RNA_def_struct_ui_text(srna, "Palette Splines", "Collection of palette colors"); + + func = RNA_def_function(srna, "new", "rna_Palette_color_new"); + RNA_def_function_ui_description(func, "Add a new color to the palette"); + parm = RNA_def_pointer(func, "color", "PaletteColor", "", "The newly created color"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "remove", "rna_Palette_color_remove"); + RNA_def_function_ui_description(func, "Remove a color from the palette"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "color", "PaletteColor", "", "The color to remove"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); + + func = RNA_def_function(srna, "clear", "rna_Palette_color_clear"); + RNA_def_function_ui_description(func, "Remove all colors from the palette"); + + prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "PaletteColor"); + RNA_def_property_pointer_funcs( + prop, "rna_Palette_active_color_get", "rna_Palette_active_color_set", NULL, NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Active Palette Color", ""); } static void rna_def_palettecolor(BlenderRNA *brna) { - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "PaletteColor", NULL); - RNA_def_struct_ui_text(srna, "Palette Color", ""); - - prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_float_sdna(prop, NULL, "rgb"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Color", ""); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - - prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_float_sdna(prop, NULL, "value"); - RNA_def_property_ui_text(prop, "Value", ""); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - - prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_float_sdna(prop, NULL, "value"); - RNA_def_property_ui_text(prop, "Weight", ""); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "PaletteColor", NULL); + RNA_def_struct_ui_text(srna, "Palette Color", ""); + + prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_float_sdna(prop, NULL, "rgb"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Color", ""); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_float_sdna(prop, NULL, "value"); + RNA_def_property_ui_text(prop, "Value", ""); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_float_sdna(prop, NULL, "value"); + RNA_def_property_ui_text(prop, "Weight", ""); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); } static void rna_def_palette(BlenderRNA *brna) { - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "Palette", "ID"); - RNA_def_struct_ui_text(srna, "Palette", ""); - RNA_def_struct_ui_icon(srna, ICON_COLOR); + StructRNA *srna; + PropertyRNA *prop; - prop = RNA_def_property(srna, "colors", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_type(prop, "PaletteColor"); - rna_def_palettecolors(brna, prop); + srna = RNA_def_struct(brna, "Palette", "ID"); + RNA_def_struct_ui_text(srna, "Palette", ""); + RNA_def_struct_ui_icon(srna, ICON_COLOR); + prop = RNA_def_property(srna, "colors", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "PaletteColor"); + rna_def_palettecolors(brna, prop); } void RNA_def_palette(BlenderRNA *brna) { - /* *** Non-Animated *** */ - RNA_define_animate_sdna(false); - rna_def_palettecolor(brna); - rna_def_palette(brna); - RNA_define_animate_sdna(true); + /* *** Non-Animated *** */ + RNA_define_animate_sdna(false); + rna_def_palettecolor(brna); + rna_def_palette(brna); + RNA_define_animate_sdna(true); } #endif |