diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-05-29 16:57:14 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-05-30 15:07:23 +0300 |
commit | 5c17dbd991d64257f99b179343b453bb60823d44 (patch) | |
tree | 4a24c1f396c56c36d888bf807227f54b8742f072 /source/blender/depsgraph/intern/depsgraph_query.cc | |
parent | 8ed723745e1bf939ed59062256cf7808219d8748 (diff) |
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.
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph_query.cc')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_query.cc | 19 |
1 files changed, 17 insertions, 2 deletions
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<const DEG::Depsgraph *>(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<const DEG::Depsgraph *>(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) |