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-02-12 22:43:06 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-02-12 22:47:34 +0300
commitadf355849f5c68bf504ba435cc54872b2e2ee87a (patch)
treef625dea79bf5e5a04cd9f0b0cb1b035e10fa8167 /source/blender/makesrna
parentb104057d001d2472cc55c7fa51cff3275e331523 (diff)
Layers: Per-Collection edit mode settings
I didn't manage to get the proper object context in the collection properties editor. That said I got it working for now in a temporary way since this will change once we get workspaces anyways (see changes in buttons_context.c and rna_scene.c::rna_LayerCollection_mode_settings_get) I still need to handle the merging of the settings. I will find a provisory solution while we wait for depsgraph. (also layer_collection_create_mode_settings_object and layer_collection_create_mode_settings_edit could probably be elsewhere - under draw/engines likely)
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_enum_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_scene.c237
2 files changed, 191 insertions, 47 deletions
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 1c9b3593d17..b9bb741bcde 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -61,6 +61,7 @@ extern EnumPropertyItem rna_enum_object_modifier_type_items[];
extern EnumPropertyItem rna_enum_constraint_type_items[];
extern EnumPropertyItem rna_enum_boidrule_type_items[];
extern EnumPropertyItem rna_enum_sequence_modifier_type_items[];
+extern EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[];
extern EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[];
extern EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[];
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 2fb1fa9c8d6..d0ee8a02596 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -438,6 +438,12 @@ EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = {
{0, NULL, 0, NULL, NULL}
};
+EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[] = {
+ {COLLECTION_MODE_OBJECT, "OBJECT", 0, "Object", ""},
+ {COLLECTION_MODE_EDIT, "EDIT", 0, "Edit", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
#ifdef RNA_RUNTIME
#include "DNA_anim_types.h"
@@ -2369,55 +2375,90 @@ static StructRNA *rna_CollectionEngineSettings_refine(struct PointerRNA *ptr)
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(_NAME_) \
- static int rna_LayerEngineSettings_##_NAME_##_use_get(PointerRNA *ptr) \
+#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_##_NAME_##_use_set(PointerRNA *ptr, int value) \
+ 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_, _NAME_) \
-static _TYPE_ rna_LayerEngineSettings_##_NAME_##_get(PointerRNA *ptr) \
+#define RNA_LAYER_ENGINE_GET_SET(_TYPE_, _ENGINE_, _MODE_, _NAME_) \
+static _TYPE_ rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr) \
{ \
CollectionEngineSettings *ces = (CollectionEngineSettings *)ptr->data; \
return BKE_collection_engine_property_value_get_##_TYPE_(ces, #_NAME_); \
} \
\
-static void rna_LayerEngineSettings_##_NAME_##_set(PointerRNA *ptr, _TYPE_ value) \
+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); \
} \
- RNA_LAYER_ENGINE_USE_GET_SET(_NAME_)
+ 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_)
+
+#define RNA_LAYER_ENGINE_CLAY_GET_SET_INT(_NAME_) \
+ RNA_LAYER_ENGINE_GET_SET(int, Clay, COLLECTION_MODE_NONE, _NAME_)
+
+/* mode engines */
+
+#define RNA_LAYER_MODE_OBJECT_GET_SET_FLOAT(_NAME_) \
+ RNA_LAYER_ENGINE_GET_SET(float, ObjectMode, COLLECTION_MODE_OBJECT, _NAME_)
+
+#define RNA_LAYER_MODE_OBJECT_GET_SET_INT(_NAME_) \
+ RNA_LAYER_ENGINE_GET_SET(int, ObjectMode, COLLECTION_MODE_OBJECT, _NAME_)
+
+#define RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(_NAME_) \
+ RNA_LAYER_ENGINE_GET_SET(float, EditMode, COLLECTION_MODE_EDIT, _NAME_)
-#define RNA_LAYER_ENGINE_GET_SET_FLOAT(_NAME_) \
- RNA_LAYER_ENGINE_GET_SET(float, _NAME_)
+#define RNA_LAYER_MODE_EDIT_GET_SET_INT(_NAME_) \
+ RNA_LAYER_ENGINE_GET_SET(int, EditMode, COLLECTION_MODE_EDIT, _NAME_)
-#define RNA_LAYER_ENGINE_GET_SET_INT(_NAME_) \
- RNA_LAYER_ENGINE_GET_SET(int, _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)
+RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(matcap_saturation)
+RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(matcap_value)
+RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_factor_cavity)
+RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_factor_edge)
+RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_distance)
+RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_attenuation)
+/* object engine */
-RNA_LAYER_ENGINE_GET_SET_INT(type)
-RNA_LAYER_ENGINE_GET_SET_INT(matcap_icon)
-RNA_LAYER_ENGINE_GET_SET_FLOAT(matcap_rotation)
-RNA_LAYER_ENGINE_GET_SET_FLOAT(matcap_hue)
-RNA_LAYER_ENGINE_GET_SET_FLOAT(matcap_saturation)
-RNA_LAYER_ENGINE_GET_SET_FLOAT(matcap_value)
-RNA_LAYER_ENGINE_GET_SET_FLOAT(ssao_factor_cavity)
-RNA_LAYER_ENGINE_GET_SET_FLOAT(ssao_factor_edge)
-RNA_LAYER_ENGINE_GET_SET_FLOAT(ssao_distance)
-RNA_LAYER_ENGINE_GET_SET_FLOAT(ssao_attenuation)
+RNA_LAYER_MODE_OBJECT_GET_SET_INT(foo)
+
+/* mesh engine */
+RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(bar)
-#undef RNA_LAYER_ENGINE_GET_SET_INT
-#undef RNA_LAYER_ENGINE_GET_SET_FLOAT
#undef RNA_LAYER_ENGINE_GET_SET
#undef RNA_LAYER_ENGINE_USE_GET_SET
@@ -2473,11 +2514,35 @@ static PointerRNA rna_LayerCollection_engine_settings_get(ID *UNUSED(id), LayerC
}
PointerRNA ptr;
- CollectionEngineSettings *ces = BKE_layer_collection_engine_get(lc, engine_name);
+ 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 void rna_LayerCollection_hide_update(bContext *C, PointerRNA *ptr)
{
Scene *scene = CTX_data_scene(C);
@@ -5741,14 +5806,23 @@ 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(_NAME_) \
+#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_"#_NAME_"_use_get", \
- "rna_LayerEngineSettings_"#_NAME_"_use_set"); \
+ "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_)
+
static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna)
{
StructRNA *srna;
@@ -5801,86 +5875,86 @@ static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna)
/* 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_type_get", "rna_LayerEngineSettings_type_set", NULL);
+ 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_USE(type)
+ 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_matcap_icon_get", "rna_LayerEngineSettings_matcap_icon_set", NULL);
+ 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_USE(matcap_icon)
+ RNA_LAYER_ENGINE_CLAY_USE(matcap_icon)
prop = RNA_def_property(srna, "matcap_rotation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_matcap_rotation_get", "rna_LayerEngineSettings_matcap_rotation_set", NULL);
+ 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_USE(matcap_rotation)
+ RNA_LAYER_ENGINE_CLAY_USE(matcap_rotation)
prop = RNA_def_property(srna, "matcap_hue", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_matcap_hue_get", "rna_LayerEngineSettings_matcap_hue_set", NULL);
+ 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_USE(matcap_hue)
+ RNA_LAYER_ENGINE_CLAY_USE(matcap_hue)
prop = RNA_def_property(srna, "matcap_saturation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_matcap_saturation_get", "rna_LayerEngineSettings_matcap_saturation_set", NULL);
+ 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_USE(matcap_saturation)
+ RNA_LAYER_ENGINE_CLAY_USE(matcap_saturation)
prop = RNA_def_property(srna, "matcap_value", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_matcap_value_get", "rna_LayerEngineSettings_matcap_value_set", NULL);
+ 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_USE(matcap_value)
+ RNA_LAYER_ENGINE_CLAY_USE(matcap_value)
prop = RNA_def_property(srna, "ssao_factor_cavity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_ssao_factor_cavity_get", "rna_LayerEngineSettings_ssao_factor_cavity_set", NULL);
+ 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_USE(ssao_factor_cavity)
+ RNA_LAYER_ENGINE_CLAY_USE(ssao_factor_cavity)
prop = RNA_def_property(srna, "ssao_factor_edge", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_ssao_factor_edge_get", "rna_LayerEngineSettings_ssao_factor_edge_set", NULL);
+ 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_USE(ssao_factor_edge)
+ RNA_LAYER_ENGINE_CLAY_USE(ssao_factor_edge)
prop = RNA_def_property(srna, "ssao_distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_ssao_distance_get", "rna_LayerEngineSettings_ssao_distance_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_distance_get", "rna_LayerEngineSettings_Clay_ssao_distance_set", NULL);
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_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_USE(ssao_distance)
+ RNA_LAYER_ENGINE_CLAY_USE(ssao_distance)
prop = RNA_def_property(srna, "ssao_attenuation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_ssao_attenuation_get", "rna_LayerEngineSettings_ssao_attenuation_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_attenuation_get", "rna_LayerEngineSettings_Clay_ssao_attenuation_set", NULL);
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_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
- RNA_LAYER_ENGINE_USE(ssao_attenuation)
+ RNA_LAYER_ENGINE_CLAY_USE(ssao_attenuation)
}
static void rna_def_layer_collection_engine_settings(BlenderRNA *brna)
@@ -5901,6 +5975,65 @@ static void rna_def_layer_collection_engine_settings(BlenderRNA *brna)
rna_def_layer_collection_engine_settings_clay(brna);
}
+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");
+ RNA_def_struct_ui_text(srna, "Collections Object Mode Settings", "Object Mode specific settings for this collection");
+
+ prop = RNA_def_property(srna, "foo", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Foo", "");
+ RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_ObjectMode_foo_get", "rna_LayerEngineSettings_ObjectMode_foo_set", NULL);
+ RNA_def_property_ui_text(prop, "Foo Object Setting", "Temporary settings");
+ 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(foo)
+}
+
+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");
+
+ prop = RNA_def_property(srna, "bar", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Bar Object Setting", "Temporary settings");
+ RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_EditMode_bar_get", "rna_LayerEngineSettings_EditMode_bar_set", NULL);
+ 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(bar)
+}
+
+static void rna_def_layer_collection_mode_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");
+
+ 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_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* 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
static void rna_def_layer_collection(BlenderRNA *brna)
@@ -5951,6 +6084,15 @@ static void rna_def_layer_collection(BlenderRNA *brna)
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);
+
/* Flags */
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_VISIBLE);
@@ -8655,6 +8797,7 @@ void RNA_def_scene(BlenderRNA *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);