summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/AnimationPlayer.xml1
-rw-r--r--doc/classes/CheckBox.xml23
-rw-r--r--doc/classes/CheckButton.xml23
-rw-r--r--doc/classes/Tween.xml1
-rw-r--r--editor/editor_autoload_settings.cpp41
-rw-r--r--editor/editor_autoload_settings.h5
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java2
-rw-r--r--platform/javascript/detect.py5
8 files changed, 90 insertions, 11 deletions
diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml
index 8bc2c34c6d..bb1754b810 100644
--- a/doc/classes/AnimationPlayer.xml
+++ b/doc/classes/AnimationPlayer.xml
@@ -5,6 +5,7 @@
</brief_description>
<description>
An animation player is used for general-purpose playback of [Animation] resources. It contains a dictionary of animations (referenced by name) and custom blend times between their transitions. Additionally, animations can be played and blended in different channels.
+ [AnimationPlayer] is more suited than [Tween] for animations where you know the final values in advance. For example, fading a screen in and out is more easily done with an [AnimationPlayer] node thanks to the animation tools provided by the editor. That particular example can also be implemented with a [Tween] node, but it requires doing everything by code.
Updating the target properties of animations occurs at process time.
</description>
<tutorials>
diff --git a/doc/classes/CheckBox.xml b/doc/classes/CheckBox.xml
index 5ba159880e..b5c7332bc1 100644
--- a/doc/classes/CheckBox.xml
+++ b/doc/classes/CheckBox.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CheckBox" inherits="Button" version="3.2">
<brief_description>
- Binary choice user interface widget.
+ Binary choice user interface widget. See also [CheckButton].
</brief_description>
<description>
- A checkbox allows the user to make a binary choice (choosing only one of two possible options).
+ A checkbox allows the user to make a binary choice (choosing only one of two possible options). It's similar to [CheckButton] in functionality, but it has a different apperance. To follow established UX patterns, it's recommended to use CheckBox when toggling it has [b]no[/b] immediate effect on something. For instance, it should be used when toggling it will only do something once a confirmation button is pressed.
</description>
<tutorials>
</tutorials>
@@ -18,41 +18,58 @@
</constants>
<theme_items>
<theme_item name="check_vadjust" type="int" default="0">
- The vertical offset used when rendering the check icons.
+ The vertical offset used when rendering the check icons (in pixels).
</theme_item>
<theme_item name="checked" type="Texture">
+ The check icon to display when the [CheckBox] is checked.
</theme_item>
<theme_item name="disabled" type="StyleBox">
+ The [StyleBox] to display as a background when the [CheckBox] is disabled.
</theme_item>
<theme_item name="focus" type="StyleBox">
+ The [StyleBox] to display as a background when the [CheckBox] is focused.
</theme_item>
<theme_item name="font" type="Font">
+ The [Font] to use for the [CheckBox] text.
</theme_item>
<theme_item name="font_color" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )">
+ The [CheckBox] text's font color.
</theme_item>
<theme_item name="font_color_disabled" type="Color" default="Color( 0.9, 0.9, 0.9, 0.2 )">
+ The [CheckBox] text's font color when it's disabled.
</theme_item>
<theme_item name="font_color_hover" type="Color" default="Color( 0.94, 0.94, 0.94, 1 )">
+ The [CheckBox] text's font color when it's hovered.
</theme_item>
<theme_item name="font_color_hover_pressed" type="Color" default="Color( 1, 1, 1, 1 )">
+ The [CheckBox] text's font color when it's hovered and pressed.
</theme_item>
<theme_item name="font_color_pressed" type="Color" default="Color( 1, 1, 1, 1 )">
+ The [CheckBox] text's font color when it's pressed.
</theme_item>
<theme_item name="hover" type="StyleBox">
+ The [StyleBox] to display as a background when the [CheckBox] is hovered.
</theme_item>
<theme_item name="hover_pressed" type="StyleBox">
+ The [StyleBox] to display as a background when the [CheckBox] is hovered and pressed.
</theme_item>
<theme_item name="hseparation" type="int" default="4">
+ The separation between the check icon and the text (in pixels).
</theme_item>
<theme_item name="normal" type="StyleBox">
+ The [StyleBox] to display as a background.
</theme_item>
<theme_item name="pressed" type="StyleBox">
+ The [StyleBox] to display as a background when the [CheckBox] is pressed.
</theme_item>
<theme_item name="radio_checked" type="Texture">
+ If the [CheckBox] is configured as a radio button, the icon to display when the [CheckBox] is checked.
</theme_item>
<theme_item name="radio_unchecked" type="Texture">
+ If the [CheckBox] is configured as a radio button, the icon to display when the [CheckBox] is unchecked.
</theme_item>
<theme_item name="unchecked" type="Texture">
+ The check icon to display when the [CheckBox] is unchecked.
</theme_item>
</theme_items>
</class>
diff --git a/doc/classes/CheckButton.xml b/doc/classes/CheckButton.xml
index e6a890b21f..769acb5d16 100644
--- a/doc/classes/CheckButton.xml
+++ b/doc/classes/CheckButton.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CheckButton" inherits="Button" version="3.2">
<brief_description>
- Checkable button.
+ Checkable button. See also [CheckBox].
</brief_description>
<description>
- CheckButton is a toggle button displayed as a check field.
+ CheckButton is a toggle button displayed as a check field. It's similar to [CheckBox] in functionality, but it has a different apperance. To follow established UX patterns, it's recommended to use CheckButton when toggling it has an [b]immediate[/b] effect on something. For instance, it should be used if toggling it enables/disables a setting without requiring the user to press a confirmation button.
</description>
<tutorials>
</tutorials>
@@ -18,41 +18,58 @@
</constants>
<theme_items>
<theme_item name="check_vadjust" type="int" default="0">
- The vertical offset used when rendering the icons.
+ The vertical offset used when rendering the toggle icons (in pixels).
</theme_item>
<theme_item name="disabled" type="StyleBox">
+ The [StyleBox] to display as a background when the [CheckButton] is disabled.
</theme_item>
<theme_item name="focus" type="StyleBox">
+ The [StyleBox] to display as a background when the [CheckButton] is focused.
</theme_item>
<theme_item name="font" type="Font">
+ The [Font] to use for the [CheckButton] text.
</theme_item>
<theme_item name="font_color" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )">
+ The [CheckButton] text's font color.
</theme_item>
<theme_item name="font_color_disabled" type="Color" default="Color( 0.9, 0.9, 0.9, 0.2 )">
+ The [CheckButton] text's font color when it's disabled.
</theme_item>
<theme_item name="font_color_hover" type="Color" default="Color( 0.94, 0.94, 0.94, 1 )">
+ The [CheckButton] text's font color when it's hovered.
</theme_item>
<theme_item name="font_color_hover_pressed" type="Color" default="Color( 1, 1, 1, 1 )">
+ The [CheckButton] text's font color when it's hovered and pressed.
</theme_item>
<theme_item name="font_color_pressed" type="Color" default="Color( 1, 1, 1, 1 )">
+ The [CheckButton] text's font color when it's pressed.
</theme_item>
<theme_item name="hover" type="StyleBox">
+ The [StyleBox] to display as a background when the [CheckButton] is hovered.
</theme_item>
<theme_item name="hover_pressed" type="StyleBox">
+ The [StyleBox] to display as a background when the [CheckButton] is hovered and pressed.
</theme_item>
<theme_item name="hseparation" type="int" default="4">
+ The separation between the toggle icon and the text (in pixels).
</theme_item>
<theme_item name="normal" type="StyleBox">
+ The [StyleBox] to display as a background.
</theme_item>
<theme_item name="off" type="Texture">
+ The icon to display when the [CheckButton] is unchecked.
</theme_item>
<theme_item name="off_disabled" type="Texture">
+ The icon to display when the [CheckButton] is unchecked and disabled.
</theme_item>
<theme_item name="on" type="Texture">
+ The icon to display when the [CheckButton] is checked.
</theme_item>
<theme_item name="on_disabled" type="Texture">
+ The icon to display when the [CheckButton] is checked and disabled.
</theme_item>
<theme_item name="pressed" type="StyleBox">
+ The [StyleBox] to display as a background when the [CheckButton] is pressed.
</theme_item>
</theme_items>
</class>
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml
index 9345cd059a..97d436c707 100644
--- a/doc/classes/Tween.xml
+++ b/doc/classes/Tween.xml
@@ -5,6 +5,7 @@
</brief_description>
<description>
Tweens are useful for animations requiring a numerical property to be interpolated over a range of values. The name [i]tween[/i] comes from [i]in-betweening[/i], an animation technique where you specify [i]keyframes[/i] and the computer interpolates the frames that appear between them.
+ [Tween] is more suited than [AnimationPlayer] for animations where you don't know the final values in advance. For example, interpolating a dynamically-chosen camera zoom value is best done with a [Tween] node; it would be difficult to do the same thing with an [AnimationPlayer] node.
Here is a brief usage example that causes a 2D node to move smoothly between two positions:
[codeblock]
var tween = get_node("Tween")
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 46a54969e0..dba8c2ec8c 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -120,6 +120,7 @@ void EditorAutoloadSettings::_autoload_add() {
autoload_add_path->get_line_edit()->set_text("");
autoload_add_name->set_text("");
+ add_autoload->set_disabled(true);
}
void EditorAutoloadSettings::_autoload_selected() {
@@ -312,7 +313,34 @@ void EditorAutoloadSettings::_autoload_open(const String &fpath) {
void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) {
- autoload_add_name->set_text(p_path.get_file().get_basename());
+ // Convert the file name to PascalCase, which is the convention for classes in GDScript.
+ const String class_name = p_path.get_file().get_basename().capitalize().replace(" ", "");
+
+ // If the name collides with a built-in class, prefix the name to make it possible to add without having to edit the name.
+ // The prefix is subjective, but it provides better UX than leaving the Add button disabled :)
+ const String prefix = ClassDB::class_exists(class_name) ? "Global" : "";
+
+ autoload_add_name->set_text(prefix + class_name);
+ add_autoload->set_disabled(false);
+}
+
+void EditorAutoloadSettings::_autoload_text_entered(const String p_name) {
+
+ if (autoload_add_path->get_line_edit()->get_text() != "" && _autoload_name_is_valid(p_name, NULL)) {
+ _autoload_add();
+ }
+}
+
+void EditorAutoloadSettings::_autoload_path_text_changed(const String p_path) {
+
+ add_autoload->set_disabled(
+ p_path == "" || !_autoload_name_is_valid(autoload_add_name->get_text(), NULL));
+}
+
+void EditorAutoloadSettings::_autoload_text_changed(const String p_name) {
+
+ add_autoload->set_disabled(
+ autoload_add_path->get_line_edit()->get_text() == "" || !_autoload_name_is_valid(p_name, NULL));
}
Node *EditorAutoloadSettings::_create_autoload(const String &p_path) {
@@ -424,7 +452,7 @@ void EditorAutoloadSettings::update_autoload() {
item->set_editable(2, true);
item->set_text(2, TTR("Enable"));
item->set_checked(2, info.is_singleton);
- item->add_button(3, get_icon("FileList", "EditorIcons"), BUTTON_OPEN);
+ item->add_button(3, get_icon("Load", "EditorIcons"), BUTTON_OPEN);
item->add_button(3, get_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP);
item->add_button(3, get_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN);
item->add_button(3, get_icon("Remove", "EditorIcons"), BUTTON_DELETE);
@@ -713,7 +741,9 @@ void EditorAutoloadSettings::_bind_methods() {
ClassDB::bind_method("_autoload_edited", &EditorAutoloadSettings::_autoload_edited);
ClassDB::bind_method("_autoload_button_pressed", &EditorAutoloadSettings::_autoload_button_pressed);
ClassDB::bind_method("_autoload_activated", &EditorAutoloadSettings::_autoload_activated);
+ ClassDB::bind_method("_autoload_path_text_changed", &EditorAutoloadSettings::_autoload_path_text_changed);
ClassDB::bind_method("_autoload_text_entered", &EditorAutoloadSettings::_autoload_text_entered);
+ ClassDB::bind_method("_autoload_text_changed", &EditorAutoloadSettings::_autoload_text_changed);
ClassDB::bind_method("_autoload_open", &EditorAutoloadSettings::_autoload_open);
ClassDB::bind_method("_autoload_file_callback", &EditorAutoloadSettings::_autoload_file_callback);
@@ -806,6 +836,8 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL);
autoload_add_path->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE);
autoload_add_path->get_file_dialog()->connect("file_selected", this, "_autoload_file_callback");
+ autoload_add_path->get_line_edit()->connect("text_changed", this, "_autoload_path_text_changed");
+
hbc->add_child(autoload_add_path);
l = memnew(Label);
@@ -815,11 +847,14 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
autoload_add_name = memnew(LineEdit);
autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL);
autoload_add_name->connect("text_entered", this, "_autoload_text_entered");
+ autoload_add_name->connect("text_changed", this, "_autoload_text_changed");
hbc->add_child(autoload_add_name);
- Button *add_autoload = memnew(Button);
+ add_autoload = memnew(Button);
add_autoload->set_text(TTR("Add"));
add_autoload->connect("pressed", this, "_autoload_add");
+ // The button will be enabled once a valid name is entered (either automatically or manually).
+ add_autoload->set_disabled(true);
hbc->add_child(add_autoload);
tree = memnew(Tree);
diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h
index e1a04644aa..653a1b0a78 100644
--- a/editor/editor_autoload_settings.h
+++ b/editor/editor_autoload_settings.h
@@ -76,6 +76,7 @@ class EditorAutoloadSettings : public VBoxContainer {
Tree *tree;
EditorLineEditFileChooser *autoload_add_path;
LineEdit *autoload_add_name;
+ Button *add_autoload;
bool _autoload_name_is_valid(const String &p_name, String *r_error = NULL);
@@ -84,7 +85,9 @@ class EditorAutoloadSettings : public VBoxContainer {
void _autoload_edited();
void _autoload_button_pressed(Object *p_item, int p_column, int p_button);
void _autoload_activated();
- void _autoload_text_entered(String) { _autoload_add(); }
+ void _autoload_path_text_changed(const String p_path);
+ void _autoload_text_entered(const String p_name);
+ void _autoload_text_changed(const String p_name);
void _autoload_open(const String &fpath);
void _autoload_file_callback(const String &p_path);
Node *_create_autoload(const String &p_path);
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java
index 44998aa6c0..e901b4b36d 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java
@@ -123,7 +123,7 @@ public class GodotEditText extends EditText {
}
private void setMaxInputLength(EditText p_edit_text, int p_max_input_length) {
- if (p_max_input_length >= 0) {
+ if (p_max_input_length > 0) {
InputFilter[] filters = new InputFilter[1];
filters[0] = new InputFilter.LengthFilter(p_max_input_length);
p_edit_text.setFilters(filters);
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 7bf3e1bc1d..1766833364 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -131,6 +131,11 @@ def configure(env):
env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
+ # Only include the JavaScript support code for the web environment
+ # (i.e. exclude Node.js and other unused environments).
+ # This makes the JavaScript support code about 4 KB smaller.
+ env.Append(LINKFLAGS=['-s', 'ENVIRONMENT=web'])
+
# This needs to be defined for Emscripten using 'fastcomp' (default pre-1.39.0)
# and undefined if using 'upstream'. And to make things simple, earlier
# Emscripten versions didn't include 'fastcomp' in their path, so we check