I18n: Use fmt::format() to replace string concatenation in nodes #107260
|
@ -36,6 +36,7 @@ set(INC
|
|||
../../../intern/mikktspace
|
||||
../../../intern/opensubdiv
|
||||
../../../extern/curve_fit_nd
|
||||
../../../extern/fmtlib/include
|
||||
|
||||
# dna_type_offsets.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../makesdna/intern
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#define FMT_HEADER_ONLY
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
MeshFieldContext::MeshFieldContext(const Mesh &mesh, const eAttrDomain domain)
|
||||
|
@ -264,9 +267,7 @@ GVArray AttributeFieldInput::get_varray_for_context(const GeometryFieldContext &
|
|||
|
||||
std::string AttributeFieldInput::socket_inspection_name() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << '"' << name_ << '"' << TIP_(" attribute from geometry");
|
||||
return ss.str();
|
||||
return fmt::format(TIP_("\"{}\" attribute from geometry"), name_);
|
||||
}
|
||||
|
||||
uint64_t AttributeFieldInput::hash() const
|
||||
|
@ -348,9 +349,7 @@ GVArray AnonymousAttributeFieldInput::get_varray_for_context(const GeometryField
|
|||
|
||||
std::string AnonymousAttributeFieldInput::socket_inspection_name() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << '"' << debug_name_ << '"' << TIP_(" from ") << producer_name_;
|
||||
return ss.str();
|
||||
return fmt::format(TIP_("\"{}\" from {}"), TIP_(debug_name_.c_str()), producer_name_);
|
||||
}
|
||||
|
||||
uint64_t AnonymousAttributeFieldInput::hash() const
|
||||
|
|
|
@ -65,7 +65,8 @@ const char *BLT_pgettext(const char *msgctxt, const char *msgid)
|
|||
bool BLT_translate(void)
|
||||
{
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
return BLI_thread_is_main();
|
||||
return true;
|
||||
/* return BLI_thread_is_main(); */
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@ set(INC
|
|||
../../render
|
||||
../../windowmanager
|
||||
../../../../intern/guardedalloc
|
||||
../../../../extern/fmtlib/include
|
||||
|
||||
# dna_type_offsets.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../../makesdna/intern
|
||||
|
|
|
@ -90,6 +90,9 @@
|
|||
|
||||
#include "node_intern.hh" /* own include */
|
||||
|
||||
#define FMT_HEADER_ONLY
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace geo_log = blender::nodes::geo_eval_log;
|
||||
using blender::bke::node_tree_zones::TreeZone;
|
||||
using blender::bke::node_tree_zones::TreeZones;
|
||||
|
@ -856,7 +859,7 @@ static void create_inspection_string_for_generic_value(const bNodeSocket &socket
|
|||
return;
|
||||
}
|
||||
if (value_type.is<std::string>()) {
|
||||
ss << *static_cast<const std::string *>(buffer) << " " << TIP_("(String)");
|
||||
ss << fmt::format(TIP_("{} (String)"), *static_cast<const std::string *>(buffer));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -873,22 +876,22 @@ static void create_inspection_string_for_generic_value(const bNodeSocket &socket
|
|||
BLI_SCOPED_DEFER([&]() { socket_type.destruct(socket_value); });
|
||||
|
||||
if (socket_type.is<int>()) {
|
||||
ss << *static_cast<int *>(socket_value) << " " << TIP_("(Integer)");
|
||||
ss << fmt::format(TIP_("{} (Integer)"), *static_cast<int *>(socket_value));
|
||||
}
|
||||
else if (socket_type.is<float>()) {
|
||||
ss << *static_cast<float *>(socket_value) << " " << TIP_("(Float)");
|
||||
ss << fmt::format(TIP_("{} (Float)"), *static_cast<float *>(socket_value));
|
||||
}
|
||||
else if (socket_type.is<blender::float3>()) {
|
||||
ss << *static_cast<blender::float3 *>(socket_value) << " " << TIP_("(Vector)");
|
||||
const blender::float3 &vector = *static_cast<blender::float3 *>(socket_value);
|
||||
ss << fmt::format(TIP_("({}, {}, {}) (Vector)"), vector.x, vector.y, vector.z);
|
||||
}
|
||||
else if (socket_type.is<blender::ColorGeometry4f>()) {
|
||||
const blender::ColorGeometry4f &color = *static_cast<blender::ColorGeometry4f *>(socket_value);
|
||||
ss << "(" << color.r << ", " << color.g << ", " << color.b << ", " << color.a << ") "
|
||||
<< TIP_("(Color)");
|
||||
ss << fmt::format(TIP_("({}, {}, {}, {}) (Color)"), color.r, color.g, color.b, color.a);
|
||||
}
|
||||
else if (socket_type.is<bool>()) {
|
||||
ss << ((*static_cast<bool *>(socket_value)) ? TIP_("True") : TIP_("False")) << " "
|
||||
<< TIP_("(Boolean)");
|
||||
ss << fmt::format(TIP_("{} (Boolean)"),
|
||||
((*static_cast<bool *>(socket_value)) ? TIP_("True") : TIP_("False")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ set(INC
|
|||
../makesrna
|
||||
../render
|
||||
../windowmanager
|
||||
../../../extern/fmtlib/include
|
||||
../../../intern/guardedalloc
|
||||
|
||||
# dna_type_offsets.h
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#define FMT_HEADER_ONLY
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
using fn::ValueOrField;
|
||||
|
@ -315,10 +318,10 @@ class LazyFunctionForGeometryNode : public LazyFunction {
|
|||
{
|
||||
const ValueOrFieldCPPType &value_or_field_cpp_type = *ValueOrFieldCPPType::get_from_self(
|
||||
*outputs_[lf_index].type);
|
||||
GField output_field{
|
||||
std::make_shared<AnonymousAttributeFieldInput>(std::move(attribute_id),
|
||||
value_or_field_cpp_type.value,
|
||||
node_.label_or_name() + TIP_(" node"))};
|
||||
GField output_field{std::make_shared<AnonymousAttributeFieldInput>(
|
||||
std::move(attribute_id),
|
||||
value_or_field_cpp_type.value,
|
||||
fmt::format(TIP_("{} node"), node_.label_or_name()))};
|
||||
void *r_value = params.get_output_data_ptr(lf_index);
|
||||
value_or_field_cpp_type.construct_from_field(r_value, std::move(output_field));
|
||||
params.output_set(lf_index);
|
||||
|
@ -994,9 +997,7 @@ class LazyFunctionForGroupNode : public LazyFunction {
|
|||
|
||||
std::string name() const override
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Group '" << (group_node_.id->name + 2) << "' (" << group_node_.name << ")";
|
||||
return ss.str();
|
||||
return fmt::format(TIP_("Group '{}' ({})"), group_node_.id->name + 2, group_node_.name);
|
||||
}
|
||||
|
||||
std::string input_name(const int i) const override
|
||||
|
@ -1033,9 +1034,8 @@ class LazyFunctionForGroupNode : public LazyFunction {
|
|||
for (const auto [bsocket_index, lf_socket_index] : lf_output_for_input_bsocket_usage_.items())
|
||||
{
|
||||
if (i == lf_socket_index) {
|
||||
std::stringstream ss;
|
||||
ss << "'" << group_node_.input_socket(bsocket_index).name << "' input is used";
|
||||
return ss.str();
|
||||
return fmt::format(TIP_("'{}' input is used"),
|
||||
group_node_.input_socket(bsocket_index).name);
|
||||
}
|
||||
}
|
||||
return outputs_[i].debug_name;
|
||||
|
|
Loading…
Reference in New Issue