summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/packet_peer.cpp10
-rw-r--r--core/io/packet_peer.h12
-rw-r--r--core/os/os.cpp4
-rw-r--r--core/os/os.h7
-rw-r--r--core/ustring.cpp154
-rw-r--r--core/ustring.h33
-rw-r--r--doc/classes/Camera.xml182
-rw-r--r--doc/classes/Navigation.xml2
-rw-r--r--doc/classes/Navigation2D.xml2
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp4
-rw-r--r--drivers/unix/packet_peer_udp_posix.cpp2
-rw-r--r--drivers/unix/packet_peer_udp_posix.h12
-rw-r--r--drivers/windows/packet_peer_udp_winsock.cpp (renamed from platform/windows/packet_peer_udp_winsock.cpp)6
-rw-r--r--drivers/windows/packet_peer_udp_winsock.h (renamed from platform/windows/packet_peer_udp_winsock.h)16
-rw-r--r--drivers/windows/stream_peer_tcp_winsock.cpp (renamed from platform/windows/stream_peer_winsock.cpp)52
-rw-r--r--drivers/windows/stream_peer_tcp_winsock.h (renamed from platform/windows/stream_peer_winsock.h)12
-rw-r--r--drivers/windows/tcp_server_winsock.cpp (renamed from platform/windows/tcp_server_winsock.cpp)8
-rw-r--r--drivers/windows/tcp_server_winsock.h (renamed from platform/windows/tcp_server_winsock.h)4
-rw-r--r--editor/editor_export.cpp18
-rw-r--r--editor/editor_export.h8
-rw-r--r--editor/editor_sub_scene.cpp95
-rw-r--r--editor/editor_sub_scene.h5
-rw-r--r--editor/plugins/mesh_instance_editor_plugin.h4
-rw-r--r--editor/plugins/script_editor_plugin.cpp14
-rw-r--r--editor/plugins/script_editor_plugin.h1
-rw-r--r--editor/plugins/script_text_editor.cpp45
-rw-r--r--editor/plugins/shader_editor_plugin.cpp34
-rw-r--r--editor/project_export.cpp4
-rw-r--r--editor/property_editor.cpp1
-rw-r--r--editor/scene_tree_dock.cpp113
-rw-r--r--editor/scene_tree_editor.cpp8
-rw-r--r--editor/script_create_dialog.cpp12
-rw-r--r--editor/script_create_dialog.h1
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp4
-rw-r--r--modules/enet/networked_multiplayer_enet.h8
-rw-r--r--modules/gdnative/gdnative/gdnative.cpp4
-rw-r--r--modules/gdnative/gdnative_api.json6
-rw-r--r--modules/gdnative/include/gdnative/gdnative.h4
-rw-r--r--modules/gridmap/grid_map.cpp4
-rw-r--r--platform/android/export/export.cpp2
-rw-r--r--platform/iphone/export/export.cpp2
-rw-r--r--platform/javascript/export/export.cpp4
-rw-r--r--platform/osx/export/export.cpp2
-rw-r--r--platform/uwp/SCsub3
-rw-r--r--platform/uwp/export/export.cpp2
-rw-r--r--platform/uwp/os_uwp.cpp8
-rw-r--r--platform/windows/SCsub3
-rw-r--r--platform/windows/os_windows.cpp10
-rw-r--r--platform/x11/export/export.cpp3
-rw-r--r--scene/2d/navigation2d.cpp4
-rw-r--r--scene/2d/navigation2d.h2
-rw-r--r--scene/2d/navigation_polygon.cpp6
-rw-r--r--scene/2d/tile_map.cpp2
-rw-r--r--scene/3d/camera.cpp198
-rw-r--r--scene/3d/camera.h13
-rw-r--r--scene/3d/navigation.cpp4
-rw-r--r--scene/3d/navigation.h2
-rw-r--r--scene/3d/navigation_mesh.cpp6
-rw-r--r--scene/gui/popup_menu.cpp37
-rw-r--r--scene/gui/rich_text_label.cpp11
-rw-r--r--scene/gui/text_edit.cpp72
-rw-r--r--scene/gui/text_edit.h4
-rw-r--r--scene/gui/tree.cpp14
-rw-r--r--scene/main/viewport.cpp5
64 files changed, 685 insertions, 649 deletions
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 16c73c26e7..c6b12f73ae 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -49,7 +49,7 @@ bool PacketPeer::is_object_decoding_allowed() const {
return allow_object_decoding;
}
-Error PacketPeer::get_packet_buffer(PoolVector<uint8_t> &r_buffer) const {
+Error PacketPeer::get_packet_buffer(PoolVector<uint8_t> &r_buffer) {
const uint8_t *buffer;
int buffer_size;
@@ -78,7 +78,7 @@ Error PacketPeer::put_packet_buffer(const PoolVector<uint8_t> &p_buffer) {
return put_packet(&r[0], len);
}
-Error PacketPeer::get_var(Variant &r_variant) const {
+Error PacketPeer::get_var(Variant &r_variant) {
const uint8_t *buffer;
int buffer_size;
@@ -107,7 +107,7 @@ Error PacketPeer::put_var(const Variant &p_packet) {
return put_packet(buf, len);
}
-Variant PacketPeer::_bnd_get_var() const {
+Variant PacketPeer::_bnd_get_var() {
Variant var;
get_var(var);
@@ -117,7 +117,7 @@ Variant PacketPeer::_bnd_get_var() const {
Error PacketPeer::_put_packet(const PoolVector<uint8_t> &p_buffer) {
return put_packet_buffer(p_buffer);
}
-PoolVector<uint8_t> PacketPeer::_get_packet() const {
+PoolVector<uint8_t> PacketPeer::_get_packet() {
PoolVector<uint8_t> raw;
last_get_error = get_packet_buffer(raw);
@@ -202,7 +202,7 @@ int PacketPeerStream::get_available_packet_count() const {
return count;
}
-Error PacketPeerStream::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const {
+Error PacketPeerStream::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
ERR_FAIL_COND_V(peer.is_null(), ERR_UNCONFIGURED);
_poll_buffer();
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index b08d44ad8a..a6d363ec12 100644
--- a/core/io/packet_peer.h
+++ b/core/io/packet_peer.h
@@ -37,13 +37,13 @@ class PacketPeer : public Reference {
GDCLASS(PacketPeer, Reference);
- Variant _bnd_get_var() const;
+ Variant _bnd_get_var();
void _bnd_put_var(const Variant &p_var);
static void _bind_methods();
Error _put_packet(const PoolVector<uint8_t> &p_buffer);
- PoolVector<uint8_t> _get_packet() const;
+ PoolVector<uint8_t> _get_packet();
Error _get_packet_error() const;
mutable Error last_get_error;
@@ -52,17 +52,17 @@ class PacketPeer : public Reference {
public:
virtual int get_available_packet_count() const = 0;
- virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const = 0; ///< buffer is GONE after next get_packet
+ virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) = 0; ///< buffer is GONE after next get_packet
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size) = 0;
virtual int get_max_packet_size() const = 0;
/* helpers / binders */
- virtual Error get_packet_buffer(PoolVector<uint8_t> &r_buffer) const;
+ virtual Error get_packet_buffer(PoolVector<uint8_t> &r_buffer);
virtual Error put_packet_buffer(const PoolVector<uint8_t> &p_buffer);
- virtual Error get_var(Variant &r_variant) const;
+ virtual Error get_var(Variant &r_variant);
virtual Error put_var(const Variant &p_packet);
void set_allow_object_decoding(bool p_enable);
@@ -91,7 +91,7 @@ protected:
public:
virtual int get_available_packet_count() const;
- virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const;
+ virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
virtual int get_max_packet_size() const;
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 8088a6fa74..d81e70e612 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -606,10 +606,6 @@ bool OS::has_feature(const String &p_feature) {
return false;
}
-void *OS::get_stack_bottom() const {
- return _stack_bottom;
-}
-
OS::OS() {
void *volatile stack_bottom;
diff --git a/core/os/os.h b/core/os/os.h
index 41500acd93..d9f7b91daa 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -445,13 +445,6 @@ public:
virtual void force_process_input(){};
bool has_feature(const String &p_feature);
- /**
- * Returns the stack bottom of the main thread of the application.
- * This may be of use when integrating languages with garbage collectors that
- * need to check whether a pointer is on the stack.
- */
- virtual void *get_stack_bottom() const;
-
bool is_hidpi_allowed() const { return _allow_hidpi; }
OS();
virtual ~OS();
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 1bf7d000c3..ceafe209ea 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -393,7 +393,7 @@ bool String::operator<(const CharType *p_str) const {
return false; //should never reach here anyway
}
-bool String::operator<=(String p_str) const {
+bool String::operator<=(const String &p_str) const {
return (*this < p_str) || (*this == p_str);
}
@@ -426,7 +426,7 @@ bool String::operator<(const char *p_str) const {
return false; //should never reach here anyway
}
-bool String::operator<(String p_str) const {
+bool String::operator<(const String &p_str) const {
return operator<(p_str.c_str());
}
@@ -902,7 +902,10 @@ String String::to_upper() const {
for (int i = 0; i < upper.size(); i++) {
- upper[i] = _find_upper(upper[i]);
+ const char s = upper[i];
+ const char t = _find_upper(s);
+ if (s != t) // avoid copy on write
+ upper[i] = t;
}
return upper;
@@ -910,20 +913,17 @@ String String::to_upper() const {
String String::to_lower() const {
- String upper = *this;
+ String lower = *this;
- for (int i = 0; i < upper.size(); i++) {
+ for (int i = 0; i < lower.size(); i++) {
- upper[i] = _find_lower(upper[i]);
+ const char s = lower[i];
+ const char t = _find_lower(s);
+ if (s != t) // avoid copy on write
+ lower[i] = t;
}
- return upper;
-}
-
-int String::length() const {
-
- int s = size();
- return s ? (s - 1) : 0; // length does not include zero
+ return lower;
}
const CharType *String::c_str() const {
@@ -2175,7 +2175,7 @@ Vector<uint8_t> String::sha256_buffer() const {
return ret;
}
-String String::insert(int p_at_pos, String p_string) const {
+String String::insert(int p_at_pos, const String &p_string) const {
if (p_at_pos < 0)
return *this;
@@ -2203,10 +2203,15 @@ String String::substr(int p_from, int p_chars) const {
p_chars = length() - p_from;
}
+ if (p_from == 0 && p_chars >= length()) {
+
+ return String(*this);
+ }
+
return String(&c_str()[p_from], p_chars);
}
-int String::find_last(String p_str) const {
+int String::find_last(const String &p_str) const {
int pos = -1;
int findfrom = 0;
@@ -2219,19 +2224,21 @@ int String::find_last(String p_str) const {
return pos;
}
-int String::find(String p_str, int p_from) const {
+
+int String::find(const String &p_str, int p_from) const {
if (p_from < 0)
return -1;
- int src_len = p_str.length();
+ const int src_len = p_str.length();
- int len = length();
+ const int len = length();
if (src_len == 0 || len == 0)
return -1; //wont find anything!
const CharType *src = c_str();
+ const CharType *str = p_str.c_str();
for (int i = p_from; i <= (len - src_len); i++) {
@@ -2246,7 +2253,7 @@ int String::find(String p_str, int p_from) const {
return -1;
};
- if (src[read_pos] != p_str[j]) {
+ if (src[read_pos] != str[j]) {
found = false;
break;
}
@@ -2259,6 +2266,62 @@ int String::find(String p_str, int p_from) const {
return -1;
}
+int String::find(const char *p_str, int p_from) const {
+
+ if (p_from < 0)
+ return -1;
+
+ const int len = length();
+
+ if (len == 0)
+ return -1; //wont find anything!
+
+ const CharType *src = c_str();
+
+ int src_len = 0;
+ while (p_str[src_len] != '\0')
+ src_len++;
+
+ if (src_len == 1) {
+
+ const char needle = p_str[0];
+
+ for (int i = p_from; i < len; i++) {
+
+ if (src[i] == needle) {
+ return i;
+ }
+ }
+
+ } else {
+
+ for (int i = p_from; i <= (len - src_len); i++) {
+
+ bool found = true;
+ for (int j = 0; j < src_len; j++) {
+
+ int read_pos = i + j;
+
+ if (read_pos >= len) {
+
+ ERR_PRINT("read_pos>=len");
+ return -1;
+ };
+
+ if (src[read_pos] != p_str[j]) {
+ found = false;
+ break;
+ }
+ }
+
+ if (found)
+ return i;
+ }
+ }
+
+ return -1;
+}
+
int String::findmk(const Vector<String> &p_keys, int p_from, int *r_key) const {
if (p_from < 0)
@@ -2313,7 +2376,7 @@ int String::findmk(const Vector<String> &p_keys, int p_from, int *r_key) const {
return -1;
}
-int String::findn(String p_str, int p_from) const {
+int String::findn(const String &p_str, int p_from) const {
if (p_from < 0)
return -1;
@@ -2354,7 +2417,7 @@ int String::findn(String p_str, int p_from) const {
return -1;
}
-int String::rfind(String p_str, int p_from) const {
+int String::rfind(const String &p_str, int p_from) const {
// establish a limit
int limit = length() - p_str.length();
@@ -2400,7 +2463,7 @@ int String::rfind(String p_str, int p_from) const {
return -1;
}
-int String::rfindn(String p_str, int p_from) const {
+int String::rfindn(const String &p_str, int p_from) const {
// establish a limit
int limit = length() - p_str.length();
@@ -2700,7 +2763,7 @@ String String::format(const Variant &values, String placeholder) const {
return new_string;
}
-String String::replace(String p_key, String p_with) const {
+String String::replace(const String &p_key, const String &p_with) const {
String new_string;
int search_from = 0;
@@ -2713,12 +2776,43 @@ String String::replace(String p_key, String p_with) const {
search_from = result + p_key.length();
}
+ if (search_from == 0) {
+
+ return *this;
+ }
+
new_string += substr(search_from, length() - search_from);
return new_string;
}
-String String::replace_first(String p_key, String p_with) const {
+String String::replace(const char *p_key, const char *p_with) const {
+
+ String new_string;
+ int search_from = 0;
+ int result = 0;
+
+ while ((result = find(p_key, search_from)) >= 0) {
+
+ new_string += substr(search_from, result - search_from);
+ new_string += p_with;
+ int k = 0;
+ while (p_key[k] != '\0')
+ k++;
+ search_from = result + k;
+ }
+
+ if (search_from == 0) {
+
+ return *this;
+ }
+
+ new_string += substr(search_from, length() - search_from);
+
+ return new_string;
+}
+
+String String::replace_first(const String &p_key, const String &p_with) const {
String new_string;
int search_from = 0;
@@ -2732,11 +2826,16 @@ String String::replace_first(String p_key, String p_with) const {
break;
}
+ if (search_from == 0) {
+
+ return *this;
+ }
+
new_string += substr(search_from, length() - search_from);
return new_string;
}
-String String::replacen(String p_key, String p_with) const {
+String String::replacen(const String &p_key, const String &p_with) const {
String new_string;
int search_from = 0;
@@ -2749,6 +2848,11 @@ String String::replacen(String p_key, String p_with) const {
search_from = result + p_key.length();
}
+ if (search_from == 0) {
+
+ return *this;
+ }
+
new_string += substr(search_from, length() - search_from);
return new_string;
}
diff --git a/core/ustring.h b/core/ustring.h
index 6541642bd1..73537bfd13 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -93,8 +93,8 @@ public:
bool operator!=(const CharType *p_str) const;
bool operator<(const CharType *p_str) const;
bool operator<(const char *p_str) const;
- bool operator<(String p_str) const;
- bool operator<=(String p_str) const;
+ bool operator<(const String &p_str) const;
+ bool operator<=(const String &p_str) const;
signed char casecmp_to(const String &p_str) const;
signed char nocasecmp_to(const String &p_str) const;
@@ -103,15 +103,19 @@ public:
const CharType *c_str() const;
/* standard size stuff */
- int length() const;
+ _FORCE_INLINE_ int length() const {
+ int s = size();
+ return s ? (s - 1) : 0; // length does not include zero
+ }
/* complex helpers */
String substr(int p_from, int p_chars) const;
- int find(String p_str, int p_from = 0) const; ///< return <0 if failed
- int find_last(String p_str) const; ///< return <0 if failed
- int findn(String p_str, int p_from = 0) const; ///< return <0 if failed, case insensitive
- int rfind(String p_str, int p_from = -1) const; ///< return <0 if failed
- int rfindn(String p_str, int p_from = -1) const; ///< return <0 if failed, case insensitive
+ int find(const String &p_str, int p_from = 0) const; ///< return <0 if failed
+ int find(const char *p_str, int p_from) const; ///< return <0 if failed
+ int find_last(const String &p_str) const; ///< return <0 if failed
+ int findn(const String &p_str, int p_from = 0) const; ///< return <0 if failed, case insensitive
+ int rfind(const String &p_str, int p_from = -1) const; ///< return <0 if failed
+ int rfindn(const String &p_str, int p_from = -1) const; ///< return <0 if failed, case insensitive
int findmk(const Vector<String> &p_keys, int p_from = 0, int *r_key = NULL) const; ///< return <0 if failed
bool match(const String &p_wildcard) const;
bool matchn(const String &p_wildcard) const;
@@ -125,10 +129,11 @@ public:
Vector<String> bigrams() const;
float similarity(const String &p_string) const;
String format(const Variant &values, String placeholder = "{_}") const;
- String replace_first(String p_key, String p_with) const;
- String replace(String p_key, String p_with) const;
- String replacen(String p_key, String p_with) const;
- String insert(int p_at_pos, String p_string) const;
+ String replace_first(const String &p_key, const String &p_with) const;
+ String replace(const String &p_key, const String &p_with) const;
+ String replace(const char *p_key, const char *p_with) const;
+ String replacen(const String &p_key, const String &p_with) const;
+ String insert(int p_at_pos, const String &p_string) const;
String pad_decimals(int p_digits) const;
String pad_zeros(int p_digits) const;
String lpad(int min_length, const String &character = " ") const;
@@ -204,7 +209,7 @@ public:
Vector<uint8_t> md5_buffer() const;
Vector<uint8_t> sha256_buffer() const;
- inline bool empty() const { return length() == 0; }
+ _FORCE_INLINE_ bool empty() const { return length() == 0; }
// path functions
bool is_abs_path() const;
@@ -242,6 +247,8 @@ public:
*/
/* String(CharType p_char);*/
inline String() {}
+ inline String(const String &p_str) :
+ Vector(p_str) {}
String(const char *p_str);
String(const CharType *p_str, int p_clip_to_len = -1);
String(const StrRange &p_range);
diff --git a/doc/classes/Camera.xml b/doc/classes/Camera.xml
index 5d6c13498c..91c9ecc774 100644
--- a/doc/classes/Camera.xml
+++ b/doc/classes/Camera.xml
@@ -25,88 +25,6 @@
Get the camera transform. Subclassed cameras (such as CharacterCamera) may provide different transforms than the [Node] transform.
</description>
</method>
- <method name="get_cull_mask" qualifiers="const">
- <return type="int">
- </return>
- <description>
- Returns the culling mask, describing which 3D render layers are rendered by this Camera.
- </description>
- </method>
- <method name="get_doppler_tracking" qualifiers="const">
- <return type="int" enum="Camera.DopplerTracking">
- </return>
- <description>
- </description>
- </method>
- <method name="get_environment" qualifiers="const">
- <return type="Environment">
- </return>
- <description>
- Returns the [Environment] used by this Camera.
- </description>
- </method>
- <method name="get_fov" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Returns the [i]FOV[/i] Y angle in degrees (FOV means Field of View).
- </description>
- </method>
- <method name="get_h_offset" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Returns the horizontal (X) offset of the Camera viewport.
- </description>
- </method>
- <method name="get_keep_aspect_mode" qualifiers="const">
- <return type="int" enum="Camera.KeepAspect">
- </return>
- <description>
- Returns the current mode for keeping the aspect ratio. See [code]KEEP_*[/code] constants.
- </description>
- </method>
- <method name="get_projection" qualifiers="const">
- <return type="int" enum="Camera.Projection">
- </return>
- <description>
- Returns the Camera's projection. See PROJECTION_* constants.
- </description>
- </method>
- <method name="get_size" qualifiers="const">
- <return type="float">
- </return>
- <description>
- </description>
- </method>
- <method name="get_v_offset" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Returns the vertical (Y) offset of the Camera viewport.
- </description>
- </method>
- <method name="get_zfar" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Returns the far clip plane in world space units.
- </description>
- </method>
- <method name="get_znear" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Returns the near clip plane in world space units.
- </description>
- </method>
- <method name="is_current" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if the Camera is the current one in the [Viewport], or plans to become current (if outside the scene tree).
- </description>
- </method>
<method name="is_position_behind" qualifiers="const">
<return type="bool">
</return>
@@ -129,6 +47,7 @@
<argument index="0" name="screen_point" type="Vector2">
</argument>
<description>
+ Returns a normal vector from the screen point location directed along the camera. Orthogonal cameras are normalized. Perspective cameras account for perspective, screen width/height, etc.
</description>
</method>
<method name="project_position" qualifiers="const">
@@ -158,51 +77,6 @@
Returns a 3D position in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.
</description>
</method>
- <method name="set_cull_mask">
- <return type="void">
- </return>
- <argument index="0" name="mask" type="int">
- </argument>
- <description>
- Sets the cull mask, describing which 3D render layers are rendered by this Camera.
- </description>
- </method>
- <method name="set_doppler_tracking">
- <return type="void">
- </return>
- <argument index="0" name="mode" type="int" enum="Camera.DopplerTracking">
- </argument>
- <description>
- Changes Doppler effect tracking. See [code]DOPPLER_*[/code] constants.
- </description>
- </method>
- <method name="set_environment">
- <return type="void">
- </return>
- <argument index="0" name="env" type="Environment">
- </argument>
- <description>
- Sets the [Environment] to use for this Camera.
- </description>
- </method>
- <method name="set_h_offset">
- <return type="void">
- </return>
- <argument index="0" name="ofs" type="float">
- </argument>
- <description>
- Sets the horizontal (X) offset of the Camera viewport.
- </description>
- </method>
- <method name="set_keep_aspect_mode">
- <return type="void">
- </return>
- <argument index="0" name="mode" type="int" enum="Camera.KeepAspect">
- </argument>
- <description>
- Sets the mode for keeping the aspect ratio. See [code]KEEP_*[/code] constants.
- </description>
- </method>
<method name="set_orthogonal">
<return type="void">
</return>
@@ -229,15 +103,6 @@
Set the camera projection to perspective mode, by specifying a [i]FOV[/i] Y angle in degrees (FOV means Field of View), and the [i]near[/i] and [i]far[/i] clip planes in worldspace units.
</description>
</method>
- <method name="set_v_offset">
- <return type="void">
- </return>
- <argument index="0" name="ofs" type="float">
- </argument>
- <description>
- Sets the vertical (Y) offset of the Camera viewport.
- </description>
- </method>
<method name="unproject_position" qualifiers="const">
<return type="Vector2">
</return>
@@ -248,6 +113,47 @@
</description>
</method>
</methods>
+ <members>
+ <member name="cull_mask" type="int" setter="set_cull_mask" getter="get_cull_mask">
+ The culling mask that describes which 3D render layers are rendered by this camera.
+ </member>
+ <member name="current" type="bool" setter="set_current" getter="is_current">
+ If [code]true[/code] the ancestor [Viewport] is currently using this Camera. Default value: [code]false[/code].
+ </member>
+ <member name="doppler_tracking" type="int" setter="set_doppler_tracking" getter="get_doppler_tracking" enum="Camera.DopplerTracking">
+ If not [code]DOPPLER_TRACKING_DISABLED[/code] this Camera will simulate the Doppler effect for objects changed in particular [code]_process[/code] methods. Default value: [code]DOPPLER_TRACKING_DISABLED[/code].
+ </member>
+ <member name="environment" type="Environment" setter="set_environment" getter="get_environment">
+ Set the [Environment] to use for this Camera.
+ </member>
+ <member name="far" type="float" setter="set_zfar" getter="get_zfar">
+ The distance to the far culling boundary for this Camera relative to its local z-axis.
+ </member>
+ <member name="fov" type="float" setter="set_fov" getter="get_fov">
+ The camera's field of view angle (in degrees). Only applicable in perspective mode. Since [member keep_aspect] locks one axis, [code]fov[/code] sets the other axis' field of view angle.
+ </member>
+ <member name="h_offset" type="float" setter="set_h_offset" getter="get_h_offset">
+ The horizontal (X) offset of the Camear viewport.
+ </member>
+ <member name="keep_aspect" type="int" setter="set_keep_aspect_mode" getter="get_keep_aspect_mode" enum="Camera.KeepAspect">
+ The axis to lock during [member fov]/[member size] adjustments.
+ </member>
+ <member name="near" type="float" setter="set_znear" getter="get_znear">
+ The distance to the near culling boundary for this Camera relative to its local z-axis.
+ </member>
+ <member name="projection" type="int" setter="set_projection" getter="get_projection" enum="Camera.Projection">
+ The camera's projection mode. In [code]PROJECTION_PERSPECTIVE[/code] mode, objects' z-distance from the camera's local space scales their perceived size.
+ </member>
+ <member name="size" type="float" setter="set_size" getter="get_size">
+ The camera's size measured as 1/2 the width or height. Only applicable in orthogonal mode. Since [member keep_aspect] locks on axis, [code]size[/code] sets the other axis' size length.
+ </member>
+ <member name="v_offset" type="float" setter="set_v_offset" getter="get_v_offset">
+ The horizontal (Y) offset of the Camear viewport.
+ </member>
+ <member name="vaspect" type="bool" setter="set_vaspect" getter="get_vaspect">
+ A boolean representation of [member keep_aspect] in which [code]true[/code] is equivalent to [code]KEEP_WIDTH[/code].
+ </member>
+ </members>
<constants>
<constant name="PROJECTION_PERSPECTIVE" value="0" enum="Projection">
Perspective Projection (object's size on the screen becomes smaller when far away).
@@ -256,10 +162,10 @@
Orthogonal Projection (objects remain the same size on the screen no matter how far away they are).
</constant>
<constant name="KEEP_WIDTH" value="0" enum="KeepAspect">
- Try to keep the aspect ratio when scaling the Camera's viewport to the screen. If not possible, preserve the viewport's width by changing the height. Height is [code]sizey[/code] for orthographic projection, [code]fovy[/code] for perspective projection.
+ Preserves the horizontal aspect ratio.
</constant>
<constant name="KEEP_HEIGHT" value="1" enum="KeepAspect">
- Try to keep the aspect ratio when scaling the Camera's viewport to the screen. If not possible, preserve the viewport's height by changing the width. Width is [code]sizex[/code] for orthographic projection, [code]fovx[/code] for perspective projection.
+ Preserves the vertical aspect ratio.
</constant>
<constant name="DOPPLER_TRACKING_DISABLED" value="0" enum="DopplerTracking">
Disable Doppler effect simulation (default).
diff --git a/doc/classes/Navigation.xml b/doc/classes/Navigation.xml
index 995cb5b179..8fe520f853 100644
--- a/doc/classes/Navigation.xml
+++ b/doc/classes/Navigation.xml
@@ -64,7 +64,7 @@
Returns a path of points as a [code]PoolVector3Array[/code]. If [code]optimize[/code] is false the [code]NavigationMesh[/code] agent properties will be taken into account, otherwise it will return the nearest path and ignore agent radius, height, etc.
</description>
</method>
- <method name="navmesh_create">
+ <method name="navmesh_add">
<return type="int">
</return>
<argument index="0" name="mesh" type="NavigationMesh">
diff --git a/doc/classes/Navigation2D.xml b/doc/classes/Navigation2D.xml
index 8868348cf9..18c15a616a 100644
--- a/doc/classes/Navigation2D.xml
+++ b/doc/classes/Navigation2D.xml
@@ -37,7 +37,7 @@
<description>
</description>
</method>
- <method name="navpoly_create">
+ <method name="navpoly_add">
<return type="int">
</return>
<argument index="0" name="mesh" type="NavigationPolygon">
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 13fbb5c293..29ab531177 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1557,7 +1557,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) {
glEnableVertexAttribArray(VS::ARRAY_NORMAL);
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector3) * vertices, c.normals.ptr());
- glVertexAttribPointer(VS::ARRAY_NORMAL, 3, GL_FLOAT, false, sizeof(Vector3) * vertices, ((uint8_t *)NULL) + buf_ofs);
+ glVertexAttribPointer(VS::ARRAY_NORMAL, 3, GL_FLOAT, false, sizeof(Vector3), ((uint8_t *)NULL) + buf_ofs);
buf_ofs += sizeof(Vector3) * vertices;
} else {
@@ -1569,7 +1569,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) {
glEnableVertexAttribArray(VS::ARRAY_TANGENT);
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Plane) * vertices, c.tangents.ptr());
- glVertexAttribPointer(VS::ARRAY_TANGENT, 4, GL_FLOAT, false, sizeof(Plane) * vertices, ((uint8_t *)NULL) + buf_ofs);
+ glVertexAttribPointer(VS::ARRAY_TANGENT, 4, GL_FLOAT, false, sizeof(Plane), ((uint8_t *)NULL) + buf_ofs);
buf_ofs += sizeof(Plane) * vertices;
} else {
diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp
index 61d2737555..f6742d8114 100644
--- a/drivers/unix/packet_peer_udp_posix.cpp
+++ b/drivers/unix/packet_peer_udp_posix.cpp
@@ -65,7 +65,7 @@ int PacketPeerUDPPosix::get_available_packet_count() const {
return queue_count;
}
-Error PacketPeerUDPPosix::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const {
+Error PacketPeerUDPPosix::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
Error err = const_cast<PacketPeerUDPPosix *>(this)->_poll(false);
if (err != OK)
diff --git a/drivers/unix/packet_peer_udp_posix.h b/drivers/unix/packet_peer_udp_posix.h
index e580d336b2..ad7be5bbe0 100644
--- a/drivers/unix/packet_peer_udp_posix.h
+++ b/drivers/unix/packet_peer_udp_posix.h
@@ -41,12 +41,12 @@ class PacketPeerUDPPosix : public PacketPeerUDP {
PACKET_BUFFER_SIZE = 65536
};
- mutable RingBuffer<uint8_t> rb;
+ RingBuffer<uint8_t> rb;
uint8_t recv_buffer[PACKET_BUFFER_SIZE];
- mutable uint8_t packet_buffer[PACKET_BUFFER_SIZE];
- mutable IP_Address packet_ip;
- mutable int packet_port;
- mutable int queue_count;
+ uint8_t packet_buffer[PACKET_BUFFER_SIZE];
+ IP_Address packet_ip;
+ int packet_port;
+ int queue_count;
int sockfd;
bool sock_blocking;
IP::Type sock_type;
@@ -62,7 +62,7 @@ class PacketPeerUDPPosix : public PacketPeerUDP {
public:
virtual int get_available_packet_count() const;
- virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const;
+ virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
virtual int get_max_packet_size() const;
diff --git a/platform/windows/packet_peer_udp_winsock.cpp b/drivers/windows/packet_peer_udp_winsock.cpp
index d414ec891e..119ee68bd2 100644
--- a/platform/windows/packet_peer_udp_winsock.cpp
+++ b/drivers/windows/packet_peer_udp_winsock.cpp
@@ -27,6 +27,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifdef WINDOWS_ENABLED
+
#include "packet_peer_udp_winsock.h"
#include <winsock2.h>
@@ -43,7 +45,7 @@ int PacketPeerUDPWinsock::get_available_packet_count() const {
return queue_count;
}
-Error PacketPeerUDPWinsock::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const {
+Error PacketPeerUDPWinsock::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
Error err = const_cast<PacketPeerUDPWinsock *>(this)->_poll(false);
if (err != OK)
@@ -291,3 +293,5 @@ PacketPeerUDPWinsock::~PacketPeerUDPWinsock() {
close();
}
+
+#endif
diff --git a/platform/windows/packet_peer_udp_winsock.h b/drivers/windows/packet_peer_udp_winsock.h
index 8a6951fd6e..8ce2cff741 100644
--- a/platform/windows/packet_peer_udp_winsock.h
+++ b/drivers/windows/packet_peer_udp_winsock.h
@@ -27,6 +27,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifdef WINDOWS_ENABLED
+
#ifndef PACKET_PEER_UDP_WINSOCK_H
#define PACKET_PEER_UDP_WINSOCK_H
@@ -39,12 +41,12 @@ class PacketPeerUDPWinsock : public PacketPeerUDP {
PACKET_BUFFER_SIZE = 65536
};
- mutable RingBuffer<uint8_t> rb;
+ RingBuffer<uint8_t> rb;
uint8_t recv_buffer[PACKET_BUFFER_SIZE];
- mutable uint8_t packet_buffer[PACKET_BUFFER_SIZE];
- mutable IP_Address packet_ip;
- mutable int packet_port;
- mutable int queue_count;
+ uint8_t packet_buffer[PACKET_BUFFER_SIZE];
+ IP_Address packet_ip;
+ int packet_port;
+ int queue_count;
int sockfd;
bool sock_blocking;
IP::Type sock_type;
@@ -62,7 +64,7 @@ class PacketPeerUDPWinsock : public PacketPeerUDP {
public:
virtual int get_available_packet_count() const;
- virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const;
+ virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
virtual int get_max_packet_size() const;
@@ -82,3 +84,5 @@ public:
~PacketPeerUDPWinsock();
};
#endif // PACKET_PEER_UDP_WINSOCK_H
+
+#endif
diff --git a/platform/windows/stream_peer_winsock.cpp b/drivers/windows/stream_peer_tcp_winsock.cpp
index 8b83215325..f4cd38079d 100644
--- a/platform/windows/stream_peer_winsock.cpp
+++ b/drivers/windows/stream_peer_tcp_winsock.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* stream_peer_winsock.cpp */
+/* stream_peer_tcp_winsock.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -29,7 +29,7 @@
/*************************************************************************/
#ifdef WINDOWS_ENABLED
-#include "stream_peer_winsock.h"
+#include "stream_peer_tcp_winsock.h"
#include <winsock2.h>
#include <ws2tcpip.h>
@@ -38,14 +38,14 @@
int winsock_refcount = 0;
-StreamPeerTCP *StreamPeerWinsock::_create() {
+StreamPeerTCP *StreamPeerTCPWinsock::_create() {
- return memnew(StreamPeerWinsock);
+ return memnew(StreamPeerTCPWinsock);
};
-void StreamPeerWinsock::make_default() {
+void StreamPeerTCPWinsock::make_default() {
- StreamPeerTCP::_create = StreamPeerWinsock::_create;
+ StreamPeerTCP::_create = StreamPeerTCPWinsock::_create;
if (winsock_refcount == 0) {
WSADATA data;
@@ -54,7 +54,7 @@ void StreamPeerWinsock::make_default() {
++winsock_refcount;
};
-void StreamPeerWinsock::cleanup() {
+void StreamPeerTCPWinsock::cleanup() {
--winsock_refcount;
if (winsock_refcount == 0) {
@@ -63,7 +63,7 @@ void StreamPeerWinsock::cleanup() {
};
};
-Error StreamPeerWinsock::_block(int p_sockfd, bool p_read, bool p_write) const {
+Error StreamPeerTCPWinsock::_block(int p_sockfd, bool p_read, bool p_write) const {
fd_set read, write;
FD_ZERO(&read);
@@ -78,7 +78,7 @@ Error StreamPeerWinsock::_block(int p_sockfd, bool p_read, bool p_write) const {
return ret < 0 ? FAILED : OK;
};
-Error StreamPeerWinsock::_poll_connection() const {
+Error StreamPeerTCPWinsock::_poll_connection() const {
ERR_FAIL_COND_V(status != STATUS_CONNECTING || sockfd == INVALID_SOCKET, FAILED);
@@ -108,7 +108,7 @@ Error StreamPeerWinsock::_poll_connection() const {
return OK;
};
-Error StreamPeerWinsock::write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block) {
+Error StreamPeerTCPWinsock::write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block) {
if (status == STATUS_NONE || status == STATUS_ERROR) {
@@ -166,7 +166,7 @@ Error StreamPeerWinsock::write(const uint8_t *p_data, int p_bytes, int &r_sent,
return OK;
};
-Error StreamPeerWinsock::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block) {
+Error StreamPeerTCPWinsock::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block) {
if (!is_connected_to_host()) {
@@ -224,29 +224,29 @@ Error StreamPeerWinsock::read(uint8_t *p_buffer, int p_bytes, int &r_received, b
return OK;
};
-Error StreamPeerWinsock::put_data(const uint8_t *p_data, int p_bytes) {
+Error StreamPeerTCPWinsock::put_data(const uint8_t *p_data, int p_bytes) {
int total;
return write(p_data, p_bytes, total, true);
};
-Error StreamPeerWinsock::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
+Error StreamPeerTCPWinsock::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
return write(p_data, p_bytes, r_sent, false);
};
-Error StreamPeerWinsock::get_data(uint8_t *p_buffer, int p_bytes) {
+Error StreamPeerTCPWinsock::get_data(uint8_t *p_buffer, int p_bytes) {
int total;
return read(p_buffer, p_bytes, total, true);
};
-Error StreamPeerWinsock::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
+Error StreamPeerTCPWinsock::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
return read(p_buffer, p_bytes, r_received, false);
};
-StreamPeerTCP::Status StreamPeerWinsock::get_status() const {
+StreamPeerTCP::Status StreamPeerTCPWinsock::get_status() const {
if (status == STATUS_CONNECTING) {
_poll_connection();
@@ -255,7 +255,7 @@ StreamPeerTCP::Status StreamPeerWinsock::get_status() const {
return status;
};
-bool StreamPeerWinsock::is_connected_to_host() const {
+bool StreamPeerTCPWinsock::is_connected_to_host() const {
if (status == STATUS_NONE || status == STATUS_ERROR) {
@@ -268,7 +268,7 @@ bool StreamPeerWinsock::is_connected_to_host() const {
return (sockfd != INVALID_SOCKET);
};
-void StreamPeerWinsock::disconnect_from_host() {
+void StreamPeerTCPWinsock::disconnect_from_host() {
if (sockfd != INVALID_SOCKET)
closesocket(sockfd);
@@ -281,7 +281,7 @@ void StreamPeerWinsock::disconnect_from_host() {
peer_port = 0;
};
-void StreamPeerWinsock::set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_sock_type) {
+void StreamPeerTCPWinsock::set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_sock_type) {
sockfd = p_sockfd;
sock_type = p_sock_type;
@@ -290,7 +290,7 @@ void StreamPeerWinsock::set_socket(int p_sockfd, IP_Address p_host, int p_port,
peer_port = p_port;
};
-Error StreamPeerWinsock::connect_to_host(const IP_Address &p_host, uint16_t p_port) {
+Error StreamPeerTCPWinsock::connect_to_host(const IP_Address &p_host, uint16_t p_port) {
ERR_FAIL_COND_V(!p_host.is_valid(), ERR_INVALID_PARAMETER);
@@ -331,13 +331,13 @@ Error StreamPeerWinsock::connect_to_host(const IP_Address &p_host, uint16_t p_po
return OK;
};
-void StreamPeerWinsock::set_nodelay(bool p_enabled) {
+void StreamPeerTCPWinsock::set_nodelay(bool p_enabled) {
ERR_FAIL_COND(!is_connected_to_host());
int flag = p_enabled ? 1 : 0;
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int));
}
-int StreamPeerWinsock::get_available_bytes() const {
+int StreamPeerTCPWinsock::get_available_bytes() const {
unsigned long len;
int ret = ioctlsocket(sockfd, FIONREAD, &len);
@@ -345,17 +345,17 @@ int StreamPeerWinsock::get_available_bytes() const {
return len;
}
-IP_Address StreamPeerWinsock::get_connected_host() const {
+IP_Address StreamPeerTCPWinsock::get_connected_host() const {
return peer_host;
};
-uint16_t StreamPeerWinsock::get_connected_port() const {
+uint16_t StreamPeerTCPWinsock::get_connected_port() const {
return peer_port;
};
-StreamPeerWinsock::StreamPeerWinsock() {
+StreamPeerTCPWinsock::StreamPeerTCPWinsock() {
sock_type = IP::TYPE_NONE;
sockfd = INVALID_SOCKET;
@@ -363,7 +363,7 @@ StreamPeerWinsock::StreamPeerWinsock() {
peer_port = 0;
};
-StreamPeerWinsock::~StreamPeerWinsock() {
+StreamPeerTCPWinsock::~StreamPeerTCPWinsock() {
disconnect_from_host();
};
diff --git a/platform/windows/stream_peer_winsock.h b/drivers/windows/stream_peer_tcp_winsock.h
index 26e2a3e4c9..fef457c43f 100644
--- a/platform/windows/stream_peer_winsock.h
+++ b/drivers/windows/stream_peer_tcp_winsock.h
@@ -29,15 +29,15 @@
/*************************************************************************/
#ifdef WINDOWS_ENABLED
-#ifndef STREAM_PEER_WINSOCK_H
-#define STREAM_PEER_WINSOCK_H
+#ifndef STREAM_PEER_TCP_WINSOCK_H
+#define STREAM_PEER_TCP_WINSOCK_H
#include "error_list.h"
#include "core/io/ip_address.h"
#include "core/io/stream_peer_tcp.h"
-class StreamPeerWinsock : public StreamPeerTCP {
+class StreamPeerTCPWinsock : public StreamPeerTCP {
protected:
mutable Status status;
@@ -82,10 +82,10 @@ public:
virtual void set_nodelay(bool p_enabled);
- StreamPeerWinsock();
- ~StreamPeerWinsock();
+ StreamPeerTCPWinsock();
+ ~StreamPeerTCPWinsock();
};
-#endif // TCP_SOCKET_POSIX_H
+#endif // STREAM_PEER_TCP_WINSOCK_H
#endif
diff --git a/platform/windows/tcp_server_winsock.cpp b/drivers/windows/tcp_server_winsock.cpp
index de300befa7..49de279793 100644
--- a/platform/windows/tcp_server_winsock.cpp
+++ b/drivers/windows/tcp_server_winsock.cpp
@@ -27,9 +27,11 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifdef WINDOWS_ENABLED
+
#include "tcp_server_winsock.h"
-#include "stream_peer_winsock.h"
+#include "stream_peer_tcp_winsock.h"
#include <winsock2.h>
#include <ws2tcpip.h>
@@ -151,7 +153,7 @@ Ref<StreamPeerTCP> TCPServerWinsock::take_connection() {
int fd = accept(listen_sockfd, (struct sockaddr *)&their_addr, &sin_size);
ERR_FAIL_COND_V(fd == INVALID_SOCKET, NULL);
- Ref<StreamPeerWinsock> conn = memnew(StreamPeerWinsock);
+ Ref<StreamPeerTCPWinsock> conn = memnew(StreamPeerTCPWinsock);
IP_Address ip;
int port;
_set_ip_addr_port(ip, port, &their_addr);
@@ -181,3 +183,5 @@ TCPServerWinsock::~TCPServerWinsock() {
stop();
};
+
+#endif
diff --git a/platform/windows/tcp_server_winsock.h b/drivers/windows/tcp_server_winsock.h
index a3e01098ed..fd16480167 100644
--- a/platform/windows/tcp_server_winsock.h
+++ b/drivers/windows/tcp_server_winsock.h
@@ -27,6 +27,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifdef WINDOWS_ENABLED
+
#ifndef TCP_SERVER_WINSOCK_H
#define TCP_SERVER_WINSOCK_H
@@ -54,3 +56,5 @@ public:
};
#endif
+
+#endif
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index b330f5d177..3585417d13 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -1288,8 +1288,18 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset,
return valid;
}
-String EditorExportPlatformPC::get_binary_extension() const {
- return extension;
+String EditorExportPlatformPC::get_binary_extension(const Ref<EditorExportPreset> &p_preset) const {
+ for (Map<String, String>::Element *E = extensions.front(); E; E = E->next()) {
+ if (p_preset->get(E->key())) {
+ return extensions[E->key()];
+ }
+ }
+
+ if (extensions.has("default")) {
+ return extensions["default"];
+ }
+
+ return "";
}
Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
@@ -1337,8 +1347,8 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
return save_pack(p_preset, pck_path);
}
-void EditorExportPlatformPC::set_extension(const String &p_extension) {
- extension = p_extension;
+void EditorExportPlatformPC::set_extension(const String &p_extension, const String &p_feature_key) {
+ extensions[p_feature_key] = p_extension;
}
void EditorExportPlatformPC::set_name(const String &p_name) {
diff --git a/editor/editor_export.h b/editor/editor_export.h
index 8b1cf4bcff..02b15aff10 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -240,7 +240,7 @@ public:
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const = 0;
- virtual String get_binary_extension() const = 0;
+ virtual String get_binary_extension(const Ref<EditorExportPreset> &p_preset) const = 0;
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) = 0;
virtual void get_platform_features(List<String> *r_features) = 0;
@@ -363,7 +363,7 @@ class EditorExportPlatformPC : public EditorExportPlatform {
Ref<ImageTexture> logo;
String name;
String os_name;
- String extension;
+ Map<String, String> extensions;
String release_file_32;
String release_file_64;
@@ -385,10 +385,10 @@ public:
virtual Ref<Texture> get_logo() const;
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const;
- virtual String get_binary_extension() const;
+ virtual String get_binary_extension(const Ref<EditorExportPreset> &p_preset) const;
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
- void set_extension(const String &p_extension);
+ void set_extension(const String &p_extension, const String &p_feature_key = "default");
void set_name(const String &p_name);
void set_os_name(const String &p_name);
diff --git a/editor/editor_sub_scene.cpp b/editor/editor_sub_scene.cpp
index b81dfd3f46..fad9346b38 100644
--- a/editor/editor_sub_scene.cpp
+++ b/editor/editor_sub_scene.cpp
@@ -96,14 +96,54 @@ void EditorSubScene::_fill_tree(Node *p_node, TreeItem *p_parent) {
}
}
-void EditorSubScene::ok_pressed() {
+void EditorSubScene::_selected_changed() {
+ selection.clear();
+ is_root = false;
+}
- TreeItem *s = tree->get_selected();
- if (!s)
- return;
- Node *selnode = s->get_metadata(0);
- if (!selnode)
+void EditorSubScene::_item_multi_selected(Object *p_object, int p_cell, bool p_selected) {
+ if (!is_root) {
+ TreeItem *item = Object::cast_to<TreeItem>(p_object);
+ ERR_FAIL_COND(!item);
+
+ Node *n = item->get_metadata(0);
+
+ if (!n)
+ return;
+ if (p_selected) {
+ if (n == scene) {
+ is_root = true;
+ selection.clear();
+ }
+ selection.push_back(n);
+ }
+ }
+}
+
+void EditorSubScene::_remove_selection_child(Node *n) {
+ if (n->get_child_count() > 0) {
+ for (int i = 0; i < n->get_child_count(); i++) {
+ Node *c = n->get_child(i);
+ List<Node *>::Element *E = selection.find(c);
+ if (E) {
+ selection.move_to_back(E);
+ selection.pop_back();
+ }
+ if (c->get_child_count() > 0) {
+ _remove_selection_child(c);
+ }
+ }
+ }
+}
+
+void EditorSubScene::ok_pressed() {
+ if (selection.size() <= 0) {
return;
+ }
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ Node *c = E->get();
+ _remove_selection_child(c);
+ }
emit_signal("subscene_selected");
hide();
clear();
@@ -127,37 +167,34 @@ void EditorSubScene::_reown(Node *p_node, List<Node *> *p_to_reown) {
}
void EditorSubScene::move(Node *p_new_parent, Node *p_new_owner) {
-
if (!scene) {
return;
}
- TreeItem *s = tree->get_selected();
- if (!s) {
- return;
- }
- Node *selnode = s->get_metadata(0);
- if (!selnode) {
+ if (selection.size() <= 0) {
return;
}
- List<Node *> to_reown;
- _reown(selnode, &to_reown);
-
- if (selnode != scene) {
- selnode->get_parent()->remove_child(selnode);
- }
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ Node *selnode = E->get();
+ if (!selnode) {
+ return;
+ }
+ List<Node *> to_reown;
+ _reown(selnode, &to_reown);
+ if (selnode != scene) {
+ selnode->get_parent()->remove_child(selnode);
+ }
- p_new_parent->add_child(selnode);
- for (List<Node *>::Element *E = to_reown.front(); E; E = E->next()) {
- E->get()->set_owner(p_new_owner);
+ p_new_parent->add_child(selnode);
+ for (List<Node *>::Element *E = to_reown.front(); E; E = E->next()) {
+ E->get()->set_owner(p_new_owner);
+ }
}
-
- if (selnode != scene) {
+ if (!is_root) {
memdelete(scene);
}
scene = NULL;
-
//return selnode;
}
@@ -172,12 +209,15 @@ void EditorSubScene::_bind_methods() {
ClassDB::bind_method(D_METHOD("_path_selected"), &EditorSubScene::_path_selected);
ClassDB::bind_method(D_METHOD("_path_changed"), &EditorSubScene::_path_changed);
ClassDB::bind_method(D_METHOD("_path_browse"), &EditorSubScene::_path_browse);
+ ClassDB::bind_method(D_METHOD("_item_multi_selected"), &EditorSubScene::_item_multi_selected);
+ ClassDB::bind_method(D_METHOD("_selected_changed"), &EditorSubScene::_selected_changed);
ADD_SIGNAL(MethodInfo("subscene_selected"));
}
EditorSubScene::EditorSubScene() {
scene = NULL;
+ is_root = false;
set_title(TTR("Select Node(s) to Import"));
set_hide_on_ok(false);
@@ -200,6 +240,11 @@ EditorSubScene::EditorSubScene() {
tree = memnew(Tree);
tree->set_v_size_flags(SIZE_EXPAND_FILL);
vb->add_margin_child(TTR("Import From Node:"), tree, true);
+ tree->set_select_mode(Tree::SELECT_MULTI);
+ tree->connect("multi_selected", this, "_item_multi_selected");
+ //tree->connect("nothing_selected", this, "_deselect_items");
+ tree->connect("cell_selected", this, "_selected_changed");
+
tree->connect("item_activated", this, "_ok", make_binds(), CONNECT_DEFERRED);
file_dialog = memnew(EditorFileDialog);
diff --git a/editor/editor_sub_scene.h b/editor/editor_sub_scene.h
index 13ce19bbb2..db9d91018a 100644
--- a/editor/editor_sub_scene.h
+++ b/editor/editor_sub_scene.h
@@ -38,13 +38,18 @@ class EditorSubScene : public ConfirmationDialog {
GDCLASS(EditorSubScene, ConfirmationDialog);
+ List<Node *> selection;
LineEdit *path;
Tree *tree;
Node *scene;
+ bool is_root;
EditorFileDialog *file_dialog;
void _fill_tree(Node *p_node, TreeItem *p_parent);
+ void _selected_changed();
+ void _item_multi_selected(Object *p_object, int p_cell, bool p_selected);
+ void _remove_selection_child(Node *c);
void _reown(Node *p_node, List<Node *> *p_to_reown);
void ok_pressed();
diff --git a/editor/plugins/mesh_instance_editor_plugin.h b/editor/plugins/mesh_instance_editor_plugin.h
index 68c149f98a..32c779509a 100644
--- a/editor/plugins/mesh_instance_editor_plugin.h
+++ b/editor/plugins/mesh_instance_editor_plugin.h
@@ -35,9 +35,9 @@
#include "scene/3d/mesh_instance.h"
#include "scene/gui/spin_box.h"
-class MeshInstanceEditor : public Node {
+class MeshInstanceEditor : public Control {
- GDCLASS(MeshInstanceEditor, Node);
+ GDCLASS(MeshInstanceEditor, Control);
enum Menu {
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index c02b3458e5..591e6dac56 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1329,12 +1329,12 @@ void ScriptEditor::_members_overview_selected(int p_idx) {
if (!se) {
return;
}
- Dictionary state;
- state["scroll_position"] = members_overview->get_item_metadata(p_idx);
+ // Go to the member's line and reset the cursor column. We can't just change scroll_position
+ // directly, since code might be folded.
+ se->goto_line(members_overview->get_item_metadata(p_idx));
+ Dictionary state = se->get_edit_state();
state["column"] = 0;
- state["row"] = members_overview->get_item_metadata(p_idx);
se->set_edit_state(state);
- se->ensure_focus();
}
void ScriptEditor::_help_overview_selected(int p_idx) {
@@ -1845,6 +1845,11 @@ void ScriptEditor::apply_scripts() const {
}
}
+void ScriptEditor::open_script_create_dialog(const String &p_base_name, const String &p_base_path) {
+ _menu_option(FILE_NEW);
+ script_create_dialog->config(p_base_name, p_base_path);
+}
+
void ScriptEditor::_editor_play() {
debugger->start();
@@ -2548,6 +2553,7 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script);
ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts);
+ ClassDB::bind_method(D_METHOD("open_script_create_dialog", "base_name", "base_path"), &ScriptEditor::open_script_create_dialog);
ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script")));
ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script")));
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index ffd42d18ca..9d5c110dec 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -360,6 +360,7 @@ public:
void ensure_focus_current();
void apply_scripts() const;
+ void open_script_create_dialog(const String &p_base_name, const String &p_base_path);
void ensure_select_current();
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 95f2739927..0610f55b3f 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -537,10 +537,6 @@ void ScriptTextEditor::set_edit_state(const Variant &p_state) {
code_editor->get_text_edit()->cursor_set_line(state["row"]);
code_editor->get_text_edit()->set_v_scroll(state["scroll_position"]);
code_editor->get_text_edit()->grab_focus();
-
- //int scroll_pos;
- //int cursor_column;
- //int cursor_row;
}
String ScriptTextEditor::get_name() {
@@ -924,26 +920,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
if (scr.is_null())
return;
- tx->begin_complex_operation();
- if (tx->is_selection_active()) {
- tx->indent_selection_left();
- } else {
- int begin = tx->cursor_get_line();
- String line_text = tx->get_line(begin);
- // begins with tab
- if (line_text.begins_with("\t")) {
- line_text = line_text.substr(1, line_text.length());
- tx->set_line(begin, line_text);
- }
- // begins with 4 spaces
- else if (line_text.begins_with(" ")) {
- line_text = line_text.substr(4, line_text.length());
- tx->set_line(begin, line_text);
- }
- }
- tx->end_complex_operation();
- tx->update();
- //tx->deselect();
+ tx->indent_left();
} break;
case EDIT_INDENT_RIGHT: {
@@ -951,18 +928,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
if (scr.is_null())
return;
- tx->begin_complex_operation();
- if (tx->is_selection_active()) {
- tx->indent_selection_right();
- } else {
- int begin = tx->cursor_get_line();
- String line_text = tx->get_line(begin);
- line_text = '\t' + line_text;
- tx->set_line(begin, line_text);
- }
- tx->end_complex_operation();
- tx->update();
- //tx->deselect();
+ tx->indent_right();
} break;
case EDIT_DELETE_LINE: {
@@ -1503,14 +1469,15 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/select_all"), EDIT_SELECT_ALL);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
+ context_menu->add_separator();
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
if (p_selection) {
context_menu->add_separator();
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_to_uppercase"), EDIT_TO_UPPERCASE);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_to_lowercase"), EDIT_TO_LOWERCASE);
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
}
if (p_can_fold || p_is_folded)
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_fold_line"), EDIT_TOGGLE_FOLD_LINE);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index bd6efee2db..3e00776dfd 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -379,26 +379,7 @@ void ShaderEditor::_menu_option(int p_option) {
if (shader.is_null())
return;
- tx->begin_complex_operation();
- if (tx->is_selection_active()) {
- tx->indent_selection_left();
- } else {
- int begin = tx->cursor_get_line();
- String line_text = tx->get_line(begin);
- // begins with tab
- if (line_text.begins_with("\t")) {
- line_text = line_text.substr(1, line_text.length());
- tx->set_line(begin, line_text);
- }
- // begins with 4 spaces
- else if (line_text.begins_with(" ")) {
- line_text = line_text.substr(4, line_text.length());
- tx->set_line(begin, line_text);
- }
- }
- tx->end_complex_operation();
- tx->update();
- //tx->deselect();
+ tx->indent_left();
} break;
case EDIT_INDENT_RIGHT: {
@@ -407,18 +388,7 @@ void ShaderEditor::_menu_option(int p_option) {
if (shader.is_null())
return;
- tx->begin_complex_operation();
- if (tx->is_selection_active()) {
- tx->indent_selection_right();
- } else {
- int begin = tx->cursor_get_line();
- String line_text = tx->get_line(begin);
- line_text = '\t' + line_text;
- tx->set_line(begin, line_text);
- }
- tx->end_complex_operation();
- tx->update();
- //tx->deselect();
+ tx->indent_right();
} break;
case EDIT_DELETE_LINE: {
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 767dbcc27b..3c31b70564 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -718,7 +718,9 @@ void ProjectExportDialog::_export_project() {
export_project->set_access(FileDialog::ACCESS_FILESYSTEM);
export_project->clear_filters();
export_project->set_current_file(default_filename);
- String extension = platform->get_binary_extension();
+
+ String extension = platform->get_binary_extension(current);
+
if (extension != String()) {
export_project->add_filter("*." + extension + " ; " + platform->get_name() + " Export");
}
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index d22bee40d9..16ce364b92 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -551,6 +551,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
text_edit->show();
text_edit->set_text(v);
+ text_edit->deselect();
int button_margin = get_constant("button_margin", "Dialogs");
int margin = get_constant("margin", "Dialogs");
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 4d86030e7d..4d5d467857 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1373,77 +1373,81 @@ void SceneTreeDock::_create() {
}
} else if (current_option == TOOL_REPLACE) {
- Node *n = scene_tree->get_selected();
- ERR_FAIL_COND(!n);
+ List<Node *> selection = editor_selection->get_selected_node_list();
+ ERR_FAIL_COND(selection.size() <= 0);
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ Node *n = E->get();
+ ERR_FAIL_COND(!n);
- Object *c = create_dialog->instance_selected();
+ Object *c = create_dialog->instance_selected();
- ERR_FAIL_COND(!c);
- Node *newnode = Object::cast_to<Node>(c);
- ERR_FAIL_COND(!newnode);
+ ERR_FAIL_COND(!c);
+ Node *newnode = Object::cast_to<Node>(c);
+ ERR_FAIL_COND(!newnode);
- List<PropertyInfo> pinfo;
- n->get_property_list(&pinfo);
+ List<PropertyInfo> pinfo;
+ n->get_property_list(&pinfo);
- for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
- if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
- continue;
- if (E->get().name == "__meta__")
- continue;
- newnode->set(E->get().name, n->get(E->get().name));
- }
+ for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
+ if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
+ continue;
+ if (E->get().name == "__meta__")
+ continue;
+ newnode->set(E->get().name, n->get(E->get().name));
+ }
- editor->push_item(NULL);
+ editor->push_item(NULL);
- //reconnect signals
- List<MethodInfo> sl;
+ //reconnect signals
+ List<MethodInfo> sl;
- n->get_signal_list(&sl);
- for (List<MethodInfo>::Element *E = sl.front(); E; E = E->next()) {
+ n->get_signal_list(&sl);
+ for (List<MethodInfo>::Element *E = sl.front(); E; E = E->next()) {
- List<Object::Connection> cl;
- n->get_signal_connection_list(E->get().name, &cl);
+ List<Object::Connection> cl;
+ n->get_signal_connection_list(E->get().name, &cl);
- for (List<Object::Connection>::Element *F = cl.front(); F; F = F->next()) {
+ for (List<Object::Connection>::Element *F = cl.front(); F; F = F->next()) {
- Object::Connection &c = F->get();
- if (!(c.flags & Object::CONNECT_PERSIST))
- continue;
- newnode->connect(c.signal, c.target, c.method, varray(), Object::CONNECT_PERSIST);
+ Object::Connection &c = F->get();
+ if (!(c.flags & Object::CONNECT_PERSIST))
+ continue;
+ newnode->connect(c.signal, c.target, c.method, varray(), Object::CONNECT_PERSIST);
+ }
}
- }
- String newname = n->get_name();
+ String newname = n->get_name();
- List<Node *> to_erase;
- for (int i = 0; i < n->get_child_count(); i++) {
- if (n->get_child(i)->get_owner() == NULL && n->is_owned_by_parent()) {
- to_erase.push_back(n->get_child(i));
+ List<Node *> to_erase;
+ for (int i = 0; i < n->get_child_count(); i++) {
+ if (n->get_child(i)->get_owner() == NULL && n->is_owned_by_parent()) {
+ to_erase.push_back(n->get_child(i));
+ }
}
- }
- n->replace_by(newnode, true);
+ n->replace_by(newnode, true);
- if (n == edited_scene) {
- edited_scene = newnode;
- editor->set_edited_scene(newnode);
- newnode->set_editable_instances(n->get_editable_instances());
- }
+ if (n == edited_scene) {
+ edited_scene = newnode;
+ editor->set_edited_scene(newnode);
+ newnode->set_editable_instances(n->get_editable_instances());
+ }
- //small hack to make collisionshapes and other kind of nodes to work
- for (int i = 0; i < newnode->get_child_count(); i++) {
- Node *c = newnode->get_child(i);
- c->call("set_transform", c->call("get_transform"));
- }
- editor_data->get_undo_redo().clear_history();
- newnode->set_name(newname);
+ //small hack to make collisionshapes and other kind of nodes to work
+ for (int i = 0; i < newnode->get_child_count(); i++) {
+ Node *c = newnode->get_child(i);
+ c->call("set_transform", c->call("get_transform"));
+ }
+ editor_data->get_undo_redo().clear_history();
+ newnode->set_name(newname);
- editor->push_item(newnode);
+ editor->push_item(newnode);
- memdelete(n);
+ memdelete(n);
- while (to_erase.front()) {
- memdelete(to_erase.front()->get());
- to_erase.pop_front();
+ while (to_erase.front()) {
+ memdelete(to_erase.front()->get());
+ to_erase.pop_front();
+ }
}
}
}
@@ -1737,13 +1741,12 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
menu->add_icon_shortcut(get_icon("Add", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW);
menu->add_icon_shortcut(get_icon("Instance", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE);
menu->add_separator();
- menu->add_icon_shortcut(get_icon("Reload", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/change_node_type"), TOOL_REPLACE);
- menu->add_separator();
menu->add_icon_shortcut(get_icon("ScriptCreate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT);
menu->add_icon_shortcut(get_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT);
menu->add_separator();
}
-
+ menu->add_icon_shortcut(get_icon("Reload", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/change_node_type"), TOOL_REPLACE);
+ menu->add_separator();
menu->add_icon_shortcut(get_icon("MoveUp", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_up"), TOOL_MOVE_UP);
menu->add_icon_shortcut(get_icon("MoveDown", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_down"), TOOL_MOVE_DOWN);
menu->add_icon_shortcut(get_icon("Duplicate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/duplicate"), TOOL_DUPLICATE);
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 3e503c45a5..827e8d9ee4 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -774,9 +774,11 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from
Node *n = get_node(np);
if (n) {
-
- selected.push_back(n);
- icons.push_back(next->get_icon(0));
+ // Only allow selection if not part of an instanced scene.
+ if (!n->get_owner() || n->get_owner() == get_scene_node() || n->get_owner()->get_filename() == String()) {
+ selected.push_back(n);
+ icons.push_back(next->get_icon(0));
+ }
}
next = tree->get_next_selected(next);
}
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index f99a2eafdd..97f442b0ec 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -331,6 +331,12 @@ void ScriptCreateDialog::_file_selected(const String &p_file) {
} else {
file_path->set_text(p);
_path_changed(p);
+
+ String filename = p.get_file().get_basename();
+ int select_start = p.find_last(filename);
+ file_path->select(select_start, select_start + filename.length());
+ file_path->set_cursor_position(select_start + filename.length());
+ file_path->grab_focus();
}
}
@@ -425,6 +431,10 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
_update_dialog();
}
+void ScriptCreateDialog::_path_entered(const String &p_path) {
+ ok_pressed();
+}
+
void ScriptCreateDialog::_msg_script_valid(bool valid, const String &p_msg) {
error_label->set_text(TTR(p_msg));
@@ -550,6 +560,7 @@ void ScriptCreateDialog::_bind_methods() {
ClassDB::bind_method("_browse_path", &ScriptCreateDialog::_browse_path);
ClassDB::bind_method("_file_selected", &ScriptCreateDialog::_file_selected);
ClassDB::bind_method("_path_changed", &ScriptCreateDialog::_path_changed);
+ ClassDB::bind_method("_path_entered", &ScriptCreateDialog::_path_entered);
ClassDB::bind_method("_template_changed", &ScriptCreateDialog::_template_changed);
ADD_SIGNAL(MethodInfo("script_created", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script")));
}
@@ -715,6 +726,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
hb = memnew(HBoxContainer);
file_path = memnew(LineEdit);
file_path->connect("text_changed", this, "_path_changed");
+ file_path->connect("text_entered", this, "_path_entered");
file_path->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(file_path);
path_button = memnew(Button);
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index c7bbc82d47..1cff9871d8 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -73,6 +73,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
Vector<String> template_list;
void _path_changed(const String &p_path = String());
+ void _path_entered(const String &p_path = String());
void _lang_changed(int l = 0);
void _built_in_pressed();
bool _validate(const String &p_string);
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index ce485956b4..396bebf0ea 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -386,7 +386,7 @@ int NetworkedMultiplayerENet::get_available_packet_count() const {
return incoming_packets.size();
}
-Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const {
+Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
ERR_FAIL_COND_V(incoming_packets.size() == 0, ERR_UNAVAILABLE);
@@ -480,7 +480,7 @@ int NetworkedMultiplayerENet::get_max_packet_size() const {
return 1 << 24; //anything is good
}
-void NetworkedMultiplayerENet::_pop_current_packet() const {
+void NetworkedMultiplayerENet::_pop_current_packet() {
if (current_packet.packet) {
enet_packet_destroy(current_packet.packet);
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index 81d517147d..d7bc5c7849 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -86,12 +86,12 @@ private:
CompressionMode compression_mode;
- mutable List<Packet> incoming_packets;
+ List<Packet> incoming_packets;
- mutable Packet current_packet;
+ Packet current_packet;
uint32_t _gen_unique_id() const;
- void _pop_current_packet() const;
+ void _pop_current_packet();
Vector<uint8_t> src_compressor_mem;
Vector<uint8_t> dst_compressor_mem;
@@ -123,7 +123,7 @@ public:
virtual bool is_server() const;
virtual int get_available_packet_count() const;
- virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const; ///< buffer is GONE after next get_packet
+ virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size); ///< buffer is GONE after next get_packet
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
virtual int get_max_packet_size() const;
diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp
index 92a88e354b..8ff67b10b1 100644
--- a/modules/gdnative/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative/gdnative.cpp
@@ -52,10 +52,6 @@ godot_object GDAPI *godot_global_get_singleton(char *p_name) {
return (godot_object *)Engine::get_singleton()->get_singleton_object(String(p_name));
} // result shouldn't be freed
-void GDAPI *godot_get_stack_bottom() {
- return OS::get_singleton()->get_stack_bottom();
-}
-
// MethodBind API
godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname) {
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index b7b2553435..06c6e9f410 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -5533,12 +5533,6 @@
]
},
{
- "name": "godot_get_stack_bottom",
- "return_type": "void *",
- "arguments": [
- ]
- },
- {
"name": "godot_method_bind_get_method",
"return_type": "godot_method_bind *",
"arguments": [
diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h
index f7f5606428..9d7829a51f 100644
--- a/modules/gdnative/include/gdnative/gdnative.h
+++ b/modules/gdnative/include/gdnative/gdnative.h
@@ -212,10 +212,6 @@ void GDAPI godot_object_destroy(godot_object *p_o);
godot_object GDAPI *godot_global_get_singleton(char *p_name); // result shouldn't be freed
-////// OS API
-
-void GDAPI *godot_get_stack_bottom(); // returns stack bottom of the main thread
-
////// MethodBind API
typedef struct {
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index b3a1947647..bebf8bcf8f 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -469,7 +469,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
nm.xform = xform;
if (navigation) {
- nm.id = navigation->navmesh_create(navmesh, xform, this);
+ nm.id = navigation->navmesh_add(navmesh, xform, this);
} else {
nm.id = -1;
}
@@ -556,7 +556,7 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) {
if (cell_map.has(F->key()) && F->get().id < 0) {
Ref<NavigationMesh> nm = theme->get_item_navmesh(cell_map[F->key()].item);
if (nm.is_valid()) {
- F->get().id = navigation->navmesh_create(nm, F->get().xform, this);
+ F->get().id = navigation->navmesh_add(nm, F->get().xform, this);
}
}
}
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 255413bf2c..6ca687d057 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1305,7 +1305,7 @@ public:
return valid;
}
- virtual String get_binary_extension() const {
+ virtual String get_binary_extension(const Ref<EditorExportPreset> &p_preset) const {
return "apk";
}
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 1833bdf2b3..9ea8d58db0 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -108,7 +108,7 @@ public:
virtual String get_os_name() const { return "iOS"; }
virtual Ref<Texture> get_logo() const { return logo; }
- virtual String get_binary_extension() const { return "ipa"; }
+ virtual String get_binary_extension(const Ref<EditorExportPreset> &p_preset) const { return "ipa"; }
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const;
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 775e9c7ee0..ec5010f330 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -57,7 +57,7 @@ public:
virtual Ref<Texture> get_logo() const;
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const;
- virtual String get_binary_extension() const;
+ virtual String get_binary_extension(const Ref<EditorExportPreset> &p_preset) const;
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
virtual bool poll_devices();
@@ -149,7 +149,7 @@ bool EditorExportPlatformJavaScript::can_export(const Ref<EditorExportPreset> &p
return !r_missing_templates;
}
-String EditorExportPlatformJavaScript::get_binary_extension() const {
+String EditorExportPlatformJavaScript::get_binary_extension(const Ref<EditorExportPreset> &p_preset) const {
return "html";
}
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index d3b763b42e..8a09aa634e 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -74,7 +74,7 @@ public:
virtual String get_os_name() const { return "OSX"; }
virtual Ref<Texture> get_logo() const { return logo; }
- virtual String get_binary_extension() const { return use_dmg() ? "dmg" : "zip"; }
+ virtual String get_binary_extension(const Ref<EditorExportPreset> &p_preset) const { return use_dmg() ? "dmg" : "zip"; }
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const;
diff --git a/platform/uwp/SCsub b/platform/uwp/SCsub
index f0d69fef33..fb0c4a92ae 100644
--- a/platform/uwp/SCsub
+++ b/platform/uwp/SCsub
@@ -4,9 +4,6 @@ Import('env')
files = [
'thread_uwp.cpp',
- '#platform/windows/tcp_server_winsock.cpp',
- '#platform/windows/packet_peer_udp_winsock.cpp',
- '#platform/windows/stream_peer_winsock.cpp',
'#platform/windows/key_mapping_win.cpp',
'#platform/windows/windows_terminal_logger.cpp',
'joypad_uwp.cpp',
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 7f86b4ae53..45ca097de5 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -1013,7 +1013,7 @@ public:
return "UWP";
}
- virtual String get_binary_extension() const {
+ virtual String get_binary_extension(const Ref<EditorExportPreset> &p_preset) const {
return "appx";
}
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 659f162724..3018ac0bef 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -34,13 +34,13 @@
#include "drivers/windows/dir_access_windows.h"
#include "drivers/windows/file_access_windows.h"
#include "drivers/windows/mutex_windows.h"
+#include "drivers/windows/packet_peer_udp_winsock.h"
#include "drivers/windows/rw_lock_windows.h"
#include "drivers/windows/semaphore_windows.h"
+#include "drivers/windows/stream_peer_tcp_winsock.h"
+#include "drivers/windows/tcp_server_winsock.h"
#include "io/marshalls.h"
#include "main/main.h"
-#include "platform/windows/packet_peer_udp_winsock.h"
-#include "platform/windows/stream_peer_winsock.h"
-#include "platform/windows/tcp_server_winsock.h"
#include "platform/windows/windows_terminal_logger.h"
#include "project_settings.h"
#include "servers/audio_server.h"
@@ -163,7 +163,7 @@ void OSUWP::initialize_core() {
DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_FILESYSTEM);
TCPServerWinsock::make_default();
- StreamPeerWinsock::make_default();
+ StreamPeerTCPWinsock::make_default();
PacketPeerUDPWinsock::make_default();
// We need to know how often the clock is updated
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index 135ccd902a..5030f4b3e0 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -19,9 +19,6 @@ common_win = [
"os_windows.cpp",
"ctxgl_procaddr.cpp",
"key_mapping_win.cpp",
- "tcp_server_winsock.cpp",
- "packet_peer_udp_winsock.cpp",
- "stream_peer_winsock.cpp",
"joypad.cpp",
"power_windows.cpp",
"windows_terminal_logger.cpp"
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 5916c8f06c..6cab683e83 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -34,19 +34,19 @@
#include "drivers/windows/dir_access_windows.h"
#include "drivers/windows/file_access_windows.h"
#include "drivers/windows/mutex_windows.h"
+#include "drivers/windows/packet_peer_udp_winsock.h"
#include "drivers/windows/rw_lock_windows.h"
#include "drivers/windows/semaphore_windows.h"
+#include "drivers/windows/stream_peer_tcp_winsock.h"
+#include "drivers/windows/tcp_server_winsock.h"
#include "drivers/windows/thread_windows.h"
#include "io/marshalls.h"
#include "joypad.h"
#include "lang_table.h"
#include "main/main.h"
-#include "packet_peer_udp_winsock.h"
#include "servers/audio_server.h"
#include "servers/visual/visual_server_raster.h"
#include "servers/visual/visual_server_wrap_mt.h"
-#include "stream_peer_winsock.h"
-#include "tcp_server_winsock.h"
#include "version_generated.gen.h"
#include "windows_terminal_logger.h"
@@ -196,7 +196,7 @@ void OS_Windows::initialize_core() {
DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_FILESYSTEM);
TCPServerWinsock::make_default();
- StreamPeerWinsock::make_default();
+ StreamPeerTCPWinsock::make_default();
PacketPeerUDPWinsock::make_default();
// We need to know how often the clock is updated
@@ -1253,7 +1253,7 @@ void OS_Windows::finalize_core() {
memdelete(process_map);
TCPServerWinsock::cleanup();
- StreamPeerWinsock::cleanup();
+ StreamPeerTCPWinsock::cleanup();
}
void OS_Windows::alert(const String &p_alert, const String &p_title) {
diff --git a/platform/x11/export/export.cpp b/platform/x11/export/export.cpp
index fdb43c9ae0..1baa3e127f 100644
--- a/platform/x11/export/export.cpp
+++ b/platform/x11/export/export.cpp
@@ -44,7 +44,8 @@ void register_x11_exporter() {
logo->create_from_image(img);
platform->set_logo(logo);
platform->set_name("Linux/X11");
- platform->set_extension("bin");
+ platform->set_extension("x86");
+ platform->set_extension("x86_64", "binary_format/64_bits");
platform->set_release_32("linux_x11_32_release");
platform->set_debug_32("linux_x11_32_debug");
platform->set_release_64("linux_x11_64_release");
diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp
index 9eff107827..40013814f8 100644
--- a/scene/2d/navigation2d.cpp
+++ b/scene/2d/navigation2d.cpp
@@ -205,7 +205,7 @@ void Navigation2D::_navpoly_unlink(int p_id) {
nm.linked = false;
}
-int Navigation2D::navpoly_create(const Ref<NavigationPolygon> &p_mesh, const Transform2D &p_xform, Object *p_owner) {
+int Navigation2D::navpoly_add(const Ref<NavigationPolygon> &p_mesh, const Transform2D &p_xform, Object *p_owner) {
int id = last_id++;
NavMesh nm;
@@ -708,7 +708,7 @@ Object *Navigation2D::get_closest_point_owner(const Vector2 &p_point) {
void Navigation2D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("navpoly_create", "mesh", "xform", "owner"), &Navigation2D::navpoly_create, DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("navpoly_add", "mesh", "xform", "owner"), &Navigation2D::navpoly_add, DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("navpoly_set_transform", "id", "xform"), &Navigation2D::navpoly_set_transform);
ClassDB::bind_method(D_METHOD("navpoly_remove", "id"), &Navigation2D::navpoly_remove);
diff --git a/scene/2d/navigation2d.h b/scene/2d/navigation2d.h
index bb97e1a9a9..02dbcb0f96 100644
--- a/scene/2d/navigation2d.h
+++ b/scene/2d/navigation2d.h
@@ -159,7 +159,7 @@ protected:
public:
//API should be as dynamic as possible
- int navpoly_create(const Ref<NavigationPolygon> &p_mesh, const Transform2D &p_xform, Object *p_owner = NULL);
+ int navpoly_add(const Ref<NavigationPolygon> &p_mesh, const Transform2D &p_xform, Object *p_owner = NULL);
void navpoly_set_transform(int p_id, const Transform2D &p_xform);
void navpoly_remove(int p_id);
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp
index c53241e985..5a6a5128e6 100644
--- a/scene/2d/navigation_polygon.cpp
+++ b/scene/2d/navigation_polygon.cpp
@@ -293,7 +293,7 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) {
if (navpoly.is_valid()) {
- nav_id = navigation->navpoly_create(navpoly, get_relative_transform_to_parent(navigation), this);
+ nav_id = navigation->navpoly_add(navpoly, get_relative_transform_to_parent(navigation), this);
}
}
}
@@ -324,7 +324,7 @@ void NavigationPolygonInstance::_notification(int p_what) {
if (enabled && navpoly.is_valid()) {
- nav_id = navigation->navpoly_create(navpoly, get_relative_transform_to_parent(navigation), this);
+ nav_id = navigation->navpoly_add(navpoly, get_relative_transform_to_parent(navigation), this);
}
break;
}
@@ -419,7 +419,7 @@ void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolyg
}
if (navigation && navpoly.is_valid() && enabled) {
- nav_id = navigation->navpoly_create(navpoly, get_relative_transform_to_parent(navigation), this);
+ nav_id = navigation->navpoly_add(navpoly, get_relative_transform_to_parent(navigation), this);
}
//update_gizmo();
_change_notify("navpoly");
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 1e34372d1e..bcdad177c5 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -486,7 +486,7 @@ void TileMap::_update_dirty_quadrants() {
xform.set_origin(offset.floor() + q.pos);
_fix_cell_transform(xform, c, npoly_ofs + center_ofs, s);
- int pid = navigation->navpoly_create(navpoly, nav_rel * xform);
+ int pid = navigation->navpoly_add(navpoly, nav_rel * xform);
Quadrant::NavPoly np;
np.id = pid;
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index af210fff1c..72c0b979af 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -56,126 +56,16 @@ void Camera::_update_camera_mode() {
}
}
-bool Camera::_set(const StringName &p_name, const Variant &p_value) {
-
- bool changed_all = false;
- if (p_name == "projection") {
-
- int proj = p_value;
- if (proj == PROJECTION_PERSPECTIVE)
- mode = PROJECTION_PERSPECTIVE;
- if (proj == PROJECTION_ORTHOGONAL)
- mode = PROJECTION_ORTHOGONAL;
-
- changed_all = true;
- } else if (p_name == "fov" || p_name == "fovy" || p_name == "fovx")
- fov = p_value;
- else if (p_name == "size" || p_name == "sizex" || p_name == "sizey")
- size = p_value;
- else if (p_name == "near")
- near = p_value;
- else if (p_name == "far")
- far = p_value;
- else if (p_name == "keep_aspect")
- set_keep_aspect_mode(KeepAspect(int(p_value)));
- else if (p_name == "vaspect")
- set_keep_aspect_mode(p_value ? KEEP_WIDTH : KEEP_HEIGHT);
- else if (p_name == "h_offset")
- h_offset = p_value;
- else if (p_name == "v_offset")
- v_offset = p_value;
- else if (p_name == "current") {
- if (p_value.operator bool()) {
- make_current();
- } else {
- clear_current();
+void Camera::_validate_property(PropertyInfo &p_property) const {
+ if (p_property.name == "fov") {
+ if (mode == PROJECTION_ORTHOGONAL) {
+ p_property.usage = PROPERTY_USAGE_NOEDITOR;
}
- } else if (p_name == "cull_mask") {
- set_cull_mask(p_value);
- } else if (p_name == "environment") {
- set_environment(p_value);
- } else if (p_name == "doppler/tracking") {
- set_doppler_tracking(DopplerTracking(int(p_value)));
- } else
- return false;
-
- _update_camera_mode();
- if (changed_all)
- _change_notify();
- return true;
-}
-bool Camera::_get(const StringName &p_name, Variant &r_ret) const {
-
- if (p_name == "projection") {
- r_ret = mode;
- } else if (p_name == "fov" || p_name == "fovy" || p_name == "fovx")
- r_ret = fov;
- else if (p_name == "size" || p_name == "sizex" || p_name == "sizey")
- r_ret = size;
- else if (p_name == "near")
- r_ret = near;
- else if (p_name == "far")
- r_ret = far;
- else if (p_name == "keep_aspect")
- r_ret = int(keep_aspect);
- else if (p_name == "current") {
-
- if (is_inside_tree() && get_tree()->is_node_being_edited(this)) {
- r_ret = current;
- } else {
- r_ret = is_current();
+ } else if (p_property.name == "size") {
+ if (mode == PROJECTION_PERSPECTIVE) {
+ p_property.usage = PROPERTY_USAGE_NOEDITOR;
}
- } else if (p_name == "cull_mask") {
- r_ret = get_cull_mask();
- } else if (p_name == "h_offset") {
- r_ret = get_h_offset();
- } else if (p_name == "v_offset") {
- r_ret = get_v_offset();
- } else if (p_name == "environment") {
- r_ret = get_environment();
- } else if (p_name == "doppler/tracking") {
- r_ret = get_doppler_tracking();
- } else
- return false;
-
- return true;
-}
-
-void Camera::_get_property_list(List<PropertyInfo> *p_list) const {
-
- p_list->push_back(PropertyInfo(Variant::INT, "projection", PROPERTY_HINT_ENUM, "Perspective,Orthogonal"));
-
- switch (mode) {
-
- case PROJECTION_PERSPECTIVE: {
-
- p_list->push_back(PropertyInfo(Variant::REAL, "fov", PROPERTY_HINT_RANGE, "1,179,0.1", PROPERTY_USAGE_NOEDITOR));
- if (keep_aspect == KEEP_WIDTH)
- p_list->push_back(PropertyInfo(Variant::REAL, "fovx", PROPERTY_HINT_RANGE, "1,179,0.1", PROPERTY_USAGE_EDITOR));
- else
- p_list->push_back(PropertyInfo(Variant::REAL, "fovy", PROPERTY_HINT_RANGE, "1,179,0.1", PROPERTY_USAGE_EDITOR));
-
- } break;
- case PROJECTION_ORTHOGONAL: {
-
- p_list->push_back(PropertyInfo(Variant::REAL, "size", PROPERTY_HINT_RANGE, "1,16384,0.01", PROPERTY_USAGE_NOEDITOR));
- if (keep_aspect == KEEP_WIDTH)
- p_list->push_back(PropertyInfo(Variant::REAL, "sizex", PROPERTY_HINT_RANGE, "0.1,16384,0.01", PROPERTY_USAGE_EDITOR));
- else
- p_list->push_back(PropertyInfo(Variant::REAL, "sizey", PROPERTY_HINT_RANGE, "0.1,16384,0.01", PROPERTY_USAGE_EDITOR));
-
- } break;
}
-
- p_list->push_back(PropertyInfo(Variant::REAL, "near", PROPERTY_HINT_EXP_RANGE, "0.01,4096.0,0.01"));
- p_list->push_back(PropertyInfo(Variant::REAL, "far", PROPERTY_HINT_EXP_RANGE, "0.01,4096.0,0.01"));
- p_list->push_back(PropertyInfo(Variant::INT, "keep_aspect", PROPERTY_HINT_ENUM, "Keep Width,Keep Height"));
- p_list->push_back(PropertyInfo(Variant::BOOL, "current"));
- p_list->push_back(PropertyInfo(Variant::INT, "cull_mask", PROPERTY_HINT_LAYERS_3D_RENDER));
- p_list->push_back(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"));
- p_list->push_back(PropertyInfo(Variant::REAL, "h_offset"));
- p_list->push_back(PropertyInfo(Variant::REAL, "v_offset"));
- p_list->push_back(PropertyInfo(Variant::INT, "doppler/tracking", PROPERTY_HINT_ENUM, "Disabled,Idle,Physics"));
}
void Camera::_update_camera() {
@@ -282,6 +172,14 @@ void Camera::set_orthogonal(float p_size, float p_z_near, float p_z_far) {
update_gizmo();
}
+void Camera::set_projection(Camera::Projection p_mode) {
+ if (p_mode == PROJECTION_PERSPECTIVE || p_mode == PROJECTION_ORTHOGONAL) {
+ mode = p_mode;
+ _update_camera_mode();
+ _change_notify();
+ }
+}
+
RID Camera::get_camera() const {
return camera;
@@ -311,6 +209,14 @@ void Camera::clear_current() {
}
}
+void Camera::set_current(bool p_current) {
+ if (p_current) {
+ make_current();
+ } else {
+ clear_current();
+ }
+}
+
bool Camera::is_current() const {
if (is_inside_tree() && !get_tree()->is_node_being_edited(this)) {
@@ -481,6 +387,7 @@ void Camera::set_environment(const Ref<Environment> &p_environment) {
VS::get_singleton()->camera_set_environment(camera, environment->get_rid());
else
VS::get_singleton()->camera_set_environment(camera, RID());
+ _update_camera_mode();
}
Ref<Environment> Camera::get_environment() const {
@@ -489,10 +396,9 @@ Ref<Environment> Camera::get_environment() const {
}
void Camera::set_keep_aspect_mode(KeepAspect p_aspect) {
-
keep_aspect = p_aspect;
VisualServer::get_singleton()->camera_set_use_vertical_aspect(camera, p_aspect == KEEP_WIDTH);
-
+ _update_camera_mode();
_change_notify();
}
@@ -501,6 +407,15 @@ Camera::KeepAspect Camera::get_keep_aspect_mode() const {
return keep_aspect;
}
+void Camera::set_vaspect(bool p_vaspect) {
+ set_keep_aspect_mode(p_vaspect ? KEEP_WIDTH : KEEP_HEIGHT);
+ _update_camera_mode();
+}
+
+bool Camera::get_vaspect() const {
+ return keep_aspect == KEEP_HEIGHT;
+}
+
void Camera::set_doppler_tracking(DopplerTracking p_tracking) {
if (doppler_tracking == p_tracking)
@@ -511,6 +426,7 @@ void Camera::set_doppler_tracking(DopplerTracking p_tracking) {
velocity_tracker->set_track_physics_step(doppler_tracking == DOPPLER_TRACKING_PHYSICS_STEP);
velocity_tracker->reset(get_global_transform().origin);
}
+ _update_camera_mode();
}
Camera::DopplerTracking Camera::get_doppler_tracking() const {
@@ -529,13 +445,19 @@ void Camera::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_orthogonal", "size", "z_near", "z_far"), &Camera::set_orthogonal);
ClassDB::bind_method(D_METHOD("make_current"), &Camera::make_current);
ClassDB::bind_method(D_METHOD("clear_current"), &Camera::clear_current);
+ ClassDB::bind_method(D_METHOD("set_current"), &Camera::set_current);
ClassDB::bind_method(D_METHOD("is_current"), &Camera::is_current);
ClassDB::bind_method(D_METHOD("get_camera_transform"), &Camera::get_camera_transform);
ClassDB::bind_method(D_METHOD("get_fov"), &Camera::get_fov);
ClassDB::bind_method(D_METHOD("get_size"), &Camera::get_size);
ClassDB::bind_method(D_METHOD("get_zfar"), &Camera::get_zfar);
ClassDB::bind_method(D_METHOD("get_znear"), &Camera::get_znear);
+ ClassDB::bind_method(D_METHOD("set_fov"), &Camera::set_fov);
+ ClassDB::bind_method(D_METHOD("set_size"), &Camera::set_size);
+ ClassDB::bind_method(D_METHOD("set_zfar"), &Camera::set_zfar);
+ ClassDB::bind_method(D_METHOD("set_znear"), &Camera::set_znear);
ClassDB::bind_method(D_METHOD("get_projection"), &Camera::get_projection);
+ ClassDB::bind_method(D_METHOD("set_projection"), &Camera::set_projection);
ClassDB::bind_method(D_METHOD("set_h_offset", "ofs"), &Camera::set_h_offset);
ClassDB::bind_method(D_METHOD("get_h_offset"), &Camera::get_h_offset);
ClassDB::bind_method(D_METHOD("set_v_offset", "ofs"), &Camera::set_v_offset);
@@ -546,10 +468,26 @@ void Camera::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_environment"), &Camera::get_environment);
ClassDB::bind_method(D_METHOD("set_keep_aspect_mode", "mode"), &Camera::set_keep_aspect_mode);
ClassDB::bind_method(D_METHOD("get_keep_aspect_mode"), &Camera::get_keep_aspect_mode);
+ ClassDB::bind_method(D_METHOD("set_vaspect"), &Camera::set_vaspect);
+ ClassDB::bind_method(D_METHOD("get_vaspect"), &Camera::get_vaspect);
ClassDB::bind_method(D_METHOD("set_doppler_tracking", "mode"), &Camera::set_doppler_tracking);
ClassDB::bind_method(D_METHOD("get_doppler_tracking"), &Camera::get_doppler_tracking);
//ClassDB::bind_method(D_METHOD("_camera_make_current"),&Camera::_camera_make_current );
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "keep_aspect", PROPERTY_HINT_ENUM, "Keep Width,Keep Height"), "set_keep_aspect_mode", "get_keep_aspect_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vaspect"), "set_vaspect", "get_vaspect");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "cull_mask", PROPERTY_HINT_LAYERS_3D_RENDER), "set_cull_mask", "get_cull_mask");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "h_offset"), "set_h_offset", "get_h_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_offset"), "set_v_offset", "get_v_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "doppler_tracking", PROPERTY_HINT_ENUM, "Disabled,Idle,Physics"), "set_doppler_tracking", "get_doppler_tracking");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "projection", PROPERTY_HINT_ENUM, "Perspective,Orthogonal"), "set_projection", "get_projection");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "current"), "set_current", "is_current");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "fov", PROPERTY_HINT_RANGE, "1,179,0.1"), "set_fov", "get_fov");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "size", PROPERTY_HINT_RANGE, "0.1,16384,0.01"), "set_size", "get_size");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "near"), "set_znear", "get_znear");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "far"), "set_zfar", "get_zfar");
+
BIND_ENUM_CONSTANT(PROJECTION_PERSPECTIVE);
BIND_ENUM_CONSTANT(PROJECTION_ORTHOGONAL);
@@ -586,10 +524,30 @@ Camera::Projection Camera::get_projection() const {
return mode;
}
-void Camera::set_cull_mask(uint32_t p_layers) {
+void Camera::set_fov(float p_fov) {
+ fov = p_fov;
+ _update_camera_mode();
+}
+
+void Camera::set_size(float p_size) {
+ size = p_size;
+ _update_camera_mode();
+}
+
+void Camera::set_znear(float p_znear) {
+ near = p_znear;
+ _update_camera_mode();
+}
+void Camera::set_zfar(float p_zfar) {
+ far = p_zfar;
+ _update_camera_mode();
+}
+
+void Camera::set_cull_mask(uint32_t p_layers) {
layers = p_layers;
VisualServer::get_singleton()->camera_set_cull_mask(camera, layers);
+ _update_camera_mode();
}
uint32_t Camera::get_cull_mask() const {
diff --git a/scene/3d/camera.h b/scene/3d/camera.h
index 73c6844c1a..520afb962b 100644
--- a/scene/3d/camera.h
+++ b/scene/3d/camera.h
@@ -95,10 +95,8 @@ protected:
virtual void _request_camera_update();
void _update_camera_mode();
- bool _set(const StringName &p_name, const Variant &p_value);
- bool _get(const StringName &p_name, Variant &r_ret) const;
- void _get_property_list(List<PropertyInfo> *p_list) const;
void _notification(int p_what);
+ virtual void _validate_property(PropertyInfo &property) const;
static void _bind_methods();
@@ -111,9 +109,11 @@ public:
void set_perspective(float p_fovy_degrees, float p_z_near, float p_z_far);
void set_orthogonal(float p_size, float p_z_near, float p_z_far);
+ void set_projection(Camera::Projection p_mode);
void make_current();
void clear_current();
+ void set_current(bool p_current);
bool is_current() const;
RID get_camera() const;
@@ -124,6 +124,11 @@ public:
float get_znear() const;
Projection get_projection() const;
+ void set_fov(float p_fov);
+ void set_size(float p_size);
+ void set_zfar(float p_zfar);
+ void set_znear(float p_znear);
+
virtual Transform get_camera_transform() const;
Vector3 project_ray_normal(const Point2 &p_pos) const;
@@ -143,6 +148,8 @@ public:
void set_keep_aspect_mode(KeepAspect p_aspect);
KeepAspect get_keep_aspect_mode() const;
+ void set_vaspect(bool p_vaspect);
+ bool get_vaspect() const;
void set_v_offset(float p_offset);
float get_v_offset() const;
diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp
index b6507aedb3..78cf75e3b3 100644
--- a/scene/3d/navigation.cpp
+++ b/scene/3d/navigation.cpp
@@ -202,7 +202,7 @@ void Navigation::_navmesh_unlink(int p_id) {
nm.linked = false;
}
-int Navigation::navmesh_create(const Ref<NavigationMesh> &p_mesh, const Transform &p_xform, Object *p_owner) {
+int Navigation::navmesh_add(const Ref<NavigationMesh> &p_mesh, const Transform &p_xform, Object *p_owner) {
int id = last_id++;
NavMesh nm;
@@ -686,7 +686,7 @@ Vector3 Navigation::get_up_vector() const {
void Navigation::_bind_methods() {
- ClassDB::bind_method(D_METHOD("navmesh_create", "mesh", "xform", "owner"), &Navigation::navmesh_create, DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("navmesh_add", "mesh", "xform", "owner"), &Navigation::navmesh_add, DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("navmesh_set_transform", "id", "xform"), &Navigation::navmesh_set_transform);
ClassDB::bind_method(D_METHOD("navmesh_remove", "id"), &Navigation::navmesh_remove);
diff --git a/scene/3d/navigation.h b/scene/3d/navigation.h
index d9a38f7b00..134afa2278 100644
--- a/scene/3d/navigation.h
+++ b/scene/3d/navigation.h
@@ -166,7 +166,7 @@ public:
Vector3 get_up_vector() const;
//API should be as dynamic as possible
- int navmesh_create(const Ref<NavigationMesh> &p_mesh, const Transform &p_xform, Object *p_owner = NULL);
+ int navmesh_add(const Ref<NavigationMesh> &p_mesh, const Transform &p_xform, Object *p_owner = NULL);
void navmesh_set_transform(int p_id, const Transform &p_xform);
void navmesh_remove(int p_id);
diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp
index 40750cdfe8..4fb12b8fac 100644
--- a/scene/3d/navigation_mesh.cpp
+++ b/scene/3d/navigation_mesh.cpp
@@ -471,7 +471,7 @@ void NavigationMeshInstance::set_enabled(bool p_enabled) {
if (navmesh.is_valid()) {
- nav_id = navigation->navmesh_create(navmesh, get_relative_transform(navigation), this);
+ nav_id = navigation->navmesh_add(navmesh, get_relative_transform(navigation), this);
}
}
}
@@ -508,7 +508,7 @@ void NavigationMeshInstance::_notification(int p_what) {
if (enabled && navmesh.is_valid()) {
- nav_id = navigation->navmesh_create(navmesh, get_relative_transform(navigation), this);
+ nav_id = navigation->navmesh_add(navmesh, get_relative_transform(navigation), this);
}
break;
}
@@ -568,7 +568,7 @@ void NavigationMeshInstance::set_navigation_mesh(const Ref<NavigationMesh> &p_na
navmesh = p_navmesh;
if (navigation && navmesh.is_valid() && enabled) {
- nav_id = navigation->navmesh_create(navmesh, get_relative_transform(navigation), this);
+ nav_id = navigation->navmesh_add(navmesh, get_relative_transform(navigation), this);
}
if (debug_view && navmesh.is_valid()) {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 32f889e826..698676cc39 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -42,24 +42,6 @@ String PopupMenu::_get_accel_text(int p_item) const {
else if (items[p_item].accel)
return keycode_get_string(items[p_item].accel);
return String();
-
- /*
- String atxt;
- if (p_accel&KEY_MASK_SHIFT)
- atxt+="Shift+";
- if (p_accel&KEY_MASK_ALT)
- atxt+="Alt+";
- if (p_accel&KEY_MASK_CTRL)
- atxt+="Ctrl+";
- if (p_accel&KEY_MASK_META)
- atxt+="Meta+";
-
- p_accel&=KEY_CODE_MASK;
-
- atxt+=String::chr(p_accel).to_upper();
-
- return atxt;
-*/
}
Size2 PopupMenu::get_minimum_size() const {
@@ -136,7 +118,6 @@ int PopupMenu::_get_mouse_over(const Point2 &p_over) const {
Ref<Font> font = get_font("font");
int vseparation = get_constant("vseparation");
- //int hseparation = get_constant("hseparation");
float font_h = font->get_height();
for (int i = 0; i < items.size(); i++) {
@@ -230,6 +211,11 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
mouse_over = i;
update();
+
+ if (items[i].submenu != "" && submenu_over != i) {
+ submenu_over = i;
+ submenu_timer->start();
+ }
break;
}
}
@@ -245,6 +231,11 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
mouse_over = i;
update();
+
+ if (items[i].submenu != "" && submenu_over != i) {
+ submenu_over = i;
+ submenu_timer->start();
+ }
break;
}
}
@@ -500,6 +491,13 @@ void PopupMenu::_notification(int p_what) {
} break;
case NOTIFICATION_MOUSE_EXIT: {
+ if (mouse_over >= 0 && (items[mouse_over].submenu == "" || submenu_over != -1)) {
+ mouse_over = -1;
+ update();
+ }
+ } break;
+ case NOTIFICATION_POPUP_HIDE: {
+
if (mouse_over >= 0) {
mouse_over = -1;
update();
@@ -1217,6 +1215,7 @@ void PopupMenu::set_invalidate_click_until_motion() {
PopupMenu::PopupMenu() {
mouse_over = -1;
+ submenu_over = -1;
set_focus_mode(FOCUS_ALL);
set_as_toplevel(true);
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 05c6e9f77e..6fbc58a38a 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -31,6 +31,11 @@
#include "os/keyboard.h"
#include "os/os.h"
#include "scene/scene_string_names.h"
+
+#ifdef TOOLS_ENABLED
+#include "editor/editor_node.h"
+#endif
+
RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) {
if (p_free) {
@@ -370,7 +375,11 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
Color uc = color;
uc.a *= 0.5;
int uy = y + lh - fh + ascent + 2;
- VS::get_singleton()->canvas_item_add_line(ci, p_ofs + Point2(align_ofs + pofs, uy), p_ofs + Point2(align_ofs + pofs + cw, uy), uc);
+ float underline_width = 1.0;
+#ifdef TOOLS_ENABLED
+ underline_width *= EDSCALE;
+#endif
+ VS::get_singleton()->canvas_item_add_line(ci, p_ofs + Point2(align_ofs + pofs, uy), p_ofs + Point2(align_ofs + pofs + cw, uy), uc, underline_width);
}
ofs += cw;
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index e5169089f2..2ce709732c 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1664,17 +1664,22 @@ void TextEdit::backspace_at_cursor() {
cursor_set_column(prev_column);
}
-void TextEdit::indent_selection_right() {
+void TextEdit::indent_right() {
- if (!is_selection_active()) {
- return;
- }
+ int start_line;
+ int end_line;
begin_complex_operation();
- int start_line = get_selection_from_line();
- int end_line = get_selection_to_line();
+
+ if (is_selection_active()) {
+ start_line = get_selection_from_line();
+ end_line = get_selection_to_line();
+ } else {
+ start_line = cursor.line;
+ end_line = start_line;
+ }
// ignore if the cursor is not past the first column
- if (get_selection_to_column() == 0) {
+ if (is_selection_active() && get_selection_to_column() == 0) {
end_line--;
}
@@ -1688,23 +1693,32 @@ void TextEdit::indent_selection_right() {
set_line(i, line_text);
}
- // fix selection being off by one on the last line
- selection.to_column++;
+ // fix selection and cursor being off by one on the last line
+ if (is_selection_active()) {
+ selection.to_column++;
+ selection.from_column++;
+ }
+ cursor.column++;
end_complex_operation();
update();
}
-void TextEdit::indent_selection_left() {
+void TextEdit::indent_left() {
- if (!is_selection_active()) {
- return;
- }
+ int start_line;
+ int end_line;
begin_complex_operation();
- int start_line = get_selection_from_line();
- int end_line = get_selection_to_line();
+
+ if (is_selection_active()) {
+ start_line = get_selection_from_line();
+ end_line = get_selection_to_line();
+ } else {
+ start_line = cursor.line;
+ end_line = start_line;
+ }
// ignore if the cursor is not past the first column
- if (get_selection_to_column() == 0) {
+ if (is_selection_active() && get_selection_to_column() == 0) {
end_line--;
}
String last_line_text = get_line(end_line);
@@ -1721,9 +1735,15 @@ void TextEdit::indent_selection_left() {
}
}
- // fix selection being off by one on the last line
- if (last_line_text != get_line(end_line) && selection.to_column > 0) {
- selection.to_column--;
+ // fix selection and cursor being off by one on the last line
+ if (is_selection_active() && last_line_text != get_line(end_line)) {
+ if (selection.to_column > 0)
+ selection.to_column--;
+ if (selection.from_column > 0)
+ selection.from_column--;
+ }
+ if (cursor.column > 0) {
+ cursor.column--;
}
end_complex_operation();
update();
@@ -2216,9 +2236,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
case KEY_TAB: {
if (k->get_shift()) {
- indent_selection_left();
+ indent_left();
} else {
- indent_selection_right();
+ indent_right();
}
dobreak = true;
accept_event();
@@ -2389,8 +2409,12 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (readonly)
break;
- if (selection.active) {
-
+ if (is_selection_active()) {
+ if (k->get_shift()) {
+ indent_left();
+ } else {
+ indent_right();
+ }
} else {
if (k->get_shift()) {
@@ -5657,4 +5681,4 @@ TextEdit::TextEdit() {
}
TextEdit::~TextEdit() {
-}
+} \ No newline at end of file
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index dd305d5822..edef28cc25 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -443,8 +443,8 @@ public:
void set_line(int line, String new_text);
void backspace_at_cursor();
- void indent_selection_left();
- void indent_selection_right();
+ void indent_left();
+ void indent_right();
int get_indent_level(int p_line) const;
inline void set_scroll_pass_end_of_file(bool p_enabled) {
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index ab12d123ba..b5b42e8f29 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -30,6 +30,7 @@
#include "tree.h"
#include <limits.h>
+#include "math_funcs.h"
#include "os/input.h"
#include "os/keyboard.h"
#include "os/os.h"
@@ -37,6 +38,10 @@
#include "project_settings.h"
#include "scene/main/viewport.h"
+#ifdef TOOLS_ENABLED
+#include "editor/editor_node.h"
+#endif
+
void TreeItem::move_to_top() {
if (!parent || parent->childs == this)
@@ -1412,9 +1417,14 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
if (c->get_children() != NULL)
root_pos -= Point2i(cache.arrow->get_width(), 0);
+ float line_width = 1.0;
+#ifdef TOOLS_ENABLED
+ line_width *= EDSCALE;
+#endif
+
Point2i parent_pos = Point2i(parent_ofs - cache.arrow->get_width() / 2, p_pos.y + label_h / 2 + cache.arrow->get_height() / 2) - cache.offset + p_draw_ofs;
- VisualServer::get_singleton()->canvas_item_add_line(ci, root_pos, Point2i(parent_pos.x, root_pos.y), cache.relationship_line_color);
- VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y), parent_pos, cache.relationship_line_color);
+ VisualServer::get_singleton()->canvas_item_add_line(ci, root_pos, Point2i(parent_pos.x - Math::floor(line_width / 2), root_pos.y), cache.relationship_line_color, line_width);
+ VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y), parent_pos, cache.relationship_line_color, line_width);
}
int child_h = draw_item(children_pos, p_draw_ofs, p_draw_size, c);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 4635de81e8..1666aa5415 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1421,7 +1421,7 @@ void Viewport::_gui_show_tooltip() {
gui.tooltip_label->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_TOP));
gui.tooltip_label->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -ttp->get_margin(MARGIN_RIGHT));
gui.tooltip_label->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -ttp->get_margin(MARGIN_BOTTOM));
- gui.tooltip_label->set_text(tooltip);
+ gui.tooltip_label->set_text(tooltip.strip_edges());
Rect2 r(gui.tooltip_pos + Point2(10, 10), gui.tooltip_label->get_combined_minimum_size() + ttp->get_minimum_size());
Rect2 vr = gui.tooltip_label->get_viewport_rect();
if (r.size.x + r.position.x > vr.size.x)
@@ -1811,7 +1811,8 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
_gui_call_input(gui.mouse_focus, mb);
}
- if (mb->get_button_index() == gui.mouse_focus_button) {
+ if (mb->get_button_mask() == 0) {
+ // Last mouse button was released
gui.mouse_focus = NULL;
gui.mouse_focus_button = -1;
}