[Bf-blender-cvs] [ca9cdba2df8] master: Fix: Add tooltip translation marker to disabled hints

Hans Goudey noreply at git.blender.org
Thu Dec 2 03:55:18 CET 2021


Commit: ca9cdba2df8231e88575c0d56df1f72efc819950
Author: Hans Goudey
Date:   Wed Dec 1 21:55:04 2021 -0500
Branches: master
https://developer.blender.org/rBca9cdba2df8231e88575c0d56df1f72efc819950

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

===================================================================

M	source/blender/editors/space_file/asset_catalog_tree_view.cc
M	source/blender/nodes/composite/node_composite_util.cc
M	source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
M	source/blender/nodes/composite/nodes/node_composite_image.cc
M	source/blender/nodes/function/node_function_util.cc
M	source/blender/nodes/geometry/node_geometry_util.cc
M	source/blender/nodes/intern/node_common.cc
M	source/blender/nodes/shader/node_shader_util.cc
M	source/blender/nodes/texture/node_texture_util.c

===================================================================

diff --git a/source/blender/editors/space_file/asset_catalog_tree_view.cc b/source/blender/editors/space_file/asset_catalog_tree_view.cc
index 1b1517b7289..2b1bcb3ae0d 100644
--- a/source/blender/editors/space_file/asset_catalog_tree_view.cc
+++ b/source/blender/editors/space_file/asset_catalog_tree_view.cc
@@ -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;
 }
 
diff --git a/source/blender/nodes/composite/node_composite_util.cc b/source/blender/nodes/composite/node_composite_util.cc
index 21269b92e65..9ea98d2a867 100644
--- a/source/blender/nodes/composite/node_composite_util.cc
+++ b/source/blender/nodes/composite/node_composite_util.cc
@@ -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;
diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
index 6657267b016..39fc86e837b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
@@ -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;
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc
index 40d4d4563c9..4b53010db30 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_image.cc
@@ -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;
diff --git a/source/blender/nodes/function/node_function_util.cc b/source/blender/nodes/function/node_function_util.cc
index a1493d51a11..ac48322c269 100644
--- a/source/blender/nodes/function/node_function_util.cc
+++ b/source/blender/nodes/function/node_function_util.cc
@@ -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;
diff --git a/source/blender/nodes/geometry/node_geometry_util.cc b/source/blender/nodes/geometry/node_geometry_util.cc
index 5c1d507041c..cd2f0097b86 100644
--- a/source/blender/nodes/geometry/node_geometry_util.cc
+++ b/source/blender/nodes/geometry/node_geometry_util.cc
@@ -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;
diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc
index a2ec313e151..7387047c413 100644
--- a/source/blender/nodes/intern/node_common.cc
+++ b/source/blender/nodes/intern/node_common.cc
@@ -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;
   }
 
diff --git a/source/blender/nodes/shader/node_shader_util.cc b/source/blender/nodes/shader/node_shader_util.cc
index 3b064bdf3ac..1d875e86b44 100644
--- a/source/blender/nodes/shader/node_shader_util.cc
+++ b/source/blender/nodes/shader/node_shader_util.cc
@@ -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;
diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c
index c968d0bae56..fe8e68bfc42 100644
--- a/source/blender/nodes/texture/node_texture_util.c
+++ b/source/blender/nodes/texture/node_texture_util.c
@@ -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;



More information about the Bf-blender-cvs mailing list