diff options
97 files changed, 729 insertions, 214 deletions
diff --git a/bin/tests/test_containers.cpp b/bin/tests/test_containers.cpp index db877fcc1c..f8cc8ccd41 100644 --- a/bin/tests/test_containers.cpp +++ b/bin/tests/test_containers.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_containers.h b/bin/tests/test_containers.h index 3bfdef301b..72d5c0ff7a 100644 --- a/bin/tests/test_containers.h +++ b/bin/tests/test_containers.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_detailer.cpp b/bin/tests/test_detailer.cpp index ce318632dd..616356077e 100644 --- a/bin/tests/test_detailer.cpp +++ b/bin/tests/test_detailer.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_detailer.h b/bin/tests/test_detailer.h index a410f6a67a..597e088caf 100644 --- a/bin/tests/test_detailer.h +++ b/bin/tests/test_detailer.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_gdscript.cpp b/bin/tests/test_gdscript.cpp index 68209ecb54..683191fba2 100644 --- a/bin/tests/test_gdscript.cpp +++ b/bin/tests/test_gdscript.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_gdscript.h b/bin/tests/test_gdscript.h index f599b9c9e1..225654e2a8 100644 --- a/bin/tests/test_gdscript.h +++ b/bin/tests/test_gdscript.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_gui.cpp b/bin/tests/test_gui.cpp index c404623872..cba488a3da 100644 --- a/bin/tests/test_gui.cpp +++ b/bin/tests/test_gui.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_gui.h b/bin/tests/test_gui.h index 556b45462a..5526320b0c 100644 --- a/bin/tests/test_gui.h +++ b/bin/tests/test_gui.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_image.cpp b/bin/tests/test_image.cpp index b378755dfe..bf9851cf01 100644 --- a/bin/tests/test_image.cpp +++ b/bin/tests/test_image.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_image.h b/bin/tests/test_image.h index 8812658464..09b33e799e 100644 --- a/bin/tests/test_image.h +++ b/bin/tests/test_image.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_io.cpp b/bin/tests/test_io.cpp index 4c211a1b0d..a1eb2be19b 100644 --- a/bin/tests/test_io.cpp +++ b/bin/tests/test_io.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_io.h b/bin/tests/test_io.h index 27a5118cf0..c839590ab9 100644 --- a/bin/tests/test_io.h +++ b/bin/tests/test_io.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_main.cpp b/bin/tests/test_main.cpp index 5567145aa0..8143a95d66 100644 --- a/bin/tests/test_main.cpp +++ b/bin/tests/test_main.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_main.h b/bin/tests/test_main.h index d1898387eb..c8d571a7dd 100644 --- a/bin/tests/test_main.h +++ b/bin/tests/test_main.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_math.cpp b/bin/tests/test_math.cpp index d340515c65..b5041b265f 100644 --- a/bin/tests/test_math.cpp +++ b/bin/tests/test_math.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_math.h b/bin/tests/test_math.h index 3209ebcef6..492c3a1837 100644 --- a/bin/tests/test_math.h +++ b/bin/tests/test_math.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_misc.cpp b/bin/tests/test_misc.cpp index d6ea193853..68564c62b0 100644 --- a/bin/tests/test_misc.cpp +++ b/bin/tests/test_misc.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_misc.h b/bin/tests/test_misc.h index ac751e5cc9..55608f6a0e 100644 --- a/bin/tests/test_misc.h +++ b/bin/tests/test_misc.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_particles.cpp b/bin/tests/test_particles.cpp index 18b52444d8..bafd78eda0 100644 --- a/bin/tests/test_particles.cpp +++ b/bin/tests/test_particles.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_particles.h b/bin/tests/test_particles.h index e5e3cfab15..e95637a4e6 100644 --- a/bin/tests/test_particles.h +++ b/bin/tests/test_particles.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_physics.cpp b/bin/tests/test_physics.cpp index e3fd96ff9d..ce96f37f3f 100644 --- a/bin/tests/test_physics.cpp +++ b/bin/tests/test_physics.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_physics.h b/bin/tests/test_physics.h index f62806bf5e..5b6a54f2d4 100644 --- a/bin/tests/test_physics.h +++ b/bin/tests/test_physics.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_physics_2d.cpp b/bin/tests/test_physics_2d.cpp index 70a7d868be..c5fb734999 100644 --- a/bin/tests/test_physics_2d.cpp +++ b/bin/tests/test_physics_2d.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_physics_2d.h b/bin/tests/test_physics_2d.h index eadd5ebcb4..e2eb1f4023 100644 --- a/bin/tests/test_physics_2d.h +++ b/bin/tests/test_physics_2d.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_python.cpp b/bin/tests/test_python.cpp index a89e4a7eee..575caf2513 100644 --- a/bin/tests/test_python.cpp +++ b/bin/tests/test_python.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_python.h b/bin/tests/test_python.h index 9dafbd545d..77e9603fe2 100644 --- a/bin/tests/test_python.h +++ b/bin/tests/test_python.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_render.cpp b/bin/tests/test_render.cpp index 97a52b16c1..568699e5e6 100644 --- a/bin/tests/test_render.cpp +++ b/bin/tests/test_render.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_render.h b/bin/tests/test_render.h index dc71a32978..6993e75b9f 100644 --- a/bin/tests/test_render.h +++ b/bin/tests/test_render.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_shader_lang.cpp b/bin/tests/test_shader_lang.cpp index df826e489d..e55ad3074f 100644 --- a/bin/tests/test_shader_lang.cpp +++ b/bin/tests/test_shader_lang.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_shader_lang.h b/bin/tests/test_shader_lang.h index 85d379bc43..f129fb224a 100644 --- a/bin/tests/test_shader_lang.h +++ b/bin/tests/test_shader_lang.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_sound.cpp b/bin/tests/test_sound.cpp index 63c6edd9c9..44cc117e02 100644 --- a/bin/tests/test_sound.cpp +++ b/bin/tests/test_sound.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_sound.h b/bin/tests/test_sound.h index 32b66c8bba..91b87a2261 100644 --- a/bin/tests/test_sound.h +++ b/bin/tests/test_sound.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_string.cpp b/bin/tests/test_string.cpp index 93b1835b78..fe7bf4d9cf 100644 --- a/bin/tests/test_string.cpp +++ b/bin/tests/test_string.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/bin/tests/test_string.h b/bin/tests/test_string.h index b04eccb005..7b3cd9a019 100644 --- a/bin/tests/test_string.h +++ b/bin/tests/test_string.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index fba3e7ca09..f951237971 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -494,8 +494,8 @@ uint64_t _OS::get_unix_time() const { return OS::get_singleton()->get_unix_time(); }; -uint64_t _OS::get_system_time_msec() const { - return OS::get_singleton()->get_system_time_msec(); +uint64_t _OS::get_system_time_secs() const { + return OS::get_singleton()->get_system_time_secs(); } void _OS::delay_usec(uint32_t p_usec) const { @@ -810,7 +810,7 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_time","utc"),&_OS::get_time,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("get_time_zone_info"),&_OS::get_time_zone_info); ObjectTypeDB::bind_method(_MD("get_unix_time"),&_OS::get_unix_time); - ObjectTypeDB::bind_method(_MD("get_system_time_msec"), &_OS::get_system_time_msec); + ObjectTypeDB::bind_method(_MD("get_system_time_secs"), &_OS::get_system_time_secs); ObjectTypeDB::bind_method(_MD("set_icon","icon"),&_OS::set_icon); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 8ab8878119..62572d7761 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -208,7 +208,7 @@ public: Dictionary get_time(bool utc) const; Dictionary get_time_zone_info() const; uint64_t get_unix_time() const; - uint64_t get_system_time_msec() const; + uint64_t get_system_time_secs() const; int get_static_memory_usage() const; int get_static_memory_peak_usage() const; diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 4d8cf121ee..19a7286dcf 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -248,7 +248,7 @@ Error HTTPClient::poll(){ status=STATUS_SSL_HANDSHAKE_ERROR; return ERR_CANT_CONNECT; } - print_line("SSL! TURNED ON!"); + //print_line("SSL! TURNED ON!"); connection=ssl; } status=STATUS_CONNECTED; @@ -295,7 +295,7 @@ Error HTTPClient::poll(){ response_str.push_back(0); String response; response.parse_utf8((const char*)response_str.ptr()); - print_line("END OF RESPONSE? :\n"+response+"\n------"); + //print_line("END OF RESPONSE? :\n"+response+"\n------"); Vector<String> responses = response.split("\n"); body_size=0; chunked=false; @@ -307,16 +307,17 @@ Error HTTPClient::poll(){ for(int i=0;i<responses.size();i++) { String s = responses[i].strip_edges(); + s = s.to_lower(); if (s.length()==0) continue; - if (s.begins_with("Content-Length:")) { + if (s.begins_with("content-length:")) { body_size = s.substr(s.find(":")+1,s.length()).strip_edges().to_int(); body_left=body_size; } - if (s.begins_with("Transfer-Encoding:")) { + if (s.begins_with("transfer-encoding:")) { String encoding = s.substr(s.find(":")+1,s.length()).strip_edges(); - print_line("TRANSFER ENCODING: "+encoding); + //print_line("TRANSFER ENCODING: "+encoding); if (encoding=="chunked") { chunked=true; } diff --git a/core/os/input.cpp b/core/os/input.cpp index d8d746c811..6e1e618d9a 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -53,8 +53,12 @@ void Input::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_mouse_button_pressed","button"),&Input::is_mouse_button_pressed); ObjectTypeDB::bind_method(_MD("is_joy_button_pressed","device","button"),&Input::is_joy_button_pressed); ObjectTypeDB::bind_method(_MD("is_action_pressed","action"),&Input::is_action_pressed); + ObjectTypeDB::bind_method(_MD("add_joy_mapping","mapping", "update_existing"),&Input::add_joy_mapping, DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("remove_joy_mapping","guid"),&Input::remove_joy_mapping); + ObjectTypeDB::bind_method(_MD("is_joy_known","device"),&Input::is_joy_known); ObjectTypeDB::bind_method(_MD("get_joy_axis","device","axis"),&Input::get_joy_axis); ObjectTypeDB::bind_method(_MD("get_joy_name","device"),&Input::get_joy_name); + ObjectTypeDB::bind_method(_MD("get_joy_guid","device"),&Input::get_joy_guid); ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer); //ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want ObjectTypeDB::bind_method(_MD("get_mouse_speed"),&Input::get_mouse_speed); diff --git a/core/os/input.h b/core/os/input.h index 57eaa973d9..2dd4496f26 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -63,7 +63,10 @@ public: virtual float get_joy_axis(int p_device,int p_axis)=0; virtual String get_joy_name(int p_idx)=0; virtual void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid)=0; - + virtual void add_joy_mapping(String p_mapping, bool p_update_existing=false)=0; + virtual void remove_joy_mapping(String p_guid)=0; + virtual bool is_joy_known(int p_device)=0; + virtual String get_joy_guid(int p_device) const=0; virtual Point2 get_mouse_pos() const=0; virtual Point2 get_mouse_speed() const=0; diff --git a/core/os/os.cpp b/core/os/os.cpp index eb5f91167a..be447d511e 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -50,7 +50,7 @@ uint64_t OS::get_unix_time() const { return 0; }; -uint64_t OS::get_system_time_msec() const { +uint64_t OS::get_system_time_secs() const { return 0; } void OS::debug_break() { @@ -507,6 +507,13 @@ float OS::get_time_scale() const { return _time_scale; } +bool OS::is_joy_known(int p_device) { + return true; +} + +String OS::get_joy_guid(int p_device) const { + return "Default Joystick"; +} OS::OS() { last_error=NULL; diff --git a/core/os/os.h b/core/os/os.h index 94cb1d4ea4..83ea2c2101 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -256,7 +256,7 @@ public: virtual Time get_time(bool local=false) const=0; virtual TimeZoneInfo get_time_zone_info() const=0; virtual uint64_t get_unix_time() const; - virtual uint64_t get_system_time_msec() const; + virtual uint64_t get_system_time_secs() const; virtual void delay_usec(uint32_t p_usec) const=0; virtual uint64_t get_ticks_usec() const=0; @@ -397,6 +397,9 @@ public: _FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; } + virtual bool is_joy_known(int p_device); + virtual String get_joy_guid(int p_device)const; + OS(); virtual ~OS(); diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index fb17156df4..d977ea3e18 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -101,10 +101,12 @@ void register_core_types() { resource_loader_binary = memnew( ResourceFormatLoaderBinary ); ResourceLoader::add_resource_format_loader(resource_loader_binary); +#ifdef XML_ENABLED resource_saver_xml = memnew( ResourceFormatSaverXML ); ResourceSaver::add_resource_format_saver(resource_saver_xml); resource_loader_xml = memnew( ResourceFormatLoaderXML ); ResourceLoader::add_resource_format_loader(resource_loader_xml); +#endif ObjectTypeDB::register_type<Object>(); diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 491eacb099..3efa87de80 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -448,7 +448,7 @@ Error VariantParser::_parse_construct(Stream *p_stream,Vector<T>& r_construct,in if (!first) { get_token(p_stream,token,line,r_err_str); if (token.type==TK_COMMA) { - //do none + //do none } else if (token.type==TK_PARENTHESIS_CLOSE) { break; } else { @@ -458,7 +458,10 @@ Error VariantParser::_parse_construct(Stream *p_stream,Vector<T>& r_construct,in } } get_token(p_stream,token,line,r_err_str); - if (token.type!=TK_NUMBER) { + + if (first && token.type==TK_PARENTHESIS_CLOSE) { + break; + } else if (token.type!=TK_NUMBER) { r_err_str="Expected float in constructor"; return ERR_PARSE_ERROR; } diff --git a/demos/3d/platformer/engine.cfg b/demos/3d/platformer/engine.cfg index 84cac52c97..84a7e8f597 100644 --- a/demos/3d/platformer/engine.cfg +++ b/demos/3d/platformer/engine.cfg @@ -6,7 +6,7 @@ icon="res://icon.png" [display] -height=450 +height=720 stretch_2d=true [input] diff --git a/demos/3d/platformer/player.scn b/demos/3d/platformer/player.scn Binary files differindex 854a8397e4..3b24da94ec 100644 --- a/demos/3d/platformer/player.scn +++ b/demos/3d/platformer/player.scn diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 1b95899729..4a1e437694 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -432,7 +432,7 @@ <method name="convert"> <return type="Object"> </return> - <argument index="0" name="what" type="var"> + <argument index="0" name="what" type="Variant"> </argument> <argument index="1" name="type" type="int"> </argument> @@ -443,9 +443,9 @@ <method name="str"> <return type="String"> </return> - <argument index="0" name="what" type="var"> + <argument index="0" name="what" type="Variant"> </argument> - <argument index="1" name="..." type="var"> + <argument index="1" name="..." type="Variant"> </argument> <description> Convert one or more arguments to strings in the best way possible. @@ -454,9 +454,9 @@ <method name="str"> <return type="String"> </return> - <argument index="0" name="what" type="var"> + <argument index="0" name="what" type="Variant"> </argument> - <argument index="1" name="..." type="var"> + <argument index="1" name="..." type="Variant"> </argument> <description> Convert one or more arguments to strings in the best way possible. @@ -465,9 +465,9 @@ <method name="print"> <return type="Nil"> </return> - <argument index="0" name="what" type="var"> + <argument index="0" name="what" type="Variant"> </argument> - <argument index="1" name="..." type="var"> + <argument index="1" name="..." type="Variant"> </argument> <description> Print one or more arguments to strings in the best way possible to a console line. @@ -476,9 +476,9 @@ <method name="printt"> <return type="Nil"> </return> - <argument index="0" name="what" type="var"> + <argument index="0" name="what" type="Variant"> </argument> - <argument index="1" name="..." type="var"> + <argument index="1" name="..." type="Variant"> </argument> <description> Print one or more arguments to the console with a tab between each argument. @@ -487,9 +487,9 @@ <method name="prints"> <return type="Nil"> </return> - <argument index="0" name="what" type="var"> + <argument index="0" name="what" type="Variant"> </argument> - <argument index="1" name="..." type="var"> + <argument index="1" name="..." type="Variant"> </argument> <description> </description> @@ -497,9 +497,9 @@ <method name="printerr"> <return type="Nil"> </return> - <argument index="0" name="what" type="var"> + <argument index="0" name="what" type="Variant"> </argument> - <argument index="1" name="..." type="var"> + <argument index="1" name="..." type="Variant"> </argument> <description> Print one or more arguments to strings in the best way possible to standard error line. @@ -508,9 +508,9 @@ <method name="printraw"> <return type="Nil"> </return> - <argument index="0" name="what" type="var"> + <argument index="0" name="what" type="Variant"> </argument> - <argument index="1" name="..." type="var"> + <argument index="1" name="..." type="Variant"> </argument> <description> Print one or more arguments to strings in the best way possible to console. No newline is added at the end. @@ -519,25 +519,40 @@ <method name="var2str"> <return type="String"> </return> - <argument index="0" name="var" type="var"> + <argument index="0" name="var" type="Variant"> </argument> <description> Converts the value of a variable to a String. </description> </method> - <method name="str2var:Variant"> - <return type="Nil"> + <method name="str2var"> + <return type="Variant"> </return> <argument index="0" name="string" type="String"> </argument> <description> - Converts the value of a String to a Variant. + </description> + </method> + <method name="var2bytes"> + <return type="RawArray"> + </return> + <argument index="0" name="var" type="Variant"> + </argument> + <description> + </description> + </method> + <method name="bytes2var"> + <return type="Variant"> + </return> + <argument index="0" name="bytes" type="RawArray"> + </argument> + <description> </description> </method> <method name="range"> <return type="Array"> </return> - <argument index="0" name="..." type="var"> + <argument index="0" name="..." type="Variant"> </argument> <description> Return an array with the given range. Range can be 1 argument N (0 to N-1), two arguments (initial, final-1) or three arguments (initial,final-1,increment). @@ -573,12 +588,26 @@ <method name="hash"> <return type="int"> </return> - <argument index="0" name="var:Variant" type="var"> + <argument index="0" name="var:Variant" type="Variant"> </argument> <description> Hashes the variable passed and returns an integer. </description> </method> + <method name="Color8"> + <return type="Color"> + </return> + <argument index="0" name="r8" type="int"> + </argument> + <argument index="1" name="g8" type="int"> + </argument> + <argument index="2" name="b8" type="int"> + </argument> + <argument index="3" name="a8" type="int"> + </argument> + <description> + </description> + </method> <method name="print_stack"> <return type="Nil"> </return> @@ -1371,6 +1400,10 @@ </constant> <constant name="JOY_ANALOG_2_Y" value="5"> </constant> + <constant name="JOY_ANALOG_L2" value="6"> + </constant> + <constant name="JOY_ANALOG_R2" value="7"> + </constant> <constant name="OK" value="0"> Functions that return [Error] return OK when everything went ok. Most functions don't return error anyway and/or just print errors to stdout. </constant> @@ -7561,6 +7594,14 @@ </member> <member name="v" type="float"> </member> + <member name="r8" type="int"> + </member> + <member name="g8" type="int"> + </member> + <member name="b8" type="int"> + </member> + <member name="a8" type="int"> + </member> </members> <constants> </constants> @@ -7968,6 +8009,8 @@ </argument> <argument index="1" name="key" type="String"> </argument> + <argument index="2" name="default" type="var" default="NULL"> + </argument> <description> </description> </method> @@ -13625,6 +13668,7 @@ returns:= "username=user&password=pass" <argument index="1" name="button" type="int"> </argument> <description> + Returns true if the joystick button at the given index is currently pressed. Returns false otherwise. (see JOY_* constans in [InputEvent]) </description> </method> <method name="is_action_pressed"> @@ -13635,6 +13679,31 @@ returns:= "username=user&password=pass" <description> </description> </method> + <method name="add_joy_mapping"> + <argument index="0" name="mapping" type="String"> + </argument> + <argument index="1" name="update_existing" type="bool" default="false"> + </argument> + <description> + Add a new mapping entry (in SDL2 format) to the mapping database. Optionally update already connected devices. + </description> + </method> + <method name="remove_joy_mapping"> + <argument index="0" name="guid" type="String"> + </argument> + <description> + Removes all mappings from the internal db that match the given uid. + </description> + </method> + <method name="is_joy_known"> + <return type="bool"> + </return> + <argument index="0" name="device" type="int"> + </argument> + <description> + Returns true if the specified device is known by the system. This means that it sets all button and axis indices exactly as defined in [InputEvent]. Unknown joysticks are not expected to match these constants, but you can still retrieve events from them. + </description> + </method> <method name="get_joy_axis"> <return type="float"> </return> @@ -13643,6 +13712,7 @@ returns:= "username=user&password=pass" <argument index="1" name="axis" type="int"> </argument> <description> + Returns the current value of the joystick axis at given index (see JOY_* enum in [InputEvent]) </description> </method> <method name="get_joy_name"> @@ -13651,6 +13721,16 @@ returns:= "username=user&password=pass" <argument index="0" name="device" type="int"> </argument> <description> + Returns the name of the joystick at the specified device index + </description> + </method> + <method name="get_joy_guid" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="device" type="int"> + </argument> + <description> + Returns a SDL2 compatible device guid on platforms that use gamepad remapping. Returns "Default Gamepad" otherwise. </description> </method> <method name="get_accelerometer"> @@ -15479,7 +15559,7 @@ returns:= "username=user&password=pass" </description> </method> <method name="get_collider_metadata" qualifiers="const"> - <return type="var"> + <return type="Variant"> </return> <description> Return the metadata of the shape that collided with this body. If there is no collision, it will return 0, so collisions must be checked first with [method is_colliding]. Aditionally, this metadata can not be set with [method Object.set_meta], it must be set with [method Physics2DServer.body_set_shape_metadata]. @@ -18971,6 +19051,8 @@ returns:= "username=user&password=pass" </constant> <constant name="NOTIFICATION_UNPAUSED" value="15"> </constant> + <constant name="NOTIFICATION_INSTANCED" value="20"> + </constant> <constant name="PAUSE_MODE_INHERIT" value="0"> </constant> <constant name="PAUSE_MODE_STOP" value="1"> @@ -19138,7 +19220,7 @@ returns:= "username=user&password=pass" <description> </description> </method> - <method name="get_relative_transform" qualifiers="const"> + <method name="get_relative_transform_to_parent" qualifiers="const"> <return type="Matrix32"> </return> <argument index="0" name="parent" type="Object"> @@ -20178,6 +20260,14 @@ returns:= "username=user&password=pass" Return the list of signals as an array of dictionaries. </description> </method> + <method name="get_signal_connection_list" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="signal" type="String"> + </argument> + <description> + </description> + </method> <method name="connect"> <return type="int"> </return> @@ -21601,6 +21691,10 @@ returns:= "username=user&password=pass" <description> </description> </method> + <method name="reset"> + <description> + </description> + </method> <method name="set_use_local_space"> <argument index="0" name="enable" type="bool"> </argument> @@ -29631,6 +29725,14 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> + <method name="has_group" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> <method name="set_auto_accept_quit"> <argument index="0" name="enabled" type="bool"> </argument> @@ -33335,6 +33437,12 @@ This method controls whether the position between two cached points is interpola </description> </method> </methods> + <signals> + <signal name="finished"> + <description> + </description> + </signal> + </signals> <constants> </constants> </class> diff --git a/drivers/convex_decomp/b2Polygon.cpp b/drivers/convex_decomp/b2Polygon.cpp index 775f2adfe2..73955d3573 100644 --- a/drivers/convex_decomp/b2Polygon.cpp +++ b/drivers/convex_decomp/b2Polygon.cpp @@ -217,8 +217,8 @@ b2Polygon::b2Polygon(b2Triangle& t) { void b2Polygon::Set(const b2Polygon& p) { if (nVertices != p.nVertices){ nVertices = p.nVertices; - if (x) delete[] x; - if (y) delete[] y; + delete[] x; + delete[] y; x = new float32[nVertices]; y = new float32[nVertices]; } diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 9b26cbfc7c..58d5c307f0 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -929,6 +929,7 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I texture->compressed=compressed; texture->has_alpha=false; //by default it doesn't have alpha unless something with alpha is blitteds texture->data_size=0; + texture->mipmaps=0; glActiveTexture(GL_TEXTURE0); @@ -1086,6 +1087,7 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu glGenerateMipmap(texture->target); } + texture->mipmaps=mipmaps; @@ -1269,11 +1271,14 @@ void RasterizerGLES2::texture_set_flags(RID p_texture,uint32_t p_flags) { p_flags&=VS::TEXTURE_FLAG_FILTER;//can change only filter } + bool had_mipmaps = texture->flags&VS::TEXTURE_FLAG_MIPMAPS; + glActiveTexture(GL_TEXTURE0); glBindTexture(texture->target, texture->tex_id); uint32_t cube = texture->flags & VS::TEXTURE_FLAG_CUBEMAP; texture->flags=p_flags|cube; // can't remove a cube from being a cube + bool force_clamp_to_edge = !(p_flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) && (nearest_power_of_2(texture->alloc_height)!=texture->alloc_height || nearest_power_of_2(texture->alloc_width)!=texture->alloc_width); if (!force_clamp_to_edge && (texture->flags&VS::TEXTURE_FLAG_REPEAT || texture->flags&VS::TEXTURE_FLAG_MIRRORED_REPEAT) && texture->target != GL_TEXTURE_CUBE_MAP) { @@ -1304,9 +1309,13 @@ void RasterizerGLES2::texture_set_flags(RID p_texture,uint32_t p_flags) { } } - if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) + if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) { + if (!had_mipmaps && texture->mipmaps==1) { + glGenerateMipmap(texture->target); + } glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,use_fast_texture_filter?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR_MIPMAP_LINEAR); - else{ + + } else{ if (texture->flags&VS::TEXTURE_FLAG_FILTER) { glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR); } else { @@ -8330,6 +8339,14 @@ void RasterizerGLES2::canvas_draw_rect(const Rect2& p_rect, int p_flags, const R if ( texture ) { + bool untile=false; + + if (p_flags&CANVAS_RECT_TILE && !(texture->flags&VS::TEXTURE_FLAG_REPEAT)) { + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + untile=true; + } + if (!(p_flags&CANVAS_RECT_REGION)) { Rect2 region = Rect2(0,0,texture->width,texture->height); @@ -8340,6 +8357,12 @@ void RasterizerGLES2::canvas_draw_rect(const Rect2& p_rect, int p_flags, const R _draw_textured_quad(p_rect, p_source, Size2(texture->width,texture->height),p_flags&CANVAS_RECT_FLIP_H,p_flags&CANVAS_RECT_FLIP_V,p_flags&CANVAS_RECT_TRANSPOSE); } + + if (untile) { + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + } + } else { //glDisable(GL_TEXTURE_2D); diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h index f3edc28861..0f70ceaa97 100644 --- a/drivers/gles2/rasterizer_gles2.h +++ b/drivers/gles2/rasterizer_gles2.h @@ -138,6 +138,8 @@ class RasterizerGLES2 : public Rasterizer { StringName reloader_func; Image image[6]; + int mipmaps; + bool active; GLuint tex_id; @@ -159,6 +161,7 @@ class RasterizerGLES2 : public Rasterizer { compressed=false; total_data_size=0; target=GL_TEXTURE_2D; + mipmaps=0; reloader=0; } diff --git a/drivers/pnm/bitmap_loader_pnm.cpp b/drivers/pnm/bitmap_loader_pnm.cpp index 874e5977c1..c9298be26a 100644 --- a/drivers/pnm/bitmap_loader_pnm.cpp +++ b/drivers/pnm/bitmap_loader_pnm.cpp @@ -170,7 +170,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E } DVector<uint8_t>::Read r=token.read(); - + for(int i=0;i<height;i++) { for(int j=0;j<width;j++) { @@ -194,11 +194,14 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E } DVector<uint8_t>::Read r=token.read(); + int bitwidth = width; + if (bitwidth % 8) + bitwidth+=8-(bitwidth%8); for(int i=0;i<height;i++) { for(int j=0;j<width;j++) { - int ofs = width*i+j; + int ofs = bitwidth*i+j; uint8_t byte = r[ofs/8]; bool bit = (byte>>(7-(ofs%8)))&1; diff --git a/drivers/rtaudio/RtAudio.cpp b/drivers/rtaudio/RtAudio.cpp index 72ca836907..86981e56d2 100644 --- a/drivers/rtaudio/RtAudio.cpp +++ b/drivers/rtaudio/RtAudio.cpp @@ -139,8 +139,7 @@ void RtAudio :: getCompiledApi( std::vector<RtAudio::Api> &apis ) throw() void RtAudio :: openRtApi( RtAudio::Api api ) { - if ( rtapi_ ) - delete rtapi_; + delete rtapi_; rtapi_ = 0; #if defined(__UNIX_JACK__) @@ -216,8 +215,7 @@ RtAudio :: RtAudio( RtAudio::Api api ) RtAudio :: ~RtAudio() throw() { - if ( rtapi_ ) - delete rtapi_; + delete rtapi_; } void RtAudio :: openStream( RtAudio::StreamParameters *outputParameters, diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index bdf7daf799..8e3fba167f 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -149,8 +149,7 @@ void OS_Unix::finalize_core() { if (mempool_dynamic) memdelete( mempool_dynamic ); - if (mempool_static) - delete mempool_static; + delete mempool_static; } @@ -233,13 +232,12 @@ uint64_t OS_Unix::get_unix_time() const { return time(NULL); }; -uint64_t OS_Unix::get_system_time_msec() const { +uint64_t OS_Unix::get_system_time_secs() const { struct timeval tv_now; gettimeofday(&tv_now, NULL); //localtime(&tv_now.tv_usec); //localtime((const long *)&tv_now.tv_usec); - uint64_t msec = uint64_t(tv_now.tv_sec)*1000+tv_now.tv_usec/1000; - return msec; + return uint64_t(tv_now.tv_sec); } diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index 1baed9e869..a889bba0ff 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -95,7 +95,7 @@ public: virtual TimeZoneInfo get_time_zone_info() const; virtual uint64_t get_unix_time() const; - virtual uint64_t get_system_time_msec() const; + virtual uint64_t get_system_time_secs() const; virtual void delay_usec(uint32_t p_usec) const; virtual uint64_t get_ticks_usec() const; diff --git a/main/input_default.cpp b/main/input_default.cpp index 68f7434d96..a79199580b 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -781,3 +781,49 @@ void InputDefault::parse_mapping(String p_mapping) { map_db.push_back(mapping); //printf("added mapping with uuid %ls\n", mapping.uid.c_str()); }; + +void InputDefault::add_joy_mapping(String p_mapping, bool p_update_existing) { + parse_mapping(p_mapping); + if (p_update_existing) { + Vector<String> entry = p_mapping.split(","); + String uid = entry[0]; + for (int i=0; i<joy_names.size(); i++) { + if (uid == joy_names[i].uid) { + joy_names[i].mapping = map_db.size() -1; + } + } + } +} + +void InputDefault::remove_joy_mapping(String p_guid) { + for (int i=map_db.size()-1; i >= 0;i--) { + if (p_guid == map_db[i].uid) { + map_db.remove(i); + } + } + for (int i=0; i<joy_names.size(); i++) { + if (joy_names[i].uid == p_guid) { + joy_names[i].mapping = -1; + } + } +} + +//Defaults to simple implementation for platforms with a fixed gamepad layout, like consoles. +bool InputDefault::is_joy_known(int p_device) { + + return OS::get_singleton()->is_joy_known(p_device); +} + +String InputDefault::get_joy_guid(int p_device) const { + return OS::get_singleton()->get_joy_guid(p_device); +} + +//platforms that use the remapping system can override and call to these ones +bool InputDefault::is_joy_mapped(int p_device) { + return joy_names[p_device].mapping != -1 ? true : false; +} + +String InputDefault::get_joy_guid_remapped(int p_device) const { + return joy_names[p_device].uid; +} + diff --git a/main/input_default.h b/main/input_default.h index 6645817b31..bbfd9ced2c 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -56,6 +56,7 @@ class InputDefault : public Input { } last_hat = HAT_MASK_CENTER; filter = 0.01f; + mapping = -1; } }; @@ -161,6 +162,14 @@ public: uint32_t joy_axis(uint32_t p_last_id, int p_device, int p_axis, const JoyAxis& p_value); uint32_t joy_hat(uint32_t p_last_id, int p_device, int p_val); + virtual void add_joy_mapping(String p_mapping, bool p_update_existing=false); + virtual void remove_joy_mapping(String p_guid); + virtual bool is_joy_known(int p_device); + virtual String get_joy_guid(int p_device) const; + + bool is_joy_mapped(int p_device); + String get_joy_guid_remapped(int p_device) const; + InputDefault(); }; diff --git a/main/main.cpp b/main/main.cpp index 9f3b6a2f37..752a248b2f 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -124,7 +124,7 @@ static String unescape_cmdline(const String& p_str) { void Main::print_help(const char* p_binary) { - OS::get_singleton()->print(VERSION_FULL_NAME" (c) 2008-2015 Juan Linietsky, Ariel Manzur.\n"); + OS::get_singleton()->print(VERSION_FULL_NAME" (c) 2008-2016 Juan Linietsky, Ariel Manzur.\n"); OS::get_singleton()->print("Usage: %s [options] [scene]\n",p_binary); OS::get_singleton()->print("Options:\n"); OS::get_singleton()->print("\t-path [dir] : Path to a game, containing engine.cfg\n"); diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index d753a9f167..9a3f50d3b8 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -1139,7 +1139,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (!GDScriptLanguage::get_singleton()->debug_break(err_text,false)) { // debugger break did not happen - _err_print_error(err_func.utf8().get_data(),err_file.utf8().get_data(),err_line,err_text.utf8().get_data()); + _err_print_error(err_func.utf8().get_data(),err_file.utf8().get_data(),err_line,err_text.utf8().get_data(),ERR_HANDLER_SCRIPT); } diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp index 67d1fd6956..8b7cb992d9 100644 --- a/platform/android/dir_access_jandroid.cpp +++ b/platform/android/dir_access_jandroid.cpp @@ -96,7 +96,7 @@ void DirAccessJAndroid::list_dir_end(){ return; JNIEnv *env = ThreadAndroid::get_env(); - env->CallObjectMethod(io,_dir_close,id); + env->CallVoidMethod(io,_dir_close,id); id=0; @@ -143,7 +143,7 @@ Error DirAccessJAndroid::change_dir(String p_dir){ if (res<=0) return ERR_INVALID_PARAMETER; - env->CallObjectMethod(io,_dir_close,res); + env->CallVoidMethod(io,_dir_close,res); current_dir=new_dir; diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index 6aa5d24f1c..c6bc6a6943 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/GodotIO.java b/platform/android/java/src/org/godotengine/godot/GodotIO.java index 071d090e8b..3e6919c2ad 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotIO.java +++ b/platform/android/java/src/org/godotengine/godot/GodotIO.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/GodotLib.java b/platform/android/java/src/org/godotengine/godot/GodotLib.java index ddbcf2e5c6..aef6591864 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotLib.java +++ b/platform/android/java/src/org/godotengine/godot/GodotLib.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java index 04b5dfa5dd..492eb4cb54 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotView.java +++ b/platform/android/java/src/org/godotengine/godot/GodotView.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp index 96fd868a81..c7eed1c7cd 100644 --- a/platform/haiku/audio_driver_media_kit.cpp +++ b/platform/haiku/audio_driver_media_kit.cpp @@ -118,8 +118,7 @@ void AudioDriverMediaKit::unlock() { } void AudioDriverMediaKit::finish() { - if (player) - delete player; + delete player; if (samples_in) { memdelete_arr(samples_in); diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp index 3914ee272a..184d64f840 100644 --- a/platform/haiku/haiku_direct_window.cpp +++ b/platform/haiku/haiku_direct_window.cpp @@ -16,9 +16,7 @@ HaikuDirectWindow::HaikuDirectWindow(BRect p_frame) HaikuDirectWindow::~HaikuDirectWindow() { - if (update_runner) { - delete update_runner; - } + delete update_runner; } void HaikuDirectWindow::SetHaikuGLView(HaikuGLView* p_view) { diff --git a/platform/nacl/os_nacl.cpp b/platform/nacl/os_nacl.cpp index 43f6bd9c01..de6a15525b 100644 --- a/platform/nacl/os_nacl.cpp +++ b/platform/nacl/os_nacl.cpp @@ -144,8 +144,7 @@ void OSNacl::finalize_core() { if (mempool_dynamic) memdelete( mempool_dynamic ); - if (mempool_static) - delete mempool_static; + delete mempool_static; }; diff --git a/platform/windows/detect.py b/platform/windows/detect.py index a1366e7630..c00d94a4fb 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -262,7 +262,7 @@ def configure(env): env.Append(CCFLAGS=["/I"+DIRECTX_PATH+"/Include"]) env.Append(LIBPATH=[DIRECTX_PATH+"/Lib/x86"]) env['ENV'] = os.environ; - env["x86_opt_vc"]=True + env["x86_opt_vc"]=env["bits"]!="64" else: # Workaround for MinGW. See: diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 95bfa2ea94..6f19f8bdfe 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1144,8 +1144,7 @@ void OS_Windows::finalize_core() { if (mempool_dynamic) memdelete( mempool_dynamic ); - if (mempool_static) - delete mempool_static; + delete mempool_static; TCPServerWinsock::cleanup(); @@ -1681,10 +1680,16 @@ uint64_t OS_Windows::get_unix_time() const { return (*(uint64_t*)&ft - *(uint64_t*)&fep) / 10000000; }; -uint64_t OS_Windows::get_system_time_msec() const { +uint64_t OS_Windows::get_system_time_secs() const { SYSTEMTIME st; GetSystemTime(&st); - return st.wMilliseconds; + FILETIME ft; + SystemTimeToFileTime(&st,&ft); + uint64_t ret; + ret=ft.dwHighDateTime; + ret<<=32; + ret|=ft.dwLowDateTime; + return ret; } void OS_Windows::delay_usec(uint32_t p_usec) const { @@ -2099,6 +2104,13 @@ String OS_Windows::get_data_dir() const { } +bool OS_Windows::is_joy_known(int p_device) { + return input->is_joy_mapped(p_device); +} + +String OS_Windows::get_joy_guid(int p_device) const { + return input->get_joy_guid_remapped(p_device); +} OS_Windows::OS_Windows(HINSTANCE _hInstance) { diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index dfa2b40595..e433d5cc11 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -231,7 +231,7 @@ public: virtual Time get_time(bool utc) const; virtual TimeZoneInfo get_time_zone_info() const; virtual uint64_t get_unix_time() const; - virtual uint64_t get_system_time_msec() const; + virtual uint64_t get_system_time_secs() const; virtual bool can_draw() const; virtual Error set_cwd(const String& p_cwd); @@ -270,6 +270,9 @@ public: virtual bool get_swap_ok_cancel() { return true; } + virtual bool is_joy_known(int p_device); + virtual String get_joy_guid(int p_device) const; + OS_Windows(HINSTANCE _hInstance); ~OS_Windows(); diff --git a/platform/winrt/os_winrt.cpp b/platform/winrt/os_winrt.cpp index 7c4b2dc661..f507c1aae7 100644 --- a/platform/winrt/os_winrt.cpp +++ b/platform/winrt/os_winrt.cpp @@ -345,8 +345,7 @@ void OSWinrt::finalize_core() { if (mempool_dynamic) memdelete( mempool_dynamic ); - if (mempool_static) - delete mempool_static; + delete mempool_static; } diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 344545ab81..e035c72993 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -147,9 +147,13 @@ def configure(env): env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED']) - if platform.system() == 'Linux': + + if os.system("pkg-config --exists alsa")==0: + print("Enabling ALSA") env.Append(CPPFLAGS=["-DALSA_ENABLED"]) env.Append(LIBS=['asound']) + else: + print("ALSA libraries not found, disabling driver") if (env["gamepad"]=="yes" and platform.system() == "Linux"): # pkg-config returns 0 when the lib exists... diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 437e41eead..82df8dff60 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1774,6 +1774,14 @@ void OS_X11::run() { main_loop->finish(); } +bool OS_X11::is_joy_known(int p_device) { + return input->is_joy_mapped(p_device); +} + +String OS_X11::get_joy_guid(int p_device) const { + return input->get_joy_guid_remapped(p_device); +} + OS_X11::OS_X11() { #ifdef RTAUDIO_ENABLED diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index a556ba49e3..91dbeac284 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -222,6 +222,10 @@ public: virtual void move_window_to_foreground(); virtual void alert(const String& p_alert,const String& p_title="ALERT!"); + + virtual bool is_joy_known(int p_device); + virtual String get_joy_guid(int p_device) const; + void run(); OS_X11(); diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index 464553b982..50a115174d 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -420,13 +420,13 @@ void Area2D::_notification(int p_what) { void Area2D::set_enable_monitoring(bool p_enable) { - if (locked) { - ERR_EXPLAIN("This function can't be used during the in/out signal."); - } - ERR_FAIL_COND(locked); if (p_enable==monitoring) return; + if (locked) { + ERR_EXPLAIN("Function blocked during in/out signal. Use call_deferred(\"set_enable_monitoring\",true/false)"); + } + ERR_FAIL_COND(locked); monitoring=p_enable; diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 386c7b9dd0..2a40a6207d 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -197,7 +197,7 @@ void CollisionPolygon2D::_notification(int p_what) { Vector2 n = polygon[(i+1)%polygon.size()]; draw_line(p,n,Color(0.9,0.2,0.0,0.8),3); } -//#define DEBUG_DECOMPOSE +#define DEBUG_DECOMPOSE #if defined(TOOLS_ENABLED) && defined (DEBUG_DECOMPOSE) Vector< Vector<Vector2> > decomp = _decompose_in_convex(); diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index f135864098..bd7415aa04 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -74,6 +74,8 @@ void Path2D::set_curve(const Ref<Curve2D>& p_curve) { curve->connect("changed",this,"_curve_changed"); } + _curve_changed(); + } Ref<Curve2D> Path2D::get_curve() const{ diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 71a45024c4..cc2e5c0d72 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -310,14 +310,20 @@ void RigidBody2D::_body_enter_tree(ObjectID p_id) { ERR_FAIL_COND(!E); ERR_FAIL_COND(E->get().in_scene); + contact_monitor->locked=true; + E->get().in_scene=true; emit_signal(SceneStringNames::get_singleton()->body_enter,node); + for(int i=0;i<E->get().shapes.size();i++) { emit_signal(SceneStringNames::get_singleton()->body_enter_shape,p_id,node,E->get().shapes[i].body_shape,E->get().shapes[i].local_shape); } + contact_monitor->locked=false; + + } void RigidBody2D::_body_exit_tree(ObjectID p_id) { @@ -329,11 +335,18 @@ void RigidBody2D::_body_exit_tree(ObjectID p_id) { ERR_FAIL_COND(!E); ERR_FAIL_COND(!E->get().in_scene); E->get().in_scene=false; + + contact_monitor->locked=true; + emit_signal(SceneStringNames::get_singleton()->body_exit,node); + for(int i=0;i<E->get().shapes.size();i++) { emit_signal(SceneStringNames::get_singleton()->body_exit_shape,p_id,node,E->get().shapes[i].body_shape,E->get().shapes[i].local_shape); } + + contact_monitor->locked=false; + } void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shape,int p_local_shape) { @@ -439,6 +452,8 @@ void RigidBody2D::_direct_state_changed(Object *p_state) { if (contact_monitor) { + contact_monitor->locked=true; + //untag all int rc=0; for( Map<ObjectID,BodyState>::Element *E=contact_monitor->body_map.front();E;E=E->next()) { @@ -520,6 +535,8 @@ void RigidBody2D::_direct_state_changed(Object *p_state) { _body_inout(1,toadd[i].id,toadd[i].shape,toadd[i].local_shape); } + contact_monitor->locked=false; + } set_block_transform_notify(true); // don't want notify (would feedback loop) @@ -803,6 +820,11 @@ void RigidBody2D::set_contact_monitor(bool p_enabled) { if (!p_enabled) { + if (contact_monitor->locked) { + ERR_EXPLAIN("Can't disable contact monitoring during in/out callback. Use call_deferred(\"set_contact_monitor\",false) instead"); + } + ERR_FAIL_COND(contact_monitor->locked); + for(Map<ObjectID,BodyState>::Element *E=contact_monitor->body_map.front();E;E=E->next()) { //clean up mess @@ -813,6 +835,7 @@ void RigidBody2D::set_contact_monitor(bool p_enabled) { } else { contact_monitor = memnew( ContactMonitor ); + contact_monitor->locked=false; } } diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index fc337915c5..999e63dd5d 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -190,7 +190,7 @@ private: struct ContactMonitor { - + bool locked; Map<ObjectID,BodyState> body_map; }; diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index d7f9b191fe..fac94f19dc 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -102,6 +102,10 @@ void TouchScreenButton::_notification(int p_what) { action_id=-1; } } break; + case NOTIFICATION_EXIT_TREE: { + if (is_pressed()) + Input::get_singleton()->action_release(action); + } break; } } diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index de777604b0..1a2665b6ad 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -207,6 +207,9 @@ void RigidBody::_body_enter_tree(ObjectID p_id) { ERR_FAIL_COND(E->get().in_tree); E->get().in_tree=true; + + contact_monitor->locked=true; + emit_signal(SceneStringNames::get_singleton()->body_enter,node); for(int i=0;i<E->get().shapes.size();i++) { @@ -214,6 +217,9 @@ void RigidBody::_body_enter_tree(ObjectID p_id) { emit_signal(SceneStringNames::get_singleton()->body_enter_shape,p_id,node,E->get().shapes[i].body_shape,E->get().shapes[i].local_shape); } + contact_monitor->locked=false; + + } void RigidBody::_body_exit_tree(ObjectID p_id) { @@ -225,11 +231,18 @@ void RigidBody::_body_exit_tree(ObjectID p_id) { ERR_FAIL_COND(!E); ERR_FAIL_COND(!E->get().in_tree); E->get().in_tree=false; + + contact_monitor->locked=true; + emit_signal(SceneStringNames::get_singleton()->body_exit,node); + for(int i=0;i<E->get().shapes.size();i++) { emit_signal(SceneStringNames::get_singleton()->body_exit_shape,p_id,node,E->get().shapes[i].body_shape,E->get().shapes[i].local_shape); } + + contact_monitor->locked=false; + } void RigidBody::_body_inout(int p_status, ObjectID p_instance, int p_body_shape,int p_local_shape) { @@ -317,6 +330,8 @@ void RigidBody::_direct_state_changed(Object *p_state) { if (contact_monitor) { + contact_monitor->locked=true; + //untag all int rc=0; for( Map<ObjectID,BodyState>::Element *E=contact_monitor->body_map.front();E;E=E->next()) { @@ -396,6 +411,8 @@ void RigidBody::_direct_state_changed(Object *p_state) { _body_inout(1,toadd[i].id,toadd[i].shape,toadd[i].local_shape); } + contact_monitor->locked=false; + } set_ignore_transform_notification(true); @@ -648,6 +665,11 @@ void RigidBody::set_contact_monitor(bool p_enabled) { if (!p_enabled) { + if (contact_monitor->locked) { + ERR_EXPLAIN("Can't disable contact monitoring during in/out callback. Use call_deferred(\"set_contact_monitor\",false) instead"); + } + ERR_FAIL_COND(contact_monitor->locked); + for(Map<ObjectID,BodyState>::Element *E=contact_monitor->body_map.front();E;E=E->next()) { //clean up mess @@ -658,6 +680,8 @@ void RigidBody::set_contact_monitor(bool p_enabled) { } else { contact_monitor = memnew( ContactMonitor ); + contact_monitor->locked=false; + } } diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h index 0d6c358e28..da79d63f00 100644 --- a/scene/3d/physics_body.h +++ b/scene/3d/physics_body.h @@ -175,7 +175,7 @@ private: struct ContactMonitor { - + bool locked; Map<ObjectID,BodyState> body_map; }; diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index d3b7521c9a..ffcdf98519 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -48,20 +48,20 @@ void Range::Shared::emit_value_changed() { } } -void Range::_changed_notify() { +void Range::_changed_notify(const char *p_what) { emit_signal("changed",shared->val); update(); - _change_notify(); + _change_notify(p_what); } -void Range::Shared::emit_changed() { +void Range::Shared::emit_changed(const char *p_what) { for (Set<Range*>::Element *E=owners.front();E;E=E->next()) { Range *r=E->get(); if (!r->is_inside_tree()) continue; - r->_changed_notify(); + r->_changed_notify(p_what); } } @@ -94,20 +94,20 @@ void Range::set_min(double p_min) { shared->min=p_min; set_val(shared->val); - shared->emit_changed(); + shared->emit_changed("range/min"); } void Range::set_max(double p_max) { shared->max=p_max; set_val(shared->val); - shared->emit_changed(); + shared->emit_changed("range/max"); } void Range::set_step(double p_step) { shared->step=p_step; - shared->emit_changed(); + shared->emit_changed("range/step"); } void Range::set_page(double p_page) { @@ -115,7 +115,7 @@ void Range::set_page(double p_page) { shared->page=p_page; set_val(shared->val); - shared->emit_changed(); + shared->emit_changed("range/page"); } double Range::get_val() const { diff --git a/scene/gui/range.h b/scene/gui/range.h index 2967c2790c..d96ecdfb0b 100644 --- a/scene/gui/range.h +++ b/scene/gui/range.h @@ -44,7 +44,7 @@ class Range : public Control { bool exp_unit_value; Set<Range*> owners; void emit_value_changed(); - void emit_changed(); + void emit_changed(const char *p_what=""); }; Shared *shared; @@ -55,7 +55,7 @@ class Range : public Control { void _share(Node *p_range); void _value_changed_notify(); - void _changed_notify(); + void _changed_notify(const char *p_what=""); protected: diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index 14cd0bee8e..bb64a57212 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -266,6 +266,7 @@ void Tabs::_notification(int p_what) { int label_valign_fg = get_constant("label_valign_fg"); int label_valign_bg = get_constant("label_valign_bg"); + int w=0; int mw = 0; @@ -277,12 +278,16 @@ void Tabs::_notification(int p_what) { for(int i=0;i<tabs.size();i++) { + Ref<Texture> tex = tabs[i].icon; if (tex.is_valid()) { if (tabs[i].text!="") mw+=get_constant("hseparation"); } + + tabs[i].ofs_cache=mw; + mw+=font->get_string_size(tabs[i].text).width; if (current==i) mw+=tab_fg->get_minimum_size().width; @@ -303,6 +308,9 @@ void Tabs::_notification(int p_what) { bms.width+=get_constant("hseparation"); mw+=bms.width; } + + + } } @@ -758,6 +766,79 @@ Tabs::TabAlign Tabs::get_tab_align() const { } +void Tabs::ensure_tab_visible(int p_idx) { + + if (!is_inside_tree()) + return; + + ERR_FAIL_INDEX(p_idx,tabs.size()); + + if (p_idx<offset) { + offset=p_idx; + update(); + return; + } + + Ref<StyleBox> tab_bg = get_stylebox("tab_bg"); + Ref<StyleBox> tab_fg = get_stylebox("tab_fg"); + Ref<Font> font = get_font("font"); + + Ref<Texture> incr = get_icon("increment"); + Ref<Texture> decr = get_icon("decrement"); + + int limit=get_size().width-incr->get_width()-decr->get_width(); + + + + int x=0; + for(int i=0;i<tabs.size();i++) { + + if (i<offset) + continue; + + Ref<Texture> tex = tabs[i].icon; + if (tex.is_valid()) { + if (tabs[i].text!="") + x+=get_constant("hseparation"); + + } + + tabs[i].x_cache=x; + + x+=font->get_string_size(tabs[i].text).width; + if (current==i) + x+=tab_fg->get_minimum_size().width; + else + x+=tab_bg->get_minimum_size().width; + + if (tabs[i].right_button.is_valid()) { + Ref<Texture> rb=tabs[i].right_button; + Size2 bms = rb->get_size();//+get_stylebox("button")->get_minimum_size(); + bms.width+=get_constant("hseparation"); + + x+=bms.width; + } + + if (tabs[i].close_button.is_valid()) { + Ref<Texture> cb=tabs[i].close_button; + Size2 bms = cb->get_size();//+get_stylebox("button")->get_minimum_size(); + bms.width+=get_constant("hseparation"); + x+=bms.width; + } + + tabs[i].x_size_cache=x-tabs[i].x_cache; + + + + } + + while(offset<tabs.size() && ( (tabs[p_idx].x_cache + tabs[p_idx].x_size_cache) - tabs[offset].x_cache) < limit) { + offset++; + } + + update(); +} + void Tabs::_bind_methods() { ObjectTypeDB::bind_method(_MD("_input_event"),&Tabs::_input_event); @@ -772,6 +853,7 @@ void Tabs::_bind_methods() { ObjectTypeDB::bind_method(_MD("add_tab","title","icon:Texture"),&Tabs::add_tab); ObjectTypeDB::bind_method(_MD("set_tab_align","align"),&Tabs::set_tab_align); ObjectTypeDB::bind_method(_MD("get_tab_align"),&Tabs::get_tab_align); + ObjectTypeDB::bind_method(_MD("ensure_tab_visible","idx"),&Tabs::ensure_tab_visible); ADD_SIGNAL(MethodInfo("tab_changed",PropertyInfo(Variant::INT,"tab"))); ADD_SIGNAL(MethodInfo("right_button_pressed",PropertyInfo(Variant::INT,"tab"))); @@ -804,4 +886,6 @@ Tabs::Tabs() { cb_displaypolicy = SHOW_NEVER; // Default : no close button offset=0; max_drawn_tab=0; + + } diff --git a/scene/gui/tabs.h b/scene/gui/tabs.h index efcb291a52..82035291ec 100644 --- a/scene/gui/tabs.h +++ b/scene/gui/tabs.h @@ -59,10 +59,14 @@ private: Ref<Texture> icon; int ofs_cache; int size_cache; + int x_cache; + int x_size_cache; + Ref<Texture> right_button; Rect2 rb_rect; Ref<Texture> close_button; Rect2 cb_rect; + }; @@ -119,6 +123,8 @@ public: void clear_tabs(); + void ensure_tab_visible(int p_idx); + Size2 get_minimum_size() const; Tabs(); diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index d289510cb6..5923f89120 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -1354,6 +1354,10 @@ void ConcavePolygonShapeSW::_fill_bvh(_VolumeSW_BVH* p_bvh_tree,BVH* p_bvh_array void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) { int src_face_count=p_faces.size(); + if (src_face_count==0) { + configure(AABB()); + return; + } ERR_FAIL_COND(src_face_count%3); src_face_count/=3; diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp index 48f7c90066..601e53eabb 100644 --- a/tools/editor/editor_log.cpp +++ b/tools/editor/editor_log.cpp @@ -243,7 +243,7 @@ EditorLog::EditorLog() { log->set_selection_enabled(true); log->set_focus_mode(FOCUS_CLICK); pc->add_child(log); - add_message(VERSION_FULL_NAME" (c) 2008-2015 Juan Linietsky, Ariel Manzur."); + add_message(VERSION_FULL_NAME" (c) 2008-2016 Juan Linietsky, Ariel Manzur."); //log->add_text("Initialization Complete.\n"); //because it looks cool. add_style_override("panel",get_stylebox("panelf","Panel")); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 462153a183..d4596c7496 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1450,12 +1450,6 @@ void EditorNode::_dialog_action(String p_file) { if (p_file.empty()) return; - if (p_file=="Default") { - confirm_error->set_text("Cannot overwrite default layout!"); - confirm_error->popup_centered_minsize(); - return; - } - Ref<ConfigFile> config; config.instance(); Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg")); @@ -1463,8 +1457,7 @@ void EditorNode::_dialog_action(String p_file) { if (err==ERR_CANT_OPEN) { config.instance(); // new config } else if (err!=OK) { - confirm_error->set_text("Error trying to save layout!"); - confirm_error->popup_centered_minsize(); + show_warning("Error trying to save layout!"); return; } @@ -1475,25 +1468,22 @@ void EditorNode::_dialog_action(String p_file) { layout_dialog->hide(); _update_layouts_menu(); + if (p_file=="Default") { + show_warning("Default editor layout overridden."); + } + } break; case SETTINGS_LAYOUT_DELETE: { if (p_file.empty()) return; - if (p_file=="Default") { - confirm_error->set_text("Cannot delete default layout!"); - confirm_error->popup_centered_minsize(); - return; - } - Ref<ConfigFile> config; config.instance(); Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg")); if (err!=OK || !config->has_section(p_file)) { - confirm_error->set_text("Layout name not found!"); - confirm_error->popup_centered_minsize(); + show_warning("Layout name not found!"); return; } @@ -1509,6 +1499,10 @@ void EditorNode::_dialog_action(String p_file) { layout_dialog->hide(); _update_layouts_menu(); + if (p_file=="Default") { + show_warning("Restored Default layout to base settings."); + } + } break; default: { //save scene? @@ -2081,21 +2075,21 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case FILE_QUICK_OPEN_SCENE: { - quick_open->popup("PackedScene"); + quick_open->popup("PackedScene", true); quick_open->set_title("Quick Open Scene.."); } break; case FILE_QUICK_OPEN_SCRIPT: { - quick_open->popup("Script"); + quick_open->popup("Script", true); quick_open->set_title("Quick Open Script.."); } break; case FILE_QUICK_OPEN_FILE: { - quick_open->popup("Resource",false,true); + quick_open->popup("Resource", false, true); quick_open->set_title("Quick Search File.."); } break; @@ -3174,7 +3168,7 @@ Error EditorNode::save_translatable_strings(const String& p_to_file) { OS::Time time = OS::get_singleton()->get_time(); f->store_line("# Translation Strings Dump."); f->store_line("# Created By."); - f->store_line("# \t" VERSION_FULL_NAME " (c) 2008-2015 Juan Linietsky, Ariel Manzur."); + f->store_line("# \t" VERSION_FULL_NAME " (c) 2008-2016 Juan Linietsky, Ariel Manzur."); f->store_line("# From Scene: "); f->store_line("# \t"+get_edited_scene()->get_filename()); f->store_line(""); @@ -3931,19 +3925,26 @@ void EditorNode::hide_animation_player_editors() { emit_signal("hide_animation_player_editors"); } -void EditorNode::_quick_opened(const String& p_resource) { +void EditorNode::_quick_opened() { if (current_option==FILE_QUICK_OPEN_FILE) { - scenes_dock->open(p_resource); + String res_path = quick_open->get_selected(); + + scenes_dock->open(res_path); return; } - if (quick_open->get_base_type()=="PackedScene") { - open_request(p_resource); - } else { - load_resource(p_resource); - } + Vector<String> files = quick_open->get_selected_files(); + + for (int i = 0; i < files.size(); i++) { + String res_path = files[i]; + if (quick_open->get_base_type()=="PackedScene") { + open_request(res_path); + } else { + load_resource(res_path); + } + } } void EditorNode::_quick_run(const String& p_resource) { @@ -4511,7 +4512,11 @@ void EditorNode::_load_docks() { config.instance(); Error err = config->load(EditorSettings::get_singleton()->get_project_settings_path().plus_file("editor_layout.cfg")); if (err!=OK) { - return; //no config + //no config + if (overridden_default_layout>=0) { + _layout_menu_option(overridden_default_layout); + } + return; } _load_docks_from_config(config, "docks"); @@ -4613,6 +4618,8 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String& void EditorNode::_update_layouts_menu() { editor_layouts->clear(); + overridden_default_layout=-1; + editor_layouts->set_size(Vector2()); editor_layouts->add_item("Save Layout", SETTINGS_LAYOUT_SAVE); editor_layouts->add_item("Delete Layout", SETTINGS_LAYOUT_DELETE); @@ -4633,8 +4640,12 @@ void EditorNode::_update_layouts_menu() { String layout=E->get(); - if (layout!="Default") - editor_layouts->add_item(layout); + if (layout=="Default") { + editor_layouts->remove_item(editor_layouts->get_item_index(SETTINGS_LAYOUT_DEFAULT)); + overridden_default_layout=editor_layouts->get_item_count(); + } + + editor_layouts->add_item(layout); } } @@ -4659,7 +4670,7 @@ void EditorNode::_layout_menu_option(int p_id) { } break; case SETTINGS_LAYOUT_DEFAULT: { - _load_docks_from_config(default_theme, "docks"); + _load_docks_from_config(default_layout, "docks"); _save_docks(); } break; default: { @@ -4673,7 +4684,6 @@ void EditorNode::_layout_menu_option(int p_id) { _load_docks_from_config(config, editor_layouts->get_item_text(p_id)); _save_docks(); - } } @@ -4723,11 +4733,13 @@ void EditorNode::_scene_tab_changed(int p_tab) { editor_data.get_undo_redo().add_do_method(this,"set_current_version",unsaved?saved_version:0); editor_data.get_undo_redo().add_do_method(this,"set_current_scene",p_tab); editor_data.get_undo_redo().add_do_method(scene_tabs,"set_current_tab",p_tab); + editor_data.get_undo_redo().add_do_method(scene_tabs,"ensure_tab_visible",p_tab); editor_data.get_undo_redo().add_do_method(this,"set_current_version",next_scene_version==0?editor_data.get_undo_redo().get_version()+1:next_scene_version); editor_data.get_undo_redo().add_undo_method(this,"set_current_version",next_scene_version); editor_data.get_undo_redo().add_undo_method(this,"set_current_scene",editor_data.get_edited_scene()); editor_data.get_undo_redo().add_undo_method(scene_tabs,"set_current_tab",editor_data.get_edited_scene()); + editor_data.get_undo_redo().add_undo_method(scene_tabs,"ensure_tab_visible",p_tab,editor_data.get_edited_scene()); editor_data.get_undo_redo().add_undo_method(this,"set_current_version",saved_version); editor_data.get_undo_redo().commit_action(); @@ -5456,8 +5468,6 @@ EditorNode::EditorNode() { gui_base->add_child(layout_dialog); layout_dialog->set_hide_on_ok(false); layout_dialog->set_size(Size2(175, 70)); - confirm_error = memnew( AcceptDialog ); - layout_dialog->add_child(confirm_error); layout_dialog->connect("name_confirmed", this,"_dialog_action"); sources_button = memnew( ToolButton ); @@ -5648,15 +5658,16 @@ EditorNode::EditorNode() { const String docks_section = "docks"; - default_theme.instance(); - default_theme->set_value(docks_section, "dock_3", "Scene"); - default_theme->set_value(docks_section, "dock_4", "FileSystem"); - default_theme->set_value(docks_section, "dock_5", "Inspector"); + overridden_default_layout=-1; + default_layout.instance(); + default_layout->set_value(docks_section, "dock_3", "Scene"); + default_layout->set_value(docks_section, "dock_4", "FileSystem"); + default_layout->set_value(docks_section, "dock_5", "Inspector"); for(int i=0;i<DOCK_SLOT_MAX/2;i++) - default_theme->set_value(docks_section, "dock_hsplit_"+itos(i+1), 0); + default_layout->set_value(docks_section, "dock_hsplit_"+itos(i+1), 0); for(int i=0;i<DOCK_SLOT_MAX/2;i++) - default_theme->set_value(docks_section, "dock_split_"+itos(i+1), 0); + default_layout->set_value(docks_section, "dock_split_"+itos(i+1), 0); _update_layouts_menu(); @@ -5799,7 +5810,7 @@ EditorNode::EditorNode() { about->get_ok()->set_text("Thanks!"); about->set_hide_on_ok(true); Label *about_text = memnew( Label ); - about_text->set_text(VERSION_FULL_NAME"\n(c) 2008-2015 Juan Linietsky, Ariel Manzur.\n"); + about_text->set_text(VERSION_FULL_NAME"\n(c) 2008-2016 Juan Linietsky, Ariel Manzur.\n"); about_text->set_pos(Point2(gui_base->get_icon("Logo","EditorIcons")->get_size().width+30,20)); gui_base->add_child(about); about->add_child(about_text); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 2228e0948b..d8d76d47cc 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -288,10 +288,10 @@ class EditorNode : public Node { AcceptDialog *about; AcceptDialog *warning; - Ref<ConfigFile> default_theme; + int overridden_default_layout; + Ref<ConfigFile> default_layout; PopupMenu *editor_layouts; EditorNameDialog *layout_dialog; - AcceptDialog *confirm_error; //OptimizedPresetsDialog *optimized_presets; EditorSettingsDialog *settings_config_dialog; @@ -440,7 +440,7 @@ class EditorNode : public Node { void _update_keying(); void _hide_top_editors(); - void _quick_opened(const String& p_resource); + void _quick_opened(); void _quick_run(const String& p_resource); void _run(bool p_current=false, const String &p_custom=""); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 6c36c71e93..fc0d68b2f8 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -327,7 +327,11 @@ void ScriptTextEditor::_load_theme_settings() { for(List<StringName>::Element *E=types.front();E;E=E->next()) { - get_text_edit()->add_keyword_color(E->get(),type_color); + String n = E->get(); + if (n.begins_with("_")) + n = n.substr(1, n.length()); + + get_text_edit()->add_keyword_color(n,type_color); } //colorize comments diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 0fac1346fc..29d2a7774c 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2629,6 +2629,13 @@ Dictionary SpatialEditor::get_state() const { Dictionary d; + d["snap_enabled"]=snap_enabled; + d["translate_snap"]=get_translate_snap(); + d["rotate_snap"]=get_rotate_snap(); + d["scale_snap"]=get_scale_snap(); + + int local_coords_index=transform_menu->get_popup()->get_item_index(MENU_TRANSFORM_LOCAL_COORDS); + d["local_coords"]=transform_menu->get_popup()->is_item_checked( local_coords_index ); int vc=0; if (view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT) )) @@ -2670,37 +2677,52 @@ void SpatialEditor::set_state(const Dictionary& p_state) { Dictionary d = p_state; - ERR_FAIL_COND(!d.has("viewport_mode")); - ERR_FAIL_COND(!d.has("viewports")); - ERR_FAIL_COND(!d.has("default_light")); - ERR_FAIL_COND(!d.has("show_grid")); - ERR_FAIL_COND(!d.has("show_origin")); - ERR_FAIL_COND(!d.has("fov")); - ERR_FAIL_COND(!d.has("znear")); - ERR_FAIL_COND(!d.has("zfar")); + if (d.has("snap_enabled")) { + snap_enabled=d["snap_enabled"]; + int snap_enabled_idx=transform_menu->get_popup()->get_item_index(MENU_TRANSFORM_USE_SNAP); + transform_menu->get_popup()->set_item_checked( snap_enabled_idx, snap_enabled ); + } - int vc = d["viewport_mode"]; + if (d.has("translate_snap")) + snap_translate->set_text(d["translate_snap"]); - if (vc==1) - _menu_item_pressed(MENU_VIEW_USE_1_VIEWPORT); - else if (vc==2) - _menu_item_pressed(MENU_VIEW_USE_2_VIEWPORTS); - else if (vc==3) - _menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS); - else if (vc==4) - _menu_item_pressed(MENU_VIEW_USE_4_VIEWPORTS); - else if (vc==5) - _menu_item_pressed(MENU_VIEW_USE_2_VIEWPORTS_ALT); - else if (vc==6) - _menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS_ALT); - - Array vp = d["viewports"]; - ERR_FAIL_COND(vp.size()>4); + if (d.has("rotate_snap")) + snap_rotate->set_text(d["rotate_snap"]); - for(int i=0;i<4;i++) { - viewports[i]->set_state(vp[i]); + if (d.has("scale_snap")) + snap_scale->set_text(d["scale_snap"]); + + if (d.has("local_coords")) { + int local_coords_idx=transform_menu->get_popup()->get_item_index(MENU_TRANSFORM_LOCAL_COORDS); + transform_menu->get_popup()->set_item_checked( local_coords_idx, d["local_coords"] ); + update_transform_gizmo(); + } + + if (d.has("viewport_mode")) { + int vc = d["viewport_mode"]; + + if (vc==1) + _menu_item_pressed(MENU_VIEW_USE_1_VIEWPORT); + else if (vc==2) + _menu_item_pressed(MENU_VIEW_USE_2_VIEWPORTS); + else if (vc==3) + _menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS); + else if (vc==4) + _menu_item_pressed(MENU_VIEW_USE_4_VIEWPORTS); + else if (vc==5) + _menu_item_pressed(MENU_VIEW_USE_2_VIEWPORTS_ALT); + else if (vc==6) + _menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS_ALT); } + if (d.has("viewports")) { + Array vp = d["viewports"]; + ERR_FAIL_COND(vp.size()>4); + + for(int i=0;i<4;i++) { + viewports[i]->set_state(vp[i]); + } + } if (d.has("zfar")) settings_zfar->set_val(float(d["zfar"])); diff --git a/tools/editor/plugins/sprite_region_editor_plugin.cpp b/tools/editor/plugins/sprite_region_editor_plugin.cpp index 2653973226..725de19dd7 100644 --- a/tools/editor/plugins/sprite_region_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_region_editor_plugin.cpp @@ -411,6 +411,7 @@ SpriteRegionEditor::SpriteRegionEditor(EditorNode* p_editor) snap_step=Vector2(10,10); use_snap=false; snap_show_grid=false; + drag=false; add_child( memnew( VSeparator )); edit_node = memnew( ToolButton ); @@ -449,7 +450,7 @@ SpriteRegionEditor::SpriteRegionEditor(EditorNode* p_editor) hb_tools->add_child( memnew( VSeparator )); hb_tools->add_child( memnew( Label("Grid Offset:") ) ); - SpinBox *sb_off_x = memnew( SpinBox ); + sb_off_x = memnew( SpinBox ); sb_off_x->set_min(-256); sb_off_x->set_max(256); sb_off_x->set_step(1); @@ -458,7 +459,7 @@ SpriteRegionEditor::SpriteRegionEditor(EditorNode* p_editor) sb_off_x->connect("value_changed", this, "_set_snap_off_x"); hb_tools->add_child(sb_off_x); - SpinBox *sb_off_y = memnew( SpinBox ); + sb_off_y = memnew( SpinBox ); sb_off_y->set_min(-256); sb_off_y->set_max(256); sb_off_y->set_step(1); @@ -470,7 +471,7 @@ SpriteRegionEditor::SpriteRegionEditor(EditorNode* p_editor) hb_tools->add_child( memnew( VSeparator )); hb_tools->add_child( memnew( Label("Grid Step:") ) ); - SpinBox *sb_step_x = memnew( SpinBox ); + sb_step_x = memnew( SpinBox ); sb_step_x->set_min(-256); sb_step_x->set_max(256); sb_step_x->set_step(1); @@ -479,7 +480,7 @@ SpriteRegionEditor::SpriteRegionEditor(EditorNode* p_editor) sb_step_x->connect("value_changed", this, "_set_snap_step_x"); hb_tools->add_child(sb_step_x); - SpinBox *sb_step_y = memnew( SpinBox ); + sb_step_y = memnew( SpinBox ); sb_step_y->set_min(-256); sb_step_y->set_max(256); sb_step_y->set_step(1); @@ -488,8 +489,6 @@ SpriteRegionEditor::SpriteRegionEditor(EditorNode* p_editor) sb_step_y->connect("value_changed", this, "_set_snap_step_y"); hb_tools->add_child(sb_step_y); -// MARIANOGNU::TODO: Add more tools? - HBoxContainer *main_hb = memnew( HBoxContainer ); main_vb->add_child(main_hb); edit_draw = memnew( Control ); @@ -554,6 +553,50 @@ void SpriteRegionEditorPlugin::make_visible(bool p_visible) } } + +Dictionary SpriteRegionEditorPlugin::get_state() const { + + Dictionary state; + state["zoom"]=region_editor->zoom->get_val(); + state["snap_offset"]=region_editor->snap_offset; + state["snap_step"]=region_editor->snap_step; + state["use_snap"]=region_editor->use_snap; + state["snap_show_grid"]=region_editor->snap_show_grid; + return state; +} + +void SpriteRegionEditorPlugin::set_state(const Dictionary& p_state){ + + Dictionary state=p_state; + if (state.has("zoom")) { + region_editor->zoom->set_val(p_state["zoom"]); + } + + if (state.has("snap_step")) { + Vector2 s = state["snap_step"]; + region_editor->sb_step_x->set_val(s.x); + region_editor->sb_step_y->set_val(s.y); + region_editor->snap_step = s; + } + + if (state.has("snap_offset")) { + Vector2 ofs = state["snap_offset"]; + region_editor->sb_off_x->set_val(ofs.x); + region_editor->sb_off_y->set_val(ofs.y); + region_editor->snap_offset = ofs; + } + + if (state.has("use_snap")) { + region_editor->use_snap=state["use_snap"]; + region_editor->b_snap_enable->set_pressed(state["use_snap"]); + } + + if (state.has("snap_show_grid")) { + region_editor->snap_show_grid=state["snap_show_grid"]; + region_editor->b_snap_grid->set_pressed(state["snap_show_grid"]); + } +} + SpriteRegionEditorPlugin::SpriteRegionEditorPlugin(EditorNode *p_node) { editor = p_node; diff --git a/tools/editor/plugins/sprite_region_editor_plugin.h b/tools/editor/plugins/sprite_region_editor_plugin.h index fafa2e119b..47cb210863 100644 --- a/tools/editor/plugins/sprite_region_editor_plugin.h +++ b/tools/editor/plugins/sprite_region_editor_plugin.h @@ -41,6 +41,8 @@ class SpriteRegionEditor : public HBoxContainer { OBJ_TYPE(SpriteRegionEditor, HBoxContainer ); + friend class SpriteRegionEditorPlugin; + ToolButton *edit_node; // Button *use_region; ToolButton *b_snap_enable; @@ -48,6 +50,10 @@ class SpriteRegionEditor : public HBoxContainer { TextureFrame *icon_zoom; HSlider *zoom; SpinBox *zoom_value; + SpinBox *sb_step_y; + SpinBox *sb_step_x; + SpinBox *sb_off_y; + SpinBox *sb_off_x; Control *edit_draw; VScrollBar *vscroll; @@ -113,11 +119,13 @@ class SpriteRegionEditorPlugin : public EditorPlugin EditorNode *editor; public: - virtual String get_name() const { return "Sprite"; } + virtual String get_name() const { return "SpriteRegion"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_node); virtual bool handles(Object *p_node) const; virtual void make_visible(bool p_visible); + void set_state(const Dictionary &p_state); + Dictionary get_state() const; SpriteRegionEditorPlugin(EditorNode *p_node); }; diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index 5fd9118a32..589d9d3d99 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -964,7 +964,7 @@ ProjectManager::ProjectManager() { String cp; cp.push_back(0xA9); cp.push_back(0); - l->set_text(cp+" 2008-2015 Juan Linietsky, Ariel Manzur."); + l->set_text(cp+" 2008-2016 Juan Linietsky, Ariel Manzur."); l->set_align(Label::ALIGN_CENTER); vb->add_child(l); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index d0a37f0c7d..9743dc7202 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -727,7 +727,17 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty RES cb=EditorSettings::get_singleton()->get_resource_clipboard(); - bool paste_valid=cb.is_valid() && (hint_text=="" || ObjectTypeDB::is_type(cb->get_type(),hint_text)); + bool paste_valid=false; + if (cb.is_valid()) { + if (hint_text=="") + paste_valid=true; + else + for (int i = 0; i < hint_text.get_slice_count(",");i++) + if (ObjectTypeDB::is_type(cb->get_type(),hint_text.get_slice(",",i))) { + paste_valid=true; + break; + } + } if (!RES(v).is_null() || paste_valid) { menu->add_separator(); diff --git a/tools/editor/quick_open.cpp b/tools/editor/quick_open.cpp index bfbcb739ac..22f4a40c83 100644 --- a/tools/editor/quick_open.cpp +++ b/tools/editor/quick_open.cpp @@ -30,7 +30,7 @@ #include "os/keyboard.h" -void EditorQuickOpen::popup(const StringName &p_base, bool p_dontclear, bool p_add_dirs) { +void EditorQuickOpen::popup(const StringName &p_base, bool p_enable_multi, bool p_add_dirs, bool p_dontclear) { add_directories=p_add_dirs; popup_centered_ratio(0.6); @@ -38,13 +38,38 @@ void EditorQuickOpen::popup(const StringName &p_base, bool p_dontclear, bool p_a search_box->select_all(); else search_box->clear(); + if (p_enable_multi) + search_options->set_select_mode(Tree::SELECT_MULTI); + else + search_options->set_select_mode(Tree::SELECT_SINGLE); search_box->grab_focus(); base_type=p_base; _update_search(); +} + +String EditorQuickOpen::get_selected() const { + TreeItem *ti = search_options->get_selected(); + if (!ti) + return String(); + return "res://" + ti->get_text(0); } +Vector<String> EditorQuickOpen::get_selected_files() const { + + Vector<String> files; + + TreeItem* item = search_options->get_next_selected(search_options->get_root()); + while (item) { + + files.push_back("res://"+item->get_text(0)); + + item = search_options->get_next_selected(item); + } + + return files; +} void EditorQuickOpen::_text_changed(const String& p_newtext) { @@ -132,7 +157,7 @@ void EditorQuickOpen::_confirmed() { TreeItem *ti = search_options->get_selected(); if (!ti) return; - emit_signal("quick_open","res://"+ti->get_text(0)); + emit_signal("quick_open"); hide(); } @@ -156,7 +181,7 @@ void EditorQuickOpen::_bind_methods() { ObjectTypeDB::bind_method(_MD("_confirmed"),&EditorQuickOpen::_confirmed); ObjectTypeDB::bind_method(_MD("_sbox_input"),&EditorQuickOpen::_sbox_input); - ADD_SIGNAL(MethodInfo("quick_open",PropertyInfo(Variant::STRING,"respath"))); + ADD_SIGNAL(MethodInfo("quick_open")); } diff --git a/tools/editor/quick_open.h b/tools/editor/quick_open.h index 7f2091e5d1..520f7e569d 100644 --- a/tools/editor/quick_open.h +++ b/tools/editor/quick_open.h @@ -61,7 +61,10 @@ public: StringName get_base_type() const; - void popup(const StringName& p_base,bool p_dontclear=false,bool p_add_dirs=false); + String get_selected() const; + Vector<String> get_selected_files() const; + + void popup(const StringName& p_base,bool p_enable_multi=false,bool p_add_dirs=false,bool p_dontclear=false); EditorQuickOpen(); }; diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 75f1597b20..89036d2581 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -1268,6 +1268,11 @@ void SceneTreeDock::_create() { editor->set_edited_scene(newnode); } + //small hack to make collisionshapes and other kind of nodes to work + for(int i=0;i<newnode->get_child_count();i++) { + Node *c=newnode->get_child(i); + c->call("set_transform", c->call("get_transform") ); + } editor_data->get_undo_redo().clear_history(); newnode->set_name(newname); |