aboutsummaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/particles.cpp2
-rw-r--r--scene/gui/label.cpp7
-rw-r--r--scene/main/scene_tree.cpp4
-rw-r--r--scene/resources/audio_stream_sample.cpp5
-rw-r--r--scene/resources/audio_stream_sample.h1
-rw-r--r--scene/resources/curve.cpp2
-rw-r--r--scene/resources/material.cpp6
-rw-r--r--scene/resources/material.h6
-rw-r--r--scene/resources/scene_format_text.cpp10
-rw-r--r--scene/resources/scene_format_text.h3
-rw-r--r--scene/resources/texture.cpp19
-rw-r--r--scene/scene_string_names.cpp2
-rw-r--r--scene/scene_string_names.h2
13 files changed, 45 insertions, 24 deletions
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index edf97bc24..c8f45a8d7 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -627,7 +627,7 @@ void ParticlesMaterial::_update_shader() {
if (flags[FLAG_DISABLE_Z]) {
- code += " float angle1 = rand_from_seed(alt_seed)*spread*3.1416;\n";
+ code += " float angle1 = (rand_from_seed(alt_seed)*2.0-1.0)*spread/180.0*3.1416;\n";
code += " vec3 rot=vec3( cos(angle1), sin(angle1),0.0 );\n";
code += " VELOCITY=(rot*initial_linear_velocity+rot*initial_linear_velocity_random*rand_from_seed(alt_seed));\n";
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index f3a279bad..fb85930ce 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -65,7 +65,12 @@ void Label::_notification(int p_what) {
if (p_what == NOTIFICATION_TRANSLATION_CHANGED) {
- xl_text = XL_MESSAGE(text);
+ String new_text = XL_MESSAGE(text);
+ if (new_text == xl_text)
+ return; //nothing new
+ xl_text = new_text;
+
+ regenerate_word_cache();
minimum_size_changed();
update();
}
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 39d546936..479abccda 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -687,7 +687,9 @@ void SceneTree::_notification(int p_notification) {
get_root()->propagate_notification(p_notification);
} break;
case NOTIFICATION_TRANSLATION_CHANGED: {
- get_root()->propagate_notification(Node::NOTIFICATION_TRANSLATION_CHANGED);
+ if (!is_editor_hint()) {
+ get_root()->propagate_notification(Node::NOTIFICATION_TRANSLATION_CHANGED);
+ }
} break;
case NOTIFICATION_WM_UNFOCUS_REQUEST: {
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index 4f2ab1863..f12e23107 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -39,8 +39,6 @@ void AudioStreamPlaybackSample::start(float p_from_pos) {
ima_adpcm[i].last_nibble = -1;
ima_adpcm[i].loop_pos = 0x7FFFFFFF;
ima_adpcm[i].window_ofs = 0;
- ima_adpcm[i].ptr = (const uint8_t *)base->data;
- ima_adpcm[i].ptr += AudioStreamSample::DATA_PAD;
}
seek_pos(p_from_pos);
@@ -122,7 +120,8 @@ void AudioStreamPlaybackSample::do_resample(const Depth *p_src, AudioFrame *p_ds
int16_t nibble, diff, step;
ima_adpcm[i].last_nibble++;
- const uint8_t *src_ptr = ima_adpcm[i].ptr;
+ const uint8_t *src_ptr = (const uint8_t *)base->data;
+ src_ptr += AudioStreamSample::DATA_PAD;
uint8_t nbb = src_ptr[(ima_adpcm[i].last_nibble >> 1) * (is_stereo ? 2 : 1) + i];
nibble = (ima_adpcm[i].last_nibble & 1) ? (nbb >> 4) : (nbb & 0xF);
diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h
index cd02df512..680f037f1 100644
--- a/scene/resources/audio_stream_sample.h
+++ b/scene/resources/audio_stream_sample.h
@@ -53,7 +53,6 @@ class AudioStreamPlaybackSample : public AudioStreamPlayback {
int32_t last_nibble;
int32_t loop_pos;
int32_t window_ofs;
- const uint8_t *ptr;
} ima_adpcm[2];
int64_t offset;
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index bc6d0230a..338311b87 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -730,7 +730,7 @@ void Curve::set_data(Array input) {
// Validate input
for (int i = 0; i < input.size(); i += ELEMS) {
ERR_FAIL_COND(input[i].get_type() != Variant::VECTOR2);
- ERR_FAIL_COND(input[i + 1].get_type() != Variant::REAL);
+ ERR_FAIL_COND(!input[i + 1].is_num());
ERR_FAIL_COND(input[i + 2].get_type() != Variant::REAL);
ERR_FAIL_COND(input[i + 3].get_type() != Variant::INT);
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 0912c7014..393446785 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -49,7 +49,7 @@ Material::~Material() {
bool ShaderMaterial::_set(const StringName &p_name, const Variant &p_value) {
- if (p_name == SceneStringNames::get_singleton()->shader_shader) {
+ if (p_name == SceneStringNames::get_singleton()->shader) {
set_shader(p_value);
return true;
} else {
@@ -75,7 +75,7 @@ bool ShaderMaterial::_set(const StringName &p_name, const Variant &p_value) {
bool ShaderMaterial::_get(const StringName &p_name, Variant &r_ret) const {
- if (p_name == SceneStringNames::get_singleton()->shader_shader) {
+ if (p_name == SceneStringNames::get_singleton()->shader) {
r_ret = get_shader();
return true;
@@ -97,7 +97,7 @@ bool ShaderMaterial::_get(const StringName &p_name, Variant &r_ret) const {
void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const {
- p_list->push_back(PropertyInfo(Variant::OBJECT, "shader/shader", PROPERTY_HINT_RESOURCE_TYPE, "Shader,ShaderGraph"));
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "shader", PROPERTY_HINT_RESOURCE_TYPE, "Shader,ShaderGraph"));
if (!shader.is_null()) {
diff --git a/scene/resources/material.h b/scene/resources/material.h
index c04323648..fb6c5b81d 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -42,9 +42,9 @@
class Material : public Resource {
- GDCLASS(Material, Resource);
- RES_BASE_EXTENSION("material");
- OBJ_SAVE_TYPE(Material);
+ GDCLASS(Material, Resource)
+ RES_BASE_EXTENSION("material")
+ OBJ_SAVE_TYPE(Material)
RID material;
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index f62fa93e0..8ad297000 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -332,6 +332,7 @@ Error ResourceInteractiveLoaderText::poll() {
if (!ResourceCache::has(res_path)) {
resource->set_path(res_path);
}
+ resource->set_as_translation_remapped(translation_remapped);
}
return error;
}
@@ -606,6 +607,15 @@ int ResourceInteractiveLoaderText::get_stage_count() const {
return resources_total; //+ext_resources;
}
+void ResourceInteractiveLoaderText::set_translation_remapped(bool p_remapped) {
+
+ translation_remapped = p_remapped;
+}
+
+ResourceInteractiveLoaderText::ResourceInteractiveLoaderText() {
+ translation_remapped = false;
+}
+
ResourceInteractiveLoaderText::~ResourceInteractiveLoaderText() {
memdelete(f);
diff --git a/scene/resources/scene_format_text.h b/scene/resources/scene_format_text.h
index a7e78d62f..1ea6465c2 100644
--- a/scene/resources/scene_format_text.h
+++ b/scene/resources/scene_format_text.h
@@ -38,6 +38,7 @@
class ResourceInteractiveLoaderText : public ResourceInteractiveLoader {
+ bool translation_remapped;
String local_path;
String res_path;
String error_text;
@@ -94,12 +95,14 @@ public:
virtual Error poll();
virtual int get_stage() const;
virtual int get_stage_count() const;
+ virtual void set_translation_remapped(bool p_remapped);
void open(FileAccess *p_f, bool p_skip_first_tag = false);
String recognize(FileAccess *p_f);
void get_dependencies(FileAccess *p_f, List<String> *p_dependencies, bool p_add_types);
Error rename_dependencies(FileAccess *p_f, const String &p_path, const Map<String, String> &p_map);
+ ResourceInteractiveLoaderText();
~ResourceInteractiveLoaderText();
};
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 6c7ae2445..171826cb2 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -91,7 +91,7 @@ Texture::Texture() {
void ImageTexture::reload_from_file() {
- String path = get_path();
+ String path = ResourceLoader::path_remap(get_path());
if (!path.is_resource_file())
return;
@@ -710,13 +710,16 @@ void StreamTexture::set_flags(uint32_t p_flags) {
void StreamTexture::reload_from_file() {
-#ifdef TOOLS_ENABLED
- String ipath = get_import_path();
- if (ipath.is_resource_file() && ipath != path_to_file) {
- path_to_file = ipath;
- }
-#endif
- load(path_to_file);
+ String path = get_path();
+ if (!path.is_resource_file())
+ return;
+
+ path = ResourceLoader::path_remap(path); //remap for translation
+ path = ResourceLoader::import_remap(path); //remap for import
+ if (!path.is_resource_file())
+ return;
+
+ load(path);
}
void StreamTexture::_bind_methods() {
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index c6277dbbb..ec71333de 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -44,7 +44,7 @@ SceneStringNames::SceneStringNames() {
hide = StaticCString::create("hide");
visibility_changed = StaticCString::create("visibility_changed");
input_event = StaticCString::create("input_event");
- shader_shader = StaticCString::create("shader/shader");
+ shader = StaticCString::create("shader");
shader_unshaded = StaticCString::create("shader/unshaded");
shading_mode = StaticCString::create("shader/shading_mode");
tree_entered = StaticCString::create("tree_entered");
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 3e4c80d4f..0802a7397 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -64,7 +64,7 @@ public:
StringName gui_input;
StringName _gui_input;
StringName item_rect_changed;
- StringName shader_shader;
+ StringName shader;
StringName shader_unshaded;
StringName shading_mode;
StringName tree_entered;