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/math/vector3.cpp12
-rw-r--r--core/math/vector3.h197
-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.cpp6
-rw-r--r--core/variant_parser.cpp16
-rw-r--r--doc/base/classes.xml53
-rw-r--r--drivers/builtin_openssl2/SCsub3
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp58
-rw-r--r--drivers/gles2/shaders/material.glsl12
-rw-r--r--drivers/theora/SCsub44
-rw-r--r--main/main.cpp14
-rwxr-xr-xmethods.py6
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp36
-rw-r--r--modules/enet/networked_multiplayer_enet.h7
-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/animation/tween.cpp23
-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.cpp44
-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--servers/physics_2d/space_2d_sw.cpp3
-rw-r--r--servers/visual_server.cpp1
-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.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_editor_plugin.cpp21
-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
55 files changed, 707 insertions, 344 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/math/vector3.cpp b/core/math/vector3.cpp
index b4a13d8f6d..fae3831dd6 100644
--- a/core/math/vector3.cpp
+++ b/core/math/vector3.cpp
@@ -49,13 +49,13 @@ void Vector3::set_axis(int p_axis,real_t p_value) {
}
real_t Vector3::get_axis(int p_axis) const {
- ERR_FAIL_INDEX_V(p_axis,3,0);
- return operator[](p_axis);
+ ERR_FAIL_INDEX_V(p_axis,3,0);
+ return operator[](p_axis);
}
int Vector3::min_axis() const {
- return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2);
+ return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2);
}
int Vector3::max_axis() const {
@@ -71,9 +71,9 @@ void Vector3::snap(float p_val) {
}
Vector3 Vector3::snapped(float p_val) const {
- Vector3 v=*this;
- v.snap(p_val);
- return v;
+ Vector3 v=*this;
+ v.snap(p_val);
+ return v;
}
diff --git a/core/math/vector3.h b/core/math/vector3.h
index 910446023a..06840be5e7 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -63,77 +63,78 @@ struct Vector3 {
return coord[p_axis];
}
- void set_axis(int p_axis,real_t p_value);
- real_t get_axis(int p_axis) const;
+ void set_axis(int p_axis,real_t p_value);
+ real_t get_axis(int p_axis) const;
- int min_axis() const;
- int max_axis() const;
+ int min_axis() const;
+ int max_axis() const;
- _FORCE_INLINE_ real_t length() const;
- _FORCE_INLINE_ real_t length_squared() const;
+ _FORCE_INLINE_ real_t length() const;
+ _FORCE_INLINE_ real_t length_squared() const;
- _FORCE_INLINE_ void normalize();
- _FORCE_INLINE_ Vector3 normalized() const;
- _FORCE_INLINE_ Vector3 inverse() const;
+ _FORCE_INLINE_ void normalize();
+ _FORCE_INLINE_ Vector3 normalized() const;
+ _FORCE_INLINE_ Vector3 inverse() const;
_FORCE_INLINE_ void zero();
- void snap(float p_val);
- Vector3 snapped(float p_val) const;
+ void snap(float p_val);
+ Vector3 snapped(float p_val) const;
void rotate(const Vector3& p_axis,float p_phi);
Vector3 rotated(const Vector3& p_axis,float p_phi) const;
- /* Static Methods between 2 vector3s */
+ /* Static Methods between 2 vector3s */
- _FORCE_INLINE_ Vector3 linear_interpolate(const Vector3& p_b,float p_t) const;
+ _FORCE_INLINE_ Vector3 linear_interpolate(const Vector3& p_b,float p_t) const;
Vector3 cubic_interpolate(const Vector3& p_b,const Vector3& p_pre_a, const Vector3& p_post_b,float p_t) const;
Vector3 cubic_interpolaten(const Vector3& p_b,const Vector3& p_pre_a, const Vector3& p_post_b,float p_t) const;
- _FORCE_INLINE_ Vector3 cross(const Vector3& p_b) const;
- _FORCE_INLINE_ real_t dot(const Vector3& p_b) const;
+ _FORCE_INLINE_ Vector3 cross(const Vector3& p_b) const;
+ _FORCE_INLINE_ real_t dot(const Vector3& p_b) const;
- _FORCE_INLINE_ Vector3 abs() const;
- _FORCE_INLINE_ Vector3 floor() const;
- _FORCE_INLINE_ Vector3 ceil() const;
+ _FORCE_INLINE_ Vector3 abs() const;
+ _FORCE_INLINE_ Vector3 floor() const;
+ _FORCE_INLINE_ Vector3 ceil() const;
- _FORCE_INLINE_ real_t distance_to(const Vector3& p_b) const;
- _FORCE_INLINE_ real_t distance_squared_to(const Vector3& p_b) const;
+ _FORCE_INLINE_ real_t distance_to(const Vector3& p_b) const;
+ _FORCE_INLINE_ real_t distance_squared_to(const Vector3& p_b) const;
+ _FORCE_INLINE_ real_t angle_to(const Vector3& p_b) const;
_FORCE_INLINE_ Vector3 slide(const Vector3& p_vec) const;
_FORCE_INLINE_ Vector3 reflect(const Vector3& p_vec) const;
- /* Operators */
+ /* Operators */
- _FORCE_INLINE_ Vector3& operator+=(const Vector3& p_v);
- _FORCE_INLINE_ Vector3 operator+(const Vector3& p_v) const;
- _FORCE_INLINE_ Vector3& operator-=(const Vector3& p_v);
- _FORCE_INLINE_ Vector3 operator-(const Vector3& p_v) const;
- _FORCE_INLINE_ Vector3& operator*=(const Vector3& p_v);
- _FORCE_INLINE_ Vector3 operator*(const Vector3& p_v) const;
- _FORCE_INLINE_ Vector3& operator/=(const Vector3& p_v);
- _FORCE_INLINE_ Vector3 operator/(const Vector3& p_v) const;
+ _FORCE_INLINE_ Vector3& operator+=(const Vector3& p_v);
+ _FORCE_INLINE_ Vector3 operator+(const Vector3& p_v) const;
+ _FORCE_INLINE_ Vector3& operator-=(const Vector3& p_v);
+ _FORCE_INLINE_ Vector3 operator-(const Vector3& p_v) const;
+ _FORCE_INLINE_ Vector3& operator*=(const Vector3& p_v);
+ _FORCE_INLINE_ Vector3 operator*(const Vector3& p_v) const;
+ _FORCE_INLINE_ Vector3& operator/=(const Vector3& p_v);
+ _FORCE_INLINE_ Vector3 operator/(const Vector3& p_v) const;
- _FORCE_INLINE_ Vector3& operator*=(real_t p_scalar);
- _FORCE_INLINE_ Vector3 operator*(real_t p_scalar) const;
- _FORCE_INLINE_ Vector3& operator/=(real_t p_scalar);
- _FORCE_INLINE_ Vector3 operator/(real_t p_scalar) const;
+ _FORCE_INLINE_ Vector3& operator*=(real_t p_scalar);
+ _FORCE_INLINE_ Vector3 operator*(real_t p_scalar) const;
+ _FORCE_INLINE_ Vector3& operator/=(real_t p_scalar);
+ _FORCE_INLINE_ Vector3 operator/(real_t p_scalar) const;
- _FORCE_INLINE_ Vector3 operator-() const;
+ _FORCE_INLINE_ Vector3 operator-() const;
- _FORCE_INLINE_ bool operator==(const Vector3& p_v) const;
- _FORCE_INLINE_ bool operator!=(const Vector3& p_v) const;
- _FORCE_INLINE_ bool operator<(const Vector3& p_v) const;
+ _FORCE_INLINE_ bool operator==(const Vector3& p_v) const;
+ _FORCE_INLINE_ bool operator!=(const Vector3& p_v) const;
+ _FORCE_INLINE_ bool operator<(const Vector3& p_v) const;
_FORCE_INLINE_ bool operator<=(const Vector3& p_v) const;
operator String() const;
- _FORCE_INLINE_ Vector3() { x=y=z=0; }
- _FORCE_INLINE_ Vector3(real_t p_x,real_t p_y,real_t p_z) { x=p_x; y=p_y; z=p_z; }
+ _FORCE_INLINE_ Vector3() { x=y=z=0; }
+ _FORCE_INLINE_ Vector3(real_t p_x,real_t p_y,real_t p_z) { x=p_x; y=p_y; z=p_z; }
};
@@ -151,11 +152,12 @@ Vector3 Vector3::cross(const Vector3& p_b) const {
(x * p_b.y) - (y * p_b.x)
);
- return ret;
+ return ret;
}
+
real_t Vector3::dot(const Vector3& p_b) const {
- return x*p_b.x + y*p_b.y + z*p_b.z;
+ return x*p_b.x + y*p_b.y + z*p_b.z;
}
Vector3 Vector3::abs() const {
@@ -180,115 +182,119 @@ Vector3 Vector3::linear_interpolate(const Vector3& p_b,float p_t) const {
y+(p_t * (p_b.y-y)),
z+(p_t * (p_b.z-z))
);
-
}
-
-
real_t Vector3::distance_to(const Vector3& p_b) const {
+
return (p_b-*this).length();
}
+
real_t Vector3::distance_squared_to(const Vector3& p_b) const {
- return (p_b-*this).length_squared();
+ return (p_b-*this).length_squared();
+}
+
+real_t Vector3::angle_to(const Vector3& p_b) const {
+
+ return Math::acos(this->dot(p_b) / Math::sqrt(this->length_squared() * p_b.length_squared()));
}
/* Operators */
Vector3& Vector3::operator+=(const Vector3& p_v) {
- x+=p_v.x;
- y+=p_v.y;
- z+=p_v.z;
- return *this;
+ x+=p_v.x;
+ y+=p_v.y;
+ z+=p_v.z;
+ return *this;
}
+
Vector3 Vector3::operator+(const Vector3& p_v) const {
- return Vector3(x+p_v.x, y+p_v.y, z+ p_v.z);
+ return Vector3(x+p_v.x, y+p_v.y, z+ p_v.z);
}
Vector3& Vector3::operator-=(const Vector3& p_v) {
- x-=p_v.x;
- y-=p_v.y;
- z-=p_v.z;
- return *this;
+ x-=p_v.x;
+ y-=p_v.y;
+ z-=p_v.z;
+ return *this;
}
Vector3 Vector3::operator-(const Vector3& p_v) const {
- return Vector3(x-p_v.x, y-p_v.y, z- p_v.z);
+ return Vector3(x-p_v.x, y-p_v.y, z- p_v.z);
}
-
-
Vector3& Vector3::operator*=(const Vector3& p_v) {
- x*=p_v.x;
- y*=p_v.y;
- z*=p_v.z;
- return *this;
+ x*=p_v.x;
+ y*=p_v.y;
+ z*=p_v.z;
+ return *this;
}
Vector3 Vector3::operator*(const Vector3& p_v) const {
- return Vector3(x*p_v.x, y*p_v.y, z* p_v.z);
+ return Vector3(x*p_v.x, y*p_v.y, z* p_v.z);
}
Vector3& Vector3::operator/=(const Vector3& p_v) {
- x/=p_v.x;
- y/=p_v.y;
- z/=p_v.z;
- return *this;
+ x/=p_v.x;
+ y/=p_v.y;
+ z/=p_v.z;
+ return *this;
}
+
Vector3 Vector3::operator/(const Vector3& p_v) const {
- return Vector3(x/p_v.x, y/p_v.y, z/ p_v.z);
+ return Vector3(x/p_v.x, y/p_v.y, z/ p_v.z);
}
Vector3& Vector3::operator*=(real_t p_scalar) {
- x*=p_scalar;
- y*=p_scalar;
- z*=p_scalar;
- return *this;
+ x*=p_scalar;
+ y*=p_scalar;
+ z*=p_scalar;
+ return *this;
}
_FORCE_INLINE_ Vector3 operator*(real_t p_scalar, const Vector3& p_vec) {
+
return p_vec * p_scalar;
}
Vector3 Vector3::operator*(real_t p_scalar) const {
- return Vector3( x*p_scalar, y*p_scalar, z*p_scalar);
+ return Vector3( x*p_scalar, y*p_scalar, z*p_scalar);
}
Vector3& Vector3::operator/=(real_t p_scalar) {
- x/=p_scalar;
- y/=p_scalar;
- z/=p_scalar;
- return *this;
+ x/=p_scalar;
+ y/=p_scalar;
+ z/=p_scalar;
+ return *this;
}
Vector3 Vector3::operator/(real_t p_scalar) const {
- return Vector3( x/p_scalar, y/p_scalar, z/p_scalar);
+ return Vector3( x/p_scalar, y/p_scalar, z/p_scalar);
}
Vector3 Vector3::operator-() const {
- return Vector3( -x, -y, -z );
+ return Vector3( -x, -y, -z );
}
-
bool Vector3::operator==(const Vector3& p_v) const {
- return (x==p_v.x && y==p_v.y && z==p_v.z);
+ return (x==p_v.x && y==p_v.y && z==p_v.z);
}
bool Vector3::operator!=(const Vector3& p_v) const {
- return (x!=p_v.x || y!=p_v.y || z!=p_v.z);
+ return (x!=p_v.x || y!=p_v.y || z!=p_v.z);
}
bool Vector3::operator<(const Vector3& p_v) const {
@@ -298,9 +304,9 @@ bool Vector3::operator<(const Vector3& p_v) const {
return z<p_v.z;
else
return y<p_v.y;
- } else
+ } else {
return x<p_v.x;
-
+ }
}
bool Vector3::operator<=(const Vector3& p_v) const {
@@ -310,9 +316,9 @@ bool Vector3::operator<=(const Vector3& p_v) const {
return z<=p_v.z;
else
return y<p_v.y;
- } else
+ } else {
return x<p_v.x;
-
+ }
}
_FORCE_INLINE_ Vector3 vec3_cross(const Vector3& p_a, const Vector3& p_b) {
@@ -333,6 +339,7 @@ real_t Vector3::length() const {
return Math::sqrt(x2+y2+z2);
}
+
real_t Vector3::length_squared() const {
real_t x2=x*x;
@@ -340,27 +347,25 @@ real_t Vector3::length_squared() const {
real_t z2=z*z;
return x2+y2+z2;
-
}
void Vector3::normalize() {
- real_t l=length();
- if (l==0) {
-
+ real_t l=length();
+ if (l==0) {
x=y=z=0;
- } else {
-
+ } else {
x/=l;
y/=l;
z/=l;
- }
+ }
}
+
Vector3 Vector3::normalized() const {
- Vector3 v=*this;
- v.normalize();
- return v;
+ Vector3 v=*this;
+ v.normalize();
+ return v;
}
Vector3 Vector3::inverse() const {
@@ -377,10 +382,10 @@ Vector3 Vector3::slide(const Vector3& p_vec) const {
return p_vec - *this * this->dot(p_vec);
}
+
Vector3 Vector3::reflect(const Vector3& p_vec) const {
return p_vec - *this * this->dot(p_vec) * 2.0;
-
}
#endif
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..51cd4c2399 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -375,6 +375,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM0R(Vector3, ceil);
VCALL_LOCALMEM1R(Vector3, distance_to);
VCALL_LOCALMEM1R(Vector3, distance_squared_to);
+ VCALL_LOCALMEM1R(Vector3, angle_to);
VCALL_LOCALMEM1R(Vector3, slide);
VCALL_LOCALMEM1R(Vector3, reflect);
@@ -465,8 +466,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);
@@ -1487,6 +1488,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(VECTOR3,VECTOR3,Vector3,ceil,varray());
ADDFUNC1(VECTOR3,REAL,Vector3,distance_to,VECTOR3,"b",varray());
ADDFUNC1(VECTOR3,REAL,Vector3,distance_squared_to,VECTOR3,"b",varray());
+ ADDFUNC1(VECTOR3,REAL,Vector3,angle_to,VECTOR3,"to",varray());
ADDFUNC1(VECTOR3,VECTOR3,Vector3,slide,VECTOR3,"by",varray());
ADDFUNC1(VECTOR3,VECTOR3,Vector3,reflect,VECTOR3,"by",varray());
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 023605a952..6b3828a572 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -986,7 +986,18 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
InputEvent ie;
- if (id=="KEY") {
+ if (id=="NONE") {
+
+ ie.type=InputEvent::NONE;
+
+ get_token(p_stream,token,line,r_err_str);
+
+ if (token.type!=TK_PARENTHESIS_CLOSE) {
+ r_err_str="Expected ')'";
+ return ERR_PARSE_ERROR;
+ }
+
+ } else if (id=="KEY") {
get_token(p_stream,token,line,r_err_str);
if (token.type!=TK_COMMA) {
@@ -2093,6 +2104,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
case InputEvent::JOYSTICK_MOTION: {
str+="JAXIS,"+itos(ev.joy_motion.axis)+","+itos(ev.joy_motion.axis_value);
} break;
+ case InputEvent::NONE: {
+ str+="NONE";
+ } break;
default: {}
}
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index deed5c5cda..a65f4abc46 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>
@@ -44177,10 +44206,10 @@
</return>
<argument index="0" name="object" type="Object">
</argument>
- <argument index="1" name="key" type="String">
+ <argument index="1" name="key" type="String" default="&quot;&quot;">
</argument>
<description>
- Stop animating and completely remove a tween, given its object and property/method pair.
+ Stop animating and completely remove a tween, given its object and property/method pair. Passing empty String as key will remove all tweens for given object.
</description>
</method>
<method name="remove_all">
@@ -44195,10 +44224,10 @@
</return>
<argument index="0" name="object" type="Object">
</argument>
- <argument index="1" name="key" type="String">
+ <argument index="1" name="key" type="String" default="&quot;&quot;">
</argument>
<description>
- Resets a tween to the initial value (the one given, not the one before the tween), given its object and property/method pair.
+ Resets a tween to the initial value (the one given, not the one before the tween), given its object and property/method pair. Passing empty String as key will reset all tweens for given object.
</description>
</method>
<method name="reset_all">
@@ -44213,10 +44242,10 @@
</return>
<argument index="0" name="object" type="Object">
</argument>
- <argument index="1" name="key" type="String">
+ <argument index="1" name="key" type="String" default="&quot;&quot;">
</argument>
<description>
- Continue animating a stopped tween, given its object and property/method pair.
+ Continue animating a stopped tween, given its object and property/method pair. Passing empty String as key will resume all tweens for given object.
</description>
</method>
<method name="resume_all">
@@ -44275,10 +44304,10 @@
</return>
<argument index="0" name="object" type="Object">
</argument>
- <argument index="1" name="key" type="String">
+ <argument index="1" name="key" type="String" default="&quot;&quot;">
</argument>
<description>
- Stop animating a tween, given its object and property/method pair.
+ Stop animating a tween, given its object and property/method pair. Passing empty String as key will stop all tweens for given object.
</description>
</method>
<method name="stop_all">
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..a7edc8d935 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
@@ -5455,9 +5456,16 @@ void RasterizerGLES2::_setup_light(uint16_t p_light) {
}
- light_data[VL_LIGHT_ATTENUATION][0]=l->vars[VS::LIGHT_PARAM_ENERGY];
- light_data[VL_LIGHT_ATTENUATION][1]=l->vars[VS::LIGHT_PARAM_RADIUS];
- light_data[VL_LIGHT_ATTENUATION][2]=l->vars[VS::LIGHT_PARAM_ATTENUATION];
+ light_data[VL_LIGHT_ATTENUATION][0] = l->vars[VS::LIGHT_PARAM_ENERGY];
+
+ if (l->type == VS::LIGHT_DIRECTIONAL) {
+ light_data[VL_LIGHT_ATTENUATION][1] = l->directional_shadow_param[VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_MAX_DISTANCE];
+ }
+ else{
+ light_data[VL_LIGHT_ATTENUATION][1] = l->vars[VS::LIGHT_PARAM_RADIUS];
+ }
+
+ light_data[VL_LIGHT_ATTENUATION][2] = l->vars[VS::LIGHT_PARAM_ATTENUATION];
light_data[VL_LIGHT_SPOT_ATTENUATION][0]=Math::cos(Math::deg2rad(l->vars[VS::LIGHT_PARAM_SPOT_ANGLE]));
light_data[VL_LIGHT_SPOT_ATTENUATION][1]=l->vars[VS::LIGHT_PARAM_SPOT_ATTENUATION];
@@ -10813,14 +10821,52 @@ void RasterizerGLES2::init() {
print_line(String("GLES2: Using GLEW ") + (const char*) glewGetString(GLEW_VERSION));
}
+ // Godot makes use of functions from ARB_framebuffer_object extension which is not implemented by all drivers.
+ // On the other hand, these drivers might implement the older EXT_framebuffer_object extension
+ // with which current source code is backward compatible.
+
+ bool framebuffer_object_is_supported = glewIsSupported("GL_ARB_framebuffer_object");
+
+ if ( !framebuffer_object_is_supported ) {
+ WARN_PRINT("GL_ARB_framebuffer_object not supported by your graphics card.");
+
+ if ( glewIsSupported("GL_EXT_framebuffer_object") ) {
+ // falling-back to the older EXT function if present
+ WARN_PRINT("Falling-back to GL_EXT_framebuffer_object.");
+
+ glIsRenderbuffer = glIsRenderbufferEXT;
+ glBindRenderbuffer = glBindRenderbufferEXT;
+ glDeleteRenderbuffers = glDeleteRenderbuffersEXT;
+ glGenRenderbuffers = glGenRenderbuffersEXT;
+ glRenderbufferStorage = glRenderbufferStorageEXT;
+ glGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT;
+ glIsFramebuffer = glIsFramebufferEXT;
+ glBindFramebuffer = glBindFramebufferEXT;
+ glDeleteFramebuffers = glDeleteFramebuffersEXT;
+ glGenFramebuffers = glGenFramebuffersEXT;
+ glCheckFramebufferStatus = glCheckFramebufferStatusEXT;
+ glFramebufferTexture1D = glFramebufferTexture1DEXT;
+ glFramebufferTexture2D = glFramebufferTexture2DEXT;
+ glFramebufferTexture3D = glFramebufferTexture3DEXT;
+ glFramebufferRenderbuffer = glFramebufferRenderbufferEXT;
+ glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT;
+ glGenerateMipmap = glGenerateMipmapEXT;
+
+ framebuffer_object_is_supported = true;
+ }
+ else {
+ ERR_PRINT("Framebuffer Object is not supported by your graphics card.");
+ }
+ }
+
// Check for GL 2.1 compatibility, if not bail out
- if (!glewIsSupported("GL_VERSION_2_1")) {
+ if (!(glewIsSupported("GL_VERSION_2_1") && framebuffer_object_is_supported)) {
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/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl
index 477a451f2f..e5be25757d 100644
--- a/drivers/gles2/shaders/material.glsl
+++ b/drivers/gles2/shaders/material.glsl
@@ -980,6 +980,12 @@ FRAGMENT_SHADER_CODE
#ifdef LIGHT_USE_SHADOW
#ifdef LIGHT_TYPE_DIRECTIONAL
+ float shadow_fade_exponent=5.0; //hardcoded for now
+ float shadow_fade=pow(length(vertex_interp)/light_attenuation.g,shadow_fade_exponent);
+
+// optimization - skip shadows outside visible range
+ if(shadow_fade<1.0){
+
#ifdef LIGHT_USE_PSSM
@@ -1105,6 +1111,12 @@ FRAGMENT_SHADER_CODE
shadow_attenuation=SAMPLE_SHADOW_TEX(shadow_coord.xy,shadow_coord.z);
#endif
+
+ shadow_attenuation=mix(shadow_attenuation,1.0,shadow_fade);
+ }else{
+ shadow_attenuation=1.0;
+ };
+
#endif
#ifdef LIGHT_TYPE_OMNI
diff --git a/drivers/theora/SCsub b/drivers/theora/SCsub
index fa85b49804..94477d2827 100644
--- a/drivers/theora/SCsub
+++ b/drivers/theora/SCsub
@@ -1,11 +1,11 @@
Import('env')
sources = [
- "theora/analyze.c",
- "theora/apiwrapper.c",
+ #"theora/analyze.c",
+ #"theora/apiwrapper.c",
"theora/bitpack.c",
"theora/cpu.c",
- "theora/decapiwrapper.c",
+ #"theora/decapiwrapper.c",
"theora/decinfo.c",
"theora/decode.c",
"theora/dequant.c",
@@ -13,55 +13,53 @@ sources = [
#"theora/encfrag.c",
#"theora/encinfo.c",
#"theora/encode.c",
- "theora/encoder_disabled.c",
- "theora/enquant.c",
- "theora/fdct.c",
+ #"theora/encoder_disabled.c",
+ #"theora/enquant.c",
+ #"theora/fdct.c",
"theora/fragment.c",
"theora/huffdec.c",
- "theora/huffenc.c",
+ #"theora/huffenc.c",
"theora/idct.c",
"theora/info.c",
"theora/internal.c",
- "theora/mathops.c",
- "theora/mcenc.c",
+ #"theora/mathops.c",
+ #"theora/mcenc.c",
"theora/quant.c",
- "theora/rate.c",
+ #"theora/rate.c",
"theora/state.c",
- "theora/tokenize.c",
+ #"theora/tokenize.c",
"theora/video_stream_theora.cpp",
]
sources_x86 = [
- "theora/x86/mmxencfrag.c",
- "theora/x86/mmxfdct.c",
+ #"theora/x86/mmxencfrag.c",
+ #"theora/x86/mmxfdct.c",
"theora/x86/mmxfrag.c",
"theora/x86/mmxidct.c",
"theora/x86/mmxstate.c",
- "theora/x86/sse2fdct.c",
- "theora/x86/x86enc.c",
+ #"theora/x86/sse2fdct.c",
+ #"theora/x86/x86enc.c",
"theora/x86/x86state.c",
]
sources_x86_vc = [
- "theora/x86_vc/mmxencfrag.c",
- "theora/x86_vc/mmxfdct.c",
+ #"theora/x86_vc/mmxencfrag.c",
+ #"theora/x86_vc/mmxfdct.c",
"theora/x86_vc/mmxfrag.c",
"theora/x86_vc/mmxidct.c",
"theora/x86_vc/mmxstate.c",
- "theora/x86_vc/x86enc.c",
+ #"theora/x86_vc/x86enc.c",
"theora/x86_vc/x86state.c",
]
env.drivers_sources += sources
if (env["x86_opt_gcc"]):
- env.Append(CCFLAGS=["-DOC_X86_ASM"])
env.drivers_sources += sources_x86
if (env["x86_opt_vc"]):
- env.Append(CCFLAGS=["-DOC_X86_ASM"])
env.drivers_sources += sources_x86_vc
-
-
-
+if (env["x86_opt_gcc"] or env["x86_opt_vc"]):
+ Import('env_drivers')
+ env_drivers.Append(CCFLAGS=["-DOC_X86_ASM"])
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/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index 4134ed037f..c1dc72a32f 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -32,7 +32,7 @@ Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int
host = enet_host_create (& address /* the address to bind the server host to */,
p_max_clients /* allow up to 32 clients and/or outgoing connections */,
- 2 /* allow up to 2 channels to be used, 0 and 1 */,
+ SYSCH_MAX /* allow up to SYSCH_MAX channels to be used */,
p_in_bandwidth /* assume any amount of incoming bandwidth */,
p_out_bandwidth /* assume any amount of outgoing bandwidth */);
@@ -52,7 +52,7 @@ Error NetworkedMultiplayerENet::create_client(const IP_Address& p_ip, int p_port
host = enet_host_create (NULL /* create a client host */,
1 /* only allow 1 outgoing connection */,
- 2 /* allow up 2 channels to be used, 0 and 1 */,
+ SYSCH_MAX /* allow up to SYSCH_MAX channels to be used */,
p_in_bandwidth /* 56K modem with 56 Kbps downstream bandwidth */,
p_out_bandwidth /* 56K modem with 14 Kbps upstream bandwidth */);
@@ -70,8 +70,8 @@ Error NetworkedMultiplayerENet::create_client(const IP_Address& p_ip, int p_port
unique_id=_gen_unique_id();
- /* Initiate the connection, allocating the two channels 0 and 1. */
- ENetPeer *peer = enet_host_connect (host, & address, 2, unique_id);
+ /* Initiate the connection, allocating the enough channels */
+ ENetPeer *peer = enet_host_connect (host, & address, SYSCH_MAX, unique_id);
if (peer == NULL) {
enet_host_destroy(host);
@@ -148,12 +148,12 @@ void NetworkedMultiplayerENet::poll(){
ENetPacket * packet = enet_packet_create (NULL,8,ENET_PACKET_FLAG_RELIABLE);
encode_uint32(SYSMSG_ADD_PEER,&packet->data[0]);
encode_uint32(E->key(),&packet->data[4]);
- enet_peer_send(event.peer,1,packet);
+ enet_peer_send(event.peer,SYSCH_CONFIG,packet);
//send the new peer to existing peers
packet = enet_packet_create (NULL,8,ENET_PACKET_FLAG_RELIABLE);
encode_uint32(SYSMSG_ADD_PEER,&packet->data[0]);
encode_uint32(*new_id,&packet->data[4]);
- enet_peer_send(E->get(),1,packet);
+ enet_peer_send(E->get(),SYSCH_CONFIG,packet);
}
} else {
@@ -185,7 +185,7 @@ void NetworkedMultiplayerENet::poll(){
ENetPacket* packet = enet_packet_create (NULL,8,ENET_PACKET_FLAG_RELIABLE);
encode_uint32(SYSMSG_REMOVE_PEER,&packet->data[0]);
encode_uint32(*id,&packet->data[4]);
- enet_peer_send(E->get(),1,packet);
+ enet_peer_send(E->get(),SYSCH_CONFIG,packet);
}
} else if (!server) {
emit_signal("server_disconnected");
@@ -204,7 +204,7 @@ void NetworkedMultiplayerENet::poll(){
case ENET_EVENT_TYPE_RECEIVE: {
- if (event.channelID==1) {
+ if (event.channelID==SYSCH_CONFIG) {
//some config message
ERR_CONTINUE( event.packet->dataLength < 8);
@@ -226,7 +226,7 @@ void NetworkedMultiplayerENet::poll(){
}
enet_packet_destroy(event.packet);
- } else if (event.channelID==0){
+ } else if (event.channelID < SYSCH_MAX){
Packet packet;
packet.packet = event.packet;
@@ -258,7 +258,7 @@ void NetworkedMultiplayerENet::poll(){
ENetPacket* packet2 = enet_packet_create (packet.packet->data,packet.packet->dataLength,flags);
- enet_peer_send(E->get(),0,packet2);
+ enet_peer_send(E->get(),event.channelID,packet2);
}
} else if (target<0) {
@@ -272,7 +272,7 @@ void NetworkedMultiplayerENet::poll(){
ENetPacket* packet2 = enet_packet_create (packet.packet->data,packet.packet->dataLength,flags);
- enet_peer_send(E->get(),0,packet2);
+ enet_peer_send(E->get(),event.channelID,packet2);
}
if (-target != 1) {
@@ -289,7 +289,7 @@ void NetworkedMultiplayerENet::poll(){
} else {
//to someone else, specifically
ERR_CONTINUE(!peer_map.has(target));
- enet_peer_send(peer_map[target],0,packet.packet);
+ enet_peer_send(peer_map[target],event.channelID,packet.packet);
}
} else {
@@ -369,16 +369,20 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer,int p_buffer_
ERR_FAIL_COND_V(connection_status!=CONNECTION_CONNECTED,ERR_UNCONFIGURED);
int packet_flags=0;
+ int channel=SYSCH_RELIABLE;
switch(transfer_mode) {
case TRANSFER_MODE_UNRELIABLE: {
packet_flags=ENET_PACKET_FLAG_UNSEQUENCED;
+ channel=SYSCH_UNRELIABLE;
} break;
case TRANSFER_MODE_UNRELIABLE_ORDERED: {
packet_flags=0;
+ channel=SYSCH_UNRELIABLE;
} break;
case TRANSFER_MODE_RELIABLE: {
packet_flags=ENET_PACKET_FLAG_RELIABLE;
+ channel=SYSCH_RELIABLE;
} break;
}
@@ -402,7 +406,7 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer,int p_buffer_
if (server) {
if (target_peer==0) {
- enet_host_broadcast(host,0,packet);
+ enet_host_broadcast(host,channel,packet);
} else if (target_peer<0) {
//send to all but one
//and make copies for sending
@@ -416,18 +420,18 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer,int p_buffer_
ENetPacket* packet2 = enet_packet_create (packet->data,packet->dataLength,packet_flags);
- enet_peer_send(F->get(),0,packet2);
+ enet_peer_send(F->get(),channel,packet2);
}
enet_packet_destroy(packet); //original packet no longer needed
} else {
- enet_peer_send (E->get(), 0, packet);
+ enet_peer_send (E->get(), channel, packet);
}
} else {
ERR_FAIL_COND_V(!peer_map.has(1),ERR_BUG);
- enet_peer_send (peer_map[1], 0, packet); //send to server for broadcast..
+ enet_peer_send (peer_map[1], channel, packet); //send to server for broadcast..
}
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index 59863c1f78..f64db4561e 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -23,6 +23,13 @@ private:
SYSMSG_REMOVE_PEER
};
+ enum {
+ SYSCH_CONFIG,
+ SYSCH_RELIABLE,
+ SYSCH_UNRELIABLE,
+ SYSCH_MAX
+ };
+
bool active;
bool server;
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/animation/tween.cpp b/scene/animation/tween.cpp
index adc8f9c8cf..156f4956bb 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -199,13 +199,13 @@ void Tween::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_tween_process_mode"),&Tween::get_tween_process_mode);
ObjectTypeDB::bind_method(_MD("start"),&Tween::start );
- ObjectTypeDB::bind_method(_MD("reset","object","key"),&Tween::reset );
+ ObjectTypeDB::bind_method(_MD("reset","object","key"),&Tween::reset, DEFVAL("") );
ObjectTypeDB::bind_method(_MD("reset_all"),&Tween::reset_all );
- ObjectTypeDB::bind_method(_MD("stop","object","key"),&Tween::stop );
+ ObjectTypeDB::bind_method(_MD("stop","object","key"),&Tween::stop, DEFVAL("") );
ObjectTypeDB::bind_method(_MD("stop_all"),&Tween::stop_all );
- ObjectTypeDB::bind_method(_MD("resume","object","key"),&Tween::resume );
+ ObjectTypeDB::bind_method(_MD("resume","object","key"),&Tween::resume, DEFVAL("") );
ObjectTypeDB::bind_method(_MD("resume_all"),&Tween::resume_all );
- ObjectTypeDB::bind_method(_MD("remove","object","key"),&Tween::remove );
+ ObjectTypeDB::bind_method(_MD("remove","object","key"),&Tween::remove, DEFVAL("") );
ObjectTypeDB::bind_method(_MD("remove_all"),&Tween::remove_all );
ObjectTypeDB::bind_method(_MD("seek","time"),&Tween::seek );
ObjectTypeDB::bind_method(_MD("tell"),&Tween::tell );
@@ -723,7 +723,7 @@ bool Tween::reset(Object *p_object, String p_key) {
if(object == NULL)
continue;
- if(object == p_object && data.key == p_key) {
+ if(object == p_object && (data.key == p_key || p_key == "")) {
data.elapsed = 0;
data.finish = false;
@@ -759,7 +759,7 @@ bool Tween::stop(Object *p_object, String p_key) {
Object *object = ObjectDB::get_instance(data.id);
if(object == NULL)
continue;
- if(object == p_object && data.key == p_key)
+ if(object == p_object && (data.key == p_key || p_key == ""))
data.active = false;
}
pending_update --;
@@ -793,7 +793,7 @@ bool Tween::resume(Object *p_object, String p_key) {
Object *object = ObjectDB::get_instance(data.id);
if(object == NULL)
continue;
- if(object == p_object && data.key == p_key)
+ if(object == p_object && (data.key == p_key || p_key == ""))
data.active = true;
}
pending_update --;
@@ -821,17 +821,20 @@ bool Tween::remove(Object *p_object, String p_key) {
call_deferred("remove", p_object, p_key);
return true;
}
+ List<List<InterpolateData>::Element *> for_removal;
for(List<InterpolateData>::Element *E=interpolates.front();E;E=E->next()) {
InterpolateData& data = E->get();
Object *object = ObjectDB::get_instance(data.id);
if(object == NULL)
continue;
- if(object == p_object && data.key == p_key) {
- interpolates.erase(E);
- return true;
+ if(object == p_object && (data.key == p_key || p_key == "")) {
+ for_removal.push_back(E);
}
}
+ for(List<List<InterpolateData>::Element *>::Element *E=for_removal.front();E;E=E->next()) {
+ interpolates.erase(E->get());
+ }
return true;
}
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..ca9c666c01 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");
@@ -1701,16 +1704,11 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
} break;
case TreeItem::CELL_MODE_CHECK: {
- Ref<Texture> checked = cache.checked;
bring_up_editor=false; //checkboxes are not edited with editor
- if (x>=0 && x<= checked->get_width()+cache.hseparation ) {
-
-
- p_item->set_checked(col,!c.checked);
- item_edited(col,p_item);
- click_handled=true;
- //p_item->edited_signal.call(col);
- }
+ p_item->set_checked(col, !c.checked);
+ item_edited(col, p_item);
+ click_handled = true;
+ //p_item->edited_signal.call(col);
} break;
case TreeItem::CELL_MODE_RANGE:
@@ -2681,11 +2679,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 +2735,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/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index d0dcee7763..3d702ebb93 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -81,6 +81,9 @@ int Physics2DDirectSpaceStateSW::intersect_point(const Vector2& p_point,ShapeRes
if (!shape->contains_point(local_point))
continue;
+ if (cc>=p_result_max)
+ continue;
+
r_results[cc].collider_id=col_obj->get_instance_id();
if (r_results[cc].collider_id!=0)
r_results[cc].collider=ObjectDB::get_instance(r_results[cc].collider_id);
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index f69580254c..5a49be67da 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -531,6 +531,7 @@ void VisualServer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("canvas_item_set_self_opacity"),&VisualServer::canvas_item_set_self_opacity);
ObjectTypeDB::bind_method(_MD("canvas_item_get_self_opacity"),&VisualServer::canvas_item_get_self_opacity);
ObjectTypeDB::bind_method(_MD("canvas_item_set_z"),&VisualServer::canvas_item_set_z);
+ ObjectTypeDB::bind_method(_MD("canvas_item_set_sort_children_by_y"),&VisualServer::canvas_item_set_sort_children_by_y);
ObjectTypeDB::bind_method(_MD("canvas_item_add_line"),&VisualServer::canvas_item_add_line, DEFVAL(1.0), DEFVAL(false));
ObjectTypeDB::bind_method(_MD("canvas_item_add_rect"),&VisualServer::canvas_item_add_rect);
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.h b/tools/editor/editor_node.h
index c1c5885091..6392b96f8f 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -701,6 +701,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_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index fd25843de9..3cd6d8336a 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -755,29 +755,10 @@ void ScriptEditor::_menu_option(int p_option) {
} break;
case FILE_SAVE_ALL: {
- if (!_test_script_times_on_disk())
+ if (_test_script_times_on_disk())
return;
save_all_scripts();
-
-#if 0
- for(int i=0;i<tab_container->get_child_count();i++) {
-
- ScriptTextEditor *se = tab_container->get_child(i)->cast_to<ScriptTextEditor>();
- if (!se)
- continue;
-
-
- Ref<Script> script = se->get_edited_script();
-
- if (script->get_path()=="" || script->get_path().find("local://")!=-1 || script->get_path().find("::")!=-1)
- continue; //internal script, who cares
-
-
- editor->save_resource( script );
- }
-
-#endif
} break;
case FILE_IMPORT_THEME: {
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
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")