Move ID recalc flags into dedicated field in ID
Currently this is a no-visible-changes change, but the idea is to use this dedicated flag to tell which exact components of ID changed, make it more granular than just OBJECT and OBJECT_DATA. Allow setting this field based on what components new dependency graph flushed on evaluation.
This commit is contained in:
parent
400d59be9b
commit
c4046e9082
|
@ -74,6 +74,8 @@
|
|||
|
||||
#include "nla_private.h"
|
||||
|
||||
#include "atomic_ops.h"
|
||||
|
||||
/* ***************************************** */
|
||||
/* AnimData API */
|
||||
|
||||
|
@ -1663,8 +1665,11 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val
|
|||
|
||||
/* for cases like duplifarmes it's only a temporary so don't
|
||||
* notify anyone of updates */
|
||||
if (!(id->tag & LIB_TAG_ANIM_NO_RECALC)) {
|
||||
BKE_id_tag_set_atomic(id, LIB_TAG_ID_RECALC);
|
||||
if (!(id->recalc & ID_RECALC_SKIP_ANIM_TAG)) {
|
||||
/* NOTE: This is a bit annoying to use atomic API here, but this
|
||||
* code is at it's EOL and removed already in 2.8 branch.
|
||||
*/
|
||||
atomic_fetch_and_or_int32(&id->recalc, ID_RECALC);
|
||||
DAG_id_type_tag(G.main, GS(id->name));
|
||||
}
|
||||
}
|
||||
|
@ -2618,8 +2623,8 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
|
|||
*/
|
||||
if (ptr->id.data != NULL) {
|
||||
ID *id = ptr->id.data;
|
||||
if (!(id->tag & LIB_TAG_ANIM_NO_RECALC)) {
|
||||
id->tag |= LIB_TAG_ID_RECALC;
|
||||
if (!(id->recalc & ID_RECALC_SKIP_ANIM_TAG)) {
|
||||
id->recalc |= ID_RECALC;
|
||||
DAG_id_type_tag(G.main, GS(id->name));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1532,7 +1532,7 @@ static bool check_object_tagged_for_update(Object *object)
|
|||
|
||||
if (ELEM(object->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE)) {
|
||||
ID *data_id = object->data;
|
||||
return (data_id->tag & LIB_TAG_ID_RECALC_ALL) != 0;
|
||||
return (data_id->recalc & ID_RECALC_ALL) != 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1780,13 +1780,13 @@ void DAG_scene_free(Scene *sce)
|
|||
|
||||
static void lib_id_recalc_tag(Main *bmain, ID *id)
|
||||
{
|
||||
id->tag |= LIB_TAG_ID_RECALC;
|
||||
id->recalc |= ID_RECALC;
|
||||
DAG_id_type_tag(bmain, GS(id->name));
|
||||
}
|
||||
|
||||
static void lib_id_recalc_data_tag(Main *bmain, ID *id)
|
||||
{
|
||||
id->tag |= LIB_TAG_ID_RECALC_DATA;
|
||||
id->recalc |= ID_RECALC_DATA;
|
||||
DAG_id_type_tag(bmain, GS(id->name));
|
||||
}
|
||||
|
||||
|
@ -2825,7 +2825,7 @@ void DAG_ids_flush_tagged(Main *bmain)
|
|||
|
||||
if (id && bmain->id_tag_update[BKE_idcode_to_index(GS(id->name))]) {
|
||||
for (; id; id = id->next) {
|
||||
if (id->tag & LIB_TAG_ID_RECALC_ALL) {
|
||||
if (id->recalc & ID_RECALC_ALL) {
|
||||
for (dsl = listbase.first; dsl; dsl = dsl->next)
|
||||
dag_id_flush_update(bmain, dsl->scene, id);
|
||||
|
||||
|
@ -2945,12 +2945,12 @@ void DAG_ids_clear_recalc(Main *bmain)
|
|||
|
||||
if (id && bmain->id_tag_update[BKE_idcode_to_index(GS(id->name))]) {
|
||||
for (; id; id = id->next) {
|
||||
id->tag &= ~LIB_TAG_ID_RECALC_ALL;
|
||||
id->recalc &= ~ID_RECALC_ALL;
|
||||
|
||||
/* some ID's contain semi-datablock nodetree */
|
||||
ntree = ntreeFromID(id);
|
||||
if (ntree)
|
||||
ntree->id.tag &= ~LIB_TAG_ID_RECALC_ALL;
|
||||
ntree->id.recalc &= ~ID_RECALC_ALL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1463,8 +1463,8 @@ void BKE_mask_update_scene(Main *bmain, Scene *scene)
|
|||
Mask *mask;
|
||||
|
||||
for (mask = bmain->mask.first; mask; mask = mask->id.next) {
|
||||
if (mask->id.tag & LIB_TAG_ID_RECALC_ALL) {
|
||||
bool do_new_frame = (mask->id.tag & LIB_TAG_ID_RECALC_DATA) != 0;
|
||||
if (mask->id.recalc & ID_RECALC_ALL) {
|
||||
bool do_new_frame = (mask->id.recalc & ID_RECALC_DATA) != 0;
|
||||
BKE_mask_evaluate_all_masks(bmain, CFRA, do_new_frame);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -379,7 +379,7 @@ static void make_duplis_frames(const DupliContext *ctx)
|
|||
|
||||
/* special flag to avoid setting recalc flags to notify the depsgraph of
|
||||
* updates, as this is not a permanent change to the object */
|
||||
ob->id.tag |= LIB_TAG_ANIM_NO_RECALC;
|
||||
ob->id.recalc |= ID_RECALC_SKIP_ANIM_TAG;
|
||||
|
||||
for (scene->r.cfra = ob->dupsta; scene->r.cfra <= dupend; scene->r.cfra++) {
|
||||
int ok = 1;
|
||||
|
|
|
@ -1841,8 +1841,8 @@ static void prepare_mesh_for_viewport_render(Main *bmain, Scene *scene)
|
|||
if (obedit) {
|
||||
Mesh *mesh = obedit->data;
|
||||
if ((obedit->type == OB_MESH) &&
|
||||
((obedit->id.tag & LIB_TAG_ID_RECALC_ALL) ||
|
||||
(mesh->id.tag & LIB_TAG_ID_RECALC_ALL)))
|
||||
((obedit->id.recalc & ID_RECALC_ALL) ||
|
||||
(mesh->id.recalc & ID_RECALC_ALL)))
|
||||
{
|
||||
if (check_rendered_viewport_visible(bmain)) {
|
||||
BMesh *bm = mesh->edit_btmesh->bm;
|
||||
|
|
|
@ -3077,7 +3077,7 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
|
|||
ntree->adt = newdataadr(fd, ntree->adt);
|
||||
direct_link_animdata(fd, ntree->adt);
|
||||
|
||||
ntree->id.tag &= ~LIB_TAG_ID_RECALC_ALL;
|
||||
ntree->id.recalc &= ~ID_RECALC_ALL;
|
||||
|
||||
link_list(fd, &ntree->nodes);
|
||||
for (node = ntree->nodes.first; node; node = node->next) {
|
||||
|
|
|
@ -153,7 +153,7 @@ void deg_graph_build_finalize(Depsgraph *graph)
|
|||
|
||||
if ((id_node->layers & graph->layers) != 0 || graph->layers == 0) {
|
||||
ID *id = id_node->id;
|
||||
if ((id->tag & LIB_TAG_ID_RECALC_ALL) &&
|
||||
if ((id->recalc & ID_RECALC_ALL) &&
|
||||
(id->tag & LIB_TAG_DOIT))
|
||||
{
|
||||
id_node->tag_update(graph);
|
||||
|
|
|
@ -312,7 +312,7 @@ DepsRelation *Depsgraph::add_new_relation(OperationDepsNode *from,
|
|||
if (comp_node->type == DEG_NODE_TYPE_GEOMETRY) {
|
||||
IDDepsNode *id_to = to->owner->owner;
|
||||
IDDepsNode *id_from = from->owner->owner;
|
||||
if (id_to != id_from && (id_to->id->tag & LIB_TAG_ID_RECALC_ALL)) {
|
||||
if (id_to != id_from && (id_to->id->recalc & ID_RECALC_ALL)) {
|
||||
if ((id_from->eval_flags & DAG_EVAL_NEED_CPU) == 0) {
|
||||
id_from->tag_update(this);
|
||||
id_from->eval_flags |= DAG_EVAL_NEED_CPU;
|
||||
|
|
|
@ -83,13 +83,13 @@ namespace {
|
|||
|
||||
void lib_id_recalc_tag(Main *bmain, ID *id)
|
||||
{
|
||||
id->tag |= LIB_TAG_ID_RECALC;
|
||||
id->recalc |= ID_RECALC;
|
||||
DEG_id_type_tag(bmain, GS(id->name));
|
||||
}
|
||||
|
||||
void lib_id_recalc_data_tag(Main *bmain, ID *id)
|
||||
{
|
||||
id->tag |= LIB_TAG_ID_RECALC_DATA;
|
||||
id->recalc |= ID_RECALC_DATA;
|
||||
DEG_id_type_tag(bmain, GS(id->name));
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
|
|||
GHASH_FOREACH_BEGIN(DEG::IDDepsNode *, id_node, graph->id_hash)
|
||||
{
|
||||
ID *id = id_node->id;
|
||||
if ((id->tag & LIB_TAG_ID_RECALC_ALL) != 0 ||
|
||||
if ((id->recalc & ID_RECALC_ALL) != 0 ||
|
||||
(id_node->layers & scene->lay_updated) == 0)
|
||||
{
|
||||
id_node->tag_update(graph);
|
||||
|
@ -307,7 +307,7 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
|
|||
*/
|
||||
if (GS(id->name) == ID_OB) {
|
||||
Object *object = (Object *)id;
|
||||
if ((id->tag & LIB_TAG_ID_RECALC_ALL) == 0 &&
|
||||
if ((id->recalc & ID_RECALC_ALL) == 0 &&
|
||||
(object->recalc & OB_RECALC_ALL) != 0)
|
||||
{
|
||||
id_node->tag_update(graph);
|
||||
|
@ -409,12 +409,12 @@ void DEG_ids_clear_recalc(Main *bmain)
|
|||
|
||||
if (id && bmain->id_tag_update[BKE_idcode_to_index(GS(id->name))]) {
|
||||
for (; id; id = (ID *)id->next) {
|
||||
id->tag &= ~LIB_TAG_ID_RECALC_ALL;
|
||||
id->recalc &= ~ID_RECALC_ALL;
|
||||
|
||||
/* Some ID's contain semi-datablock nodetree */
|
||||
ntree = ntreeFromID(id);
|
||||
if (ntree != NULL) {
|
||||
ntree->id.tag &= ~LIB_TAG_ID_RECALC_ALL;
|
||||
ntree->id.recalc &= ~ID_RECALC_ALL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,13 +65,13 @@ namespace {
|
|||
// TODO(sergey): De-duplicate with depsgraph_tag,cc
|
||||
void lib_id_recalc_tag(Main *bmain, ID *id)
|
||||
{
|
||||
id->tag |= LIB_TAG_ID_RECALC;
|
||||
id->recalc |= ID_RECALC;
|
||||
DEG_id_type_tag(bmain, GS(id->name));
|
||||
}
|
||||
|
||||
void lib_id_recalc_data_tag(Main *bmain, ID *id)
|
||||
{
|
||||
id->tag |= LIB_TAG_ID_RECALC_DATA;
|
||||
id->recalc |= ID_RECALC_DATA;
|
||||
DEG_id_type_tag(bmain, GS(id->name));
|
||||
}
|
||||
|
||||
|
|
|
@ -348,18 +348,20 @@ enum {
|
|||
/* RESET_AFTER_USE tag existing data before linking so we know what is new. */
|
||||
LIB_TAG_PRE_EXISTING = 1 << 11,
|
||||
|
||||
/* RESET_AFTER_USE, used by update code (depsgraph). */
|
||||
LIB_TAG_ID_RECALC = 1 << 12,
|
||||
LIB_TAG_ID_RECALC_DATA = 1 << 13,
|
||||
LIB_TAG_ANIM_NO_RECALC = 1 << 14,
|
||||
LIB_TAG_ID_RECALC_ALL = (LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA),
|
||||
|
||||
/* RESET_NEVER tag datablock for freeing etc. behavior (usually set when copying real one into temp/runtime one). */
|
||||
LIB_TAG_NO_MAIN = 1 << 16, /* Datablock is not listed in Main database. */
|
||||
LIB_TAG_NO_USER_REFCOUNT = 1 << 17, /* Datablock does not refcount usages of other IDs. */
|
||||
LIB_TAG_NO_MAIN = 1 << 11, /* Datablock is not listed in Main database. */
|
||||
LIB_TAG_NO_USER_REFCOUNT = 1 << 13, /* Datablock does not refcount usages of other IDs. */
|
||||
/* Datablock was not allocated by standard system (BKE_libblock_alloc), do not free its memory
|
||||
* (usual type-specific freeing is called though). */
|
||||
LIB_TAG_NOT_ALLOCATED = 1 << 18,
|
||||
LIB_TAG_NOT_ALLOCATED = 1 << 14,
|
||||
};
|
||||
|
||||
enum {
|
||||
/* RESET_AFTER_USE, used by update code (depsgraph). */
|
||||
ID_RECALC = 1 << 0,
|
||||
ID_RECALC_DATA = 1 << 1,
|
||||
ID_RECALC_SKIP_ANIM_TAG = 1 << 2,
|
||||
ID_RECALC_ALL = (ID_RECALC | ID_RECALC_DATA),
|
||||
};
|
||||
|
||||
/* To filter ID types (filter_id) */
|
||||
|
|
|
@ -997,12 +997,12 @@ static void rna_def_ID(BlenderRNA *brna)
|
|||
"(initial state is undefined)");
|
||||
|
||||
prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_ID_RECALC);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "recalc", ID_RECALC);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Is Updated", "Data-block is tagged for recalculation");
|
||||
|
||||
prop = RNA_def_property(srna, "is_updated_data", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_ID_RECALC_DATA);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "recalc", ID_RECALC_DATA);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Is Updated Data", "Data-block data is tagged for recalculation");
|
||||
|
||||
|
|
|
@ -575,7 +575,7 @@ static void correctivesmooth_modifier_do(
|
|||
const bool force_delta_cache_update =
|
||||
/* XXX, take care! if mesh data its self changes we need to forcefully recalculate deltas */
|
||||
((csmd->rest_source == MOD_CORRECTIVESMOOTH_RESTSOURCE_ORCO) &&
|
||||
(((ID *)ob->data)->tag & LIB_TAG_ID_RECALC));
|
||||
(((ID *)ob->data)->recalc & ID_RECALC));
|
||||
|
||||
bool use_only_smooth = (csmd->flag & MOD_CORRECTIVESMOOTH_ONLY_SMOOTH) != 0;
|
||||
MDeformVert *dvert = NULL;
|
||||
|
|
Loading…
Reference in New Issue