Fix: Add tooltip translation marker to disabled hints

This was overlooked, as it seems there's no way for these strings to be
translated currently. Generally it's not that clear whether `N_` or
`TIP_` should be used in this case, but `TIP_` seems more consistent.
To avoid the cost of the translation lookup when the UI text isn't
necessary, we could allow the disabled hint argument to be optional.

Differential Revision: https://developer.blender.org/D13141
This commit is contained in:
Hans Goudey 2021-12-01 21:55:04 -05:00
parent b869da0c10
commit ca9cdba2df
9 changed files with 13 additions and 12 deletions

View File

@ -516,7 +516,7 @@ bool AssetCatalogDropController::has_droppable_asset(const wmDrag &drag,
}
}
*r_disabled_hint = "Only assets from this current file can be moved between catalogs";
*r_disabled_hint = TIP_("Only assets from this current file can be moved between catalogs");
return false;
}

View File

@ -28,7 +28,7 @@ bool cmp_node_poll_default(bNodeType *UNUSED(ntype),
const char **r_disabled_hint)
{
if (!STREQ(ntree->idname, "CompositorNodeTree")) {
*r_disabled_hint = "Not a compositor node tree";
*r_disabled_hint = TIP_("Not a compositor node tree");
return false;
}
return true;

View File

@ -298,11 +298,11 @@ static bool node_poll_cryptomatte(bNodeType *UNUSED(ntype),
if (scene == nullptr) {
*r_disabled_hint =
"The node tree must be the compositing node tree of any scene in the file";
TIP_("The node tree must be the compositing node tree of any scene in the file");
}
return scene != nullptr;
}
*r_disabled_hint = "Not a compositor node tree";
*r_disabled_hint = TIP_("Not a compositor node tree");
return false;
}

View File

@ -499,7 +499,7 @@ static bool node_composit_poll_rlayers(bNodeType *UNUSED(ntype),
const char **r_disabled_hint)
{
if (!STREQ(ntree->idname, "CompositorNodeTree")) {
*r_disabled_hint = "Not a compositor node tree";
*r_disabled_hint = TIP_("Not a compositor node tree");
return false;
}
@ -516,7 +516,8 @@ static bool node_composit_poll_rlayers(bNodeType *UNUSED(ntype),
}
if (scene == nullptr) {
*r_disabled_hint = "The node tree must be the compositing node tree of any scene in the file";
*r_disabled_hint = TIP_(
"The node tree must be the compositing node tree of any scene in the file");
return false;
}
return true;

View File

@ -23,7 +23,7 @@ static bool fn_node_poll_default(bNodeType *UNUSED(ntype),
{
/* Function nodes are only supported in simulation node trees so far. */
if (!STREQ(ntree->idname, "GeometryNodeTree")) {
*r_disabled_hint = "Not a geometry node tree";
*r_disabled_hint = TIP_("Not a geometry node tree");
return false;
}
return true;

View File

@ -63,7 +63,7 @@ bool geo_node_poll_default(bNodeType *UNUSED(ntype),
const char **r_disabled_hint)
{
if (!STREQ(ntree->idname, "GeometryNodeTree")) {
*r_disabled_hint = "Not a geometry node tree";
*r_disabled_hint = TIP_("Not a geometry node tree");
return false;
}
return true;

View File

@ -107,7 +107,7 @@ bool nodeGroupPoll(bNodeTree *nodetree, bNodeTree *grouptree, const char **r_dis
}
if (nodetree == grouptree) {
*r_disabled_hint = "Nesting a node group inside of itself is not allowed";
*r_disabled_hint = TIP_("Nesting a node group inside of itself is not allowed");
return false;
}

View File

@ -30,7 +30,7 @@
bool sh_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree, const char **r_disabled_hint)
{
if (!STREQ(ntree->idname, "ShaderNodeTree")) {
*r_disabled_hint = "Not a shader node tree";
*r_disabled_hint = TIP_("Not a shader node tree");
return false;
}
return true;
@ -41,7 +41,7 @@ static bool sh_fn_poll_default(bNodeType *UNUSED(ntype),
const char **r_disabled_hint)
{
if (!STR_ELEM(ntree->idname, "ShaderNodeTree", "GeometryNodeTree")) {
*r_disabled_hint = "Not a shader or geometry node tree";
*r_disabled_hint = TIP_("Not a shader or geometry node tree");
return false;
}
return true;

View File

@ -44,7 +44,7 @@ bool tex_node_poll_default(bNodeType *UNUSED(ntype),
const char **r_disabled_hint)
{
if (!STREQ(ntree->idname, "TextureNodeTree")) {
*r_disabled_hint = "Not a texture node tree";
*r_disabled_hint = TIP_("Not a texture node tree");
return false;
}
return true;