summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/unzip.c17
-rw-r--r--core/os/input.cpp4
-rw-r--r--core/os/input.h5
-rw-r--r--core/variant_call.cpp2
-rw-r--r--doc/base/classes.xml39
-rw-r--r--main/input_default.cpp65
-rw-r--r--main/input_default.h17
-rw-r--r--platform/android/export/export.cpp175
-rw-r--r--platform/x11/joystick_linux.cpp74
-rw-r--r--platform/x11/joystick_linux.h7
-rw-r--r--platform/x11/os_x11.cpp33
-rw-r--r--platform/x11/os_x11.h3
-rw-r--r--scene/2d/canvas_item.cpp19
-rw-r--r--scene/2d/canvas_item.h2
-rw-r--r--scene/3d/vehicle_body.cpp2
-rw-r--r--scene/3d/vehicle_body.h2
-rw-r--r--scene/animation/animation_tree_player.cpp2
-rw-r--r--scene/gui/control.cpp50
-rw-r--r--scene/gui/control.h2
-rw-r--r--scene/gui/rich_text_label.cpp7
-rw-r--r--scene/gui/split_container.cpp2
-rw-r--r--scene/gui/split_container.h2
-rw-r--r--scene/gui/text_edit.cpp18
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/main/node.cpp33
-rw-r--r--scene/main/node.h2
-rw-r--r--scene/resources/dynamic_font.cpp6
-rw-r--r--scene/resources/room.cpp2
-rw-r--r--scene/resources/room.h2
-rw-r--r--servers/visual_server.cpp2
-rwxr-xr-xtools/Godot.app/Contents/Info.plist2
-rw-r--r--tools/editor/asset_library_editor_plugin.cpp6
-rw-r--r--tools/editor/code_editor.cpp17
-rw-r--r--tools/editor/connections_dialog.cpp49
-rw-r--r--tools/editor/connections_dialog.h1
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp139
-rw-r--r--tools/editor/plugins/script_editor_plugin.h2
-rw-r--r--tools/editor/plugins/shader_editor_plugin.cpp22
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp8
-rw-r--r--tools/editor/plugins/texture_region_editor_plugin.cpp44
-rw-r--r--tools/editor/plugins/texture_region_editor_plugin.h2
-rw-r--r--tools/translations/ru.po177
42 files changed, 837 insertions, 230 deletions
diff --git a/core/io/unzip.c b/core/io/unzip.c
index 78672677f9..7aa0a86d13 100644
--- a/core/io/unzip.c
+++ b/core/io/unzip.c
@@ -1031,10 +1031,19 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
if (lSeek!=0)
{
- if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
- lSeek=0;
- else
- err=UNZ_ERRNO;
+ if (lSeek<0) {
+ // WORKAROUND for backwards seeking
+ z_off_t pos = ZTELL64(s->z_filefunc, s->filestream);
+ if (ZSEEK64(s->z_filefunc, s->filestream,pos+lSeek,ZLIB_FILEFUNC_SEEK_SET)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ } else {
+ if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ }
}
while(acc < file_info.size_file_extra)
diff --git a/core/os/input.cpp b/core/os/input.cpp
index a766ef87fc..005a248aac 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -59,6 +59,10 @@ void Input::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_joy_axis","device","axis"),&Input::get_joy_axis);
ObjectTypeDB::bind_method(_MD("get_joy_name","device"),&Input::get_joy_name);
ObjectTypeDB::bind_method(_MD("get_joy_guid","device"),&Input::get_joy_guid);
+ ObjectTypeDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength);
+ ObjectTypeDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration);
+ ObjectTypeDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration);
+ ObjectTypeDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration);
ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer);
ObjectTypeDB::bind_method(_MD("get_magnetometer"),&Input::get_magnetometer);
//ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want
diff --git a/core/os/input.h b/core/os/input.h
index 46edb30aa1..6364d597b0 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -67,6 +67,11 @@ public:
virtual void remove_joy_mapping(String p_guid)=0;
virtual bool is_joy_known(int p_device)=0;
virtual String get_joy_guid(int p_device) const=0;
+ virtual Vector2 get_joy_vibration_strength(int p_device)=0;
+ virtual float get_joy_vibration_duration(int p_device)=0;
+ virtual uint64_t get_joy_vibration_timestamp(int p_device)=0;
+ virtual void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration)=0;
+ virtual void stop_joy_vibration(int p_device)=0;
virtual Point2 get_mouse_pos() const=0;
virtual Point2 get_mouse_speed() const=0;
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index ffe05d10d6..c1a58dff75 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1290,7 +1290,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(STRING,STRING,String,extension,varray());
ADDFUNC0(STRING,STRING,String,basename,varray());
ADDFUNC1(STRING,STRING,String,plus_file,STRING,"file",varray());
- ADDFUNC1(STRING,STRING,String,ord_at,INT,"at",varray());
+ ADDFUNC1(STRING,INT,String,ord_at,INT,"at",varray());
ADDFUNC2(STRING,NIL,String,erase,INT,"pos",INT,"chars", varray());
ADDFUNC0(STRING,INT,String,hash,varray());
ADDFUNC0(STRING,STRING,String,md5_text,varray());
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index e6a4f9646a..e553e95890 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -15820,6 +15820,23 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
Returns a SDL2 compatible device guid on platforms that use gamepad remapping. Returns "Default Gamepad" otherwise.
</description>
</method>
+ <method name="get_joy_vibration_strength">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="device" type="int">
+ </argument>
+ <description>
+ Returns the strength of the joystick vibration: x is the strength of the weak motor, and y is the strength of the strong motor.
+ </description>
+ </method>
+ <method name="get_joy_vibration_duration">
+ <return type="float">
+ </return>
+ <argument index="0" name="device" type="int">
+ </argument>
+ <description>
+ Returns the duration of the current vibration effect in seconds.
+ </description>
<method name="get_accelerometer">
<return type="Vector3">
</return>
@@ -15862,6 +15879,26 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
Return the mouse mode. See the constants for more information.
</description>
</method>
+ <method name="start_joy_vibration">
+ <argument index="0" name="device" type="int">
+ </argument>
+ <argument index="1" name="weak_magnitude" type="float">
+ </argument>
+ <argument index="2" name="strong_magnitude" type="float">
+ </argument>
+ <argument index="3" name="duration" type="float">
+ </argument>
+ <description>
+ Starts to vibrate the joystick. Joysticks usually come with two rumble motors, a strong and a weak one. weak_magnitude is the strength of the weak motor (between 0 and 1) and strong_magnitude is the strength of the strong motor (between 0 and 1). duration is the duration of the effect in seconds (a duration of 0 will play the vibration indefinitely).
+ </description>
+ </method>
+ <method name="stop_joy_vibration">
+ <argument index="0" name="device" type="int">
+ </argument>
+ <description>
+ Stops the vibration of the joystick.
+ </description>
+ </method>
<method name="warp_mouse_pos">
<argument index="0" name="to" type="Vector2">
</argument>
@@ -37388,7 +37425,7 @@ This method controls whether the position between two cached points is interpola
</description>
</method>
<method name="ord_at">
- <return type="String">
+ <return type="int">
</return>
<argument index="0" name="at" type="int">
</argument>
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 5b4ae7f2cb..a6f14ae1f5 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -137,6 +137,30 @@ String InputDefault::get_joy_name(int p_idx) {
return joy_names[p_idx].name;
};
+Vector2 InputDefault::get_joy_vibration_strength(int p_device) {
+ if (joy_vibration.has(p_device)) {
+ return Vector2(joy_vibration[p_device].weak_magnitude, joy_vibration[p_device].strong_magnitude);
+ } else {
+ return Vector2(0, 0);
+ }
+}
+
+uint64_t InputDefault::get_joy_vibration_timestamp(int p_device) {
+ if (joy_vibration.has(p_device)) {
+ return joy_vibration[p_device].timestamp;
+ } else {
+ return 0;
+ }
+}
+
+float InputDefault::get_joy_vibration_duration(int p_device) {
+ if (joy_vibration.has(p_device)) {
+ return joy_vibration[p_device].duration;
+ } else {
+ return 0.f;
+ }
+}
+
static String _hex_str(uint8_t p_byte) {
static const char* dict = "0123456789abcdef";
@@ -294,6 +318,29 @@ void InputDefault::set_joy_axis(int p_device,int p_axis,float p_value) {
_joy_axis[c]=p_value;
}
+void InputDefault::start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration) {
+ _THREAD_SAFE_METHOD_
+ if (p_weak_magnitude < 0.f || p_weak_magnitude > 1.f || p_strong_magnitude < 0.f || p_strong_magnitude > 1.f) {
+ return;
+ }
+ VibrationInfo vibration;
+ vibration.weak_magnitude = p_weak_magnitude;
+ vibration.strong_magnitude = p_strong_magnitude;
+ vibration.duration = p_duration;
+ vibration.timestamp = OS::get_singleton()->get_unix_time();
+ joy_vibration[p_device] = vibration;
+}
+
+void InputDefault::stop_joy_vibration(int p_device) {
+ _THREAD_SAFE_METHOD_
+ VibrationInfo vibration;
+ vibration.weak_magnitude = 0;
+ vibration.strong_magnitude = 0;
+ vibration.duration = 0;
+ vibration.timestamp = OS::get_singleton()->get_unix_time();
+ joy_vibration[p_device] = vibration;
+}
+
void InputDefault::set_accelerometer(const Vector3& p_accel) {
_THREAD_SAFE_METHOD_
@@ -416,26 +463,35 @@ static const char *s_ControllerMappings [] =
#ifdef WINDOWS_ENABLED
"00f00300000000000000504944564944,RetroUSB.com RetroPad,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
"00f0f100000000000000504944564944,RetroUSB.com Super RetroPort,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
+ "0d0f4900000000000000504944564944,Hatsune Miku Sho Controller,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
+ "10080100000000000000504944564944,PS1 USB,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,",
"10080300000000000000504944564944,PS2 USB,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a4,righty:a2,lefttrigger:b4,righttrigger:b5,",
"25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,",
+ "2509e803000000000000504944564944,Mayflash Wii Classic Controller,a:b1,b:b0,x:b3,y:b2,back:b8,guide:b10,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:b11,dpdown:b13,dpleft:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
"28040140000000000000504944564944,GamePad Pro USB,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,lefttrigger:b6,righttrigger:b7,",
"341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
"36280100000000000000504944564944,OUYA Controller,a:b0,b:b3,y:b2,x:b1,start:b14,guide:b15,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b8,dpleft:b10,dpdown:b9,dpright:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b12,righttrigger:b13,",
+ "49190204000000000000504944564944,Ipega PG-9023,a:b0,b:b1,x:b3,y:b4,back:b10,start:b11,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b8,righttrigger:b9",
"4b12014d000000000000504944564944,NYKO AIRFLO,a:b0,b:b1,x:b2,y:b3,back:b8,guide:b10,start:b9,leftstick:a0,rightstick:a2,leftshoulder:a3,rightshoulder:b5,dpup:h0.1,dpdown:h0.0,dpleft:h0.8,dpright:h0.2,leftx:h0.6,lefty:h0.12,rightx:h0.9,righty:h0.4,lefttrigger:b6,righttrigger:b7,",
"4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
"4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"4f0400b3000000000000504944564944,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,",
"4f0415b3000000000000504944564944,Thrustmaster Dual Analog 3.2,x:b1,a:b0,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
+ "4f0423b3000000000000504944564944,Dual Trigger 3-in-1,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7",
"6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
"6d0418c2000000000000504944564944,Logitech RumblePad 2 USB,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
"6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
"6f0e1e01000000000000504944564944,Rock Candy Gamepad for PS3,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,guide:b12,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,",
+ "79000018000000000000504944564944,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
+ "79000600000000000000504944564944,G-Shark GS-GP702,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7",
+ "79004318000000000000504944564944,Mayflash GameCube Controller Adapter,a:b1,b:b2,x:b0,y:b3,back:b0,start:b9,guide:b0,leftshoulder:b4,rightshoulder:b7,leftstick:b0,rightstick:b0,leftx:a0,lefty:a1,rightx:a5,righty:a2,lefttrigger:a3,righttrigger:a4,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,",
"79000600000000000000504944564944,Generic Speedlink,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,",
"83056020000000000000504944564944,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,y:b2,x:b3,start:b7,back:b6,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,",
"88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,",
"8f0e0300000000000000504944564944,Trust GXT 28,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
"8f0e0d31000000000000504944564944,Multilaser JS071 USB,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
"8f0e1200000000000000504944564944,Acme,x:b2,a:b0,b:b1,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
+ "9000318000000000000504944564944,Mayflash Wiimote PC Adapter,a:b2,b:h0.4,x:b0,y:b1,back:b4,start:b5,guide:b11,leftshoulder:b6,rightshoulder:b3,leftx:a0,lefty:a1,",
"a3060cff000000000000504944564944,Saitek P2500,a:b2,b:b3,y:b1,x:b0,start:b4,guide:b10,back:b5,leftstick:b8,rightstick:b9,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
"c911f055000000000000504944564944,GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
"d6206dca000000000000504944564944,PowerA Pro Ex,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.0,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
@@ -475,11 +531,14 @@ static const char *s_ControllerMappings [] =
"03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,a:b2,b:b1,y:b0,x:b3,start:b8,back:b9,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,",
"03000000260900008888000000010000,GameCube {WiseGroup USB box},a:b0,b:b2,y:b3,x:b1,start:b7,leftshoulder:,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,rightstick:,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,",
"03000000280400000140000000010000,Gravis GamePad Pro USB ,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftx:a0,lefty:a1,",
+ "03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,y:b3,x:b0,start:b9,guide:,back:,leftstick:,rightstick:,leftshoulder:,dpleft:b15,dpdown:b14,dpright:b13,leftx:a0,lefty:a1,rightx:a5,righty:a2,lefttrigger:a3,righttrigger:a4,rightshoulder:b7,dpup:b12,",
+ "03000000380700001647000010040000,Mad Catz Wired Xbox 360 Controller,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
"030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
"030000004c050000c405000011010000,Sony DualShock 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,",
"030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,",
"030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,a:b1,b:b2,x:b0,y:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,",
"030000004f04000009d0000000010000,Thrustmaster Run N Drive Wireless PS3,a:b1,b:b2,x:b0,y:b3,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
+ "030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,x:b1,y:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,",
"030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,y:b3,x:b1,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,",
"030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a5,",
"030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
@@ -490,6 +549,7 @@ static const char *s_ControllerMappings [] =
"030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
"030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b11,dpdown:b14,dpright:b12,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
"030000005e040000d102000001010000,Microsoft X-Box One pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
+ "030000005e040000dd02000003020000,Microsoft X-Box One pad v2,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
"03000000666600000488000000010000,Super Joy Box 5 Pro,a:b2,b:b1,x:b3,y:b0,back:b9,start:b8,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,dpup:b12,dpleft:b15,dpdown:b14,dpright:b13,",
"030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,y:b4,x:b3,start:b8,guide:b5,back:b2,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b9,righttrigger:b10,",
"030000006d04000016c2000010010000,Logitech Logitech Dual Action,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
@@ -499,11 +559,14 @@ static const char *s_ControllerMappings [] =
"030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,x:b0,a:b2,b:b3,y:b1,back:b10,guide:b12,start:b11,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
"030000006f0e00001304000000010000,Generic X-Box pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
"030000006f0e00001e01000011010000,Rock Candy Gamepad for PS3,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,guide:b12,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,",
"030000006f0e00001f01000000010000,Generic X-Box pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
"030000006f0e00002801000011010000,PDP Rock Candy Wireless Controller for PS3,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a3,dpleft:h0.8,lefttrigger:b6,x:b0,dpup:h0.1,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b1,dpright:h0.2,righttrigger:b7,b:b2,",
"030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
+ "030000006f0e00003901000020060000,Afterglow Wired Controller for Xbox One,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
+ "030000006f0e00004601000001010000,Rock Candy Wired Controller for Xbox One,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,guide:b8,leftstick:b9,rightstick:b10,lefttrigger:a2,righttrigger:a5,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
"03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
"03000000790000001100000010010000,RetroLink Saturn Classic Controller,x:b3,a:b0,b:b1,y:b4,back:b5,guide:b2,start:b8,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
"03000000830500006020000010010000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,",
@@ -511,6 +574,8 @@ static const char *s_ControllerMappings [] =
"030000008916000001fd000024010000,Razer Onza Classic Edition,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:b11,dpdown:b14,dpright:b12,dpup:b13,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
"030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
"030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick,x:b2,a:b0,b:b1,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
+ "03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,y:b3,x:b0,start:b12,guide:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,",
+ "03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
"03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,",
"03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
"03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
diff --git a/main/input_default.h b/main/input_default.h
index 8f6a430436..01b813f3ca 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -3,6 +3,7 @@
#include "os/input.h"
+
class InputDefault : public Input {
OBJ_TYPE( InputDefault, Input );
@@ -19,6 +20,16 @@ class InputDefault : public Input {
MainLoop *main_loop;
bool emulate_touch;
+
+ struct VibrationInfo {
+ float weak_magnitude;
+ float strong_magnitude;
+ float duration; // Duration in seconds
+ uint64_t timestamp;
+ };
+
+ Map<int, VibrationInfo> joy_vibration;
+
struct SpeedTrack {
uint64_t last_tick;
@@ -129,6 +140,9 @@ public:
virtual float get_joy_axis(int p_device,int p_axis);
String get_joy_name(int p_idx);
+ virtual Vector2 get_joy_vibration_strength(int p_device);
+ virtual float get_joy_vibration_duration(int p_device);
+ virtual uint64_t get_joy_vibration_timestamp(int p_device);
void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid = "");
void parse_joystick_mapping(String p_mapping, bool p_update_existing);
@@ -147,6 +161,9 @@ public:
void set_magnetometer(const Vector3& p_magnetometer);
void set_joy_axis(int p_device,int p_axis,float p_value);
+ virtual void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration);
+ virtual void stop_joy_vibration(int p_device);
+
void set_main_loop(MainLoop *main_loop);
void set_mouse_pos(const Point2& p_posf);
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 060819b90e..b35e3a8055 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -9,6 +9,7 @@
#include "os/file_access.h"
#include "os/os.h"
#include "platform/android/logo.h"
+#include <string.h>
static const char* android_perms[]={
@@ -231,6 +232,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
void _fix_manifest(Vector<uint8_t>& p_manifest, bool p_give_internet);
void _fix_resources(Vector<uint8_t>& p_manifest);
static Error save_apk_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total);
+ static bool _should_compress_asset(const String& p_path);
protected:
@@ -1001,7 +1003,7 @@ Error EditorExportPlatformAndroid::save_apk_file(void *p_userdata,const String&
NULL,
0,
NULL,
- Z_DEFLATED,
+ _should_compress_asset(p_path) ? Z_DEFLATED : 0,
Z_DEFAULT_COMPRESSION);
@@ -1012,13 +1014,63 @@ Error EditorExportPlatformAndroid::save_apk_file(void *p_userdata,const String&
}
+bool EditorExportPlatformAndroid::_should_compress_asset(const String& p_path) {
+
+ /*
+ * By not compressing files with little or not benefit in doing so,
+ * a performance gain is expected at runtime. Moreover, if the APK is
+ * zip-aligned, assets stored as they are can be efficiently read by
+ * Android by memory-mapping them.
+ */
+
+ // -- Unconditional uncompress to mimic AAPT plus some other
+
+ static const char* unconditional_compress_ext[] = {
+ // From https://github.com/android/platform_frameworks_base/blob/master/tools/aapt/Package.cpp
+ // These formats are already compressed, or don't compress well:
+ ".jpg", ".jpeg", ".png", ".gif",
+ ".wav", ".mp2", ".mp3", ".ogg", ".aac",
+ ".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet",
+ ".rtttl", ".imy", ".xmf", ".mp4", ".m4a",
+ ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2",
+ ".amr", ".awb", ".wma", ".wmv",
+ // Godot-specific:
+ ".webp", // Same reasoning as .png
+ ".cfb", // Don't let small config files slow-down startup
+ // Trailer for easier processing
+ NULL
+ };
+
+ for (const char** ext=unconditional_compress_ext; *ext; ++ext) {
+ if (p_path.to_lower().ends_with(String(*ext))) {
+ return false;
+ }
+ }
+
+ // -- Compressed resource?
+
+ FileAccess *f=FileAccess::open(p_path,FileAccess::READ);
+ ERR_FAIL_COND_V(!f,true);
+
+ uint8_t header[4];
+ f->get_buffer(header,4);
+ if (header[0]=='R' && header[1]=='S' && header[2]=='C' && header[3]=='C') {
+ // Already compressed
+ return false;
+ }
+
+ // --- TODO: Decide on texture resources according to their image compression setting
+
+ return true;
+}
+
Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_debug, int p_flags) {
String src_apk;
- EditorProgress ep("export","Exporting for Android",104);
+ EditorProgress ep("export","Exporting for Android",105);
if (p_debug)
src_apk=custom_debug_package;
@@ -1058,7 +1110,8 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
zlib_filefunc_def io2=io;
FileAccess *dst_f=NULL;
io2.opaque=&dst_f;
- zipFile apk=zipOpen2(p_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2);
+ String unaligned_path=EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmpexport-unaligned.apk";
+ zipFile unaligned_apk=zipOpen2(unaligned_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2);
while(ret==UNZ_OK) {
@@ -1137,7 +1190,11 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
print_line("ADDING: "+file);
if (!skip) {
- zipOpenNewFileInZip(apk,
+
+ // Respect decision on compression made by AAPT for the export template
+ const bool uncompressed = info.compression_method == 0;
+
+ zipOpenNewFileInZip(unaligned_apk,
file.utf8().get_data(),
NULL,
NULL,
@@ -1145,11 +1202,11 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
NULL,
0,
NULL,
- Z_DEFLATED,
+ uncompressed ? 0 : Z_DEFLATED,
Z_DEFAULT_COMPRESSION);
- zipWriteInFileInZip(apk,data.ptr(),data.size());
- zipCloseFileInZip(apk);
+ zipWriteInFileInZip(unaligned_apk,data.ptr(),data.size());
+ zipCloseFileInZip(unaligned_apk);
}
ret = unzGoToNextFile(pkg);
@@ -1206,7 +1263,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
APKExportData ed;
ed.ep=&ep;
- ed.apk=apk;
+ ed.apk=unaligned_apk;
err = export_project_files(save_apk_file,&ed,false);
}
@@ -1235,7 +1292,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
print_line(itos(i)+" param: "+cl[i]);
}
- zipOpenNewFileInZip(apk,
+ zipOpenNewFileInZip(unaligned_apk,
"assets/_cl_",
NULL,
NULL,
@@ -1243,15 +1300,15 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
NULL,
0,
NULL,
- Z_DEFLATED,
+ 0, // No compress (little size gain and potentially slower startup)
Z_DEFAULT_COMPRESSION);
- zipWriteInFileInZip(apk,clf.ptr(),clf.size());
- zipCloseFileInZip(apk);
+ zipWriteInFileInZip(unaligned_apk,clf.ptr(),clf.size());
+ zipCloseFileInZip(unaligned_apk);
}
- zipClose(apk,NULL);
+ zipClose(unaligned_apk,NULL);
unzClose(pkg);
if (err) {
@@ -1308,7 +1365,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
args.push_back(keystore);
args.push_back("-storepass");
args.push_back(password);
- args.push_back(p_path);
+ args.push_back(unaligned_path);
args.push_back(user);
int retval;
int err = OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval);
@@ -1321,16 +1378,102 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
args.clear();
args.push_back("-verify");
- args.push_back(p_path);
+ args.push_back(unaligned_path);
args.push_back("-verbose");
err = OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval);
if (retval) {
- EditorNode::add_io_error("'jarsigner' verificaiton of APK failed. Make sure to use jarsigner from Java 6.");
+ EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use jarsigner from Java 6.");
return ERR_CANT_CREATE;
}
}
+
+
+
+ // Let's zip-align (must be done after signing)
+
+ static const int ZIP_ALIGNMENT = 4;
+
+ ep.step("Aligning APK..",105);
+
+ unzFile tmp_unaligned = unzOpen2(unaligned_path.utf8().get_data(), &io);
+ if (!tmp_unaligned) {
+
+ EditorNode::add_io_error("Could not find temp unaligned APK.");
+ return ERR_FILE_NOT_FOUND;
+ }
+
+ ERR_FAIL_COND_V(!tmp_unaligned, ERR_CANT_OPEN);
+ ret = unzGoToFirstFile(tmp_unaligned);
+
+ io2=io;
+ dst_f=NULL;
+ io2.opaque=&dst_f;
+ zipFile final_apk=zipOpen2(p_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2);
+
+ // Take files from the unaligned APK and write them out to the aligned one
+ // in raw mode, i.e. not uncompressing and recompressing, aligning them as needed,
+ // following what is done in https://github.com/android/platform_build/blob/master/tools/zipalign/ZipAlign.cpp
+ int bias = 0;
+ while(ret==UNZ_OK) {
+
+ unz_file_info info;
+ memset(&info, 0, sizeof(info));
+
+ char fname[16384];
+ char extra[16384];
+ ret = unzGetCurrentFileInfo(tmp_unaligned,&info,fname,16384,extra,16384-ZIP_ALIGNMENT,NULL,0);
+
+ String file=fname;
+
+ Vector<uint8_t> data;
+ data.resize(info.compressed_size);
+
+ // read
+ int method, level;
+ unzOpenCurrentFile2(tmp_unaligned, &method, &level, 1); // raw read
+ long file_offset = unzGetCurrentFileZStreamPos64(tmp_unaligned);
+ unzReadCurrentFile(tmp_unaligned,data.ptr(),data.size());
+ unzCloseCurrentFile(tmp_unaligned);
+
+ // align
+ int padding = 0;
+ if (!info.compression_method) {
+ // Uncompressed file => Align
+ long new_offset = file_offset + bias;
+ padding = (ZIP_ALIGNMENT - (new_offset % ZIP_ALIGNMENT)) % ZIP_ALIGNMENT;
+ }
+
+ memset(extra + info.size_file_extra, 0, padding);
+
+ // write
+ zipOpenNewFileInZip2(final_apk,
+ file.utf8().get_data(),
+ NULL,
+ extra,
+ info.size_file_extra + padding,
+ NULL,
+ 0,
+ NULL,
+ method,
+ level,
+ 1); // raw write
+ zipWriteInFileInZip(final_apk,data.ptr(),data.size());
+ zipCloseFileInZipRaw(final_apk,info.uncompressed_size,info.crc);
+
+ bias += padding;
+
+ ret = unzGoToNextFile(tmp_unaligned);
+ }
+
+ zipClose(final_apk,NULL);
+ unzClose(tmp_unaligned);
+
+ if (err) {
+ return err;
+ }
+
return OK;
}
diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joystick_linux.cpp
index 2793cc5734..5ce0219df7 100644
--- a/platform/x11/joystick_linux.cpp
+++ b/platform/x11/joystick_linux.cpp
@@ -316,13 +316,21 @@ void joystick_linux::setup_joystick_properties(int p_id) {
}
}
}
-}
+ joy->force_feedback = false;
+ joy->ff_effect_timestamp = 0;
+ unsigned long ffbit[NBITS(FF_CNT)];
+ if (ioctl(joy->fd, EVIOCGBIT(EV_FF, sizeof(ffbit)), ffbit) != -1) {
+ if (test_bit(FF_RUMBLE, ffbit)) {
+ joy->force_feedback = true;
+ }
+ }
+}
void joystick_linux::open_joystick(const char *p_path) {
int joy_num = get_free_joy_slot();
- int fd = open(p_path, O_RDONLY | O_NONBLOCK);
+ int fd = open(p_path, O_RDWR | O_NONBLOCK);
if (fd != -1 && joy_num != -1) {
unsigned long evbit[NBITS(EV_MAX)] = { 0 };
@@ -392,6 +400,55 @@ void joystick_linux::open_joystick(const char *p_path) {
}
}
+void joystick_linux::joystick_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp)
+{
+ Joystick& joy = joysticks[p_id];
+ if (!joy.force_feedback || joy.fd == -1 || p_weak_magnitude < 0.f || p_weak_magnitude > 1.f || p_strong_magnitude < 0.f || p_strong_magnitude > 1.f) {
+ return;
+ }
+ if (joy.ff_effect_id != -1) {
+ joystick_vibration_stop(p_id, p_timestamp);
+ }
+
+ struct ff_effect effect;
+ effect.type = FF_RUMBLE;
+ effect.id = -1;
+ effect.u.rumble.weak_magnitude = floor(p_weak_magnitude * (float)0xffff);
+ effect.u.rumble.strong_magnitude = floor(p_strong_magnitude * (float)0xffff);
+ effect.replay.length = floor(p_duration * 1000);
+ effect.replay.delay = 0;
+
+ if (ioctl(joy.fd, EVIOCSFF, &effect) < 0) {
+ return;
+ }
+
+ struct input_event play;
+ play.type = EV_FF;
+ play.code = effect.id;
+ play.value = 1;
+ write(joy.fd, (const void*)&play, sizeof(play));
+
+ joy.ff_effect_id = effect.id;
+ joy.ff_effect_timestamp = p_timestamp;
+}
+
+void joystick_linux::joystick_vibration_stop(int p_id, uint64_t p_timestamp)
+{
+ Joystick& joy = joysticks[p_id];
+ if (!joy.force_feedback || joy.fd == -1 || joy.ff_effect_id == -1) {
+ return;
+ }
+
+ struct input_event stop;
+ stop.type = EV_FF;
+ stop.code = joy.ff_effect_id;
+ stop.value = 0;
+ write(joy.fd, (const void*)&stop, sizeof(stop));
+
+ joy.ff_effect_id = -1;
+ joy.ff_effect_timestamp = p_timestamp;
+}
+
InputDefault::JoyAxis joystick_linux::axis_correct(const input_absinfo *p_abs, int p_value) const {
int min = p_abs->minimum;
@@ -485,6 +542,19 @@ uint32_t joystick_linux::process_joysticks(uint32_t p_event_id) {
if (len == 0 || (len < 0 && errno != EAGAIN)) {
close_joystick(i);
};
+
+ if (joy->force_feedback) {
+ uint64_t timestamp = input->get_joy_vibration_timestamp(i);
+ if (timestamp > joy->ff_effect_timestamp) {
+ Vector2 strength = input->get_joy_vibration_strength(i);
+ float duration = input->get_joy_vibration_duration(i);
+ if (strength.x == 0 && strength.y == 0) {
+ joystick_vibration_stop(i, timestamp);
+ } else {
+ joystick_vibration_start(i, strength.x, strength.y, duration, timestamp);
+ }
+ }
+ }
}
joy_mutex->unlock();
return p_event_id;
diff --git a/platform/x11/joystick_linux.h b/platform/x11/joystick_linux.h
index 4f0533721b..7ea2664ebb 100644
--- a/platform/x11/joystick_linux.h
+++ b/platform/x11/joystick_linux.h
@@ -61,6 +61,10 @@ private:
String devpath;
input_absinfo *abs_info[MAX_ABS];
+ bool force_feedback;
+ int ff_effect_id;
+ uint64_t ff_effect_timestamp;
+
Joystick();
~Joystick();
void reset();
@@ -88,6 +92,9 @@ private:
void run_joystick_thread();
void open_joystick(const char* path);
+ void joystick_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
+ void joystick_vibration_stop(int p_id, uint64_t p_timestamp);
+
InputDefault::JoyAxis axis_correct(const input_absinfo *abs, int value) const;
};
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index eb576b11f4..1ca779ef7c 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -120,15 +120,33 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
const char* err;
xrr_get_monitors = NULL;
+ xrr_free_monitors = NULL;
+ int xrandr_major = 0;
+ int xrandr_minor = 0;
+ int event_base, error_base;
+ xrandr_ext_ok = XRRQueryExtension(x11_display,&event_base, &error_base);
xrandr_handle = dlopen("libXrandr.so", RTLD_LAZY);
err = dlerror();
if (!xrandr_handle) {
- fprintf(stderr, "could not load libXrandr.so, dpi detection disabled. Error: %s\n", err);
+ fprintf(stderr, "could not load libXrandr.so, Error: %s\n", err);
}
else {
- xrr_get_monitors = (xrr_get_monitors_t) dlsym(xrandr_handle, "XRRGetMonitors");
- if (!xrr_get_monitors)
- fprintf(stderr, "could not find symbol XRRGetMonitors, dpi detection will only work on the first screen\nError: %s\n", err);
+ XRRQueryVersion(x11_display, &xrandr_major, &xrandr_minor);
+ if (((xrandr_major << 8) | xrandr_minor) >= 0x0105) {
+ xrr_get_monitors = (xrr_get_monitors_t) dlsym(xrandr_handle, "XRRGetMonitors");
+ if (!xrr_get_monitors) {
+ err = dlerror();
+ fprintf(stderr, "could not find symbol XRRGetMonitors\nError: %s\n", err);
+ }
+ else {
+ xrr_free_monitors = (xrr_free_monitors_t) dlsym(xrandr_handle, "XRRFreeMonitors");
+ if (!xrr_free_monitors) {
+ err = dlerror();
+ fprintf(stderr, "could not find XRRFreeMonitors\nError: %s\n", err);
+ xrr_get_monitors = NULL;
+ }
+ }
+ }
}
xim = XOpenIM (x11_display, NULL, NULL, NULL);
@@ -745,19 +763,18 @@ int OS_X11::get_screen_dpi(int p_screen) const {
ERR_FAIL_INDEX_V(p_screen, get_screen_count(), 0);
//Get physical monitor Dimensions through XRandR and calculate dpi
- int event_base, error_base;
- const Bool ext_okay = XRRQueryExtension(x11_display,&event_base, &error_base);
-
Size2 sc = get_screen_size(p_screen);
- if (ext_okay) {
+ if (xrandr_ext_ok) {
int count = 0;
if (xrr_get_monitors) {
xrr_monitor_info *monitors = xrr_get_monitors(x11_display, x11_window, true, &count);
if (p_screen < count) {
double xdpi = sc.width / (double) monitors[p_screen].mwidth * 25.4;
double ydpi = sc.height / (double) monitors[p_screen].mheight * 25.4;
+ xrr_free_monitors(monitors);
return (xdpi + ydpi) / 2;
}
+ xrr_free_monitors(monitors);
}
else if (p_screen == 0) {
XRRScreenSize *sizes = XRRSizes(x11_display, 0, &count);
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 3a4579d818..71bbe726dd 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -178,8 +178,11 @@ class OS_X11 : public OS_Unix {
void set_wm_fullscreen(bool p_enabled);
typedef xrr_monitor_info* (*xrr_get_monitors_t)(Display *dpy, Window window, Bool get_active, int *nmonitors);
+ typedef void (*xrr_free_monitors_t)(xrr_monitor_info* monitors);
xrr_get_monitors_t xrr_get_monitors;
+ xrr_free_monitors_t xrr_free_monitors;
void *xrandr_handle;
+ Bool xrandr_ext_ok;
protected:
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 17e5503a2d..8864459dfb 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -1042,7 +1042,9 @@ void CanvasItem::_bind_methods() {
ObjectTypeDB::bind_method(_MD("edit_rotate","degrees"),&CanvasItem::edit_rotate);
ObjectTypeDB::bind_method(_MD("get_item_rect"),&CanvasItem::get_item_rect);
+ ObjectTypeDB::bind_method(_MD("get_item_and_children_rect"),&CanvasItem::get_item_and_children_rect);
//ObjectTypeDB::bind_method(_MD("get_transform"),&CanvasItem::get_transform);
+
ObjectTypeDB::bind_method(_MD("get_canvas_item"),&CanvasItem::get_canvas_item);
ObjectTypeDB::bind_method(_MD("is_visible"),&CanvasItem::is_visible);
@@ -1195,6 +1197,23 @@ int CanvasItem::get_canvas_layer() const {
return 0;
}
+
+Rect2 CanvasItem::get_item_and_children_rect() const {
+
+ Rect2 rect = get_item_rect();
+
+
+ for(int i=0;i<get_child_count();i++) {
+ CanvasItem *c=get_child(i)->cast_to<CanvasItem>();
+ if (c) {
+ Rect2 sir = c->get_transform().xform(c->get_item_and_children_rect());
+ rect = rect.merge(sir);
+ }
+ }
+
+ return rect;
+}
+
CanvasItem::CanvasItem() : xform_change(this) {
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 05a2e725e9..d915f742ec 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -240,6 +240,8 @@ public:
virtual Matrix32 get_global_transform() const;
virtual Matrix32 get_global_transform_with_canvas() const;
+ Rect2 get_item_and_children_rect() const;
+
CanvasItem *get_toplevel() const;
_FORCE_INLINE_ RID get_canvas_item() const { return canvas_item; }
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index e35ba11e84..7d134a070e 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -990,7 +990,7 @@ float VehicleBody::get_steering() const{
return m_steeringValue;
}
-Vector3 VehicleBody::get_linear_velocity()
+Vector3 VehicleBody::get_linear_velocity() const
{
return linear_velocity;
}
diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h
index b6ad88f15e..31c61ff99d 100644
--- a/scene/3d/vehicle_body.h
+++ b/scene/3d/vehicle_body.h
@@ -178,7 +178,7 @@ public:
void set_steering(float p_steering);
float get_steering() const;
- Vector3 get_linear_velocity();
+ Vector3 get_linear_velocity() const;
VehicleBody();
};
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp
index 211c5961b0..0f7ed1cb29 100644
--- a/scene/animation/animation_tree_player.cpp
+++ b/scene/animation/animation_tree_player.cpp
@@ -669,7 +669,7 @@ float AnimationTreePlayer::_process_node(const StringName& p_node,AnimationNode
}
tsn->seek_pos=-1;
- return _process_node(tsn->inputs[0].node,r_prev_anim,p_weight,p_time,p_seek);
+ return _process_node(tsn->inputs[0].node,r_prev_anim,p_weight,p_time,p_seek, p_filter, p_reverse_weight);
} break;
case NODE_TRANSITION: {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index dfad7d1432..666ac88055 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -437,11 +437,17 @@ void Control::_notification(int p_notification) {
if (is_set_as_toplevel()) {
data.SI=get_viewport()->_gui_add_subwindow_control(this);
+
+ if (data.theme.is_null() && data.parent && data.parent->data.theme_owner) {
+ data.theme_owner=data.parent->data.theme_owner;
+ notification(NOTIFICATION_THEME_CHANGED);
+ }
+
} else {
Node *parent=this; //meh
- Node *parent_control=NULL;
+ Control *parent_control=NULL;
bool subwindow=false;
while(parent) {
@@ -457,8 +463,9 @@ void Control::_notification(int p_notification) {
break;
}
- if (parent->cast_to<Control>()) {
- parent_control=parent->cast_to<Control>();
+ parent_control=parent->cast_to<Control>();
+
+ if (parent_control) {
break;
} else if (ci) {
@@ -470,6 +477,10 @@ void Control::_notification(int p_notification) {
if (parent_control) {
//do nothing, has a parent control
+ if (data.theme.is_null() && parent_control->data.theme_owner) {
+ data.theme_owner=parent_control->data.theme_owner;
+ notification(NOTIFICATION_THEME_CHANGED);
+ }
} else if (subwindow) {
//is a subwindow (process input before other controls for that canvas)
data.SI=get_viewport()->_gui_add_subwindow_control(this);
@@ -1829,18 +1840,29 @@ void Control::_modal_stack_remove() {
}
-void Control::_propagate_theme_changed(Control *p_owner) {
+void Control::_propagate_theme_changed(CanvasItem *p_at,Control *p_owner) {
+
+ Control *c = p_at->cast_to<Control>();
+
+ if (c && c!=p_owner && c->data.theme.is_valid()) // has a theme, this can't be propagated
+ return;
+
+ for(int i=0;i<p_at->get_child_count();i++) {
- for(int i=0;i<get_child_count();i++) {
+ CanvasItem *child = p_at->get_child(i)->cast_to<CanvasItem>();
+ if (child) {
+ _propagate_theme_changed(child,p_owner);
+ }
- Control *child = get_child(i)->cast_to<Control>();
- if (child && child->data.theme.is_null()) //has no theme, propagate
- child->_propagate_theme_changed(p_owner);
}
- data.theme_owner=p_owner;
- _notification(NOTIFICATION_THEME_CHANGED);
- update();
+
+ if (c) {
+
+ c->data.theme_owner=p_owner;
+ c->_notification(NOTIFICATION_THEME_CHANGED);
+ c->update();
+ }
}
void Control::set_theme(const Ref<Theme>& p_theme) {
@@ -1849,15 +1871,15 @@ void Control::set_theme(const Ref<Theme>& p_theme) {
data.theme=p_theme;
if (!p_theme.is_null()) {
- _propagate_theme_changed(this);
+ _propagate_theme_changed(this,this);
} else {
Control *parent = get_parent()?get_parent()->cast_to<Control>():NULL;
if (parent && parent->data.theme_owner) {
- _propagate_theme_changed(parent->data.theme_owner);
+ _propagate_theme_changed(this,parent->data.theme_owner);
} else {
- _propagate_theme_changed(NULL);
+ _propagate_theme_changed(this,NULL);
}
}
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 59704ae29b..69ee41f180 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -169,7 +169,7 @@ private:
float _get_range(int p_idx) const;
float _s2a(float p_val, AnchorType p_anchor,float p_range) const;
float _a2s(float p_val, AnchorType p_anchor,float p_range) const;
- void _propagate_theme_changed(Control *p_owner);
+ void _propagate_theme_changed(CanvasItem *p_at, Control *p_owner);
void _change_notify_margins();
void _update_minimum_size();
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 80949b4eb4..786ce27a0c 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -278,6 +278,11 @@ if (m_height > line_height) {\
if (c[end]=='\t') {
cw=tab_size*font->get_char_size(' ').width;
}
+
+ if (end>0 && w+cw+begin > p_width ) {
+ break; //don't allow lines longer than assigned width
+ }
+
w+=cw;
if (c[end]==' ') {
@@ -340,10 +345,12 @@ if (m_height > line_height) {\
int cw=font->get_char_size(c[i],c[i+1]).x;
+
if (c[i]=='\t') {
cw=tab_size*font->get_char_size(' ').width;
}
+
if (p_click_pos.x-cw/2>p_ofs.x+align_ofs+pofs) {
rchar=int((&c[i])-cf);
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index d22f6a0229..6b36a60ea2 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -351,7 +351,7 @@ void SplitContainer::_input_event(const InputEvent& p_event) {
}
-Control::CursorShape SplitContainer::get_cursor_shape(const Point2& p_pos) {
+Control::CursorShape SplitContainer::get_cursor_shape(const Point2& p_pos) const {
if (collapsed)
return Control::get_cursor_shape(p_pos);
diff --git a/scene/gui/split_container.h b/scene/gui/split_container.h
index f721d16310..d2dc42165e 100644
--- a/scene/gui/split_container.h
+++ b/scene/gui/split_container.h
@@ -75,7 +75,7 @@ public:
void set_dragger_visibility(DraggerVisibility p_visibility);
DraggerVisibility get_dragger_visibility() const;
- virtual CursorShape get_cursor_shape(const Point2& p_pos=Point2i());
+ virtual CursorShape get_cursor_shape(const Point2& p_pos=Point2i()) const;
virtual Size2 get_minimum_size() const;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 3e374ef888..49d7527786 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2892,7 +2892,7 @@ int TextEdit::get_char_count() {
return totalsize; // omit last \n
}
-Size2 TextEdit::get_minimum_size() {
+Size2 TextEdit::get_minimum_size() const {
return cache.style_normal->get_minimum_size();
}
@@ -3825,12 +3825,16 @@ void TextEdit::undo() {
_do_text_op(op, true);
current_op.version=op.prev_version;
if(undo_stack_pos->get().chain_backward) {
- do {
+ while(true) {
+ ERR_BREAK(!undo_stack_pos->prev());
undo_stack_pos = undo_stack_pos->prev();
op = undo_stack_pos->get();
_do_text_op(op, true);
current_op.version = op.prev_version;
- } while(!undo_stack_pos->get().chain_forward);
+ if (undo_stack_pos->get().chain_forward) {
+ break;
+ }
+ }
}
cursor_set_line(undo_stack_pos->get().from_line);
@@ -3849,12 +3853,16 @@ void TextEdit::redo() {
_do_text_op(op, false);
current_op.version = op.version;
if(undo_stack_pos->get().chain_forward) {
- do {
+
+ while(true) {
+ ERR_BREAK(!undo_stack_pos->next());
undo_stack_pos=undo_stack_pos->next();
op = undo_stack_pos->get();
_do_text_op(op, false);
current_op.version = op.version;
- } while(!undo_stack_pos->get().chain_backward);
+ if (undo_stack_pos->get().chain_backward)
+ break;
+ }
}
cursor_set_line(undo_stack_pos->get().to_line);
cursor_set_column(undo_stack_pos->get().to_column);
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 24a72afd48..22f024c491 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -278,7 +278,7 @@ class TextEdit : public Control {
void _scroll_lines_down();
// void mouse_motion(const Point& p_pos, const Point& p_rel, int p_button_mask);
- Size2 get_minimum_size();
+ Size2 get_minimum_size() const;
int get_row_height() const;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index f8af83e23b..50b0fe224e 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -283,7 +283,11 @@ void Node::move_child(Node *p_child,int p_pos) {
ERR_FAIL_INDEX( p_pos, data.children.size()+1 );
ERR_EXPLAIN("child is not a child of this node.");
ERR_FAIL_COND(p_child->data.parent!=this);
- ERR_FAIL_COND(data.blocked>0);
+ if (data.blocked>0) {
+ ERR_EXPLAIN("Parent node is busy setting up children, move_child() failed. Consider using call_deferred(\"move_child\") instead (or \"popup\" if this is from a popup).");
+ ERR_FAIL_COND(data.blocked>0);
+ }
+
data.children.remove( p_child->data.pos );
data.children.insert( p_pos, p_child );
@@ -739,6 +743,12 @@ void Node::add_child(Node *p_child, bool p_legible_unique_name) {
}
ERR_EXPLAIN("Can't add child, already has a parent");
ERR_FAIL_COND( p_child->data.parent );
+
+ if (data.blocked>0) {
+ ERR_EXPLAIN("Parent node is busy setting up children, add_node() failed. Consider using call_deferred(\"add_child\",child) instead.");
+ ERR_FAIL_COND(data.blocked>0);
+ }
+
ERR_EXPLAIN("Can't add child while a notification is happening");
ERR_FAIL_COND( data.blocked > 0 );
@@ -800,7 +810,10 @@ void Node::_propagate_validate_owner() {
void Node::remove_child(Node *p_child) {
ERR_FAIL_NULL(p_child);
- ERR_FAIL_COND( data.blocked > 0 );
+ if (data.blocked>0) {
+ ERR_EXPLAIN("Parent node is busy setting up children, remove_node() failed. Consider using call_deferred(\"remove_child\",child) instead.");
+ ERR_FAIL_COND(data.blocked>0);
+ }
int idx=-1;
for (int i=0;i<data.children.size();i++) {
@@ -1770,6 +1783,8 @@ void Node::replace_by(Node* p_node,bool p_keep_data) {
}
}
+ _replace_connections_target(p_node);
+
if (data.owner) {
for(int i=0;i<get_child_count();i++)
find_owned_by(data.owner,get_child(i),&owned_by_owner);
@@ -1808,6 +1823,20 @@ void Node::replace_by(Node* p_node,bool p_keep_data) {
}
+void Node::_replace_connections_target(Node* p_new_target) {
+
+ List<Connection> cl;
+ get_signals_connected_to_this(&cl);
+
+ for(List<Connection>::Element *E=cl.front();E;E=E->next()) {
+
+ Connection &c=E->get();
+
+ c.source->disconnect(c.signal,this,c.method);
+ c.source->connect(c.signal,p_new_target,c.method,c.binds,c.flags);
+ }
+}
+
Vector<Variant> Node::make_binds(VARIANT_ARG_DECLARE) {
diff --git a/scene/main/node.h b/scene/main/node.h
index d099f6e773..a3b8d8de81 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -121,7 +121,7 @@ private:
Node *_get_node(const NodePath& p_path) const;
Node *_get_child_by_name(const StringName& p_name) const;
-
+ void _replace_connections_target(Node* p_new_target);
void _validate_child_name(Node *p_name, bool p_force_human_readable=false);
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 78a5571bf0..1edae01754 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -573,7 +573,11 @@ DynamicFontAtSize::~DynamicFontAtSize(){
void DynamicFont::set_font_data(const Ref<DynamicFontData>& p_data) {
data=p_data;
- data_at_size=data->_get_dynamic_font_at_size(size);
+ if (data.is_valid())
+ data_at_size=data->_get_dynamic_font_at_size(size);
+ else
+ data_at_size=Ref<DynamicFontAtSize>();
+
emit_changed();
}
diff --git a/scene/resources/room.cpp b/scene/resources/room.cpp
index 4024e2f45c..d1fc614c90 100644
--- a/scene/resources/room.cpp
+++ b/scene/resources/room.cpp
@@ -31,7 +31,7 @@
#include "servers/visual_server.h"
-RID RoomBounds::get_rid() {
+RID RoomBounds::get_rid() const {
return area;
}
diff --git a/scene/resources/room.h b/scene/resources/room.h
index a9f159cd46..3ed41a3e61 100644
--- a/scene/resources/room.h
+++ b/scene/resources/room.h
@@ -50,7 +50,7 @@ protected:
public:
- virtual RID get_rid();
+ virtual RID get_rid() const;
void set_bounds( const BSP_Tree& p_bounds );
BSP_Tree get_bounds() const;
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 570a5a6ee4..fafc09f554 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -560,7 +560,7 @@ void VisualServer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("draw"),&VisualServer::draw);
ObjectTypeDB::bind_method(_MD("sync"),&VisualServer::sync);
- ObjectTypeDB::bind_method(_MD("free"),&VisualServer::free);
+ ObjectTypeDB::bind_method(_MD("free_rid"),&VisualServer::free);
ObjectTypeDB::bind_method(_MD("set_default_clear_color"),&VisualServer::set_default_clear_color);
diff --git a/tools/Godot.app/Contents/Info.plist b/tools/Godot.app/Contents/Info.plist
index 2b58162ae8..37c80fc8a3 100755
--- a/tools/Godot.app/Contents/Info.plist
+++ b/tools/Godot.app/Contents/Info.plist
@@ -34,7 +34,7 @@
<string>10.6.0</string>
</dict>
<key>NSHighResolutionCapable</key>
- <false/>
+ <true/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp
index 928acdbcbb..c571310ded 100644
--- a/tools/editor/asset_library_editor_plugin.cpp
+++ b/tools/editor/asset_library_editor_plugin.cpp
@@ -541,8 +541,12 @@ void EditorAssetLibrary::_notification(int p_what) {
error_hb->add_child(tf);
error_label->raise();
+ }
- _repository_changed(0);
+ if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
+ if(!is_hidden()) {
+ _repository_changed(0); // Update when shown for the first time
+ }
}
if (p_what==NOTIFICATION_PROCESS) {
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index f62209fafa..be5d9c47ff 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -247,8 +247,18 @@ void FindReplaceBar::_get_search_from(int& r_line, int& r_col) {
r_col=text_edit->cursor_get_column();
if (text_edit->is_selection_active() && !replace_all_mode) {
- r_line=text_edit->get_selection_from_line();
- r_col=text_edit->get_selection_to_column();
+
+ int selection_line=text_edit->get_selection_from_line();
+
+ if (text_edit->get_selection_text()==get_search_text() && r_line==selection_line) {
+
+ int selection_from_col=text_edit->get_selection_from_column();
+
+ if (r_col>=selection_from_col && r_col<=text_edit->get_selection_to_column()) {
+ r_col=selection_line;
+ r_col=selection_from_col;
+ }
+ }
}
if (r_line==result_line && r_col>=result_col && r_col<=result_col+get_search_text().length()) {
@@ -521,6 +531,9 @@ FindReplaceBar::FindReplaceBar() {
error_label = memnew(Label);
search_options->add_child(error_label);
+ error_label->add_color_override("font_color", Color(1,1,0,1));
+ error_label->add_color_override("font_color_shadow", Color(0,0,0,1));
+ error_label->add_constant_override("shadow_as_outline", 1);
search_options->add_spacer();
diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp
index 222e42f8a7..8847654ad7 100644
--- a/tools/editor/connections_dialog.cpp
+++ b/tools/editor/connections_dialog.cpp
@@ -35,6 +35,7 @@
#include "print_string.h"
#include "editor_settings.h"
#include "editor_node.h"
+#include "plugins/script_editor_plugin.h"
class ConnectDialogBinds : public Object {
@@ -766,11 +767,58 @@ void ConnectionsDock::_something_selected() {
}
+void ConnectionsDock::_something_activated() {
+
+ TreeItem *item = tree->get_selected();
+
+ if (!item)
+ return;
+
+ if (item->get_parent()==tree->get_root() || item->get_parent()->get_parent()==tree->get_root()) {
+ // a signal - connect
+ String signal=item->get_metadata(0).operator Dictionary()["name"];
+ String midname=node->get_name();
+ for(int i=0;i<midname.length();i++) {
+ CharType c = midname[i];
+ if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='_') {
+ //all good
+ } else if (c==' ') {
+ c='_';
+ } else {
+ midname.remove(i);
+ i--;
+ continue;
+ }
+
+ midname[i]=c;
+ }
+
+ connect_dialog->edit(node);
+ connect_dialog->popup_centered_ratio();
+ connect_dialog->set_dst_method("_on_"+midname+"_"+signal);
+ connect_dialog->set_dst_node(node->get_owner()?node->get_owner():node);
+ } else {
+ // a slot - go to target method
+ Connection c=item->get_metadata(0);
+ ERR_FAIL_COND(c.source!=node); //shouldn't happen but...bugcheck
+
+ if (!c.target)
+ return;
+
+ Ref<Script> script = c.target->get_script();
+
+ if (script.is_valid() && ScriptEditor::get_singleton()->script_go_to_method(script,c.method)) {
+ editor->call("_editor_select",EditorNode::EDITOR_SCRIPT);
+ }
+ }
+}
+
void ConnectionsDock::_bind_methods() {
ObjectTypeDB::bind_method("_connect",&ConnectionsDock::_connect);
ObjectTypeDB::bind_method("_something_selected",&ConnectionsDock::_something_selected);
+ ObjectTypeDB::bind_method("_something_activated",&ConnectionsDock::_something_activated);
ObjectTypeDB::bind_method("_close",&ConnectionsDock::_close);
ObjectTypeDB::bind_method("_connect_pressed",&ConnectionsDock::_connect_pressed);
ObjectTypeDB::bind_method("update_tree",&ConnectionsDock::update_tree);
@@ -823,6 +871,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
remove_confirm->connect("confirmed", this,"_remove_confirm");
connect_dialog->connect("connected", this,"_connect");
tree->connect("item_selected", this,"_something_selected");
+ tree->connect("item_activated", this,"_something_activated");
add_constant_override("separation",3*EDSCALE);
}
diff --git a/tools/editor/connections_dialog.h b/tools/editor/connections_dialog.h
index 96ebaf85b0..73f52abc9e 100644
--- a/tools/editor/connections_dialog.h
+++ b/tools/editor/connections_dialog.h
@@ -111,6 +111,7 @@ class ConnectionsDock : public VBoxContainer {
void _close();
void _connect();
void _something_selected();
+ void _something_activated();
UndoRedo *undo_redo;
protected:
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 48505324d3..a313b0053a 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -2503,6 +2503,51 @@ void ScriptEditor::set_scene_root_script( Ref<Script> p_script ) {
}
}
+bool ScriptEditor::script_go_to_method(Ref<Script> p_script, const String& p_method) {
+
+ Vector<String> functions;
+ bool found=false;
+
+ for (int i=0;i<tab_container->get_child_count();i++) {
+ ScriptTextEditor *current = tab_container->get_child(i)->cast_to<ScriptTextEditor>();
+
+ if (current && current->get_edited_script()==p_script) {
+ functions=current->get_functions();
+ found=true;
+ break;
+ }
+ }
+
+ if (!found) {
+ String errortxt;
+ int line=-1,col;
+ String text=p_script->get_source_code();
+ List<String> fnc;
+
+ if (p_script->get_language()->validate(text,line,col,errortxt,p_script->get_path(),&fnc)) {
+
+ for (List<String>::Element *E=fnc.front();E;E=E->next())
+ functions.push_back(E->get());
+ }
+ }
+
+ String method_search = p_method + ":";
+
+ for (int i=0;i<functions.size();i++) {
+ String function=functions[i];
+
+ if (function.begins_with(method_search)) {
+
+ edit(p_script);
+ int line=function.get_slice(":",1).to_int();
+ _goto_script_line2(line-1);
+ return true;
+ }
+ }
+
+ return false;
+}
+
void ScriptEditor::set_live_auto_reload_running_scripts(bool p_enabled) {
auto_reload_running_scripts=p_enabled;
@@ -2575,72 +2620,72 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
file_menu = memnew( MenuButton );
menu_hb->add_child(file_menu);
file_menu->set_text(TTR("File"));
- file_menu->get_popup()->add_item(TTR("New"),FILE_NEW);
- file_menu->get_popup()->add_item(TTR("Open"),FILE_OPEN);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new", TTR("New")), FILE_NEW);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/open", TTR("Open")), FILE_OPEN);
file_menu->get_popup()->add_separator();
- file_menu->get_popup()->add_item(TTR("Save"),FILE_SAVE,KEY_MASK_ALT|KEY_MASK_CMD|KEY_S);
- file_menu->get_popup()->add_item(TTR("Save As.."),FILE_SAVE_AS);
- file_menu->get_popup()->add_item(TTR("Save All"),FILE_SAVE_ALL,KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_S);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save", TTR("Save"), KEY_MASK_ALT|KEY_MASK_CMD|KEY_S), FILE_SAVE);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_as", TTR("Save As..")), FILE_SAVE_AS);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTR("Save All"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_S), FILE_SAVE_ALL);
file_menu->get_popup()->add_separator();
- file_menu->get_popup()->add_item(TTR("History Prev"),WINDOW_PREV,KEY_MASK_CTRL|KEY_MASK_ALT|KEY_LEFT);
- file_menu->get_popup()->add_item(TTR("History Next"),WINDOW_NEXT,KEY_MASK_CTRL|KEY_MASK_ALT|KEY_RIGHT);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Prev"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_LEFT), WINDOW_PREV);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_RIGHT), WINDOW_NEXT);
file_menu->get_popup()->add_separator();
- file_menu->get_popup()->add_item(TTR("Import Theme"), FILE_IMPORT_THEME);
- file_menu->get_popup()->add_item(TTR("Reload Theme"), FILE_RELOAD_THEME);
- file_menu->get_popup()->add_item(TTR("Save Theme"), FILE_SAVE_THEME);
- file_menu->get_popup()->add_item(TTR("Save Theme As"), FILE_SAVE_THEME_AS);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/import_theme", TTR("Import Theme")), FILE_IMPORT_THEME);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_theme", TTR("Reload Theme")), FILE_RELOAD_THEME);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_theme", TTR("Save Theme")), FILE_SAVE_THEME);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_theme_as", TTR("Save Theme As")), FILE_SAVE_THEME_AS);
file_menu->get_popup()->add_separator();
- file_menu->get_popup()->add_item(TTR("Close"),FILE_CLOSE,KEY_MASK_CMD|KEY_W);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTR("Close"), KEY_MASK_CMD|KEY_W), FILE_CLOSE);
file_menu->get_popup()->connect("item_pressed", this,"_menu_option");
edit_menu = memnew( MenuButton );
menu_hb->add_child(edit_menu);
edit_menu->set_text(TTR("Edit"));
- edit_menu->get_popup()->add_item(TTR("Undo"),EDIT_UNDO,KEY_MASK_CMD|KEY_Z);
- edit_menu->get_popup()->add_item(TTR("Redo"),EDIT_REDO,KEY_MASK_CMD|KEY_Y);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/undo", TTR("Undo"), KEY_MASK_CMD|KEY_Z), EDIT_UNDO);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/redo", TTR("Redo"), KEY_MASK_CMD|KEY_Y), EDIT_REDO);
edit_menu->get_popup()->add_separator();
- edit_menu->get_popup()->add_item(TTR("Cut"),EDIT_CUT,KEY_MASK_CMD|KEY_X);
- edit_menu->get_popup()->add_item(TTR("Copy"),EDIT_COPY,KEY_MASK_CMD|KEY_C);
- edit_menu->get_popup()->add_item(TTR("Paste"),EDIT_PASTE,KEY_MASK_CMD|KEY_V);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/cut", TTR("Cut"), KEY_MASK_CMD|KEY_X), EDIT_CUT);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/copy", TTR("Copy"), KEY_MASK_CMD|KEY_C), EDIT_COPY);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/paste", TTR("Paste"), KEY_MASK_CMD|KEY_V), EDIT_PASTE);
edit_menu->get_popup()->add_separator();
- edit_menu->get_popup()->add_item(TTR("Select All"),EDIT_SELECT_ALL,KEY_MASK_CMD|KEY_A);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/select_all", TTR("Select All"), KEY_MASK_CMD|KEY_A), EDIT_SELECT_ALL);
edit_menu->get_popup()->add_separator();
- edit_menu->get_popup()->add_item(TTR("Move Up"),EDIT_MOVE_LINE_UP,KEY_MASK_ALT|KEY_UP);
- edit_menu->get_popup()->add_item(TTR("Move Down"),EDIT_MOVE_LINE_DOWN,KEY_MASK_ALT|KEY_DOWN);
- edit_menu->get_popup()->add_item(TTR("Indent Left"),EDIT_INDENT_LEFT,KEY_MASK_ALT|KEY_LEFT);
- edit_menu->get_popup()->add_item(TTR("Indent Right"),EDIT_INDENT_RIGHT,KEY_MASK_ALT|KEY_RIGHT);
- edit_menu->get_popup()->add_item(TTR("Toggle Comment"),EDIT_TOGGLE_COMMENT,KEY_MASK_CMD|KEY_K);
- edit_menu->get_popup()->add_item(TTR("Clone Down"),EDIT_CLONE_DOWN,KEY_MASK_CMD|KEY_B);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/move_up", TTR("Move Up"), KEY_MASK_ALT|KEY_UP), EDIT_MOVE_LINE_UP);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/move_down", TTR("Move Down"), KEY_MASK_ALT|KEY_DOWN), EDIT_MOVE_LINE_DOWN);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/indent_left", TTR("Indent Left"), KEY_MASK_ALT|KEY_LEFT), EDIT_INDENT_LEFT);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/indent_right", TTR("Indent Right"), KEY_MASK_ALT|KEY_RIGHT), EDIT_INDENT_RIGHT);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_comment", TTR("Toggle Comment"), KEY_MASK_CMD|KEY_K), EDIT_TOGGLE_COMMENT);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD|KEY_B), EDIT_CLONE_DOWN);
edit_menu->get_popup()->add_separator();
#ifdef OSX_ENABLED
- edit_menu->get_popup()->add_item(TTR("Complete Symbol"),EDIT_COMPLETE,KEY_MASK_CTRL|KEY_SPACE);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CTRL|KEY_SPACE), EDIT_COMPLETE);
#else
- edit_menu->get_popup()->add_item(TTR("Complete Symbol"),EDIT_COMPLETE,KEY_MASK_CMD|KEY_SPACE);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CMD|KEY_SPACE), EDIT_COMPLETE);
#endif
- edit_menu->get_popup()->add_item(TTR("Trim Trailing Whitespace"), EDIT_TRIM_TRAILING_WHITESAPCE, KEY_MASK_CTRL|KEY_MASK_ALT|KEY_T);
- edit_menu->get_popup()->add_item(TTR("Auto Indent"),EDIT_AUTO_INDENT,KEY_MASK_CMD|KEY_I);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_T), EDIT_TRIM_TRAILING_WHITESAPCE);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/auto_indent", TTR("Auto Indent"), KEY_MASK_CMD|KEY_I), EDIT_AUTO_INDENT);
edit_menu->get_popup()->connect("item_pressed", this,"_menu_option");
edit_menu->get_popup()->add_separator();
- edit_menu->get_popup()->add_item(TTR("Soft Reload Script"),FILE_TOOL_RELOAD_SOFT,KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_R);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_script_soft", TTR("Soft Reload Script"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_R), FILE_TOOL_RELOAD_SOFT);
search_menu = memnew( MenuButton );
menu_hb->add_child(search_menu);
search_menu->set_text(TTR("Search"));
- search_menu->get_popup()->add_item(TTR("Find.."),SEARCH_FIND,KEY_MASK_CMD|KEY_F);
- search_menu->get_popup()->add_item(TTR("Find Next"),SEARCH_FIND_NEXT,KEY_F3);
- search_menu->get_popup()->add_item(TTR("Find Previous"),SEARCH_FIND_PREV,KEY_MASK_SHIFT|KEY_F3);
- search_menu->get_popup()->add_item(TTR("Replace.."),SEARCH_REPLACE,KEY_MASK_CMD|KEY_R);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find.."), KEY_MASK_CMD|KEY_F), SEARCH_FIND);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), SEARCH_FIND_NEXT);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_previous", TTR("Find Previous"), KEY_MASK_SHIFT|KEY_F3), SEARCH_FIND_PREV);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/replace", TTR("Replace.."), KEY_MASK_CMD|KEY_R), SEARCH_REPLACE);
search_menu->get_popup()->add_separator();
- search_menu->get_popup()->add_item(TTR("Goto Function.."),SEARCH_LOCATE_FUNCTION,KEY_MASK_SHIFT|KEY_MASK_CMD|KEY_F);
- search_menu->get_popup()->add_item(TTR("Goto Line.."),SEARCH_GOTO_LINE,KEY_MASK_CMD|KEY_L);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/goto_function", TTR("Goto Function.."), KEY_MASK_SHIFT|KEY_MASK_CMD|KEY_F), SEARCH_LOCATE_FUNCTION);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/goto_line", TTR("Goto Line.."), KEY_MASK_CMD|KEY_L), SEARCH_GOTO_LINE);
search_menu->get_popup()->connect("item_pressed", this,"_menu_option");
script_search_menu = memnew( MenuButton );
menu_hb->add_child(script_search_menu);
script_search_menu->set_text(TTR("Search"));
- script_search_menu->get_popup()->add_item(TTR("Find.."),SEARCH_FIND,KEY_MASK_CMD|KEY_F);
- script_search_menu->get_popup()->add_item(TTR("Find Next"),SEARCH_FIND_NEXT,KEY_F3);
+ script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find.."), KEY_MASK_CMD|KEY_F), SEARCH_FIND);
+ script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), SEARCH_FIND_NEXT);
script_search_menu->get_popup()->connect("item_pressed", this,"_menu_option");
script_search_menu->hide();
@@ -2648,19 +2693,19 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
debug_menu = memnew( MenuButton );
menu_hb->add_child(debug_menu);
debug_menu->set_text(TTR("Debug"));
- debug_menu->get_popup()->add_item(TTR("Toggle Breakpoint"),DEBUG_TOGGLE_BREAKPOINT,KEY_F9);
- debug_menu->get_popup()->add_item(TTR("Remove All Breakpoints"), DEBUG_REMOVE_ALL_BREAKPOINTS, KEY_MASK_CTRL|KEY_MASK_SHIFT|KEY_F9);
- debug_menu->get_popup()->add_item(TTR("Goto Next Breakpoint"), DEBUG_GOTO_NEXT_BREAKPOINT, KEY_MASK_CTRL|KEY_PERIOD);
- debug_menu->get_popup()->add_item(TTR("Goto Previous Breakpoint"), DEBUG_GOTO_PREV_BREAKPOINT, KEY_MASK_CTRL|KEY_COMMA);
+ debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9), DEBUG_TOGGLE_BREAKPOINT);
+ debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/remove_all_breakpoints", TTR("Remove All Breakpoints"), KEY_MASK_CTRL|KEY_MASK_SHIFT|KEY_F9), DEBUG_REMOVE_ALL_BREAKPOINTS);
+ debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/goto_next_breakpoint", TTR("Goto Next Breakpoint"), KEY_MASK_CTRL|KEY_PERIOD), DEBUG_GOTO_NEXT_BREAKPOINT);
+ debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/goto_previous_breakpoint", TTR("Goto Previous Breakpoint"), KEY_MASK_CTRL|KEY_COMMA), DEBUG_GOTO_PREV_BREAKPOINT);
debug_menu->get_popup()->add_separator();
- debug_menu->get_popup()->add_item(TTR("Step Over"),DEBUG_NEXT,KEY_F10);
- debug_menu->get_popup()->add_item(TTR("Step Into"),DEBUG_STEP,KEY_F11);
+ debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("debugger/step_over", TTR("Step Over"), KEY_F10), DEBUG_NEXT);
+ debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("debugger/step_into", TTR("Step Into"), KEY_F11), DEBUG_STEP);
debug_menu->get_popup()->add_separator();
- debug_menu->get_popup()->add_item(TTR("Break"),DEBUG_BREAK);
- debug_menu->get_popup()->add_item(TTR("Continue"),DEBUG_CONTINUE);
+ debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("debugger/break", TTR("Break")), DEBUG_BREAK);
+ debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("debugger/continue", TTR("Continue")), DEBUG_CONTINUE);
debug_menu->get_popup()->add_separator();
//debug_menu->get_popup()->add_check_item("Show Debugger",DEBUG_SHOW);
- debug_menu->get_popup()->add_check_item(TTR("Keep Debugger Open"),DEBUG_SHOW_KEEP_OPEN);
+ debug_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("debugger/keep_debugger_open", TTR("Keep Debugger Open")), DEBUG_SHOW_KEEP_OPEN);
debug_menu->get_popup()->connect("item_pressed", this,"_menu_option");
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_NEXT), true);
@@ -2685,7 +2730,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
help_menu = memnew( MenuButton );
menu_hb->add_child(help_menu);
help_menu->set_text(TTR("Help"));
- help_menu->get_popup()->add_item(TTR("Contextual"), HELP_CONTEXTUAL, KEY_MASK_SHIFT|KEY_F1);
+ help_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/Contextual", TTR("Contextual Help"), KEY_MASK_SHIFT|KEY_F1), HELP_CONTEXTUAL);
help_menu->get_popup()->connect("item_pressed", this,"_menu_option");
menu_hb->add_spacer();
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index 5a9dce759e..3d723adfe9 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -325,6 +325,8 @@ public:
void set_scene_root_script( Ref<Script> p_script );
+ bool script_go_to_method(Ref<Script> p_script, const String& p_method);
+
virtual void edited_scene_changed();
ScriptEditorDebugger *get_debugger() { return debugger; }
diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp
index 61dde9a9ef..f4b294daa5 100644
--- a/tools/editor/plugins/shader_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_editor_plugin.cpp
@@ -496,14 +496,14 @@ ShaderEditor::ShaderEditor() {
add_child(edit_menu);
edit_menu->set_pos(Point2(5,-1));
edit_menu->set_text(TTR("Edit"));
- edit_menu->get_popup()->add_item(TTR("Undo"),EDIT_UNDO,KEY_MASK_CMD|KEY_Z);
- edit_menu->get_popup()->add_item(TTR("Redo"),EDIT_REDO,KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_Z);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/undo", TTR("Undo"), KEY_MASK_CMD|KEY_Z), EDIT_UNDO);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/redo", TTR("Redo"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_Z), EDIT_REDO);
edit_menu->get_popup()->add_separator();
- edit_menu->get_popup()->add_item(TTR("Cut"),EDIT_CUT,KEY_MASK_CMD|KEY_X);
- edit_menu->get_popup()->add_item(TTR("Copy"),EDIT_COPY,KEY_MASK_CMD|KEY_C);
- edit_menu->get_popup()->add_item(TTR("Paste"),EDIT_PASTE,KEY_MASK_CMD|KEY_V);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/cut", TTR("Cut"), KEY_MASK_CMD|KEY_X), EDIT_CUT);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/copy", TTR("Copy"), KEY_MASK_CMD|KEY_C), EDIT_COPY);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/paste", TTR("Paste"), KEY_MASK_CMD|KEY_V), EDIT_PASTE);
edit_menu->get_popup()->add_separator();
- edit_menu->get_popup()->add_item(TTR("Select All"),EDIT_SELECT_ALL,KEY_MASK_CMD|KEY_A);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/select_all", TTR("Select All"), KEY_MASK_CMD|KEY_A), EDIT_SELECT_ALL);
edit_menu->get_popup()->connect("item_pressed", this,"_menu_option");
@@ -511,13 +511,13 @@ ShaderEditor::ShaderEditor() {
add_child(search_menu);
search_menu->set_pos(Point2(38,-1));
search_menu->set_text(TTR("Search"));
- search_menu->get_popup()->add_item(TTR("Find.."),SEARCH_FIND,KEY_MASK_CMD|KEY_F);
- search_menu->get_popup()->add_item(TTR("Find Next"),SEARCH_FIND_NEXT,KEY_F3);
- search_menu->get_popup()->add_item(TTR("Find Previous"),SEARCH_FIND_PREV,KEY_MASK_SHIFT|KEY_F3);
- search_menu->get_popup()->add_item(TTR("Replace.."),SEARCH_REPLACE,KEY_MASK_CMD|KEY_R);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find.."), KEY_MASK_CMD|KEY_F), SEARCH_FIND);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), SEARCH_FIND_NEXT);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_previous", TTR("Find Previous"), KEY_MASK_SHIFT|KEY_F3), SEARCH_FIND_PREV);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/replace", TTR("Replace.."), KEY_MASK_CMD|KEY_R), SEARCH_REPLACE);
search_menu->get_popup()->add_separator();
// search_menu->get_popup()->add_item("Locate Symbol..",SEARCH_LOCATE_SYMBOL,KEY_MASK_CMD|KEY_K);
- search_menu->get_popup()->add_item(TTR("Goto Line.."),SEARCH_GOTO_LINE,KEY_MASK_CMD|KEY_G);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/goto_line", TTR("Goto Line.."), KEY_MASK_CMD|KEY_G), SEARCH_GOTO_LINE);
search_menu->get_popup()->connect("item_pressed", this,"_menu_option");
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index e261b48f67..fdb654571a 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -996,26 +996,26 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
case TRANSFORM_VIEW: {
_edit.plane=TRANSFORM_X_AXIS;
- set_message(TTR("View Plane Transform."),2);
+ set_message(TTR("X-Axis Transform."),2);
name="";
_update_name();
} break;
case TRANSFORM_X_AXIS: {
_edit.plane=TRANSFORM_Y_AXIS;
- set_message(TTR("X-Axis Transform."),2);
+ set_message(TTR("Y-Axis Transform."),2);
} break;
case TRANSFORM_Y_AXIS: {
_edit.plane=TRANSFORM_Z_AXIS;
- set_message(TTR("Y-Axis Transform."),2);
+ set_message(TTR("Z-Axis Transform."),2);
} break;
case TRANSFORM_Z_AXIS: {
_edit.plane=TRANSFORM_VIEW;
- set_message(TTR("Z-Axis Transform."),2);
+ set_message(TTR("View Plane Transform."),2);
} break;
}
diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp
index b69b0d7a9b..57db19b736 100644
--- a/tools/editor/plugins/texture_region_editor_plugin.cpp
+++ b/tools/editor/plugins/texture_region_editor_plugin.cpp
@@ -43,6 +43,8 @@ void TextureRegionEditor::_region_draw()
base_tex = node_patch9->get_texture();
else if(node_type == "StyleBoxTexture" && obj_styleBox)
base_tex = obj_styleBox->get_texture();
+ else if(node_type == "AtlasTexture" && atlas_tex)
+ base_tex = atlas_tex->get_atlas();
if (base_tex.is_null())
return;
@@ -164,6 +166,8 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input)
drag=true;
if(node_type == "Sprite" && node_sprite )
rect_prev=node_sprite->get_region_rect();
+ else if(node_type == "AtlasTexture" && atlas_tex)
+ rect_prev=atlas_tex->get_region();
else if(node_type == "Patch9Frame" && node_patch9)
rect_prev=node_patch9->get_region_rect();
else if(node_type == "StyleBoxTexture" && obj_styleBox)
@@ -191,10 +195,18 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input)
undo_redo->add_do_method(node_sprite ,"set_region_rect",node_sprite->get_region_rect());
undo_redo->add_undo_method(node_sprite,"set_region_rect",rect_prev);
}
+ else if(node_type == "AtlasTexture" && atlas_tex ){
+ undo_redo->add_do_method(atlas_tex ,"set_region",atlas_tex->get_region());
+ undo_redo->add_undo_method(atlas_tex,"set_region",rect_prev);
+ }
else if(node_type == "Patch9Frame" && node_patch9){
undo_redo->add_do_method(node_patch9 ,"set_region_rect",node_patch9->get_region_rect());
undo_redo->add_undo_method(node_patch9,"set_region_rect",rect_prev);
}
+ else if(node_type == "StyleBoxTexture" && obj_styleBox){
+ undo_redo->add_do_method(obj_styleBox ,"set_region_rect",obj_styleBox->get_region_rect());
+ undo_redo->add_undo_method(obj_styleBox,"set_region_rect",rect_prev);
+ }
undo_redo->add_do_method(edit_draw,"update");
undo_redo->add_undo_method(edit_draw,"update");
undo_redo->commit_action();
@@ -355,6 +367,8 @@ void TextureRegionEditor::apply_rect(const Rect2& rect){
node_patch9->set_region_rect(rect);
else if(obj_styleBox)
obj_styleBox->set_region_rect(rect);
+ else if(atlas_tex)
+ atlas_tex->set_region(rect);
}
else if(this->editing_region == REGION_PATCH_MARGIN) {
if(node_patch9) {
@@ -387,10 +401,11 @@ void TextureRegionEditor::_notification(int p_what)
void TextureRegionEditor::_node_removed(Object *p_obj)
{
- if(p_obj == node_sprite || p_obj == node_patch9 || p_obj == obj_styleBox) {
- node_patch9 = NULL;
- node_sprite = NULL;
+ if(p_obj == node_sprite || p_obj == node_patch9 || p_obj == obj_styleBox || p_obj == atlas_tex) {
+ node_patch9 = NULL;
+ node_sprite = NULL;
obj_styleBox = NULL;
+ atlas_tex = NULL;
hide();
}
}
@@ -421,30 +436,42 @@ void TextureRegionEditor::edit(Object *p_obj)
node_sprite = p_obj->cast_to<Sprite>();
node_patch9 = NULL;
obj_styleBox = NULL;
+ atlas_tex = NULL;
+ }
+ else if(node_type == "AtlasTexture") {
+ atlas_tex = p_obj->cast_to<AtlasTexture>();
+ node_sprite = NULL;
+ node_patch9 = NULL;
+ obj_styleBox = NULL;
}
else if(node_type == "Patch9Frame") {
node_patch9 = p_obj->cast_to<Patch9Frame>();
node_sprite = NULL;
obj_styleBox = NULL;
+ atlas_tex = NULL;
margin_button->show();
}
else if(node_type == "StyleBoxTexture") {
obj_styleBox = p_obj->cast_to<StyleBoxTexture>();
node_sprite = NULL;
node_patch9 = NULL;
+ atlas_tex = NULL;
margin_button->show();
}
p_obj->connect("exit_tree",this,"_node_removed",varray(p_obj),CONNECT_ONESHOT);
} else {
if(node_sprite)
node_sprite->disconnect("exit_tree",this,"_node_removed");
+ else if(atlas_tex)
+ atlas_tex->disconnect("exit_tree",this,"_node_removed");
else if(node_patch9)
node_patch9->disconnect("exit_tree",this,"_node_removed");
else if(obj_styleBox)
obj_styleBox->disconnect("exit_tree",this,"_node_removed");
- node_sprite = NULL;
- node_patch9 = NULL;
+ node_sprite = NULL;
+ node_patch9 = NULL;
obj_styleBox = NULL;
+ atlas_tex = NULL;
}
}
@@ -469,6 +496,8 @@ void TextureRegionEditor::_edit_node(int region)
texture = node_patch9->get_texture();
else if(node_type == "StyleBoxTexture" && obj_styleBox)
texture = obj_styleBox->get_texture();
+ else if(node_type == "AtlasTexture" && atlas_tex)
+ texture = atlas_tex->get_atlas();
if (texture.is_null()) {
error->set_text(TTR("No texture in this node.\nSet a texture to be able to edit region."));
@@ -482,6 +511,8 @@ void TextureRegionEditor::_edit_node(int region)
tex_region = node_patch9->get_region_rect();
else if(node_type == "StyleBoxTexture" && obj_styleBox)
tex_region = obj_styleBox->get_region_rect();
+ else if(node_type == "AtlasTexture" && atlas_tex)
+ tex_region = atlas_tex->get_region();
rect = tex_region;
if(region == REGION_PATCH_MARGIN) {
@@ -521,6 +552,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor)
{
node_sprite = NULL;
node_patch9 = NULL;
+ atlas_tex = NULL;
editor=p_editor;
undo_redo = editor->get_undo_redo();
@@ -661,7 +693,7 @@ void TextureRegionEditorPlugin::edit(Object *p_node)
bool TextureRegionEditorPlugin::handles(Object *p_obj) const
{
- return p_obj->is_type("Sprite") || p_obj->is_type("Patch9Frame") || p_obj->is_type("StyleBoxTexture");
+ return p_obj->is_type("Sprite") || p_obj->is_type("Patch9Frame") || p_obj->is_type("StyleBoxTexture") || p_obj->is_type("AtlasTexture");
}
void TextureRegionEditorPlugin::make_visible(bool p_visible)
diff --git a/tools/editor/plugins/texture_region_editor_plugin.h b/tools/editor/plugins/texture_region_editor_plugin.h
index 951b11e1e6..1e4888b06d 100644
--- a/tools/editor/plugins/texture_region_editor_plugin.h
+++ b/tools/editor/plugins/texture_region_editor_plugin.h
@@ -38,6 +38,7 @@
#include "scene/2d/sprite.h"
#include "scene/gui/patch_9_frame.h"
#include "scene/resources/style_box.h"
+#include "scene/resources/texture.h"
class TextureRegionEditor : public HBoxContainer {
@@ -82,6 +83,7 @@ class TextureRegionEditor : public HBoxContainer {
Patch9Frame *node_patch9;
Sprite *node_sprite;
StyleBoxTexture *obj_styleBox;
+ AtlasTexture *atlas_tex;
int editing_region;
Rect2 rect;
diff --git a/tools/translations/ru.po b/tools/translations/ru.po
index aa98be2767..138aa2c858 100644
--- a/tools/translations/ru.po
+++ b/tools/translations/ru.po
@@ -26,7 +26,7 @@ msgid ""
"order for AnimatedSprite to display frames."
msgstr ""
"Чтобы AnimatedSprite отображал кадры, пожалуйста установите или создайте "
-"ресурс SpriteFrames в параметре 'Frames'"
+"ресурс SpriteFrames в параметре 'Frames'."
#: scene/2d/canvas_modulate.cpp
msgid ""
@@ -218,13 +218,12 @@ msgstr ""
"ресурс SampleLibrary в параметре 'samples'."
#: scene/3d/sprite_3d.cpp
-#, fuzzy
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
"order for AnimatedSprite3D to display frames."
msgstr ""
-"Чтобы AnimatedSprite отображал кадры, пожалуйста установите или создайте "
-"ресурс SpriteFrames в параметре 'Frames'"
+"Чтобы AnimatedSprite3D отображал кадры, пожалуйста установите или создайте "
+"ресурс SpriteFrames в параметре 'Frames'."
#: scene/gui/dialogs.cpp tools/editor/io_plugins/editor_scene_import_plugin.cpp
msgid "Cancel"
@@ -262,24 +261,20 @@ msgid "Open"
msgstr "Открыть"
#: scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Open a File"
-msgstr "Открыть сэмпл(ы)"
+msgstr "Открыть файл"
#: scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Open File(s)"
-msgstr "Открыть сэмпл(ы)"
+msgstr "Открыть файл(ы)"
#: scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Open a Directory"
-msgstr "Выбрать каталог"
+msgstr "Открыть каталог"
#: scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Open a File or Directory"
-msgstr "Выбрать каталог"
+msgstr "Открыть каталог или файл"
#: scene/gui/file_dialog.cpp tools/editor/editor_file_dialog.cpp
#: tools/editor/editor_node.cpp
@@ -343,7 +338,7 @@ msgstr "Alt+"
#: scene/gui/input_action.cpp
msgid "Ctrl+"
-msgstr ""
+msgstr "Ctrl+"
#: scene/gui/input_action.cpp tools/editor/project_settings.cpp
#: tools/editor/settings_config_dialog.cpp
@@ -715,7 +710,7 @@ msgstr "Включить индивидуальное редактировани
#: tools/editor/animation_editor.cpp
msgid "Anim. Optimizer"
-msgstr "Оптимизатор анимации."
+msgstr "Оптимизатор анимации"
#: tools/editor/animation_editor.cpp
msgid "Max. Linear Error:"
@@ -810,22 +805,20 @@ msgid "Site:"
msgstr "Сайт:"
#: tools/editor/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Support.."
-msgstr "Экспортировать.."
+msgstr "Поддержка.."
#: tools/editor/asset_library_editor_plugin.cpp
msgid "Official"
-msgstr ""
+msgstr "Официально"
#: tools/editor/asset_library_editor_plugin.cpp
msgid "Community"
-msgstr ""
+msgstr "Сообщество"
#: tools/editor/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Testing"
-msgstr "Настройки"
+msgstr "Тестируемые"
#: tools/editor/asset_library_editor_plugin.cpp
msgid "Assets ZIP File"
@@ -1018,9 +1011,8 @@ msgid "Disconnect"
msgstr "Отсоединить"
#: tools/editor/connections_dialog.cpp tools/editor/node_dock.cpp
-#, fuzzy
msgid "Signals"
-msgstr "Сигналы:"
+msgstr "Сигналы"
#: tools/editor/create_dialog.cpp
msgid "Create New"
@@ -1245,7 +1237,7 @@ msgstr "Описание методов:"
#: tools/editor/editor_help.cpp
msgid "Search Text"
-msgstr "Искать текст:"
+msgstr "Искать текст"
#: tools/editor/editor_import_export.cpp
msgid "Added:"
@@ -1280,9 +1272,8 @@ msgid "Setting Up.."
msgstr "Настройка.."
#: tools/editor/editor_log.cpp
-#, fuzzy
msgid " Output:"
-msgstr "Вывод"
+msgstr " Вывод:"
#: tools/editor/editor_node.cpp tools/editor/editor_reimport_dialog.cpp
msgid "Re-Importing"
@@ -1396,9 +1387,8 @@ msgid "Copy Params"
msgstr "Копировать параметры"
#: tools/editor/editor_node.cpp
-#, fuzzy
msgid "Paste Params"
-msgstr "Вставить кадр"
+msgstr "Вставить параметры"
#: tools/editor/editor_node.cpp
#: tools/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -1418,9 +1408,8 @@ msgid "Make Sub-Resources Unique"
msgstr "Сделать вложенные ресурсы уникальными"
#: tools/editor/editor_node.cpp
-#, fuzzy
msgid "Open in Help"
-msgstr "Открыть сцену"
+msgstr "Открыть в справке"
#: tools/editor/editor_node.cpp
msgid "There is no defined scene to run."
@@ -1431,6 +1420,9 @@ msgid ""
"No main scene has ever been defined.\n"
"Select one from \"Project Settings\" under the 'application' category."
msgstr ""
+"Не назначена главная сцена.\n"
+"Укажите её в параметре \"main_scene\" расположенном\n"
+"в \"Настройки проекта - Основное - application\"."
#: tools/editor/editor_node.cpp
msgid "Current scene was never saved, please save it prior to running."
@@ -1550,9 +1542,8 @@ msgid "Save Layout"
msgstr "Сохранить макет"
#: tools/editor/editor_node.cpp
-#, fuzzy
msgid "Load Layout"
-msgstr "Сохранить макет"
+msgstr "Загрузить макет"
#: tools/editor/editor_node.cpp tools/editor/project_export.cpp
msgid "Default"
@@ -1616,9 +1607,8 @@ msgid "Open Recent"
msgstr "Открыть последнее"
#: tools/editor/editor_node.cpp
-#, fuzzy
msgid "Quick Filter Files.."
-msgstr "Быстрый поиск файлов.."
+msgstr "Быстро отсортировать файлы.."
#: tools/editor/editor_node.cpp
msgid "Convert To.."
@@ -1690,9 +1680,8 @@ msgid "Export"
msgstr "Экспорт"
#: tools/editor/editor_node.cpp
-#, fuzzy
msgid "Play the project."
-msgstr "Запустить проект (F5)."
+msgstr "Запустить проект."
#: tools/editor/editor_node.cpp
#: tools/editor/plugins/sample_library_editor_plugin.cpp
@@ -1704,14 +1693,12 @@ msgid "Pause the scene"
msgstr "Приостановить сцену"
#: tools/editor/editor_node.cpp
-#, fuzzy
msgid "Pause Scene"
msgstr "Приостановить сцену"
#: tools/editor/editor_node.cpp
-#, fuzzy
msgid "Stop the scene."
-msgstr "Остановить проект (F8)."
+msgstr "Остановить сцену."
#: tools/editor/editor_node.cpp
#: tools/editor/plugins/sample_library_editor_plugin.cpp
@@ -1719,14 +1706,12 @@ msgid "Stop"
msgstr "Остановить"
#: tools/editor/editor_node.cpp
-#, fuzzy
msgid "Play the edited scene."
-msgstr "Запустить текущую сцену (F6)."
+msgstr "Запустить текущую сцену."
#: tools/editor/editor_node.cpp
-#, fuzzy
msgid "Play Scene"
-msgstr "Сохранить сцену"
+msgstr "Запустить сцену"
#: tools/editor/editor_node.cpp
msgid "Play custom scene"
@@ -1737,19 +1722,20 @@ msgid "Debug options"
msgstr "Параметры отладки"
#: tools/editor/editor_node.cpp
-#, fuzzy
msgid "Deploy with Remote Debug"
-msgstr "Развернуть удалённую отладку"
+msgstr "Развернуть с удалённой отладкой"
#: tools/editor/editor_node.cpp
msgid ""
"When exporting or deploying, the resulting executable will attempt to connect "
"to the IP of this computer in order to be debugged."
msgstr ""
+"При экспорте или развёртывании, полученный исполняемый файл будет пытаться "
+"подключиться к IP этого компьютера с целью отладки."
#: tools/editor/editor_node.cpp
msgid "Small Deploy with Network FS"
-msgstr ""
+msgstr "Небольшое развёртывание через сеть"
#: tools/editor/editor_node.cpp
msgid ""
@@ -1760,6 +1746,11 @@ msgid ""
"On Android, deploy will use the USB cable for faster performance. This option "
"speeds up testing for games with a large footprint."
msgstr ""
+"Когда эта опция включена, экспорт или развёртывание будет создавать "
+"минимальный исполняемый файл.\n"
+"Файловая система проекта будет предоставляться редактором через сеть.\n"
+"На Android развёртывание будет быстрее при подключении через USB.\n"
+"Эта опция ускоряет тестирование больших проектов."
#: tools/editor/editor_node.cpp
msgid "Visible Collision Shapes"
@@ -1770,6 +1761,8 @@ msgid ""
"Collision shapes and raycast nodes (for 2D and 3D) will be visible on the "
"running game if this option is turned on."
msgstr ""
+"Когда эта опция включена, области соприкосновений и ноды Raycast(в 2D и 3D) "
+"будут видимыми в запущенной игре."
#: tools/editor/editor_node.cpp
msgid "Visible Navigation"
@@ -1780,10 +1773,12 @@ msgid ""
"Navigation meshes and polygons will be visible on the running game if this "
"option is turned on."
msgstr ""
+"Когда эта опция включена, навигационные полисетки и полигоны будут видимыми "
+"в запущенной игре."
#: tools/editor/editor_node.cpp
msgid "Sync Scene Changes"
-msgstr ""
+msgstr "Синхронизация изменений на сцене"
#: tools/editor/editor_node.cpp
msgid ""
@@ -1792,11 +1787,14 @@ msgid ""
"When used remotely on a device, this is more efficient with network "
"filesystem."
msgstr ""
+"Когда эта опция включена, все изменения, внесённые на сцену, в редакторе "
+"будут перенесены в запущенную игру.\n"
+"При удалённом использовании на устройстве, это работает более эффективно с "
+"сетевой файловой системой."
#: tools/editor/editor_node.cpp
-#, fuzzy
msgid "Sync Script Changes"
-msgstr "Обновлять при изменениях"
+msgstr "Синхронизация изменений в скриптах"
#: tools/editor/editor_node.cpp
msgid ""
@@ -1805,6 +1803,10 @@ msgid ""
"When used remotely on a device, this is more efficient with network "
"filesystem."
msgstr ""
+"Когда эта опция включена, любой сохранённый скрипт будет перезагружен в "
+"запущенную игру.\n"
+"При удалённом использовании на устройстве, это работает более эффективно с "
+"сетевой файловой системой."
#: tools/editor/editor_node.cpp tools/editor/plugins/spatial_editor_plugin.cpp
msgid "Settings"
@@ -2068,9 +2070,8 @@ msgid "Imported Resources"
msgstr "Импортированные ресурсы"
#: tools/editor/io_plugins/editor_bitmask_import_plugin.cpp
-#, fuzzy
msgid "No bit masks to import!"
-msgstr "Нет элементов для импорта!"
+msgstr "Нет битовой маски для импорта!"
#: tools/editor/io_plugins/editor_bitmask_import_plugin.cpp
#: tools/editor/io_plugins/editor_sample_import_plugin.cpp
@@ -2100,9 +2101,8 @@ msgid "Save path is empty!"
msgstr "Путь сохранения пуст!"
#: tools/editor/io_plugins/editor_bitmask_import_plugin.cpp
-#, fuzzy
msgid "Import BitMasks"
-msgstr "Импорт текстур"
+msgstr "Импорт битовой маски"
#: tools/editor/io_plugins/editor_bitmask_import_plugin.cpp
#: tools/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -2129,7 +2129,7 @@ msgstr "Принять"
#: tools/editor/io_plugins/editor_bitmask_import_plugin.cpp
msgid "Bit Mask"
-msgstr ""
+msgstr "Битовая маска"
#: tools/editor/io_plugins/editor_font_import_plugin.cpp
msgid "No source font file!"
@@ -2164,7 +2164,7 @@ msgid "The quick brown fox jumps over the lazy dog."
msgstr ""
"Съешь ещё этих мягких французских булок да выпей чаю. \n"
"The quick brown fox jumps over the lazy dog.\n"
-"0123456789`!@#$%^&*()_+-=\\/"
+"0123456789`!@#$%^&*()_+-=\\/."
#: tools/editor/io_plugins/editor_font_import_plugin.cpp
msgid "Test:"
@@ -2646,18 +2646,18 @@ msgid "MultiNode Set"
msgstr "Мульти нодовый набор"
#: tools/editor/node_dock.cpp
-#, fuzzy
msgid "Node"
-msgstr "Mix Node"
+msgstr "Нод"
#: tools/editor/node_dock.cpp
-#, fuzzy
msgid "Groups"
-msgstr "Группы:"
+msgstr "Группы"
#: tools/editor/node_dock.cpp
msgid "Select a Node to edit Signals and Groups."
msgstr ""
+"Выберите нод для редактирования\n"
+"сигналов и групп."
#: tools/editor/plugins/animation_player_editor_plugin.cpp
msgid "Toggle Autoplay"
@@ -2774,7 +2774,7 @@ msgstr "Загрузить анимацию с диска."
#: tools/editor/plugins/animation_player_editor_plugin.cpp
msgid "Save the current animation"
-msgstr "Сохранить текущую анимацию."
+msgstr "Сохранить текущую анимацию"
#: tools/editor/plugins/animation_player_editor_plugin.cpp
msgid "Display list of animations in player."
@@ -2925,39 +2925,39 @@ msgstr "Дерево анимации не действительно."
#: tools/editor/plugins/animation_tree_editor_plugin.cpp
msgid "Animation Node"
-msgstr "Animation Node"
+msgstr "Animation нод"
#: tools/editor/plugins/animation_tree_editor_plugin.cpp
msgid "OneShot Node"
-msgstr "OneShot Node"
+msgstr "OneShot нод"
#: tools/editor/plugins/animation_tree_editor_plugin.cpp
msgid "Mix Node"
-msgstr "Mix Node"
+msgstr "Mix нод"
#: tools/editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend2 Node"
-msgstr "Blend2 Node"
+msgstr "Blend2 нод"
#: tools/editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend3 Node"
-msgstr "Blend3 Node"
+msgstr "Blend3 нод"
#: tools/editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend4 Node"
-msgstr "Blend4 Node"
+msgstr "Blend4 нод"
#: tools/editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeScale Node"
-msgstr "TimeScale Node"
+msgstr "TimeScale нод"
#: tools/editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeSeek Node"
-msgstr "TimeSeek Node"
+msgstr "TimeSeek нод"
#: tools/editor/plugins/animation_tree_editor_plugin.cpp
msgid "Transition Node"
-msgstr "Transition Node"
+msgstr "Transition нод"
#: tools/editor/plugins/animation_tree_editor_plugin.cpp
msgid "Import Animations.."
@@ -3971,14 +3971,12 @@ msgid "Auto Indent"
msgstr "Автоотступ"
#: tools/editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Reload Tool Script"
-msgstr "Перезагрузить скрипты"
+msgstr "Перезагрузить инструм. скрипт"
#: tools/editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Reload Tool Script (Soft)"
-msgstr "Перезагрузить скрипты"
+msgstr "Перезагрузить инструм. скрипт (мягко)"
#: tools/editor/plugins/script_editor_plugin.cpp
#: tools/editor/plugins/shader_editor_plugin.cpp
@@ -4635,20 +4633,20 @@ msgid "StyleBox Preview:"
msgstr "StyleBox предпросмотр:"
#: tools/editor/plugins/texture_region_editor_plugin.cpp
-#, fuzzy
msgid "Texture Region Editor"
-msgstr "Редактор Области Спрайта"
+msgstr "Редактор области текстуры"
#: tools/editor/plugins/texture_region_editor_plugin.cpp
-#, fuzzy
msgid "Scale Region Editor"
-msgstr "Редактор Области Спрайта"
+msgstr "Редактор масштабируемой области текстуры"
#: tools/editor/plugins/texture_region_editor_plugin.cpp
msgid ""
"No texture in this node.\n"
"Set a texture to be able to edit region."
msgstr ""
+"В этом ноде нет текстуры.\n"
+"Выберите текстуру, чтобы редактировать область."
#: tools/editor/plugins/theme_editor_plugin.cpp
msgid "Can't save theme to file:"
@@ -5171,14 +5169,12 @@ msgid "Remove project from the list? (Folder contents will not be modified)"
msgstr "Удалить проект из списка? (Содержимое папки не будет изменено)"
#: tools/editor/project_manager.cpp
-#, fuzzy
msgid "Project Manager"
-msgstr "Название проекта:"
+msgstr "Менеджер проектов"
#: tools/editor/project_manager.cpp
-#, fuzzy
msgid "Project List"
-msgstr "Выйти в список проектов"
+msgstr "Список проектов"
#: tools/editor/project_manager.cpp
msgid "Run"
@@ -5198,7 +5194,7 @@ msgstr "Выход"
#: tools/editor/project_settings.cpp
msgid "Key "
-msgstr "Кнопка"
+msgstr "Кнопка "
#: tools/editor/project_settings.cpp
msgid "Joy Button"
@@ -5334,14 +5330,12 @@ msgstr ""
"константы."
#: tools/editor/project_settings.cpp
-#, fuzzy
msgid "Autoload '%s' already exists!"
-msgstr "Действие '%s' уже существует!"
+msgstr "Автозагрузка '%s' уже существует!"
#: tools/editor/project_settings.cpp
-#, fuzzy
msgid "Rename Autoload"
-msgstr "Удалена автозагрузка"
+msgstr "Переименовать автозагрузку"
#: tools/editor/project_settings.cpp
msgid "Toggle AutoLoad Globals"
@@ -5691,9 +5685,7 @@ msgstr "Не могу работать с нодами из внешней сц
#: tools/editor/scene_tree_dock.cpp
msgid "Can't operate on nodes the current scene inherits from!"
-msgstr ""
-"Не могу работать с нодами текущей сцены, наследуемой откуда-то!\n"
-"Очистите наследование, чтобы продолжить работу с ними."
+msgstr "Невозможно работать с нодами текущей сцены, наследуемой откуда-то!"
#: tools/editor/scene_tree_dock.cpp
msgid "Remove Node(s)"
@@ -5861,7 +5853,7 @@ msgstr "Файлы не выбраны!"
#: tools/editor/scenes_dock.cpp
msgid "Instance"
-msgstr "Экземпляр"
+msgstr "Добавить экземпляр"
#: tools/editor/scenes_dock.cpp
msgid "Edit Dependencies.."
@@ -5872,9 +5864,8 @@ msgid "View Owners.."
msgstr "Просмотреть владельцев.."
#: tools/editor/scenes_dock.cpp
-#, fuzzy
msgid "Copy Path"
-msgstr "Копировать параметры"
+msgstr "Копировать путь"
#: tools/editor/scenes_dock.cpp
msgid "Rename or Move.."
@@ -6050,7 +6041,7 @@ msgstr "Дерево сцены в реальном времени:"
#: tools/editor/script_editor_debugger.cpp
msgid "Remote Object Properties: "
-msgstr "Параметры объекта:"
+msgstr "Параметры объекта: "
#: tools/editor/script_editor_debugger.cpp
msgid "Profiler"
@@ -6114,7 +6105,7 @@ msgstr "Установить из дерева нодов"
#: tools/editor/settings_config_dialog.cpp
msgid "Shortcuts"
-msgstr ""
+msgstr "Горячие клавиши"
#: tools/editor/spatial_editor_gizmos.cpp
msgid "Change Light Radius"