summaryrefslogtreecommitdiffstats
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/SCsub1
-rw-r--r--scene/2d/parallax_2d.cpp6
-rw-r--r--scene/2d/physics/SCsub1
-rw-r--r--scene/2d/physics/joints/SCsub1
-rw-r--r--scene/3d/SCsub1
-rw-r--r--scene/3d/physics/SCsub1
-rw-r--r--scene/3d/physics/joints/SCsub1
-rw-r--r--scene/SCsub1
-rw-r--r--scene/animation/SCsub1
-rw-r--r--scene/audio/SCsub1
-rw-r--r--scene/debugger/SCsub1
-rw-r--r--scene/gui/SCsub1
-rw-r--r--scene/gui/color_picker.cpp15
-rw-r--r--scene/gui/line_edit.cpp2
-rw-r--r--scene/gui/scroll_bar.cpp2
-rw-r--r--scene/gui/text_edit.cpp2
-rw-r--r--scene/main/SCsub1
-rw-r--r--scene/resources/2d/SCsub1
-rw-r--r--scene/resources/3d/SCsub1
-rw-r--r--scene/resources/SCsub1
-rw-r--r--scene/resources/animation.cpp14
-rw-r--r--scene/resources/camera_texture.cpp24
-rw-r--r--scene/resources/camera_texture.h1
-rw-r--r--scene/theme/SCsub1
-rw-r--r--scene/theme/icons/SCsub1
25 files changed, 62 insertions, 21 deletions
diff --git a/scene/2d/SCsub b/scene/2d/SCsub
index 94e1ab6c96..6f6bf9818c 100644
--- a/scene/2d/SCsub
+++ b/scene/2d/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/2d/parallax_2d.cpp b/scene/2d/parallax_2d.cpp
index fdb2d2cdd0..c6176390dc 100644
--- a/scene/2d/parallax_2d.cpp
+++ b/scene/2d/parallax_2d.cpp
@@ -83,7 +83,11 @@ void Parallax2D::_validate_property(PropertyInfo &p_property) const {
void Parallax2D::_camera_moved(const Transform2D &p_transform, const Point2 &p_screen_offset, const Point2 &p_adj_screen_pos) {
if (!ignore_camera_scroll) {
if (get_viewport() && get_viewport()->is_snap_2d_transforms_to_pixel_enabled()) {
- set_screen_offset((p_adj_screen_pos + Vector2(0.5, 0.5)).floor());
+ Size2 vps = get_viewport_rect().size;
+ Vector2 offset;
+ offset.x = ((int)vps.width % 2) ? 0.0 : 0.5;
+ offset.y = ((int)vps.height % 2) ? 0.0 : 0.5;
+ set_screen_offset((p_adj_screen_pos + offset).floor());
} else {
set_screen_offset(p_adj_screen_pos);
}
diff --git a/scene/2d/physics/SCsub b/scene/2d/physics/SCsub
index e7fd3fe643..5f9747514a 100644
--- a/scene/2d/physics/SCsub
+++ b/scene/2d/physics/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/2d/physics/joints/SCsub b/scene/2d/physics/joints/SCsub
index fc61250247..374dc2119d 100644
--- a/scene/2d/physics/joints/SCsub
+++ b/scene/2d/physics/joints/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/3d/SCsub b/scene/3d/SCsub
index 94e1ab6c96..6f6bf9818c 100644
--- a/scene/3d/SCsub
+++ b/scene/3d/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/3d/physics/SCsub b/scene/3d/physics/SCsub
index e7fd3fe643..5f9747514a 100644
--- a/scene/3d/physics/SCsub
+++ b/scene/3d/physics/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/3d/physics/joints/SCsub b/scene/3d/physics/joints/SCsub
index fc61250247..374dc2119d 100644
--- a/scene/3d/physics/joints/SCsub
+++ b/scene/3d/physics/joints/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/SCsub b/scene/SCsub
index b4b2d6dd0a..1eb4ffa53d 100644
--- a/scene/SCsub
+++ b/scene/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/animation/SCsub b/scene/animation/SCsub
index d0aa0bc8aa..dd2b22c2e3 100644
--- a/scene/animation/SCsub
+++ b/scene/animation/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/audio/SCsub b/scene/audio/SCsub
index fc61250247..374dc2119d 100644
--- a/scene/audio/SCsub
+++ b/scene/audio/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/debugger/SCsub b/scene/debugger/SCsub
index fc61250247..374dc2119d 100644
--- a/scene/debugger/SCsub
+++ b/scene/debugger/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/gui/SCsub b/scene/gui/SCsub
index fc61250247..374dc2119d 100644
--- a/scene/gui/SCsub
+++ b/scene/gui/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index c92dcbc153..002a738b83 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -33,8 +33,6 @@
#include "core/input/input.h"
#include "core/io/image.h"
#include "core/math/color.h"
-#include "core/os/keyboard.h"
-#include "core/os/os.h"
#include "scene/gui/color_mode.h"
#include "scene/gui/margin_container.h"
#include "scene/resources/image_texture.h"
@@ -42,7 +40,6 @@
#include "scene/resources/style_box_texture.h"
#include "scene/theme/theme_db.h"
#include "servers/display_server.h"
-#include "thirdparty/misc/ok_color.h"
#include "thirdparty/misc/ok_color_shader.h"
List<Color> ColorPicker::preset_cache;
@@ -1567,7 +1564,7 @@ void ColorPicker::_pick_button_pressed_legacy() {
picker_preview_label = memnew(Label);
picker_preview->set_anchors_preset(Control::PRESET_CENTER_TOP);
- picker_preview_label->set_text("Color Picking active");
+ picker_preview_label->set_text(ETR("Color Picking active"));
picker_preview->add_child(picker_preview_label);
picker_preview_style_box = (Ref<StyleBoxFlat>)memnew(StyleBoxFlat);
@@ -1905,7 +1902,7 @@ ColorPicker::ColorPicker() {
mode_popup->add_radio_check_item(modes[i]->get_name(), i);
}
mode_popup->add_separator();
- mode_popup->add_check_item("Colorized Sliders", MODE_MAX);
+ mode_popup->add_check_item(ETR("Colorized Sliders"), MODE_MAX);
mode_popup->set_item_checked(current_mode, true);
mode_popup->set_item_checked(MODE_MAX + 1, true);
mode_popup->connect(SceneStringName(id_pressed), callable_mp(this, &ColorPicker::_set_mode_popup_value));
@@ -1933,7 +1930,7 @@ ColorPicker::ColorPicker() {
hex_hbc->set_alignment(ALIGNMENT_BEGIN);
vbr->add_child(hex_hbc);
- hex_hbc->add_child(memnew(Label("Hex")));
+ hex_hbc->add_child(memnew(Label(ETR("Hex"))));
text_type = memnew(Button);
hex_hbc->add_child(text_type);
@@ -1997,8 +1994,7 @@ ColorPicker::ColorPicker() {
preset_group.instantiate();
- btn_preset = memnew(Button);
- btn_preset->set_text("Swatches");
+ btn_preset = memnew(Button(ETR("Swatches")));
btn_preset->set_flat(true);
btn_preset->set_toggle_mode(true);
btn_preset->set_focus_mode(FOCUS_NONE);
@@ -2014,8 +2010,7 @@ ColorPicker::ColorPicker() {
recent_preset_group.instantiate();
- btn_recent_preset = memnew(Button);
- btn_recent_preset->set_text("Recent Colors");
+ btn_recent_preset = memnew(Button(ETR("Recent Colors")));
btn_recent_preset->set_flat(true);
btn_recent_preset->set_toggle_mode(true);
btn_recent_preset->set_focus_mode(FOCUS_NONE);
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 43782409a8..6e5b555cdf 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -103,7 +103,7 @@ void LineEdit::_close_ime_window() {
void LineEdit::_update_ime_window_position() {
DisplayServer::WindowID wid = get_window() ? get_window()->get_window_id() : DisplayServer::INVALID_WINDOW_ID;
- if (wid == DisplayServer::INVALID_WINDOW_ID || !DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME) || !DisplayServer::get_singleton()->window_is_focused(wid)) {
+ if (wid == DisplayServer::INVALID_WINDOW_ID || !DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) {
return;
}
DisplayServer::get_singleton()->window_set_ime_active(true, wid);
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index af9f08e389..eb69dab478 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -472,7 +472,7 @@ double ScrollBar::get_area_size() const {
}
double ScrollBar::get_grabber_offset() const {
- return (get_area_size()) * get_as_ratio();
+ return get_area_size() * get_as_ratio();
}
Size2 ScrollBar::get_minimum_size() const {
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 0e8d76d294..6b5ff23436 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2958,7 +2958,7 @@ void TextEdit::_close_ime_window() {
void TextEdit::_update_ime_window_position() {
DisplayServer::WindowID wid = get_window() ? get_window()->get_window_id() : DisplayServer::INVALID_WINDOW_ID;
- if (wid == DisplayServer::INVALID_WINDOW_ID || !DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME) || !DisplayServer::get_singleton()->window_is_focused(wid)) {
+ if (wid == DisplayServer::INVALID_WINDOW_ID || !DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) {
return;
}
DisplayServer::get_singleton()->window_set_ime_active(true, wid);
diff --git a/scene/main/SCsub b/scene/main/SCsub
index fc61250247..374dc2119d 100644
--- a/scene/main/SCsub
+++ b/scene/main/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/resources/2d/SCsub b/scene/resources/2d/SCsub
index fdf20e0bde..408aa3cf7e 100644
--- a/scene/resources/2d/SCsub
+++ b/scene/resources/2d/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/resources/3d/SCsub b/scene/resources/3d/SCsub
index fdf20e0bde..408aa3cf7e 100644
--- a/scene/resources/3d/SCsub
+++ b/scene/resources/3d/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/resources/SCsub b/scene/resources/SCsub
index 2b6aa88d2c..46f6251b91 100644
--- a/scene/resources/SCsub
+++ b/scene/resources/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index a2ed6af23c..9abc6a02d2 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -321,8 +321,12 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
Vector<real_t> times = d["times"];
Vector<real_t> values = d["points"];
#ifdef TOOLS_ENABLED
- ERR_FAIL_COND_V(!d.has("handle_modes"), false);
- Vector<int> handle_modes = d["handle_modes"];
+ Vector<int> handle_modes;
+ if (d.has("handle_modes")) {
+ handle_modes = d["handle_modes"];
+ } else {
+ handle_modes.resize_zeroed(times.size());
+ }
#endif // TOOLS_ENABLED
ERR_FAIL_COND_V(times.size() * 5 != values.size(), false);
@@ -4804,9 +4808,9 @@ void Animation::compress(uint32_t p_page_size, uint32_t p_fps, float p_split_tol
continue; // This track is exhausted (all keys were added already), don't consider.
}
}
-
- uint32_t key_frame = double(track_get_key_time(uncomp_track, time_tracks[i].key_index)) / frame_len;
-
+ double key_time = track_get_key_time(uncomp_track, time_tracks[i].key_index);
+ double result = key_time / frame_len;
+ uint32_t key_frame = Math::fast_ftoi(result);
if (time_tracks[i].needs_start_frame && key_frame > base_page_frame) {
start_frame = true;
best_frame = base_page_frame;
diff --git a/scene/resources/camera_texture.cpp b/scene/resources/camera_texture.cpp
index b575a099ed..b219f89e59 100644
--- a/scene/resources/camera_texture.cpp
+++ b/scene/resources/camera_texture.cpp
@@ -47,6 +47,11 @@ void CameraTexture::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "camera_is_active"), "set_camera_active", "get_camera_active");
}
+void CameraTexture::_on_format_changed() {
+ // FIXME: `emit_changed` is more appropriate, but causes errors for some reason.
+ callable_mp((Resource *)this, &Resource::emit_changed).call_deferred();
+}
+
int CameraTexture::get_width() const {
Ref<CameraFeed> feed = CameraServer::get_singleton()->get_feed_by_id(camera_feed_id);
if (feed.is_valid()) {
@@ -82,13 +87,26 @@ RID CameraTexture::get_rid() const {
}
Ref<Image> CameraTexture::get_image() const {
- // not (yet) supported
- return Ref<Image>();
+ return RenderingServer::get_singleton()->texture_2d_get(get_rid());
}
void CameraTexture::set_camera_feed_id(int p_new_id) {
+ Ref<CameraFeed> feed = CameraServer::get_singleton()->get_feed_by_id(camera_feed_id);
+ if (feed.is_valid()) {
+ if (feed->is_connected("format_changed", callable_mp(this, &CameraTexture::_on_format_changed))) {
+ feed->disconnect("format_changed", callable_mp(this, &CameraTexture::_on_format_changed));
+ }
+ }
+
camera_feed_id = p_new_id;
+
+ feed = CameraServer::get_singleton()->get_feed_by_id(camera_feed_id);
+ if (feed.is_valid()) {
+ feed->connect("format_changed", callable_mp(this, &CameraTexture::_on_format_changed));
+ }
+
notify_property_list_changed();
+ callable_mp((Resource *)this, &Resource::emit_changed).call_deferred();
}
int CameraTexture::get_camera_feed_id() const {
@@ -98,6 +116,7 @@ int CameraTexture::get_camera_feed_id() const {
void CameraTexture::set_which_feed(CameraServer::FeedImage p_which) {
which_feed = p_which;
notify_property_list_changed();
+ callable_mp((Resource *)this, &Resource::emit_changed).call_deferred();
}
CameraServer::FeedImage CameraTexture::get_which_feed() const {
@@ -109,6 +128,7 @@ void CameraTexture::set_camera_active(bool p_active) {
if (feed.is_valid()) {
feed->set_active(p_active);
notify_property_list_changed();
+ callable_mp((Resource *)this, &Resource::emit_changed).call_deferred();
}
}
diff --git a/scene/resources/camera_texture.h b/scene/resources/camera_texture.h
index 521121f9ea..dd216a72d6 100644
--- a/scene/resources/camera_texture.h
+++ b/scene/resources/camera_texture.h
@@ -43,6 +43,7 @@ private:
protected:
static void _bind_methods();
+ void _on_format_changed();
public:
virtual int get_width() const override;
diff --git a/scene/theme/SCsub b/scene/theme/SCsub
index 2372d1820a..fb0914c0ee 100644
--- a/scene/theme/SCsub
+++ b/scene/theme/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")
diff --git a/scene/theme/icons/SCsub b/scene/theme/icons/SCsub
index 1f3b7f6d17..19aca74e57 100644
--- a/scene/theme/icons/SCsub
+++ b/scene/theme/icons/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from misc.utility.scons_hints import *
Import("env")