Commit: 410810d42f92f6726f859601d2517df1ee7e6f75
Author: Jeroen Bakker
Date:   Mon Apr 16 15:01:31 2018 +0200
Branches: blender2.8-workbench
https://developer.blender.org/rB410810d42f92f6726f859601d2517df1ee7e6f75

Workbench: Added Object Color to collection_properties

===================================================================

M       release/scripts/addons
M       release/scripts/addons_contrib
M       release/scripts/startup/bl_ui/properties_collection.py
M       release/scripts/startup/bl_ui/properties_render.py
M       source/blender/blenkernel/intern/scene.c
M       source/blender/draw/engines/workbench/workbench_engine.c
M       source/blender/draw/engines/workbench/workbench_materials.c
M       source/blender/makesdna/DNA_scene_types.h
M       source/blender/makesrna/intern/rna_layer.c

===================================================================

diff --git a/release/scripts/addons b/release/scripts/addons
index c88411ff777..8f2fd7e23f0 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit c88411ff7776a2db5d6ef6117a1b2faa42a95611
+Subproject commit 8f2fd7e23f0b5ce023440182f51c40e88d663325
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 310578043de..34a27a42d78 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 310578043dec1aae382eb6a447ae1d103792d7e6
+Subproject commit 34a27a42d781d80f9f1833bad8cc5b2abcac2933
diff --git a/release/scripts/startup/bl_ui/properties_collection.py 
b/release/scripts/startup/bl_ui/properties_collection.py
index e48df3a0a61..cced6262be5 100644
--- a/release/scripts/startup/bl_ui/properties_collection.py
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -86,6 +86,24 @@ class COLLECTION_PT_clay_settings(CollectionButtonsPanel, 
Panel):
         col.template_override_property(collection_props, scene_props, 
"hair_brightness_randomness")
 
 
+class COLLECTION_PT_workbench_settings(CollectionButtonsPanel, Panel):
+    bl_label = "Render Settings"
+    COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
+
+    @classmethod
+    def poll(cls, context):
+        return context.view_render.engine in cls.COMPAT_ENGINES
+
+    def draw(self, context):
+        layout = self.layout
+        scene_props = context.scene.collection_properties['BLENDER_WORKBENCH']
+        collection = get_collection_from_context(context)
+        collection_props = collection.engine_overrides['BLENDER_WORKBENCH']
+
+        col = layout.column()
+        col.template_override_property(collection_props, scene_props, 
"object_color")
+
+
 class COLLECTION_PT_object_mode_settings(CollectionButtonsPanel, Panel):
     bl_label = "Object Mode Settings"
 
