diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-10-23 22:46:35 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-10-23 23:18:05 +0300 |
commit | 23a5726ec286f66648195776592eeaf4f19a1d45 (patch) | |
tree | a38eda24fcf5275a92952e9f93a24b16855b996d /source/blender/makesrna/intern | |
parent | 4db67aab06dfe6a210ab20268ed898834371119b (diff) |
Refactor: Move rna_scene.c layer/collection to rna_layer.c
rna_scene.c was getting way too big with data that was related to
DNA_layer_types.h.
I tried doing it earlier, but failed. But now with the new changes I think it's
better to do this sooner than later.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 2196 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 2095 |
5 files changed, 2199 insertions, 2095 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index bf537ea67c6..74c36c456b0 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -56,6 +56,7 @@ set(DEFSRC rna_key.c rna_lamp.c rna_lattice.c + rna_layer.c rna_linestyle.c rna_main.c rna_mask.c diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 3e67eeb3951..720f7324bdb 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -3336,6 +3336,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_key.c", NULL, RNA_def_key}, {"rna_lamp.c", NULL, RNA_def_lamp}, {"rna_lattice.c", "rna_lattice_api.c", RNA_def_lattice}, + {"rna_layer.c", NULL, RNA_def_scene_layer}, {"rna_linestyle.c", NULL, RNA_def_linestyle}, {"rna_main.c", "rna_main_api.c", RNA_def_main}, {"rna_material.c", "rna_material_api.c", RNA_def_material}, diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 00b1b53ad71..ec9b8cc24b2 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -172,6 +172,7 @@ void RNA_def_render(struct BlenderRNA *brna); void RNA_def_rigidbody(struct BlenderRNA *brna); void RNA_def_rna(struct BlenderRNA *brna); void RNA_def_scene(struct BlenderRNA *brna); +void RNA_def_scene_layer(struct BlenderRNA *brna); void RNA_def_screen(struct BlenderRNA *brna); void RNA_def_sculpt_paint(struct BlenderRNA *brna); void RNA_def_sensor(struct BlenderRNA *brna); diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c new file mode 100644 index 00000000000..acec7330922 --- /dev/null +++ b/source/blender/makesrna/intern/rna_layer.c @@ -0,0 +1,2196 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_layer.c + * \ingroup RNA + */ + +#include "DNA_scene_types.h" +#include "DNA_layer_types.h" + +#include "BLI_math.h" +#include "BLI_string_utils.h" + +#include "BLT_translation.h" + +#include "ED_object.h" +#include "ED_render.h" + +#include "RE_engine.h" + +#include "DRW_engine.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "RNA_define.h" + +#include "rna_internal.h" + +const EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[] = { + {COLLECTION_MODE_OBJECT, "OBJECT", 0, "Object", ""}, + {COLLECTION_MODE_EDIT, "EDIT", 0, "Edit", ""}, + {COLLECTION_MODE_PAINT_WEIGHT, "PAINT_WEIGHT", 0, "Weight Paint", ""}, + {COLLECTION_MODE_PAINT_WEIGHT, "PAINT_VERTEX", 0, "Vertex Paint", ""}, + {0, NULL, 0, NULL, NULL} +}; + +#ifdef RNA_RUNTIME + +#include "DNA_anim_types.h" +#include "DNA_color_types.h" +#include "DNA_node_types.h" +#include "DNA_object_types.h" +#include "DNA_mesh_types.h" +#include "DNA_text_types.h" +#include "DNA_workspace_types.h" + +#include "RNA_access.h" + +#include "MEM_guardedalloc.h" + +#include "BKE_brush.h" +#include "BKE_collection.h" +#include "BKE_colortools.h" +#include "BKE_context.h" +#include "BKE_global.h" +#include "BKE_idprop.h" +#include "BKE_image.h" +#include "BKE_layer.h" +#include "BKE_main.h" +#include "BKE_node.h" +#include "BKE_pointcache.h" +#include "BKE_scene.h" +#include "BKE_mesh.h" +#include "BKE_sound.h" +#include "BKE_screen.h" +#include "BKE_sequencer.h" +#include "BKE_animsys.h" +#include "BKE_freestyle.h" +#include "BKE_gpencil.h" + +#include "ED_info.h" +#include "ED_node.h" +#include "ED_view3d.h" +#include "ED_mesh.h" +#include "ED_keyframing.h" +#include "ED_image.h" +#include "ED_scene.h" + +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" +#include "DEG_depsgraph_query.h" + +#ifdef WITH_FREESTYLE +#include "FRS_freestyle.h" +#endif + +static void rna_SceneCollection_name_set(PointerRNA *ptr, const char *value) +{ + Scene *scene = (Scene *)ptr->id.data; + SceneCollection *sc = (SceneCollection *)ptr->data; + BKE_collection_rename(scene, sc, value); +} + +static void rna_SceneCollection_filter_set(PointerRNA *ptr, const char *value) +{ + Scene *scene = (Scene *)ptr->id.data; + SceneCollection *sc = (SceneCollection *)ptr->data; + BLI_strncpy_utf8(sc->filter, value, sizeof(sc->filter)); + + TODO_LAYER_SYNC_FILTER; + (void)scene; +} + +static PointerRNA rna_SceneCollection_objects_get(CollectionPropertyIterator *iter) +{ + ListBaseIterator *internal = &iter->internal.listbase; + + /* we are actually iterating a LinkData list, so override get */ + return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((LinkData *)internal->link)->data); +} + +static int rna_SceneCollection_move_above(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) +{ + Scene *scene = (Scene *)id; + + if (!BKE_collection_move_above(scene, sc_dst, sc_src)) { + return 0; + } + + DEG_relations_tag_update(bmain); + WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); + + return 1; +} + +static int rna_SceneCollection_move_below(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) +{ + Scene *scene = (Scene *)id; + + if (!BKE_collection_move_below(scene, sc_dst, sc_src)) { + return 0; + } + + DEG_relations_tag_update(bmain); + WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); + + return 1; +} + +static int rna_SceneCollection_move_into(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) +{ + Scene *scene = (Scene *)id; + + if (!BKE_collection_move_into(scene, sc_dst, sc_src)) { + return 0; + } + + DEG_relations_tag_update(bmain); + WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); + + return 1; +} + +static SceneCollection *rna_SceneCollection_new( + ID *id, SceneCollection *sc_parent, Main *bmain, const char *name) +{ + Scene *scene = (Scene *)id; + SceneCollection *sc = BKE_collection_add(scene, sc_parent, name); + + DEG_relations_tag_update(bmain); + WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); + + return sc; +} + +static void rna_SceneCollection_remove( + ID *id, SceneCollection *sc_parent, Main *bmain, ReportList *reports, PointerRNA *sc_ptr) +{ + Scene *scene = (Scene *)id; + SceneCollection *sc = sc_ptr->data; + + const int index = BLI_findindex(&sc_parent->scene_collections, sc); + if (index == -1) { + BKE_reportf(reports, RPT_ERROR, "Collection '%s' is not a sub-collection of '%s'", + sc->name, sc_parent->name); + return; + } + + if (!BKE_collection_remove(scene, sc)) { + BKE_reportf(reports, RPT_ERROR, "Collection '%s' could not be removed from collection '%s'", + sc->name, sc_parent->name); + return; + } + + RNA_POINTER_INVALIDATE(sc_ptr); + + DEG_relations_tag_update(bmain); + WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); +} + +static int rna_SceneCollection_objects_active_index_get(PointerRNA *ptr) +{ + SceneCollection *sc = (SceneCollection *)ptr->data; + return sc->active_object_index; +} + +static void rna_SceneCollection_objects_active_index_set(PointerRNA *ptr, int value) +{ + SceneCollection *sc = (SceneCollection *)ptr->data; + sc->active_object_index = value; +} + +static void rna_SceneCollection_objects_active_index_range( + PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) +{ + SceneCollection *sc = (SceneCollection *)ptr->data; + *min = 0; + *max = max_ii(0, BLI_listbase_count(&sc->objects) - 1); +} + +void rna_SceneCollection_object_link( + ID *id, SceneCollection *sc, Main *bmain, ReportList *reports, Object *ob) +{ + Scene *scene = (Scene *)id; + + if (BLI_findptr(&sc->objects, ob, offsetof(LinkData, data))) { + BKE_reportf(reports, RPT_ERROR, "Object '%s' is already in collection '%s'", ob->id.name + 2, sc->name); + return; + } + + BKE_collection_object_add(scene, sc, ob); + + /* TODO(sergey): Only update relations for the current scene. */ + DEG_relations_tag_update(bmain); + + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(&scene->id, 0); + + DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); + + WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene); +} + +static void rna_SceneCollection_object_unlink( + ID *id, SceneCollection *sc, Main *bmain, ReportList *reports, Object *ob) +{ + Scene *scene = (Scene *)id; + + if (!BLI_findptr(&sc->objects, ob, offsetof(LinkData, data))) { + BKE_reportf(reports, RPT_ERROR, "Object '%s' is not in collection '%s'", ob->id.name + 2, sc->name); + return; + } + + BKE_collection_object_remove(bmain, scene, sc, ob, false); + + /* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */ + DEG_relations_tag_update(bmain); + + WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene); +} + +/****** layer collection engine settings *******/ + +#define RNA_LAYER_ENGINE_GET_SET(_TYPE_, _ENGINE_, _MODE_, _NAME_) \ +static _TYPE_ rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr) \ +{ \ + 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) \ +{ \ + IDProperty *props = (IDProperty *)ptr->data; \ + BKE_collection_engine_property_value_set_##_TYPE_(props, #_NAME_, value); \ +} + +#define RNA_LAYER_ENGINE_GET_SET_ARRAY(_TYPE_, _ENGINE_, _MODE_, _NAME_, _LEN_) \ +static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr, _TYPE_ *values) \ +{ \ + IDProperty *props = (IDProperty *)ptr->data; \ + IDProperty *idprop = IDP_GetPropertyFromGroup(props, #_NAME_); \ + if (idprop != NULL) { \ + memcpy(values, IDP_Array(idprop), sizeof(_TYPE_) * idprop->len); \ + } \ +} \ + \ +static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr, const _TYPE_ *values) \ +{ \ + IDProperty *props = (IDProperty *)ptr->data; \ + BKE_collection_engine_property_value_set_##_TYPE_##_array(props, #_NAME_, values); \ +} + +#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_FLOAT_ARRAY(_NAME_, _LEN_) \ + RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Clay, COLLECTION_MODE_NONE, _NAME_, _LEN_) + +#define RNA_LAYER_ENGINE_CLAY_GET_SET_INT(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(int, Clay, COLLECTION_MODE_NONE, _NAME_) + +#define RNA_LAYER_ENGINE_CLAY_GET_SET_BOOL(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(bool, Clay, COLLECTION_MODE_NONE, _NAME_) + +#define RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(float, Eevee, COLLECTION_MODE_NONE, _NAME_) + +#define RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT_ARRAY(_NAME_, _LEN_) \ + RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Eevee, COLLECTION_MODE_NONE, _NAME_, _LEN_) + +#define RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(int, Eevee, COLLECTION_MODE_NONE, _NAME_) + +#define RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(bool, Eevee, 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_OBJECT_GET_SET_BOOL(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(bool, 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_MODE_EDIT_GET_SET_INT(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(int, EditMode, COLLECTION_MODE_EDIT, _NAME_) + +#define RNA_LAYER_MODE_EDIT_GET_SET_BOOL(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(bool, EditMode, COLLECTION_MODE_EDIT, _NAME_) + +#define RNA_LAYER_MODE_PAINT_WEIGHT_GET_SET_BOOL(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(bool, PaintWeightMode, COLLECTION_MODE_PAINT_WEIGHT, _NAME_) + +#define RNA_LAYER_MODE_PAINT_VERTEX_GET_SET_BOOL(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(bool, PaintVertexMode, COLLECTION_MODE_PAINT_VERTEX, _NAME_) + +/* clay engine */ +#ifdef WITH_CLAY_ENGINE +/* SceneLayer settings. */ +RNA_LAYER_ENGINE_CLAY_GET_SET_INT(ssao_samples) + +/* LayerCollection settings. */ +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) +RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(hair_brightness_randomness) +#endif /* WITH_CLAY_ENGINE */ + +/* eevee engine */ +/* SceneLayer settings. */ +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(gtao_enable) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(gtao_use_bent_normals) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(gtao_denoise) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(gtao_bounce) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(gtao_factor) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(gtao_quality) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(gtao_distance) +RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(gtao_samples) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(dof_enable) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bokeh_max_size) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bokeh_threshold) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(bloom_enable) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_threshold) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT_ARRAY(bloom_color, 3) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_knee) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_radius) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_clamp) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_intensity) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(motion_blur_enable) +RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(motion_blur_samples) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(motion_blur_shutter) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(volumetric_enable) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(volumetric_start) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(volumetric_end) +RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(volumetric_samples) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(volumetric_sample_distribution) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(volumetric_lights) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(volumetric_light_clamp) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(volumetric_shadows) +RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(volumetric_shadow_samples) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(volumetric_colored_transmittance) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(ssr_refraction) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(ssr_enable) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(ssr_halfres) +RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(ssr_ray_count) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_quality) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_max_roughness) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_thickness) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_border_fade) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_firefly_fac) +RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(shadow_method) +RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(shadow_size) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(shadow_high_bitdepth) +RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(taa_samples) +RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(gi_diffuse_bounces) +RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(gi_cubemap_resolution) + +/* object engine */ +RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(show_wire) +RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(show_backface_culling) + +/* mesh engine */ +RNA_LAYER_MODE_EDIT_GET_SET_BOOL(show_occlude_wire) +RNA_LAYER_MODE_EDIT_GET_SET_BOOL(show_weight) +RNA_LAYER_MODE_EDIT_GET_SET_BOOL(face_normals_show) +RNA_LAYER_MODE_EDIT_GET_SET_BOOL(vert_normals_show) +RNA_LAYER_MODE_EDIT_GET_SET_BOOL(loop_normals_show) +RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(normals_length) +RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(backwire_opacity) + +/* weight paint engine */ +RNA_LAYER_MODE_PAINT_WEIGHT_GET_SET_BOOL(use_shading) +RNA_LAYER_MODE_PAINT_WEIGHT_GET_SET_BOOL(use_wire) + +/* vertex paint engine */ +RNA_LAYER_MODE_PAINT_VERTEX_GET_SET_BOOL(use_shading) +RNA_LAYER_MODE_PAINT_VERTEX_GET_SET_BOOL(use_wire) + +#undef RNA_LAYER_ENGINE_GET_SET + +static void rna_SceneLayerEngineSettings_update(bContext *C, PointerRNA *UNUSED(ptr)) +{ + Scene *scene = CTX_data_scene(C); + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(&scene->id, 0); +} + +static void rna_LayerCollectionEngineSettings_update(bContext *C, PointerRNA *UNUSED(ptr)) +{ + Scene *scene = CTX_data_scene(C); + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(&scene->id, 0); +} + +static void rna_LayerCollectionEngineSettings_wire_update(bContext *C, PointerRNA *UNUSED(ptr)) +{ + Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); + Object *ob = OBACT_NEW(sl); + + if (ob != NULL && ob->type == OB_MESH) { + BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL); + } + + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(&scene->id, 0); +} + +/***********************************/ + +static void engine_settings_use(IDProperty *root, IDProperty *props, PointerRNA *props_ptr, const char *identifier) +{ + PropertyRNA *prop = RNA_struct_find_property(props_ptr, identifier); + + switch (RNA_property_type(prop)) { + case PROP_FLOAT: + { + float value = BKE_collection_engine_property_value_get_float(props, identifier); + BKE_collection_engine_property_add_float(root, identifier, value); + break; + } + case PROP_ENUM: + { + int value = BKE_collection_engine_property_value_get_int(props, identifier); + BKE_collection_engine_property_add_int(root, identifier, value); + break; + } + case PROP_INT: + { + int value = BKE_collection_engine_property_value_get_int(props, identifier); + BKE_collection_engine_property_add_int(root, identifier, value); + break; + } + case PROP_BOOLEAN: + { + int value = BKE_collection_engine_property_value_get_int(props, identifier); + BKE_collection_engine_property_add_bool(root, identifier, value); + break; + } + case PROP_STRING: + case PROP_POINTER: + case PROP_COLLECTION: + default: + break; + } +} + +static StructRNA *rna_SceneLayerSettings_refine(PointerRNA *ptr) +{ + IDProperty *props = (IDProperty *)ptr->data; + BLI_assert(props && props->type == IDP_GROUP); + + switch (props->subtype) { + case IDP_GROUP_SUB_ENGINE_RENDER: +#ifdef WITH_CLAY_ENGINE + if (STREQ(props->name, RE_engine_id_BLENDER_CLAY)) { + return &RNA_SceneLayerEngineSettingsClay; + } +#endif + if (STREQ(props->name, RE_engine_id_BLENDER_EEVEE)) { + return &RNA_SceneLayerEngineSettingsEevee; + } + break; + case IDP_GROUP_SUB_MODE_OBJECT: + case IDP_GROUP_SUB_MODE_EDIT: + case IDP_GROUP_SUB_MODE_PAINT_WEIGHT: + case IDP_GROUP_SUB_MODE_PAINT_VERTEX: + default: + BLI_assert(!"Mode not fully implemented"); + break; + } + + return &RNA_SceneLayerSettings; +} + +static void rna_SceneLayerSettings_name_get(PointerRNA *ptr, char *value) +{ + IDProperty *props = (IDProperty *)ptr->data; + strcpy(value, props->name); +} + +static int rna_SceneLayerSettings_name_length(PointerRNA *ptr) +{ + IDProperty *props = (IDProperty *)ptr->data; + return strnlen(props->name, sizeof(props->name)); +} + +static void rna_SceneLayerSettings_use(ID *id, IDProperty *props, const char *identifier) +{ + Scene *scene = (Scene *)id; + PointerRNA scene_props_ptr; + IDProperty *scene_props; + + scene_props = BKE_scene_layer_engine_scene_get(scene, COLLECTION_MODE_NONE, props->name); + RNA_pointer_create(id, &RNA_SceneLayerSettings, scene_props, &scene_props_ptr); + + engine_settings_use(props, scene_props, &scene_props_ptr, identifier); + + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(id, 0); +} + +static void rna_SceneLayerSettings_unuse(ID *id, IDProperty *props, const char *identifier) +{ + IDProperty *prop_to_remove = IDP_GetPropertyFromGroup(props, identifier); + IDP_FreeFromGroup(props, prop_to_remove); + + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(id, 0); +} + +static StructRNA *rna_LayerCollectionSettings_refine(PointerRNA *ptr) +{ + IDProperty *props = (IDProperty *)ptr->data; + BLI_assert(props && props->type == IDP_GROUP); + + 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 + if (STREQ(props->name, RE_engine_id_BLENDER_EEVEE)) { + /* printf("Mode not fully implemented\n"); */ + return &RNA_LayerCollectionSettings; + } + break; + case IDP_GROUP_SUB_MODE_OBJECT: + return &RNA_LayerCollectionModeSettingsObject; + break; + case IDP_GROUP_SUB_MODE_EDIT: + return &RNA_LayerCollectionModeSettingsEdit; + break; + case IDP_GROUP_SUB_MODE_PAINT_WEIGHT: + return &RNA_LayerCollectionModeSettingsPaintWeight; + break; + case IDP_GROUP_SUB_MODE_PAINT_VERTEX: + return &RNA_LayerCollectionModeSettingsPaintVertex; + break; + default: + BLI_assert(!"Mode not fully implemented"); + break; + } + + return &RNA_LayerCollectionSettings; +} + +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_LayerCollectionSettings_use(ID *id, IDProperty *props, const char *identifier) +{ + Scene *scene = (Scene *)id; + PointerRNA scene_props_ptr; + IDProperty *scene_props; + + scene_props = BKE_layer_collection_engine_scene_get(scene, COLLECTION_MODE_NONE, props->name); + RNA_pointer_create(id, &RNA_LayerCollectionSettings, scene_props, &scene_props_ptr); + engine_settings_use(props, scene_props, &scene_props_ptr, identifier); + + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(id, 0); +} + +static void rna_LayerCollectionSettings_unuse(ID *id, IDProperty *props, const char *identifier) +{ + IDProperty *prop_to_remove = IDP_GetPropertyFromGroup(props, identifier); + IDP_FreeFromGroup(props, prop_to_remove); + + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(id, 0); +} + +static void rna_LayerCollection_name_get(PointerRNA *ptr, char *value) +{ + SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection; + strcpy(value, sc->name); +} + +static int rna_LayerCollection_name_length(PointerRNA *ptr) +{ + SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection; + return strnlen(sc->name, sizeof(sc->name)); +} + +static void rna_LayerCollection_name_set(PointerRNA *ptr, const char *value) +{ + Scene *scene = (Scene *)ptr->id.data; + SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection; + BKE_collection_rename(scene, sc, value); +} + +static PointerRNA rna_LayerCollection_objects_get(CollectionPropertyIterator *iter) +{ + ListBaseIterator *internal = &iter->internal.listbase; + Base *base = ((LinkData *)internal->link)->data; + return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object); +} + +static int rna_LayerCollection_move_above(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) +{ + Scene *scene = (Scene *)id; + + if (!BKE_layer_collection_move_above(scene, lc_dst, lc_src)) { + return 0; + } + + DEG_relations_tag_update(bmain); + WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); + + return 1; +} + +static int rna_LayerCollection_move_below(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) +{ + Scene *scene = (Scene *)id; + + if (!BKE_layer_collection_move_below(scene, lc_dst, lc_src)) { + return 0; + } + + DEG_relations_tag_update(bmain); + WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); + + return 1; +} + +static int rna_LayerCollection_move_into(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) +{ + Scene *scene = (Scene *)id; + + if (!BKE_layer_collection_move_into(scene, lc_dst, lc_src)) { + return 0; + } + + DEG_relations_tag_update(bmain); + WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); + + return 1; +} + +static void rna_LayerCollection_flag_update(bContext *C, PointerRNA *UNUSED(ptr)) +{ + Scene *scene = CTX_data_scene(C); + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(&scene->id, 0); + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); +} + +static void rna_LayerCollection_enable_set( + ID *id, LayerCollection *layer_collection, Main *bmain, bContext *C, ReportList *reports, int value) +{ + Scene *scene = (Scene *)id; + SceneLayer *scene_layer = BKE_scene_layer_find_from_collection(scene, layer_collection); + + if (layer_collection->flag & COLLECTION_DISABLED) { + if (value == 1) { + BKE_collection_enable(scene_layer, layer_collection); + } + else { + BKE_reportf(reports, RPT_ERROR, "Layer collection '%s' is already disabled", + layer_collection->scene_collection->name); + return; + } + } + else { + if (value == 0) { + BKE_collection_disable(scene_layer, layer_collection); + } + else { + BKE_reportf(reports, RPT_ERROR, "Layer collection '%s' is already enabled", + layer_collection->scene_collection->name); + } + } + + DEG_relations_tag_update(bmain); + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(&scene->id, 0); + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); + WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene); +} + +static int rna_LayerCollections_active_collection_index_get(PointerRNA *ptr) +{ + SceneLayer *sl = (SceneLayer *)ptr->data; + return sl->active_collection; +} + +static void rna_LayerCollections_active_collection_index_set(PointerRNA *ptr, int value) +{ + SceneLayer *sl = (SceneLayer *)ptr->data; + int num_collections = BKE_layer_collection_count(sl); + sl->active_collection = min_ff(value, num_collections - 1); +} + +static void rna_LayerCollections_active_collection_index_range( + PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) +{ + SceneLayer *sl = (SceneLayer *)ptr->data; + *min = 0; + *max = max_ii(0, BKE_layer_collection_count(sl) - 1); +} + +static PointerRNA rna_LayerCollections_active_collection_get(PointerRNA *ptr) +{ + SceneLayer *sl = (SceneLayer *)ptr->data; + LayerCollection *lc = BKE_layer_collection_get_active(sl); + return rna_pointer_inherit_refine(ptr, &RNA_LayerCollection, lc); +} + +static void rna_LayerCollections_active_collection_set(PointerRNA *ptr, PointerRNA value) +{ + SceneLayer *sl = (SceneLayer *)ptr->data; + LayerCollection *lc = (LayerCollection *)value.data; + const int index = BKE_layer_collection_findindex(sl, lc); + if (index != -1) sl->active_collection = index; +} + +LayerCollection * rna_SceneLayer_collection_link( + ID *id, SceneLayer *sl, Main *bmain, SceneCollection *sc) +{ + Scene *scene = (Scene *)id; + LayerCollection *lc = BKE_collection_link(sl, sc); + + DEG_relations_tag_update(bmain); + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(id, 0); + WM_main_add_notifier(NC_SCENE | ND_LAYER, scene); + + return lc; +} + +static void rna_SceneLayer_collection_unlink( + ID *id, SceneLayer *sl, Main *bmain, ReportList *reports, LayerCollection *lc) +{ + Scene *scene = (Scene *)id; + + if (BLI_findindex(&sl->layer_collections, lc) == -1) { + BKE_reportf(reports, RPT_ERROR, "Layer collection '%s' is not in '%s'", lc->scene_collection->name, sl->name); + return; + } + + BKE_collection_unlink(sl, lc); + + DEG_relations_tag_update(bmain); + /* TODO(sergey): Use proper flag for tagging here. */ + DEG_id_tag_update(id, 0); + WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene); +} + +static PointerRNA rna_LayerObjects_active_object_get(PointerRNA *ptr) +{ + SceneLayer *sl = (SceneLayer *)ptr->data; + return rna_pointer_inherit_refine(ptr, &RNA_Object, sl->basact ? sl->basact->object : NULL); +} + +static void rna_LayerObjects_active_object_set(PointerRNA *ptr, PointerRNA value) +{ + SceneLayer *sl = (SceneLayer *)ptr->data; + if (value.data) + sl->basact = BKE_scene_layer_base_find(sl, (Object *)value.data); + else + sl->basact = NULL; +} + +static void rna_SceneLayer_name_set(PointerRNA *ptr, const char *value) +{ + Scene *scene = (Scene *)ptr->id.data; + SceneLayer *sl = (SceneLayer *)ptr->data; + char oldname[sizeof(sl->name)]; + + BLI_strncpy(oldname, sl->name, sizeof(sl->name)); + + BLI_strncpy_utf8(sl->name, value, sizeof(sl->name)); + BLI_uniquename(&scene->render_layers, sl, DATA_("SceneLayer"), '.', offsetof(SceneLayer, name), sizeof(sl->name)); + + if (scene->nodetree) { + bNode *node; + int index = BLI_findindex(&scene->render_layers, sl); + + for (node = scene->nodetree->nodes.first; node; node = node->next) { + if (node->type == CMP_NODE_R_LAYERS && node->id == NULL) { + if (node->custom1 == index) + BLI_strncpy(node->name, sl->name, NODE_MAXSTR); + } + } + } +} + +static PointerRNA rna_SceneLayer_objects_get(CollectionPropertyIterator *iter) +{ + ListBaseIterator *internal = &iter->internal.listbase; + + /* we are actually iterating a ObjectBase list, so override get */ + Base *base = (Base *)internal->link; + return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object); +} + +static int rna_SceneLayer_objects_selected_skip(CollectionPropertyIterator *iter, void *UNUSED(data)) +{ + ListBaseIterator *internal = &iter->internal.listbase; + Base *base = (Base *)internal->link; + + if ((base->flag & BASE_SELECTED) != 0) { + return 0; + } + + return 1; +}; + +static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + SceneLayer *sl = (SceneLayer *)ptr->data; + rna_iterator_listbase_begin(iter, &sl->object_bases, rna_SceneLayer_objects_selected_skip); +} + +static void rna_SceneLayer_update_tagged(SceneLayer *UNUSED(sl), bContext *C) +{ + Depsgraph *graph = CTX_data_depsgraph(C); + DEG_OBJECT_ITER(graph, ob, DEG_OBJECT_ITER_FLAG_ALL) + { + /* Don't do anything, we just need to run the iterator to flush + * the base info to the objects. */ + UNUSED_VARS(ob); + } + DEG_OBJECT_ITER_END +} + +static void rna_ObjectBase_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + Base *base = (Base *)ptr->data; + short mode = (base->flag & BASE_SELECTED) ? BA_SELECT : BA_DESELECT; + ED_object_base_select(base, mode); +} + +static char *rna_ViewRenderSettings_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_sprintfN("viewport_render"); +} + +static void rna_ViewRenderSettings_engine_set(PointerRNA *ptr, int value) +{ + ViewRender *view_render = (ViewRender *)ptr->data; + RenderEngineType *type = BLI_findlink(&R_engines, value); + + if (type) { + BLI_strncpy_utf8(view_render->engine_id, type->idname, sizeof(view_render->engine_id)); + DEG_id_tag_update(ptr->id.data, DEG_TAG_COPY_ON_WRITE); + } +} + +static const EnumPropertyItem *rna_ViewRenderSettings_engine_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +{ + RenderEngineType *type; + EnumPropertyItem *item = NULL; + EnumPropertyItem tmp = {0, "", 0, "", ""}; + int a = 0, totitem = 0; + + for (type = R_engines.first; type; type = type->next, a++) { + tmp.value = a; + tmp.identifier = type->idname; + tmp.name = type->name; + RNA_enum_item_add(&item, &totitem, &tmp); + } + + RNA_enum_item_end(&item, &totitem); + *r_free = true; + + return item; +} + +static int rna_ViewRenderSettings_engine_get(PointerRNA *ptr) +{ + ViewRender *view_render = (ViewRender *)ptr->data; + RenderEngineType *type; + int a = 0; + + for (type = R_engines.first; type; type = type->next, a++) + if (STREQ(type->idname, view_render->engine_id)) + return a; + + return 0; +} + +static void rna_ViewRenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr)) +{ + ED_render_engine_changed(bmain); +} + +static int rna_ViewRenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) +{ + return (BLI_listbase_count(&R_engines) > 1); +} + +static int rna_ViewRenderSettings_use_shading_nodes_get(PointerRNA *ptr) +{ + ViewRender *view_render = (ViewRender *)ptr->data; + return BKE_viewrender_use_new_shading_nodes(view_render); +} + +static int rna_ViewRenderSettings_use_spherical_stereo_get(PointerRNA *ptr) +{ + ViewRender *view_render = (ViewRender *)ptr->data; + return BKE_viewrender_use_spherical_stereo(view_render); +} + +static int rna_ViewRenderSettings_use_game_engine_get(PointerRNA *ptr) +{ + ViewRender *view_render = (ViewRender *)ptr->data; + RenderEngineType *type; + + for (type = R_engines.first; type; type = type->next) + if (STREQ(type->idname, view_render->engine_id)) + return (type->flag & RE_GAME) != 0; + + return 0; +} +#else + +static void rna_def_scene_collections(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "SceneCollections"); + srna = RNA_def_struct(brna, "SceneCollections", NULL); + RNA_def_struct_sdna(srna, "SceneCollection"); + RNA_def_struct_ui_text(srna, "Scene Collection", "Collection of scene collections"); + + func = RNA_def_function(srna, "new", "rna_SceneCollection_new"); + RNA_def_function_ui_description(func, "Add a collection to scene"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); + parm = RNA_def_string(func, "name", "SceneCollection", 0, "", "New name for the collection (not unique)"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_pointer(func, "result", "SceneCollection", "", "Newly created collection"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "remove", "rna_SceneCollection_remove"); + RNA_def_function_ui_description(func, "Remove a collection layer"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "layer", "SceneCollection", "", "Collection to remove"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); +} + +static void rna_def_collection_objects(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + PropertyRNA *prop; + + RNA_def_property_srna(cprop, "CollectionObjects"); + srna = RNA_def_struct(brna, "CollectionObjects", NULL); + RNA_def_struct_sdna(srna, "SceneCollection"); + RNA_def_struct_ui_text(srna, "Collection Objects", "Objects of a collection"); + + prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_funcs(prop, "rna_SceneCollection_objects_active_index_get", + "rna_SceneCollection_objects_active_index_set", + "rna_SceneCollection_objects_active_index_range"); + RNA_def_property_ui_text(prop, "Active Object Index", "Active index in collection objects array"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + + func = RNA_def_function(srna, "link", "rna_SceneCollection_object_link"); + RNA_def_function_ui_description(func, "Link an object to collection"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "object", "Object", "", "Object to add to collection"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); + + func = RNA_def_function(srna, "unlink", "rna_SceneCollection_object_unlink"); + RNA_def_function_ui_description(func, "Unlink object from collection"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove from collection"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); +} + +static void rna_def_scene_collection(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + srna = RNA_def_struct(brna, "SceneCollection", NULL); + RNA_def_struct_ui_text(srna, "Scene Collection", "Collection"); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneCollection_name_set"); + RNA_def_property_ui_text(prop, "Name", "Collection name"); + RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + + prop = RNA_def_property(srna, "filter", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneCollection_filter_set"); + RNA_def_property_ui_text(prop, "Filter", "Filter to dynamically include objects based on their names (e.g., CHAR_*)"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + + prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "scene_collections", NULL); + RNA_def_property_struct_type(prop, "SceneCollection"); + RNA_def_property_ui_text(prop, "SceneCollections", ""); + rna_def_scene_collections(brna, prop); + + prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "objects", NULL); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SceneCollection_objects_get", NULL, NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Objects", "All the objects directly added to this collection (not including sub-collection objects)"); + rna_def_collection_objects(brna, prop); + + prop = RNA_def_property(srna, "filters_objects", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "filter_objects", NULL); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SceneCollection_objects_get", NULL, NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Filter Objects", "All the objects dynamically added to this collection via the filter"); + + /* Functions */ + func = RNA_def_function(srna, "move_above", "rna_SceneCollection_move_above"); + RNA_def_function_ui_description(func, "Move collection after another"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); + parm = RNA_def_pointer(func, "sc_dst", "SceneCollection", "Collection", "Reference collection above which the collection will move"); + parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "move_below", "rna_SceneCollection_move_below"); + RNA_def_function_ui_description(func, "Move collection before another"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); + parm = RNA_def_pointer(func, "sc_dst", "SceneCollection", "Collection", "Reference collection below which the collection will move"); + parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "move_into", "rna_SceneCollection_move_into"); + RNA_def_function_ui_description(func, "Move collection into another"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); + parm = RNA_def_pointer(func, "sc_dst", "SceneCollection", "Collection", "Collection to insert into"); + parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); + RNA_def_function_return(func, parm); +} + +static void rna_def_layer_collection_override(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "LayerCollectionOverride", NULL); + RNA_def_struct_sdna(srna, "CollectionOverride"); + RNA_def_struct_ui_text(srna, "Collection Override", "Collection Override"); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_ui_text(prop, "Name", "Collection name"); + RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); +} + + +#ifdef WITH_CLAY_ENGINE +static void rna_def_scene_layer_engine_settings_clay(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SceneLayerEngineSettingsClay", "SceneLayerSettings"); + RNA_def_struct_ui_text(srna, "Clay Scene Layer Settings", "Clay Engine settings"); + + RNA_define_verify_sdna(0); /* not in sdna */ + + /* see RNA_LAYER_ENGINE_GET_SET macro */ + prop = RNA_def_property(srna, "ssao_samples", PROP_INT, PROP_NONE); + RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_samples_get", + "rna_LayerEngineSettings_Clay_ssao_samples_set", NULL); + RNA_def_property_ui_text(prop, "Samples", "Number of samples"); + RNA_def_property_range(prop, 1, 500); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + RNA_define_verify_sdna(1); /* not in sdna */ +} +#endif /* WITH_CLAY_ENGINE */ + +static void rna_def_scene_layer_engine_settings_eevee(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + /* Keep in sync with eevee_private.h */ + static const EnumPropertyItem eevee_shadow_method_items[] = { + {1, "ESM", 0, "ESM", "Exponential Shadow Mapping"}, + {2, "VSM", 0, "VSM", "Variance Shadow Mapping"}, + {0, NULL, 0, NULL, NULL} + }; + + static const EnumPropertyItem eevee_shadow_size_items[] = { + {64, "64", 0, "64px", ""}, + {128, "128", 0, "128px", ""}, + {256, "256", 0, "256px", ""}, + {512, "512", 0, "512px", ""}, + {1024, "1024", 0, "1024px", ""}, + {2048, "2048", 0, "2048px", ""}, + {4096, "4096", 0, "4096px", ""}, + {8192, "8192", 0, "8192px", ""}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "SceneLayerEngineSettingsEevee", "SceneLayerSettings"); + RNA_def_struct_ui_text(srna, "Eevee Scene Layer Settings", "Eevee Engine settings"); + + RNA_define_verify_sdna(0); /* not in sdna */ + + /* see RNA_LAYER_ENGINE_GET_SET macro */ + + /* Indirect Lighting */ + prop = RNA_def_property(srna, "gi_diffuse_bounces", PROP_INT, PROP_NONE); + RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_gi_diffuse_bounces_get", + "rna_LayerEngineSettings_Eevee_gi_diffuse_bounces_set", NULL); + RNA_def_property_ui_text(prop, "Diffuse Bounces", "Number of time the light is reinjected inside light grids, " + "0 disable indirect diffuse light"); + RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "gi_cubemap_resolution", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Eevee_gi_cubemap_resolution_get", "rna_LayerEngineSettings_Eevee_gi_cubemap_resolution_set", NULL); + RNA_def_property_enum_items(prop, eevee_shadow_size_items); + RNA_def_property_ui_text(prop, "Cubemap Size", "Size of every cubemaps"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + /* Temporal Anti-Aliasing (super sampling) */ + prop = RNA_def_property(srna, "taa_samples", PROP_INT, PROP_NONE); + RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_taa_samples_get", + "rna_LayerEngineSettings_Eevee_taa_samples_set", NULL); + RNA_def_property_ui_text(prop, "Viewport Samples", "Number of temporal samples, unlimited if 0, " + "disabled if 1"); + RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + /* Screen Space Reflection */ + prop = RNA_def_property(srna, "ssr_enable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_enable_get", + "rna_LayerEngineSettings_Eevee_ssr_enable_set"); + RNA_def_property_ui_text(prop, "Screen Space Reflections", "Enable screen space reflection"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "ssr_refraction", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_refraction_get", + "rna_LayerEngineSettings_Eevee_ssr_refraction_set"); + RNA_def_property_ui_text(prop, "Screen Space Refractions", "Enable screen space Refractions"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "ssr_halfres", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_halfres_get", + "rna_LayerEngineSettings_Eevee_ssr_halfres_set"); + RNA_def_property_ui_text(prop, "Half Res Trace", "Raytrace at a lower resolution"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "ssr_quality", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_quality_get", + "rna_LayerEngineSettings_Eevee_ssr_quality_set", NULL); + RNA_def_property_ui_text(prop, "Trace Quality", "Quality of the screen space raytracing"); + 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_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "ssr_max_roughness", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_max_roughness_get", + "rna_LayerEngineSettings_Eevee_ssr_max_roughness_set", NULL); + RNA_def_property_ui_text(prop, "Max Roughness", "Do not raytrace reflections for roughness above this value"); + 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_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "ssr_ray_count", PROP_INT, PROP_NONE); + RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_ray_count_get", + "rna_LayerEngineSettings_Eevee_ssr_ray_count_set", NULL); + RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per pixels"); + RNA_def_property_range(prop, 1, 4); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "ssr_thickness", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_thickness_get", + "rna_LayerEngineSettings_Eevee_ssr_thickness_set", NULL); + RNA_def_property_ui_text(prop, "Thickness", "Pixel thickness used to detect intersection"); + RNA_def_property_range(prop, 1e-6f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 5, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "ssr_border_fade", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_border_fade_get", + "rna_LayerEngineSettings_Eevee_ssr_border_fade_set", NULL); + RNA_def_property_ui_text(prop, "Edge Fading", "Screen percentage used to fade the SSR"); + RNA_def_property_range(prop, 0.0f, 0.5f); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "ssr_firefly_fac", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_firefly_fac_get", + "rna_LayerEngineSettings_Eevee_ssr_firefly_fac_set", NULL); + RNA_def_property_ui_text(prop, "Clamp", "Clamp pixel intensity to remove noise (0 to disabled)"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + /* Volumetrics */ + prop = RNA_def_property(srna, "volumetric_enable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_enable_get", + "rna_LayerEngineSettings_Eevee_volumetric_enable_set"); + RNA_def_property_ui_text(prop, "Volumetrics", "Enable scattering and absorbance of volumetric material"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "volumetric_start", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_start_get", + "rna_LayerEngineSettings_Eevee_volumetric_start_set", NULL); + RNA_def_property_ui_text(prop, "Start", "Start distance of the volumetric effect"); + RNA_def_property_range(prop, 1e-6f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "volumetric_end", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_end_get", + "rna_LayerEngineSettings_Eevee_volumetric_end_set", NULL); + RNA_def_property_ui_text(prop, "End", "End distance of the volumetric effect"); + RNA_def_property_range(prop, 1e-6f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "volumetric_samples", PROP_INT, PROP_NONE); + RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_samples_get", + "rna_LayerEngineSettings_Eevee_volumetric_samples_set", NULL); + RNA_def_property_ui_text(prop, "Samples", "Number of samples to compute volumetric effects"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_range(prop, 1, 256); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "volumetric_sample_distribution", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_sample_distribution_get", + "rna_LayerEngineSettings_Eevee_volumetric_sample_distribution_set", NULL); + RNA_def_property_ui_text(prop, "Exponential Sampling", "Distribute more samples closer to the camera"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "volumetric_lights", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_lights_get", + "rna_LayerEngineSettings_Eevee_volumetric_lights_set"); + RNA_def_property_ui_text(prop, "Volumetric Lighting", "Enable scene lamps interactions with volumetrics"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "volumetric_light_clamp", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_light_clamp_get", + "rna_LayerEngineSettings_Eevee_volumetric_light_clamp_set", NULL); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_text(prop, "Clamp", "Maximum light contribution, reducing noise"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "volumetric_shadows", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_shadows_get", + "rna_LayerEngineSettings_Eevee_volumetric_shadows_set"); + RNA_def_property_ui_text(prop, "Volumetric Shadows", "Generate shadows from volumetric material (Very expensive)"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "volumetric_shadow_samples", PROP_INT, PROP_NONE); + RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_shadow_samples_get", + "rna_LayerEngineSettings_Eevee_volumetric_shadow_samples_set", NULL); + RNA_def_property_range(prop, 1, 128); + RNA_def_property_ui_text(prop, "Volumetric Shadow Samples", "Number of samples to compute volumetric shadowing"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "volumetric_colored_transmittance", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_colored_transmittance_get", + "rna_LayerEngineSettings_Eevee_volumetric_colored_transmittance_set"); + RNA_def_property_ui_text(prop, "Colored Transmittance", "Enable wavelength dependent volumetric transmittance"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + /* Ambient Occlusion */ + prop = RNA_def_property(srna, "gtao_enable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_enable_get", + "rna_LayerEngineSettings_Eevee_gtao_enable_set"); + RNA_def_property_ui_text(prop, "Ambient Occlusion", "Enable ambient occlusion to simulate medium scale indirect shadowing"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "gtao_use_bent_normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_use_bent_normals_get", + "rna_LayerEngineSettings_Eevee_gtao_use_bent_normals_set"); + RNA_def_property_ui_text(prop, "Bent Normals", "Compute main non occluded direction to sample the environment"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "gtao_denoise", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_denoise_get", + "rna_LayerEngineSettings_Eevee_gtao_denoise_set"); + RNA_def_property_ui_text(prop, "Denoise", "Use denoising to filter the resulting occlusion and bent normal but exhibit 2x2 pixel blocks"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "gtao_bounce", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_bounce_get", + "rna_LayerEngineSettings_Eevee_gtao_bounce_set"); + RNA_def_property_ui_text(prop, "Bounces Approximation", "An approximation to simulate light bounces " + "giving less occlusion on brighter objects"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "gtao_factor", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_factor_get", "rna_LayerEngineSettings_Eevee_gtao_factor_set", NULL); + RNA_def_property_ui_text(prop, "Factor", "Factor for ambient occlusion blending"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 2); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update"); + + prop = RNA_def_property(srna, "gtao_quality", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_quality_get", "rna_LayerEngineSettings_Eevee_gtao_quality_set", NULL); + RNA_def_property_ui_text(prop, "Trace Quality", "Quality of the horizon search"); + 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_LayerCollectionEngineSettings_update"); + + prop = RNA_def_property(srna, "gtao_distance", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_distance_get", "rna_LayerEngineSettings_Eevee_gtao_distance_set", NULL); + RNA_def_property_ui_text(prop, "Distance", "Distance of object that contribute to the ambient occlusion 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_LayerCollectionEngineSettings_update"); + + prop = RNA_def_property(srna, "gtao_samples", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_samples_get", + "rna_LayerEngineSettings_Eevee_gtao_samples_set", NULL); + RNA_def_property_ui_text(prop, "Samples", "Number of samples to take to compute occlusion"); + RNA_def_property_range(prop, 2, 32); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + /* Depth of Field */ + prop = RNA_def_property(srna, "dof_enable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_dof_enable_get", + "rna_LayerEngineSettings_Eevee_dof_enable_set"); + RNA_def_property_ui_text(prop, "Depth of Field", "Enable depth of field using the values from the active camera"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bokeh_max_size", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bokeh_max_size_get", + "rna_LayerEngineSettings_Eevee_bokeh_max_size_set", NULL); + RNA_def_property_ui_text(prop, "Max Size", "Max size of the bokeh shape for the depth of field (lower is faster)"); + RNA_def_property_range(prop, 0.0f, 2000.0f); + RNA_def_property_ui_range(prop, 2.0f, 200.0f, 1, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bokeh_threshold", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bokeh_threshold_get", + "rna_LayerEngineSettings_Eevee_bokeh_threshold_set", NULL); + RNA_def_property_ui_text(prop, "Sprite Threshold", "Brightness threshold for using sprite base depth of field"); + RNA_def_property_range(prop, 0.0f, 100000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + /* Bloom */ + prop = RNA_def_property(srna, "bloom_enable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_enable_get", + "rna_LayerEngineSettings_Eevee_bloom_enable_set"); + RNA_def_property_ui_text(prop, "Bloom", "High brighness pixels generate a glowing effect"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bloom_threshold", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_threshold_get", + "rna_LayerEngineSettings_Eevee_bloom_threshold_set", NULL); + RNA_def_property_ui_text(prop, "Threshold", "Filters out pixels under this level of brightness"); + RNA_def_property_range(prop, 0.0f, 100000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bloom_color", PROP_FLOAT, PROP_COLOR); + RNA_def_property_array(prop, 3); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_color_get", + "rna_LayerEngineSettings_Eevee_bloom_color_set", NULL); + RNA_def_property_ui_text(prop, "Color", "Color applied to the bloom effect"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bloom_knee", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_knee_get", + "rna_LayerEngineSettings_Eevee_bloom_knee_set", NULL); + RNA_def_property_ui_text(prop, "Knee", "Makes transition between under/over-threshold gradual"); + 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_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bloom_radius", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_radius_get", + "rna_LayerEngineSettings_Eevee_bloom_radius_set", NULL); + RNA_def_property_ui_text(prop, "Radius", "Bloom spread distance"); + RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bloom_clamp", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_clamp_get", + "rna_LayerEngineSettings_Eevee_bloom_clamp_set", NULL); + RNA_def_property_ui_text(prop, "Clamp", "Maximum intensity a bloom pixel can have"); + RNA_def_property_range(prop, 0.0f, 1000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bloom_intensity", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_intensity_get", + "rna_LayerEngineSettings_Eevee_bloom_intensity_set", NULL); + RNA_def_property_ui_text(prop, "Intensity", "Blend factor"); + RNA_def_property_range(prop, 0.0f, 10000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + /* Motion blur */ + prop = RNA_def_property(srna, "motion_blur_enable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_motion_blur_enable_get", + "rna_LayerEngineSettings_Eevee_motion_blur_enable_set"); + RNA_def_property_ui_text(prop, "Motion Blur", "Enable motion blur effect (only in camera view)"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_motion_blur_samples_get", + "rna_LayerEngineSettings_Eevee_motion_blur_samples_set", NULL); + RNA_def_property_ui_text(prop, "Samples", "Number of samples to take with motion blur"); + RNA_def_property_range(prop, 1, 64); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_motion_blur_shutter_get", + "rna_LayerEngineSettings_Eevee_motion_blur_shutter_set", NULL); + RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close"); + RNA_def_property_ui_range(prop, 0.01f, 2.0f, 1, 2); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + /* Shadows */ + prop = RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Eevee_shadow_method_get", "rna_LayerEngineSettings_Eevee_shadow_method_set", NULL); + RNA_def_property_enum_items(prop, eevee_shadow_method_items); + RNA_def_property_ui_text(prop, "Method", "Technique use to compute the shadows"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "shadow_size", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Eevee_shadow_size_get", "rna_LayerEngineSettings_Eevee_shadow_size_set", NULL); + RNA_def_property_enum_items(prop, eevee_shadow_size_items); + RNA_def_property_ui_text(prop, "Size", "Size of every shadow maps"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "shadow_high_bitdepth", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_shadow_high_bitdepth_get", "rna_LayerEngineSettings_Eevee_shadow_high_bitdepth_set"); + RNA_def_property_ui_text(prop, "High Bitdepth", "Use 32bit shadows"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + RNA_define_verify_sdna(1); /* not in sdna */ +} + +#ifdef WITH_CLAY_ENGINE +static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static const 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, "LayerCollectionEngineSettingsClay", "LayerCollectionSettings"); + RNA_def_struct_ui_text(srna, "Collections Clay Engine Settings", "Engine specific settings for this collection"); + + RNA_define_verify_sdna(0); /* not in sdna */ + + /* see RNA_LAYER_ENGINE_GET_SET macro */ + 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_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_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_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_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_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_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_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); + 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_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); + 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_LayerCollectionEngineSettings_update"); + + prop = RNA_def_property(srna, "hair_brightness_randomness", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_hair_brightness_randomness_get", "rna_LayerEngineSettings_Clay_hair_brightness_randomness_set", NULL); + RNA_def_property_ui_text(prop, "Hair Brightness Randomness", "Brightness randomness for hair"); + 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_LayerCollectionEngineSettings_update"); + + 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, "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 */ + + prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE); + 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_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_LayerCollectionEngineSettings_update"); + + RNA_define_verify_sdna(1); /* not in sdna */ +} + +static void rna_def_layer_collection_mode_settings_edit(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + 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 */ + + prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE); + 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_LayerCollectionEngineSettings_update"); + + prop = RNA_def_property(srna, "show_weight", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Show Weights", "Draw weights in editmode"); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_show_weight_get", "rna_LayerEngineSettings_EditMode_show_weight_set"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + 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_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_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_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"); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_EditMode_normals_length_get", "rna_LayerEngineSettings_EditMode_normals_length_set", NULL); + 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_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_LayerCollectionEngineSettings_update"); + + RNA_define_verify_sdna(1); /* not in sdna */ +} + +static void rna_def_layer_collection_mode_settings_paint_weight(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "LayerCollectionModeSettingsPaintWeight", "LayerCollectionSettings"); + RNA_def_struct_ui_text(srna, "Collections Weight Paint Mode Settings", "Weight Paint Mode specific settings to be overridden per collection"); + RNA_define_verify_sdna(0); /* not in sdna */ + + /* see RNA_LAYER_ENGINE_GET_SET macro */ + + prop = RNA_def_property(srna, "use_shading", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Use Shading", "Whether to use shaded or shadeless drawing"); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintWeightMode_use_shading_get", "rna_LayerEngineSettings_PaintWeightMode_use_shading_set"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update"); + + prop = RNA_def_property(srna, "use_wire", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Show Wire", "Whether to overlay wireframe onto the mesh"); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintWeightMode_use_wire_get", "rna_LayerEngineSettings_PaintWeightMode_use_wire_set"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_wire_update"); + + RNA_define_verify_sdna(1); /* not in sdna */ +} + +static void rna_def_layer_collection_mode_settings_paint_vertex(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "LayerCollectionModeSettingsPaintVertex", "LayerCollectionSettings"); + RNA_def_struct_ui_text(srna, "Collections Vertex Paint Mode Settings", "Vertex Paint Mode specific settings to be overridden per collection"); + RNA_define_verify_sdna(0); /* not in sdna */ + + /* see RNA_LAYER_ENGINE_GET_SET macro */ + + prop = RNA_def_property(srna, "use_shading", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Use Shading", "Whether to use shaded or shadeless drawing"); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintVertexMode_use_shading_get", "rna_LayerEngineSettings_PaintVertexMode_use_shading_set"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update"); + + prop = RNA_def_property(srna, "use_wire", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Show Wire", "Whether to overlay wireframe onto the mesh"); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintVertexMode_use_wire_get", "rna_LayerEngineSettings_PaintVertexMode_use_wire_set"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_wire_update"); + + RNA_define_verify_sdna(1); /* not in sdna */ +} + +static void rna_def_scene_layer_settings(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + FunctionRNA *func; + PropertyRNA *parm; + + srna = RNA_def_struct(brna, "SceneLayerSettings", NULL); + RNA_def_struct_sdna(srna, "IDProperty"); + RNA_def_struct_ui_text(srna, "Scene Layer Settings", + "Engine specific settings that can be overriden by SceneLayer"); + RNA_def_struct_refine_func(srna, "rna_SceneLayerSettings_refine"); + + RNA_define_verify_sdna(0); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, "rna_SceneLayerSettings_name_get", "rna_SceneLayerSettings_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); + + func = RNA_def_function(srna, "use", "rna_SceneLayerSettings_use"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + RNA_def_function_ui_description(func, "Initialize this property to use"); + parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to set"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + + func = RNA_def_function(srna, "unuse", "rna_SceneLayerSettings_unuse"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + RNA_def_function_ui_description(func, "Remove the property"); + parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to unset"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + +#ifdef WITH_CLAY_ENGINE + rna_def_scene_layer_engine_settings_clay(brna); +#endif + rna_def_scene_layer_engine_settings_eevee(brna); + +#if 0 + rna_def_scene_layer_mode_settings_object(brna); + rna_def_scene_layer_mode_settings_edit(brna); + rna_def_scene_layer_mode_settings_paint_weight(brna); + rna_def_scene_layer_mode_settings_paint_vertex(brna); +#endif + + RNA_define_verify_sdna(1); +} + +static void rna_def_layer_collection_settings(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + FunctionRNA *func; + PropertyRNA *parm; + + srna = RNA_def_struct(brna, "LayerCollectionSettings", NULL); + RNA_def_struct_sdna(srna, "IDProperty"); + 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"); + + 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); + + func = RNA_def_function(srna, "use", "rna_LayerCollectionSettings_use"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + RNA_def_function_ui_description(func, "Initialize this property to use"); + parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to set"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + + func = RNA_def_function(srna, "unuse", "rna_LayerCollectionSettings_unuse"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + RNA_def_function_ui_description(func, "Remove the property"); + parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to unset"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + +#ifdef WITH_CLAY_ENGINE + rna_def_layer_collection_engine_settings_clay(brna); +#endif + + rna_def_layer_collection_mode_settings_object(brna); + rna_def_layer_collection_mode_settings_edit(brna); + rna_def_layer_collection_mode_settings_paint_weight(brna); + rna_def_layer_collection_mode_settings_paint_vertex(brna); + + RNA_define_verify_sdna(1); +} + +static void rna_def_layer_collection(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + srna = RNA_def_struct(brna, "LayerCollection", NULL); + RNA_def_struct_ui_text(srna, "Layer Collection", "Layer collection"); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, "rna_LayerCollection_name_get", "rna_LayerCollection_name_length", "rna_LayerCollection_name_set"); + RNA_def_property_ui_text(prop, "Name", "Collection name"); + RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + + prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "scene_collection"); + RNA_def_property_struct_type(prop, "SceneCollection"); + RNA_def_property_ui_text(prop, "Collection", "Collection this layer collection is wrapping"); + + prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL); + RNA_def_property_struct_type(prop, "LayerCollection"); + RNA_def_property_ui_text(prop, "Layer Collections", ""); + + prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_LayerCollection_objects_get", NULL, NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Objects", "All the objects directly or indirectly added to this collection (not including sub-collection objects)"); + + prop = RNA_def_property(srna, "overrides", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "overrides", NULL); + RNA_def_property_struct_type(prop, "LayerCollectionOverride"); + RNA_def_property_ui_text(prop, "Collection Overrides", ""); + + /* 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 | FUNC_USE_MAIN); + parm = RNA_def_pointer(func, "lc_dst", "LayerCollection", "Collection", "Reference collection above which the collection will move"); + parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "move_below", "rna_LayerCollection_move_below"); + RNA_def_function_ui_description(func, "Move collection before another"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); + parm = RNA_def_pointer(func, "lc_dst", "LayerCollection", "Collection", "Reference collection below which the collection will move"); + parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "move_into", "rna_LayerCollection_move_into"); + RNA_def_function_ui_description(func, "Move collection into another"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); + parm = RNA_def_pointer(func, "lc_dst", "LayerCollection", "Collection", "Collection to insert into"); + parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "enable_set", "rna_LayerCollection_enable_set"); + RNA_def_function_ui_description(func, "Enable or disable a collection"); + parm = RNA_def_boolean(func, "value", 1, "Enable", ""); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS); + + /* Flags */ + prop = RNA_def_property(srna, "is_enabled", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_DISABLED); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Enabled", "Enable or disable collection from depsgraph"); + + prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_VISIBLE); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1); + RNA_def_property_ui_text(prop, "Hide", "Restrict visiblity"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update"); + + prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_SELECTABLE); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1); + RNA_def_property_ui_text(prop, "Hide Selectable", "Restrict selection"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update"); + + /* TODO_LAYER_OVERRIDE */ +} + +static void rna_def_layer_collections(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *prop; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "LayerCollections"); + srna = RNA_def_struct(brna, "LayerCollections", NULL); + RNA_def_struct_sdna(srna, "SceneLayer"); + RNA_def_struct_ui_text(srna, "Layer Collections", "Collections of render layer"); + + prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "active_collection"); + RNA_def_property_int_funcs(prop, "rna_LayerCollections_active_collection_index_get", + "rna_LayerCollections_active_collection_index_set", + "rna_LayerCollections_active_collection_index_range"); + RNA_def_property_ui_text(prop, "Active Collection Index", "Active index in layer collection array"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL); + + prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "LayerCollection"); + RNA_def_property_pointer_funcs(prop, "rna_LayerCollections_active_collection_get", + "rna_LayerCollections_active_collection_set", NULL, NULL); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); + RNA_def_property_ui_text(prop, "Active Layer Collection", "Active Layer Collection"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL); + + func = RNA_def_function(srna, "link", "rna_SceneLayer_collection_link"); + RNA_def_function_ui_description(func, "Link a collection to render layer"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); + parm = RNA_def_pointer(func, "scene_collection", "SceneCollection", "", "Collection to add to render layer"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); + parm = RNA_def_pointer(func, "result", "LayerCollection", "", "Newly created layer collection"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "unlink", "rna_SceneLayer_collection_unlink"); + RNA_def_function_ui_description(func, "Unlink a collection from render layer"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "layer_collection", "LayerCollection", "", "Layer collection to remove from render layer"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); +} + +static void rna_def_layer_objects(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + + RNA_def_property_srna(cprop, "LayerObjects"); + srna = RNA_def_struct(brna, "LayerObjects", NULL); + RNA_def_struct_sdna(srna, "SceneLayer"); + RNA_def_struct_ui_text(srna, "Layer Objects", "Collections of objects"); + + prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_pointer_funcs(prop, "rna_LayerObjects_active_object_get", "rna_LayerObjects_active_object_set", NULL, NULL); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); + RNA_def_property_ui_text(prop, "Active Object", "Active object for this layer"); + /* Could call: ED_base_object_activate(C, rl->basact); + * but would be a bad level call and it seems the notifier is enough */ + RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL); + + prop = RNA_def_property(srna, "selected", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_collection_funcs(prop, "rna_LayerObjects_selected_begin", "rna_iterator_listbase_next", + "rna_iterator_listbase_end", "rna_SceneLayer_objects_get", + NULL, NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Selected Objects", "All the selected objects of this layer"); +} + +static void rna_def_object_base(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "ObjectBase", NULL); + RNA_def_struct_sdna(srna, "Base"); + RNA_def_struct_ui_text(srna, "Object Base", "An object instance in a render layer"); + RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA); + + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "object"); + RNA_def_property_ui_text(prop, "Object", "Object this base links to"); + + prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", BASE_SELECTED); + RNA_def_property_ui_text(prop, "Select", "Object base selection state"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ObjectBase_select_update"); +} + +static void rna_def_scene_view_render(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static const EnumPropertyItem engine_items[] = { + {0, "BLENDER_RENDER", 0, "Blender Render", "Use the Blender internal rendering engine for rendering"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "ViewRenderSettings", NULL); + RNA_def_struct_sdna(srna, "ViewRender"); + RNA_def_struct_path_func(srna, "rna_ViewRenderSettings_path"); + RNA_def_struct_ui_text(srna, "View Render", "Rendering settings related to viewport drawing/rendering"); + + /* engine */ + prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, engine_items); + RNA_def_property_enum_funcs(prop, "rna_ViewRenderSettings_engine_get", "rna_ViewRenderSettings_engine_set", + "rna_ViewRenderSettings_engine_itemf"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering"); + RNA_def_property_update(prop, NC_WINDOW, "rna_ViewRenderSettings_engine_update"); + + prop = RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_multiple_engines_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available"); + + prop = RNA_def_property(srna, "use_shading_nodes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_use_shading_nodes_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Use Shading Nodes", "Active render engine uses new shading nodes system"); + + prop = RNA_def_property(srna, "use_spherical_stereo", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_use_spherical_stereo_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Use Spherical Stereo", "Active render engine supports spherical stereo rendering"); + + prop = RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_use_game_engine_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Use Game Engine", "Current rendering engine is a game engine"); +} + +void RNA_def_scene_layer(BlenderRNA *brna) +{ + FunctionRNA *func; + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SceneLayer", NULL); + RNA_def_struct_ui_text(srna, "Render Layer", "Render layer"); + RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneLayer_name_set"); + RNA_def_property_ui_text(prop, "Name", "Render layer name"); + RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + + prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL); + RNA_def_property_struct_type(prop, "LayerCollection"); + RNA_def_property_ui_text(prop, "Layer Collections", ""); + rna_def_layer_collections(brna, prop); + + prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SceneLayer_objects_get", NULL, NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Objects", "All the objects in this layer"); + rna_def_layer_objects(brna, prop); + + /* layer options */ + prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SCENE_LAYER_RENDER); + RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL); + + /* 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, "SceneLayerSettings"); + RNA_def_property_ui_text(prop, "Layer Settings", "Override of engine specific render settings"); + + /* debug update routine */ + func = RNA_def_function(srna, "update", "rna_SceneLayer_update_tagged"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, + "Update data tagged to be updated from previous access to data or operators"); + + /* Nested Data */ + /* *** Non-Animated *** */ + RNA_define_animate_sdna(false); + rna_def_scene_collection(brna); + rna_def_layer_collection(brna); + rna_def_layer_collection_override(brna); + rna_def_object_base(brna); + RNA_define_animate_sdna(true); + /* *** Animated *** */ + rna_def_scene_layer_settings(brna); + rna_def_layer_collection_settings(brna); + rna_def_scene_view_render(brna); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index ab1802ed0e0..21159bbc240 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -438,14 +438,6 @@ static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = { #endif -const EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[] = { - {COLLECTION_MODE_OBJECT, "OBJECT", 0, "Object", ""}, - {COLLECTION_MODE_EDIT, "EDIT", 0, "Edit", ""}, - {COLLECTION_MODE_PAINT_WEIGHT, "PAINT_WEIGHT", 0, "Weight Paint", ""}, - {COLLECTION_MODE_PAINT_WEIGHT, "PAINT_VERTEX", 0, "Vertex Paint", ""}, - {0, NULL, 0, NULL, NULL} -}; - #ifdef RNA_RUNTIME #include "DNA_anim_types.h" @@ -1008,11 +1000,6 @@ static void rna_RenderSettings_stereoViews_begin(CollectionPropertyIterator *ite rna_iterator_listbase_begin(iter, &rd->views, rna_RenderSettings_stereoViews_skip); } -static char *rna_ViewRenderSettings_path(PointerRNA *UNUSED(ptr)) -{ - return BLI_sprintfN("viewport_render"); -} - static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("render"); @@ -1502,56 +1489,6 @@ static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value) rd->views_format = value; } -static void rna_ViewRenderSettings_engine_set(PointerRNA *ptr, int value) -{ - ViewRender *view_render = (ViewRender *)ptr->data; - RenderEngineType *type = BLI_findlink(&R_engines, value); - - if (type) { - BLI_strncpy_utf8(view_render->engine_id, type->idname, sizeof(view_render->engine_id)); - DEG_id_tag_update(ptr->id.data, DEG_TAG_COPY_ON_WRITE); - } -} - -static const EnumPropertyItem *rna_ViewRenderSettings_engine_itemf( - bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) -{ - RenderEngineType *type; - EnumPropertyItem *item = NULL; - EnumPropertyItem tmp = {0, "", 0, "", ""}; - int a = 0, totitem = 0; - - for (type = R_engines.first; type; type = type->next, a++) { - tmp.value = a; - tmp.identifier = type->idname; - tmp.name = type->name; - RNA_enum_item_add(&item, &totitem, &tmp); - } - - RNA_enum_item_end(&item, &totitem); - *r_free = true; - - return item; -} - -static int rna_ViewRenderSettings_engine_get(PointerRNA *ptr) -{ - ViewRender *view_render = (ViewRender *)ptr->data; - RenderEngineType *type; - int a = 0; - - for (type = R_engines.first; type; type = type->next, a++) - if (STREQ(type->idname, view_render->engine_id)) - return a; - - return 0; -} - -static void rna_ViewRenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr)) -{ - ED_render_engine_changed(bmain); -} - static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; @@ -1643,35 +1580,6 @@ static char *rna_SceneRenderView_path(PointerRNA *ptr) return BLI_sprintfN("render.views[\"%s\"]", srv->name); } -static int rna_ViewRenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) -{ - return (BLI_listbase_count(&R_engines) > 1); -} - -static int rna_ViewRenderSettings_use_shading_nodes_get(PointerRNA *ptr) -{ - ViewRender *view_render = (ViewRender *)ptr->data; - return BKE_viewrender_use_new_shading_nodes(view_render); -} - -static int rna_ViewRenderSettings_use_spherical_stereo_get(PointerRNA *ptr) -{ - ViewRender *view_render = (ViewRender *)ptr->data; - return BKE_viewrender_use_spherical_stereo(view_render); -} - -static int rna_ViewRenderSettings_use_game_engine_get(PointerRNA *ptr) -{ - ViewRender *view_render = (ViewRender *)ptr->data; - RenderEngineType *type; - - for (type = R_engines.first; type; type = type->next) - if (STREQ(type->idname, view_render->engine_id)) - return (type->flag & RE_GAME) != 0; - - return 0; -} - static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values) { SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data; @@ -1883,71 +1791,6 @@ static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value) gm->exitkey = value; } -static StructRNA *rna_SceneLayerSettings_refine(PointerRNA *ptr) -{ - IDProperty *props = (IDProperty *)ptr->data; - BLI_assert(props && props->type == IDP_GROUP); - - switch (props->subtype) { - case IDP_GROUP_SUB_ENGINE_RENDER: -#ifdef WITH_CLAY_ENGINE - if (STREQ(props->name, RE_engine_id_BLENDER_CLAY)) { - return &RNA_SceneLayerEngineSettingsClay; - } -#endif - if (STREQ(props->name, RE_engine_id_BLENDER_EEVEE)) { - return &RNA_SceneLayerEngineSettingsEevee; - } - break; - case IDP_GROUP_SUB_MODE_OBJECT: - case IDP_GROUP_SUB_MODE_EDIT: - case IDP_GROUP_SUB_MODE_PAINT_WEIGHT: - case IDP_GROUP_SUB_MODE_PAINT_VERTEX: - default: - BLI_assert(!"Mode not fully implemented"); - break; - } - - return &RNA_SceneLayerSettings; -} - -static StructRNA *rna_LayerCollectionSettings_refine(PointerRNA *ptr) -{ - IDProperty *props = (IDProperty *)ptr->data; - BLI_assert(props && props->type == IDP_GROUP); - - 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 - if (STREQ(props->name, RE_engine_id_BLENDER_EEVEE)) { - /* printf("Mode not fully implemented\n"); */ - return &RNA_LayerCollectionSettings; - } - break; - case IDP_GROUP_SUB_MODE_OBJECT: - return &RNA_LayerCollectionModeSettingsObject; - break; - case IDP_GROUP_SUB_MODE_EDIT: - return &RNA_LayerCollectionModeSettingsEdit; - break; - case IDP_GROUP_SUB_MODE_PAINT_WEIGHT: - return &RNA_LayerCollectionModeSettingsPaintWeight; - break; - case IDP_GROUP_SUB_MODE_PAINT_VERTEX: - return &RNA_LayerCollectionModeSettingsPaintVertex; - break; - default: - BLI_assert(!"Mode not fully implemented"); - break; - } - - return &RNA_LayerCollectionSettings; -} - static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[], int frame) { TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); @@ -2271,735 +2114,6 @@ static int rna_gpu_is_hq_supported_get(PointerRNA *UNUSED(ptr)) return true; } -static void rna_SceneCollection_name_set(PointerRNA *ptr, const char *value) -{ - Scene *scene = (Scene *)ptr->id.data; - SceneCollection *sc = (SceneCollection *)ptr->data; - BKE_collection_rename(scene, sc, value); -} - -static void rna_SceneCollection_filter_set(PointerRNA *ptr, const char *value) -{ - Scene *scene = (Scene *)ptr->id.data; - SceneCollection *sc = (SceneCollection *)ptr->data; - BLI_strncpy_utf8(sc->filter, value, sizeof(sc->filter)); - - TODO_LAYER_SYNC_FILTER; - (void)scene; -} - -static PointerRNA rna_SceneCollection_objects_get(CollectionPropertyIterator *iter) -{ - ListBaseIterator *internal = &iter->internal.listbase; - - /* we are actually iterating a LinkData list, so override get */ - return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((LinkData *)internal->link)->data); -} - -static int rna_SceneCollection_move_above(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) -{ - Scene *scene = (Scene *)id; - - if (!BKE_collection_move_above(scene, sc_dst, sc_src)) { - return 0; - } - - DEG_relations_tag_update(bmain); - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); - - return 1; -} - -static int rna_SceneCollection_move_below(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) -{ - Scene *scene = (Scene *)id; - - if (!BKE_collection_move_below(scene, sc_dst, sc_src)) { - return 0; - } - - DEG_relations_tag_update(bmain); - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); - - return 1; -} - -static int rna_SceneCollection_move_into(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) -{ - Scene *scene = (Scene *)id; - - if (!BKE_collection_move_into(scene, sc_dst, sc_src)) { - return 0; - } - - DEG_relations_tag_update(bmain); - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); - - return 1; -} - -static SceneCollection *rna_SceneCollection_new( - ID *id, SceneCollection *sc_parent, Main *bmain, const char *name) -{ - Scene *scene = (Scene *)id; - SceneCollection *sc = BKE_collection_add(scene, sc_parent, name); - - DEG_relations_tag_update(bmain); - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); - - return sc; -} - -static void rna_SceneCollection_remove( - ID *id, SceneCollection *sc_parent, Main *bmain, ReportList *reports, PointerRNA *sc_ptr) -{ - Scene *scene = (Scene *)id; - SceneCollection *sc = sc_ptr->data; - - const int index = BLI_findindex(&sc_parent->scene_collections, sc); - if (index == -1) { - BKE_reportf(reports, RPT_ERROR, "Collection '%s' is not a sub-collection of '%s'", - sc->name, sc_parent->name); - return; - } - - if (!BKE_collection_remove(scene, sc)) { - BKE_reportf(reports, RPT_ERROR, "Collection '%s' could not be removed from collection '%s'", - sc->name, sc_parent->name); - return; - } - - RNA_POINTER_INVALIDATE(sc_ptr); - - DEG_relations_tag_update(bmain); - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); -} - -static int rna_SceneCollection_objects_active_index_get(PointerRNA *ptr) -{ - SceneCollection *sc = (SceneCollection *)ptr->data; - return sc->active_object_index; -} - -static void rna_SceneCollection_objects_active_index_set(PointerRNA *ptr, int value) -{ - SceneCollection *sc = (SceneCollection *)ptr->data; - sc->active_object_index = value; -} - -static void rna_SceneCollection_objects_active_index_range( - PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) -{ - SceneCollection *sc = (SceneCollection *)ptr->data; - *min = 0; - *max = max_ii(0, BLI_listbase_count(&sc->objects) - 1); -} - -void rna_SceneCollection_object_link( - ID *id, SceneCollection *sc, Main *bmain, ReportList *reports, Object *ob) -{ - Scene *scene = (Scene *)id; - - if (BLI_findptr(&sc->objects, ob, offsetof(LinkData, data))) { - BKE_reportf(reports, RPT_ERROR, "Object '%s' is already in collection '%s'", ob->id.name + 2, sc->name); - return; - } - - BKE_collection_object_add(scene, sc, ob); - - /* TODO(sergey): Only update relations for the current scene. */ - DEG_relations_tag_update(bmain); - - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(&scene->id, 0); - - DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); - - WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene); -} - -static void rna_SceneCollection_object_unlink( - ID *id, SceneCollection *sc, Main *bmain, ReportList *reports, Object *ob) -{ - Scene *scene = (Scene *)id; - - if (!BLI_findptr(&sc->objects, ob, offsetof(LinkData, data))) { - BKE_reportf(reports, RPT_ERROR, "Object '%s' is not in collection '%s'", ob->id.name + 2, sc->name); - return; - } - - BKE_collection_object_remove(bmain, scene, sc, ob, false); - - /* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */ - DEG_relations_tag_update(bmain); - - WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene); -} - -/****** layer collection engine settings *******/ - -#define RNA_LAYER_ENGINE_GET_SET(_TYPE_, _ENGINE_, _MODE_, _NAME_) \ -static _TYPE_ rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr) \ -{ \ - 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) \ -{ \ - IDProperty *props = (IDProperty *)ptr->data; \ - BKE_collection_engine_property_value_set_##_TYPE_(props, #_NAME_, value); \ -} - -#define RNA_LAYER_ENGINE_GET_SET_ARRAY(_TYPE_, _ENGINE_, _MODE_, _NAME_, _LEN_) \ -static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr, _TYPE_ *values) \ -{ \ - IDProperty *props = (IDProperty *)ptr->data; \ - IDProperty *idprop = IDP_GetPropertyFromGroup(props, #_NAME_); \ - if (idprop != NULL) { \ - memcpy(values, IDP_Array(idprop), sizeof(_TYPE_) * idprop->len); \ - } \ -} \ - \ -static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr, const _TYPE_ *values) \ -{ \ - IDProperty *props = (IDProperty *)ptr->data; \ - BKE_collection_engine_property_value_set_##_TYPE_##_array(props, #_NAME_, values); \ -} - -#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_FLOAT_ARRAY(_NAME_, _LEN_) \ - RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Clay, COLLECTION_MODE_NONE, _NAME_, _LEN_) - -#define RNA_LAYER_ENGINE_CLAY_GET_SET_INT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(int, Clay, COLLECTION_MODE_NONE, _NAME_) - -#define RNA_LAYER_ENGINE_CLAY_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, Clay, COLLECTION_MODE_NONE, _NAME_) - -#define RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(float, Eevee, COLLECTION_MODE_NONE, _NAME_) - -#define RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT_ARRAY(_NAME_, _LEN_) \ - RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Eevee, COLLECTION_MODE_NONE, _NAME_, _LEN_) - -#define RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(int, Eevee, COLLECTION_MODE_NONE, _NAME_) - -#define RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, Eevee, 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_OBJECT_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, 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_MODE_EDIT_GET_SET_INT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(int, EditMode, COLLECTION_MODE_EDIT, _NAME_) - -#define RNA_LAYER_MODE_EDIT_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, EditMode, COLLECTION_MODE_EDIT, _NAME_) - -#define RNA_LAYER_MODE_PAINT_WEIGHT_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, PaintWeightMode, COLLECTION_MODE_PAINT_WEIGHT, _NAME_) - -#define RNA_LAYER_MODE_PAINT_VERTEX_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, PaintVertexMode, COLLECTION_MODE_PAINT_VERTEX, _NAME_) - -/* clay engine */ -#ifdef WITH_CLAY_ENGINE -/* SceneLayer settings. */ -RNA_LAYER_ENGINE_CLAY_GET_SET_INT(ssao_samples) - -/* LayerCollection settings. */ -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) -RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(hair_brightness_randomness) -#endif /* WITH_CLAY_ENGINE */ - -/* eevee engine */ -/* SceneLayer settings. */ -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(gtao_enable) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(gtao_use_bent_normals) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(gtao_denoise) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(gtao_bounce) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(gtao_factor) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(gtao_quality) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(gtao_distance) -RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(gtao_samples) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(dof_enable) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bokeh_max_size) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bokeh_threshold) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(bloom_enable) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_threshold) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT_ARRAY(bloom_color, 3) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_knee) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_radius) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_clamp) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_intensity) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(motion_blur_enable) -RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(motion_blur_samples) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(motion_blur_shutter) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(volumetric_enable) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(volumetric_start) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(volumetric_end) -RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(volumetric_samples) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(volumetric_sample_distribution) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(volumetric_lights) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(volumetric_light_clamp) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(volumetric_shadows) -RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(volumetric_shadow_samples) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(volumetric_colored_transmittance) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(ssr_refraction) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(ssr_enable) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(ssr_halfres) -RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(ssr_ray_count) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_quality) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_max_roughness) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_thickness) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_border_fade) -RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_firefly_fac) -RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(shadow_method) -RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(shadow_size) -RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(shadow_high_bitdepth) -RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(taa_samples) -RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(gi_diffuse_bounces) -RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(gi_cubemap_resolution) - -/* object engine */ -RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(show_wire) -RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(show_backface_culling) - -/* mesh engine */ -RNA_LAYER_MODE_EDIT_GET_SET_BOOL(show_occlude_wire) -RNA_LAYER_MODE_EDIT_GET_SET_BOOL(show_weight) -RNA_LAYER_MODE_EDIT_GET_SET_BOOL(face_normals_show) -RNA_LAYER_MODE_EDIT_GET_SET_BOOL(vert_normals_show) -RNA_LAYER_MODE_EDIT_GET_SET_BOOL(loop_normals_show) -RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(normals_length) -RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(backwire_opacity) - -/* weight paint engine */ -RNA_LAYER_MODE_PAINT_WEIGHT_GET_SET_BOOL(use_shading) -RNA_LAYER_MODE_PAINT_WEIGHT_GET_SET_BOOL(use_wire) - -/* vertex paint engine */ -RNA_LAYER_MODE_PAINT_VERTEX_GET_SET_BOOL(use_shading) -RNA_LAYER_MODE_PAINT_VERTEX_GET_SET_BOOL(use_wire) - -#undef RNA_LAYER_ENGINE_GET_SET - -static void rna_SceneLayerEngineSettings_update(bContext *C, PointerRNA *UNUSED(ptr)) -{ - Scene *scene = CTX_data_scene(C); - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(&scene->id, 0); -} - -static void rna_LayerCollectionEngineSettings_update(bContext *C, PointerRNA *UNUSED(ptr)) -{ - Scene *scene = CTX_data_scene(C); - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(&scene->id, 0); -} - -static void rna_LayerCollectionEngineSettings_wire_update(bContext *C, PointerRNA *UNUSED(ptr)) -{ - Scene *scene = CTX_data_scene(C); - SceneLayer *sl = CTX_data_scene_layer(C); - Object *ob = OBACT_NEW(sl); - - if (ob != NULL && ob->type == OB_MESH) { - BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL); - } - - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(&scene->id, 0); -} - -/***********************************/ - -static void engine_settings_use(IDProperty *root, IDProperty *props, PointerRNA *props_ptr, const char *identifier) -{ - PropertyRNA *prop = RNA_struct_find_property(props_ptr, identifier); - - switch (RNA_property_type(prop)) { - case PROP_FLOAT: - { - float value = BKE_collection_engine_property_value_get_float(props, identifier); - BKE_collection_engine_property_add_float(root, identifier, value); - break; - } - case PROP_ENUM: - { - int value = BKE_collection_engine_property_value_get_int(props, identifier); - BKE_collection_engine_property_add_int(root, identifier, value); - break; - } - case PROP_INT: - { - int value = BKE_collection_engine_property_value_get_int(props, identifier); - BKE_collection_engine_property_add_int(root, identifier, value); - break; - } - case PROP_BOOLEAN: - { - int value = BKE_collection_engine_property_value_get_int(props, identifier); - BKE_collection_engine_property_add_bool(root, identifier, value); - break; - } - case PROP_STRING: - case PROP_POINTER: - case PROP_COLLECTION: - default: - break; - } -} - -static void rna_SceneLayerSettings_name_get(PointerRNA *ptr, char *value) -{ - IDProperty *props = (IDProperty *)ptr->data; - strcpy(value, props->name); -} - -static int rna_SceneLayerSettings_name_length(PointerRNA *ptr) -{ - IDProperty *props = (IDProperty *)ptr->data; - return strnlen(props->name, sizeof(props->name)); -} - -static void rna_SceneLayerSettings_use(ID *id, IDProperty *props, const char *identifier) -{ - Scene *scene = (Scene *)id; - PointerRNA scene_props_ptr; - IDProperty *scene_props; - - scene_props = BKE_scene_layer_engine_scene_get(scene, COLLECTION_MODE_NONE, props->name); - RNA_pointer_create(id, &RNA_SceneLayerSettings, scene_props, &scene_props_ptr); - - engine_settings_use(props, scene_props, &scene_props_ptr, identifier); - - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(id, 0); -} - -static void rna_SceneLayerSettings_unuse(ID *id, IDProperty *props, const char *identifier) -{ - IDProperty *prop_to_remove = IDP_GetPropertyFromGroup(props, identifier); - IDP_FreeFromGroup(props, prop_to_remove); - - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(id, 0); -} - -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_LayerCollectionSettings_use(ID *id, IDProperty *props, const char *identifier) -{ - Scene *scene = (Scene *)id; - PointerRNA scene_props_ptr; - IDProperty *scene_props; - - scene_props = BKE_layer_collection_engine_scene_get(scene, COLLECTION_MODE_NONE, props->name); - RNA_pointer_create(id, &RNA_LayerCollectionSettings, scene_props, &scene_props_ptr); - engine_settings_use(props, scene_props, &scene_props_ptr, identifier); - - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(id, 0); -} - -static void rna_LayerCollectionSettings_unuse(ID *id, IDProperty *props, const char *identifier) -{ - IDProperty *prop_to_remove = IDP_GetPropertyFromGroup(props, identifier); - IDP_FreeFromGroup(props, prop_to_remove); - - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(id, 0); -} - -static void rna_LayerCollection_name_get(PointerRNA *ptr, char *value) -{ - SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection; - strcpy(value, sc->name); -} - -static int rna_LayerCollection_name_length(PointerRNA *ptr) -{ - SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection; - return strnlen(sc->name, sizeof(sc->name)); -} - -static void rna_LayerCollection_name_set(PointerRNA *ptr, const char *value) -{ - Scene *scene = (Scene *)ptr->id.data; - SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection; - BKE_collection_rename(scene, sc, value); -} - -static PointerRNA rna_LayerCollection_objects_get(CollectionPropertyIterator *iter) -{ - ListBaseIterator *internal = &iter->internal.listbase; - Base *base = ((LinkData *)internal->link)->data; - return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object); -} - -static int rna_LayerCollection_move_above(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) -{ - Scene *scene = (Scene *)id; - - if (!BKE_layer_collection_move_above(scene, lc_dst, lc_src)) { - return 0; - } - - DEG_relations_tag_update(bmain); - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); - - return 1; -} - -static int rna_LayerCollection_move_below(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) -{ - Scene *scene = (Scene *)id; - - if (!BKE_layer_collection_move_below(scene, lc_dst, lc_src)) { - return 0; - } - - DEG_relations_tag_update(bmain); - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); - - return 1; -} - -static int rna_LayerCollection_move_into(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) -{ - Scene *scene = (Scene *)id; - - if (!BKE_layer_collection_move_into(scene, lc_dst, lc_src)) { - return 0; - } - - DEG_relations_tag_update(bmain); - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); - - return 1; -} - -static void rna_LayerCollection_flag_update(bContext *C, PointerRNA *UNUSED(ptr)) -{ - Scene *scene = CTX_data_scene(C); - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(&scene->id, 0); - WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); -} - -static void rna_LayerCollection_enable_set( - ID *id, LayerCollection *layer_collection, Main *bmain, bContext *C, ReportList *reports, int value) -{ - Scene *scene = (Scene *)id; - SceneLayer *scene_layer = BKE_scene_layer_find_from_collection(scene, layer_collection); - - if (layer_collection->flag & COLLECTION_DISABLED) { - if (value == 1) { - BKE_collection_enable(scene_layer, layer_collection); - } - else { - BKE_reportf(reports, RPT_ERROR, "Layer collection '%s' is already disabled", - layer_collection->scene_collection->name); - return; - } - } - else { - if (value == 0) { - BKE_collection_disable(scene_layer, layer_collection); - } - else { - BKE_reportf(reports, RPT_ERROR, "Layer collection '%s' is already enabled", - layer_collection->scene_collection->name); - } - } - - DEG_relations_tag_update(bmain); - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(&scene->id, 0); - WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); - WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene); -} - -static int rna_LayerCollections_active_collection_index_get(PointerRNA *ptr) -{ - SceneLayer *sl = (SceneLayer *)ptr->data; - return sl->active_collection; -} - -static void rna_LayerCollections_active_collection_index_set(PointerRNA *ptr, int value) -{ - SceneLayer *sl = (SceneLayer *)ptr->data; - int num_collections = BKE_layer_collection_count(sl); - sl->active_collection = min_ff(value, num_collections - 1); -} - -static void rna_LayerCollections_active_collection_index_range( - PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) -{ - SceneLayer *sl = (SceneLayer *)ptr->data; - *min = 0; - *max = max_ii(0, BKE_layer_collection_count(sl) - 1); -} - -static PointerRNA rna_LayerCollections_active_collection_get(PointerRNA *ptr) -{ - SceneLayer *sl = (SceneLayer *)ptr->data; - LayerCollection *lc = BKE_layer_collection_get_active(sl); - return rna_pointer_inherit_refine(ptr, &RNA_LayerCollection, lc); -} - -static void rna_LayerCollections_active_collection_set(PointerRNA *ptr, PointerRNA value) -{ - SceneLayer *sl = (SceneLayer *)ptr->data; - LayerCollection *lc = (LayerCollection *)value.data; - const int index = BKE_layer_collection_findindex(sl, lc); - if (index != -1) sl->active_collection = index; -} - -LayerCollection * rna_SceneLayer_collection_link( - ID *id, SceneLayer *sl, Main *bmain, SceneCollection *sc) -{ - Scene *scene = (Scene *)id; - LayerCollection *lc = BKE_collection_link(sl, sc); - - DEG_relations_tag_update(bmain); - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(id, 0); - WM_main_add_notifier(NC_SCENE | ND_LAYER, scene); - - return lc; -} - -static void rna_SceneLayer_collection_unlink( - ID *id, SceneLayer *sl, Main *bmain, ReportList *reports, LayerCollection *lc) -{ - Scene *scene = (Scene *)id; - - if (BLI_findindex(&sl->layer_collections, lc) == -1) { - BKE_reportf(reports, RPT_ERROR, "Layer collection '%s' is not in '%s'", lc->scene_collection->name, sl->name); - return; - } - - BKE_collection_unlink(sl, lc); - - DEG_relations_tag_update(bmain); - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(id, 0); - WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene); -} - -static PointerRNA rna_LayerObjects_active_object_get(PointerRNA *ptr) -{ - SceneLayer *sl = (SceneLayer *)ptr->data; - return rna_pointer_inherit_refine(ptr, &RNA_Object, sl->basact ? sl->basact->object : NULL); -} - -static void rna_LayerObjects_active_object_set(PointerRNA *ptr, PointerRNA value) -{ - SceneLayer *sl = (SceneLayer *)ptr->data; - if (value.data) - sl->basact = BKE_scene_layer_base_find(sl, (Object *)value.data); - else - sl->basact = NULL; -} - -static void rna_SceneLayer_name_set(PointerRNA *ptr, const char *value) -{ - Scene *scene = (Scene *)ptr->id.data; - SceneLayer *sl = (SceneLayer *)ptr->data; - char oldname[sizeof(sl->name)]; - - BLI_strncpy(oldname, sl->name, sizeof(sl->name)); - - BLI_strncpy_utf8(sl->name, value, sizeof(sl->name)); - BLI_uniquename(&scene->render_layers, sl, DATA_("SceneLayer"), '.', offsetof(SceneLayer, name), sizeof(sl->name)); - - if (scene->nodetree) { - bNode *node; - int index = BLI_findindex(&scene->render_layers, sl); - - for (node = scene->nodetree->nodes.first; node; node = node->next) { - if (node->type == CMP_NODE_R_LAYERS && node->id == NULL) { - if (node->custom1 == index) - BLI_strncpy(node->name, sl->name, NODE_MAXSTR); - } - } - } -} - -static PointerRNA rna_SceneLayer_objects_get(CollectionPropertyIterator *iter) -{ - ListBaseIterator *internal = &iter->internal.listbase; - - /* we are actually iterating a ObjectBase list, so override get */ - Base *base = (Base *)internal->link; - return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object); -} - -static int rna_SceneLayer_objects_selected_skip(CollectionPropertyIterator *iter, void *UNUSED(data)) -{ - ListBaseIterator *internal = &iter->internal.listbase; - Base *base = (Base *)internal->link; - - if ((base->flag & BASE_SELECTED) != 0) { - return 0; - } - - return 1; -}; - -static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) -{ - SceneLayer *sl = (SceneLayer *)ptr->data; - rna_iterator_listbase_begin(iter, &sl->object_bases, rna_SceneLayer_objects_selected_skip); -} - -static void rna_SceneLayer_update_tagged(SceneLayer *UNUSED(sl), bContext *C) -{ - Depsgraph *graph = CTX_data_depsgraph(C); - DEG_OBJECT_ITER(graph, ob, DEG_OBJECT_ITER_FLAG_ALL) - { - /* Don't do anything, we just need to run the iterator to flush - * the base info to the objects. */ - UNUSED_VARS(ob); - } - DEG_OBJECT_ITER_END -} - static int rna_SceneLayer_active_layer_index_get(PointerRNA *ptr) { Scene *scene = (Scene *)ptr->data; @@ -3061,13 +2175,6 @@ static void rna_SceneLayer_remove( RNA_POINTER_INVALIDATE(sl_ptr); } } - -static void rna_ObjectBase_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -{ - Base *base = (Base *)ptr->data; - short mode = (base->flag & BASE_SELECTED) ? BA_SELECT : BA_DESELECT; - ED_object_base_select(base, mode); -} #else /* Grease Pencil Interpolation tool settings */ @@ -5940,1133 +5047,6 @@ static void rna_def_gpu_fx(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUFXSettings_fx_update"); } -/* Render Layers and Collections */ - -static void rna_def_scene_collections(BlenderRNA *brna, PropertyRNA *cprop) -{ - StructRNA *srna; - FunctionRNA *func; - PropertyRNA *parm; - - RNA_def_property_srna(cprop, "SceneCollections"); - srna = RNA_def_struct(brna, "SceneCollections", NULL); - RNA_def_struct_sdna(srna, "SceneCollection"); - RNA_def_struct_ui_text(srna, "Scene Collection", "Collection of scene collections"); - - func = RNA_def_function(srna, "new", "rna_SceneCollection_new"); - RNA_def_function_ui_description(func, "Add a collection to scene"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); - parm = RNA_def_string(func, "name", "SceneCollection", 0, "", "New name for the collection (not unique)"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - parm = RNA_def_pointer(func, "result", "SceneCollection", "", "Newly created collection"); - RNA_def_function_return(func, parm); - - func = RNA_def_function(srna, "remove", "rna_SceneCollection_remove"); - RNA_def_function_ui_description(func, "Remove a collection layer"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); - parm = RNA_def_pointer(func, "layer", "SceneCollection", "", "Collection to remove"); - RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); - RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); -} - -static void rna_def_collection_objects(BlenderRNA *brna, PropertyRNA *cprop) -{ - StructRNA *srna; - FunctionRNA *func; - PropertyRNA *parm; - PropertyRNA *prop; - - RNA_def_property_srna(cprop, "CollectionObjects"); - srna = RNA_def_struct(brna, "CollectionObjects", NULL); - RNA_def_struct_sdna(srna, "SceneCollection"); - RNA_def_struct_ui_text(srna, "Collection Objects", "Objects of a collection"); - - prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_funcs(prop, "rna_SceneCollection_objects_active_index_get", - "rna_SceneCollection_objects_active_index_set", - "rna_SceneCollection_objects_active_index_range"); - RNA_def_property_ui_text(prop, "Active Object Index", "Active index in collection objects array"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); - - func = RNA_def_function(srna, "link", "rna_SceneCollection_object_link"); - RNA_def_function_ui_description(func, "Link an object to collection"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); - parm = RNA_def_pointer(func, "object", "Object", "", "Object to add to collection"); - RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); - - func = RNA_def_function(srna, "unlink", "rna_SceneCollection_object_unlink"); - RNA_def_function_ui_description(func, "Unlink object from collection"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); - parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove from collection"); - RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); -} - -static void rna_def_scene_collection(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - FunctionRNA *func; - PropertyRNA *parm; - - srna = RNA_def_struct(brna, "SceneCollection", NULL); - RNA_def_struct_ui_text(srna, "Scene Collection", "Collection"); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneCollection_name_set"); - RNA_def_property_ui_text(prop, "Name", "Collection name"); - RNA_def_struct_name_property(srna, prop); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); - - prop = RNA_def_property(srna, "filter", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneCollection_filter_set"); - RNA_def_property_ui_text(prop, "Filter", "Filter to dynamically include objects based on their names (e.g., CHAR_*)"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); - - prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "scene_collections", NULL); - RNA_def_property_struct_type(prop, "SceneCollection"); - RNA_def_property_ui_text(prop, "SceneCollections", ""); - rna_def_scene_collections(brna, prop); - - prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "objects", NULL); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SceneCollection_objects_get", NULL, NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Objects", "All the objects directly added to this collection (not including sub-collection objects)"); - rna_def_collection_objects(brna, prop); - - prop = RNA_def_property(srna, "filters_objects", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "filter_objects", NULL); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SceneCollection_objects_get", NULL, NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Filter Objects", "All the objects dynamically added to this collection via the filter"); - - /* Functions */ - func = RNA_def_function(srna, "move_above", "rna_SceneCollection_move_above"); - RNA_def_function_ui_description(func, "Move collection after another"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); - parm = RNA_def_pointer(func, "sc_dst", "SceneCollection", "Collection", "Reference collection above which the collection will move"); - parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); - RNA_def_function_return(func, parm); - - func = RNA_def_function(srna, "move_below", "rna_SceneCollection_move_below"); - RNA_def_function_ui_description(func, "Move collection before another"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); - parm = RNA_def_pointer(func, "sc_dst", "SceneCollection", "Collection", "Reference collection below which the collection will move"); - parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); - RNA_def_function_return(func, parm); - - func = RNA_def_function(srna, "move_into", "rna_SceneCollection_move_into"); - RNA_def_function_ui_description(func, "Move collection into another"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); - parm = RNA_def_pointer(func, "sc_dst", "SceneCollection", "Collection", "Collection to insert into"); - parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); - RNA_def_function_return(func, parm); -} - -static void rna_def_layer_collection_override(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "LayerCollectionOverride", NULL); - RNA_def_struct_sdna(srna, "CollectionOverride"); - RNA_def_struct_ui_text(srna, "Collection Override", "Collection Override"); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Name", "Collection name"); - RNA_def_struct_name_property(srna, prop); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); -} - - -#ifdef WITH_CLAY_ENGINE -static void rna_def_scene_layer_engine_settings_clay(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "SceneLayerEngineSettingsClay", "SceneLayerSettings"); - RNA_def_struct_ui_text(srna, "Clay Scene Layer Settings", "Clay Engine settings"); - - RNA_define_verify_sdna(0); /* not in sdna */ - - /* see RNA_LAYER_ENGINE_GET_SET macro */ - prop = RNA_def_property(srna, "ssao_samples", PROP_INT, PROP_NONE); - RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_samples_get", - "rna_LayerEngineSettings_Clay_ssao_samples_set", NULL); - RNA_def_property_ui_text(prop, "Samples", "Number of samples"); - RNA_def_property_range(prop, 1, 500); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - RNA_define_verify_sdna(1); /* not in sdna */ -} -#endif /* WITH_CLAY_ENGINE */ - -static void rna_def_scene_layer_engine_settings_eevee(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - /* Keep in sync with eevee_private.h */ - static const EnumPropertyItem eevee_shadow_method_items[] = { - {1, "ESM", 0, "ESM", "Exponential Shadow Mapping"}, - {2, "VSM", 0, "VSM", "Variance Shadow Mapping"}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem eevee_shadow_size_items[] = { - {64, "64", 0, "64px", ""}, - {128, "128", 0, "128px", ""}, - {256, "256", 0, "256px", ""}, - {512, "512", 0, "512px", ""}, - {1024, "1024", 0, "1024px", ""}, - {2048, "2048", 0, "2048px", ""}, - {4096, "4096", 0, "4096px", ""}, - {8192, "8192", 0, "8192px", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "SceneLayerEngineSettingsEevee", "SceneLayerSettings"); - RNA_def_struct_ui_text(srna, "Eevee Scene Layer Settings", "Eevee Engine settings"); - - RNA_define_verify_sdna(0); /* not in sdna */ - - /* see RNA_LAYER_ENGINE_GET_SET macro */ - - /* Indirect Lighting */ - prop = RNA_def_property(srna, "gi_diffuse_bounces", PROP_INT, PROP_NONE); - RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_gi_diffuse_bounces_get", - "rna_LayerEngineSettings_Eevee_gi_diffuse_bounces_set", NULL); - RNA_def_property_ui_text(prop, "Diffuse Bounces", "Number of time the light is reinjected inside light grids, " - "0 disable indirect diffuse light"); - RNA_def_property_range(prop, 0, INT_MAX); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "gi_cubemap_resolution", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Eevee_gi_cubemap_resolution_get", "rna_LayerEngineSettings_Eevee_gi_cubemap_resolution_set", NULL); - RNA_def_property_enum_items(prop, eevee_shadow_size_items); - RNA_def_property_ui_text(prop, "Cubemap Size", "Size of every cubemaps"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - /* Temporal Anti-Aliasing (super sampling) */ - prop = RNA_def_property(srna, "taa_samples", PROP_INT, PROP_NONE); - RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_taa_samples_get", - "rna_LayerEngineSettings_Eevee_taa_samples_set", NULL); - RNA_def_property_ui_text(prop, "Viewport Samples", "Number of temporal samples, unlimited if 0, " - "disabled if 1"); - RNA_def_property_range(prop, 0, INT_MAX); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - /* Screen Space Reflection */ - prop = RNA_def_property(srna, "ssr_enable", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_enable_get", - "rna_LayerEngineSettings_Eevee_ssr_enable_set"); - RNA_def_property_ui_text(prop, "Screen Space Reflections", "Enable screen space reflection"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "ssr_refraction", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_refraction_get", - "rna_LayerEngineSettings_Eevee_ssr_refraction_set"); - RNA_def_property_ui_text(prop, "Screen Space Refractions", "Enable screen space Refractions"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "ssr_halfres", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_halfres_get", - "rna_LayerEngineSettings_Eevee_ssr_halfres_set"); - RNA_def_property_ui_text(prop, "Half Res Trace", "Raytrace at a lower resolution"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "ssr_quality", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_quality_get", - "rna_LayerEngineSettings_Eevee_ssr_quality_set", NULL); - RNA_def_property_ui_text(prop, "Trace Quality", "Quality of the screen space raytracing"); - 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_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "ssr_max_roughness", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_max_roughness_get", - "rna_LayerEngineSettings_Eevee_ssr_max_roughness_set", NULL); - RNA_def_property_ui_text(prop, "Max Roughness", "Do not raytrace reflections for roughness above this value"); - 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_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "ssr_ray_count", PROP_INT, PROP_NONE); - RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_ray_count_get", - "rna_LayerEngineSettings_Eevee_ssr_ray_count_set", NULL); - RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per pixels"); - RNA_def_property_range(prop, 1, 4); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "ssr_thickness", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_thickness_get", - "rna_LayerEngineSettings_Eevee_ssr_thickness_set", NULL); - RNA_def_property_ui_text(prop, "Thickness", "Pixel thickness used to detect intersection"); - RNA_def_property_range(prop, 1e-6f, FLT_MAX); - RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 5, 3); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "ssr_border_fade", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_border_fade_get", - "rna_LayerEngineSettings_Eevee_ssr_border_fade_set", NULL); - RNA_def_property_ui_text(prop, "Edge Fading", "Screen percentage used to fade the SSR"); - RNA_def_property_range(prop, 0.0f, 0.5f); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "ssr_firefly_fac", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_ssr_firefly_fac_get", - "rna_LayerEngineSettings_Eevee_ssr_firefly_fac_set", NULL); - RNA_def_property_ui_text(prop, "Clamp", "Clamp pixel intensity to remove noise (0 to disabled)"); - RNA_def_property_range(prop, 0.0f, FLT_MAX); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - /* Volumetrics */ - prop = RNA_def_property(srna, "volumetric_enable", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_enable_get", - "rna_LayerEngineSettings_Eevee_volumetric_enable_set"); - RNA_def_property_ui_text(prop, "Volumetrics", "Enable scattering and absorbance of volumetric material"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "volumetric_start", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_start_get", - "rna_LayerEngineSettings_Eevee_volumetric_start_set", NULL); - RNA_def_property_ui_text(prop, "Start", "Start distance of the volumetric effect"); - RNA_def_property_range(prop, 1e-6f, FLT_MAX); - RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "volumetric_end", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_end_get", - "rna_LayerEngineSettings_Eevee_volumetric_end_set", NULL); - RNA_def_property_ui_text(prop, "End", "End distance of the volumetric effect"); - RNA_def_property_range(prop, 1e-6f, FLT_MAX); - RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "volumetric_samples", PROP_INT, PROP_NONE); - RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_samples_get", - "rna_LayerEngineSettings_Eevee_volumetric_samples_set", NULL); - RNA_def_property_ui_text(prop, "Samples", "Number of samples to compute volumetric effects"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_range(prop, 1, 256); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "volumetric_sample_distribution", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_sample_distribution_get", - "rna_LayerEngineSettings_Eevee_volumetric_sample_distribution_set", NULL); - RNA_def_property_ui_text(prop, "Exponential Sampling", "Distribute more samples closer to the camera"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "volumetric_lights", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_lights_get", - "rna_LayerEngineSettings_Eevee_volumetric_lights_set"); - RNA_def_property_ui_text(prop, "Volumetric Lighting", "Enable scene lamps interactions with volumetrics"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "volumetric_light_clamp", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_light_clamp_get", - "rna_LayerEngineSettings_Eevee_volumetric_light_clamp_set", NULL); - RNA_def_property_range(prop, 0.0f, FLT_MAX); - RNA_def_property_ui_text(prop, "Clamp", "Maximum light contribution, reducing noise"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "volumetric_shadows", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_shadows_get", - "rna_LayerEngineSettings_Eevee_volumetric_shadows_set"); - RNA_def_property_ui_text(prop, "Volumetric Shadows", "Generate shadows from volumetric material (Very expensive)"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "volumetric_shadow_samples", PROP_INT, PROP_NONE); - RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_shadow_samples_get", - "rna_LayerEngineSettings_Eevee_volumetric_shadow_samples_set", NULL); - RNA_def_property_range(prop, 1, 128); - RNA_def_property_ui_text(prop, "Volumetric Shadow Samples", "Number of samples to compute volumetric shadowing"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "volumetric_colored_transmittance", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_volumetric_colored_transmittance_get", - "rna_LayerEngineSettings_Eevee_volumetric_colored_transmittance_set"); - RNA_def_property_ui_text(prop, "Colored Transmittance", "Enable wavelength dependent volumetric transmittance"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - /* Ambient Occlusion */ - prop = RNA_def_property(srna, "gtao_enable", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_enable_get", - "rna_LayerEngineSettings_Eevee_gtao_enable_set"); - RNA_def_property_ui_text(prop, "Ambient Occlusion", "Enable ambient occlusion to simulate medium scale indirect shadowing"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "gtao_use_bent_normals", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_use_bent_normals_get", - "rna_LayerEngineSettings_Eevee_gtao_use_bent_normals_set"); - RNA_def_property_ui_text(prop, "Bent Normals", "Compute main non occluded direction to sample the environment"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "gtao_denoise", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_denoise_get", - "rna_LayerEngineSettings_Eevee_gtao_denoise_set"); - RNA_def_property_ui_text(prop, "Denoise", "Use denoising to filter the resulting occlusion and bent normal but exhibit 2x2 pixel blocks"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "gtao_bounce", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_bounce_get", - "rna_LayerEngineSettings_Eevee_gtao_bounce_set"); - RNA_def_property_ui_text(prop, "Bounces Approximation", "An approximation to simulate light bounces " - "giving less occlusion on brighter objects"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "gtao_factor", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_factor_get", "rna_LayerEngineSettings_Eevee_gtao_factor_set", NULL); - RNA_def_property_ui_text(prop, "Factor", "Factor for ambient occlusion blending"); - RNA_def_property_range(prop, 0.0f, FLT_MAX); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 2); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "gtao_quality", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_quality_get", "rna_LayerEngineSettings_Eevee_gtao_quality_set", NULL); - RNA_def_property_ui_text(prop, "Trace Quality", "Quality of the horizon search"); - 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_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "gtao_distance", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_distance_get", "rna_LayerEngineSettings_Eevee_gtao_distance_set", NULL); - RNA_def_property_ui_text(prop, "Distance", "Distance of object that contribute to the ambient occlusion 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_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "gtao_samples", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_gtao_samples_get", - "rna_LayerEngineSettings_Eevee_gtao_samples_set", NULL); - RNA_def_property_ui_text(prop, "Samples", "Number of samples to take to compute occlusion"); - RNA_def_property_range(prop, 2, 32); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - /* Depth of Field */ - prop = RNA_def_property(srna, "dof_enable", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_dof_enable_get", - "rna_LayerEngineSettings_Eevee_dof_enable_set"); - RNA_def_property_ui_text(prop, "Depth of Field", "Enable depth of field using the values from the active camera"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "bokeh_max_size", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bokeh_max_size_get", - "rna_LayerEngineSettings_Eevee_bokeh_max_size_set", NULL); - RNA_def_property_ui_text(prop, "Max Size", "Max size of the bokeh shape for the depth of field (lower is faster)"); - RNA_def_property_range(prop, 0.0f, 2000.0f); - RNA_def_property_ui_range(prop, 2.0f, 200.0f, 1, 3); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "bokeh_threshold", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bokeh_threshold_get", - "rna_LayerEngineSettings_Eevee_bokeh_threshold_set", NULL); - RNA_def_property_ui_text(prop, "Sprite Threshold", "Brightness threshold for using sprite base depth of field"); - RNA_def_property_range(prop, 0.0f, 100000.0f); - RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - /* Bloom */ - prop = RNA_def_property(srna, "bloom_enable", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_enable_get", - "rna_LayerEngineSettings_Eevee_bloom_enable_set"); - RNA_def_property_ui_text(prop, "Bloom", "High brighness pixels generate a glowing effect"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "bloom_threshold", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_threshold_get", - "rna_LayerEngineSettings_Eevee_bloom_threshold_set", NULL); - RNA_def_property_ui_text(prop, "Threshold", "Filters out pixels under this level of brightness"); - RNA_def_property_range(prop, 0.0f, 100000.0f); - RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "bloom_color", PROP_FLOAT, PROP_COLOR); - RNA_def_property_array(prop, 3); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_color_get", - "rna_LayerEngineSettings_Eevee_bloom_color_set", NULL); - RNA_def_property_ui_text(prop, "Color", "Color applied to the bloom effect"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "bloom_knee", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_knee_get", - "rna_LayerEngineSettings_Eevee_bloom_knee_set", NULL); - RNA_def_property_ui_text(prop, "Knee", "Makes transition between under/over-threshold gradual"); - 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_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "bloom_radius", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_radius_get", - "rna_LayerEngineSettings_Eevee_bloom_radius_set", NULL); - RNA_def_property_ui_text(prop, "Radius", "Bloom spread distance"); - RNA_def_property_range(prop, 0.0f, 100.0f); - RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "bloom_clamp", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_clamp_get", - "rna_LayerEngineSettings_Eevee_bloom_clamp_set", NULL); - RNA_def_property_ui_text(prop, "Clamp", "Maximum intensity a bloom pixel can have"); - RNA_def_property_range(prop, 0.0f, 1000.0f); - RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "bloom_intensity", PROP_FLOAT, PROP_UNSIGNED); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_intensity_get", - "rna_LayerEngineSettings_Eevee_bloom_intensity_set", NULL); - RNA_def_property_ui_text(prop, "Intensity", "Blend factor"); - RNA_def_property_range(prop, 0.0f, 10000.0f); - RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - /* Motion blur */ - prop = RNA_def_property(srna, "motion_blur_enable", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_motion_blur_enable_get", - "rna_LayerEngineSettings_Eevee_motion_blur_enable_set"); - RNA_def_property_ui_text(prop, "Motion Blur", "Enable motion blur effect (only in camera view)"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_motion_blur_samples_get", - "rna_LayerEngineSettings_Eevee_motion_blur_samples_set", NULL); - RNA_def_property_ui_text(prop, "Samples", "Number of samples to take with motion blur"); - RNA_def_property_range(prop, 1, 64); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_UNSIGNED); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_motion_blur_shutter_get", - "rna_LayerEngineSettings_Eevee_motion_blur_shutter_set", NULL); - RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close"); - RNA_def_property_ui_range(prop, 0.01f, 2.0f, 1, 2); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - /* Shadows */ - prop = RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Eevee_shadow_method_get", "rna_LayerEngineSettings_Eevee_shadow_method_set", NULL); - RNA_def_property_enum_items(prop, eevee_shadow_method_items); - RNA_def_property_ui_text(prop, "Method", "Technique use to compute the shadows"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "shadow_size", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Eevee_shadow_size_get", "rna_LayerEngineSettings_Eevee_shadow_size_set", NULL); - RNA_def_property_enum_items(prop, eevee_shadow_size_items); - RNA_def_property_ui_text(prop, "Size", "Size of every shadow maps"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - prop = RNA_def_property(srna, "shadow_high_bitdepth", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_shadow_high_bitdepth_get", "rna_LayerEngineSettings_Eevee_shadow_high_bitdepth_set"); - RNA_def_property_ui_text(prop, "High Bitdepth", "Use 32bit shadows"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); - - RNA_define_verify_sdna(1); /* not in sdna */ -} - -#ifdef WITH_CLAY_ENGINE -static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const 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, "LayerCollectionEngineSettingsClay", "LayerCollectionSettings"); - RNA_def_struct_ui_text(srna, "Collections Clay Engine Settings", "Engine specific settings for this collection"); - - RNA_define_verify_sdna(0); /* not in sdna */ - - /* see RNA_LAYER_ENGINE_GET_SET macro */ - 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_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_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_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_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_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_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_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); - 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_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); - 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_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "hair_brightness_randomness", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_hair_brightness_randomness_get", "rna_LayerEngineSettings_Clay_hair_brightness_randomness_set", NULL); - RNA_def_property_ui_text(prop, "Hair Brightness Randomness", "Brightness randomness for hair"); - 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_LayerCollectionEngineSettings_update"); - - 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, "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 */ - - prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE); - 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_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_LayerCollectionEngineSettings_update"); - - RNA_define_verify_sdna(1); /* not in sdna */ -} - -static void rna_def_layer_collection_mode_settings_edit(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - 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 */ - - prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE); - 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_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "show_weight", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Show Weights", "Draw weights in editmode"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_show_weight_get", "rna_LayerEngineSettings_EditMode_show_weight_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - 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_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_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_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"); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_EditMode_normals_length_get", "rna_LayerEngineSettings_EditMode_normals_length_set", NULL); - 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_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_LayerCollectionEngineSettings_update"); - - RNA_define_verify_sdna(1); /* not in sdna */ -} - -static void rna_def_layer_collection_mode_settings_paint_weight(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "LayerCollectionModeSettingsPaintWeight", "LayerCollectionSettings"); - RNA_def_struct_ui_text(srna, "Collections Weight Paint Mode Settings", "Weight Paint Mode specific settings to be overridden per collection"); - RNA_define_verify_sdna(0); /* not in sdna */ - - /* see RNA_LAYER_ENGINE_GET_SET macro */ - - prop = RNA_def_property(srna, "use_shading", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Use Shading", "Whether to use shaded or shadeless drawing"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintWeightMode_use_shading_get", "rna_LayerEngineSettings_PaintWeightMode_use_shading_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "use_wire", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Show Wire", "Whether to overlay wireframe onto the mesh"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintWeightMode_use_wire_get", "rna_LayerEngineSettings_PaintWeightMode_use_wire_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_wire_update"); - - RNA_define_verify_sdna(1); /* not in sdna */ -} - -static void rna_def_layer_collection_mode_settings_paint_vertex(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "LayerCollectionModeSettingsPaintVertex", "LayerCollectionSettings"); - RNA_def_struct_ui_text(srna, "Collections Vertex Paint Mode Settings", "Vertex Paint Mode specific settings to be overridden per collection"); - RNA_define_verify_sdna(0); /* not in sdna */ - - /* see RNA_LAYER_ENGINE_GET_SET macro */ - - prop = RNA_def_property(srna, "use_shading", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Use Shading", "Whether to use shaded or shadeless drawing"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintVertexMode_use_shading_get", "rna_LayerEngineSettings_PaintVertexMode_use_shading_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "use_wire", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Show Wire", "Whether to overlay wireframe onto the mesh"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintVertexMode_use_wire_get", "rna_LayerEngineSettings_PaintVertexMode_use_wire_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_wire_update"); - - RNA_define_verify_sdna(1); /* not in sdna */ -} - -static void rna_def_scene_layer_settings(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - FunctionRNA *func; - PropertyRNA *parm; - - srna = RNA_def_struct(brna, "SceneLayerSettings", NULL); - RNA_def_struct_sdna(srna, "IDProperty"); - RNA_def_struct_ui_text(srna, "Scene Layer Settings", - "Engine specific settings that can be overriden by SceneLayer"); - RNA_def_struct_refine_func(srna, "rna_SceneLayerSettings_refine"); - - RNA_define_verify_sdna(0); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, "rna_SceneLayerSettings_name_get", "rna_SceneLayerSettings_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); - - func = RNA_def_function(srna, "use", "rna_SceneLayerSettings_use"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); - RNA_def_function_ui_description(func, "Initialize this property to use"); - parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to set"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - func = RNA_def_function(srna, "unuse", "rna_SceneLayerSettings_unuse"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); - RNA_def_function_ui_description(func, "Remove the property"); - parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to unset"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - -#ifdef WITH_CLAY_ENGINE - rna_def_scene_layer_engine_settings_clay(brna); -#endif - rna_def_scene_layer_engine_settings_eevee(brna); - -#if 0 - rna_def_scene_layer_mode_settings_object(brna); - rna_def_scene_layer_mode_settings_edit(brna); - rna_def_scene_layer_mode_settings_paint_weight(brna); - rna_def_scene_layer_mode_settings_paint_vertex(brna); -#endif - - RNA_define_verify_sdna(1); -} - -static void rna_def_layer_collection_settings(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - FunctionRNA *func; - PropertyRNA *parm; - - srna = RNA_def_struct(brna, "LayerCollectionSettings", NULL); - RNA_def_struct_sdna(srna, "IDProperty"); - 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"); - - 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); - - func = RNA_def_function(srna, "use", "rna_LayerCollectionSettings_use"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); - RNA_def_function_ui_description(func, "Initialize this property to use"); - parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to set"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - func = RNA_def_function(srna, "unuse", "rna_LayerCollectionSettings_unuse"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); - RNA_def_function_ui_description(func, "Remove the property"); - parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to unset"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - -#ifdef WITH_CLAY_ENGINE - rna_def_layer_collection_engine_settings_clay(brna); -#endif - - rna_def_layer_collection_mode_settings_object(brna); - rna_def_layer_collection_mode_settings_edit(brna); - rna_def_layer_collection_mode_settings_paint_weight(brna); - rna_def_layer_collection_mode_settings_paint_vertex(brna); - - RNA_define_verify_sdna(1); -} - -static void rna_def_layer_collection(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - FunctionRNA *func; - PropertyRNA *parm; - - srna = RNA_def_struct(brna, "LayerCollection", NULL); - RNA_def_struct_ui_text(srna, "Layer Collection", "Layer collection"); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, "rna_LayerCollection_name_get", "rna_LayerCollection_name_length", "rna_LayerCollection_name_set"); - RNA_def_property_ui_text(prop, "Name", "Collection name"); - RNA_def_struct_name_property(srna, prop); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); - - prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "scene_collection"); - RNA_def_property_struct_type(prop, "SceneCollection"); - RNA_def_property_ui_text(prop, "Collection", "Collection this layer collection is wrapping"); - - prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL); - RNA_def_property_struct_type(prop, "LayerCollection"); - RNA_def_property_ui_text(prop, "Layer Collections", ""); - - prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_LayerCollection_objects_get", NULL, NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Objects", "All the objects directly or indirectly added to this collection (not including sub-collection objects)"); - - prop = RNA_def_property(srna, "overrides", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "overrides", NULL); - RNA_def_property_struct_type(prop, "LayerCollectionOverride"); - RNA_def_property_ui_text(prop, "Collection Overrides", ""); - - /* 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 | FUNC_USE_MAIN); - parm = RNA_def_pointer(func, "lc_dst", "LayerCollection", "Collection", "Reference collection above which the collection will move"); - parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); - RNA_def_function_return(func, parm); - - func = RNA_def_function(srna, "move_below", "rna_LayerCollection_move_below"); - RNA_def_function_ui_description(func, "Move collection before another"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); - parm = RNA_def_pointer(func, "lc_dst", "LayerCollection", "Collection", "Reference collection below which the collection will move"); - parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); - RNA_def_function_return(func, parm); - - func = RNA_def_function(srna, "move_into", "rna_LayerCollection_move_into"); - RNA_def_function_ui_description(func, "Move collection into another"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); - parm = RNA_def_pointer(func, "lc_dst", "LayerCollection", "Collection", "Collection to insert into"); - parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded"); - RNA_def_function_return(func, parm); - - func = RNA_def_function(srna, "enable_set", "rna_LayerCollection_enable_set"); - RNA_def_function_ui_description(func, "Enable or disable a collection"); - parm = RNA_def_boolean(func, "value", 1, "Enable", ""); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS); - - /* Flags */ - prop = RNA_def_property(srna, "is_enabled", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_DISABLED); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Enabled", "Enable or disable collection from depsgraph"); - - prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_VISIBLE); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1); - RNA_def_property_ui_text(prop, "Hide", "Restrict visiblity"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update"); - - prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_SELECTABLE); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1); - RNA_def_property_ui_text(prop, "Hide Selectable", "Restrict selection"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update"); - - /* TODO_LAYER_OVERRIDE */ -} - -static void rna_def_layer_collections(BlenderRNA *brna, PropertyRNA *cprop) -{ - StructRNA *srna; - FunctionRNA *func; - PropertyRNA *prop; - PropertyRNA *parm; - - RNA_def_property_srna(cprop, "LayerCollections"); - srna = RNA_def_struct(brna, "LayerCollections", NULL); - RNA_def_struct_sdna(srna, "SceneLayer"); - RNA_def_struct_ui_text(srna, "Layer Collections", "Collections of render layer"); - - prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_sdna(prop, NULL, "active_collection"); - RNA_def_property_int_funcs(prop, "rna_LayerCollections_active_collection_index_get", - "rna_LayerCollections_active_collection_index_set", - "rna_LayerCollections_active_collection_index_range"); - RNA_def_property_ui_text(prop, "Active Collection Index", "Active index in layer collection array"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL); - - prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "LayerCollection"); - RNA_def_property_pointer_funcs(prop, "rna_LayerCollections_active_collection_get", - "rna_LayerCollections_active_collection_set", NULL, NULL); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); - RNA_def_property_ui_text(prop, "Active Layer Collection", "Active Layer Collection"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL); - - func = RNA_def_function(srna, "link", "rna_SceneLayer_collection_link"); - RNA_def_function_ui_description(func, "Link a collection to render layer"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); - parm = RNA_def_pointer(func, "scene_collection", "SceneCollection", "", "Collection to add to render layer"); - RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); - parm = RNA_def_pointer(func, "result", "LayerCollection", "", "Newly created layer collection"); - RNA_def_function_return(func, parm); - - func = RNA_def_function(srna, "unlink", "rna_SceneLayer_collection_unlink"); - RNA_def_function_ui_description(func, "Unlink a collection from render layer"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); - parm = RNA_def_pointer(func, "layer_collection", "LayerCollection", "", "Layer collection to remove from render layer"); - RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); -} - -static void rna_def_layer_objects(BlenderRNA *brna, PropertyRNA *cprop) -{ - StructRNA *srna; - PropertyRNA *prop; - - RNA_def_property_srna(cprop, "LayerObjects"); - srna = RNA_def_struct(brna, "LayerObjects", NULL); - RNA_def_struct_sdna(srna, "SceneLayer"); - RNA_def_struct_ui_text(srna, "Layer Objects", "Collections of objects"); - - prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_pointer_funcs(prop, "rna_LayerObjects_active_object_get", "rna_LayerObjects_active_object_set", NULL, NULL); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); - RNA_def_property_ui_text(prop, "Active Object", "Active object for this layer"); - /* Could call: ED_base_object_activate(C, rl->basact); - * but would be a bad level call and it seems the notifier is enough */ - RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL); - - prop = RNA_def_property(srna, "selected", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_collection_funcs(prop, "rna_LayerObjects_selected_begin", "rna_iterator_listbase_next", - "rna_iterator_listbase_end", "rna_SceneLayer_objects_get", - NULL, NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Selected Objects", "All the selected objects of this layer"); -} - -static void rna_def_scene_layer(BlenderRNA *brna) -{ - FunctionRNA *func; - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "SceneLayer", NULL); - RNA_def_struct_ui_text(srna, "Render Layer", "Render layer"); - RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneLayer_name_set"); - RNA_def_property_ui_text(prop, "Name", "Render layer name"); - RNA_def_struct_name_property(srna, prop); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); - - prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL); - RNA_def_property_struct_type(prop, "LayerCollection"); - RNA_def_property_ui_text(prop, "Layer Collections", ""); - rna_def_layer_collections(brna, prop); - - prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SceneLayer_objects_get", NULL, NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Objects", "All the objects in this layer"); - rna_def_layer_objects(brna, prop); - - /* layer options */ - prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SCENE_LAYER_RENDER); - RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL); - - /* 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, "SceneLayerSettings"); - RNA_def_property_ui_text(prop, "Layer Settings", "Override of engine specific render settings"); - - /* debug update routine */ - func = RNA_def_function(srna, "update", "rna_SceneLayer_update_tagged"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); - RNA_def_function_ui_description(func, - "Update data tagged to be updated from previous access to data or operators"); -} - static void rna_def_scene_layers(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; @@ -7111,26 +5091,6 @@ static void rna_def_scene_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); } -static void rna_def_object_base(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "ObjectBase", NULL); - RNA_def_struct_sdna(srna, "Base"); - RNA_def_struct_ui_text(srna, "Object Base", "An object instance in a render layer"); - RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA); - - prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "object"); - RNA_def_property_ui_text(prop, "Object", "Object this base links to"); - - prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", BASE_SELECTED); - RNA_def_property_ui_text(prop, "Select", "Object base selection state"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ObjectBase_select_update"); -} - /* TODO LAYERS: legacy SceneRenderLayers, to be removed */ static void rna_def_scene_render_layer(BlenderRNA *brna) @@ -8693,52 +6653,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_api_scene_render(srna); } -static void rna_def_scene_view_render(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem engine_items[] = { - {0, "BLENDER_RENDER", 0, "Blender Render", "Use the Blender internal rendering engine for rendering"}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "ViewRenderSettings", NULL); - RNA_def_struct_sdna(srna, "ViewRender"); - RNA_def_struct_nested(brna, srna, "Scene"); - RNA_def_struct_path_func(srna, "rna_ViewRenderSettings_path"); - RNA_def_struct_ui_text(srna, "View Render", "Rendering settings related to viewport drawing/rendering"); - - /* engine */ - prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, engine_items); - RNA_def_property_enum_funcs(prop, "rna_ViewRenderSettings_engine_get", "rna_ViewRenderSettings_engine_set", - "rna_ViewRenderSettings_engine_itemf"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering"); - RNA_def_property_update(prop, NC_WINDOW, "rna_ViewRenderSettings_engine_update"); - - prop = RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_multiple_engines_get", NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available"); - - prop = RNA_def_property(srna, "use_shading_nodes", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_use_shading_nodes_get", NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Use Shading Nodes", "Active render engine uses new shading nodes system"); - - prop = RNA_def_property(srna, "use_spherical_stereo", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_use_spherical_stereo_get", NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Use Spherical Stereo", "Active render engine supports spherical stereo rendering"); - - prop = RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_use_game_engine_get", NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Use Game Engine", "Current rendering engine is a game engine"); -} - /* scene.objects */ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) { @@ -8777,7 +6691,6 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL); } - /* scene.bases.* */ static void rna_def_scene_bases(BlenderRNA *brna, PropertyRNA *cprop) { @@ -9444,17 +7357,9 @@ void RNA_def_scene(BlenderRNA *brna) rna_def_scene_game_data(brna); rna_def_selected_uv_element(brna); rna_def_display_safe_areas(brna); - rna_def_scene_collection(brna); - rna_def_layer_collection(brna); - rna_def_layer_collection_override(brna); - rna_def_scene_layer(brna); - rna_def_object_base(brna); RNA_define_animate_sdna(true); /* *** Animated *** */ - rna_def_scene_layer_settings(brna); - rna_def_layer_collection_settings(brna); rna_def_scene_render_data(brna); - rna_def_scene_view_render(brna); rna_def_scene_render_layer(brna); rna_def_gpu_fx(brna); rna_def_scene_render_view(brna); |