From 79312c1912b4fdb830e38a856cf88bfca8e4703d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 6 Dec 2018 17:52:37 +0100 Subject: Depsgraph: Remove duplicated sets of recalc/update flags There were at least three copies of those: - OB_RECALC* family of flags, which are rudiment of an old dependency graph system. - PSYS_RECALC* which were used by old dependency graph system as a separate set since the graph itself did not handle particle systems. - DEG_TAG_* which was used to tag IDs. Now there is a single set, which defines what can be tagged and queried for an update. It also has some aggregate flags to make queries simpler. Lets once and for all solve the madness of those flags, stick to a single set, which will not overlap with anything or require any extra conversion. Technically, shouldn't be measurable user difference, but some of the agregate flags for few dependency graph components did change. Fixes T58632: Particle don't update rotation settings --- source/blender/makesrna/intern/rna_ID.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'source/blender/makesrna/intern/rna_ID.c') diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index b550b4043e3..2221c63d6b7 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -157,7 +157,7 @@ void rna_ID_name_set(PointerRNA *ptr, const char *value) if (GS(id->name) == ID_OB) { Object *ob = (Object *)id; if (ob->type == OB_MBALL) { - DEG_id_tag_update(&ob->id, DEG_TAG_GEOMETRY); + DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); } } } @@ -404,7 +404,11 @@ static void rna_ID_update_tag(ID *id, ReportList *reports, int flag) /* ensure flag us correct for the type */ switch (GS(id->name)) { case ID_OB: - if (flag & ~(OB_RECALC_ALL)) { + /* TODO(sergey): This is kind of difficult to predict since different + * object types supports different flags. Maybe does not worth checking + * for this at all. Or maybe let dependency graph to return whether + * the tag was valid or not. */ + if (flag & ~(ID_RECALC_ALL)) { BKE_report(reports, RPT_ERROR, "'Refresh' incompatible with Object ID type"); return; } @@ -536,7 +540,7 @@ static Material *rna_IDMaterials_pop_id( return NULL; } - DEG_id_tag_update(id, OB_RECALC_DATA); + DEG_id_tag_update(id, ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_OBJECT | ND_DRAW, id); WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id); @@ -547,7 +551,7 @@ static void rna_IDMaterials_clear_id(ID *id, Main *bmain, bool remove_material_s { BKE_material_clear_id(bmain, id, remove_material_slot); - DEG_id_tag_update(id, OB_RECALC_DATA); + DEG_id_tag_update(id, ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_OBJECT | ND_DRAW, id); WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id); } @@ -1154,9 +1158,9 @@ static void rna_def_ID(BlenderRNA *brna) PropertyRNA *prop, *parm; static const EnumPropertyItem update_flag_items[] = { - {OB_RECALC_OB, "OBJECT", 0, "Object", ""}, - {OB_RECALC_DATA, "DATA", 0, "Data", ""}, - {OB_RECALC_TIME, "TIME", 0, "Time", ""}, + {ID_RECALC_TRANSFORM, "OBJECT", 0, "Object", ""}, + {ID_RECALC_GEOMETRY, "DATA", 0, "Data", ""}, + {ID_RECALC_ANIMATION, "TIME", 0, "Time", ""}, {0, NULL, 0, NULL, NULL} }; -- cgit v1.2.3