Cleanup: extract function to get node ui storage

This function will be used by multiple functions.
This commit is contained in:
Jacques Lucke 2021-02-19 12:03:21 +01:00
parent 359d0029fe
commit 55c1021be4
Notes: blender-bot 2023-02-13 19:51:07 +01:00
Referenced by issue #84849, Preview in sequencer is green with alpha<1 when not displaying alpha
1 changed files with 15 additions and 7 deletions

View File

@ -83,22 +83,30 @@ static void node_error_message_log(bNodeTree &ntree,
}
}
void BKE_nodetree_error_message_add(bNodeTree &ntree,
const NodeTreeEvaluationContext &context,
const bNode &node,
const NodeWarningType type,
std::string message)
static NodeUIStorage &find_node_ui_storage(bNodeTree &ntree,
const NodeTreeEvaluationContext &context,
const bNode &node)
{
ui_storage_ensure(ntree);
NodeTreeUIStorage &ui_storage = *ntree.ui_storage;
node_error_message_log(ntree, node, message, type);
Map<std::string, NodeUIStorage> &node_tree_ui_storage =
ui_storage.context_map.lookup_or_add_default(context);
NodeUIStorage &node_ui_storage = node_tree_ui_storage.lookup_or_add_default_as(
StringRef(node.name));
return node_ui_storage;
}
void BKE_nodetree_error_message_add(bNodeTree &ntree,
const NodeTreeEvaluationContext &context,
const bNode &node,
const NodeWarningType type,
std::string message)
{
node_error_message_log(ntree, node, message, type);
NodeUIStorage &node_ui_storage = find_node_ui_storage(ntree, context, node);
node_ui_storage.warnings.append({type, std::move(message)});
}