diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-04-19 10:45:52 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-04-19 10:45:52 +0300 |
commit | 16fac020e07d7ad0caa5901c0740c88e9772194f (patch) | |
tree | 505cf49b33f2ce6d8edae69b7355ca1ea092aca9 /source/blender/makesrna | |
parent | 1f5d51e44ecf99f34d8e733559a9312e5ae3ef33 (diff) |
Workbench: Option to use Object color
- added `object_color_type` where the user can set if the collection
determines the color, or the object will be used for the color.
Implemented it as an enum as later this can have a random color option.
- moved OB_LIGHTING_* to DNA_view3d_types and renamed it.
- Fixed some DRY in workbench_materials.c. Can remove more DRY's but
will need to discuss the responsibility of the workbench engine as it
might become part of the eevee renderer.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 25 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 12 |
2 files changed, 28 insertions, 9 deletions
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index dce85f0e91c..245f368ce30 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -26,6 +26,7 @@ #include "DNA_scene_types.h" #include "DNA_layer_types.h" +#include "DNA_view3d_types.h" #include "BLI_math.h" #include "BLI_string_utils.h" @@ -312,6 +313,9 @@ static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr, #define RNA_LAYER_ENGINE_WORKBENCH_GET_SET_FLOAT_ARRAY(_NAME_, _LEN_) \ RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Workbench, COLLECTION_MODE_NONE, _NAME_, _LEN_) +#define RNA_LAYER_ENGINE_WORKBENCH_GET_SET_INT(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(int, Workbench, COLLECTION_MODE_NONE, _NAME_) + /* mode engines */ #define RNA_LAYER_MODE_OBJECT_GET_SET_FLOAT(_NAME_) \ @@ -359,6 +363,7 @@ RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(hair_brightness_randomness) /* workbench engine */ /* LayerCollection settings. */ RNA_LAYER_ENGINE_WORKBENCH_GET_SET_FLOAT_ARRAY(object_color, 3) +RNA_LAYER_ENGINE_WORKBENCH_GET_SET_INT(object_color_type) /* eevee engine */ /* ViewLayer settings. */ @@ -1662,21 +1667,35 @@ static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna) } #endif /* WITH_CLAY_ENGINE */ +/* Workbench engine */ static void rna_def_layer_collection_engine_settings_workbench(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - + + static const EnumPropertyItem object_color_type_items[] = { + {V3D_OBJECT_COLOR_COLLECTION, "COLLECTION", 0, "Collection", ""}, + {V3D_OBJECT_COLOR_OBJECT, "OBJECT", 0, "Object", ""}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "LayerCollectionEngineSettingsWorkbench", "LayerCollectionSettings"); - RNA_def_struct_ui_text(srna, "Collections Workbench Engine Settings", "Engine specific settings for this collection"); + RNA_def_struct_ui_text(srna, "Collections Workbench Engine Settings", "Workbench specific settings for this collection"); RNA_define_verify_sdna(0); /* not in sdna */ + prop = RNA_def_property(srna, "object_color_type", PROP_ENUM, PROP_COLOR); + RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Workbench_object_color_type_get", "rna_LayerEngineSettings_Workbench_object_color_type_set", NULL); + RNA_def_property_enum_items(prop, object_color_type_items); + RNA_def_property_ui_text(prop, "Object Color", "Way colors are given to the Object"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); + prop = RNA_def_property(srna, "object_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Workbench_object_color_get", "rna_LayerEngineSettings_Workbench_object_color_set", NULL); - RNA_def_property_ui_text(prop, "Object Color", "Color for Drawing Objects"); + RNA_def_property_ui_text(prop, "Collection Color", "Color for Drawing Objects in this Collection"); RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 47ae2cb8951..80d23e14949 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -183,15 +183,15 @@ const EnumPropertyItem rna_enum_viewport_shade_items[] = { }; const EnumPropertyItem rna_enum_viewport_shade_solid_items[] = { - {OB_LIGHTING_FLAT, "FLAT", ICON_SOLID, "Flat Lighting", "Display using flat lighting"}, - {OB_LIGHTING_STUDIO, "STUDIO", ICON_SOLID, "Studio Lighting", "Display using studio lighting"}, - // {OB_LIGHTING_SCENE, "SCENE", ICON_SOLID, "Scene Lighting", "Display using scene lighting"}, + {V3D_LIGHTING_FLAT, "FLAT", ICON_SOLID, "Flat Lighting", "Display using flat lighting"}, + {V3D_LIGHTING_STUDIO, "STUDIO", ICON_SOLID, "Studio Lighting", "Display using studio lighting"}, + /* {V3D_LIGHTING_SCENE, "SCENE", ICON_SOLID, "Scene Lighting", "Display using scene lighting"}, */ {0, NULL, 0, NULL, NULL} }; const EnumPropertyItem rna_enum_viewport_shade_texture_items[] = { - {OB_LIGHTING_FLAT, "FLAT", ICON_POTATO, "Flat Lighting", "Display using flat lighting"}, - {OB_LIGHTING_STUDIO, "STUDIO", ICON_POTATO, "Studio Lighting", "Display using studio lighting"}, - // {OB_LIGHTING_SCENE, "SCENE", ICON_POTATO, "Scene Lighting", "Display using scene lighting"}, + {V3D_LIGHTING_FLAT, "FLAT", ICON_POTATO, "Flat Lighting", "Display using flat lighting"}, + {V3D_LIGHTING_STUDIO, "STUDIO", ICON_POTATO, "Studio Lighting", "Display using studio lighting"}, + /* {V3D_LIGHTING_SCENE, "SCENE", ICON_POTATO, "Scene Lighting", "Display using scene lighting"}, */ {0, NULL, 0, NULL, NULL} }; |