From 5c17dbd991d64257f99b179343b453bb60823d44 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 29 May 2018 15:57:14 +0200 Subject: Fix missing Cycles 3D viewport updates when editing materials, lamps. This introduces a new depsgraph API for getting updated datablocks, rather than getting it from bpy.data. * depsgraph.ids_updated gives a list of all datablocks in the depsgraph which have been updated. * depsgraph.id_type_updated('TYPE') is true if any datablock of the given type has been added, removed or modified. More API updates are coming to properly handle multiple depsgraphs and finer update granularity, but this should make Cycles work again. --- source/blender/depsgraph/intern/depsgraph_query.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'source/blender/depsgraph/intern/depsgraph_query.cc') diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc index 734b0ef931a..06fbe980620 100644 --- a/source/blender/depsgraph/intern/depsgraph_query.cc +++ b/source/blender/depsgraph/intern/depsgraph_query.cc @@ -80,9 +80,24 @@ float DEG_get_ctime(const Depsgraph *graph) } -bool DEG_id_type_tagged(Main *bmain, short id_type) +bool DEG_id_type_updated(const Depsgraph *graph, short id_type) { - return bmain->id_tag_update[BKE_idcode_to_index(id_type)] != 0; + const DEG::Depsgraph *deg_graph = reinterpret_cast(graph); + return deg_graph->id_type_updated[BKE_idcode_to_index(id_type)] != 0; +} + +bool DEG_id_type_any_updated(const Depsgraph *graph) +{ + const DEG::Depsgraph *deg_graph = reinterpret_cast(graph); + + /* Loop over all ID types. */ + for (int id_type_index = 0; id_type_index < MAX_LIBARRAY; id_type_index++) { + if (deg_graph->id_type_updated[id_type_index]) { + return true; + } + } + + return false; } short DEG_get_eval_flags_for_id(const Depsgraph *graph, ID *id) -- cgit v1.2.3