diff options
84 files changed, 667 insertions, 420 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/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 796dcde3d0..c008c3f9a4 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -725,7 +725,8 @@ Error ResourceInteractiveLoaderBinary::poll(){ } } else { - path=res_path; + if (!ResourceCache::has(res_path)) + path=res_path; } uint64_t offset = internal_resources[s].offset; diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp index 74813d24fa..8c8d79948a 100644 --- a/core/io/resource_format_xml.cpp +++ b/core/io/resource_format_xml.cpp @@ -1570,7 +1570,9 @@ Error ResourceInteractiveLoaderXML::poll() { if (main) { f->close(); resource=res; - resource->set_path(res_path); + if (!ResourceCache::has(res_path)) { + resource->set_path(res_path); + } error=ERR_FILE_EOF; return error; 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 1a505fb236..be447d511e 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -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 711743f23a..83ea2c2101 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -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/print_string.cpp b/core/print_string.cpp index 37760a66ca..e364388b7b 100644 --- a/core/print_string.cpp +++ b/core/print_string.cpp @@ -66,7 +66,7 @@ void remove_print_handler(PrintHandlerList *p_handler) { l=l->next; } - OS::get_singleton()->print("print hanlder list is %p\n",print_handler_list); + OS::get_singleton()->print("print handler list is %p\n",print_handler_list); ERR_FAIL_COND(l==NULL); _global_unlock(); 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/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/gles2/shader_gles2.h b/drivers/gles2/shader_gles2.h index 51520cc9da..68ae8af63f 100644 --- a/drivers/gles2/shader_gles2.h +++ b/drivers/gles2/shader_gles2.h @@ -205,6 +205,11 @@ private: Plane val=p_value; glUniform4f( p_uniform, val.normal.x,val.normal.y,val.normal.z,val.d ); } break; + case Variant::QUAT: { + + Quat val=p_value; + glUniform4f( p_uniform, val.x,val.y,val.z,val.w ); + } break; case Variant::MATRIX32: { 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/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 8e3fba167f..a004a116e0 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -78,11 +78,11 @@ void OS_Unix::print_error(const char* p_function,const char* p_file,int p_line,c break; case ERR_WARNING: print("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n",p_function,err_details); - print("\E[0;33m At: %s:%i.\E[0m\n",p_file,p_line); + print("\E[0;33m At: %s:%i.\E[0m\n",p_file,p_line); break; case ERR_SCRIPT: print("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n",p_function,err_details); - print("\E[0;35m At: %s:%i.\E[0m\n",p_file,p_line); + print("\E[0;35m At: %s:%i.\E[0m\n",p_file,p_line); break; } } 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..8319c415fc 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"); @@ -1327,6 +1327,30 @@ bool Main::start() { //autoload List<PropertyInfo> props; Globals::get_singleton()->get_property_list(&props); + + //first pass, add the constants so they exist before any script is loaded + for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) { + + String s = E->get().name; + if (!s.begins_with("autoload/")) + continue; + String name = s.get_slicec('/',1); + String path = Globals::get_singleton()->get(s); + bool global_var=false; + if (path.begins_with("*")) { + global_var=true; + } + + if (global_var) { + for(int i=0;i<ScriptServer::get_language_count();i++) { + ScriptServer::get_language(i)->add_global_constant(name,Variant()); + } + } + + } + + //second pass, load into global constants + List<Node*> to_add; for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) { String s = E->get().name; @@ -1350,12 +1374,13 @@ bool Main::start() { } else if (res->is_type("Script")) { Ref<Script> s = res; StringName ibt = s->get_instance_base_type(); + bool valid_type = ObjectTypeDB::is_type(ibt,"Node"); ERR_EXPLAIN("Script does not inherit a Node: "+path); - ERR_CONTINUE( !ObjectTypeDB::is_type(ibt,"Node") ); + ERR_CONTINUE( !valid_type ); Object *obj = ObjectTypeDB::instance(ibt); - ERR_EXPLAIN("Cannot instance node for autoload type: "+String(ibt)); + ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: "+String(ibt)); ERR_CONTINUE( obj==NULL ); n = obj->cast_to<Node>(); @@ -1366,7 +1391,9 @@ bool Main::start() { ERR_CONTINUE(!n); n->set_name(name); - sml->get_root()->add_child(n); + //defer so references are all valid on _ready() + //sml->get_root()->add_child(n); + to_add.push_back(n); if (global_var) { for(int i=0;i<ScriptServer::get_language_count();i++) { @@ -1374,9 +1401,15 @@ bool Main::start() { } } + } + + for(List<Node*>::Element *E=to_add.front();E;E=E->next()) { + sml->get_root()->add_child(E->get()); } + + } Node *scene=NULL; diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index cf8f762a86..a69f99314a 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -534,6 +534,7 @@ public: virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const; virtual void add_global_constant(const StringName& p_variable,const Variant& p_value); + /* DEBUGGER FUNCTIONS */ virtual String debug_get_error() const; 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/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 79d8aa1a0c..6f19f8bdfe 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2104,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 69bdcda278..e433d5cc11 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -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/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/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/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/line_edit.cpp b/scene/gui/line_edit.cpp index 49ea077a30..fdced3f62f 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -330,6 +330,8 @@ void LineEdit::_input_event(InputEvent p_event) { append_at_cursor(ucodestr); emit_signal("text_changed",text); _change_notify("text"); + + accept_event(); } } else { diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index bb64a57212..a26acc9c05 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -65,8 +65,8 @@ Size2 Tabs::get_minimum_size() const { ms.height=MAX(bms.height+tab_bg->get_minimum_size().height,ms.height); } - if (tabs[i].close_button.is_valid()) { - Ref<Texture> cb=tabs[i].close_button; + if (cb_displaypolicy==CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy==CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i==current)) { + Ref<Texture> cb=get_icon("close"); Size2 bms = cb->get_size();//+get_stylebox("button")->get_minimum_size(); bms.width+=get_constant("hseparation"); ms.width+=bms.width; @@ -108,14 +108,6 @@ void Tabs::_input_event(const InputEvent& p_event) { for(int i=0;i<tabs.size();i++) { // test hovering tab to display close button if policy says so - if (cb_displaypolicy == SHOW_HOVER) { - int ofs=tabs[i].ofs_cache; - int size = tabs[i].ofs_cache; - if (pos.x >=tabs[i].ofs_cache && pos.x<tabs[i].ofs_cache+tabs[i].size_cache) { - hover=i; - } - } - // test hovering right button and close button if (tabs[i].rb_rect.has_point(pos)) { @@ -260,6 +252,7 @@ void Tabs::_notification(int p_what) { Ref<Font> font = get_font("font"); Color color_fg = get_color("font_color_fg"); Color color_bg = get_color("font_color_bg"); + Ref<Texture> close=get_icon("close"); int h = get_size().height; @@ -278,37 +271,10 @@ 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"); - - } + int sz = get_tab_width(i); tabs[i].ofs_cache=mw; - - mw+=font->get_string_size(tabs[i].text).width; - if (current==i) - mw+=tab_fg->get_minimum_size().width; - else - mw+=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"); - - mw+=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"); - mw+=bms.width; - } - + mw+=sz; } @@ -372,56 +338,15 @@ void Tabs::_notification(int p_what) { } - // Close button - switch (cb_displaypolicy) { - case SHOW_ALWAYS: { - if (tabs[i].close_button.is_valid()) { - Ref<StyleBox> style = get_stylebox("button"); - Ref<Texture> rb=tabs[i].close_button; - lsize+=get_constant("hseparation"); - //lsize+=style->get_margin(MARGIN_LEFT); - lsize+=rb->get_width(); - //lsize+=style->get_margin(MARGIN_RIGHT); - - } - } break; - case SHOW_ACTIVE_ONLY: { - if (i==current) { - if (tabs[i].close_button.is_valid()) { - Ref<StyleBox> style = get_stylebox("button"); - Ref<Texture> rb=tabs[i].close_button; - - lsize+=get_constant("hseparation"); - //lsize+=style->get_margin(MARGIN_LEFT); - lsize+=rb->get_width(); - //lsize+=style->get_margin(MARGIN_RIGHT); - - } - } - } break; - case SHOW_HOVER: { - if (i==current || i==hover) { - if (tabs[i].close_button.is_valid()) { - Ref<StyleBox> style = get_stylebox("button"); - Ref<Texture> rb=tabs[i].close_button; - - lsize+=get_constant("hseparation"); - //lsize+=style->get_margin(MARGIN_LEFT); - lsize+=rb->get_width(); - //lsize+=style->get_margin(MARGIN_RIGHT); - - } - } - } break; - case SHOW_NEVER: // by default, never show close button - default: { - // do nothing - } break; + if (cb_displaypolicy==CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy==CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i==current)) { + lsize+=get_constant("hseparation"); + //lsize+=style->get_margin(MARGIN_LEFT); + lsize+=close->get_width(); + //lsize+=style->get_margin(MARGIN_RIGHT); } - if (w+lsize > limit) { max_drawn_tab=i-1; missing_right=true; @@ -495,100 +420,31 @@ void Tabs::_notification(int p_what) { } + if (cb_displaypolicy==CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy==CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i==current)) { + Ref<StyleBox> style = get_stylebox("button"); + Ref<Texture> cb=close; - // Close button - switch (cb_displaypolicy) { - case SHOW_ALWAYS: { - if (tabs[i].close_button.is_valid()) { - Ref<StyleBox> style = get_stylebox("button"); - Ref<Texture> cb=tabs[i].close_button; - - w+=get_constant("hseparation"); - - Rect2 cb_rect; - cb_rect.size=style->get_minimum_size()+cb->get_size(); - cb_rect.pos.x=w; - cb_rect.pos.y=sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-(cb_rect.size.y))/2; - - if (cb_hover==i) { - if (cb_pressing) - get_stylebox("button_pressed")->draw(ci,cb_rect); - else - style->draw(ci,cb_rect); - } + w+=get_constant("hseparation"); - //w+=style->get_margin(MARGIN_LEFT); + Rect2 cb_rect; + cb_rect.size=style->get_minimum_size()+cb->get_size(); + cb_rect.pos.x=w; + cb_rect.pos.y=sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-(cb_rect.size.y))/2; - cb->draw(ci,Point2i( w,cb_rect.pos.y+style->get_margin(MARGIN_TOP) )); - w+=cb->get_width(); - //w+=style->get_margin(MARGIN_RIGHT); - tabs[i].cb_rect=cb_rect; - } - } break; - case SHOW_ACTIVE_ONLY: { - if (current==i) { - if (tabs[i].close_button.is_valid()) { - Ref<StyleBox> style = get_stylebox("button"); - Ref<Texture> cb=tabs[i].close_button; - - w+=get_constant("hseparation"); - - Rect2 cb_rect; - cb_rect.size=style->get_minimum_size()+cb->get_size(); - cb_rect.pos.x=w; - cb_rect.pos.y=sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-(cb_rect.size.y))/2; - - if (cb_hover==i) { - if (cb_pressing) - get_stylebox("button_pressed")->draw(ci,cb_rect); - else - style->draw(ci,cb_rect); - } - - //w+=style->get_margin(MARGIN_LEFT); - - cb->draw(ci,Point2i( w,cb_rect.pos.y+style->get_margin(MARGIN_TOP) )); - w+=cb->get_width(); - //w+=style->get_margin(MARGIN_RIGHT); - tabs[i].cb_rect=cb_rect; - } - } - } break; - case SHOW_HOVER: { - if (current==i || hover==i) { - if (tabs[i].close_button.is_valid()) { - Ref<StyleBox> style = get_stylebox("button"); - Ref<Texture> cb=tabs[i].close_button; - - w+=get_constant("hseparation"); - - Rect2 cb_rect; - cb_rect.size=style->get_minimum_size()+cb->get_size(); - cb_rect.pos.x=w; - cb_rect.pos.y=sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-(cb_rect.size.y))/2; - - if (cb_hover==i) { - if (cb_pressing) - get_stylebox("button_pressed")->draw(ci,cb_rect); - else - style->draw(ci,cb_rect); - } - - //w+=style->get_margin(MARGIN_LEFT); - - cb->draw(ci,Point2i( w,cb_rect.pos.y+style->get_margin(MARGIN_TOP) )); - w+=cb->get_width(); - //w+=style->get_margin(MARGIN_RIGHT); - tabs[i].cb_rect=cb_rect; - } + if (cb_hover==i) { + if (cb_pressing) + get_stylebox("button_pressed")->draw(ci,cb_rect); + else + style->draw(ci,cb_rect); } - } break; - case SHOW_NEVER: - default: { - // show nothing - } break; + //w+=style->get_margin(MARGIN_LEFT); + + cb->draw(ci,Point2i( w,cb_rect.pos.y+style->get_margin(MARGIN_TOP) )); + w+=cb->get_width(); + //w+=style->get_margin(MARGIN_RIGHT); + tabs[i].cb_rect=cb_rect; } w+=sb->get_margin(MARGIN_RIGHT); @@ -695,20 +551,6 @@ Ref<Texture> Tabs::get_tab_right_button(int p_tab) const{ } -void Tabs::set_tab_close_button(int p_tab, const Ref<Texture>& p_close_button) { - ERR_FAIL_INDEX(p_tab, tabs.size()); - tabs[p_tab].close_button=p_close_button; - update(); - minimum_size_changed(); -} - - -Ref<Texture> Tabs::get_tab_close_button(int p_tab) const{ - - ERR_FAIL_INDEX_V(p_tab,tabs.size(),Ref<Texture>()); - return tabs[p_tab].close_button; - -} void Tabs::add_tab(const String& p_str,const Ref<Texture>& p_icon) { @@ -716,8 +558,6 @@ void Tabs::add_tab(const String& p_str,const Ref<Texture>& p_icon) { t.text=p_str; t.icon=p_icon; - t.close_button = get_icon("close"); - tabs.push_back(t); update(); @@ -749,10 +589,6 @@ void Tabs::remove_tab(int p_idx) { } -void Tabs::set_tab_close_display_policy(CloseButtonDisplayPolicy p_cb_displaypolicy) { - cb_displaypolicy = p_cb_displaypolicy; -} - void Tabs::set_tab_align(TabAlign p_align) { @@ -765,6 +601,49 @@ Tabs::TabAlign Tabs::get_tab_align() const { return tab_align; } +int Tabs::get_tab_width(int p_idx) const { + + ERR_FAIL_INDEX_V(p_idx,tabs.size(),0); + + Ref<StyleBox> tab_bg = get_stylebox("tab_bg"); + Ref<StyleBox> tab_fg = get_stylebox("tab_fg"); + Ref<Font> font = get_font("font"); + Ref<Texture> close=get_icon("close"); + + int x=0; + + Ref<Texture> tex = tabs[p_idx].icon; + if (tex.is_valid()) { + if (tabs[p_idx].text!="") + x+=get_constant("hseparation"); + + } + + + x+=font->get_string_size(tabs[p_idx].text).width; + if (current==p_idx) + x+=tab_fg->get_minimum_size().width; + else + x+=tab_bg->get_minimum_size().width; + + if (tabs[p_idx].right_button.is_valid()) { + print_line("has right"); + Ref<Texture> rb=tabs[p_idx].right_button; + Size2 bms = rb->get_size();//+get_stylebox("button")->get_minimum_size(); + bms.width+=get_constant("hseparation"); + + x+=bms.width; + } + + if (cb_displaypolicy==CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy==CLOSE_BUTTON_SHOW_ACTIVE_ONLY && p_idx==current)) { + + Size2 bms = close->get_size();//+get_stylebox("button")->get_minimum_size(); + bms.width+=get_constant("hseparation"); + x+=bms.width; + } + + return x; +} void Tabs::ensure_tab_visible(int p_idx) { @@ -773,16 +652,12 @@ void Tabs::ensure_tab_visible(int p_idx) { ERR_FAIL_INDEX(p_idx,tabs.size()); - if (p_idx<offset) { + 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"); @@ -796,49 +671,25 @@ void Tabs::ensure_tab_visible(int p_idx) { if (i<offset) continue; - Ref<Texture> tex = tabs[i].icon; - if (tex.is_valid()) { - if (tabs[i].text!="") - x+=get_constant("hseparation"); - - } - + int sz = get_tab_width(i); 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; - - + tabs[i].x_size_cache=sz; + x+=sz; } - while(offset<tabs.size() && ( (tabs[p_idx].x_cache + tabs[p_idx].x_size_cache) - tabs[offset].x_cache) < limit) { + while(offset<tabs.size() && ( (tabs[p_idx].x_cache + tabs[p_idx].x_size_cache) - tabs[offset].x_cache) > limit) { offset++; } update(); } +void Tabs::set_tab_close_display_policy(CloseButtonDisplayPolicy p_policy) { + cb_displaypolicy=p_policy; + update(); +} + void Tabs::_bind_methods() { ObjectTypeDB::bind_method(_MD("_input_event"),&Tabs::_input_event); @@ -866,10 +717,10 @@ void Tabs::_bind_methods() { BIND_CONSTANT( ALIGN_CENTER ); BIND_CONSTANT( ALIGN_RIGHT ); - BIND_CONSTANT( SHOW_ACTIVE_ONLY ); - BIND_CONSTANT( SHOW_ALWAYS ); - BIND_CONSTANT( SHOW_HOVER ); - BIND_CONSTANT( SHOW_NEVER ); + BIND_CONSTANT( CLOSE_BUTTON_SHOW_ACTIVE_ONLY ); + BIND_CONSTANT( CLOSE_BUTTON_SHOW_ALWAYS ); + BIND_CONSTANT( CLOSE_BUTTON_SHOW_NEVER ); + } @@ -883,7 +734,7 @@ Tabs::Tabs() { cb_hover=-1; cb_pressing=false; - cb_displaypolicy = SHOW_NEVER; // Default : no close button + cb_displaypolicy = CLOSE_BUTTON_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 82035291ec..7f85280853 100644 --- a/scene/gui/tabs.h +++ b/scene/gui/tabs.h @@ -45,10 +45,9 @@ public: enum CloseButtonDisplayPolicy { - SHOW_ALWAYS, - SHOW_ACTIVE_ONLY, - SHOW_HOVER, - SHOW_NEVER + CLOSE_BUTTON_SHOW_NEVER, + CLOSE_BUTTON_SHOW_ACTIVE_ONLY, + CLOSE_BUTTON_SHOW_ALWAYS, }; private: @@ -64,7 +63,6 @@ private: Ref<Texture> right_button; Rect2 rb_rect; - Ref<Texture> close_button; Rect2 cb_rect; }; @@ -89,6 +87,8 @@ private: int hover; // hovered tab + int get_tab_width(int p_idx) const; + protected: void _input_event(const InputEvent& p_event); @@ -108,13 +108,11 @@ public: void set_tab_right_button(int p_tab,const Ref<Texture>& p_right_button); Ref<Texture> get_tab_right_button(int p_tab) const; - void set_tab_close_button(int p_tab, const Ref<Texture>& p_close_button); - Ref<Texture> get_tab_close_button(int p_tab) const; - void set_tab_close_display_policy(CloseButtonDisplayPolicy p_cb_displaypolicy); - void set_tab_align(TabAlign p_align); TabAlign get_tab_align() const; + void set_tab_close_display_policy(CloseButtonDisplayPolicy p_policy); + int get_tab_count() const; void set_current_tab(int p_current); int get_current_tab() const; diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index d2795bddb8..03127620f7 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1597,6 +1597,16 @@ Node *PackedScene::instance(bool p_gen_edit_state) const { return s; } +void PackedScene::replace_state(Ref<SceneState> p_by) { + + state=p_by; + state->set_path(get_path()); +#ifdef TOOLS_ENABLED + state->set_last_modified_time(get_last_modified_time()); +#endif + +} + void PackedScene::recreate_state() { state = Ref<SceneState>( memnew( SceneState )); diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index 911ffd2542..00a812f16a 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -50,7 +50,6 @@ class SceneState : public Reference { FLAG_INSTANCE_IS_PLACEHOLDER=(1<<30), FLAG_MASK=(1<<24)-1, NO_PARENT_SAVED=0x7FFFFFFF, - TYPE_INSTANCED=0x7FFFFFFF, }; @@ -106,6 +105,10 @@ class SceneState : public Reference { static bool disable_placeholders; public: + enum { + TYPE_INSTANCED=0x7FFFFFFF + }; + static void set_disable_placeholders(bool p_disable); int find_node_by_path(const NodePath& p_node) const; @@ -195,6 +198,7 @@ public: Node *instance(bool p_gen_edit_state=false) const; void recreate_state(); + void replace_state(Ref<SceneState> p_by); virtual void set_path(const String& p_path,bool p_take_over=false); #ifdef TOOLS_ENABLED diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index ca85ca957a..5450b9e2ac 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -302,6 +302,10 @@ Error ResourceInteractiveLoaderText::poll() { if (error) { if (error!=ERR_FILE_EOF) { _printerr(); + } else { + if (!ResourceCache::has(res_path)) { + resource->set_path(res_path); + } } return error; } @@ -362,18 +366,15 @@ Error ResourceInteractiveLoaderText::poll() { parent=packed_scene->get_state()->add_node_path(next_tag.fields["parent"]); } - if (next_tag.fields.has("owner")) { - owner=packed_scene->get_state()->add_node_path(next_tag.fields["owner"]); - } else { - if (parent!=-1) - owner=0; //if no owner, owner is root - } if (next_tag.fields.has("type")) { type=packed_scene->get_state()->add_name(next_tag.fields["type"]); + } else { + type=SceneState::TYPE_INSTANCED; //no type? assume this was instanced } + if (next_tag.fields.has("instance")) { instance=packed_scene->get_state()->add_value(next_tag.fields["instance"]); @@ -384,6 +385,13 @@ Error ResourceInteractiveLoaderText::poll() { } } + if (next_tag.fields.has("owner")) { + owner=packed_scene->get_state()->add_node_path(next_tag.fields["owner"]); + } else { + if (parent!=-1 && !(type==SceneState::TYPE_INSTANCED && instance==-1)) + owner=0; //if no owner, owner is root + } + int node_id = packed_scene->get_state()->add_node(parent,owner,type,name,instance); @@ -399,6 +407,9 @@ Error ResourceInteractiveLoaderText::poll() { _printerr(); } else { resource=packed_scene; + if (!ResourceCache::has(res_path)) { + packed_scene->set_path(res_path); + } } return error; } diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index d79c1ff466..5e613c658b 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -499,8 +499,8 @@ void EditorData::remove_scene(int p_idx){ bool EditorData::_find_updated_instances(Node* p_root,Node *p_node,Set<String> &checked_paths) { - if (p_root!=p_node && p_node->get_owner()!=p_root && !p_root->is_editable_instance(p_node->get_owner())) - return false; +// if (p_root!=p_node && p_node->get_owner()!=p_root && !p_root->is_editable_instance(p_node->get_owner())) +// return false; Ref<SceneState> ss; diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index bcac82fc1b..5203ace125 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -455,6 +455,9 @@ bool EditorExportPlatformPC::_set(const StringName& p_name, const Variant& p_val } else if (n=="resources/pack_mode") { export_mode=ExportMode(int(p_value)); + } else if (n=="resources/bundle_dependencies_(for_optical_disc)") { + + bundle=p_value; } else if (n=="binary/64_bits") { use64=p_value; @@ -478,6 +481,9 @@ bool EditorExportPlatformPC::_get(const StringName& p_name,Variant &r_ret) const } else if (n=="resources/pack_mode") { r_ret=export_mode; + } else if (n=="resources/bundle_dependencies_(for_optical_disc)") { + + r_ret=bundle; } else if (n=="binary/64_bits") { r_ret=use64; @@ -492,7 +498,8 @@ void EditorExportPlatformPC::_get_property_list( List<PropertyInfo> *p_list) con p_list->push_back( PropertyInfo( Variant::STRING, "custom_binary/debug", PROPERTY_HINT_GLOBAL_FILE,binary_extension)); p_list->push_back( PropertyInfo( Variant::STRING, "custom_binary/release", PROPERTY_HINT_GLOBAL_FILE,binary_extension)); - p_list->push_back( PropertyInfo( Variant::INT, "resources/pack_mode", PROPERTY_HINT_ENUM,"Single Exec.,Exec+Pack (.pck),Copy,Bundles (Optical)")); + p_list->push_back( PropertyInfo( Variant::INT, "resources/pack_mode", PROPERTY_HINT_ENUM,"Pack into executable,Pack into binary file (.pck),Pack into archive file (.zip)")); + p_list->push_back( PropertyInfo( Variant::BOOL, "resources/bundle_dependencies_(for_optical_disc)")); p_list->push_back( PropertyInfo( Variant::BOOL, "binary/64_bits")); } @@ -1274,26 +1281,32 @@ Error EditorExportPlatformPC::export_project(const String& p_path, bool p_debug, } } + String dstfile = p_path.replace_first("res://","").replace("\\","/"); if (export_mode!=EXPORT_EXE) { - String dstfile=p_path.replace_first("res://","").replace("\\","/"); + String dstfile_extension=export_mode==EXPORT_ZIP?".zip":".pck"; if (dstfile.find("/")!=-1) - dstfile=dstfile.get_base_dir()+"/data.pck"; + dstfile=dstfile.get_base_dir()+"/data"+dstfile_extension; else - dstfile="data.pck"; + dstfile="data"+dstfile_extension; + if (export_mode==EXPORT_PACK) { + + memdelete(dst); - memdelete(dst); - dst=FileAccess::open(dstfile,FileAccess::WRITE); - if (!dst) { + dst=FileAccess::open(dstfile,FileAccess::WRITE); + if (!dst) { - EditorNode::add_io_error("Can't write data pack to:\n "+p_path); - return ERR_FILE_CANT_WRITE; + EditorNode::add_io_error("Can't write data pack to:\n "+p_path); + return ERR_FILE_CANT_WRITE; + } } } + + memdelete(src_exe); - Error err = save_pack(dst,export_mode==EXPORT_BUNDLES); + Error err = export_mode==EXPORT_ZIP?save_zip(dstfile,bundle):save_pack(dst,bundle); memdelete(dst); return err; } @@ -1836,6 +1849,15 @@ void EditorImportExport::load_config() { if (cf->has_section("convert_samples")) { + if (cf->has_section_key("convert_samples","action")) { + String action = cf->get_value("convert_samples","action"); + if (action=="none") { + sample_action=SAMPLE_ACTION_NONE; + } else if (action=="compress_ram") { + sample_action=SAMPLE_ACTION_COMPRESS_RAM; + } + } + if (cf->has_section_key("convert_samples","max_hz")) sample_action_max_hz=cf->get_value("convert_samples","max_hz"); diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h index 3dc78c88aa..1a0686fb50 100644 --- a/tools/editor/editor_import_export.h +++ b/tools/editor/editor_import_export.h @@ -175,8 +175,7 @@ public: enum ExportMode { EXPORT_EXE, EXPORT_PACK, - EXPORT_COPY, - EXPORT_BUNDLES + EXPORT_ZIP }; @@ -198,6 +197,7 @@ private: Ref<Texture> logo; ExportMode export_mode; + bool bundle; protected: bool _set(const StringName& p_name, const Variant& p_value); 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 2e67bb66fe..dc6e832829 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -143,6 +143,7 @@ void EditorNode::_update_scene_tabs() { } scene_tabs->set_current_tab(editor_data.get_edited_scene()); + scene_tabs->ensure_tab_visible(editor_data.get_edited_scene()); } @@ -1450,12 +1451,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 +1458,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 +1469,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 +1500,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? @@ -3174,7 +3169,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(""); @@ -3628,7 +3623,18 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo add_io_error(txt); } - sdata->set_path(lpath,true); //take over path + if (ResourceCache::has(lpath)) { + //used from somewhere else? no problem! update state and replace sdata + Ref<PackedScene> ps = Ref<PackedScene>( ResourceCache::get(lpath)->cast_to<PackedScene>() ); + if (ps.is_valid()) { + ps->replace_state( sdata->get_state() ); + ps->set_last_modified_time( sdata->get_last_modified_time() ); + sdata=ps; + } + + } else { + sdata->set_path(lpath,true); //take over path + } Node*new_scene=sdata->instance(true); @@ -4518,7 +4524,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"); @@ -4620,6 +4630,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); @@ -4640,8 +4652,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); } } @@ -4666,7 +4682,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: { @@ -4680,7 +4696,6 @@ void EditorNode::_layout_menu_option(int p_id) { _load_docks_from_config(config, editor_layouts->get_item_text(p_id)); _save_docks(); - } } @@ -5052,7 +5067,7 @@ EditorNode::EditorNode() { scene_tabs=memnew( Tabs ); scene_tabs->add_tab("unsaved"); scene_tabs->set_tab_align(Tabs::ALIGN_CENTER); - scene_tabs->set_tab_close_display_policy(Tabs::SHOW_ACTIVE_ONLY); + scene_tabs->set_tab_close_display_policy(Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY); scene_tabs->connect("tab_changed",this,"_scene_tab_changed"); scene_tabs->connect("right_button_pressed",this,"_scene_tab_script_edited"); scene_tabs->connect("tab_close", this, "_scene_tab_closed"); @@ -5465,8 +5480,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 ); @@ -5657,15 +5670,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(); @@ -5808,7 +5822,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); @@ -5961,7 +5975,8 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( Polygon2DEditorPlugin(this) ) ); add_editor_plugin( memnew( LightOccluder2DEditorPlugin(this) ) ); add_editor_plugin( memnew( NavigationPolygonEditorPlugin(this) ) ); - add_editor_plugin( memnew( ColorRampEditorPlugin(this) ) ); + add_editor_plugin( memnew( ColorRampEditorPlugin(this,true) ) ); + add_editor_plugin( memnew( ColorRampEditorPlugin(this,false) ) ); add_editor_plugin( memnew( CollisionShape2DEditorPlugin(this) ) ); for(int i=0;i<EditorPlugins::get_plugin_count();i++) diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index ca230a4d5e..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; diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 56ed95fb16..2eaf017d08 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -194,7 +194,7 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2& mouse_pos) { void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { - if (!is_visible()) + if (!is_visible() || window_has_modal_stack()) return; if (p_ev.key.mod.control) // prevent to change tool mode when control key is pressed diff --git a/tools/editor/plugins/color_ramp_editor_plugin.cpp b/tools/editor/plugins/color_ramp_editor_plugin.cpp index df50535402..42ff1b1de9 100644 --- a/tools/editor/plugins/color_ramp_editor_plugin.cpp +++ b/tools/editor/plugins/color_ramp_editor_plugin.cpp @@ -3,14 +3,20 @@ */ #include "color_ramp_editor_plugin.h" +#include "spatial_editor_plugin.h" +#include "canvas_item_editor_plugin.h" -ColorRampEditorPlugin::ColorRampEditorPlugin(EditorNode *p_node) { +ColorRampEditorPlugin::ColorRampEditorPlugin(EditorNode *p_node, bool p_2d) { editor=p_node; ramp_editor = memnew( ColorRampEdit ); - add_custom_control(CONTAINER_CANVAS_EDITOR_BOTTOM,ramp_editor); - //add_custom_control(CONTAINER_SPATIAL_EDITOR_BOTTOM,ramp_editor); + _2d=p_2d; + if (p_2d) + add_custom_control(CONTAINER_CANVAS_EDITOR_BOTTOM,ramp_editor); + else + add_custom_control(CONTAINER_SPATIAL_EDITOR_BOTTOM,ramp_editor); + ramp_editor->set_custom_minimum_size(Size2(100, 48)); ramp_editor->hide(); ramp_editor->connect("ramp_changed", this, "ramp_changed"); @@ -27,7 +33,10 @@ void ColorRampEditorPlugin::edit(Object *p_object) { bool ColorRampEditorPlugin::handles(Object *p_object) const { - return p_object->is_type("ColorRamp"); + if (_2d) + return p_object->is_type("ColorRamp") && CanvasItemEditor::get_singleton()->is_visible() == true; + else + return p_object->is_type("ColorRamp") && SpatialEditor::get_singleton()->is_visible() == true; } void ColorRampEditorPlugin::make_visible(bool p_visible) { diff --git a/tools/editor/plugins/color_ramp_editor_plugin.h b/tools/editor/plugins/color_ramp_editor_plugin.h index e39a5d65fe..f07dbabeb3 100644 --- a/tools/editor/plugins/color_ramp_editor_plugin.h +++ b/tools/editor/plugins/color_ramp_editor_plugin.h @@ -13,6 +13,7 @@ class ColorRampEditorPlugin : public EditorPlugin { OBJ_TYPE( ColorRampEditorPlugin, EditorPlugin ); + bool _2d; Ref<ColorRamp> color_ramp_ref; ColorRampEdit *ramp_editor; EditorNode *editor; @@ -29,7 +30,7 @@ public: virtual bool handles(Object *p_node) const; virtual void make_visible(bool p_visible); - ColorRampEditorPlugin(EditorNode *p_node); + ColorRampEditorPlugin(EditorNode *p_node, bool p_2d); ~ColorRampEditorPlugin(); }; diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index fc0d68b2f8..8adfe9d2cf 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -2331,7 +2331,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { script_list = memnew( ItemList ); script_split->add_child(script_list); - script_list->set_custom_minimum_size(Size2(70,0)); + script_list->set_custom_minimum_size(Size2(0,0)); script_split->set_split_offset(70); tab_container = memnew( TabContainer ); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 0fac1346fc..e47dcbf30f 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"])); @@ -3507,10 +3529,10 @@ void SpatialEditor::_instance_scene() { void SpatialEditor::_unhandled_key_input(InputEvent p_event) { - if (!is_visible()) + if (!is_visible() || window_has_modal_stack()) return; - { + { EditorNode *en = editor; EditorPlugin *over_plugin = en->get_editor_plugin_over(); diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index d034edc80d..7690d31e7b 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -258,6 +258,7 @@ void ProjectExportDialog::_sample_convert_edited(int what) { EditorImportExport::get_singleton()->sample_set_action( EditorImportExport::SampleAction(sample_mode->get_selected())); EditorImportExport::get_singleton()->sample_set_max_hz( sample_max_hz->get_val() ); EditorImportExport::get_singleton()->sample_set_trim( sample_trim->is_pressed() ); + _save_export_cfg(); } 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/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); |