summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/file_access_pack.cpp6
-rw-r--r--editor/editor_node.cpp8
-rw-r--r--platform/android/export/export.cpp10
-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
-rw-r--r--servers/visual/visual_server_canvas.cpp12
9 files changed, 114 insertions, 22 deletions
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index 1a16d0f61c..efb4c7a073 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -88,7 +88,11 @@ void PackedData::add_path(const String &pkg_path, const String &path, uint64_t o
}
}
}
- cd->files.insert(path.get_file());
+ String filename = path.get_file();
+ // Don't add as a file if the path points to a directoryy
+ if (!filename.empty()) {
+ cd->files.insert(filename);
+ }
}
}
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/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 6b4d0ff8c4..6d9f0a7e9a 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -301,8 +301,7 @@ class EditorExportAndroid : public EditorExportPlatform {
args.push_back("-s");
args.push_back(d.id);
args.push_back("shell");
- args.push_back("cat");
- args.push_back("/system/build.prop");
+ args.push_back("getprop");
int ec;
String dp;
@@ -315,7 +314,14 @@ class EditorExportAndroid : public EditorExportPlatform {
d.api_level = 0;
for (int j = 0; j < props.size(); j++) {
+ // got information by `shell cat /system/build.prop` before and its format is "property=value"
+ // it's now changed to use `shell getporp` because of permission issue with Android 8.0 and above
+ // its format is "[property]: [value]" so changed it as like build.prop
String p = props[j];
+ p = p.replace("]: ", "=");
+ p = p.replace("[", "");
+ p = p.replace("]", "");
+
if (p.begins_with("ro.product.model=")) {
device = p.get_slice("=", 1).strip_edges();
} else if (p.begins_with("ro.product.brand=")) {
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 {
diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp
index 3e6e524117..dd8d07f00d 100644
--- a/servers/visual/visual_server_canvas.cpp
+++ b/servers/visual/visual_server_canvas.cpp
@@ -440,13 +440,17 @@ void VisualServerCanvas::canvas_item_add_polyline(RID p_item, const Vector<Point
if (p_antialiased) {
pline->line_colors.push_back(Color(1, 1, 1, 1));
}
- }
- if (p_colors.size() == 1) {
+ } else if (p_colors.size() == 1) {
pline->triangle_colors = p_colors;
pline->line_colors = p_colors;
} else {
- pline->triangle_colors.resize(pline->triangles.size());
- pline->line_colors.resize(pline->lines.size());
+ if (p_colors.size() != p_points.size()) {
+ pline->triangle_colors.push_back(p_colors[0]);
+ pline->line_colors.push_back(p_colors[0]);
+ } else {
+ pline->triangle_colors.resize(pline->triangles.size());
+ pline->line_colors.resize(pline->lines.size());
+ }
}
for (int i = 0; i < p_points.size(); i++) {