summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/global_constants.cpp1
-rw-r--r--core/os/keyboard.cpp2
-rw-r--r--core/os/keyboard.h1
-rw-r--r--core/os/os.h6
-rw-r--r--core/project_settings.cpp50
-rw-r--r--core/project_settings.h2
-rw-r--r--doc/base/classes.xml27
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp7
-rw-r--r--drivers/unix/os_unix.cpp10
-rw-r--r--drivers/unix/os_unix.h2
-rw-r--r--editor/editor_node.cpp29
-rw-r--r--editor/editor_node.h2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp21
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp22
-rw-r--r--editor/plugins/theme_editor_plugin.cpp59
-rw-r--r--editor/plugins/theme_editor_plugin.h3
-rw-r--r--editor/project_manager.cpp27
-rw-r--r--editor/property_editor.cpp3
-rw-r--r--modules/gdnative/register_types.cpp3
-rw-r--r--modules/nativescript/nativescript.cpp33
-rw-r--r--modules/nativescript/nativescript.h3
-rw-r--r--modules/nativescript/register_types.cpp6
-rw-r--r--platform/iphone/export/export.cpp14
-rw-r--r--platform/osx/os_osx.h1
-rw-r--r--platform/osx/os_osx.mm84
-rw-r--r--platform/windows/os_windows.cpp10
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--platform/x11/key_mapping_x11.cpp1
-rw-r--r--platform/x11/os_x11.cpp2
-rw-r--r--platform/x11/power_x11.cpp11
30 files changed, 292 insertions, 152 deletions
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index 4f535fb05e..18071d7748 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -106,7 +106,6 @@ static _GlobalConstant _global_constants[] = {
BIND_GLOBAL_CONSTANT(KEY_F14),
BIND_GLOBAL_CONSTANT(KEY_F15),
BIND_GLOBAL_CONSTANT(KEY_F16),
- BIND_GLOBAL_CONSTANT(KEY_KP_ENTER),
BIND_GLOBAL_CONSTANT(KEY_KP_MULTIPLY),
BIND_GLOBAL_CONSTANT(KEY_KP_DIVIDE),
BIND_GLOBAL_CONSTANT(KEY_KP_SUBTRACT),
diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp
index 2f5dc03614..e154b1934d 100644
--- a/core/os/keyboard.cpp
+++ b/core/os/keyboard.cpp
@@ -81,7 +81,6 @@ static const _KeyCodeText _keycodes[] = {
{KEY_F14 ,"F14"},
{KEY_F15 ,"F15"},
{KEY_F16 ,"F16"},
- {KEY_KP_ENTER ,"Kp Enter"},
{KEY_KP_MULTIPLY ,"Kp Multiply"},
{KEY_KP_DIVIDE ,"Kp Divide"},
{KEY_KP_SUBTRACT ,"Kp Subtract"},
@@ -334,7 +333,6 @@ bool keycode_has_unicode(uint32_t p_keycode) {
case KEY_F14:
case KEY_F15:
case KEY_F16:
- case KEY_KP_ENTER:
case KEY_SUPER_L:
case KEY_SUPER_R:
case KEY_MENU:
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index 0a72663867..c6985c887d 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -96,7 +96,6 @@ enum KeyList {
KEY_F14 = SPKEY | 0x29,
KEY_F15 = SPKEY | 0x2A,
KEY_F16 = SPKEY | 0x2B,
- KEY_KP_ENTER = SPKEY | 0x80,
KEY_KP_MULTIPLY = SPKEY | 0x81,
KEY_KP_DIVIDE = SPKEY | 0x82,
KEY_KP_SUBTRACT = SPKEY | 0x83,
diff --git a/core/os/os.h b/core/os/os.h
index 957c1d0ba7..703c6a6bcd 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -184,9 +184,9 @@ public:
virtual void set_ime_position(const Point2 &p_pos) {}
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle) { return ERR_UNAVAILABLE; };
- virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; };
- virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle) { return ERR_UNAVAILABLE; };
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle) { return ERR_UNAVAILABLE; }
+ virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; }
+ virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) { return ERR_UNAVAILABLE; }
virtual void set_keep_screen_on(bool p_enabled);
virtual bool is_keep_screen_on() const;
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 0426af3fa0..b31f78ec20 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -455,8 +455,10 @@ Error ProjectSettings::_load_settings(const String p_path) {
memdelete(f);
ERR_FAIL_COND_V(config_version > FORMAT_VERSION, ERR_FILE_CANT_OPEN);
}
+ } else {
+ // config_version is checked and dropped
+ set(section + "/" + assign, value);
}
- set(section + "/" + assign, value);
} else if (next_tag.name != String()) {
section = next_tag.name;
}
@@ -600,6 +602,15 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
ERR_FAIL_COND_V(err, err)
}
+ file->store_line("; Engine configuration file.");
+ file->store_line("; It's best edited using the editor UI and not directly,");
+ file->store_line("; since the parameters that go here are not all obvious.");
+ file->store_line("; ");
+ file->store_line("; Format: ");
+ file->store_line("; [section] ; section goes between []");
+ file->store_line("; param=value ; assign values to parameters");
+ file->store_line("");
+
file->store_string("config_version=" + itos(FORMAT_VERSION) + "\n");
if (p_custom_features != String())
file->store_string("custom_features=\"" + p_custom_features + "\"\n");
@@ -640,38 +651,43 @@ Error ProjectSettings::_save_custom_bnd(const String &p_file) { // add other par
return save_custom(p_file);
};
-Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_custom, const Vector<String> &p_custom_features) {
+Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_custom, const Vector<String> &p_custom_features, bool p_merge_with_current) {
ERR_FAIL_COND_V(p_path == "", ERR_INVALID_PARAMETER);
Set<_VCSort> vclist;
- for (Map<StringName, VariantContainer>::Element *G = props.front(); G; G = G->next()) {
+ if (p_merge_with_current) {
+ for (Map<StringName, VariantContainer>::Element *G = props.front(); G; G = G->next()) {
- const VariantContainer *v = &G->get();
+ const VariantContainer *v = &G->get();
- if (v->hide_from_editor)
- continue;
+ if (v->hide_from_editor)
+ continue;
- if (p_custom.has(G->key()))
- continue;
+ if (p_custom.has(G->key()))
+ continue;
- _VCSort vc;
- vc.name = G->key(); //*k;
- vc.order = v->order;
- vc.type = v->variant.get_type();
- vc.flags = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE;
- if (v->variant == v->initial)
- continue;
+ _VCSort vc;
+ vc.name = G->key(); //*k;
+ vc.order = v->order;
+ vc.type = v->variant.get_type();
+ vc.flags = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE;
+ if (v->variant == v->initial)
+ continue;
- vclist.insert(vc);
+ vclist.insert(vc);
+ }
}
for (const Map<String, Variant>::Element *E = p_custom.front(); E; E = E->next()) {
+ // Lookup global prop to store in the same order
+ Map<StringName, VariantContainer>::Element *global_prop = props.find(E->key());
+
_VCSort vc;
vc.name = E->key();
- vc.order = 0xFFFFFFF;
+ vc.order = global_prop ? global_prop->get().order : 0xFFFFFFF;
vc.type = E->get().get_type();
vc.flags = PROPERTY_USAGE_STORAGE;
vclist.insert(vc);
diff --git a/core/project_settings.h b/core/project_settings.h
index 278d4b8132..c58ac3ca49 100644
--- a/core/project_settings.h
+++ b/core/project_settings.h
@@ -138,7 +138,7 @@ public:
Error setup(const String &p_path, const String &p_main_pack);
- Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>());
+ Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>(), bool p_merge_with_current = true);
Error save();
void set_custom_property_info(const String &p_prop, const PropertyInfo &p_info);
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 4b2f3336cd..058753132e 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -245,7 +245,7 @@
<description>
Returns the floating-point remainder of x/y (rounded towards zero):
[codeblock]
- fmod = x - tquot * y
+ fmod = x - tquot * y
[/codeblock]
Where tquot is the truncated (i.e., rounded towards zero) result of: x/y.
</description>
@@ -957,9 +957,6 @@
<constant name="KEY_F16" value="16777259">
F16 Key
</constant>
- <constant name="KEY_KP_ENTER" value="16777344">
- Enter Key on Numpad
- </constant>
<constant name="KEY_KP_MULTIPLY" value="16777345">
Multiply Key on Numpad
</constant>
@@ -22390,7 +22387,16 @@
<argument index="0" name="rel_vec" type="Vector3">
</argument>
<description>
- Move the body in the given direction, stopping if there is an obstacle. The returned vector is how much movement was remaining before being stopped.
+ Move the body in the given direction, stopping if there is an obstacle. If as a result of a movement there will be any collision then informations about this collision will be in returned dictionary. Dictionary will contains those keys:
+ - "position" - collision position
+ - "normal" - collision normal
+ - "local_shape" - id of this kinematic body shape that took part in a collision
+ - "travel" - traveled movement before being stopped
+ - "remainder" - remaining movement before being stopped
+ - "collider_id" - id of the collider, it can be used when dealing with [PhysicsServer]
+ - "collider" - colliding body
+ - "collider_shape_index" - index of the colliding shape, inside collider body "collider_metadata"
+ If the body did not intersect anything, then an empty dictionary (dir.empty()==true) is returned instead. Please note that this method is less user friendly than [method move_and_slide]. If you don't want to program each edge case manually, then it's recommended to use [method move_and_slide] instead.
</description>
</method>
<method name="move_and_slide">
@@ -22572,7 +22578,16 @@
<argument index="0" name="rel_vec" type="Vector2">
</argument>
<description>
- Move the body in the given direction, stopping if there is an obstacle. The returned vector is how much movement was remaining before being stopped.
+ Move the body in the given direction, stopping if there is an obstacle. If as a result of a movement there will be any collision then informations about this collision will be in returned dictionary. Dictionary will contains those keys:
+ - "position" - collision position
+ - "normal" - collision normal
+ - "local_shape" - id of this kinematic body shape that took part in a collision
+ - "travel" - traveled movement before being stopped
+ - "remainder" - remaining movement before being stopped
+ - "collider_id" - id of the collider, it can be used when dealing with [Physics2DServer]
+ - "collider" - colliding body
+ - "collider_shape_index" - index of the colliding shape, inside collider body "collider_metadata"
+ If the body did not intersect anything, then an empty dictionary (dir.empty()==true) is returned instead. Please note that this method is less user friendly than [method move_and_slide]. If you don't want to program each edge case manually, then it's recommended to use [method move_and_slide] instead.
</description>
</method>
<method name="move_and_slide">
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 2a9f078d8c..89bea1e8cc 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -5999,6 +5999,13 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
static const int msaa_value[] = { 0, 2, 4, 8, 16 };
int msaa = msaa_value[rt->msaa];
+ int max_samples = 0;
+ glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
+ if (msaa > max_samples) {
+ WARN_PRINTS("MSAA must be <= GL_MAX_SAMPLES, falling-back to GL_MAX_SAMPLES = " + itos(max_samples));
+ msaa = max_samples;
+ }
+
//regular fbo
glGenFramebuffers(1, &rt->buffers.fbo);
glBindFramebuffer(GL_FRAMEBUFFER, rt->buffers.fbo);
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index d05529ef9a..e424590881 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -453,7 +453,7 @@ Error OS_Unix::close_dynamic_library(void *p_library_handle) {
return OK;
}
-Error OS_Unix::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle) {
+Error OS_Unix::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional) {
const char *error;
dlerror(); // Clear existing errors
@@ -461,8 +461,12 @@ Error OS_Unix::get_dynamic_library_symbol_handle(void *p_library_handle, const S
error = dlerror();
if (error != NULL) {
- ERR_EXPLAIN("Can't resolve symbol " + p_name + ". Error: " + error);
- ERR_FAIL_V(ERR_CANT_RESOLVE);
+ if (!p_optional) {
+ ERR_EXPLAIN("Can't resolve symbol " + p_name + ". Error: " + error);
+ ERR_FAIL_V(ERR_CANT_RESOLVE);
+ } else {
+ return ERR_CANT_RESOLVE;
+ }
}
return OK;
}
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 953b0f0431..fdc6d6e28f 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -85,7 +85,7 @@ public:
virtual Error open_dynamic_library(const String p_path, void *&p_library_handle);
virtual Error close_dynamic_library(void *p_library_handle);
- virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle);
+ virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false);
virtual Error set_cwd(const String &p_cwd);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 0c47daf5e6..0cdb981306 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1949,7 +1949,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case FILE_CLOSE: {
if (!p_confirmed && (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER)) {
- tab_closing = p_option == FILE_CLOSE ? editor_data.get_edited_scene() : _next_unsaved_scene();
+ tab_closing = p_option == FILE_CLOSE ? editor_data.get_edited_scene() : _next_unsaved_scene(false);
String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename();
save_confirmation->get_ok()->set_text(TTR("Save & Close"));
save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene"));
@@ -2481,7 +2481,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case RUN_PROJECT_MANAGER: {
if (!p_confirmed) {
- if (_next_unsaved_scene() == -1) {
+ bool save_each = EDITOR_DEF("interface/save_each_scene_on_quit", true);
+ if (_next_unsaved_scene(!save_each) == -1) {
bool confirm = EDITOR_DEF("interface/quit_confirmation", true);
if (confirm) {
@@ -2495,21 +2496,16 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
} else {
- bool save_each = EDITOR_DEF("interface/save_each_scene_on_quit", true);
if (save_each) {
_menu_option_confirm(p_option == FILE_QUIT ? FILE_CLOSE_ALL_AND_QUIT : FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER, false);
} else {
String unsaved_scenes;
- for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
- int current = editor_data.get_edited_scene();
- bool unsaved = (i == current) ? saved_version != editor_data.get_undo_redo().get_version() : editor_data.get_scene_version(i) != 0;
- if (unsaved) {
-
- String scene_filename = editor_data.get_edited_scene_root(i)->get_filename();
- unsaved_scenes += "\n " + scene_filename;
- }
+ int i = _next_unsaved_scene(true, 0);
+ while (i != -1) {
+ unsaved_scenes += "\n " + editor_data.get_edited_scene_root(i)->get_filename();
+ i = _next_unsaved_scene(true, ++i);
}
save_confirmation->get_ok()->set_text(TTR("Save & Quit"));
@@ -2522,7 +2518,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
break;
}
- if (_next_unsaved_scene() != -1) {
+ if (_next_unsaved_scene(true) != -1) {
_save_all_scenes();
}
_discard_changes();
@@ -2751,15 +2747,18 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
}
-int EditorNode::_next_unsaved_scene() {
+int EditorNode::_next_unsaved_scene(bool p_valid_filename, int p_start) {
- for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
+ for (int i = p_start; i < editor_data.get_edited_scene_count(); i++) {
if (!editor_data.get_edited_scene_root(i))
continue;
int current = editor_data.get_edited_scene();
bool unsaved = (i == current) ? saved_version != editor_data.get_undo_redo().get_version() : editor_data.get_scene_version(i) != 0;
if (unsaved) {
+ String scene_filename = editor_data.get_edited_scene_root(i)->get_filename();
+ if (p_valid_filename && scene_filename.length() == 0)
+ continue;
return i;
}
}
@@ -2779,7 +2778,7 @@ void EditorNode::_discard_changes(const String &p_str) {
_update_scene_tabs();
if (current_option == FILE_CLOSE_ALL_AND_QUIT || current_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) {
- if (_next_unsaved_scene() == -1) {
+ if (_next_unsaved_scene(false) == -1) {
current_option = current_option == FILE_CLOSE_ALL_AND_QUIT ? FILE_QUIT : RUN_PROJECT_MANAGER;
_discard_changes();
} else {
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 6553d3eee2..a440aaa1e6 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -464,7 +464,7 @@ private:
void _save_scene(String p_file, int idx = -1);
void _save_all_scenes();
- int _next_unsaved_scene();
+ int _next_unsaved_scene(bool p_valid_filename, int p_start = 0);
void _discard_changes(const String &p_str = String());
void _instance_request(const Vector<String> &p_files);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 4c4cd88dfb..a809a68c23 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -176,7 +176,6 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2 &mouse_pos) {
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
Node2D *n2d = E->get()->cast_to<Node2D>();
-
if (n2d && n2d->edit_has_pivot()) {
Vector2 offset = n2d->edit_get_pivot();
@@ -1736,11 +1735,9 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
Ref<InputEventKey> k = p_event;
-
if (k.is_valid()) {
-
if (k->is_pressed() && drag == DRAG_NONE) {
-
+ // Move the object with the arrow keys
KeyMoveMODE move_mode = MOVE_VIEW_BASE;
if (k->get_alt()) move_mode = MOVE_LOCAL_BASE;
if (k->get_control() || k->get_metakey()) move_mode = MOVE_LOCAL_WITH_ROT;
@@ -1773,13 +1770,23 @@ void CanvasItemEditor::_viewport_draw() {
RID ci = viewport->get_canvas_item();
if (snap_show_grid) {
+ //Draw the grid
Size2 s = viewport->get_size();
int last_cell;
Transform2D xform = transform.affine_inverse();
+ Vector2 grid_offset;
+ if (snap_relative && snap_grid && get_item_count() > 0) {
+ Vector2 topleft = _find_topleftmost_point();
+ grid_offset.x = fmod(topleft.x, snap_step.x);
+ grid_offset.y = fmod(topleft.y, snap_step.y);
+ } else {
+ grid_offset = snap_offset;
+ }
+
if (snap_step.x != 0) {
for (int i = 0; i < s.width; i++) {
- int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(i, 0)).x - snap_offset.x) / snap_step.x));
+ int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(i, 0)).x - grid_offset.x) / snap_step.x));
if (i == 0)
last_cell = cell;
if (last_cell != cell)
@@ -1790,7 +1797,7 @@ void CanvasItemEditor::_viewport_draw() {
if (snap_step.y != 0) {
for (int i = 0; i < s.height; i++) {
- int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(0, i)).y - snap_offset.y) / snap_step.y));
+ int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(0, i)).y - grid_offset.y) / snap_step.y));
if (i == 0)
last_cell = cell;
if (last_cell != cell)
@@ -2383,6 +2390,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
snap_grid = !snap_grid;
int idx = edit_menu->get_popup()->get_item_index(SNAP_USE);
edit_menu->get_popup()->set_item_checked(idx, snap_grid);
+ viewport->update();
} break;
case SNAP_SHOW_GRID: {
snap_show_grid = !snap_show_grid;
@@ -2399,6 +2407,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
snap_relative = !snap_relative;
int idx = edit_menu->get_popup()->get_item_index(SNAP_RELATIVE);
edit_menu->get_popup()->set_item_checked(idx, snap_relative);
+ viewport->update();
} break;
case SNAP_USE_PIXEL: {
snap_pixel = !snap_pixel;
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index ef7ed5f7f6..c31e11cc38 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -1563,13 +1563,13 @@ void SpatialEditorViewport::_update_freelook(real_t delta) {
Vector3 right = camera->get_transform().basis.xform(Vector3(1, 0, 0));
Vector3 up = camera->get_transform().basis.xform(Vector3(0, 1, 0));
- int key_left = ED_SHORTCUT("spatial_editor/freelook_left", TTR("Freelook Left"), KEY_A)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_right = ED_SHORTCUT("spatial_editor/freelook_right", TTR("Freelook Right"), KEY_D)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_forward = ED_SHORTCUT("spatial_editor/freelook_forward", TTR("Freelook Forward"), KEY_W)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_backwards = ED_SHORTCUT("spatial_editor/freelook_backwards", TTR("Freelook Backwards"), KEY_S)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_up = ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), KEY_Q)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_down = ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), KEY_E)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
- int key_speed_modifier = ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), KEY_SHIFT)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_left = ED_GET_SHORTCUT("spatial_editor/freelook_left")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_right = ED_GET_SHORTCUT("spatial_editor/freelook_right")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_forward = ED_GET_SHORTCUT("spatial_editor/freelook_forward")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_backwards = ED_GET_SHORTCUT("spatial_editor/freelook_backwards")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_up = ED_GET_SHORTCUT("spatial_editor/freelook_up")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_down = ED_GET_SHORTCUT("spatial_editor/freelook_down")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_speed_modifier = ED_GET_SHORTCUT("spatial_editor/freelook_speed_modifier")->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
Vector3 velocity;
bool pressed = false;
@@ -2424,6 +2424,14 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/align_selection_with_view"), VIEW_ALIGN_SELECTION_WITH_VIEW);
view_menu->get_popup()->connect("id_pressed", this, "_menu_option");
+ ED_SHORTCUT("spatial_editor/freelook_left", TTR("Freelook Left"), KEY_A);
+ ED_SHORTCUT("spatial_editor/freelook_right", TTR("Freelook Right"), KEY_D);
+ ED_SHORTCUT("spatial_editor/freelook_forward", TTR("Freelook Forward"), KEY_W);
+ ED_SHORTCUT("spatial_editor/freelook_backwards", TTR("Freelook Backwards"), KEY_S);
+ ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), KEY_Q);
+ ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), KEY_E);
+ ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), KEY_SHIFT);
+
preview_camera = memnew(Button);
preview_camera->set_toggle_mode(true);
preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, 90);
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index a83ea70508..f5bb9d4a35 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -493,11 +493,10 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
Ref<Theme> base_theme;
- type_select->show();
- type_select_label->show();
name_select_label->show();
- name_edit->show();
- name_menu->show();
+ name_hbc->show();
+ type_select_label->show();
+ type_select->show();
if (p_option == POPUP_ADD) { //add
@@ -515,11 +514,10 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
base_theme = Theme::get_default();
- type_select->hide();
name_select_label->hide();
+ name_hbc->hide();
type_select_label->hide();
- name_edit->hide();
- name_menu->hide();
+ type_select->hide();
} else if (p_option == POPUP_REMOVE) {
@@ -537,11 +535,10 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
base_theme = Theme::get_default();
- type_select->hide();
name_select_label->hide();
+ name_hbc->hide();
type_select_label->hide();
- name_edit->hide();
- name_menu->hide();
+ type_select->hide();
}
popup_mode = p_option;
@@ -832,48 +829,46 @@ ThemeEditor::ThemeEditor() {
add_del_dialog->hide();
add_child(add_del_dialog);
+ VBoxContainer *dialog_vbc = memnew(VBoxContainer);
+ add_del_dialog->add_child(dialog_vbc);
+
Label *l = memnew(Label);
- l->set_position(Point2(5, 5) * EDSCALE);
l->set_text(TTR("Type:"));
- add_del_dialog->add_child(l);
- dtype_select_label = l;
+ dialog_vbc->add_child(l);
+
+ type_hbc = memnew(HBoxContainer);
+ dialog_vbc->add_child(type_hbc);
type_edit = memnew(LineEdit);
- type_edit->set_position(Point2(5, 25) * EDSCALE);
- type_edit->set_size(Point2(150, 5) * EDSCALE);
- add_del_dialog->add_child(type_edit);
+ type_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ type_hbc->add_child(type_edit);
type_menu = memnew(MenuButton);
- type_menu->set_position(Point2(160, 25) * EDSCALE);
- type_menu->set_size(Point2(30, 5) * EDSCALE);
type_menu->set_text("..");
- add_del_dialog->add_child(type_menu);
+ type_hbc->add_child(type_menu);
type_menu->get_popup()->connect("id_pressed", this, "_type_menu_cbk");
l = memnew(Label);
- l->set_position(Point2(200, 5) * EDSCALE);
l->set_text(TTR("Name:"));
- add_del_dialog->add_child(l);
+ dialog_vbc->add_child(l);
name_select_label = l;
+ name_hbc = memnew(HBoxContainer);
+ dialog_vbc->add_child(name_hbc);
+
name_edit = memnew(LineEdit);
- name_edit->set_position(Point2(200, 25) * EDSCALE);
- name_edit->set_size(Point2(150, 5) * EDSCALE);
- add_del_dialog->add_child(name_edit);
+ name_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ name_hbc->add_child(name_edit);
name_menu = memnew(MenuButton);
- name_menu->set_position(Point2(360, 25) * EDSCALE);
- name_menu->set_size(Point2(30, 5) * EDSCALE);
name_menu->set_text("..");
-
- add_del_dialog->add_child(name_menu);
+ name_hbc->add_child(name_menu);
name_menu->get_popup()->connect("about_to_show", this, "_name_menu_about_to_show");
name_menu->get_popup()->connect("id_pressed", this, "_name_menu_cbk");
type_select_label = memnew(Label);
- type_select_label->set_position(Point2(400, 5) * EDSCALE);
type_select_label->set_text(TTR("Data Type:"));
- add_del_dialog->add_child(type_select_label);
+ dialog_vbc->add_child(type_select_label);
type_select = memnew(OptionButton);
type_select->add_item(TTR("Icon"));
@@ -881,10 +876,8 @@ ThemeEditor::ThemeEditor() {
type_select->add_item(TTR("Font"));
type_select->add_item(TTR("Color"));
type_select->add_item(TTR("Constant"));
- type_select->set_position(Point2(400, 25) * EDSCALE);
- type_select->set_size(Point2(80, 5) * EDSCALE);
- add_del_dialog->add_child(type_select);
+ dialog_vbc->add_child(type_select);
add_del_dialog->get_ok()->connect("pressed", this, "_dialog_cbk");
diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h
index 6db01c6246..a75b83e76a 100644
--- a/editor/plugins/theme_editor_plugin.h
+++ b/editor/plugins/theme_editor_plugin.h
@@ -54,14 +54,15 @@ class ThemeEditor : public Control {
MenuButton *theme_menu;
ConfirmationDialog *add_del_dialog;
+ HBoxContainer *type_hbc;
MenuButton *type_menu;
LineEdit *type_edit;
+ HBoxContainer *name_hbc;
MenuButton *name_menu;
LineEdit *name_edit;
OptionButton *type_select;
Label *type_select_label;
Label *name_select_label;
- Label *dtype_select_label;
enum PopupMode {
POPUP_ADD,
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index acf5fe02cc..82f17b80d5 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -187,30 +187,17 @@ private:
} else {
if (mode == MODE_NEW) {
- FileAccess *f = FileAccess::open(dir.plus_file("/project.godot"), FileAccess::WRITE);
- if (!f) {
+ ProjectSettings::CustomMap initial_settings;
+ initial_settings["application/config/name"] = project_name->get_text();
+ initial_settings["application/config/icon"] = "res://icon.png";
+ initial_settings["rendering/environment/default_environment"] = "res://default_env.tres";
+
+ if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("/project.godot"), initial_settings, Vector<String>(), false)) {
error->set_text(TTR("Couldn't create project.godot in project path."));
} else {
-
- f->store_line("; Engine configuration file.");
- f->store_line("; It's best edited using the editor UI and not directly,");
- f->store_line("; since the parameters that go here are not all obvious.");
- f->store_line("; ");
- f->store_line("; Format: ");
- f->store_line("; [section] ; section goes between []");
- f->store_line("; param=value ; assign values to parameters");
- f->store_line("\n");
- f->store_line("[application]");
- f->store_line("\n");
- f->store_line("config/name=\"" + project_name->get_text() + "\"");
- f->store_line("config/icon=\"res://icon.png\"");
- f->store_line("[rendering]");
- f->store_line("environment/default_environment=\"res://default_env.tres\"");
- memdelete(f);
-
ResourceSaver::save(dir.plus_file("/icon.png"), get_icon("DefaultProjectIcon", "EditorIcons"));
- f = FileAccess::open(dir.plus_file("/default_env.tres"), FileAccess::WRITE);
+ FileAccess *f = FileAccess::open(dir.plus_file("/default_env.tres"), FileAccess::WRITE);
if (!f) {
error->set_text(TTR("Couldn't create project.godot in project path."));
} else {
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index c2af2445cc..71afa8ac79 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -2199,6 +2199,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p
case Variant::BOOL: {
p_item->set_checked(1, obj->get(p_name));
+ p_item->set_text(1, obj->get(p_name) ? TTR("On") : TTR("Off"));
} break;
case Variant::REAL:
case Variant::INT: {
@@ -3141,7 +3142,7 @@ void PropertyEditor::update_tree() {
case Variant::BOOL: {
item->set_cell_mode(1, TreeItem::CELL_MODE_CHECK);
- item->set_text(1, TTR("On"));
+ item->set_text(1, obj->get(p.name) ? TTR("On") : TTR("Off"));
item->set_tooltip(1, obj->get(p.name) ? "True" : "False");
item->set_checked(1, obj->get(p.name));
if (show_type_icons)
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 20ac1ecc0c..d180d5aada 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -47,7 +47,8 @@ godot_variant cb_standard_varcall(void *handle, godot_string *p_procedure, godot
Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
handle,
*(String *)p_procedure,
- library_proc);
+ library_proc,
+ true); // we roll our own message
if (err != OK) {
ERR_PRINT((String("GDNative procedure \"" + *(String *)p_procedure) + "\" does not exists and can't be called").utf8().get_data());
godot_variant ret;
diff --git a/modules/nativescript/nativescript.cpp b/modules/nativescript/nativescript.cpp
index 271f5bde1c..c4cbfcce51 100644
--- a/modules/nativescript/nativescript.cpp
+++ b/modules/nativescript/nativescript.cpp
@@ -203,7 +203,21 @@ ScriptInstance *NativeScript::instance_create(Object *p_this) {
nsi->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data);
#endif
+#ifndef NO_THREADS
+ owners_lock->lock();
+#endif
+
instance_owners.insert(p_this);
+
+#ifndef NO_THREADS
+ owners_lock->unlock();
+#endif
+
+ // try to call _init
+ // we don't care if it doesn't exist, so we ignore errors.
+ Variant::CallError err;
+ call("_init", NULL, 0, err);
+
return nsi;
}
@@ -393,9 +407,6 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Variant::Call
ref = REF(r);
}
- // GDScript does it like this: _create_instance(p_args, p_argcount, owner, r != NULL, r_error);
- // TODO(karroffel): support varargs for constructors.
-
NativeScriptInstance *instance = (NativeScriptInstance *)instance_create(owner);
owner->set_script_instance(instance);
@@ -419,11 +430,18 @@ NativeScript::NativeScript() {
library = Ref<GDNative>();
lib_path = "";
class_name = "";
+#ifndef NO_THREADS
+ owners_lock = Mutex::create();
+#endif
}
// TODO(karroffel): implement this
NativeScript::~NativeScript() {
NSL->unregister_script(this);
+
+#ifndef NO_THREADS
+ memdelete(owners_lock);
+#endif
}
////// ScriptInstance stuff
@@ -754,7 +772,16 @@ NativeScriptInstance::~NativeScriptInstance() {
script_data->destroy_func.destroy_func((godot_object *)owner, script_data->destroy_func.method_data, userdata);
if (owner) {
+
+#ifndef NO_THREADS
+ script->owners_lock->lock();
+#endif
+
script->instance_owners.erase(owner);
+
+#ifndef NO_THREADS
+ script->owners_lock->unlock();
+#endif
}
}
diff --git a/modules/nativescript/nativescript.h b/modules/nativescript/nativescript.h
index 05e2d361d3..95b4954171 100644
--- a/modules/nativescript/nativescript.h
+++ b/modules/nativescript/nativescript.h
@@ -106,6 +106,9 @@ class NativeScript : public Script {
String class_name;
+#ifndef NO_THREADS
+ Mutex *owners_lock;
+#endif
Set<Object *> instance_owners;
protected:
diff --git a/modules/nativescript/register_types.cpp b/modules/nativescript/register_types.cpp
index a8a931343b..dfa16d8a2a 100644
--- a/modules/nativescript/register_types.cpp
+++ b/modules/nativescript/register_types.cpp
@@ -50,7 +50,8 @@ void init_call_cb(void *p_handle, godot_string *p_proc_name, void *p_data, int p
Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
p_handle,
*(String *)p_proc_name,
- library_proc);
+ library_proc,
+ true); // we print our own message
if (err != OK) {
ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
return;
@@ -75,7 +76,8 @@ void thread_call_cb(void *p_handle, godot_string *p_proc_name, void *p_data, int
Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
p_handle,
*(String *)p_proc_name,
- library_proc);
+ library_proc,
+ true);
if (err != OK) {
// it's fine if thread callbacks are not present in the library.
return;
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index a5efae8678..6ae2a0692d 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -80,7 +80,15 @@ public:
void EditorExportPlatformIOS::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
- // what does this need to do?
+ if (p_preset->get("texture_format/s3tc")) {
+ r_features->push_back("s3tc");
+ }
+ if (p_preset->get("texture_format/etc")) {
+ r_features->push_back("etc");
+ }
+ if (p_preset->get("texture_format/etc2")) {
+ r_features->push_back("etc2");
+ }
}
void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options) {
@@ -98,6 +106,10 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/copyright"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/bits_mode", PROPERTY_HINT_ENUM, "Fat (32 & 64 bits),64 bits,32 bits"), 1));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), false));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), true));
+
/* probably need some more info */
}
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 44f4334786..fc80088846 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -105,7 +105,6 @@ public:
Vector<int> screen_dpi;
Size2 window_size;
- int current_screen;
Rect2 restore_rect;
power_osx *power_manager;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 82c1313326..fce38b6a8b 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -152,6 +152,16 @@ static bool mouse_down_control = false;
return NO;
}
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+- (void)windowDidEnterFullScreen:(NSNotification *)notification {
+ OS_OSX::singleton->zoomed = true;
+}
+
+- (void)windowDidExitFullScreen:(NSNotification *)notification {
+ OS_OSX::singleton->zoomed = false;
+}
+#endif // MAC_OS_X_VERSION_MAX_ALLOWED
+
- (void)windowDidResize:(NSNotification *)notification {
[OS_OSX::singleton->context update];
@@ -161,6 +171,12 @@ static bool mouse_down_control = false;
OS_OSX::singleton->window_size.width = fbRect.size.width * OS_OSX::singleton->display_scale;
OS_OSX::singleton->window_size.height = fbRect.size.height * OS_OSX::singleton->display_scale;
+ if (OS_OSX::singleton->main_loop) {
+ Main::force_redraw();
+ //Event retrieval blocks until resize is over. Call Main::iteration() directly.
+ Main::iteration();
+ }
+
/*
_GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
_GodotInputWindowSize(window, contentRect.size.width, contentRect.size.height);
@@ -512,7 +528,7 @@ static int translateKey(unsigned int key) {
/* 49 */ KEY_UNKNOWN, /* VolumeDown */
/* 4a */ KEY_UNKNOWN, /* Mute */
/* 4b */ KEY_KP_DIVIDE,
- /* 4c */ KEY_KP_ENTER,
+ /* 4c */ KEY_ENTER,
/* 4d */ KEY_UNKNOWN,
/* 4e */ KEY_KP_SUBTRACT,
/* 4f */ KEY_UNKNOWN,
@@ -1233,13 +1249,21 @@ int OS_OSX::get_screen_count() const {
};
int OS_OSX::get_current_screen() const {
-
- return current_screen;
+ Vector2 wpos = get_window_position();
+
+ int count = get_screen_count();
+ for (int i = 0; i < count; i++) {
+ Point2 pos = get_screen_position(i);
+ Size2 size = get_screen_size(i);
+ if ((wpos.x >= pos.x && wpos.x < pos.x + size.width) && (wpos.y >= pos.y && wpos.y < pos.y + size.height))
+ return i;
+ }
+ return 0;
};
void OS_OSX::set_current_screen(int p_screen) {
-
- current_screen = p_screen;
+ Vector2 wpos = get_window_position() - get_screen_position(get_current_screen());
+ set_window_position(wpos + get_screen_position(p_screen));
};
Point2 OS_OSX::get_screen_position(int p_screen) const {
@@ -1383,7 +1407,7 @@ void OS_OSX::set_window_maximized(bool p_enabled) {
if (p_enabled) {
restore_rect = Rect2(get_window_position(), get_window_size());
- [window_object setFrame:[[[NSScreen screens] objectAtIndex:current_screen] visibleFrame] display:YES];
+ [window_object setFrame:[[[NSScreen screens] objectAtIndex:get_current_screen()] visibleFrame] display:YES];
} else {
set_window_size(restore_rect.size);
set_window_position(restore_rect.position);
@@ -1661,12 +1685,52 @@ OS_OSX::OS_OSX() {
// In case we are unbundled, make us a proper UI application
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
-#if 0
// Menu bar setup must go between sharedApplication above and
// finishLaunching below, in order to properly emulate the behavior
// of NSApplicationMain
- createMenuBar();
-#endif
+ NSMenuItem *menu_item;
+ NSString *title;
+
+ NSString *nsappname = [[[NSBundle mainBundle] performSelector:@selector(localizedInfoDictionary)] objectForKey:@"CFBundleName"];
+ if (nsappname == nil)
+ nsappname = [[NSProcessInfo processInfo] processName];
+
+ // Setup Apple menu
+ NSMenu *apple_menu = [[NSMenu alloc] initWithTitle:@""];
+ title = [NSString stringWithFormat:NSLocalizedString(@"About %@", nil), nsappname];
+ [apple_menu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
+
+ [apple_menu addItem:[NSMenuItem separatorItem]];
+
+ NSMenu *services = [[NSMenu alloc] initWithTitle:@""];
+ menu_item = [apple_menu addItemWithTitle:NSLocalizedString(@"Services", nil) action:nil keyEquivalent:@""];
+ [apple_menu setSubmenu:services forItem:menu_item];
+ [NSApp setServicesMenu:services];
+ [services release];
+
+ [apple_menu addItem:[NSMenuItem separatorItem]];
+
+ title = [NSString stringWithFormat:NSLocalizedString(@"Hide %@", nil), nsappname];
+ [apple_menu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
+
+ menu_item = [apple_menu addItemWithTitle:NSLocalizedString(@"Hide Others", nil) action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
+ [menu_item setKeyEquivalentModifierMask:(NSAlternateKeyMask | NSCommandKeyMask)];
+
+ [apple_menu addItemWithTitle:NSLocalizedString(@"Show all", nil) action:@selector(unhideAllApplications:) keyEquivalent:@""];
+
+ [apple_menu addItem:[NSMenuItem separatorItem]];
+
+ title = [NSString stringWithFormat:NSLocalizedString(@"Quit %@", nil), nsappname];
+ [apple_menu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
+
+ // Setup menu bar
+ NSMenu *main_menu = [[NSMenu alloc] initWithTitle:@""];
+ menu_item = [main_menu addItemWithTitle:@"" action:nil keyEquivalent:@""];
+ [main_menu setSubmenu:apple_menu forItem:menu_item];
+ [NSApp setMainMenu:main_menu];
+
+ [main_menu release];
+ [apple_menu release];
[NSApp finishLaunching];
@@ -1676,8 +1740,6 @@ OS_OSX::OS_OSX() {
cursor_shape = CURSOR_ARROW;
- current_screen = 0;
-
maximized = false;
minimized = false;
window_size = Vector2(1024, 600);
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 3413050f4a..c091c7d022 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1569,12 +1569,16 @@ Error OS_Windows::close_dynamic_library(void *p_library_handle) {
return OK;
}
-Error OS_Windows::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle) {
+Error OS_Windows::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional) {
char *error;
p_symbol_handle = (void *)GetProcAddress((HMODULE)p_library_handle, p_name.utf8().get_data());
if (!p_symbol_handle) {
- ERR_EXPLAIN("Can't resolve symbol " + p_name + ". Error: " + String::num(GetLastError()));
- ERR_FAIL_V(ERR_CANT_RESOLVE);
+ if (!p_optional) {
+ ERR_EXPLAIN("Can't resolve symbol " + p_name + ". Error: " + String::num(GetLastError()));
+ ERR_FAIL_V(ERR_CANT_RESOLVE);
+ } else {
+ return ERR_CANT_RESOLVE;
+ }
}
return OK;
}
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index e6589ddfad..6856e7e9b8 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -227,7 +227,7 @@ public:
virtual Error open_dynamic_library(const String p_path, void *&p_library_handle);
virtual Error close_dynamic_library(void *p_library_handle);
- virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle);
+ virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false);
virtual MainLoop *get_main_loop() const;
diff --git a/platform/x11/key_mapping_x11.cpp b/platform/x11/key_mapping_x11.cpp
index 362fc3618a..1d7eb1692c 100644
--- a/platform/x11/key_mapping_x11.cpp
+++ b/platform/x11/key_mapping_x11.cpp
@@ -94,7 +94,6 @@ static _XTranslatePair _xkeysym_to_keycode[] = {
//{ XK_KP_Separator, KEY_COMMA },
{ XK_KP_Decimal, KEY_KP_PERIOD },
{ XK_KP_Delete, KEY_KP_PERIOD },
- { XK_KP_Enter, KEY_KP_ENTER },
{ XK_KP_Multiply, KEY_KP_MULTIPLY },
{ XK_KP_Divide, KEY_KP_DIVIDE },
{ XK_KP_Subtract, KEY_KP_SUBTRACT },
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 5bfe31b8c2..1dde328eda 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -497,6 +497,8 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
joypad = memnew(JoypadLinux(input));
#endif
_ensure_data_dir();
+
+ power_manager = memnew(PowerX11);
}
void OS_X11::xim_destroy_callback(::XIM im, ::XPointer client_data,
diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp
index 093d24f406..8e69a2223f 100644
--- a/platform/x11/power_x11.cpp
+++ b/platform/x11/power_x11.cpp
@@ -171,25 +171,18 @@ void PowerX11::check_proc_acpi_battery(const char *node, bool *have_battery, boo
charge = true;
}
} else if (String(key) == "remaining capacity") {
- char *endptr = NULL;
- //const int cvt = (int) strtol(val, &endptr, 10);
String sval = val;
const int cvt = sval.to_int();
- if (*endptr == ' ') {
- remaining = cvt;
- }
+ remaining = cvt;
}
}
ptr = &info[0];
while (make_proc_acpi_key_val(&ptr, &key, &val)) {
if (String(key) == "design capacity") {
- char *endptr = NULL;
String sval = val;
const int cvt = sval.to_int();
- if (*endptr == ' ') {
- maximum = cvt;
- }
+ maximum = cvt;
}
}