Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2017-03-30 18:01:23 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-03-30 18:01:23 +0300
commitce3c7e8ff515e5bfbf70d0f4f60557e26c9d98a1 (patch)
tree1062bd45d22a2a0aff4e4a227079154b78c42263 /source/blender
parent98e69631b0cf31b5b73c1d9afb9bd9fc81fc42be (diff)
Layers: use IDProperty and override collection properties system
First this replace a custom data struct with IDProperty, and use IDProperty group merge and copying functions. Which means that a collection property setting is only created if necessary. This implements the "Layer Collection settings" override system, as suggested in the "Override Manifesto" document. The core is working, with Scene, LayerCollection and Object using a single IDProperty to store all the render settings data. Next step is to migrate this to depsgraph. Note: Clay engine "ssao_samples" was hardcoded to 32 for now. It will come back as part of "Workspace Settings" later. Many thanks for Bastien Montagne for the help with the UI template nightmare ;) Differential Revision: https://developer.blender.org/D2563
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_layer.h46
-rw-r--r--source/blender/blenkernel/intern/idprop.c1
-rw-r--r--source/blender/blenkernel/intern/layer.c635
-rw-r--r--source/blender/blenkernel/intern/material.c6
-rw-r--r--source/blender/blenkernel/intern/object.c12
-rw-r--r--source/blender/blenkernel/intern/scene.c12
-rw-r--r--source/blender/blenloader/intern/readfile.c32
-rw-r--r--source/blender/blenloader/intern/versioning_280.c22
-rw-r--r--source/blender/blenloader/intern/writefile.c69
-rw-r--r--source/blender/draw/DRW_engine.h11
-rw-r--r--source/blender/draw/engines/clay/clay.c125
-rw-r--r--source/blender/draw/engines/clay/clay.h5
-rw-r--r--source/blender/draw/engines/eevee/eevee.c10
-rw-r--r--source/blender/draw/intern/DRW_render.h4
-rw-r--r--source/blender/draw/intern/draw_manager.c81
-rw-r--r--source/blender/draw/modes/edit_mesh_mode.c20
-rw-r--r--source/blender/draw/modes/object_mode.c10
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/interface/interface_ops.c108
-rw-r--r--source/blender/editors/interface/interface_templates.c56
-rw-r--r--source/blender/makesdna/DNA_ID.h9
-rw-r--r--source/blender/makesdna/DNA_layer_types.h48
-rw-r--r--source/blender/makesdna/DNA_material_types.h30
-rw-r--r--source/blender/makesdna/DNA_object_types.h3
-rw-r--r--source/blender/makesdna/DNA_scene_types.h40
-rw-r--r--source/blender/makesrna/RNA_access.h2
-rw-r--r--source/blender/makesrna/intern/rna_material.c143
-rw-r--r--source/blender/makesrna/intern/rna_render.c9
-rw-r--r--source/blender/makesrna/intern/rna_scene.c467
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c9
-rw-r--r--source/blender/render/extern/include/RE_engine.h4
31 files changed, 616 insertions, 1414 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index e1ae266aaa8..07d1c255188 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -42,9 +42,11 @@ extern "C" {
#define TODO_LAYER_DEPSGRAPH /* placeholder for real Depsgraph fix */
#define TODO_LAYER /* generic todo */
-struct CollectionEngineSettings;
+#define ROOT_PROP "root"
+
struct LayerCollection;
struct ID;
+struct IDProperty;
struct ListBase;
struct Main;
struct Object;
@@ -75,7 +77,7 @@ void BKE_scene_layer_base_flag_recalculate(struct SceneLayer *sl);
void BKE_scene_layer_engine_settings_recalculate(struct SceneLayer *sl);
void BKE_scene_layer_engine_settings_object_recalculate(struct SceneLayer *sl, struct Object *ob);
void BKE_scene_layer_engine_settings_collection_recalculate(struct SceneLayer *sl, struct LayerCollection *lc);
-void BKE_scene_layer_engine_settings_update(struct SceneLayer *sl);
+void BKE_scene_layer_engine_settings_update(struct Scene *scene, struct SceneLayer *sl);
void BKE_layer_collection_free(struct SceneLayer *sl, struct LayerCollection *lc);
@@ -109,28 +111,23 @@ void BKE_layer_sync_object_unlink(const struct Scene *scene, struct SceneCollect
void BKE_collection_override_datablock_add(struct LayerCollection *lc, const char *data_path, struct ID *id);
/* engine settings */
-typedef void (*CollectionEngineSettingsCB)(struct RenderEngine *engine, struct CollectionEngineSettings *ces);
-struct CollectionEngineSettings *BKE_layer_collection_engine_get(struct LayerCollection *lc, const int type, const char *engine_name);
-struct CollectionEngineSettings *BKE_object_collection_engine_get(struct Object *ob, const int type, const char *engine_name);
+typedef void (*CollectionEngineSettingsCB)(struct RenderEngine *engine, struct IDProperty *props);
+struct IDProperty *BKE_layer_collection_engine_get(struct LayerCollection *lc, const int type, const char *engine_name);
+struct IDProperty *BKE_object_collection_engine_get(struct Object *ob, const int type, const char *engine_name);
void BKE_layer_collection_engine_settings_callback_register(struct Main *bmain, const char *engine_name, CollectionEngineSettingsCB func);
void BKE_layer_collection_engine_settings_callback_free(void);
+void BKE_layer_collection_engine_settings_create(struct IDProperty *root);
+
+void BKE_collection_engine_property_add_float(struct IDProperty *props, const char *name, float value);
+void BKE_collection_engine_property_add_int(struct IDProperty *props, const char *name, int value);
+void BKE_collection_engine_property_add_bool(struct IDProperty *props, const char *name, bool value);
-struct CollectionEngineSettings *BKE_layer_collection_engine_settings_create(const char *engine_name);
-void BKE_layer_collection_engine_settings_free(struct CollectionEngineSettings *ces);
-void BKE_layer_collection_engine_settings_list_free(struct ListBase *lb);
-
-void BKE_collection_engine_property_add_float(struct CollectionEngineSettings *ces, const char *name, float value);
-void BKE_collection_engine_property_add_int(struct CollectionEngineSettings *ces, const char *name, int value);
-void BKE_collection_engine_property_add_bool(struct CollectionEngineSettings *ces, const char *name, bool value);
-struct CollectionEngineProperty *BKE_collection_engine_property_get(struct CollectionEngineSettings *ces, const char *name);
-int BKE_collection_engine_property_value_get_int(struct CollectionEngineSettings *ces, const char *name);
-float BKE_collection_engine_property_value_get_float(struct CollectionEngineSettings *ces, const char *name);
-bool BKE_collection_engine_property_value_get_bool(struct CollectionEngineSettings *ces, const char *name);
-void BKE_collection_engine_property_value_set_int(struct CollectionEngineSettings *ces, const char *name, int value);
-void BKE_collection_engine_property_value_set_float(struct CollectionEngineSettings *ces, const char *name, float value);
-void BKE_collection_engine_property_value_set_bool(struct CollectionEngineSettings *ces, const char *name, bool value);
-bool BKE_collection_engine_property_use_get(struct CollectionEngineSettings *ces, const char *name);
-void BKE_collection_engine_property_use_set(struct CollectionEngineSettings *ces, const char *name, bool value);
+int BKE_collection_engine_property_value_get_int(struct IDProperty *props, const char *name);
+float BKE_collection_engine_property_value_get_float(struct IDProperty *props, const char *name);
+bool BKE_collection_engine_property_value_get_bool(struct IDProperty *props, const char *name);
+void BKE_collection_engine_property_value_set_int(struct IDProperty *props, const char *name, int value);
+void BKE_collection_engine_property_value_set_float(struct IDProperty *props, const char *name, float value);
+void BKE_collection_engine_property_value_set_bool(struct IDProperty *props, const char *name, bool value);
/* iterators */
@@ -212,11 +209,11 @@ void BKE_visible_bases_Iterator_end(Iterator *iter);
}
/* temporary hacky solution waiting for final depsgraph evaluation */
-#define DEG_OBJECT_ITER(sl_, instance_) \
+#define DEG_OBJECT_ITER(scene_, sl_, instance_) \
{ \
Object *instance_; \
/* temporary solution, waiting for depsgraph update */ \
- BKE_scene_layer_engine_settings_update(sl_); \
+ BKE_scene_layer_engine_settings_update(scene_, sl_); \
\
/* flush all the data to objects*/ \
Base *base_; \
@@ -232,9 +229,6 @@ void BKE_visible_bases_Iterator_end(Iterator *iter);
} \
}
-/* temporary doversion functions */
-void BKE_scene_layer_doversion_update(struct Main *bmain);
-
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index b2641b110f8..31d98a00610 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -468,6 +468,7 @@ static IDProperty *IDP_CopyGroup(const IDProperty *prop)
BLI_assert(prop->type == IDP_GROUP);
newp = idp_generic_copy(prop);
newp->len = prop->len;
+ newp->subtype = prop->subtype;
for (link = prop->data.group.first; link; link = link->next) {
BLI_addtail(&newp->data.group, IDP_CopyProperty(link));
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 6ab7e85cd0d..a593d400f56 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -33,6 +33,7 @@
#include "BLT_translation.h"
#include "BKE_collection.h"
+#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_node.h"
@@ -52,11 +53,10 @@ struct CollectionEngineSettingsCB_Type;
static void layer_collection_free(SceneLayer *sl, LayerCollection *lc);
static LayerCollection *layer_collection_add(SceneLayer *sl, ListBase *lb, SceneCollection *sc);
static LayerCollection *find_layer_collection_by_scene_collection(LayerCollection *lc, const SceneCollection *sc);
-static CollectionEngineSettings *collection_engine_settings_create(struct CollectionEngineSettingsCB_Type *ces_type);
-static void layer_collection_engine_settings_free(LayerCollection *lc);
-static void layer_collection_create_engine_settings(LayerCollection *lc);
-static void layer_collection_create_mode_settings(LayerCollection *lc);
-static void scene_layer_engine_settings_update(SceneLayer *sl, Object *ob);
+static IDProperty *collection_engine_settings_create(struct CollectionEngineSettingsCB_Type *ces_type, const bool populate);
+static IDProperty *collection_engine_get(IDProperty *root, const int type, const char *engine_name);
+static void collection_engine_settings_init(IDProperty *root, const bool populate);
+static void scene_layer_engine_settings_update(Scene *scene, SceneLayer *sl, Object *ob);
static void object_bases_Iterator_next(Iterator *iter, const int flag);
/* RenderLayer */
@@ -337,7 +337,7 @@ void BKE_scene_layer_engine_settings_collection_recalculate(SceneLayer *sl, Laye
*
* Temporary function, waiting for real depsgraph
*/
-void BKE_scene_layer_engine_settings_update(struct SceneLayer *sl)
+void BKE_scene_layer_engine_settings_update(struct Scene *scene, struct SceneLayer *sl)
{
if ((sl->flag & SCENE_LAYER_ENGINE_DIRTY) == 0) {
return;
@@ -348,7 +348,7 @@ void BKE_scene_layer_engine_settings_update(struct SceneLayer *sl)
if (((base->flag & BASE_DIRTY_ENGINE_SETTINGS) != 0) && \
(base->flag & BASE_VISIBLED) != 0)
{
- scene_layer_engine_settings_update(sl, base->object);
+ scene_layer_engine_settings_update(scene, sl, base->object);
base->flag &= ~BASE_DIRTY_ENGINE_SETTINGS;
}
}
@@ -392,7 +392,11 @@ static void layer_collection_free(SceneLayer *sl, LayerCollection *lc)
BLI_freelistN(&lc->object_bases);
BLI_freelistN(&lc->overrides);
- layer_collection_engine_settings_free(lc);
+
+ if (lc->properties) {
+ IDP_FreeProperty(lc->properties);
+ MEM_freeN(lc->properties);
+ }
for (LayerCollection *nlc = lc->layer_collections.first; nlc; nlc = nlc->next) {
layer_collection_free(sl, nlc);
@@ -910,14 +914,16 @@ static void layer_collection_populate(SceneLayer *sl, LayerCollection *lc, Scene
static LayerCollection *layer_collection_add(SceneLayer *sl, ListBase *lb, SceneCollection *sc)
{
+ IDPropertyTemplate val = {0};
LayerCollection *lc = MEM_callocN(sizeof(LayerCollection), "Collection Base");
BLI_addtail(lb, lc);
lc->scene_collection = sc;
lc->flag = COLLECTION_VISIBLE + COLLECTION_SELECTABLE + COLLECTION_FOLDED;
- layer_collection_create_engine_settings(lc);
- layer_collection_create_mode_settings(lc);
+ lc->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
+ collection_engine_settings_init(lc->properties, false);
+
layer_collection_populate(sl, lc, sc);
return lc;
@@ -1044,14 +1050,24 @@ typedef struct CollectionEngineSettingsCB_Type {
} CollectionEngineSettingsCB_Type;
+static void create_engine_settings_scene(Scene *scene, CollectionEngineSettingsCB_Type *ces_type)
+{
+ if (collection_engine_get(scene->collection_properties, COLLECTION_MODE_NONE, ces_type->name)) {
+ return;
+ }
+
+ IDProperty *props = collection_engine_settings_create(ces_type, true);
+ IDP_AddToGroup(scene->collection_properties, props);
+}
+
static void create_engine_settings_layer_collection(LayerCollection *lc, CollectionEngineSettingsCB_Type *ces_type)
{
if (BKE_layer_collection_engine_get(lc, COLLECTION_MODE_NONE, ces_type->name)) {
return;
}
- CollectionEngineSettings *ces = collection_engine_settings_create(ces_type);
- BLI_addtail(&lc->engine_settings, ces);
+ IDProperty *props = collection_engine_settings_create(ces_type, false);
+ IDP_AddToGroup(lc->properties, props);
for (LayerCollection *lcn = lc->layer_collections.first; lcn; lcn = lcn->next) {
create_engine_settings_layer_collection(lcn, ces_type);
@@ -1060,6 +1076,9 @@ static void create_engine_settings_layer_collection(LayerCollection *lc, Collect
static void create_engines_settings_scene(Scene *scene, CollectionEngineSettingsCB_Type *ces_type)
{
+ /* populate the scene with the new settings */
+ create_engine_settings_scene(scene, ces_type);
+
for (SceneLayer *sl = scene->render_layers.first; sl; sl = sl->next) {
for (LayerCollection *lc = sl->layer_collections.first; lc; lc = lc->next) {
create_engine_settings_layer_collection(lc, ces_type);
@@ -1099,123 +1118,116 @@ void BKE_layer_collection_engine_settings_callback_free(void)
BLI_freelistN(&R_engines_settings_callbacks);
}
-static CollectionEngineSettings *collection_engine_settings_create(CollectionEngineSettingsCB_Type *ces_type)
-{
- /* create callback data */
- CollectionEngineSettings *ces = MEM_callocN(sizeof(CollectionEngineSettings), "Collection Engine Settings");
- BLI_strncpy_utf8(ces->name, ces_type->name, sizeof(ces->name));
-
- /* call callback */
- ces_type->callback(NULL, ces);
-
- return ces;
-}
-
/**
- * Initialize a CollectionEngineSettings
+ * Create a root IDProperty for this engine
*
- * Usually we would pass LayerCollection->engine_settings
- * But depsgraph uses this for Object->collection_settings
- */
-CollectionEngineSettings *BKE_layer_collection_engine_settings_create(const char *engine_name)
-{
- CollectionEngineSettingsCB_Type *ces_type;
- ces_type = BLI_findstring(&R_engines_settings_callbacks, engine_name,
- offsetof(CollectionEngineSettingsCB_Type, name));
- BLI_assert(ces_type);
-
- CollectionEngineSettings *ces = collection_engine_settings_create(ces_type);
- return ces;
-}
-
-/**
- * Free the CollectionEngineSettings
+ * \param populate whether we want to pre-fill the collection with the default properties
*/
-void BKE_layer_collection_engine_settings_free(CollectionEngineSettings *ces)
+static IDProperty *collection_engine_settings_create(CollectionEngineSettingsCB_Type *ces_type, const bool populate)
{
- BLI_freelistN(&ces->properties);
-}
+ IDProperty *props;
+ IDPropertyTemplate val = {0};
-static void layer_collection_engine_settings_free(LayerCollection *lc)
-{
- for (CollectionEngineSettings *ces = lc->engine_settings.first; ces; ces = ces->next) {
- BKE_layer_collection_engine_settings_free(ces);
- }
- BLI_freelistN(&lc->engine_settings);
+ props = IDP_New(IDP_GROUP, &val, ces_type->name);
+ props->subtype = IDP_GROUP_SUB_ENGINE_RENDER;
- for (CollectionEngineSettings *ces = lc->mode_settings.first; ces; ces = ces->next) {
- BKE_layer_collection_engine_settings_free(ces);
+ /* properties */
+ if (populate) {
+ ces_type->callback(NULL, props);
}
- BLI_freelistN(&lc->mode_settings);
-}
-/**
- * Initialize the render settings for a single LayerCollection
- */
-static void layer_collection_create_engine_settings(LayerCollection *lc)
-{
- CollectionEngineSettingsCB_Type *ces_type;
- for (ces_type = R_engines_settings_callbacks.first; ces_type; ces_type = ces_type->next) {
- create_engine_settings_layer_collection(lc, ces_type);
- }
+ return props;
}
-static void layer_collection_create_mode_settings_object(ListBase *lb)
+static void layer_collection_create_mode_settings_object(IDProperty *root, const bool populate)
{
- CollectionEngineSettings *ces;
+ IDProperty *props;
+ IDPropertyTemplate val = {0};
- ces = MEM_callocN(sizeof(CollectionEngineSettings), "Object Mode Settings");
- BLI_strncpy_utf8(ces->name, "Object Mode", sizeof(ces->name));
- ces->type = COLLECTION_MODE_OBJECT;
+ props = IDP_New(IDP_GROUP, &val, "ObjectMode");
+ props->subtype = IDP_GROUP_SUB_MODE_OBJECT;
/* properties */
- OBJECT_collection_settings_create(ces);
+ if (populate) {
+ OBJECT_collection_settings_create(props);
+ }
- BLI_addtail(lb, ces);
+ IDP_AddToGroup(root, props);
}
-static void layer_collection_create_mode_settings_edit(ListBase *lb)
+static void layer_collection_create_mode_settings_edit(IDProperty *root, const bool populate)
{
- CollectionEngineSettings *ces;
+ IDProperty *props;
+ IDPropertyTemplate val = {0};
- ces = MEM_callocN(sizeof(CollectionEngineSettings), "Edit Mode Settings");
- BLI_strncpy_utf8(ces->name, "Edit Mode", sizeof(ces->name));
- ces->type = COLLECTION_MODE_EDIT;
+ props = IDP_New(IDP_GROUP, &val, "EditMode");
+ props->subtype = IDP_GROUP_SUB_MODE_EDIT;
/* properties */
- EDIT_MESH_collection_settings_create(ces);
+ if (populate) {
+ EDIT_MESH_collection_settings_create(props);
+ }
+
+ IDP_AddToGroup(root, props);
+}
- BLI_addtail(lb, ces);
+static void collection_create_render_settings(IDProperty *root, const bool populate)
+{
+ CollectionEngineSettingsCB_Type *ces_type;
+ for (ces_type = R_engines_settings_callbacks.first; ces_type; ces_type = ces_type->next) {
+ IDProperty *props = collection_engine_settings_create(ces_type, populate);
+ IDP_AddToGroup(root, props);
+ }
}
-static void collection_create_mode_settings(ListBase *lb)
+static void collection_create_mode_settings(IDProperty *root, const bool populate)
{
- layer_collection_create_mode_settings_object(lb);
- layer_collection_create_mode_settings_edit(lb);
+ /* XXX TODO: put all those engines in the R_engines_settings_callbacks
+ * and have IDP_AddToGroup outside the callbacks */
+ layer_collection_create_mode_settings_object(root, populate);
+ layer_collection_create_mode_settings_edit(root, populate);
}
-static void layer_collection_create_mode_settings(LayerCollection *lc)
+static int idproperty_group_subtype(const int mode_type)
{
- collection_create_mode_settings(&lc->mode_settings);
+ int idgroup_type;
+
+ switch (mode_type) {
+ case COLLECTION_MODE_OBJECT:
+ idgroup_type = IDP_GROUP_SUB_MODE_OBJECT;
+ break;
+ case COLLECTION_MODE_EDIT:
+ idgroup_type = IDP_GROUP_SUB_MODE_EDIT;
+ break;
+ default:
+ case COLLECTION_MODE_NONE:
+ return IDP_GROUP_SUB_ENGINE_RENDER;
+ break;
+ }
+
+ return idgroup_type;
}
/**
* Return collection enginne settings for either Object s of LayerCollection s
*/
-static CollectionEngineSettings *collection_engine_get(
- ListBase *lb_render, ListBase *lb_mode, const int type, const char *engine_name)
+static IDProperty *collection_engine_get(
+ IDProperty *root, const int type, const char *engine_name)
{
- if (type == COLLECTION_MODE_NONE) {
- return BLI_findstring(lb_render, engine_name, offsetof(CollectionEngineSettings, name));
+ const int subtype = idproperty_group_subtype(type);
+
+ if (subtype == IDP_GROUP_SUB_ENGINE_RENDER) {
+ return IDP_GetPropertyFromGroup(root, engine_name);
}
else {
- CollectionEngineSettings *ces;
- for (ces = lb_mode->first; ces; ces = ces->next) {
- if (ces->type == type) {
- return ces;
+ IDProperty *prop;
+ for (prop = root->data.group.first; prop; prop = prop->next) {
+ if (prop->subtype == subtype) {
+ return prop;
}
}
}
+
BLI_assert(false);
return NULL;
}
@@ -1223,255 +1235,163 @@ static CollectionEngineSettings *collection_engine_get(
/**
* Return collection engine settings from Object for specified engine of mode
*/
-CollectionEngineSettings *BKE_object_collection_engine_get(Object *ob, const int type, const char *engine_name)
+IDProperty *BKE_object_collection_engine_get(Object *ob, const int type, const char *engine_name)
{
- return collection_engine_get(&ob->collection_settings, &ob->collection_settings, type, engine_name);
+ return collection_engine_get(ob->collection_properties, type, engine_name);
}
/**
* Return layer collection engine settings for specified engine
*/
-CollectionEngineSettings *BKE_layer_collection_engine_get(LayerCollection *lc, const int type, const char *engine_name)
+IDProperty *BKE_layer_collection_engine_get(LayerCollection *lc, const int type, const char *engine_name)
{
- return collection_engine_get(&lc->engine_settings, &lc->mode_settings, type, engine_name);
+ return collection_engine_get(lc->properties, type, engine_name);
}
/* ---------------------------------------------------------------------- */
/* Engine Settings Properties */
-void BKE_collection_engine_property_add_float(CollectionEngineSettings *ces, const char *name, float value)
+void BKE_collection_engine_property_add_float(IDProperty *props, const char *name, float value)
{
- CollectionEnginePropertyFloat *prop;
- prop = MEM_callocN(sizeof(CollectionEnginePropertyFloat), "collection engine settings float");
- prop->data.type = COLLECTION_PROP_TYPE_FLOAT;
- BLI_strncpy_utf8(prop->data.name, name, sizeof(prop->data.name));
- prop->value = value;
- BLI_addtail(&ces->properties, prop);
+ IDPropertyTemplate val = {0};
+ val.f = value;
+ IDP_AddToGroup(props, IDP_New(IDP_FLOAT, &val, name));
}
-void BKE_collection_engine_property_add_int(CollectionEngineSettings *ces, const char *name, int value)
+void BKE_collection_engine_property_add_int(IDProperty *props, const char *name, int value)
{
- CollectionEnginePropertyInt *prop;
- prop = MEM_callocN(sizeof(CollectionEnginePropertyInt), "collection engine settings int");
- prop->data.type = COLLECTION_PROP_TYPE_INT;
- BLI_strncpy_utf8(prop->data.name, name, sizeof(prop->data.name));
- prop->value = value;
- BLI_addtail(&ces->properties, prop);
+ IDPropertyTemplate val = {0};
+ val.i = value;
+ IDP_AddToGroup(props, IDP_New(IDP_INT, &val, name));
}
-void BKE_collection_engine_property_add_bool(CollectionEngineSettings *ces, const char *name, bool value)
+void BKE_collection_engine_property_add_bool(IDProperty *props, const char *name, bool value)
{
- CollectionEnginePropertyBool *prop;
- prop = MEM_callocN(sizeof(CollectionEnginePropertyBool), "collection engine settings bool");
- prop->data.type = COLLECTION_PROP_TYPE_BOOL;
- BLI_strncpy_utf8(prop->data.name, name, sizeof(prop->data.name));
- prop->value = value;
- BLI_addtail(&ces->properties, prop);
+ IDPropertyTemplate val = {0};
+ val.i = value;
+ IDP_AddToGroup(props, IDP_New(IDP_INT, &val, name));
}
-CollectionEngineProperty *BKE_collection_engine_property_get(CollectionEngineSettings *ces, const char *name)
+int BKE_collection_engine_property_value_get_int(IDProperty *props, const char *name)
{
- return BLI_findstring(&ces->properties, name, offsetof(CollectionEngineProperty, name));
+ IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
+ return idprop ? idprop->data.val : 0;
}
-int BKE_collection_engine_property_value_get_int(CollectionEngineSettings *ces, const char *name)
+float BKE_collection_engine_property_value_get_float(IDProperty *props, const char *name)
{
- CollectionEnginePropertyInt *prop;
- prop = (CollectionEnginePropertyInt *)BLI_findstring(&ces->properties, name,
- offsetof(CollectionEngineProperty, name));
- return prop->value;
+ IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
+ return idprop ? *((float *)&idprop->data.val) : 0.0f;
}
-float BKE_collection_engine_property_value_get_float(CollectionEngineSettings *ces, const char *name)
+bool BKE_collection_engine_property_value_get_bool(IDProperty *props, const char *name)
{
- CollectionEnginePropertyFloat *prop;
- prop = (CollectionEnginePropertyFloat *)BLI_findstring(&ces->properties, name,
- offsetof(CollectionEngineProperty, name));
- return prop->value;
+ IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
+ return idprop ? idprop->data.val : 0;
}
-bool BKE_collection_engine_property_value_get_bool(CollectionEngineSettings *ces, const char *name)
+void BKE_collection_engine_property_value_set_int(IDProperty *props, const char *name, int value)
{
- CollectionEnginePropertyBool *prop;
- prop = (CollectionEnginePropertyBool *)BLI_findstring(&ces->properties, name,
- offsetof(CollectionEngineProperty, name));
- return prop->value;
+ IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
+ idprop->data.val = value;
}
-void BKE_collection_engine_property_value_set_int(CollectionEngineSettings *ces, const char *name, int value)
+void BKE_collection_engine_property_value_set_float(IDProperty *props, const char *name, float value)
{
- CollectionEnginePropertyInt *prop;
- prop = (CollectionEnginePropertyInt *)BLI_findstring(&ces->properties, name,
- offsetof(CollectionEngineProperty, name));
- prop->value = value;
- prop->data.flag |= COLLECTION_PROP_USE;
+ IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
+ *(float *)&idprop->data.val = value;
}
-void BKE_collection_engine_property_value_set_float(CollectionEngineSettings *ces, const char *name, float value)
+void BKE_collection_engine_property_value_set_bool(IDProperty *props, const char *name, bool value)
{
- CollectionEnginePropertyFloat *prop;
- prop = (CollectionEnginePropertyFloat *)BLI_findstring(&ces->properties, name,
- offsetof(CollectionEngineProperty, name));
- prop->value = value;
- prop->data.flag |= COLLECTION_PROP_USE;
-}
-
-void BKE_collection_engine_property_value_set_bool(CollectionEngineSettings *ces, const char *name, bool value)
-{
- CollectionEnginePropertyBool *prop;
- prop = (CollectionEnginePropertyBool *)BLI_findstring(&ces->properties, name,
- offsetof(CollectionEngineProperty, name));
- prop->value = value;
- prop->data.flag |= COLLECTION_PROP_USE;
-}
-
-bool BKE_collection_engine_property_use_get(CollectionEngineSettings *ces, const char *name)
-{
- CollectionEngineProperty *prop;
- prop = (CollectionEngineProperty *)BLI_findstring(&ces->properties, name, offsetof(CollectionEngineProperty, name));
- return ((prop->flag & COLLECTION_PROP_USE) != 0);
-}
-
-void BKE_collection_engine_property_use_set(CollectionEngineSettings *ces, const char *name, bool value)
-{
- CollectionEngineProperty *prop;
- prop = (CollectionEngineProperty *)BLI_findstring(&ces->properties, name, offsetof(CollectionEngineProperty, name));
-
- if (value) {
- prop->flag |= COLLECTION_PROP_USE;
- }
- else {
- prop->flag &= ~COLLECTION_PROP_USE;
- }
+ IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
+ idprop->data.val = value;
}
/* Engine Settings recalculate */
-static void collection_engine_settings_init(ListBase *lb)
-{
- CollectionEngineSettingsCB_Type *ces_type;
- for (ces_type = R_engines_settings_callbacks.first; ces_type; ces_type = ces_type->next) {
- CollectionEngineSettings *ces = collection_engine_settings_create(ces_type);
- BLI_strncpy_utf8(ces->name, ces_type->name, sizeof(ces->name));
- BLI_addtail(lb, ces);
- }
-
- /* edit modes */
- collection_create_mode_settings(lb);
-}
-
-static void collection_engine_settings_copy(ListBase *lb_dst, ListBase *lb_src)
+/* get all the default settings defined in scene and merge them here */
+static void collection_engine_settings_init(IDProperty *root, const bool populate)
{
- for (CollectionEngineSettings *ces_src = lb_src->first; ces_src; ces_src = ces_src->next) {
- CollectionEngineSettings *ces_dst = MEM_callocN(sizeof(*ces_dst), "CollectionEngineSettings copy");
-
- BLI_strncpy_utf8(ces_dst->name, ces_src->name, sizeof(ces_dst->name));
- ces_dst->type = ces_src->type;
- BLI_addtail(lb_dst, ces_dst);
+ /* render engines */
+ collection_create_render_settings(root, populate);
- for (CollectionEngineProperty *prop = ces_src->properties.first; prop; prop = prop->next) {
- CollectionEngineProperty *prop_new = MEM_dupallocN(prop);
- BLI_addtail(&ces_dst->properties, prop_new);
- }
- }
+ /* mode engines */
+ collection_create_mode_settings(root, populate);
}
/**
- * Set a value from a CollectionProperty to another
+ * Initialize the render setings
+ * It's used mainly for scenes
*/
-static void collection_engine_property_set (CollectionEngineProperty *prop_dst, CollectionEngineProperty *prop_src)
-{
- if ((prop_src->flag & COLLECTION_PROP_USE) != 0) {
- /* mark the property as used, so the engine knows if the value was ever set*/
- prop_dst->flag |= COLLECTION_PROP_USE;
- switch (prop_src->type) {
- case COLLECTION_PROP_TYPE_FLOAT:
- ((CollectionEnginePropertyFloat *)prop_dst)->value = ((CollectionEnginePropertyFloat *)prop_src)->value;
- break;
- case COLLECTION_PROP_TYPE_INT:
- ((CollectionEnginePropertyInt *)prop_dst)->value = ((CollectionEnginePropertyInt *)prop_src)->value;
- break;
- case COLLECTION_PROP_TYPE_BOOL:
- ((CollectionEnginePropertyBool *)prop_dst)->value = ((CollectionEnginePropertyBool *)prop_src)->value;
- break;
- default:
- BLI_assert(false);
- break;
- }
- }
+void BKE_layer_collection_engine_settings_create(IDProperty *root)
+{
+ collection_engine_settings_init(root, true);
}
-static void collection_engine_settings_merge(ListBase *lb_dst, ListBase *lb_src)
+static void collection_engine_settings_copy(IDProperty *props_dst, IDProperty *props_src)
{
- for (CollectionEngineSettings *ces_src = lb_src->first; ces_src; ces_src = ces_src->next) {
- CollectionEngineSettings *ces_dst = collection_engine_get(lb_dst, lb_dst, ces_src->type, ces_src->name);
- BLI_assert(ces_dst);
+ IDP_MergeGroup(props_dst, props_src, true);
+}
- CollectionEngineProperty *prop_dst, *prop_src;
- for (prop_dst = ces_dst->properties.first; prop_dst; prop_dst = prop_dst->next) {
- prop_src = BLI_findstring(&ces_src->properties, prop_dst->name, offsetof(CollectionEngineProperty, name));
- BLI_assert(prop_src);
- collection_engine_property_set(prop_dst, prop_src);
- }
- }
+static void collection_engine_settings_merge(IDProperty *props_dst, IDProperty *props_src)
+{
+ IDP_SyncGroupValues(props_dst, props_src);
}
static void layer_collection_engine_settings_update(
- LayerCollection *lc, ListBase *lb_parent,
- Base *base, ListBase *lb_object)
+ LayerCollection *lc, IDProperty *props_parent,
+ Base *base, IDProperty *props_object)
{
if ((lc->flag & COLLECTION_VISIBLE) == 0) {
return;
}
- ListBase lb_collection = {NULL};
- collection_engine_settings_copy(&lb_collection, lb_parent);
+ IDPropertyTemplate val = {0};
+ IDProperty *props_collection = IDP_New(IDP_GROUP, &val, ROOT_PROP);
+ collection_engine_settings_copy(props_collection, props_parent);
- collection_engine_settings_merge(&lb_collection, &lc->engine_settings);
- collection_engine_settings_merge(&lb_collection, &lc->mode_settings);
+ collection_engine_settings_merge(props_collection, lc->properties);
if (BLI_findptr(&lc->object_bases, base, offsetof(LinkData, data)) != NULL) {
- collection_engine_settings_merge(lb_object, &lb_collection);
+ collection_engine_settings_merge(props_object, props_collection);
}
/* do it recursively */
for (LayerCollection *lcn = lc->layer_collections.first; lcn; lcn = lcn->next) {
- layer_collection_engine_settings_update(lcn, &lb_collection, base, lb_object);
+ layer_collection_engine_settings_update(lcn, props_collection, base, props_object);
}
- BKE_layer_collection_engine_settings_list_free(&lb_collection);
-}
-
-/**
- * Empty all the CollectionEngineSettings in the list
- */
-void BKE_layer_collection_engine_settings_list_free(struct ListBase *lb)
-{
- for (CollectionEngineSettings *ces = lb->first; ces; ces = ces->next) {
- BKE_layer_collection_engine_settings_free(ces);
- }
- BLI_freelistN(lb);
+ IDP_FreeProperty(props_collection);
+ MEM_freeN(props_collection);
}
/**
* Update the collection settings pointer allocated in the object
* This is to be flushed from the Depsgraph
*/
-static void scene_layer_engine_settings_update(SceneLayer *sl, Object *ob)
+static void scene_layer_engine_settings_update(Scene *scene, SceneLayer *sl, Object *ob)
{
Base *base = BKE_scene_layer_base_find(sl, ob);
- ListBase ces_layer = {NULL};
+ IDPropertyTemplate val = {0};
- collection_engine_settings_init(&ces_layer);
+ IDProperty *layer_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
+ collection_engine_settings_copy(layer_properties, scene->collection_properties);
/* start fresh */
- BKE_layer_collection_engine_settings_list_free(&ob->collection_settings);
- collection_engine_settings_init(&ob->collection_settings);
+ if (ob->collection_properties) {
+ IDP_FreeProperty(ob->collection_properties);
+ MEM_freeN(ob->collection_properties);
+ }
+
+ ob->collection_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
+ collection_engine_settings_copy(ob->collection_properties, scene->collection_properties);
for (LayerCollection *lc = sl->layer_collections.first; lc; lc = lc->next) {
- layer_collection_engine_settings_update(lc, &ces_layer, base, &ob->collection_settings);
+ layer_collection_engine_settings_update(lc, layer_properties, base, ob->collection_properties);
}
- BKE_layer_collection_engine_settings_list_free(&ces_layer);
+ IDP_FreeProperty(layer_properties);
+ MEM_freeN(layer_properties);
}
/* ---------------------------------------------------------------------- */
@@ -1578,204 +1498,3 @@ void BKE_visible_bases_Iterator_end(Iterator *UNUSED(iter))
{
/* do nothing */
}
-
-
-/* ---------------------------------------------------------------------- */
-/* Doversion routine */
-
-/**
- * Merge CollectionEngineSettings
- *
- * \param ces_ref CollectionEngineSettings to use as reference
- * \param ces CollectionEngineSettings to merge into
- */
-static void scene_layer_doversion_merge_setings(const CollectionEngineSettings *ces_ref, CollectionEngineSettings *ces)
-{
- CollectionEngineProperty *cep = ces->properties.first, *cep_ref;
-
- for (cep_ref = ces_ref->properties.first; cep_ref; cep_ref = cep_ref->next) {
- cep = BLI_findstring(&ces->properties, cep_ref->name, offsetof(CollectionEngineProperty, name));
-
- if (cep == NULL) {
- cep = MEM_dupallocN(cep_ref);
- BLI_addtail(&ces->properties, cep);
- }
- else if (cep->type != cep_ref->type) {
- CollectionEngineProperty *prev = cep->prev, *next = cep->next;
- MEM_freeN(cep);
- cep = MEM_dupallocN(cep_ref);
-
- cep->prev = prev;
- cep->next = next;
- }
- else {
- /* keep the property as it is */
- }
- }
-}
-
-/**
- * Merge ListBases of LayerCollections
- *
- * \param lb_ref ListBase of CollectionEngineSettings to use as reference
- * \param lb ListBase of CollectionEngineSettings
- */
-static void scene_layer_doversion_merge_layer_collection(const ListBase *lb_ref, ListBase *lb)
-{
- CollectionEngineSettings *ces = lb->first, *ces_ref;
-
- for (ces_ref = lb_ref->first; ces_ref; ces_ref = ces_ref->next) {
- ces = BLI_findstring(lb, ces_ref->name, offsetof(CollectionEngineSettings, name));
-
- if (ces == NULL) {
- ces = MEM_dupallocN(ces_ref);
- BLI_duplicatelist(&ces->properties, &ces_ref->properties);
- BLI_addtail(lb, ces);
- }
- else {
- scene_layer_doversion_merge_setings(ces_ref, ces);
- }
- }
-}
-
-/**
- * Create or remove CollectionEngineSettings and CollectionEngineProperty
- * based on reference LayerCollection
- *
- * \param lc_ref reference LayerCollection to merge missing settings from
- * \param lb ListBase of LayerCollection
- */
-static void scene_layer_doversion_update_collections(const LayerCollection *lc_ref, ListBase *lb)
-{
- for (LayerCollection *lc = lb->first; lc; lc = lc->next) {
-
- scene_layer_doversion_merge_layer_collection(&lc_ref->engine_settings, &lc->engine_settings);
- scene_layer_doversion_merge_layer_collection(&lc_ref->mode_settings, &lc->mode_settings);
-
- /* continue recursively */
- scene_layer_doversion_update_collections(lc_ref, &lc->layer_collections);
- }
-}
-
-/**
- * Updates all the CollectionEngineSettings of all
- * LayerCollection elements in Scene
- *
- * \param lc_ref reference LayerCollection to merge missing settings from
- */
-static void scene_layer_doversion_update(const LayerCollection *lc_ref, Scene *scene)
-{
- for (SceneLayer *sl = scene->render_layers.first; sl; sl = sl->next) {
- scene_layer_doversion_update_collections(lc_ref, &sl->layer_collections);
- }
-}
-
-/**
- * Return true at the first indicative that the listbases don't match
- *
- * It's fine if the individual properties values are different, as long
- * as we have the same properties across them
- *
- * \param lb_ces ListBase of CollectionEngineSettings
- * \param lb_ces_ref ListBase of CollectionEngineSettings
- */
-static bool scene_layer_doversion_is_outdated_engines(ListBase *lb_ces, ListBase *lb_ces_ref)
-{
- if (BLI_listbase_count(lb_ces) != BLI_listbase_count(lb_ces_ref)) {
- return true;
- }
-
- CollectionEngineSettings *ces, *ces_ref;
- for (ces = lb_ces->first, ces_ref = lb_ces_ref->first; ces; ces = ces->next, ces_ref = ces_ref->next) {
- if (BLI_listbase_count(&ces->properties) != BLI_listbase_count(&ces_ref->properties)) {
- return true;
- }
-
- CollectionEngineProperty *cep, *cep_ref;
- for (cep = ces->properties.first, cep_ref = ces_ref->properties.first;
- cep != NULL;
- cep = cep->next, cep_ref = cep_ref->next)
- {
- if (cep->type != cep_ref->type) {
- return true;
- }
-
- if (STREQ(cep->name, cep_ref->name) == false) {
- return true;
- }
- }
- }
-
- return false;
-}
-
-/**
- * Get the first available LayerCollection
- */
-static LayerCollection *scene_layer_doversion_collection_get(Main *bmain)
-{
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
- for (SceneLayer *sl = scene->render_layers.first; sl; sl = sl->next) {
- for (LayerCollection *lc = sl->layer_collections.first; lc; lc = lc->next) {
- return lc;
- }
- }
- }
- return NULL;
-}
-
-/**
- * See if a new LayerCollection have the same CollectionEngineSettings
- * and properties of the saved LayerCollection
- */
-static bool scene_layer_doversion_is_outdated(Main *bmain)
-{
- LayerCollection *lc, lc_ref = {NULL};
- bool is_outdated = false;
-
- lc = scene_layer_doversion_collection_get(bmain);
-
- if (lc == NULL) {
- return false;
- }
-
- layer_collection_create_engine_settings(&lc_ref);
- layer_collection_create_mode_settings(&lc_ref);
-
- if (scene_layer_doversion_is_outdated_engines(&lc->engine_settings, &lc_ref.engine_settings)) {
- is_outdated = true;
- }
-
- if (scene_layer_doversion_is_outdated_engines(&lc->mode_settings, &lc_ref.mode_settings)) {
- is_outdated = true;
- }
-
- layer_collection_engine_settings_free(&lc_ref);
- return is_outdated;
-}
-
-/**
- * Handle doversion of files during the viewport development
- *
- * This is intended to prevent subversion bumping every time a new property
- * is added to an engine, but it may be relevant in the future as a generic doversion
- */
-void BKE_scene_layer_doversion_update(Main *bmain)
-{
- /* if file not outdated, don't bother with the slow merging */
- if (scene_layer_doversion_is_outdated(bmain) == false) {
- return;
- }
-
- /* create a reference LayerCollection to merge missing settings from */
- LayerCollection lc_ref = {NULL};
- layer_collection_create_engine_settings(&lc_ref);
- layer_collection_create_mode_settings(&lc_ref);
-
- /* bring all the missing properties for the LayerCollections */
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
- scene_layer_doversion_update(&lc_ref, scene);
- }
-
- layer_collection_engine_settings_free(&lc_ref);
-}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 435504859a4..6cab8945779 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -111,12 +111,6 @@ void BKE_material_free(Material *ma)
BKE_icon_id_delete((ID *)ma);
BKE_previewimg_free(&ma->preview);
-
- for (MaterialEngineSettings *mes = ma->engines_settings.first; mes; mes = mes->next) {
- if (mes->data)
- MEM_SAFE_FREE(mes->data);
- }
- BLI_freelistN(&ma->engines_settings);
}
void BKE_material_init(Material *ma)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index a84a0f31d91..0b427a3cf9d 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -460,7 +460,10 @@ void BKE_object_free(Object *ob)
BKE_previewimg_free(&ob->preview);
- BKE_layer_collection_engine_settings_list_free(&ob->collection_settings);
+ if (ob->collection_properties) {
+ IDP_FreeProperty(ob->collection_properties);
+ MEM_freeN(ob->collection_properties);
+ }
}
/* actual check for internal data, not context or flags */
@@ -1176,7 +1179,6 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, bool copy_caches)
BLI_listbase_clear(&obn->gpulamp);
BLI_listbase_clear(&obn->pc_ids);
- BLI_listbase_clear(&obn->collection_settings);
obn->mpath = NULL;
@@ -1190,6 +1192,12 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, bool copy_caches)
/* Do not copy object's preview (mostly due to the fact renderers create temp copy of objects). */
obn->preview = NULL;
+ if (ob->collection_properties) {
+ IDPropertyTemplate val = {0};
+ obn->collection_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
+ IDP_MergeGroup(obn->collection_properties, ob->collection_properties, true);
+ }
+
return obn;
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 4d01b1b2eb6..38ddd9ebda7 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -569,11 +569,11 @@ void BKE_scene_free(Scene *sce)
sce->collection = NULL;
/* Runtime Engine Data */
- for (RenderEngineSettings *res = sce->engines_settings.first; res; res = res->next) {
- if (res->data)
- MEM_freeN(res->data);
+ if (sce->collection_properties) {
+ IDP_FreeProperty(sce->collection_properties);
+ MEM_freeN(sce->collection_properties);
+ sce->collection_properties = NULL;
}
- BLI_freelistN(&sce->engines_settings);
}
void BKE_scene_init(Scene *sce)
@@ -928,6 +928,10 @@ void BKE_scene_init(Scene *sce)
sce->collection = MEM_callocN(sizeof(SceneCollection), "Master Collection");
BLI_strncpy(sce->collection->name, "Master Collection", sizeof(sce->collection->name));
+ IDPropertyTemplate val = {0};
+ sce->collection_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
+ BKE_layer_collection_engine_settings_create(sce->collection_properties);
+
BKE_scene_layer_add(sce, "Render Layer");
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 4309bc071b7..88d7424a278 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3949,7 +3949,6 @@ static void lib_link_material(FileData *fd, Main *main)
static void direct_link_material(FileData *fd, Material *ma)
{
int a;
- MaterialEngineSettings *mes;
ma->adt = newdataadr(fd, ma->adt);
direct_link_animdata(fd, ma->adt);
@@ -3970,11 +3969,6 @@ static void direct_link_material(FileData *fd, Material *ma)
ma->preview = direct_link_preview_image(fd, ma->preview);
BLI_listbase_clear(&ma->gpumaterial);
-
- link_list(fd, &ma->engines_settings);
- for (mes = ma->engines_settings.first; mes; mes = mes->next) {
- mes->data = newdataadr(fd, mes->data);
- }
}
/* ************ READ PARTICLE SETTINGS ***************** */
@@ -5592,7 +5586,6 @@ static void direct_link_object(FileData *fd, Object *ob)
ob->bb = NULL;
ob->derivedDeform = NULL;
ob->derivedFinal = NULL;
- BLI_listbase_clear(&ob->collection_settings);
BLI_listbase_clear(&ob->gpulamp);
link_list(fd, &ob->pc_ids);
@@ -5610,6 +5603,9 @@ static void direct_link_object(FileData *fd, Object *ob)
ob->currentlod = ob->lodlevels.first;
ob->preview = direct_link_preview_image(fd, ob->preview);
+
+ ob->collection_properties = newdataadr(fd, ob->collection_properties);
+ IDP_DirectLinkGroup_OrFree(&ob->collection_properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
}
/* ************ READ SCENE ***************** */
@@ -5961,14 +5957,6 @@ static void direct_link_scene_collection(FileData *fd, SceneCollection *sc)
}
}
-static void direct_link_engine_settings(FileData *fd, ListBase *lb)
-{
- link_list(fd, lb);
- for (CollectionEngineSettings *ces = lb->first; ces; ces = ces->next) {
- link_list(fd, &ces->properties);
- }
-}
-
static void direct_link_layer_collections(FileData *fd, ListBase *lb)
{
link_list(fd, lb);
@@ -5983,9 +5971,10 @@ static void direct_link_layer_collections(FileData *fd, ListBase *lb)
link_list(fd, &lc->overrides);
- direct_link_engine_settings(fd, &lc->engine_settings);
-
- direct_link_engine_settings(fd, &lc->mode_settings);
+ if (lc->properties) {
+ lc->properties = newdataadr(fd, lc->properties);
+ IDP_DirectLinkGroup_OrFree(&lc->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+ }
direct_link_layer_collections(fd, &lc->layer_collections);
}
@@ -5999,7 +5988,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
RigidBodyWorld *rbw;
SceneLayer *sl;
SceneRenderLayer *srl;
- RenderEngineSettings *res;
sce->theDag = NULL;
sce->depsgraph = NULL;
@@ -6266,10 +6254,8 @@ static void direct_link_scene(FileData *fd, Scene *sce)
BKE_scene_layer_base_flag_recalculate(sl);
}
- link_list(fd, &sce->engines_settings);
- for (res = sce->engines_settings.first; res; res = res->next) {
- res->data = newdataadr(fd, res->data);
- }
+ sce->collection_properties = newdataadr(fd, sce->collection_properties);
+ IDP_DirectLinkGroup_OrFree(&sce->collection_properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
}
/* ************ READ WM ***************** */
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 75628e59fa7..55d88240100 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -37,6 +37,7 @@
#include "BKE_blender.h"
#include "BKE_collection.h"
+#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_scene.h"
@@ -211,11 +212,6 @@ void do_versions_after_linking_280(Main *main)
}
}
-static void blo_do_version_temporary(Main *main)
-{
- BKE_scene_layer_doversion_update(main);
-}
-
void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
{
if (!MAIN_VERSION_ATLEAST(main, 280, 0)) {
@@ -227,7 +223,19 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
- /* temporary validation of 280 files for layers */
- blo_do_version_temporary(main);
+ if (!DNA_struct_elem_find(fd->filesdna, "Scene", "IDProperty", "collection_properties")) {
+ IDPropertyTemplate val = {0};
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ scene->collection_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
+ BKE_layer_collection_engine_settings_create(scene->collection_properties);
+ }
+ }
+
+ if (!DNA_struct_elem_find(fd->filesdna, "Object", "IDProperty", "collection_properties")) {
+ IDPropertyTemplate val = {0};
+ for (Object *ob = main->object.first; ob; ob = ob->id.next) {
+ ob->collection_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
+ }
+ }
}
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index f21003b66ac..d5fa4204602 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1921,6 +1921,10 @@ static void write_object(WriteData *wd, Object *ob)
writelist(wd, DATA, LodLevel, &ob->lodlevels);
write_previews(wd, ob->preview);
+
+ if (ob->collection_properties) {
+ IDP_WriteProperty(ob->collection_properties, wd);
+ }
}
}
@@ -2402,21 +2406,6 @@ static void write_texture(WriteData *wd, Tex *tex)
}
}
-static void write_material_engines_settings(WriteData *wd, ListBase *lb)
-{
- for (MaterialEngineSettings *res = lb->first; res; res = res->next) {
- writestruct(wd, DATA, MaterialEngineSettings, 1, res);
-
- if (STREQ(res->name, RE_engine_id_BLENDER_CLAY)) {
- writestruct(wd, DATA, MaterialEngineSettingsClay, 1, res->data);
- }
- else {
- /* No engine matched */
- /* error: don't know how to write this file */
- }
- }
-}
-
static void write_material(WriteData *wd, Material *ma)
{
if (ma->id.us > 0 || wd->current) {
@@ -2448,8 +2437,6 @@ static void write_material(WriteData *wd, Material *ma)
}
write_previews(wd, ma->preview);
-
- write_material_engines_settings(wd, &ma->engines_settings);
}
}
@@ -2565,29 +2552,6 @@ static void write_scene_collection(WriteData *wd, SceneCollection *sc)
}
}
-static void write_collection_engine_settings(WriteData *wd, ListBase *lb)
-{
- for (CollectionEngineSettings *ces = lb->first; ces; ces = ces->next) {
- writestruct(wd, DATA, CollectionEngineSettings, 1, ces);
-
- for (CollectionEngineProperty *prop = ces->properties.first; prop; prop = prop->next) {
- switch (prop->type) {
- case COLLECTION_PROP_TYPE_FLOAT:
- writestruct(wd, DATA, CollectionEnginePropertyFloat, 1, prop);
- break;
- case COLLECTION_PROP_TYPE_INT:
- writestruct(wd, DATA, CollectionEnginePropertyInt, 1, prop);
- break;
- case COLLECTION_PROP_TYPE_BOOL:
- writestruct(wd, DATA, CollectionEnginePropertyBool, 1, prop);
- break;
- default:
- ; /* error: don't know how to write this file */
- }
- }
- }
-}
-
static void write_layer_collections(WriteData *wd, ListBase *lb)
{
for (LayerCollection *lc = lb->first; lc; lc = lc->next) {
@@ -2596,29 +2560,14 @@ static void write_layer_collections(WriteData *wd, ListBase *lb)
writelist(wd, DATA, LinkData, &lc->object_bases);
writelist(wd, DATA, CollectionOverride, &lc->overrides);
- write_collection_engine_settings(wd, &lc->engine_settings);
-
- write_collection_engine_settings(wd, &lc->mode_settings);
+ if (lc->properties) {
+ IDP_WriteProperty(lc->properties, wd);
+ }
write_layer_collections(wd, &lc->layer_collections);
}
}
-static void write_render_engines_settings(WriteData *wd, ListBase *lb)
-{
- for (RenderEngineSettings *res = lb->first; res; res = res->next) {
- writestruct(wd, DATA, RenderEngineSettings, 1, res);
-
- if (STREQ(res->name, RE_engine_id_BLENDER_CLAY)) {
- writestruct(wd, DATA, RenderEngineSettingsClay, 1, res->data);
- }
- else {
- /* No engine matched */
- /* error: don't know how to write this file */
- }
- }
-}
-
static void write_scene(WriteData *wd, Scene *sce)
{
/* write LibData */
@@ -2830,7 +2779,9 @@ static void write_scene(WriteData *wd, Scene *sce)
write_layer_collections(wd, &sl->layer_collections);
}
- write_render_engines_settings(wd, &sce->engines_settings);
+ if (sce->collection_properties) {
+ IDP_WriteProperty(sce->collection_properties, wd);
+ }
}
static void write_gpencil(WriteData *wd, bGPdata *gpd)
diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h
index e8dc47245e3..669f7a24908 100644
--- a/source/blender/draw/DRW_engine.h
+++ b/source/blender/draw/DRW_engine.h
@@ -31,6 +31,7 @@ struct DRWPass;
struct Material;
struct Scene;
struct DrawEngineType;
+struct IDProperty;
struct bContext;
struct Object;
@@ -54,13 +55,9 @@ void DRW_draw_view(const struct bContext *C);
/* This is here because GPUViewport needs it */
void DRW_pass_free(struct DRWPass *pass);
-/* Settings */
-void *DRW_material_settings_get(struct Material *ma, const char *engine_name);
-void *DRW_render_settings_get(struct Scene *scene, const char *engine_name);
-
/* Mode engines initialization */
-void OBJECT_collection_settings_create(struct CollectionEngineSettings *ces);
-void EDIT_MESH_collection_settings_create(struct CollectionEngineSettings *ces);
-void EDIT_ARMATURE_collection_settings_create(struct CollectionEngineSettings *ces);
+void OBJECT_collection_settings_create(struct IDProperty *properties);
+void EDIT_MESH_collection_settings_create(struct IDProperty *properties);
+void EDIT_ARMATURE_collection_settings_create(struct IDProperty *properties);
#endif /* __DRW_ENGINE_H__ */
diff --git a/source/blender/draw/engines/clay/clay.c b/source/blender/draw/engines/clay/clay.c
index 9f46556b7c2..6294715e01c 100644
--- a/source/blender/draw/engines/clay/clay.c
+++ b/source/blender/draw/engines/clay/clay.c
@@ -22,6 +22,7 @@
#include "DRW_render.h"
#include "BKE_icons.h"
+#include "BKE_idprop.h"
#include "BKE_main.h"
#include "BLI_dynstr.h"
@@ -252,30 +253,6 @@ static struct GPUTexture *create_jitter_texture(void)
return DRW_texture_create_2D(64, 64, DRW_TEX_RG_16, DRW_TEX_FILTER | DRW_TEX_WRAP, &jitter[0][0]);
}
-static void clay_material_settings_init(MaterialEngineSettingsClay *ma)
-{
- ma->matcap_icon = ICON_MATCAP_01;
- ma->matcap_rot = 0.0f;
- ma->matcap_hue = 0.5f;
- ma->matcap_sat = 0.5f;
- ma->matcap_val = 0.5f;
- ma->ssao_distance = 0.2;
- ma->ssao_attenuation = 1.0f;
- ma->ssao_factor_cavity = 1.0f;
- ma->ssao_factor_edge = 1.0f;
-}
-
-RenderEngineSettings *CLAY_render_settings_create(void)
-{
- RenderEngineSettingsClay *settings = MEM_callocN(sizeof(RenderEngineSettingsClay), "RenderEngineSettingsClay");
-
- clay_material_settings_init((MaterialEngineSettingsClay *)settings);
-
- settings->ssao_samples = 32;
-
- return (RenderEngineSettings *)settings;
-}
-
static void CLAY_engine_init(void *vedata)
{
CLAY_StorageList *stl = ((CLAY_Data *)vedata)->stl;
@@ -372,6 +349,7 @@ static void CLAY_engine_init(void *vedata)
/* SSAO setup */
{
+ int ssao_samples = 32; /* XXX get from render settings */
float invproj[4][4];
float dfdyfacs[2];
bool is_persp = DRW_viewport_is_persp_get();
@@ -383,11 +361,10 @@ static void CLAY_engine_init(void *vedata)
};
int i;
float *size = DRW_viewport_size_get();
- RenderEngineSettingsClay *settings = DRW_render_settings_get(NULL, RE_engine_id_BLENDER_CLAY);
DRW_get_dfdy_factors(dfdyfacs);
- e_data.ssao_params[0] = settings->ssao_samples;
+ e_data.ssao_params[0] = ssao_samples;
e_data.ssao_params[1] = size[0] / 64.0;
e_data.ssao_params[2] = size[1] / 64.0;
e_data.ssao_params[3] = dfdyfacs[1]; /* dfdy sign for offscreen */
@@ -421,14 +398,14 @@ static void CLAY_engine_init(void *vedata)
}
/* AO Samples Tex */
- if (e_data.sampling_tx && (e_data.cached_sample_num != settings->ssao_samples)) {
+ if (e_data.sampling_tx && (e_data.cached_sample_num != ssao_samples)) {
DRW_texture_free(e_data.sampling_tx);
e_data.sampling_tx = NULL;
}
if (!e_data.sampling_tx) {
- e_data.sampling_tx = create_spiral_sample_texture(settings->ssao_samples);
- e_data.cached_sample_num = settings->ssao_samples;
+ e_data.sampling_tx = create_spiral_sample_texture(ssao_samples);
+ e_data.cached_sample_num = ssao_samples;
}
}
}
@@ -528,62 +505,21 @@ static int mat_in_ubo(CLAY_Storage *storage, float matcap_rot, float matcap_hue,
return id;
}
-/* Safe way to get override values */
-static void override_setting(CollectionEngineSettings *ces, const char *name, void *ret)
-{
- CollectionEngineProperty *cep = BKE_collection_engine_property_get(ces, name);
-
- if (cep == NULL) {
- return;
- }
-
- if ((cep->flag & COLLECTION_PROP_USE) == 0) {
- return;
- }
-
- if (cep->type == COLLECTION_PROP_TYPE_INT) {
- CollectionEnginePropertyInt *prop = (CollectionEnginePropertyInt *)cep;
- *((int *)ret) = prop->value;
- }
- else if (cep->type == COLLECTION_PROP_TYPE_FLOAT) {
- CollectionEnginePropertyFloat *prop = (CollectionEnginePropertyFloat *)cep;
- *((float *)ret) = prop->value;
- }
- else if (cep->type == COLLECTION_PROP_TYPE_BOOL) {
- CollectionEnginePropertyBool *prop = (CollectionEnginePropertyBool *)cep;
- *((bool *)ret) = prop->value;
- }
-}
-
static DRWShadingGroup *CLAY_object_shgrp_get(CLAY_Data *vedata, Object *ob, CLAY_StorageList *stl, CLAY_PassList *psl)
{
DRWShadingGroup **shgrps = stl->storage->shgrps;
- MaterialEngineSettingsClay *settings = DRW_render_settings_get(NULL, RE_engine_id_BLENDER_CLAY);
- CollectionEngineSettings *ces = BKE_object_collection_engine_get(ob, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_CLAY);
+ IDProperty *props = BKE_object_collection_engine_get(ob, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_CLAY);
/* Default Settings */
- float matcap_rot = settings->matcap_rot;
- float matcap_hue = settings->matcap_hue;
- float matcap_sat = settings->matcap_sat;
- float matcap_val = settings->matcap_val;
- float ssao_distance = settings->ssao_distance;
- float ssao_factor_cavity = settings->ssao_factor_cavity;
- float ssao_factor_edge = settings->ssao_factor_edge;
- float ssao_attenuation = settings->ssao_attenuation;
- int matcap_icon = settings->matcap_icon;
-
- /* Override settings */
- if (ces) {
- override_setting(ces, "matcap_rotation", &matcap_rot);
- override_setting(ces, "matcap_hue", &matcap_hue);
- override_setting(ces, "matcap_saturation", &matcap_sat);
- override_setting(ces, "matcap_value", &matcap_val);
- override_setting(ces, "ssao_distance", &ssao_distance);
- override_setting(ces, "ssao_factor_cavity", &ssao_factor_cavity);
- override_setting(ces, "ssao_factor_edge", &ssao_factor_edge);
- override_setting(ces, "ssao_attenuation", &ssao_attenuation);
- override_setting(ces, "matcap_icon", &matcap_icon);
- }
+ float matcap_rot = BKE_collection_engine_property_value_get_float(props, "matcap_rotation");
+ float matcap_hue = BKE_collection_engine_property_value_get_float(props, "matcap_hue");
+ float matcap_sat = BKE_collection_engine_property_value_get_float(props, "matcap_saturation");
+ float matcap_val = BKE_collection_engine_property_value_get_float(props, "matcap_value");
+ float ssao_distance = BKE_collection_engine_property_value_get_float(props, "ssao_distance");
+ float ssao_factor_cavity = BKE_collection_engine_property_value_get_float(props, "ssao_factor_cavity");
+ float ssao_factor_edge = BKE_collection_engine_property_value_get_float(props, "ssao_factor_edge");
+ float ssao_attenuation = BKE_collection_engine_property_value_get_float(props, "ssao_attenuation");
+ int matcap_icon = BKE_collection_engine_property_value_get_int(props, "matcap_icon");
int id = mat_in_ubo(stl->storage, matcap_rot, matcap_hue, matcap_sat, matcap_val,
ssao_distance, ssao_factor_cavity, ssao_factor_edge,
@@ -638,7 +574,7 @@ static void CLAY_cache_populate(void *vedata, Object *ob)
if (!DRW_is_object_renderable(ob))
return;
- CollectionEngineSettings *ces_mode_ob = BKE_object_collection_engine_get(ob, COLLECTION_MODE_OBJECT, "");
+ IDProperty *ces_mode_ob = BKE_object_collection_engine_get(ob, COLLECTION_MODE_OBJECT, "");
bool do_cull = BKE_collection_engine_property_value_get_bool(ces_mode_ob, "show_backface_culling");
/* TODO all renderable */
@@ -680,19 +616,22 @@ static void CLAY_draw_scene(void *vedata)
DRW_draw_pass(psl->clay_pass);
}
-static void CLAY_collection_settings_create(RenderEngine *UNUSED(engine), CollectionEngineSettings *ces)
+static void CLAY_collection_settings_create(RenderEngine *UNUSED(engine), IDProperty *props)
{
- BLI_assert(ces);
- BKE_collection_engine_property_add_int(ces, "matcap_icon", ICON_MATCAP_01);
- BKE_collection_engine_property_add_int(ces, "type", CLAY_MATCAP_NONE);
- BKE_collection_engine_property_add_float(ces, "matcap_rotation", 0.0f);
- BKE_collection_engine_property_add_float(ces, "matcap_hue", 0.5f);
- BKE_collection_engine_property_add_float(ces, "matcap_saturation", 0.5f);
- BKE_collection_engine_property_add_float(ces, "matcap_value", 0.5f);
- BKE_collection_engine_property_add_float(ces, "ssao_distance", 0.2f);
- BKE_collection_engine_property_add_float(ces, "ssao_attenuation", 1.0f);
- BKE_collection_engine_property_add_float(ces, "ssao_factor_cavity", 1.0f);
- BKE_collection_engine_property_add_float(ces, "ssao_factor_edge", 1.0f);
+ BLI_assert(props &&
+ props->type == IDP_GROUP &&
+ props->subtype == IDP_GROUP_SUB_ENGINE_RENDER);
+
+ BKE_collection_engine_property_add_int(props, "matcap_icon", ICON_MATCAP_01);
+ BKE_collection_engine_property_add_int(props, "type", CLAY_MATCAP_NONE);
+ BKE_collection_engine_property_add_float(props, "matcap_rotation", 0.0f);
+ BKE_collection_engine_property_add_float(props, "matcap_hue", 0.5f);
+ BKE_collection_engine_property_add_float(props, "matcap_saturation", 0.5f);
+ BKE_collection_engine_property_add_float(props, "matcap_value", 0.5f);
+ BKE_collection_engine_property_add_float(props, "ssao_distance", 0.2f);
+ BKE_collection_engine_property_add_float(props, "ssao_attenuation", 1.0f);
+ BKE_collection_engine_property_add_float(props, "ssao_factor_cavity", 1.0f);
+ BKE_collection_engine_property_add_float(props, "ssao_factor_edge", 1.0f);
}
static void CLAY_engine_free(void)
diff --git a/source/blender/draw/engines/clay/clay.h b/source/blender/draw/engines/clay/clay.h
index 1afe1ac5ea8..660ad70ab48 100644
--- a/source/blender/draw/engines/clay/clay.h
+++ b/source/blender/draw/engines/clay/clay.h
@@ -28,7 +28,8 @@
extern RenderEngineType viewport_clay_type;
-struct RenderEngineSettings *CLAY_render_settings_create(void);
-struct MaterialEngineSettings *CLAY_material_settings_create(void);
+struct IDProperty;
+
+struct IDProperty *CLAY_render_settings_create(void);
#endif /* __CLAY_H__ */
diff --git a/source/blender/draw/engines/eevee/eevee.c b/source/blender/draw/engines/eevee/eevee.c
index f5c4f2385af..d40ce0baa38 100644
--- a/source/blender/draw/engines/eevee/eevee.c
+++ b/source/blender/draw/engines/eevee/eevee.c
@@ -156,7 +156,7 @@ static void EEVEE_cache_populate(void *vedata, Object *ob)
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
if (ob->type == OB_MESH) {
- CollectionEngineSettings *ces_mode_ob = BKE_object_collection_engine_get(ob, COLLECTION_MODE_OBJECT, "");
+ IDProperty *ces_mode_ob = BKE_object_collection_engine_get(ob, COLLECTION_MODE_OBJECT, "");
bool do_cull = BKE_collection_engine_property_value_get_bool(ces_mode_ob, "show_backface_culling");
struct Batch *geom = DRW_cache_surface_get(ob);
@@ -222,10 +222,12 @@ static void EEVEE_engine_free(void)
DRW_shader_free(e_data.tonemap);
}
-static void EEVEE_collection_settings_create(RenderEngine *UNUSED(engine), CollectionEngineSettings *ces)
+static void EEVEE_collection_settings_create(RenderEngine *UNUSED(engine), IDProperty *props)
{
- BLI_assert(ces);
- // BKE_collection_engine_property_add_int(ces, "high_quality_sphere_lamps", false);
+ BLI_assert(props &&
+ props->type == IDP_GROUP &&
+ props->subtype == IDP_GROUP_SUB_ENGINE_RENDER);
+ // BKE_collection_engine_property_add_int(props, "high_quality_sphere_lamps", false);
}
DrawEngineType draw_engine_eevee_type = {
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 1f74ca5981a..13b10011dec 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -249,10 +249,6 @@ struct DefaultTextureList *DRW_viewport_texture_list_get(void);
/* Settings */
bool DRW_is_object_renderable(struct Object *ob);
-#ifndef __DRW_ENGINE_H__
-void *DRW_material_settings_get(Material *ma, const char *engine_name);
-void *DRW_render_settings_get(Scene *scene, const char *engine_name);
-#endif /* __DRW_ENGINE_H__ */
/* Draw commands */
void DRW_draw_pass(DRWPass *pass);
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index efa677240dd..65fd77a5155 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -923,7 +923,7 @@ static void draw_geometry(DRWShadingGroup *shgroup, Batch *geom, const float (*o
{
RegionView3D *rv3d = CTX_wm_region_view3d(DST.context);
DRWInterface *interface = shgroup->interface;
-
+
float mvp[4][4], mv[4][4], n[3][3], wn[3][3];
float eye[3] = { 0.0f, 0.0f, 1.0f }; /* looking into the screen */
@@ -1050,7 +1050,7 @@ static void draw_shgroup(DRWShadingGroup *shgroup)
GPU_texture_bind(tex, uni->bindloc);
GPU_texture_compare_mode(tex, false);
GPU_texture_filter_mode(tex, false);
-
+
bound_tex = MEM_callocN(sizeof(DRWBoundTexture), "DRWBoundTexture");
bound_tex->tex = tex;
BLI_addtail(&DST.bound_texs, bound_tex);
@@ -1186,8 +1186,8 @@ bool DRW_is_object_renderable(Object *ob)
if (ob->type == OB_MESH) {
if (ob == obedit) {
- CollectionEngineSettings *ces_mode_ed = BKE_object_collection_engine_get(ob, COLLECTION_MODE_EDIT, "");
- bool do_occlude_wire = BKE_collection_engine_property_value_get_bool(ces_mode_ed, "show_occlude_wire");
+ IDProperty *props = BKE_object_collection_engine_get(ob, COLLECTION_MODE_EDIT, "");
+ bool do_occlude_wire = BKE_collection_engine_property_value_get_bool(props, "show_occlude_wire");
if (do_occlude_wire)
return false;
@@ -1197,72 +1197,6 @@ bool DRW_is_object_renderable(Object *ob)
return true;
}
-void *DRW_material_settings_get(Material *ma, const char *engine_name)
-{
- MaterialEngineSettings *ms = NULL;
-
- ms = BLI_findstring(&ma->engines_settings, engine_name, offsetof(MaterialEngineSettings, name));
-
-#ifdef WITH_CLAY_ENGINE
- /* If the settings does not exists yet, create it */
- if (ms == NULL) {
- ms = MEM_callocN(sizeof(RenderEngineSettings), "RenderEngineSettings");
-
- BLI_strncpy(ms->name, engine_name, 32);
-
- /* TODO make render_settings_create a polymorphic function */
- if (STREQ(engine_name, RE_engine_id_BLENDER_CLAY)) {
- /* No material support */
- BLI_assert(false);
- }
- else {
- /* No engine matched */
- BLI_assert(false);
- }
-
- BLI_addtail(&ma->engines_settings, ms);
- }
-#else
- return NULL;
-#endif
-
- return ms->data;
-}
-
-/* If scene is NULL, use context scene */
-void *DRW_render_settings_get(Scene *scene, const char *engine_name)
-{
- RenderEngineSettings *rs = NULL;
-
- if (scene == NULL)
- scene = CTX_data_scene(DST.context);
-
- rs = BLI_findstring(&scene->engines_settings, engine_name, offsetof(RenderEngineSettings, name));
-
-#ifdef WITH_CLAY_ENGINE
- /* If the settings does not exists yet, create it */
- if (rs == NULL) {
- rs = MEM_callocN(sizeof(RenderEngineSettings), "RenderEngineSettings");
-
- BLI_strncpy(rs->name, engine_name, 32);
-
- /* TODO make render_settings_create a polymorphic function */
- if (STREQ(engine_name, RE_engine_id_BLENDER_CLAY)) {
- rs->data = CLAY_render_settings_create();
- }
- else {
- /* No engine matched */
- BLI_assert(false);
- }
-
- BLI_addtail(&scene->engines_settings, rs);
- }
-#else
- return NULL;
-#endif
-
- return rs->data;
-}
/* ****************************************** Framebuffers ******************************************/
static GPUTextureFormat convert_tex_format(int fbo_format, int *channels)
@@ -1289,7 +1223,7 @@ void DRW_framebuffer_init(struct GPUFrameBuffer **fb, int width, int height, DRW
for (int i = 0; i < texnbr; ++i) {
DRWFboTexture fbotex = textures[i];
-
+
if (!*fbotex.tex) {
int channels;
GPUTextureFormat gpu_format = convert_tex_format(fbotex.format, &channels);
@@ -1307,7 +1241,7 @@ void DRW_framebuffer_init(struct GPUFrameBuffer **fb, int width, int height, DRW
++color_attachment;
}
}
-
+
GPU_framebuffer_texture_attach(*fb, *fbotex.tex, color_attachment);
}
@@ -1787,10 +1721,11 @@ void DRW_draw_view(const bContext *C)
/* ideally only refresh when objects are added/removed */
/* or render properties / materials change */
if (cache_is_dirty) {
+ Scene *scene = CTX_data_scene(C);
SceneLayer *sl = CTX_data_scene_layer(C);
DRW_engines_cache_init();
- DEG_OBJECT_ITER(sl, ob);
+ DEG_OBJECT_ITER(scene, sl, ob);
{
DRW_engines_cache_populate(ob);
}
diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c
index 084e0eb89b7..713ae607ef4 100644
--- a/source/blender/draw/modes/edit_mesh_mode.c
+++ b/source/blender/draw/modes/edit_mesh_mode.c
@@ -367,7 +367,7 @@ static void EDIT_MESH_cache_populate(void *vedata, Object *ob)
if (ob->type == OB_MESH) {
if (ob == obedit) {
- CollectionEngineSettings *ces_mode_ed = BKE_object_collection_engine_get(ob, COLLECTION_MODE_EDIT, "");
+ IDProperty *ces_mode_ed = BKE_object_collection_engine_get(ob, COLLECTION_MODE_EDIT, "");
bool do_occlude_wire = BKE_collection_engine_property_value_get_bool(ces_mode_ed, "show_occlude_wire");
backwire_opacity = BKE_collection_engine_property_value_get_float(ces_mode_ed, "backwire_opacity"); /* Updating uniform */
@@ -446,15 +446,17 @@ static void EDIT_MESH_draw_scene(void *vedata)
}
}
-void EDIT_MESH_collection_settings_create(CollectionEngineSettings *ces)
+void EDIT_MESH_collection_settings_create(IDProperty *properties)
{
- BLI_assert(ces);
- BKE_collection_engine_property_add_int(ces, "show_occlude_wire", false);
- BKE_collection_engine_property_add_int(ces, "face_normals_show", false);
- BKE_collection_engine_property_add_int(ces, "vert_normals_show", false);
- BKE_collection_engine_property_add_int(ces, "loop_normals_show", false);
- BKE_collection_engine_property_add_float(ces, "normals_length", 0.1);
- BKE_collection_engine_property_add_float(ces, "backwire_opacity", 0.5);
+ BLI_assert(properties &&
+ properties->type == IDP_GROUP &&
+ properties->subtype == IDP_GROUP_SUB_MODE_EDIT);
+ BKE_collection_engine_property_add_int(properties, "show_occlude_wire", false);
+ BKE_collection_engine_property_add_int(properties, "face_normals_show", false);
+ BKE_collection_engine_property_add_int(properties, "vert_normals_show", false);
+ BKE_collection_engine_property_add_int(properties, "loop_normals_show", false);
+ BKE_collection_engine_property_add_float(properties, "normals_length", 0.1);
+ BKE_collection_engine_property_add_float(properties, "backwire_opacity", 0.5);
}
static void EDIT_MESH_engine_free(void)
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 046fcc0a837..e301c3e4e8a 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -1028,11 +1028,13 @@ static void OBJECT_draw_scene(void *vedata)
DRW_draw_pass(psl->outlines_resolve);
}
-void OBJECT_collection_settings_create(CollectionEngineSettings *ces)
+void OBJECT_collection_settings_create(IDProperty *props)
{
- BLI_assert(ces);
- BKE_collection_engine_property_add_int(ces, "show_wire", false);
- BKE_collection_engine_property_add_int(ces, "show_backface_culling", false);
+ BLI_assert(props &&
+ props->type == IDP_GROUP &&
+ props->subtype == IDP_GROUP_SUB_MODE_OBJECT);
+ BKE_collection_engine_property_add_int(props, "show_wire", false);
+ BKE_collection_engine_property_add_int(props, "show_backface_culling", false);
}
DrawEngineType draw_engine_object_type = {
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 625a5887bef..bd3e56b39a0 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -948,6 +948,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C);
void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr);
+void uiTemplateOverrideProperty(uiLayout *layout, struct PointerRNA *collection_props_ptr, struct PointerRNA *scene_props_ptr, const char *name, const char *custom_template);
void uiTemplateComponentMenu(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name);
void uiTemplateNodeSocket(uiLayout *layout, struct bContext *C, float *color);
void uiTemplateCacheFile(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index fb95cdf389b..de226e74c65 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -42,6 +42,8 @@
#include "BLT_lang.h"
#include "BKE_context.h"
+#include "BKE_idprop.h"
+#include "BKE_layer.h"
#include "BKE_screen.h"
#include "BKE_global.h"
#include "BKE_node.h"
@@ -50,6 +52,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_types.h"
#include "UI_interface.h"
@@ -328,6 +331,109 @@ static void UI_OT_unset_property_button(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
}
+/* Use/Unuse Property Button Operator ------------------------ */
+
+static int use_property_button_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ PointerRNA ptr, scene_props_ptr;
+ PropertyRNA *prop;
+ IDProperty *props;
+
+ uiBut *but = UI_context_active_but_get(C);
+
+ prop = but->rnaprop;
+ ptr = but->rnapoin;
+ props = (IDProperty *)ptr.data;
+ /* XXX Using existing data struct to pass another RNAPointer */
+ scene_props_ptr = but->rnasearchpoin;
+
+ const char *identifier = RNA_property_identifier(prop);
+ if (IDP_GetPropertyFromGroup(props, identifier)) {
+ return OPERATOR_CANCELLED;
+ }
+
+ switch (RNA_property_type(prop)) {
+ case PROP_FLOAT:
+ {
+ float value = RNA_property_float_get(&scene_props_ptr, prop);
+ BKE_collection_engine_property_add_float(props, identifier, value);
+ break;
+ }
+ case PROP_ENUM:
+ {
+ int value = RNA_enum_get(&scene_props_ptr, identifier);
+ BKE_collection_engine_property_add_int(props, identifier, value);
+ break;
+ }
+ case PROP_INT:
+ {
+ int value = RNA_int_get(&scene_props_ptr, identifier);
+ BKE_collection_engine_property_add_int(props, identifier, value);
+ break;
+ }
+ case PROP_BOOLEAN:
+ {
+ int value = RNA_boolean_get(&scene_props_ptr, identifier);
+ BKE_collection_engine_property_add_bool(props, identifier, value);
+ break;
+ }
+ case PROP_STRING:
+ case PROP_POINTER:
+ case PROP_COLLECTION:
+ default:
+ break;
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+static void UI_OT_use_property_button(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Use property";
+ ot->idname = "UI_OT_use_property_button";
+ ot->description = "Create a property";
+
+ /* callbacks */
+ ot->poll = ED_operator_regionactive;
+ ot->exec = use_property_button_exec;
+
+ /* flags */
+ ot->flag = OPTYPE_UNDO;
+}
+
+static int unuse_property_button_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ PointerRNA ptr;
+ PropertyRNA *prop;
+ int index;
+
+ /* try to unset the nominated property */
+ UI_context_active_but_prop_get(C, &ptr, &prop, &index);
+ const char *identifier = RNA_property_identifier(prop);
+
+ IDProperty *props = (IDProperty *)ptr.data;
+ IDProperty *prop_to_remove = IDP_GetPropertyFromGroup(props, identifier);
+ IDP_FreeFromGroup(props, prop_to_remove);
+
+ return OPERATOR_FINISHED;
+}
+
+static void UI_OT_unuse_property_button(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Unuse property";
+ ot->idname = "UI_OT_unuse_property_button";
+ ot->description = "Remove a property";
+
+ /* callbacks */
+ ot->poll = ED_operator_regionactive;
+ ot->exec = unuse_property_button_exec;
+
+ /* flags */
+ ot->flag = OPTYPE_UNDO;
+}
+
/* Copy To Selected Operator ------------------------ */
bool UI_context_copy_to_selected_list(
@@ -1114,6 +1220,8 @@ void ED_operatortypes_ui(void)
WM_operatortype_append(UI_OT_copy_python_command_button);
WM_operatortype_append(UI_OT_reset_default_button);
WM_operatortype_append(UI_OT_unset_property_button);
+ WM_operatortype_append(UI_OT_use_property_button);
+ WM_operatortype_append(UI_OT_unuse_property_button);
WM_operatortype_append(UI_OT_copy_to_selected_button);
WM_operatortype_append(UI_OT_reports_to_textblock); /* XXX: temp? */
WM_operatortype_append(UI_OT_drop_color);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index a31ce55ca5f..e3a71feb1a9 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -58,6 +58,8 @@
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_idcode.h"
+#include "BKE_idprop.h"
+#include "BKE_layer.h"
#include "BKE_library.h"
#include "BKE_linestyle.h"
#include "BKE_main.h"
@@ -3751,6 +3753,60 @@ void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr)
}
}
+/********************************* Overrides *************************************/
+
+void uiTemplateOverrideProperty(uiLayout *layout, struct PointerRNA *collection_props_ptr, struct PointerRNA *scene_props_ptr, const char *name, const char *custom_template)
+{
+ bool is_set = false;
+ uiLayout *row, *col;
+
+ PointerRNA *ptr;
+ PropertyRNA *prop;
+
+ IDProperty *collection_props = collection_props_ptr->data;
+
+ if (IDP_GetPropertyFromGroup(collection_props, name)) {
+ prop = RNA_struct_find_property(collection_props_ptr, name);
+ ptr = collection_props_ptr;
+ is_set = RNA_property_is_set(ptr, prop);
+ }
+ else {
+ /* property doesn't exist yet */
+ prop = RNA_struct_find_property(scene_props_ptr, name);
+ ptr = scene_props_ptr;
+ }
+
+ row = uiLayoutRow(layout, false);
+ col = uiLayoutColumn(row, false);
+
+ uiLayoutSetEnabled(col, is_set);
+
+ if (custom_template && STREQ(custom_template, "icon_view")) {
+ uiTemplateIconView(col, ptr, name, false, 5.0f);
+ }
+ else {
+ uiItemFullR(col, ptr, prop, -1, 0, 0, NULL, ICON_NONE);
+ }
+
+ col = uiLayoutColumn(row, false);
+ uiBut *but;
+ uiBlock *block = uiLayoutGetBlock(col);
+ UI_block_emboss_set(block, UI_EMBOSS_NONE);
+
+ if (is_set) {
+ but = uiDefIconButO(block, UI_BTYPE_BUT, "UI_OT_unuse_property_button", WM_OP_EXEC_DEFAULT, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
+ }
+ else {
+ but = uiDefIconButO(block, UI_BTYPE_BUT, "UI_OT_use_property_button", WM_OP_EXEC_DEFAULT, ICON_ZOOMIN, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
+ /* XXX - Using existing data struct to pass another RNAPointer */
+ but->rnasearchpoin = *scene_props_ptr;
+ }
+
+ but->rnapoin = *collection_props_ptr;
+ but->rnaprop = prop;
+ UI_block_emboss_set(block, UI_EMBOSS);
+}
+
/********************************* Color management *************************************/
void uiTemplateColorspaceSettings(uiLayout *layout, PointerRNA *ptr, const char *propname)
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 2c6f3d2fc66..9c3e194b78c 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -98,6 +98,15 @@ enum {
IDP_STRING_SUB_BYTE = 1, /* arbitrary byte array, _not_ null terminated */
};
+/* IDP_GROUP */
+enum {
+ IDP_GROUP_SUB_NONE = 0, /* default */
+ IDP_GROUP_SUB_MODE_OBJECT = 1, /* object mode settings */
+ IDP_GROUP_SUB_MODE_EDIT = 2, /* mesh edit mode settings */
+ IDP_GROUP_SUB_ENGINE_RENDER = 3, /* render engine settings */
+ IDP_GROUP_SUB_OVERRIDE = 4, /* data override */
+};
+
/*->flag*/
enum {
IDP_FLAG_GHOST = 1 << 7, /* this means the property is set but RNA will return false when checking
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h
index de2bd51f647..2ea0638acfb 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -61,6 +61,7 @@ typedef struct LayerCollection {
ListBase layer_collections; /* synced with collection->collections */
ListBase engine_settings; /* CollectionEngineSettings */
ListBase mode_settings; /* CollectionModeSettings */
+ struct IDProperty *properties; /* overrides */
} LayerCollection;
typedef struct SceneLayer {
@@ -112,53 +113,6 @@ enum {
/* *************************************************************** */
/* Engine Settings */
-typedef struct CollectionEngineProperty {
- struct CollectionEngineProperty *next, *prev;
- char name[64]; /* MAX_NAME */
- short type;
- short pad;
- char flag;
- char pad2[3];
-} CollectionEngineProperty;
-
-typedef struct CollectionEnginePropertyInt {
- struct CollectionEngineProperty data;
- int value;
- int pad;
-} CollectionEnginePropertyInt;
-
-typedef struct CollectionEnginePropertyBool {
- struct CollectionEngineProperty data;
- int value;
- int pad;
-} CollectionEnginePropertyBool;
-
-typedef struct CollectionEnginePropertyFloat {
- struct CollectionEngineProperty data;
- float value;
- float pad;
-} CollectionEnginePropertyFloat;
-
-typedef struct CollectionEngineSettings {
- struct CollectionEngineSettings *next, *prev;
- char name[32]; /* engine name - MAX_NAME */
- ListBase properties; /* CollectionProperty */
- int type; /* CollectionEngineSettingsType */
- int pad;
-} CollectionEngineSettings;
-
-/* CollectionEngineProperty->flag */
-enum {
- COLLECTION_PROP_USE = (1 << 0),
-};
-
-/* CollectionEngineProperty.type */
-typedef enum CollectionEnginePropertyType {
- COLLECTION_PROP_TYPE_FLOAT = 0,
- COLLECTION_PROP_TYPE_INT = 1,
- COLLECTION_PROP_TYPE_BOOL = 2,
-} CollectionEnginePropertyType;
-
/* CollectionEngineSettings->type */
typedef enum CollectionEngineSettingsType {
COLLECTION_MODE_NONE = 0,
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index bd8278f897a..67bc49032d5 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -90,38 +90,11 @@ typedef struct TexPaintSlot {
int pad;
} TexPaintSlot;
-/* Material Engine Settings */
-typedef struct MaterialEngineSettings {
- struct MaterialEngineSettings *next, *prev;
- char name[32]; /* engine name - MAX_NAME */
- void *data;
-} MaterialEngineSettings;
-
/* Clay engine */
/* MaterialRuntimeClay.flag */
#define CLAY_OUTDATED 1
-typedef struct MaterialEngineSettingsClay {
- short type;
- short matcap_icon; /* Icon ID */
-
- float matcap_rot;
- float matcap_hue;
- float matcap_sat;
- float matcap_val;
-
- float ssao_distance;
- float ssao_attenuation;
- float ssao_factor_cavity;
- float ssao_factor_edge;
-
- /* Runtime */
- short flag;
- short pad;
- int ubo_index;
-} MaterialEngineSettingsClay;
-
/* MaterialEngineSettingsClay.type */
#define CLAY_MATCAP_NONE 0
#define CLAY_MATCAP_SIMPLE 1
@@ -240,9 +213,6 @@ typedef struct Material {
struct TexPaintSlot *texpaintslot; /* cached slot for painting. Make sure to recalculate before use
* with refresh_texpaint_image_cache */
- /* Engine Settings */
- ListBase engines_settings; /* MaterialEngineSettings */
-
ListBase gpumaterial; /* runtime */
} Material;
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index fb0a02e92ae..59ed6f1222f 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -46,7 +46,6 @@ struct Object;
struct AnimData;
struct Ipo;
struct BoundBox;
-struct CollectionEngineSettings;
struct Path;
struct Material;
struct PartDeflect;
@@ -304,7 +303,7 @@ typedef struct Object {
struct PreviewImage *preview;
- ListBase collection_settings; /* used by depsgraph, flushed from collection-tree */
+ struct IDProperty *collection_properties; /* used by depsgraph, flushed from collection-tree */
} Object;
/* Warning, this is not used anymore because hooks are now modifiers */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index eac599eefc4..e3e97b94304 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -539,44 +539,6 @@ typedef enum BakePassFilter {
#define R_BAKE_PASS_FILTER_ALL (~0)
-/* *************************************************************** */
-/* Engine Settings */
-
-typedef struct RenderEngineSettings {
- struct RenderEngineSettings *next, *prev;
- char name[32]; /* engine name */
- void *data;
-} RenderEngineSettings;
-
-/* Render Data */
-typedef struct RenderEngineSettingsClay {
- /* Use same layout as MaterialEngineSettingsClay so this struct
- * can be used as Material Settings. */
- short type;
- short matcap_icon; /* Icon ID */
-
- float matcap_rot;
- float matcap_hue;
- float matcap_sat;
- float matcap_val;
-
- float ssao_distance;
- float ssao_attenuation;
- float ssao_factor_cavity;
- float ssao_factor_edge;
-
- short flag;
- short pad;
- int ubo_index;
- /* end of MaterialEngineSettingsClay */
-
- /* Global Settings */
- short options;
- short pad1;
- int ssao_samples;
- int pad2[2];
-} RenderEngineSettingsClay;
-
/* RenderEngineSettingsClay.options */
typedef enum ClayFlagSettings {
CLAY_USE_AO = (1 << 0),
@@ -1754,7 +1716,7 @@ typedef struct Scene {
int active_layer;
int pad4;
- ListBase engines_settings; /* RenderEngineSettings */
+ IDProperty *collection_properties; /* settings to be overriden by layer collections */
int pad5[2];
} Scene;
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index f4df95cf873..e8cb54448de 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -386,8 +386,6 @@ extern StructRNA RNA_MaterialStrand;
extern StructRNA RNA_MaterialSubsurfaceScattering;
extern StructRNA RNA_MaterialTextureSlot;
extern StructRNA RNA_MaterialVolume;
-extern StructRNA RNA_MaterialEngineSettings;
-extern StructRNA RNA_MaterialEngineSettingsClay;
extern StructRNA RNA_Mask;
extern StructRNA RNA_MaskLayer;
extern StructRNA RNA_Menu;
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 4d3e3ffca26..b293f20dd95 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -313,31 +313,6 @@ static void rna_MaterialTextureSlot_use_set(PointerRNA *ptr, int value)
}
}
-static StructRNA *rna_MaterialEngineSettings_refine(PointerRNA *ptr)
-{
-#ifdef WITH_CLAY_ENGINE
- MaterialEngineSettings *mes = (MaterialEngineSettings *)ptr->data;
- if (STREQ(mes->name, RE_engine_id_BLENDER_CLAY)) {
- return &RNA_MaterialEngineSettingsClay;
- }
-#endif
- return &RNA_MaterialEngineSettings;
-}
-
-static void rna_Material_update_engine_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
-{
-#if 0
- Material *ma = (Material *)ptr->data;
- RenderEngineSettings *ed = DRW_material_settings_get(ma, sce->r.engine, NULL);
-
- if (ed->runtime) {
- MEM_freeN(ed->runtime);
- ed->runtime = NULL;
- }
-#endif
- WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL);
-}
-
static void rna_Material_use_diffuse_ramp_set(PointerRNA *ptr, int value)
{
Material *ma = (Material *)ptr->data;
@@ -849,118 +824,6 @@ static void rna_def_material_mtex(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Material_update");
}
-static void rna_def_material_settings_clay(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static EnumPropertyItem clay_matcap_items[] = {
- {ICON_MATCAP_01, "01", ICON_MATCAP_01, "", ""},
- {ICON_MATCAP_02, "02", ICON_MATCAP_02, "", ""},
- {ICON_MATCAP_03, "03", ICON_MATCAP_03, "", ""},
- {ICON_MATCAP_04, "04", ICON_MATCAP_04, "", ""},
- {ICON_MATCAP_05, "05", ICON_MATCAP_05, "", ""},
- {ICON_MATCAP_06, "06", ICON_MATCAP_06, "", ""},
- {ICON_MATCAP_07, "07", ICON_MATCAP_07, "", ""},
- {ICON_MATCAP_08, "08", ICON_MATCAP_08, "", ""},
- {ICON_MATCAP_09, "09", ICON_MATCAP_09, "", ""},
- {ICON_MATCAP_10, "10", ICON_MATCAP_10, "", ""},
- {ICON_MATCAP_11, "11", ICON_MATCAP_11, "", ""},
- {ICON_MATCAP_12, "12", ICON_MATCAP_12, "", ""},
- {ICON_MATCAP_13, "13", ICON_MATCAP_13, "", ""},
- {ICON_MATCAP_14, "14", ICON_MATCAP_14, "", ""},
- {ICON_MATCAP_15, "15", ICON_MATCAP_15, "", ""},
- {ICON_MATCAP_16, "16", ICON_MATCAP_16, "", ""},
- {ICON_MATCAP_17, "17", ICON_MATCAP_17, "", ""},
- {ICON_MATCAP_18, "18", ICON_MATCAP_18, "", ""},
- {ICON_MATCAP_19, "19", ICON_MATCAP_19, "", ""},
- {ICON_MATCAP_20, "20", ICON_MATCAP_20, "", ""},
- {ICON_MATCAP_21, "21", ICON_MATCAP_21, "", ""},
- {ICON_MATCAP_22, "22", ICON_MATCAP_22, "", ""},
- {ICON_MATCAP_23, "23", ICON_MATCAP_23, "", ""},
- {ICON_MATCAP_24, "24", ICON_MATCAP_24, "", ""},
- {0, NULL, 0, NULL, NULL}
- };
-
- static EnumPropertyItem clay_matcap_type[] = {
- {CLAY_MATCAP_NONE, "NONE", 0, "Scene", "Use default scene matcap"},
- {CLAY_MATCAP_SIMPLE, "SIMPLE", 0, "Simple", "Let you choose the texture to use with the default settings"},
- {CLAY_MATCAP_COMPLETE, "COMPLETE", 0, "Complete", "Expose all settings"},
- {0, NULL, 0, NULL, NULL}
- };
-
- srna = RNA_def_struct(brna, "MaterialEngineSettingsClay", "MaterialEngineSettings");
- RNA_def_struct_ui_text(srna, "Material Clay Settings", "Clay Engine settings for a Material data-block");
- RNA_def_struct_sdna_from(srna, "MaterialEngineSettingsClay", "data");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, clay_matcap_type);
- RNA_def_property_ui_text(prop, "Settings Type", "What settings to use for this material");
- RNA_def_property_update(prop, 0, "rna_Material_update_engine_data");
-
- prop = RNA_def_property(srna, "matcap_icon", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, clay_matcap_items);
- RNA_def_property_ui_text(prop, "Matcap", "Image to use for Material Capture by this material");
- RNA_def_property_update(prop, 0, "rna_Material_update_engine_data");
-
- prop = RNA_def_property(srna, "matcap_rotation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "matcap_rot");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Matcap Rotation", "Orientation of the matcap on the model");
- RNA_def_property_update(prop, 0, "rna_Material_update_engine_data");
-
- prop = RNA_def_property(srna, "matcap_hue", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Matcap Hue shift", "Hue correction of the matcap");
- RNA_def_property_update(prop, 0, "rna_Material_update_engine_data");
-
- prop = RNA_def_property(srna, "matcap_saturation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "matcap_sat");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Matcap Saturation", "Saturation correction of the matcap");
- RNA_def_property_update(prop, 0, "rna_Material_update_engine_data");
-
- prop = RNA_def_property(srna, "matcap_value", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "matcap_val");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Matcap Value", "Value correction of the matcap");
- RNA_def_property_update(prop, 0, "rna_Material_update_engine_data");
-
- prop = RNA_def_property(srna, "ssao_factor_cavity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Cavity Strength", "Strength of the Cavity effect");
- RNA_def_property_range(prop, 0.0f, 250.0f);
- RNA_def_property_update(prop, 0, "rna_Material_update_engine_data");
-
- prop = RNA_def_property(srna, "ssao_factor_edge", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Edge Strength", "Strength of the Edge effect");
- RNA_def_property_range(prop, 0.0f, 250.0f);
- RNA_def_property_update(prop, 0, "rna_Material_update_engine_data");
-
- prop = RNA_def_property(srna, "ssao_distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Distance", "Distance of object that contribute to the Cavity/Edge effect");
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_update(prop, 0, "rna_Material_update_engine_data");
-
- prop = RNA_def_property(srna, "ssao_attenuation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Attenuation", "Attenuation constant");
- RNA_def_property_range(prop, 1.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
- RNA_def_property_update(prop, 0, "rna_Material_update_engine_data");
-}
-
-static void rna_def_material_engine_settings(BlenderRNA *brna)
-{
- StructRNA *srna;
-
- srna = RNA_def_struct(brna, "MaterialEngineSettings", NULL);
- RNA_def_struct_ui_text(srna, "Engine Settings", "Engine specific settings");
- RNA_def_struct_sdna(srna, "MaterialEngineSettings");
- RNA_def_struct_refine_func(srna, "rna_MaterialEngineSettings_refine");
-
- rna_def_material_settings_clay(brna);
-}
-
static void rna_def_material_gamesettings(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2224,11 +2087,6 @@ void RNA_def_material(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "MaterialGameSettings");
RNA_def_property_ui_text(prop, "Game Settings", "Game material settings");
- /* Engine settings */
- prop = RNA_def_property(srna, "engines_settings", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "MaterialEngineSettings");
- RNA_def_property_ui_text(prop, "Material Engine Settings", "Engine specific settings");
-
/* nodetree */
prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
@@ -2278,7 +2136,6 @@ void RNA_def_material(BlenderRNA *brna)
rna_def_material_strand(brna);
rna_def_material_physics(brna);
rna_def_material_gamesettings(brna);
- rna_def_material_engine_settings(brna);
RNA_api_material(srna);
}
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index 5f796261c73..36de2b85619 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -261,19 +261,18 @@ static void engine_update_script_node(RenderEngine *engine, struct bNodeTree *nt
RNA_parameter_list_free(&list);
}
-static void engine_collection_settings_create(RenderEngine *engine, struct CollectionEngineSettings *ces)
+static void engine_collection_settings_create(RenderEngine *engine, struct IDProperty *props)
{
extern FunctionRNA rna_RenderEngine_collection_settings_create_func;
- PointerRNA ptr,cesptr;
+ PointerRNA ptr;
ParameterList list;
FunctionRNA *func;
RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
- RNA_pointer_create(NULL, &RNA_CollectionEngineSettings, ces, &cesptr);
func = &rna_RenderEngine_collection_settings_create_func;
RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "collection_settings", &cesptr);
+ RNA_parameter_set_lookup(&list, "props", &props);
engine->type->ext.call(NULL, &ptr, func, &list);
RNA_parameter_list_free(&list);
@@ -512,7 +511,7 @@ static void rna_def_render_engine(BlenderRNA *brna)
func = RNA_def_function(srna, "collection_settings_create", NULL);
RNA_def_function_ui_description(func, "Create the per collection settings for the engine");
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "collection_settings", "CollectionEngineSettings", "", "");
+ parm = RNA_def_pointer(func, "collection_settings", "LayerCollectionSettings", "", "");
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
/* tag for redraw */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 1108f2b7cb5..46bfc58f2ad 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1903,41 +1903,30 @@ static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value)
gm->exitkey = value;
}
-static StructRNA *rna_RenderEngineSettings_refine(PointerRNA *ptr)
+static StructRNA *rna_LayerCollectionSettings_refine(PointerRNA *ptr)
{
-#ifdef WITH_CLAY_ENGINE
- RenderEngineSettings *res = (RenderEngineSettings *)ptr->data;
+ IDProperty *props = (IDProperty *)ptr->data;
+ BLI_assert(props && props->type == IDP_GROUP);
- if (STREQ(res->name, RE_engine_id_BLENDER_CLAY)) {
- return &RNA_RenderEngineSettingsClay;
- }
+ switch (props->subtype) {
+ case IDP_GROUP_SUB_ENGINE_RENDER:
+#ifdef WITH_CLAY_ENGINE
+ if (STREQ(props->name, RE_engine_id_BLENDER_CLAY)) {
+ return &RNA_LayerCollectionEngineSettingsClay;
+ }
#endif
- return &RNA_RenderEngineSettings;
-}
-
-static PointerRNA rna_RenderEngineSettings_active_get(PointerRNA *ptr)
-{
- Scene *scene = (Scene *)ptr->data;
- RenderEngineSettings *res;
-
- /* Ensure settings exists */
- DRW_render_settings_get(scene, scene->r.engine);
-
- res = BLI_findstring(&scene->engines_settings, scene->r.engine, offsetof(RenderEngineSettings, name));
-
- return rna_pointer_inherit_refine(ptr, &RNA_RenderEngineSettings, res);
-}
-
-static void rna_RenderEngineSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
-{
- Scene *sce = (Scene *)ptr->id.data;
- MaterialEngineSettingsClay *res;
-
- res = (MaterialEngineSettingsClay *)DRW_render_settings_get(sce, sce->r.engine);
-
- res->flag = CLAY_OUTDATED;
+ break;
+ case IDP_GROUP_SUB_MODE_OBJECT:
+ return &RNA_LayerCollectionModeSettingsObject;
+ break;
+ case IDP_GROUP_SUB_MODE_EDIT:
+ return &RNA_LayerCollectionModeSettingsEdit;
+ break;
+ default:
+ break;
+ }
- WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ return &RNA_LayerCollectionSettings;
}
static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[], int frame)
@@ -2397,65 +2386,18 @@ static void rna_SceneCollection_object_unlink(
/****** layer collection engine settings *******/
-static StructRNA *rna_CollectionEngineSettings_refine(struct PointerRNA *ptr)
-{
- CollectionEngineSettings *ces = (CollectionEngineSettings *)ptr->data;
-
- if (STREQ(ces->name, "BLENDER_CLAY")) {
- return &RNA_CollectionEngineSettingsClay;
- }
-
- /* TODO - handle other engines */
- TODO_LAYER;
- (void) ces;
-
- return &RNA_CollectionEngineSettings;
-}
-
-static StructRNA *rna_CollectionModeSettings_refine(struct PointerRNA *ptr)
-{
- CollectionEngineSettings *ces = (CollectionEngineSettings *)ptr->data;
-
- switch(ces->type) {
- case COLLECTION_MODE_OBJECT:
- return &RNA_CollectionModeSettingsObject;
- break;
- case COLLECTION_MODE_EDIT:
- return &RNA_CollectionModeSettingsEdit;
- break;
- }
-
- return &RNA_CollectionModeSettings;
-}
-
-/****** clay engine settings *******/
-
-#define RNA_LAYER_ENGINE_USE_GET_SET(_ENGINE_, _NAME_) \
- static int rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_use_get(PointerRNA *ptr) \
- { \
- CollectionEngineSettings *ces = (CollectionEngineSettings *)ptr->data; \
- return BKE_collection_engine_property_use_get(ces, #_NAME_) ? 1 : 0; \
- } \
- \
- static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_use_set(PointerRNA *ptr, int value) \
- { \
- CollectionEngineSettings *ces = (CollectionEngineSettings *)ptr->data; \
- BKE_collection_engine_property_use_set(ces, #_NAME_, value? true : false); \
- }
-
#define RNA_LAYER_ENGINE_GET_SET(_TYPE_, _ENGINE_, _MODE_, _NAME_) \
-static _TYPE_ rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr) \
+static _TYPE_ rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr) \
{ \
- CollectionEngineSettings *ces = (CollectionEngineSettings *)ptr->data; \
- return BKE_collection_engine_property_value_get_##_TYPE_(ces, #_NAME_); \
+ IDProperty *props = (IDProperty *)ptr->data; \
+ return BKE_collection_engine_property_value_get_##_TYPE_(props, #_NAME_); \
} \
\
static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr, _TYPE_ value) \
{ \
- CollectionEngineSettings *ces = (CollectionEngineSettings *)ptr->data; \
- BKE_collection_engine_property_value_set_##_TYPE_(ces, #_NAME_, value); \
+ IDProperty *props = (IDProperty *)ptr->data; \
+ BKE_collection_engine_property_value_set_##_TYPE_(props, #_NAME_, value); \
} \
- RNA_LAYER_ENGINE_USE_GET_SET(_ENGINE_, _NAME_)
#define RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(_NAME_) \
RNA_LAYER_ENGINE_GET_SET(float, Clay, COLLECTION_MODE_NONE, _NAME_)
@@ -2487,7 +2429,6 @@ static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr,
RNA_LAYER_ENGINE_GET_SET(bool, EditMode, COLLECTION_MODE_EDIT, _NAME_)
/* clay engine */
-RNA_LAYER_ENGINE_CLAY_GET_SET_INT(type)
RNA_LAYER_ENGINE_CLAY_GET_SET_INT(matcap_icon)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(matcap_rotation)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(matcap_hue)
@@ -2511,9 +2452,8 @@ RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(normals_length)
RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(backwire_opacity)
#undef RNA_LAYER_ENGINE_GET_SET
-#undef RNA_LAYER_ENGINE_USE_GET_SET
-static void rna_CollectionEngineSettings_update(bContext *C, PointerRNA *UNUSED(ptr))
+static void rna_LayerCollectionEngineSettings_update(bContext *C, PointerRNA *UNUSED(ptr))
{
SceneLayer *sl = CTX_data_scene_layer(C);
LayerCollection *lc = CTX_data_layer_collection(C);
@@ -2522,6 +2462,18 @@ static void rna_CollectionEngineSettings_update(bContext *C, PointerRNA *UNUSED(
/***********************************/
+static void rna_LayerCollectionSettings_name_get(PointerRNA *ptr, char *value)
+{
+ IDProperty *props = (IDProperty *)ptr->data;
+ strcpy(value, props->name);
+}
+
+static int rna_LayerCollectionSettings_name_length(PointerRNA *ptr)
+{
+ IDProperty *props = (IDProperty *)ptr->data;
+ return strnlen(props->name, sizeof(props->name));
+}
+
static void rna_LayerCollection_name_get(PointerRNA *ptr, char *value)
{
SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection;
@@ -2548,49 +2500,6 @@ static PointerRNA rna_LayerCollection_objects_get(CollectionPropertyIterator *it
return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object);
}
-static PointerRNA rna_LayerCollection_engine_settings_get(ID *UNUSED(id), LayerCollection *lc, bContext *C, const char *engine)
-{
- Scene *scene = CTX_data_scene(C);
- const char *engine_name;
-
- if (STREQ(engine, NO_ENGINE)) {
- RenderData *rd = &scene->r;
- engine_name = rd->engine;
- }
- else {
- engine_name = engine;
- }
-
- PointerRNA ptr;
- CollectionEngineSettings *ces = BKE_layer_collection_engine_get(lc, COLLECTION_MODE_NONE, engine_name);
- RNA_pointer_create(NULL, &RNA_CollectionEngineSettings, ces, &ptr);
- return rna_pointer_inherit_refine(&ptr, &RNA_CollectionEngineSettings, ces);
-}
-
-static PointerRNA rna_LayerCollection_mode_settings_get(ID *UNUSED(id), LayerCollection *lc, bContext *C, int type)
-{
- if (type == COLLECTION_MODE_NONE) {
- /* temporarily get mode from active object */
- Object *ob = CTX_data_active_object(C);
-
- if (ob) {
- switch (ob->mode) {
- case OB_MODE_OBJECT:
- type = COLLECTION_MODE_OBJECT;
- break;
- case OB_MODE_EDIT:
- type = COLLECTION_MODE_EDIT;
- break;
- }
- }
- }
-
- PointerRNA ptr;
- CollectionEngineSettings *ces = BKE_layer_collection_engine_get(lc, type, "");
- RNA_pointer_create(NULL, &RNA_CollectionEngineSettings, ces, &ptr);
- return rna_pointer_inherit_refine(&ptr, &RNA_CollectionModeSettings, ces);
-}
-
static int rna_LayerCollection_move_above(ID *id, LayerCollection *lc_src, LayerCollection *lc_dst)
{
Scene *scene = (Scene *)id;
@@ -2895,7 +2804,6 @@ static void rna_ObjectBase_select_update(Main *UNUSED(bmain), Scene *UNUSED(scen
short mode = (base->flag & BASE_SELECTED) ? BA_SELECT : BA_DESELECT;
ED_object_base_select(base, mode);
}
-
#else
/* Grease Pencil Interpolation tool settings */
@@ -5903,23 +5811,7 @@ static void rna_def_layer_collection_override(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL);
}
-#define RNA_LAYER_ENGINE_USE(_ENGINE_, _NAME_) \
- prop = RNA_def_property(srna, #_NAME_"_use", PROP_BOOLEAN, PROP_NONE); \
- RNA_def_property_boolean_funcs(prop, \
- "rna_LayerEngineSettings_"#_ENGINE_"_"#_NAME_"_use_get", \
- "rna_LayerEngineSettings_"#_ENGINE_"_"#_NAME_"_use_set"); \
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); \
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
-
-#define RNA_LAYER_ENGINE_CLAY_USE(_NAME_) \
- RNA_LAYER_ENGINE_USE(Clay, _NAME_)
-
-#define RNA_LAYER_MODE_OBJECT_USE(_NAME_) \
- RNA_LAYER_ENGINE_USE(ObjectMode, _NAME_)
-
-#define RNA_LAYER_MODE_EDIT_USE(_NAME_) \
- RNA_LAYER_ENGINE_USE(EditMode, _NAME_)
-
+#ifdef WITH_CLAY_ENGINE
static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna)
{
StructRNA *srna;
@@ -5953,87 +5845,60 @@ static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
- static EnumPropertyItem clay_matcap_type[] = {
- {CLAY_MATCAP_NONE, "NONE", 0, "Scene", "Use default scene matcap"},
- {CLAY_MATCAP_SIMPLE, "SIMPLE", 0, "Simple", "Let you choose the texture to use with the default settings"},
- {CLAY_MATCAP_COMPLETE, "COMPLETE", 0, "Complete", "Expose all settings"},
- {0, NULL, 0, NULL, NULL}
- };
-
- srna = RNA_def_struct(brna, "CollectionEngineSettingsClay", NULL);
- RNA_def_struct_sdna(srna, "CollectionEngineSettings");
+ srna = RNA_def_struct(brna, "LayerCollectionEngineSettingsClay", NULL);
RNA_def_struct_ui_text(srna, "Collections Clay Engine Settings", "Engine specific settings for this collection");
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Engine name");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_struct_name_property(srna, prop);
+ RNA_define_verify_sdna(0); /* not in sdna */
/* see RNA_LAYER_ENGINE_GET_SET macro */
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Clay_type_get", "rna_LayerEngineSettings_Clay_type_set", NULL);
- RNA_def_property_enum_items(prop, clay_matcap_type);
- RNA_def_property_ui_text(prop, "Settings Type", "What settings to use for this material");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_CLAY_USE(type)
-
prop = RNA_def_property(srna, "matcap_icon", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Clay_matcap_icon_get", "rna_LayerEngineSettings_Clay_matcap_icon_set", NULL);
RNA_def_property_enum_items(prop, clay_matcap_items);
RNA_def_property_ui_text(prop, "Matcap", "Image to use for Material Capture by this material");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_CLAY_USE(matcap_icon)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "matcap_rotation", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_matcap_rotation_get", "rna_LayerEngineSettings_Clay_matcap_rotation_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Rotation", "Orientation of the matcap on the model");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_CLAY_USE(matcap_rotation)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "matcap_hue", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_matcap_hue_get", "rna_LayerEngineSettings_Clay_matcap_hue_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Hue shift", "Hue correction of the matcap");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_CLAY_USE(matcap_hue)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "matcap_saturation", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_matcap_saturation_get", "rna_LayerEngineSettings_Clay_matcap_saturation_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Saturation", "Saturation correction of the matcap");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_CLAY_USE(matcap_saturation)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "matcap_value", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_matcap_value_get", "rna_LayerEngineSettings_Clay_matcap_value_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Value", "Value correction of the matcap");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_CLAY_USE(matcap_value)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "ssao_factor_cavity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_factor_cavity_get", "rna_LayerEngineSettings_Clay_ssao_factor_cavity_set", NULL);
RNA_def_property_ui_text(prop, "Cavity Strength", "Strength of the Cavity effect");
RNA_def_property_range(prop, 0.0f, 250.0f);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_CLAY_USE(ssao_factor_cavity)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "ssao_factor_edge", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_factor_edge_get", "rna_LayerEngineSettings_Clay_ssao_factor_edge_set", NULL);
RNA_def_property_ui_text(prop, "Edge Strength", "Strength of the Edge effect");
RNA_def_property_range(prop, 0.0f, 250.0f);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_CLAY_USE(ssao_factor_edge)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "ssao_distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_distance_get", "rna_LayerEngineSettings_Clay_ssao_distance_set", NULL);
@@ -6041,8 +5906,7 @@ static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0f, 100000.0f);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_CLAY_USE(ssao_distance)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "ssao_attenuation", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_attenuation_get", "rna_LayerEngineSettings_Clay_ssao_attenuation_set", NULL);
@@ -6050,36 +5914,20 @@ static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna)
RNA_def_property_range(prop, 1.0f, 100000.0f);
RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_CLAY_USE(ssao_attenuation)
-}
-
-static void rna_def_layer_collection_engine_settings(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "CollectionEngineSettings", NULL);
- RNA_def_struct_ui_text(srna, "Collections Engine Settings", "Engine specific settings for this collection");
- RNA_def_struct_refine_func(srna, "rna_CollectionEngineSettings_refine");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Engine name");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
- /* the engine specific structs */
- rna_def_layer_collection_engine_settings_clay(brna);
+ RNA_define_verify_sdna(1); /* not in sdna */
}
+#endif /* WITH_CLAY_ENGINE */
static void rna_def_layer_collection_mode_settings_object(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "CollectionModeSettingsObject", NULL);
- RNA_def_struct_sdna(srna, "CollectionEngineSettings");
+ srna = RNA_def_struct(brna, "LayerCollectionModeSettingsObject", "LayerCollectionSettings");
RNA_def_struct_ui_text(srna, "Collections Object Mode Settings", "Object Mode specific settings for this collection");
+ RNA_define_verify_sdna(0); /* not in sdna */
/* see RNA_LAYER_ENGINE_GET_SET macro */
@@ -6087,15 +5935,15 @@ static void rna_def_layer_collection_mode_settings_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Wire", "Add the object's wireframe over solid drawing");
RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_ObjectMode_show_wire_get", "rna_LayerEngineSettings_ObjectMode_show_wire_set");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_MODE_OBJECT_USE(show_wire)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "show_backface_culling", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Backface Culling", "");
RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_ObjectMode_show_backface_culling_get", "rna_LayerEngineSettings_ObjectMode_show_backface_culling_set");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_MODE_OBJECT_USE(show_backface_culling)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
+
+ RNA_define_verify_sdna(1); /* not in sdna */
}
static void rna_def_layer_collection_mode_settings_edit(BlenderRNA *brna)
@@ -6103,9 +5951,9 @@ static void rna_def_layer_collection_mode_settings_edit(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "CollectionModeSettingsEdit", NULL);
- RNA_def_struct_sdna(srna, "CollectionEngineSettings");
- RNA_def_struct_ui_text(srna, "Collections Edit Mode Settings", "Edit Mode specific settings for this collection");
+ srna = RNA_def_struct(brna, "LayerCollectionModeSettingsEdit", "LayerCollectionSettings");
+ RNA_def_struct_ui_text(srna, "Collections Edit Mode Settings", "Edit Mode specific settings to be overridden per collection");
+ RNA_define_verify_sdna(0); /* not in sdna */
/* see RNA_LAYER_ENGINE_GET_SET macro */
@@ -6113,29 +5961,25 @@ static void rna_def_layer_collection_mode_settings_edit(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display");
RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_show_occlude_wire_get", "rna_LayerEngineSettings_EditMode_show_occlude_wire_set");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_MODE_EDIT_USE(show_occlude_wire)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "face_normals_show", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Draw Normals", "Display face normals as lines");
RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_face_normals_show_get", "rna_LayerEngineSettings_EditMode_face_normals_show_set");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_MODE_EDIT_USE(face_normals_show)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "vert_normals_show", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Display vertex normals as lines");
RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_vert_normals_show_get", "rna_LayerEngineSettings_EditMode_vert_normals_show_set");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_MODE_EDIT_USE(vert_normals_show)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "loop_normals_show", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Draw Split Normals", "Display vertex-per-face normals as lines");
RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_loop_normals_show_get", "rna_LayerEngineSettings_EditMode_loop_normals_show_set");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_MODE_EDIT_USE(loop_normals_show)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "normals_length", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view");
@@ -6143,43 +5987,45 @@ static void rna_def_layer_collection_mode_settings_edit(BlenderRNA *brna)
RNA_def_property_range(prop, 0.00001, 1000.0);
RNA_def_property_ui_range(prop, 0.01, 10.0, 10.0, 2);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_MODE_EDIT_USE(normals_length)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "backwire_opacity", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Backwire Opacity", "Opacity when rendering transparent wires");
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_EditMode_backwire_opacity_get", "rna_LayerEngineSettings_EditMode_backwire_opacity_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_MODE_EDIT_USE(backwire_opacity)
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update");
+
+ RNA_define_verify_sdna(1); /* not in sdna */
}
-static void rna_def_layer_collection_mode_settings(BlenderRNA *brna)
+static void rna_def_layer_collection_settings(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "CollectionModeSettings", NULL);
- RNA_def_struct_sdna(srna, "CollectionEngineSettings");
- RNA_def_struct_ui_text(srna, "Collections Mode Settings", "Mode specific settings for this collection");
- RNA_def_struct_refine_func(srna, "rna_CollectionModeSettings_refine");
+ srna = RNA_def_struct(brna, "LayerCollectionSettings", NULL);
+ RNA_def_struct_ui_text(srna, "Layer Collection Settings",
+ "Engine specific settings that can be overriden by LayerCollection");
+ RNA_def_struct_refine_func(srna, "rna_LayerCollectionSettings_refine");
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_layer_collection_mode_settings_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
+ RNA_define_verify_sdna(0);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_LayerCollectionSettings_name_get", "rna_LayerCollectionSettings_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Engine Name");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
+
+#ifdef WITH_CLAY_ENGINE
+ rna_def_layer_collection_engine_settings_clay(brna);
+#endif
- /* the modes specific structs */
rna_def_layer_collection_mode_settings_object(brna);
rna_def_layer_collection_mode_settings_edit(brna);
-}
-#undef RNA_LAYER_MODE_EDIT_USE
-#undef RNA_LAYER_MODE_OBJECT_USE
-#undef RNA_LAYER_ENGINE_CLAY_USE
-#undef RNA_LAYER_ENGINE_USE
+ RNA_define_verify_sdna(1);
+}
static void rna_def_layer_collection(BlenderRNA *brna)
{
@@ -6220,25 +6066,13 @@ static void rna_def_layer_collection(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "LayerCollectionOverride");
RNA_def_property_ui_text(prop, "Collection Overrides", "");
- /* Functions */
- func = RNA_def_function(srna, "get_engine_settings", "rna_LayerCollection_engine_settings_get");
- RNA_def_function_ui_description(func, "Return the engine settings for this collection");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_CONTEXT);
- parm = RNA_def_string(func, "engine", NO_ENGINE, MAX_NAME, "Engine", "use context one by default");
- RNA_def_parameter_clear_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "result", "CollectionEngineSettings", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "get_mode_settings", "rna_LayerCollection_mode_settings_get");
- RNA_def_function_ui_description(func, "Return the mode settings for this collection");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_CONTEXT);
- parm = RNA_def_enum(func, "type", rna_enum_layer_collection_mode_settings_type_items, COLLECTION_MODE_NONE, "Mode", "use context one by default");
- RNA_def_parameter_clear_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "result", "CollectionEngineSettings", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
+ /* Override settings */
+ prop = RNA_def_property(srna, "engine_overrides", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "properties->data.group", NULL);
+ RNA_def_property_struct_type(prop, "LayerCollectionSettings");
+ RNA_def_property_ui_text(prop, "Collection Settings", "Override of engine specific render settings");
+ /* Functions */
func = RNA_def_function(srna, "move_above", "rna_LayerCollection_move_above");
RNA_def_function_ui_description(func, "Move collection after another");
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
@@ -7203,113 +7037,25 @@ static void rna_def_scene_quicktime_settings(BlenderRNA *brna)
#endif
#ifdef WITH_CLAY_ENGINE
-static void rna_def_render_engine_settings_clay(BlenderRNA *brna)
+static void UNUSED_FUNCTION(rna_def_scene_engine_settings_clay)(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem clay_matcap_items[] = {
- {ICON_MATCAP_01, "01", ICON_MATCAP_01, "", ""},
- {ICON_MATCAP_02, "02", ICON_MATCAP_02, "", ""},
- {ICON_MATCAP_03, "03", ICON_MATCAP_03, "", ""},
- {ICON_MATCAP_04, "04", ICON_MATCAP_04, "", ""},
- {ICON_MATCAP_05, "05", ICON_MATCAP_05, "", ""},
- {ICON_MATCAP_06, "06", ICON_MATCAP_06, "", ""},
- {ICON_MATCAP_07, "07", ICON_MATCAP_07, "", ""},
- {ICON_MATCAP_08, "08", ICON_MATCAP_08, "", ""},
- {ICON_MATCAP_09, "09", ICON_MATCAP_09, "", ""},
- {ICON_MATCAP_10, "10", ICON_MATCAP_10, "", ""},
- {ICON_MATCAP_11, "11", ICON_MATCAP_11, "", ""},
- {ICON_MATCAP_12, "12", ICON_MATCAP_12, "", ""},
- {ICON_MATCAP_13, "13", ICON_MATCAP_13, "", ""},
- {ICON_MATCAP_14, "14", ICON_MATCAP_14, "", ""},
- {ICON_MATCAP_15, "15", ICON_MATCAP_15, "", ""},
- {ICON_MATCAP_16, "16", ICON_MATCAP_16, "", ""},
- {ICON_MATCAP_17, "17", ICON_MATCAP_17, "", ""},
- {ICON_MATCAP_18, "18", ICON_MATCAP_18, "", ""},
- {ICON_MATCAP_19, "19", ICON_MATCAP_19, "", ""},
- {ICON_MATCAP_20, "20", ICON_MATCAP_20, "", ""},
- {ICON_MATCAP_21, "21", ICON_MATCAP_21, "", ""},
- {ICON_MATCAP_22, "22", ICON_MATCAP_22, "", ""},
- {ICON_MATCAP_23, "23", ICON_MATCAP_23, "", ""},
- {ICON_MATCAP_24, "24", ICON_MATCAP_24, "", ""},
- {0, NULL, 0, NULL, NULL}
- };
-
- srna = RNA_def_struct(brna, "RenderEngineSettingsClay", "RenderEngineSettings");
- RNA_def_struct_ui_text(srna, "Material Clay Settings", "Clay Engine settings for a Material data-block");
- RNA_def_struct_sdna_from(srna, "RenderEngineSettingsClay", "data");
-
- prop = RNA_def_property(srna, "matcap_icon", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, clay_matcap_items);
- RNA_def_property_ui_text(prop, "Matcap", "Image to use for Material Capture by this material");
- RNA_def_property_update(prop, 0, "rna_RenderEngineSettings_update");
-
- prop = RNA_def_property(srna, "matcap_rotation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "matcap_rot");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Matcap Rotation", "Orientation of the matcap on the model");
- RNA_def_property_update(prop, 0, "rna_RenderEngineSettings_update");
-
- prop = RNA_def_property(srna, "matcap_hue", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Matcap Hue shift", "Hue correction of the matcap");
- RNA_def_property_update(prop, 0, "rna_RenderEngineSettings_update");
-
- prop = RNA_def_property(srna, "matcap_saturation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "matcap_sat");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Matcap Saturation", "Saturation correction of the matcap");
- RNA_def_property_update(prop, 0, "rna_RenderEngineSettings_update");
-
- prop = RNA_def_property(srna, "matcap_value", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "matcap_val");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Matcap Value", "Value correction of the matcap");
- RNA_def_property_update(prop, 0, "rna_RenderEngineSettings_update");
-
- prop = RNA_def_property(srna, "ssao_factor_cavity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Cavity Strength", "Strength of the Cavity effect");
- RNA_def_property_range(prop, 0.0f, 250.0f);
- RNA_def_property_update(prop, 0, "rna_RenderEngineSettings_update");
-
- prop = RNA_def_property(srna, "ssao_factor_edge", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Edge Strength", "Strength of the Edge effect");
- RNA_def_property_range(prop, 0.0f, 250.0f);
- RNA_def_property_update(prop, 0, "rna_RenderEngineSettings_update");
- prop = RNA_def_property(srna, "ssao_distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Distance", "Distance of object that contribute to the Cavity/Edge effect");
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_update(prop, 0, "rna_RenderEngineSettings_update");
+ srna = RNA_def_struct(brna, "SceneEngineSettingsClay", "SceneEngineSettings");
+ RNA_def_struct_ui_text(srna, "Clay Scene Settings", "Clay Engine settings");
- prop = RNA_def_property(srna, "ssao_attenuation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Attenuation", "Attenuation constant");
- RNA_def_property_range(prop, 1.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
- RNA_def_property_update(prop, 0, "rna_RenderEngineSettings_update");
+ RNA_define_verify_sdna(0); /* not in sdna */
/* Clay settings */
prop = RNA_def_property(srna, "ssao_samples", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(prop, "Samples", "Number of samples");
RNA_def_property_range(prop, 1, 500);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-}
-#endif
-
-static void rna_def_scene_render_engine(BlenderRNA *brna)
-{
- StructRNA *srna;
-
- srna = RNA_def_struct(brna, "RenderEngineSettings", NULL);
- RNA_def_struct_ui_text(srna, "Render Engine Settings", "Engine specific render settings");
- RNA_def_struct_sdna(srna, "RenderEngineSettings");
- RNA_def_struct_refine_func(srna, "rna_RenderEngineSettings_refine");
-#ifdef WITH_CLAY_ENGINE
- rna_def_render_engine_settings_clay(brna);
-#endif
+ RNA_define_verify_sdna(1); /* not in sdna */
}
+#endif /* WITH_CLAY_ENGINE */
static void rna_def_scene_render_data(BlenderRNA *brna)
{
@@ -8827,14 +8573,11 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Render Data", "");
/* Render Engine Data */
- prop = RNA_def_property(srna, "engines_settings", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "RenderEngineSettings");
- RNA_def_property_ui_text(prop, "Render Engine Settings", "Engine specific render settings");
-
- prop = RNA_def_property(srna, "active_engine_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "RenderEngineSettings");
- RNA_def_property_pointer_funcs(prop, "rna_RenderEngineSettings_active_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Render Engine Settings", "Active Engine specific render settings for this scene");
+ prop = RNA_def_property(srna, "collection_properties", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "collection_properties->data.group", NULL);
+ RNA_def_property_struct_type(prop, "LayerCollectionSettings");
+ RNA_def_property_ui_text(prop, "Collection Settings",
+ "Engine specific render settings to be overridden by collections");
/* Safe Areas */
prop = RNA_def_property(srna, "safe_areas", PROP_POINTER, PROP_NONE);
@@ -8982,14 +8725,12 @@ void RNA_def_scene(BlenderRNA *brna)
rna_def_scene_collection(brna);
rna_def_layer_collection(brna);
rna_def_layer_collection_override(brna);
- rna_def_layer_collection_engine_settings(brna);
- rna_def_layer_collection_mode_settings(brna);
rna_def_scene_layer(brna);
rna_def_object_base(brna);
RNA_define_animate_sdna(true);
/* *** Animated *** */
+ rna_def_layer_collection_settings(brna);
rna_def_scene_render_data(brna);
- rna_def_scene_render_engine(brna);
rna_def_scene_render_layer(brna);
rna_def_gpu_fx(brna);
rna_def_scene_render_view(brna);
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 46775af21db..6ef4bc6a371 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -888,6 +888,15 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ func = RNA_def_function(srna, "template_override_property", "uiTemplateOverrideProperty");
+ parm = RNA_def_pointer(func, "collection_render_overrides", "AnyType", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_pointer(func, "scene_collection_properties", "AnyType", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in collection_properties");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "custom_template", NULL, 0, "", "Optional template to use for property");
+
func = RNA_def_function(srna, "template_component_menu", "uiTemplateComponentMenu");
RNA_def_function_ui_description(func, "Item. Display expanded property in a popup menu");
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h
index 74d96ce69d1..bac3b5982c4 100644
--- a/source/blender/render/extern/include/RE_engine.h
+++ b/source/blender/render/extern/include/RE_engine.h
@@ -39,7 +39,7 @@
struct bNode;
struct bNodeTree;
-struct CollectionEngineSettings;
+struct IDProperty;
struct Main;
struct Object;
struct Render;
@@ -100,7 +100,7 @@ typedef struct RenderEngineType {
void (*update_script_node)(struct RenderEngine *engine, struct bNodeTree *ntree, struct bNode *node);
- void (*collection_settings_create)(struct RenderEngine *engine, struct CollectionEngineSettings *ces);
+ void (*collection_settings_create)(struct RenderEngine *engine, struct IDProperty *props);
struct DrawEngineType *draw_engine;