forked from bartvdbraak/blender
Depsgraph: Make update flags debug print more useful
Will print list of human-readable update flags, not the combined bitfield printed as a number.
This commit is contained in:
parent
4df12b6ca6
commit
d68f7c8e11
@ -156,6 +156,9 @@ typedef enum eDepsgraph_Tag {
|
|||||||
/* Only inform editors about the change. Don't modify datablock itself. */
|
/* Only inform editors about the change. Don't modify datablock itself. */
|
||||||
DEG_TAG_EDITORS_UPDATE = (1 << 12),
|
DEG_TAG_EDITORS_UPDATE = (1 << 12),
|
||||||
} eDepsgraph_Tag;
|
} eDepsgraph_Tag;
|
||||||
|
|
||||||
|
const char *DEG_update_tag_as_string(eDepsgraph_Tag flag);
|
||||||
|
|
||||||
void DEG_id_tag_update(struct ID *id, int flag);
|
void DEG_id_tag_update(struct ID *id, int flag);
|
||||||
void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag);
|
void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag);
|
||||||
|
|
||||||
|
@ -473,10 +473,64 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string stringify_append_bit(const string& str, eDepsgraph_Tag tag)
|
||||||
|
{
|
||||||
|
string result = str;
|
||||||
|
if (!result.empty()) {
|
||||||
|
result += ", ";
|
||||||
|
}
|
||||||
|
result += DEG_update_tag_as_string(tag);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
string stringify_update_bitfield(int flag)
|
||||||
|
{
|
||||||
|
if (flag == 0) {
|
||||||
|
return "LEGACY_0";
|
||||||
|
}
|
||||||
|
string result = "";
|
||||||
|
int current_flag = flag;
|
||||||
|
/* Special cases to avoid ALL flags form being split into
|
||||||
|
* individual bits.
|
||||||
|
*/
|
||||||
|
if ((current_flag & DEG_TAG_PSYS_ALL) == DEG_TAG_PSYS_ALL) {
|
||||||
|
result = stringify_append_bit(result, DEG_TAG_PSYS_ALL);
|
||||||
|
}
|
||||||
|
/* Handle all the rest of the flags. */
|
||||||
|
while (current_flag != 0) {
|
||||||
|
eDepsgraph_Tag tag =
|
||||||
|
(eDepsgraph_Tag)(1 << bitscan_forward_clear_i(¤t_flag));
|
||||||
|
result = stringify_append_bit(result, tag);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace */
|
} /* namespace */
|
||||||
|
|
||||||
} // namespace DEG
|
} // namespace DEG
|
||||||
|
|
||||||
|
const char *DEG_update_tag_as_string(eDepsgraph_Tag flag)
|
||||||
|
{
|
||||||
|
switch (flag) {
|
||||||
|
case DEG_TAG_TRANSFORM: return "TRANSFORM";
|
||||||
|
case DEG_TAG_GEOMETRY: return "GEOMETRY";
|
||||||
|
case DEG_TAG_TIME: return "TIME";
|
||||||
|
case DEG_TAG_PSYS_REDO: return "PSYS_REDO";
|
||||||
|
case DEG_TAG_PSYS_RESET: return "PSYS_RESET";
|
||||||
|
case DEG_TAG_PSYS_TYPE: return "PSYS_TYPE";
|
||||||
|
case DEG_TAG_PSYS_CHILD: return "PSYS_CHILD";
|
||||||
|
case DEG_TAG_PSYS_PHYS: return "PSYS_PHYS";
|
||||||
|
case DEG_TAG_PSYS_ALL: return "PSYS_ALL";
|
||||||
|
case DEG_TAG_COPY_ON_WRITE: return "COPY_ON_WRITE";
|
||||||
|
case DEG_TAG_SHADING_UPDATE: return "SHADING_UPDATE";
|
||||||
|
case DEG_TAG_SELECT_UPDATE: return "SELECT_UPDATE";
|
||||||
|
case DEG_TAG_BASE_FLAGS_UPDATE: return "BASE_FLAGS_UPDATE";
|
||||||
|
case DEG_TAG_EDITORS_UPDATE: return "EDITORS_UPDATE";
|
||||||
|
}
|
||||||
|
BLI_assert(!"Unhandled update flag, should never happen!");
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
|
||||||
/* Data-Based Tagging */
|
/* Data-Based Tagging */
|
||||||
|
|
||||||
/* Tag given ID for an update in all the dependency graphs. */
|
/* Tag given ID for an update in all the dependency graphs. */
|
||||||
@ -492,7 +546,10 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, int flag)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (G.debug & G_DEBUG_DEPSGRAPH_TAG) {
|
if (G.debug & G_DEBUG_DEPSGRAPH_TAG) {
|
||||||
printf("%s: id=%s flag=%d\n", __func__, id->name, flag);
|
printf("%s: id=%s flags=%s\n",
|
||||||
|
__func__,
|
||||||
|
id->name,
|
||||||
|
DEG::stringify_update_bitfield(flag).c_str());
|
||||||
}
|
}
|
||||||
DEG::deg_id_tag_update(bmain, id, flag);
|
DEG::deg_id_tag_update(bmain, id, flag);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user