@@ -170,6 +188,7 @@ class 
COLLECTION_PT_paint_vertex_mode_settings(CollectionButtonsPanel, Panel):
 classes = (
     COLLECTION_PT_context_collection,
     COLLECTION_PT_clay_settings,
+    COLLECTION_PT_workbench_settings,
     COLLECTION_PT_object_mode_settings,
     COLLECTION_PT_edit_mode_settings,
     COLLECTION_PT_paint_weight_mode_settings,
diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index 15b175617d6..78b9f007bc0 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -912,6 +912,18 @@ class RENDER_PT_eevee_film(RenderButtonsPanel, Panel):
         col.prop(rd, "alpha_mode", text="Alpha")
 
 
+class RENDER_PT_workbench_collection_settings(RenderButtonsPanel, Panel):
+    bl_label = "Workbench Collection Settings"
+    COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
+
+    def draw(self, context):
+        layout = self.layout
+        props = context.scene.collection_properties['BLENDER_WORKBENCH']
+
+        col = layout.column()
+        col.prop(props, "object_color")
+
+
 classes = (
     RENDER_MT_presets,
     RENDER_MT_ffmpeg_presets,
@@ -941,6 +953,7 @@ classes = (
     RENDER_PT_eevee_motion_blur,
     RENDER_PT_eevee_depth_of_field,
     RENDER_PT_eevee_bloom,
+    RENDER_PT_workbench_collection_settings,
 )
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 9a7c10d31de..628d9584f0e 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -115,6 +115,7 @@ const char *RE_engine_id_BLENDER_RENDER = "BLENDER_RENDER";
 const char *RE_engine_id_BLENDER_GAME = "BLENDER_GAME";
 const char *RE_engine_id_BLENDER_CLAY = "BLENDER_CLAY";
 const char *RE_engine_id_BLENDER_EEVEE = "BLENDER_EEVEE";
+const char *RE_engine_id_BLENDER_WORKBENCH = "BLENDER_WORKBENCH";
 const char *RE_engine_id_CYCLES = "CYCLES";
 
 void free_avicodecdata(AviCodecData *acd)
diff --git a/source/blender/draw/engines/workbench/workbench_engine.c 
b/source/blender/draw/engines/workbench/workbench_engine.c
index bcaed908ec6..45073466606 100644
--- a/source/blender/draw/engines/workbench/workbench_engine.c
+++ b/source/blender/draw/engines/workbench/workbench_engine.c
@@ -73,6 +73,16 @@ static void workbench_engine_free(void)
        workbench_materials_free();
 }
 
+static void workbench_layer_collection_settings_create(RenderEngine 
*UNUSED(engine), IDProperty *props)
+{
+       BLI_assert(props &&
+                  props->type == IDP_GROUP &&
+                  props->subtype == IDP_GROUP_SUB_ENGINE_RENDER);
+       float default_object_color[3] = {1.0, 1.0, 1.0};
+       BKE_collection_engine_property_add_float_array(props, "object_color", 
default_object_color, 3);
+}
+
+
 static const DrawEngineDataSize workbench_data_size = 
DRW_VIEWPORT_DATA_SIZE(WORKBENCH_Data);
 
 DrawEngineType draw_engine_workbench_type = {
@@ -96,7 +106,7 @@ DrawEngineType draw_engine_workbench_type = {
 RenderEngineType DRW_engine_viewport_workbench_type = {
        NULL, NULL,
        WORKBENCH_ENGINE, N_("Workbench"), RE_INTERNAL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
&workbench_layer_collection_settings_create, NULL,
        &draw_engine_workbench_type,
        {NULL, NULL, NULL}
 };
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c 
b/source/blender/draw/engines/workbench/workbench_materials.c
index 3a6d199cecf..b499a203f18 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -77,6 +77,9 @@ void workbench_materials_cache_populate(WORKBENCH_Data* 
vedata, Object *ob)
 {
        WORKBENCH_PassList *psl = vedata->psl;
        WORKBENCH_StorageList *stl = vedata->stl;
+       
+       IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, 
COLLECTION_MODE_NONE, RE_engine_id_BLENDER_WORKBENCH);
+       const float* color = 
BKE_collection_engine_property_value_get_float_array(props, "object_color");
 
        if (!DRW_object_is_renderable(ob))
                return;
@@ -89,7 +92,7 @@ void workbench_materials_cache_populate(WORKBENCH_Data* 
vedata, Object *ob)
                
                /* Silhouette */
                grp = DRW_shgroup_create(e_data.silhouette_sh, 
psl->silhouette_pass);
-               DRW_shgroup_uniform_vec3(grp, "color", ob->col, 1);
+               DRW_shgroup_uniform_vec3(grp, "color", color, 1);
                DRW_shgroup_call_add(grp, geom, ob->obmat);
        }
 }
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index 696918d97a5..3b7875ea5b1 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1913,6 +1913,7 @@ extern const char *RE_engine_id_BLENDER_RENDER;
 extern const char *RE_engine_id_BLENDER_GAME;
 extern const char *RE_engine_id_BLENDER_CLAY;
 extern const char *RE_engine_id_BLENDER_EEVEE;
+extern const char *RE_engine_id_BLENDER_WORKBENCH;
 extern const char *RE_engine_id_CYCLES;
 
 /* **************** SCENE ********************* */
diff --git a/source/blender/makesrna/intern/rna_layer.c 
b/source/blender/makesrna/intern/rna_layer.c
index 7d09f30ed6a..36e6afe26d6 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -309,6 +309,9 @@ static void 
rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr,
 #define RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(_NAME_) \
        RNA_LAYER_ENGINE_GET_SET(bool, Eevee, COLLECTION_MODE_NONE, _NAME_)
 
+#define RNA_LAYER_ENGINE_WORKBENCH_GET_SET_FLOAT_ARRAY(_NAME_, _LEN_) \
+       RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Workbench, COLLECTION_MODE_NONE, 
_NAME_, _LEN_)
+
 /* mode engines */
 
 #define RNA_LAYER_MODE_OBJECT_GET_SET_FLOAT(_NAME_) \
@@ -353,6 +356,10 @@ RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_attenuation)
 RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(hair_brightness_randomness)
 #endif /* WITH_CLAY_ENGINE */
 
+/* workbench engine */
+/* LayerCollection settings. */
+RNA_LAYER_ENGINE_WORKBENCH_GET_SET_FLOAT_ARRAY(object_color, 3)
+
 /* eevee engine */
 /* ViewLayer settings. */
 RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(gtao_enable)
@@ -578,6 +585,9 @@ static StructRNA 
*rna_LayerCollectionSettings_refine(PointerRNA *ptr)
                                return &RNA_LayerCollectionEngineSettingsClay;
                        }
 #endif
+                       if (STREQ(props->name, RE_engine_id_BLENDER_WORKBENCH)) 
{
+                               return 
&RNA_LayerCollectionEngineSettingsWorkbench;
+                       }
                        if (STREQ(props->name, RE_engine_id_BLENDER_EEVEE)) {
                                /* printf("Mode not fully implemented\n"); */
                                return &RNA_LayerCollectionSettings;
@@ -1736,6 +1746,25 @@ static void 
rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna)
 }
 #endif /* WITH_CLAY_ENGINE */
 
+static void rna_def_layer_collection_engine_settings_workbench(BlenderRNA 
*brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+       
+       srna = RNA_def_struct(brna, "LayerCollectionEngineSettingsWorkbench", 
"LayerCollectionSettings");
+       RNA_def_struct_ui_text(srna, "Collections Workbench Engine Settings", 
"Engine specific settings for this collection");
+
+       RNA_define_verify_sdna(0); /* not in sdna */
+
+       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_flag(prop, PROP_CONTEXT_UPDATE);
+       RNA_def_property_update(prop, 0, 
"rna_LayerCollectionEngineSettings_update");
+}
+
 static void rna_def_layer_collection_mode_settings_object(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -1958,6 +1987,7 @@ static void rna_def_layer_collection_settings(BlenderRNA 
*brna)
        rna_def_layer_collection_engine_settings_clay(brna);
 #endif
 
+       rna_def_layer_collection_engine_settings_workbench(brna);
        rna_def_layer_collection_mode_settings_object(brna);
        rna_def_layer_collection_mode_settings_edit(brna);
        rna_def_layer_collection_mode_settings_paint_weight(brna);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to