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