summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct3
-rw-r--r--core/array.cpp20
-rw-r--r--core/array.h4
-rw-r--r--core/io/pck_packer.cpp (renamed from tools/pck/pck_packer.cpp)0
-rw-r--r--core/io/pck_packer.h (renamed from tools/pck/pck_packer.h)0
-rw-r--r--core/object.cpp9
-rw-r--r--core/os/os.h1
-rw-r--r--core/register_core_types.cpp3
-rw-r--r--core/script_debugger_remote.cpp3
-rw-r--r--core/ustring.cpp5
-rw-r--r--core/variant_call.cpp4
-rw-r--r--doc/base/classes.xml37
-rw-r--r--drivers/builtin_openssl2/SCsub3
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp5
-rw-r--r--main/main.cpp14
-rwxr-xr-xmethods.py6
-rw-r--r--platform/windows/detect.py25
-rw-r--r--platform/windows/os_windows.cpp7
-rw-r--r--platform/windows/os_windows.h1
-rw-r--r--scene/gui/item_list.cpp35
-rw-r--r--scene/gui/text_edit.cpp6
-rw-r--r--scene/gui/text_edit.h7
-rw-r--r--scene/gui/tree.cpp31
-rw-r--r--scene/gui/tree.h3
-rw-r--r--scene/gui/video_player.cpp3
-rw-r--r--scene/io/resource_format_image.cpp118
-rw-r--r--scene/io/resource_format_image.h2
-rw-r--r--scene/resources/default_theme/default_theme.cpp2
-rw-r--r--tools/SCsub1
-rw-r--r--tools/editor/animation_editor.cpp12
-rw-r--r--tools/editor/editor_log.cpp12
-rw-r--r--tools/editor/editor_log.h2
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/editor_node.h1
-rw-r--r--tools/editor/editor_run.cpp4
-rw-r--r--tools/editor/editor_run.h2
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp53
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.h2
-rw-r--r--tools/editor/plugins/script_text_editor.cpp114
-rw-r--r--tools/editor/plugins/script_text_editor.h11
-rw-r--r--tools/editor/plugins/theme_editor_plugin.cpp2
-rw-r--r--tools/editor/project_manager.cpp14
-rw-r--r--tools/editor/property_editor.cpp2
-rw-r--r--tools/editor/script_editor_debugger.cpp2
-rw-r--r--tools/pck/SCsub4
45 files changed, 445 insertions, 152 deletions
diff --git a/SConstruct b/SConstruct
index e08c46c51e..0652414088 100644
--- a/SConstruct
+++ b/SConstruct
@@ -16,7 +16,6 @@ platform_list = [] # list of platforms
platform_opts = {} # options for each platform
platform_flags = {} # flags for each platform
-
active_platforms=[]
active_platform_ids=[]
platform_exporters=[]
@@ -60,7 +59,7 @@ platform_arg = ARGUMENTS.get("platform", False)
if (os.name=="posix"):
pass
elif (os.name=="nt"):
- if (os.getenv("VSINSTALLDIR")==None or platform_arg=="android"):
+ if (not methods.msvc_is_detected() or platform_arg=="android"):
custom_tools=['mingw']
env_base=Environment(tools=custom_tools);
diff --git a/core/array.cpp b/core/array.cpp
index 23792f90fc..683a43e3d0 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -276,16 +276,26 @@ void Array::push_front(const Variant& p_value) {
_p->array.insert(0,p_value);
}
-void Array::pop_back(){
+Variant Array::pop_back(){
- if (!_p->array.empty())
- _p->array.resize( _p->array.size() -1 );
+ if (!_p->array.empty()) {
+ int n = _p->array.size() - 1;
+ Variant ret = _p->array.get(n);
+ _p->array.resize(n);
+ return ret;
+ }
+ return Variant();
}
-void Array::pop_front(){
- if (!_p->array.empty())
+Variant Array::pop_front(){
+
+ if (!_p->array.empty()) {
+ Variant ret = _p->array.get(0);
_p->array.remove(0);
+ return ret;
+ }
+ return Variant();
}
diff --git a/core/array.h b/core/array.h
index dfc902525c..eb79b0cf33 100644
--- a/core/array.h
+++ b/core/array.h
@@ -80,8 +80,8 @@ public:
void erase(const Variant& p_value);
void push_front(const Variant& p_value);
- void pop_back();
- void pop_front();
+ Variant pop_back();
+ Variant pop_front();
Array(const Array& p_from);
Array(bool p_shared=false);
diff --git a/tools/pck/pck_packer.cpp b/core/io/pck_packer.cpp
index 04b88ea028..04b88ea028 100644
--- a/tools/pck/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
diff --git a/tools/pck/pck_packer.h b/core/io/pck_packer.h
index b1182335e2..b1182335e2 100644
--- a/tools/pck/pck_packer.h
+++ b/core/io/pck_packer.h
diff --git a/core/object.cpp b/core/object.cpp
index 8cd4e07097..9a1e9be8d5 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1215,6 +1215,15 @@ void Object::emit_signal(const StringName& p_name,const Variant** p_args,int p_a
Signal *s = signal_map.getptr(p_name);
if (!s) {
+#ifdef DEBUG_ENABLED
+ bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_name);
+ //check in script
+ if (!signal_is_valid && !script.is_null() && !Ref<Script>(script)->has_script_signal(p_name)) {
+ ERR_EXPLAIN("Can't emit non-existing signal " + String("\"")+p_name+"\".");
+ ERR_FAIL();
+ }
+#endif
+ //not connected? just return
return;
}
diff --git a/core/os/os.h b/core/os/os.h
index 8e9293b3c8..c2b46a5420 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -372,6 +372,7 @@ public:
virtual void set_screen_orientation(ScreenOrientation p_orientation);
ScreenOrientation get_screen_orientation() const;
+ virtual void enable_for_stealing_focus(ProcessID pid) {}
virtual void move_window_to_foreground() {}
virtual void debug_break();
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 7e4ba039c5..c3a127afb9 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -49,6 +49,7 @@
#include "os/input.h"
#include "core/io/xml_parser.h"
#include "io/http_client.h"
+#include "io/pck_packer.h"
#include "packed_data_container.h"
#include "func_ref.h"
#include "input_map.h"
@@ -146,6 +147,8 @@ void register_core_types() {
ObjectTypeDB::register_type<ConfigFile>();
+ ObjectTypeDB::register_type<PCKPacker>();
+
ObjectTypeDB::register_type<PackedDataContainer>();
ObjectTypeDB::register_virtual_type<PackedDataContainerRef>();
ObjectTypeDB::register_type<AStar>();
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 1ac0907967..6d685d3c43 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -134,6 +134,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) {
ERR_FAIL();
}
+ OS::get_singleton()->enable_for_stealing_focus(Globals::get_singleton()->get("editor_pid"));
+
packet_peer_stream->put_var("debug_enter");
packet_peer_stream->put_var(2);
packet_peer_stream->put_var(p_can_continue);
@@ -273,6 +275,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) {
set_depth(-1);
set_lines_left(-1);
+ OS::get_singleton()->move_window_to_foreground();
break;
} else if (command=="break") {
ERR_PRINT("Got break when already broke!");
diff --git a/core/ustring.cpp b/core/ustring.cpp
index f7dcba6b14..2e907381f7 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3073,6 +3073,11 @@ String String::simplify_path() const {
}
s =s.replace("\\","/");
+ while(true){ // in case of using 2 or more slash
+ String compare = s.replace("//","/");
+ if (s==compare) break;
+ else s=compare;
+ }
Vector<String> dirs = s.split("/",false);
for(int i=0;i<dirs.size();i++) {
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 5f052bce8e..a84eed4d88 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -465,8 +465,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM0R(Array,hash);
VCALL_LOCALMEM1(Array,push_back);
VCALL_LOCALMEM1(Array,push_front);
- VCALL_LOCALMEM0(Array,pop_back);
- VCALL_LOCALMEM0(Array,pop_front);
+ VCALL_LOCALMEM0R(Array,pop_back);
+ VCALL_LOCALMEM0R(Array,pop_front);
VCALL_LOCALMEM1(Array,append);
VCALL_LOCALMEM1(Array,resize);
VCALL_LOCALMEM2(Array,insert);
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index deed5c5cda..c18cba09a4 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -31861,14 +31861,21 @@
</class>
<class name="RayCast" inherits="Spatial" category="Core">
<brief_description>
+ Query the closest object intersecting a ray.
</brief_description>
<description>
+ A RayCast represents a line from its origin to its destination position [code]cast_to[/code], it is used to query the 3D space in order to find the closest object intersecting with the ray.
+
+ RayCast can ignore some objects by adding them to the exception list via [code]add_exception[/code], setting proper filtering with layers, or by filtering object types with type masks.
+
+ Only enabled raycasts will be able to query the space and report collisions!
</description>
<methods>
<method name="add_exception">
<argument index="0" name="node" type="Object">
</argument>
<description>
+ Adds a collision exception so the ray does not report collisions with the specified [code]node[/code].
</description>
</method>
<method name="add_exception_rid">
@@ -31879,30 +31886,35 @@
</method>
<method name="clear_exceptions">
<description>
+ Removes all collision exception for this ray.
</description>
</method>
<method name="get_cast_to" qualifiers="const">
<return type="Vector3">
</return>
<description>
+ Return the destination point of this ray object.
</description>
</method>
<method name="get_collider" qualifiers="const">
<return type="Object">
</return>
<description>
+ Return the closest object the ray is pointing to. Note that this does not consider the length of the vector, so you must also use [method is_colliding] to check if the object returned is actually colliding with the ray.
</description>
</method>
<method name="get_collider_shape" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the collision shape of the closest object the ray is pointing to.
</description>
</method>
<method name="get_collision_normal" qualifiers="const">
<return type="Vector3">
</return>
<description>
+ Returns the normal of the intersecting object shape face containing the collision point.
</description>
</method>
<method name="get_collision_point" qualifiers="const">
@@ -31916,30 +31928,35 @@
<return type="int">
</return>
<description>
+ Returns the layer mask for this ray.
</description>
</method>
<method name="get_type_mask" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the type mask (types of objects to detect) for this ray. The value is a sum (bitwise OR'd) of constants available for [PhysicsDirectSpaceState].
</description>
</method>
<method name="is_colliding" qualifiers="const">
<return type="bool">
</return>
<description>
+ Return whether the closest object the ray is pointing to is colliding with the vector (considering the vector length).
</description>
</method>
<method name="is_enabled" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns whether this raycast is enabled or not.
</description>
</method>
<method name="remove_exception">
<argument index="0" name="node" type="Object">
</argument>
<description>
+ Removes a collision exception so the ray does report collisions with the specified [code]node[/code].
</description>
</method>
<method name="remove_exception_rid">
@@ -31959,18 +31976,21 @@
<argument index="0" name="enabled" type="bool">
</argument>
<description>
+ Enables the RayCast2D. Only enabled raycasts will be able to query the space and report collisions.
</description>
</method>
<method name="set_layer_mask">
<argument index="0" name="mask" type="int">
</argument>
<description>
+ Set the mask to filter objects. Only objects with at least the same mask element set will be detected.
</description>
</method>
<method name="set_type_mask">
<argument index="0" name="mask" type="int">
</argument>
<description>
+ Set the types of objects to detect. For [code]mask[/code] use a logic sum (OR operation) of constants defined in [PhysicsDirectSpaceState], eg. [code]PhysicsDirectSpaceState.TYPE_MASK_STATIC_BODY | PhysicsDirectSpaceState.TYPE_MASK_KINEMATIC_BODY[/code] to detect only those two types.
</description>
</method>
</methods>
@@ -31979,10 +31999,14 @@
</class>
<class name="RayCast2D" inherits="Node2D" category="Core">
<brief_description>
- Query the closest object intersecting a ray
+ Query the closest object intersecting a ray.
</brief_description>
<description>
A RayCast2D represents a line from its origin to its destination position [code]cast_to[/code], it is used to query the 2D space in order to find the closest object intersecting with the ray.
+
+ RayCast2D can ignore some objects by adding them to the exception list via [code]add_exception[/code], setting proper filtering with layers, or by filtering object types with type masks.
+
+ Only enabled raycasts will be able to query the space and report collisions!
</description>
<methods>
<method name="add_exception">
@@ -32007,7 +32031,7 @@
<return type="Vector2">
</return>
<description>
- Return the destination point of this ray object
+ Return the destination point of this ray object.
</description>
</method>
<method name="get_collider" qualifiers="const">
@@ -32035,13 +32059,14 @@
<return type="Vector2">
</return>
<description>
- Returns the collision point in which the ray intersects the closest object.
+ Returns the collision point in which the ray intersects the closest object. This point is in [b]global[/b] coordinate system.
</description>
</method>
<method name="get_exclude_parent_body" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns whether this ray should hit your parent node, if it's a body.
</description>
</method>
<method name="get_layer_mask" qualifiers="const">
@@ -32055,6 +32080,7 @@
<return type="int">
</return>
<description>
+ Returns the type mask (types of objects to detect) for this ray. The value is a sum (bitwise OR'd) of constants available for [Physics2DDirectSpaceState].
</description>
</method>
<method name="is_colliding" qualifiers="const">
@@ -32068,7 +32094,7 @@
<return type="bool">
</return>
<description>
- Returns whether this raycast is enabled or not
+ Returns whether this raycast is enabled or not.
</description>
</method>
<method name="remove_exception">
@@ -32102,18 +32128,21 @@
<argument index="0" name="mask" type="bool">
</argument>
<description>
+ Toggle whether this ray should hit your parent node, if it's a body.
</description>
</method>
<method name="set_layer_mask">
<argument index="0" name="mask" type="int">
</argument>
<description>
+ Set the mask to filter objects. Only objects with at least the same mask element set will be detected.
</description>
</method>
<method name="set_type_mask">
<argument index="0" name="mask" type="int">
</argument>
<description>
+ Set the types of objects to detect. For [code]mask[/code] use a logic sum (OR operation) of constants defined in [Physics2DDirectSpaceState], eg. [code]Physics2DDirectSpaceState.TYPE_MASK_STATIC_BODY | Physics2DDirectSpaceState.TYPE_MASK_KINEMATIC_BODY[/code] to detect only those two types.
</description>
</method>
</methods>
diff --git a/drivers/builtin_openssl2/SCsub b/drivers/builtin_openssl2/SCsub
index a28bc2922c..0c035cc4a5 100644
--- a/drivers/builtin_openssl2/SCsub
+++ b/drivers/builtin_openssl2/SCsub
@@ -656,7 +656,8 @@ if "platform" in env and env["platform"] == "winrt":
# Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517)
import os
-if not (os.name=="nt" and os.getenv("VSINSTALLDIR")!=None): # not Windows and not MSVC
+import methods
+if not (os.name=="nt" and methods.msvc_is_detected() ): # not Windows and not MSVC
env_drivers.Append(CFLAGS=["-Wno-error=implicit-function-declaration"])
env_drivers.add_source_files(env.drivers_sources,openssl_sources)
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index aeb3d9e039..80ccf9be67 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -36,6 +36,7 @@
#include "servers/visual/particle_system_sw.h"
#include "gl_context/context_gl.h"
#include <string.h>
+#include <stdlib.h>
#ifdef GLEW_ENABLED
#define _GL_HALF_FLOAT_OES 0x140B
@@ -10816,11 +10817,11 @@ void RasterizerGLES2::init() {
// Check for GL 2.1 compatibility, if not bail out
if (!glewIsSupported("GL_VERSION_2_1")) {
ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"
- "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
+ "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot is now going to terminate.");
OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"
"Godot Engine will self-destruct as soon as you acknowledge this error message.",
"Fatal error: Insufficient OpenGL / GLES drivers");
- // TODO: If it's even possible, we should stop the execution without segfault and memory leaks :)
+ exit(1);
}
#endif
diff --git a/main/main.cpp b/main/main.cpp
index d2ba38b094..912e8adf4f 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -57,7 +57,6 @@
#include "tools/editor/editor_node.h"
#include "tools/editor/project_manager.h"
-#include "tools/pck/pck_packer.h"
#endif
#include "io/file_access_network.h"
@@ -560,6 +559,16 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
goto error;
}
+ } else if (I->get()=="-epid") {
+ if (I->next()) {
+
+ int editor_pid=I->next()->get().to_int();
+ Globals::get_singleton()->set("editor_pid",editor_pid);
+ N=I->next()->next();
+ } else {
+ goto error;
+
+ }
} else {
//test for game path
@@ -996,7 +1005,7 @@ Error Main::setup2() {
#ifdef TOOLS_ENABLED
ObjectTypeDB::set_current_api(ObjectTypeDB::API_EDITOR);
EditorNode::register_editor_types();
- ObjectTypeDB::register_type<PCKPacker>(); // todo: move somewhere else
+
ObjectTypeDB::set_current_api(ObjectTypeDB::API_CORE);
#endif
@@ -1755,4 +1764,3 @@ void Main::cleanup() {
}
-
diff --git a/methods.py b/methods.py
index c28ed55dda..c4951c69bd 100755
--- a/methods.py
+++ b/methods.py
@@ -1516,6 +1516,12 @@ def detect_visual_c_compiler_version(tools_env):
return vc_chosen_compiler_str
+def msvc_is_detected() :
+ # looks for VisualStudio env variable
+ # or for Visual C++ Build Tools (which is a standalone MSVC)
+ return os.getenv("VSINSTALLDIR") or os.getenv("VS100COMNTOOLS") or os.getenv("VS110COMNTOOLS") or os.getenv("VS120COMNTOOLS") or os.getenv("VS140COMNTOOLS");
+
+
def precious_program(env, program, sources, **args):
program = env.ProgramOriginal(program, sources, **args)
env.Precious(program)
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 0548b84cfa..12ea5a93ee 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -1,10 +1,11 @@
#
-# tested on | Windows native | Linux cross-compilation
-# ------------------------+-------------------+---------------------------
-# MSVS C++ 2010 Express | WORKS | n/a
-# Mingw-w64 | WORKS | WORKS
-# Mingw-w32 | WORKS | WORKS
-# MinGW | WORKS | untested
+# tested on | Windows native | Linux cross-compilation
+# ----------------------------+-------------------+---------------------------
+# MSVS C++ 2010 Express | WORKS | n/a
+# Visual C++ Build Tools 2015 | WORKS | n/a
+# Mingw-w64 | WORKS | WORKS
+# Mingw-w32 | WORKS | WORKS
+# MinGW | WORKS | untested
#
#####
# Notes about MSVS C++ :
@@ -12,6 +13,12 @@
# - MSVC2010-Express compiles to 32bits only.
#
#####
+# Note about Visual C++ Build Tools :
+#
+# - Visual C++ Build Tools is the standalone MSVC compiler :
+# http://landinghub.visualstudio.com/visual-cpp-build-tools
+#
+#####
# Notes about Mingw-w64 and Mingw-w32 under Windows :
#
# - both can be installed using the official installer :
@@ -78,7 +85,7 @@
#####
# TODO :
-#
+#
# - finish to cleanup this script to remove all the remains of previous hacks and workarounds
# - make it work with the Windows7 SDK that is supposed to enable 64bits compilation for MSVC2010-Express
# - confirm it works well with other Visual Studio versions.
@@ -102,7 +109,7 @@ def can_build():
if (os.name=="nt"):
#building natively on windows!
- if (os.getenv("VSINSTALLDIR")):
+ if ( methods.msvc_is_detected() ):
return True
else:
print("\nMSVC not detected, attempting Mingw.")
@@ -197,7 +204,7 @@ def configure(env):
env.Append(CPPPATH=['#platform/windows'])
env['is_mingw']=False
- if (os.name=="nt" and os.getenv("VSINSTALLDIR")!=None):
+ if (os.name=="nt" and methods.msvc_is_detected() ):
#build using visual studio
env['ENV']['TMP'] = os.environ['TMP']
env.Append(CPPPATH=['#platform/windows/include'])
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index f38bda5899..35d90a8308 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -2157,10 +2157,15 @@ String OS_Windows::get_stdin_string(bool p_block) {
}
+void OS_Windows::enable_for_stealing_focus(ProcessID pid) {
+
+ AllowSetForegroundWindow(pid);
+
+}
+
void OS_Windows::move_window_to_foreground() {
SetForegroundWindow(hWnd);
- BringWindowToTop(hWnd);
}
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index e3e037e57b..70ef694957 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -269,6 +269,7 @@ public:
virtual String get_locale() const;
virtual LatinKeyboardVariant get_latin_keyboard_variant() const;
+ virtual void enable_for_stealing_focus(ProcessID pid);
virtual void move_window_to_foreground();
virtual String get_data_dir() const;
virtual String get_system_dir(SystemDir p_dir) const;
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 89cd509fbd..f69ad8fa7e 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -959,7 +959,23 @@ void ItemList::_notification(int p_what) {
shape_changed=false;
}
+ //ensure_selected_visible needs to be checked before we draw the list.
+ if (ensure_selected_visible && current>=0 && current <=items.size()) {
+ Rect2 r = items[current].rect_cache;
+ int from = scroll_bar->get_val();
+ int to = from + scroll_bar->get_page();
+
+ if (r.pos.y < from) {
+ scroll_bar->set_val(r.pos.y);
+ } else if (r.pos.y+r.size.y > to) {
+ scroll_bar->set_val(r.pos.y+r.size.y - (to-from));
+ }
+
+
+ }
+
+ ensure_selected_visible=false;
Vector2 base_ofs = bg->get_offset();
base_ofs.y-=int(scroll_bar->get_val());
@@ -1147,25 +1163,6 @@ void ItemList::_notification(int p_what) {
for(int i=0;i<separators.size();i++) {
draw_line(Vector2(bg->get_margin(MARGIN_LEFT),base_ofs.y+separators[i]),Vector2(size.width-bg->get_margin(MARGIN_LEFT),base_ofs.y+separators[i]),guide_color);
}
-
-
- if (ensure_selected_visible && current>=0 && current <=items.size()) {
-
- Rect2 r = items[current].rect_cache;
- int from = scroll_bar->get_val();
- int to = from + scroll_bar->get_page();
-
- if (r.pos.y < from) {
- scroll_bar->set_val(r.pos.y);
- } else if (r.pos.y+r.size.y > to) {
- scroll_bar->set_val(r.pos.y+r.size.y - (to-from));
- }
-
-
- }
-
- ensure_selected_visible=false;
-
}
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 8a9ed98a5f..14508e07a8 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1651,7 +1651,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
update();
}
- if (mb.button_index==BUTTON_RIGHT) {
+ if (mb.button_index==BUTTON_RIGHT && context_menu_enabled) {
menu->set_pos(get_global_transform().xform(get_local_mouse_pos()));
menu->set_size(Vector2(1,1));
@@ -4569,6 +4569,9 @@ bool TextEdit::is_selecting_identifiers_on_hover_enabled() const {
return select_identifiers_enabled;
}
+void TextEdit::set_context_menu_enabled(bool p_enable) {
+ context_menu_enabled = p_enable;
+}
PopupMenu *TextEdit::get_menu() const {
return menu;
@@ -4789,6 +4792,7 @@ TextEdit::TextEdit() {
window_has_focus=true;
select_identifiers_enabled=false;
+ context_menu_enabled=true;
menu = memnew( PopupMenu );
add_child(menu);
menu->add_item(TTR("Cut"),MENU_CUT,KEY_MASK_CMD|KEY_X);
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index cb49618f18..37477e3b7e 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -269,6 +269,8 @@ class TextEdit : public Control {
int search_result_line;
int search_result_col;
+ bool context_menu_enabled;
+
int get_visible_rows() const;
int get_char_count();
@@ -319,8 +321,6 @@ class TextEdit : public Control {
void _confirm_completion();
void _update_completion_candidates();
- void _get_mouse_pos(const Point2i& p_mouse, int &r_row, int &r_col) const;
-
protected:
virtual String get_tooltip(const Point2& p_pos) const;
@@ -360,6 +360,8 @@ public:
virtual CursorShape get_cursor_shape(const Point2& p_pos=Point2i()) const;
+ void _get_mouse_pos(const Point2i& p_mouse, int &r_row, int &r_col) const;
+
//void delete_char();
//void delete_line();
@@ -499,6 +501,7 @@ public:
void set_select_identifiers_on_hover(bool p_enable);
bool is_selecting_identifiers_on_hover_enabled() const;
+ void set_context_menu_enabled(bool p_enable);
PopupMenu *get_menu() const;
String get_text_for_completion();
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 20794b2faa..5a614fb1b2 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -32,6 +32,7 @@
#include "os/keyboard.h"
#include "globals.h"
#include "os/input.h"
+#include "scene/main/viewport.h"
@@ -829,6 +830,8 @@ void Tree::update_cache() {
cache.guide_width=get_constant("guide_width");
cache.draw_relationship_lines=get_constant("draw_relationship_lines");
cache.relationship_line_color=get_color("relationship_line_color");
+ cache.scroll_border=get_constant("scroll_border");
+ cache.scroll_speed=get_constant("scroll_speed");
cache.title_button = get_stylebox("title_button_normal");
cache.title_button_pressed = get_stylebox("title_button_pressed");
@@ -2681,11 +2684,17 @@ void Tree::_notification(int p_what) {
if (p_what==NOTIFICATION_DRAG_END) {
drop_mode_flags=0;
+ scrolling = false;
+ set_fixed_process(false);
update();
}
if (p_what==NOTIFICATION_DRAG_BEGIN) {
single_select_defer=NULL;
+ if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_pos() - get_global_pos())) {
+ scrolling = true;
+ set_fixed_process(true);
+ }
}
if (p_what==NOTIFICATION_FIXED_PROCESS) {
@@ -2731,6 +2740,28 @@ void Tree::_notification(int p_what) {
}
}
+
+ if (scrolling) {
+ Point2 point = get_viewport()->get_mouse_pos() - get_global_pos();
+ if (point.x < cache.scroll_border) {
+ point.x -= cache.scroll_border;
+ } else if (point.x > get_size().width - cache.scroll_border) {
+ point.x -= get_size().width - cache.scroll_border;
+ } else {
+ point.x = 0;
+ }
+ if (point.y < cache.scroll_border) {
+ point.y -= cache.scroll_border;
+ } else if (point.y > get_size().height - cache.scroll_border) {
+ point.y -= get_size().height - cache.scroll_border;
+ } else {
+ point.y = 0;
+ }
+ point *= cache.scroll_speed * get_fixed_process_delta_time();
+ point += get_scroll();
+ h_scroll->set_val(point.x);
+ v_scroll->set_val(point.y);
+ }
}
if (p_what==NOTIFICATION_DRAW) {
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 2124dce749..6c2f1dae40 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -390,6 +390,8 @@ friend class TreeItem;
int button_margin;
Point2 offset;
int draw_relationship_lines;
+ int scroll_border;
+ int scroll_speed;
enum ClickType {
CLICK_NONE,
@@ -448,6 +450,7 @@ friend class TreeItem;
bool drag_touching_deaccel;
bool click_handled;
bool allow_rmb_select;
+ bool scrolling;
bool force_select_on_already_selected;
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index 1be847929d..335672126c 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -248,7 +248,7 @@ void VideoPlayer::stop() {
playback->stop();
AudioServer::get_singleton()->stream_set_active(stream_rid,false);
- resampler.clear();
+ resampler.flush();
set_process(false);
last_audio_time=0;
};
@@ -426,5 +426,6 @@ VideoPlayer::~VideoPlayer() {
if (stream_rid.is_valid())
AudioServer::get_singleton()->free(stream_rid);
+ resampler.clear(); //Not necessary here, but make in consistent with other "stream_player" classes
};
diff --git a/scene/io/resource_format_image.cpp b/scene/io/resource_format_image.cpp
index f3a0eaa8c4..55ad23ba93 100644
--- a/scene/io/resource_format_image.cpp
+++ b/scene/io/resource_format_image.cpp
@@ -136,61 +136,7 @@ RES ResourceFormatLoaderImage::load(const String &p_path, const String& p_origin
#endif
- uint32_t flags=0;
-
- FileAccess *f2 = FileAccess::open(p_path+".flags",FileAccess::READ);
- Map<String,bool> flags_found;
- if (f2) {
-
- while(!f2->eof_reached()) {
- String l2 = f2->get_line();
- int eqpos = l2.find("=");
- if (eqpos!=-1) {
- String flag=l2.substr(0,eqpos).strip_edges();
- String val=l2.substr(eqpos+1,l2.length()).strip_edges().to_lower();
- flags_found[flag]=(val=="true" || val=="1")?true:false;
- }
- }
- memdelete(f2);
- }
-
-
- if (flags_found.has("filter")) {
- if (flags_found["filter"])
- flags|=Texture::FLAG_FILTER;
- } else if (bool(GLOBAL_DEF("image_loader/filter",true))) {
- flags|=Texture::FLAG_FILTER;
- }
-
-
- if (flags_found.has("gen_mipmaps")) {
- if (flags_found["gen_mipmaps"])
- flags|=Texture::FLAG_MIPMAPS;
- } else if (bool(GLOBAL_DEF("image_loader/gen_mipmaps",true))) {
- flags|=Texture::FLAG_MIPMAPS;
- }
-
- if (flags_found.has("repeat")) {
- if (flags_found["repeat"])
- flags|=Texture::FLAG_REPEAT;
- } else if (bool(GLOBAL_DEF("image_loader/repeat",true))) {
- flags|=Texture::FLAG_REPEAT;
- }
-
- if (flags_found.has("anisotropic")) {
- if (flags_found["anisotropic"])
- flags|=Texture::FLAG_ANISOTROPIC_FILTER;
- }
-
- if (flags_found.has("tolinear")) {
- if (flags_found["tolinear"])
- flags|=Texture::FLAG_CONVERT_TO_LINEAR;
- }
-
- if (flags_found.has("mirroredrepeat")) {
- if (flags_found["mirroredrepeat"])
- flags|=Texture::FLAG_MIRRORED_REPEAT;
- }
+ uint32_t flags=load_image_flags(p_path);
if (debug_load_times)
begtime=OS::get_singleton()->get_ticks_usec();
@@ -214,6 +160,68 @@ RES ResourceFormatLoaderImage::load(const String &p_path, const String& p_origin
}
+uint32_t ResourceFormatLoaderImage::load_image_flags(const String &p_path) {
+
+
+ FileAccess *f2 = FileAccess::open(p_path+".flags",FileAccess::READ);
+ Map<String,bool> flags_found;
+ if (f2) {
+
+ while(!f2->eof_reached()) {
+ String l2 = f2->get_line();
+ int eqpos = l2.find("=");
+ if (eqpos!=-1) {
+ String flag=l2.substr(0,eqpos).strip_edges();
+ String val=l2.substr(eqpos+1,l2.length()).strip_edges().to_lower();
+ flags_found[flag]=(val=="true" || val=="1")?true:false;
+ }
+ }
+ memdelete(f2);
+ }
+
+
+ uint32_t flags=0;
+
+ if (flags_found.has("filter")) {
+ if (flags_found["filter"])
+ flags|=Texture::FLAG_FILTER;
+ } else if (bool(GLOBAL_DEF("image_loader/filter",true))) {
+ flags|=Texture::FLAG_FILTER;
+ }
+
+
+ if (flags_found.has("gen_mipmaps")) {
+ if (flags_found["gen_mipmaps"])
+ flags|=Texture::FLAG_MIPMAPS;
+ } else if (bool(GLOBAL_DEF("image_loader/gen_mipmaps",true))) {
+ flags|=Texture::FLAG_MIPMAPS;
+ }
+
+ if (flags_found.has("repeat")) {
+ if (flags_found["repeat"])
+ flags|=Texture::FLAG_REPEAT;
+ } else if (bool(GLOBAL_DEF("image_loader/repeat",true))) {
+ flags|=Texture::FLAG_REPEAT;
+ }
+
+ if (flags_found.has("anisotropic")) {
+ if (flags_found["anisotropic"])
+ flags|=Texture::FLAG_ANISOTROPIC_FILTER;
+ }
+
+ if (flags_found.has("tolinear")) {
+ if (flags_found["tolinear"])
+ flags|=Texture::FLAG_CONVERT_TO_LINEAR;
+ }
+
+ if (flags_found.has("mirroredrepeat")) {
+ if (flags_found["mirroredrepeat"])
+ flags|=Texture::FLAG_MIRRORED_REPEAT;
+ }
+
+ return flags;
+}
+
bool ResourceFormatLoaderImage::handles_type(const String& p_type) const {
return ObjectTypeDB::is_type(p_type,"Texture") || ObjectTypeDB::is_type(p_type,"CubeMap");
diff --git a/scene/io/resource_format_image.h b/scene/io/resource_format_image.h
index 6388aa641f..cce6ffab83 100644
--- a/scene/io/resource_format_image.h
+++ b/scene/io/resource_format_image.h
@@ -39,8 +39,8 @@ class ResourceFormatLoaderImage : public ResourceFormatLoader {
bool debug_load_times;
int max_texture_size;
public:
-
virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL);
+ static uint32_t load_image_flags(const String &p_path);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String& p_type) const;
virtual String get_resource_type(const String &p_path) const;
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index dea612735c..0740b591c4 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -714,6 +714,8 @@ void fill_default_theme(Ref<Theme>& t, const Ref<Font> & default_font, const Ref
t->set_constant("item_margin","Tree",12 *scale);
t->set_constant("button_margin","Tree",4 *scale);
t->set_constant("draw_relationship_lines", "Tree", 0);
+ t->set_constant("scroll_border", "Tree", 4);
+ t->set_constant("scroll_speed", "Tree", 12);
// ItemList
diff --git a/tools/SCsub b/tools/SCsub
index aaebab724a..67b1f20e72 100644
--- a/tools/SCsub
+++ b/tools/SCsub
@@ -117,7 +117,6 @@ if (env["tools"]!="no"):
SConscript('editor/SCsub');
SConscript('collada/SCsub');
SConscript('doc/SCsub')
- SConscript('pck/SCsub')
lib = env.Library("tool",env.tool_sources)
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index 2f67df1fc3..a556031e5e 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -1933,12 +1933,20 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
if (mb.button_index==BUTTON_WHEEL_UP && mb.pressed) {
- v_scroll->set_val( v_scroll->get_val() - v_scroll->get_page() / 8 );
+ if (mb.mod.command) {
+ zoom->set_val(zoom->get_val() + zoom->get_step());
+ } else {
+ v_scroll->set_val( v_scroll->get_val() - v_scroll->get_page() / 8 );
+ }
}
if (mb.button_index==BUTTON_WHEEL_DOWN && mb.pressed) {
- v_scroll->set_val( v_scroll->get_val() + v_scroll->get_page() / 8 );
+ if (mb.mod.command) {
+ zoom->set_val(zoom->get_val() - zoom->get_step());
+ } else {
+ v_scroll->set_val( v_scroll->get_val() + v_scroll->get_page() / 8 );
+ }
}
if (mb.button_index==BUTTON_RIGHT && mb.pressed) {
diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp
index 20613467d3..02af9712a8 100644
--- a/tools/editor/editor_log.cpp
+++ b/tools/editor/editor_log.cpp
@@ -161,7 +161,7 @@ void EditorLog::_undo_redo_cbk(void *p_self,const String& p_name) {
void EditorLog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_clear_request"),&EditorLog::_clear_request );
-
+ ObjectTypeDB::bind_method("_override_logger_styles",&EditorLog::_override_logger_styles );
//ObjectTypeDB::bind_method(_MD("_dragged"),&EditorLog::_dragged );
ADD_SIGNAL( MethodInfo("clear_request"));
}
@@ -193,11 +193,10 @@ EditorLog::EditorLog() {
ec->set_custom_minimum_size(Size2(0,180));
ec->set_v_size_flags(SIZE_EXPAND_FILL);
-
- PanelContainer *pc = memnew( PanelContainer );
- pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
+ pc = memnew( PanelContainer );
ec->add_child(pc);
pc->set_area_as_parent_rect();
+ pc->connect("enter_tree", this, "_override_logger_styles");
log = memnew( RichTextLabel );
log->set_scroll_follow(true);
@@ -224,6 +223,11 @@ void EditorLog::deinit() {
}
+void EditorLog::_override_logger_styles() {
+
+ pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
+
+}
EditorLog::~EditorLog() {
diff --git a/tools/editor/editor_log.h b/tools/editor/editor_log.h
index 699be710d8..bbf35b63cb 100644
--- a/tools/editor/editor_log.h
+++ b/tools/editor/editor_log.h
@@ -50,6 +50,7 @@ class EditorLog : public VBoxContainer {
HBoxContainer *title_hb;
// PaneDrag *pd;
Control *ec;
+ PanelContainer *pc;
static void _error_handler(void *p_self, const char*p_func, const char*p_file,int p_line, const char*p_error,const char*p_errorexp,ErrorHandlerType p_type);
@@ -64,6 +65,7 @@ protected:
static void _bind_methods();
void _notification(int p_what);
+ void _override_logger_styles();
public:
void add_message(const String& p_msg, bool p_error=false);
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index fe97fe2881..8274272a7e 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -2678,7 +2678,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break;
case RUN_PLAY_NATIVE: {
-
+
bool autosave = EDITOR_DEF("run/auto_save_before_running",true);
if (autosave) {
_menu_option_confirm(FILE_SAVE_ALL_SCENES, false);
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 2fae5daced..0393cd19a9 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -700,6 +700,7 @@ public:
void notify_child_process_exited();
+ OS::ProcessID get_child_process_id() const { return editor_run.get_pid(); }
void stop_child_process();
Ref<Theme> get_editor_theme() const { return theme; }
diff --git a/tools/editor/editor_run.cpp b/tools/editor/editor_run.cpp
index fb0f24c084..5fbb4ae2a0 100644
--- a/tools/editor/editor_run.cpp
+++ b/tools/editor/editor_run.cpp
@@ -52,6 +52,9 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List
args.push_back("localhost:"+String::num(GLOBAL_DEF("debug/debug_port", 6007)));
}
+ args.push_back("-epid");
+ args.push_back(String::num(OS::get_singleton()->get_process_ID()));
+
if (p_custom_args!="") {
Vector<String> cargs=p_custom_args.split(" ",false);
@@ -132,6 +135,7 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List
}
+
if (p_breakpoints.size()) {
args.push_back("-bp");
diff --git a/tools/editor/editor_run.h b/tools/editor/editor_run.h
index 0b96a2c91c..5aa2adf801 100644
--- a/tools/editor/editor_run.h
+++ b/tools/editor/editor_run.h
@@ -53,6 +53,8 @@ public:
void run_native_notify() { status=STATUS_PLAY; }
void stop();
+ OS::ProcessID get_pid() const { return pid; }
+
void set_debug_collisions(bool p_debug);
bool get_debug_collisions() const;
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
index 60642999f2..2935ea8fe2 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -38,6 +38,7 @@
#include "scene/gui/check_button.h"
#include "scene/gui/button_group.h"
#include "scene/gui/margin_container.h"
+#include "scene/io/resource_format_image.h"
static const char *flag_names[]={
("Streaming Format"),
@@ -1589,16 +1590,9 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
} break; //use default
}
+ String validated_path=EditorImportPlugin::validate_source_path(p_path);
- int flags=0;
-
- if (Globals::get_singleton()->get("image_loader/filter"))
- flags|=IMAGE_FLAG_FILTER;
- if (!Globals::get_singleton()->get("image_loader/gen_mipmaps"))
- flags|=IMAGE_FLAG_NO_MIPMAPS;
- if (!Globals::get_singleton()->get("image_loader/repeat"))
- flags|=IMAGE_FLAG_REPEAT;
-
+ int flags=texture_flags_to_export_flags(ResourceFormatLoaderImage::load_image_flags(validated_path));
flags|=IMAGE_FLAG_FIX_BORDER_ALPHA;
print_line("group format"+itos(group_format));
@@ -1607,7 +1601,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
rimd->set_option("quality",group_lossy_quality);
rimd->set_option("atlas",false);
rimd->set_option("shrink",group_shrink);
- rimd->add_source(EditorImportPlugin::validate_source_path(p_path),FileAccess::get_md5(p_path));
+ rimd->add_source(validated_path,FileAccess::get_md5(p_path));
} else if (EditorImportExport::get_singleton()->get_image_formats().has(p_path.extension().to_lower()) && EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE) {
//handled by general image export settings
@@ -1619,22 +1613,16 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
case EditorImportExport::IMAGE_ACTION_COMPRESS_RAM: rimd->set_option("format",IMAGE_FORMAT_COMPRESS_RAM); break;
}
- int flags=0;
-
- if (Globals::get_singleton()->get("image_loader/filter"))
- flags|=IMAGE_FLAG_FILTER;
- if (!Globals::get_singleton()->get("image_loader/gen_mipmaps"))
- flags|=IMAGE_FLAG_NO_MIPMAPS;
- if (!Globals::get_singleton()->get("image_loader/repeat"))
- flags|=IMAGE_FLAG_REPEAT;
+ String validated_path=EditorImportPlugin::validate_source_path(p_path);
+ int flags=texture_flags_to_export_flags(ResourceFormatLoaderImage::load_image_flags(validated_path));
flags|=IMAGE_FLAG_FIX_BORDER_ALPHA;
rimd->set_option("shrink",EditorImportExport::get_singleton()->get_export_image_shrink());
rimd->set_option("flags",flags);
rimd->set_option("quality",EditorImportExport::get_singleton()->get_export_image_quality());
rimd->set_option("atlas",false);
- rimd->add_source(EditorImportPlugin::validate_source_path(p_path),FileAccess::get_md5(p_path));
+ rimd->add_source(validated_path,FileAccess::get_md5(p_path));
} else {
return Vector<uint8_t>();
@@ -1726,6 +1714,33 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
return ret;
}
+uint32_t EditorTextureImportPlugin::texture_flags_to_export_flags(uint32_t p_tex_flags) const {
+
+ uint32_t flags=0;
+
+ if (!(p_tex_flags&Texture::FLAG_MIPMAPS)) {
+ flags|=IMAGE_FLAG_NO_MIPMAPS;
+ }
+ if (p_tex_flags&Texture::FLAG_REPEAT) {
+ flags|=IMAGE_FLAG_REPEAT;
+ }
+ if (p_tex_flags&Texture::FLAG_FILTER) {
+ flags|=IMAGE_FLAG_FILTER;
+ }
+ if (p_tex_flags&Texture::FLAG_ANISOTROPIC_FILTER) {
+ flags|=IMAGE_FLAG_USE_ANISOTROPY;
+ }
+ if (p_tex_flags&Texture::FLAG_CONVERT_TO_LINEAR) {
+ flags|=IMAGE_FLAG_CONVERT_TO_LINEAR;
+ }
+ /* // no correspondence yet
+ if (p_tex_flags&Texture::TEXTURE_FLAG_MIRRORED_REPEAT) {
+ flags|=;
+ }*/
+
+ return flags;
+}
+
void EditorTextureImportPlugin::import_from_drop(const Vector<String>& p_drop,const String& p_dest_path) {
Vector<String> valid;
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.h b/tools/editor/io_plugins/editor_texture_import_plugin.h
index 5c8abd10a4..22c10a1a3a 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.h
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.h
@@ -72,6 +72,8 @@ private:
Error _process_texture_data(Ref<ImageTexture> &texture, int format, float quality, int flags,EditorExportPlatform::ImageCompression p_compr,int tex_flags,float shrink);
void compress_image(EditorExportPlatform::ImageCompression p_mode,Image& image,bool p_smaller);
+
+ uint32_t texture_flags_to_export_flags(uint32_t p_tex_flags) const;
public:
diff --git a/tools/editor/plugins/script_text_editor.cpp b/tools/editor/plugins/script_text_editor.cpp
index ca0398f069..2f807eaa19 100644
--- a/tools/editor/plugins/script_text_editor.cpp
+++ b/tools/editor/plugins/script_text_editor.cpp
@@ -498,6 +498,7 @@ void ScriptTextEditor::_code_complete_scripts(void* p_ud,const String& p_code, L
void ScriptTextEditor::_code_complete_script(const String& p_code, List<String>* r_options) {
+ if (color_panel->is_visible()) return;
Node *base = get_tree()->get_edited_scene_root();
if (base) {
base = _find_node_for_script(base,base,script);
@@ -882,6 +883,9 @@ void ScriptTextEditor::_edit_option(int p_op) {
case EDIT_TRIM_TRAILING_WHITESAPCE: {
trim_trailing_whitespace();
} break;
+ case EDIT_PICK_COLOR: {
+ color_panel->popup();
+ } break;
case SEARCH_FIND: {
@@ -989,7 +993,8 @@ void ScriptTextEditor::_bind_methods() {
ObjectTypeDB::bind_method("_edit_option",&ScriptTextEditor::_edit_option);
ObjectTypeDB::bind_method("_goto_line",&ScriptTextEditor::_goto_line);
ObjectTypeDB::bind_method("_lookup_symbol",&ScriptTextEditor::_lookup_symbol);
-
+ ObjectTypeDB::bind_method("_text_edit_input_event", &ScriptTextEditor::_text_edit_input_event);
+ ObjectTypeDB::bind_method("_color_changed", &ScriptTextEditor::_color_changed);
ObjectTypeDB::bind_method("get_drag_data_fw",&ScriptTextEditor::get_drag_data_fw);
@@ -1168,6 +1173,96 @@ void ScriptTextEditor::drop_data_fw(const Point2& p_point,const Variant& p_data,
}
+void ScriptTextEditor::_text_edit_input_event(const InputEvent& ev) {
+ if (ev.type == InputEvent::MOUSE_BUTTON) {
+ InputEventMouseButton mb = ev.mouse_button;
+ if (mb.button_index == BUTTON_RIGHT && !mb.pressed) {
+
+ int col, row;
+ TextEdit* tx = code_editor->get_text_edit();
+ tx->_get_mouse_pos(Point2i(mb.global_x, mb.global_y)-tx->get_global_pos(), row, col);
+ Vector2 mpos = Vector2(mb.global_x, mb.global_y)-tx->get_global_pos();
+ bool have_selection = (tx->get_selection_text().length() > 0);
+ bool have_color = (tx->get_word_at_pos(mpos) == "Color");
+ if (have_color) {
+
+ String line = tx->get_line(row);
+ color_line = row;
+ int begin = 0;
+ int end = 0;
+ bool valid = false;
+ for (int i = col; i < line.length(); i++) {
+ if (line[i] == '(') {
+ begin = i;
+ continue;
+ }
+ else if (line[i] == ')') {
+ end = i+1;
+ valid = true;
+ break;
+ }
+ }
+ if (valid) {
+ color_args = line.substr(begin, end-begin);
+ String stripped = color_args.replace(" ", "").replace("(", "").replace(")", "");
+ Vector<float> color = stripped.split_floats(",");
+ if (color.size() > 2) {
+ float alpha = color.size() > 3 ? color[3] : 1.0f;
+ color_picker->set_color(Color(color[0], color[1], color[2], alpha));
+ }
+ color_panel->set_pos(get_global_transform().xform(get_local_mouse_pos()));
+ Size2 ms = Size2(300, color_picker->get_combined_minimum_size().height+10);
+ color_panel->set_size(ms);
+ } else {
+ have_color = false;
+ }
+ }
+ _make_context_menu(have_selection, have_color);
+ }
+ }
+}
+
+void ScriptTextEditor::_color_changed(const Color& p_color) {
+ String new_args;
+ if (p_color.a == 1.0f) {
+ new_args = String("("+rtos(p_color.r)+", "+rtos(p_color.g)+", "+rtos(p_color.b)+")");
+ } else {
+ new_args = String("("+rtos(p_color.r)+", "+rtos(p_color.g)+", "+rtos(p_color.b)+", "+rtos(p_color.a)+")");
+ }
+
+ String line = code_editor->get_text_edit()->get_line(color_line);
+ String new_line = line.replace(color_args, new_args);
+ color_args = new_args;
+ code_editor->get_text_edit()->set_line(color_line, new_line);
+}
+
+void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color) {
+
+ context_menu->clear();
+ if (p_selection) {
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/cut"));
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/copy"));
+ }
+
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/paste"));
+ context_menu->add_separator();
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/select_all"));
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"));
+
+ if (p_selection) {
+ context_menu->add_separator();
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"));
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"));
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"));
+ }
+ if (p_color) {
+ context_menu->add_separator();
+ context_menu->add_item(TTR("Pick Color"), EDIT_PICK_COLOR);
+ }
+ context_menu->set_pos(get_global_transform().xform(get_local_mouse_pos()));
+ context_menu->set_size(Vector2(1, 1));
+ context_menu->popup();
+}
ScriptTextEditor::ScriptTextEditor() {
@@ -1197,6 +1292,19 @@ ScriptTextEditor::ScriptTextEditor() {
EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset"));
code_editor->get_text_edit()->set_select_identifiers_on_hover(true);
+ code_editor->get_text_edit()->set_context_menu_enabled(false);
+ code_editor->get_text_edit()->connect("input_event", this, "_text_edit_input_event");
+
+ context_menu = memnew(PopupMenu);
+ add_child(context_menu);
+ context_menu->connect("item_pressed", this, "_edit_option");
+
+ color_panel = memnew(PopupPanel);
+ add_child(color_panel);
+ color_picker = memnew(ColorPicker);
+ color_panel->add_child(color_picker);
+ color_panel->set_child_rect(color_picker);
+ color_picker->connect("color_changed", this, "_color_changed");
edit_hb = memnew (HBoxContainer);
@@ -1279,8 +1387,8 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/select_all", TTR("Select All"), KEY_MASK_CMD|KEY_A);
ED_SHORTCUT("script_text_editor/move_up", TTR("Move Up"), KEY_MASK_ALT|KEY_UP);
ED_SHORTCUT("script_text_editor/move_down", TTR("Move Down"), KEY_MASK_ALT|KEY_DOWN);
- ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), 0);
- ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), 0);
+ ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), KEY_MASK_ALT|KEY_LEFT);
+ ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), KEY_MASK_ALT|KEY_RIGHT);
ED_SHORTCUT("script_text_editor/toggle_comment", TTR("Toggle Comment"), KEY_MASK_CMD|KEY_K);
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD|KEY_B);
#ifdef OSX_ENABLED
diff --git a/tools/editor/plugins/script_text_editor.h b/tools/editor/plugins/script_text_editor.h
index 2c7eac6095..ceef50f0bc 100644
--- a/tools/editor/plugins/script_text_editor.h
+++ b/tools/editor/plugins/script_text_editor.h
@@ -30,6 +30,7 @@
#define SCRIPT_TEXT_EDITOR_H
#include "script_editor_plugin.h"
+#include "scene/gui/color_picker.h"
class ScriptTextEditor : public ScriptEditorBase {
@@ -47,10 +48,16 @@ class ScriptTextEditor : public ScriptEditorBase {
MenuButton *edit_menu;
MenuButton *search_menu;
+ PopupMenu *context_menu;
GotoLineDialog *goto_line_dialog;
ScriptEditorQuickOpen *quick_open;
+ PopupPanel *color_panel;
+ ColorPicker *color_picker;
+ int color_line;
+ String color_args;
+
enum {
EDIT_UNDO,
EDIT_REDO,
@@ -67,6 +74,7 @@ class ScriptTextEditor : public ScriptEditorBase {
EDIT_INDENT_RIGHT,
EDIT_INDENT_LEFT,
EDIT_CLONE_DOWN,
+ EDIT_PICK_COLOR,
SEARCH_FIND,
SEARCH_FIND_NEXT,
SEARCH_FIND_PREV,
@@ -96,6 +104,9 @@ protected:
static void _bind_methods();
void _edit_option(int p_op);
+ void _make_context_menu(bool p_selection, bool p_color);
+ void _text_edit_input_event(const InputEvent& ev);
+ void _color_changed(const Color& p_color);
void _goto_line(int p_line) { goto_line(p_line); }
void _lookup_symbol(const String& p_symbol,int p_row, int p_column);
diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp
index 5db331ba45..84568aa8c0 100644
--- a/tools/editor/plugins/theme_editor_plugin.cpp
+++ b/tools/editor/plugins/theme_editor_plugin.cpp
@@ -668,7 +668,7 @@ ThemeEditor::ThemeEditor() {
theme_menu = memnew( MenuButton );
- theme_menu->set_text("Theme");
+ theme_menu->set_text(TTR("Theme"));
theme_menu->get_popup()->add_item(TTR("Add Item"),POPUP_ADD);
theme_menu->get_popup()->add_item(TTR("Add Class Items"),POPUP_CLASS_ADD);
theme_menu->get_popup()->add_item(TTR("Remove Item"),POPUP_REMOVE);
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index b2eae2f6d1..18a4e845a0 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -506,7 +506,7 @@ void ProjectManager::_panel_draw(Node *p_hb) {
hb->draw_line(Point2(0,hb->get_size().y+1),Point2(hb->get_size().x-10,hb->get_size().y+1),get_color("guide_color","Tree"));
if (selected_list.has(hb->get_meta("name"))) {
- hb->draw_style_box(get_stylebox("selected","Tree"),Rect2(Point2(),hb->get_size()-Size2(10,0)));
+ hb->draw_style_box( gui_base->get_stylebox("selected","Tree"),Rect2(Point2(),hb->get_size()-Size2(10,0)));
}
}
@@ -753,7 +753,7 @@ void ProjectManager::_load_recent_projects() {
List<PropertyInfo> properties;
EditorSettings::get_singleton()->get_property_list(&properties);
- Color font_color = get_color("font_color","Tree");
+ Color font_color = gui_base->get_color("font_color","Tree");
List<ProjectItem> projects;
List<ProjectItem> favorite_projects;
@@ -864,6 +864,7 @@ void ProjectManager::_load_recent_projects() {
hb->set_meta("favorite",is_favorite);
hb->connect("draw",this,"_panel_draw",varray(hb));
hb->connect("input_event",this,"_panel_input",varray(hb));
+ hb->add_constant_override("separation",10*EDSCALE);
VBoxContainer *favorite_box = memnew( VBoxContainer );
TextureButton *favorite = memnew( TextureButton );
@@ -885,7 +886,7 @@ void ProjectManager::_load_recent_projects() {
ec->set_custom_minimum_size(Size2(0,1));
vb->add_child(ec);
Label *title = memnew( Label(project_name) );
- title->add_font_override("font",get_font("large","Fonts"));
+ title->add_font_override("font", gui_base->get_font("large","Fonts"));
title->add_color_override("font_color",font_color);
vb->add_child(title);
Label *fpath = memnew( Label(path) );
@@ -1205,6 +1206,7 @@ ProjectManager::ProjectManager() {
gui_base = memnew( Control );
add_child(gui_base);
gui_base->set_area_as_parent_rect();
+ gui_base->set_theme(create_custom_theme());
Panel *panel = memnew( Panel );
gui_base->add_child(panel);
@@ -1227,7 +1229,7 @@ ProjectManager::ProjectManager() {
CenterContainer *ccl = memnew( CenterContainer );
Label *l = memnew( Label );
l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager"));
- l->add_font_override("font",get_font("doc","EditorFonts"));
+ l->add_font_override("font", gui_base->get_font("doc","EditorFonts"));
ccl->add_child(l);
top_hb->add_child(ccl);
top_hb->add_spacer();
@@ -1263,7 +1265,7 @@ ProjectManager::ProjectManager() {
search_tree_vb->add_child(search_box);
PanelContainer *pc = memnew( PanelContainer);
- pc->add_style_override("panel",get_stylebox("bg","Tree"));
+ pc->add_style_override("panel", gui_base->get_stylebox("bg","Tree"));
search_tree_vb->add_child(pc);
pc->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -1392,8 +1394,6 @@ ProjectManager::ProjectManager() {
last_clicked = "";
SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped");
-
- gui_base->set_theme(create_custom_theme());
}
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 6641297491..7163836f73 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -3182,6 +3182,7 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CHECK );
item->set_text(1,TTR("On"));
+ item->set_tooltip(1, obj->get(p.name) ? "True" : "False");
item->set_checked( 1, obj->get( p.name ) );
if (show_type_icons)
item->set_icon( 0, get_icon("Bool","EditorIcons") );
@@ -3828,6 +3829,7 @@ void PropertyEditor::_item_edited() {
case Variant::BOOL: {
_edit_set(name,item->is_checked(1));
+ item->set_tooltip(1, item->is_checked(1) ? "True" : "False");
} break;
case Variant::INT:
case Variant::REAL: {
diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp
index 7fba73ca08..c8170ca9a3 100644
--- a/tools/editor/script_editor_debugger.cpp
+++ b/tools/editor/script_editor_debugger.cpp
@@ -216,6 +216,8 @@ void ScriptEditorDebugger::debug_continue() {
ERR_FAIL_COND(connection.is_null());
ERR_FAIL_COND(!connection->is_connected());
+ OS::get_singleton()->enable_for_stealing_focus(EditorNode::get_singleton()->get_child_process_id());
+
Array msg;
msg.push_back("continue");
ppeer->put_var(msg);
diff --git a/tools/pck/SCsub b/tools/pck/SCsub
deleted file mode 100644
index cf98ae145d..0000000000
--- a/tools/pck/SCsub
+++ /dev/null
@@ -1,4 +0,0 @@
-Import('env')
-
-if env["tools"] == "yes":
- env.add_source_files(env.tool_sources, "*.cpp")