summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/editor_node.cpp8
-rw-r--r--modules/mono/config.py2
-rw-r--r--platform/osx/os_osx.h1
-rw-r--r--platform/osx/os_osx.mm49
-rw-r--r--scene/main/scene_tree.cpp6
-rw-r--r--servers/audio_server.cpp41
-rw-r--r--servers/audio_server.h3
7 files changed, 94 insertions, 16 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index e627263909..36ea90ed66 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -604,6 +604,10 @@ void EditorNode::open_resource(const String &p_type) {
void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const String &p_path) {
editor_data.apply_changes_in_editors();
+ if (p_resource->get_last_modified_time() == p_resource->get_import_last_modified_time()) {
+ return;
+ }
+
int flg = 0;
if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources"))
flg |= ResourceSaver::FLAG_COMPRESS;
@@ -1089,7 +1093,8 @@ void EditorNode::_save_scene(String p_file, int idx) {
void EditorNode::_save_all_scenes() {
- for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
+ int i = _next_unsaved_scene(true, 0);
+ while (i != -1) {
Node *scene = editor_data.get_edited_scene_root(i);
if (scene && scene->get_filename() != "") {
if (i != editor_data.get_edited_scene())
@@ -1097,6 +1102,7 @@ void EditorNode::_save_all_scenes() {
else
_save_scene_with_preview(scene->get_filename());
} // else: ignore new scenes
+ i = _next_unsaved_scene(true, ++i);
}
_save_default_environment();
diff --git a/modules/mono/config.py b/modules/mono/config.py
index 0e21987a0e..831d849ea6 100644
--- a/modules/mono/config.py
+++ b/modules/mono/config.py
@@ -161,7 +161,7 @@ def configure(env):
mono_lib_path = ''
mono_so_name = ''
- mono_prefix = subprocess.check_output(["pkg-config", "mono-2", "--variable=prefix"], encoding="utf8").strip()
+ mono_prefix = subprocess.check_output(["pkg-config", "mono-2", "--variable=prefix"]).decode("utf8").strip()
tmpenv = Environment()
tmpenv.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 486d7af1c1..29935f197e 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -195,6 +195,7 @@ public:
virtual VideoMode get_video_mode(int p_screen = 0) const;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool p_read_stderr);
virtual String get_executable_path() const;
virtual LatinKeyboardVariant get_latin_keyboard_variant() const;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index a811ff585d..d125ca5a67 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -2045,6 +2045,55 @@ bool OS_OSX::get_borderless_window() {
return [window_object styleMask] == NSWindowStyleMaskBorderless;
}
+Error OS_OSX::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool p_read_stderr) {
+
+ NSTask *task = [[NSTask alloc] init];
+ NSPipe *stdout_pipe = nil;
+ [task setLaunchPath:[NSString stringWithUTF8String:p_path.utf8().get_data()]];
+
+ NSMutableArray *arguments = [[NSMutableArray alloc] initWithCapacity:p_arguments.size()];
+ for (int i = 0; i < p_arguments.size(); i++) {
+ [arguments addObject:[NSString stringWithUTF8String:p_arguments[i].utf8().get_data()]];
+ }
+ [task setArguments:arguments];
+
+ if (p_blocking && r_pipe) {
+ stdout_pipe = [NSPipe pipe];
+ [task setStandardOutput:stdout_pipe];
+ if (p_read_stderr) [task setStandardError:[task standardOutput]];
+ }
+
+ @try {
+ [task launch];
+ if (r_child_id)
+ *r_child_id = [task processIdentifier];
+
+ if (p_blocking) {
+ if (r_pipe) {
+ NSFileHandle *read_handle = [stdout_pipe fileHandleForReading];
+ NSData *data = nil;
+ while ((data = [read_handle availableData]) && [data length]) {
+ NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+ (*r_pipe) += [string UTF8String];
+ [string release];
+ }
+ } else {
+ [task waitUntilExit];
+ }
+ }
+
+ [arguments release];
+ [task release];
+ return OK;
+ } @catch (NSException *exception) {
+ ERR_PRINTS("NSException: " + String([exception reason].UTF8String) + "; Path: " + p_path);
+
+ [arguments release];
+ [task release];
+ return ERR_CANT_OPEN;
+ }
+}
+
String OS_OSX::get_executable_path() const {
int ret;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 12c3da78bd..037331dec1 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -498,14 +498,14 @@ bool SceneTree::idle(float p_time) {
Size2 win_size = Size2(OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height);
if (win_size != last_screen_size) {
+ last_screen_size = win_size;
+ _update_root_rect();
+
if (use_font_oversampling) {
DynamicFontAtSize::font_oversampling = OS::get_singleton()->get_window_size().width / root->get_visible_rect().size.width;
DynamicFont::update_oversampling();
}
- last_screen_size = win_size;
- _update_root_rect();
-
emit_signal("screen_resized");
}
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index a030871754..c3b0de6d9a 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -172,6 +172,12 @@ void AudioServer::_driver_process(int p_frames, int32_t *p_buffer) {
int todo = p_frames;
+ if (channel_count != get_channel_count()) {
+ // Amount of channels changed due to a device change
+ // reinitialize the buses channels and buffers
+ init_channels_and_buffers();
+ }
+
while (todo) {
if (to_mix == 0) {
@@ -485,8 +491,8 @@ void AudioServer::set_bus_count(int p_count) {
}
buses[i] = memnew(Bus);
- buses[i]->channels.resize(get_channel_count());
- for (int j = 0; j < get_channel_count(); j++) {
+ buses[i]->channels.resize(channel_count);
+ for (int j = 0; j < channel_count; j++) {
buses[i]->channels[j].buffer.resize(buffer_size);
}
buses[i]->name = attempt;
@@ -557,8 +563,8 @@ void AudioServer::add_bus(int p_at_pos) {
}
Bus *bus = memnew(Bus);
- bus->channels.resize(get_channel_count());
- for (int j = 0; j < get_channel_count(); j++) {
+ bus->channels.resize(channel_count);
+ for (int j = 0; j < channel_count; j++) {
bus->channels[j].buffer.resize(buffer_size);
}
bus->name = attempt;
@@ -860,17 +866,29 @@ bool AudioServer::is_bus_channel_active(int p_bus, int p_channel) const {
return buses[p_bus]->channels[p_channel].active;
}
+void AudioServer::init_channels_and_buffers() {
+ channel_count = get_channel_count();
+ temp_buffer.resize(channel_count);
+
+ for (int i = 0; i < temp_buffer.size(); i++) {
+ temp_buffer[i].resize(buffer_size);
+ }
+
+ for (int i = 0; i < buses.size(); i++) {
+ buses[i]->channels.resize(channel_count);
+ for (int j = 0; j < channel_count; j++) {
+ buses[i]->channels[j].buffer.resize(buffer_size);
+ }
+ }
+}
+
void AudioServer::init() {
channel_disable_threshold_db = GLOBAL_DEF("audio/channel_disable_threshold_db", -60.0);
channel_disable_frames = float(GLOBAL_DEF("audio/channel_disable_time", 2.0)) * get_mix_rate();
buffer_size = 1024; //hardcoded for now
- temp_buffer.resize(get_channel_count());
-
- for (int i = 0; i < temp_buffer.size(); i++) {
- temp_buffer[i].resize(buffer_size);
- }
+ init_channels_and_buffers();
mix_count = 0;
set_bus_count(1);
@@ -1052,8 +1070,8 @@ void AudioServer::set_bus_layout(const Ref<AudioBusLayout> &p_bus_layout) {
bus_map[bus->name] = bus;
buses[i] = bus;
- buses[i]->channels.resize(get_channel_count());
- for (int j = 0; j < get_channel_count(); j++) {
+ buses[i]->channels.resize(channel_count);
+ for (int j = 0; j < channel_count; j++) {
buses[i]->channels[j].buffer.resize(buffer_size);
}
_update_bus_effects(i);
@@ -1154,6 +1172,7 @@ AudioServer::AudioServer() {
audio_data_max_mem = 0;
audio_data_lock = Mutex::create();
mix_frames = 0;
+ channel_count = 0;
to_mix = 0;
}
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 188d38db94..a8be48b4c3 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -130,6 +130,7 @@ private:
float channel_disable_threshold_db;
uint32_t channel_disable_frames;
+ int channel_count;
int to_mix;
struct Bus {
@@ -186,6 +187,8 @@ private:
Mutex *audio_data_lock;
+ void init_channels_and_buffers();
+
void _mix_step();
struct CallbackItem {