summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/script_language.cpp22
-rw-r--r--core/script_language.h1
-rw-r--r--editor/editor_help_search.cpp18
-rw-r--r--editor/editor_help_search.h1
-rw-r--r--editor/editor_settings.cpp2
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp8
-rw-r--r--editor/scene_tree_editor.cpp43
-rw-r--r--editor/scene_tree_editor.h2
-rw-r--r--editor/script_editor_debugger.cpp12
-rw-r--r--modules/gdscript/gdscript_parser.cpp12
-rw-r--r--modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs6
-rw-r--r--platform/osx/os_osx.mm65
12 files changed, 114 insertions, 78 deletions
diff --git a/core/script_language.cpp b/core/script_language.cpp
index f0310ffc31..1c244661b0 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -409,6 +409,11 @@ bool PlaceHolderScriptInstance::get(const StringName &p_name, Variant &r_ret) co
return true;
}
+ if (constants.has(p_name)) {
+ r_ret = constants[p_name];
+ return true;
+ }
+
if (!script->is_placeholder_fallback_enabled()) {
Variant defval;
if (script->get_property_default_value(p_name, defval)) {
@@ -444,6 +449,13 @@ Variant::Type PlaceHolderScriptInstance::get_property_type(const StringName &p_n
*r_is_valid = true;
return values[p_name].get_type();
}
+
+ if (constants.has(p_name)) {
+ if (r_is_valid)
+ *r_is_valid = true;
+ return constants[p_name].get_type();
+ }
+
if (r_is_valid)
*r_is_valid = false;
@@ -513,6 +525,9 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c
owner->_change_notify();
}
//change notify
+
+ constants.clear();
+ script->get_constants(&constants);
}
void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid) {
@@ -552,6 +567,13 @@ Variant PlaceHolderScriptInstance::property_get_fallback(const StringName &p_nam
*r_valid = true;
return E->value();
}
+
+ E = constants.find(p_name);
+ if (E) {
+ if (r_valid)
+ *r_valid = true;
+ return E->value();
+ }
}
if (r_valid)
diff --git a/core/script_language.h b/core/script_language.h
index 2d35097692..65fb0f0268 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -336,6 +336,7 @@ class PlaceHolderScriptInstance : public ScriptInstance {
Object *owner;
List<PropertyInfo> properties;
Map<StringName, Variant> values;
+ Map<StringName, Variant> constants;
ScriptLanguage *language;
Ref<Script> script;
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index 21cddc8ca4..616a52e25b 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -45,21 +45,6 @@ void EditorHelpSearch::_update_icons() {
_update_results();
}
-void EditorHelpSearch::_load_settings() {
-
- bool enable_rl = EditorSettings::get_singleton()->get("docks/scene_tree/draw_relationship_lines");
- Color rl_color = EditorSettings::get_singleton()->get("docks/scene_tree/relationship_line_color");
-
- if (enable_rl) {
- results_tree->add_constant_override("draw_relationship_lines", 1);
- results_tree->add_color_override("relationship_line_color", rl_color);
- results_tree->add_constant_override("draw_guides", 0);
- } else {
- results_tree->add_constant_override("draw_relationship_lines", 0);
- results_tree->add_constant_override("draw_guides", 1);
- }
-}
-
void EditorHelpSearch::_update_results() {
String term = search_box->get_text();
@@ -120,7 +105,6 @@ void EditorHelpSearch::_notification(int p_what) {
switch (p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
- _load_settings();
_update_icons();
} break;
case NOTIFICATION_ENTER_TREE: {
@@ -264,8 +248,6 @@ EditorHelpSearch::EditorHelpSearch() {
results_tree->connect("item_activated", this, "_confirmed");
results_tree->connect("item_selected", get_ok(), "set_disabled", varray(false));
vbox->add_child(results_tree, true);
-
- _load_settings();
}
bool EditorHelpSearch::Runner::_slice() {
diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h
index e74bfdc5b6..93cf66a0dd 100644
--- a/editor/editor_help_search.h
+++ b/editor/editor_help_search.h
@@ -64,7 +64,6 @@ class EditorHelpSearch : public ConfirmationDialog {
Ref<Runner> search;
void _update_icons();
- void _load_settings();
void _update_results();
void _search_box_gui_input(const Ref<InputEvent> &p_event);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index aa2b52617d..8d590e5268 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -392,8 +392,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// SceneTree
_initial_set("docks/scene_tree/start_create_dialog_fully_expanded", false);
- _initial_set("docks/scene_tree/draw_relationship_lines", true);
- _initial_set("docks/scene_tree/relationship_line_color", Color::html("464646"));
// FileSystem
_initial_set("docks/filesystem/thumbnail_size", 64);
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 5b54384ee0..dc099b84a7 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -2460,10 +2460,12 @@ void TileSetEditor::draw_polygon_shapes() {
workspace->draw_polygon(polygon, colors);
if (!creating_shape) {
- for (int j = 0; j < polygon.size() - 1; j++) {
- workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1, true);
+ if (polygon.size() > 1) {
+ for (int j = 0; j < polygon.size() - 1; j++) {
+ workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1, true);
+ }
+ workspace->draw_line(polygon[polygon.size() - 1], polygon[0], c_border, 1, true);
}
- workspace->draw_line(polygon[polygon.size() - 1], polygon[0], c_border, 1, true);
}
if (shape == edited_occlusion_shape) {
draw_handles = true;
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 4c23ae437b..8cfc6d4e8e 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -549,32 +549,28 @@ void SceneTreeEditor::_cell_multi_selected(Object *p_object, int p_cell, bool p_
void SceneTreeEditor::_notification(int p_what) {
- if (p_what == NOTIFICATION_ENTER_TREE) {
-
- get_tree()->connect("tree_changed", this, "_tree_changed");
- get_tree()->connect("node_removed", this, "_node_removed");
- get_tree()->connect("node_configuration_warning_changed", this, "_warning_changed");
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
- tree->connect("item_collapsed", this, "_cell_collapsed");
+ get_tree()->connect("tree_changed", this, "_tree_changed");
+ get_tree()->connect("node_removed", this, "_node_removed");
+ get_tree()->connect("node_configuration_warning_changed", this, "_warning_changed");
- EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed");
- _editor_settings_changed();
+ tree->connect("item_collapsed", this, "_cell_collapsed");
- //get_scene()->connect("tree_changed",this,"_tree_changed",Vector<Variant>(),CONNECT_DEFERRED);
- //get_scene()->connect("node_removed",this,"_node_removed",Vector<Variant>(),CONNECT_DEFERRED);
- _update_tree();
- }
- if (p_what == NOTIFICATION_EXIT_TREE) {
+ _update_tree();
+ } break;
+ case NOTIFICATION_EXIT_TREE: {
- get_tree()->disconnect("tree_changed", this, "_tree_changed");
- get_tree()->disconnect("node_removed", this, "_node_removed");
- tree->disconnect("item_collapsed", this, "_cell_collapsed");
- get_tree()->disconnect("node_configuration_warning_changed", this, "_warning_changed");
- EditorSettings::get_singleton()->disconnect("settings_changed", this, "_editor_settings_changed");
- }
- if (p_what == NOTIFICATION_THEME_CHANGED) {
+ get_tree()->disconnect("tree_changed", this, "_tree_changed");
+ get_tree()->disconnect("node_removed", this, "_node_removed");
+ tree->disconnect("item_collapsed", this, "_cell_collapsed");
+ get_tree()->disconnect("node_configuration_warning_changed", this, "_warning_changed");
+ } break;
+ case NOTIFICATION_THEME_CHANGED: {
- _update_tree();
+ _update_tree();
+ } break;
}
}
@@ -978,9 +974,6 @@ void SceneTreeEditor::_warning_changed(Node *p_for_node) {
update_timer->start();
}
-void SceneTreeEditor::_editor_settings_changed() {
-}
-
void SceneTreeEditor::_bind_methods() {
ClassDB::bind_method("_tree_changed", &SceneTreeEditor::_tree_changed);
@@ -1001,8 +994,6 @@ void SceneTreeEditor::_bind_methods() {
ClassDB::bind_method("_node_script_changed", &SceneTreeEditor::_node_script_changed);
ClassDB::bind_method("_node_visibility_changed", &SceneTreeEditor::_node_visibility_changed);
- ClassDB::bind_method("_editor_settings_changed", &SceneTreeEditor::_editor_settings_changed);
-
ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &SceneTreeEditor::get_drag_data_fw);
ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &SceneTreeEditor::can_drop_data_fw);
ClassDB::bind_method(D_METHOD("drop_data_fw"), &SceneTreeEditor::drop_data_fw);
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index 9b87c0981d..aa4d4dd58a 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -124,8 +124,6 @@ class SceneTreeEditor : public Control {
void _warning_changed(Node *p_for_node);
- void _editor_settings_changed();
-
Timer *update_timer;
List<StringName> *script_types;
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index ddb7f065aa..dda46d2414 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1215,24 +1215,15 @@ void ScriptEditorDebugger::_notification(int p_what) {
if (OS::get_singleton()->get_ticks_msec() > until)
break;
}
-
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+
tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles"));
tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles"));
tabs->set_margin(MARGIN_LEFT, -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT));
tabs->set_margin(MARGIN_RIGHT, EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT));
- bool enable_rl = EditorSettings::get_singleton()->get("docks/scene_tree/draw_relationship_lines");
- Color rl_color = EditorSettings::get_singleton()->get("docks/scene_tree/relationship_line_color");
-
- if (enable_rl) {
- inspect_scene_tree->add_constant_override("draw_relationship_lines", 1);
- inspect_scene_tree->add_color_override("relationship_line_color", rl_color);
- } else
- inspect_scene_tree->add_constant_override("draw_relationship_lines", 0);
-
copy->set_icon(get_icon("ActionCopy", "EditorIcons"));
step->set_icon(get_icon("DebugStep", "EditorIcons"));
next->set_icon(get_icon("DebugNext", "EditorIcons"));
@@ -1241,7 +1232,6 @@ void ScriptEditorDebugger::_notification(int p_what) {
dobreak->set_icon(get_icon("Pause", "EditorIcons"));
docontinue->set_icon(get_icon("DebugContinue", "EditorIcons"));
vmem_refresh->set_icon(get_icon("Reload", "EditorIcons"));
-
} break;
}
}
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 5619729c13..f005f88d2e 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -815,6 +815,16 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
if (!dependencies_only) {
+ if (!bfn && ScriptServer::is_global_class(identifier)) {
+ Ref<Script> scr = ResourceLoader::load(ScriptServer::get_global_class_path(identifier));
+ if (scr.is_valid() && scr->is_valid()) {
+ ConstantNode *constant = alloc_node<ConstantNode>();
+ constant->value = scr;
+ expr = constant;
+ bfn = true;
+ }
+ }
+
// Check parents for the constant
if (!bfn && cln->extends_file != StringName()) {
Ref<GDScript> parent = ResourceLoader::load(cln->extends_file);
@@ -7247,6 +7257,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_identifier_type(const DataType
DataType result;
result.has_type = true;
result.script_type = scr;
+ result.is_constant = true;
result.is_meta_type = true;
Ref<GDScript> gds = scr;
if (gds.is_valid()) {
@@ -7297,6 +7308,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_identifier_type(const DataType
if (singleton.is_valid()) {
DataType result;
result.has_type = true;
+ result.is_constant = true;
result.script_type = singleton;
Ref<GDScript> gds = singleton;
diff --git a/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs b/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
index 79ef46ebb5..967e3bcc19 100644
--- a/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
+++ b/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
@@ -92,6 +92,9 @@ namespace GodotSharpTools.Build
bool redirectOutput = !IsDebugMSBuildRequested() && !PrintBuildOutput;
+ if (!redirectOutput) // TODO: or if stdout verbose
+ Console.WriteLine($"Running: \"{startInfo.FileName}\" {startInfo.Arguments}");
+
startInfo.RedirectStandardOutput = redirectOutput;
startInfo.RedirectStandardError = redirectOutput;
startInfo.UseShellExecute = false;
@@ -145,6 +148,9 @@ namespace GodotSharpTools.Build
bool redirectOutput = !IsDebugMSBuildRequested() && !PrintBuildOutput;
+ if (!redirectOutput) // TODO: or if stdout verbose
+ Console.WriteLine($"Running: \"{startInfo.FileName}\" {startInfo.Arguments}");
+
startInfo.RedirectStandardOutput = redirectOutput;
startInfo.RedirectStandardError = redirectOutput;
startInfo.UseShellExecute = false;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index fee20de804..0b19f8c002 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -765,9 +765,41 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) {
[super updateTrackingAreas];
}
+static bool isNumpadKey(unsigned int key) {
+
+ static const unsigned int table[] = {
+ 0x41, /* kVK_ANSI_KeypadDecimal */
+ 0x43, /* kVK_ANSI_KeypadMultiply */
+ 0x45, /* kVK_ANSI_KeypadPlus */
+ 0x47, /* kVK_ANSI_KeypadClear */
+ 0x4b, /* kVK_ANSI_KeypadDivide */
+ 0x4c, /* kVK_ANSI_KeypadEnter */
+ 0x4e, /* kVK_ANSI_KeypadMinus */
+ 0x51, /* kVK_ANSI_KeypadEquals */
+ 0x52, /* kVK_ANSI_Keypad0 */
+ 0x53, /* kVK_ANSI_Keypad1 */
+ 0x54, /* kVK_ANSI_Keypad2 */
+ 0x55, /* kVK_ANSI_Keypad3 */
+ 0x56, /* kVK_ANSI_Keypad4 */
+ 0x57, /* kVK_ANSI_Keypad5 */
+ 0x58, /* kVK_ANSI_Keypad6 */
+ 0x59, /* kVK_ANSI_Keypad7 */
+ 0x5b, /* kVK_ANSI_Keypad8 */
+ 0x5c, /* kVK_ANSI_Keypad9 */
+ 0x5f, /* kVK_JIS_KeypadComma */
+ 0x00
+ };
+ for (int i = 0; table[i] != 0; i++) {
+ if (key == table[i])
+ return true;
+ }
+ return false;
+}
+
// Translates a OS X keycode to a Godot keycode
//
static int translateKey(unsigned int key) {
+
// Keyboard symbol translation table
static const unsigned int table[128] = {
/* 00 */ KEY_A,
@@ -780,7 +812,7 @@ static int translateKey(unsigned int key) {
/* 07 */ KEY_X,
/* 08 */ KEY_C,
/* 09 */ KEY_V,
- /* 0a */ KEY_UNKNOWN,
+ /* 0a */ KEY_SECTION, /* ISO Section */
/* 0b */ KEY_B,
/* 0c */ KEY_Q,
/* 0d */ KEY_W,
@@ -834,7 +866,7 @@ static int translateKey(unsigned int key) {
/* 3d */ KEY_ALT,
/* 3e */ KEY_CONTROL,
/* 3f */ KEY_UNKNOWN, /* Function */
- /* 40 */ KEY_UNKNOWN,
+ /* 40 */ KEY_UNKNOWN, /* F17 */
/* 41 */ KEY_KP_PERIOD,
/* 42 */ KEY_UNKNOWN,
/* 43 */ KEY_KP_MULTIPLY,
@@ -842,16 +874,16 @@ static int translateKey(unsigned int key) {
/* 45 */ KEY_KP_ADD,
/* 46 */ KEY_UNKNOWN,
/* 47 */ KEY_NUMLOCK, /* Really KeypadClear... */
- /* 48 */ KEY_UNKNOWN, /* VolumeUp */
- /* 49 */ KEY_UNKNOWN, /* VolumeDown */
- /* 4a */ KEY_UNKNOWN, /* Mute */
+ /* 48 */ KEY_VOLUMEUP, /* VolumeUp */
+ /* 49 */ KEY_VOLUMEDOWN, /* VolumeDown */
+ /* 4a */ KEY_VOLUMEMUTE, /* Mute */
/* 4b */ KEY_KP_DIVIDE,
/* 4c */ KEY_KP_ENTER,
/* 4d */ KEY_UNKNOWN,
/* 4e */ KEY_KP_SUBTRACT,
- /* 4f */ KEY_UNKNOWN,
- /* 50 */ KEY_UNKNOWN,
- /* 51 */ KEY_EQUAL, //wtf equal?
+ /* 4f */ KEY_UNKNOWN, /* F18 */
+ /* 50 */ KEY_UNKNOWN, /* F19 */
+ /* 51 */ KEY_EQUAL, /* KeypadEqual */
/* 52 */ KEY_KP_0,
/* 53 */ KEY_KP_1,
/* 54 */ KEY_KP_2,
@@ -860,27 +892,27 @@ static int translateKey(unsigned int key) {
/* 57 */ KEY_KP_5,
/* 58 */ KEY_KP_6,
/* 59 */ KEY_KP_7,
- /* 5a */ KEY_UNKNOWN,
+ /* 5a */ KEY_UNKNOWN, /* F20 */
/* 5b */ KEY_KP_8,
/* 5c */ KEY_KP_9,
- /* 5d */ KEY_UNKNOWN,
- /* 5e */ KEY_UNKNOWN,
- /* 5f */ KEY_UNKNOWN,
+ /* 5d */ KEY_YEN, /* JIS Yen */
+ /* 5e */ KEY_UNDERSCORE, /* JIS Underscore */
+ /* 5f */ KEY_COMMA, /* JIS KeypadComma */
/* 60 */ KEY_F5,
/* 61 */ KEY_F6,
/* 62 */ KEY_F7,
/* 63 */ KEY_F3,
/* 64 */ KEY_F8,
/* 65 */ KEY_F9,
- /* 66 */ KEY_UNKNOWN,
+ /* 66 */ KEY_UNKNOWN, /* JIS Eisu */
/* 67 */ KEY_F11,
- /* 68 */ KEY_UNKNOWN,
+ /* 68 */ KEY_UNKNOWN, /* JIS Kana */
/* 69 */ KEY_F13,
/* 6a */ KEY_F16,
/* 6b */ KEY_F14,
/* 6c */ KEY_UNKNOWN,
/* 6d */ KEY_F10,
- /* 6e */ KEY_UNKNOWN,
+ /* 6e */ KEY_MENU,
/* 6f */ KEY_F12,
/* 70 */ KEY_UNKNOWN,
/* 71 */ KEY_F15,
@@ -971,6 +1003,9 @@ static const _KeyCodeMap _keycodes[55] = {
static int remapKey(unsigned int key) {
+ if (isNumpadKey(key))
+ return translateKey(key);
+
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
if (!currentKeyboard)
return translateKey(key);