diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 984 |
1 files changed, 350 insertions, 634 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index e6ba459a406..5518b296e22 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -32,6 +32,7 @@ #include "DNA_particle_types.h" #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" +#include "DNA_layer_types.h" #include "DNA_linestyle_types.h" #include "DNA_userdef_types.h" #include "DNA_world_types.h" @@ -47,8 +48,12 @@ #include "BKE_editmesh.h" #include "BKE_paint.h" +#include "ED_object.h" + #include "GPU_extensions.h" +#include "DRW_engine.h" + #include "RNA_define.h" #include "RNA_enum_types.h" @@ -430,6 +435,7 @@ static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = { {0, NULL, 0, NULL, NULL} }; + #endif #ifdef RNA_RUNTIME @@ -440,22 +446,24 @@ static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = { #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_depsgraph.h" #include "BKE_mesh.h" #include "BKE_sound.h" #include "BKE_screen.h" @@ -470,6 +478,11 @@ static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = { #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" @@ -605,87 +618,39 @@ static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, Poi ED_space_image_uv_sculpt_update(bmain->wm.first, scene); } -static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) + +/* Read-only Iterator of all the scene objects. */ + +static void rna_Scene_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { Scene *scene = (Scene *)ptr->data; - Base *base; - - for (base = scene->base.first; base; base = base->next) { - if (STREQLEN(base->object->id.name + 2, key, sizeof(base->object->id.name) - 2)) { - *r_ptr = rna_pointer_inherit_refine(ptr, &RNA_ObjectBase, base); - return true; - } - } + iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__); - return false; + ((BLI_Iterator *)iter->internal.custom)->valid = true; + BKE_scene_objects_iterator_begin(iter->internal.custom, (void *)scene); + iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid; } -static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter) +static void rna_Scene_objects_next(CollectionPropertyIterator *iter) { - ListBaseIterator *internal = &iter->internal.listbase; - - /* we are actually iterating a Base list, so override get */ - return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base *)internal->link)->object); + BKE_scene_objects_iterator_next(iter->internal.custom); + iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid; } -static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *reports, Object *ob) +static void rna_Scene_objects_end(CollectionPropertyIterator *iter) { - Scene *scene_act = CTX_data_scene(C); - Base *base; - - if (BKE_scene_base_find(scene, ob)) { - BKE_reportf(reports, RPT_ERROR, "Object '%s' is already in scene '%s'", ob->id.name + 2, scene->id.name + 2); - return NULL; - } - - base = BKE_scene_base_add(scene, ob); - id_us_plus(&ob->id); - - /* this is similar to what object_add_type and BKE_object_add do */ - base->lay = scene->lay; - - /* when linking to an inactive scene don't touch the layer */ - if (scene == scene_act) - ob->lay = base->lay; - - /* TODO(sergey): Only update relations for the current scene. */ - DAG_relations_tag_update(CTX_data_main(C)); - DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); - - /* slows down importers too much, run scene.update() */ - /* DAG_srelations_tag_update(G.main); */ - - WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene); - - return base; + BKE_scene_objects_iterator_end(iter->internal.custom); + MEM_freeN(iter->internal.custom); } -static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *ob) +static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter) { - Base *base = BKE_scene_base_find(scene, ob); - if (!base) { - BKE_reportf(reports, RPT_ERROR, "Object '%s' is not in this scene '%s'", ob->id.name + 2, scene->id.name + 2); - return; - } - if (base == scene->basact && ob->mode != OB_MODE_OBJECT) { - BKE_reportf(reports, RPT_ERROR, "Object '%s' must be in object mode to unlink", ob->id.name + 2); - return; - } - if (scene->basact == base) { - scene->basact = NULL; - } - - BKE_scene_base_unlink(scene, base); - MEM_freeN(base); - - id_us_min(&ob->id); - - /* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */ - DAG_relations_tag_update(G.main); - - WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene); + Object *ob = ((BLI_Iterator *)iter->internal.custom)->current; + return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ob); } +/* End of read-only Iterator of all the scene objects. */ + static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value) { ToolSettings *ts = (ToolSettings *)ptr->data; @@ -695,21 +660,6 @@ static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value) ts->skgen_template = NULL; } -static PointerRNA rna_Scene_active_object_get(PointerRNA *ptr) -{ - Scene *scene = (Scene *)ptr->data; - return rna_pointer_inherit_refine(ptr, &RNA_Object, scene->basact ? scene->basact->object : NULL); -} - -static void rna_Scene_active_object_set(PointerRNA *ptr, PointerRNA value) -{ - Scene *scene = (Scene *)ptr->data; - if (value.data) - scene->basact = BKE_scene_base_find(scene, (Object *)value.data); - else - scene->basact = NULL; -} - static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value) { Scene *scene = (Scene *)ptr->data; @@ -728,11 +678,25 @@ static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value) scene->set = set; } +void rna_Scene_set_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +{ + Scene *scene = (Scene *)ptr->id.data; + + DEG_relations_tag_update(bmain); + DEG_id_tag_update_ex(bmain, &scene->id, 0); + if (scene->set != NULL) { + /* Objects which are pulled into main scene's depsgraph needs to have + * their base flags updated. + */ + DEG_id_tag_update_ex(bmain, &scene->set->id, 0); + } +} + static void rna_Scene_layer_set(PointerRNA *ptr, const int *values) { Scene *scene = (Scene *)ptr->data; - scene->lay = ED_view3d_scene_layer_set(scene->lay, values, &scene->layact); + scene->lay = ED_view3d_view_layer_set(scene->lay, values, &scene->layact); } static int rna_Scene_active_layer_get(PointerRNA *ptr) @@ -744,19 +708,21 @@ static int rna_Scene_active_layer_get(PointerRNA *ptr) static void rna_Scene_view3d_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr) { + wmWindowManager *wm = bmain->wm.first; Scene *scene = (Scene *)ptr->data; - BKE_screen_view3d_main_sync(&bmain->screen, scene); + WM_windows_scene_data_sync(&wm->windows, scene); } -static void rna_Scene_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Scene_layer_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { - rna_Scene_view3d_update(bmain, scene, ptr); /* XXX We would need do_time=true here, else we can have update issues like [#36289]... * However, this has too much drawbacks (like slower layer switch, undesired updates...). * That's TODO for future DAG updates. */ - DAG_on_visible_update(bmain, false); + DEG_on_visible_update(bmain, false); + + /* No need to sync scene data here (WM_windows_scene_data_sync), handled through notifier. */ } static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) @@ -1334,73 +1300,6 @@ static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain), Scene } #endif -static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr) -{ - RenderData *rd = (RenderData *)ptr->data; - return rd->actlay; -} - -static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value) -{ - RenderData *rd = (RenderData *)ptr->data; - int num_layers = BLI_listbase_count(&rd->layers); - rd->actlay = min_ff(value, num_layers - 1); -} - -static void rna_RenderSettings_active_layer_index_range( - PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) -{ - RenderData *rd = (RenderData *)ptr->data; - - *min = 0; - *max = max_ii(0, BLI_listbase_count(&rd->layers) - 1); -} - -static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr) -{ - RenderData *rd = (RenderData *)ptr->data; - SceneRenderLayer *srl = BLI_findlink(&rd->layers, rd->actlay); - - return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderLayer, srl); -} - -static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA value) -{ - RenderData *rd = (RenderData *)ptr->data; - SceneRenderLayer *srl = (SceneRenderLayer *)value.data; - const int index = BLI_findindex(&rd->layers, srl); - if (index != -1) rd->actlay = index; -} - -static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), const char *name) -{ - Scene *scene = (Scene *)id; - SceneRenderLayer *srl = BKE_scene_add_render_layer(scene, name); - - DAG_id_tag_update(&scene->id, 0); - WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); - - return srl; -} - -static void rna_RenderLayer_remove( - ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports, PointerRNA *srl_ptr) -{ - SceneRenderLayer *srl = srl_ptr->data; - Scene *scene = (Scene *)id; - - if (!BKE_scene_remove_render_layer(bmain, scene, srl)) { - BKE_reportf(reports, RPT_ERROR, "Render layer '%s' could not be removed from scene '%s'", - srl->name, scene->id.name + 2); - return; - } - - RNA_POINTER_INVALIDATE(srl_ptr); - - DAG_id_tag_update(&scene->id, 0); - WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); -} - static int rna_RenderSettings_active_view_index_get(PointerRNA *ptr) { RenderData *rd = (RenderData *)ptr->data; @@ -1465,121 +1364,74 @@ static void rna_RenderView_remove( WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); } -static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) +static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value) { RenderData *rd = (RenderData *)ptr->data; - RenderEngineType *type = BLI_findlink(&R_engines, value); - - if (type) - BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine)); -} -static const EnumPropertyItem *rna_RenderSettings_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); + if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW && + value == SCE_VIEWS_FORMAT_STEREO_3D) + { + /* make sure the actview is visible */ + if (rd->actview > 1) rd->actview = 1; } - - RNA_enum_item_end(&item, &totitem); - *r_free = true; - return item; + rd->views_format = value; } -static int rna_RenderSettings_engine_get(PointerRNA *ptr) +void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { - RenderData *rd = (RenderData *)ptr->data; - RenderEngineType *type; - int a = 0; - - for (type = R_engines.first; type; type = type->next, a++) - if (STREQ(type->idname, rd->engine)) - return a; - - return 0; -} + Scene *scene = (Scene *)ptr->id.data; -static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr)) -{ - ED_render_engine_changed(bmain); + DEG_id_tag_update(&scene->id, 0); } -static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_Scene_world_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Scene *scene = (Scene *)ptr->id.data; + Scene *sc = (Scene *)ptr->id.data; - DAG_id_tag_update(&scene->id, 0); + rna_Scene_glsl_update(bmain, scene, ptr); + WM_main_add_notifier(NC_WORLD | ND_WORLD, &sc->id); } -static void rna_Scene_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +void rna_Scene_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; - DAG_id_tag_update(&scene->id, 0); + DEG_id_tag_update(&scene->id, 0); } -static void rna_Scene_use_view_map_cache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +void rna_Scene_use_view_map_cache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { #ifdef WITH_FREESTYLE FRS_free_view_map_cache(); #endif } -static IDProperty *rna_SceneRenderLayer_idprops(PointerRNA *ptr, bool create) -{ - SceneRenderLayer *srl = (SceneRenderLayer *)ptr->data; - - if (create && !srl->prop) { - IDPropertyTemplate val = {0}; - srl->prop = IDP_New(IDP_GROUP, &val, "SceneRenderLayer ID properties"); - } - - return srl->prop; -} - -static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) +void rna_ViewLayer_name_set(PointerRNA *ptr, const char *value) { Scene *scene = (Scene *)ptr->id.data; - SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data; - char oldname[sizeof(rl->name)]; + ViewLayer *view_layer = (ViewLayer *)ptr->data; + char oldname[sizeof(view_layer->name)]; - BLI_strncpy(oldname, rl->name, sizeof(rl->name)); + BLI_strncpy(oldname, view_layer->name, sizeof(view_layer->name)); - BLI_strncpy_utf8(rl->name, value, sizeof(rl->name)); - BLI_uniquename(&scene->r.layers, rl, DATA_("RenderLayer"), '.', offsetof(SceneRenderLayer, name), sizeof(rl->name)); + BLI_strncpy_utf8(view_layer->name, value, sizeof(view_layer->name)); + BLI_uniquename(&scene->view_layers, view_layer, DATA_("ViewLayer"), '.', offsetof(ViewLayer, name), sizeof(view_layer->name)); if (scene->nodetree) { bNode *node; - int index = BLI_findindex(&scene->r.layers, rl); + int index = BLI_findindex(&scene->view_layers, view_layer); 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, rl->name, NODE_MAXSTR); + BLI_strncpy(node->name, view_layer->name, NODE_MAXSTR); } } } /* fix all the animation data which may link to this */ - BKE_animdata_fix_paths_rename_all(NULL, "render.layers", oldname, rl->name); -} - -static char *rna_SceneRenderLayer_path(PointerRNA *ptr) -{ - SceneRenderLayer *srl = (SceneRenderLayer *)ptr->data; - char name_esc[sizeof(srl->name) * 2]; - - BLI_strescape(name_esc, srl->name, sizeof(name_esc)); - return BLI_sprintfN("render.layers[\"%s\"]", name_esc); + BKE_animdata_fix_paths_rename_all(NULL, "view_layers", oldname, view_layer->name); } static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value) @@ -1590,62 +1442,7 @@ static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value) BLI_uniquename(&scene->r.views, rv, DATA_("RenderView"), '.', offsetof(SceneRenderView, name), sizeof(rv->name)); } -static char *rna_SceneRenderView_path(PointerRNA *ptr) -{ - SceneRenderView *srv = (SceneRenderView *)ptr->data; - return BLI_sprintfN("render.views[\"%s\"]", srv->name); -} - -static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value) -{ - RenderData *rd = (RenderData *)ptr->data; - - if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW && - value == SCE_VIEWS_FORMAT_STEREO_3D) - { - /* make sure the actview is visible */ - if (rd->actview > 1) rd->actview = 1; - } - - rd->views_format = value; -} - -static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) -{ - return (BLI_listbase_count(&R_engines) > 1); -} - -static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr) -{ - Scene *scene = (Scene *)ptr->id.data; - return BKE_scene_use_new_shading_nodes(scene); -} - -static int rna_RenderSettings_use_spherical_stereo_get(PointerRNA *ptr) -{ - Scene *scene = (Scene *)ptr->id.data; - return BKE_scene_use_spherical_stereo(scene); -} - -static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr) -{ - RenderData *rd = (RenderData *)ptr->data; - RenderEngineType *type; - - for (type = R_engines.first; type; type = type->next) - if (STREQ(type->idname, rd->engine)) - return (type->flag & RE_GAME) != 0; - - return 0; -} - -static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values) -{ - SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data; - rl->lay = ED_view3d_scene_layer_set(rl->lay, values, NULL); -} - -static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr) +void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; @@ -1655,11 +1452,10 @@ static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *activescene, Po rna_Scene_glsl_update(bmain, activescene, ptr); } -static void rna_SceneRenderLayer_update_render_passes(ID *id) +static char *rna_SceneRenderView_path(PointerRNA *ptr) { - Scene *scene = (Scene *)id; - if (scene->nodetree) - ntreeCompositUpdateRLayers(scene->nodetree); + SceneRenderView *srv = (SceneRenderView *)ptr->data; + return BLI_sprintfN("render.views[\"%s\"]", srv->name); } static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr) @@ -1673,23 +1469,25 @@ static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr) static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; - Base *base; - - for (base = scene->base.first; base; base = base->next) - BKE_ptcache_object_reset(scene, base->object, PTCACHE_RESET_DEPSGRAPH); + FOREACH_SCENE_OBJECT(scene, ob) + { + BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH); + } + FOREACH_SCENE_OBJECT_END } static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value) { Scene *scene = (Scene *)ptr->id.data; + ViewLayer *view_layer = BKE_view_layer_context_active_PLACEHOLDER(scene); ToolSettings *ts = (ToolSettings *)ptr->data; int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0); if (flag) { ts->selectmode = flag; - if (scene->basact) { - Mesh *me = BKE_mesh_from_object(scene->basact->object); + if (view_layer->basact) { + Mesh *me = BKE_mesh_from_object(view_layer->basact->object); if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) { me->edit_btmesh->selectmode = flag; EDBM_selectmode_set(me->edit_btmesh); @@ -1698,12 +1496,13 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value } } -static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_Scene_editmesh_select_mode_update(bContext *C, PointerRNA *UNUSED(ptr)) { + ViewLayer *view_layer = CTX_data_view_layer(C); Mesh *me = NULL; - if (scene->basact) { - me = BKE_mesh_from_object(scene->basact->object); + if (view_layer->basact) { + me = BKE_mesh_from_object(view_layer->basact->object); if (me && me->edit_btmesh == NULL) me = NULL; } @@ -1725,7 +1524,7 @@ static void object_simplify_update(Object *ob) for (md = ob->modifiers.first; md; md = md->next) { if (ELEM(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem)) { - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); } } @@ -1740,33 +1539,39 @@ static void object_simplify_update(Object *ob) } } -static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Scene_use_simplify_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *sce = ptr->id.data; Scene *sce_iter; Base *base; - BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true); - for (SETLOOPER(sce, sce_iter, base)) + FOREACH_SCENE_OBJECT(sce, ob) + { + object_simplify_update(ob); + } + FOREACH_SCENE_OBJECT_END + + for (SETLOOPER_SET_ONLY(sce, sce_iter, base)) { object_simplify_update(base->object); + } WM_main_add_notifier(NC_GEOM | ND_DATA, NULL); - DAG_id_tag_update(&scene->id, 0); + DEG_id_tag_update(&sce->id, 0); } -static void rna_Scene_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Scene *sce = ptr->id.data; if (sce->r.mode & R_SIMPLIFY) - rna_Scene_use_simplify_update(bmain, sce, ptr); + rna_Scene_use_simplify_update(bmain, scene, ptr); } static void rna_SceneRenderData_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *sce = ptr->id.data; - DAG_id_tag_update(&sce->id, 0); + DEG_id_tag_update(&sce->id, 0); } static void rna_Scene_use_persistent_data_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -1896,9 +1701,11 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons } } -static void rna_UnifiedPaintSettings_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_UnifiedPaintSettings_update(bContext *C, PointerRNA *UNUSED(ptr)) { - Brush *br = BKE_paint_brush(BKE_paint_get_active(scene)); + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + Brush *br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer)); WM_main_add_notifier(NC_BRUSH | NA_EDITED, br); } @@ -1921,11 +1728,11 @@ static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, flo ups->unprojected_radius = value; } -static void rna_UnifiedPaintSettings_radius_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_UnifiedPaintSettings_radius_update(bContext *C, PointerRNA *ptr) { /* changing the unified size should invalidate the overlay but also update the brush */ BKE_paint_invalidate_overlay_all(); - rna_UnifiedPaintSettings_update(bmain, scene, ptr); + rna_UnifiedPaintSettings_update(C, ptr); } static char *rna_UnifiedPaintSettings_path(PointerRNA *UNUSED(ptr)) @@ -1939,18 +1746,19 @@ static char *rna_CurvePaintSettings_path(PointerRNA *UNUSED(ptr)) } /* generic function to recalc geometry */ -static void rna_EditMesh_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_EditMesh_update(bContext *C, PointerRNA *UNUSED(ptr)) { + ViewLayer *view_layer = CTX_data_view_layer(C); Mesh *me = NULL; - if (scene->basact) { - me = BKE_mesh_from_object(scene->basact->object); + if (view_layer->basact) { + me = BKE_mesh_from_object(view_layer->basact->object); if (me && me->edit_btmesh == NULL) me = NULL; } if (me) { - DAG_id_tag_update(&me->id, OB_RECALC_DATA); + DEG_id_tag_update(&me->id, OB_RECALC_DATA); WM_main_add_notifier(NC_GEOM | ND_DATA, me); } } @@ -1965,11 +1773,13 @@ static char *rna_MeshStatVis_path(PointerRNA *UNUSED(ptr)) * is not for general use and only for the few cases where changing scene * settings and NOT for general purpose updates, possibly this should be * given its own notifier. */ -static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_Scene_update_active_object_data(bContext *C, PointerRNA *UNUSED(ptr)) { - Object *ob = OBACT; + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *ob = OBACT(view_layer); + if (ob) { - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id); } } @@ -1980,7 +1790,7 @@ static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po Object *camera = scene->camera; if (camera) - DAG_id_tag_update(&camera->id, 0); + DEG_id_tag_update(&camera->id, 0); } static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) @@ -1994,14 +1804,14 @@ static char *rna_ToolSettings_path(PointerRNA *UNUSED(ptr)) return BLI_strdup("tool_settings"); } -static PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr) +PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr) { FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data; return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle); } -static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value) +void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value) { FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data; @@ -2011,19 +1821,19 @@ static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value id_us_plus(&lineset->linestyle->id); } -static FreestyleLineSet *rna_FreestyleSettings_lineset_add( +FreestyleLineSet *rna_FreestyleSettings_lineset_add( ID *id, FreestyleSettings *config, Main *bmain, const char *name) { Scene *scene = (Scene *)id; FreestyleLineSet *lineset = BKE_freestyle_lineset_add(bmain, (FreestyleConfig *)config, name); - DAG_id_tag_update(&scene->id, 0); + DEG_id_tag_update(&scene->id, 0); WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); return lineset; } -static void rna_FreestyleSettings_lineset_remove( +void rna_FreestyleSettings_lineset_remove( ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *lineset_ptr) { FreestyleLineSet *lineset = lineset_ptr->data; @@ -2036,18 +1846,18 @@ static void rna_FreestyleSettings_lineset_remove( RNA_POINTER_INVALIDATE(lineset_ptr); - DAG_id_tag_update(&scene->id, 0); + DEG_id_tag_update(&scene->id, 0); WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); } -static PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr) +PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr) { FreestyleConfig *config = (FreestyleConfig *)ptr->data; FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset); } -static void rna_FreestyleSettings_active_lineset_index_range( +void rna_FreestyleSettings_active_lineset_index_range( PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) { FreestyleConfig *config = (FreestyleConfig *)ptr->data; @@ -2056,30 +1866,30 @@ static void rna_FreestyleSettings_active_lineset_index_range( *max = max_ii(0, BLI_listbase_count(&config->linesets) - 1); } -static int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr) +int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr) { FreestyleConfig *config = (FreestyleConfig *)ptr->data; return BKE_freestyle_lineset_get_active_index(config); } -static void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value) +void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value) { FreestyleConfig *config = (FreestyleConfig *)ptr->data; BKE_freestyle_lineset_set_active_index(config, value); } -static FreestyleModuleConfig *rna_FreestyleSettings_module_add(ID *id, FreestyleSettings *config) +FreestyleModuleConfig *rna_FreestyleSettings_module_add(ID *id, FreestyleSettings *config) { Scene *scene = (Scene *)id; FreestyleModuleConfig *module = BKE_freestyle_module_add((FreestyleConfig *)config); - DAG_id_tag_update(&scene->id, 0); + DEG_id_tag_update(&scene->id, 0); WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); return module; } -static void rna_FreestyleSettings_module_remove( +void rna_FreestyleSettings_module_remove( ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *module_ptr) { Scene *scene = (Scene *)id; @@ -2095,7 +1905,7 @@ static void rna_FreestyleSettings_module_remove( RNA_POINTER_INVALIDATE(module_ptr); - DAG_id_tag_update(&scene->id, 0); + DEG_id_tag_update(&scene->id, 0); WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); } @@ -2164,7 +1974,69 @@ static void rna_Stereo3dFormat_update(Main *UNUSED(bmain), Scene *UNUSED(scene), static int rna_gpu_is_hq_supported_get(PointerRNA *UNUSED(ptr)) { - return GPU_instanced_drawing_support() && GPU_geometry_shader_support(); + return true; +} + +static int rna_ViewLayer_active_view_layer_index_get(PointerRNA *ptr) +{ + Scene *scene = (Scene *)ptr->data; + return scene->active_view_layer; +} + +static void rna_ViewLayer_active_view_layer_index_set(PointerRNA *ptr, int value) +{ + Scene *scene = (Scene *)ptr->data; + int num_layers = BLI_listbase_count(&scene->view_layers); + scene->active_view_layer = min_ff(value, num_layers - 1); +} + +static void rna_ViewLayer_active_view_layer_index_range( + PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) +{ + Scene *scene = (Scene *)ptr->data; + + *min = 0; + *max = max_ii(0, BLI_listbase_count(&scene->view_layers) - 1); +} + +static PointerRNA rna_ViewLayer_active_view_layer_get(PointerRNA *ptr) +{ + Scene *scene = (Scene *)ptr->data; + ViewLayer *view_layer = BLI_findlink(&scene->view_layers, scene->active_view_layer); + + return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, view_layer); +} + +static void rna_ViewLayer_active_view_layer_set(PointerRNA *ptr, PointerRNA value) +{ + Scene *scene = (Scene *)ptr->data; + ViewLayer *view_layer = (ViewLayer *)value.data; + const int index = BLI_findindex(&scene->view_layers, view_layer); + if (index != -1) scene->active_view_layer = index; +} + +static ViewLayer *rna_ViewLayer_new( + ID *id, Scene *UNUSED(sce), Main *bmain, const char *name) +{ + Scene *scene = (Scene *)id; + ViewLayer *view_layer = BKE_view_layer_add(scene, name); + + DEG_id_tag_update(&scene->id, 0); + DEG_relations_tag_update(bmain); + WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); + + return view_layer; +} + +static void rna_ViewLayer_remove( + ID *id, Scene *UNUSED(sce), Main *bmain, ReportList *reports, PointerRNA *sl_ptr) +{ + Scene *scene = (Scene *)id; + ViewLayer *view_layer = sl_ptr->data; + + if (ED_scene_view_layer_delete(bmain, scene, view_layer, reports)) { + RNA_POINTER_INVALIDATE(sl_ptr); + } } #else @@ -2435,24 +2307,6 @@ static void rna_def_gpencil_brushes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_ui_text(prop, "Active Brush Index", "Index of active brush"); } -static void rna_def_transform_orientation(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "TransformOrientation", NULL); - - prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX); - RNA_def_property_float_sdna(prop, NULL, "mat"); - RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_struct_name_property(srna, prop); - RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); -} - static void rna_def_tool_settings(BlenderRNA *brna) { StructRNA *srna; @@ -2544,6 +2398,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sculpt", ""); prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1); RNA_def_property_ui_text(prop, "WPaint Auto-Normalize", "Ensure all bone-deforming vertex groups add up " @@ -2551,6 +2406,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data"); prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1); RNA_def_property_ui_text(prop, "WPaint Multi-Paint", "Paint across the weights of all selected bones, " @@ -2558,12 +2414,14 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data"); prop = RNA_def_property(srna, "vertex_group_user", PROP_ENUM, PROP_NONE); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_enum_sdna(prop, NULL, "weightuser"); RNA_def_property_enum_items(prop, draw_groupuser_items); RNA_def_property_ui_text(prop, "Mask Non-Group Vertices", "Display unweighted vertices"); RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data"); prop = RNA_def_property(srna, "vertex_group_subset", PROP_ENUM, PROP_NONE); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_enum_sdna(prop, NULL, "vgroupsubset"); RNA_def_property_enum_items(prop, vertex_group_select_items); RNA_def_property_ui_text(prop, "Subset", "Filter Vertex groups for Display"); @@ -2874,6 +2732,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set"); RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update"); prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR); @@ -3009,6 +2868,7 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna) * from the active brush */ prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL); RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10); RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, -1); RNA_def_property_ui_text(prop, "Radius", "Radius of the brush"); @@ -3016,6 +2876,7 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_funcs(prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_range(prop, 0.001, FLT_MAX); RNA_def_property_ui_range(prop, 0.001, 1, 0, -1); RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units"); @@ -3023,6 +2884,7 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "alpha"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_float_default(prop, 0.5f); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3); @@ -3031,6 +2893,7 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "weight"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_float_default(prop, 0.5f); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3); @@ -3038,12 +2901,14 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update"); prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_float_sdna(prop, NULL, "rgb"); RNA_def_property_ui_text(prop, "Color", ""); RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update"); prop = RNA_def_property(srna, "secondary_color", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_float_sdna(prop, NULL, "secondary_rgb"); RNA_def_property_ui_text(prop, "Secondary Color", ""); @@ -3185,6 +3050,7 @@ static void rna_def_statvis(BlenderRNA *brna) prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, stat_type); RNA_def_property_ui_text(prop, "Type", "Type of data to visualize/check"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); @@ -3195,6 +3061,7 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3); RNA_def_property_ui_text(prop, "Overhang Min", "Minimum angle to display"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); prop = RNA_def_property(srna, "overhang_max", PROP_FLOAT, PROP_ANGLE); @@ -3203,12 +3070,14 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3); RNA_def_property_ui_text(prop, "Overhang Max", "Maximum angle to display"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); prop = RNA_def_property(srna, "overhang_axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "overhang_axis"); RNA_def_property_enum_items(prop, rna_enum_object_axis_items); RNA_def_property_ui_text(prop, "Axis", ""); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); @@ -3219,6 +3088,7 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1000.0); RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3); RNA_def_property_ui_text(prop, "Thickness Min", "Minimum for measuring thickness"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_DISTANCE); @@ -3227,12 +3097,14 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1000.0); RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3); RNA_def_property_ui_text(prop, "Thickness Max", "Maximum for measuring thickness"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); prop = RNA_def_property(srna, "thickness_samples", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "thickness_samples"); RNA_def_property_range(prop, 1, 32); RNA_def_property_ui_text(prop, "Samples", "Number of samples to test per face"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); /* distort */ @@ -3242,6 +3114,7 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3); RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); prop = RNA_def_property(srna, "distort_max", PROP_FLOAT, PROP_ANGLE); @@ -3250,6 +3123,7 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3); RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); /* sharp */ @@ -3259,6 +3133,7 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f)); RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3); RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); prop = RNA_def_property(srna, "sharp_max", PROP_FLOAT, PROP_ANGLE); @@ -3267,6 +3142,7 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f)); RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3); RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); } @@ -3314,67 +3190,19 @@ static void rna_def_unit_settings(BlenderRNA *brna) RNA_def_property_update(prop, NC_WINDOW, NULL); } -void rna_def_render_layer_common(StructRNA *srna, int scene) +void rna_def_view_layer_common(StructRNA *srna, int scene) { PropertyRNA *prop; prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderLayer_name_set"); + if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ViewLayer_name_set"); else RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Name", "Render layer name"); RNA_def_struct_name_property(srna, prop); if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "mat_override"); - RNA_def_property_struct_type(prop, "Material"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Material Override", - "Material to override all other materials in this render layer"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); - else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - - prop = RNA_def_property(srna, "light_override", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "light_override"); - RNA_def_property_struct_type(prop, "Group"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Light Override", "Group to override all other lights in this render layer"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); - else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - - /* layers */ - prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER); - RNA_def_property_boolean_sdna(prop, NULL, "lay", 1); - RNA_def_property_array(prop, 20); - RNA_def_property_ui_text(prop, "Visible Layers", "Scene layers included in this render layer"); - if (scene) RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_layer_set"); - else RNA_def_property_boolean_funcs(prop, NULL, "rna_RenderLayer_layer_set"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); - else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - /* this seems to be too much trouble with depsgraph updates/etc. currently (20140423) */ - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - - prop = RNA_def_property(srna, "layers_zmask", PROP_BOOLEAN, PROP_LAYER); - RNA_def_property_boolean_sdna(prop, NULL, "lay_zmask", 1); - RNA_def_property_array(prop, 20); - RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers for solid faces"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); - else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - - prop = RNA_def_property(srna, "layers_exclude", PROP_BOOLEAN, PROP_LAYER); - RNA_def_property_boolean_sdna(prop, NULL, "lay_exclude", 1); - RNA_def_property_array(prop, 20); - RNA_def_property_ui_text(prop, "Exclude Layers", "Exclude scene layers from having any influence"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); - else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - if (scene) { - prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED); - RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, " - "0 will use the scene setting"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - prop = RNA_def_property(srna, "pass_alpha_threshold", PROP_FLOAT, PROP_FACTOR); RNA_def_property_ui_text(prop, "Alpha Threshold", "Z, Index, normal, UV and vector passes are only affected by surfaces with " @@ -3383,12 +3211,6 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) } /* layer options */ - prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "layflag", SCE_LAY_DISABLE); - RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); - else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK); RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values"); @@ -3450,247 +3272,241 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_FRS); - RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); - else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - /* passes */ prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED); RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z); RNA_def_property_ui_text(prop, "Z", "Deliver Z values pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_vector", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR); RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL); RNA_def_property_ui_text(prop, "Normal", "Deliver normal pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_uv", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV); RNA_def_property_ui_text(prop, "UV", "Deliver texture UV pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_mist", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST); RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_object_index", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB); RNA_def_property_ui_text(prop, "Object Index", "Deliver object index pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_material_index", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA); RNA_def_property_ui_text(prop, "Material Index", "Deliver material index pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_RGBA); RNA_def_property_ui_text(prop, "Color", "Deliver shade-less color pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_diffuse", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE); RNA_def_property_ui_text(prop, "Diffuse", "Deliver diffuse pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_specular", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SPEC); RNA_def_property_ui_text(prop, "Specular", "Deliver specular pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_shadow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW); RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO); RNA_def_property_ui_text(prop, "AO", "Deliver AO pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_reflection", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFLECT); RNA_def_property_ui_text(prop, "Reflection", "Deliver raytraced reflection pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_refraction", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFRACT); RNA_def_property_ui_text(prop, "Refraction", "Deliver raytraced refraction pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT); RNA_def_property_ui_text(prop, "Emit", "Deliver emission pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_environment", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT); RNA_def_property_ui_text(prop, "Environment", "Deliver environment lighting pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDIRECT); RNA_def_property_ui_text(prop, "Indirect", "Deliver indirect lighting pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "exclude_specular", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SPEC); RNA_def_property_ui_text(prop, "Specular Exclude", "Exclude specular pass from combined"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "exclude_shadow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SHADOW); RNA_def_property_ui_text(prop, "Shadow Exclude", "Exclude shadow pass from combined"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "exclude_ambient_occlusion", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_AO); RNA_def_property_ui_text(prop, "AO Exclude", "Exclude AO pass from combined"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "exclude_reflection", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFLECT); RNA_def_property_ui_text(prop, "Reflection Exclude", "Exclude raytraced reflection pass from combined"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "exclude_refraction", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFRACT); RNA_def_property_ui_text(prop, "Refraction Exclude", "Exclude raytraced refraction pass from combined"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "exclude_emit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_EMIT); RNA_def_property_ui_text(prop, "Emit Exclude", "Exclude emission pass from combined"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "exclude_environment", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_ENVIRONMENT); RNA_def_property_ui_text(prop, "Environment Exclude", "Exclude environment pass from combined"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "exclude_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_INDIRECT); RNA_def_property_ui_text(prop, "Indirect Exclude", "Exclude indirect pass from combined"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_diffuse_direct", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT); RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT); RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR); RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT); RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy direct pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_glossy_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT); RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy indirect pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_glossy_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR); RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy color pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_transmission_direct", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT); RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission direct pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_transmission_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT); RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission indirect pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR); RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission color pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_subsurface_direct", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_DIRECT); RNA_def_property_ui_text(prop, "Subsurface Direct", "Deliver subsurface direct pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_subsurface_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_INDIRECT); RNA_def_property_ui_text(prop, "Subsurface Indirect", "Deliver subsurface indirect pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "use_pass_subsurface_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_COLOR); RNA_def_property_ui_text(prop, "Subsurface Color", "Deliver subsurface color pass"); - if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); } @@ -3760,7 +3576,7 @@ static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); } -static void rna_def_freestyle_settings(BlenderRNA *brna) +void rna_def_freestyle_settings(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; @@ -4053,8 +3869,8 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) srna = RNA_def_struct(brna, "FreestyleSettings", NULL); RNA_def_struct_sdna(srna, "FreestyleConfig"); - RNA_def_struct_nested(brna, srna, "SceneRenderLayer"); - RNA_def_struct_ui_text(srna, "Freestyle Settings", "Freestyle settings for a SceneRenderLayer data-block"); + RNA_def_struct_nested(brna, srna, "ViewLayer"); + RNA_def_struct_ui_text(srna, "Freestyle Settings", "Freestyle settings for a ViewLayer data-block"); prop = RNA_def_property(srna, "modules", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "modules", NULL); @@ -4780,11 +4596,6 @@ static void rna_def_scene_game_data(BlenderRNA *brna) "Respect the frame rate from the Physics panel in the world properties " "rather than rendering as many frames as possible"); - prop = RNA_def_property(srna, "use_display_lists", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_DISPLAY_LISTS); - RNA_def_property_ui_text(prop, "Display Lists", - "Use display lists to speed up rendering by keeping geometry on the GPU"); - prop = RNA_def_property(srna, "use_deprecation_warnings", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_IGNORE_DEPRECATION_WARNINGS); RNA_def_property_ui_text(prop, "Deprecation Warnings", @@ -4944,11 +4755,23 @@ static void rna_def_gpu_dof_fx(BlenderRNA *brna) RNA_def_property_int_funcs(prop, NULL, "rna_GPUDOFSettings_blades_set", NULL); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update"); + prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_ui_text(prop, "Rotation", "Rotation of blades in apperture"); + RNA_def_property_range(prop, -M_PI, M_PI); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "Ratio", "Distortion to simulate anamorphic lens bokeh"); + RNA_def_property_range(prop, 0.0000001f, FLT_MAX); + RNA_def_property_ui_range(prop, 1.0f, 2.0f, 0.1, 3); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + prop = RNA_def_property(srna, "use_high_quality", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "high_quality", 1); RNA_def_property_ui_text(prop, "High Quality", "Use high quality depth of field"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update"); + /* NOTE: high quality is always supported */ prop = RNA_def_property(srna, "is_hq_supported", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_gpu_is_hq_supported_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -5029,77 +4852,46 @@ static void rna_def_gpu_fx(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUFXSettings_fx_update"); } - -static void rna_def_scene_render_layer(BlenderRNA *brna) +static void rna_def_view_layers(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; - PropertyRNA *prop; - FunctionRNA *func; - - srna = RNA_def_struct(brna, "SceneRenderLayer", NULL); - RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer"); - RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS); - RNA_def_struct_path_func(srna, "rna_SceneRenderLayer_path"); - RNA_def_struct_idprops_func(srna, "rna_SceneRenderLayer_idprops"); - - rna_def_render_layer_common(srna, 1); - - func = RNA_def_function(srna, "update_render_passes", "rna_SceneRenderLayer_update_render_passes"); - RNA_def_function_ui_description(func, "Requery the enabled render passes from the render engine"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF); - - /* Freestyle */ - rna_def_freestyle_settings(brna); - - prop = RNA_def_property(srna, "freestyle_settings", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "freestyleConfig"); - RNA_def_property_struct_type(prop, "FreestyleSettings"); - RNA_def_property_ui_text(prop, "Freestyle Settings", ""); -} - -/* Render Layers */ -static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) -{ - StructRNA *srna; - PropertyRNA *prop; - FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; - RNA_def_property_srna(cprop, "RenderLayers"); - srna = RNA_def_struct(brna, "RenderLayers", NULL); - RNA_def_struct_sdna(srna, "RenderData"); + RNA_def_property_srna(cprop, "ViewLayers"); + srna = RNA_def_struct(brna, "ViewLayers", NULL); + RNA_def_struct_sdna(srna, "Scene"); RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers"); prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_sdna(prop, NULL, "actlay"); - RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", - "rna_RenderSettings_active_layer_index_set", - "rna_RenderSettings_active_layer_index_range"); - RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); - + RNA_def_property_int_sdna(prop, NULL, "active_view_layer"); + RNA_def_property_int_funcs(prop, "rna_ViewLayer_active_view_layer_index_get", + "rna_ViewLayer_active_view_layer_index_set", + "rna_ViewLayer_active_view_layer_index_range"); + RNA_def_property_ui_text(prop, "Active View Layer Index", "Active index in view layer 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, "SceneRenderLayer"); - RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get", - "rna_RenderSettings_active_layer_set", NULL, NULL); + RNA_def_property_struct_type(prop, "ViewLayer"); + RNA_def_property_pointer_funcs(prop, "rna_ViewLayer_active_view_layer_get", + "rna_ViewLayer_active_view_layer_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); - RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); + RNA_def_property_ui_text(prop, "Active View Layer", "Active View Layer"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL); - func = RNA_def_function(srna, "new", "rna_RenderLayer_new"); - RNA_def_function_ui_description(func, "Add a render layer to scene"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); - parm = RNA_def_string(func, "name", "RenderLayer", 0, "", "New name for the render layer (not unique)"); + func = RNA_def_function(srna, "new", "rna_ViewLayer_new"); + RNA_def_function_ui_description(func, "Add a view layer to scene"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); + parm = RNA_def_string(func, "name", "ViewLayer", 0, "", "New name for the view layer (not unique)"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - parm = RNA_def_pointer(func, "result", "SceneRenderLayer", "", "Newly created render layer"); + parm = RNA_def_pointer(func, "result", "ViewLayer", "", "Newly created view layer"); RNA_def_function_return(func, parm); - func = RNA_def_function(srna, "remove", "rna_RenderLayer_remove"); - RNA_def_function_ui_description(func, "Remove a render layer"); - RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID); - parm = RNA_def_pointer(func, "layer", "SceneRenderLayer", "", "Render layer to remove"); + func = RNA_def_function(srna, "remove", "rna_ViewLayer_remove"); + RNA_def_function_ui_description(func, "Remove a view layer"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "layer", "ViewLayer", "", "View layer to remove"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); } @@ -5773,11 +5565,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static const EnumPropertyItem engine_items[] = { - {0, "BLENDER_RENDER", 0, "Blender Render", "Use the Blender internal rendering engine for rendering"}, - {0, NULL, 0, NULL, NULL} - }; - static const EnumPropertyItem freestyle_thickness_items[] = { {R_LINE_THICKNESS_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Specify unit line thickness in pixels"}, {R_LINE_THICKNESS_RELATIVE, "RELATIVE", 0, "Relative", @@ -6481,14 +6268,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Depth of Field", "Use depth of field using the values from scene strip active camera"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update"); - /* layers */ - prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "layers", NULL); - RNA_def_property_struct_type(prop, "SceneRenderLayer"); - RNA_def_property_ui_text(prop, "Render Layers", ""); - rna_def_render_layers(brna, prop); - - prop = RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER); RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer"); @@ -6521,35 +6300,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_views_format_set", NULL); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - /* 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_RenderSettings_engine_get", "rna_RenderSettings_engine_set", - "rna_RenderSettings_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_RenderSettings_engine_update"); - - prop = RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_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_RenderSettings_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_RenderSettings_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_RenderSettings_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"); - /* simplify */ prop = RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SIMPLIFY); @@ -6635,61 +6385,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna) static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; - PropertyRNA *prop; - FunctionRNA *func; - PropertyRNA *parm; - RNA_def_property_srna(cprop, "SceneObjects"); srna = RNA_def_struct(brna, "SceneObjects", NULL); RNA_def_struct_sdna(srna, "Scene"); - RNA_def_struct_ui_text(srna, "Scene Objects", "Collection of scene objects"); - - func = RNA_def_function(srna, "link", "rna_Scene_object_link"); - RNA_def_function_ui_description(func, "Link object to scene, run scene.update() after"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); - parm = RNA_def_pointer(func, "object", "Object", "", "Object to add to scene"); - RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); - parm = RNA_def_pointer(func, "base", "ObjectBase", "", "The newly created base"); - RNA_def_function_return(func, parm); - - func = RNA_def_function(srna, "unlink", "rna_Scene_object_unlink"); - RNA_def_function_ui_description(func, "Unlink object from scene"); - RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene"); - RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); - - prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_pointer_funcs(prop, "rna_Scene_active_object_get", "rna_Scene_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 scene"); - /* Could call: ED_base_object_activate(C, scene->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); -} - - -/* scene.bases.* */ -static void rna_def_scene_bases(BlenderRNA *brna, PropertyRNA *cprop) -{ - StructRNA *srna; - PropertyRNA *prop; - -/* FunctionRNA *func; */ -/* PropertyRNA *parm; */ - - RNA_def_property_srna(cprop, "SceneBases"); - srna = RNA_def_struct(brna, "SceneBases", NULL); - RNA_def_struct_sdna(srna, "Scene"); - RNA_def_struct_ui_text(srna, "Scene Bases", "Collection of scene bases"); - - prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "ObjectBase"); - RNA_def_property_pointer_sdna(prop, NULL, "basact"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Active Base", "Active object base in the scene"); - RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL); + RNA_def_struct_ui_text(srna, "Scene Objects", "All the of scene objects"); } /* scene.timeline_markers */ @@ -6912,33 +6612,28 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_set_set", NULL, NULL); RNA_def_property_ui_text(prop, "Background Scene", "Background set scene"); - RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update"); + RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update"); prop = RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "World", "World used for rendering the scene"); - RNA_def_property_update(prop, NC_SCENE | ND_WORLD, "rna_Scene_glsl_update"); + RNA_def_property_update(prop, NC_SCENE | ND_WORLD, "rna_Scene_world_update"); prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH); RNA_def_property_float_sdna(prop, NULL, "cursor"); RNA_def_property_ui_text(prop, "Cursor Location", "3D cursor location"); RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4); RNA_def_property_update(prop, NC_WINDOW, NULL); - - /* Bases/Objects */ - prop = RNA_def_property(srna, "object_bases", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "base", NULL); - RNA_def_property_struct_type(prop, "ObjectBase"); - RNA_def_property_ui_text(prop, "Bases", ""); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, - "rna_Scene_object_bases_lookup_string", NULL); - rna_def_scene_bases(brna, prop); prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "base", NULL); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Objects", ""); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_Scene_objects_get", NULL, NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, + "rna_Scene_objects_begin", + "rna_Scene_objects_next", + "rna_Scene_objects_end", + "rna_Scene_objects_get", + NULL, NULL, NULL, NULL); rna_def_scene_objects(brna, prop); /* Layers */ @@ -7177,7 +6872,26 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "r"); RNA_def_property_struct_type(prop, "RenderSettings"); RNA_def_property_ui_text(prop, "Render Data", ""); - + + /* View Render */ + prop = RNA_def_property(srna, "view_render", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "ViewRenderSettings"); + RNA_def_property_ui_text(prop, "View Render", ""); + + /* Render Engine Data */ + prop = RNA_def_property(srna, "layer_properties", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "layer_properties->data.group", NULL); + RNA_def_property_struct_type(prop, "ViewLayerSettings"); + RNA_def_property_ui_text(prop, "Layer Settings", + "Engine specific render settings to be overridden by layers"); + + prop = RNA_def_property(srna, "collection_properties", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "collection_properties->data.group", NULL); + RNA_def_property_struct_type(prop, "LayerCollectionSettings"); + RNA_def_property_ui_text(prop, "Collection Settings", + "Engine specific render settings to be overridden by collections"); + /* Safe Areas */ prop = RNA_def_property(srna, "safe_areas", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "safe_areas"); @@ -7247,6 +6961,8 @@ void RNA_def_scene(BlenderRNA *brna) /* Statistics */ func = RNA_def_function(srna, "statistics", "ED_info_stats_string"); + parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Active layer"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_string(func, "statistics", NULL, 0, "Statistics", ""); RNA_def_function_return(func, parm); @@ -7257,12 +6973,6 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil data-block"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); - - /* Transform Orientations */ - prop = RNA_def_property(srna, "orientations", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "transform_spaces", NULL); - RNA_def_property_struct_type(prop, "TransformOrientation"); - RNA_def_property_ui_text(prop, "Transform Orientations", ""); /* active MovieClip */ prop = RNA_def_property(srna, "active_clip", PROP_POINTER, PROP_NONE); @@ -7288,10 +6998,18 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ColorManagedSequencerColorspaceSettings"); RNA_def_property_ui_text(prop, "Sequencer Color Space Settings", "Settings of color space sequencer is working in"); - /* Dependency Graph */ - prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Depsgraph"); - RNA_def_property_ui_text(prop, "Dependency Graph", "Dependencies in the scene data"); + /* Layer and Collections */ + prop = RNA_def_property(srna, "view_layers", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "view_layers", NULL); + RNA_def_property_struct_type(prop, "ViewLayer"); + RNA_def_property_ui_text(prop, "View Layers", ""); + rna_def_view_layers(brna, prop); + + prop = RNA_def_property(srna, "master_collection", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "collection"); + RNA_def_property_struct_type(prop, "SceneCollection"); + RNA_def_property_ui_text(prop, "Master Collection", "Collection that contains all other collections"); /* Nestled Data */ /* *** Non-Animated *** */ @@ -7305,13 +7023,11 @@ void RNA_def_scene(BlenderRNA *brna) rna_def_unit_settings(brna); rna_def_scene_image_format_data(brna); rna_def_scene_game_data(brna); - rna_def_transform_orientation(brna); rna_def_selected_uv_element(brna); rna_def_display_safe_areas(brna); RNA_define_animate_sdna(true); /* *** Animated *** */ rna_def_scene_render_data(brna); - rna_def_scene_render_layer(brna); rna_def_gpu_fx(brna); rna_def_scene_render_view(brna); |