summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/@GlobalScope.xml49
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp13
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp6
-rw-r--r--modules/gdscript/language_server/gdscript_extend_parser.cpp2
-rw-r--r--modules/opensimplex/doc_classes/NoiseTexture.xml5
-rw-r--r--platform/iphone/export/export_plugin.cpp8
-rw-r--r--platform/osx/display_server_osx.mm8
-rw-r--r--platform/osx/export/export_plugin.cpp17
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm23
-rw-r--r--scene/main/node.cpp1
-rw-r--r--scene/resources/texture.cpp9
-rw-r--r--scene/resources/texture.h3
14 files changed, 114 insertions, 34 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index aba77afb68..ea49b6b634 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -14,6 +14,26 @@
<return type="Variant" />
<argument index="0" name="x" type="Variant" />
<description>
+ Returns the absolute value of a [Variant] parameter [code]x[/code] (i.e. non-negative value). Variant types [int], [float] (real), [Vector2], [Vector2i], [Vector3] and [Vector3i] are supported.
+ [codeblock]
+ var a = abs(-1)
+ # a is 1
+
+ var b = abs(-1.2)
+ # b is 1.2
+
+ var c = abs(Vector2(-3.5, -4))
+ # c is (3.5, 4)
+
+ var d = abs(Vector2i(-5, -6))
+ # d is (5, 6)
+
+ var e = abs(Vector3(-7, 8.5, -3.8))
+ # e is (7, 8.5, 3.8)
+
+ var f = abs(Vector3i(-7, -8, -9))
+ # f is (7, 8, 9)
+ [/codeblock]
</description>
</method>
<method name="absf">
@@ -118,6 +138,26 @@
<argument index="1" name="min" type="Variant" />
<argument index="2" name="max" type="Variant" />
<description>
+ Clamps the [Variant] [code]value[/code] and returns a value not less than [code]min[/code] and not more than [code]max[/code]. Variant types [int], [float] (real), [Vector2], [Vector2i], [Vector3] and [Vector3i] are supported.
+ [codeblock]
+ var a = clamp(-10, -1, 5)
+ # a is -1
+
+ var b = clamp(8.1, 0.9, 5.5)
+ # b is 5.5
+
+ var c = clamp(Vector2(-3.5, -4), Vector2(-3.2, -2), Vector2(2, 6.5))
+ # c is (-3.2, -2)
+
+ var d = clamp(Vector2i(7, 8), Vector2i(-3, -2), Vector2i(2, 6))
+ # d is (2, 6)
+
+ var e = clamp(Vector3(-7, 8.5, -3.8), Vector3(-3, -2, 5.4), Vector3(-2, 6, -4.1))
+ # e is (-3, -2, 5.4)
+
+ var f = clamp(Vector3i(-7, -8, -9), Vector3i(-1, 2, 3), Vector3i(-4, -5, -6))
+ # f is (-4, -5, -6)
+ [/codeblock]
</description>
</method>
<method name="clampf">
@@ -347,6 +387,7 @@
<return type="bool" />
<argument index="0" name="id" type="int" />
<description>
+ Returns [code]true[/code] if the Object that corresponds to [code]instance_id[/code] is a valid object (e.g. has not been deleted from memory). All Objects have a unique instance ID.
</description>
</method>
<method name="is_instance_valid">
@@ -750,6 +791,14 @@
<return type="Variant" />
<argument index="0" name="x" type="Variant" />
<description>
+ Returns the sign of [code]x[/code] as same type of [Variant] as [code]x[/code] with each component being -1, 0 and 1 for each negative, zero and positive values respectivelu. Variant types [int], [float] (real), [Vector2], [Vector2i], [Vector3] and [Vector3i] are supported.
+ [codeblock]
+ sign(-6.0) # Returns -1
+ sign(0.0) # Returns 0
+ sign(6.0) # Returns 1
+
+ sign(Vector3(-6.0, 0.0, 6.0) # Returns (-1, 0, 1)
+ [/codeblock]
</description>
</method>
<method name="signf">
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index 64fc94ea91..1233f0f632 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -34,6 +34,7 @@
#include "core/config/project_settings.h"
#include "core/os/os.h"
+#include "core/version.h"
#ifdef ALSAMIDI_ENABLED
#include "drivers/alsa/asound-so_wrap.h"
@@ -293,7 +294,17 @@ Error AudioDriverPulseAudio::init() {
pa_ml = pa_mainloop_new();
ERR_FAIL_COND_V(pa_ml == nullptr, ERR_CANT_OPEN);
- pa_ctx = pa_context_new(pa_mainloop_get_api(pa_ml), "Godot");
+ String context_name;
+ if (Engine::get_singleton()->is_editor_hint()) {
+ context_name = VERSION_NAME " Editor";
+ } else {
+ context_name = GLOBAL_GET("application/config/name");
+ if (context_name.is_empty()) {
+ context_name = VERSION_NAME " Project";
+ }
+ }
+
+ pa_ctx = pa_context_new(pa_mainloop_get_api(pa_ml), context_name.utf8().ptr());
ERR_FAIL_COND_V(pa_ctx == nullptr, ERR_CANT_OPEN);
pa_ready = 0;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index d855085719..7db49c45dd 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1791,7 +1791,7 @@ void EditorNode::_save_all_scenes() {
} else {
_save_scene_with_preview(scene->get_scene_file_path());
}
- } else {
+ } else if (scene->get_scene_file_path() != "") {
all_saved = false;
}
}
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 3502f0c5d8..fa5381bb10 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -6650,7 +6650,7 @@ void Node3DEditor::_add_sun_to_scene(bool p_already_added_environment) {
Node *new_sun = preview_sun->duplicate();
undo_redo->create_action(TTR("Add Preview Sun to Scene"));
- undo_redo->add_do_method(base, "add_child", new_sun);
+ undo_redo->add_do_method(base, "add_child", new_sun, true);
// Move to the beginning of the scene tree since more "global" nodes
// generally look better when placed at the top.
undo_redo->add_do_method(base, "move_child", new_sun, 0);
@@ -6680,7 +6680,7 @@ void Node3DEditor::_add_environment_to_scene(bool p_already_added_sun) {
new_env->set_environment(preview_environment->get_environment()->duplicate(true));
undo_redo->create_action(TTR("Add Preview Environment to Scene"));
- undo_redo->add_do_method(base, "add_child", new_env);
+ undo_redo->add_do_method(base, "add_child", new_env, true);
// Move to the beginning of the scene tree since more "global" nodes
// generally look better when placed at the top.
undo_redo->add_do_method(base, "move_child", new_env, 0);
@@ -7146,7 +7146,7 @@ void Node3DEditor::_update_preview_environment() {
} else {
if (!preview_sun->get_parent()) {
- add_child(preview_sun);
+ add_child(preview_sun, true);
sun_state->hide();
sun_vb->show();
}
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp
index f4c0c4d9bb..80f4721e2d 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.cpp
+++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp
@@ -269,7 +269,7 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
if (j > 0) {
symbol.detail += ", ";
}
- symbol.detail += m.signal->parameters[i]->identifier->name;
+ symbol.detail += m.signal->parameters[j]->identifier->name;
}
symbol.detail += ")";
diff --git a/modules/opensimplex/doc_classes/NoiseTexture.xml b/modules/opensimplex/doc_classes/NoiseTexture.xml
index 8a10411cf6..16fea228b1 100644
--- a/modules/opensimplex/doc_classes/NoiseTexture.xml
+++ b/modules/opensimplex/doc_classes/NoiseTexture.xml
@@ -8,8 +8,9 @@
NoiseTexture can also generate normal map textures.
The class uses [Thread]s to generate the texture data internally, so [method Texture2D.get_image] may return [code]null[/code] if the generation process has not completed yet. In that case, you need to wait for the texture to be generated before accessing the image and the generated byte data:
[codeblock]
- var texture = preload("res://noise.tres")
- yield(texture, "changed")
+ var texture = NoiseTexture.new()
+ texture.noise = OpenSimplexNoise.new()
+ await texture.changed
var image = texture.get_image()
var data = image.get_data()
[/codeblock]
diff --git a/platform/iphone/export/export_plugin.cpp b/platform/iphone/export/export_plugin.cpp
index 0559c8130f..7450215cfb 100644
--- a/platform/iphone/export/export_plugin.cpp
+++ b/platform/iphone/export/export_plugin.cpp
@@ -1685,8 +1685,10 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
archive_args.push_back("archive");
archive_args.push_back("-archivePath");
archive_args.push_back(archive_path);
- err = OS::get_singleton()->execute("xcodebuild", archive_args);
+ String archive_str;
+ err = OS::get_singleton()->execute("xcodebuild", archive_args, &archive_str, nullptr, true);
ERR_FAIL_COND_V(err, err);
+ print_line("xcodebuild (.xcarchive):\n" + archive_str);
if (ep.step("Making .ipa", 4)) {
return ERR_SKIP;
@@ -1700,8 +1702,10 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
export_args.push_back("-allowProvisioningUpdates");
export_args.push_back("-exportPath");
export_args.push_back(dest_dir);
- err = OS::get_singleton()->execute("xcodebuild", export_args);
+ String export_str;
+ err = OS::get_singleton()->execute("xcodebuild", export_args, &export_str, nullptr, true);
ERR_FAIL_COND_V(err, err);
+ print_line("xcodebuild (.ipa):\n" + export_str);
#else
print_line(".ipa can only be built on macOS. Leaving Xcode project without building the package.");
#endif
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm
index a862f14efb..03301af0af 100644
--- a/platform/osx/display_server_osx.mm
+++ b/platform/osx/display_server_osx.mm
@@ -289,14 +289,6 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
Callable::CallError ce;
wd.rect_changed_callback.call((const Variant **)&sizep, 1, ret, ce);
}
-
- if (OS_OSX::get_singleton()->get_main_loop()) {
- Main::force_redraw();
- //Event retrieval blocks until resize is over. Call Main::iteration() directly.
- if (!Main::is_iterating()) { //avoid cyclic loop
- Main::iteration();
- }
- }
}
- (void)windowDidMove:(NSNotification *)notification {
diff --git a/platform/osx/export/export_plugin.cpp b/platform/osx/export/export_plugin.cpp
index 1e80dcd97b..a88f7bb332 100644
--- a/platform/osx/export/export_plugin.cpp
+++ b/platform/osx/export/export_plugin.cpp
@@ -1048,8 +1048,21 @@ void EditorExportPlatformOSX::_zip_folder_recursive(zipFile &p_zip, const String
0x0314, // "version made by", 0x03 - Unix, 0x14 - ZIP specification version 2.0, required to store Unix file permissions
0);
- Vector<uint8_t> array = FileAccess::get_file_as_array(dir.plus_file(f));
- zipWriteInFileInZip(p_zip, array.ptr(), array.size());
+ FileAccessRef fa = FileAccess::open(dir.plus_file(f), FileAccess::READ);
+ if (!fa) {
+ ERR_FAIL_MSG("Can't open file to read from path '" + String(dir.plus_file(f)) + "'.");
+ }
+ const int bufsize = 16384;
+ uint8_t buf[bufsize];
+
+ while (true) {
+ uint64_t got = fa->get_buffer(buf, bufsize);
+ if (got == 0) {
+ break;
+ }
+ zipWriteInFileInZip(p_zip, buf, got);
+ }
+
zipCloseFileInZip(p_zip);
}
}
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index fc78fb28a8..7e02f4e154 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -57,6 +57,8 @@ class OS_OSX : public OS_Unix {
MainLoop *main_loop;
+ static void pre_wait_observer_cb(CFRunLoopObserverRef p_observer, CFRunLoopActivity p_activiy, void *p_context);
+
public:
String open_with_filename;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 307ab03c48..45a81be80a 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -549,14 +549,31 @@ Error OS_OSX::create_process(const String &p_path, const List<String> &p_argumen
}
}
+void OS_OSX::pre_wait_observer_cb(CFRunLoopObserverRef p_observer, CFRunLoopActivity p_activiy, void *p_context) {
+ // Prevent main loop from sleeping and redraw window during resize / modal popups.
+
+ if (get_singleton()->get_main_loop()) {
+ Main::force_redraw();
+ if (!Main::is_iterating()) { // Avoid cyclic loop.
+ Main::iteration();
+ }
+ }
+
+ CFRunLoopWakeUp(CFRunLoopGetCurrent()); // Prevent main loop from sleeping.
+}
+
void OS_OSX::run() {
force_quit = false;
- if (!main_loop)
+ if (!main_loop) {
return;
+ }
main_loop->initialize();
+ CFRunLoopObserverRef pre_wait_observer = CFRunLoopObserverCreate(kCFAllocatorDefault, kCFRunLoopBeforeWaiting, true, 0, &pre_wait_observer_cb, nullptr);
+ CFRunLoopAddObserver(CFRunLoopGetCurrent(), pre_wait_observer, kCFRunLoopCommonModes);
+
bool quit = false;
while (!force_quit && !quit) {
@try {
@@ -572,6 +589,10 @@ void OS_OSX::run() {
ERR_PRINT("NSException: " + String([exception reason].UTF8String));
}
};
+
+ CFRunLoopRemoveObserver(CFRunLoopGetCurrent(), pre_wait_observer, kCFRunLoopCommonModes);
+ CFRelease(pre_wait_observer);
+
main_loop->finalize();
}
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index cb5f502b24..5ff8cd169b 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -927,7 +927,6 @@ void Node::_validate_child_name(Node *p_child, bool p_force_human_readable) {
if (p_force_human_readable) {
//this approach to autoset node names is human readable but very slow
- //it's turned on while running in the editor
StringName name = p_child->data.name;
_generate_serial_child_name(p_child, name);
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 485074e283..ec6965ded2 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -2871,15 +2871,6 @@ RID CameraTexture::get_rid() const {
}
}
-void CameraTexture::set_flags(uint32_t p_flags) {
- // not supported
-}
-
-uint32_t CameraTexture::get_flags() const {
- // not supported
- return 0;
-}
-
Ref<Image> CameraTexture::get_image() const {
// not (yet) supported
return Ref<Image>();
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 51567124c6..e666ff06b5 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -900,9 +900,6 @@ public:
virtual RID get_rid() const override;
virtual bool has_alpha() const override;
- virtual void set_flags(uint32_t p_flags);
- virtual uint32_t get_flags() const;
-
virtual Ref<Image> get_image() const override;
void set_camera_feed_id(int p_new_id);