summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/os/thread.h7
-rw-r--r--core/reference.h4
-rw-r--r--core/script_language.cpp16
-rw-r--r--core/script_language.h10
-rw-r--r--core/ustring.cpp17
-rw-r--r--core/ustring.h1
-rw-r--r--core/variant_call.cpp2
-rw-r--r--doc/base/classes.xml106
-rw-r--r--drivers/unix/thread_posix.cpp7
-rw-r--r--drivers/windows/thread_windows.cpp9
-rw-r--r--drivers/windows/thread_windows.h1
-rw-r--r--modules/gdscript/gd_script.cpp1
-rw-r--r--platform/android/build.gradle.template14
-rw-r--r--platform/android/java/src/com/android/vending/billing/IInAppBillingService.aidl144
-rw-r--r--platform/android/thread_jandroid.cpp3
-rw-r--r--platform/winrt/thread_winrt.cpp2
-rw-r--r--platform/x11/os_x11.cpp2
-rw-r--r--scene/2d/canvas_item.cpp2
-rw-r--r--scene/2d/parallax_layer.cpp18
-rw-r--r--scene/2d/sprite.cpp2
-rw-r--r--scene/gui/line_edit.cpp110
-rw-r--r--scene/gui/line_edit.h18
-rw-r--r--scene/gui/patch_9_frame.cpp5
-rw-r--r--scene/gui/text_edit.cpp12
-rw-r--r--scene/resources/default_theme/arrow_down.pngbin322 -> 184 bytes
-rw-r--r--scene/resources/default_theme/arrow_right.pngbin326 -> 183 bytes
-rw-r--r--scene/resources/default_theme/close.pngbin356 -> 230 bytes
-rw-r--r--scene/resources/default_theme/close_hl.pngbin356 -> 230 bytes
-rw-r--r--scene/resources/default_theme/default_theme.cpp3
-rw-r--r--scene/resources/default_theme/graph_node_close.pngbin349 -> 222 bytes
-rw-r--r--scene/resources/default_theme/icon_add.pngbin295 -> 129 bytes
-rw-r--r--scene/resources/default_theme/icon_close.pngbin356 -> 230 bytes
-rw-r--r--scene/resources/default_theme/icon_color_pick.pngbin472 -> 416 bytes
-rw-r--r--scene/resources/default_theme/icon_folder.pngbin312 -> 170 bytes
-rw-r--r--scene/resources/default_theme/icon_play.pngbin355 -> 237 bytes
-rw-r--r--scene/resources/default_theme/icon_reload.pngbin480 -> 420 bytes
-rw-r--r--scene/resources/default_theme/icon_zoom_less.pngbin285 -> 112 bytes
-rw-r--r--scene/resources/default_theme/icon_zoom_more.pngbin295 -> 129 bytes
-rw-r--r--scene/resources/default_theme/icon_zoom_reset.pngbin326 -> 186 bytes
-rw-r--r--scene/resources/default_theme/option_arrow.pngbin343 -> 227 bytes
-rw-r--r--scene/resources/default_theme/popup_checked.pngbin356 -> 238 bytes
-rw-r--r--scene/resources/default_theme/spinbox_updown.pngbin366 -> 280 bytes
-rw-r--r--scene/resources/default_theme/submenu.pngbin325 -> 175 bytes
-rw-r--r--scene/resources/default_theme/tab_close.pngbin433 -> 325 bytes
-rw-r--r--scene/resources/default_theme/tab_menu.pngbin324 -> 186 bytes
-rw-r--r--scene/resources/default_theme/tab_menu_hl.pngbin324 -> 186 bytes
-rw-r--r--scene/resources/default_theme/updown.pngbin382 -> 241 bytes
-rw-r--r--scene/resources/style_box.cpp5
-rw-r--r--scene/resources/texture.cpp5
-rw-r--r--tools/editor/editor_node.cpp28
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/icons/2x/icon_gizmo_directional_light.pngbin1370 -> 8264 bytes
-rw-r--r--tools/editor/icons/2x/icon_gizmo_light.pngbin1491 -> 6282 bytes
-rw-r--r--tools/editor/icons/2x/icon_gizmo_listener.pngbin1850 -> 7636 bytes
-rw-r--r--tools/editor/icons/2x/icon_gizmo_spatial_sample_player.pngbin526 -> 2831 bytes
-rw-r--r--tools/editor/icons/2x/icon_gizmo_spatial_stream_player.pngbin895 -> 3649 bytes
-rw-r--r--tools/editor/icons/2x/icon_zoom_less.pngbin0 -> 162 bytes
-rw-r--r--tools/editor/icons/2x/icon_zoom_more.pngbin0 -> 290 bytes
-rw-r--r--tools/editor/icons/2x/icon_zoom_reset.pngbin0 -> 689 bytes
-rw-r--r--tools/editor/icons/icon_gizmo_directional_light.pngbin783 -> 3628 bytes
-rw-r--r--tools/editor/icons/icon_gizmo_light.pngbin730 -> 3064 bytes
-rw-r--r--tools/editor/icons/icon_gizmo_listener.pngbin894 -> 3613 bytes
-rw-r--r--tools/editor/icons/icon_gizmo_spatial_sample_player.pngbin311 -> 1297 bytes
-rw-r--r--tools/editor/icons/icon_gizmo_spatial_stream_player.pngbin501 -> 1720 bytes
-rw-r--r--tools/editor/icons/icon_zoom_less.pngbin0 -> 149 bytes
-rw-r--r--tools/editor/icons/icon_zoom_more.pngbin0 -> 232 bytes
-rw-r--r--tools/editor/icons/icon_zoom_reset.pngbin0 -> 430 bytes
-rw-r--r--tools/editor/icons/source/icon_gizmo_directional_light.svg155
-rw-r--r--tools/editor/icons/source/icon_gizmo_light.svg34
-rw-r--r--tools/editor/icons/source/icon_gizmo_listener.svg32
-rw-r--r--tools/editor/icons/source/icon_gizmo_spatial_sample_player.svg58
-rw-r--r--tools/editor/icons/source/icon_gizmo_spatial_stream_player.svg20
-rw-r--r--tools/editor/icons/source/icon_zoom_more.svg104
-rw-r--r--tools/editor/plugins/texture_region_editor_plugin.cpp891
-rw-r--r--tools/editor/plugins/texture_region_editor_plugin.h57
75 files changed, 1178 insertions, 729 deletions
diff --git a/core/os/thread.h b/core/os/thread.h
index 7349b83dbc..5f0ec707f2 100644
--- a/core/os/thread.h
+++ b/core/os/thread.h
@@ -39,6 +39,8 @@
typedef void (*ThreadCreateCallback)(void *p_userdata);
+
+
class Thread {
public:
@@ -65,15 +67,14 @@ protected:
static void (*wait_to_finish_func)(Thread*);
static Error (*set_name_func)(const String&);
- friend class Main;
+ friend class Main;
- static ID _main_thread_id;
+ static ID _main_thread_id;
Thread();
public:
-
virtual ID get_ID() const=0;
static Error set_name(const String &p_name);
diff --git a/core/reference.h b/core/reference.h
index 60a256dc99..89e9627b77 100644
--- a/core/reference.h
+++ b/core/reference.h
@@ -341,7 +341,7 @@ struct PtrToArg< Ref<T> > {
_FORCE_INLINE_ static void encode(Ref<T> p_val,const void* p_ptr) {
- *((T**)p_ptr)=p_val.ptr();
+ *(Ref<Reference>*)p_ptr=p_val;
}
};
@@ -371,7 +371,7 @@ struct PtrToArg< RefPtr > {
_FORCE_INLINE_ static void encode(RefPtr p_val,const void* p_ptr) {
Ref<Reference> r = p_val;
- *((Reference**)p_ptr)=r.ptr();
+ *(Ref<Reference>*)p_ptr=r;
}
};
diff --git a/core/script_language.cpp b/core/script_language.cpp
index 68a694398a..466242d39d 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -102,6 +102,22 @@ bool ScriptServer::is_reload_scripts_on_save_enabled() {
return reload_scripts_on_save;
}
+void ScriptServer::thread_enter() {
+
+ for(int i=0;i<_language_count;i++) {
+ _languages[i]->thread_enter();
+ }
+}
+
+void ScriptServer::thread_exit() {
+
+ for(int i=0;i<_language_count;i++) {
+ _languages[i]->thread_exit();
+ }
+
+}
+
+
void ScriptInstance::get_property_state(List<Pair<StringName, Variant> > &state) {
List<PropertyInfo> pinfo;
diff --git a/core/script_language.h b/core/script_language.h
index bde4d619ab..de725d8d08 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -59,6 +59,9 @@ public:
static void set_reload_scripts_on_save(bool p_enable);
static bool is_reload_scripts_on_save_enabled();
+ static void thread_enter();
+ static void thread_exit();
+
static void init_languages();
};
@@ -128,7 +131,6 @@ public:
virtual void call_multilevel_reversed(const StringName& p_method,const Variant** p_args,int p_argcount);
virtual void notification(int p_notification)=0;
-
//this is used by script languages that keep a reference counter of their own
//you can make make Ref<> not die when it reaches zero, so deleting the reference
//depends entirely from the script
@@ -183,6 +185,12 @@ public:
virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const=0;
virtual void add_global_constant(const StringName& p_variable,const Variant& p_value)=0;
+ /* MULTITHREAD FUNCTIONS */
+
+ //some VMs need to be notified of thread creation/exiting to allocate a stack
+ virtual void thread_enter() {}
+ virtual void thread_exit() {}
+
/* DEBUGGER FUNCTIONS */
virtual String debug_get_error() const=0;
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 4dbe41890d..3c22de35f1 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -2416,6 +2416,23 @@ Vector<uint8_t> String::md5_buffer() const {
return ret;
};
+Vector<uint8_t> String::sha256_buffer() const {
+ CharString cs = utf8();
+ unsigned char hash[32];
+ sha256_context ctx;
+ sha256_init(&ctx);
+ sha256_hash(&ctx, (unsigned char*)cs.ptr(), cs.length());
+ sha256_done(&ctx, hash);
+
+ Vector<uint8_t> ret;
+ ret.resize(32);
+ for (int i = 0; i < 32; i++) {
+ ret[i] = hash[i];
+ }
+
+ return ret;
+}
+
String String::insert(int p_at_pos,String p_string) const {
diff --git a/core/ustring.h b/core/ustring.h
index 692cb4e37d..bb57b11d88 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -196,6 +196,7 @@ public:
String md5_text() const;
String sha256_text() const;
Vector<uint8_t> md5_buffer() const;
+ Vector<uint8_t> sha256_buffer() const;
inline bool empty() const { return length() == 0; }
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 34e5164b24..c0f8930eed 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -271,6 +271,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM0R(String,md5_text);
VCALL_LOCALMEM0R(String,sha256_text);
VCALL_LOCALMEM0R(String,md5_buffer);
+ VCALL_LOCALMEM0R(String,sha256_buffer);
VCALL_LOCALMEM0R(String,empty);
VCALL_LOCALMEM0R(String,is_abs_path);
VCALL_LOCALMEM0R(String,is_rel_path);
@@ -1322,6 +1323,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(STRING,STRING,String,md5_text,varray());
ADDFUNC0(STRING,STRING,String,sha256_text,varray());
ADDFUNC0(STRING,RAW_ARRAY,String,md5_buffer,varray());
+ ADDFUNC0(STRING,RAW_ARRAY,String,sha256_buffer,varray());
ADDFUNC0(STRING,BOOL,String,empty,varray());
ADDFUNC0(STRING,BOOL,String,is_abs_path,varray());
ADDFUNC0(STRING,BOOL,String,is_rel_path,varray());
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 808bf20c25..09554e6a98 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -7059,8 +7059,11 @@
Draw a textured rectangle region at a given position, optionally modulated by a color. Transpose swaps the x and y coordinates when reading the texture.
</description>
</method>
- <method name="edit_get" qualifiers="const">
+ <method name="edit_get_state" qualifiers="const">
+ <return type="Variant">
+ </return>
<description>
+ Used for editing, returns an opaque value representing the transform state.
</description>
</method>
<method name="edit_rotate">
@@ -7080,7 +7083,7 @@
<argument index="0" name="state" type="Variant">
</argument>
<description>
- Used for editing, returns an opaque value representing the transform state.
+ Set the transform state of this CanvasItem. For [Node2D], this is an [Array] with (in order) a [Vector2] for position, a float for rotation and another [Vector2] for scale. For [Control] this is a [Rect2] with the position and size.
</description>
</method>
<method name="get_blend_mode" qualifiers="const">
@@ -7094,6 +7097,7 @@
<return type="RID">
</return>
<description>
+ Return the [RID] of the [World2D] canvas where this item is in.
</description>
</method>
<method name="get_canvas_item" qualifiers="const">
@@ -7107,55 +7111,63 @@
<return type="Matrix32">
</return>
<description>
+ Get the transform matrix of this item's canvas.
</description>
</method>
<method name="get_global_mouse_pos" qualifiers="const">
<return type="Vector2">
</return>
<description>
+ Get the global position of the mouse.
</description>
</method>
<method name="get_global_transform" qualifiers="const">
<return type="Matrix32">
</return>
<description>
+ Get the global transform matrix of this item.
</description>
</method>
<method name="get_global_transform_with_canvas" qualifiers="const">
<return type="Matrix32">
</return>
<description>
+ Get the global transform matrix of this item in relation to the canvas.
</description>
</method>
<method name="get_item_and_children_rect" qualifiers="const">
<return type="Rect2">
</return>
<description>
+ Get a [Rect2] with the boundaries of this item and its children.
</description>
</method>
<method name="get_item_rect" qualifiers="const">
<return type="Rect2">
</return>
<description>
- Return a rect containing the editable contents of the item.
+ Return a rect containing the editable boundaries of the item.
</description>
</method>
<method name="get_light_mask" qualifiers="const">
<return type="int">
</return>
<description>
+ Get this item's light mask number.
</description>
</method>
<method name="get_local_mouse_pos" qualifiers="const">
<return type="Vector2">
</return>
<description>
+ Get the mouse position relative to this item's position.
</description>
</method>
<method name="get_material" qualifiers="const">
<return type="CanvasItemMaterial">
</return>
<description>
+ Get the material of this item.
</description>
</method>
<method name="get_opacity" qualifiers="const">
@@ -7176,30 +7188,35 @@
<return type="Matrix32">
</return>
<description>
+ Get the transform matrix of this item.
</description>
</method>
<method name="get_use_parent_material" qualifiers="const">
<return type="bool">
</return>
<description>
+ Get whether this item uses its parent's material.
</description>
</method>
<method name="get_viewport_rect" qualifiers="const">
<return type="Rect2">
</return>
<description>
+ Get the viewport's boundaries as a [Rect2].
</description>
</method>
<method name="get_viewport_transform" qualifiers="const">
<return type="Matrix32">
</return>
<description>
+ Get this item's transform in relation to the viewport.
</description>
</method>
<method name="get_world_2d" qualifiers="const">
<return type="Object">
</return>
<description>
+ Get the [World2D] where this item is in.
</description>
</method>
<method name="hide">
@@ -7241,13 +7258,14 @@
<argument index="0" name="event" type="InputEvent">
</argument>
<description>
+ Takes a global input event and convert to this item's coordinate system.
</description>
</method>
<method name="set_as_toplevel">
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Set as toplevel. This means that it will not inherit transform from parent canvas items.
+ Set as top level. This means that it will not inherit transform from parent canvas items.
</description>
</method>
<method name="set_blend_mode">
@@ -7261,25 +7279,28 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Sets whether the canvas item is drawn behind its parent.
+ Set whether the canvas item is drawn behind its parent.
</description>
</method>
<method name="set_hidden">
<argument index="0" name="hidden" type="bool">
</argument>
<description>
+ Set whether this item should be hidden or not. Note that no matter what is set here this item won't be shown if its parent or grandparents nodes are also hidden. A hidden CanvasItem make all children hidden too.
</description>
</method>
<method name="set_light_mask">
<argument index="0" name="light_mask" type="int">
</argument>
<description>
+ Set the ligtht mask number of this item.
</description>
</method>
<method name="set_material">
<argument index="0" name="material" type="CanvasItemMaterial">
</argument>
<description>
+ Set the material of this item.
</description>
</method>
<method name="set_opacity">
@@ -7300,6 +7321,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
+ Set whether or not this item should use its parent's material.
</description>
</method>
<method name="show">
@@ -7309,7 +7331,7 @@
</method>
<method name="update">
<description>
- Queue the CanvasItem for update. NOTIFICATION_DRAW will be called on idle time to request redraw.
+ Queue the CanvasItem for update. [code]NOTIFICATION_DRAW[/code] will be called on idle time to request redraw.
</description>
</method>
</methods>
@@ -18959,6 +18981,34 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
Set the cursor position inside the [LineEdit], causing it to scroll if needed.
</description>
</method>
+ <method name="cursor_set_blink_enabled">
+ <argument index="0" name="enable" type="bool">
+ </argument>
+ <description>
+ Set the line edit caret to blink.
+ </description>
+ </method>
+ <method name="cursor_get_blink_enabled" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Gets whether the line edit caret is blinking.
+ </description>
+ </method>
+ <method name="cursor_set_blink_speed">
+ <argument index="0" name="blink_speed" type="float">
+ </argument>
+ <description>
+ Set the line edit caret blink speed. Cannot be less then or equal to 0.
+ </description>
+ </method>
+ <method name="cursor_get_blink_speed" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Gets the line edit caret blink speed.
+ </description>
+ </method>
<method name="set_editable">
<argument index="0" name="enabled" type="bool">
</argument>
@@ -37540,12 +37590,14 @@ A similar effect may be achieved moving this node's descendants.
<return type="String">
</return>
<description>
+ Return a copy of the string with special characters escaped using the C language standard.
</description>
</method>
<method name="c_unescape">
<return type="String">
</return>
<description>
+ Return a copy of the string with escaped characters replaced by their meanings according to the C language standard.
</description>
</method>
<method name="capitalize">
@@ -37577,6 +37629,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="text" type="String">
</argument>
<description>
+ Return true if the strings ends with the given string.
</description>
</method>
<method name="erase">
@@ -37585,6 +37638,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="1" name="chars" type="int">
</argument>
<description>
+ Erase [code]chars[/code] characters from the string starting from [code]pos[/code].
</description>
</method>
<method name="extension">
@@ -37684,7 +37738,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="text" type="String">
</argument>
<description>
- Checked whether this string is a subsequence of the given string.
+ Check whether this string is a subsequence of the given string.
</description>
</method>
<method name="is_subsequence_ofi">
@@ -37693,7 +37747,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="text" type="String">
</argument>
<description>
- Checked whether this string is a subsequence of the given string, without considering case.
+ Check whether this string is a subsequence of the given string, without considering case.
</description>
</method>
<method name="is_valid_float">
@@ -37714,6 +37768,7 @@ A similar effect may be achieved moving this node's descendants.
<return type="bool">
</return>
<description>
+ Check whether the string is a valid identifier. As is common in programming languages, a valid identifier may contain only letters, digits and underscores (_) and the first character may not be a digit.
</description>
</method>
<method name="is_valid_integer">
@@ -37734,6 +37789,7 @@ A similar effect may be achieved moving this node's descendants.
<return type="String">
</return>
<description>
+ Return a copy of the string with special characters escaped using the JSON standard.
</description>
</method>
<method name="left">
@@ -37774,12 +37830,14 @@ A similar effect may be achieved moving this node's descendants.
<return type="RawArray">
</return>
<description>
+ Return the MD5 hash of the string as an array of bytes.
</description>
</method>
<method name="md5_text">
<return type="String">
</return>
<description>
+ Return the MD5 hash of the string as a string.
</description>
</method>
<method name="nocasecmp_to">
@@ -37797,7 +37855,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="at" type="int">
</argument>
<description>
- Return the character code at position "at".
+ Return the character code at position [code]at[/code].
</description>
</method>
<method name="pad_decimals">
@@ -37806,6 +37864,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="digits" type="int">
</argument>
<description>
+ Format a number to have an exact number of [code]digits[/code] after the decimal point.
</description>
</method>
<method name="pad_zeros">
@@ -37814,18 +37873,21 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="digits" type="int">
</argument>
<description>
+ Format a number to have an exact number of [code]digits[/code] before the decimal point.
</description>
</method>
<method name="percent_decode">
<return type="String">
</return>
<description>
+ Decode a percent-encoded string. See [method percent_encode].
</description>
</method>
<method name="percent_encode">
<return type="String">
</return>
<description>
+ Percent-encode a string. This is meant to encode parameters in a URL when sending a HTTP GET request and bodies of form-urlencoded POST request.
</description>
</method>
<method name="plus_file">
@@ -37834,6 +37896,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="file" type="String">
</argument>
<description>
+ If the string is a path, this concatenates [code]file[/code] at the end of the string as a subpath. E.g. [code]"this/is".plus_file("path") == "this/is/path"[/code].
</description>
</method>
<method name="replace">
@@ -37889,10 +37952,17 @@ A similar effect may be achieved moving this node's descendants.
Return the right side of the string from a given position.
</description>
</method>
+ <method name="sha256_buffer">
+ <return type="RawArray">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="sha256_text">
<return type="String">
</return>
<description>
+ Return the SHA-256 hash of the string as a string.
</description>
</method>
<method name="similarity">
@@ -37912,7 +37982,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="1" name="allow_empty" type="bool" default="True">
</argument>
<description>
- Split the string by a divisor string, return an array of the substrings. Example "One,Two,Three" will return \["One","Two","Three"\] if split by ",".
+ Split the string by a divisor string, return an array of the substrings. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",".
</description>
</method>
<method name="split_floats">
@@ -37923,7 +37993,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="1" name="allow_empty" type="bool" default="True">
</argument>
<description>
- Split the string in floats by using a divisor string, return an array of the substrings. Example "1,2.5,3" will return \[1,2.5,3\] if split by ",".
+ Split the string in floats by using a divisor string, return an array of the substrings. Example "1,2.5,3" will return [1,2.5,3] if split by ",".
</description>
</method>
<method name="strip_edges">
@@ -37945,7 +38015,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="1" name="len" type="int">
</argument>
<description>
- Return part of the string from "from", with length "len".
+ Return part of the string from the position [code]from[/code], with length [code]len[/code].
</description>
</method>
<method name="to_ascii">
@@ -37959,14 +38029,14 @@ A similar effect may be achieved moving this node's descendants.
<return type="float">
</return>
<description>
- Convert a string, containing a decimal number, into a float.
+ Convert a string, containing a decimal number, into a [code]float[/code].
</description>
</method>
<method name="to_int">
<return type="int">
</return>
<description>
- Convert a string, containing an integer number, into an int.
+ Convert a string, containing an integer number, into an [code]int[/code].
</description>
</method>
<method name="to_lower">
@@ -37994,14 +38064,14 @@ A similar effect may be achieved moving this node's descendants.
<return type="String">
</return>
<description>
- Perform XML escaping on the string.
+ Return a copy of the string with special characters escaped using the XML standard.
</description>
</method>
<method name="xml_unescape">
<return type="String">
</return>
<description>
- Perform XML un-escaping of the string.
+ Return a copy of the string with escaped characters replaced by their meanings according to the XML standard.
</description>
</method>
</methods>
@@ -39262,8 +39332,6 @@ A similar effect may be achieved moving this node's descendants.
</theme_item>
<theme_item name="completion" type="StyleBox">
</theme_item>
- <theme_item name="completion_existing" type="Color">
- </theme_item>
<theme_item name="completion_lines" type="int">
</theme_item>
<theme_item name="completion_max_width" type="int">
@@ -39272,8 +39340,6 @@ A similar effect may be achieved moving this node's descendants.
</theme_item>
<theme_item name="completion_scroll_width" type="int">
</theme_item>
- <theme_item name="completion_selected" type="StyleBox">
- </theme_item>
<theme_item name="current_line_color" type="Color">
</theme_item>
<theme_item name="focus" type="StyleBox">
diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp
index 6ace64a923..c71e09685b 100644
--- a/drivers/unix/thread_posix.cpp
+++ b/drivers/unix/thread_posix.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "thread_posix.h"
+#include "script_language.h"
#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)
@@ -50,7 +51,13 @@ void *ThreadPosix::thread_callback(void *userdata) {
ThreadPosix *t=reinterpret_cast<ThreadPosix*>(userdata);
t->id=(ID)pthread_self();
+
+ ScriptServer::thread_enter(); //scripts may need to attach a stack
+
t->callback(t->user);
+
+ ScriptServer::thread_exit();
+
return NULL;
}
diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp
index d5e489aab4..884575e81e 100644
--- a/drivers/windows/thread_windows.cpp
+++ b/drivers/windows/thread_windows.cpp
@@ -32,6 +32,7 @@
#include "os/memory.h"
+
Thread::ID ThreadWindows::get_ID() const {
return id;
@@ -45,8 +46,14 @@ Thread* ThreadWindows::create_thread_windows() {
DWORD ThreadWindows::thread_callback( LPVOID userdata ) {
ThreadWindows *t=reinterpret_cast<ThreadWindows*>(userdata);
- t->callback(t->user);
+
+ ScriptServer::thread_enter(); //scripts may need to attach a stack
+
t->id=(ID)GetCurrentThreadId(); // must implement
+ t->callback(t->user);
+
+ ScriptServer::thread_exit();
+
return 0;
}
diff --git a/drivers/windows/thread_windows.h b/drivers/windows/thread_windows.h
index b051bfe370..1c90504dde 100644
--- a/drivers/windows/thread_windows.h
+++ b/drivers/windows/thread_windows.h
@@ -36,6 +36,7 @@
#ifdef WINDOWS_ENABLED
#include "os/thread.h"
+#include "script_language.h"
#include <windows.h>
class ThreadWindows : public Thread {
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 026fd04869..e37a2ca155 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -1709,6 +1709,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"false",
"float",
"int",
+ "bool",
"null",
"PI",
"self",
diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template
index b0630d9a3a..1e1461ef29 100644
--- a/platform/android/build.gradle.template
+++ b/platform/android/build.gradle.template
@@ -18,7 +18,7 @@ allprojects {
dependencies {
compile 'com.android.support:support-v4:23.+' // can be removed if minSdkVersion 16 and modify DownloadNotification.java & V14CustomNotification.java
- $$GRADLE_DEPENDENCIES$$
+ $$GRADLE_DEPENDENCIES$$
}
android {
@@ -44,26 +44,26 @@ android {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src'
- $$GRADLE_JAVA_DIRS$$
+ $$GRADLE_JAVA_DIRS$$
]
resources.srcDirs = [
'res'
- $$GRADLE_RES_DIRS$$
+ $$GRADLE_RES_DIRS$$
]
res.srcDirs = ['res']
// libs.srcDirs = ['libs']
aidl.srcDirs = [
'aidl'
- $$GRADLE_AIDL_DIRS$$
+ $$GRADLE_AIDL_DIRS$$
]
assets.srcDirs = [
'assets'
- $$GRADLE_ASSET_DIRS$$
+ $$GRADLE_ASSET_DIRS$$
]
jniLibs.srcDirs = [
'libs'
- $$GRADLE_JNI_DIRS$$
- ]
+ $$GRADLE_JNI_DIRS$$
+ ]
}
}
diff --git a/platform/android/java/src/com/android/vending/billing/IInAppBillingService.aidl b/platform/android/java/src/com/android/vending/billing/IInAppBillingService.aidl
deleted file mode 100644
index 2a492f7845..0000000000
--- a/platform/android/java/src/com/android/vending/billing/IInAppBillingService.aidl
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.vending.billing;
-
-import android.os.Bundle;
-
-/**
- * InAppBillingService is the service that provides in-app billing version 3 and beyond.
- * This service provides the following features:
- * 1. Provides a new API to get details of in-app items published for the app including
- * price, type, title and description.
- * 2. The purchase flow is synchronous and purchase information is available immediately
- * after it completes.
- * 3. Purchase information of in-app purchases is maintained within the Google Play system
- * till the purchase is consumed.
- * 4. An API to consume a purchase of an inapp item. All purchases of one-time
- * in-app items are consumable and thereafter can be purchased again.
- * 5. An API to get current purchases of the user immediately. This will not contain any
- * consumed purchases.
- *
- * All calls will give a response code with the following possible values
- * RESULT_OK = 0 - success
- * RESULT_USER_CANCELED = 1 - user pressed back or canceled a dialog
- * RESULT_BILLING_UNAVAILABLE = 3 - this billing API version is not supported for the type requested
- * RESULT_ITEM_UNAVAILABLE = 4 - requested SKU is not available for purchase
- * RESULT_DEVELOPER_ERROR = 5 - invalid arguments provided to the API
- * RESULT_ERROR = 6 - Fatal error during the API action
- * RESULT_ITEM_ALREADY_OWNED = 7 - Failure to purchase since item is already owned
- * RESULT_ITEM_NOT_OWNED = 8 - Failure to consume since item is not owned
- */
-interface IInAppBillingService {
- /**
- * Checks support for the requested billing API version, package and in-app type.
- * Minimum API version supported by this interface is 3.
- * @param apiVersion the billing version which the app is using
- * @param packageName the package name of the calling app
- * @param type type of the in-app item being purchased "inapp" for one-time purchases
- * and "subs" for subscription.
- * @return RESULT_OK(0) on success, corresponding result code on failures
- */
- int isBillingSupported(int apiVersion, String packageName, String type);
-
- /**
- * Provides details of a list of SKUs
- * Given a list of SKUs of a valid type in the skusBundle, this returns a bundle
- * with a list JSON strings containing the productId, price, title and description.
- * This API can be called with a maximum of 20 SKUs.
- * @param apiVersion billing API version that the Third-party is using
- * @param packageName the package name of the calling app
- * @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST"
- * @return Bundle containing the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "DETAILS_LIST" with a StringArrayList containing purchase information
- * in JSON format similar to:
- * '{ "productId" : "exampleSku", "type" : "inapp", "price" : "$5.00",
- * "title : "Example Title", "description" : "This is an example description" }'
- */
- Bundle getSkuDetails(int apiVersion, String packageName, String type, in Bundle skusBundle);
-
- /**
- * Returns a pending intent to launch the purchase flow for an in-app item by providing a SKU,
- * the type, a unique purchase token and an optional developer payload.
- * @param apiVersion billing API version that the app is using
- * @param packageName package name of the calling app
- * @param sku the SKU of the in-app item as published in the developer console
- * @param type the type of the in-app item ("inapp" for one-time purchases
- * and "subs" for subscription).
- * @param developerPayload optional argument to be sent back with the purchase information
- * @return Bundle containing the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "BUY_INTENT" - PendingIntent to start the purchase flow
- *
- * The Pending intent should be launched with startIntentSenderForResult. When purchase flow
- * has completed, the onActivityResult() will give a resultCode of OK or CANCELED.
- * If the purchase is successful, the result data will contain the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "INAPP_PURCHASE_DATA" - String in JSON format similar to
- * '{"orderId":"12999763169054705758.1371079406387615",
- * "packageName":"com.example.app",
- * "productId":"exampleSku",
- * "purchaseTime":1345678900000,
- * "purchaseToken" : "122333444455555",
- * "developerPayload":"example developer payload" }'
- * "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that
- * was signed with the private key of the developer
- * TODO: change this to app-specific keys.
- */
- Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type,
- String developerPayload);
-
- /**
- * Returns the current SKUs owned by the user of the type and package name specified along with
- * purchase information and a signature of the data to be validated.
- * This will return all SKUs that have been purchased in V3 and managed items purchased using
- * V1 and V2 that have not been consumed.
- * @param apiVersion billing API version that the app is using
- * @param packageName package name of the calling app
- * @param type the type of the in-app items being requested
- * ("inapp" for one-time purchases and "subs" for subscription).
- * @param continuationToken to be set as null for the first call, if the number of owned
- * skus are too many, a continuationToken is returned in the response bundle.
- * This method can be called again with the continuation token to get the next set of
- * owned skus.
- * @return Bundle containing the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "INAPP_PURCHASE_ITEM_LIST" - StringArrayList containing the list of SKUs
- * "INAPP_PURCHASE_DATA_LIST" - StringArrayList containing the purchase information
- * "INAPP_DATA_SIGNATURE_LIST"- StringArrayList containing the signatures
- * of the purchase information
- * "INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the
- * next set of in-app purchases. Only set if the
- * user has more owned skus than the current list.
- */
- Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken);
-
- /**
- * Consume the last purchase of the given SKU. This will result in this item being removed
- * from all subsequent responses to getPurchases() and allow re-purchase of this item.
- * @param apiVersion billing API version that the app is using
- * @param packageName package name of the calling app
- * @param purchaseToken token in the purchase information JSON that identifies the purchase
- * to be consumed
- * @return 0 if consumption succeeded. Appropriate error values for failures.
- */
- int consumePurchase(int apiVersion, String packageName, String purchaseToken);
-}
diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp
index 1425e23c73..61ee237586 100644
--- a/platform/android/thread_jandroid.cpp
+++ b/platform/android/thread_jandroid.cpp
@@ -29,6 +29,7 @@
#include "thread_jandroid.h"
#include "os/memory.h"
+#include "script_language.h"
Thread::ID ThreadAndroid::get_ID() const {
@@ -44,8 +45,10 @@ void *ThreadAndroid::thread_callback(void *userdata) {
ThreadAndroid *t=reinterpret_cast<ThreadAndroid*>(userdata);
setup_thread();
+ ScriptServer::thread_enter(); //scripts may need to attach a stack
t->id=(ID)pthread_self();
t->callback(t->user);
+ ScriptServer::thread_exit();
return NULL;
}
diff --git a/platform/winrt/thread_winrt.cpp b/platform/winrt/thread_winrt.cpp
index 097050e511..e7028bd9dc 100644
--- a/platform/winrt/thread_winrt.cpp
+++ b/platform/winrt/thread_winrt.cpp
@@ -33,6 +33,8 @@
Thread* ThreadWinrt::create_func_winrt(ThreadCreateCallback p_callback,void *p_user,const Settings&) {
ThreadWinrt* thread = memnew(ThreadWinrt);
+
+
std::thread new_thread(p_callback, p_user);
std::swap(thread->thread, new_thread);
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index c9349c1bbe..12957b81b7 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -344,7 +344,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
/* set the name and class hints for the window manager to use */
classHint = XAllocClassHint();
if (classHint) {
- classHint->res_name = (char *)"Godot";
+ classHint->res_name = (char *)"Godot_Engine";
classHint->res_class = (char *)"Godot";
}
XSetClassHint(x11_display, x11_window, classHint);
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index eb37634b24..976a5c4f1e 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -1023,7 +1023,7 @@ void CanvasItem::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_is_visible_"),&CanvasItem::_is_visible_);
ObjectTypeDB::bind_method(_MD("edit_set_state","state"),&CanvasItem::edit_set_state);
- ObjectTypeDB::bind_method(_MD("edit_get"),&CanvasItem::edit_get_state);
+ ObjectTypeDB::bind_method(_MD("edit_get_state:Variant"),&CanvasItem::edit_get_state);
ObjectTypeDB::bind_method(_MD("edit_set_rect","rect"),&CanvasItem::edit_set_rect);
ObjectTypeDB::bind_method(_MD("edit_rotate","degrees"),&CanvasItem::edit_rotate);
diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp
index bf559deb09..a67ea04959 100644
--- a/scene/2d/parallax_layer.cpp
+++ b/scene/2d/parallax_layer.cpp
@@ -92,23 +92,13 @@ void ParallaxLayer::set_base_offset_and_scale(const Point2& p_offset,float p_sca
Point2 new_ofs = ((orig_offset+p_offset)*motion_scale)*p_scale;
if (mirroring.x) {
-
- while( new_ofs.x>=0) {
- new_ofs.x -= mirroring.x*p_scale;
- }
- while(new_ofs.x < -mirroring.x*p_scale) {
- new_ofs.x += mirroring.x*p_scale;
- }
+ double den = mirroring.x*p_scale;
+ new_ofs.x = fmod(new_ofs.x,den) - (mirroring.x > 0 ? den : 0);
}
if (mirroring.y) {
-
- while( new_ofs.y>=0) {
- new_ofs.y -= mirroring.y*p_scale;
- }
- while(new_ofs.y < -mirroring.y*p_scale) {
- new_ofs.y += mirroring.y*p_scale;
- }
+ double den = mirroring.y*p_scale;
+ new_ofs.y = fmod(new_ofs.y,den) - (mirroring.y > 0 ? den : 0);
}
diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp
index 3e6384ea2c..27aa08ec5b 100644
--- a/scene/2d/sprite.cpp
+++ b/scene/2d/sprite.cpp
@@ -120,6 +120,7 @@ void Sprite::set_texture(const Ref<Texture>& p_texture) {
}
#endif
update();
+ emit_signal("texture_changed");
item_rect_changed();
}
@@ -323,6 +324,7 @@ void Sprite::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_modulate"),&Sprite::get_modulate);
ADD_SIGNAL(MethodInfo("frame_changed"));
+ ADD_SIGNAL(MethodInfo("texture_changed"));
ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_texture"),_SCS("get_texture"));
ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered"));
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 52ef57cf1c..579a6e2f0a 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -31,6 +31,9 @@
#include "os/os.h"
#include "print_string.h"
#include "label.h"
+#ifdef TOOLS_ENABLED
+#include "tools/editor/editor_settings.h"
+#endif
static bool _is_text_char(CharType c) {
@@ -57,6 +60,7 @@ void LineEdit::_input_event(InputEvent p_event) {
if (b.button_index!=BUTTON_LEFT)
break;
+ _reset_caret_blink_timer();
if (b.pressed) {
shift_selection_check_pre(b.mod.shift);
@@ -227,7 +231,7 @@ void LineEdit::_input_event(InputEvent p_event) {
}
}
-
+ _reset_caret_blink_timer();
if (!k.mod.meta) {
bool handled=true;
@@ -294,6 +298,9 @@ void LineEdit::_input_event(InputEvent p_event) {
}
case KEY_LEFT: {
+#ifndef APPLE_STYLE_KEYS
+ if (!k.mod.alt)
+#endif
shift_selection_check_pre(k.mod.shift);
#ifdef APPLE_STYLE_KEYS
@@ -543,14 +550,37 @@ void LineEdit::drop_data(const Point2& p_point,const Variant& p_data){
void LineEdit::_notification(int p_what) {
switch(p_what) {
+#ifdef TOOLS_ENABLED
+ case NOTIFICATION_ENTER_TREE: {
+ if (get_tree()->is_editor_hint()) {
+ cursor_set_blink_enabled(EDITOR_DEF("text_editor/caret_blink", false));
+ cursor_set_blink_speed(EDITOR_DEF("text_editor/caret_blink_speed", 0.65));
+ EditorSettings::get_singleton()->connect("settings_changed",this,"_editor_settings_changed");
+ }
+ } break;
+#endif
case NOTIFICATION_RESIZED: {
set_cursor_pos( get_cursor_pos() );
} break;
+ case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
+ window_has_focus = true;
+ draw_caret = true;
+ update();
+ } break;
+ case MainLoop::NOTIFICATION_WM_FOCUS_OUT: {
+ window_has_focus = false;
+ draw_caret = false;
+ update();
+ } break;
case NOTIFICATION_DRAW: {
+ if ((!has_focus() && !menu->has_focus()) || !window_has_focus) {
+ draw_caret = false;
+ }
+
int width,height;
Size2 size=get_size();
@@ -627,21 +657,26 @@ void LineEdit::_notification(int p_what) {
font->draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, selected ? font_color_selected : font_color);
- if (char_ofs==cursor_pos && has_focus())
+ if (char_ofs==cursor_pos && draw_caret) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(
Point2( x_ofs , y_ofs ), Size2( 1, y_area ) ), cursor_color );
+ }
x_ofs+=char_width;
char_ofs++;
}
- if (char_ofs==cursor_pos && has_focus()) //may be at the end
+ if (char_ofs==cursor_pos && draw_caret) {//may be at the end
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(
Point2( x_ofs , y_ofs ), Size2( 1, y_area ) ), cursor_color );
-
+ }
} break;
case NOTIFICATION_FOCUS_ENTER: {
+ if (!caret_blink_enabled) {
+ draw_caret = true;
+ }
+
if (OS::get_singleton()->has_virtual_keyboard())
OS::get_singleton()->show_virtual_keyboard(get_text(),get_global_rect());
@@ -788,6 +823,45 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
}
+bool LineEdit::cursor_get_blink_enabled() const {
+ return caret_blink_enabled;
+}
+
+void LineEdit::cursor_set_blink_enabled(const bool p_enabled) {
+ caret_blink_enabled = p_enabled;
+ if (p_enabled) {
+ caret_blink_timer->start();
+ } else {
+ caret_blink_timer->stop();
+ }
+ draw_caret = true;
+}
+
+float LineEdit::cursor_get_blink_speed() const {
+ return caret_blink_timer->get_wait_time();
+}
+
+void LineEdit::cursor_set_blink_speed(const float p_speed) {
+ ERR_FAIL_COND(p_speed <= 0);
+ caret_blink_timer->set_wait_time(p_speed);
+}
+
+void LineEdit::_reset_caret_blink_timer() {
+ if (caret_blink_enabled) {
+ caret_blink_timer->stop();
+ caret_blink_timer->start();
+ draw_caret = true;
+ update();
+ }
+ }
+
+void LineEdit::_toggle_draw_caret() {
+ draw_caret = !draw_caret;
+ if (is_visible()) {
+ update();
+ }
+}
+
void LineEdit::delete_char() {
if ((text.length()<=0) || (cursor_pos==0)) return;
@@ -1126,8 +1200,21 @@ PopupMenu *LineEdit::get_menu() const {
return menu;
}
+#ifdef TOOLS_ENABLED
+ void LineEdit::_editor_settings_changed() {
+ cursor_set_blink_enabled(EDITOR_DEF("text_editor/caret_blink", false));
+ cursor_set_blink_speed(EDITOR_DEF("text_editor/caret_blink_speed", 0.65));
+ }
+#endif
+
void LineEdit::_bind_methods() {
+ ObjectTypeDB::bind_method(_MD("_toggle_draw_caret"),&LineEdit::_toggle_draw_caret);
+
+#ifdef TOOLS_ENABLED
+ ObjectTypeDB::bind_method("_editor_settings_changed",&LineEdit::_editor_settings_changed);
+#endif
+
ObjectTypeDB::bind_method(_MD("set_align", "align"), &LineEdit::set_align);
ObjectTypeDB::bind_method(_MD("get_align"), &LineEdit::get_align);
@@ -1138,6 +1225,10 @@ void LineEdit::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_text"),&LineEdit::get_text);
ObjectTypeDB::bind_method(_MD("set_cursor_pos","pos"),&LineEdit::set_cursor_pos);
ObjectTypeDB::bind_method(_MD("get_cursor_pos"),&LineEdit::get_cursor_pos);
+ ObjectTypeDB::bind_method(_MD("cursor_set_blink_enabled", "enable"),&LineEdit::cursor_set_blink_enabled);
+ ObjectTypeDB::bind_method(_MD("cursor_get_blink_enabled"),&LineEdit::cursor_get_blink_enabled);
+ ObjectTypeDB::bind_method(_MD("cursor_set_blink_speed", "blink_speed"),&LineEdit::cursor_set_blink_speed);
+ ObjectTypeDB::bind_method(_MD("cursor_get_blink_speed"),&LineEdit::cursor_get_blink_speed);
ObjectTypeDB::bind_method(_MD("set_max_length","chars"),&LineEdit::set_max_length);
ObjectTypeDB::bind_method(_MD("get_max_length"),&LineEdit::get_max_length);
ObjectTypeDB::bind_method(_MD("append_at_cursor","text"),&LineEdit::append_at_cursor);
@@ -1171,7 +1262,8 @@ void LineEdit::_bind_methods() {
ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "editable" ), _SCS("set_editable"),_SCS("is_editable") );
ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "secret" ), _SCS("set_secret"),_SCS("is_secret") );
ADD_PROPERTY( PropertyInfo( Variant::INT,"focus_mode", PROPERTY_HINT_ENUM, "None,Click,All" ), _SCS("set_focus_mode"), _SCS("get_focus_mode") );
-
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret/caret_blink"), _SCS("cursor_set_blink_enabled"), _SCS("cursor_get_blink_enabled"));;
+ ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "caret/caret_blink_speed",PROPERTY_HINT_RANGE,"0.1,10,0.1"), _SCS("cursor_set_blink_speed"),_SCS("cursor_get_blink_speed") );
}
LineEdit::LineEdit() {
@@ -1180,6 +1272,7 @@ LineEdit::LineEdit() {
cached_width = 0;
cursor_pos=0;
window_pos=0;
+ window_has_focus=true;
max_length = 0;
pass=false;
@@ -1189,6 +1282,13 @@ LineEdit::LineEdit() {
set_default_cursor_shape(CURSOR_IBEAM);
set_stop_mouse(true);
+ draw_caret=true;
+ caret_blink_enabled=false;
+ caret_blink_timer = memnew(Timer);
+ add_child(caret_blink_timer);
+ caret_blink_timer->set_wait_time(0.65);
+ caret_blink_timer->connect("timeout", this,"_toggle_draw_caret");
+ cursor_set_blink_enabled(false);
menu = memnew( PopupMenu );
add_child(menu);
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index ce3958db02..e4da0f0b87 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -87,6 +87,11 @@ private:
bool drag_attempt;
} selection;
+ Timer *caret_blink_timer;
+ bool caret_blink_enabled;
+ bool draw_caret;
+ bool window_has_focus;
+
void shift_selection_check_pre(bool);
void shift_selection_check_post(bool);
@@ -97,10 +102,15 @@ private:
void set_cursor_at_pixel_pos(int p_x);
+ void _reset_caret_blink_timer();
+ void _toggle_draw_caret();
+
void clear_internal();
void changed_internal();
-
+#ifdef TOOLS_ENABLED
+ void _editor_settings_changed();
+#endif
void _input_event(InputEvent p_event);
void _notification(int p_what);
@@ -132,6 +142,12 @@ public:
void append_at_cursor(String p_text);
void clear();
+ bool cursor_get_blink_enabled() const;
+ void cursor_set_blink_enabled(const bool p_enabled);
+
+ float cursor_get_blink_speed() const;
+ void cursor_set_blink_speed(const float p_speed);
+
void copy_text();
void cut_text();
void paste_text();
diff --git a/scene/gui/patch_9_frame.cpp b/scene/gui/patch_9_frame.cpp
index a6a3490ad2..9ad6398359 100644
--- a/scene/gui/patch_9_frame.cpp
+++ b/scene/gui/patch_9_frame.cpp
@@ -79,6 +79,8 @@ void Patch9Frame::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_draw_center","draw_center"), & Patch9Frame::set_draw_center );
ObjectTypeDB::bind_method(_MD("get_draw_center"), & Patch9Frame::get_draw_center );
+ ADD_SIGNAL(MethodInfo("texture_changed"));
+
ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), _SCS("set_texture"),_SCS("get_texture") );
ADD_PROPERTYNO( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate") );
ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "draw_center"), _SCS("set_draw_center"),_SCS("get_draw_center") );
@@ -93,11 +95,14 @@ void Patch9Frame::_bind_methods() {
void Patch9Frame::set_texture(const Ref<Texture>& p_tex) {
+ if (texture==p_tex)
+ return;
texture=p_tex;
update();
//if (texture.is_valid())
// texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites
minimum_size_changed();
+ emit_signal("texture_changed");
}
Ref<Texture> Patch9Frame::get_texture() const {
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 9342d077eb..6fd6137ac8 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2065,6 +2065,12 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
if (k.mod.shift)
_pre_shift_selection();
+#ifdef APPLE_STYLE_KEYS
+ else
+#else
+ else if (!k.mod.alt)
+#endif
+ deselect();
#ifdef APPLE_STYLE_KEYS
if (k.mod.command) {
@@ -2118,6 +2124,12 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
if (k.mod.shift)
_pre_shift_selection();
+#ifdef APPLE_STYLE_KEYS
+ else
+#else
+ else if (!k.mod.alt)
+#endif
+ deselect();
#ifdef APPLE_STYLE_KEYS
if (k.mod.command) {
diff --git a/scene/resources/default_theme/arrow_down.png b/scene/resources/default_theme/arrow_down.png
index b65549d175..fc837d120a 100644
--- a/scene/resources/default_theme/arrow_down.png
+++ b/scene/resources/default_theme/arrow_down.png
Binary files differ
diff --git a/scene/resources/default_theme/arrow_right.png b/scene/resources/default_theme/arrow_right.png
index b926ca4e42..ebe6e26ace 100644
--- a/scene/resources/default_theme/arrow_right.png
+++ b/scene/resources/default_theme/arrow_right.png
Binary files differ
diff --git a/scene/resources/default_theme/close.png b/scene/resources/default_theme/close.png
index 6137d1ab11..5ac6357dcd 100644
--- a/scene/resources/default_theme/close.png
+++ b/scene/resources/default_theme/close.png
Binary files differ
diff --git a/scene/resources/default_theme/close_hl.png b/scene/resources/default_theme/close_hl.png
index 6137d1ab11..5ac6357dcd 100644
--- a/scene/resources/default_theme/close_hl.png
+++ b/scene/resources/default_theme/close_hl.png
Binary files differ
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index db45a998c3..7ed83f50f8 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -469,6 +469,9 @@ void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<F
t->set_font("font","TextEdit", default_font );
+ t->set_color("completion_background_color", "TextEdit",Color::html("2C2A32"));
+ t->set_color("completion_selected_color", "TextEdit",Color::html("434244"));
+ t->set_color("completion_existing_color", "TextEdit",Color::html("21dfdfdf"));
t->set_color("completion_scroll_color","TextEdit", control_font_color_pressed );
t->set_color("font_color","TextEdit", control_font_color );
t->set_color("font_color_selected","TextEdit", Color(0,0,0) );
diff --git a/scene/resources/default_theme/graph_node_close.png b/scene/resources/default_theme/graph_node_close.png
index ae400f1f3f..144a8b9c4c 100644
--- a/scene/resources/default_theme/graph_node_close.png
+++ b/scene/resources/default_theme/graph_node_close.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_add.png b/scene/resources/default_theme/icon_add.png
index 366e28e5a4..fa675045bc 100644
--- a/scene/resources/default_theme/icon_add.png
+++ b/scene/resources/default_theme/icon_add.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_close.png b/scene/resources/default_theme/icon_close.png
index 6137d1ab11..5ac6357dcd 100644
--- a/scene/resources/default_theme/icon_close.png
+++ b/scene/resources/default_theme/icon_close.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_color_pick.png b/scene/resources/default_theme/icon_color_pick.png
index 8d5d5f0780..15679a9558 100644
--- a/scene/resources/default_theme/icon_color_pick.png
+++ b/scene/resources/default_theme/icon_color_pick.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_folder.png b/scene/resources/default_theme/icon_folder.png
index fb3f0b36be..cc05e98ebb 100644
--- a/scene/resources/default_theme/icon_folder.png
+++ b/scene/resources/default_theme/icon_folder.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_play.png b/scene/resources/default_theme/icon_play.png
index ebc3d633cb..864e4e4fb9 100644
--- a/scene/resources/default_theme/icon_play.png
+++ b/scene/resources/default_theme/icon_play.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_reload.png b/scene/resources/default_theme/icon_reload.png
index 6e613cbd68..9303fabb9c 100644
--- a/scene/resources/default_theme/icon_reload.png
+++ b/scene/resources/default_theme/icon_reload.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_zoom_less.png b/scene/resources/default_theme/icon_zoom_less.png
index d815521d42..888ddc995d 100644
--- a/scene/resources/default_theme/icon_zoom_less.png
+++ b/scene/resources/default_theme/icon_zoom_less.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_zoom_more.png b/scene/resources/default_theme/icon_zoom_more.png
index f180caf5db..fa675045bc 100644
--- a/scene/resources/default_theme/icon_zoom_more.png
+++ b/scene/resources/default_theme/icon_zoom_more.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_zoom_reset.png b/scene/resources/default_theme/icon_zoom_reset.png
index d9c9f95299..953ae47d24 100644
--- a/scene/resources/default_theme/icon_zoom_reset.png
+++ b/scene/resources/default_theme/icon_zoom_reset.png
Binary files differ
diff --git a/scene/resources/default_theme/option_arrow.png b/scene/resources/default_theme/option_arrow.png
index 9e188dcd8c..007de16bfa 100644
--- a/scene/resources/default_theme/option_arrow.png
+++ b/scene/resources/default_theme/option_arrow.png
Binary files differ
diff --git a/scene/resources/default_theme/popup_checked.png b/scene/resources/default_theme/popup_checked.png
index 087dfa117c..a24e0543c0 100644
--- a/scene/resources/default_theme/popup_checked.png
+++ b/scene/resources/default_theme/popup_checked.png
Binary files differ
diff --git a/scene/resources/default_theme/spinbox_updown.png b/scene/resources/default_theme/spinbox_updown.png
index 204339e1d9..b40b1e9fd2 100644
--- a/scene/resources/default_theme/spinbox_updown.png
+++ b/scene/resources/default_theme/spinbox_updown.png
Binary files differ
diff --git a/scene/resources/default_theme/submenu.png b/scene/resources/default_theme/submenu.png
index 2e00b766e8..ec727eecf1 100644
--- a/scene/resources/default_theme/submenu.png
+++ b/scene/resources/default_theme/submenu.png
Binary files differ
diff --git a/scene/resources/default_theme/tab_close.png b/scene/resources/default_theme/tab_close.png
index 6195559257..20d9b5c810 100644
--- a/scene/resources/default_theme/tab_close.png
+++ b/scene/resources/default_theme/tab_close.png
Binary files differ
diff --git a/scene/resources/default_theme/tab_menu.png b/scene/resources/default_theme/tab_menu.png
index 5f80512336..148b64b8aa 100644
--- a/scene/resources/default_theme/tab_menu.png
+++ b/scene/resources/default_theme/tab_menu.png
Binary files differ
diff --git a/scene/resources/default_theme/tab_menu_hl.png b/scene/resources/default_theme/tab_menu_hl.png
index 5f80512336..148b64b8aa 100644
--- a/scene/resources/default_theme/tab_menu_hl.png
+++ b/scene/resources/default_theme/tab_menu_hl.png
Binary files differ
diff --git a/scene/resources/default_theme/updown.png b/scene/resources/default_theme/updown.png
index a0c577db5b..916284a3cf 100644
--- a/scene/resources/default_theme/updown.png
+++ b/scene/resources/default_theme/updown.png
Binary files differ
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index a61ffe8e97..8580ffdc5a 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -104,7 +104,10 @@ StyleBox::StyleBox() {
void StyleBoxTexture::set_texture(RES p_texture) {
+ if (texture==p_texture)
+ return;
texture=p_texture;
+ emit_signal("texture_changed");
emit_changed();
}
@@ -207,6 +210,8 @@ void StyleBoxTexture::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_draw_center","enable"),&StyleBoxTexture::set_draw_center);
ObjectTypeDB::bind_method(_MD("get_draw_center"),&StyleBoxTexture::get_draw_center);
+ ADD_SIGNAL(MethodInfo("texture_changed"));
+
ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture" ), _SCS("set_texture"),_SCS("get_texture") );
ADD_PROPERTYNZ( PropertyInfo( Variant::RECT2, "region_rect"), _SCS("set_region_rect"),_SCS("get_region_rect"));
ADD_PROPERTYI( PropertyInfo( Variant::REAL, "margin/left", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_margin_size"),_SCS("get_margin_size"), MARGIN_LEFT );
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 1893bfe524..2fa00c7da7 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -526,8 +526,11 @@ uint32_t AtlasTexture::get_flags() const{
void AtlasTexture::set_atlas(const Ref<Texture>& p_atlas){
+ if (atlas==p_atlas)
+ return;
atlas=p_atlas;
emit_changed();
+ emit_signal("atlas_changed");
}
Ref<Texture> AtlasTexture::get_atlas() const{
@@ -569,6 +572,8 @@ void AtlasTexture::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_margin","margin"),&AtlasTexture::set_margin);
ObjectTypeDB::bind_method(_MD("get_margin"),&AtlasTexture::get_margin);
+ ADD_SIGNAL(MethodInfo("atlas_changed"));
+
ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "atlas", PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_atlas"),_SCS("get_atlas") );
ADD_PROPERTY( PropertyInfo( Variant::RECT2, "region"), _SCS("set_region"),_SCS("get_region") );
ADD_PROPERTY( PropertyInfo( Variant::RECT2, "margin"), _SCS("set_margin"),_SCS("get_margin") );
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 0f8ddafb20..f9bedc7660 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -182,6 +182,16 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) {
if (ED_IS_SHORTCUT("editor/distraction_free_mode", p_event)) {
set_distraction_free_mode(!get_distraction_free_mode());
}
+ if (ED_IS_SHORTCUT("editor/next_tab", p_event)) {
+ int next_tab = editor_data.get_edited_scene() + 1;
+ next_tab %= editor_data.get_edited_scene_count();
+ _scene_tab_changed(next_tab);
+ }
+ if (ED_IS_SHORTCUT("editor/prev_tab", p_event)) {
+ int next_tab = editor_data.get_edited_scene() - 1;
+ next_tab = next_tab >= 0 ? next_tab : editor_data.get_edited_scene_count() - 1;
+ _scene_tab_changed(next_tab);
+ }
switch(p_event.key.scancode) {
@@ -205,18 +215,7 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) {
case KEY_F6: _menu_option_confirm(RUN_PLAY_SCENE,true); break;
//case KEY_F7: _menu_option_confirm(RUN_PAUSE,true); break;
case KEY_F8: _menu_option_confirm(RUN_STOP,true); break;*/
- case KEY_TAB:
- if (p_event.key.mod.command) {
- int current_tab = editor_data.get_edited_scene();
- int tab_offset = 1;
- if (p_event.key.mod.shift)
- tab_offset = -1;
- int next_tab = current_tab + tab_offset;
- next_tab = next_tab >= 0 ? next_tab : editor_data.get_edited_scene_count() - 1;
- next_tab %= editor_data.get_edited_scene_count();
- _scene_tab_changed(next_tab);
- }
- break;
+
}
}
@@ -5502,6 +5501,11 @@ EditorNode::EditorNode() {
ED_SHORTCUT("editor/fullscreen_mode",TTR("Fullscreen Mode"),KEY_MASK_SHIFT|KEY_F11);
ED_SHORTCUT("editor/distraction_free_mode",TTR("Distraction Free Mode"),KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_F11);
+
+ ED_SHORTCUT("editor/next_tab", TTR("Next tab"), KEY_MASK_CMD+KEY_TAB);
+ ED_SHORTCUT("editor/prev_tab", TTR("Previous tab"), KEY_MASK_CMD+KEY_MASK_SHIFT+KEY_TAB);
+
+
Separator *vs=NULL;
file_menu->set_tooltip(TTR("Operations with scene files."));
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 457aecba4a..b89863289a 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -423,7 +423,7 @@ void EditorSettings::setup_network() {
if (ip=="127.0.0.1")
continue;
- if (lip!="")
+ if (lip=="")
lip=ip;
if (ip==current)
lip=current; //so it saves
diff --git a/tools/editor/icons/2x/icon_gizmo_directional_light.png b/tools/editor/icons/2x/icon_gizmo_directional_light.png
index 5f812845df..0d02788040 100644
--- a/tools/editor/icons/2x/icon_gizmo_directional_light.png
+++ b/tools/editor/icons/2x/icon_gizmo_directional_light.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_gizmo_light.png b/tools/editor/icons/2x/icon_gizmo_light.png
index 3b1b15f4b6..2ba9689107 100644
--- a/tools/editor/icons/2x/icon_gizmo_light.png
+++ b/tools/editor/icons/2x/icon_gizmo_light.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_gizmo_listener.png b/tools/editor/icons/2x/icon_gizmo_listener.png
index 9fbf16c015..bc2908824d 100644
--- a/tools/editor/icons/2x/icon_gizmo_listener.png
+++ b/tools/editor/icons/2x/icon_gizmo_listener.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_gizmo_spatial_sample_player.png b/tools/editor/icons/2x/icon_gizmo_spatial_sample_player.png
index f67beb14c5..78a88c55c1 100644
--- a/tools/editor/icons/2x/icon_gizmo_spatial_sample_player.png
+++ b/tools/editor/icons/2x/icon_gizmo_spatial_sample_player.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_gizmo_spatial_stream_player.png b/tools/editor/icons/2x/icon_gizmo_spatial_stream_player.png
index feed191fc1..631f03e874 100644
--- a/tools/editor/icons/2x/icon_gizmo_spatial_stream_player.png
+++ b/tools/editor/icons/2x/icon_gizmo_spatial_stream_player.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_zoom_less.png b/tools/editor/icons/2x/icon_zoom_less.png
new file mode 100644
index 0000000000..d483db55ce
--- /dev/null
+++ b/tools/editor/icons/2x/icon_zoom_less.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_zoom_more.png b/tools/editor/icons/2x/icon_zoom_more.png
new file mode 100644
index 0000000000..8f9ef77849
--- /dev/null
+++ b/tools/editor/icons/2x/icon_zoom_more.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_zoom_reset.png b/tools/editor/icons/2x/icon_zoom_reset.png
new file mode 100644
index 0000000000..092215b3e2
--- /dev/null
+++ b/tools/editor/icons/2x/icon_zoom_reset.png
Binary files differ
diff --git a/tools/editor/icons/icon_gizmo_directional_light.png b/tools/editor/icons/icon_gizmo_directional_light.png
index a716930687..bdeb120b43 100644
--- a/tools/editor/icons/icon_gizmo_directional_light.png
+++ b/tools/editor/icons/icon_gizmo_directional_light.png
Binary files differ
diff --git a/tools/editor/icons/icon_gizmo_light.png b/tools/editor/icons/icon_gizmo_light.png
index 396ae8615d..be9903f8c2 100644
--- a/tools/editor/icons/icon_gizmo_light.png
+++ b/tools/editor/icons/icon_gizmo_light.png
Binary files differ
diff --git a/tools/editor/icons/icon_gizmo_listener.png b/tools/editor/icons/icon_gizmo_listener.png
index 218736e491..47e978be61 100644
--- a/tools/editor/icons/icon_gizmo_listener.png
+++ b/tools/editor/icons/icon_gizmo_listener.png
Binary files differ
diff --git a/tools/editor/icons/icon_gizmo_spatial_sample_player.png b/tools/editor/icons/icon_gizmo_spatial_sample_player.png
index 71e4f13f1c..0119dbc433 100644
--- a/tools/editor/icons/icon_gizmo_spatial_sample_player.png
+++ b/tools/editor/icons/icon_gizmo_spatial_sample_player.png
Binary files differ
diff --git a/tools/editor/icons/icon_gizmo_spatial_stream_player.png b/tools/editor/icons/icon_gizmo_spatial_stream_player.png
index 04144aec26..6a4f85d550 100644
--- a/tools/editor/icons/icon_gizmo_spatial_stream_player.png
+++ b/tools/editor/icons/icon_gizmo_spatial_stream_player.png
Binary files differ
diff --git a/tools/editor/icons/icon_zoom_less.png b/tools/editor/icons/icon_zoom_less.png
new file mode 100644
index 0000000000..fd8ef9075e
--- /dev/null
+++ b/tools/editor/icons/icon_zoom_less.png
Binary files differ
diff --git a/tools/editor/icons/icon_zoom_more.png b/tools/editor/icons/icon_zoom_more.png
new file mode 100644
index 0000000000..8e818db1ee
--- /dev/null
+++ b/tools/editor/icons/icon_zoom_more.png
Binary files differ
diff --git a/tools/editor/icons/icon_zoom_reset.png b/tools/editor/icons/icon_zoom_reset.png
new file mode 100644
index 0000000000..fa8a9d197e
--- /dev/null
+++ b/tools/editor/icons/icon_zoom_reset.png
Binary files differ
diff --git a/tools/editor/icons/source/icon_gizmo_directional_light.svg b/tools/editor/icons/source/icon_gizmo_directional_light.svg
index 0682c270ac..65202877a0 100644
--- a/tools/editor/icons/source/icon_gizmo_directional_light.svg
+++ b/tools/editor/icons/source/icon_gizmo_directional_light.svg
@@ -9,15 +9,15 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="32"
- height="32"
- viewBox="0 0 32 32"
+ width="128"
+ height="128"
+ viewBox="0 0 128 128"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_dependency_changed_hl.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_gizmo_directional_light.png"
+ inkscape:export-xdpi="360"
+ inkscape:export-ydpi="360"
sodipodi:docname="icon_gizmo_directional_light.svg">
<defs
id="defs4" />
@@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="11.313708"
- inkscape:cx="13.90442"
- inkscape:cy="22.349302"
+ inkscape:zoom="4"
+ inkscape:cx="69.526732"
+ inkscape:cy="53.07939"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
@@ -68,106 +68,65 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(0,-1020.3622)">
+ transform="translate(0,-924.3622)">
<circle
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4156"
- cx="16"
- cy="1036.3622"
- r="7.0000172" />
- <rect
+ cx="64"
+ cy="988.36218"
+ r="24.000017" />
+ <path
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 64,4 a 8.0000172,8.0000172 0 0 0 -8,8 l 0,12 a 7.9999828,7.9999828 0 0 0 8,8 7.9999828,7.9999828 0 0 0 8,-8 L 72,12 A 8.0000172,8.0000172 0 0 0 64,4 Z"
+ transform="translate(0,924.3622)"
id="rect4169"
- width="4"
- height="5.0000172"
- x="14"
- y="1021.3622"
- rx="0"
- ry="0"
- inkscape:transform-center-y="-12.500009" />
- <rect
- inkscape:transform-center-y="-8.8388501"
- ry="0"
- rx="0"
- y="706.505"
- x="742.13245"
- height="5.0000172"
- width="4"
- id="rect4171"
+ inkscape:connector-curvature="0"
+ inkscape:transform-center-y="-46" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4148"
+ d="m 124,988.3622 a 8.0000172,8.0000172 0 0 0 -8,-8 l -12,0 a 7.9999828,7.9999828 0 0 0 -8,8 7.9999828,7.9999828 0 0 0 8,8 l 12,0 a 8.0000172,8.0000172 0 0 0 8,-8 z"
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
- transform="matrix(0.70710678,0.70710678,-0.70710678,0.70710678,0,0)"
- inkscape:transform-center-x="-8.8388459" />
- <rect
- inkscape:transform-center-x="-12.500018"
- transform="matrix(0,1,-1,0,0,0)"
+ inkscape:transform-center-x="-46" />
+ <path
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
- id="rect4173"
- width="4"
- height="5.0000172"
- x="1034.3622"
- y="-31.000027"
- rx="0"
- ry="0"
- inkscape:transform-center-y="-1.754751e-05" />
- <rect
- inkscape:transform-center-y="8.8388073"
- ry="0"
- rx="0"
- y="-759.13245"
- x="719.505"
- height="5.0000172"
- width="4"
- id="rect4175"
+ d="m 64,1048.3622 a 8.0000172,8.0000172 0 0 0 8,-8 l 0,-12 a 7.9999828,7.9999828 0 0 0 -8,-8 7.9999828,7.9999828 0 0 0 -8,8 l 0,12 a 8.0000172,8.0000172 0 0 0 8,8 z"
+ id="path4150"
+ inkscape:connector-curvature="0"
+ inkscape:transform-center-y="46" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4152"
+ d="m 4,988.3622 a 8.0000172,8.0000172 0 0 0 8,8 l 12,0 a 7.9999828,7.9999828 0 0 0 8,-8 7.9999828,7.9999828 0 0 0 -8,-8 l -12,0 a 8.0000172,8.0000172 0 0 0 -8,8 z"
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
- transform="matrix(-0.70710678,0.70710678,-0.70710678,-0.70710678,0,0)"
- inkscape:transform-center-x="-8.8388458" />
- <rect
- inkscape:transform-center-x="-2.6589615e-05"
- transform="scale(-1,-1)"
+ inkscape:transform-center-x="46" />
+ <path
+ inkscape:transform-center-y="-32.526909"
+ inkscape:connector-curvature="0"
+ id="path4154"
+ d="m 106.42641,945.93579 a 8.0000172,8.0000172 0 0 0 -11.313712,0 l -8.485281,8.48528 a 7.9999828,7.9999828 0 0 0 0,11.31371 7.9999828,7.9999828 0 0 0 11.313708,0 l 8.485285,-8.48528 a 8.0000172,8.0000172 0 0 0 0,-11.31371 z"
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
- id="rect4177"
- width="4"
- height="5.0000172"
- x="-18.000027"
- y="-1051.3622"
- rx="0"
- ry="0"
- inkscape:transform-center-y="12.499974" />
- <rect
- inkscape:transform-center-y="8.8388074"
- ry="0"
- rx="0"
- y="-736.505"
- x="-746.13245"
- height="5.0000172"
- width="4"
- id="rect4179"
+ inkscape:transform-center-x="-32.526906" />
+ <path
+ inkscape:transform-center-x="-32.526906"
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
- transform="matrix(-0.70710678,-0.70710678,0.70710678,-0.70710678,0,0)"
- inkscape:transform-center-x="8.8388116" />
- <rect
- inkscape:transform-center-x="12.499964"
- transform="matrix(0,-1,1,0,0,0)"
+ d="m 106.42641,1030.7886 a 8.0000172,8.0000172 0 0 0 0,-11.3137 l -8.485285,-8.4853 a 7.9999828,7.9999828 0 0 0 -11.313708,0 7.9999828,7.9999828 0 0 0 0,11.3137 l 8.485281,8.4853 a 8.0000172,8.0000172 0 0 0 11.313712,0 z"
+ id="path4157"
+ inkscape:connector-curvature="0"
+ inkscape:transform-center-y="32.526894" />
+ <path
+ inkscape:transform-center-y="32.526893"
+ inkscape:connector-curvature="0"
+ id="path4159"
+ d="m 21.573593,1030.7886 a 8.0000172,8.0000172 0 0 0 11.313709,0 l 8.485281,-8.4853 a 7.9999828,7.9999828 0 0 0 0,-11.3137 7.9999828,7.9999828 0 0 0 -11.313708,0 l -8.485282,8.4853 a 8.0000172,8.0000172 0 0 0 0,11.3137 z"
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
- id="rect4181"
- width="4"
- height="5.0000172"
- x="-1038.3622"
- y="1.0000273"
- rx="0"
- ry="0"
- inkscape:transform-center-y="-1.7409218e-05" />
- <rect
- inkscape:transform-center-y="-8.83885"
- ry="0"
- rx="0"
- y="729.13245"
- x="-723.505"
- height="5.0000172"
- width="4"
- id="rect4183"
+ inkscape:transform-center-x="32.526905" />
+ <path
+ inkscape:transform-center-x="32.526905"
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
- transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,0,0)"
- inkscape:transform-center-x="8.8388113" />
+ d="m 21.573593,945.93579 a 8.0000172,8.0000172 0 0 0 0,11.31371 l 8.485282,8.48528 a 7.9999828,7.9999828 0 0 0 11.313708,0 7.9999828,7.9999828 0 0 0 0,-11.31371 l -8.485281,-8.48528 a 8.0000172,8.0000172 0 0 0 -11.313709,0 z"
+ id="path4161"
+ inkscape:connector-curvature="0"
+ inkscape:transform-center-y="-32.526908" />
</g>
</svg>
diff --git a/tools/editor/icons/source/icon_gizmo_light.svg b/tools/editor/icons/source/icon_gizmo_light.svg
index c9ce60273a..c42d6e1f76 100644
--- a/tools/editor/icons/source/icon_gizmo_light.svg
+++ b/tools/editor/icons/source/icon_gizmo_light.svg
@@ -9,9 +9,9 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="32"
- height="32"
- viewBox="0 0 32 32"
+ width="128"
+ height="128"
+ viewBox="0 0 128 128"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
@@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="15.999999"
- inkscape:cx="18.311796"
- inkscape:cy="18.635805"
+ inkscape:zoom="3.9999998"
+ inkscape:cx="47.738891"
+ inkscape:cy="58.814006"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
@@ -68,23 +68,23 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(0,-1020.3622)">
+ transform="translate(0,-924.3622)">
<path
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
- d="M 16 1 A 10.000017 10.000017 0 0 0 6 11 A 10.000017 10.000017 0 0 0 16 21 A 10.000017 10.000017 0 0 0 26 11 A 10.000017 10.000017 0 0 0 16 1 z M 16 4 A 7 7 0 0 1 23 11 A 7 7 0 0 1 16 18 A 7 7 0 0 1 9 11 A 7 7 0 0 1 16 4 z "
- transform="translate(0,1020.3622)"
- id="path4162" />
+ d="m 64,930.3622 a 40.000068,40.000068 0 0 0 -40,40 40.000068,40.000068 0 0 0 40,40 40.000068,40.000068 0 0 0 40,-40 40.000068,40.000068 0 0 0 -40,-40 z m 0,12 a 28,28 0 0 1 28,28 28,28 0 0 1 -28,28 28,28 0 0 1 -28,-28 28,28 0 0 1 28,-28 z"
+ id="path4162"
+ inkscape:connector-curvature="0" />
<path
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
- d="M 12 19 L 12 24 A 2 2 0 0 0 14 26 L 18 26 A 2 2 0 0 0 20 24 L 20 19 L 12 19 z "
- transform="translate(0,1020.3622)"
- id="rect4164" />
+ d="m 48,1002.3622 0,20 a 8,8 0 0 0 8,8 l 16,0 a 8,8 0 0 0 8,-8 l 0,-20 -32,0 z"
+ id="rect4164"
+ inkscape:connector-curvature="0" />
<rect
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4168"
- width="4"
- height="2.0000174"
- x="14"
- y="1048.3622" />
+ width="16"
+ height="8.0000696"
+ x="56"
+ y="1038.3622" />
</g>
</svg>
diff --git a/tools/editor/icons/source/icon_gizmo_listener.svg b/tools/editor/icons/source/icon_gizmo_listener.svg
index a53b08af44..3667cbc69b 100644
--- a/tools/editor/icons/source/icon_gizmo_listener.svg
+++ b/tools/editor/icons/source/icon_gizmo_listener.svg
@@ -9,9 +9,9 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="32"
- height="32"
- viewBox="0 0 32 32"
+ width="128"
+ height="128"
+ viewBox="0 0 128 128"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
@@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="15.999999"
- inkscape:cx="4.4071843"
- inkscape:cy="17.118049"
+ inkscape:zoom="3.9999998"
+ inkscape:cx="53.348444"
+ inkscape:cy="75.110194"
inkscape:document-units="px"
inkscape:current-layer="g4175"
showgrid="true"
@@ -60,7 +60,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title />
+ <dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
@@ -68,33 +68,33 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(0,-1020.3622)">
+ transform="translate(0,-924.3622)">
<g
id="g4175"
transform="matrix(2,0,0,2,-16,-1040.3622)">
<path
inkscape:connector-curvature="0"
id="path4274"
- d="m 21.928203,1032.3622 -1.738281,1.0039 a 6,6 0 0 1 0.810547,2.9961 6,6 0 0 1 -0.808594,2.998 l 1.736328,1.002 a 8,8 0 0 0 0,-8 z"
+ d="m 63.712867,990.36221 -6.953133,4.0152 a 24.000031,23.999015 0 0 1 3.242193,11.98399 24.000031,23.999015 0 0 1 -3.234381,11.9917 l 6.945321,4.0076 a 32.000041,31.998687 0 0 0 0,-31.99849 z"
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
- y="1043.3622"
- x="11"
- height="2"
- width="1"
+ y="1034.3602"
+ x="19.999998"
+ height="7.9996719"
+ width="4.0000052"
id="rect4147"
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
id="path4149"
- d="m 14,1031.3622 a 5,5 0 0 0 -5,5 l 2,0 a 3,3 0 0 1 3,-3 3,3 0 0 1 3,3 l 2,0 a 5,5 0 0 0 -5,-5 z"
+ d="m 32.000015,986.3622 a 20.000026,19.999179 0 0 0 -20.000026,19.9992 l 8.00001,0 a 12.000015,11.999507 0 0 1 12.000016,-11.99959 12.000015,11.999507 0 0 1 12.000015,11.99959 l 8.00001,0 A 20.000026,19.999179 0 0 0 32.000015,986.3622 Z"
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="csc"
inkscape:connector-curvature="0"
id="path4155"
- d="m 18,1036.3622 c 0,4 -3,4 -3,5 0,3 -2,3 -3,3"
- style="fill:none;fill-rule:evenodd;stroke:#f7f5cf;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ d="m 48.000035,1006.3614 c 0,15.9993 -12.000015,15.9993 -12.000015,19.9993 0,11.9992 -8.00001,11.9992 -12.000016,11.9992"
+ style="fill:none;fill-rule:evenodd;stroke:#f7f5cf;stroke-width:7.99984121;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</g>
</svg>
diff --git a/tools/editor/icons/source/icon_gizmo_spatial_sample_player.svg b/tools/editor/icons/source/icon_gizmo_spatial_sample_player.svg
index 68375f9487..a734095268 100644
--- a/tools/editor/icons/source/icon_gizmo_spatial_sample_player.svg
+++ b/tools/editor/icons/source/icon_gizmo_spatial_sample_player.svg
@@ -9,9 +9,9 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="32"
- height="32"
- viewBox="0 0 32 32"
+ width="128"
+ height="128"
+ viewBox="0 0 128 128"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
@@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="15.999999"
- inkscape:cx="18.414591"
- inkscape:cy="16.81826"
+ inkscape:zoom="2"
+ inkscape:cx="7.8244495"
+ inkscape:cy="69.465609"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
@@ -71,26 +71,50 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(0,-1020.3622)">
+ transform="translate(0,-924.3622)">
<path
- style="fill:#f7f5cf;fill-opacity:1;fill-rule:evenodd;stroke:#f7f5cf;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 16,1024.3622 0,24 -8,-8 -4,0 0,-8 4,0 z"
+ style="fill:#f7f5cf;fill-opacity:1;fill-rule:evenodd;stroke:#f7f5cf;stroke-width:8;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 64.000015,940.3622 0,96.0012 -31.999993,-32.0004 -15.999996,0 0,-32.00043 15.999996,0 z"
id="path4143"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc" />
<rect
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843"
id="rect4145"
- width="3"
- height="8.0000172"
- x="20"
- y="1032.3622" />
+ width="11.999997"
+ height="32.000439"
+ x="80.000008"
+ y="972.36255" />
<rect
- y="1026.3622"
- x="26"
- height="19.999949"
- width="3"
+ y="948.36224"
+ x="104"
+ height="80.000717"
+ width="11.999997"
id="rect4147"
style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843" />
+ <circle
+ style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path4137"
+ cx="86"
+ cy="972.36218"
+ r="6" />
+ <circle
+ r="6"
+ cy="1002.3622"
+ cx="86"
+ id="circle4139"
+ style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <circle
+ style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="circle4141"
+ cx="110"
+ cy="1028.3622"
+ r="6" />
+ <circle
+ r="6"
+ cy="948.36218"
+ cx="110"
+ id="circle4143"
+ style="opacity:1;fill:#f7f5cf;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
</svg>
diff --git a/tools/editor/icons/source/icon_gizmo_spatial_stream_player.svg b/tools/editor/icons/source/icon_gizmo_spatial_stream_player.svg
index 5acff1ec76..c333641249 100644
--- a/tools/editor/icons/source/icon_gizmo_spatial_stream_player.svg
+++ b/tools/editor/icons/source/icon_gizmo_spatial_stream_player.svg
@@ -9,9 +9,9 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="32"
- height="32"
- viewBox="0 0 32 32"
+ width="128"
+ height="128"
+ viewBox="0 0 128 128"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
@@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="15.999999"
- inkscape:cx="18.768034"
- inkscape:cy="16.106066"
+ inkscape:zoom="5.6568542"
+ inkscape:cx="102.18566"
+ inkscape:cy="68.674719"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
@@ -71,11 +71,11 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(0,-1020.3622)">
+ transform="translate(0,-924.3622)">
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#f7f5cf;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- d="M 23.941406 2.0019531 A 2.0002 2.0002 0 0 0 23.451172 2.0761719 L 9.4511719 6.0761719 A 2.0002 2.0002 0 0 0 8 8 L 8 20.029297 A 4.5000086 4.5000086 0 0 0 7.5 20 A 4.5000086 4.5000086 0 0 0 3 24.5 A 4.5000086 4.5000086 0 0 0 7.5 29 A 4.5000086 4.5000086 0 0 0 11.96875 25 L 12 25 L 12 24.5 L 12 9.5097656 L 22 6.6523438 L 22 16.03125 A 4.5 4.5 0 0 0 21.5 16 A 4.5 4.5 0 0 0 17 20.5 A 4.5 4.5 0 0 0 21.5 25 A 4.5 4.5 0 0 0 25.96875 21 L 26 21 L 26 20.5 L 26 4 A 2.0002 2.0002 0 0 0 23.941406 2.0019531 z "
- transform="translate(0,1020.3622)"
- id="path4187" />
+ d="m 99.765624,934.3602 a 8.0008,8.001126 0 0 0 -1.960936,0.296 l -56,16.0004 A 8.0008,8.001126 0 0 0 36,958.353 l 0,48.1192 a 18.000034,18.000768 0 0 0 -2,-0.116 18.000034,18.000768 0 0 0 -18,18.0008 18.000034,18.000768 0 0 0 18,18.0008 18.000034,18.000768 0 0 0 17.875,-16.0008 l 0.125,0 0,-2 0,-59.9632 40,-11.4304 0,37.5172 a 18,18.000734 0 0 0 -2,-0.124 18,18.000734 0 0 0 -18,18.0008 18,18.000734 0 0 0 18,18.0004 18,18.000734 0 0 0 17.875,-16.0004 l 0.125,0 0,-2 0,-66.0028 a 8.0008,8.001126 0 0 0 -8.234376,-7.9924 z"
+ id="path4187"
+ inkscape:connector-curvature="0" />
</g>
</svg>
diff --git a/tools/editor/icons/source/icon_zoom_more.svg b/tools/editor/icons/source/icon_zoom_more.svg
new file mode 100644
index 0000000000..87acdfb021
--- /dev/null
+++ b/tools/editor/icons/source/icon_zoom_more.svg
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_zoom.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_zoom_more.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.627417"
+ inkscape:cx="3.7772222"
+ inkscape:cy="13.690414"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1018"
+ inkscape:window-x="-8"
+ inkscape:window-y="-8"
+ inkscape:window-maximized="1">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <g
+ id="layer1-6"
+ inkscape:label="Capa 1"
+ transform="translate(-201.5751,205.0256)">
+ <g
+ inkscape:label="Layer 1"
+ id="layer1-0-4"
+ transform="matrix(48.459085,0,0,53.967813,-126.63031,-55835.691)">
+ <g
+ transform="translate(0.51853114,-0.01988754)"
+ id="g4182-8">
+ <rect
+ style="fill:#e0e0e0;fill-opacity:0.99607843"
+ id="rect4167"
+ width="0.042994563"
+ height="0.26204652"
+ x="6.3978949"
+ y="1050.0524"
+ rx="0"
+ ry="0" />
+ <rect
+ ry="0"
+ rx="0"
+ y="1050.165"
+ x="6.2806396"
+ height="0.040943757"
+ width="0.28011176"
+ id="rect4169-6"
+ style="fill:#e0e0e0;fill-opacity:0.99607843" />
+ </g>
+ </g>
+ </g>
+ </g>
+</svg>
diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp
index 57db19b736..8515008982 100644
--- a/tools/editor/plugins/texture_region_editor_plugin.cpp
+++ b/tools/editor/plugins/texture_region_editor_plugin.cpp
@@ -29,21 +29,30 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "core/core_string_names.h"
#include "texture_region_editor_plugin.h"
#include "scene/gui/check_box.h"
#include "os/input.h"
#include "os/keyboard.h"
+void draw_margin_line(Control *edit_draw, Vector2 from, Vector2 to){
+ Vector2 line = (to-from).normalized() * 10;
+ while ((to - from).length_squared() > 200) {
+ edit_draw->draw_line(from, from + line,Color(0.97, 0.2, 0.2),2);
+ from += line*2;
+ }
+}
+
void TextureRegionEditor::_region_draw()
{
Ref<Texture> base_tex = NULL;
- if(node_type == "Sprite" && node_sprite)
+ if(node_sprite)
base_tex = node_sprite->get_texture();
- else if(node_type == "Patch9Frame" && node_patch9)
+ else if(node_patch9)
base_tex = node_patch9->get_texture();
- else if(node_type == "StyleBoxTexture" && obj_styleBox)
+ else if(obj_styleBox.is_valid())
base_tex = obj_styleBox->get_texture();
- else if(node_type == "AtlasTexture" && atlas_tex)
+ else if(atlas_tex.is_valid())
base_tex = atlas_tex->get_atlas();
if (base_tex.is_null())
return;
@@ -57,29 +66,63 @@ void TextureRegionEditor::_region_draw()
edit_draw->draw_texture(base_tex,Point2());
VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(),Matrix32());
- if (snap_show_grid) {
+ if (snap_mode == SNAP_GRID) {
Size2 s = edit_draw->get_size();
int last_cell;
if (snap_step.x!=0) {
- for(int i=0;i<s.width;i++) {
- int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(i,0)).x-snap_offset.x)/snap_step.x));
- if (i==0)
+ if (snap_separation.x == 0)
+ for(int i=0;i<s.width;i++) {
+ int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(i,0)).x-snap_offset.x)/snap_step.x));
+ if (i==0)
+ last_cell=cell;
+ if (last_cell!=cell)
+ edit_draw->draw_line(Point2(i,0),Point2(i,s.height),Color(0.3,0.7,1,0.3));
last_cell=cell;
- if (last_cell!=cell)
- edit_draw->draw_line(Point2(i,0),Point2(i,s.height),Color(0.3,0.7,1,0.3));
- last_cell=cell;
- }
+ }
+ else
+ for(int i=0;i<s.width;i++) {
+ int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(i,0)).x-snap_offset.x)/(snap_step.x+snap_separation.x)));
+ if (i==0)
+ last_cell=cell;
+ if (last_cell!=cell)
+ edit_draw->draw_rect(Rect2(i-snap_separation.x*draw_zoom,0,snap_separation.x*draw_zoom,s.height),Color(0.3,0.7,1,0.3));
+ last_cell=cell;
+ }
}
if (snap_step.y!=0) {
- for(int i=0;i<s.height;i++) {
- int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(0,i)).y-snap_offset.y)/snap_step.y));
- if (i==0)
+ if (snap_separation.y == 0)
+ for(int i=0;i<s.height;i++) {
+ int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(0,i)).y-snap_offset.y)/snap_step.y));
+ if (i==0)
+ last_cell=cell;
+ if (last_cell!=cell)
+ edit_draw->draw_line(Point2(0,i),Point2(s.width,i),Color(0.3,0.7,1,0.3));
last_cell=cell;
- if (last_cell!=cell)
- edit_draw->draw_line(Point2(0,i),Point2(s.width,i),Color(0.3,0.7,1,0.3));
- last_cell=cell;
+ }
+ else
+ for(int i=0;i<s.height;i++) {
+ int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(0,i)).y-snap_offset.y)/(snap_step.y+snap_separation.y)));
+ if (i==0)
+ last_cell=cell;
+ if (last_cell!=cell)
+ edit_draw->draw_rect(Rect2(0,i-snap_separation.y*draw_zoom,s.width,snap_separation.y*draw_zoom),Color(0.3,0.7,1,0.3));
+ last_cell=cell;
+ }
+ }
+ } else if (snap_mode == SNAP_AUTOSLICE) {
+ for (List<Rect2>::Element *E = autoslice_cache.front();E;E=E->next()) {
+ Rect2 r = E->get();
+ Vector2 endpoints[4]={
+ mtx.basis_xform(r.pos),
+ mtx.basis_xform(r.pos+Vector2(r.size.x,0)),
+ mtx.basis_xform(r.pos+r.size),
+ mtx.basis_xform(r.pos+Vector2(0,r.size.y))
+ };
+ for(int i=0;i<4;i++) {
+ int next = (i+1)%4;
+ edit_draw->draw_line(endpoints[i]-draw_ofs, endpoints[next]-draw_ofs, Color(0.3,0.7,1,1) , 2);
}
}
}
@@ -96,8 +139,6 @@ void TextureRegionEditor::_region_draw()
mtx.basis_xform(rect.pos+Vector2(0,rect.size.y))
};
Color color(0.9,0.5,0.5);
- if(this->editing_region == REGION_PATCH_MARGIN)
- color = Color(0.21, 0.79, 0.31);
for(int i=0;i<4;i++) {
int prev = (i+3)%4;
@@ -108,12 +149,14 @@ void TextureRegionEditor::_region_draw()
edit_draw->draw_line(endpoints[i]-draw_ofs, endpoints[next]-draw_ofs, color , 2);
- edit_draw->draw_texture(select_handle,(endpoints[i]+ofs-(select_handle->get_size()/2)).floor()-draw_ofs);
+ if (snap_mode != SNAP_AUTOSLICE)
+ edit_draw->draw_texture(select_handle,(endpoints[i]+ofs-(select_handle->get_size()/2)).floor()-draw_ofs);
ofs = (endpoints[next]-endpoints[i])/2;
ofs += (endpoints[next]-endpoints[i]).tangent().normalized()*(select_handle->get_size().width/2);
- edit_draw->draw_texture(select_handle,(endpoints[i]+ofs-(select_handle->get_size()/2)).floor()-draw_ofs);
+ if (snap_mode != SNAP_AUTOSLICE)
+ edit_draw->draw_texture(select_handle,(endpoints[i]+ofs-(select_handle->get_size()/2)).floor()-draw_ofs);
scroll_rect.expand_to(endpoints[i]);
}
@@ -132,6 +175,31 @@ void TextureRegionEditor::_region_draw()
vscroll->set_val(draw_ofs.y);
vscroll->set_step(0.001);
updating_scroll=false;
+
+ float margins[4];
+ if (node_patch9 || obj_styleBox.is_valid()) {
+ if (node_patch9) {
+ margins[0] = node_patch9->get_patch_margin(MARGIN_TOP);
+ margins[1] = node_patch9->get_patch_margin(MARGIN_BOTTOM);
+ margins[2] = node_patch9->get_patch_margin(MARGIN_LEFT);
+ margins[3] = node_patch9->get_patch_margin(MARGIN_RIGHT);
+ } else if (obj_styleBox.is_valid()) {
+ margins[0] = obj_styleBox->get_margin_size(MARGIN_TOP);
+ margins[1] = obj_styleBox->get_margin_size(MARGIN_BOTTOM);
+ margins[2] = obj_styleBox->get_margin_size(MARGIN_LEFT);
+ margins[3] = obj_styleBox->get_margin_size(MARGIN_RIGHT);
+ }
+ Vector2 pos[4] = {
+ mtx.basis_xform(Vector2(0,margins[0]))+Vector2(0,endpoints[0].y-draw_ofs.y),
+ -mtx.basis_xform(Vector2(0,margins[1]))+Vector2(0,endpoints[2].y-draw_ofs.y),
+ mtx.basis_xform(Vector2(margins[2],0))+Vector2(endpoints[0].x-draw_ofs.x,0),
+ -mtx.basis_xform(Vector2(margins[3],0))+Vector2(endpoints[2].x-draw_ofs.x,0)};
+
+ draw_margin_line(edit_draw,pos[0],pos[0]+Vector2(edit_draw->get_size().x,0));
+ draw_margin_line(edit_draw,pos[1],pos[1]+Vector2(edit_draw->get_size().x,0));
+ draw_margin_line(edit_draw,pos[2],pos[2]+Vector2(0,edit_draw->get_size().y));
+ draw_margin_line(edit_draw,pos[3],pos[3]+Vector2(0,edit_draw->get_size().y));
+ }
}
void TextureRegionEditor::_region_input(const InputEvent& p_input)
@@ -153,84 +221,176 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input)
if (p_input.type==InputEvent::MOUSE_BUTTON) {
-
const InputEventMouseButton &mb=p_input.mouse_button;
if (mb.button_index==BUTTON_LEFT) {
-
if (mb.pressed) {
-
- drag_from=mtx.affine_inverse().xform(Vector2(mb.x,mb.y));
- drag_from=snap_point(drag_from);
- 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)
- rect_prev=obj_styleBox->get_region_rect();
-
- drag_index=-1;
- for(int i=0;i<8;i++) {
-
- Vector2 tuv=endpoints[i];
- if (tuv.distance_to(Vector2(mb.x,mb.y))<8) {
- drag_index=i;
- creating = false;
+ if (node_patch9 || obj_styleBox.is_valid()) {
+ edited_margin = -1;
+ float margins[4];
+ if (node_patch9) {
+ margins[0] = node_patch9->get_patch_margin(MARGIN_TOP);
+ margins[1] = node_patch9->get_patch_margin(MARGIN_BOTTOM);
+ margins[2] = node_patch9->get_patch_margin(MARGIN_LEFT);
+ margins[3] = node_patch9->get_patch_margin(MARGIN_RIGHT);
+ } else if (obj_styleBox.is_valid()) {
+ margins[0] = obj_styleBox->get_margin_size(MARGIN_TOP);
+ margins[1] = obj_styleBox->get_margin_size(MARGIN_BOTTOM);
+ margins[2] = obj_styleBox->get_margin_size(MARGIN_LEFT);
+ margins[3] = obj_styleBox->get_margin_size(MARGIN_RIGHT);
+ }
+ Vector2 pos[4] = {
+ mtx.basis_xform(rect.pos+Vector2(0,margins[0]))-draw_ofs,
+ mtx.basis_xform(rect.pos+rect.size-Vector2(0,margins[1]))-draw_ofs,
+ mtx.basis_xform(rect.pos+Vector2(margins[2],0))-draw_ofs,
+ mtx.basis_xform(rect.pos+rect.size-Vector2(margins[3],0))-draw_ofs};
+ if (Math::abs(mb.y - pos[0].y) < 8) {
+ edited_margin = 0;
+ prev_margin = margins[0];
+ } else if (Math::abs(mb.y - pos[1].y) < 8) {
+ edited_margin = 1;
+ prev_margin = margins[1];
+ } else if (Math::abs(mb.x - pos[2].x) < 8) {
+ edited_margin = 2;
+ prev_margin = margins[2];
+ } else if (Math::abs(mb.x - pos[3].x) < 8) {
+ edited_margin = 3;
+ prev_margin = margins[3];
+ }
+ if (edited_margin >= 0) {
+ drag_from=Vector2(mb.x,mb.y);
+ drag=true;
}
}
+ if ( edited_margin < 0 && snap_mode == SNAP_AUTOSLICE) {
+ Vector2 point = mtx.affine_inverse().xform(Vector2(mb.x,mb.y));
+ for (List<Rect2>::Element *E=autoslice_cache.front();E;E=E->next()) {
+ if (E->get().has_point(point)) {
+ rect = E->get();
+ if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)&&!(Input::get_singleton()->is_key_pressed(KEY_SHIFT|KEY_ALT))) {
+ Rect2 r;
+ if(node_sprite )
+ r=node_sprite->get_region_rect();
+ else if(node_patch9)
+ r=node_patch9->get_region_rect();
+ else if(obj_styleBox.is_valid())
+ r=obj_styleBox->get_region_rect();
+ else if(atlas_tex.is_valid())
+ r =atlas_tex->get_region();
+ rect.expand_to(r.pos);
+ rect.expand_to(r.pos+r.size);
+ }
+ undo_redo->create_action("Set Region Rect");
+ if(node_sprite){
+ undo_redo->add_do_method(node_sprite ,"set_region_rect",rect);
+ undo_redo->add_undo_method(node_sprite,"set_region_rect",node_sprite->get_region_rect());
+ } else if(node_patch9){
+ undo_redo->add_do_method(node_patch9 ,"set_region_rect",rect);
+ undo_redo->add_undo_method(node_patch9,"set_region_rect",node_patch9->get_region_rect());
+ } else if (obj_styleBox.is_valid()) {
+ undo_redo->add_do_method(obj_styleBox.ptr(),"set_region_rect",rect);
+ undo_redo->add_undo_method(obj_styleBox.ptr(),"set_region_rect",obj_styleBox->get_region_rect());
+ } else if (atlas_tex.is_valid()) {
+ undo_redo->add_do_method(atlas_tex.ptr(),"set_region",rect);
+ undo_redo->add_undo_method(atlas_tex.ptr(),"set_region",atlas_tex->get_region());
+ }
+ undo_redo->add_do_method(edit_draw,"update");
+ undo_redo->add_undo_method(edit_draw,"update");
+ undo_redo->commit_action();
+ break;
+ }
+ }
+ } else if (edited_margin < 0) {
+ print_line("EDIT RECTANGLE!!!");
+ drag_from=mtx.affine_inverse().xform(Vector2(mb.x,mb.y));
+ if (snap_mode == SNAP_PIXEL)
+ drag_from = drag_from.snapped(Vector2(1,1));
+ else if (snap_mode == SNAP_GRID)
+ drag_from=snap_point(drag_from);
+ drag=true;
+ if(node_sprite )
+ rect_prev=node_sprite->get_region_rect();
+ else if(node_patch9)
+ rect_prev=node_patch9->get_region_rect();
+ else if(obj_styleBox.is_valid())
+ rect_prev=obj_styleBox->get_region_rect();
+ else if(atlas_tex.is_valid())
+ rect_prev=atlas_tex->get_region();
+
+ for (int i=0; i<8;i++) {
+ Vector2 tuv=endpoints[i];
+ if (tuv.distance_to(Vector2(mb.x,mb.y))<8) {
+ drag_index=i;
+ }
+ }
- if (drag_index==-1) {
- creating = true;
- rect = Rect2(drag_from,Size2());
+ if (drag_index==-1) {
+ creating = true;
+ rect = Rect2(drag_from,Size2());
+ }
}
} else if (drag) {
- if(editing_region == REGION_TEXTURE_REGION) {
- undo_redo->create_action("Set region_rect");
- if(node_type == "Sprite" && node_sprite ){
+ print_line("DRAGING!!!");
+ if (edited_margin >= 0) {
+ undo_redo->create_action("Set Margin");
+ static Margin m[4] = {MARGIN_TOP,MARGIN_BOTTOM,MARGIN_LEFT,MARGIN_RIGHT};
+ if (node_patch9) {
+ undo_redo->add_do_method(node_patch9 ,"set_patch_margin",m[edited_margin],node_patch9->get_patch_margin(m[edited_margin]));
+ undo_redo->add_undo_method(node_patch9,"set_patch_margin",m[edited_margin],prev_margin);
+ } else if (obj_styleBox.is_valid()) {
+ undo_redo->add_do_method(obj_styleBox.ptr() ,"set_margin_size",m[edited_margin],obj_styleBox->get_margin_size(m[edited_margin]));
+ undo_redo->add_undo_method(obj_styleBox.ptr(),"set_margin_size",m[edited_margin],prev_margin);
+ obj_styleBox->emit_signal(CoreStringNames::get_singleton()->changed);
+ }
+ edited_margin = -1;
+ } else {
+ undo_redo->create_action("Set Region Rect");
+ if(node_sprite){
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(atlas_tex.is_valid()){
+ undo_redo->add_do_method(atlas_tex.ptr() ,"set_region",atlas_tex->get_region());
+ undo_redo->add_undo_method(atlas_tex.ptr(),"set_region",rect_prev);
}
- else if(node_type == "Patch9Frame" && node_patch9){
+ else if(node_patch9){
+ } else if(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 (obj_styleBox.is_valid()) {
+ undo_redo->add_do_method(obj_styleBox.ptr() ,"set_region_rect",obj_styleBox->get_region_rect());
+ undo_redo->add_undo_method(obj_styleBox.ptr(),"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();
+ drag_index = -1;
}
+ undo_redo->add_do_method(edit_draw,"update");
+ undo_redo->add_undo_method(edit_draw,"update");
+ undo_redo->commit_action();
drag=false;
+ creating = false;
}
} else if (mb.button_index==BUTTON_RIGHT && mb.pressed) {
if (drag) {
drag=false;
- apply_rect(rect_prev);
- rect=rect_prev;
- edit_draw->update();
+ if (edited_margin >= 0) {
+ static Margin m[4] = {MARGIN_TOP,MARGIN_BOTTOM,MARGIN_LEFT,MARGIN_RIGHT};
+ if (node_patch9)
+ node_patch9->set_patch_margin(m[edited_margin],prev_margin);
+ if (obj_styleBox.is_valid())
+ obj_styleBox->set_margin_size(m[edited_margin],prev_margin);
+ edited_margin = -1;
+ } else {
+ apply_rect(rect_prev);
+ rect=rect_prev;
+ edit_draw->update();
+ drag_index = -1;
+ }
}
-
- } else if (mb.button_index==BUTTON_WHEEL_UP && mb.pressed) {
-
- zoom->set_val( zoom->get_val()/0.9 );
- } else if (mb.button_index==BUTTON_WHEEL_DOWN && mb.pressed) {
-
- zoom->set_val( zoom->get_val()*0.9);
}
-
} else if (p_input.type==InputEvent::MOUSE_MOTION) {
const InputEventMouseMotion &mm=p_input.mouse_motion;
@@ -243,67 +403,89 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input)
} else if (drag) {
- Vector2 new_pos = mtx.affine_inverse().xform(Vector2(mm.x,mm.y));
- new_pos = snap_point(new_pos);
-
- if (creating) {
- rect = Rect2(drag_from,Size2());
- rect.expand_to(new_pos);
- apply_rect(rect);
- edit_draw->update();
- return;
- }
-
- switch(drag_index) {
- case 0: {
- Vector2 p=rect_prev.pos+rect_prev.size;
- rect = Rect2(p,Size2());
- rect.expand_to(new_pos);
- apply_rect(rect);
- } break;
- case 1: {
- Vector2 p=rect_prev.pos+Vector2(0,rect_prev.size.y);
- rect = Rect2(p,Size2(rect_prev.size.x,0));
- rect.expand_to(new_pos);
- apply_rect(rect);
- } break;
- case 2: {
- Vector2 p=rect_prev.pos+Vector2(0,rect_prev.size.y);
- rect = Rect2(p,Size2());
- rect.expand_to(new_pos);
- apply_rect(rect);
- } break;
- case 3: {
- Vector2 p=rect_prev.pos;
- rect = Rect2(p,Size2(0,rect_prev.size.y));
- rect.expand_to(new_pos);
- apply_rect(rect);
- } break;
- case 4: {
- Vector2 p=rect_prev.pos;
- rect = Rect2(p,Size2());
- rect.expand_to(new_pos);
- apply_rect(rect);
- } break;
- case 5: {
- Vector2 p=rect_prev.pos;
- rect = Rect2(p,Size2(rect_prev.size.x,0));
- rect.expand_to(new_pos);
- apply_rect(rect);
- } break;
- case 6: {
- Vector2 p=rect_prev.pos+Vector2(rect_prev.size.x,0);
- rect = Rect2(p,Size2());
- rect.expand_to(new_pos);
- apply_rect(rect);
- } break;
- case 7: {
- Vector2 p=rect_prev.pos+Vector2(rect_prev.size.x,0);
- rect = Rect2(p,Size2(0,rect_prev.size.y));
+ if (edited_margin >= 0) {
+ float new_margin;
+ if (edited_margin == 0)
+ new_margin = prev_margin + (mm.y-drag_from.y) / draw_zoom;
+ else if (edited_margin == 1)
+ new_margin = prev_margin - (mm.y-drag_from.y) / draw_zoom;
+ else if (edited_margin == 2)
+ new_margin = prev_margin + (mm.x-drag_from.x) / draw_zoom;
+ else if (edited_margin == 3)
+ new_margin = prev_margin - (mm.x-drag_from.x) / draw_zoom;
+ if (new_margin < 0)
+ new_margin = 0;
+ static Margin m[4] = {MARGIN_TOP,MARGIN_BOTTOM,MARGIN_LEFT,MARGIN_RIGHT};
+ if (node_patch9)
+ node_patch9->set_patch_margin(m[edited_margin],new_margin);
+ if (obj_styleBox.is_valid())
+ obj_styleBox->set_margin_size(m[edited_margin],new_margin);
+ } else {
+ Vector2 new_pos = mtx.affine_inverse().xform(Vector2(mm.x,mm.y));
+ if (snap_mode == SNAP_PIXEL)
+ new_pos = new_pos.snapped(Vector2(1,1));
+ else if (snap_mode == SNAP_GRID)
+ new_pos=snap_point(new_pos);
+
+ if (creating) {
+ rect = Rect2(drag_from,Size2());
rect.expand_to(new_pos);
apply_rect(rect);
- } break;
+ edit_draw->update();
+ return;
+ }
+ switch(drag_index) {
+ case 0: {
+ Vector2 p=rect_prev.pos+rect_prev.size;
+ rect = Rect2(p,Size2());
+ rect.expand_to(new_pos);
+ apply_rect(rect);
+ } break;
+ case 1: {
+ Vector2 p=rect_prev.pos+Vector2(0,rect_prev.size.y);
+ rect = Rect2(p,Size2(rect_prev.size.x,0));
+ rect.expand_to(new_pos);
+ apply_rect(rect);
+ } break;
+ case 2: {
+ Vector2 p=rect_prev.pos+Vector2(0,rect_prev.size.y);
+ rect = Rect2(p,Size2());
+ rect.expand_to(new_pos);
+ apply_rect(rect);
+ } break;
+ case 3: {
+ Vector2 p=rect_prev.pos;
+ rect = Rect2(p,Size2(0,rect_prev.size.y));
+ rect.expand_to(new_pos);
+ apply_rect(rect);
+ } break;
+ case 4: {
+ Vector2 p=rect_prev.pos;
+ rect = Rect2(p,Size2());
+ rect.expand_to(new_pos);
+ apply_rect(rect);
+ } break;
+ case 5: {
+ Vector2 p=rect_prev.pos;
+ rect = Rect2(p,Size2(rect_prev.size.x,0));
+ rect.expand_to(new_pos);
+ apply_rect(rect);
+ } break;
+ case 6: {
+ Vector2 p=rect_prev.pos+Vector2(rect_prev.size.x,0);
+ rect = Rect2(p,Size2());
+ rect.expand_to(new_pos);
+ apply_rect(rect);
+ } break;
+ case 7: {
+ Vector2 p=rect_prev.pos+Vector2(rect_prev.size.x,0);
+ rect = Rect2(p,Size2(0,rect_prev.size.y));
+ rect.expand_to(new_pos);
+ apply_rect(rect);
+ } break;
+
+ }
}
edit_draw->update();
}
@@ -318,19 +500,21 @@ void TextureRegionEditor::_scroll_changed(float)
draw_ofs.x=hscroll->get_val();
draw_ofs.y=vscroll->get_val();
- draw_zoom=zoom->get_val();
- print_line("_scroll_changed");
edit_draw->update();
}
-void TextureRegionEditor::_set_use_snap(bool p_use)
+void TextureRegionEditor::_set_snap_mode(int p_mode)
{
- use_snap=p_use;
-}
+ snap_mode_button->get_popup()->set_item_checked(snap_mode,false);
+ snap_mode = p_mode;
+ snap_mode_button->set_text(snap_mode_button->get_popup()->get_item_text(p_mode));
+ snap_mode_button->get_popup()->set_item_checked(snap_mode,true);
+
+ if (snap_mode == SNAP_GRID)
+ hb_grid->show();
+ else
+ hb_grid->hide();
-void TextureRegionEditor::_set_show_grid(bool p_show)
-{
- snap_show_grid=p_show;
edit_draw->update();
}
@@ -358,42 +542,59 @@ void TextureRegionEditor::_set_snap_step_y(float p_val)
edit_draw->update();
}
-void TextureRegionEditor::apply_rect(const Rect2& rect){
+void TextureRegionEditor::_set_snap_sep_x(float p_val)
+{
+ snap_separation.x = p_val;
+ edit_draw->update();
+}
- if(this->editing_region == REGION_TEXTURE_REGION) {
- if(node_sprite)
- node_sprite->set_region_rect(rect);
- else if(node_patch9)
- 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);
+void TextureRegionEditor::_set_snap_sep_y(float p_val)
+{
+ snap_separation.y = p_val;
+ edit_draw->update();
+}
+
+void TextureRegionEditor::_zoom_in()
+{
+ if (draw_zoom < 8) {
+ draw_zoom *= 2;
+ edit_draw->update();
}
- else if(this->editing_region == REGION_PATCH_MARGIN) {
- if(node_patch9) {
- node_patch9->set_patch_margin(MARGIN_LEFT, rect.pos.x - tex_region.pos.x);
- node_patch9->set_patch_margin(MARGIN_RIGHT, tex_region.pos.x+tex_region.size.width-(rect.pos.x+rect.size.width));
- node_patch9->set_patch_margin(MARGIN_TOP, rect.pos.y - tex_region.pos.y);
- node_patch9->set_patch_margin(MARGIN_BOTTOM, tex_region.pos.y+tex_region.size.height-(rect.pos.y+rect.size.height));
- }
- else if(obj_styleBox) {
- obj_styleBox->set_margin_size(MARGIN_LEFT, rect.pos.x - tex_region.pos.x);
- obj_styleBox->set_margin_size(MARGIN_RIGHT, tex_region.pos.x+tex_region.size.width-(rect.pos.x+rect.size.width));
- obj_styleBox->set_margin_size(MARGIN_TOP, rect.pos.y - tex_region.pos.y);
- obj_styleBox->set_margin_size(MARGIN_BOTTOM, tex_region.pos.y+tex_region.size.height-(rect.pos.y+rect.size.height));
- }
+}
+
+void TextureRegionEditor::_zoom_reset()
+{
+ if (draw_zoom == 1) return;
+ draw_zoom = 1;
+ edit_draw->update();
+}
+
+void TextureRegionEditor::_zoom_out()
+{
+ if (draw_zoom > 0.25) {
+ draw_zoom /= 2;
+ edit_draw->update();
}
}
+void TextureRegionEditor::apply_rect(const Rect2& rect){
+ if(node_sprite)
+ node_sprite->set_region_rect(rect);
+ else if(node_patch9)
+ node_patch9->set_region_rect(rect);
+ else if(obj_styleBox.is_valid())
+ obj_styleBox->set_region_rect(rect);
+ else if(atlas_tex.is_valid())
+ atlas_tex->set_region(rect);
+}
+
void TextureRegionEditor::_notification(int p_what)
{
switch(p_what) {
case NOTIFICATION_READY: {
- region_button->set_icon( get_icon("RegionEdit","EditorIcons"));
- margin_button->set_icon( get_icon("Patch9Frame", "EditorIcons"));
- b_snap_grid->set_icon( get_icon("Grid", "EditorIcons"));
- b_snap_enable->set_icon( get_icon("Snap", "EditorIcons"));
+ zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons"));
+ zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));
+ zoom_in->set_icon(get_icon("ZoomMore", "EditorIcons"));
icon_zoom->set_texture( get_icon("Zoom", "EditorIcons"));
} break;
}
@@ -401,149 +602,165 @@ 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 || p_obj == atlas_tex) {
- node_patch9 = NULL;
- node_sprite = NULL;
- obj_styleBox = NULL;
- atlas_tex = NULL;
+ if(p_obj == node_sprite || p_obj == node_patch9 || p_obj == obj_styleBox.ptr() || p_obj == atlas_tex.ptr()) {
+ node_patch9 = NULL;
+ node_sprite = NULL;
+ obj_styleBox = Ref<StyleBox>(NULL);
+ atlas_tex = Ref<AtlasTexture>(NULL);
hide();
}
}
void TextureRegionEditor::_bind_methods()
{
- ObjectTypeDB::bind_method(_MD("_edit_node"),&TextureRegionEditor::_edit_node);
ObjectTypeDB::bind_method(_MD("_edit_region"),&TextureRegionEditor::_edit_region);
- ObjectTypeDB::bind_method(_MD("_edit_margin"),&TextureRegionEditor::_edit_margin);
ObjectTypeDB::bind_method(_MD("_region_draw"),&TextureRegionEditor::_region_draw);
ObjectTypeDB::bind_method(_MD("_region_input"),&TextureRegionEditor::_region_input);
ObjectTypeDB::bind_method(_MD("_scroll_changed"),&TextureRegionEditor::_scroll_changed);
ObjectTypeDB::bind_method(_MD("_node_removed"),&TextureRegionEditor::_node_removed);
- ObjectTypeDB::bind_method(_MD("_set_use_snap"),&TextureRegionEditor::_set_use_snap);
- ObjectTypeDB::bind_method(_MD("_set_show_grid"),&TextureRegionEditor::_set_show_grid);
+ ObjectTypeDB::bind_method(_MD("_set_snap_mode"),&TextureRegionEditor::_set_snap_mode);
ObjectTypeDB::bind_method(_MD("_set_snap_off_x"),&TextureRegionEditor::_set_snap_off_x);
ObjectTypeDB::bind_method(_MD("_set_snap_off_y"),&TextureRegionEditor::_set_snap_off_y);
ObjectTypeDB::bind_method(_MD("_set_snap_step_x"),&TextureRegionEditor::_set_snap_step_x);
ObjectTypeDB::bind_method(_MD("_set_snap_step_y"),&TextureRegionEditor::_set_snap_step_y);
+ ObjectTypeDB::bind_method(_MD("_set_snap_sep_x"),&TextureRegionEditor::_set_snap_sep_x);
+ ObjectTypeDB::bind_method(_MD("_set_snap_sep_y"),&TextureRegionEditor::_set_snap_sep_y);
+ ObjectTypeDB::bind_method(_MD("_zoom_in"),&TextureRegionEditor::_zoom_in);
+ ObjectTypeDB::bind_method(_MD("_zoom_reset"),&TextureRegionEditor::_zoom_reset);
+ ObjectTypeDB::bind_method(_MD("_zoom_out"),&TextureRegionEditor::_zoom_out);
}
void TextureRegionEditor::edit(Object *p_obj)
{
+ if (node_sprite && node_sprite->is_connected("texture_changed",this,"_edit_region"))
+ node_sprite->disconnect("texture_changed",this,"_edit_region");
+ if (node_patch9 && node_patch9->is_connected("texture_changed",this,"_edit_region"))
+ node_patch9->disconnect("texture_changed",this,"_edit_region");
+ if (obj_styleBox.is_valid() && obj_styleBox->is_connected("texture_changed",this,"_edit_region"))
+ obj_styleBox->disconnect("texture_changed",this,"_edit_region");
+ if (atlas_tex.is_valid() && atlas_tex->is_connected("atlas_changed",this,"_edit_region"))
+ atlas_tex->disconnect("atlas_changed",this,"_edit_region");
if (p_obj) {
- margin_button->hide();
- node_type = p_obj->get_type();
- if(node_type == "Sprite"){
- 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();
+ node_sprite = p_obj->cast_to<Sprite>();
+ node_patch9 = p_obj->cast_to<Patch9Frame>();
+ if (p_obj->cast_to<StyleBoxTexture>())
+ obj_styleBox = Ref<StyleBoxTexture>(p_obj->cast_to<StyleBoxTexture>());
+ if (p_obj->cast_to<AtlasTexture>()) {
+ atlas_tex = Ref<AtlasTexture>(p_obj->cast_to<AtlasTexture>());
+ atlas_tex->connect("atlas_changed",this,"_edit_region");
+ } else {
+ p_obj->connect("texture_changed",this,"_edit_region");
}
p_obj->connect("exit_tree",this,"_node_removed",varray(p_obj),CONNECT_ONESHOT);
+ _edit_region();
} 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)
+ else if(obj_styleBox.is_valid())
obj_styleBox->disconnect("exit_tree",this,"_node_removed");
- node_sprite = NULL;
- node_patch9 = NULL;
- obj_styleBox = NULL;
- atlas_tex = NULL;
+ else if(atlas_tex.is_valid())
+ atlas_tex->disconnect("exit_tree",this,"_node_removed");
+
+ node_sprite = NULL;
+ node_patch9 = NULL;
+ obj_styleBox = Ref<StyleBoxTexture>(NULL);
+ atlas_tex = Ref<AtlasTexture>(NULL);
}
+ edit_draw->update();
}
void TextureRegionEditor::_edit_region()
{
- this->_edit_node(REGION_TEXTURE_REGION);
- dlg_editor->set_title(TTR("Texture Region Editor"));
-}
-
-void TextureRegionEditor::_edit_margin()
-{
- this->_edit_node(REGION_PATCH_MARGIN);
- dlg_editor->set_title(TTR("Scale Region Editor"));
-}
-
-void TextureRegionEditor::_edit_node(int region)
-{
Ref<Texture> texture = NULL;
- if(node_type == "Sprite" && node_sprite )
+ if(node_sprite )
texture = node_sprite->get_texture();
- else if(node_type == "Patch9Frame" && node_patch9 )
+ else if(node_patch9 )
texture = node_patch9->get_texture();
- else if(node_type == "StyleBoxTexture" && obj_styleBox)
+ else if(obj_styleBox.is_valid())
texture = obj_styleBox->get_texture();
- else if(node_type == "AtlasTexture" && atlas_tex)
+ else if(atlas_tex.is_valid())
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."));
- error->popup_centered_minsize();
return;
}
- if(node_type == "Sprite" && node_sprite )
- tex_region = node_sprite->get_region_rect();
- else if(node_type == "Patch9Frame" && node_patch9 )
- 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) {
- if(node_patch9){
- Patch9Frame *node = node_patch9;
- rect.pos += Point2(node->get_patch_margin(MARGIN_LEFT),node->get_patch_margin(MARGIN_TOP));
- rect.size -= Size2(node->get_patch_margin(MARGIN_RIGHT)+node->get_patch_margin(MARGIN_LEFT), node->get_patch_margin(MARGIN_BOTTOM)+node->get_patch_margin(MARGIN_TOP));
- }
- else if(obj_styleBox) {
- StyleBoxTexture * node = obj_styleBox;
- rect.pos += Point2(node->get_margin_size(MARGIN_LEFT),node->get_margin_size(MARGIN_TOP));
- rect.size -= Size2(node->get_margin_size(MARGIN_RIGHT)+node->get_margin_size(MARGIN_LEFT), node->get_margin_size(MARGIN_BOTTOM)+node->get_margin_size(MARGIN_TOP));
+ autoslice_cache.clear();
+ Image i;
+ if (i.load(texture->get_path()) == OK) {
+ BitMap bm;
+ bm.create_from_image_alpha(i);
+ for (int y = 0; y < i.get_height(); y++) {
+ for (int x = 0; x < i.get_width(); x++) {
+ if (bm.get_bit(Point2(x,y))) {
+ bool found = false;
+ for (List<Rect2>::Element *E = autoslice_cache.front(); E; E=E->next()) {
+ Rect2 grown = E->get().grow(1.5);
+ if (grown.has_point(Point2(x,y))) {
+ E->get().expand_to(Point2(x,y));
+ E->get().expand_to(Point2(x+1,y+1));
+ x = E->get().pos.x+E->get().size.x-1;
+ bool merged = true;
+ while (merged) {
+ merged = false;
+ for (List<Rect2>::Element *F = autoslice_cache.front(); F; F=F->next()) {
+ if (F==E)
+ continue;
+ if (E->get().grow(1).intersects(F->get())) {
+ E->get().expand_to(F->get().pos);
+ E->get().expand_to(F->get().pos+F->get().size);
+ F=F->prev();
+ autoslice_cache.erase(F->next());
+ merged = true;
+ }
+ }
+ }
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ Rect2 new_rect(x,y,1,1);
+ autoslice_cache.push_back(new_rect);
+ }
+ }
+ }
}
}
- dlg_editor->popup_centered_ratio(0.85);
- dlg_editor->get_ok()->release_focus();
- editing_region = region;
+ if(node_sprite )
+ rect = node_sprite->get_region_rect();
+ else if(node_patch9 )
+ rect = node_patch9->get_region_rect();
+ else if(obj_styleBox.is_valid())
+ rect = obj_styleBox->get_region_rect();
+ else if (atlas_tex.is_valid())
+ rect = atlas_tex->get_region();
+
+ edit_draw->update();
}
-inline float _snap_scalar(float p_offset, float p_step, float p_target) {
- return p_step != 0 ? Math::stepify(p_target - p_offset, p_step) + p_offset : p_target;
+inline float _snap_scalar(float p_offset, float p_step, float separation, float p_target) {
+ if (p_step != 0) {
+ float a = Math::stepify(p_target - p_offset, p_step+separation) + p_offset;
+ float b = a;
+ if (p_target >= 0)
+ b -= separation;
+ else
+ b += p_step;
+ return (Math::abs(p_target-a) < Math::abs(p_target-b)) ? a : b;
+ }
+ return p_target;
}
Vector2 TextureRegionEditor::snap_point(Vector2 p_target) const {
- if (use_snap) {
- p_target.x = _snap_scalar(snap_offset.x, snap_step.x, p_target.x);
- p_target.y = _snap_scalar(snap_offset.y, snap_step.y, p_target.y);
+ if (snap_mode == SNAP_GRID) {
+ p_target.x = _snap_scalar(snap_offset.x, snap_step.x, snap_separation.x, p_target.x);
+ p_target.y = _snap_scalar(snap_offset.y, snap_step.y, snap_separation.y, p_target.y);
}
- p_target = p_target.snapped(Size2(1, 1));
return p_target;
}
@@ -552,56 +769,40 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor)
{
node_sprite = NULL;
node_patch9 = NULL;
- atlas_tex = NULL;
+ obj_styleBox = Ref<StyleBoxTexture>(NULL);
+ atlas_tex = Ref<AtlasTexture>(NULL);
editor=p_editor;
undo_redo = editor->get_undo_redo();
snap_step=Vector2(10,10);
- use_snap=false;
- snap_show_grid=false;
+ snap_separation = Vector2(0,0);
drag=false;
- add_child( memnew( VSeparator ));
- region_button = memnew( ToolButton );
- add_child(region_button);
- region_button->set_tooltip(TTR("Texture Region Editor"));
- region_button->connect("pressed",this,"_edit_region");
-
- margin_button = memnew( ToolButton );
- add_child(margin_button);
- margin_button->set_tooltip(TTR("Scale Region Editor"));
- margin_button->connect("pressed",this,"_edit_margin");
-
- dlg_editor = memnew( AcceptDialog );
- add_child(dlg_editor);
- dlg_editor->set_self_opacity(0.9);
-
VBoxContainer *main_vb = memnew( VBoxContainer );
- dlg_editor->add_child(main_vb);
- dlg_editor->set_child_rect(main_vb);
+ add_child(main_vb);
+ main_vb->set_area_as_parent_rect(0);
HBoxContainer *hb_tools = memnew( HBoxContainer );
main_vb->add_child(hb_tools);
- b_snap_enable = memnew( ToolButton );
- hb_tools->add_child(b_snap_enable);
- b_snap_enable->set_text(TTR("Snap"));
- b_snap_enable->set_focus_mode(FOCUS_NONE);
- b_snap_enable->set_toggle_mode(true);
- b_snap_enable->set_pressed(use_snap);
- b_snap_enable->set_tooltip(TTR("Enable Snap"));
- b_snap_enable->connect("toggled",this,"_set_use_snap");
-
- b_snap_grid = memnew( ToolButton );
- hb_tools->add_child(b_snap_grid);
- b_snap_grid->set_text(TTR("Grid"));
- b_snap_grid->set_focus_mode(FOCUS_NONE);
- b_snap_grid->set_toggle_mode(true);
- b_snap_grid->set_pressed(snap_show_grid);
- b_snap_grid->set_tooltip(TTR("Show Grid"));
- b_snap_grid->connect("toggled",this,"_set_show_grid");
-
- hb_tools->add_child( memnew( VSeparator ));
- hb_tools->add_child( memnew( Label(TTR("Grid Offset:")) ) );
+ hb_tools->add_child(memnew( Label(TTR("Snap Mode:")) ));
+
+ snap_mode_button = memnew( MenuButton );
+ hb_tools->add_child(snap_mode_button);
+ snap_mode_button->set_text(TTR("<None>"));
+ PopupMenu *p = snap_mode_button->get_popup();
+ p->add_item(TTR("<None>"),0);
+ p->add_item(TTR("Pixel Snap"),1);
+ p->add_item(TTR("Grid Snap"),2);
+ p->add_item(TTR("Auto Slice"),3);
+ for (int i = 0; i < 4; i++)
+ p->set_item_as_checkable(i,true);
+ p->set_item_checked(0,true);
+ p->connect("item_pressed", this, "_set_snap_mode");
+ hb_grid = memnew( HBoxContainer );
+ hb_tools->add_child(hb_grid);
+ hb_grid->add_child( memnew( VSeparator ));
+
+ hb_grid->add_child( memnew( Label(TTR("Offset:")) ) );
sb_off_x = memnew( SpinBox );
sb_off_x->set_min(-256);
@@ -610,7 +811,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor)
sb_off_x->set_val(snap_offset.x);
sb_off_x->set_suffix("px");
sb_off_x->connect("value_changed", this, "_set_snap_off_x");
- hb_tools->add_child(sb_off_x);
+ hb_grid->add_child(sb_off_x);
sb_off_y = memnew( SpinBox );
sb_off_y->set_min(-256);
@@ -619,10 +820,10 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor)
sb_off_y->set_val(snap_offset.y);
sb_off_y->set_suffix("px");
sb_off_y->connect("value_changed", this, "_set_snap_off_y");
- hb_tools->add_child(sb_off_y);
+ hb_grid->add_child(sb_off_y);
- hb_tools->add_child( memnew( VSeparator ));
- hb_tools->add_child( memnew( Label(TTR("Grid Step:")) ) );
+ hb_grid->add_child( memnew( VSeparator ));
+ hb_grid->add_child( memnew( Label(TTR("Step:")) ) );
sb_step_x = memnew( SpinBox );
sb_step_x->set_min(-256);
@@ -631,7 +832,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor)
sb_step_x->set_val(snap_step.x);
sb_step_x->set_suffix("px");
sb_step_x->connect("value_changed", this, "_set_snap_step_x");
- hb_tools->add_child(sb_step_x);
+ hb_grid->add_child(sb_step_x);
sb_step_y = memnew( SpinBox );
sb_step_y->set_min(-256);
@@ -640,7 +841,30 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor)
sb_step_y->set_val(snap_step.y);
sb_step_y->set_suffix("px");
sb_step_y->connect("value_changed", this, "_set_snap_step_y");
- hb_tools->add_child(sb_step_y);
+ hb_grid->add_child(sb_step_y);
+
+ hb_grid->add_child( memnew( VSeparator ));
+ hb_grid->add_child( memnew( Label(TTR("Separation:")) ) );
+
+ sb_sep_x = memnew( SpinBox );
+ sb_sep_x->set_min(0);
+ sb_sep_x->set_max(256);
+ sb_sep_x->set_step(1);
+ sb_sep_x->set_val(snap_separation.x);
+ sb_sep_x->set_suffix("px");
+ sb_sep_x->connect("value_changed", this, "_set_snap_sep_x");
+ hb_grid->add_child(sb_sep_x);
+
+ sb_sep_y = memnew( SpinBox );
+ sb_sep_y->set_min(0);
+ sb_sep_y->set_max(256);
+ sb_sep_y->set_step(1);
+ sb_sep_y->set_val(snap_separation.y);
+ sb_sep_y->set_suffix("px");
+ sb_sep_y->connect("value_changed", this, "_set_snap_sep_y");
+ hb_grid->add_child(sb_sep_y);
+
+ hb_grid->hide();
HBoxContainer *main_hb = memnew( HBoxContainer );
main_vb->add_child(main_hb);
@@ -649,25 +873,24 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor)
main_hb->set_v_size_flags(SIZE_EXPAND_FILL);
edit_draw->set_h_size_flags(SIZE_EXPAND_FILL);
+ Control * separator = memnew( Control );
+ separator->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ hb_tools->add_child(separator);
- hb_tools->add_child( memnew( VSeparator ));
icon_zoom = memnew( TextureFrame );
hb_tools->add_child(icon_zoom);
- zoom = memnew( HSlider );
- zoom->set_min(0.01);
- zoom->set_max(4);
- zoom->set_val(1);
- zoom->set_step(0.01);
- hb_tools->add_child(zoom);
- zoom->set_custom_minimum_size(Size2(200,0));
- zoom_value = memnew( SpinBox );
- zoom->share(zoom_value);
- zoom_value->set_custom_minimum_size(Size2(50,0));
- hb_tools->add_child(zoom_value);
- zoom->connect("value_changed",this,"_scroll_changed");
+ zoom_out = memnew( ToolButton );
+ zoom_out->connect("pressed", this, "_zoom_out");
+ hb_tools->add_child(zoom_out);
+ zoom_reset = memnew( ToolButton );
+ zoom_reset->connect("pressed", this, "_zoom_reset");
+ hb_tools->add_child(zoom_reset);
+ zoom_in = memnew( ToolButton );
+ zoom_in->connect("pressed", this, "_zoom_in");
+ hb_tools->add_child(zoom_in);
vscroll = memnew( VScrollBar);
main_hb->add_child(vscroll);
@@ -681,9 +904,6 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor)
draw_zoom=1.0;
updating_scroll=false;
- error = memnew( AcceptDialog);
- add_child(error);
-
}
void TextureRegionEditorPlugin::edit(Object *p_node)
@@ -699,10 +919,13 @@ bool TextureRegionEditorPlugin::handles(Object *p_obj) const
void TextureRegionEditorPlugin::make_visible(bool p_visible)
{
if (p_visible) {
- region_editor->show();
+ region_button->show();
+ if (region_button->is_pressed())
+ region_editor->show();
} else {
- region_editor->hide();
+ region_button->hide();
region_editor->edit(NULL);
+ region_editor->hide();
}
}
@@ -710,11 +933,11 @@ void TextureRegionEditorPlugin::make_visible(bool p_visible)
Dictionary TextureRegionEditorPlugin::get_state() const {
Dictionary state;
- state["zoom"]=region_editor->zoom->get_val();
+ state["zoom"]=region_editor->draw_zoom;
state["snap_offset"]=region_editor->snap_offset;
state["snap_step"]=region_editor->snap_step;
- state["use_snap"]=region_editor->use_snap;
- state["snap_show_grid"]=region_editor->snap_show_grid;
+ state["snap_separation"]=region_editor->snap_separation;
+ state["snap_mode"]=region_editor->snap_mode;
return state;
}
@@ -722,7 +945,7 @@ void TextureRegionEditorPlugin::set_state(const Dictionary& p_state){
Dictionary state=p_state;
if (state.has("zoom")) {
- region_editor->zoom->set_val(p_state["zoom"]);
+ region_editor->draw_zoom = p_state["zoom"];
}
if (state.has("snap_step")) {
@@ -739,22 +962,28 @@ void TextureRegionEditorPlugin::set_state(const Dictionary& p_state){
region_editor->snap_offset = ofs;
}
- if (state.has("use_snap")) {
- region_editor->use_snap=state["use_snap"];
- region_editor->b_snap_enable->set_pressed(state["use_snap"]);
+ if (state.has("snap_separation")) {
+ Vector2 sep = state["snap_separation"];
+ region_editor->sb_sep_x->set_val(sep.x);
+ region_editor->sb_sep_y->set_val(sep.y);
+ region_editor->snap_separation = sep;
}
- if (state.has("snap_show_grid")) {
- region_editor->snap_show_grid=state["snap_show_grid"];
- region_editor->b_snap_grid->set_pressed(state["snap_show_grid"]);
+ if (state.has("snap_mode")) {
+ region_editor->_set_snap_mode(state["snap_mode"]);
}
+
}
TextureRegionEditorPlugin::TextureRegionEditorPlugin(EditorNode *p_node)
{
editor = p_node;
- region_editor= memnew ( TextureRegionEditor(p_node) );
- CanvasItemEditor::get_singleton()->add_control_to_menu_panel(region_editor);
+ region_editor = memnew ( TextureRegionEditor(p_node) );
+
+ region_button = p_node->add_bottom_panel_item(TTR("Texture Region"), region_editor);
+ region_button->set_tooltip(TTR("Texture Region Editor"));
+ region_editor->set_custom_minimum_size(Size2(0,200));
region_editor->hide();
+ region_button->hide();
}
diff --git a/tools/editor/plugins/texture_region_editor_plugin.h b/tools/editor/plugins/texture_region_editor_plugin.h
index 1e4888b06d..3658a38f11 100644
--- a/tools/editor/plugins/texture_region_editor_plugin.h
+++ b/tools/editor/plugins/texture_region_editor_plugin.h
@@ -40,69 +40,73 @@
#include "scene/resources/style_box.h"
#include "scene/resources/texture.h"
-class TextureRegionEditor : public HBoxContainer {
+class TextureRegionEditor : public Control {
- OBJ_TYPE(TextureRegionEditor, HBoxContainer );
- enum RegionType {
- REGION_TEXTURE_REGION,
- REGION_PATCH_MARGIN
+ OBJ_TYPE(TextureRegionEditor, Control );
+
+ enum SnapMode {
+ SNAP_NONE,
+ SNAP_PIXEL,
+ SNAP_GRID,
+ SNAP_AUTOSLICE
};
friend class TextureRegionEditorPlugin;
- ToolButton *region_button;
- ToolButton *margin_button;
- ToolButton *b_snap_enable;
- ToolButton *b_snap_grid;
+ MenuButton *snap_mode_button;
TextureFrame *icon_zoom;
- HSlider *zoom;
- SpinBox *zoom_value;
+ ToolButton *zoom_in;
+ ToolButton *zoom_reset;
+ ToolButton *zoom_out;
+ HBoxContainer * hb_grid; //For showing/hiding the grid controls when changing the SnapMode
SpinBox *sb_step_y;
SpinBox *sb_step_x;
SpinBox *sb_off_y;
SpinBox *sb_off_x;
+ SpinBox *sb_sep_y;
+ SpinBox *sb_sep_x;
Control *edit_draw;
VScrollBar *vscroll;
HScrollBar *hscroll;
EditorNode *editor;
- AcceptDialog *dlg_editor;
UndoRedo* undo_redo;
Vector2 draw_ofs;
float draw_zoom;
bool updating_scroll;
- bool use_snap;
- bool snap_show_grid;
+ int snap_mode;
Vector2 snap_offset;
Vector2 snap_step;
+ Vector2 snap_separation;
-
- String node_type;
Patch9Frame *node_patch9;
Sprite *node_sprite;
- StyleBoxTexture *obj_styleBox;
- AtlasTexture *atlas_tex;
+ Ref<StyleBoxTexture> obj_styleBox;
+ Ref<AtlasTexture> atlas_tex;
- int editing_region;
Rect2 rect;
Rect2 rect_prev;
- Rect2 tex_region;
+ float prev_margin;
+ int edited_margin;
+ List<Rect2> autoslice_cache;
bool drag;
bool creating;
Vector2 drag_from;
int drag_index;
- AcceptDialog *error;
-
- void _set_use_snap(bool p_use);
- void _set_show_grid(bool p_show);
+ void _set_snap_mode(int p_mode);
void _set_snap_off_x(float p_val);
void _set_snap_off_y(float p_val);
void _set_snap_step_x(float p_val);
void _set_snap_step_y(float p_val);
+ void _set_snap_sep_x(float p_val);
+ void _set_snap_sep_y(float p_val);
+ void _zoom_in();
+ void _zoom_reset();
+ void _zoom_out();
void apply_rect(const Rect2& rect);
protected:
@@ -114,9 +118,7 @@ protected:
public:
- void _edit_node(int tex_region);
void _edit_region();
- void _edit_margin();
void _region_draw();
void _region_input(const InputEvent &p_input);
void _scroll_changed(float);
@@ -130,11 +132,12 @@ class TextureRegionEditorPlugin : public EditorPlugin
{
OBJ_TYPE( TextureRegionEditorPlugin, EditorPlugin );
+ Button *region_button;
TextureRegionEditor *region_editor;
EditorNode *editor;
public:
- virtual String get_name() const { return "SpriteRegion"; }
+ virtual String get_name() const { return "TextureRegion"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_node);
virtual bool handles(Object *p_node) const;