Use special TTR macro for non-editor code
Because TTR is not available in non-editor buildsmaster
parent
f90960d596
commit
9c81ccc5ba
|
@ -829,7 +829,7 @@ VoxelGraphRuntime::CompilationResult VoxelGeneratorGraph::compile() {
|
|||
if (r->sdf_output_buffer_index != -1) {
|
||||
VoxelGraphRuntime::CompilationResult error;
|
||||
error.success = false;
|
||||
error.message = TTR("Multiple SDF outputs are not supported");
|
||||
error.message = ZN_TTR("Multiple SDF outputs are not supported");
|
||||
error.node_id = output.node_id;
|
||||
return error;
|
||||
} else {
|
||||
|
@ -842,7 +842,7 @@ VoxelGraphRuntime::CompilationResult VoxelGeneratorGraph::compile() {
|
|||
if (r->weight_outputs_count >= r->weight_outputs.size()) {
|
||||
VoxelGraphRuntime::CompilationResult error;
|
||||
error.success = false;
|
||||
error.message = String(TTR("Cannot use more than {0} weight outputs"))
|
||||
error.message = String(ZN_TTR("Cannot use more than {0} weight outputs"))
|
||||
.format(varray(r->weight_outputs.size()));
|
||||
error.node_id = output.node_id;
|
||||
return error;
|
||||
|
@ -853,7 +853,7 @@ VoxelGraphRuntime::CompilationResult VoxelGeneratorGraph::compile() {
|
|||
// Should not be allowed by the UI, but who knows
|
||||
VoxelGraphRuntime::CompilationResult error;
|
||||
error.success = false;
|
||||
error.message = String(TTR("Cannot use negative layer index in weight output"));
|
||||
error.message = String(ZN_TTR("Cannot use negative layer index in weight output"));
|
||||
error.node_id = output.node_id;
|
||||
return error;
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ VoxelGraphRuntime::CompilationResult VoxelGeneratorGraph::compile() {
|
|||
VoxelGraphRuntime::CompilationResult error;
|
||||
error.success = false;
|
||||
error.message =
|
||||
String(TTR("Weight layers cannot exceed {}")).format(varray(r->weight_outputs.size()));
|
||||
String(ZN_TTR("Weight layers cannot exceed {0}")).format(varray(r->weight_outputs.size()));
|
||||
error.node_id = output.node_id;
|
||||
return error;
|
||||
}
|
||||
|
@ -871,7 +871,7 @@ VoxelGraphRuntime::CompilationResult VoxelGeneratorGraph::compile() {
|
|||
VoxelGraphRuntime::CompilationResult error;
|
||||
error.success = false;
|
||||
error.message =
|
||||
String(TTR("Only one weight output node can use layer index {0}, found duplicate"))
|
||||
String(ZN_TTR("Only one weight output node can use layer index {0}, found duplicate"))
|
||||
.format(varray(layer_index));
|
||||
error.node_id = output.node_id;
|
||||
return error;
|
||||
|
@ -888,7 +888,7 @@ VoxelGraphRuntime::CompilationResult VoxelGeneratorGraph::compile() {
|
|||
if (r->type_output_buffer_index != -1) {
|
||||
VoxelGraphRuntime::CompilationResult error;
|
||||
error.success = false;
|
||||
error.message = TTR("Multiple TYPE outputs are not supported");
|
||||
error.message = ZN_TTR("Multiple TYPE outputs are not supported");
|
||||
error.node_id = output.node_id;
|
||||
return error;
|
||||
} else {
|
||||
|
@ -901,14 +901,15 @@ VoxelGraphRuntime::CompilationResult VoxelGeneratorGraph::compile() {
|
|||
if (r->single_texture_output_buffer_index != -1) {
|
||||
VoxelGraphRuntime::CompilationResult error;
|
||||
error.success = false;
|
||||
error.message = TTR("Multiple TYPE outputs are not supported");
|
||||
error.message = ZN_TTR("Multiple TYPE outputs are not supported");
|
||||
error.node_id = output.node_id;
|
||||
return error;
|
||||
}
|
||||
if (has_output_type(runtime, _graph, VoxelGeneratorGraph::NODE_OUTPUT_WEIGHT)) {
|
||||
VoxelGraphRuntime::CompilationResult error;
|
||||
error.success = false;
|
||||
error.message = TTR("Using both OutputWeight nodes and an OutputSingleTexture node is not allowed");
|
||||
error.message =
|
||||
ZN_TTR("Using both OutputWeight nodes and an OutputSingleTexture node is not allowed");
|
||||
error.node_id = output.node_id;
|
||||
return error;
|
||||
}
|
||||
|
@ -924,7 +925,7 @@ VoxelGraphRuntime::CompilationResult VoxelGeneratorGraph::compile() {
|
|||
if (r->sdf_output_buffer_index == -1 && r->type_output_buffer_index == -1) {
|
||||
VoxelGraphRuntime::CompilationResult error;
|
||||
error.success = false;
|
||||
error.message = String(TTR("An SDF or TYPE output is required for the graph to be valid."));
|
||||
error.message = String(ZN_TTR("An SDF or TYPE output is required for the graph to be valid."));
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "voxel_graph_node_db.h"
|
||||
#include "../../constants/voxel_constants.h"
|
||||
#include "../../util/macros.h"
|
||||
#include "../../util/math/sdf.h"
|
||||
#include "../../util/noise/fast_noise_lite/fast_noise_lite.h"
|
||||
#include "../../util/noise/fast_noise_lite/fast_noise_lite_range.h"
|
||||
|
@ -834,7 +835,7 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
|
|||
t.compile_func = [](CompileContext &ctx) {
|
||||
Ref<Curve> curve = ctx.get_param(0);
|
||||
if (curve.is_null()) {
|
||||
ctx.make_error("Curve instance is null");
|
||||
ctx.make_error(String(ZN_TTR("{0} instance is null").format(varray(Curve::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
// Make sure it is baked. We don't want multithreading to bail out because of a write operation
|
||||
|
@ -887,7 +888,7 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
|
|||
t.compile_func = [](CompileContext &ctx) {
|
||||
Ref<Noise> noise = ctx.get_param(0);
|
||||
if (noise.is_null()) {
|
||||
ctx.make_error("Noise instance is null");
|
||||
ctx.make_error(String(ZN_TTR("{0} instance is null").format(varray(Noise::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
Params p;
|
||||
|
@ -933,7 +934,7 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
|
|||
t.compile_func = [](CompileContext &ctx) {
|
||||
Ref<Noise> noise = ctx.get_param(0);
|
||||
if (noise.is_null()) {
|
||||
ctx.make_error("OpenSimplexNoise instance is null");
|
||||
ctx.make_error(String(ZN_TTR("{0} instance is null").format(varray(Noise::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
Params p;
|
||||
|
@ -977,11 +978,12 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
|
|||
t.compile_func = [](CompileContext &ctx) {
|
||||
Ref<Image> image = ctx.get_param(0);
|
||||
if (image.is_null()) {
|
||||
ctx.make_error("Image instance is null");
|
||||
ctx.make_error(String(ZN_TTR("{0} instance is null").format(varray(Image::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
if (image->is_compressed()) {
|
||||
ctx.make_error("Image has a compressed format, this is not supported");
|
||||
ctx.make_error(String(ZN_TTR("{0} has a compressed format, this is not supported")
|
||||
.format(varray(Image::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
ImageRangeGrid *im_range = memnew(ImageRangeGrid);
|
||||
|
@ -1396,11 +1398,12 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
|
|||
t.compile_func = [](CompileContext &ctx) {
|
||||
Ref<Image> image = ctx.get_param(0);
|
||||
if (image.is_null()) {
|
||||
ctx.make_error("Image instance is null");
|
||||
ctx.make_error(String(ZN_TTR("{0} instance is null").format(varray(Image::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
if (image->is_compressed()) {
|
||||
ctx.make_error("Image has a compressed format, this is not supported");
|
||||
ctx.make_error(String(ZN_TTR("{0} has a compressed format, this is not supported")
|
||||
.format(varray(Image::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
ImageRangeGrid *im_range = memnew(ImageRangeGrid);
|
||||
|
@ -1508,7 +1511,8 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
|
|||
t.compile_func = [](CompileContext &ctx) {
|
||||
Ref<ZN_FastNoiseLite> noise = ctx.get_param(0);
|
||||
if (noise.is_null()) {
|
||||
ctx.make_error(ZN_FastNoiseLite::get_class_static() + " instance is null");
|
||||
ctx.make_error(
|
||||
String(ZN_TTR("{0} instance is null").format(varray(ZN_FastNoiseLite::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
Params p;
|
||||
|
@ -1552,7 +1556,8 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
|
|||
t.compile_func = [](CompileContext &ctx) {
|
||||
Ref<ZN_FastNoiseLite> noise = ctx.get_param(0);
|
||||
if (noise.is_null()) {
|
||||
ctx.make_error("FastNoiseLite instance is null");
|
||||
ctx.make_error(
|
||||
String(ZN_TTR("{0} instance is null").format(varray(ZN_FastNoiseLite::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
Params p;
|
||||
|
@ -1598,7 +1603,8 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
|
|||
t.compile_func = [](CompileContext &ctx) {
|
||||
Ref<ZN_FastNoiseLiteGradient> noise = ctx.get_param(0);
|
||||
if (noise.is_null()) {
|
||||
ctx.make_error("FastNoiseLiteGradient instance is null");
|
||||
ctx.make_error(String(
|
||||
ZN_TTR("{0} instance is null").format(varray(ZN_FastNoiseLiteGradient::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
Params p;
|
||||
|
@ -1651,7 +1657,8 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
|
|||
t.compile_func = [](CompileContext &ctx) {
|
||||
Ref<ZN_FastNoiseLiteGradient> noise = ctx.get_param(0);
|
||||
if (noise.is_null()) {
|
||||
ctx.make_error("FastNoiseLiteGradient instance is null");
|
||||
ctx.make_error(String(
|
||||
ZN_TTR("{0} instance is null").format(varray(ZN_FastNoiseLiteGradient::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
Params p;
|
||||
|
@ -1708,12 +1715,12 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
|
|||
t.compile_func = [](CompileContext &ctx) {
|
||||
Ref<FastNoise2> noise = ctx.get_param(0);
|
||||
if (noise.is_null()) {
|
||||
ctx.make_error("FastNoise2 instance is null");
|
||||
ctx.make_error(String(ZN_TTR("{0} instance is null").format(varray(FastNoise2::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
noise->update_generator();
|
||||
if (!noise->is_valid()) {
|
||||
ctx.make_error("FastNoise2 setup is invalid");
|
||||
ctx.make_error(String(ZN_TTR("{0} setup is invalid").format(varray(FastNoise2::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
Params p;
|
||||
|
@ -1756,12 +1763,12 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
|
|||
t.compile_func = [](CompileContext &ctx) {
|
||||
Ref<FastNoise2> noise = ctx.get_param(0);
|
||||
if (noise.is_null()) {
|
||||
ctx.make_error("FastNoise2 instance is null");
|
||||
ctx.make_error(String(ZN_TTR("{0} instance is null").format(varray(FastNoise2::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
noise->update_generator();
|
||||
if (!noise->is_valid()) {
|
||||
ctx.make_error("FastNoise2 setup is invalid");
|
||||
ctx.make_error(String(ZN_TTR("{0} setup is invalid").format(varray(FastNoise2::get_class_static()))));
|
||||
return;
|
||||
}
|
||||
Params p;
|
||||
|
|
|
@ -309,7 +309,7 @@ VoxelGraphRuntime::CompilationResult VoxelGraphRuntime::_compile(const ProgramGr
|
|||
// so we have to limit to this instead of Reference or Object
|
||||
CompilationResult result;
|
||||
result.success = false;
|
||||
result.message = "A parameter is an object but does not inherit Resource";
|
||||
result.message = ZN_TTR("A parameter is an object but does not inherit Resource");
|
||||
result.node_id = node_id;
|
||||
return result;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ VoxelGraphRuntime::CompilationResult VoxelGraphRuntime::_compile(const ProgramGr
|
|||
if (_program.outputs_count == _program.outputs.size()) {
|
||||
CompilationResult result;
|
||||
result.success = false;
|
||||
result.message = "Maximum number of outputs has been reached";
|
||||
result.message = ZN_TTR("Maximum number of outputs has been reached");
|
||||
result.node_id = node_id;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -16,4 +16,12 @@
|
|||
|
||||
#define VOXEL_ARRAY_LENGTH(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
// Godot does not define the TTR macro for translation of messages in release builds. However, there are some non-editor
|
||||
// code that can produce errors in this module, and we still want them to compile properly.
|
||||
#ifdef TOOLS_ENABLED
|
||||
#define ZN_TTR(msg) TTR(msg)
|
||||
#else
|
||||
#define ZN_TTR(msg) msg
|
||||
#endif
|
||||
|
||||
#endif // VOXEL_MACROS_H
|
||||
|
|
Loading…
Reference in New Issue