diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene_api.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index fe2f4fe0dca..003e2561a22 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -60,7 +60,6 @@ const EnumPropertyItem rna_enum_abc_compression_items[] = { #ifdef RNA_RUNTIME #include "BKE_animsys.h" -#include "BKE_depsgraph.h" #include "BKE_editmesh.h" #include "BKE_global.h" #include "BKE_image.h" @@ -86,8 +85,13 @@ static void rna_Scene_frame_set(Scene *scene, Main *bmain, int frame, float subf BPy_BEGIN_ALLOW_THREADS; #endif - /* It's possible that here we're including layers which were never visible before. */ - BKE_scene_update_for_newframe_ex(bmain->eval_ctx, bmain, scene, (1 << 20) - 1, true); + for (ViewLayer *view_layer = scene->view_layers.first; + view_layer != NULL; + view_layer = view_layer->next) + { + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); + BKE_scene_graph_update_for_newframe(depsgraph, bmain); + } #ifdef WITH_PYTHON BPy_END_ALLOW_THREADS; @@ -99,7 +103,7 @@ static void rna_Scene_frame_set(Scene *scene, Main *bmain, int frame, float subf * redrawing while the data is being modified for render */ if (!G.is_rendering) { /* cant use NC_SCENE|ND_FRAME because this causes wm_event_do_notifiers to call - * BKE_scene_update_for_newframe which will loose any un-keyed changes [#24690] */ + * BKE_scene_graph_update_for_newframe which will loose any un-keyed changes [#24690] */ /* WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); */ /* instead just redraw the views */ @@ -127,7 +131,13 @@ static void rna_Scene_update_tagged(Scene *scene, Main *bmain) BPy_BEGIN_ALLOW_THREADS; #endif - BKE_scene_update_tagged(bmain->eval_ctx, bmain, scene); + for (ViewLayer *view_layer = scene->view_layers.first; + view_layer != NULL; + view_layer = view_layer->next) + { + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); + BKE_scene_graph_update_tagged(depsgraph, bmain); + } #ifdef WITH_PYTHON BPy_END_ALLOW_THREADS; @@ -154,14 +164,15 @@ static void rna_SceneRender_get_frame_path( } static void rna_Scene_ray_cast( - Scene *scene, Main *bmain, + Scene *scene, Main *bmain, ViewLayer *view_layer, float origin[3], float direction[3], float ray_dist, int *r_success, float r_location[3], float r_normal[3], int *r_index, Object **r_ob, float r_obmat[16]) { normalize_v3(direction); - SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, 0); + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); + SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, depsgraph, 0); bool ret = ED_transform_snap_object_project_ray_ex( sctx, @@ -299,6 +310,8 @@ void RNA_api_scene(StructRNA *srna) func = RNA_def_function(srna, "ray_cast", "rna_Scene_ray_cast"); RNA_def_function_flag(func, FUNC_USE_MAIN); RNA_def_function_ui_description(func, "Cast a ray onto in object space"); + parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Scene Layer"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); /* ray start and end */ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); @@ -333,7 +346,6 @@ void RNA_api_scene(StructRNA *srna) func = RNA_def_function(srna, "sequence_editor_clear", "rna_Scene_sequencer_editing_free"); RNA_def_function_ui_description(func, "Clear sequence editor in this scene"); - #ifdef WITH_ALEMBIC /* XXX Deprecated, will be removed in 2.8 in favour of calling the export operator. */ func = RNA_def_function(srna, "alembic_export", "rna_Scene_alembic_export"); @@ -362,7 +374,7 @@ void RNA_api_scene(StructRNA *srna) RNA_def_boolean(func, "export_hair", 1, "Export Hair", "Exports hair particle systems as animated curves"); RNA_def_boolean(func, "export_particles", 1, "Export Particles", "Exports non-hair particle systems"); RNA_def_enum(func, "compression_type", rna_enum_abc_compression_items, 0, "Compression", ""); - RNA_def_boolean(func, "packuv" , 0, "Export with packed UV islands", "Export with packed UV islands"); + RNA_def_boolean(func, "packuv", 0, "Export with packed UV islands", "Export with packed UV islands"); RNA_def_float(func, "scale", 1.0f, 0.0001f, 1000.0f, "Scale", "Value by which to enlarge or shrink the objects with respect to the world's origin", 0.0001f, 1000.0f); RNA_def_boolean(func, "triangulate", 0, "Triangulate", "Export Polygons (Quads & NGons) as Triangles"); RNA_def_enum(func, "quad_method", rna_enum_modifier_triangulate_quad_method_items, 0, "Quad Method", "Method for splitting the quads into triangles"); |