|
|
|
@@ -224,13 +224,13 @@ void depsgraph_tag_to_component_opcode(const ID *id,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void id_tag_update_ntree_special(
|
|
|
|
|
Main *bmain, Depsgraph *graph, ID *id, int flag, eUpdateSource update_source)
|
|
|
|
|
Main *bmain, Depsgraph *graph, ID *id, unsigned int flags, eUpdateSource update_source)
|
|
|
|
|
{
|
|
|
|
|
bNodeTree *ntree = ntreeFromID(id);
|
|
|
|
|
if (ntree == nullptr) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
graph_id_tag_update(bmain, graph, &ntree->id, flag, update_source);
|
|
|
|
|
graph_id_tag_update(bmain, graph, &ntree->id, flags, update_source);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void depsgraph_update_editors_tag(Main *bmain, Depsgraph *graph, ID *id)
|
|
|
|
@@ -407,13 +407,13 @@ string stringify_append_bit(const string &str, IDRecalcFlag tag)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string stringify_update_bitfield(int flag)
|
|
|
|
|
string stringify_update_bitfield(unsigned int flags)
|
|
|
|
|
{
|
|
|
|
|
if (flag == 0) {
|
|
|
|
|
if (flags == 0) {
|
|
|
|
|
return "LEGACY_0";
|
|
|
|
|
}
|
|
|
|
|
string result;
|
|
|
|
|
int current_flag = flag;
|
|
|
|
|
unsigned int current_flag = flags;
|
|
|
|
|
/* Special cases to avoid ALL flags form being split into
|
|
|
|
|
* individual bits. */
|
|
|
|
|
if ((current_flag & ID_RECALC_PSYS_ALL) == ID_RECALC_PSYS_ALL) {
|
|
|
|
@@ -421,7 +421,7 @@ string stringify_update_bitfield(int flag)
|
|
|
|
|
}
|
|
|
|
|
/* Handle all the rest of the flags. */
|
|
|
|
|
while (current_flag != 0) {
|
|
|
|
|
IDRecalcFlag tag = (IDRecalcFlag)(1 << bitscan_forward_clear_i(¤t_flag));
|
|
|
|
|
IDRecalcFlag tag = (IDRecalcFlag)(1 << bitscan_forward_clear_uint(¤t_flag));
|
|
|
|
|
result = stringify_append_bit(result, tag);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
@@ -449,7 +449,7 @@ int deg_recalc_flags_for_legacy_zero()
|
|
|
|
|
ID_RECALC_SOURCE | ID_RECALC_EDITORS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int deg_recalc_flags_effective(Depsgraph *graph, int flags)
|
|
|
|
|
int deg_recalc_flags_effective(Depsgraph *graph, unsigned int flags)
|
|
|
|
|
{
|
|
|
|
|
if (graph != nullptr) {
|
|
|
|
|
if (!graph->is_active) {
|
|
|
|
@@ -520,12 +520,12 @@ void graph_tag_ids_for_visible_update(Depsgraph *graph)
|
|
|
|
|
* No need bother with it to tag or anything. */
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
int flag = 0;
|
|
|
|
|
unsigned int flags = 0;
|
|
|
|
|
if (!deg::deg_copy_on_write_is_expanded(id_node->id_cow)) {
|
|
|
|
|
flag |= ID_RECALC_COPY_ON_WRITE;
|
|
|
|
|
flags |= ID_RECALC_COPY_ON_WRITE;
|
|
|
|
|
if (do_time) {
|
|
|
|
|
if (BKE_animdata_from_id(id_node->id_orig) != nullptr) {
|
|
|
|
|
flag |= ID_RECALC_ANIMATION;
|
|
|
|
|
flags |= ID_RECALC_ANIMATION;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -542,9 +542,9 @@ void graph_tag_ids_for_visible_update(Depsgraph *graph)
|
|
|
|
|
*
|
|
|
|
|
* TODO(sergey): Need to generalize this somehow. */
|
|
|
|
|
if (id_type == ID_OB) {
|
|
|
|
|
flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY;
|
|
|
|
|
flags |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY;
|
|
|
|
|
}
|
|
|
|
|
graph_id_tag_update(bmain, graph, id_node->id_orig, flag, DEG_UPDATE_SOURCE_VISIBILITY);
|
|
|
|
|
graph_id_tag_update(bmain, graph, id_node->id_orig, flags, DEG_UPDATE_SOURCE_VISIBILITY);
|
|
|
|
|
if (id_type == ID_SCE) {
|
|
|
|
|
/* Make sure collection properties are up to date. */
|
|
|
|
|
id_node->tag_update(graph, DEG_UPDATE_SOURCE_VISIBILITY);
|
|
|
|
@@ -614,20 +614,20 @@ NodeType geometry_tag_to_component(const ID *id)
|
|
|
|
|
return NodeType::UNDEFINED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source)
|
|
|
|
|
void id_tag_update(Main *bmain, ID *id, unsigned int flags, eUpdateSource update_source)
|
|
|
|
|
{
|
|
|
|
|
graph_id_tag_update(bmain, nullptr, id, flag, update_source);
|
|
|
|
|
graph_id_tag_update(bmain, nullptr, id, flags, update_source);
|
|
|
|
|
for (deg::Depsgraph *depsgraph : deg::get_all_registered_graphs(bmain)) {
|
|
|
|
|
graph_id_tag_update(bmain, depsgraph, id, flag, update_source);
|
|
|
|
|
graph_id_tag_update(bmain, depsgraph, id, flags, update_source);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Accumulate all tags for an ID between two undo steps, so they can be
|
|
|
|
|
* replayed for undo. */
|
|
|
|
|
id->recalc_after_undo_push |= deg_recalc_flags_effective(nullptr, flag);
|
|
|
|
|
id->recalc_after_undo_push |= deg_recalc_flags_effective(nullptr, flags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void graph_id_tag_update(
|
|
|
|
|
Main *bmain, Depsgraph *graph, ID *id, int flag, eUpdateSource update_source)
|
|
|
|
|
Main *bmain, Depsgraph *graph, ID *id, unsigned int flags, eUpdateSource update_source)
|
|
|
|
|
{
|
|
|
|
|
const int debug_flags = (graph != nullptr) ? DEG_debug_flags_get((::Depsgraph *)graph) : G.debug;
|
|
|
|
|
if (graph != nullptr && graph->is_evaluating) {
|
|
|
|
@@ -640,20 +640,20 @@ void graph_id_tag_update(
|
|
|
|
|
printf("%s: id=%s flags=%s source=%s\n",
|
|
|
|
|
__func__,
|
|
|
|
|
id->name,
|
|
|
|
|
stringify_update_bitfield(flag).c_str(),
|
|
|
|
|
stringify_update_bitfield(flags).c_str(),
|
|
|
|
|
update_source_as_string(update_source));
|
|
|
|
|
}
|
|
|
|
|
IDNode *id_node = (graph != nullptr) ? graph->find_id_node(id) : nullptr;
|
|
|
|
|
if (graph != nullptr) {
|
|
|
|
|
DEG_graph_id_type_tag(reinterpret_cast<::Depsgraph *>(graph), GS(id->name));
|
|
|
|
|
}
|
|
|
|
|
if (flag == 0) {
|
|
|
|
|
if (flags == 0) {
|
|
|
|
|
deg_graph_node_tag_zero(bmain, graph, id_node, update_source);
|
|
|
|
|
}
|
|
|
|
|
/* Store original flag in the ID.
|
|
|
|
|
* Allows to have more granularity than a node-factory based flags. */
|
|
|
|
|
if (id_node != nullptr) {
|
|
|
|
|
id_node->id_cow->recalc |= flag;
|
|
|
|
|
id_node->id_cow->recalc |= flags;
|
|
|
|
|
}
|
|
|
|
|
/* When ID is tagged for update based on an user edits store the recalc flags in the original ID.
|
|
|
|
|
* This way IDs in the undo steps will have this flag preserved, making it possible to restore
|
|
|
|
@@ -663,20 +663,20 @@ void graph_id_tag_update(
|
|
|
|
|
* usually newly created dependency graph skips animation update to avoid loss of unkeyed
|
|
|
|
|
* changes). */
|
|
|
|
|
if (update_source == DEG_UPDATE_SOURCE_USER_EDIT) {
|
|
|
|
|
id->recalc |= deg_recalc_flags_effective(graph, flag);
|
|
|
|
|
id->recalc |= deg_recalc_flags_effective(graph, flags);
|
|
|
|
|
}
|
|
|
|
|
int current_flag = flag;
|
|
|
|
|
unsigned int current_flag = flags;
|
|
|
|
|
while (current_flag != 0) {
|
|
|
|
|
IDRecalcFlag tag = (IDRecalcFlag)(1 << bitscan_forward_clear_i(¤t_flag));
|
|
|
|
|
IDRecalcFlag tag = (IDRecalcFlag)(1 << bitscan_forward_clear_uint(¤t_flag));
|
|
|
|
|
graph_id_tag_update_single_flag(bmain, graph, id, id_node, tag, update_source);
|
|
|
|
|
}
|
|
|
|
|
/* Special case for nested node tree data-blocks. */
|
|
|
|
|
id_tag_update_ntree_special(bmain, graph, id, flag, update_source);
|
|
|
|
|
id_tag_update_ntree_special(bmain, graph, id, flags, update_source);
|
|
|
|
|
/* Direct update tags means that something outside of simulated/cached
|
|
|
|
|
* physics did change and that cache is to be invalidated.
|
|
|
|
|
* This is only needed if data changes. If it's just a drawing, we keep the
|
|
|
|
|
* point cache. */
|
|
|
|
|
if (update_source == DEG_UPDATE_SOURCE_USER_EDIT && flag != ID_RECALC_SHADING) {
|
|
|
|
|
if (update_source == DEG_UPDATE_SOURCE_USER_EDIT && flags != ID_RECALC_SHADING) {
|
|
|
|
|
graph_id_tag_update_single_flag(
|
|
|
|
|
bmain, graph, id, id_node, ID_RECALC_POINT_CACHE, update_source);
|
|
|
|
|
}
|
|
|
|
@@ -747,27 +747,27 @@ const char *DEG_update_tag_as_string(IDRecalcFlag flag)
|
|
|
|
|
|
|
|
|
|
/* Data-Based Tagging. */
|
|
|
|
|
|
|
|
|
|
void DEG_id_tag_update(ID *id, int flag)
|
|
|
|
|
void DEG_id_tag_update(ID *id, unsigned int flags)
|
|
|
|
|
{
|
|
|
|
|
DEG_id_tag_update_ex(G.main, id, flag);
|
|
|
|
|
DEG_id_tag_update_ex(G.main, id, flags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DEG_id_tag_update_ex(Main *bmain, ID *id, int flag)
|
|
|
|
|
void DEG_id_tag_update_ex(Main *bmain, ID *id, unsigned int flags)
|
|
|
|
|
{
|
|
|
|
|
if (id == nullptr) {
|
|
|
|
|
/* Ideally should not happen, but old depsgraph allowed this. */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
deg::id_tag_update(bmain, id, flag, deg::DEG_UPDATE_SOURCE_USER_EDIT);
|
|
|
|
|
deg::id_tag_update(bmain, id, flags, deg::DEG_UPDATE_SOURCE_USER_EDIT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DEG_graph_id_tag_update(struct Main *bmain,
|
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
|
struct ID *id,
|
|
|
|
|
int flag)
|
|
|
|
|
unsigned int flags)
|
|
|
|
|
{
|
|
|
|
|
deg::Depsgraph *graph = (deg::Depsgraph *)depsgraph;
|
|
|
|
|
deg::graph_id_tag_update(bmain, graph, id, flag, deg::DEG_UPDATE_SOURCE_USER_EDIT);
|
|
|
|
|
deg::graph_id_tag_update(bmain, graph, id, flags, deg::DEG_UPDATE_SOURCE_USER_EDIT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DEG_time_tag_update(struct Main *bmain)
|
|
|
|
|