diff options
480 files changed, 4669 insertions, 3204 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 8f1c1779bd..657f527a51 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -340,24 +340,6 @@ Array _OS::get_fullscreen_mode_list(int p_screen) const { return vmarr; } -void _OS::set_iterations_per_second(int p_ips) { - - OS::get_singleton()->set_iterations_per_second(p_ips); -} -int _OS::get_iterations_per_second() const { - - return OS::get_singleton()->get_iterations_per_second(); - -} - -void _OS::set_target_fps(int p_fps) { - OS::get_singleton()->set_target_fps(p_fps); -} - -float _OS::get_target_fps() const { - return OS::get_singleton()->get_target_fps(); -} - void _OS::set_low_processor_usage_mode(bool p_enabled) { OS::get_singleton()->set_low_processor_usage_mode(p_enabled); @@ -449,22 +431,10 @@ String _OS::get_latin_keyboard_variant() const { String _OS::get_model_name() const { - return OS::get_singleton()->get_model_name(); + return OS::get_singleton()->get_model_name(); } -MainLoop *_OS::get_main_loop() const { - return OS::get_singleton()->get_main_loop(); -} - -void _OS::set_time_scale(float p_scale) { - OS::get_singleton()->set_time_scale(p_scale); -} - -float _OS::get_time_scale() { - - return OS::get_singleton()->get_time_scale(); -} bool _OS::is_ok_left_and_cancel_right() const { @@ -804,10 +774,6 @@ bool _OS::can_draw() const { return OS::get_singleton()->can_draw(); } -int _OS::get_frames_drawn() { - - return OS::get_singleton()->get_frames_drawn(); -} int _OS::get_processor_count() const { @@ -936,11 +902,6 @@ String _OS::get_data_dir() const { return OS::get_singleton()->get_data_dir(); }; -float _OS::get_frames_per_second() const { - - return OS::get_singleton()->get_frames_per_second(); -} - Error _OS::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) { return OS::get_singleton()->native_video_play(p_path, p_volume, p_audio_track, p_subtitle_track); @@ -1005,10 +966,7 @@ String _OS::get_system_dir(SystemDir p_dir) const { return OS::get_singleton()->get_system_dir(OS::SystemDir(p_dir)); } -String _OS::get_custom_level() const { - return OS::get_singleton()->get_custom_level(); -} String _OS::get_scancode_string(uint32_t p_code) const { @@ -1028,11 +986,6 @@ void _OS::alert(const String& p_alert,const String& p_title) { OS::get_singleton()->alert(p_alert,p_title); } -Dictionary _OS::get_engine_version() const { - - return OS::get_singleton()->get_engine_version(); -} - _OS *_OS::singleton=NULL; void _OS::_bind_methods() { @@ -1043,11 +996,12 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("set_clipboard","clipboard"),&_OS::set_clipboard); ClassDB::bind_method(_MD("get_clipboard"),&_OS::get_clipboard); - ClassDB::bind_method(_MD("set_video_mode","size","fullscreen","resizable","screen"),&_OS::set_video_mode,DEFVAL(0)); - ClassDB::bind_method(_MD("get_video_mode_size","screen"),&_OS::get_video_mode,DEFVAL(0)); - ClassDB::bind_method(_MD("is_video_mode_fullscreen","screen"),&_OS::is_video_mode_fullscreen,DEFVAL(0)); - ClassDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0)); - ClassDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); + //will not delete for now, just unexpose + //ClassDB::bind_method(_MD("set_video_mode","size","fullscreen","resizable","screen"),&_OS::set_video_mode,DEFVAL(0)); + //ClassDB::bind_method(_MD("get_video_mode_size","screen"),&_OS::get_video_mode,DEFVAL(0)); + //ClassDB::bind_method(_MD("is_video_mode_fullscreen","screen"),&_OS::is_video_mode_fullscreen,DEFVAL(0)); + //ClassDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0)); + //ClassDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); ClassDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count); @@ -1079,13 +1033,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("set_keep_screen_on","enabled"),&_OS::set_keep_screen_on); ClassDB::bind_method(_MD("is_keep_screen_on"),&_OS::is_keep_screen_on); - ClassDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_OS::set_iterations_per_second); - ClassDB::bind_method(_MD("get_iterations_per_second"),&_OS::get_iterations_per_second); - ClassDB::bind_method(_MD("set_target_fps","target_fps"),&_OS::set_target_fps); - ClassDB::bind_method(_MD("get_target_fps"),&_OS::get_target_fps); - - ClassDB::bind_method(_MD("set_time_scale","time_scale"),&_OS::set_time_scale); - ClassDB::bind_method(_MD("get_time_scale"),&_OS::get_time_scale); ClassDB::bind_method(_MD("has_touchscreen_ui_hint"),&_OS::has_touchscreen_ui_hint); @@ -1107,7 +1054,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("get_name"),&_OS::get_name); ClassDB::bind_method(_MD("get_cmdline_args"),&_OS::get_cmdline_args); - ClassDB::bind_method(_MD("get_main_loop"),&_OS::get_main_loop); ClassDB::bind_method(_MD("get_datetime","utc"),&_OS::get_datetime,DEFVAL(false)); ClassDB::bind_method(_MD("get_date","utc"),&_OS::get_date,DEFVAL(false)); @@ -1133,10 +1079,8 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("get_latin_keyboard_variant"),&_OS::get_latin_keyboard_variant); ClassDB::bind_method(_MD("get_model_name"),&_OS::get_model_name); - ClassDB::bind_method(_MD("get_custom_level"),&_OS::get_custom_level); ClassDB::bind_method(_MD("can_draw"),&_OS::can_draw); - ClassDB::bind_method(_MD("get_frames_drawn"),&_OS::get_frames_drawn); ClassDB::bind_method(_MD("is_stdout_verbose"),&_OS::is_stdout_verbose); ClassDB::bind_method(_MD("can_use_threads"),&_OS::can_use_threads); @@ -1163,7 +1107,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("is_ok_left_and_cancel_right"),&_OS::is_ok_left_and_cancel_right); - ClassDB::bind_method(_MD("get_frames_per_second"),&_OS::get_frames_per_second); ClassDB::bind_method(_MD("print_all_textures_by_size"),&_OS::print_all_textures_by_size); ClassDB::bind_method(_MD("print_resources_by_type","types"),&_OS::print_resources_by_type); @@ -1187,8 +1130,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("set_use_vsync","enable"),&_OS::set_use_vsync); ClassDB::bind_method(_MD("is_vsync_enabled"),&_OS::is_vsync_enabled); - ClassDB::bind_method(_MD("get_engine_version"),&_OS::get_engine_version); - BIND_CONSTANT( DAY_SUNDAY ); BIND_CONSTANT( DAY_MONDAY ); BIND_CONSTANT( DAY_TUESDAY ); @@ -1890,9 +1831,9 @@ Error _Directory::open(const String& p_path) { return OK; } -bool _Directory::list_dir_begin() { +Error _Directory::list_dir_begin() { - ERR_FAIL_COND_V(!d,false); + ERR_FAIL_COND_V(!d,ERR_UNCONFIGURED); return d->list_dir_begin(); } @@ -1923,6 +1864,10 @@ String _Directory::get_drive(int p_drive){ ERR_FAIL_COND_V(!d,""); return d->get_drive(p_drive); } +int _Directory::get_current_drive() { + ERR_FAIL_COND_V(!d,0); + return d->get_current_drive(); +} Error _Directory::change_dir(String p_dir){ @@ -2031,13 +1976,14 @@ void _Directory::_bind_methods() { ClassDB::bind_method(_MD("list_dir_end"),&_Directory::list_dir_end); ClassDB::bind_method(_MD("get_drive_count"),&_Directory::get_drive_count); ClassDB::bind_method(_MD("get_drive","idx"),&_Directory::get_drive); + ClassDB::bind_method(_MD("get_current_drive"),&_Directory::get_current_drive); ClassDB::bind_method(_MD("change_dir:Error","todir"),&_Directory::change_dir); ClassDB::bind_method(_MD("get_current_dir"),&_Directory::get_current_dir); ClassDB::bind_method(_MD("make_dir:Error","path"),&_Directory::make_dir); ClassDB::bind_method(_MD("make_dir_recursive:Error","path"),&_Directory::make_dir_recursive); ClassDB::bind_method(_MD("file_exists","path"),&_Directory::file_exists); ClassDB::bind_method(_MD("dir_exists","path"),&_Directory::dir_exists); -// ClassDB::bind_method(_MD("get_modified_time","file"),&_Directory::get_modified_time); + //ClassDB::bind_method(_MD("get_modified_time","file"),&_Directory::get_modified_time); ClassDB::bind_method(_MD("get_space_left"),&_Directory::get_space_left); ClassDB::bind_method(_MD("copy:Error","from","to"),&_Directory::copy); ClassDB::bind_method(_MD("rename:Error","from","to"),&_Directory::rename); @@ -2567,22 +2513,22 @@ void _ClassDB::_bind_methods() { ClassDB::bind_method(_MD("can_instance","class"),&_ClassDB::can_instance); ClassDB::bind_method(_MD("instance","class"),&_ClassDB::instance); - ClassDB::bind_method(_MD("has_signal","class","signal"),&_ClassDB::has_signal); - ClassDB::bind_method(_MD("get_signal","class","signal"),&_ClassDB::get_signal); - ClassDB::bind_method(_MD("get_signal_list","class","no_inheritance"),&_ClassDB::get_signal_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_has_signal","class","signal"),&_ClassDB::has_signal); + ClassDB::bind_method(_MD("class_get_signal","class","signal"),&_ClassDB::get_signal); + ClassDB::bind_method(_MD("class_get_signal_list","class","no_inheritance"),&_ClassDB::get_signal_list,DEFVAL(false)); - ClassDB::bind_method(_MD("get_property_list","class","no_inheritance"),&_ClassDB::get_property_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_property_list","class","no_inheritance"),&_ClassDB::get_property_list,DEFVAL(false)); - ClassDB::bind_method(_MD("has_method","class","method","no_inheritance"),&_ClassDB::has_method,DEFVAL(false)); + ClassDB::bind_method(_MD("class_has_method","class","method","no_inheritance"),&_ClassDB::has_method,DEFVAL(false)); - ClassDB::bind_method(_MD("get_method_list","class","no_inheritance"),&_ClassDB::get_method_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_method_list","class","no_inheritance"),&_ClassDB::get_method_list,DEFVAL(false)); - ClassDB::bind_method(_MD("get_integer_constant_list","class","no_inheritance"),&_ClassDB::get_integer_constant_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_integer_constant_list","class","no_inheritance"),&_ClassDB::get_integer_constant_list,DEFVAL(false)); - ClassDB::bind_method(_MD("has_integer_constant","class","name"),&_ClassDB::has_integer_constant); - ClassDB::bind_method(_MD("get_integer_constant","class","name"),&_ClassDB::get_integer_constant); + ClassDB::bind_method(_MD("class_has_integer_constant","class","name"),&_ClassDB::has_integer_constant); + ClassDB::bind_method(_MD("class_get_integer_constant","class","name"),&_ClassDB::get_integer_constant); - ClassDB::bind_method(_MD("get_category","class"),&_ClassDB::get_category); + ClassDB::bind_method(_MD("class_get_category","class"),&_ClassDB::get_category); ClassDB::bind_method(_MD("is_class_enabled","class"),&_ClassDB::is_class_enabled); @@ -2596,3 +2542,88 @@ _ClassDB::~_ClassDB(){ } +/////////////////////////////// + + +void _Engine::set_iterations_per_second(int p_ips) { + + Engine::get_singleton()->set_iterations_per_second(p_ips); +} +int _Engine::get_iterations_per_second() const { + + return Engine::get_singleton()->get_iterations_per_second(); + +} + +void _Engine::set_target_fps(int p_fps) { + Engine::get_singleton()->set_target_fps(p_fps); +} + +float _Engine::get_target_fps() const { + return Engine::get_singleton()->get_target_fps(); +} + + + +float _Engine::get_frames_per_second() const { + + return Engine::get_singleton()->get_frames_per_second(); +} + +String _Engine::get_custom_level() const { + + return Engine::get_singleton()->get_custom_level(); +} + +void _Engine::set_time_scale(float p_scale) { + Engine::get_singleton()->set_time_scale(p_scale); +} + +float _Engine::get_time_scale() { + + return Engine::get_singleton()->get_time_scale(); +} + +int _Engine::get_frames_drawn() { + + return Engine::get_singleton()->get_frames_drawn(); +} + +MainLoop *_Engine::get_main_loop() const { + + //needs to remain in OS, since it's actually OS that interacts with it, but it's better exposed here + return OS::get_singleton()->get_main_loop(); +} + +Dictionary _Engine::get_version_info() const { + + return Engine::get_singleton()->get_version_info(); +} + + +void _Engine::_bind_methods() { + + ClassDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_Engine::set_iterations_per_second); + ClassDB::bind_method(_MD("get_iterations_per_second"),&_Engine::get_iterations_per_second); + ClassDB::bind_method(_MD("set_target_fps","target_fps"),&_Engine::set_target_fps); + ClassDB::bind_method(_MD("get_target_fps"),&_Engine::get_target_fps); + + ClassDB::bind_method(_MD("set_time_scale","time_scale"),&_Engine::set_time_scale); + ClassDB::bind_method(_MD("get_time_scale"),&_Engine::get_time_scale); + + ClassDB::bind_method(_MD("get_custom_level"),&_Engine::get_custom_level); + + ClassDB::bind_method(_MD("get_frames_drawn"),&_Engine::get_frames_drawn); + ClassDB::bind_method(_MD("get_frames_per_second"),&_Engine::get_frames_per_second); + + ClassDB::bind_method(_MD("get_main_loop:MainLoop"),&_Engine::get_main_loop); + + ClassDB::bind_method(_MD("get_version_info"),&_Engine::get_version_info); + +} + +_Engine *_Engine::singleton = NULL; + +_Engine::_Engine() { + singleton=this; +} diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index d491483d82..f10714720f 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -169,12 +169,6 @@ public: void native_video_unpause(); void native_video_stop(); - void set_iterations_per_second(int p_ips); - int get_iterations_per_second() const; - - void set_target_fps(int p_fps); - float get_target_fps() const; - void set_low_processor_usage_mode(bool p_enabled); bool is_in_low_processor_usage_mode() const; @@ -196,11 +190,7 @@ public: String get_latin_keyboard_variant() const; String get_model_name() const; - MainLoop *get_main_loop() const; - String get_custom_level() const; - - float get_frames_per_second() const; void dump_memory_to_file(const String& p_file); void dump_resources_to_file(const String& p_file); @@ -271,8 +261,6 @@ public: bool can_draw() const; - int get_frames_drawn(); - bool is_stdout_verbose() const; int get_processor_count() const; @@ -313,8 +301,6 @@ public: void set_keep_screen_on(bool p_enabled); bool is_keep_screen_on() const; - void set_time_scale(float p_scale); - float get_time_scale(); bool is_ok_left_and_cancel_right() const; @@ -323,8 +309,6 @@ public: void set_use_vsync(bool p_enable); bool is_vsync_enabled() const; - Dictionary get_engine_version() const; - static _OS *get_singleton() { return singleton; } _OS(); @@ -472,7 +456,7 @@ public: Error open(const String& p_path); - bool list_dir_begin(); ///< This starts dir listing + Error list_dir_begin(); ///< This starts dir listing String get_next(); bool current_is_dir() const; @@ -480,6 +464,7 @@ public: int get_drive_count(); String get_drive(int p_drive); + int get_current_drive(); Error change_dir(String p_dir); ///< can be relative or absolute, return false on success String get_current_dir(); ///< return current dir location @@ -632,4 +617,39 @@ public: ~_ClassDB(); }; + +class _Engine : public Object { + GDCLASS(_Engine,Object); + +protected: + + static void _bind_methods(); + static _Engine *singleton; + +public: + + static _Engine* get_singleton() { return singleton; } + void set_iterations_per_second(int p_ips); + int get_iterations_per_second() const; + + void set_target_fps(int p_fps); + float get_target_fps() const; + + float get_frames_per_second() const; + + int get_frames_drawn(); + + void set_time_scale(float p_scale); + float get_time_scale(); + + String get_custom_level() const; + + MainLoop *get_main_loop() const; + + Dictionary get_version_info() const; + + _Engine(); +}; + + #endif // CORE_BIND_H diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 71f810422a..1e3a51fede 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -467,7 +467,7 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { //print_line("Hash: "+itos(p)); if (p==0xFFFFFFFF) { -// print_line("GETMSG: Nothing!"); + //print_line("GETMSG: Nothing!"); return StringName(); //nothing } @@ -489,7 +489,7 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { //print_line("bucket pos: "+itos(idx)); if (idx==-1) { -// print_line("GETMSG: Not in Bucket!"); + //print_line("GETMSG: Not in Bucket!"); return StringName(); } @@ -497,8 +497,8 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { String rstr; rstr.parse_utf8(&sptr[ bucket.elem[idx].str_offset ], bucket.elem[idx].uncomp_size ); -// print_line("Uncompressed, size: "+itos(bucket.elem[idx].comp_size)); -// print_line("Return: "+rstr); + //print_line("Uncompressed, size: "+itos(bucket.elem[idx].comp_size)); + //print_line("Return: "+rstr); return rstr; } else { @@ -508,8 +508,8 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { smaz_decompress(&sptr[ bucket.elem[idx].str_offset ], bucket.elem[idx].comp_size,uncomp.ptr(),bucket.elem[idx].uncomp_size ); String rstr; rstr.parse_utf8(uncomp.get_data()); -// print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size)); -// print_line("Return: "+rstr); + //print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size)); + //print_line("Return: "+rstr); return rstr; } diff --git a/core/engine.cpp b/core/engine.cpp new file mode 100644 index 0000000000..eb6d8a3478 --- /dev/null +++ b/core/engine.cpp @@ -0,0 +1,118 @@ +/*************************************************************************/ +/* engine.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "engine.h" +#include "version.h" + +void Engine::set_iterations_per_second(int p_ips) { + + ips=p_ips; +} +int Engine::get_iterations_per_second() const { + + return ips; +} + +void Engine::set_target_fps(int p_fps) { + _target_fps=p_fps>0? p_fps : 0; +} + +float Engine::get_target_fps() const { + return _target_fps; +} + +uint64_t Engine::get_frames_drawn() { + + return frames_drawn; +} + +void Engine::set_frame_delay(uint32_t p_msec) { + + _frame_delay=p_msec; +} + +uint32_t Engine::get_frame_delay() const { + + return _frame_delay; +} + +void Engine::set_time_scale(float p_scale) { + + _time_scale=p_scale; +} + +float Engine::get_time_scale() const { + + return _time_scale; +} + +Dictionary Engine::get_version_info() const { + + Dictionary dict; + dict["major"] = VERSION_MAJOR; + dict["minor"] = VERSION_MINOR; + #ifdef VERSION_PATCH + dict["patch"] = VERSION_PATCH; + #else + dict["patch"] = 0; + #endif + dict["status"] = _MKSTR(VERSION_STATUS); + dict["revision"] = _MKSTR(VERSION_REVISION); + dict["year"] = VERSION_YEAR; + + String stringver = String(dict["major"]) + "." + String(dict["minor"]); + if ((int)dict["patch"] != 0) + stringver += "." + String(dict["patch"]); + stringver += "-" + String(dict["status"]) + " (" + String(dict["revision"]) + ")"; + dict["string"] = stringver; + + return dict; +} + + +Engine *Engine::singleton=NULL; + +Engine *Engine::get_singleton() { + return singleton; +} + +Engine::Engine() +{ + + singleton=this; + frames_drawn=0; + ips=60; + _frame_delay=0; + _fps=1; + _target_fps=0; + _time_scale=1.0; + _pixel_snap=false; + _fixed_frames=0; + _idle_frames=0; + _in_fixed=false; +} diff --git a/core/engine.h b/core/engine.h new file mode 100644 index 0000000000..9af4219a68 --- /dev/null +++ b/core/engine.h @@ -0,0 +1,88 @@ +/*************************************************************************/ +/* engine.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef ENGINE_H +#define ENGINE_H + +#include "ustring.h" +#include "list.h" +#include "vector.h" +#include "os/main_loop.h" + +class Engine { + +friend class Main; + + String _custom_level; + uint64_t frames_drawn; + uint32_t _frame_delay; + + int ips; + float _fps; + int _target_fps; + float _time_scale; + bool _pixel_snap; + uint64_t _fixed_frames; + uint64_t _idle_frames; + bool _in_fixed; + + static Engine *singleton; +public: + + static Engine *get_singleton(); + + virtual void set_iterations_per_second(int p_ips); + virtual int get_iterations_per_second() const; + + virtual void set_target_fps(int p_fps); + virtual float get_target_fps() const; + + virtual float get_frames_per_second() const { return _fps; } + + String get_custom_level() const { return _custom_level; } + + uint64_t get_frames_drawn(); + + uint64_t get_fixed_frames() const { return _fixed_frames; } + uint64_t get_idle_frames() const { return _idle_frames; } + bool is_in_fixed_frame() const { return _in_fixed; } + + void set_time_scale(float p_scale); + float get_time_scale() const; + + void set_frame_delay(uint32_t p_msec); + uint32_t get_frame_delay() const; + + _FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; } + + Dictionary get_version_info() const; + + Engine(); +}; + +#endif // ENGINE_H diff --git a/core/globals.cpp b/core/globals.cpp index 28fabac302..a4c24a6cc8 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -329,7 +329,7 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { String candidate = d->get_current_dir(); String current_dir = d->get_current_dir(); - String exec_name = OS::get_singleton()->get_executable_path().get_file().basename(); + String exec_name = OS::get_singleton()->get_executable_path().get_file().get_basename(); bool found = false; bool first_time=true; @@ -1011,7 +1011,7 @@ GlobalConfig::GlobalConfig() { GLOBAL_DEF("input/ui_page_down",va); input_presets.push_back("input/ui_page_down"); -// GLOBAL_DEF("display/handheld/orientation", "landscape"); + //GLOBAL_DEF("display/handheld/orientation", "landscape"); custom_prop_info["display/handheld/orientation"]=PropertyInfo(Variant::STRING,"display/handheld/orientation",PROPERTY_HINT_ENUM,"landscape,portrait,reverse_landscape,reverse_portrait,sensor_landscape,sensor_portrait,sensor"); diff --git a/core/hash_map.h b/core/hash_map.h index fba12b55ec..0d55206935 100644 --- a/core/hash_map.h +++ b/core/hash_map.h @@ -61,7 +61,7 @@ public: static _FORCE_INLINE_ uint32_t hash(const uint8_t p_int) { return p_int; } static _FORCE_INLINE_ uint32_t hash(const int8_t p_int) { return (uint32_t)p_int; } static _FORCE_INLINE_ uint32_t hash(const wchar_t p_wchar) { return (uint32_t)p_wchar; } -// static _FORCE_INLINE_ uint32_t hash(const void* p_ptr) { return uint32_t(uint64_t(p_ptr))*(0x9e3779b1L); } + //static _FORCE_INLINE_ uint32_t hash(const void* p_ptr) { return uint32_t(uint64_t(p_ptr))*(0x9e3779b1L); } }; /** diff --git a/core/image.cpp b/core/image.cpp index 174c840c23..d769e6a0b3 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -363,7 +363,7 @@ void Image::convert( Format p_new_format ){ Image new_img(width,height,0,p_new_format); -// int len=data.size(); + //int len=data.size(); PoolVector<uint8_t>::Read r = data.read(); PoolVector<uint8_t>::Write w = new_img.data.write(); @@ -414,7 +414,7 @@ void Image::convert( Format p_new_format ){ bool gen_mipmaps=mipmaps; -// mipmaps=false; + //mipmaps=false; *this=new_img; @@ -1240,7 +1240,7 @@ void Image::create( const char ** p_xpm ) { uint8_t col_r; uint8_t col_g; uint8_t col_b; -// uint8_t col_a=255; + //uint8_t col_a=255; for (int i=0;i<6;i++) { diff --git a/core/input_map.cpp b/core/input_map.cpp index 0379131dd3..bcae630c76 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -324,7 +324,7 @@ void InputMap::load_default() { key.key.scancode=KEY_PAGEDOWN; action_add_event("ui_page_down",key); -// set("display/handheld/orientation", "landscape"); + //set("display/handheld/orientation", "landscape"); } diff --git a/core/io/file_access_buffered_fa.h b/core/io/file_access_buffered_fa.h index 884d40a266..000c2b45f3 100644 --- a/core/io/file_access_buffered_fa.h +++ b/core/io/file_access_buffered_fa.h @@ -127,10 +127,11 @@ public: set_error(OK); }; -// static void make_default() { - - //FileAccess::create_func = FileAccessBufferedFA<T>::create; -// }; + /* + static void make_default() { + FileAccess::create_func = FileAccessBufferedFA<T>::create; + }; + */ virtual uint64_t _get_modified_time(const String& p_file) { diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index a9dbf56c15..32eb003228 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -68,7 +68,7 @@ FileAccess* FileAccessMemory::create() { bool FileAccessMemory::file_exists(const String& p_name) { String name = fix_path(p_name); -// name = DirAccess::normalize_path(name); + //name = DirAccess::normalize_path(name); return files && (files->find(name) != NULL); } @@ -87,7 +87,7 @@ Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) { ERR_FAIL_COND_V(!files, ERR_FILE_NOT_FOUND); String name = fix_path(p_path); -// name = DirAccess::normalize_path(name); + //name = DirAccess::normalize_path(name); Map<String, Vector<uint8_t> >::Element* E = files->find(name); ERR_FAIL_COND_V(!E, ERR_FILE_NOT_FOUND); diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 19076b57be..7bf750f6e1 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -206,7 +206,7 @@ Error FileAccessNetworkClient::connect(const String& p_host,int p_port,const Str } DEBUG_PRINT("IP: "+String(ip)+" port "+itos(p_port)); - Error err = client->connect(ip,p_port); + Error err = client->connect_to_host(ip,p_port); ERR_FAIL_COND_V(err,err); while(client->get_status()==StreamPeerTCP::STATUS_CONNECTING) { //DEBUG_PRINT("trying to connect...."); @@ -325,7 +325,7 @@ Error FileAccessNetwork::_open(const String& p_path, int p_mode_flags) { last_page=-1; last_page_buff=NULL; -// buffers.clear(); + //buffers.clear(); nc->unlock_mutex(); DEBUG_PRINT("OPEN POST"); DEBUG_TIME("open_post"); @@ -437,7 +437,7 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const{ p_length=total_size-pos; } -// FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton; + //FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton; uint8_t *buff=last_page_buff; diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 7e3a6d1fa0..d63539a7a5 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -340,7 +340,7 @@ FileAccessPack::~FileAccessPack() { ////////////////////////////////////////////////////////////////////////////////// -bool DirAccessPack::list_dir_begin() { +Error DirAccessPack::list_dir_begin() { list_dirs.clear(); @@ -356,7 +356,7 @@ bool DirAccessPack::list_dir_begin() { list_files.push_back(E->get()); } - return true; + return OK; } String DirAccessPack::get_next(){ diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index 83340a662b..0a1320e57b 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -209,7 +209,7 @@ class DirAccessPack : public DirAccess { public: - virtual bool list_dir_begin(); + virtual Error list_dir_begin(); virtual String get_next(); virtual bool current_is_dir() const; virtual bool current_is_hidden() const; diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index c4439f2599..87f07cb7b1 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -165,7 +165,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const { bool ZipArchive::try_open_pack(const String& p_name) { //printf("opening zip pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz")); - if (p_name.extension().nocasecmp_to("zip") != 0 && p_name.extension().nocasecmp_to("pcz") != 0) + if (p_name.get_extension().nocasecmp_to("zip") != 0 && p_name.get_extension().nocasecmp_to("pcz") != 0) return false; zlib_filefunc_def io; diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 5e57f55f87..63c8abbbad 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -33,7 +33,7 @@ void HTTPClient::set_ip_type(IP::Type p_type) { ip_type = p_type; } -Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){ +Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){ close(); tcp_connection->set_ip_type(ip_type); @@ -57,7 +57,7 @@ Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_ve if (conn_host.is_valid_ip_address()) { //is ip - Error err = tcp_connection->connect(IP_Address(conn_host),p_port); + Error err = tcp_connection->connect_to_host(IP_Address(conn_host),p_port); if (err) { status=STATUS_CANT_CONNECT; return err; @@ -232,7 +232,7 @@ Error HTTPClient::get_response_headers(List<String> *r_response) { void HTTPClient::close(){ if (tcp_connection->get_status()!=StreamPeerTCP::STATUS_NONE) - tcp_connection->disconnect(); + tcp_connection->disconnect_from_host(); connection.unref(); status=STATUS_DISCONNECTED; @@ -267,7 +267,7 @@ Error HTTPClient::poll(){ case IP::RESOLVER_STATUS_DONE: { IP_Address host = IP::get_singleton()->get_resolve_item_address(resolving); - Error err = tcp_connection->connect(host,conn_port); + Error err = tcp_connection->connect_to_host(host,conn_port); IP::get_singleton()->erase_resolve_item(resolving); resolving=IP::RESOLVER_INVALID_ID; if (err) { @@ -300,7 +300,7 @@ Error HTTPClient::poll(){ case StreamPeerTCP::STATUS_CONNECTED: { if (ssl) { Ref<StreamPeerSSL> ssl = StreamPeerSSL::create(); - Error err = ssl->connect(tcp_connection,true,ssl_verify_host?conn_host:String()); + Error err = ssl->connect_to_stream(tcp_connection,true,ssl_verify_host?conn_host:String()); if (err!=OK) { close(); status=STATUS_SSL_HANDSHAKE_ERROR; @@ -640,7 +640,7 @@ Error HTTPClient::_get_http_data(uint8_t* p_buffer, int p_bytes,int &r_received) void HTTPClient::_bind_methods() { ClassDB::bind_method(_MD("set_ip_type","ip_type"),&HTTPClient::set_ip_type); - ClassDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true)); + ClassDB::bind_method(_MD("connect_to_host:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect_to_host,DEFVAL(false),DEFVAL(true)); ClassDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection); ClassDB::bind_method(_MD("get_connection:StreamPeer"),&HTTPClient::get_connection); ClassDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw); diff --git a/core/io/http_client.h b/core/io/http_client.h index c6f96db1d6..496d22530b 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -167,7 +167,7 @@ public: void set_ip_type(IP::Type p_type); //Error connect_and_get(const String& p_url,bool p_verify_host=true); //connects to a full url and perform request - Error connect(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true); + Error connect_to_host(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true); void set_connection(const Ref<StreamPeer>& p_connection); Ref<StreamPeer> get_connection() const; diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp index d4d10e2126..2b01e865f4 100644 --- a/core/io/image_loader.cpp +++ b/core/io/image_loader.cpp @@ -36,7 +36,7 @@ bool ImageFormatLoader::recognize(const String& p_extension) const { get_recognized_extensions(&extensions); for (List<String>::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(p_extension.extension())==0) + if (E->get().nocasecmp_to(p_extension.get_extension())==0) return true; } @@ -56,7 +56,7 @@ Error ImageLoader::load_image(String p_file,Image *p_image, FileAccess *p_custom } } - String extension = p_file.extension(); + String extension = p_file.get_extension(); for (int i=0;i<loader_count;i++) { diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index 91d1fc5f98..9fec807bfb 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -36,7 +36,7 @@ String PacketPeerUDP::_get_packet_ip() const { return get_packet_address(); } -Error PacketPeerUDP::_set_send_address(const String& p_address, int p_port) { +Error PacketPeerUDP::_set_dest_address(const String& p_address, int p_port) { IP_Address ip; if (p_address.is_valid_ip_address()) { @@ -47,7 +47,7 @@ Error PacketPeerUDP::_set_send_address(const String& p_address, int p_port) { return ERR_CANT_RESOLVE; } - set_send_address(ip,p_port); + set_dest_address(ip,p_port); return OK; } @@ -66,7 +66,7 @@ void PacketPeerUDP::_bind_methods() { ClassDB::bind_method(_MD("get_packet_ip"),&PacketPeerUDP::_get_packet_ip); //ClassDB::bind_method(_MD("get_packet_address"),&PacketPeerUDP::_get_packet_address); ClassDB::bind_method(_MD("get_packet_port"),&PacketPeerUDP::get_packet_port); - ClassDB::bind_method(_MD("set_send_address","host","port"),&PacketPeerUDP::_set_send_address); + ClassDB::bind_method(_MD("set_dest_address","host","port"),&PacketPeerUDP::_set_dest_address); } diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h index 17a2817f34..17952b4ac1 100644 --- a/core/io/packet_peer_udp.h +++ b/core/io/packet_peer_udp.h @@ -45,7 +45,7 @@ protected: String _get_packet_ip() const; - virtual Error _set_send_address(const String& p_address,int p_port); + virtual Error _set_dest_address(const String& p_address,int p_port); public: @@ -56,7 +56,7 @@ public: virtual bool is_listening() const=0; virtual IP_Address get_packet_address() const=0; virtual int get_packet_port() const=0; - virtual void set_send_address(const IP_Address& p_address,int p_port)=0; + virtual void set_dest_address(const IP_Address& p_address,int p_port)=0; static Ref<PacketPeerUDP> create_ref(); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index c093b087b8..4af3503434 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1059,7 +1059,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderBinary::load_interactive(cons Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->open(f); @@ -1114,7 +1114,7 @@ Error ResourceFormatLoaderBinary::load_import_metadata(const String &p_path, Ref Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->recognize(f); if(ria->error!=OK) return ERR_FILE_UNRECOGNIZED; @@ -1159,14 +1159,14 @@ void ResourceFormatLoaderBinary::get_dependencies(const String& p_path,List<Stri Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->get_dependencies(f,p_dependencies,p_add_types); } Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path,const Map<String,String>& p_map) { -// Error error=OK; + //Error error=OK; FileAccess *f=FileAccess::open(p_path,FileAccess::READ); @@ -1250,7 +1250,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path,const ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; ria->remaps=p_map; - // ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->open(f); err = ria->poll(); @@ -1384,7 +1384,7 @@ String ResourceFormatLoaderBinary::get_resource_type(const String &p_path) const Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); String r = ria->recognize(f); return r; @@ -1708,8 +1708,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, for(List<Variant>::Element *E=keys.front();E;E=E->next()) { - //if (!_check_type(dict[E->get()])) - // continue; + /* + if (!_check_type(dict[E->get()])) + continue; + */ write_variant(E->get()); write_variant(d[E->get()]); @@ -2150,7 +2152,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_ } Vector<uint64_t> ofs_table; -// int saved_idx=0; + //int saved_idx=0; //now actually save the resources for(List<ResourceData>::Element *E=resources.front();E;E=E->next()) { diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index cc3c8ce006..354efaa83f 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -55,7 +55,7 @@ bool ResourceFormatLoader::recognize(const String& p_extension) const { get_recognized_extensions(&extensions); for (List<String>::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(p_extension.extension())==0) + if (E->get().nocasecmp_to(p_extension.get_extension())==0) return true; } @@ -182,7 +182,7 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p if (OS::get_singleton()->is_stdout_verbose()) print_line("load resource: "+remapped_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); bool found=false; for (int i=0;i<loader_count;i++) { @@ -230,7 +230,7 @@ Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p else local_path = GlobalConfig::get_singleton()->localize_path(p_path); - String extension=p_path.extension(); + String extension=p_path.get_extension(); Ref<ResourceImportMetadata> ret; for (int i=0;i<loader_count;i++) { @@ -331,7 +331,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_ String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); bool found=false; for (int i=0;i<loader_count;i++) { @@ -385,14 +385,16 @@ void ResourceLoader::get_dependencies(const String& p_path, List<String> *p_depe String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;i<loader_count;i++) { if (!loader[i]->recognize(extension)) continue; - //if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) - // continue; + /* + if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) + continue; + */ loader[i]->get_dependencies(remapped_path,p_dependencies,p_add_types); @@ -410,14 +412,16 @@ Error ResourceLoader::rename_dependencies(const String &p_path,const Map<String, String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;i<loader_count;i++) { if (!loader[i]->recognize(extension)) continue; - //if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) - // continue; + /* + if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) + continue; + */ return loader[i]->rename_dependencies(p_path,p_map); @@ -449,7 +453,7 @@ String ResourceLoader::get_resource_type(const String &p_path) { local_path = GlobalConfig::get_singleton()->localize_path(p_path); String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;i<loader_count;i++) { diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index 9081adaa8f..222d3e6bc0 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -40,7 +40,7 @@ ResourceSavedCallback ResourceSaver::save_callback=0; Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_flags) { - String extension=p_path.extension(); + String extension=p_path.get_extension(); Error err=ERR_FILE_UNRECOGNIZED; for (int i=0;i<saver_count;i++) { @@ -54,7 +54,7 @@ Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_ for (List<String>::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(extension.extension())==0) + if (E->get().nocasecmp_to(extension.get_extension())==0) recognized=true; } diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp index aab42a2989..fc535e94b0 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_ssl.cpp @@ -57,10 +57,10 @@ bool StreamPeerSSL::is_available() { void StreamPeerSSL::_bind_methods() { - ClassDB::bind_method(_MD("accept:Error","stream:StreamPeer"),&StreamPeerSSL::accept); - ClassDB::bind_method(_MD("connect:Error","stream:StreamPeer","validate_certs","for_hostname"),&StreamPeerSSL::connect,DEFVAL(false),DEFVAL(String())); + ClassDB::bind_method(_MD("accept_stream:Error","stream:StreamPeer"),&StreamPeerSSL::accept_stream); + ClassDB::bind_method(_MD("connect_to_stream:Error","stream:StreamPeer","validate_certs","for_hostname"),&StreamPeerSSL::connect_to_stream,DEFVAL(false),DEFVAL(String())); ClassDB::bind_method(_MD("get_status"),&StreamPeerSSL::get_status); - ClassDB::bind_method(_MD("disconnect"),&StreamPeerSSL::disconnect); + ClassDB::bind_method(_MD("disconnect_from_stream"),&StreamPeerSSL::disconnect_from_stream); BIND_CONSTANT( STATUS_DISCONNECTED ); BIND_CONSTANT( STATUS_CONNECTED ); BIND_CONSTANT( STATUS_ERROR_NO_CERTIFICATE ); diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h index 8675433a30..9aafac874d 100644 --- a/core/io/stream_peer_ssl.h +++ b/core/io/stream_peer_ssl.h @@ -57,11 +57,11 @@ public: STATUS_ERROR_HOSTNAME_MISMATCH }; - virtual Error accept(Ref<StreamPeer> p_base)=0; - virtual Error connect(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String())=0; + virtual Error accept_stream(Ref<StreamPeer> p_base)=0; + virtual Error connect_to_stream(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String())=0; virtual Status get_status() const=0; - virtual void disconnect()=0; + virtual void disconnect_from_stream()=0; static StreamPeerSSL* create(); diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 2218057cf7..0a59c32995 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -41,24 +41,24 @@ Error StreamPeerTCP::_connect(const String& p_address,int p_port) { return ERR_CANT_RESOLVE; } - connect(ip,p_port); + connect_to_host(ip,p_port); return OK; } void StreamPeerTCP::set_ip_type(IP::Type p_type) { - disconnect(); + disconnect_from_host(); ip_type = p_type; } void StreamPeerTCP::_bind_methods() { ClassDB::bind_method(_MD("set_ip_type","ip_type"),&StreamPeerTCP::set_ip_type); - ClassDB::bind_method(_MD("connect","host","port"),&StreamPeerTCP::_connect); - ClassDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected); + ClassDB::bind_method(_MD("connect_to_host","host","port"),&StreamPeerTCP::_connect); + ClassDB::bind_method(_MD("is_connected_to_host"),&StreamPeerTCP::is_connected_to_host); ClassDB::bind_method(_MD("get_status"),&StreamPeerTCP::get_status); ClassDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host); ClassDB::bind_method(_MD("get_connected_port"),&StreamPeerTCP::get_connected_port); - ClassDB::bind_method(_MD("disconnect"),&StreamPeerTCP::disconnect); + ClassDB::bind_method(_MD("disconnect_from_host"),&StreamPeerTCP::disconnect_from_host); BIND_CONSTANT( STATUS_NONE ); BIND_CONSTANT( STATUS_CONNECTING ); diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h index 8f6dfaf3f8..2b25f31739 100644 --- a/core/io/stream_peer_tcp.h +++ b/core/io/stream_peer_tcp.h @@ -60,13 +60,13 @@ protected: public: virtual void set_ip_type(IP::Type p_type); - virtual Error connect(const IP_Address& p_host, uint16_t p_port)=0; + virtual Error connect_to_host(const IP_Address& p_host, uint16_t p_port)=0; //read/write from streampeer - virtual bool is_connected() const=0; + virtual bool is_connected_to_host() const=0; virtual Status get_status() const=0; - virtual void disconnect()=0; + virtual void disconnect_from_host()=0; virtual IP_Address get_connected_host() const=0; virtual uint16_t get_connected_port() const=0; virtual void set_nodelay(bool p_enabled)=0; diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index 8c4c1c8180..bee38e037f 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -204,7 +204,7 @@ bool TranslationLoaderPO::handles_type(const String& p_type) const{ String TranslationLoaderPO::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="po") + if (p_path.get_extension().to_lower()=="po") return "Translation"; return ""; } diff --git a/core/io/zip.c b/core/io/zip.c index 44c79195d9..27a3d3cdc1 100644 --- a/core/io/zip.c +++ b/core/io/zip.c @@ -855,7 +855,7 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl ziinit.z_filefunc.zseek32_file = NULL; ziinit.z_filefunc.ztell32_file = NULL; if (pzlib_filefunc64_32_def==NULL) { -// fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64); + //fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64); } else ziinit.z_filefunc = *pzlib_filefunc64_32_def; diff --git a/core/map.h b/core/map.h index af35fec332..9448389169 100644 --- a/core/map.h +++ b/core/map.h @@ -149,7 +149,7 @@ private: #ifdef GLOBALNIL_DISABLED memdelete_allocator<Element,A>(_nil); #endif -// memdelete_allocator<Element,A>(_root); + //memdelete_allocator<Element,A>(_root); } }; diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp index b888b6b56c..e2526f5134 100644 --- a/core/math/bsp_tree.cpp +++ b/core/math/bsp_tree.cpp @@ -390,8 +390,10 @@ static int _bsp_create_node(const Face3 *p_faces,const Vector<int>& p_indices,Ve const Face3& f=p_faces[ indices[i] ]; - //if (f.get_plane().is_almost_like(divisor_plane)) - // continue; + /* + if (f.get_plane().is_almost_like(divisor_plane)) + continue; + */ int over_count=0; int under_count=0; @@ -546,7 +548,7 @@ BSP_Tree::BSP_Tree(const Variant& p_variant) { error_radius = d["error"]; aabb = d["aabb"]; -// int node_count = src_nodes.size(); + //int node_count = src_nodes.size(); nodes.resize(src_nodes.size()/3); PoolVector<int>::Read r = src_nodes.read(); diff --git a/core/math/geometry.h b/core/math/geometry.h index 9800e5513c..d5b3a3068c 100644 --- a/core/math/geometry.h +++ b/core/math/geometry.h @@ -750,9 +750,7 @@ public: return Vector<Vector3>(); //empty } -// long count = 0; long previous = polygon.size() - 1; - Vector<Vector3> clipped; for (int index = 0; index < polygon.size(); index++) { diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 7896299c24..a24c4266ee 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -154,7 +154,7 @@ struct Vector2 { Vector2 floor() const; Vector2 snapped(const Vector2& p_by) const; - real_t get_aspect() const { return width/height; } + real_t aspect() const { return width/height; } operator String() const { return String::num(x)+", "+String::num(y); } diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp index db1c52ccb4..8353aa0ebe 100644 --- a/core/math/math_funcs.cpp +++ b/core/math/math_funcs.cpp @@ -29,7 +29,7 @@ #include "math_funcs.h" #include "core/os/os.h" -#include <math.h> + #include "float.h" uint32_t Math::default_seed=1; @@ -69,48 +69,6 @@ double Math::randf() { return (double)rand() / (double)Math::RANDOM_MAX; } -double Math::sin(double p_x) { - - return ::sin(p_x); - -} - -double Math::cos(double p_x) { - - return ::cos(p_x); - -} - -double Math::tan(double p_x) { - - return ::tan(p_x); - -} -double Math::sinh(double p_x) { - - return ::sinh(p_x); -} - -double Math::cosh(double p_x) { - - return ::cosh(p_x); -} - -double Math::tanh(double p_x) { - - return ::tanh(p_x); -} - - -double Math::deg2rad(double p_y) { - - return p_y*Math_PI/180.0; -} - -double Math::rad2deg(double p_y) { - - return p_y*180.0/Math_PI; -} double Math::round(double p_val) { @@ -122,22 +80,6 @@ double Math::round(double p_val) { } } -double Math::asin(double p_x) { - - return ::asin(p_x); - -} - -double Math::acos(double p_x) { - - return ::acos(p_x); -} - -double Math::atan(double p_x) { - - return ::atan(p_x); -} - double Math::dectime(double p_value,double p_amount, double p_step) { float sgn = p_value < 0 ? -1.0 : 1.0; @@ -148,42 +90,6 @@ double Math::dectime(double p_value,double p_amount, double p_step) { return val*sgn; } -double Math::atan2(double p_y, double p_x) { - - return ::atan2(p_y,p_x); - -} -double Math::sqrt(double p_x) { - - return ::sqrt(p_x); -} - -double Math::fmod(double p_x,double p_y) { - - return ::fmod(p_x,p_y); -} - -double Math::fposmod(double p_x,double p_y) { - - if (p_x>=0) { - - return Math::fmod(p_x,p_y); - - } else { - - return p_y-Math::fmod(-p_x,p_y); - } - -} -double Math::floor(double p_x) { - - return ::floor(p_x); -} - -double Math::ceil(double p_x) { - - return ::ceil(p_x); -} int Math::step_decimals(double p_step) { @@ -244,20 +150,7 @@ double Math::stepify(double p_value,double p_step) { return p_value; } -bool Math::is_nan(double p_val) { - - return (p_val!=p_val); -} - -bool Math::is_inf(double p_val) { - -#ifdef _MSC_VER - return !_finite(p_val); -#else - return isinf(p_val); -#endif -} uint32_t Math::larger_prime(uint32_t p_val) { diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 24081528f0..8ce59224ff 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -33,38 +33,125 @@ #include "math_defs.h" #ifndef NO_MATH_H -#include "math.h" +#include <math.h> #endif +#define Math_PI 3.14159265358979323846 +#define Math_SQRT12 0.7071067811865475244008443621048490 + class Math { static uint32_t default_seed; public: - Math() {}; // useless to instance + Math() {} // useless to instance enum { RANDOM_MAX=2147483647L }; - static double sin(double p_x); - static double cos(double p_x); - static double tan(double p_x); - static double sinh(double p_x); - static double cosh(double p_x); - static double tanh(double p_x); - static double asin(double p_x); - static double acos(double p_x); - static double atan(double p_x); - static double atan2(double p_y, double p_x); - static double deg2rad(double p_y); - static double rad2deg(double p_y); - static double sqrt(double p_x); - static double fmod(double p_x,double p_y); - static double fposmod(double p_x,double p_y); + + static _ALWAYS_INLINE_ double sin(double p_x) { + + return ::sin(p_x); + + } + + static _ALWAYS_INLINE_ double cos(double p_x) { + + return ::cos(p_x); + + } + + static _ALWAYS_INLINE_ double tan(double p_x) { + + return ::tan(p_x); + + } + static _ALWAYS_INLINE_ double sinh(double p_x) { + + return ::sinh(p_x); + } + + static _ALWAYS_INLINE_ double cosh(double p_x) { + + return ::cosh(p_x); + } + + static _ALWAYS_INLINE_ double tanh(double p_x) { + + return ::tanh(p_x); + } + + + static _ALWAYS_INLINE_ double asin(double p_x) { + + return ::asin(p_x); + + } + + static _ALWAYS_INLINE_ double acos(double p_x) { + + return ::acos(p_x); + } + + static _ALWAYS_INLINE_ double atan(double p_x) { + + return ::atan(p_x); + } + + static _ALWAYS_INLINE_ double atan2(double p_y, double p_x) { + + return ::atan2(p_y,p_x); + + } + + static _ALWAYS_INLINE_ double deg2rad(double p_y) { + + return p_y*Math_PI/180.0; + } + + static _ALWAYS_INLINE_ double rad2deg(double p_y) { + + return p_y*180.0/Math_PI; + } + + + static _ALWAYS_INLINE_ double sqrt(double p_x) { + + return ::sqrt(p_x); + } + + static _ALWAYS_INLINE_ double fmod(double p_x,double p_y) { + + return ::fmod(p_x,p_y); + } + + static _ALWAYS_INLINE_ double fposmod(double p_x,double p_y) { + + if (p_x>=0) { + + return fmod(p_x,p_y); + + } else { + + return p_y-fmod(-p_x,p_y); + } + + } + static _ALWAYS_INLINE_ double floor(double p_x) { + + return ::floor(p_x); + } + + static _ALWAYS_INLINE_ double ceil(double p_x) { + + return ::ceil(p_x); + } + + static uint32_t rand_from_seed(uint32_t *seed); - static double floor(double p_x); - static double ceil(double p_x); + static double ease(double p_x, double p_c); static int step_decimals(double p_step); static double stepify(double p_value,double p_step); @@ -84,10 +171,20 @@ public: return Math::exp( p_db * 0.11512925464970228420089957273422 ); } - static bool is_nan(double p_val); - static bool is_inf(double p_val); + static _ALWAYS_INLINE_ bool is_nan(double p_val) { + + return (p_val!=p_val); + } + static _ALWAYS_INLINE_ bool is_inf(double p_val) { + #ifdef _MSC_VER + return !_finite(p_val); + #else + return isinf(p_val); + #endif + + } static uint32_t rand(); static double randf(); @@ -289,7 +386,5 @@ public: }; -#define Math_PI 3.14159265358979323846 -#define Math_SQRT12 0.7071067811865475244008443621048490 #endif // MATH_FUNCS_H diff --git a/core/math/octree.h b/core/math/octree.h index 1a41413a76..483ba1d510 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -130,8 +130,10 @@ private: ~Octant() { - //for (int i=0;i<8;i++) - // memdelete_notnull(children[i]); + /* + for (int i=0;i<8;i++) + memdelete_notnull(children[i]); + */ } }; @@ -250,8 +252,10 @@ private: E->get().eA=p_A->pair_list.push_back(&E->get()); E->get().eB=p_B->pair_list.push_back(&E->get()); -// if (pair_callback) -// pair_callback(pair_callback_userdata,p_A->userdata,p_B->userdata); + /* + if (pair_callback) + pair_callback(pair_callback_userdata,p_A->userdata,p_B->userdata); + */ } else { E->get().refcount++; @@ -970,8 +974,10 @@ void Octree<T,use_pairs,AL>::move(OctreeElementID p_id, const Rect3& p_aabb) { Octant *o=E->get().octant; typename List<typename Element::OctantOwner,AL>::Element *N=E->next(); -// if (!use_pairs) -// o->elements.erase( E->get().E ); + /* + if (!use_pairs) + o->elements.erase( E->get().E ); + */ if (use_pairs && e.pairable) o->pairable_elements.erase( E->get().E ); diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index ab81a068d4..756e48d0b4 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -483,7 +483,7 @@ Error QuickHull::build(const Vector<Vector3>& p_points, Geometry::MeshData &r_me //fill mesh r_mesh.faces.clear(); r_mesh.faces.resize(ret_faces.size()); -// print_line("FACECOUNT: "+itos(r_mesh.faces.size())); + //print_line("FACECOUNT: "+itos(r_mesh.faces.size())); int idx=0; for (List<Geometry::MeshData::Face>::Element *E=ret_faces.front();E;E=E->next()) { diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index fc5f55066b..74c4656771 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -320,7 +320,7 @@ bool TriangleMesh::intersect_segment(const Vector3& p_begin,const Vector3& p_end bool valid = b.aabb.intersects_segment(p_begin,p_end); -// bool valid = b.aabb.intersects(ray_aabb); + //bool valid = b.aabb.intersects(ray_aabb); if (!valid) { diff --git a/core/math/triangulator.cpp b/core/math/triangulator.cpp index 8f82d76823..75b2b064c4 100644 --- a/core/math/triangulator.cpp +++ b/core/math/triangulator.cpp @@ -1128,7 +1128,7 @@ int TriangulatorPartition::MonotonePartition(List<TriangulatorPoly> *inpolys, Li //this makes deleting existing edges much faster Set<ScanLineEdge>::Element **edgeTreeIterators,*edgeIter; edgeTreeIterators = new Set<ScanLineEdge>::Element*[maxnumvertices]; -// Pair<Set<ScanLineEdge>::Element*,bool> edgeTreeRet; + //Pair<Set<ScanLineEdge>::Element*,bool> edgeTreeRet; for(i = 0; i<numvertices; i++) edgeTreeIterators[i] = NULL; //for each vertex diff --git a/core/method_bind.cpp b/core/method_bind.cpp index f323f3bc24..3465edff63 100644 --- a/core/method_bind.cpp +++ b/core/method_bind.cpp @@ -26,7 +26,10 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +// object.h needs to be the first include *before* method_bind.h +// FIXME: Find out why and fix potential cyclical dependencies. #include "object.h" + #include "method_bind.h" diff --git a/core/object.cpp b/core/object.cpp index 3bb917bd38..8af088122e 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -369,8 +369,10 @@ void Object::set(const String& p_name, const Variant& p_value) { _setv(p_name,p_value); - //if (!_use_builtin_script()) -// return; + /* + if (!_use_builtin_script()) + return; + */ bool success; ClassDB::set_property(this,p_name,p_value,success); @@ -410,8 +412,10 @@ void Object::set(const StringName& p_name, const Variant& p_value, bool *r_valid //try built-in setgetter { if (ClassDB::set_property(this,p_name,p_value,r_valid)) { - //if (r_valid) - // *r_valid=true; + /* + if (r_valid) + *r_valid=true; + */ return; } } @@ -1689,12 +1693,12 @@ void Object::_bind_methods() { //todo reimplement this per language so all 5 arguments can be called -// ClassDB::bind_method(_MD("call","method","arg1","arg2","arg3","arg4"),&Object::_call_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); -// ClassDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); + //ClassDB::bind_method(_MD("call","method","arg1","arg2","arg3","arg4"),&Object::_call_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); + //ClassDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); ClassDB::bind_method(_MD("add_user_signal","signal","arguments"),&Object::_add_user_signal,DEFVAL(Array())); ClassDB::bind_method(_MD("has_user_signal","signal"),&Object::_has_user_signal); -// ClassDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array())); + //ClassDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array())); { diff --git a/core/object.h b/core/object.h index a54693eab6..6ce579ea99 100644 --- a/core/object.h +++ b/core/object.h @@ -579,8 +579,8 @@ public: } /* IAPI */ -// void set(const String& p_name, const Variant& p_value); -// Variant get(const String& p_name) const; + //void set(const String& p_name, const Variant& p_value); + //Variant get(const String& p_name) const; void set(const StringName& p_name, const Variant& p_value, bool *r_valid=NULL); Variant get(const StringName& p_name, bool *r_valid=NULL) const; diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp index f3bb37421f..24b9c26e71 100644 --- a/core/object_type_db.cpp +++ b/core/object_type_db.cpp @@ -897,7 +897,7 @@ bool ClassDB::set_property(Object* p_object,const StringName& p_property, const if (psg->index>=0) { Variant index=psg->index; const Variant* arg[2]={&index,&p_value}; -// p_object->call(psg->setter,arg,2,ce); + //p_object->call(psg->setter,arg,2,ce); if (psg->_setptr) { psg->_setptr->call(p_object,arg,2,ce); } else { @@ -1111,6 +1111,15 @@ MethodBind* ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const String instance_type=p_bind->get_instance_class(); +#ifdef DEBUG_ENABLED + + if (has_method(instance_type,mdname)) { + ERR_EXPLAIN("Class "+String(instance_type)+" already has a method "+String(mdname)); + ERR_FAIL_V(NULL); + } +#endif + + ClassInfo *type=classes.getptr(instance_type); if (!type) { ERR_PRINTS("Couldn't bind method '"+mdname+"' for instance: "+instance_type); diff --git a/core/os/dir_access.h b/core/os/dir_access.h index f824b5f319..7c173fc780 100644 --- a/core/os/dir_access.h +++ b/core/os/dir_access.h @@ -72,7 +72,7 @@ protected: public: - virtual bool list_dir_begin()=0; ///< This starts dir listing + virtual Error list_dir_begin()=0; ///< This starts dir listing virtual String get_next(bool* p_is_dir); // compatibility virtual String get_next()=0; virtual bool current_is_dir() const=0; diff --git a/core/os/input.cpp b/core/os/input.cpp index 2ae5834bde..e53aa82b13 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -75,7 +75,7 @@ void Input::_bind_methods() { ClassDB::bind_method(_MD("get_magnetometer"),&Input::get_magnetometer); ClassDB::bind_method(_MD("get_gyroscope"),&Input::get_gyroscope); //ClassDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want - ClassDB::bind_method(_MD("get_mouse_speed"),&Input::get_mouse_speed); + ClassDB::bind_method(_MD("get_last_mouse_speed"),&Input::get_last_mouse_speed); ClassDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask); ClassDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode); ClassDB::bind_method(_MD("get_mouse_mode"),&Input::get_mouse_mode); diff --git a/core/os/input.h b/core/os/input.h index b12ad9b55d..82c7a80d3f 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -77,7 +77,7 @@ public: virtual void stop_joy_vibration(int p_device)=0; virtual Point2 get_mouse_pos() const=0; - virtual Point2 get_mouse_speed() const=0; + virtual Point2 get_last_mouse_speed() const=0; virtual int get_mouse_button_mask() const=0; virtual void warp_mouse_pos(const Vector2& p_to)=0; diff --git a/core/os/memory.h b/core/os/memory.h index 0e6dea48d3..49424037ff 100644 --- a/core/os/memory.h +++ b/core/os/memory.h @@ -97,8 +97,8 @@ _ALWAYS_INLINE_ T *_post_initialize(T *p_obj) { #define memnew(m_class) _post_initialize(new("") m_class) _ALWAYS_INLINE_ void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_description) { -// void *failptr=0; -// ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */ + //void *failptr=0; + //ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */ return p_pointer; } diff --git a/core/os/os.cpp b/core/os/os.cpp index 677bf63e69..3a8e15a692 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -27,13 +27,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "os.h" -#include "os/file_access.h" -#include <stdarg.h> + #include "dir_access.h" #include "globals.h" #include "input.h" -// For get_engine_version, could be removed if it's moved to a new Engine singleton -#include "version.h" +#include "os/file_access.h" + +#include <stdarg.h> OS* OS::singleton=NULL; @@ -98,23 +98,6 @@ void OS::printerr(const char* p_format, ...) { }; -void OS::set_iterations_per_second(int p_ips) { - - ips=p_ips; -} -int OS::get_iterations_per_second() const { - - return ips; -} - -void OS::set_target_fps(int p_fps) { - _target_fps=p_fps>0? p_fps : 0; -} - -float OS::get_target_fps() const { - return _target_fps; -} - void OS::set_keep_screen_on(bool p_enabled) { _keep_screen_on=p_enabled; } @@ -152,10 +135,6 @@ int OS::get_process_ID() const { return -1; }; -uint64_t OS::get_frames_drawn() { - - return frames_drawn; -} bool OS::is_stdout_verbose() const { @@ -187,7 +166,7 @@ const char *OS::get_last_error() const { void OS::dump_memory_to_file(const char* p_file) { -// Memory::dump_static_mem_to_file(p_file); + //Memory::dump_static_mem_to_file(p_file); } static FileAccess *_OSPRF=NULL; @@ -261,15 +240,7 @@ void OS::clear_last_error() { memfree(last_error); last_error=NULL; } -void OS::set_frame_delay(uint32_t p_msec) { - _frame_delay=p_msec; -} - -uint32_t OS::get_frame_delay() const { - - return _frame_delay; -} void OS::set_no_window_mode(bool p_enable) { @@ -513,20 +484,13 @@ OS::MouseMode OS::get_mouse_mode() const{ return MOUSE_MODE_VISIBLE; } -void OS::set_time_scale(float p_scale) { - - _time_scale=p_scale; -} OS::LatinKeyboardVariant OS::get_latin_keyboard_variant() const { return LATIN_KEYBOARD_QWERTY; } -float OS::get_time_scale() const { - return _time_scale; -} bool OS::is_joy_known(int p_device) { return true; @@ -548,49 +512,21 @@ bool OS::is_vsync_enabled() const{ return true; } -Dictionary OS::get_engine_version() const { - - Dictionary dict; - dict["major"] = _MKSTR(VERSION_MAJOR); - dict["minor"] = _MKSTR(VERSION_MINOR); -#ifdef VERSION_PATCH - dict["patch"] = _MKSTR(VERSION_PATCH); -#else - dict["patch"] = ""; -#endif - dict["status"] = _MKSTR(VERSION_STATUS); - dict["revision"] = _MKSTR(VERSION_REVISION); - - String stringver = String(dict["major"]) + "." + String(dict["minor"]); - if (dict["patch"] != "") - stringver += "." + String(dict["patch"]); - stringver += "-" + String(dict["status"]) + " (" + String(dict["revision"]) + ")"; - dict["string"] = stringver; - - return dict; -} OS::OS() { last_error=NULL; - frames_drawn=0; singleton=this; - ips=60; _keep_screen_on=true; // set default value to true, because this had been true before godot 2.0. low_processor_usage_mode=false; _verbose_stdout=false; - _frame_delay=0; _no_window=false; _exit_code=0; _orientation=SCREEN_LANDSCAPE; - _fps=1; - _target_fps=0; + _render_thread_mode=RENDER_THREAD_SAFE; - _time_scale=1.0; - _pixel_snap=false; + + _allow_hidpi=true; - _fixed_frames=0; - _idle_frames=0; - _in_fixed=false; Math::seed(1234567); } diff --git a/core/os/os.h b/core/os/os.h index 5ea3216f24..ea03481a92 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -32,6 +32,7 @@ #include "ustring.h" #include "list.h" #include "vector.h" +#include "engine.h" #include "os/main_loop.h" #include <stdarg.h> @@ -43,28 +44,17 @@ class OS { static OS* singleton; String _execpath; - String _custom_level; List<String> _cmdline; - int ips; bool _keep_screen_on; bool low_processor_usage_mode; bool _verbose_stdout; String _local_clipboard; - uint64_t frames_drawn; - uint32_t _frame_delay; uint64_t _msec_splash; bool _no_window; int _exit_code; int _orientation; - float _fps; - int _target_fps; - float _time_scale; - bool _pixel_snap; bool _allow_hidpi; - uint64_t _fixed_frames; - uint64_t _idle_frames; - bool _in_fixed; char *last_error; @@ -185,15 +175,6 @@ public: virtual bool get_borderless_window() { return 0; } - - virtual void set_iterations_per_second(int p_ips); - virtual int get_iterations_per_second() const; - - virtual void set_target_fps(int p_fps); - virtual float get_target_fps() const; - - virtual float get_frames_per_second() const { return _fps; } - virtual void set_keep_screen_on(bool p_enabled); virtual bool is_keep_screen_on() const; virtual void set_low_processor_usage_mode(bool p_enabled); @@ -217,7 +198,6 @@ public: virtual MainLoop *get_main_loop() const=0; - String get_custom_level() const { return _custom_level; } virtual void yield(); @@ -280,17 +260,9 @@ public: uint32_t get_ticks_msec() const; uint64_t get_splash_tick_msec() const; - void set_frame_delay(uint32_t p_msec); - uint32_t get_frame_delay() const; virtual bool can_draw() const = 0; - uint64_t get_frames_drawn(); - - uint64_t get_fixed_frames() const { return _fixed_frames; } - uint64_t get_idle_frames() const { return _idle_frames; } - bool is_in_fixed_frame() const { return _in_fixed; } - bool is_stdout_verbose() const; enum CursorShape { @@ -416,10 +388,6 @@ public: virtual LatinKeyboardVariant get_latin_keyboard_variant() const; - void set_time_scale(float p_scale); - float get_time_scale() const; - - _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; @@ -434,8 +402,6 @@ public: virtual void set_use_vsync(bool p_enable); virtual bool is_vsync_enabled() const; - Dictionary get_engine_version() const; - bool is_hidpi_allowed() const { return _allow_hidpi; } OS(); virtual ~OS(); diff --git a/core/path_remap.cpp b/core/path_remap.cpp index fd5b38fa79..42383e212d 100644 --- a/core/path_remap.cpp +++ b/core/path_remap.cpp @@ -142,7 +142,7 @@ void PathRemap::load_remaps() { // platform remaps second, so override remaps = GlobalConfig::get_singleton()->get("remap/"+OS::get_singleton()->get_name()); -// remaps = Globals::get_singleton()->get("remap/PSP"); + //remaps = Globals::get_singleton()->get("remap/PSP"); { int rlen = remaps.size(); @@ -152,7 +152,7 @@ void PathRemap::load_remaps() { String from = r[i*2+0]; String to = r[i*2+1]; -// print_line("add remap: "+from+" -> "+to); + //print_line("add remap: "+from+" -> "+to); add_remap(from,to); } } diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index fe88d1d13d..85fa5d27c0 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -62,6 +62,7 @@ static ResourceFormatLoaderBinary *resource_loader_binary=NULL; static _ResourceLoader *_resource_loader=NULL; static _ResourceSaver *_resource_saver=NULL; static _OS *_os=NULL; +static _Engine *_engine=NULL; static _ClassDB *_classdb=NULL; static _Marshalls *_marshalls = NULL; static TranslationLoaderPO *resource_format_po=NULL; @@ -122,7 +123,7 @@ void register_core_types() { ClassDB::register_virtual_class<PacketPeer>(); ClassDB::register_class<PacketPeerStream>(); ClassDB::register_class<MainLoop>(); -// ClassDB::register_type<OptimizedSaver>(); + //ClassDB::register_type<OptimizedSaver>(); ClassDB::register_class<Translation>(); ClassDB::register_class<PHashTranslation>(); ClassDB::register_class<UndoRedo>(); @@ -156,6 +157,7 @@ void register_core_types() { _resource_loader=memnew(_ResourceLoader); _resource_saver=memnew(_ResourceSaver); _os=memnew(_OS); + _engine=memnew(_Engine); _classdb=memnew(_ClassDB); _marshalls = memnew(_Marshalls); @@ -179,6 +181,7 @@ void register_core_singletons() { GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ResourceSaver",_ResourceSaver::get_singleton()) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("PathRemap",PathRemap::get_singleton() ) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("OS",_OS::get_singleton() ) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Engine",_Engine::get_singleton() ) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ClassDB",_classdb ) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Marshalls",_Marshalls::get_singleton() ) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("TranslationServer",TranslationServer::get_singleton() ) ); @@ -196,6 +199,7 @@ void unregister_core_types() { memdelete( _resource_loader ); memdelete( _resource_saver ); memdelete( _os); + memdelete( _engine ); memdelete( _classdb ); memdelete( _marshalls ); diff --git a/core/resource.cpp b/core/resource.cpp index db4d2ec0db..3369e4a5a2 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -522,11 +522,12 @@ void ResourceCache::clear() { void ResourceCache::reload_externals() { - //const String *K=NULL; - //while ((K=resources.next(K))) { -// resources[*K]->reload_external_data(); -// } - + /* + const String *K=NULL; + while ((K=resources.next(K))) { + resources[*K]->reload_external_data(); + } + */ } bool ResourceCache::has(const String& p_path) { diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 62fcd5247f..bb0109467e 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -66,7 +66,7 @@ Error ScriptDebuggerRemote::connect_to_host(const String& p_host,uint16_t p_port int port = p_port; int tries = 3; - tcp_client->connect(ip, port); + tcp_client->connect_to_host(ip, port); while (tries--) { @@ -129,7 +129,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { //or when execution is paused from editor - if (!tcp_client->is_connected()) { + if (!tcp_client->is_connected_to_host()) { ERR_EXPLAIN("Script Debugger failed to connect, but being used anyway."); ERR_FAIL(); } @@ -446,7 +446,7 @@ void ScriptDebuggerRemote::_err_handler(void* ud,const char* p_func,const char*p sdr->mutex->lock(); - if (!sdr->locking && sdr->tcp_client->is_connected()) { + if (!sdr->locking && sdr->tcp_client->is_connected_to_host()) { sdr->errors.push_back(oe); } @@ -778,7 +778,7 @@ void ScriptDebuggerRemote::_send_profiling_data(bool p_for_frame) { } - packet_peer_stream->put_var(OS::get_singleton()->get_frames_drawn()); //total frame time + packet_peer_stream->put_var(Engine::get_singleton()->get_frames_drawn()); //total frame time packet_peer_stream->put_var(frame_time); //total frame time packet_peer_stream->put_var(idle_time); //idle frame time packet_peer_stream->put_var(fixed_time); //fixed frame time @@ -887,7 +887,7 @@ void ScriptDebuggerRemote::idle_poll() { void ScriptDebuggerRemote::send_message(const String& p_message, const Array &p_args) { mutex->lock(); - if (!locking && tcp_client->is_connected()) { + if (!locking && tcp_client->is_connected_to_host()) { Message msg; msg.message=p_message; @@ -928,7 +928,7 @@ void ScriptDebuggerRemote::_print_handler(void *p_this,const String& p_string) { } sdr->mutex->lock(); - if (!sdr->locking && sdr->tcp_client->is_connected()) { + if (!sdr->locking && sdr->tcp_client->is_connected_to_host()) { sdr->output_strings.push_back(s); } diff --git a/core/set.h b/core/set.h index 9da2887671..13c2b3a4f6 100644 --- a/core/set.h +++ b/core/set.h @@ -141,7 +141,7 @@ private: #ifdef GLOBALNIL_DISABLED memdelete_allocator<Element,A>(_nil); #endif -// memdelete_allocator<Element,A>(_root); + //memdelete_allocator<Element,A>(_root); } }; @@ -307,7 +307,7 @@ private: new_node->right=_data._nil; new_node->left=_data._nil; new_node->value=p_value; -// new_node->data=_data; + //new_node->data=_data; if (new_parent==_data._root || less(p_value,new_parent->value)) { new_parent->left=new_node; diff --git a/core/ustring.cpp b/core/ustring.cpp index 27bb8eac72..66608379be 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -560,7 +560,7 @@ String String::get_slice(String p_splitter, int p_slice) const { int pos=0; int prev_pos=0; -// int slices=1; + //int slices=1; if (p_slice<0) return ""; if (find(p_splitter)==-1) @@ -574,7 +574,7 @@ String String::get_slice(String p_splitter, int p_slice) const { pos=length(); //reached end int from=prev_pos; - // int to=pos; + //int to=pos; if (p_slice==i) { @@ -1420,7 +1420,7 @@ bool String::parse_utf8(const char* p_utf8,int p_len) { } } -// printf("char %i, len %i\n",unichar,len); + //printf("char %i, len %i\n",unichar,len); if (sizeof(wchar_t)==2 && unichar>0xFFFF) { unichar=' '; //too long for windows @@ -2951,6 +2951,78 @@ bool String::matchn(const String& p_wildcard) const { } +String String::format(const Variant& values,String placeholder) const { + + String new_string = String( this->ptr() ); + + if( values.get_type() == Variant::ARRAY ) { + Array values_arr = values; + + for(int i=0;i<values_arr.size();i++) { + String i_as_str = String::num_int64( i ); + + if( values_arr[i].get_type() == Variant::ARRAY ) {//Array in Array structure [["name","RobotGuy"],[0,"godot"],["strength",9000.91]] + Array value_arr = values_arr[i]; + + if( value_arr.size()==2 ) { + Variant v_key = value_arr[0]; + String key; + + key = v_key.get_construct_string(); + if( key.left(1)=="\"" && key.right(key.length()-1)=="\"" ) { + key = key.substr(1,key.length()-2); + } + + Variant v_val = value_arr[1]; + String val; + val = v_val.get_construct_string(); + + if( val.left(1)=="\"" && val.right(val.length()-1)=="\"" ) { + val = val.substr(1,val.length()-2); + } + + new_string = new_string.replacen( placeholder.replace("_", key ), val ); + }else { + ERR_PRINT(String("STRING.format Inner Array size != 2 ").ascii().get_data()); + } + } else {//Array structure ["RobotGuy","Logis","rookie"] + Variant v_val = values_arr[i]; + String val; + val = v_val.get_construct_string(); + + if( val.left(1)=="\"" && val.right(val.length()-1)=="\"" ) { + val = val.substr(1,val.length()-2); + } + + new_string = new_string.replacen( placeholder.replace("_", i_as_str ), val ); + } + } + }else if( values.get_type() == Variant::DICTIONARY ) { + Dictionary d = values; + List<Variant> keys; + d.get_key_list(&keys); + + for (List<Variant>::Element *E=keys.front();E;E=E->next()) { + String key = E->get().get_construct_string(); + String val = d[E->get()].get_construct_string(); + + if( key.left(1)=="\"" && key.right(key.length()-1)=="\"" ) { + key = key.substr(1,key.length()-2); + } + + if( val.left(1)=="\"" && val.right(val.length()-1)=="\"" ) { + val = val.substr(1,val.length()-2); + } + + new_string = new_string.replacen( placeholder.replace("_", key ), val ); + } + }else{ + ERR_PRINT(String("Invalid type: use Array or Dictionary.").ascii().get_data()); + } + + return new_string; +} + String String::replace(String p_key,String p_with) const { String new_string; @@ -3812,7 +3884,7 @@ String String::get_file() const { return substr(sep+1,length()); } -String String::extension() const { +String String::get_extension() const { int pos = find_last("."); if (pos<0) @@ -3822,8 +3894,9 @@ String String::extension() const { } String String::plus_file(const String& p_file) const { - - if (length()>0 && operator [](length()-1)=='/') + if (empty()) + return p_file; + if (operator [](length()-1)=='/' || p_file.operator [](0)=='/') return *this+p_file; else return *this+"/"+p_file; @@ -3891,7 +3964,7 @@ String String::percent_decode() const { return String::utf8(pe.ptr()); } -String String::basename() const { +String String::get_basename() const { int pos = find_last("."); if (pos<0) @@ -4211,4 +4284,3 @@ String RTR(const String& p_text) { return p_text; } - diff --git a/core/ustring.h b/core/ustring.h index 9a145143d0..426762a9e1 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -125,6 +125,7 @@ public: bool is_subsequence_ofi(const String& p_string) const; Vector<String> bigrams() const; float similarity(const String& p_string) const; + String format(const Variant& values,String placeholder="{_}") const; String replace_first(String p_key,String p_with) const; String replace(String p_key,String p_with) const; String replacen(String p_key,String p_with) const; @@ -176,8 +177,8 @@ public: String right(int p_pos) const; String strip_edges(bool left = true, bool right = true) const; String strip_escapes() const; - String extension() const; - String basename() const; + String get_extension() const; + String get_basename() const; String plus_file(const String& p_file) const; CharType ord_at(int p_idx) const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 0c8b40539d..51ad115d46 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -146,7 +146,7 @@ struct _VariantCall { Arg(Variant::Type p_type,const StringName &p_name) { name=p_name; type=p_type; } }; -// void addfunc(Variant::Type p_type, const StringName& p_name,VariantFunc p_func); + //void addfunc(Variant::Type p_type, const StringName& p_name,VariantFunc p_func); static void make_func_return_variant(Variant::Type p_type,const StringName& p_name) { @@ -261,6 +261,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM1R(String,is_subsequence_ofi); VCALL_LOCALMEM0R(String,bigrams); VCALL_LOCALMEM1R(String,similarity); + VCALL_LOCALMEM2R(String,format); VCALL_LOCALMEM2R(String,replace); VCALL_LOCALMEM2R(String,replacen); VCALL_LOCALMEM2R(String,insert); @@ -272,8 +273,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM1R(String,left); VCALL_LOCALMEM1R(String,right); VCALL_LOCALMEM2R(String,strip_edges); - VCALL_LOCALMEM0R(String,extension); - VCALL_LOCALMEM0R(String,basename); + VCALL_LOCALMEM0R(String,get_extension); + VCALL_LOCALMEM0R(String,get_basename); VCALL_LOCALMEM1R(String,plus_file); VCALL_LOCALMEM1R(String,ord_at); VCALL_LOCALMEM2(String,erase); @@ -349,12 +350,12 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0R(Vector2,tangent); VCALL_LOCALMEM0R(Vector2,floor); VCALL_LOCALMEM1R(Vector2,snapped); - VCALL_LOCALMEM0R(Vector2,get_aspect); + VCALL_LOCALMEM0R(Vector2,aspect); VCALL_LOCALMEM1R(Vector2,dot); VCALL_LOCALMEM1R(Vector2,slide); VCALL_LOCALMEM1R(Vector2,reflect); VCALL_LOCALMEM0R(Vector2,angle); -// VCALL_LOCALMEM1R(Vector2,cross); + //VCALL_LOCALMEM1R(Vector2,cross); VCALL_LOCALMEM0R(Vector2,abs); VCALL_LOCALMEM1R(Vector2,clamped); @@ -1392,6 +1393,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(STRING,POOL_STRING_ARRAY,String,bigrams,varray()); ADDFUNC1(STRING,REAL,String,similarity,STRING,"text",varray()); + ADDFUNC2(STRING,STRING,String,format,NIL,"values",STRING,"placeholder",varray("{_}")); ADDFUNC2(STRING,STRING,String,replace,STRING,"what",STRING,"forwhat",varray()); ADDFUNC2(STRING,STRING,String,replacen,STRING,"what",STRING,"forwhat",varray()); ADDFUNC2(STRING,STRING,String,insert,INT,"pos",STRING,"what",varray()); @@ -1405,8 +1407,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(STRING,STRING,String,left,INT,"pos",varray()); ADDFUNC1(STRING,STRING,String,right,INT,"pos",varray()); ADDFUNC2(STRING,STRING,String,strip_edges,BOOL,"left",BOOL,"right",varray(true,true)); - ADDFUNC0(STRING,STRING,String,extension,varray()); - ADDFUNC0(STRING,STRING,String,basename,varray()); + ADDFUNC0(STRING,STRING,String,get_extension,varray()); + ADDFUNC0(STRING,STRING,String,get_basename,varray()); ADDFUNC1(STRING,STRING,String,plus_file,STRING,"file",varray()); ADDFUNC1(STRING,INT,String,ord_at,INT,"at",varray()); ADDFUNC2(STRING,NIL,String,erase,INT,"pos",INT,"chars", varray()); @@ -1457,7 +1459,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(VECTOR2,VECTOR2,Vector2,tangent,varray()); ADDFUNC0(VECTOR2,VECTOR2,Vector2,floor,varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,snapped,VECTOR2,"by",varray()); - ADDFUNC0(VECTOR2,REAL,Vector2,get_aspect,varray()); + ADDFUNC0(VECTOR2,REAL,Vector2,aspect,varray()); ADDFUNC1(VECTOR2,REAL,Vector2,dot,VECTOR2,"with",varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,slide,VECTOR2,"vec",varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray()); diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 402c8d41da..ca748b7fd3 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -2094,8 +2094,10 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud,"{ "); for(List<Variant>::Element *E=keys.front();E;E=E->next()) { - //if (!_check_type(dict[E->get()])) - // continue; + /* + if (!_check_type(dict[E->get()])) + continue; + */ write(E->get(),p_store_string_func,p_store_string_ud,p_encode_res_func,p_encode_res_ud); p_store_string_func(p_store_string_ud,":"); write(dict[E->get()],p_store_string_func,p_store_string_ud,p_encode_res_func,p_encode_res_ud); diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 04bf8f677e..0088f576f0 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -8816,7 +8816,7 @@ <constants> </constants> </class> -<class name="ColorFrame" inherits="Control" category="Core"> +<class name="ColorRect" inherits="Control" category="Core"> <brief_description> </brief_description> <description> @@ -26354,7 +26354,7 @@ </constant> </constants> </class> -<class name="Patch9Frame" inherits="Control" category="Core"> +<class name="Patch9Rect" inherits="Control" category="Core"> <brief_description> </brief_description> <description> @@ -32557,7 +32557,7 @@ <constants> </constants> </class> -<class name="ReferenceFrame" inherits="Control" category="Core"> +<class name="ReferenceRect" inherits="Control" category="Core"> <brief_description> Reference frame for GUI. </brief_description> @@ -41638,7 +41638,7 @@ <constants> </constants> </class> -<class name="TextureFrame" inherits="Control" category="Core"> +<class name="TextureRect" inherits="Control" category="Core"> <brief_description> Control Frame that draws a texture. </brief_description> @@ -44205,7 +44205,7 @@ </argument> <argument index="4" name="target_method" type="String"> </argument> - <argument index="5" name="times_in_sec" type="float"> + <argument index="5" name="duration" type="float"> </argument> <argument index="6" name="trans_type" type="int"> </argument> @@ -44214,7 +44214,7 @@ <argument index="8" name="delay" type="float" default="0"> </argument> <description> - Follow [code]method[/code] of [code]object[/code] and apply the returned value on [code]target_method[/code] of [code]target[/code], beginning from [code]initial_val[/code] for [code]times_in_sec[/code] seconds, [code]delay[/code] later. Methods are animated by calling them with consequitive values. + Follow [code]method[/code] of [code]object[/code] and apply the returned value on [code]target_method[/code] of [code]target[/code], beginning from [code]initial_val[/code] for [code]duration[/code] seconds, [code]delay[/code] later. Methods are animated by calling them with consequitive values. [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the begining, the end, or both). You can read more about them in the class description. </description> </method> @@ -44231,7 +44231,7 @@ </argument> <argument index="4" name="target_property" type="String"> </argument> - <argument index="5" name="times_in_sec" type="float"> + <argument index="5" name="duration" type="float"> </argument> <argument index="6" name="trans_type" type="int"> </argument> @@ -44240,7 +44240,7 @@ <argument index="8" name="delay" type="float" default="0"> </argument> <description> - Follow [code]property[/code] of [code]object[/code] and apply it on [code]target_property[/code] of [code]target[/code], beginning from [code]initial_val[/code] for [code]times_in_sec[/code] seconds, [code]delay[/code] seconds later. Note that [code]target:target_property[/code] would equal [code]object:property[/code] at the end of the tween. + Follow [code]property[/code] of [code]object[/code] and apply it on [code]target_property[/code] of [code]target[/code], beginning from [code]initial_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Note that [code]target:target_property[/code] would equal [code]object:property[/code] at the end of the tween. [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the begining, the end, or both). You can read more about them in the class description. </description> </method> @@ -44270,7 +44270,7 @@ </return> <argument index="0" name="object" type="Object"> </argument> - <argument index="1" name="times_in_sec" type="float"> + <argument index="1" name="duration" type="float"> </argument> <argument index="2" name="callback" type="String"> </argument> @@ -44285,7 +44285,7 @@ <argument index="7" name="arg5" type="Variant" default="NULL"> </argument> <description> - Call [code]callback[/code] of [code]object[/code] after [code]times_in_sec[/code]. [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback. + Call [code]callback[/code] of [code]object[/code] after [code]duration[/code]. [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback. </description> </method> <method name="interpolate_deferred_callback"> @@ -44293,7 +44293,7 @@ </return> <argument index="0" name="object" type="Object"> </argument> - <argument index="1" name="times_in_sec" type="float"> + <argument index="1" name="duration" type="float"> </argument> <argument index="2" name="callback" type="String"> </argument> @@ -44308,7 +44308,7 @@ <argument index="7" name="arg5" type="Variant" default="NULL"> </argument> <description> - Call [code]callback[/code] of [code]object[/code] after [code]times_in_sec[/code] on the main thread (similar to [methog Object.call_deferred). [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback. + Call [code]callback[/code] of [code]object[/code] after [code]duration[/code] on the main thread (similar to [methog Object.call_deferred). [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback. </description> </method> <method name="interpolate_method"> @@ -44322,7 +44322,7 @@ </argument> <argument index="3" name="final_val" type="Variant"> </argument> - <argument index="4" name="times_in_sec" type="float"> + <argument index="4" name="duration" type="float"> </argument> <argument index="5" name="trans_type" type="int"> </argument> @@ -44331,7 +44331,7 @@ <argument index="7" name="delay" type="float" default="0"> </argument> <description> - Animate [code]method[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]times_in_sec[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecuitive values. + Animate [code]method[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecuitive values. [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the begining, the end, or both). You can read more about them in the class description. </description> </method> @@ -44346,7 +44346,7 @@ </argument> <argument index="3" name="final_val" type="Variant"> </argument> - <argument index="4" name="times_in_sec" type="float"> + <argument index="4" name="duration" type="float"> </argument> <argument index="5" name="trans_type" type="int"> </argument> @@ -44355,7 +44355,7 @@ <argument index="7" name="delay" type="float" default="0"> </argument> <description> - Animate [code]property[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]times_in_sec[/code] seconds, [code]delay[/code] seconds later. + Animate [code]property[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the begining, the end, or both). You can read more about them in the class description. </description> </method> @@ -44502,7 +44502,7 @@ </argument> <argument index="4" name="final_val" type="Variant"> </argument> - <argument index="5" name="times_in_sec" type="float"> + <argument index="5" name="duration" type="float"> </argument> <argument index="6" name="trans_type" type="int"> </argument> @@ -44511,7 +44511,7 @@ <argument index="8" name="delay" type="float" default="0"> </argument> <description> - Animate [code]method[/code] of [code]object[/code] from the value returned by [code]initial.initial_method[/code] to [code]final_val[/code] for [code]times_in_sec[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecuitive values. + Animate [code]method[/code] of [code]object[/code] from the value returned by [code]initial.initial_method[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecuitive values. [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the begining, the end, or both). You can read more about them in the class description. </description> </method> @@ -44528,7 +44528,7 @@ </argument> <argument index="4" name="final_val" type="Variant"> </argument> - <argument index="5" name="times_in_sec" type="float"> + <argument index="5" name="duration" type="float"> </argument> <argument index="6" name="trans_type" type="int"> </argument> @@ -44537,7 +44537,7 @@ <argument index="8" name="delay" type="float" default="0"> </argument> <description> - Animate [code]property[/code] of [code]object[/code] from the current value of the [code]initial_val[/code] property of [code]initial[/code] to [code]final_val[/code] for [code]times_in_sec[/code] seconds, [code]delay[/code] seconds later. + Animate [code]property[/code] of [code]object[/code] from the current value of the [code]initial_val[/code] property of [code]initial[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the begining, the end, or both). You can read more about them in the class description. </description> </method> diff --git a/drivers/convex_decomp/b2Glue.h b/drivers/convex_decomp/b2Glue.h index 7ec6d7f181..425486356e 100644 --- a/drivers/convex_decomp/b2Glue.h +++ b/drivers/convex_decomp/b2Glue.h @@ -134,11 +134,13 @@ struct b2Vec2 return length; } - ///// Does this vector contain finite coordinates? - //bool IsValid() const - //{ - // return b2IsValid(x) && b2IsValid(y); - //} + /* + /// Does this vector contain finite coordinates? + bool IsValid() const + { + return b2IsValid(x) && b2IsValid(y); + } + */ float32 x, y; }; diff --git a/drivers/convex_decomp/b2Polygon.cpp b/drivers/convex_decomp/b2Polygon.cpp index 73955d3573..f45d98250a 100644 --- a/drivers/convex_decomp/b2Polygon.cpp +++ b/drivers/convex_decomp/b2Polygon.cpp @@ -189,7 +189,7 @@ void b2Polygon::MergeParallelEdges(float32 tolerance) { x = newx; y = newy; nVertices = newNVertices; -// printf("%d \n", newNVertices); + //printf("%d \n", newNVertices); } /* @@ -436,7 +436,6 @@ bool b2Polygon::IsSimple() { * For internal use. */ b2Polygon* b2Polygon::Add(b2Triangle& t) { -// float32 equalTol = .001f; // First, find vertices that connect int32 firstP = -1; int32 firstT = -1; @@ -963,7 +962,7 @@ int32 DecomposeConvex(b2Polygon* p, b2Polygon* results, int32 maxPolys) { tempP.Set(*p); ReversePolygon(tempP.x, tempP.y, tempP.nVertices); nTri = TriangulatePolygon(tempP.x, tempP.y, tempP.nVertices, triangulated); -// ReversePolygon(p->x, p->y, p->nVertices); //reset orientation + //ReversePolygon(p->x, p->y, p->nVertices); //reset orientation } else { //printf("It is not ccw \n"); nTri = TriangulatePolygon(p->x, p->y, p->nVertices, triangulated); @@ -997,7 +996,7 @@ void DecomposeConvexAndAddTo(b2Polygon* p, b2Body* bd, b2FixtureDef* prototype) if (p->nVertices < 3) return; b2Polygon* decomposed = new b2Polygon[p->nVertices - 2]; //maximum number of polys int32 nPolys = DecomposeConvex(p, decomposed, p->nVertices - 2); -// printf("npolys: %d",nPolys); + //printf("npolys: %d",nPolys); b2FixtureDef* pdarray = new b2FixtureDef[2*p->nVertices];//extra space in case of splits int32 extra = 0; for (int32 i = 0; i < nPolys; ++i) { @@ -1362,14 +1361,15 @@ b2Polygon TraceEdge(b2Polygon* p){ //printf("knode %d on node %d now has %d connections\n",k,j,knode->nConnected); //printf("Found duplicate point.\n"); } - //printf("Orphaning node at address %d\n",(int)jnode); - //for (int32 k=0; k<njConn; ++k) { - // if (jnode->connected[k]->IsConnectedTo(*jnode)) printf("Problem!!!\n"); - //} /* + printf("Orphaning node at address %d\n",(int)jnode); + for (int32 k=0; k<njConn; ++k) { + if (jnode->connected[k]->IsConnectedTo(*jnode)) printf("Problem!!!\n"); + } for (int32 k=0; k < njConn; ++k){ jnode->RemoveConnectionByIndex(k); - }*/ + } + */ jnode->nConnected = 0; } } diff --git a/drivers/convex_decomp/b2Polygon.h b/drivers/convex_decomp/b2Polygon.h index 36af2fd9d0..c466e28f7e 100644 --- a/drivers/convex_decomp/b2Polygon.h +++ b/drivers/convex_decomp/b2Polygon.h @@ -74,9 +74,11 @@ public: void print(){ printFormatted(); -// for (int32 i=0; i<nVertices; ++i){ -// printf("i: %d, x:%f, y:%f\n",i,x[i],y[i]); -// } + /* + for (int32 i=0; i<nVertices; ++i){ + printf("i: %d, x:%f, y:%f\n",i,x[i],y[i]); + } + */ } void printFormatted(){ diff --git a/drivers/convex_decomp/b2d_decompose.cpp b/drivers/convex_decomp/b2d_decompose.cpp index 82eade5b69..f84faaf586 100644 --- a/drivers/convex_decomp/b2d_decompose.cpp +++ b/drivers/convex_decomp/b2d_decompose.cpp @@ -144,7 +144,7 @@ static Vector< Vector<Vector2> > _b2d_decompose(const Vector<Vector2>& p_polygon Skip: ; } -// delete[] pdarray; + //delete[] pdarray; delete[] decomposed; delete p; return res;// pdarray; //needs to be deleted after body is created diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 2673c79232..fd3e5e508e 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -915,7 +915,7 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I if (scale_textures) { texture->alloc_width = po2_width; texture->alloc_height = po2_height; - // print_line("scale because npo2: "+itos(npo2_textures_available)+" mm: "+itos(p_format&VS::TEXTURE_FLAG_MIPMAPS)+" "+itos(p_mipmap_count) ); + //print_line("scale because npo2: "+itos(npo2_textures_available)+" mm: "+itos(p_format&VS::TEXTURE_FLAG_MIPMAPS)+" "+itos(p_mipmap_count) ); } else { texture->alloc_width = texture->width; @@ -1910,7 +1910,7 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, use_VBO=false; } -// surface->packed=pack_arrays && use_VBO; + //surface->packed=pack_arrays && use_VBO; int total_elem_size=0; @@ -3917,7 +3917,7 @@ void RasterizerGLES2::light_instance_set_shadow_transform(RID p_light_instance, ERR_FAIL_COND(!lighti); ERR_FAIL_COND(lighti->base->type!=VS::LIGHT_DIRECTIONAL); -// ERR_FAIL_INDEX(p_index,1); + //ERR_FAIL_INDEX(p_index,1); lighti->custom_projection[p_index]=p_camera; lighti->custom_transform[p_index]=p_transform; @@ -4043,8 +4043,10 @@ RID RasterizerGLES2::viewport_data_create() { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, - // GL_RGBA, GL_UNSIGNED_BYTE, NULL); + /* + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + */ glTexImage2D(GL_TEXTURE_2D, 0, format_luminance, 1, 1, 0, format_luminance_components, format_luminance_type, NULL); @@ -4295,11 +4297,11 @@ void RasterizerGLES2::begin_frame() { draw_next_frame=false; -// material_shader.set_uniform_default(MaterialShaderGLES2::SCREENZ_SCALE, Math::fmod(time, 3600.0)); + //material_shader.set_uniform_default(MaterialShaderGLES2::SCREENZ_SCALE, Math::fmod(time, 3600.0)); /* nehe ?*/ -// glClearColor(0,0,1,1); -// glClear(GL_COLOR_BUFFER_BIT); //should not clear if anything else cleared.. + //glClearColor(0,0,1,1); + //glClear(GL_COLOR_BUFFER_BIT); //should not clear if anything else cleared.. } void RasterizerGLES2::capture_viewport(Image* r_capture) { @@ -4329,7 +4331,7 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) { PoolVector<uint8_t>::Write w = pixels.write(); glPixelStorei(GL_PACK_ALIGNMENT, 4); -// uint64_t time = OS::get_singleton()->get_ticks_usec(); + //uint64_t time = OS::get_singleton()->get_ticks_usec(); if (current_rt) { #ifdef GLEW_ENABLED @@ -4456,7 +4458,7 @@ void RasterizerGLES2::begin_shadow_map( RID p_light_instance, int p_shadow_pass opaque_render_list.clear(); alpha_render_list.clear(); -// pre_zpass_render_list.clear(); + //pre_zpass_render_list.clear(); light_instance_count=0; glCullFace(GL_FRONT); @@ -4614,7 +4616,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const { //print_line("compiled fragment: "+fragment_code); - // ("compiled fragment globals: "+fragment_globals); + //("compiled fragment globals: "+fragment_globals); //print_line("UCF: "+itos(p_shader->uniforms.size())); @@ -5128,9 +5130,11 @@ _FORCE_INLINE_ void RasterizerGLES2::_update_material_shader_params(Material *p_ ud.value=E->value().default_value; old_inuse=false; //if reverted to default, obviously did not work - //print_line("NEW: "+String(E->key())+" because: hasold-"+itos(old_mparams.has(E->key()))); - //if (old_mparams.has(E->key())) - // print_line(" told "+Variant::get_type_name(old_mparams[E->key()].value.get_type())+" tnew "+Variant::get_type_name(E->value().default_value.get_type())); + /* + print_line("NEW: "+String(E->key())+" because: hasold-"+itos(old_mparams.has(E->key()))); + if (old_mparams.has(E->key())) + print_line(" told "+Variant::get_type_name(old_mparams[E->key()].value.get_type())+" tnew "+Variant::get_type_name(E->value().default_value.get_type())); + */ } @@ -5216,12 +5220,14 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material if (p_material->shader_cache && p_material->shader_cache->valid) { - // // reduce amount of conditional compilations - // for(int i=0;i<_tex_version_count;i++) - // material_shader.set_conditional((MaterialShaderGLES2::Conditionals)_tex_version[i],false); + /* + // reduce amount of conditional compilations + for(int i=0;i<_tex_version_count;i++) + material_shader.set_conditional((MaterialShaderGLES2::Conditionals)_tex_version[i],false); + */ - // material_shader.set_custom_shader(p_material->shader_cache->custom_code_id); + //material_shader.set_custom_shader(p_material->shader_cache->custom_code_id); if (p_material->shader_version!=p_material->shader_cache->version) { //shader changed somehow, must update uniforms @@ -5241,7 +5247,7 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material if (E->get().index<0) continue; -// print_line(String(E->key())+": "+E->get().value); + //print_line(String(E->key())+": "+E->get().value); if (E->get().istexture) { //clearly a texture.. RID rid = E->get().value; @@ -5418,13 +5424,7 @@ void RasterizerGLES2::_setup_light(uint16_t p_light) { if (li->near_shadow_buffer) { glActiveTexture(GL_TEXTURE0+max_texture_units-1); - //if (read_depth_supported) { - - glBindTexture(GL_TEXTURE_2D,li->near_shadow_buffer->depth); - //} else { - - - //} + glBindTexture(GL_TEXTURE_2D,li->near_shadow_buffer->depth); material_shader.set_uniform(MaterialShaderGLES2::SHADOW_MATRIX,li->shadow_projection[0]); material_shader.set_uniform(MaterialShaderGLES2::SHADOW_TEXEL_SIZE,Vector2(1.0,1.0)/li->near_shadow_buffer->size); @@ -5944,8 +5944,10 @@ Error RasterizerGLES2::_setup_geometry(const Geometry *p_geometry, const Materia const Surface::ArrayData& ad=surf->array[i]; -// if (!gl_texcoord_shader[i]) -// continue; + /* + if (!gl_texcoord_shader[i]) + continue; + */ if (ad.size==0 || ! ad.bind) { glDisableVertexAttribArray(i); @@ -5957,7 +5959,7 @@ Error RasterizerGLES2::_setup_geometry(const Geometry *p_geometry, const Materia } glEnableVertexAttribArray(i); -// print_line("set: "+itos(i)+" - count: "+itos(ad.count)+" datatype: "+itos(ad.datatype)+" ofs: "+itos(ad.ofs)+" stride: "+itos(stride)+" total len: "+itos(surf->array_len)); + //print_line("set: "+itos(i)+" - count: "+itos(ad.count)+" datatype: "+itos(ad.datatype)+" ofs: "+itos(ad.ofs)+" stride: "+itos(stride)+" total len: "+itos(surf->array_len)); glVertexAttribPointer(i, ad.count, ad.datatype, ad.normalize, stride, &base[ad.ofs]); } @@ -6015,7 +6017,7 @@ void RasterizerGLES2::_render(const Geometry *p_geometry,const Material *p_mater glDrawElements(gl_primitive[s->primitive], s->index_array_len, (s->array_len>(1<<16))?GL_UNSIGNED_INT:GL_UNSIGNED_SHORT, s->index_array_local); } else { - // print_line("indices: "+itos(s->index_array_local) ); + //print_line("indices: "+itos(s->index_array_local) ); //print_line("VBO F: "+itos(s->format)+" C: "+itos(s->index_array_len)+" VC: "+itos(s->array_len)); @@ -6405,7 +6407,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans material_shader.set_conditional(MaterialShaderGLES2::SHADELESS,false); material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_OCTREE,false); material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_LIGHTMAP,false); -// material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_TEXTURE,false); + //material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_TEXTURE,false); } @@ -6956,7 +6958,7 @@ void RasterizerGLES2::_process_glow_bloom() { glUniform1i(copy_shader.get_uniform_location(CopyShaderGLES2::HDR_SOURCE),2); copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_EXPOSURE,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE])); copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_WHITE])); -// copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE,1.0); + //copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE,1.0); copy_shader.set_uniform(CopyShaderGLES2::HDR_GLOW_TRESHOLD,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD])); copy_shader.set_uniform(CopyShaderGLES2::HDR_GLOW_SCALE,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_GLOW_SCALE])); @@ -7040,7 +7042,7 @@ void RasterizerGLES2::_process_hdr() { _copy_screen_quad(); copy_shader.set_conditional(CopyShaderGLES2::USE_HDR_COPY,false); -// int passes = current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_PASSES]; + //int passes = current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_PASSES]; copy_shader.set_conditional(CopyShaderGLES2::USE_HDR_REDUCE,true); copy_shader.bind(); @@ -7345,7 +7347,7 @@ void RasterizerGLES2::end_scene() { print_line(String("setting camera to ")+camera_transform_inverse); */ -// material_shader.set_uniform_default(MaterialShaderGLES2::CAMERA_INVERSE, camera_transform_inverse); + //material_shader.set_uniform_default(MaterialShaderGLES2::CAMERA_INVERSE, camera_transform_inverse); current_depth_test=true; @@ -7391,7 +7393,7 @@ void RasterizerGLES2::end_scene() { _render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true); glColorMask(1,1,1,1); -// material_shader.set_conditional( MaterialShaderGLES2::USE_FOG,false); + //material_shader.set_conditional( MaterialShaderGLES2::USE_FOG,false); DEBUG_TEST_ERROR("Drawing Scene"); @@ -7534,8 +7536,8 @@ void RasterizerGLES2::end_scene() { if (GLOBAL_DEF("rasterizer/debug_shadow_maps",false)) { _debug_shadows(); } -// _debug_luminances(); -// _debug_samplers(); + //_debug_luminances(); + //_debug_samplers(); if (using_canvas_bg) { using_canvas_bg=false; @@ -7884,7 +7886,7 @@ void RasterizerGLES2::_debug_draw_shadows_type(Vector<ShadowBuffer>& p_shadows,P Size2 debug_size(128,128); -// Size2 debug_size(512,512); + //Size2 debug_size(512,512); int useblur=shadow_filter==SHADOW_FILTER_ESM?1:0; @@ -7989,7 +7991,7 @@ void RasterizerGLES2::_debug_shadows() { _debug_draw_shadows_type(near_shadow_buffers,ofs); -// _debug_draw_shadows_type(far_shadow_buffers,ofs); + //_debug_draw_shadows_type(far_shadow_buffers,ofs); } @@ -8841,11 +8843,11 @@ RID RasterizerGLES2::canvas_light_shadow_buffer_create(int p_width) { } else { // We'll use a RGBA texture into which we pack the depth info glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, cls->size, cls->height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); + GL_RGBA, GL_UNSIGNED_BYTE, NULL); // Attach the RGBA texture to FBO color attachment point glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, cls->depth, 0); + GL_TEXTURE_2D, cls->depth, 0); cls->rgba=cls->depth; // Allocate 16-bit depth buffer @@ -8853,7 +8855,7 @@ RID RasterizerGLES2::canvas_light_shadow_buffer_create(int p_width) { // Attach the render buffer as depth buffer - will be ignored glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, cls->rbo); + GL_RENDERBUFFER, cls->rbo); } @@ -8922,7 +8924,7 @@ void RasterizerGLES2::canvas_light_shadow_buffer_update(RID p_buffer, const Matr //light.basis.scale(Vector3(to_light.elements[0].length(),to_light.elements[1].length(),1)); - /// p_near=1; + / //p_near=1; CameraMatrix projection; { real_t fov = 90; @@ -9121,10 +9123,10 @@ void RasterizerGLES2::canvas_debug_viewport_shadows(CanvasLight* p_lights_with_s //print_line(" debug lights "); while(light) { - // print_line("debug light"); + //print_line("debug light"); if (light->shadow_buffer.is_valid()) { - // print_line("sb is valid"); + //print_line("sb is valid"); CanvasLightShadow * sb = canvas_light_shadow_owner.get(light->shadow_buffer); if (sb) { glActiveTexture(GL_TEXTURE0); @@ -9172,7 +9174,7 @@ void RasterizerGLES2::_canvas_item_render_commands(CanvasItem *p_item,CanvasItem case CanvasItem::Command::TYPE_RECT: { CanvasItem::CommandRect* rect = static_cast<CanvasItem::CommandRect*>(c); -// canvas_draw_rect(rect->rect,rect->region,rect->source,rect->flags&CanvasItem::CommandRect::FLAG_TILE,rect->flags&CanvasItem::CommandRect::FLAG_FLIP_H,rect->flags&CanvasItem::CommandRect::FLAG_FLIP_V,rect->texture,rect->modulate); + //canvas_draw_rect(rect->rect,rect->region,rect->source,rect->flags&CanvasItem::CommandRect::FLAG_TILE,rect->flags&CanvasItem::CommandRect::FLAG_FLIP_H,rect->flags&CanvasItem::CommandRect::FLAG_FLIP_V,rect->texture,rect->modulate); #if 0 int flags=0; @@ -9344,9 +9346,6 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(CanvasItemMaterial *mater } else { glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height); } -// if (current_clip) { -// // print_line(" a clip "); -// } canvas_texscreen_used=true; } @@ -9925,8 +9924,8 @@ RID RasterizerGLES2::sampled_light_dp_create(int p_width,int p_height) { glGenTextures(1,&slight->texture); glBindTexture(GL_TEXTURE_2D, slight->texture); // for debug, but glitchy -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -10046,7 +10045,7 @@ void RasterizerGLES2::free(const RID& p_rid) { // delete the texture Texture *texture = texture_owner.get(p_rid); -// glDeleteTextures( 1,&texture->tex_id ); + //glDeleteTextures( 1,&texture->tex_id ); _rinfo.texture_mem-=texture->total_data_size; texture_owner.free(p_rid); memdelete(texture); @@ -10232,9 +10231,11 @@ void RasterizerGLES2::free(const RID& p_rid) { glDeleteFramebuffers(1,&cls->fbo); glDeleteRenderbuffers(1,&cls->rbo); glDeleteTextures(1,&cls->depth); - //if (!read_depth_supported) { - // glDeleteTextures(1,&cls->rgba); - //} + /* + if (!read_depth_supported) { + glDeleteTextures(1,&cls->rgba); + } + */ canvas_light_shadow_owner.free(p_rid); memdelete(cls); @@ -10286,18 +10287,18 @@ bool RasterizerGLES2::ShadowBuffer::init(int p_size,bool p_use_depth) { } else { // We'll use a RGBA texture into which we pack the depth info glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size, size, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); + GL_RGBA, GL_UNSIGNED_BYTE, NULL); // Attach the RGBA texture to FBO color attachment point glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, depth, 0); + GL_TEXTURE_2D, depth, 0); // Allocate 16-bit depth buffer glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size,size); // Attach the render buffer as depth buffer - will be ignored glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, rbo); + GL_RENDERBUFFER, rbo); } @@ -10332,8 +10333,8 @@ bool RasterizerGLES2::ShadowBuffer::init(int p_size,bool p_use_depth) { } else { -// glGenRenderbuffers(1, &rbo); -// glBindRenderbuffer(GL_RENDERBUFFER, rbo); + //glGenRenderbuffers(1, &rbo); + //glBindRenderbuffer(GL_RENDERBUFFER, rbo); glGenTextures(1, &depth); glBindTexture(GL_TEXTURE_2D, depth); @@ -10383,20 +10384,21 @@ bool RasterizerGLES2::ShadowBuffer::init(int p_size,bool p_use_depth) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size, size, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); -// glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, size, size, 0, -// GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT, NULL); + //glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, size, size, 0, + //GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT, NULL); - // Attach the RGBA texture to FBO color attachment point - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, blur, 0); + // Attach the RGBA texture to FBO color attachment point + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, blur, 0); - // Allocate 16-bit depth buffer - /* glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size, size); + // Allocate 16-bit depth buffer + /* + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size, size); - // Attach the render buffer as depth buffer - will be ignored - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, rbo_blur); -*/ + // Attach the render buffer as depth buffer - will be ignored + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, rbo_blur); + */ status = glCheckFramebufferStatus(GL_FRAMEBUFFER); OS::get_singleton()->print("Status: %x\n",status); glBindFramebuffer(GL_FRAMEBUFFER, 0); @@ -10502,7 +10504,7 @@ void RasterizerGLES2::_update_framebuffer() { #endif //color -// GLuint format_rgba = use_fp16_fb?_GL_RGBA16F_EXT:GL_RGBA; + //GLuint format_rgba = use_fp16_fb?_GL_RGBA16F_EXT:GL_RGBA; GLuint format_rgba = GL_RGBA; GLuint format_type = use_fp16_fb?_GL_HALF_FLOAT_OES:GL_UNSIGNED_BYTE; GLuint format_internal=GL_RGBA; @@ -10528,8 +10530,8 @@ void RasterizerGLES2::_update_framebuffer() { glTexImage2D(GL_TEXTURE_2D, 0, format_rgba, framebuffer.width, framebuffer.height, 0, format_internal, format_type, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, framebuffer.color, 0); @@ -10562,8 +10564,8 @@ void RasterizerGLES2::_update_framebuffer() { glTexImage2D(GL_TEXTURE_2D, 0, format_rgba, framebuffer.width, framebuffer.height, 0, format_internal, format_type, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, framebuffer.sample_color, 0); @@ -10730,9 +10732,9 @@ void RasterizerGLES2::_update_blur_buffer() { glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size, size, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); + GL_RGBA, GL_UNSIGNED_BYTE, NULL); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, framebuffer.blur[i].color, 0); + GL_TEXTURE_2D, framebuffer.blur[i].color, 0); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); @@ -10915,9 +10917,9 @@ void RasterizerGLES2::init() { framebuffer.fbo=0; framebuffer.width=0; framebuffer.height=0; -// framebuffer.buff16=false; -// framebuffer.blur[0].fbo=false; -// framebuffer.blur[1].fbo=false; + //framebuffer.buff16=false; + //framebuffer.blur[0].fbo=false; + //framebuffer.blur[1].fbo=false; framebuffer.active=false; @@ -10945,8 +10947,8 @@ void RasterizerGLES2::init() { use_depth24 =true; s3tc_supported = true; atitc_supported = false; -// use_texture_instancing=false; -// use_attribute_instancing=true; + //use_texture_instancing=false; + //use_attribute_instancing=true; use_texture_instancing=false; use_attribute_instancing=true; full_float_fb_supported=true; @@ -11017,8 +11019,10 @@ void RasterizerGLES2::init() { use_hw_skeleton_xform=vtf>0 && float_supported; float_linear_supported = extensions.has("GL_OES_texture_float_linear"); - //if (extensions.has("GL_QCOM_tiled_rendering")) - // use_hw_skeleton_xform=false; + /* + if (extensions.has("GL_QCOM_tiled_rendering")) + use_hw_skeleton_xform=false; + */ GLint mva; glGetIntegerv(GL_MAX_VERTEX_ATTRIBS,&mva); if (vtf==0 && mva>8) { @@ -11195,7 +11199,7 @@ void RasterizerGLES2::set_extensions(const char *p_strings) { for(int i=0;i<strings.size();i++) { extensions.insert(strings[i]); -// print_line(strings[i]); + //print_line(strings[i]); } } diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index adb9fe0e83..247a35141e 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -435,7 +435,7 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a //create the call to sample the screen, and clamp it uses_texpos=true; code="get_texpos("+dump_node_code(onode->arguments[1],p_level)+""; -// code="get_texpos(gl_ProjectionMatrixInverse * texture2D( depth_texture, clamp(("+dump_node_code(onode->arguments[1],p_level)+").xy,vec2(0.0),vec2(1.0))*gl_LightSource[5].specular.zw+gl_LightSource[5].specular.xy)"; + //code="get_texpos(gl_ProjectionMatrixInverse * texture2D( depth_texture, clamp(("+dump_node_code(onode->arguments[1],p_level)+").xy,vec2(0.0),vec2(1.0))*gl_LightSource[5].specular.zw+gl_LightSource[5].specular.xy)"; //code="(texture2D( screen_texture, ("+dump_node_code(onode->arguments[1],p_level)+").xy).rgb"; break; } else if (custom_h && callfunc=="cosh_custom") { @@ -571,12 +571,13 @@ Error ShaderCompilerGLES2::compile_node(SL::ProgramNode *p_program) { global_code+=uline; if (uniforms) { - //if (uniforms->has(E->key())) { - // //repeated uniform, error - // ERR_EXPLAIN("Uniform already exists from other shader: "+String(E->key())); - // ERR_FAIL_COND_V(uniforms->has(E->key()),ERR_ALREADY_EXISTS); -// -// } + /* + if (uniforms->has(E->key())) { + //repeated uniform, error + ERR_EXPLAIN("Uniform already exists from other shader: "+String(E->key())); + ERR_FAIL_COND_V(uniforms->has(E->key()),ERR_ALREADY_EXISTS); + } + */ SL::Uniform u = E->get(); u.order+=ubase; uniforms->insert(E->key(),u); @@ -812,8 +813,8 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() { mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["VAR1"]="var1_interp"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["VAR2"]="var2_interp"; -// mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SCREEN_POS"]="SCREEN_POS"; -// mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SCREEN_SIZE"]="SCREEN_SIZE"; + //mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SCREEN_POS"]="SCREEN_POS"; + //mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SCREEN_SIZE"]="SCREEN_SIZE"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["INSTANCE_ID"]="instance_id"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["TIME"]="time"; diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp index 2ee89e9895..97c31dfc1c 100644 --- a/drivers/gles2/shader_gles2.cpp +++ b/drivers/gles2/shader_gles2.cpp @@ -561,7 +561,7 @@ ShaderGLES2::Version* ShaderGLES2::get_current_version() { v.uniform_location[j]=glGetUniformLocation(v.id,uniform_names[j]); - // print_line("uniform "+String(uniform_names[j])+" location "+itos(v.uniform_location[j])); + //print_line("uniform "+String(uniform_names[j])+" location "+itos(v.uniform_location[j])); } // set texture uniforms diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index eeab42ee64..4bcebbd69d 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -392,7 +392,7 @@ LIGHT_SHADER_CODE //use lighting #endif -// color.rgb*=color.a; + //color.rgb*=color.a; gl_FragColor = color; diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl index e5be25757d..704a22c5d1 100644 --- a/drivers/gles2/shaders/material.glsl +++ b/drivers/gles2/shaders/material.glsl @@ -820,7 +820,7 @@ void main() { vec3 binormal = normalize(binormal_interp)*side; vec3 tangent = normalize(tangent_interp)*side; #endif -// vec3 normal = abs(normalize(normal_interp))*side; + //vec3 normal = abs(normalize(normal_interp))*side; vec3 normal = normalize(normal_interp)*side; #if defined(ENABLE_SCREEN_UV) vec2 screen_uv = gl_FragCoord.xy*screen_uv_mult; @@ -989,7 +989,7 @@ FRAGMENT_SHADER_CODE #ifdef LIGHT_USE_PSSM -// if (vertex_interp.z > light_pssm_split) { + //if (vertex_interp.z > light_pssm_split) { #if 0 highp vec3 splane = vec3(0.0,0.0,0.0); @@ -1261,12 +1261,12 @@ LIGHT_SHADER_CODE vec3 ambient = const_light_mult*ambient_light*diffuse.rgb; # if defined(LIGHT_TYPE_OMNI) || defined (LIGHT_TYPE_SPOT) -// ambient*=diffuse_interp.a; //attenuation affects ambient too + //ambient*=diffuse_interp.a; //attenuation affects ambient too # endif -// diffuse.rgb=(diffuse.rgb * diffuse_interp.rgb + specular * specular_interp)*shadow_attenuation + ambient; -// diffuse.rgb+=emission * const_light_mult; + //diffuse.rgb=(diffuse.rgb * diffuse_interp.rgb + specular * specular_interp)*shadow_attenuation + ambient; + //diffuse.rgb+=emission * const_light_mult; diffuse.rgb=(diffuse.rgb * diffuse_interp.rgb + specular * specular_interp)*shadow_attenuation + ambient; diffuse.rgb+=emission * const_light_mult; diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 3c3768be67..e658fbbe88 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -147,7 +147,7 @@ void RasterizerCanvasGLES3::canvas_begin(){ -// state.canvas_shader.set_uniform(CanvasShaderGLES3::PROJECTION_MATRIX,state.vp); + //state.canvas_shader.set_uniform(CanvasShaderGLES3::PROJECTION_MATRIX,state.vp); //state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,Transform()); //state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Transform()); @@ -743,9 +743,6 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(CanvasItemMaterial *mater } else { glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height); } -// if (current_clip) { -// // print_line(" a clip "); -// } canvas_texscreen_used=true; } @@ -1193,10 +1190,10 @@ void RasterizerCanvasGLES3::canvas_debug_viewport_shadows(Light* p_lights_with_s while(light) { - // print_line("debug light"); + //print_line("debug light"); if (light->shadow_buffer.is_valid()) { - // print_line("sb is valid"); + //print_line("sb is valid"); RasterizerStorageGLES3::CanvasLightShadow * sb = storage->canvas_light_shadow_owner.get(light->shadow_buffer); if (sb) { glBindTexture(GL_TEXTURE_2D,sb->distance); @@ -1253,7 +1250,7 @@ void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, cons //light.basis.scale(Vector3(to_light.elements[0].length(),to_light.elements[1].length(),1)); - /// p_near=1; + //p_near=1; CameraMatrix projection; { real_t fov = 90; diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index efad6c7e55..b7616db8b1 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -300,9 +300,9 @@ void RasterizerGLES3::end_frame(){ glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, 0, vtx ); -// glBindBuffer(GL_ARRAY_BUFFER,canvas->data.canvas_quad_vertices); -// glEnableVertexAttribArray(VS::ARRAY_VERTEX); -// glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, 0, 0 ); + //glBindBuffer(GL_ARRAY_BUFFER,canvas->data.canvas_quad_vertices); + //glEnableVertexAttribArray(VS::ARRAY_VERTEX); + //glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, 0, 0 ); glBindVertexArray(canvas->data.canvas_quad_array); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 5611b4b63a..a026199bc7 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1102,10 +1102,10 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); else glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); - */ - //if (p_material->line_width) - // glLineWidth(p_material->line_width); + if (p_material->line_width) + glLineWidth(p_material->line_width); + */ #if 0 //blend mode @@ -1251,9 +1251,9 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e) { RasterizerStorageGLES3::Surface *s = static_cast<RasterizerStorageGLES3::Surface*>(e->geometry); - if (s->morph_targets.size() && e->instance->morph_values.size()) { + if (s->blend_shapes.size() && e->instance->blend_values.size()) { //blend shapes, use transform feedback - storage->mesh_render_blend_shapes(s,e->instance->morph_values.ptr()); + storage->mesh_render_blend_shapes(s,e->instance->blend_values.ptr()); //rebind shader state.scene_shader.bind(); } else { @@ -2067,8 +2067,10 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g } } - //if (e->geometry->type==RasterizerStorageGLES3::Geometry::GEOMETRY_MULTISURFACE) - // e->sort_flags|=RenderList::SORT_FLAG_INSTANCING; + /* + if (e->geometry->type==RasterizerStorageGLES3::Geometry::GEOMETRY_MULTISURFACE) + e->sort_flags|=RenderList::SORT_FLAG_INSTANCING; + */ if (mirror) { @@ -3949,9 +3951,10 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C if (env && env->bg_mode==VS::ENV_BG_SKYBOX) { - //if (use_mrt) { - // glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); //switch to alpha fbo for skybox, only diffuse/ambient matters - // + /* + if (use_mrt) { + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); //switch to alpha fbo for skybox, only diffuse/ambient matters + */ _draw_skybox(skybox,p_cam_projection,p_cam_transform,storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP],env->skybox_scale); } @@ -3963,7 +3966,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C //_render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true); //glColorMask(1,1,1,1); -// state.scene_shader.set_conditional( SceneShaderGLES3::USE_FOG,false); + //state.scene_shader.set_conditional( SceneShaderGLES3::USE_FOG,false); if (use_mrt) { @@ -4016,7 +4019,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C storage->canvas->canvas_begin(); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D,exposure_shrink[4].color); -// glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->exposure.color); + //glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->exposure.color); storage->canvas->draw_generic_textured_rect(Rect2(0,0,storage->frame.current_rt->width/16,storage->frame.current_rt->height/16),Rect2(0,0,1,1)); } @@ -4189,8 +4192,8 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C if (GLOBAL_DEF("rasterizer/debug_shadow_maps",false)) { _debug_shadows(); } -// _debug_luminances(); -// _debug_samplers(); + //_debug_luminances(); + //_debug_samplers(); if (using_canvas_bg) { using_canvas_bg=false; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index a4fea29b47..f096719988 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2480,7 +2480,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P } - bool has_morph = p_blend_shapes.size(); + //bool has_morph = p_blend_shapes.size(); Surface::Attrib attribs[VS::ARRAY_MAX]; @@ -2702,7 +2702,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P ERR_FAIL_COND(p_index_array.size()!=index_array_size); - ERR_FAIL_COND(p_blend_shapes.size()!=mesh->morph_target_count); + ERR_FAIL_COND(p_blend_shapes.size()!=mesh->blend_shape_count); for(int i=0;i<p_blend_shapes.size();i++) { ERR_FAIL_COND(p_blend_shapes[i].size()!=array_size); @@ -2807,7 +2807,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P for(int i=0;i<p_blend_shapes.size();i++) { - Surface::MorphTarget mt; + Surface::BlendShape mt; PoolVector<uint8_t>::Read vr = p_blend_shapes[i].read(); @@ -2837,7 +2837,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER,0); //unbind - surface->morph_targets.push_back(mt); + surface->blend_shapes.push_back(mt); } } @@ -2846,7 +2846,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P mesh->instance_change_notify(); } -void RasterizerStorageGLES3::mesh_set_morph_target_count(RID p_mesh,int p_amount){ +void RasterizerStorageGLES3::mesh_set_blend_shape_count(RID p_mesh,int p_amount){ Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); @@ -2855,32 +2855,32 @@ void RasterizerStorageGLES3::mesh_set_morph_target_count(RID p_mesh,int p_amount ERR_FAIL_COND(mesh->surfaces.size()!=0); ERR_FAIL_COND(p_amount<0); - mesh->morph_target_count=p_amount; + mesh->blend_shape_count=p_amount; } -int RasterizerStorageGLES3::mesh_get_morph_target_count(RID p_mesh) const{ +int RasterizerStorageGLES3::mesh_get_blend_shape_count(RID p_mesh) const{ const Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND_V(!mesh,0); - return mesh->morph_target_count; + return mesh->blend_shape_count; } -void RasterizerStorageGLES3::mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode){ +void RasterizerStorageGLES3::mesh_set_blend_shape_mode(RID p_mesh,VS::BlendShapeMode p_mode){ Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); - mesh->morph_target_mode=p_mode; + mesh->blend_shape_mode=p_mode; } -VS::MorphTargetMode RasterizerStorageGLES3::mesh_get_morph_target_mode(RID p_mesh) const{ +VS::BlendShapeMode RasterizerStorageGLES3::mesh_get_blend_shape_mode(RID p_mesh) const{ const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh,VS::MORPH_MODE_NORMALIZED); + ERR_FAIL_COND_V(!mesh,VS::BLEND_SHAPE_MODE_NORMALIZED); - return mesh->morph_target_mode; + return mesh->blend_shape_mode; } void RasterizerStorageGLES3::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material){ @@ -3027,9 +3027,9 @@ Vector<PoolVector<uint8_t> > RasterizerStorageGLES3::mesh_surface_get_blend_shap Vector<PoolVector<uint8_t> > bsarr; - for(int i=0;i<mesh->surfaces[p_surface]->morph_targets.size();i++) { + for(int i=0;i<mesh->surfaces[p_surface]->blend_shapes.size();i++) { - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,mesh->surfaces[p_surface]->morph_targets[i].vertex_id); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,mesh->surfaces[p_surface]->blend_shapes[i].vertex_id); void * data = glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER,0,mesh->surfaces[p_surface]->array_byte_size,GL_MAP_READ_BIT); ERR_FAIL_COND_V(!data,Vector<PoolVector<uint8_t> >()); @@ -3081,10 +3081,10 @@ void RasterizerStorageGLES3::mesh_remove_surface(RID p_mesh, int p_surface){ glDeleteVertexArrays(1,&surface->array_id); - for(int i=0;i<surface->morph_targets.size();i++) { + for(int i=0;i<surface->blend_shapes.size();i++) { - glDeleteBuffers(1,&surface->morph_targets[i].vertex_id); - glDeleteVertexArrays(1,&surface->morph_targets[i].array_id); + glDeleteBuffers(1,&surface->blend_shapes[i].vertex_id); + glDeleteVertexArrays(1,&surface->blend_shapes[i].array_id); } mesh->instance_material_change_notify(); @@ -3290,9 +3290,9 @@ void RasterizerStorageGLES3::mesh_render_blend_shapes(Surface *s, float *p_weigh //copy all first float base_weight=1.0; - int mtc = s->morph_targets.size(); + int mtc = s->blend_shapes.size(); - if (s->mesh->morph_target_mode==VS::MORPH_MODE_NORMALIZED) { + if (s->mesh->blend_shape_mode==VS::BLEND_SHAPE_MODE_NORMALIZED) { for(int i=0;i<mtc;i++) { base_weight-=p_weights[i]; @@ -3324,7 +3324,7 @@ void RasterizerStorageGLES3::mesh_render_blend_shapes(Surface *s, float *p_weigh if (weight<0.001) //not bother with this one continue; - glBindVertexArray(s->morph_targets[ti].array_id); + glBindVertexArray(s->blend_shapes[ti].array_id); glBindBuffer(GL_ARRAY_BUFFER, resources.transform_feedback_buffers[0]); glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, resources.transform_feedback_buffers[1]); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 66593b202f..f9e440288f 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -531,12 +531,12 @@ public: //bool packed; - struct MorphTarget { + struct BlendShape { GLuint vertex_id; GLuint array_id; }; - Vector<MorphTarget> morph_targets; + Vector<BlendShape> blend_shapes; Rect3 aabb; @@ -583,13 +583,13 @@ public: bool active; Vector<Surface*> surfaces; - int morph_target_count; - VS::MorphTargetMode morph_target_mode; + int blend_shape_count; + VS::BlendShapeMode blend_shape_mode; Rect3 custom_aabb; mutable uint64_t last_pass; Mesh() { - morph_target_mode=VS::MORPH_MODE_NORMALIZED; - morph_target_count=0; + blend_shape_mode=VS::BLEND_SHAPE_MODE_NORMALIZED; + blend_shape_count=0; last_pass=0; active=false; } @@ -601,12 +601,12 @@ public: virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<Rect3>& p_bone_aabbs=Vector<Rect3>()); - virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount); - virtual int mesh_get_morph_target_count(RID p_mesh) const; + virtual void mesh_set_blend_shape_count(RID p_mesh,int p_amount); + virtual int mesh_get_blend_shape_count(RID p_mesh) const; - virtual void mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode); - virtual VS::MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const; + virtual void mesh_set_blend_shape_mode(RID p_mesh,VS::BlendShapeMode p_mode); + virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const; virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material); virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const; diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 26b9aeada4..97872226a4 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -676,7 +676,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_SPATIAL].renames["AO"]="ao"; actions[VS::SHADER_SPATIAL].renames["EMISSION"]="emission"; actions[VS::SHADER_SPATIAL].renames["DISCARD"]="_discard"; -// actions[VS::SHADER_SPATIAL].renames["SCREEN_UV"]=ShaderLanguage::TYPE_VEC2; + //actions[VS::SHADER_SPATIAL].renames["SCREEN_UV"]=ShaderLanguage::TYPE_VEC2; actions[VS::SHADER_SPATIAL].renames["POINT_COORD"]="gl_PointCoord"; diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index 13b2160ec6..42a9f19671 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -573,7 +573,7 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { v.uniform_location[j]=glGetUniformLocation(v.id,uniform_names[j]); - // print_line("uniform "+String(uniform_names[j])+" location "+itos(v.uniform_location[j])); + //print_line("uniform "+String(uniform_names[j])+" location "+itos(v.uniform_location[j])); } // set texture uniforms @@ -720,7 +720,7 @@ void ShaderGLES3::setup(const char** p_conditional_defines, int p_conditional_co } else { fragment_code3=code3.substr(0,cpos).ascii(); - // print_line("CODE3:\n"+String(fragment_code3.get_data())); + //print_line("CODE3:\n"+String(fragment_code3.get_data())); fragment_code4 = code3.substr(cpos+light_code_tag.length(),code3.length()).ascii(); //print_line("CODE4:\n"+String(fragment_code4.get_data())); } diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index cf2e0f776f..e6c72da8f1 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -449,7 +449,7 @@ LIGHT_SHADER_CODE //use lighting #endif -// color.rgb*=color.a; + //color.rgb*=color.a; frag_color = color; } diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index c5af010c96..66123193e6 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -681,11 +681,13 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 bino splane.z=1.0 - splane.z; - //if (clamp_rect.z<clamp_rect.w) { - // clamp_rect.x+=clamp_rect.z; - //} else { - // clamp_rect.y+=clamp_rect.w; - //} + /* + if (clamp_rect.z<clamp_rect.w) { + clamp_rect.x+=clamp_rect.z; + } else { + clamp_rect.y+=clamp_rect.w; + } + */ } diff --git a/drivers/gles3/shaders/ssao_blur.glsl b/drivers/gles3/shaders/ssao_blur.glsl index 31f3841a2a..ff852487c0 100644 --- a/drivers/gles3/shaders/ssao_blur.glsl +++ b/drivers/gles3/shaders/ssao_blur.glsl @@ -69,9 +69,11 @@ void main() { depth*=depth_divide; - //if (depth > camera_z_far*0.999) { - // discard;//skybox - //} + /* + if (depth > camera_z_far*0.999) { + discard;//skybox + } + */ float sum = texelFetch(source_ssao, ssC, 0).r; diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index de095c20ac..51429f3416 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -134,7 +134,7 @@ Error ImageLoaderPNG::_load_image(void *rf_up,png_rw_ptr p_func,Image *p_image) } if (png_get_valid(png,info,PNG_INFO_tRNS)) { -// png_set_expand_gray_1_2_4_to_8(png); + //png_set_expand_gray_1_2_4_to_8(png); png_set_tRNS_to_alpha(png); update_info=true; } diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp index a798990449..850e5ab053 100644 --- a/drivers/rtaudio/audio_driver_rtaudio.cpp +++ b/drivers/rtaudio/audio_driver_rtaudio.cpp @@ -104,11 +104,11 @@ Error AudioDriverRtAudio::init() { unsigned int target_number_of_buffers = 4; options.numberOfBuffers = target_number_of_buffers; -// options. -// RtAudioStreamFlags flags; /*!< A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE). */// -// unsigned int numberOfBuffers; /*!< Number of stream buffers. */ -// std::string streamName; /*!< A stream name (currently used only in Jack). */ -// int priority; /*!< Scheduling priority of callback thread (only used with flag RTAUDIO_SCHEDULE_REALTIME). */ + //options. + //RtAudioStreamFlags flags; /*!< A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE). */// + //unsigned int numberOfBuffers; /*!< Number of stream buffers. */ + //std::string streamName; /*!< A stream name (currently used only in Jack). */ + //int priority; /*!< Scheduling priority of callback thread (only used with flag RTAUDIO_SCHEDULE_REALTIME). */ parameters.firstChannel = 0; mix_rate = GLOBAL_DEF("audio/mix_rate",44100); diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index 3bb30700db..a09cf80e6c 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -44,20 +44,20 @@ DirAccess *DirAccessUnix::create_fs() { return memnew( DirAccessUnix ); } -bool DirAccessUnix::list_dir_begin() { +Error DirAccessUnix::list_dir_begin() { list_dir_end(); //close any previous dir opening! -// char real_current_dir_name[2048]; //is this enough?! + //char real_current_dir_name[2048]; //is this enough?! //getcwd(real_current_dir_name,2048); //chdir(curent_path.utf8().get_data()); dir_stream = opendir(current_dir.utf8().get_data()); //chdir(real_current_dir_name); if (!dir_stream) - return true; //error! + return ERR_CANT_OPEN; //error! - return false; + return OK; } bool DirAccessUnix::file_exists(String p_file) { diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h index 324d2a379c..f075c48268 100644 --- a/drivers/unix/dir_access_unix.h +++ b/drivers/unix/dir_access_unix.h @@ -57,7 +57,7 @@ protected: public: - virtual bool list_dir_begin(); ///< This starts dir listing + virtual Error list_dir_begin(); ///< This starts dir listing virtual String get_next(); virtual bool current_is_dir() const; virtual bool current_is_hidden() const; diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp index ffb37b4f59..fc0b3faccc 100644 --- a/drivers/unix/ip_unix.cpp +++ b/drivers/unix/ip_unix.cpp @@ -33,10 +33,6 @@ #include <string.h> #ifdef WINDOWS_ENABLED - // Workaround mingw missing flags! - #ifndef AI_ADDRCONFIG - #define AI_ADDRCONFIG 0x00000400 - #endif #include <ws2tcpip.h> #include <winsock2.h> #include <windows.h> diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp index 4d9ef6cdae..6adb3eea70 100644 --- a/drivers/unix/packet_peer_udp_posix.cpp +++ b/drivers/unix/packet_peer_udp_posix.cpp @@ -230,7 +230,7 @@ int PacketPeerUDPPosix::_get_socket() { } -void PacketPeerUDPPosix::set_send_address(const IP_Address& p_address,int p_port) { +void PacketPeerUDPPosix::set_dest_address(const IP_Address& p_address,int p_port) { peer_addr=p_address; peer_port=p_port; diff --git a/drivers/unix/packet_peer_udp_posix.h b/drivers/unix/packet_peer_udp_posix.h index 89b8886cf5..ead7174a9d 100644 --- a/drivers/unix/packet_peer_udp_posix.h +++ b/drivers/unix/packet_peer_udp_posix.h @@ -73,7 +73,7 @@ public: virtual IP_Address get_packet_address() const; virtual int get_packet_port() const; - virtual void set_send_address(const IP_Address& p_address,int p_port); + virtual void set_dest_address(const IP_Address& p_address,int p_port); static void make_default(); diff --git a/drivers/unix/socket_helpers.h b/drivers/unix/socket_helpers.h index 962f228c3c..6d4f7e7519 100644 --- a/drivers/unix/socket_helpers.h +++ b/drivers/unix/socket_helpers.h @@ -3,15 +3,11 @@ #include <string.h> -#ifdef WINDOWS_ENABLED - // Workaround mingw missing flags! - #ifndef IPV6_V6ONLY - #define IPV6_V6ONLY 27 - #endif -#endif - -#ifdef UWP_ENABLED -#define in6addr_any IN6ADDR_ANY_INIT +#if defined(__MINGW32__ ) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 4) + // Workaround for mingw-w64 < 4.0 + #ifndef IPV6_V6ONLY + #define IPV6_V6ONLY 27 + #endif #endif // helpers for sockaddr -> IP_Address and back, should work for posix and winsock. All implementations should use this diff --git a/drivers/unix/stream_peer_tcp_posix.cpp b/drivers/unix/stream_peer_tcp_posix.cpp index f2a1417920..82f3115f4b 100644 --- a/drivers/unix/stream_peer_tcp_posix.cpp +++ b/drivers/unix/stream_peer_tcp_posix.cpp @@ -139,14 +139,14 @@ void StreamPeerTCPPosix::set_socket(int p_sockfd, IP_Address p_host, int p_port, peer_port = p_port; }; -Error StreamPeerTCPPosix::connect(const IP_Address& p_host, uint16_t p_port) { +Error StreamPeerTCPPosix::connect_to_host(const IP_Address& p_host, uint16_t p_port) { ERR_FAIL_COND_V( p_host == IP_Address(), ERR_INVALID_PARAMETER); sockfd = _socket_create(ip_type, SOCK_STREAM, IPPROTO_TCP); if (sockfd == -1) { ERR_PRINT("Socket creation failed!"); - disconnect(); + disconnect_from_host(); //perror("socket"); return FAILED; }; @@ -165,7 +165,7 @@ Error StreamPeerTCPPosix::connect(const IP_Address& p_host, uint16_t p_port) { if (::connect(sockfd, (struct sockaddr *)&their_addr,addr_size) == -1 && errno != EINPROGRESS) { ERR_PRINT("Connection to remote host failed!"); - disconnect(); + disconnect_from_host(); return FAILED; }; @@ -217,7 +217,7 @@ Error StreamPeerTCPPosix::write(const uint8_t* p_data,int p_bytes, int &r_sent, if (errno != EAGAIN) { perror("shit?"); - disconnect(); + disconnect_from_host(); ERR_PRINT("Server disconnected!\n"); return FAILED; }; @@ -243,7 +243,7 @@ Error StreamPeerTCPPosix::write(const uint8_t* p_data,int p_bytes, int &r_sent, Error StreamPeerTCPPosix::read(uint8_t* p_buffer, int p_bytes,int &r_received, bool p_block) { - if (!is_connected()) { + if (!is_connected_to_host()) { return FAILED; }; @@ -274,7 +274,7 @@ Error StreamPeerTCPPosix::read(uint8_t* p_buffer, int p_bytes,int &r_received, b if (errno != EAGAIN) { perror("shit?"); - disconnect(); + disconnect_from_host(); ERR_PRINT("Server disconnected!\n"); return FAILED; }; @@ -308,12 +308,12 @@ Error StreamPeerTCPPosix::read(uint8_t* p_buffer, int p_bytes,int &r_received, b void StreamPeerTCPPosix::set_nodelay(bool p_enabled) { - ERR_FAIL_COND(!is_connected()); + ERR_FAIL_COND(!is_connected_to_host()); int flag=p_enabled?1:0; setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(int)); } -bool StreamPeerTCPPosix::is_connected() const { +bool StreamPeerTCPPosix::is_connected_to_host() const { if (status == STATUS_NONE || status == STATUS_ERROR) { @@ -336,7 +336,7 @@ StreamPeerTCP::Status StreamPeerTCPPosix::get_status() const { }; -void StreamPeerTCPPosix::disconnect() { +void StreamPeerTCPPosix::disconnect_from_host() { if (sockfd != -1) close(sockfd); @@ -398,7 +398,7 @@ StreamPeerTCPPosix::StreamPeerTCPPosix() { StreamPeerTCPPosix::~StreamPeerTCPPosix() { - disconnect(); + disconnect_from_host(); }; #endif diff --git a/drivers/unix/stream_peer_tcp_posix.h b/drivers/unix/stream_peer_tcp_posix.h index 1df509cac4..e0091d55b7 100644 --- a/drivers/unix/stream_peer_tcp_posix.h +++ b/drivers/unix/stream_peer_tcp_posix.h @@ -59,7 +59,7 @@ protected: public: - virtual Error connect(const IP_Address& p_host, uint16_t p_port); + virtual Error connect_to_host(const IP_Address& p_host, uint16_t p_port); virtual Error put_data(const uint8_t* p_data,int p_bytes); virtual Error put_partial_data(const uint8_t* p_data,int p_bytes, int &r_sent); @@ -74,9 +74,9 @@ public: virtual IP_Address get_connected_host() const; virtual uint16_t get_connected_port() const; - virtual bool is_connected() const; + virtual bool is_connected_to_host() const; virtual Status get_status() const; - virtual void disconnect(); + virtual void disconnect_from_host(); virtual void set_nodelay(bool p_enabled); diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index c7082dbc7c..14742aa420 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -59,7 +59,7 @@ struct DirAccessWindowsPrivate { // CreateFolderAsync -bool DirAccessWindows::list_dir_begin() { +Error DirAccessWindows::list_dir_begin() { _cisdir=false; _cishidden=false; @@ -67,7 +67,7 @@ bool DirAccessWindows::list_dir_begin() { list_dir_end(); p->h = FindFirstFileExW((current_dir+"\\*").c_str(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, NULL, 0); - return (p->h==INVALID_HANDLE_VALUE); + return (p->h==INVALID_HANDLE_VALUE) ? ERR_CANT_OPEN : OK; } diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h index 4d9fdd08e2..f4105b7bc9 100644 --- a/drivers/windows/dir_access_windows.h +++ b/drivers/windows/dir_access_windows.h @@ -62,7 +62,7 @@ class DirAccessWindows : public DirAccess { public: - virtual bool list_dir_begin(); ///< This starts dir listing + virtual Error list_dir_begin(); ///< This starts dir listing virtual String get_next(); virtual bool current_is_dir() const; virtual bool current_is_hidden() const; diff --git a/main/input_default.cpp b/main/input_default.cpp index c2c4e28854..a7d06dbdbe 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -158,10 +158,10 @@ bool InputDefault::is_action_just_pressed(const StringName& p_action) const { if (!E) return false; - if (OS::get_singleton()->is_in_fixed_frame()) { - return E->get().pressed && E->get().fixed_frame==OS::get_singleton()->get_fixed_frames(); + if (Engine::get_singleton()->is_in_fixed_frame()) { + return E->get().pressed && E->get().fixed_frame==Engine::get_singleton()->get_fixed_frames(); } else { - return E->get().pressed && E->get().idle_frame==OS::get_singleton()->get_idle_frames(); + return E->get().pressed && E->get().idle_frame==Engine::get_singleton()->get_idle_frames(); } } @@ -171,10 +171,10 @@ bool InputDefault::is_action_just_released(const StringName& p_action) const{ if (!E) return false; - if (OS::get_singleton()->is_in_fixed_frame()) { - return !E->get().pressed && E->get().fixed_frame==OS::get_singleton()->get_fixed_frames(); + if (Engine::get_singleton()->is_in_fixed_frame()) { + return !E->get().pressed && E->get().fixed_frame==Engine::get_singleton()->get_fixed_frames(); } else { - return !E->get().pressed && E->get().idle_frame==OS::get_singleton()->get_idle_frames(); + return !E->get().pressed && E->get().idle_frame==Engine::get_singleton()->get_idle_frames(); } } @@ -313,7 +313,7 @@ void InputDefault::parse_input_event(const InputEvent& p_event) { if (p_event.key.scancode==0) break; - // print_line(p_event); + //print_line(p_event); if (p_event.key.pressed) keys_pressed.insert(p_event.key.scancode); @@ -385,8 +385,8 @@ void InputDefault::parse_input_event(const InputEvent& p_event) { if(is_action_pressed(E->key()) != p_event.is_pressed()) { Action action; - action.fixed_frame=OS::get_singleton()->get_fixed_frames(); - action.idle_frame=OS::get_singleton()->get_idle_frames(); + action.fixed_frame=Engine::get_singleton()->get_fixed_frames(); + action.idle_frame=Engine::get_singleton()->get_idle_frames(); action.pressed=p_event.is_pressed(); action_state[E->key()]=action; } @@ -479,7 +479,7 @@ Point2 InputDefault::get_mouse_pos() const { return mouse_pos; } -Point2 InputDefault::get_mouse_speed() const { +Point2 InputDefault::get_last_mouse_speed() const { return mouse_speed_track.speed; } @@ -504,8 +504,8 @@ void InputDefault::action_press(const StringName& p_action) { Action action; - action.fixed_frame=OS::get_singleton()->get_fixed_frames(); - action.idle_frame=OS::get_singleton()->get_idle_frames(); + action.fixed_frame=Engine::get_singleton()->get_fixed_frames(); + action.idle_frame=Engine::get_singleton()->get_idle_frames(); action.pressed=true; action_state[p_action]=action; @@ -516,8 +516,8 @@ void InputDefault::action_release(const StringName& p_action){ Action action; - action.fixed_frame=OS::get_singleton()->get_fixed_frames(); - action.idle_frame=OS::get_singleton()->get_idle_frames(); + action.fixed_frame=Engine::get_singleton()->get_fixed_frames(); + action.idle_frame=Engine::get_singleton()->get_idle_frames(); action.pressed=false; action_state[p_action]=action; diff --git a/main/input_default.h b/main/input_default.h index fe7e89d771..3e41c494c1 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -198,7 +198,7 @@ public: virtual Vector3 get_gyroscope() const; virtual Point2 get_mouse_pos() const; - virtual Point2 get_mouse_speed() const; + virtual Point2 get_last_mouse_speed() const; virtual int get_mouse_button_mask() const; virtual void warp_mouse_pos(const Vector2& p_to); diff --git a/main/main.cpp b/main/main.cpp index 16adee4bf6..e535da3e28 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -79,6 +79,7 @@ #include "performance.h" static GlobalConfig *globals=NULL; +static Engine *engine=NULL; static InputMap *input_map=NULL; static bool _start_success=false; static ScriptDebugger *script_debugger=NULL; @@ -195,6 +196,9 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas RID_OwnerBase::init_rid(); OS::get_singleton()->initialize_core(); + + engine = memnew( Engine ); + ClassDB::init(); MAIN_PRINT("Main: Initialize CORE"); @@ -235,7 +239,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas while (I) { I->get()=unescape_cmdline(I->get().strip_escapes()); -// print_line("CMD: "+I->get()); + //print_line("CMD: "+I->get()); I=I->next(); } @@ -499,7 +503,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas if (I->next()) { - OS::get_singleton()->set_time_scale(I->next()->get().to_double()); + Engine::get_singleton()->set_time_scale(I->next()->get().to_double()); N=I->next()->next(); } else { goto error; @@ -707,7 +711,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas input_map->load_from_globals(); //keys for game if (video_driver=="") // specified in engine.cfg - video_driver=_GLOBAL_DEF("display/driver/name",Variant((const char*)OS::get_singleton()->get_video_driver_name(0))); + video_driver=GLOBAL_DEF("display/driver/name",Variant((const char*)OS::get_singleton()->get_video_driver_name(0))); if (!force_res && use_custom_res && globals->has("display/window/width")) video_mode.width=globals->get("display/window/width"); @@ -742,7 +746,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas use_vsync = GLOBAL_DEF("display/window/use_vsync", use_vsync); GLOBAL_DEF("display/window/test_width",0); GLOBAL_DEF("display/window/test_height",0); - OS::get_singleton()->_pixel_snap=GLOBAL_DEF("rendering/2d/use_pixel_snap",false); + Engine::get_singleton()->_pixel_snap=GLOBAL_DEF("rendering/2d/use_pixel_snap",false); OS::get_singleton()->_keep_screen_on=GLOBAL_DEF("display/energy_saving/keep_screen_on",true); if (rtm==-1) { rtm=GLOBAL_DEF("rendering/threads/thread_model",OS::RENDER_THREAD_SAFE); @@ -819,8 +823,8 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas } - OS::get_singleton()->set_iterations_per_second(GLOBAL_DEF("physics/common/fixed_fps",60)); - OS::get_singleton()->set_target_fps(GLOBAL_DEF("debug/fps/force_fps",0)); + Engine::get_singleton()->set_iterations_per_second(GLOBAL_DEF("physics/common/fixed_fps",60)); + Engine::get_singleton()->set_target_fps(GLOBAL_DEF("debug/fps/force_fps",0)); GLOBAL_DEF("debug/stdout/print_fps", OS::get_singleton()->is_stdout_verbose()); @@ -831,7 +835,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas frame_delay=GLOBAL_DEF("application/frame_delay_msec",0); } - OS::get_singleton()->set_frame_delay(frame_delay); + Engine::get_singleton()->set_frame_delay(frame_delay); message_queue = memnew( MessageQueue ); @@ -862,6 +866,8 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas memdelete( translation_server ); if (globals) memdelete(globals); + if (engine) + memdelete(engine); if (script_debugger) memdelete(script_debugger); if (packed_data) @@ -873,10 +879,12 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas // Note 1: *zip_packed_data live into *packed_data // Note 2: PackedData::~PackedData destroy this. -//#ifdef MINIZIP_ENABLED -// if (zip_packed_data) -// memdelete( zip_packed_data ); -//#endif +/* +#ifdef MINIZIP_ENABLED + if (zip_packed_data) + memdelete( zip_packed_data ); +#endif +*/ unregister_core_driver_types(); unregister_core_types(); @@ -949,7 +957,7 @@ Error Main::setup2() { VisualServer::get_singleton()->set_boot_image(boot_logo, boot_bg,boot_logo_scale); #ifndef TOOLS_ENABLED //no tools, so free the boot logo (no longer needed) - // GlobalConfig::get_singleton()->set("application/boot_logo",Image()); + //GlobalConfig::get_singleton()->set("application/boot_logo",Image()); #endif } else { @@ -1003,7 +1011,7 @@ Error Main::setup2() { //print_line("use custom cursor"); Ref<Texture> cursor=ResourceLoader::load(GlobalConfig::get_singleton()->get("display/mouse_cursor/custom_image")); if (cursor.is_valid()) { - // print_line("loaded ok"); + //print_line("loaded ok"); Vector2 hotspot = GlobalConfig::get_singleton()->get("display/mouse_cursor/custom_image_hotspot"); Input::get_singleton()->set_custom_mouse_cursor(cursor,hotspot); } @@ -1096,7 +1104,7 @@ bool Main::start() { } else if (args[i]=="-script" || args[i]=="-s") { script=args[i+1]; } else if (args[i]=="-level" || args[i]=="-l") { - OS::get_singleton()->_custom_level=args[i+1]; + Engine::get_singleton()->_custom_level=args[i+1]; } else if (args[i]=="-test") { test=args[i+1]; } else if (args[i]=="-optimize") { @@ -1579,11 +1587,12 @@ bool Main::iteration() { uint64_t ticks_elapsed=ticks-last_ticks; double step=(double)ticks_elapsed / 1000000.0; - float frame_slice=1.0/OS::get_singleton()->get_iterations_per_second(); - -// if (time_accum+step < frame_slice) -// return false; + float frame_slice=1.0/Engine::get_singleton()->get_iterations_per_second(); + /* + if (time_accum+step < frame_slice) + return false; + */ uint64_t fixed_process_ticks=0; uint64_t idle_process_ticks=0; @@ -1597,13 +1606,13 @@ bool Main::iteration() { time_accum+=step; - float time_scale = OS::get_singleton()->get_time_scale(); + float time_scale = Engine::get_singleton()->get_time_scale(); bool exit=false; int iters = 0; - OS::get_singleton()->_in_fixed=true; + Engine::get_singleton()->_in_fixed=true; while(time_accum>frame_slice) { @@ -1629,16 +1638,18 @@ bool Main::iteration() { time_accum-=frame_slice; message_queue->flush(); - //if (AudioServer::get_singleton()) - // AudioServer::get_singleton()->update(); + /* + if (AudioServer::get_singleton()) + AudioServer::get_singleton()->update(); + */ fixed_process_ticks=MAX(fixed_process_ticks,OS::get_singleton()->get_ticks_usec()-fixed_begin); // keep the largest one for reference fixed_process_max=MAX(OS::get_singleton()->get_ticks_usec()-fixed_begin,fixed_process_max); iters++; - OS::get_singleton()->_fixed_frames++; + Engine::get_singleton()->_fixed_frames++; } - OS::get_singleton()->_in_fixed=false; + Engine::get_singleton()->_in_fixed=false; uint64_t idle_begin = OS::get_singleton()->get_ticks_usec(); @@ -1658,11 +1669,11 @@ bool Main::iteration() { if ((!force_redraw_requested) && OS::get_singleton()->is_in_low_processor_usage_mode()) { if (VisualServer::get_singleton()->has_changed()) { VisualServer::get_singleton()->draw(); // flush visual commands - OS::get_singleton()->frames_drawn++; + Engine::get_singleton()->frames_drawn++; } } else { VisualServer::get_singleton()->draw(); // flush visual commands - OS::get_singleton()->frames_drawn++; + Engine::get_singleton()->frames_drawn++; force_redraw_requested = false; } } @@ -1686,9 +1697,9 @@ bool Main::iteration() { } - // x11_delay_usec(10000); + //x11_delay_usec(10000); frames++; - OS::get_singleton()->_idle_frames++; + Engine::get_singleton()->_idle_frames++; if (frame>1000000) { @@ -1696,7 +1707,7 @@ bool Main::iteration() { print_line("FPS: "+itos(frames)); }; - OS::get_singleton()->_fps=frames; + Engine::get_singleton()->_fps=frames; performance->set_process_time(USEC_TO_SEC(idle_process_max)); performance->set_fixed_process_time(USEC_TO_SEC(fixed_process_max)); idle_process_max=0; @@ -1710,12 +1721,12 @@ bool Main::iteration() { if (OS::get_singleton()->is_in_low_processor_usage_mode() || !OS::get_singleton()->can_draw()) OS::get_singleton()->delay_usec(16600); //apply some delay to force idle time (results in about 60 FPS max) else { - uint32_t frame_delay = OS::get_singleton()->get_frame_delay(); + uint32_t frame_delay = Engine::get_singleton()->get_frame_delay(); if (frame_delay) - OS::get_singleton()->delay_usec( OS::get_singleton()->get_frame_delay()*1000 ); + OS::get_singleton()->delay_usec( Engine::get_singleton()->get_frame_delay()*1000 ); } - int target_fps = OS::get_singleton()->get_target_fps(); + int target_fps = Engine::get_singleton()->get_target_fps(); if (target_fps>0) { uint64_t time_step = 1000000L/target_fps; target_ticks += time_step; @@ -1777,6 +1788,8 @@ void Main::cleanup() { memdelete(path_remap); if (globals) memdelete(globals); + if (engine) + memdelete(engine); diff --git a/main/performance.cpp b/main/performance.cpp index 2ca73c6d4b..91df55a21c 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -118,7 +118,7 @@ String Performance::get_monitor_name(Monitor p_monitor) const { float Performance::get_monitor(Monitor p_monitor) const { switch(p_monitor) { - case TIME_FPS: return OS::get_singleton()->get_frames_per_second(); + case TIME_FPS: return Engine::get_singleton()->get_frames_per_second(); case TIME_PROCESS: return _process_time; case TIME_FIXED_PROCESS: return _fixed_process_time; case MEMORY_STATIC: return Memory::get_mem_usage(); diff --git a/main/tests/test_containers.cpp b/main/tests/test_containers.cpp index 4bc297d0ba..2711d107e4 100644 --- a/main/tests/test_containers.cpp +++ b/main/tests/test_containers.cpp @@ -55,7 +55,6 @@ MainLoop * test() { { -// static const int size = 16; Image img; img.create(default_mouse_cursor_xpm); @@ -78,7 +77,7 @@ MainLoop * test() { for (int i=0;i<1100;i++) { int num=i;//(int)Math::random(0,1024); - // print_line("inserting "+itos(num)); + //print_line("inserting "+itos(num)); set.insert( num ); } diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index 1ee27ec661..4f4e76d517 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -1026,7 +1026,7 @@ MainLoop* test(TestType p_test) { } else if (p_test==TEST_BYTECODE) { Vector<uint8_t> buf = GDTokenizerBuffer::parse_code_string(code); - String dst = test.basename()+".gdc"; + String dst = test.get_basename()+".gdc"; FileAccess *fw = FileAccess::open(dst,FileAccess::WRITE); fw->store_buffer(buf.ptr(),buf.size()); memdelete(fw); diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp index ab3df3b022..b0ebc20180 100644 --- a/main/tests/test_gui.cpp +++ b/main/tests/test_gui.cpp @@ -46,7 +46,7 @@ #include "scene/gui/tab_container.h" #include "scene/gui/tree.h" #include "scene/gui/rich_text_label.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "io/image_loader.h" #include "print_string.h" #include "scene/2d/sprite.h" @@ -97,7 +97,7 @@ public: Sprite *sp = memnew( Sprite ); sp->set_texture( vp->get_render_target_texture() ); -// sp->set_texture( ResourceLoader::load("res://ball.png") ); + //sp->set_texture( ResourceLoader::load("res://ball.png") ); sp->set_pos(Point2(300,300)); get_root()->add_child(sp); diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp index f3d9ddba87..89513b81d9 100644 --- a/main/tests/test_math.cpp +++ b/main/tests/test_math.cpp @@ -596,7 +596,7 @@ MainLoop* test() { { - // print_line("NUM: "+itos(237641278346127)); + //print_line("NUM: "+itos(237641278346127)); print_line("NUM: "+itos(-128)); return NULL; diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics.cpp index ea5b1cae85..ea98da34ca 100644 --- a/main/tests/test_physics.cpp +++ b/main/tests/test_physics.cpp @@ -358,9 +358,9 @@ public: gxf.basis.scale(Vector3(1.4,0.4,1.4)); gxf.origin=Vector3(-2,1,-2); make_grid(5,5,2.5,1,gxf); - // create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,gxf); + //create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,gxf); //create_static_plane( Plane( Vector3(0,1,0), -2) ); -// test_joint(); + //test_joint(); test_fall(); //test_joint(); diff --git a/main/tests/test_physics_2d.cpp b/main/tests/test_physics_2d.cpp index 2074d532b1..8a6a8c78f9 100644 --- a/main/tests/test_physics_2d.cpp +++ b/main/tests/test_physics_2d.cpp @@ -218,8 +218,10 @@ class TestPhysics2DMainLoop : public MainLoop { void _do_ray_query() { -// Physics2DServer *ps = Physics2DServer::get_singleton(); - // ps->query_intersection_segment(ray_query,ray_from,ray_to); + /* + Physics2DServer *ps = Physics2DServer::get_singleton(); + ps->query_intersection_segment(ray_query,ray_from,ray_to); + */ } @@ -273,7 +275,7 @@ protected: ps->body_set_continuous_collision_detection_mode(body,Physics2DServer::CCD_MODE_CAST_SHAPE); ps->body_set_state(body,Physics2DServer::BODY_STATE_TRANSFORM,p_xform); -// print_line("add body with xform: "+p_xform); + //print_line("add body with xform: "+p_xform); RID sprite = vs->canvas_item_create(); vs->canvas_item_set_parent(sprite,canvas); vs->canvas_item_set_transform(sprite,p_xform); @@ -281,8 +283,8 @@ protected: vs->canvas_item_add_texture_rect(sprite,Rect2(-imgsize/2.0,imgsize),body_shape_data[p_shape].image); ps->body_set_force_integration_callback(body,this,"_body_moved",sprite); -// RID q = ps->query_create(this,"_body_moved",sprite); -// ps->query_body_state(q,body); + //RID q = ps->query_create(this,"_body_moved",sprite); + //ps->query_body_state(q,body); return body; } @@ -409,10 +411,12 @@ public: }; Physics2DServer::ShapeType type = types[i%4]; -// type=Physics2DServer::SHAPE_SEGMENT; + //type=Physics2DServer::SHAPE_SEGMENT; _add_body(type,Transform2D(i*0.8,Point2(152+i*40,100-40*i))); - //if (i==0) - // ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC); + /* + if (i==0) + ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC); + */ } //RID b= _add_body(Physics2DServer::SHAPE_CIRCLE,Transform2D(0,Point2(101,140))); diff --git a/main/tests/test_render.cpp b/main/tests/test_render.cpp index 3049ba7d45..7380c1ff6a 100644 --- a/main/tests/test_render.cpp +++ b/main/tests/test_render.cpp @@ -192,7 +192,6 @@ public: */ RID lightaux; - //* lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL ); //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) ); vs->light_set_color( lightaux, Color(1.0,1.0,1.0) ); @@ -203,17 +202,14 @@ public: lla.set_look_at(Vector3(),Vector3(-0.000000,-0.836026,-0.548690),Vector3(0,1,0)); vs->instance_set_transform( light, lla ); - // */ - //* lightaux = vs->light_create( VisualServer::LIGHT_OMNI ); -// vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,1.0) ); + //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,1.0) ); vs->light_set_color( lightaux, Color(1.0,1.0,0.0) ); vs->light_set_param( lightaux, VisualServer::LIGHT_PARAM_RANGE, 4 ); vs->light_set_param( lightaux, VisualServer::LIGHT_PARAM_ENERGY, 8 ); //vs->light_set_shadow( lightaux, true ); //light = vs->instance_create( lightaux ); - // */ ofs=0; quit=false; diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp index d99ad4476f..a4a8ceb072 100644 --- a/main/tests/test_string.cpp +++ b/main/tests/test_string.cpp @@ -252,7 +252,7 @@ bool test_13() { /* how can i embed UTF in here? */ static const CharType ustr[] = { 0x304A , 0x360F, 0x3088, 0x3046, 0 }; -// static const wchar_t ustr[] = { 'P', 0xCE, 'p',0xD3, 0 }; + //static const wchar_t ustr[] = { 'P', 0xCE, 'p',0xD3, 0 }; String s=ustr; OS::get_singleton()->print("\tUnicode: %ls\n",ustr); diff --git a/modules/chibi/cp_loader_it_samples.cpp b/modules/chibi/cp_loader_it_samples.cpp index 60db9b7f74..c736c99c0f 100644 --- a/modules/chibi/cp_loader_it_samples.cpp +++ b/modules/chibi/cp_loader_it_samples.cpp @@ -147,7 +147,7 @@ CPLoader::Error CPLoader_IT::load_sample(CPSample *p_sample) { p_sample->set_sample_data(samp_id); if (!samp_id.is_null()) { - // printf("Loaded ID: stereo: %i len %i 16bit %i\n",CPSampleManager::get_singleton()->is_stereo(samp_id), CPSampleManager::get_singleton()->get_size( samp_id), CPSampleManager::get_singleton()->is_16bits( samp_id) ); + //printf("Loaded ID: stereo: %i len %i 16bit %i\n",CPSampleManager::get_singleton()->is_stereo(samp_id), CPSampleManager::get_singleton()->get_size( samp_id), CPSampleManager::get_singleton()->is_16bits( samp_id) ); } CP_ERR_COND_V( file->eof_reached(),FILE_CORRUPTED ); diff --git a/modules/chibi/cp_loader_mod.cpp b/modules/chibi/cp_loader_mod.cpp index 4a47ce5c43..cfa3e34736 100644 --- a/modules/chibi/cp_loader_mod.cpp +++ b/modules/chibi/cp_loader_mod.cpp @@ -208,7 +208,7 @@ CPLoader::Error CPLoader_MOD::load_song(const char *p_file,CPSong *p_song,bool p uint8_t order_count=file->get_byte(); -// uint8_t loop_to=file->get_byte(); + //uint8_t loop_to=file->get_byte(); int pattern_count=0; diff --git a/modules/chibi/cp_loader_s3m.cpp b/modules/chibi/cp_loader_s3m.cpp index eb5fad12e1..4943e6d86c 100644 --- a/modules/chibi/cp_loader_s3m.cpp +++ b/modules/chibi/cp_loader_s3m.cpp @@ -102,7 +102,7 @@ void CPLoader_S3M::set_header() { song->set_name( header.songname ); -// song->variables.filename= + //song->variables.filename= song->set_row_highlight_minor( 4 ); song->set_row_highlight_major( 16 ); @@ -135,7 +135,7 @@ CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) { uint32_t samplepos=(uint32_t)file->get_byte() << 16; samplepos|=file->get_word(); samplepos*=16; -// printf("sample at %i\n",samplepos); + //printf("sample at %i\n",samplepos); /**/ int sample_size=file->get_dword(); @@ -178,7 +178,7 @@ CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) { if ((type!=1) || scrs[0]!='S' || scrs[1]!='C' || scrs[2]!='R' || scrs[3]!='S' ) { -// printf("type: %i, %c%c%c%c\n",type,scrs[0],scrs[1],scrs[2],scrs[3]); + //printf("type: %i, %c%c%c%c\n",type,scrs[0],scrs[1],scrs[2],scrs[3]); CP_PRINTERR("Not an S3M CPSample!"); return FILE_CORRUPTED; } diff --git a/modules/chibi/cp_loader_xm.cpp b/modules/chibi/cp_loader_xm.cpp index 65c7bc7ee1..cbd883642c 100644 --- a/modules/chibi/cp_loader_xm.cpp +++ b/modules/chibi/cp_loader_xm.cpp @@ -399,7 +399,7 @@ CPLoader::Error CPLoader_XM::load_song(const char *p_file,CPSong *p_song,bool p_ instrument.set_name( instrname ); -// printf("Header Len: %i, CPInstrument %i, %i samples , name: s,\n",hsize,i,sampnum,instrname); + //printf("Header Len: %i, CPInstrument %i, %i samples , name: s,\n",hsize,i,sampnum,instrname); if (sampnum==0) { //aux=file->get_dword(); //Why is this for? -- for nothing, skipped diff --git a/modules/chibi/cp_player_data.h b/modules/chibi/cp_player_data.h index c59df5f0d9..2157319855 100644 --- a/modules/chibi/cp_player_data.h +++ b/modules/chibi/cp_player_data.h @@ -124,7 +124,7 @@ class CPPlayer { CPInstrument* instrument_ptr; CPSample* sample_ptr; -// Sample_Data *sample_data; + //Sample_Data *sample_data; int32_t period; diff --git a/modules/chibi/cp_player_data_effects.cpp b/modules/chibi/cp_player_data_effects.cpp index 6c774afb16..56fb7a2905 100644 --- a/modules/chibi/cp_player_data_effects.cpp +++ b/modules/chibi/cp_player_data_effects.cpp @@ -615,7 +615,7 @@ void CPPlayer::do_effect_S(int p_track) { break; case 8: {/* S8x set panning position */ -// if (pf->panflag) { + //if (pf->panflag) { if (inf<=8) inf<<=4; else inf*=17; control.channel[p_track].panning=control.channel[p_track].channel_panning=inf; diff --git a/modules/chibi/cp_player_data_events.cpp b/modules/chibi/cp_player_data_events.cpp index 7ec3f1931c..94a048ab2f 100644 --- a/modules/chibi/cp_player_data_events.cpp +++ b/modules/chibi/cp_player_data_events.cpp @@ -194,7 +194,7 @@ void CPPlayer::Voice_Control::update_info_from_master_channel() { reverb_send=master_channel->reverb_send; chorus_send=master_channel->chorus_send; -// last_note_type=master_channel->last_note_type; + //last_note_type=master_channel->last_note_type; sample_start_index=master_channel->sample_start_index; filter=master_channel->filter; @@ -262,7 +262,7 @@ void CPPlayer::update_mixer() { /* Start Envelopes */ if ( song->has_instruments() && ((v.kick==KICK_NOTE)||(v.kick==KICK_ENVELOPE))) { -// Voice_Control *carry=0; + //Voice_Control *carry=0; if (v.has_master_channel && v.master_channel->carry.maybe) { @@ -462,7 +462,7 @@ void CPPlayer::update_mixer() { } else { filter_env=pe_value+32; //max 64 -// printf("pitch envelope at %i",filter_env); + //printf("pitch envelope at %i",filter_env); } } @@ -602,17 +602,19 @@ void CPPlayer::handle_tick() { /* process pattern-delay. pf->patdly2 is the counter and pf->patdly is the command memory. */ -// if (control.pattern_delay_1) { - -// control.pattern_delay_2=control.pattern_delay_1; -// control.pattern_delay_1=0; -// } -// if (control.pattern_delay_2) { -// patterndelay active -// if (--control.pattern_delay_2) -// so turn back pf->patpos by 1 -// if (pf->patpos) pf->patpos--; -// } + /* + if (control.pattern_delay_1) { + + control.pattern_delay_2=control.pattern_delay_1; + control.pattern_delay_1=0; + } + if (control.pattern_delay_2) { + patterndelay active + if (--control.pattern_delay_2) + // so turn back pf->patpos by 1 + if (pf->patpos) pf->patpos--; + } + */ if (control.play_mode!=PLAY_NOTHING) { diff --git a/modules/chibi/cp_player_data_notes.cpp b/modules/chibi/cp_player_data_notes.cpp index 1bfe24bc20..189403343c 100644 --- a/modules/chibi/cp_player_data_notes.cpp +++ b/modules/chibi/cp_player_data_notes.cpp @@ -67,7 +67,7 @@ void CPPlayer::process_new_note(int p_track,uint8_t p_note) { // if there's real bool CPPlayer::process_new_instrument(int p_track,uint8_t p_instrument) { -// bool different_instrument=false; + //bool different_instrument=false; ERR_FAIL_INDEX_V(p_instrument,CPSong::MAX_INSTRUMENTS,false); if ( song->has_instruments() ) { diff --git a/modules/chibi/cp_player_data_utils.cpp b/modules/chibi/cp_player_data_utils.cpp index 1ee3f30b33..b99dbfcb99 100644 --- a/modules/chibi/cp_player_data_utils.cpp +++ b/modules/chibi/cp_player_data_utils.cpp @@ -111,8 +111,10 @@ int CPPlayer::find_empty_voice() { for (i=0;i<control.max_voices;i++) { /* allow us to take over a nonexisting sample */ -// if ((voice[i].s==NULL) -// return k; + /* + if ((voice[i].s==NULL) + return k; + */ if ((voice[i].kick==KICK_NOTHING)||(voice[i].kick==KICK_ENVELOPE)) { diff --git a/modules/chibi/event_stream_chibi.cpp b/modules/chibi/event_stream_chibi.cpp index 73d1c01e33..ab34080525 100644 --- a/modules/chibi/event_stream_chibi.cpp +++ b/modules/chibi/event_stream_chibi.cpp @@ -408,8 +408,8 @@ void CPMixerImpl::set_voice_chorus_send(int p_voice_index,int p_chorus){ void CPMixerImpl::set_reverb_mode(ReverbMode p_mode){ -// Voice &v=voices[p_voice_index]; -// ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL); + //Voice &v=voices[p_voice_index]; + //ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL); switch(p_mode) { case CPMixer::REVERB_MODE_STUDIO_SMALL: reverb_type=AudioMixer::REVERB_SMALL; break; case CPMixer::REVERB_MODE_STUDIO_MEDIUM: reverb_type=AudioMixer::REVERB_MEDIUM; break; @@ -422,8 +422,8 @@ void CPMixerImpl::set_reverb_mode(ReverbMode p_mode){ void CPMixerImpl::set_chorus_params(unsigned int p_delay_ms,unsigned int p_separation_ms,unsigned int p_depth_ms10,unsigned int p_speed_hz10){ -// Voice &v=voices[p_voice_index]; -// ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL); + //Voice &v=voices[p_voice_index]; + //ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL); } @@ -785,7 +785,7 @@ RES ResourceFormatLoaderChibi::load(const String &p_path, const String& p_origin if (r_error) *r_error=ERR_FILE_CANT_OPEN; - String el = p_path.extension().to_lower(); + String el = p_path.get_extension().to_lower(); CPFileAccessWrapperImpl f; @@ -849,7 +849,7 @@ bool ResourceFormatLoaderChibi::handles_type(const String& p_type) const { } String ResourceFormatLoaderChibi::get_resource_type(const String &p_path) const { - String el = p_path.extension().to_lower(); + String el = p_path.get_extension().to_lower(); if (el=="it" || el=="s3m" || el=="xm" || el=="mod") return "EventStreamChibi"; return ""; diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index 1de98a6b1f..5295183c35 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -221,7 +221,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, if (!(flags&DDSD_MIPMAPCOUNT)) mipmaps=1; -// print_line("found format: "+String(dds_format_info[dds_format].name)); + //print_line("found format: "+String(dds_format_info[dds_format].name)); PoolVector<uint8_t> src_data; @@ -478,7 +478,7 @@ bool ResourceFormatDDS::handles_type(const String& p_type) const { String ResourceFormatDDS::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="dds") + if (p_path.get_extension().to_lower()=="dds") return "ImageTexture"; return ""; } diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index 43d9988de1..d10634e9ea 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -506,8 +506,10 @@ uint32_t NetworkedMultiplayerENet::_gen_unique_id() const { (uint32_t)OS::get_singleton()->get_unix_time(), hash ); hash = hash_djb2_one_32( (uint32_t)OS::get_singleton()->get_data_dir().hash64(), hash ); - //hash = hash_djb2_one_32( - // (uint32_t)OS::get_singleton()->get_unique_ID().hash64(), hash ); + /* + hash = hash_djb2_one_32( + (uint32_t)OS::get_singleton()->get_unique_ID().hash64(), hash ); + */ hash = hash_djb2_one_32( (uint32_t)((uint64_t)this), hash ); //rely on aslr heap hash = hash_djb2_one_32( diff --git a/modules/etc1/image_etc.cpp b/modules/etc1/image_etc.cpp index 845084fef7..36ff1b86df 100644 --- a/modules/etc1/image_etc.cpp +++ b/modules/etc1/image_etc.cpp @@ -138,13 +138,13 @@ static void _compress_etc(Image *p_img) { uint8_t *dst = &w[dst_data.size()-mmsize]; -// print_line("bh: "+itos(bh)+" bw: "+itos(bw)); + //print_line("bh: "+itos(bh)+" bw: "+itos(bw)); for(int y=0;y<bh;y++) { for(int x=0;x<bw;x++) { -// print_line("x: "+itos(x)+" y: "+itos(y)); + //print_line("x: "+itos(x)+" y: "+itos(y)); uint8_t block[4*4*4]; zeromem(block,4*4*4); diff --git a/modules/etc1/texture_loader_pkm.cpp b/modules/etc1/texture_loader_pkm.cpp index 42c9937b8f..e720e1fb4c 100644 --- a/modules/etc1/texture_loader_pkm.cpp +++ b/modules/etc1/texture_loader_pkm.cpp @@ -78,7 +78,7 @@ bool ResourceFormatPKM::handles_type(const String& p_type) const { String ResourceFormatPKM::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="pkm") + if (p_path.get_extension().to_lower()=="pkm") return "ImageTexture"; return ""; } diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index 7483af298c..a5351a584b 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -1099,7 +1099,72 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo switch(cf->cf_type) { - + case GDParser::ControlFlowNode::CF_MATCH: { + GDParser::MatchNode *match = cf->match; + + GDParser::IdentifierNode *id = memnew(GDParser::IdentifierNode); + id->name = "#match_value"; + + // var #match_value + // copied because there is no _parse_statement :( + codegen.add_stack_identifier(id->name, p_stack_level++); + codegen.alloc_stack(p_stack_level); + new_identifiers++; + + GDParser::OperatorNode *op = memnew(GDParser::OperatorNode); + op->op=GDParser::OperatorNode::OP_ASSIGN; + op->arguments.push_back(id); + op->arguments.push_back(match->val_to_match); + + int ret = _parse_expression(codegen, op, p_stack_level); + if (ret < 0) { + return ERR_PARSE_ERROR; + } + + // break address + codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(codegen.opcodes.size() + 3); + int break_addr = codegen.opcodes.size(); + codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(0); // break addr + + for (int j = 0; j < match->compiled_pattern_branches.size(); j++) { + GDParser::MatchNode::CompiledPatternBranch branch = match->compiled_pattern_branches[j]; + + // jump over continue + // jump unconditionally + // continue address + // compile the condition + int ret = _parse_expression(codegen, branch.compiled_pattern, p_stack_level); + if (ret < 0) { + return ERR_PARSE_ERROR; + } + + codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF); + codegen.opcodes.push_back(ret); + codegen.opcodes.push_back(codegen.opcodes.size() + 3); + int continue_addr = codegen.opcodes.size(); + codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(0); + + + + Error err = _parse_block(codegen, branch.body, p_stack_level, p_break_addr, continue_addr); + if (err) { + return ERR_PARSE_ERROR; + } + + codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(break_addr); + + codegen.opcodes[continue_addr + 1] = codegen.opcodes.size(); + } + + codegen.opcodes[break_addr + 1] = codegen.opcodes.size(); + + + } break; + case GDParser::ControlFlowNode::CF_IF: { #ifdef DEBUG_ENABLED @@ -1420,9 +1485,10 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode * GDFunction *gdfunc=NULL; - //if (String(p_func->name)=="") { //initializer func - // gdfunc = &p_script->initializer; - + /* + if (String(p_func->name)=="") { //initializer func + gdfunc = &p_script->initializer; + */ //} else { //regular func p_script->member_functions[func_name]=memnew(GDFunction); gdfunc = p_script->member_functions[func_name]; @@ -1729,9 +1795,14 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa } + }else { + // without extends, implicitly extend Reference + int native_idx = GDScriptLanguage::get_singleton()->get_global_map()["Reference"]; + native = GDScriptLanguage::get_singleton()->get_global_array()[native_idx]; + ERR_FAIL_COND_V(native.is_null(), ERR_BUG); + p_script->native=native; } - //print_line("Script: "+p_script->get_path()+" indices: "+itos(p_script->member_indices.size())); diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 00b080190f..19472d3d46 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -364,10 +364,12 @@ static GDCompletionIdentifier _get_type_from_variant(const Variant& p_variant) { if (p_variant.get_type()==Variant::OBJECT) { Object *obj = p_variant; if (obj) { - //if (obj->cast_to<GDNativeClass>()) { - // t.obj_type=obj->cast_to<GDNativeClass>()->get_name(); - // t.value=Variant(); - //} else { + /* + if (obj->cast_to<GDNativeClass>()) { + t.obj_type=obj->cast_to<GDNativeClass>()->get_name(); + t.value=Variant(); + } else { + */ t.obj_type=obj->get_class(); //} } @@ -671,7 +673,7 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser:: if (!script.ends_with(".gd")) { //not a script, try find the script anyway, //may have some success - script=script.basename()+".gd"; + script=script.get_basename()+".gd"; } if (FileAccess::exists(script)) { @@ -1168,7 +1170,7 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const if (!script.ends_with(".gd")) { //not a script, try find the script anyway, //may have some success - script=script.basename()+".gd"; + script=script.get_basename()+".gd"; } if (FileAccess::exists(script)) { @@ -1771,7 +1773,7 @@ static void _find_type_arguments(GDCompletionContext& context,const GDParser::No String s = E->get().name; if (!s.begins_with("autoload/")) continue; - // print_line("found "+s); + //print_line("found "+s); String name = s.get_slice("/",1); result.insert("\"/root/"+name+"\""); } @@ -1998,10 +2000,10 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No List<MethodInfo> methods; ClassDB::get_method_list(type,&methods); for(List<MethodInfo>::Element *E=methods.front();E;E=E->next()) { - //if (E->get().arguments.size()) - // result.insert(E->get().name+"("); - //else - // result.insert(E->get().name+"()"); + if (E->get().arguments.size()) + result.insert(E->get().name+"("); + else + result.insert(E->get().name+"()"); }*/ } break; @@ -2832,7 +2834,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol if (!script.ends_with(".gd")) { //not a script, try find the script anyway, //may have some success - script=script.basename()+".gd"; + script=script.get_basename()+".gd"; } if (FileAccess::exists(script)) { diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 6aed7c9491..4a36fbb4f1 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -225,8 +225,8 @@ bool GDParser::_get_completable_identifier(CompletionType p_type,StringName& ide GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_allow_assign,bool p_parsing_constant) { -// Vector<Node*> expressions; -// Vector<OperatorNode::Operator> operators; + //Vector<Node*> expressions; + //Vector<OperatorNode::Operator> operators; Vector<Expression> expression; @@ -724,6 +724,7 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ }; Node *key=NULL; + Set<Variant> keys; DictExpect expecting=DICT_EXPECT_KEY; @@ -819,6 +820,16 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ return NULL; expecting=DICT_EXPECT_COMMA; + if (key->type == GDParser::Node::TYPE_CONSTANT) { + Variant const& keyName = static_cast<const GDParser::ConstantNode*>(key)->value; + + if (keys.has(keyName)) { + _set_error("Duplicate key found in Dictionary literal"); + return NULL; + } + keys.insert(keyName); + } + DictionaryNode::Pair pair; pair.key=key; pair.value=value; @@ -1679,6 +1690,542 @@ bool GDParser::_recover_from_completion() { return true; } +GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) +{ + + PatternNode *pattern = alloc_node<PatternNode>(); + + GDTokenizer::Token token = tokenizer->get_token(); + if (error_set) + return NULL; + + if (token == GDTokenizer::TK_EOF) { + return NULL; + } + + switch (token) { + // dictionary + case GDTokenizer::TK_BRACKET_OPEN: { + tokenizer->advance(); + pattern->pt_type = GDParser::PatternNode::PT_ARRAY; + while (true) { + + if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) { + tokenizer->advance(); + break; + } + + if (tokenizer->get_token() == GDTokenizer::TK_PERIOD && tokenizer->get_token(1) == GDTokenizer::TK_PERIOD) { + // match everything + tokenizer->advance(2); + PatternNode *sub_pattern = alloc_node<PatternNode>(); + sub_pattern->pt_type = GDParser::PatternNode::PT_IGNORE_REST; + pattern->array.push_back(sub_pattern); + if (tokenizer->get_token() == GDTokenizer::TK_COMMA && tokenizer->get_token(1) == GDTokenizer::TK_BRACKET_CLOSE) { + tokenizer->advance(2); + break; + } else if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) { + tokenizer->advance(1); + break; + } else { + _set_error("'..' pattern only allowed at the end of an array pattern"); + return NULL; + } + } + + PatternNode *sub_pattern = _parse_pattern(p_static); + if (!sub_pattern) { + return NULL; + } + + pattern->array.push_back(sub_pattern); + + if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + tokenizer->advance(); + continue; + } else if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) { + tokenizer->advance(); + break; + } else { + _set_error("Not a valid pattern"); + return NULL; + } + } + } break; + // bind + case GDTokenizer::TK_PR_VAR: { + tokenizer->advance(); + pattern->pt_type = GDParser::PatternNode::PT_BIND; + pattern->bind = tokenizer->get_token_identifier(); + tokenizer->advance(); + } break; + // array + case GDTokenizer::TK_CURLY_BRACKET_OPEN: { + tokenizer->advance(); + pattern->pt_type = GDParser::PatternNode::PT_DICTIONARY; + while (true) { + + if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) { + tokenizer->advance(); + break; + } + + if (tokenizer->get_token() == GDTokenizer::TK_PERIOD && tokenizer->get_token(1) == GDTokenizer::TK_PERIOD) { + // match everything + tokenizer->advance(2); + PatternNode *sub_pattern = alloc_node<PatternNode>(); + sub_pattern->pt_type = PatternNode::PT_IGNORE_REST; + pattern->array.push_back(sub_pattern); + if (tokenizer->get_token() == GDTokenizer::TK_COMMA && tokenizer->get_token(1) == GDTokenizer::TK_CURLY_BRACKET_CLOSE) { + tokenizer->advance(2); + break; + } else if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) { + tokenizer->advance(1); + break; + } else { + _set_error("'..' pattern only allowed at the end of an dictionary pattern"); + return NULL; + } + } + + Node *key = _parse_and_reduce_expression(pattern, p_static); + if (!key) { + _set_error("Not a valid key in pattern"); + return NULL; + } + + if (key->type != GDParser::Node::TYPE_CONSTANT) { + _set_error("Not a constant expression as key"); + return NULL; + } + + if (tokenizer->get_token() == GDTokenizer::TK_COLON) { + tokenizer->advance(); + + PatternNode *value = _parse_pattern(p_static); + if (!value) { + _set_error("Expected pattern in dictionary value"); + return NULL; + } + + pattern->dictionary.insert(static_cast<ConstantNode*>(key), value); + } else { + pattern->dictionary.insert(static_cast<ConstantNode*>(key), NULL); + } + + + if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + tokenizer->advance(); + continue; + } else if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) { + tokenizer->advance(); + break; + } else { + _set_error("Not a valid pattern"); + return NULL; + } + } + } break; + // all the constants like strings and numbers + default: { + Node *value = _parse_and_reduce_expression(pattern, p_static); + if (error_set) { + return NULL; + } + if (value->type == Node::TYPE_IDENTIFIER && static_cast<IdentifierNode*>(value)->name == "_") { + // wildcard pattern + pattern->pt_type = PatternNode::PT_WILDCARD; + break; + } + + if (value->type != Node::TYPE_IDENTIFIER && value->type != Node::TYPE_CONSTANT) { + _set_error("Only constant expressions or variables allowed in a pattern"); + return NULL; + } + + pattern->pt_type = PatternNode::PT_CONSTANT; + pattern->constant = value; + } break; + } + + return pattern; +} + +void GDParser::_parse_pattern_block(BlockNode *p_block, Vector<PatternBranchNode*> &p_branches, bool p_static) +{ + int indent_level = tab_level.back()->get(); + + while (true) { + + while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE && _parse_newline()); + + // GDTokenizer::Token token = tokenizer->get_token(); + if (error_set) + return; + + if (indent_level > tab_level.back()->get()) { + return; // go back a level + } + + if (pending_newline!=-1) { + pending_newline=-1; + } + + PatternBranchNode *branch = alloc_node<PatternBranchNode>(); + + branch->patterns.push_back(_parse_pattern(p_static)); + if (!branch->patterns[0]) { + return; + } + + while (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + tokenizer->advance(); + branch->patterns.push_back(_parse_pattern(p_static)); + if (!branch->patterns[branch->patterns.size() - 1]) { + return; + } + } + + if(!_enter_indent_block()) { + _set_error("Expected block in pattern branch"); + return; + } + + branch->body = alloc_node<BlockNode>(); + branch->body->parent_block = p_block; + p_block->sub_blocks.push_back(branch->body); + current_block = branch->body; + + _parse_block(branch->body, p_static); + + current_block = p_block; + + p_branches.push_back(branch); + } +} + + +void GDParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_match, Node *&p_resulting_node, Map<StringName, Node*> &p_bindings) +{ + switch (p_pattern->pt_type) { + case PatternNode::PT_CONSTANT: { + + // typecheck + BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>(); + typeof_node->function = GDFunctions::TYPE_OF; + + OperatorNode *typeof_match_value = alloc_node<OperatorNode>(); + typeof_match_value->op = OperatorNode::OP_CALL; + typeof_match_value->arguments.push_back(typeof_node); + typeof_match_value->arguments.push_back(p_node_to_match); + + OperatorNode *typeof_pattern_value = alloc_node<OperatorNode>(); + typeof_pattern_value->op = OperatorNode::OP_CALL; + typeof_pattern_value->arguments.push_back(typeof_node); + typeof_pattern_value->arguments.push_back(p_pattern->constant); + + OperatorNode *type_comp = alloc_node<OperatorNode>(); + type_comp->op = OperatorNode::OP_EQUAL; + type_comp->arguments.push_back(typeof_match_value); + type_comp->arguments.push_back(typeof_pattern_value); + + + // comare the actual values + OperatorNode *value_comp = alloc_node<OperatorNode>(); + value_comp->op = OperatorNode::OP_EQUAL; + value_comp->arguments.push_back(p_pattern->constant); + value_comp->arguments.push_back(p_node_to_match); + + + OperatorNode *comparison = alloc_node<OperatorNode>(); + comparison->op = OperatorNode::OP_AND; + comparison->arguments.push_back(type_comp); + comparison->arguments.push_back(value_comp); + + p_resulting_node = comparison; + + } break; + case PatternNode::PT_BIND: { + p_bindings[p_pattern->bind] = p_node_to_match; + + // a bind always matches + ConstantNode *true_value = alloc_node<ConstantNode>(); + true_value->value = Variant(true); + p_resulting_node = true_value; + } break; + case PatternNode::PT_ARRAY: { + + bool open_ended = false; + + if (p_pattern->array.size() > 0) { + if (p_pattern->array[p_pattern->array.size() - 1]->pt_type == PatternNode::PT_IGNORE_REST) { + open_ended = true; + } + } + + // typeof(value_to_match) == TYPE_ARRAY && value_to_match.size() >= length + // typeof(value_to_match) == TYPE_ARRAY && value_to_match.size() == length + + { + // typecheck + BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>(); + typeof_node->function = GDFunctions::TYPE_OF; + + OperatorNode *typeof_match_value = alloc_node<OperatorNode>(); + typeof_match_value->op = OperatorNode::OP_CALL; + typeof_match_value->arguments.push_back(typeof_node); + typeof_match_value->arguments.push_back(p_node_to_match); + + IdentifierNode *typeof_array = alloc_node<IdentifierNode>(); + typeof_array->name = "TYPE_ARRAY"; + + OperatorNode *type_comp = alloc_node<OperatorNode>(); + type_comp->op = OperatorNode::OP_EQUAL; + type_comp->arguments.push_back(typeof_match_value); + type_comp->arguments.push_back(typeof_array); + + + // size + ConstantNode *length = alloc_node<ConstantNode>(); + length->value = Variant(open_ended ? p_pattern->array.size() - 1 : p_pattern->array.size()); + + OperatorNode *call = alloc_node<OperatorNode>(); + call->op = OperatorNode::OP_CALL; + call->arguments.push_back(p_node_to_match); + + IdentifierNode *size = alloc_node<IdentifierNode>(); + size->name = "size"; + call->arguments.push_back(size); + + OperatorNode *length_comparison = alloc_node<OperatorNode>(); + length_comparison->op = open_ended ? OperatorNode::OP_GREATER_EQUAL : OperatorNode::OP_EQUAL; + length_comparison->arguments.push_back(call); + length_comparison->arguments.push_back(length); + + OperatorNode *type_and_length_comparison = alloc_node<OperatorNode>(); + type_and_length_comparison->op = OperatorNode::OP_AND; + type_and_length_comparison->arguments.push_back(type_comp); + type_and_length_comparison->arguments.push_back(length_comparison); + + p_resulting_node = type_and_length_comparison; + } + + + + for (int i = 0; i < p_pattern->array.size(); i++) { + PatternNode *pattern = p_pattern->array[i]; + + Node *condition = NULL; + + ConstantNode *index = alloc_node<ConstantNode>(); + index->value = Variant(i); + + OperatorNode *indexed_value = alloc_node<OperatorNode>(); + indexed_value->op = OperatorNode::OP_INDEX; + indexed_value->arguments.push_back(p_node_to_match); + indexed_value->arguments.push_back(index); + + _generate_pattern(pattern, indexed_value, condition, p_bindings); + + // concatenate all the patterns with && + OperatorNode *and_node = alloc_node<OperatorNode>(); + and_node->op = OperatorNode::OP_AND; + and_node->arguments.push_back(p_resulting_node); + and_node->arguments.push_back(condition); + + p_resulting_node = and_node; + } + + + } break; + case PatternNode::PT_DICTIONARY: { + + bool open_ended = false; + + if (p_pattern->array.size() > 0) { + open_ended = true; + } + + // typeof(value_to_match) == TYPE_DICTIONARY && value_to_match.size() >= length + // typeof(value_to_match) == TYPE_DICTIONARY && value_to_match.size() == length + + + { + // typecheck + BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>(); + typeof_node->function = GDFunctions::TYPE_OF; + + OperatorNode *typeof_match_value = alloc_node<OperatorNode>(); + typeof_match_value->op = OperatorNode::OP_CALL; + typeof_match_value->arguments.push_back(typeof_node); + typeof_match_value->arguments.push_back(p_node_to_match); + + IdentifierNode *typeof_dictionary = alloc_node<IdentifierNode>(); + typeof_dictionary->name = "TYPE_DICTIONARY"; + + OperatorNode *type_comp = alloc_node<OperatorNode>(); + type_comp->op = OperatorNode::OP_EQUAL; + type_comp->arguments.push_back(typeof_match_value); + type_comp->arguments.push_back(typeof_dictionary); + + // size + ConstantNode *length = alloc_node<ConstantNode>(); + length->value = Variant(open_ended ? p_pattern->dictionary.size() - 1 : p_pattern->dictionary.size()); + + OperatorNode *call = alloc_node<OperatorNode>(); + call->op = OperatorNode::OP_CALL; + call->arguments.push_back(p_node_to_match); + + IdentifierNode *size = alloc_node<IdentifierNode>(); + size->name = "size"; + call->arguments.push_back(size); + + OperatorNode *length_comparison = alloc_node<OperatorNode>(); + length_comparison->op = open_ended ? OperatorNode::OP_GREATER_EQUAL : OperatorNode::OP_EQUAL; + length_comparison->arguments.push_back(call); + length_comparison->arguments.push_back(length); + + OperatorNode *type_and_length_comparison = alloc_node<OperatorNode>(); + type_and_length_comparison->op = OperatorNode::OP_AND; + type_and_length_comparison->arguments.push_back(type_comp); + type_and_length_comparison->arguments.push_back(length_comparison); + + p_resulting_node = type_and_length_comparison; + } + + + + for (Map<ConstantNode*, PatternNode*>::Element *e = p_pattern->dictionary.front(); e; e = e->next()) { + + Node *condition = NULL; + + // chech for has, then for pattern + + IdentifierNode *has = alloc_node<IdentifierNode>(); + has->name = "has"; + + OperatorNode *has_call = alloc_node<OperatorNode>(); + has_call->op = OperatorNode::OP_CALL; + has_call->arguments.push_back(p_node_to_match); + has_call->arguments.push_back(has); + has_call->arguments.push_back(e->key()); + + + if (e->value()) { + + OperatorNode *indexed_value = alloc_node<OperatorNode>(); + indexed_value->op = OperatorNode::OP_INDEX; + indexed_value->arguments.push_back(p_node_to_match); + indexed_value->arguments.push_back(e->key()); + + _generate_pattern(e->value(), indexed_value, condition, p_bindings); + + OperatorNode *has_and_pattern = alloc_node<OperatorNode>(); + has_and_pattern->op = OperatorNode::OP_AND; + has_and_pattern->arguments.push_back(has_call); + has_and_pattern->arguments.push_back(condition); + + condition = has_and_pattern; + + } else { + condition = has_call; + } + + + + // concatenate all the patterns with && + OperatorNode *and_node = alloc_node<OperatorNode>(); + and_node->op = OperatorNode::OP_AND; + and_node->arguments.push_back(p_resulting_node); + and_node->arguments.push_back(condition); + + p_resulting_node = and_node; + } + + } break; + case PatternNode::PT_IGNORE_REST: + case PatternNode::PT_WILDCARD: { + // simply generate a `true` + ConstantNode *true_value = alloc_node<ConstantNode>(); + true_value->value = Variant(true); + p_resulting_node = true_value; + } break; + default: { + + } break; + } +} + +void GDParser::_transform_match_statment(BlockNode *p_block, MatchNode *p_match_statement) +{ + IdentifierNode *id = alloc_node<IdentifierNode>(); + id->name = "#match_value"; + + for (int i = 0; i < p_match_statement->branches.size(); i++) { + + PatternBranchNode *branch = p_match_statement->branches[i]; + + MatchNode::CompiledPatternBranch compiled_branch; + compiled_branch.compiled_pattern = NULL; + + Map<StringName, Node*> binding; + + for (int j = 0; j < branch->patterns.size(); j++) { + PatternNode *pattern = branch->patterns[j]; + + Map<StringName, Node*> bindings; + Node *resulting_node; + _generate_pattern(pattern, id, resulting_node, bindings); + + if (!binding.empty() && !bindings.empty()) { + _set_error("Multipatterns can't contain bindings"); + return; + } else { + binding = bindings; + } + + if (compiled_branch.compiled_pattern) { + OperatorNode *or_node = alloc_node<OperatorNode>(); + or_node->op = OperatorNode::OP_OR; + or_node->arguments.push_back(compiled_branch.compiled_pattern); + or_node->arguments.push_back(resulting_node); + + compiled_branch.compiled_pattern = or_node; + } else { + // single pattern | first one + compiled_branch.compiled_pattern = resulting_node; + } + + } + + + // prepare the body ...hehe + for (Map<StringName, Node*>::Element *e = binding.front(); e; e = e->next()) { + LocalVarNode *local_var = alloc_node<LocalVarNode>(); + local_var->name = e->key(); + local_var->assign = e->value(); + + + IdentifierNode *id = alloc_node<IdentifierNode>(); + id->name = local_var->name; + + OperatorNode *op = alloc_node<OperatorNode>(); + op->op=OperatorNode::OP_ASSIGN; + op->arguments.push_back(id); + op->arguments.push_back(local_var->assign); + + branch->body->statements.push_front(op); + branch->body->statements.push_front(local_var); + } + + compiled_branch.body = branch->body; + + + p_match_statement->compiled_pattern_branches.push_back(compiled_branch); + } + +} + void GDParser::_parse_block(BlockNode *p_block,bool p_static) { int indent_level = tab_level.back()->get(); @@ -1762,6 +2309,24 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { } StringName n = tokenizer->get_token_identifier(); tokenizer->advance(); + if (current_function){ + for (int i=0;i<current_function->arguments.size();i++){ + if (n == current_function->arguments[i]){ + _set_error("Variable '"+String(n)+"' already defined in the scope (at line: "+itos(current_function->line)+")."); + return; + } + } + } + BlockNode *check_block = p_block; + while (check_block){ + for (int i=0;i<check_block->variables.size();i++){ + if (n == check_block->variables[i]){ + _set_error("Variable '"+String(n)+"' already defined in the scope (at line: "+itos(check_block->variable_lines[i])+")."); + return; + } + } + check_block = check_block->parent_block; + } p_block->variables.push_back(n); //line? p_block->variable_lines.push_back(tokenizer->get_token_line()); @@ -2079,7 +2644,14 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { } current_block=cf_for->body; + + // this is for checking variable for redefining + // inside this _parse_block + cf_for->body->variables.push_back(id->name); + cf_for->body->variable_lines.push_back(id->line); _parse_block(cf_for->body,p_static); + cf_for->body->variables.remove(0); + cf_for->body->variable_lines.remove(0); current_block=p_block; if (error_set) @@ -2141,6 +2713,46 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { } break; + case GDTokenizer::TK_CF_MATCH: { + + tokenizer->advance(); + + MatchNode *match_node = alloc_node<MatchNode>(); + + Node *val_to_match = _parse_and_reduce_expression(p_block, p_static); + + if (!val_to_match) { + if (_recover_from_completion()) { + break; + } + return; + } + + match_node->val_to_match = val_to_match; + + if (!_enter_indent_block()) { + _set_error("Expected indented pattern matching block after 'match'"); + return; + } + + BlockNode *compiled_branches = alloc_node<BlockNode>(); + compiled_branches->parent_block = p_block; + compiled_branches->parent_class = p_block->parent_class; + + p_block->sub_blocks.push_back(compiled_branches); + + _parse_pattern_block(compiled_branches, match_node->branches, p_static); + + _transform_match_statment(compiled_branches, match_node); + + ControlFlowNode *match_cf_node = alloc_node<ControlFlowNode>(); + match_cf_node->cf_type = ControlFlowNode::CF_MATCH; + match_cf_node->match = match_node; + + p_block->statements.push_back(match_cf_node); + + _end_statement(); + } break; case GDTokenizer::TK_PR_ASSERT: { tokenizer->advance(); diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h index e8f5f0f981..7968bf85df 100644 --- a/modules/gdscript/gd_parser.h +++ b/modules/gdscript/gd_parser.h @@ -258,6 +258,44 @@ public: Vector<Node*> arguments; OperatorNode() { type=TYPE_OPERATOR; } }; + + + struct PatternNode : public Node { + + enum PatternType { + PT_CONSTANT, + PT_BIND, + PT_DICTIONARY, + PT_ARRAY, + PT_IGNORE_REST, + PT_WILDCARD + }; + + PatternType pt_type; + + Node *constant; + StringName bind; + Map<ConstantNode*, PatternNode*> dictionary; + Vector<PatternNode*> array; + + }; + + struct PatternBranchNode : public Node { + Vector<PatternNode*> patterns; + BlockNode *body; + }; + + struct MatchNode : public Node { + Node *val_to_match; + Vector<PatternBranchNode*> branches; + + struct CompiledPatternBranch { + Node *compiled_pattern; + BlockNode *body; + }; + + Vector<CompiledPatternBranch> compiled_pattern_branches; + }; struct ControlFlowNode : public Node { enum CFType { @@ -267,13 +305,16 @@ public: CF_SWITCH, CF_BREAK, CF_CONTINUE, - CF_RETURN + CF_RETURN, + CF_MATCH }; CFType cf_type; Vector<Node*> arguments; BlockNode *body; BlockNode *body_else; + + MatchNode *match; ControlFlowNode *_else; //used for if ControlFlowNode() { type=TYPE_CONTROL_FLOW; cf_type=CF_IF; body=NULL; body_else=NULL;} @@ -452,6 +493,15 @@ private: Node* _reduce_expression(Node *p_node,bool p_to_const=false); Node* _parse_and_reduce_expression(Node *p_parent,bool p_static,bool p_reduce_const=false,bool p_allow_assign=false); + + + + PatternNode *_parse_pattern(bool p_static); + void _parse_pattern_block(BlockNode *p_block, Vector<PatternBranchNode*> &p_branches, bool p_static); + void _transform_match_statment(BlockNode *p_block, MatchNode *p_match_statement); + void _generate_pattern(PatternNode *p_pattern, Node *p_node_to_match, Node *&p_resulting_node, Map<StringName, Node*> &p_bindings); + + void _parse_block(BlockNode *p_block,bool p_static); void _parse_extends(ClassNode *p_class); void _parse_class(ClassNode *p_class); diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 0b81780b0c..d9a3dd13f0 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -160,6 +160,8 @@ Variant GDScript::_new(const Variant** p_args,int p_argcount,Variant::CallError& _baseptr=_baseptr->_base; } + ERR_FAIL_COND_V(_baseptr->native.is_null(), Variant()); + if (_baseptr->native.ptr()) { owner=_baseptr->native->instance(); } else { @@ -356,9 +358,11 @@ bool GDScript::get_property_default_value(const StringName& p_property, Variant #ifdef TOOLS_ENABLED - //for (const Map<StringName,Variant>::Element *I=member_default_values.front();I;I=I->next()) { - // print_line("\t"+String(String(I->key())+":"+String(I->get()))); - //} + /* + for (const Map<StringName,Variant>::Element *I=member_default_values.front();I;I=I->next()) { + print_line("\t"+String(String(I->key())+":"+String(I->get()))); + } + */ const Map<StringName,Variant>::Element *E=member_default_values_cache.find(p_property); if (E) { r_value=E->get(); @@ -1860,7 +1864,7 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script>& p_script,bool p_sof void GDScriptLanguage::frame() { - // print_line("calls: "+itos(calls)); + //print_line("calls: "+itos(calls)); calls=0; #ifdef DEBUG_ENABLED @@ -1934,6 +1938,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const { "for", "pass", "return", + "match", "while", "remote", "sync", @@ -2066,7 +2071,7 @@ bool ResourceFormatLoaderGDScript::handles_type(const String& p_type) const { String ResourceFormatLoaderGDScript::get_resource_type(const String &p_path) const { - String el = p_path.extension().to_lower(); + String el = p_path.get_extension().to_lower(); if (el=="gd" || el=="gdc" || el=="gde") return "GDScript"; return ""; diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 960b06f3ff..4d3baa5bc0 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -139,7 +139,7 @@ protected: void _get_property_list(List<PropertyInfo> *p_properties) const; Variant call(const StringName& p_method,const Variant** p_args,int p_argcount,Variant::CallError &r_error); -// void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount); + //void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount); static void _bind_methods(); public: diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 30ac988295..70fc991bcc 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -85,6 +85,7 @@ const char* GDTokenizer::token_names[TK_MAX]={ "continue", "pass", "return", +"match", "func", "class", "extends", @@ -513,9 +514,11 @@ void GDTokenizerText::_advance() { if (GETCHAR(1)=='=') { _make_token(TK_OP_ASSIGN_ADD); INCPOS(1); - //} else if (GETCHAR(1)=='+') { - // _make_token(TK_OP_PLUS_PLUS); - // INCPOS(1); + /* + } else if (GETCHAR(1)=='+') { + _make_token(TK_OP_PLUS_PLUS); + INCPOS(1); + */ } else { _make_token(TK_OP_ADD); } @@ -526,9 +529,11 @@ void GDTokenizerText::_advance() { if (GETCHAR(1)=='=') { _make_token(TK_OP_ASSIGN_SUB); INCPOS(1); - //} else if (GETCHAR(1)=='-') { - // _make_token(TK_OP_MINUS_MINUS); - // INCPOS(1); + /* + } else if (GETCHAR(1)=='-') { + _make_token(TK_OP_MINUS_MINUS); + INCPOS(1); + */ } else { _make_token(TK_OP_SUB); } @@ -890,6 +895,7 @@ void GDTokenizerText::_advance() { {TK_CF_BREAK,"break"}, {TK_CF_CONTINUE,"continue"}, {TK_CF_RETURN,"return"}, + {TK_CF_MATCH, "match"}, {TK_CF_PASS,"pass"}, {TK_SELF,"self"}, {TK_CONST_PI,"PI"}, diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h index 18e5547d36..9a6f4df9c4 100644 --- a/modules/gdscript/gd_tokenizer.h +++ b/modules/gdscript/gd_tokenizer.h @@ -92,6 +92,7 @@ public: TK_CF_CONTINUE, TK_CF_PASS, TK_CF_RETURN, + TK_CF_MATCH, TK_PR_FUNCTION, TK_PR_CLASS, TK_PR_EXTENDS, diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 11bdf783f8..051d1d85cd 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -100,7 +100,7 @@ public: if (err==OK) { fae->store_buffer(file.ptr(),file.size()); - p_path=p_path.basename()+".gde"; + p_path=p_path.get_basename()+".gde"; } memdelete(fae); @@ -111,7 +111,7 @@ public: } else { - p_path=p_path.basename()+".gdc"; + p_path=p_path.get_basename()+".gdc"; return file; } } diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index b5fa55846c..271db4babc 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -731,7 +731,7 @@ void GridMap::_octant_update(const OctantKey &p_key) { ii.shape->add_vertices_to_array(col_debug,xform); } - // print_line("PHIS x: "+xform); + //print_line("PHIS x: "+xform); } // add the item's navmesh at given xform to GridMap's Navigation ancestor @@ -796,7 +796,7 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) { for(Map<int,Octant::ItemInstances>::Element *E=g.items.front();E;E=E->next()) { VS::get_singleton()->instance_set_scenario(E->get().multimesh_instance,RID()); - // VS::get_singleton()->instance_set_transform(E->get().multimesh_instance,get_global_transform()); + //VS::get_singleton()->instance_set_transform(E->get().multimesh_instance,get_global_transform()); VS::get_singleton()->instance_set_room(E->get().multimesh_instance,RID()); } @@ -1001,8 +1001,8 @@ void GridMap::_notification(int p_what) { _update_area_instances(); for(Map<OctantKey,Octant*>::Element *E=octant_map.front();E;E=E->next()) { -// IndexKey ik; -// ik.key = E->key().indexkey; + //IndexKey ik; + //ik.key = E->key().indexkey; _octant_enter_world(E->key()); _octant_update(E->key()); } @@ -1201,7 +1201,7 @@ void GridMap::_bind_methods() { ClassDB::bind_method(_MD("get_cell_item","x","y","z"),&GridMap::get_cell_item); ClassDB::bind_method(_MD("get_cell_item_orientation","x","y","z"),&GridMap::get_cell_item_orientation); -// ClassDB::bind_method(_MD("_recreate_octants"),&GridMap::_recreate_octants); + //ClassDB::bind_method(_MD("_recreate_octants"),&GridMap::_recreate_octants); ClassDB::bind_method(_MD("_update_dirty_map_callback"),&GridMap::_update_dirty_map_callback); ClassDB::bind_method(_MD("resource_changed","resource"),&GridMap::resource_changed); @@ -1706,10 +1706,12 @@ void GridMap::bake_geometry() { void GridMap::_baked_light_changed() { -// if (!baked_light_instance) -// VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID()); -// else -// VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance()); + /* + if (!baked_light_instance) + VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID()); + else + VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance()); + */ for(Map<OctantKey,Octant*>::Element *E=octant_map.front();E;E=E->next()) { for(Map<int,Octant::ItemInstances>::Element *F=E->get()->items.front();F;F=F->next()) { @@ -1831,6 +1833,7 @@ GridMap::GridMap() { use_baked_light=false; navigation = NULL; + set_notify_transform(true); } diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp index 140ea1b9e7..43a1f610d8 100644 --- a/modules/openssl/stream_peer_openssl.cpp +++ b/modules/openssl/stream_peer_openssl.cpp @@ -35,8 +35,8 @@ bool StreamPeerOpenSSL::_match_host_name(const char *name, const char *hostname) { return Tool_Curl_cert_hostcheck(name,hostname)==CURL_HOST_MATCH; -// print_line("MATCH: "+String(name)+" vs "+String(hostname)); -// return true; + //print_line("MATCH: "+String(name)+" vs "+String(hostname)); + //return true; } Error StreamPeerOpenSSL::_match_common_name(const char *hostname, const X509 *server_cert) { @@ -293,10 +293,10 @@ BIO_METHOD StreamPeerOpenSSL::_bio_method = { _bio_destroy }; -Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs, const String& p_for_hostname) { +Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String& p_for_hostname) { if (connected) - disconnect(); + disconnect_from_stream(); hostname=p_for_hostname; @@ -415,7 +415,7 @@ Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs, return OK; } -Error StreamPeerOpenSSL::accept(Ref<StreamPeer> p_base) { +Error StreamPeerOpenSSL::accept_stream(Ref<StreamPeer> p_base) { return ERR_UNAVAILABLE; @@ -451,7 +451,7 @@ Error StreamPeerOpenSSL::put_data(const uint8_t* p_data,int p_bytes) { int ret = SSL_write(ssl,p_data,p_bytes); if (ret<=0) { _print_error(ret); - disconnect(); + disconnect_from_stream(); return ERR_CONNECTION_ERROR; } p_data+=ret; @@ -486,7 +486,7 @@ Error StreamPeerOpenSSL::get_data(uint8_t* p_buffer, int p_bytes){ int ret = SSL_read(ssl,p_buffer,p_bytes); if (ret<=0) { _print_error(ret); - disconnect(); + disconnect_from_stream(); return ERR_CONNECTION_ERROR; } p_buffer+=ret; @@ -529,7 +529,7 @@ StreamPeerOpenSSL::StreamPeerOpenSSL() { flags=0; } -void StreamPeerOpenSSL::disconnect() { +void StreamPeerOpenSSL::disconnect_from_stream() { if (!connected) return; @@ -552,7 +552,7 @@ StreamPeerOpenSSL::Status StreamPeerOpenSSL::get_status() const { StreamPeerOpenSSL::~StreamPeerOpenSSL() { - disconnect(); + disconnect_from_stream(); } StreamPeerSSL* StreamPeerOpenSSL::_create_func() { diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h index d79fb97ff8..3d6875698c 100644 --- a/modules/openssl/stream_peer_openssl.h +++ b/modules/openssl/stream_peer_openssl.h @@ -85,11 +85,11 @@ protected: public: - virtual Error accept(Ref<StreamPeer> p_base); - virtual Error connect(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String()); + virtual Error accept_stream(Ref<StreamPeer> p_base); + virtual Error connect_to_stream(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String()); virtual Status get_status() const; - virtual void disconnect(); + virtual void disconnect_from_stream(); virtual Error put_data(const uint8_t* p_data,int p_bytes); virtual Error put_partial_data(const uint8_t* p_data,int p_bytes, int &r_sent); diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp index f438dde689..4a6b2e224c 100644 --- a/modules/opus/audio_stream_opus.cpp +++ b/modules/opus/audio_stream_opus.cpp @@ -366,7 +366,7 @@ void ResourceFormatLoaderAudioStreamOpus::get_recognized_extensions(List<String> } String ResourceFormatLoaderAudioStreamOpus::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="opus") + if (p_path.get_extension().to_lower()=="opus") return "AudioStreamOpus"; return ""; } diff --git a/modules/pbm/bitmap_loader_pbm.cpp b/modules/pbm/bitmap_loader_pbm.cpp index 6caaf10334..ab0805a6b0 100644 --- a/modules/pbm/bitmap_loader_pbm.cpp +++ b/modules/pbm/bitmap_loader_pbm.cpp @@ -244,7 +244,7 @@ bool ResourceFormatPBM::handles_type(const String& p_type) const { } String ResourceFormatPBM::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="pbm") + if (p_path.get_extension().to_lower()=="pbm") return "BitMap"; return ""; } diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 9f8db98e05..0d8cabb331 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -185,7 +185,7 @@ bool ResourceFormatPVR::handles_type(const String& p_type) const { String ResourceFormatPVR::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="pvr") + if (p_path.get_extension().to_lower()=="pvr") return "Texture"; return ""; } @@ -669,9 +669,11 @@ static void decompress_pvrtc(PVRTCBlock *p_comp_img, const int p_2bit, const int static void _pvrtc_decompress(Image* p_img) { -// static void decompress_pvrtc(const void *p_comp_img, const int p_2bit, const int p_width, const int p_height, unsigned char* p_dst) { -// decompress_pvrtc((PVRTCBlock*)p_comp_img,p_2bit,p_width,p_height,1,p_dst); -// } + /* + static void decompress_pvrtc(const void *p_comp_img, const int p_2bit, const int p_width, const int p_height, unsigned char* p_dst) { + decompress_pvrtc((PVRTCBlock*)p_comp_img,p_2bit,p_width,p_height,1,p_dst); + } + */ ERR_FAIL_COND( p_img->get_format()!=Image::FORMAT_PVRTC2 && p_img->get_format()!=Image::FORMAT_PVRTC2A && p_img->get_format()!=Image::FORMAT_PVRTC4 && p_img->get_format()!=Image::FORMAT_PVRTC4A); @@ -687,9 +689,11 @@ static void _pvrtc_decompress(Image* p_img) { decompress_pvrtc((PVRTCBlock*)r.ptr(),_2bit,p_img->get_width(),p_img->get_height(),0,(unsigned char*)w.ptr()); - //for(int i=0;i<newdata.size();i++) { - // print_line(itos(w[i])); - //} + /* + for(int i=0;i<newdata.size();i++) { + print_line(itos(w[i])); + } + */ w=PoolVector<uint8_t>::Write(); r=PoolVector<uint8_t>::Read(); diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index b847f17bb7..9d2dfc7f56 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -81,6 +81,9 @@ void VideoStreamPlaybackTheora::video_write(void){ th_ycbcr_buffer yuv; th_decode_ycbcr_out(td,yuv); + // FIXME: The way stuff is commented out with `//*/` closing comments + // sounds very fishy... + /* int y_offset, uv_offset; y_offset=(ti.pic_x&~1)+yuv[0].stride*(ti.pic_y&~1); @@ -105,7 +108,7 @@ void VideoStreamPlaybackTheora::video_write(void){ } format = Image::FORMAT_RGBA8; } - // */ + //*/ //* @@ -228,7 +231,7 @@ void VideoStreamPlaybackTheora::video_write(void){ format = Image::FORMAT_YUV_422; }; }; - // */ + //*/ frames_pending = 1; } @@ -598,7 +601,7 @@ void VideoStreamPlaybackTheora::update(float p_delta) { if (vd.granulepos>=0) { - // print_line("wrote: "+itos(audio_frames_wrote)+" gpos: "+itos(vd.granulepos)); + //print_line("wrote: "+itos(audio_frames_wrote)+" gpos: "+itos(vd.granulepos)); } //print_line("mix audio!"); @@ -933,7 +936,7 @@ bool ResourceFormatLoaderVideoStreamTheora::handles_type(const String& p_type) c String ResourceFormatLoaderVideoStreamTheora::get_resource_type(const String &p_path) const { - String exl=p_path.extension().to_lower(); + String exl=p_path.get_extension().to_lower(); if (exl=="ogm" || exl=="ogv") return "VideoStreamTheora"; return ""; diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp index 79bf3d50b2..5fe87a4956 100644 --- a/modules/visual_script/register_types.cpp +++ b/modules/visual_script/register_types.cpp @@ -82,7 +82,7 @@ void register_visual_script_types() { ClassDB::register_class<VisualScriptFunctionCall>(); ClassDB::register_class<VisualScriptPropertySet>(); ClassDB::register_class<VisualScriptPropertyGet>(); -// ClassDB::register_type<VisualScriptScriptCall>(); + //ClassDB::register_type<VisualScriptScriptCall>(); ClassDB::register_class<VisualScriptEmitSignal>(); ClassDB::register_class<VisualScriptReturn>(); diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 08796b3868..e1e180432a 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -2631,7 +2631,7 @@ void VisualScriptLanguage::debug_get_stack_level_locals(int p_level,List<String> const StringName *f = _call_stack[l].function; ERR_FAIL_COND(!_call_stack[l].instance->functions.has(*f)); -// VisualScriptInstance::Function *func = &_call_stack[l].instance->functions[*f]; + //VisualScriptInstance::Function *func = &_call_stack[l].instance->functions[*f]; VisualScriptNodeInstance *node =_call_stack[l].instance->instances[*_call_stack[l].current_id]; ERR_FAIL_COND(!node); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 6f3ea3b4ad..37ee225aeb 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -590,9 +590,9 @@ void VisualScriptEditor::_update_graph(int p_only_id) { t=type_icons[left_type]; } if (t.is_valid()) { - TextureFrame *tf = memnew(TextureFrame); + TextureRect *tf = memnew(TextureRect); tf->set_texture(t); - tf->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED); + tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED); hbc->add_child(tf); } @@ -657,9 +657,9 @@ void VisualScriptEditor::_update_graph(int p_only_id) { t=type_icons[right_type]; } if (t.is_valid()) { - TextureFrame *tf = memnew(TextureFrame); + TextureRect *tf = memnew(TextureRect); tf->set_texture(t); - tf->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED); + tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED); hbc->add_child(tf); } @@ -822,7 +822,7 @@ void VisualScriptEditor::_member_selected() { selected=ti->get_metadata(0); -// print_line("selected: "+String(selected)); + //print_line("selected: "+String(selected)); if (ti->get_parent()==members->get_root()->get_children()) { @@ -1136,9 +1136,11 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt undo_redo->add_undo_method(script.ptr(),"data_connect",name,E->get().from_node,E->get().from_port,E->get().to_node,E->get().to_port); } - //for(int i=0;i<script->function_get_argument_count(name);i++) { - //// undo_redo->add_undo_method(script.ptr(),"function_add_argument",name,script->function_get_argument_name(name,i),script->function_get_argument_type(name,i)); - //} + /* + for(int i=0;i<script->function_get_argument_count(name);i++) { + undo_redo->add_undo_method(script.ptr(),"function_add_argument",name,script->function_get_argument_name(name,i),script->function_get_argument_type(name,i)); + } + */ undo_redo->add_do_method(this,"_update_members"); undo_redo->add_undo_method(this,"_update_members"); undo_redo->add_do_method(this,"_update_graph"); @@ -1776,7 +1778,7 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat if (node) { graph->set_selected(node); _node_selected(node); - } + } } if (d.has("type") && String(d["type"])=="resource") { @@ -3082,7 +3084,7 @@ void VisualScriptEditor::_menu_option(int p_what) { //popup disappearing grabs focus to owner, so use call deferred node_filter->call_deferred("grab_focus"); node_filter->call_deferred("select_all"); - } break; + } break; case EDIT_COPY_NODES: case EDIT_CUT_NODES: { @@ -3346,8 +3348,8 @@ VisualScriptEditor::VisualScriptEditor() { node_filter->connect("text_changed",this,"_node_filter_changed"); hbc_nodes->add_child(node_filter); node_filter->set_h_size_flags(SIZE_EXPAND_FILL); - node_filter_icon = memnew( TextureFrame ); - node_filter_icon->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED); + node_filter_icon = memnew( TextureRect ); + node_filter_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED); hbc_nodes->add_child(node_filter_icon); vbc_nodes->add_child(hbc_nodes); diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index e120bdc655..1dc62b3e69 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -58,7 +58,7 @@ class VisualScriptEditor : public ScriptEditorBase { GraphEdit *graph; LineEdit *node_filter; - TextureFrame *node_filter_icon; + TextureRect *node_filter_icon; VisualScriptEditorSignalEdit *signal_editor; diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 9f3ba8a8cb..a8d78b9298 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -396,7 +396,7 @@ void VisualScriptFunctionCall::_update_method_cache() { } -// print_line("BASE: "+String(type)+" FUNC: "+String(function)); + //print_line("BASE: "+String(type)+" FUNC: "+String(function)); MethodBind *mb = ClassDB::get_method(type,function); if (mb) { use_default_args=mb->get_default_argument_count(); @@ -2508,7 +2508,7 @@ void register_visual_script_func_nodes() { VisualScriptLanguage::singleton->add_register_func("functions/get",create_node_generic<VisualScriptPropertyGet>); //VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_self",create_script_call_node<VisualScriptScriptCall::CALL_MODE_SELF>); -// VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_node",create_script_call_node<VisualScriptScriptCall::CALL_MODE_NODE_PATH>); + //VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_node",create_script_call_node<VisualScriptScriptCall::CALL_MODE_NODE_PATH>); VisualScriptLanguage::singleton->add_register_func("functions/emit_signal",create_node_generic<VisualScriptEmitSignal>); diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp index 7abcd0a8b7..2b05daca16 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp @@ -78,7 +78,7 @@ int AudioStreamPlaybackOGGVorbis::_ov_seek_func(void *_f,ogg_int64_t offs, int w } int AudioStreamPlaybackOGGVorbis::_ov_close_func(void *_f) { -// printf("close %p\n",_f); + //printf("close %p\n",_f); if (!_f) return 0; FileAccess *fa=(FileAccess*)_f; @@ -419,7 +419,7 @@ void ResourceFormatLoaderAudioStreamOGGVorbis::get_recognized_extensions(List<St } String ResourceFormatLoaderAudioStreamOGGVorbis::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="ogg") + if (p_path.get_extension().to_lower()=="ogg") return "AudioStreamOGGVorbis"; return ""; } diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index d132e89690..bdd97f1df7 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -415,7 +415,7 @@ bool ResourceFormatLoaderVideoStreamWebm::handles_type(const String &p_type) con String ResourceFormatLoaderVideoStreamWebm::get_resource_type(const String &p_path) const { - const String exl = p_path.extension().to_lower(); + const String exl = p_path.get_extension().to_lower(); if (exl == "webm") return "VideoStreamWebm"; return ""; diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp index 8c57eaaab6..d9e40a5913 100644 --- a/platform/android/audio_driver_jandroid.cpp +++ b/platform/android/audio_driver_jandroid.cpp @@ -71,7 +71,7 @@ Error AudioDriverAndroid::init(){ } */ -// Android_JNI_SetupThread(); + //Android_JNI_SetupThread(); // __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device"); diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp index 5e3cfcbbab..7aec2b174e 100644 --- a/platform/android/audio_driver_opensl.cpp +++ b/platform/android/audio_driver_opensl.cpp @@ -108,7 +108,7 @@ void AudioDriverOpenSL::_buffer_callbacks( AudioDriverOpenSL *ad = (AudioDriverOpenSL*)pContext; -// ad->_buffer_callback(queueItf,eventFlags,pBuffer,bufferSize,dataUsed); + //ad->_buffer_callback(queueItf,eventFlags,pBuffer,bufferSize,dataUsed); ad->_buffer_callback(queueItf); } @@ -271,8 +271,8 @@ void AudioDriverOpenSL::start(){ ERR_FAIL_COND( res !=SL_RESULT_SUCCESS ); SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, BUFFER_COUNT}; -// bufferQueue.locatorType = SL_DATALOCATOR_BUFFERQUEUE; -// bufferQueue.numBuffers = BUFFER_COUNT; /* Four buffers in our buffer queue */ + //bufferQueue.locatorType = SL_DATALOCATOR_BUFFERQUEUE; + //bufferQueue.numBuffers = BUFFER_COUNT; /* Four buffers in our buffer queue */ /* Setup the format of the content in the buffer queue */ pcm.formatType = SL_DATAFORMAT_PCM; pcm.numChannels = 2; @@ -295,7 +295,7 @@ void AudioDriverOpenSL::start(){ audioSink.pLocator = (void *)&locator_outputmix; audioSink.pFormat = NULL; /* Initialize the context for Buffer queue callbacks */ -// cntxt.pDataBase = (void*)&pcmData; + //cntxt.pDataBase = (void*)&pcmData; //cntxt.pData = cntxt.pDataBase; //cntxt.size = sizeof(pcmData); /* Set arrays required[] and iidArray[] for SEEK interface diff --git a/platform/android/dir_access_android.cpp b/platform/android/dir_access_android.cpp index f1a488cec2..42ac34a589 100644 --- a/platform/android/dir_access_android.cpp +++ b/platform/android/dir_access_android.cpp @@ -37,16 +37,16 @@ DirAccess *DirAccessAndroid::create_fs() { return memnew(DirAccessAndroid); } -bool DirAccessAndroid::list_dir_begin() { +Error DirAccessAndroid::list_dir_begin() { list_dir_end(); AAssetDir* aad = AAssetManager_openDir(FileAccessAndroid::asset_manager,current_dir.utf8().get_data()); if (!aad) - return true; //nothing + return ERR_CANT_OPEN; //nothing - return false; + return OK; } String DirAccessAndroid::get_next(){ diff --git a/platform/android/dir_access_android.h b/platform/android/dir_access_android.h index 15c29a9a02..72611ceb59 100644 --- a/platform/android/dir_access_android.h +++ b/platform/android/dir_access_android.h @@ -49,7 +49,7 @@ class DirAccessAndroid : public DirAccess { public: - virtual bool list_dir_begin(); ///< This starts dir listing + virtual Error list_dir_begin(); ///< This starts dir listing virtual String get_next(); virtual bool current_is_dir() const; virtual bool current_is_hidden() const; diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp index bbd041f6c7..2528b18248 100644 --- a/platform/android/dir_access_jandroid.cpp +++ b/platform/android/dir_access_jandroid.cpp @@ -47,7 +47,7 @@ DirAccess *DirAccessJAndroid::create_fs() { return memnew(DirAccessJAndroid); } -bool DirAccessJAndroid::list_dir_begin() { +Error DirAccessJAndroid::list_dir_begin() { list_dir_end(); JNIEnv *env = ThreadAndroid::get_env(); @@ -55,11 +55,11 @@ bool DirAccessJAndroid::list_dir_begin() { jstring js = env->NewStringUTF(current_dir.utf8().get_data()); int res = env->CallIntMethod(io,_dir_open,js); if (res<=0) - return true; + return ERR_CANT_OPEN; id=res; - return false; + return OK; } String DirAccessJAndroid::get_next(){ @@ -257,7 +257,7 @@ void DirAccessJAndroid::setup( jobject p_io) { __android_log_print(ANDROID_LOG_INFO,"godot","*******GOT METHOD _dir_is_dir ok!!"); } -// (*env)->CallVoidMethod(env,obj,aMethodID, myvar); + //(*env)->CallVoidMethod(env,obj,aMethodID, myvar); } diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h index bfd7912aaf..5db32b945c 100644 --- a/platform/android/dir_access_jandroid.h +++ b/platform/android/dir_access_jandroid.h @@ -58,7 +58,7 @@ class DirAccessJAndroid : public DirAccess { public: - virtual bool list_dir_begin(); ///< This starts dir listing + virtual Error list_dir_begin(); ///< This starts dir listing virtual String get_next(); virtual bool current_is_dir() const; virtual bool current_is_hidden() const; diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index e836258e04..204bf684b7 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -729,17 +729,17 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool } -// print_line("String "+itos(i)+": "+string_table[i]); + //print_line("String "+itos(i)+": "+string_table[i]); } for(uint32_t i=string_end;i<(ofs+size);i++) { stable_extra.push_back(p_manifest[i]); } -// printf("stable extra: %i\n",int(stable_extra.size())); + //printf("stable extra: %i\n",int(stable_extra.size())); string_table_ends=ofs+size; -// print_line("STABLE SIZE: "+itos(size)+" ACTUAL: "+itos(string_table_ends)); + //print_line("STABLE SIZE: "+itos(size)+" ACTUAL: "+itos(string_table_ends)); } break; case CHUNK_XML_START_TAG: { @@ -752,7 +752,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool String tname=string_table[name]; -// printf("NSPACE: %i\n",nspace); + //printf("NSPACE: %i\n",nspace); //printf("NAME: %i (%s)\n",name,tname.utf8().get_data()); //printf("CHECK: %x\n",check); uint32_t attrcount=decode_uint32(&p_manifest[iofs+20]); @@ -1523,7 +1523,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { if (dpos==-1) continue; d=d.substr(0,dpos).strip_edges(); - // print_line("found devuce: "+d); + //print_line("found devuce: "+d); ldevices.push_back(d); } @@ -1602,8 +1602,8 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { } d.name=vendor+" "+device; - // print_line("name: "+d.name); - // print_line("description: "+d.description); + //print_line("name: "+d.name); + //print_line("description: "+d.description); } @@ -1864,10 +1864,12 @@ bool EditorExportPlatformAndroid::can_export(String *r_error) const { if (apk_expansion) { - //if (apk_expansion_salt=="") { - // valid=false; - // err+="Invalid SALT for apk expansion.\n"; - //} + /* + if (apk_expansion_salt=="") { + valid=false; + err+="Invalid SALT for apk expansion.\n"; + } + */ if (apk_expansion_pkey=="") { valid=false; err+="Invalid public key for apk expansion.\n"; diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp index 4755f1d029..a4e9c191e9 100644 --- a/platform/android/file_access_jandroid.cpp +++ b/platform/android/file_access_jandroid.cpp @@ -236,7 +236,7 @@ void FileAccessJAndroid::setup( jobject p_io) { __android_log_print(ANDROID_LOG_INFO,"godot","*******GOT METHOD _file_close ok!!"); } -// (*env)->CallVoidMethod(env,obj,aMethodID, myvar); + //(*env)->CallVoidMethod(env,obj,aMethodID, myvar); } diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp index 52b59b2dc1..bbf9bd5b0b 100644 --- a/platform/android/globals/global_defaults.cpp +++ b/platform/android/globals/global_defaults.cpp @@ -35,7 +35,7 @@ void register_android_global_defaults() { /* GLOBAL_DEF("rasterizer.Android/use_fragment_lighting",false); GLOBAL_DEF("rasterizer.Android/fp16_framebuffer",false); GLOBAL_DEF("display.Android/driver","GLES2"); -// GLOBAL_DEF("rasterizer.Android/trilinear_mipmap_filter",false); + //GLOBAL_DEF("rasterizer.Android/trilinear_mipmap_filter",false); GlobalConfig::get_singleton()->set_custom_property_info("display.Android/driver",PropertyInfo(Variant::STRING,"display.Android/driver",PROPERTY_HINT_ENUM,"GLES2")); */ diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index c4d1a85c5f..3c7f7f5854 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -535,29 +535,33 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event) case AMOTION_EVENT_ACTION_DOWN: { engine->os->process_touch(0,0,touchvec); - //System.out.printf("action down at: %f,%f\n", event.getX(),event.getY()); + //System.out.printf("action down at: %f,%f\n", event.getX(),event.getY()); } break; case AMOTION_EVENT_ACTION_MOVE: { engine->os->process_touch(1,0,touchvec); - //for(int i=0;i<event.getPointerCount();i++) { - // System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i)); - //} + /* + for(int i=0;i<event.getPointerCount();i++) { + System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i)); + } + */ } break; case AMOTION_EVENT_ACTION_POINTER_UP: { engine->os->process_touch(4,pidx,touchvec); - //System.out.printf("%d - s.up at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx)); + //System.out.printf("%d - s.up at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx)); } break; case AMOTION_EVENT_ACTION_POINTER_DOWN: { engine->os->process_touch(3,pidx,touchvec); - //System.out.printf("%d - s.down at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx)); + //System.out.printf("%d - s.down at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx)); } break; case AMOTION_EVENT_ACTION_CANCEL: case AMOTION_EVENT_ACTION_UP: { engine->os->process_touch(2,0,touchvec); - //for(int i=0;i<event.getPointerCount();i++) { - // System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i)); - //} + /* + for(int i=0;i<event.getPointerCount();i++) { + System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i)); + } + */ } break; } @@ -638,8 +642,8 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) { } break; case APP_CMD_INIT_WINDOW: - //The window is being shown, get it ready. - // LOGI("INIT WINDOW"); + //The window is being shown, get it ready. + //LOGI("INIT WINDOW"); if (engine->app->window != NULL) { if (engine->os==NULL) { @@ -647,7 +651,7 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) { //do initialization here, when there's OpenGL! hackish but the only way engine->os = new OS_Android(_gfx_init,engine); - // char *args[]={"-test","gui",NULL}; + //char *args[]={"-test","gui",NULL}; __android_log_print(ANDROID_LOG_INFO,"godot","pre asdasd setup..."); #if 0 Error err = Main::setup("apk",2,args); @@ -722,15 +726,15 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) { engine->animating=1; engine_draw_frame(engine); } - break; + break; case APP_CMD_TERM_WINDOW: - // The window is being hidden or closed, clean it up. - // LOGI("TERM WINDOW"); - engine_term_display(engine); - break; + // The window is being hidden or closed, clean it up. + //LOGI("TERM WINDOW"); + engine_term_display(engine); + break; case APP_CMD_GAINED_FOCUS: - // When our app gains focus, we start monitoring the accelerometer. - if (engine->accelerometerSensor != NULL) { + // When our app gains focus, we start monitoring the accelerometer. + if (engine->accelerometerSensor != NULL) { ASensorEventQueue_enableSensor(engine->sensorEventQueue, engine->accelerometerSensor); // We'd like to get 60 events per second (in us). @@ -833,7 +837,7 @@ void android_main(struct android_app* state) { // Process this event. if (source != NULL) { - // LOGI("process\n"); + // LOGI("process\n"); source->process(state, source); } else { nullmax--; @@ -883,12 +887,12 @@ void android_main(struct android_app* state) { return; } -// LOGI("end\n"); + // LOGI("end\n"); } -// LOGI("engine animating? %i\n",engine.animating); + // LOGI("engine animating? %i\n",engine.animating); if (engine.animating) { //do os render diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index 94d29a3350..610f707b47 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -257,8 +257,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC public void onVideoInit(boolean use_gl2) { -// mView = new GodotView(getApplication(),io,use_gl2); -// setContentView(mView); + //mView = new GodotView(getApplication(),io,use_gl2); + //setContentView(mView); layout = new FrameLayout(this); layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); @@ -582,7 +582,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC initializeGodot(); - // instanceSingleton( new GodotFacebook(this) ); + //instanceSingleton( new GodotFacebook(this) ); } @@ -804,9 +804,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC } break; case MotionEvent.ACTION_MOVE: { GodotLib.touch(1,0,evcount,arr); - //for(int i=0;i<event.getPointerCount();i++) { - // System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i)); - //} + /* + for(int i=0;i<event.getPointerCount();i++) { + System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i)); + } + */ } break; case MotionEvent.ACTION_POINTER_UP: { final int indexPointUp = event.getActionIndex(); @@ -822,9 +824,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: { GodotLib.touch(2,0,evcount,arr); - //for(int i=0;i<event.getPointerCount();i++) { - // System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i)); - //} + /* + for(int i=0;i<event.getPointerCount();i++) { + System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i)); + } + */ } break; } @@ -866,9 +870,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC return mPaymentsManager; } -// public void setPaymentsManager(PaymentsManager mPaymentsManager) { -// this.mPaymentsManager = mPaymentsManager; -// }; + /* + public void setPaymentsManager(PaymentsManager mPaymentsManager) { + this.mPaymentsManager = mPaymentsManager; + } + */ // Audio diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java index 878528f7c7..fba082e80d 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java +++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java @@ -57,7 +57,7 @@ public class GodotDownloaderService extends DownloaderService { Log.d("GODOT", "getting public key:" + prefs.getString("store_public_key", null)); return prefs.getString("store_public_key", null); -// return BASE64_PUBLIC_KEY; + //return BASE64_PUBLIC_KEY; } /** diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java index db67144bcc..4cfe295835 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotView.java +++ b/platform/android/java/src/org/godotengine/godot/GodotView.java @@ -265,7 +265,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener { if (keyCode == KeyEvent.KEYCODE_BACK) { GodotLib.quit(); // press 'back' button should not terminate program - // normal handle 'back' event in game logic + //normal handle 'back' event in game logic return true; } diff --git a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java index 13a24994f8..67293df2a8 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java @@ -47,19 +47,19 @@ abstract public class ConsumeTask { public void consume(final String sku){ -// Log.d("XXX", "Consuming product " + sku); + //Log.d("XXX", "Consuming product " + sku); PaymentsCache pc = new PaymentsCache(context); Boolean isBlocked = pc.getConsumableFlag("block", sku); String _token = pc.getConsumableValue("token", sku); -// Log.d("XXX", "token " + _token); + //Log.d("XXX", "token " + _token); if(!isBlocked && _token == null){ -// _token = "inapp:"+context.getPackageName()+":android.test.purchased"; -// Log.d("XXX", "Consuming product " + sku + " with token " + _token); + //_token = "inapp:"+context.getPackageName()+":android.test.purchased"; + //Log.d("XXX", "Consuming product " + sku + " with token " + _token); }else if(!isBlocked){ -// Log.d("XXX", "It is not blocked ¿?"); + //Log.d("XXX", "It is not blocked ¿?"); return; }else if(_token == null){ -// Log.d("XXX", "No token available"); + //Log.d("XXX", "No token available"); this.error("No token for sku:" + sku); return; } @@ -69,9 +69,9 @@ abstract public class ConsumeTask { @Override protected String doInBackground(String... params) { try { -// Log.d("XXX", "Requesting to release item."); + //Log.d("XXX", "Requesting to release item."); int response = mService.consumePurchase(3, context.getPackageName(), token); -// Log.d("XXX", "release response code: " + response); + //Log.d("XXX", "release response code: " + response); if(response == 0 || response == 8){ return null; } diff --git a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java index 20feaef581..dfa363ed75 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java @@ -60,9 +60,9 @@ abstract public class GenericConsumeTask extends AsyncTask<String, String, Strin @Override protected String doInBackground(String... params) { try { -// Log.d("godot", "Requesting to consume an item with token ." + token); + //Log.d("godot", "Requesting to consume an item with token ." + token); int response = mService.consumePurchase(3, context.getPackageName(), token); -// Log.d("godot", "consumePurchase response: " + response); + //Log.d("godot", "consumePurchase response: " + response); if(response == 0 || response == 8){ return null; } diff --git a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java index 1aa210265d..3850453a77 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java @@ -56,29 +56,29 @@ abstract public class HandlePurchaseTask { public void handlePurchaseRequest(int resultCode, Intent data){ -// Log.d("XXX", "Handling purchase response"); -// int responseCode = data.getIntExtra("RESPONSE_CODE", 0); + //Log.d("XXX", "Handling purchase response"); + //int responseCode = data.getIntExtra("RESPONSE_CODE", 0); PaymentsCache pc = new PaymentsCache(context); String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA"); -// Log.d("XXX", "Purchase data:" + purchaseData); + //Log.d("XXX", "Purchase data:" + purchaseData); String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE"); //Log.d("XXX", "Purchase signature:" + dataSignature); if (resultCode == Activity.RESULT_OK) { try { -// Log.d("SARLANGA", purchaseData); + //Log.d("SARLANGA", purchaseData); JSONObject jo = new JSONObject(purchaseData); -// String sku = jo.getString("productId"); -// alert("You have bought the " + sku + ". Excellent choice, aventurer!"); -// String orderId = jo.getString("orderId"); -// String packageName = jo.getString("packageName"); + //String sku = jo.getString("productId"); + //alert("You have bought the " + sku + ". Excellent choice, aventurer!"); + //String orderId = jo.getString("orderId"); + //String packageName = jo.getString("packageName"); String productId = jo.getString("productId"); -// Long purchaseTime = jo.getLong("purchaseTime"); -// Integer state = jo.getInt("purchaseState"); + //Long purchaseTime = jo.getLong("purchaseTime"); + //Integer state = jo.getInt("purchaseState"); String developerPayload = jo.getString("developerPayload"); String purchaseToken = jo.getString("purchaseToken"); @@ -86,7 +86,7 @@ abstract public class HandlePurchaseTask { error("Untrusted callback"); return; } -// Log.d("XXX", "Este es el product ID:" + productId); + //Log.d("XXX", "Este es el product ID:" + productId); pc.setConsumableValue("ticket_signautre", productId, dataSignature); pc.setConsumableValue("ticket", productId, purchaseData); pc.setConsumableFlag("block", productId, true); diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java index 88fd1a0fe4..4678dae1b3 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java +++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java @@ -59,14 +59,14 @@ public class PaymentsCache { SharedPreferences sharedPref = context.getSharedPreferences("consumables_" + set, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString(sku, value); -// Log.d("XXX", "Setting asset: consumables_" + set + ":" + sku); + //Log.d("XXX", "Setting asset: consumables_" + set + ":" + sku); editor.commit(); } public String getConsumableValue(String set, String sku){ SharedPreferences sharedPref = context.getSharedPreferences( "consumables_" + set, Context.MODE_PRIVATE); -// Log.d("XXX", "Getting asset: consumables_" + set + ":" + sku); + //Log.d("XXX", "Getting asset: consumables_" + set + ":" + sku); return sharedPref.getString(sku, null); } diff --git a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java index d154ef0c78..5ad96b35ee 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java @@ -63,18 +63,20 @@ abstract public class PurchaseTask { Log.d("XXX", "Starting purchase for: " + sku); PaymentsCache pc = new PaymentsCache(context); Boolean isBlocked = pc.getConsumableFlag("block", sku); -// if(isBlocked){ -// Log.d("XXX", "Is awaiting payment confirmation"); -// error("Awaiting payment confirmation"); -// return; -// } + /* + if(isBlocked){ + Log.d("XXX", "Is awaiting payment confirmation"); + error("Awaiting payment confirmation"); + return; + } + */ final String hash = transactionId; Bundle buyIntentBundle; try { buyIntentBundle = mService.getBuyIntent(3, context.getApplicationContext().getPackageName(), sku, "inapp", hash ); } catch (RemoteException e) { -// Log.d("XXX", "Error: " + e.getMessage()); + //Log.d("XXX", "Error: " + e.getMessage()); error(e.getMessage()); return; } @@ -87,7 +89,7 @@ abstract public class PurchaseTask { }else if( rc instanceof Long){ responseCode = (int)((Long)rc).longValue(); } -// Log.d("XXX", "Buy intent response code: " + responseCode); + //Log.d("XXX", "Buy intent response code: " + responseCode); if(responseCode == 1 || responseCode == 3 || responseCode == 4){ canceled(); return; @@ -102,12 +104,12 @@ abstract public class PurchaseTask { pc.setConsumableValue("validation_hash", sku, hash); try { if(context == null){ -// Log.d("XXX", "No context!"); + //Log.d("XXX", "No context!"); } if(pendingIntent == null){ -// Log.d("XXX", "No pending intent"); + //Log.d("XXX", "No pending intent"); } -// Log.d("XXX", "Starting activity for purchase!"); + //Log.d("XXX", "Starting activity for purchase!"); context.startIntentSenderForResult( pendingIntent.getIntentSender(), PaymentsManager.REQUEST_CODE_FOR_PURCHASE, diff --git a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java index c74269890d..60a43a9070 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java @@ -56,13 +56,13 @@ abstract public class ReleaseAllConsumablesTask { public void consumeItAll(){ try{ -// Log.d("godot", "consumeItall for " + context.getPackageName()); + //Log.d("godot", "consumeItall for " + context.getPackageName()); Bundle bundle = mService.getPurchases(3, context.getPackageName(), "inapp",null); for (String key : bundle.keySet()) { - Object value = bundle.get(key); -// Log.d("godot", String.format("%s %s (%s)", key, -// value.toString(), value.getClass().getName())); + Object value = bundle.get(key); + //Log.d("godot", String.format("%s %s (%s)", key, + //value.toString(), value.getClass().getName())); } @@ -73,13 +73,13 @@ abstract public class ReleaseAllConsumablesTask { if (myPurchases == null || myPurchases.size() == 0){ -// Log.d("godot", "No purchases!"); + //Log.d("godot", "No purchases!"); notRequired(); return; } -// Log.d("godot", "# products to be consumed:" + myPurchases.size()); + //Log.d("godot", "# products to be consumed:" + myPurchases.size()); for (int i=0;i<myPurchases.size();i++) { @@ -89,7 +89,7 @@ abstract public class ReleaseAllConsumablesTask { String sku = inappPurchaseData.getString("productId"); String token = inappPurchaseData.getString("purchaseToken"); String signature = mySignatures.get(i); -// Log.d("godot", "A punto de consumir un item con token:" + token + "\n" + receipt); + //Log.d("godot", "A punto de consumir un item con token:" + token + "\n" + receipt); new GenericConsumeTask(context, mService, sku, receipt,signature, token) { @Override diff --git a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java index dafab13ad7..f09bcbf9a4 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java @@ -79,14 +79,14 @@ abstract public class ValidateTask { param.put("ticket", pc.getConsumableValue("ticket", sku)); param.put("purchaseToken", pc.getConsumableValue("token", sku)); param.put("sku", sku); -// Log.d("XXX", "Haciendo request a " + url); -// Log.d("XXX", "ticket: " + pc.getConsumableValue("ticket", sku)); -// Log.d("XXX", "purchaseToken: " + pc.getConsumableValue("token", sku)); -// Log.d("XXX", "sku: " + sku); + //Log.d("XXX", "Haciendo request a " + url); + //Log.d("XXX", "ticket: " + pc.getConsumableValue("ticket", sku)); + //Log.d("XXX", "purchaseToken: " + pc.getConsumableValue("token", sku)); + //Log.d("XXX", "sku: " + sku); param.put("package", context.getApplicationContext().getPackageName()); HttpRequester requester = new HttpRequester(); String jsonResponse = requester.post(param); -// Log.d("XXX", "Validation response:\n"+jsonResponse); + //Log.d("XXX", "Validation response:\n"+jsonResponse); return jsonResponse; } diff --git a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java index 9dd08a9563..faefbbd2c6 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java +++ b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java @@ -78,12 +78,12 @@ public class HttpRequester { private long cttl=0; public HttpRequester(){ -// Log.d("XXX", "Creando http request sin contexto"); + //Log.d("XXX", "Creando http request sin contexto"); } public HttpRequester(Context context){ this.context=context; -// Log.d("XXX", "Creando http request con contexto"); + //Log.d("XXX", "Creando http request con contexto"); } public String post(RequestParams params){ @@ -99,7 +99,7 @@ public class HttpRequester { public String get(RequestParams params){ String response = getResponseFromCache(params.getUrl()); if(response == null){ -// Log.d("XXX", "Cache miss!"); + //Log.d("XXX", "Cache miss!"); HttpGet httpget = new HttpGet(params.getUrl()); long timeInit = new Date().getTime(); response = request(httpget); @@ -117,7 +117,7 @@ public class HttpRequester { } private String request(HttpUriRequest request){ -// Log.d("XXX", "Haciendo request a: " + request.getURI() ); + //Log.d("XXX", "Haciendo request a: " + request.getURI() ); Log.d("PPP", "Haciendo request a: " + request.getURI() ); long init = new Date().getTime(); HttpClient httpclient = getNewHttpClient(); @@ -128,10 +128,10 @@ public class HttpRequester { try { HttpResponse response = httpclient.execute(request); Log.d("PPP", "Fin de request (" + (new Date().getTime() - init) + ") a: " + request.getURI() ); -// Log.d("XXX1", "Status:" + response.getStatusLine().toString()); + //Log.d("XXX1", "Status:" + response.getStatusLine().toString()); if(response.getStatusLine().getStatusCode() == 200){ String strResponse = EntityUtils.toString(response.getEntity()); -// Log.d("XXX2", strResponse); + //Log.d("XXX2", strResponse); return strResponse; }else{ Log.d("XXX3", "Response status code:" + response.getStatusLine().getStatusCode() + "\n" + EntityUtils.toString(response.getEntity())); @@ -192,7 +192,7 @@ public class HttpRequester { public void saveResponseIntoCache(String request, String response){ if(context == null){ -// Log.d("XXX", "No context, cache failed!"); + //Log.d("XXX", "No context, cache failed!"); return; } SharedPreferences sharedPref = context.getSharedPreferences("http_get_cache", Context.MODE_PRIVATE); diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp index 296ac0a831..9acda005f1 100644 --- a/platform/android/java_class_wrapper.cpp +++ b/platform/android/java_class_wrapper.cpp @@ -1240,7 +1240,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String& p_class) { //args[i] = _jobject_to_variant(env, obj); -// print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type())); + //print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type())); }; diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index a691e60575..dfbb437344 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -802,7 +802,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e env->GetJavaVM(&jvm); _godot_instance=env->NewGlobalRef(activity); -// _godot_instance=activity; + //_godot_instance=activity; __android_log_print(ANDROID_LOG_INFO,"godot","***************** HELLO FROM JNI!!!!!!!!"); @@ -879,7 +879,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e if (!rawString) { __android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is null\n",i); } else { - // __android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is: %s\n",i,rawString); + //__android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is: %s\n",i,rawString); if (strcmp(rawString,"-main_pack")==0) use_apk_expansion=true; @@ -1151,8 +1151,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch(JNIEnv * env, j pointer_events.push_back(jpe); input_mutex->unlock(); - //if (os_android) -// os_android->process_touch(ev,pointer,points); + /* + if (os_android) + os_android->process_touch(ev,pointer,points); + */ } @@ -1753,7 +1755,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv * args[i] = _jobject_to_variant(env, obj); env->DeleteLocalRef(obj); -// print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type())); + //print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type())); }; diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 55fe3f21a0..562666b679 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -399,7 +399,7 @@ void OS_Android::process_event(InputEvent p_event) { void OS_Android::process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points) { -// print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size())); + //print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size())); switch(p_what) { case 0: { //gesture begin @@ -482,8 +482,8 @@ void OS_Android::process_touch(int p_what,int p_pointer, const Vector<TouchPos>& ev.mouse_motion.x=p_points[0].pos.x; ev.mouse_motion.y=p_points[0].pos.y; input->set_mouse_pos(Point2(ev.mouse_motion.x,ev.mouse_motion.y)); - ev.mouse_motion.speed_x=input->get_mouse_speed().x; - ev.mouse_motion.speed_y=input->get_mouse_speed().y; + ev.mouse_motion.speed_x=input->get_last_mouse_speed().x; + ev.mouse_motion.speed_y=input->get_last_mouse_speed().y; ev.mouse_motion.relative_x=p_points[0].pos.x-last_mouse.x; ev.mouse_motion.relative_y=p_points[0].pos.y-last_mouse.y; last_mouse=p_points[0].pos; diff --git a/platform/bb10/os_bb10.cpp b/platform/bb10/os_bb10.cpp index ed40355eb5..ea2e326b05 100644 --- a/platform/bb10/os_bb10.cpp +++ b/platform/bb10/os_bb10.cpp @@ -190,9 +190,11 @@ void OSBB10::finalize() { spatial_sound_2d_server->finish(); memdelete(spatial_sound_2d_server); - //if (debugger_connection_console) { -// memdelete(debugger_connection_console); -//} + /* + if (debugger_connection_console) { + memdelete(debugger_connection_console); + } + */ memdelete(sample_manager); @@ -376,8 +378,8 @@ void OSBB10::handle_screen_event(bps_event_t *event) { ievent.mouse_motion.x = ievent.mouse_motion.global_x = mpos.x; ievent.mouse_motion.y = ievent.mouse_motion.global_y = mpos.y; input->set_mouse_pos(Point2(ievent.mouse_motion.x,ievent.mouse_motion.y)); - ievent.mouse_motion.speed_x=input->get_mouse_speed().x; - ievent.mouse_motion.speed_y=input->get_mouse_speed().y; + ievent.mouse_motion.speed_x=input->get_last_mouse_speed().x; + ievent.mouse_motion.speed_y=input->get_last_mouse_speed().y; ievent.mouse_motion.relative_x = mrel.x; ievent.mouse_motion.relative_y = mrel.y; ievent.mouse_motion.button_mask = 1; // pressed diff --git a/platform/bb10/os_bb10.h b/platform/bb10/os_bb10.h index 8011550987..5c484cd120 100644 --- a/platform/bb10/os_bb10.h +++ b/platform/bb10/os_bb10.h @@ -58,7 +58,7 @@ class OSBB10 : public OS_Unix { Rasterizer *rasterizer; VisualServer *visual_server; -// AudioDriverPSP audio_driver_psp; + //AudioDriverPSP audio_driver_psp; AudioServerSW *audio_server; SampleManagerMallocSW *sample_manager; SpatialSoundServerSW *spatial_sound_server; diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp index 1def361367..e7ff65e3ba 100644 --- a/platform/haiku/haiku_direct_window.cpp +++ b/platform/haiku/haiku_direct_window.cpp @@ -145,10 +145,12 @@ void HaikuDirectWindow::HandleMouseButton(BMessage* message) { last_buttons_state = buttons; // TODO: implement the mouse_mode checks - //if (mouse_mode == MOUSE_MODE_CAPTURED) { - // event.xbutton.x=last_mouse_pos.x; - // event.xbutton.y=last_mouse_pos.y; - //} + /* + if (mouse_mode == MOUSE_MODE_CAPTURED) { + event.xbutton.x=last_mouse_pos.x; + event.xbutton.y=last_mouse_pos.y; + } + */ InputEvent mouse_event; mouse_event.ID = ++event_id; @@ -219,8 +221,8 @@ void HaikuDirectWindow::HandleMouseMoved(BMessage* message) { input->set_mouse_pos(pos); motion_event.mouse_motion.global_x = pos.x; motion_event.mouse_motion.global_y = pos.y; - motion_event.mouse_motion.speed_x = input->get_mouse_speed().x; - motion_event.mouse_motion.speed_y = input->get_mouse_speed().y; + motion_event.mouse_motion.speed_x = input->get_last_mouse_speed().x; + motion_event.mouse_motion.speed_y = input->get_last_mouse_speed().y; motion_event.mouse_motion.relative_x = rel.x; motion_event.mouse_motion.relative_y = rel.y; diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp index 10e1b055be..176e1b0fbc 100644 --- a/platform/haiku/os_haiku.cpp +++ b/platform/haiku/os_haiku.cpp @@ -119,9 +119,11 @@ void OS_Haiku::initialize(const VideoMode& p_desired, int p_video_driver, int p_ ERR_FAIL_COND(!visual_server); // TODO: enable multithreaded VS - //if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) { - // visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD)); - //} + /* + if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) { + visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD)); + } + */ input = memnew(InputDefault); window->SetInput(input); diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp index 579cbaed3c..af9f28169b 100644 --- a/platform/javascript/audio_driver_javascript.cpp +++ b/platform/javascript/audio_driver_javascript.cpp @@ -68,14 +68,18 @@ AudioDriverSW::OutputFormat AudioDriverJavaScript::get_output_format() const{ } void AudioDriverJavaScript::lock(){ - //if (active && mutex) - // mutex->lock(); + /* + if (active && mutex) + mutex->lock(); + */ } void AudioDriverJavaScript::unlock() { - //if (active && mutex) - // mutex->unlock(); + /* + if (active && mutex) + mutex->unlock(); + */ } void AudioDriverJavaScript::finish(){ diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp index d1fba030a5..5489f179eb 100644 --- a/platform/javascript/audio_server_javascript.cpp +++ b/platform/javascript/audio_server_javascript.cpp @@ -617,9 +617,11 @@ void AudioServerJavascript::mix_to_js(int p_frames) { void AudioServerJavascript::init(){ - //EM_ASM( -// console.log('server is '+audio_server); -// ); + /* + EM_ASM( + console.log('server is '+audio_server); + ); + */ //int latency = GLOBAL_DEF("javascript/audio_latency",16384); diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index c151bff45c..33776bc273 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -265,7 +265,7 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool FileAccess *f=FileAccess::open(p_path.get_base_dir()+"/data.pck",FileAccess::WRITE); if (!f) { - EditorNode::add_io_error("Could not create file for writing:\n"+p_path.basename()+"_files.js"); + EditorNode::add_io_error("Could not create file for writing:\n"+p_path.get_basename()+"_files.js"); return ERR_FILE_CANT_WRITE; } Error err = save_pack(f); @@ -307,32 +307,32 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool if (file=="godot.html") { - _fix_html(data,p_path.get_file().basename(), p_debug); + _fix_html(data,p_path.get_file().get_basename(), p_debug); file=p_path.get_file(); } if (file=="godotfs.js") { _fix_files(data,len); - file=p_path.get_file().basename()+"fs.js"; + file=p_path.get_file().get_basename()+"fs.js"; } if (file=="godot.js") { - file=p_path.get_file().basename()+".js"; + file=p_path.get_file().get_basename()+".js"; } if (file=="godot.asm.js") { - file=p_path.get_file().basename()+".asm.js"; + file=p_path.get_file().get_basename()+".asm.js"; } if (file=="godot.mem") { - file=p_path.get_file().basename()+".mem"; + file=p_path.get_file().get_basename()+".mem"; } if (file=="godot.wasm") { - file=p_path.get_file().basename()+".wasm"; + file=p_path.get_file().get_basename()+".wasm"; } String dst = p_path.get_base_dir().plus_file(file); diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index 4c47594810..6ec7f1ec3d 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -159,8 +159,8 @@ int main(int argc, char *argv[]) { char *args[]={"-test","gui","-v",NULL}; Error err = Main::setup("apk",3,args); #else -// char *args[]={"-v",NULL};// -// Error err = Main::setup("",1,args); + //char *args[]={"-v",NULL};// + //Error err = Main::setup("",1,args); Error err = Main::setup("",0,NULL); #endif diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 47c8ea89d7..18bf8f6a86 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -243,7 +243,7 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int rasterizer_gles22->set_extensions(gl_extensions); rasterizer = rasterizer_gles22; } else { -// rasterizer = memnew( RasterizerGLES1(true, false) ); + //rasterizer = memnew( RasterizerGLES1(true, false) ); } print_line("Init VS"); @@ -561,7 +561,7 @@ void OS_JavaScript::push_input(const InputEvent& p_ev) { void OS_JavaScript::process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points) { -// print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size())); + //print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size())); switch(p_what) { case 0: { //gesture begin @@ -644,8 +644,8 @@ void OS_JavaScript::process_touch(int p_what,int p_pointer, const Vector<TouchPo ev.mouse_motion.x=p_points[0].pos.x; ev.mouse_motion.y=p_points[0].pos.y; input->set_mouse_pos(Point2(ev.mouse_motion.x,ev.mouse_motion.y)); - ev.mouse_motion.speed_x=input->get_mouse_speed().x; - ev.mouse_motion.speed_y=input->get_mouse_speed().y; + ev.mouse_motion.speed_x=input->get_last_mouse_speed().x; + ev.mouse_motion.speed_y=input->get_last_mouse_speed().y; ev.mouse_motion.relative_x=p_points[0].pos.x-last_mouse.x; ev.mouse_motion.relative_y=p_points[0].pos.y-last_mouse.y; last_mouse=p_points[0].pos; @@ -804,8 +804,10 @@ String OS_JavaScript::get_resource_dir() const { String OS_JavaScript::get_data_dir() const { - //if (get_data_dir_func) - // return get_data_dir_func(); + /* + if (get_data_dir_func) + return get_data_dir_func(); + */ return "/userfs"; //return GlobalConfig::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); }; diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index fc64c2b867..f6559f1f7a 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -59,7 +59,7 @@ class OS_OSX : public OS_Unix { public: bool force_quit; // rasterizer seems to no longer be given to visual server, its using GLES3 directly? -// Rasterizer *rasterizer; + //Rasterizer *rasterizer; VisualServer *visual_server; List<String> args; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index a66f6abba5..5750e19c87 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -148,36 +148,36 @@ static int button_mask=0; - (void)applicationDidHide:(NSNotification *)notification { - /* _Godotwindow* window; - - for (window = _Godot.windowListHead; window; window = window->next) - _GodotInputWindowVisibility(window, GL_FALSE); + /* + _Godotwindow* window; + for (window = _Godot.windowListHead; window; window = window->next) + _GodotInputWindowVisibility(window, GL_FALSE); */ } - (void)applicationDidUnhide:(NSNotification *)notification { /* - _Godotwindow* window; + _Godotwindow* window; - for (window = _Godot.windowListHead; window; window = window->next) - { + for (window = _Godot.windowListHead; window; window = window->next) + { if ([window_object isVisible]) _GodotInputWindowVisibility(window, GL_TRUE); - } - */ + } + */ } - (void)applicationDidChangeScreenParameters:(NSNotification *) notification { - //_GodotInputMonitorChange(); + //_GodotInputMonitorChange(); } @end @interface GodotWindowDelegate : NSObject { - // _Godotwindow* window; + //_Godotwindow* window; } @end @@ -187,7 +187,7 @@ static int button_mask=0; - (BOOL)windowShouldClose:(id)sender { - //_GodotInputWindowCloseRequest(window); + //_GodotInputWindowCloseRequest(window); if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST); return NO; @@ -207,38 +207,42 @@ static int button_mask=0; OS_OSX::singleton->window_size.height=fbRect.size.height*OS_OSX::singleton->display_scale; - // _GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); - // _GodotInputWindowSize(window, contentRect.size.width, contentRect.size.height); - //_GodotInputWindowDamage(window); + /* + _GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); + _GodotInputWindowSize(window, contentRect.size.width, contentRect.size.height); + _GodotInputWindowDamage(window); - //if (window->cursorMode == Godot_CURSOR_DISABLED) - // centerCursor(window); + if (window->cursorMode == Godot_CURSOR_DISABLED) + centerCursor(window); + */ } - (void)windowDidMove:(NSNotification *)notification { - // [window->nsgl.context update]; + /* + [window->nsgl.context update]; - // int x, y; - // _GodotPlatformGetWindowPos(window, &x, &y); - // _GodotInputWindowPos(window, x, y); + int x, y; + _GodotPlatformGetWindowPos(window, &x, &y); + _GodotInputWindowPos(window, x, y); - //if (window->cursorMode == Godot_CURSOR_DISABLED) - // centerCursor(window); + if (window->cursorMode == Godot_CURSOR_DISABLED) + centerCursor(window); + */ } - (void)windowDidBecomeKey:(NSNotification *)notification { - // _GodotInputWindowFocus(window, GL_TRUE); - // _GodotPlatformSetCursorMode(window, window->cursorMode); + //_GodotInputWindowFocus(window, GL_TRUE); + //_GodotPlatformSetCursorMode(window, window->cursorMode); if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN); } - (void)windowDidResignKey:(NSNotification *)notification { - // _GodotInputWindowFocus(window, GL_FALSE); - // _GodotPlatformSetCursorMode(window, Godot_CURSOR_NORMAL); + //_GodotInputWindowFocus(window, GL_FALSE); + //_GodotPlatformSetCursorMode(window, Godot_CURSOR_NORMAL); if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT); } @@ -273,16 +277,18 @@ static int button_mask=0; + (void)initialize { - if (self == [GodotContentView class]) - { - /* if (_glfw.ns.cursor == nil) + if (self == [GodotContentView class]) { - NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)]; - _glfw.ns.cursor = [[NSCursor alloc] initWithImage:data - hotSpot:NSZeroPoint]; - [data release]; - }*/ - } + /* + if (_glfw.ns.cursor == nil) + { + NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)]; + _glfw.ns.cursor = [[NSCursor alloc] initWithImage:data + hotSpot:NSZeroPoint]; + [data release]; + } + */ + } } - (id)init @@ -993,7 +999,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi [window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; } -// [window_object setTitle:[NSString stringWithUTF8String:"GodotEnginies"]]; + //[window_object setTitle:[NSString stringWithUTF8String:"GodotEnginies"]]; [window_object setContentView:window_view]; [window_object setDelegate:window_delegate]; [window_object setAcceptsMouseMovedEvents:YES]; @@ -1019,7 +1025,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi ADD_ATTR(NSOpenGLPFADoubleBuffer); ADD_ATTR(NSOpenGLPFAClosestPolicy); -// we now need OpenGL 3 or better, maybe even change this to 3_3Core ? + //we now need OpenGL 3 or better, maybe even change this to 3_3Core ? ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core); ADD_ATTR2(NSOpenGLPFAColorSize, colorBits); @@ -1083,15 +1089,16 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi RasterizerGLES3::register_config(); RasterizerGLES3::make_current(); -// rasterizer = instance_RasterizerGLES2(); -// visual_server = memnew( VisualServerRaster(rasterizer) ); + //rasterizer = instance_RasterizerGLES2(); + //visual_server = memnew( VisualServerRaster(rasterizer) ); visual_server = memnew( VisualServerRaster ); // FIXME: Reimplement threaded rendering? Or remove? -// if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { -// -// visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); -// } + /* + if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { + visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); + } + */ visual_server->init(); visual_server->cursor_set_visible(false, 0); @@ -1175,7 +1182,7 @@ void OS_OSX::finalize() { visual_server->finish(); memdelete(visual_server); -// memdelete(rasterizer); + //memdelete(rasterizer); physics_server->finish(); memdelete(physics_server); @@ -1730,10 +1737,10 @@ void OS_OSX::run() { set_window_fullscreen(true); } -// uint64_t last_ticks=get_ticks_usec(); + //uint64_t last_ticks=get_ticks_usec(); -// int frames=0; -// uint64_t frame=0; + //int frames=0; + //uint64_t frame=0; while (!force_quit) { diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index e35ad1adf8..6b91a5ce77 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -103,9 +103,11 @@ void OS_Server::finalize() { spatial_sound_2d_server->finish(); memdelete(spatial_sound_2d_server); - //if (debugger_connection_console) { -// memdelete(debugger_connection_console); -//} + /* + if (debugger_connection_console) { + memdelete(debugger_connection_console); + } + */ memdelete(sample_manager); diff --git a/platform/server/os_server.h b/platform/server/os_server.h index 6aa1b9e14b..f7fe586b1b 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -51,7 +51,7 @@ class OS_Server : public OS_Unix { -// Rasterizer *rasterizer; + //Rasterizer *rasterizer; VisualServer *visual_server; VideoMode current_videomode; List<String> args; diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index 6eb4ca9caa..f1e0716241 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -145,9 +145,13 @@ def configure(env): env.Append(CCFLAGS=['/DGLES2_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED']) + winver = "0x0602" # Windows 8 is the minimum target for UWP build + env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver]) + LIBS = [ 'WindowsApp', 'mincore', + 'ws2_32', 'libANGLE', 'libEGL', 'libGLESv2', diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 1844df5eef..4648384480 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -612,7 +612,7 @@ void AppxPackager::make_content_types() { for (int i = 0; i < file_metadata.size(); i++) { - String ext = file_metadata[i].name.extension(); + String ext = file_metadata[i].name.get_extension(); if (types.has(ext)) continue; diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 34977bc048..9dd745716e 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -412,9 +412,11 @@ void OSUWP::finalize() { spatial_sound_2d_server->finish(); memdelete(spatial_sound_2d_server); - //if (debugger_connection_console) { -// memdelete(debugger_connection_console); -//} + /* + if (debugger_connection_console) { + memdelete(debugger_connection_console); + } + */ memdelete(sample_manager); diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index 6b60ade5f0..7a81dfef77 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -199,7 +199,7 @@ Error ContextGL_Win::initialize() { } wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress ("wglSwapIntervalEXT"); -// glWrapperInit(wrapper_get_proc_address); + //glWrapperInit(wrapper_get_proc_address); return OK; } diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 1f3c7a7654..382783d6bc 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -209,7 +209,7 @@ def configure(env): env.Append(CPPPATH=['#platform/windows']) # Targeted Windows version: Vista (and later) - env.Append(CPPFLAGS=['-D_WIN32_WINNT=0x0600']) + winver = "0x0600" # Windows Vista is the minimum target for windows builds env['is_mingw'] = False if (os.name == "nt" and os.getenv("VCINSTALLDIR")): @@ -217,6 +217,7 @@ def configure(env): env['ENV']['TMP'] = os.environ['TMP'] env.Append(CPPPATH=['#platform/windows/include']) env.Append(LIBPATH=['#platform/windows/lib']) + env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver]) if (env["target"] == "release"): @@ -311,6 +312,7 @@ def configure(env): env.use_windows_spawn_fix() # build using mingw + env.Append(CCFLAGS=['-DWINVER=%s' % winver, '-D_WIN32_WINNT=%s' % winver]) if (os.name == "nt"): env['ENV']['TMP'] = os.environ['TMP'] # way to go scons, you can be so stupid sometimes else: diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 6256cb58e0..8910b23a2e 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -401,8 +401,8 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { } input->set_mouse_pos(Point2(mm.x,mm.y)); - mm.speed_x=input->get_mouse_speed().x; - mm.speed_y=input->get_mouse_speed().y; + mm.speed_x=input->get_last_mouse_speed().x; + mm.speed_y=input->get_last_mouse_speed().y; if (old_invalid) { @@ -635,8 +635,10 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { gr_mem=alt_mem; } - //if (wParam==VK_WIN) TODO wtf is this? - // meta_mem=uMsg==WM_KEYDOWN; + /* + if (wParam==VK_WIN) TODO wtf is this? + meta_mem=uMsg==WM_KEYDOWN; + */ } //fallthrough @@ -1085,12 +1087,12 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ visual_server = memnew( VisualServerRaster ); // FIXME: Reimplement threaded rendering? Or remove? -// if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { -// -// visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); -// } + /* + if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { + visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); + } + */ - // physics_server = memnew( PhysicsServerSW ); physics_server->init(); @@ -1274,9 +1276,11 @@ void OS_Windows::finalize() { spatial_sound_2d_server->finish(); memdelete(spatial_sound_2d_server); - //if (debugger_connection_console) { -// memdelete(debugger_connection_console); -//} + /* + if (debugger_connection_console) { + memdelete(debugger_connection_console); + } + */ memdelete(sample_manager); @@ -1608,7 +1612,7 @@ void OS_Windows::set_window_fullscreen(bool p_enabled){ */ } -// MoveWindow(hWnd,r.left,r.top,p_size.x,p_size.y,TRUE); + //MoveWindow(hWnd,r.left,r.top,p_size.x,p_size.y,TRUE); } @@ -1986,7 +1990,7 @@ Error OS_Windows::execute(const String& p_path, const List<String>& p_arguments, argss+=String(" \"")+p_arguments[i]+"\""; } -// print_line("ARGS: "+argss); + //print_line("ARGS: "+argss); //argss+"\""; //argss+=" 2>nul"; diff --git a/platform/windows/packet_peer_udp_winsock.cpp b/platform/windows/packet_peer_udp_winsock.cpp index ef497c428d..5baa01c289 100644 --- a/platform/windows/packet_peer_udp_winsock.cpp +++ b/platform/windows/packet_peer_udp_winsock.cpp @@ -247,7 +247,7 @@ int PacketPeerUDPWinsock::_get_socket() { } -void PacketPeerUDPWinsock::set_send_address(const IP_Address& p_address,int p_port) { +void PacketPeerUDPWinsock::set_dest_address(const IP_Address& p_address,int p_port) { peer_addr=p_address; peer_port=p_port; diff --git a/platform/windows/packet_peer_udp_winsock.h b/platform/windows/packet_peer_udp_winsock.h index 2199115889..18e6bd8f3d 100644 --- a/platform/windows/packet_peer_udp_winsock.h +++ b/platform/windows/packet_peer_udp_winsock.h @@ -75,7 +75,7 @@ public: virtual IP_Address get_packet_address() const; virtual int get_packet_port() const; - virtual void set_send_address(const IP_Address& p_address,int p_port); + virtual void set_dest_address(const IP_Address& p_address,int p_port); static void make_default(); PacketPeerUDPWinsock(); diff --git a/platform/windows/stream_peer_winsock.cpp b/platform/windows/stream_peer_winsock.cpp index a48a02c7a7..6ceae0fcc7 100644 --- a/platform/windows/stream_peer_winsock.cpp +++ b/platform/windows/stream_peer_winsock.cpp @@ -149,7 +149,7 @@ Error StreamPeerWinsock::write(const uint8_t* p_data,int p_bytes, int &r_sent, b if (WSAGetLastError() != WSAEWOULDBLOCK) { perror("shit?"); - disconnect(); + disconnect_from_host(); ERR_PRINT("Server disconnected!\n"); return FAILED; }; @@ -175,7 +175,7 @@ Error StreamPeerWinsock::write(const uint8_t* p_data,int p_bytes, int &r_sent, b Error StreamPeerWinsock::read(uint8_t* p_buffer, int p_bytes,int &r_received, bool p_block) { - if (!is_connected()) { + if (!is_connected_to_host()) { return FAILED; }; @@ -206,7 +206,7 @@ Error StreamPeerWinsock::read(uint8_t* p_buffer, int p_bytes,int &r_received, bo if (WSAGetLastError() != WSAEWOULDBLOCK) { perror("shit?"); - disconnect(); + disconnect_from_host(); ERR_PRINT("Server disconnected!\n"); return FAILED; }; @@ -218,7 +218,7 @@ Error StreamPeerWinsock::read(uint8_t* p_buffer, int p_bytes,int &r_received, bo }; _block(sockfd, true, false); } else if (read == 0) { - disconnect(); + disconnect_from_host(); return ERR_FILE_EOF; } else { @@ -264,7 +264,7 @@ StreamPeerTCP::Status StreamPeerWinsock::get_status() const { }; -bool StreamPeerWinsock::is_connected() const { +bool StreamPeerWinsock::is_connected_to_host() const { if (status == STATUS_NONE || status == STATUS_ERROR) { @@ -277,7 +277,7 @@ bool StreamPeerWinsock::is_connected() const { return (sockfd!=INVALID_SOCKET); }; -void StreamPeerWinsock::disconnect() { +void StreamPeerWinsock::disconnect_from_host() { if (sockfd != INVALID_SOCKET) closesocket(sockfd); @@ -298,14 +298,14 @@ void StreamPeerWinsock::set_socket(int p_sockfd, IP_Address p_host, int p_port, peer_port = p_port; }; -Error StreamPeerWinsock::connect(const IP_Address& p_host, uint16_t p_port) { +Error StreamPeerWinsock::connect_to_host(const IP_Address& p_host, uint16_t p_port) { ERR_FAIL_COND_V( p_host == IP_Address(), ERR_INVALID_PARAMETER); sockfd = _socket_create(ip_type, SOCK_STREAM, IPPROTO_TCP); if (sockfd == INVALID_SOCKET) { ERR_PRINT("Socket creation failed!"); - disconnect(); + disconnect_from_host(); //perror("socket"); return FAILED; }; @@ -313,7 +313,7 @@ Error StreamPeerWinsock::connect(const IP_Address& p_host, uint16_t p_port) { unsigned long par = 1; if (ioctlsocket(sockfd, FIONBIO, &par)) { perror("setting non-block mode"); - disconnect(); + disconnect_from_host(); return FAILED; }; @@ -324,7 +324,7 @@ Error StreamPeerWinsock::connect(const IP_Address& p_host, uint16_t p_port) { if (WSAGetLastError() != WSAEWOULDBLOCK) { ERR_PRINT("Connection to remote host failed!"); - disconnect(); + disconnect_from_host(); return FAILED; }; status = STATUS_CONNECTING; @@ -339,7 +339,7 @@ Error StreamPeerWinsock::connect(const IP_Address& p_host, uint16_t p_port) { }; void StreamPeerWinsock::set_nodelay(bool p_enabled) { - ERR_FAIL_COND(!is_connected()); + ERR_FAIL_COND(!is_connected_to_host()); int flag=p_enabled?1:0; setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(int)); } @@ -373,7 +373,7 @@ StreamPeerWinsock::StreamPeerWinsock() { StreamPeerWinsock::~StreamPeerWinsock() { - disconnect(); + disconnect_from_host(); }; diff --git a/platform/windows/stream_peer_winsock.h b/platform/windows/stream_peer_winsock.h index e17a7167e1..eff96930dd 100644 --- a/platform/windows/stream_peer_winsock.h +++ b/platform/windows/stream_peer_winsock.h @@ -58,7 +58,7 @@ protected: public: - virtual Error connect(const IP_Address& p_host, uint16_t p_port); + virtual Error connect_to_host(const IP_Address& p_host, uint16_t p_port); virtual Error put_data(const uint8_t* p_data,int p_bytes); virtual Error put_partial_data(const uint8_t* p_data,int p_bytes, int &r_sent); @@ -73,9 +73,9 @@ public: virtual IP_Address get_connected_host() const; virtual uint16_t get_connected_port() const; - virtual bool is_connected() const; + virtual bool is_connected_to_host() const; virtual Status get_status() const; - virtual void disconnect(); + virtual void disconnect_from_host(); static void make_default(); static void cleanup(); diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index 4adb47938c..39b704d2c4 100644 --- a/platform/x11/context_gl_x11.cpp +++ b/platform/x11/context_gl_x11.cpp @@ -88,7 +88,7 @@ Error ContextGL_X11::initialize() { GLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = NULL; -// const char *extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display)); + //const char *extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display)); glXCreateContextAttribsARB = (GLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB"); diff --git a/platform/x11/context_gl_x11.h b/platform/x11/context_gl_x11.h index efe377ad92..efea700224 100644 --- a/platform/x11/context_gl_x11.h +++ b/platform/x11/context_gl_x11.h @@ -48,7 +48,7 @@ class ContextGL_X11 : public ContextGL { ContextGL_X11_Private *p; OS::VideoMode default_video_mode; -// ::Colormap x11_colormap; + //::Colormap x11_colormap; ::Display *x11_display; ::Window& x11_window; bool double_buffer; diff --git a/platform/x11/key_mapping_x11.cpp b/platform/x11/key_mapping_x11.cpp index 7b92ed95de..d25fe40c4d 100644 --- a/platform/x11/key_mapping_x11.cpp +++ b/platform/x11/key_mapping_x11.cpp @@ -90,8 +90,8 @@ static _XTranslatePair _xkeysym_to_keycode[]={ { XK_Begin, KEY_CLEAR }, { XK_Insert, KEY_INSERT }, { XK_Delete, KEY_DELETE }, -// { XK_KP_Equal, KEY_EQUAL }, -// { XK_KP_Separator, KEY_COMMA }, + //{ XK_KP_Equal, KEY_EQUAL }, + //{ XK_KP_Separator, KEY_COMMA }, { XK_KP_Decimal, KEY_KP_PERIOD }, { XK_KP_Delete, KEY_KP_PERIOD }, { XK_KP_Enter, KEY_KP_ENTER }, diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 9a4b19f2db..13e01ab6ac 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -474,9 +474,11 @@ void OS_X11::finalize() { spatial_sound_2d_server->finish(); memdelete(spatial_sound_2d_server); - //if (debugger_connection_console) { -// memdelete(debugger_connection_console); -//} + /* + if (debugger_connection_console) { + memdelete(debugger_connection_console); + } + */ #ifdef JOYDEV_ENABLED memdelete(joypad); @@ -1467,8 +1469,8 @@ void OS_X11::process_xevents() { input->set_mouse_pos(pos); motion_event.mouse_motion.global_x=pos.x; motion_event.mouse_motion.global_y=pos.y; - motion_event.mouse_motion.speed_x=input->get_mouse_speed().x; - motion_event.mouse_motion.speed_y=input->get_mouse_speed().y; + motion_event.mouse_motion.speed_x=input->get_last_mouse_speed().x; + motion_event.mouse_motion.speed_y=input->get_last_mouse_speed().y; motion_event.mouse_motion.relative_x=rel.x; motion_event.mouse_motion.relative_y=rel.y; @@ -1923,10 +1925,10 @@ void OS_X11::run() { main_loop->init(); -// uint64_t last_ticks=get_ticks_usec(); + //uint64_t last_ticks=get_ticks_usec(); -// int frames=0; -// uint64_t frame=0; + //int frames=0; + //uint64_t frame=0; while (!force_quit) { diff --git a/prop_renames.txt b/prop_renames.txt index 9821a32b68..e2156f2368 100644 --- a/prop_renames.txt +++ b/prop_renames.txt @@ -112,7 +112,7 @@ motion/mirroring = motion_mirroring [PhysicsBody2D] -collision/layers = collision_layers +collision/layers = collision_layer collision/mask = collision_mask [Polygon2D] @@ -227,7 +227,7 @@ mesh/skeleton = skeleton [PhysicsBody] -collision/layers = collision_layers +collision/layers = collision_layer collision/mask = collision_mask [Quad] @@ -509,7 +509,7 @@ modulate = self_modulate modulate = self_modulate -[TextureFrame] +[TextureRect] modulate = self_modulate diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index 4300c25e9f..64d6ef5560 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -417,7 +417,7 @@ void AnimatedSprite::_notification(int p_what) { if (centered) ofs-=s/2; - if (OS::get_singleton()->get_use_pixel_snap()) { + if (Engine::get_singleton()->get_use_pixel_snap()) { ofs=ofs.floor(); } Rect2 dst_rect(ofs,s); @@ -429,7 +429,7 @@ void AnimatedSprite::_notification(int p_what) { //texture->draw_rect(ci,dst_rect,false,modulate); texture->draw_rect_region(ci,dst_rect,Rect2(Vector2(),texture->get_size())); -// VisualServer::get_singleton()->canvas_item_add_texture_rect_region(ci,dst_rect,texture->get_rid(),src_rect,modulate); + //VisualServer::get_singleton()->canvas_item_add_texture_rect_region(ci,dst_rect,texture->get_rid(),src_rect,modulate); } break; } diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index a72e1164b4..67c596421f 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -418,7 +418,7 @@ void Area2D::_notification(int p_what) { } -void Area2D::set_enable_monitoring(bool p_enable) { +void Area2D::set_monitoring(bool p_enable) { if (p_enable==monitoring) @@ -443,7 +443,7 @@ void Area2D::set_enable_monitoring(bool p_enable) { } } -bool Area2D::is_monitoring_enabled() const { +bool Area2D::is_monitoring() const { return monitoring; } @@ -629,8 +629,8 @@ void Area2D::_bind_methods() { ClassDB::bind_method(_MD("set_layer_mask_bit","bit","value"),&Area2D::set_layer_mask_bit); ClassDB::bind_method(_MD("get_layer_mask_bit","bit"),&Area2D::get_layer_mask_bit); - ClassDB::bind_method(_MD("set_enable_monitoring","enable"),&Area2D::set_enable_monitoring); - ClassDB::bind_method(_MD("is_monitoring_enabled"),&Area2D::is_monitoring_enabled); + ClassDB::bind_method(_MD("set_monitoring","enable"),&Area2D::set_monitoring); + ClassDB::bind_method(_MD("is_monitoring"),&Area2D::is_monitoring); ClassDB::bind_method(_MD("set_monitorable","enable"),&Area2D::set_monitorable); ClassDB::bind_method(_MD("is_monitorable"),&Area2D::is_monitorable); @@ -664,7 +664,7 @@ void Area2D::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::REAL,"linear_damp",PROPERTY_HINT_RANGE,"0,100,0.01"),_SCS("set_linear_damp"),_SCS("get_linear_damp")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"angular_damp",PROPERTY_HINT_RANGE,"0,100,0.01"),_SCS("set_angular_damp"),_SCS("get_angular_damp")); ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"priority",PROPERTY_HINT_RANGE,"0,128,1"),_SCS("set_priority"),_SCS("get_priority")); - ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"monitoring"),_SCS("set_enable_monitoring"),_SCS("is_monitoring_enabled")); + ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"monitoring"),_SCS("set_monitoring"),_SCS("is_monitoring")); ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"monitorable"),_SCS("set_monitorable"),_SCS("is_monitorable")); ADD_GROUP("Collision","collision_"); ADD_PROPERTYNO( PropertyInfo(Variant::INT,"collision_layers",PROPERTY_HINT_LAYERS_2D_PHYSICS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); @@ -687,7 +687,7 @@ Area2D::Area2D() : CollisionObject2D(Physics2DServer::get_singleton()->area_crea monitorable=false; collision_mask=1; layer_mask=1; - set_enable_monitoring(true); + set_monitoring(true); set_monitorable(true); } diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h index e1adc16666..68bada707b 100644 --- a/scene/2d/area_2d.h +++ b/scene/2d/area_2d.h @@ -153,8 +153,8 @@ public: void set_priority(real_t p_priority); real_t get_priority() const; - void set_enable_monitoring(bool p_enable); - bool is_monitoring_enabled() const; + void set_monitoring(bool p_enable); + bool is_monitoring() const; void set_monitorable(bool p_enable); bool is_monitorable() const; diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 6c387c610f..0bafef1b83 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -52,7 +52,7 @@ void Camera2D::_update_scroll() { if (viewport) { viewport->set_canvas_transform( xform ); } - get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,group_name,"_camera_moved",xform); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME,group_name,"_camera_moved",xform); }; } @@ -145,7 +145,7 @@ Transform2D Camera2D::get_camera_transform() { float c = smoothing*get_fixed_process_delta_time(); smoothed_camera_pos = ((camera_pos-smoothed_camera_pos)*c)+smoothed_camera_pos; ret_camera_pos=smoothed_camera_pos; - // camera_pos=camera_pos*(1.0-smoothing)+new_camera_pos*smoothing; + //camera_pos=camera_pos*(1.0-smoothing)+new_camera_pos*smoothing; } else { ret_camera_pos=smoothed_camera_pos=camera_pos; @@ -252,7 +252,7 @@ void Camera2D::_notification(int p_what) { canvas = get_canvas(); - RID vp = viewport->get_viewport(); + RID vp = viewport->get_viewport_rid(); group_name = "__cameras_"+itos(vp.get_id()); canvas_group_name ="__cameras_c"+itos(canvas.get_id()); @@ -375,7 +375,7 @@ void Camera2D::make_current() { if (!is_inside_tree()) { current=true; } else { - get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,group_name,"_make_current",this); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME,group_name,"_make_current",this); } } @@ -383,7 +383,7 @@ void Camera2D::clear_current() { current=false; if (is_inside_tree()) { - get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,group_name,"_make_current",(Object*)(NULL)); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME,group_name,"_make_current",(Object*)(NULL)); } } @@ -573,7 +573,7 @@ void Camera2D::set_custom_viewport(Node *p_viewport) { else viewport=get_viewport(); - RID vp = viewport->get_viewport(); + RID vp = viewport->get_viewport_rid(); group_name = "__cameras_"+itos(vp.get_id()); canvas_group_name ="__cameras_c"+itos(canvas.get_id()); add_to_group(group_name); @@ -713,5 +713,6 @@ Camera2D::Camera2D() { v_drag_enabled=true; h_ofs=0; v_ofs=0; + set_notify_transform(true); } diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index b7d9ba7860..817707f96e 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -182,7 +182,7 @@ CanvasItemMaterial::~CanvasItemMaterial(){ -bool CanvasItem::is_visible() const { +bool CanvasItem::is_visible_in_tree() const { if (!is_inside_tree()) return false; @@ -190,7 +190,7 @@ bool CanvasItem::is_visible() const { const CanvasItem *p=this; while(p) { - if (p->hidden) + if (!p->visible) return false; p=p->get_parent_item(); } @@ -199,13 +199,6 @@ bool CanvasItem::is_visible() const { return true; } -bool CanvasItem::is_hidden() const { - - /*if (!is_inside_scene()) - return false;*/ - - return hidden; -} void CanvasItem::_propagate_visibility_changed(bool p_visible) { @@ -221,7 +214,7 @@ void CanvasItem::_propagate_visibility_changed(bool p_visible) { CanvasItem *c=get_child(i)->cast_to<CanvasItem>(); - if (c && !c->hidden) //should the toplevels stop propagation? i think so but.. + if (c && c->visible) //should the toplevels stop propagation? i think so but.. c->_propagate_visibility_changed(p_visible); } @@ -231,10 +224,10 @@ void CanvasItem::_propagate_visibility_changed(bool p_visible) { void CanvasItem::show() { - if (!hidden) + if (visible) return; - hidden=false; + visible=true; VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,true); if (!is_inside_tree()) @@ -247,10 +240,10 @@ void CanvasItem::show() { void CanvasItem::hide() { - if (hidden) + if (!visible) return; - hidden=true; + visible=false; VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,false); if (!is_inside_tree()) @@ -260,16 +253,6 @@ void CanvasItem::hide() { _change_notify("visibility/visible"); } -void CanvasItem::set_hidden(bool p_hidden) { - - if (hidden == p_hidden) { - return; - } - - _set_visible_(!p_hidden); -} - - Variant CanvasItem::edit_get_state() const { @@ -306,7 +289,7 @@ void CanvasItem::_update_callback() { VisualServer::get_singleton()->canvas_item_clear(get_canvas_item()); //todo updating = true - only allow drawing here - if (is_visible()) { //todo optimize this!! + if (is_visible_in_tree()) { //todo optimize this!! if (first_draw) { notification(NOTIFICATION_VISIBILITY_CHANGED); first_draw=false; @@ -411,7 +394,7 @@ void CanvasItem::_enter_canvas() { else get_viewport()->gui_reset_canvas_sort_index(); - get_tree()->call_group(SceneTree::GROUP_CALL_UNIQUE,group,"_toplevel_raise_self"); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_UNIQUE,group,"_toplevel_raise_self"); } else { @@ -461,7 +444,7 @@ void CanvasItem::_notification(int p_what) { break; if (group!="") { - get_tree()->call_group(SceneTree::GROUP_CALL_UNIQUE,group,"_toplevel_raise_self"); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_UNIQUE,group,"_toplevel_raise_self"); } else { CanvasItem *p = get_parent_item(); ERR_FAIL_COND(!p); @@ -495,16 +478,16 @@ void CanvasItem::_notification(int p_what) { } } -void CanvasItem::_set_visible_(bool p_visible) { +void CanvasItem::set_visible(bool p_visible) { if (p_visible) show(); else hide(); } -bool CanvasItem::_is_visible_() const { +bool CanvasItem::is_visible() const { - return !is_hidden(); + return visible; } @@ -769,7 +752,7 @@ void CanvasItem::_notify_transform(CanvasItem *p_node) { p_node->global_invalid=true; - if (!p_node->xform_change.in_list()) { + if (notify_transform && !p_node->xform_change.in_list()) { if (!p_node->block_transform_notify) { if (p_node->is_inside_tree()) get_tree()->xform_change_list.add(&p_node->xform_change); @@ -835,7 +818,7 @@ Ref<World2D> CanvasItem::get_world_2d() const { RID CanvasItem::get_viewport_rid() const { ERR_FAIL_COND_V(!is_inside_tree(),RID()); - return get_viewport()->get_viewport(); + return get_viewport()->get_viewport_rid(); } void CanvasItem::set_block_transform_notify(bool p_enable) { @@ -924,8 +907,6 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(_MD("_toplevel_raise_self"),&CanvasItem::_toplevel_raise_self); ClassDB::bind_method(_MD("_update_callback"),&CanvasItem::_update_callback); - ClassDB::bind_method(_MD("_set_visible_"),&CanvasItem::_set_visible_); - ClassDB::bind_method(_MD("_is_visible_"),&CanvasItem::_is_visible_); ClassDB::bind_method(_MD("edit_set_state","state"),&CanvasItem::edit_set_state); ClassDB::bind_method(_MD("edit_get_state:Variant"),&CanvasItem::edit_get_state); @@ -938,11 +919,11 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(_MD("get_canvas_item"),&CanvasItem::get_canvas_item); + ClassDB::bind_method(_MD("set_visible"),&CanvasItem::set_visible); ClassDB::bind_method(_MD("is_visible"),&CanvasItem::is_visible); - ClassDB::bind_method(_MD("is_hidden"),&CanvasItem::is_hidden); + ClassDB::bind_method(_MD("is_visible_in_tree"),&CanvasItem::is_visible_in_tree); ClassDB::bind_method(_MD("show"),&CanvasItem::show); ClassDB::bind_method(_MD("hide"),&CanvasItem::hide); - ClassDB::bind_method(_MD("set_hidden","hidden"),&CanvasItem::set_hidden); ClassDB::bind_method(_MD("update"),&CanvasItem::update); @@ -997,6 +978,12 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(_MD("set_use_parent_material","enable"),&CanvasItem::set_use_parent_material); ClassDB::bind_method(_MD("get_use_parent_material"),&CanvasItem::get_use_parent_material); + ClassDB::bind_method(_MD("set_notify_local_transform","enable"),&CanvasItem::set_notify_local_transform); + ClassDB::bind_method(_MD("is_local_transform_notification_enabled"),&CanvasItem::is_local_transform_notification_enabled); + + ClassDB::bind_method(_MD("set_notify_transform","enable"),&CanvasItem::set_notify_transform); + ClassDB::bind_method(_MD("is_transform_notification_enabled"),&CanvasItem::is_transform_notification_enabled); + ClassDB::bind_method(_MD("make_canvas_pos_local","screen_point"), &CanvasItem::make_canvas_pos_local); ClassDB::bind_method(_MD("make_input_local","event"),&CanvasItem::make_input_local); @@ -1004,7 +991,7 @@ void CanvasItem::_bind_methods() { BIND_VMETHOD(MethodInfo("_draw")); ADD_GROUP("Visibility",""); - ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"visible"), _SCS("_set_visible_"),_SCS("_is_visible_") ); + ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"visible"), _SCS("set_visible"),_SCS("is_visible") ); ADD_PROPERTYNO( PropertyInfo(Variant::COLOR,"modulate"), _SCS("set_modulate"),_SCS("get_modulate") ); ADD_PROPERTYNO( PropertyInfo(Variant::COLOR,"self_modulate"), _SCS("set_self_modulate"),_SCS("get_self_modulate") ); ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"show_behind_parent"), _SCS("set_draw_behind_parent"),_SCS("is_draw_behind_parent_enabled") ); @@ -1081,6 +1068,15 @@ bool CanvasItem::is_local_transform_notification_enabled() const { return notify_local_transform; } + +void CanvasItem::set_notify_transform(bool p_enable) { + notify_transform=p_enable; +} + +bool CanvasItem::is_transform_notification_enabled() const { + return notify_transform; +} + int CanvasItem::get_canvas_layer() const { if (canvas_layer) @@ -1110,7 +1106,7 @@ CanvasItem::CanvasItem() : xform_change(this) { canvas_item=VisualServer::get_singleton()->canvas_item_create(); - hidden=false; + visible=true; pending_update=false; modulate=Color(1,1,1,1); self_modulate=Color(1,1,1,1); @@ -1118,12 +1114,13 @@ CanvasItem::CanvasItem() : xform_change(this) { first_draw=false; drawing=false; behind=false; - block_transform_notify=false; -// viewport=NULL; + block_transform_notify=false; + //viewport=NULL; canvas_layer=NULL; use_parent_material=false; global_invalid=true; notify_local_transform=false; + notify_transform=false; light_mask=1; C=NULL; diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index fded547275..9688b873c0 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -109,7 +109,7 @@ private: int light_mask; bool first_draw; - bool hidden; + bool visible; bool pending_update; bool toplevel; bool drawing; @@ -117,6 +117,7 @@ private: bool behind; bool use_parent_material; bool notify_local_transform; + bool notify_transform; Ref<CanvasItemMaterial> material; @@ -128,8 +129,6 @@ private: void _propagate_visibility_changed(bool p_visible); - void _set_visible_(bool p_visible); - bool _is_visible_() const; void _update_callback(); @@ -173,11 +172,11 @@ public: /* VISIBILITY */ + void set_visible(bool p_visible); bool is_visible() const; - bool is_hidden() const; + bool is_visible_in_tree() const; void show(); void hide(); - void set_hidden(bool p_hidden); void update(); @@ -256,6 +255,9 @@ public: void set_notify_local_transform(bool p_enable); bool is_local_transform_notification_enabled() const; + void set_notify_transform(bool p_enable); + bool is_transform_notification_enabled() const; + int get_canvas_layer() const; CanvasItem(); diff --git a/scene/2d/canvas_modulate.cpp b/scene/2d/canvas_modulate.cpp index 583f03eab1..138589651c 100644 --- a/scene/2d/canvas_modulate.cpp +++ b/scene/2d/canvas_modulate.cpp @@ -33,7 +33,7 @@ void CanvasModulate::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_CANVAS) { - if (is_visible()) { + if (is_visible_in_tree()) { VS::get_singleton()->canvas_set_modulate(get_canvas(),color); add_to_group("_canvas_modulate_"+itos(get_canvas().get_id())); } @@ -42,13 +42,13 @@ void CanvasModulate::_notification(int p_what) { } else if (p_what==NOTIFICATION_EXIT_CANVAS) { - if (is_visible()) { + if (is_visible_in_tree()) { VS::get_singleton()->canvas_set_modulate(get_canvas(),Color(1,1,1,1)); remove_from_group("_canvas_modulate_"+itos(get_canvas().get_id())); } } else if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - if (is_visible()) { + if (is_visible_in_tree()) { VS::get_singleton()->canvas_set_modulate(get_canvas(),color); add_to_group("_canvas_modulate_"+itos(get_canvas().get_id())); } else { @@ -83,7 +83,7 @@ Color CanvasModulate::get_color() const { String CanvasModulate::get_configuration_warning() const { - if (!is_visible() || !is_inside_tree()) + if (!is_visible_in_tree() || !is_inside_tree()) return String(); List<Node*> nodes; diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 3d90346209..3668963251 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -212,7 +212,7 @@ void CollisionObject2D::_mouse_exit() { void CollisionObject2D::_update_pickable() { if (!is_inside_tree()) return; - bool pickable = this->pickable && is_inside_tree() && is_visible(); + bool pickable = this->pickable && is_inside_tree() && is_visible_in_tree(); if (area) Physics2DServer::get_singleton()->area_set_pickable(rid,pickable); else @@ -282,7 +282,7 @@ void CollisionObject2D::set_shape(int p_shape_idx, const Ref<Shape2D>& p_shape) else Physics2DServer::get_singleton()->body_set_shape(get_rid(),p_shape_idx,p_shape->get_rid()); -// _update_shapes(); + //_update_shapes(); } void CollisionObject2D::set_shape_transform(int p_shape_idx, const Transform2D& p_transform) { @@ -295,7 +295,7 @@ void CollisionObject2D::set_shape_transform(int p_shape_idx, const Transform2D& else Physics2DServer::get_singleton()->body_set_shape_transform(get_rid(),p_shape_idx,p_transform); -// _update_shapes(); + //_update_shapes(); } Ref<Shape2D> CollisionObject2D::get_shape(int p_shape_idx) const { @@ -363,6 +363,7 @@ CollisionObject2D::CollisionObject2D() { //owner= + set_notify_transform(true); } diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index b9dc8fe130..2935f6b9f7 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -83,7 +83,7 @@ void Light2D::_update_light_visibility() { } #endif - VS::get_singleton()->canvas_light_set_enabled(canvas_light,enabled && is_visible() && editor_ok); + VS::get_singleton()->canvas_light_set_enabled(canvas_light,enabled && is_visible_in_tree() && editor_ok); } void Light2D::set_enabled( bool p_enabled) { @@ -482,6 +482,7 @@ Light2D::Light2D() { shadow_color=Color(0,0,0,0); shadow_filter=SHADOW_FILTER_NONE; + set_notify_transform(true); } Light2D::~Light2D() { diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index 8d447c3e8b..77c9b8184a 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -123,7 +123,7 @@ void LightOccluder2D::_notification(int p_what) { VS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder,get_canvas()); VS::get_singleton()->canvas_light_occluder_set_transform(occluder,get_global_transform()); - VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible()); + VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible_in_tree()); } if (p_what==NOTIFICATION_TRANSFORM_CHANGED) { @@ -132,7 +132,7 @@ void LightOccluder2D::_notification(int p_what) { } if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible()); + VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible_in_tree()); } if (p_what==NOTIFICATION_DRAW) { @@ -242,6 +242,7 @@ LightOccluder2D::LightOccluder2D() { occluder=VS::get_singleton()->canvas_light_occluder_create(); mask=1; + set_notify_transform(true); } LightOccluder2D::~LightOccluder2D() { diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp index 2d0fbf1cfc..03c2c698eb 100644 --- a/scene/2d/navigation2d.cpp +++ b/scene/2d/navigation2d.cpp @@ -432,7 +432,7 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2& p_start, const Vect while(!found_route) { if (open_list.size()==0) { - // print_line("NOU OPEN LIST"); + //print_line("NOU OPEN LIST"); break; } //check open list diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 5c1837ad65..012120d023 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -310,7 +310,7 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) { if (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) update(); -// update_gizmo(); + //update_gizmo(); } bool NavigationPolygonInstance::is_enabled() const { @@ -459,7 +459,7 @@ void NavigationPolygonInstance::_navpoly_changed() { String NavigationPolygonInstance::get_configuration_warning() const { - if (!is_visible() || !is_inside_tree()) + if (!is_visible_in_tree() || !is_inside_tree()) return String(); if (!navpoly.is_valid()) { @@ -497,5 +497,6 @@ NavigationPolygonInstance::NavigationPolygonInstance() { navigation=NULL; nav_id=-1; enabled=true; + set_notify_transform(true); } diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 0508a715eb..e1d1920cc5 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -239,7 +239,7 @@ void PathFollow2D::_get_property_list( List<PropertyInfo> *p_list) const{ String PathFollow2D::get_configuration_warning() const { - if (!is_visible() || !is_inside_tree()) + if (!is_visible_in_tree() || !is_inside_tree()) return String(); if (!get_parent() || !get_parent()->cast_to<Path2D>()) { diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 1498ad13a6..feecbd9e20 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -70,19 +70,19 @@ float PhysicsBody2D::get_one_way_collision_max_depth() const{ void PhysicsBody2D::_set_layers(uint32_t p_mask) { - set_layer_mask(p_mask); + set_collision_layer(p_mask); set_collision_mask(p_mask); } uint32_t PhysicsBody2D::_get_layers() const{ - return get_layer_mask(); + return get_collision_layer(); } void PhysicsBody2D::_bind_methods() { - ClassDB::bind_method(_MD("set_layer_mask","mask"),&PhysicsBody2D::set_layer_mask); - ClassDB::bind_method(_MD("get_layer_mask"),&PhysicsBody2D::get_layer_mask); + ClassDB::bind_method(_MD("set_collision_layer","mask"),&PhysicsBody2D::set_collision_layer); + ClassDB::bind_method(_MD("get_collision_layer"),&PhysicsBody2D::get_collision_layer); ClassDB::bind_method(_MD("set_collision_mask","mask"),&PhysicsBody2D::set_collision_mask); ClassDB::bind_method(_MD("get_collision_mask"),&PhysicsBody2D::get_collision_mask); @@ -90,8 +90,8 @@ void PhysicsBody2D::_bind_methods() { ClassDB::bind_method(_MD("set_collision_mask_bit","bit","value"),&PhysicsBody2D::set_collision_mask_bit); ClassDB::bind_method(_MD("get_collision_mask_bit","bit"),&PhysicsBody2D::get_collision_mask_bit); - ClassDB::bind_method(_MD("set_layer_mask_bit","bit","value"),&PhysicsBody2D::set_layer_mask_bit); - ClassDB::bind_method(_MD("get_layer_mask_bit","bit"),&PhysicsBody2D::get_layer_mask_bit); + ClassDB::bind_method(_MD("set_collision_layer_bit","bit","value"),&PhysicsBody2D::set_collision_layer_bit); + ClassDB::bind_method(_MD("get_collision_layer_bit","bit"),&PhysicsBody2D::get_collision_layer_bit); ClassDB::bind_method(_MD("_set_layers","mask"),&PhysicsBody2D::_set_layers); ClassDB::bind_method(_MD("_get_layers"),&PhysicsBody2D::_get_layers); @@ -102,21 +102,22 @@ void PhysicsBody2D::_bind_methods() { ClassDB::bind_method(_MD("add_collision_exception_with","body:PhysicsBody2D"),&PhysicsBody2D::add_collision_exception_with); ClassDB::bind_method(_MD("remove_collision_exception_with","body:PhysicsBody2D"),&PhysicsBody2D::remove_collision_exception_with); ADD_PROPERTY(PropertyInfo(Variant::INT,"layers",PROPERTY_HINT_LAYERS_2D_PHYSICS,"",0),_SCS("_set_layers"),_SCS("_get_layers")); //for backwards compat + ADD_GROUP("Collision","collision_"); - ADD_PROPERTY(PropertyInfo(Variant::INT,"collision_layers",PROPERTY_HINT_LAYERS_2D_PHYSICS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"collision_layer",PROPERTY_HINT_LAYERS_2D_PHYSICS),_SCS("set_collision_layer"),_SCS("get_collision_layer")); ADD_PROPERTY(PropertyInfo(Variant::INT,"collision_mask",PROPERTY_HINT_LAYERS_2D_PHYSICS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); ADD_GROUP("",""); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2,"one_way_collision/direction"),_SCS("set_one_way_collision_direction"),_SCS("get_one_way_collision_direction")); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"one_way_collision/max_depth"),_SCS("set_one_way_collision_max_depth"),_SCS("get_one_way_collision_max_depth")); } -void PhysicsBody2D::set_layer_mask(uint32_t p_mask) { +void PhysicsBody2D::set_collision_layer(uint32_t p_mask) { mask=p_mask; Physics2DServer::get_singleton()->body_set_layer_mask(get_rid(),p_mask); } -uint32_t PhysicsBody2D::get_layer_mask() const { +uint32_t PhysicsBody2D::get_collision_layer() const { return mask; } @@ -148,20 +149,20 @@ bool PhysicsBody2D::get_collision_mask_bit(int p_bit) const{ } -void PhysicsBody2D::set_layer_mask_bit(int p_bit, bool p_value) { +void PhysicsBody2D::set_collision_layer_bit(int p_bit, bool p_value) { - uint32_t mask = get_layer_mask(); + uint32_t mask = get_collision_layer(); if (p_value) mask|=1<<p_bit; else mask&=~(1<<p_bit); - set_layer_mask(mask); + set_collision_layer(mask); } -bool PhysicsBody2D::get_layer_mask_bit(int p_bit) const{ +bool PhysicsBody2D::get_collision_layer_bit(int p_bit) const{ - return get_layer_mask()&(1<<p_bit); + return get_collision_layer()&(1<<p_bit); } PhysicsBody2D::PhysicsBody2D(Physics2DServer::BodyMode p_mode) : CollisionObject2D( Physics2DServer::get_singleton()->body_create(p_mode), false) { @@ -374,7 +375,7 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap if (!E) { E = contact_monitor->body_map.insert(objid,BodyState()); -// E->get().rc=0; + //E->get().rc=0; E->get().in_scene=node && node->is_inside_tree(); if (node) { node->connect(SceneStringNames::get_singleton()->tree_entered,this,SceneStringNames::get_singleton()->_body_enter_tree,make_binds(objid)); @@ -493,7 +494,7 @@ void RigidBody2D::_direct_state_changed(Object *p_state) { int local_shape = state->get_contact_local_shape(i); int shape = state->get_contact_collider_shape(i); -// bool found=false; + //bool found=false; Map<ObjectID,BodyState>::Element *E=contact_monitor->body_map.find(obj); if (!E) { @@ -1140,8 +1141,10 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) { float d = a.distance_to(b); - //if (d<margin) - /// continue; + /* + if (d<margin) + continue; + */ recover_motion+=(b-a)*0.4; } diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index 2637238c04..5b7db35fe8 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -55,8 +55,8 @@ protected: static void _bind_methods(); public: - void set_layer_mask(uint32_t p_mask); - uint32_t get_layer_mask() const; + void set_collision_layer(uint32_t p_mask); + uint32_t get_collision_layer() const; void set_collision_mask(uint32_t p_mask); uint32_t get_collision_mask() const; @@ -65,8 +65,8 @@ public: void set_collision_mask_bit(int p_bit, bool p_value); bool get_collision_mask_bit(int p_bit) const; - void set_layer_mask_bit(int p_bit, bool p_value); - bool get_layer_mask_bit(int p_bit) const; + void set_collision_layer_bit(int p_bit, bool p_value); + bool get_collision_layer_bit(int p_bit) const; void add_collision_exception_with(Node* p_node); //must be physicsbody void remove_collision_exception_with(Node* p_node); diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp index c7ec84a8d7..77f1a9d500 100644 --- a/scene/2d/remote_transform_2d.cpp +++ b/scene/2d/remote_transform_2d.cpp @@ -127,7 +127,7 @@ void RemoteTransform2D::_bind_methods() { RemoteTransform2D::RemoteTransform2D() { cache=0; - + set_notify_transform(true); } diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index 3aacd7091a..20db63b66f 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -236,7 +236,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) { if (p_event.screen_touch.pressed) { - if (!is_visible()) + if (!is_visible_in_tree()) return; if (finger_pressed!=-1) @@ -307,8 +307,10 @@ Rect2 TouchScreenButton::get_item_rect() const { if (texture.is_null()) return Rect2(0,0,1,1); - //if (texture.is_null()) - // return CanvasItem::get_item_rect(); + /* + if (texture.is_null()) + return CanvasItem::get_item_rect(); + */ return Rect2(Size2(),texture->get_size()); } diff --git a/scene/2d/sound_player_2d.cpp b/scene/2d/sound_player_2d.cpp index 96382caa25..7861fb5855 100644 --- a/scene/2d/sound_player_2d.cpp +++ b/scene/2d/sound_player_2d.cpp @@ -116,7 +116,7 @@ SoundPlayer2D::SoundPlayer2D() { params[PARAM_ATTENUATION_MAX_DISTANCE]=2048; params[PARAM_ATTENUATION_DISTANCE_EXP]=1.0; //linear (and not really good) - + set_notify_transform(true); } SoundPlayer2D::~SoundPlayer2D() { diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 8bad8fcb38..bea45aae4e 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -86,7 +86,7 @@ void Sprite::_notification(int p_what) { Point2 ofs=offset; if (centered) ofs-=s/2; - if (OS::get_singleton()->get_use_pixel_snap()) { + if (Engine::get_singleton()->get_use_pixel_snap()) { ofs=ofs.floor(); } @@ -255,8 +255,10 @@ Rect2 Sprite::get_item_rect() const { if (texture.is_null()) return Rect2(0,0,1,1); - //if (texture.is_null()) - // return CanvasItem::get_item_rect(); + /* + if (texture.is_null()) + return CanvasItem::get_item_rect(); + */ Size2i s; @@ -510,8 +512,10 @@ Rect2 ViewportSprite::get_item_rect() const { if (texture.is_null()) return Rect2(0,0,1,1); - //if (texture.is_null()) - // return CanvasItem::get_item_rect(); + /* + if (texture.is_null()) + return CanvasItem::get_item_rect(); + */ Size2i s; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 7bd3a5d932..d6d713920c 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -457,10 +457,11 @@ void TileMap::_update_dirty_quadrants() { } + Color modulate = tile_set->tile_get_modulate(c.id); if (r==Rect2()) { - tex->draw_rect(canvas_item,rect,false,Color(1,1,1),c.transpose); + tex->draw_rect(canvas_item,rect,false,modulate,c.transpose); } else { - tex->draw_rect_region(canvas_item,rect,r,Color(1,1,1),c.transpose); + tex->draw_rect_region(canvas_item,rect,r,modulate,c.transpose); } Vector< Ref<Shape2D> > shapes = tile_set->tile_get_shapes(c.id); @@ -610,7 +611,7 @@ Map<TileMap::PosKey,TileMap::Quadrant>::Element *TileMap::_create_quadrant(const xform.set_origin( q.pos ); -// q.canvas_item = VisualServer::get_singleton()->canvas_item_create(); + //q.canvas_item = VisualServer::get_singleton()->canvas_item_create(); q.body=Physics2DServer::get_singleton()->body_create(use_kinematic?Physics2DServer::BODY_MODE_KINEMATIC:Physics2DServer::BODY_MODE_STATIC); Physics2DServer::get_singleton()->body_attach_object_instance_ID(q.body,get_instance_ID()); Physics2DServer::get_singleton()->body_set_layer_mask(q.body,collision_layer); @@ -849,8 +850,10 @@ void TileMap::_set_tile_data(const PoolVector<int>& p_data) { bool transpose = v&(1<<31); v&=(1<<29)-1; -// if (x<-20 || y <-20 || x>4000 || y>4000) -// continue; + /* + if (x<-20 || y <-20 || x>4000 || y>4000) + continue; + */ set_cell(x,y,v,flip_h,flip_v,transpose); } @@ -1321,6 +1324,7 @@ TileMap::TileMap() { fp_adjust=0.00001; tile_origin=TILE_ORIGIN_TOP_LEFT; + set_notify_transform(true); } TileMap::~TileMap() { diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index 61d57b0e8c..f1c70a8f60 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -145,6 +145,7 @@ void VisibilityNotifier2D::_bind_methods(){ VisibilityNotifier2D::VisibilityNotifier2D() { rect=Rect2(-10,-10,20,20); + set_notify_transform(true); } diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index c4afed4b31..99e40984c5 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -295,7 +295,7 @@ void Area::_notification(int p_what) { } } -void Area::set_enable_monitoring(bool p_enable) { +void Area::set_monitoring(bool p_enable) { if (locked) { ERR_EXPLAIN("This function can't be used during the in/out signal."); @@ -433,7 +433,7 @@ void Area::_area_inout(int p_status,const RID& p_area, int p_instance, int p_are } -bool Area::is_monitoring_enabled() const { +bool Area::is_monitoring() const { return monitoring; } @@ -622,8 +622,8 @@ void Area::_bind_methods() { ClassDB::bind_method(_MD("is_monitorable"),&Area::is_monitorable); - ClassDB::bind_method(_MD("set_enable_monitoring","enable"),&Area::set_enable_monitoring); - ClassDB::bind_method(_MD("is_monitoring_enabled"),&Area::is_monitoring_enabled); + ClassDB::bind_method(_MD("set_monitoring","enable"),&Area::set_monitoring); + ClassDB::bind_method(_MD("is_monitoring"),&Area::is_monitoring); ClassDB::bind_method(_MD("get_overlapping_bodies"),&Area::get_overlapping_bodies); ClassDB::bind_method(_MD("get_overlapping_areas"),&Area::get_overlapping_areas); @@ -653,7 +653,7 @@ void Area::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::REAL,"linear_damp",PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_linear_damp"),_SCS("get_linear_damp")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"angular_damp",PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_angular_damp"),_SCS("get_angular_damp")); ADD_PROPERTY( PropertyInfo(Variant::INT,"priority",PROPERTY_HINT_RANGE,"0,128,1"),_SCS("set_priority"),_SCS("get_priority")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"monitoring"),_SCS("set_enable_monitoring"),_SCS("is_monitoring_enabled")); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"monitoring"),_SCS("set_monitoring"),_SCS("is_monitoring")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"monitorable"),_SCS("set_monitorable"),_SCS("is_monitorable")); ADD_GROUP("Collision","collision_"); ADD_PROPERTY( PropertyInfo(Variant::INT,"collision_layers",PROPERTY_HINT_LAYERS_3D_PHYSICS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); @@ -676,7 +676,7 @@ Area::Area() : CollisionObject(PhysicsServer::get_singleton()->area_create(),tru collision_mask=1; layer_mask=1; set_ray_pickable(false); - set_enable_monitoring(true); + set_monitoring(true); set_monitorable(true); } diff --git a/scene/3d/area.h b/scene/3d/area.h index 3260bad0a4..7956846505 100644 --- a/scene/3d/area.h +++ b/scene/3d/area.h @@ -153,8 +153,8 @@ public: void set_priority(real_t p_priority); real_t get_priority() const; - void set_enable_monitoring(bool p_enable); - bool is_monitoring_enabled() const; + void set_monitoring(bool p_enable); + bool is_monitoring() const; void set_monitorable(bool p_enable); bool is_monitorable() const; diff --git a/scene/3d/baked_light_instance.cpp b/scene/3d/baked_light_instance.cpp index 59d8d7ecac..e42439bf3b 100644 --- a/scene/3d/baked_light_instance.cpp +++ b/scene/3d/baked_light_instance.cpp @@ -1524,7 +1524,7 @@ void BakedLight::set_cell_subdiv(int p_subdiv) { cell_subdiv=p_subdiv; -// VS::get_singleton()->baked_light_set_subdivision(baked_light,p_subdiv); + //VS::get_singleton()->baked_light_set_subdivision(baked_light,p_subdiv); } int BakedLight::get_cell_subdiv() const { @@ -1745,7 +1745,7 @@ void BakedLight::_bind_methods() { BakedLight::BakedLight() { -// baked_light=VisualServer::get_singleton()->baked_light_create(); + //baked_light=VisualServer::get_singleton()->baked_light_create(); VS::get_singleton()->instance_set_base(get_instance(),baked_light); cell_subdiv=8; @@ -1815,7 +1815,7 @@ void BakedLightSampler::_bind_methods() { ADD_PROPERTYI( PropertyInfo(Variant::REAL,"params/strength",PROPERTY_HINT_RANGE,"0.01,16,0.01"),_SCS("set_param"),_SCS("get_param"),PARAM_STRENGTH); ADD_PROPERTYI( PropertyInfo(Variant::REAL,"params/attenuation",PROPERTY_HINT_EXP_EASING),_SCS("set_param"),_SCS("get_param"),PARAM_ATTENUATION); ADD_PROPERTYI( PropertyInfo(Variant::REAL,"params/detail_ratio",PROPERTY_HINT_RANGE,"0.01,1.0,0.01"),_SCS("set_param"),_SCS("get_param"),PARAM_DETAIL_RATIO); -// ADD_PROPERTYI( PropertyInfo(Variant::REAL,"params/detail_ratio",PROPERTY_HINT_RANGE,"0,20,1"),_SCS("set_param"),_SCS("get_param"),PARAM_DETAIL_RATIO); + //ADD_PROPERTYI( PropertyInfo(Variant::REAL,"params/detail_ratio",PROPERTY_HINT_RANGE,"0,20,1"),_SCS("set_param"),_SCS("get_param"),PARAM_DETAIL_RATIO); ADD_PROPERTY( PropertyInfo(Variant::REAL,"params/resolution",PROPERTY_HINT_RANGE,"4,32,1"),_SCS("set_resolution"),_SCS("get_resolution")); } diff --git a/scene/3d/body_shape.cpp b/scene/3d/body_shape.cpp index ff8b0f15bf..f6ec8639d3 100644 --- a/scene/3d/body_shape.cpp +++ b/scene/3d/body_shape.cpp @@ -96,7 +96,7 @@ void CollisionShape::_update_indicator() { pt = VS::PRIMITIVE_LINES; } else if (shape->cast_to<SphereShape>()) { -// VisualServer *vs=VisualServer::get_singleton(); + //VisualServer *vs=VisualServer::get_singleton(); SphereShape *shapeptr=shape->cast_to<SphereShape>(); @@ -337,7 +337,7 @@ void CollisionShape::_notification(int p_what) { //indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario()); } break; case NOTIFICATION_TRANSFORM_CHANGED: { - // VisualServer::get_singleton()->instance_set_transform(indicator_instance,get_global_transform()); + //VisualServer::get_singleton()->instance_set_transform(indicator_instance,get_global_transform()); if (can_update_body && updating_body) { _update_body(); } diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 6298e629a4..3f36caf62c 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -190,9 +190,11 @@ void Camera::_update_camera() { tr.origin+=tr.basis.get_axis(0)*h_offset; VisualServer::get_singleton()->camera_set_transform( camera, tr ); -// here goes listener stuff -// if (viewport_ptr && is_inside_scene() && is_current()) -// get_viewport()->_camera_transform_changed_notify(); + // here goes listener stuff + /* + if (viewport_ptr && is_inside_scene() && is_current()) + get_viewport()->_camera_transform_changed_notify(); + */ if (is_inside_tree() && is_current()) { get_viewport()->_camera_transform_changed_notify(); @@ -373,7 +375,7 @@ Vector3 Camera::project_local_ray_normal(const Point2& p_pos) const { ray=Vector3(0,0,-1); } else { CameraMatrix cm; - cm.set_perspective(fov,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_perspective(fov,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); float screen_w,screen_h; cm.get_viewport_size(screen_w,screen_h); ray=Vector3( ((cpos.x/viewport_size.width)*2.0-1.0)*screen_w, ((1.0-(cpos.y/viewport_size.height))*2.0-1.0)*screen_h,-near).normalized(); @@ -400,7 +402,7 @@ Vector3 Camera::project_ray_origin(const Point2& p_pos) const { #endif ERR_FAIL_COND_V( viewport_size.y == 0, Vector3() ); -// float aspect = viewport_size.x / viewport_size.y; + //float aspect = viewport_size.x / viewport_size.y; if (mode == PROJECTION_PERSPECTIVE) { @@ -410,10 +412,10 @@ Vector3 Camera::project_ray_origin(const Point2& p_pos) const { Vector2 pos = cpos / viewport_size; float vsize,hsize; if (keep_aspect==KEEP_WIDTH) { - vsize = size/viewport_size.get_aspect(); + vsize = size/viewport_size.aspect(); hsize = size; } else { - hsize = size*viewport_size.get_aspect(); + hsize = size*viewport_size.aspect(); vsize = size; } @@ -449,9 +451,9 @@ Point2 Camera::unproject_position(const Vector3& p_pos) const { if (mode==PROJECTION_ORTHOGONAL) - cm.set_orthogonal(size,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_orthogonal(size,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); else - cm.set_perspective(fov,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_perspective(fov,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); Plane p(get_camera_transform().xform_inv(p_pos),1.0); @@ -479,9 +481,9 @@ Vector3 Camera::project_position(const Point2& p_point) const { CameraMatrix cm; if (mode==PROJECTION_ORTHOGONAL) - cm.set_orthogonal(size,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_orthogonal(size,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); else - cm.set_perspective(fov,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_perspective(fov,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); Size2 vp_size; cm.get_viewport_size(vp_size.x,vp_size.y); @@ -628,9 +630,9 @@ Vector<Plane> Camera::get_frustum() const { Size2 viewport_size = get_viewport()->get_visible_rect().size; CameraMatrix cm; if (mode==PROJECTION_PERSPECTIVE) - cm.set_perspective(fov,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_perspective(fov,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); else - cm.set_orthogonal(size,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_orthogonal(size,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); return cm.get_projection_planes(get_camera_transform()); @@ -678,6 +680,7 @@ Camera::Camera() { h_offset=0; VisualServer::get_singleton()->camera_set_cull_mask(camera,layers); //active=false; + set_notify_transform(true); } diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp index 0660d0bdad..7bba382db0 100644 --- a/scene/3d/collision_object.cpp +++ b/scene/3d/collision_object.cpp @@ -206,7 +206,7 @@ void CollisionObject::_mouse_exit() { void CollisionObject::_update_pickable() { if (!is_inside_tree()) return; - bool pickable = ray_pickable && is_inside_tree() && is_visible(); + bool pickable = ray_pickable && is_inside_tree() && is_visible_in_tree(); if (area) PhysicsServer::get_singleton()->area_set_ray_pickable(rid,pickable); else @@ -339,7 +339,7 @@ CollisionObject::CollisionObject(RID p_rid, bool p_area) { } else { PhysicsServer::get_singleton()->body_attach_object_instance_ID(rid,get_instance_ID()); } -// set_transform_notify(true); + //set_transform_notify(true); } @@ -360,7 +360,7 @@ CollisionObject::CollisionObject() { capture_input_on_drag=false; ray_pickable=true; - + set_notify_transform(true); //owner= //set_transform_notify(true); diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 13e7c175ed..54d7cb6b9e 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -1182,7 +1182,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){ if (p_create_visual_debug) { - // _create_debug_mesh(&baker); + //_create_debug_mesh(&baker); } diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 50ee3482c3..d685cd8ce7 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -164,7 +164,7 @@ void Light::_update_visibility() { } #endif - //VS::get_singleton()->instance_light_set_enabled(get_instance(),is_visible() && editor_ok); + //VS::get_singleton()->instance_light_set_enabled(get_instance(),is_visible_in_tree() && editor_ok); _change_notify("geometry/visible"); } diff --git a/scene/3d/listener.cpp b/scene/3d/listener.cpp index a227f5cd70..0aa1128bdb 100644 --- a/scene/3d/listener.cpp +++ b/scene/3d/listener.cpp @@ -156,6 +156,7 @@ Listener::Listener() { current=false; force_change=false; + set_notify_transform(true); //active=false; } diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index c4712ecc7a..764aff1c08 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -42,10 +42,10 @@ bool MeshInstance::_set(const StringName& p_name, const Variant& p_value) { return false; - Map<StringName,MorphTrack>::Element *E = morph_tracks.find(p_name); + Map<StringName,BlendShapeTrack>::Element *E = blend_shape_tracks.find(p_name); if (E) { E->get().value=p_value; - VisualServer::get_singleton()->instance_set_morph_target_weight(get_instance(),E->get().idx,E->get().value); + VisualServer::get_singleton()->instance_set_blend_shape_weight(get_instance(),E->get().idx,E->get().value); return true; } @@ -67,7 +67,7 @@ bool MeshInstance::_get(const StringName& p_name,Variant &r_ret) const { if (!get_instance().is_valid()) return false; - const Map<StringName,MorphTrack>::Element *E = morph_tracks.find(p_name); + const Map<StringName,BlendShapeTrack>::Element *E = blend_shape_tracks.find(p_name); if (E) { r_ret = E->get().value; return true; @@ -86,7 +86,7 @@ bool MeshInstance::_get(const StringName& p_name,Variant &r_ret) const { void MeshInstance::_get_property_list( List<PropertyInfo> *p_list) const { List<String> ls; - for(const Map<StringName,MorphTrack>::Element *E=morph_tracks.front();E;E=E->next()) { + for(const Map<StringName,BlendShapeTrack>::Element *E=blend_shape_tracks.front();E;E=E->next()) { ls.push_back(E->key()); } @@ -119,16 +119,16 @@ void MeshInstance::set_mesh(const Ref<Mesh>& p_mesh) { mesh=p_mesh; - morph_tracks.clear(); + blend_shape_tracks.clear(); if (mesh.is_valid()) { - for(int i=0;i<mesh->get_morph_target_count();i++) { + for(int i=0;i<mesh->get_blend_shape_count();i++) { - MorphTrack mt; + BlendShapeTrack mt; mt.idx=i; mt.value=0; - morph_tracks["morph/"+String(mesh->get_morph_target_name(i))]=mt; + blend_shape_tracks["blend_shapes/"+String(mesh->get_blend_shape_name(i))]=mt; } mesh->connect(CoreStringNames::get_singleton()->changed,this,SceneStringNames::get_singleton()->_mesh_changed); @@ -298,7 +298,7 @@ void MeshInstance::_bind_methods() { ClassDB::bind_method(_MD("get_mesh:Mesh"),&MeshInstance::get_mesh); ClassDB::bind_method(_MD("set_skeleton_path","skeleton_path:NodePath"),&MeshInstance::set_skeleton_path); ClassDB::bind_method(_MD("get_skeleton_path:NodePath"),&MeshInstance::get_skeleton_path); - ClassDB::bind_method(_MD("get_aabb"),&MeshInstance::get_aabb); + ClassDB::bind_method(_MD("create_trimesh_collision"),&MeshInstance::create_trimesh_collision); ClassDB::set_method_flags("MeshInstance","create_trimesh_collision",METHOD_FLAGS_DEFAULT); ClassDB::bind_method(_MD("create_convex_collision"),&MeshInstance::create_convex_collision); diff --git a/scene/3d/mesh_instance.h b/scene/3d/mesh_instance.h index 4d28cc2942..2d1af46980 100644 --- a/scene/3d/mesh_instance.h +++ b/scene/3d/mesh_instance.h @@ -42,14 +42,14 @@ class MeshInstance : public GeometryInstance { Ref<Mesh> mesh; NodePath skeleton_path; - struct MorphTrack { + struct BlendShapeTrack { int idx; float value; - MorphTrack() { idx=0; value=0; } + BlendShapeTrack() { idx=0; value=0; } }; - Map<StringName,MorphTrack> morph_tracks; + Map<StringName,BlendShapeTrack> blend_shape_tracks; Vector<Ref<Material> > materials; void _mesh_changed(); diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index 40666a60dc..9bb19880bf 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -368,7 +368,7 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3& p_start, const Vector while(!found_route) { if (open_list.size()==0) { - // print_line("NOU OPEN LIST"); + //print_line("NOU OPEN LIST"); break; } //check open list diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 434b400e01..4018045390 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -373,7 +373,7 @@ Ref<NavigationMesh> NavigationMeshInstance::get_navigation_mesh() const{ String NavigationMeshInstance::get_configuration_warning() const { - if (!is_visible() || !is_inside_tree()) + if (!is_visible_in_tree() || !is_inside_tree()) return String(); if (!navmesh.is_valid()) { @@ -410,5 +410,6 @@ NavigationMeshInstance::NavigationMeshInstance() { navigation=NULL; nav_id=-1; enabled=true; + set_notify_transform(true); } diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 9e37658cd9..72fab4cccc 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -325,7 +325,7 @@ RES Particles::_get_gizmo_geometry() const { mat->set_parameter( FixedSpatialMaterial::PARAM_EMISSION,Color(0.5,0.7,0.8) ); mat->set_blend_mode( Material::BLEND_MODE_ADD ); mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); -// mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true); + //mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true); surface_tool->begin(Mesh::PRIMITIVE_TRIANGLES); @@ -334,7 +334,7 @@ RES Particles::_get_gizmo_geometry() const { int sides=16; int sections=24; -// float len=1; + //float len=1; float deg=Math::deg2rad(var[VAR_SPREAD]*180); if (deg==180) deg=179.5; diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index f923ba1aaf..0a44ad9c3d 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -58,13 +58,13 @@ float PhysicsBody::get_inverse_mass() const { } -void PhysicsBody::set_layer_mask(uint32_t p_mask) { +void PhysicsBody::set_collision_layer(uint32_t p_mask) { layer_mask=p_mask; PhysicsServer::get_singleton()->body_set_layer_mask(get_rid(),p_mask); } -uint32_t PhysicsBody::get_layer_mask() const { +uint32_t PhysicsBody::get_collision_layer() const { return layer_mask; } @@ -97,20 +97,20 @@ bool PhysicsBody::get_collision_mask_bit(int p_bit) const{ } -void PhysicsBody::set_layer_mask_bit(int p_bit, bool p_value) { +void PhysicsBody::set_collision_layer_bit(int p_bit, bool p_value) { - uint32_t mask = get_layer_mask(); + uint32_t mask = get_collision_layer(); if (p_value) mask|=1<<p_bit; else mask&=~(1<<p_bit); - set_layer_mask(mask); + set_collision_layer(mask); } -bool PhysicsBody::get_layer_mask_bit(int p_bit) const{ +bool PhysicsBody::get_collision_layer_bit(int p_bit) const{ - return get_layer_mask()&(1<<p_bit); + return get_collision_layer()&(1<<p_bit); } void PhysicsBody::add_collision_exception_with(Node* p_node) { @@ -137,18 +137,18 @@ void PhysicsBody::remove_collision_exception_with(Node* p_node) { } void PhysicsBody::_set_layers(uint32_t p_mask) { - set_layer_mask(p_mask); + set_collision_layer(p_mask); set_collision_mask(p_mask); } uint32_t PhysicsBody::_get_layers() const{ - return get_layer_mask(); + return get_collision_layer(); } void PhysicsBody::_bind_methods() { - ClassDB::bind_method(_MD("set_layer_mask","mask"),&PhysicsBody::set_layer_mask); - ClassDB::bind_method(_MD("get_layer_mask"),&PhysicsBody::get_layer_mask); + ClassDB::bind_method(_MD("set_collision_layer","layer"),&PhysicsBody::set_collision_layer); + ClassDB::bind_method(_MD("get_collision_layer"),&PhysicsBody::get_collision_layer); ClassDB::bind_method(_MD("set_collision_mask","mask"),&PhysicsBody::set_collision_mask); ClassDB::bind_method(_MD("get_collision_mask"),&PhysicsBody::get_collision_mask); @@ -156,13 +156,14 @@ void PhysicsBody::_bind_methods() { ClassDB::bind_method(_MD("set_collision_mask_bit","bit","value"),&PhysicsBody::set_collision_mask_bit); ClassDB::bind_method(_MD("get_collision_mask_bit","bit"),&PhysicsBody::get_collision_mask_bit); - ClassDB::bind_method(_MD("set_layer_mask_bit","bit","value"),&PhysicsBody::set_layer_mask_bit); - ClassDB::bind_method(_MD("get_layer_mask_bit","bit"),&PhysicsBody::get_layer_mask_bit); + ClassDB::bind_method(_MD("set_collision_layer_bit","bit","value"),&PhysicsBody::set_collision_layer_bit); + ClassDB::bind_method(_MD("get_collision_layer_bit","bit"),&PhysicsBody::get_collision_layer_bit); ClassDB::bind_method(_MD("_set_layers","mask"),&PhysicsBody::_set_layers); ClassDB::bind_method(_MD("_get_layers"),&PhysicsBody::_get_layers); - ADD_PROPERTY(PropertyInfo(Variant::INT,"collision_layers",PROPERTY_HINT_LAYERS_3D_PHYSICS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); + ADD_GROUP("Collision","collision_"); + ADD_PROPERTY(PropertyInfo(Variant::INT,"collision_layer",PROPERTY_HINT_LAYERS_3D_PHYSICS),_SCS("set_collision_layer"),_SCS("get_collision_layer")); ADD_PROPERTY(PropertyInfo(Variant::INT,"collision_mask",PROPERTY_HINT_LAYERS_3D_PHYSICS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); } @@ -436,7 +437,7 @@ void RigidBody::_direct_state_changed(Object *p_state) { int local_shape = state->get_contact_local_shape(i); int shape = state->get_contact_collider_shape(i); -// bool found=false; + //bool found=false; Map<ObjectID,BodyState>::Element *E=contact_monitor->body_map.find(obj); if (!E) { @@ -999,7 +1000,7 @@ Vector3 KinematicBody::move(const Vector3& p_motion) { if (collide_character) mask|=PhysicsDirectSpaceState::TYPE_MASK_CHARACTER_BODY; -// print_line("motion: "+p_motion+" margin: "+rtos(margin)); + //print_line("motion: "+p_motion+" margin: "+rtos(margin)); //print_line("margin: "+rtos(margin)); @@ -1014,7 +1015,7 @@ Vector3 KinematicBody::move(const Vector3& p_motion) { if (is_shape_set_as_trigger(i)) continue; - if (dss->collide_shape(get_shape(i)->get_rid(), get_global_transform() * get_shape_transform(i),m,sr,max_shapes,res_shapes,exclude,get_layer_mask(),mask)) { + if (dss->collide_shape(get_shape(i)->get_rid(), get_global_transform() * get_shape_transform(i),m,sr,max_shapes,res_shapes,exclude,get_collision_layer(),mask)) { collided=true; } @@ -1037,10 +1038,10 @@ Vector3 KinematicBody::move(const Vector3& p_motion) { #if 0 float d = a.distance_to(b); - //if (d<margin) - /// continue; - /// - /// + /* + if (d<margin) + continue; + */ recover_motion+=(b-a)*0.2; #else float dist = a.distance_to(b); @@ -1096,7 +1097,7 @@ Vector3 KinematicBody::move(const Vector3& p_motion) { float lsafe,lunsafe; PhysicsDirectSpaceState::ShapeRestInfo lrest; - bool valid = dss->cast_motion(get_shape(i)->get_rid(), get_global_transform() * get_shape_transform(i), p_motion,0, lsafe,lunsafe,exclude,get_layer_mask(),mask,&lrest); + bool valid = dss->cast_motion(get_shape(i)->get_rid(), get_global_transform() * get_shape_transform(i), p_motion,0, lsafe,lunsafe,exclude,get_collision_layer(),mask,&lrest); //print_line("shape: "+itos(i)+" travel:"+rtos(ltravel)); if (!valid) { safe=0; @@ -1137,13 +1138,13 @@ Vector3 KinematicBody::move(const Vector3& p_motion) { ugt.origin+=p_motion*unsafe; PhysicsDirectSpaceState::ShapeRestInfo rest_info; - bool c2 = dss->rest_info(get_shape(best_shape)->get_rid(), ugt*get_shape_transform(best_shape), m,&rest,exclude,get_layer_mask(),mask); + bool c2 = dss->rest_info(get_shape(best_shape)->get_rid(), ugt*get_shape_transform(best_shape), m,&rest,exclude,get_collision_layer(),mask); if (!c2) { //should not happen, but floating point precision is so weird.. colliding=false; } - // print_line("Rest Travel: "+rest.normal); + //print_line("Rest Travel: "+rest.normal); } @@ -1158,8 +1159,10 @@ Vector3 KinematicBody::move(const Vector3& p_motion) { } Vector3 motion=p_motion*safe; - //if (colliding) - // motion+=normal*0.001; + /* + if (colliding) + motion+=normal*0.001; + */ Transform gt = get_global_transform(); gt.origin+=motion; set_global_transform(gt); @@ -1200,7 +1203,7 @@ bool KinematicBody::can_teleport_to(const Vector3& p_position) { if (is_shape_set_as_trigger(i)) continue; - bool col = dss->intersect_shape(get_shape(i)->get_rid(), xform * get_shape_transform(i),0,NULL,1,exclude,get_layer_mask(),mask); + bool col = dss->intersect_shape(get_shape(i)->get_rid(), xform * get_shape_transform(i),0,NULL,1,exclude,get_collision_layer(),mask); if (col) return false; } diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h index 9f317745b3..86be98f81e 100644 --- a/scene/3d/physics_body.h +++ b/scene/3d/physics_body.h @@ -55,14 +55,14 @@ public: virtual Vector3 get_angular_velocity() const; virtual float get_inverse_mass() const; - void set_layer_mask(uint32_t p_mask); - uint32_t get_layer_mask() const; + void set_collision_layer(uint32_t p_mask); + uint32_t get_collision_layer() const; void set_collision_mask(uint32_t p_mask); uint32_t get_collision_mask() const; - void set_layer_mask_bit(int p_bit, bool p_value); - bool get_layer_mask_bit(int p_bit) const; + void set_collision_layer_bit(int p_bit, bool p_value); + bool get_collision_layer_bit(int p_bit) const; void set_collision_mask_bit(int p_bit, bool p_value); bool get_collision_mask_bit(int p_bit) const; diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp index a27e558e45..f2668480f5 100644 --- a/scene/3d/physics_joint.cpp +++ b/scene/3d/physics_joint.cpp @@ -195,6 +195,7 @@ Joint::Joint() { exclude_from_collision=true; solver_priority=1; + set_notify_transform(true); } diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp index c3cb20bfdd..9f4b5c7a03 100644 --- a/scene/3d/proximity_group.cpp +++ b/scene/3d/proximity_group.cpp @@ -135,7 +135,7 @@ void ProximityGroup::broadcast(String p_name, Variant p_params) { E = groups.front(); while (E) { - get_tree()->call_group(SceneTree::GROUP_CALL_DEFAULT, E->key(), "_proximity_group_broadcast", p_name, p_params); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFAULT, E->key(), "_proximity_group_broadcast", p_name, p_params); E = E->next(); }; @@ -190,6 +190,7 @@ ProximityGroup::ProximityGroup() { dispatch_mode = MODE_PROXY; grid_radius = Vector3(1, 1, 1); + set_notify_transform(true); }; diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp index 931f075a84..b91d90ae8e 100644 --- a/scene/3d/remote_transform.cpp +++ b/scene/3d/remote_transform.cpp @@ -127,6 +127,7 @@ void RemoteTransform::_bind_methods() { RemoteTransform::RemoteTransform() { cache=0; + set_notify_transform(true); } diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index 0b19aaf151..cdca54cd84 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -216,6 +216,7 @@ Room::Room() { level=0; + } diff --git a/scene/3d/scenario_fx.cpp b/scene/3d/scenario_fx.cpp index 95ba2c990a..bda7d43570 100644 --- a/scene/3d/scenario_fx.cpp +++ b/scene/3d/scenario_fx.cpp @@ -83,7 +83,7 @@ Ref<Environment> WorldEnvironment::get_environment() const { String WorldEnvironment::get_configuration_warning() const { - if (!is_visible() || !is_inside_tree() || !environment.is_valid()) + if (!is_visible_in_tree() || !is_inside_tree() || !environment.is_valid()) return String(); List<Node*> nodes; diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index 5e576b4960..f2e339604e 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -482,7 +482,7 @@ Transform Skeleton::get_bone_pose(int p_bone) const { void Skeleton::set_bone_custom_pose(int p_bone, const Transform& p_custom_pose) { ERR_FAIL_INDEX( p_bone, bones.size() ); -// ERR_FAIL_COND( !is_inside_scene() ); + //ERR_FAIL_COND( !is_inside_scene() ); bones[p_bone].custom_pose_enable=(p_custom_pose!=Transform()); diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 60580911da..6843a7e9b3 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -74,7 +74,7 @@ SpatialGizmo::SpatialGizmo() { void Spatial::_notify_dirty() { - if (!data.ignore_notification && !xform_change.in_list()) { + if (data.notify_transform && !data.ignore_notification && !xform_change.in_list()) { get_tree()->xform_change_list.add(&xform_change); } @@ -95,8 +95,10 @@ void Spatial::_propagate_transform_changed(Spatial *p_origin) { return; } -// if (data.dirty&DIRTY_GLOBAL) -// return; //already dirty + /* + if (data.dirty&DIRTY_GLOBAL) + return; //already dirty + */ data.children_lock++; @@ -108,7 +110,7 @@ void Spatial::_propagate_transform_changed(Spatial *p_origin) { } - if (!data.ignore_notification && !xform_change.in_list()) { + if (data.notify_transform && !data.ignore_notification && !xform_change.in_list()) { get_tree()->xform_change_list.add(&xform_change); @@ -179,8 +181,8 @@ void Spatial::_notification(int p_what) { #ifdef TOOLS_ENABLED if (get_tree()->is_editor_hint()) { -// get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this); - get_tree()->call_group(0,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this); + //get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this); + get_tree()->call_group_flags(0,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this); if (!data.gizmo_disabled) { if (data.gizmo.is_valid()) @@ -482,7 +484,7 @@ void Spatial::_update_gizmo() { data.gizmo_dirty=false; if (data.gizmo.is_valid()) { - if (is_visible()) + if (is_visible_in_tree()) data.gizmo->redraw(); else data.gizmo->clear(); @@ -573,7 +575,7 @@ void Spatial::show() { if (!is_inside_tree()) return; - if (!data.parent || is_visible()) { + if (!data.parent || is_visible_in_tree()) { _propagate_visibility_changed(); } @@ -584,7 +586,7 @@ void Spatial::hide(){ if (!data.visible) return; - bool was_visible = is_visible(); + bool was_visible = is_visible_in_tree(); data.visible=false; if (!data.parent || was_visible) { @@ -593,7 +595,7 @@ void Spatial::hide(){ } } -bool Spatial::is_visible() const{ +bool Spatial::is_visible_in_tree() const{ const Spatial *s=this; @@ -608,21 +610,7 @@ bool Spatial::is_visible() const{ } -bool Spatial::is_hidden() const{ - - return !data.visible; -} - -void Spatial::set_hidden(bool p_hidden) { - - if (data.visible != p_hidden) { - return; - } - - _set_visible_(!p_hidden); -} - -void Spatial::_set_visible_(bool p_visible) { +void Spatial::set_visible(bool p_visible) { if (p_visible) show(); @@ -630,9 +618,9 @@ void Spatial::_set_visible_(bool p_visible) { hide(); } -bool Spatial::_is_visible_() const { +bool Spatial::is_visible() const { - return !is_hidden(); + return !data.visible; } void Spatial::rotate(const Vector3& p_normal,float p_radians) { @@ -736,6 +724,14 @@ void Spatial::look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, con } +void Spatial::set_notify_transform(bool p_enable) { + data.notify_transform=p_enable; +} + +bool Spatial::is_transform_notification_enabled() const { + return data.notify_transform; +} + void Spatial::set_notify_local_transform(bool p_enable) { data.notify_local_transform=p_enable; } @@ -779,18 +775,18 @@ void Spatial::_bind_methods() { ClassDB::bind_method(_MD("set_gizmo","gizmo:SpatialGizmo"), &Spatial::set_gizmo); ClassDB::bind_method(_MD("get_gizmo:SpatialGizmo"), &Spatial::get_gizmo); + ClassDB::bind_method(_MD("set_visible"), &Spatial::set_visible); + ClassDB::bind_method(_MD("is_visible"), &Spatial::is_visible); + ClassDB::bind_method(_MD("is_visible_in_tree"), &Spatial::is_visible_in_tree); ClassDB::bind_method(_MD("show"), &Spatial::show); ClassDB::bind_method(_MD("hide"), &Spatial::hide); - ClassDB::bind_method(_MD("is_visible"), &Spatial::is_visible); - ClassDB::bind_method(_MD("is_hidden"), &Spatial::is_hidden); - ClassDB::bind_method(_MD("set_hidden","hidden"), &Spatial::set_hidden); - - ClassDB::bind_method(_MD("_set_visible_"), &Spatial::_set_visible_); - ClassDB::bind_method(_MD("_is_visible_"), &Spatial::_is_visible_); ClassDB::bind_method(_MD("set_notify_local_transform","enable"), &Spatial::set_notify_local_transform); ClassDB::bind_method(_MD("is_local_transform_notification_enabled"), &Spatial::is_local_transform_notification_enabled); + ClassDB::bind_method(_MD("set_notify_transform","enable"), &Spatial::set_notify_transform); + ClassDB::bind_method(_MD("is_transform_notification_enabled"), &Spatial::is_transform_notification_enabled); + void rotate(const Vector3& p_normal,float p_radians); void rotate_x(float p_radians); void rotate_y(float p_radians); @@ -827,7 +823,7 @@ void Spatial::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"rotation",PROPERTY_HINT_NONE,"",0), _SCS("set_rotation"), _SCS("get_rotation") ); ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"scale",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR), _SCS("set_scale"), _SCS("get_scale") ); ADD_GROUP("Visibility",""); - ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"visible"), _SCS("_set_visible_"), _SCS("_is_visible_") ); + ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"visible"), _SCS("set_visible"), _SCS("is_visible") ); //ADD_PROPERTY( PropertyInfo(Variant::TRANSFORM,"transform/local"), _SCS("set_transform"), _SCS("get_transform") ); ADD_SIGNAL( MethodInfo("visibility_changed" ) ); @@ -848,11 +844,13 @@ Spatial::Spatial() : xform_change(this) data.viewport=NULL; data.inside_world=false; data.visible=true; + #ifdef TOOLS_ENABLED data.gizmo_disabled=false; data.gizmo_dirty=false; #endif data.notify_local_transform=false; + data.notify_transform=false; data.parent=NULL; data.C=NULL; diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h index 8121eaa8c2..72daa472bd 100644 --- a/scene/3d/spatial.h +++ b/scene/3d/spatial.h @@ -92,6 +92,7 @@ class Spatial : public Node { bool ignore_notification; bool notify_local_transform; + bool notify_transform; bool visible; @@ -126,8 +127,6 @@ protected: void _notification(int p_what); static void _bind_methods(); - void _set_visible_(bool p_visible); - bool _is_visible_() const; public: enum { @@ -184,17 +183,20 @@ public: void look_at(const Vector3& p_target, const Vector3& p_up_normal); void look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, const Vector3& p_up_normal); + void set_notify_transform(bool p_enable); + bool is_transform_notification_enabled() const; + void set_notify_local_transform(bool p_enable); bool is_local_transform_notification_enabled() const; void orthonormalize(); void set_identity(); + void set_visible(bool p_visible); + bool is_visible() const; void show(); void hide(); - bool is_visible() const; - bool is_hidden() const; - void set_hidden(bool p_hidden); + bool is_visible_in_tree() const; #ifdef TOOLS_ENABLED void set_import_transform(const Transform& p_transform) ; diff --git a/scene/3d/spatial_player.cpp b/scene/3d/spatial_player.cpp index 0a8b9053c1..6a368d771a 100644 --- a/scene/3d/spatial_player.cpp +++ b/scene/3d/spatial_player.cpp @@ -125,6 +125,7 @@ SpatialPlayer::SpatialPlayer() { params[PARAM_ATTENUATION_DISTANCE_EXP]=1.0; //linear (and not really good) params[PARAM_EMISSION_CONE_DEGREES]=180.0; //cone disabled params[PARAM_EMISSION_CONE_ATTENUATION_DB]=-6.0; //minus 6 db attenuation + set_notify_transform(true); } diff --git a/scene/3d/spatial_stream_player.cpp b/scene/3d/spatial_stream_player.cpp index 087e60b48b..1f9765c1d3 100644 --- a/scene/3d/spatial_stream_player.cpp +++ b/scene/3d/spatial_stream_player.cpp @@ -153,10 +153,12 @@ void SpatialStreamPlayer::play(float p_from_offset) { SpatialSoundServer::get_singleton()->source_set_audio_stream(get_source_rid(),&internal_stream); -// AudioServer::get_singleton()->stream_set_active(stream_rid,true); -// AudioServer::get_singleton()->stream_set_volume_scale(stream_rid,volume); -// if (stream->get_update_mode()!=AudioStream::UPDATE_NONE) -// set_idle_process(true); + /* + AudioServer::get_singleton()->stream_set_active(stream_rid,true); + AudioServer::get_singleton()->stream_set_volume_scale(stream_rid,volume); + if (stream->get_update_mode()!=AudioStream::UPDATE_NONE) + set_idle_process(true); + */ } @@ -289,8 +291,10 @@ bool SpatialStreamPlayer::has_autoplay() const { void SpatialStreamPlayer::set_paused(bool p_paused) { paused=p_paused; - //if (stream.is_valid()) - // stream->set_paused(p_paused); + /* + if (stream.is_valid()) + stream->set_paused(p_paused); + */ } bool SpatialStreamPlayer::is_paused() const { diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index a2a96d7d0e..9f0c91c4b8 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -563,8 +563,10 @@ Rect2 Sprite3D::get_item_rect() const { if (texture.is_null()) return Rect2(0,0,1,1); - //if (texture.is_null()) - // return CanvasItem::get_item_rect(); + /* + if (texture.is_null()) + return CanvasItem::get_item_rect(); + */ Size2i s; @@ -1130,7 +1132,7 @@ void AnimatedSprite3D::_notification(int p_what) { //texture->draw_rect(ci,dst_rect,false,modulate); texture->draw_rect_region(ci,dst_rect,Rect2(Vector2(),texture->get_size()),modulate); -// VisualServer::get_singleton()->canvas_item_add_texture_rect_region(ci,dst_rect,texture->get_rid(),src_rect,modulate); + //VisualServer::get_singleton()->canvas_item_add_texture_rect_region(ci,dst_rect,texture->get_rid(),src_rect,modulate); } break; #endif diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index f5d3957370..a14ce40495 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -185,7 +185,7 @@ public: virtual Rect2 get_item_rect() const; Sprite3D(); -// ~Sprite3D(); + //~Sprite3D(); }; #if 0 @@ -215,7 +215,7 @@ public: virtual Rect2 get_item_rect() const; AnimatedSprite3D(); -// ~AnimatedSprite3D(); + //~AnimatedSprite3D(); }; #endif diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 1cb443225c..a3f05f719d 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -340,10 +340,11 @@ void VehicleBody::_update_wheel_transform(VehicleWheel& wheel ,PhysicsDirectBody wheel.m_raycastInfo.m_isInContact = false; Transform chassisTrans = s->get_transform(); - //if (interpolatedTransform && (getRigidBody()->getMotionState())) - //{ - // getRigidBody()->getMotionState()->getWorldTransform(chassisTrans); - //} + /* + if (interpolatedTransform && (getRigidBody()->getMotionState())) { + getRigidBody()->getMotionState()->getWorldTransform(chassisTrans); + } + */ wheel.m_raycastInfo.m_hardPointWS = chassisTrans.xform( wheel.m_chassisConnectionPointCS ); //wheel.m_raycastInfo.m_hardPointWS+=s->get_linear_velocity()*s->get_step(); @@ -360,8 +361,8 @@ void VehicleBody::_update_wheel(int p_idx,PhysicsDirectBodyState *s) { const Vector3& right = wheel.m_raycastInfo.m_wheelAxleWS; Vector3 fwd = up.cross(right); fwd = fwd.normalized(); -// up = right.cross(fwd); -// up.normalize(); + //up = right.cross(fwd); + //up.normalize(); //rotate around steering over de wheelAxleWS real_t steering = wheel.steers?m_steeringValue:0.0; @@ -371,8 +372,10 @@ void VehicleBody::_update_wheel(int p_idx,PhysicsDirectBodyState *s) { Basis rotatingMat(right,-wheel.m_rotation); -// if (p_idx==1) -// print_line("steeringMat " +steeringMat); + /* + if (p_idx==1) + print_line("steeringMat " +steeringMat); + */ Basis basis2( right[0],up[0],fwd[0], @@ -502,7 +505,7 @@ void VehicleBody::_update_suspension(PhysicsDirectBodyState *s) if ( wheel_info.m_raycastInfo.m_isInContact ) { real_t force; - // Spring + //Spring { real_t susp_length = wheel_info.m_suspensionRestLength; real_t current_length = wheel_info.m_raycastInfo.m_suspensionLength; diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h index cd627f8998..273e63d741 100644 --- a/scene/3d/vehicle_body.h +++ b/scene/3d/vehicle_body.h @@ -63,7 +63,7 @@ friend class VehicleBody; VehicleBody *body; -// btVector3 m_wheelAxleCS; // const or modified by steering ? + //btVector3 m_wheelAxleCS; // const or modified by steering ? real_t m_steering; real_t m_rotation; diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index 206421f939..c7c083732e 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -125,6 +125,7 @@ void VisibilityNotifier::_bind_methods(){ VisibilityNotifier::VisibilityNotifier() { aabb=Rect3(Vector3(-1,-1,-1),Vector3(2,2,2)); + set_notify_transform(true); } diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 466c273154..ec37aa2bc4 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -45,7 +45,7 @@ void VisualInstance::_update_visibility() { return; _change_notify("visible"); - VS::get_singleton()->instance_set_visible(get_instance(),is_visible()); + VS::get_singleton()->instance_set_visible(get_instance(),is_visible_in_tree()); } @@ -102,7 +102,7 @@ void VisualInstance::_notification(int p_what) { VisualServer::get_singleton()->instance_set_scenario( instance, RID() ); VisualServer::get_singleton()->instance_set_room(instance,RID()); VisualServer::get_singleton()->instance_attach_skeleton( instance, RID() ); - // VS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() ); + //VS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() ); } break; case NOTIFICATION_VISIBILITY_CHANGED: { @@ -162,6 +162,7 @@ VisualInstance::VisualInstance() instance = VisualServer::get_singleton()->instance_create(); VisualServer::get_singleton()->instance_attach_object_instance_ID( instance, get_instance_ID() ); layers=1; + set_notify_transform(true); } @@ -367,7 +368,7 @@ void GeometryInstance::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::INT, "lod_max_distance",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_max_distance"), _SCS("get_lod_max_distance")); ADD_PROPERTY( PropertyInfo( Variant::INT, "lod_max_hysteresis",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_max_hysteresis"), _SCS("get_lod_max_hysteresis")); -// ADD_SIGNAL( MethodInfo("visibility_changed")); + //ADD_SIGNAL( MethodInfo("visibility_changed")); BIND_CONSTANT(FLAG_CAST_SHADOW ); BIND_CONSTANT(FLAG_BILLBOARD ); @@ -398,7 +399,7 @@ GeometryInstance::GeometryInstance() { shadow_casting_setting=SHADOW_CASTING_SETTING_ON; extra_cull_margin=0; -// VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0); + //VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0); } diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index fa0700584c..8b81c45597 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -36,7 +36,7 @@ bool AnimationPlayer::_set(const StringName& p_name, const Variant& p_value) { String name=p_name; if (p_name==SceneStringNames::get_singleton()->playback_speed || p_name==SceneStringNames::get_singleton()->speed) { //bw compatibility - set_speed(p_value); + set_speed_scale(p_value); } else if (p_name==SceneStringNames::get_singleton()->playback_active) { set_active(p_value); @@ -426,8 +426,10 @@ void AnimationPlayer::_animation_process_animation(AnimationData* p_anim,float p Variant value=a->value_track_interpolate(i,p_time); //thanks to trigger mode, this should be solved now.. - //if (p_delta==0 && value.get_type()==Variant::STRING) - // continue; // doing this with strings is messy, should find another way + /* + if (p_delta==0 && value.get_type()==Variant::STRING) + continue; // doing this with strings is messy, should find another way + */ if (pa->accum_pass!=accum_pass) { ERR_CONTINUE( cache_update_prop_size >= NODE_CACHE_UPDATE_MAX ); cache_update_prop[cache_update_prop_size++]=pa; @@ -713,7 +715,7 @@ void AnimationPlayer::_animation_process(float p_delta) { -// bool any_active=false; + //bool any_active=false; if (playback.current.from) { @@ -1082,13 +1084,13 @@ void AnimationPlayer::stop_all() { } -void AnimationPlayer::set_speed(float p_speed) { +void AnimationPlayer::set_speed_scale(float p_speed) { speed_scale=p_speed; } -float AnimationPlayer::get_speed() const { +float AnimationPlayer::get_speed_scale() const { return speed_scale; } @@ -1323,8 +1325,8 @@ void AnimationPlayer::_bind_methods() { ClassDB::bind_method(_MD("set_active","active"),&AnimationPlayer::set_active); ClassDB::bind_method(_MD("is_active"),&AnimationPlayer::is_active); - ClassDB::bind_method(_MD("set_speed","speed"),&AnimationPlayer::set_speed); - ClassDB::bind_method(_MD("get_speed"),&AnimationPlayer::get_speed); + ClassDB::bind_method(_MD("set_speed_scale","speed"),&AnimationPlayer::set_speed_scale); + ClassDB::bind_method(_MD("get_speed_scale"),&AnimationPlayer::get_speed_scale); ClassDB::bind_method(_MD("set_autoplay","name"),&AnimationPlayer::set_autoplay); ClassDB::bind_method(_MD("get_autoplay"),&AnimationPlayer::get_autoplay); diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 94955bec60..41bae6c928 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -271,8 +271,8 @@ public: bool is_active() const; bool is_valid() const; - void set_speed(float p_speed); - float get_speed() const; + void set_speed_scale(float p_speed); + float get_speed_scale() const; void set_autoplay(const String& pname); String get_autoplay() const; diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index dbcdb284be..c3a05240bb 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -214,7 +214,7 @@ bool AnimationTreePlayer::_set(const StringName& p_name, const Variant& p_value) StringName src = connections[i*3+0]; StringName dst = connections[i*3+1]; int dst_in = connections[i*3+2]; - connect(src,dst,dst_in); + connect_nodes(src,dst,dst_in); } set_active(data.get_valid("active")); @@ -506,10 +506,10 @@ float AnimationTreePlayer::_process_node(const StringName& p_node,AnimationNode float rem = 0; if (!an->animation.is_null()) { - // float pos = an->time; -// float delta = p_time; + //float pos = an->time; + //float delta = p_time; - // const Animation *a = an->animation.operator->(); + //const Animation *a = an->animation.operator->(); if (p_seek) { an->time=p_time; @@ -1496,17 +1496,17 @@ AnimationTreePlayer::ConnectError AnimationTreePlayer::_cycle_test(const StringN } -Error AnimationTreePlayer::connect(const StringName& p_src_node,const StringName& p_dst_node, int p_dst_input) { +Error AnimationTreePlayer::connect_nodes(const StringName& p_src_node,const StringName& p_dst_node, int p_dst_input) { ERR_FAIL_COND_V( !node_map.has(p_src_node) , ERR_INVALID_PARAMETER); ERR_FAIL_COND_V( !node_map.has(p_dst_node) , ERR_INVALID_PARAMETER); ERR_FAIL_COND_V( p_src_node==p_dst_node , ERR_INVALID_PARAMETER); -// NodeBase *src = node_map[p_src_node]; + //NodeBase *src = node_map[p_src_node]; NodeBase *dst = node_map[p_dst_node]; ERR_FAIL_INDEX_V( p_dst_input, dst->inputs.size(), ERR_INVALID_PARAMETER); -// int oldval = dst->inputs[p_dst_input].node; + //int oldval = dst->inputs[p_dst_input].node; for(Map<StringName,NodeBase*>::Element *E=node_map.front();E;E=E->next()) { @@ -1538,7 +1538,7 @@ Error AnimationTreePlayer::connect(const StringName& p_src_node,const StringName return OK; } -bool AnimationTreePlayer::is_connected(const StringName& p_src_node,const StringName& p_dst_node, int p_dst_input) const { +bool AnimationTreePlayer::are_nodes_connected(const StringName& p_src_node,const StringName& p_dst_node, int p_dst_input) const { ERR_FAIL_COND_V( !node_map.has(p_src_node) , false); ERR_FAIL_COND_V( !node_map.has(p_dst_node) , false); @@ -1550,7 +1550,7 @@ bool AnimationTreePlayer::is_connected(const StringName& p_src_node,const String } -void AnimationTreePlayer::disconnect(const StringName& p_node, int p_input) { +void AnimationTreePlayer::disconnect_nodes(const StringName& p_node, int p_input) { ERR_FAIL_COND( !node_map.has(p_node)); @@ -1901,9 +1901,9 @@ void AnimationTreePlayer::_bind_methods() { ClassDB::bind_method(_MD("node_get_pos","id"),&AnimationTreePlayer::node_get_pos); ClassDB::bind_method(_MD("remove_node","id"),&AnimationTreePlayer::remove_node); - ClassDB::bind_method(_MD("connect","id","dst_id","dst_input_idx"),&AnimationTreePlayer::connect); - ClassDB::bind_method(_MD("is_connected","id","dst_id","dst_input_idx"),&AnimationTreePlayer::is_connected); - ClassDB::bind_method(_MD("disconnect","id","dst_input_idx"),&AnimationTreePlayer::disconnect); + ClassDB::bind_method(_MD("connect_nodes","id","dst_id","dst_input_idx"),&AnimationTreePlayer::connect_nodes); + ClassDB::bind_method(_MD("are_nodes_connected","id","dst_id","dst_input_idx"),&AnimationTreePlayer::are_nodes_connected); + ClassDB::bind_method(_MD("disconnect_nodes","id","dst_input_idx"),&AnimationTreePlayer::disconnect_nodes); ClassDB::bind_method(_MD("set_active","enabled"),&AnimationTreePlayer::set_active); ClassDB::bind_method(_MD("is_active"),&AnimationTreePlayer::is_active); diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h index ae2fe8c2bb..5e118be034 100644 --- a/scene/animation/animation_tree_player.h +++ b/scene/animation/animation_tree_player.h @@ -397,9 +397,9 @@ public: void get_node_list(List<StringName> *p_node_list) const; void remove_node(const StringName& p_node); - Error connect(const StringName& p_src_node,const StringName& p_dst_node, int p_dst_input); - bool is_connected(const StringName& p_src_node,const StringName& p_dst_node, int p_input) const; - void disconnect(const StringName& p_src_node, int p_input); + Error connect_nodes(const StringName& p_src_node,const StringName& p_dst_node, int p_dst_input); + bool are_nodes_connected(const StringName& p_src_node,const StringName& p_dst_node, int p_input) const; + void disconnect_nodes(const StringName& p_src_node, int p_input); void set_base_path(const NodePath& p_path); NodePath get_base_path() const; diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index b2ae1fd3d5..0916119db3 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -109,7 +109,7 @@ bool Tween::_set(const StringName& p_name, const Variant& p_value) { String name=p_name; if (name=="playback/speed" || name=="speed") { //bw compatibility - set_speed(p_value); + set_speed_scale(p_value); } else if (name=="playback/active") { set_active(p_value); @@ -192,8 +192,8 @@ void Tween::_bind_methods() { ClassDB::bind_method(_MD("is_repeat"),&Tween::is_repeat ); ClassDB::bind_method(_MD("set_repeat","repeat"),&Tween::set_repeat ); - ClassDB::bind_method(_MD("set_speed","speed"),&Tween::set_speed); - ClassDB::bind_method(_MD("get_speed"),&Tween::get_speed); + ClassDB::bind_method(_MD("set_speed_scale","speed"),&Tween::set_speed_scale); + ClassDB::bind_method(_MD("get_speed_scale"),&Tween::get_speed_scale); ClassDB::bind_method(_MD("set_tween_process_mode","mode"),&Tween::set_tween_process_mode); ClassDB::bind_method(_MD("get_tween_process_mode"),&Tween::get_tween_process_mode); @@ -212,14 +212,14 @@ void Tween::_bind_methods() { ClassDB::bind_method(_MD("tell"),&Tween::tell ); ClassDB::bind_method(_MD("get_runtime"),&Tween::get_runtime ); - ClassDB::bind_method(_MD("interpolate_property","object","property","initial_val","final_val","times_in_sec","trans_type","ease_type","delay"),&Tween::interpolate_property, DEFVAL(0) ); - ClassDB::bind_method(_MD("interpolate_method","object","method","initial_val","final_val","times_in_sec","trans_type","ease_type","delay"),&Tween::interpolate_method, DEFVAL(0) ); - ClassDB::bind_method(_MD("interpolate_callback","object","times_in_sec","callback","arg1", "arg2","arg3","arg4","arg5"),&Tween::interpolate_callback, DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()) ); - ClassDB::bind_method(_MD("interpolate_deferred_callback","object","times_in_sec","callback","arg1","arg2","arg3","arg4","arg5"),&Tween::interpolate_deferred_callback, DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()) ); - ClassDB::bind_method(_MD("follow_property","object","property","initial_val","target","target_property","times_in_sec","trans_type","ease_type","delay"),&Tween::follow_property, DEFVAL(0) ); - ClassDB::bind_method(_MD("follow_method","object","method","initial_val","target","target_method","times_in_sec","trans_type","ease_type","delay"),&Tween::follow_method, DEFVAL(0) ); - ClassDB::bind_method(_MD("targeting_property","object","property","initial","initial_val","final_val","times_in_sec","trans_type","ease_type","delay"),&Tween::targeting_property, DEFVAL(0) ); - ClassDB::bind_method(_MD("targeting_method","object","method","initial","initial_method","final_val","times_in_sec","trans_type","ease_type","delay"),&Tween::targeting_method, DEFVAL(0) ); + ClassDB::bind_method(_MD("interpolate_property","object","property","initial_val","final_val","duration","trans_type","ease_type","delay"),&Tween::interpolate_property, DEFVAL(0) ); + ClassDB::bind_method(_MD("interpolate_method","object","method","initial_val","final_val","duration","trans_type","ease_type","delay"),&Tween::interpolate_method, DEFVAL(0) ); + ClassDB::bind_method(_MD("interpolate_callback","object","duration","callback","arg1", "arg2","arg3","arg4","arg5"),&Tween::interpolate_callback, DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()) ); + ClassDB::bind_method(_MD("interpolate_deferred_callback","object","duration","callback","arg1","arg2","arg3","arg4","arg5"),&Tween::interpolate_deferred_callback, DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()) ); + ClassDB::bind_method(_MD("follow_property","object","property","initial_val","target","target_property","duration","trans_type","ease_type","delay"),&Tween::follow_property, DEFVAL(0) ); + ClassDB::bind_method(_MD("follow_method","object","method","initial_val","target","target_method","duration","trans_type","ease_type","delay"),&Tween::follow_method, DEFVAL(0) ); + ClassDB::bind_method(_MD("targeting_property","object","property","initial","initial_val","final_val","duration","trans_type","ease_type","delay"),&Tween::targeting_property, DEFVAL(0) ); + ClassDB::bind_method(_MD("targeting_method","object","method","initial","initial_method","final_val","duration","trans_type","ease_type","delay"),&Tween::targeting_method, DEFVAL(0) ); ADD_SIGNAL( MethodInfo("tween_started", PropertyInfo( Variant::OBJECT,"object"), PropertyInfo( Variant::STRING,"key")) ); ADD_SIGNAL( MethodInfo("tween_step", PropertyInfo( Variant::OBJECT,"object"), PropertyInfo( Variant::STRING,"key"), PropertyInfo( Variant::REAL,"elapsed"), PropertyInfo( Variant::OBJECT,"value")) ); @@ -339,21 +339,21 @@ Variant Tween::_run_equation(InterpolateData& p_data) { Variant result; #define APPLY_EQUATION(element)\ - r.element = _run_equation(p_data.trans_type, p_data.ease_type, p_data.elapsed - p_data.delay, i.element, d.element, p_data.times_in_sec); + r.element = _run_equation(p_data.trans_type, p_data.ease_type, p_data.elapsed - p_data.delay, i.element, d.element, p_data.duration); switch(initial_val.get_type()) { case Variant::BOOL: - result = ( _run_equation(p_data.trans_type, p_data.ease_type, p_data.elapsed - p_data.delay, initial_val, delta_val, p_data.times_in_sec)) >= 0.5; + result = ( _run_equation(p_data.trans_type, p_data.ease_type, p_data.elapsed - p_data.delay, initial_val, delta_val, p_data.duration)) >= 0.5; break; case Variant::INT: - result = (int) _run_equation(p_data.trans_type, p_data.ease_type, p_data.elapsed - p_data.delay, (int) initial_val, (int) delta_val, p_data.times_in_sec); + result = (int) _run_equation(p_data.trans_type, p_data.ease_type, p_data.elapsed - p_data.delay, (int) initial_val, (int) delta_val, p_data.duration); break; case Variant::REAL: - result = _run_equation(p_data.trans_type, p_data.ease_type, p_data.elapsed - p_data.delay, (real_t) initial_val, (real_t) delta_val, p_data.times_in_sec); + result = _run_equation(p_data.trans_type, p_data.ease_type, p_data.elapsed - p_data.delay, (real_t) initial_val, (real_t) delta_val, p_data.duration); break; case Variant::VECTOR2: @@ -577,9 +577,9 @@ void Tween::_tween_process(float p_delta) { _apply_tween_value(data, data.initial_val); } - if(data.elapsed > (data.delay + data.times_in_sec)) { + if(data.elapsed > (data.delay + data.duration)) { - data.elapsed = data.delay + data.times_in_sec; + data.elapsed = data.delay + data.duration; data.finish = true; } @@ -697,12 +697,12 @@ void Tween::set_repeat(bool p_repeat) { repeat = p_repeat; } -void Tween::set_speed(float p_speed) { +void Tween::set_speed_scale(float p_speed) { speed_scale=p_speed; } -float Tween::get_speed() const { +float Tween::get_speed_scale() const { return speed_scale; } @@ -871,10 +871,10 @@ bool Tween::seek(real_t p_time) { data.finish = false; continue; } - else if(data.elapsed >= (data.delay + data.times_in_sec)) { + else if(data.elapsed >= (data.delay + data.duration)) { data.finish = true; - data.elapsed = (data.delay + data.times_in_sec); + data.elapsed = (data.delay + data.duration); } else data.finish = false; @@ -916,7 +916,7 @@ real_t Tween::get_runtime() const { for(const List<InterpolateData>::Element *E=interpolates.front();E;E=E->next()) { const InterpolateData& data = E->get(); - real_t t = data.delay + data.times_in_sec; + real_t t = data.delay + data.duration; if(t > runtime) runtime = t; } @@ -1035,7 +1035,7 @@ bool Tween::interpolate_property(Object *p_object , String p_property , Variant p_initial_val , Variant p_final_val - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay @@ -1046,7 +1046,7 @@ bool Tween::interpolate_property(Object *p_object , p_property , p_initial_val , p_final_val - , p_times_in_sec + , p_duration , p_trans_type , p_ease_type , p_delay @@ -1060,7 +1060,7 @@ bool Tween::interpolate_property(Object *p_object ERR_FAIL_COND_V(p_object == NULL, false); ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false); ERR_FAIL_COND_V(p_initial_val.get_type() != p_final_val.get_type(), false); - ERR_FAIL_COND_V(p_times_in_sec <= 0, false); + ERR_FAIL_COND_V(p_duration <= 0, false); ERR_FAIL_COND_V(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, false); ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); ERR_FAIL_COND_V(p_delay < 0, false); @@ -1079,7 +1079,7 @@ bool Tween::interpolate_property(Object *p_object data.key = p_property; data.initial_val = p_initial_val; data.final_val = p_final_val; - data.times_in_sec = p_times_in_sec; + data.duration = p_duration; data.trans_type = p_trans_type; data.ease_type = p_ease_type; data.delay = p_delay; @@ -1095,7 +1095,7 @@ bool Tween::interpolate_method(Object *p_object , String p_method , Variant p_initial_val , Variant p_final_val - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay @@ -1106,7 +1106,7 @@ bool Tween::interpolate_method(Object *p_object , p_method , p_initial_val , p_final_val - , p_times_in_sec + , p_duration , p_trans_type , p_ease_type , p_delay @@ -1120,7 +1120,7 @@ bool Tween::interpolate_method(Object *p_object ERR_FAIL_COND_V(p_object == NULL, false); ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false); ERR_FAIL_COND_V(p_initial_val.get_type() != p_final_val.get_type(), false); - ERR_FAIL_COND_V(p_times_in_sec <= 0, false); + ERR_FAIL_COND_V(p_duration <= 0, false); ERR_FAIL_COND_V(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, false); ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); ERR_FAIL_COND_V(p_delay < 0, false); @@ -1138,7 +1138,7 @@ bool Tween::interpolate_method(Object *p_object data.key = p_method; data.initial_val = p_initial_val; data.final_val = p_final_val; - data.times_in_sec = p_times_in_sec; + data.duration = p_duration; data.trans_type = p_trans_type; data.ease_type = p_ease_type; data.delay = p_delay; @@ -1151,7 +1151,7 @@ bool Tween::interpolate_method(Object *p_object } bool Tween::interpolate_callback(Object *p_object - , real_t p_times_in_sec + , real_t p_duration , String p_callback , VARIANT_ARG_DECLARE ) { @@ -1159,7 +1159,7 @@ bool Tween::interpolate_callback(Object *p_object if(pending_update != 0) { _add_pending_command("interpolate_callback" , p_object - , p_times_in_sec + , p_duration , p_callback , p_arg1 , p_arg2 @@ -1172,7 +1172,7 @@ bool Tween::interpolate_callback(Object *p_object ERR_FAIL_COND_V(p_object == NULL, false); ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false); - ERR_FAIL_COND_V(p_times_in_sec < 0, false); + ERR_FAIL_COND_V(p_duration < 0, false); ERR_EXPLAIN("Object has no callback named: %s" + p_callback); ERR_FAIL_COND_V(!p_object->has_method(p_callback), false); @@ -1186,7 +1186,7 @@ bool Tween::interpolate_callback(Object *p_object data.id = p_object->get_instance_ID(); data.key = p_callback; - data.times_in_sec = p_times_in_sec; + data.duration = p_duration; data.delay = 0; int args=0; @@ -1217,7 +1217,7 @@ bool Tween::interpolate_callback(Object *p_object } bool Tween::interpolate_deferred_callback(Object *p_object - , real_t p_times_in_sec + , real_t p_duration , String p_callback , VARIANT_ARG_DECLARE ) { @@ -1225,7 +1225,7 @@ bool Tween::interpolate_deferred_callback(Object *p_object if(pending_update != 0) { _add_pending_command("interpolate_deferred_callback" , p_object - , p_times_in_sec + , p_duration , p_callback , p_arg1 , p_arg2 @@ -1237,7 +1237,7 @@ bool Tween::interpolate_deferred_callback(Object *p_object } ERR_FAIL_COND_V(p_object == NULL, false); ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false); - ERR_FAIL_COND_V(p_times_in_sec < 0, false); + ERR_FAIL_COND_V(p_duration < 0, false); ERR_EXPLAIN("Object has no callback named: %s" + p_callback); ERR_FAIL_COND_V(!p_object->has_method(p_callback), false); @@ -1251,7 +1251,7 @@ bool Tween::interpolate_deferred_callback(Object *p_object data.id = p_object->get_instance_ID(); data.key = p_callback; - data.times_in_sec = p_times_in_sec; + data.duration = p_duration; data.delay = 0; int args=0; @@ -1286,7 +1286,7 @@ bool Tween::follow_property(Object *p_object , Variant p_initial_val , Object *p_target , String p_target_property - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay @@ -1298,7 +1298,7 @@ bool Tween::follow_property(Object *p_object , p_initial_val , p_target , p_target_property - , p_times_in_sec + , p_duration , p_trans_type , p_ease_type , p_delay @@ -1312,7 +1312,7 @@ bool Tween::follow_property(Object *p_object ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false); ERR_FAIL_COND_V(p_target == NULL, false); ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_target), false); - ERR_FAIL_COND_V(p_times_in_sec <= 0, false); + ERR_FAIL_COND_V(p_duration <= 0, false); ERR_FAIL_COND_V(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, false); ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); ERR_FAIL_COND_V(p_delay < 0, false); @@ -1340,7 +1340,7 @@ bool Tween::follow_property(Object *p_object data.initial_val = p_initial_val; data.target_id = p_target->get_instance_ID(); data.target_key = p_target_property; - data.times_in_sec = p_times_in_sec; + data.duration = p_duration; data.trans_type = p_trans_type; data.ease_type = p_ease_type; data.delay = p_delay; @@ -1354,7 +1354,7 @@ bool Tween::follow_method(Object *p_object , Variant p_initial_val , Object *p_target , String p_target_method - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay @@ -1366,7 +1366,7 @@ bool Tween::follow_method(Object *p_object , p_initial_val , p_target , p_target_method - , p_times_in_sec + , p_duration , p_trans_type , p_ease_type , p_delay @@ -1380,7 +1380,7 @@ bool Tween::follow_method(Object *p_object ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false); ERR_FAIL_COND_V(p_target == NULL, false); ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_target), false); - ERR_FAIL_COND_V(p_times_in_sec <= 0, false); + ERR_FAIL_COND_V(p_duration <= 0, false); ERR_FAIL_COND_V(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, false); ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); ERR_FAIL_COND_V(p_delay < 0, false); @@ -1409,7 +1409,7 @@ bool Tween::follow_method(Object *p_object data.initial_val = p_initial_val; data.target_id = p_target->get_instance_ID(); data.target_key = p_target_method; - data.times_in_sec = p_times_in_sec; + data.duration = p_duration; data.trans_type = p_trans_type; data.ease_type = p_ease_type; data.delay = p_delay; @@ -1423,7 +1423,7 @@ bool Tween::targeting_property(Object *p_object , Object *p_initial , String p_initial_property , Variant p_final_val - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay @@ -1435,7 +1435,7 @@ bool Tween::targeting_property(Object *p_object , p_initial , p_initial_property , p_final_val - , p_times_in_sec + , p_duration , p_trans_type , p_ease_type , p_delay @@ -1449,7 +1449,7 @@ bool Tween::targeting_property(Object *p_object ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false); ERR_FAIL_COND_V(p_initial == NULL, false); ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_initial), false); - ERR_FAIL_COND_V(p_times_in_sec <= 0, false); + ERR_FAIL_COND_V(p_duration <= 0, false); ERR_FAIL_COND_V(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, false); ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); ERR_FAIL_COND_V(p_delay < 0, false); @@ -1478,7 +1478,7 @@ bool Tween::targeting_property(Object *p_object data.target_key = p_initial_property; data.initial_val = initial_val; data.final_val = p_final_val; - data.times_in_sec = p_times_in_sec; + data.duration = p_duration; data.trans_type = p_trans_type; data.ease_type = p_ease_type; data.delay = p_delay; @@ -1496,7 +1496,7 @@ bool Tween::targeting_method(Object *p_object , Object *p_initial , String p_initial_method , Variant p_final_val - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay @@ -1508,7 +1508,7 @@ bool Tween::targeting_method(Object *p_object , p_initial , p_initial_method , p_final_val - , p_times_in_sec + , p_duration , p_trans_type , p_ease_type , p_delay @@ -1522,7 +1522,7 @@ bool Tween::targeting_method(Object *p_object ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false); ERR_FAIL_COND_V(p_initial == NULL, false); ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_initial), false); - ERR_FAIL_COND_V(p_times_in_sec <= 0, false); + ERR_FAIL_COND_V(p_duration <= 0, false); ERR_FAIL_COND_V(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, false); ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); ERR_FAIL_COND_V(p_delay < 0, false); @@ -1552,7 +1552,7 @@ bool Tween::targeting_method(Object *p_object data.target_key = p_initial_method; data.initial_val = initial_val; data.final_val = p_final_val; - data.times_in_sec = p_times_in_sec; + data.duration = p_duration; data.trans_type = p_trans_type; data.ease_type = p_ease_type; data.delay = p_delay; diff --git a/scene/animation/tween.h b/scene/animation/tween.h index 01c5b5680e..07c2e90da2 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -92,7 +92,7 @@ private: Variant final_val; ObjectID target_id; StringName target_key; - real_t times_in_sec; + real_t duration; TransitionType trans_type; EaseType ease_type; real_t delay; @@ -165,8 +165,8 @@ public: void set_tween_process_mode(TweenProcessMode p_mode); TweenProcessMode get_tween_process_mode() const; - void set_speed(float p_speed); - float get_speed() const; + void set_speed_scale(float p_speed); + float get_speed_scale() const; bool start(); bool reset(Object *p_node, String p_key); @@ -186,7 +186,7 @@ public: , String p_property , Variant p_initial_val , Variant p_final_val - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay = 0 @@ -196,20 +196,20 @@ public: , String p_method , Variant p_initial_val , Variant p_final_val - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay = 0 ); bool interpolate_callback(Object *p_object - , real_t p_times_in_sec + , real_t p_duration , String p_callback , VARIANT_ARG_DECLARE ); bool interpolate_deferred_callback(Object *p_object - , real_t p_times_in_sec + , real_t p_duration , String p_callback , VARIANT_ARG_DECLARE ); @@ -219,7 +219,7 @@ public: , Variant p_initial_val , Object *p_target , String p_target_property - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay = 0 @@ -230,7 +230,7 @@ public: , Variant p_initial_val , Object *p_target , String p_target_method - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay = 0 @@ -241,7 +241,7 @@ public: , Object *p_initial , String p_initial_property , Variant p_final_val - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay = 0 @@ -252,7 +252,7 @@ public: , Object *p_initial , String p_initial_method , Variant p_final_val - , real_t p_times_in_sec + , real_t p_duration , TransitionType p_trans_type , EaseType p_ease_type , real_t p_delay = 0 diff --git a/scene/audio/stream_player.cpp b/scene/audio/stream_player.cpp index 2f53dc239f..9e506034a6 100644 --- a/scene/audio/stream_player.cpp +++ b/scene/audio/stream_player.cpp @@ -167,8 +167,10 @@ void StreamPlayer::play(float p_from_offset) { sp_update(); AudioServer::get_singleton()->stream_set_active(stream_rid,true); AudioServer::get_singleton()->stream_set_volume_scale(stream_rid,volume); -// if (stream->get_update_mode()!=AudioStream::UPDATE_NONE) -// set_idle_process(true); + /* + if (stream->get_update_mode()!=AudioStream::UPDATE_NONE) + set_idle_process(true); + */ } @@ -305,8 +307,10 @@ bool StreamPlayer::has_autoplay() const { void StreamPlayer::set_paused(bool p_paused) { paused=p_paused; - //if (stream.is_valid()) - // stream->set_paused(p_paused); + /* + if (stream.is_valid()) + stream->set_paused(p_paused); + */ } bool StreamPlayer::is_paused() const { diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 45c491cd74..0b40983ddf 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -64,7 +64,7 @@ void BaseButton::_gui_input(InputEvent p_event) { if (status.pressing_button) break; - if (status.click_on_press) { + if (action_mode==ACTION_MODE_BUTTON_PRESS) { if (b.pressed) { @@ -108,7 +108,7 @@ void BaseButton::_gui_input(InputEvent p_event) { emit_signal("button_up"); /* this is pointless if (status.press_attempt && status.pressing_inside) { -// released(); + //released(); emit_signal("released"); } */ @@ -297,7 +297,7 @@ void BaseButton::_notification(int p_what) { } - if (p_what==NOTIFICATION_VISIBILITY_CHANGED && !is_visible()) { + if (p_what==NOTIFICATION_VISIBILITY_CHANGED && !is_visible_in_tree()) { if (!toggle_mode) { status.pressed = false; @@ -415,14 +415,14 @@ bool BaseButton::is_toggle_mode() const { return toggle_mode; } -void BaseButton::set_click_on_press(bool p_click_on_press) { +void BaseButton::set_action_mode(ActionMode p_mode) { - status.click_on_press=p_click_on_press; + action_mode=p_mode; } -bool BaseButton::get_click_on_press() const { +BaseButton::ActionMode BaseButton::get_action_mode() const { - return status.click_on_press; + return action_mode; } void BaseButton::set_enabled_focus_mode(FocusMode p_mode) { @@ -453,7 +453,7 @@ Ref<ShortCut> BaseButton:: get_shortcut() const { void BaseButton::_unhandled_input(InputEvent p_event) { - if (!is_disabled() && is_visible() && p_event.is_pressed() && !p_event.is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) { + if (!is_disabled() && is_visible_in_tree() && p_event.is_pressed() && !p_event.is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) { if (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)) return; //ignore because of modal window @@ -514,8 +514,8 @@ void BaseButton::_bind_methods() { ClassDB::bind_method(_MD("is_toggle_mode"),&BaseButton::is_toggle_mode); ClassDB::bind_method(_MD("set_disabled","disabled"),&BaseButton::set_disabled); ClassDB::bind_method(_MD("is_disabled"),&BaseButton::is_disabled); - ClassDB::bind_method(_MD("set_click_on_press","enable"),&BaseButton::set_click_on_press); - ClassDB::bind_method(_MD("get_click_on_press"),&BaseButton::get_click_on_press); + ClassDB::bind_method(_MD("set_action_mode","mode"),&BaseButton::set_action_mode); + ClassDB::bind_method(_MD("get_action_mode"),&BaseButton::get_action_mode); ClassDB::bind_method(_MD("get_draw_mode"),&BaseButton::get_draw_mode); ClassDB::bind_method(_MD("set_enabled_focus_mode","mode"),&BaseButton::set_enabled_focus_mode); ClassDB::bind_method(_MD("get_enabled_focus_mode"),&BaseButton::get_enabled_focus_mode); @@ -536,7 +536,7 @@ void BaseButton::_bind_methods() { ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "disabled"), _SCS("set_disabled"), _SCS("is_disabled")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "toggle_mode"), _SCS("set_toggle_mode"), _SCS("is_toggle_mode")); ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "is_pressed"), _SCS("set_pressed"), _SCS("is_pressed")); - ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "click_on_press"), _SCS("set_click_on_press"), _SCS("get_click_on_press")); + ADD_PROPERTYNO( PropertyInfo( Variant::INT, "action_mode",PROPERTY_HINT_ENUM,"Button Press,Button Release"), _SCS("set_action_mode"), _SCS("get_action_mode")); ADD_PROPERTY( PropertyInfo( Variant::INT,"enabled_focus_mode", PROPERTY_HINT_ENUM, "None,Click,All" ), _SCS("set_enabled_focus_mode"), _SCS("get_enabled_focus_mode") ); ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "shortcut",PROPERTY_HINT_RESOURCE_TYPE,"ShortCut"), _SCS("set_shortcut"), _SCS("get_shortcut")); ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "group",PROPERTY_HINT_RESOURCE_TYPE,"ButtonGroup"), _SCS("set_button_group"), _SCS("get_button_group")); @@ -547,6 +547,10 @@ void BaseButton::_bind_methods() { BIND_CONSTANT( DRAW_HOVER ); BIND_CONSTANT( DRAW_DISABLED ); + BIND_CONSTANT( ACTION_MODE_BUTTON_PRESS ); + BIND_CONSTANT( ACTION_MODE_BUTTON_RELEASE ); + + } BaseButton::BaseButton() { @@ -557,10 +561,10 @@ BaseButton::BaseButton() { status.hovering=false; status.pressing_inside=false; status.disabled = false; - status.click_on_press=false; status.pressing_button=0; set_focus_mode( FOCUS_ALL ); enabled_focus_mode = FOCUS_ALL; + action_mode=ACTION_MODE_BUTTON_RELEASE; if (button_group.is_valid()) { diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h index 898c19e811..def4ff7536 100644 --- a/scene/gui/base_button.h +++ b/scene/gui/base_button.h @@ -40,11 +40,20 @@ class ButtonGroup; class BaseButton : public Control { GDCLASS( BaseButton, Control ); +public: + + enum ActionMode { + ACTION_MODE_BUTTON_PRESS, + ACTION_MODE_BUTTON_RELEASE, + }; + +private: bool toggle_mode; FocusMode enabled_focus_mode; Ref<ShortCut> shortcut; + ActionMode action_mode; struct Status { bool pressed; @@ -53,7 +62,6 @@ class BaseButton : public Control { bool pressing_inside; bool disabled; - bool click_on_press; int pressing_button; } status; @@ -100,8 +108,8 @@ public: void set_disabled(bool p_disabled); bool is_disabled() const; - void set_click_on_press(bool p_click_on_press); - bool get_click_on_press() const; + void set_action_mode(ActionMode p_mode); + ActionMode get_action_mode() const; void set_enabled_focus_mode(FocusMode p_mode); FocusMode get_enabled_focus_mode() const; @@ -120,6 +128,8 @@ public: }; VARIANT_ENUM_CAST( BaseButton::DrawMode ) +VARIANT_ENUM_CAST( BaseButton::ActionMode ) + class ButtonGroup : public Resource { diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp index f31f51a5cd..7ca44ac27b 100644 --- a/scene/gui/box_container.cpp +++ b/scene/gui/box_container.cpp @@ -55,7 +55,7 @@ void BoxContainer::_resort() { for(int i=0;i<get_child_count();i++) { Control *c=get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; @@ -108,7 +108,7 @@ void BoxContainer::_resort() { for(int i=0;i<get_child_count();i++) { Control *c=get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; @@ -164,7 +164,7 @@ void BoxContainer::_resort() { for(int i=0;i<get_child_count();i++) { Control *c=get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; @@ -227,7 +227,7 @@ Size2 BoxContainer::get_minimum_size() const { if (c->is_set_as_toplevel()) continue; - if (c->is_hidden()) { + if (!c->is_visible()) { continue; } @@ -296,7 +296,7 @@ BoxContainer::BoxContainer(bool p_vertical) { vertical=p_vertical; align = ALIGN_BEGIN; -// set_ignore_mouse(true); + //set_ignore_mouse(true); set_mouse_filter(MOUSE_FILTER_PASS); } diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp index 4a42695c3a..4d4abb6484 100644 --- a/scene/gui/center_container.cpp +++ b/scene/gui/center_container.cpp @@ -42,7 +42,7 @@ Size2 CenterContainer::get_minimum_size() const { continue; if (c->is_set_as_toplevel()) continue; - if (c->is_hidden()) + if (!c->is_visible()) continue; Size2 minsize = c->get_combined_minimum_size(); ms.width = MAX(ms.width , minsize.width); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index ac8ce68564..da2fb1bc91 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -75,7 +75,7 @@ void ColorPicker::_update_controls() { } -void ColorPicker::set_color(const Color& p_color) { +void ColorPicker::set_pick_color(const Color& p_color) { color=p_color; if (color != last_hsv) { @@ -121,7 +121,7 @@ void ColorPicker::_value_changed(double) { color.components[i] = scroll[i]->get_value()/(raw_mode_enabled?1.0:255.0); } - set_color(color); + set_pick_color(color); _update_text_value(); @@ -139,7 +139,7 @@ void ColorPicker::_html_entered(const String& p_html) { if (!is_inside_tree()) return; - set_color(color); + set_pick_color(color); emit_signal("color_changed",color); } @@ -208,7 +208,7 @@ void ColorPicker::_text_type_toggled() _update_color(); } -Color ColorPicker::get_color() const { +Color ColorPicker::get_pick_color() const { return color; } @@ -320,7 +320,7 @@ void ColorPicker::_uv_input(const InputEvent &ev) { v=1.0-y/256.0; color.set_hsv(h,s,v,color.a); last_hsv = color; - set_color(color); + set_pick_color(color); _update_color(); emit_signal("color_changed", color); } else { @@ -336,7 +336,7 @@ void ColorPicker::_uv_input(const InputEvent &ev) { v=1.0-y/256.0; color.set_hsv(h,s,v,color.a); last_hsv = color; - set_color(color); + set_pick_color(color); _update_color(); emit_signal("color_changed", color); } @@ -354,7 +354,7 @@ void ColorPicker::_w_input(const InputEvent &ev) { } color.set_hsv(h,s,v,color.a); last_hsv = color; - set_color(color); + set_pick_color(color); _update_color(); emit_signal("color_changed", color); } else if (ev.type == InputEvent::MOUSE_MOTION) { @@ -365,7 +365,7 @@ void ColorPicker::_w_input(const InputEvent &ev) { h=1.0-y/256.0; color.set_hsv(h,s,v,color.a); last_hsv = color; - set_color(color); + set_pick_color(color); _update_color(); emit_signal("color_changed", color); } @@ -376,7 +376,7 @@ void ColorPicker::_preset_input(const InputEvent &ev) { const InputEventMouseButton &bev = ev.mouse_button; if (bev.pressed && bev.button_index==BUTTON_LEFT) { int index = bev.x/(preset->get_size().x/presets.size()); - set_color(presets[index]); + set_pick_color(presets[index]); } else if (bev.pressed && bev.button_index==BUTTON_RIGHT) { int index = bev.x/(preset->get_size().x/presets.size()); presets.erase(presets[index]); @@ -425,7 +425,7 @@ void ColorPicker::_screen_input(const InputEvent &ev) Color c( r[ofs+0]/255.0, r[ofs+1]/255.0, r[ofs+2]/255.0 ); - set_color(c); + set_pick_color(c); } } } @@ -451,8 +451,8 @@ void ColorPicker::_screen_pick_pressed() void ColorPicker::_bind_methods() { - ClassDB::bind_method(_MD("set_color","color"),&ColorPicker::set_color); - ClassDB::bind_method(_MD("get_color"),&ColorPicker::get_color); + ClassDB::bind_method(_MD("set_pick_color","color"),&ColorPicker::set_pick_color); + ClassDB::bind_method(_MD("get_pick_color"),&ColorPicker::get_pick_color); ClassDB::bind_method(_MD("set_raw_mode","mode"),&ColorPicker::set_raw_mode); ClassDB::bind_method(_MD("is_raw_mode"),&ColorPicker::is_raw_mode); ClassDB::bind_method(_MD("set_edit_alpha","show"),&ColorPicker::set_edit_alpha); @@ -487,7 +487,7 @@ ColorPicker::ColorPicker() : btn_pick = memnew( ToolButton ); btn_pick->connect("pressed",this,"_screen_pick_pressed"); - sample = memnew( TextureFrame ); + sample = memnew( TextureRect ); sample->set_h_size_flags(SIZE_EXPAND_FILL); sample->connect("draw",this,"_sample_draw"); @@ -584,13 +584,13 @@ ColorPicker::ColorPicker() : //_update_color(); updating=false; - set_color(Color(1,1,1)); + set_pick_color(Color(1,1,1)); HBoxContainer *bbc = memnew( HBoxContainer ); add_child(bbc); - preset = memnew( TextureFrame ); + preset = memnew( TextureRect ); bbc->add_child(preset); //preset->set_ignore_mouse(false); preset->connect("gui_input", this, "_preset_input"); @@ -632,20 +632,20 @@ void ColorPickerButton::_notification(int p_what) { if (p_what==NOTIFICATION_DRAW) { Ref<StyleBox> normal = get_stylebox("normal" ); - draw_rect(Rect2(normal->get_offset(),get_size()-normal->get_minimum_size()),picker->get_color()); + draw_rect(Rect2(normal->get_offset(),get_size()-normal->get_minimum_size()),picker->get_pick_color()); } } -void ColorPickerButton::set_color(const Color& p_color){ +void ColorPickerButton::set_pick_color(const Color& p_color){ - picker->set_color(p_color); + picker->set_pick_color(p_color); update(); emit_signal("color_changed",p_color); } -Color ColorPickerButton::get_color() const{ +Color ColorPickerButton::get_pick_color() const{ - return picker->get_color(); + return picker->get_pick_color(); } void ColorPickerButton::set_edit_alpha(bool p_show) { @@ -665,15 +665,15 @@ ColorPicker *ColorPickerButton::get_picker() { void ColorPickerButton::_bind_methods(){ - ClassDB::bind_method(_MD("set_color","color"),&ColorPickerButton::set_color); - ClassDB::bind_method(_MD("get_color"),&ColorPickerButton::get_color); + ClassDB::bind_method(_MD("set_pick_color","color"),&ColorPickerButton::set_pick_color); + ClassDB::bind_method(_MD("get_pick_color"),&ColorPickerButton::get_pick_color); ClassDB::bind_method(_MD("get_picker:ColorPicker"),&ColorPickerButton::get_picker); ClassDB::bind_method(_MD("set_edit_alpha","show"),&ColorPickerButton::set_edit_alpha); ClassDB::bind_method(_MD("is_editing_alpha"),&ColorPickerButton::is_editing_alpha); ClassDB::bind_method(_MD("_color_changed"),&ColorPickerButton::_color_changed); ADD_SIGNAL( MethodInfo("color_changed",PropertyInfo(Variant::COLOR,"color"))); - ADD_PROPERTY( PropertyInfo(Variant::COLOR,"color"),_SCS("set_color"),_SCS("get_color") ); + ADD_PROPERTY( PropertyInfo(Variant::COLOR,"color"),_SCS("set_pick_color"),_SCS("get_pick_color") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"edit_alpha"),_SCS("set_edit_alpha"),_SCS("is_editing_alpha") ); } diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h index c6a8ef7725..d9db9c89f7 100644 --- a/scene/gui/color_picker.h +++ b/scene/gui/color_picker.h @@ -36,7 +36,7 @@ #include "scene/gui/button.h" #include "scene/gui/popup.h" #include "scene/gui/box_container.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/tool_button.h" #include "scene/gui/check_button.h" @@ -50,8 +50,8 @@ private: Image last_capture; Control *uv_edit; Control *w_edit; - TextureFrame *sample; - TextureFrame *preset; + TextureRect *sample; + TextureRect *preset; Button *bt_add_preset; List<Color> presets; ToolButton *btn_pick; @@ -98,8 +98,8 @@ public: void set_edit_alpha(bool p_show); bool is_editing_alpha() const; - void set_color(const Color& p_color); - Color get_color() const; + void set_pick_color(const Color& p_color); + Color get_pick_color() const; void add_preset(const Color& p_color); void set_raw_mode(bool p_enabled); @@ -126,8 +126,8 @@ protected: static void _bind_methods(); public: - void set_color(const Color& p_color); - Color get_color() const; + void set_pick_color(const Color& p_color); + Color get_pick_color() const; void set_edit_alpha(bool p_show); bool is_editing_alpha() const; diff --git a/scene/gui/color_ramp_edit.cpp b/scene/gui/color_ramp_edit.cpp index c3ed3d821d..5d5d6c31a2 100644 --- a/scene/gui/color_ramp_edit.cpp +++ b/scene/gui/color_ramp_edit.cpp @@ -60,7 +60,7 @@ void ColorRampEdit::_show_color_picker() { if (grabbed==-1) return; Size2 ms = Size2(350, picker->get_combined_minimum_size().height+10); - picker->set_color(points[grabbed].color); + picker->set_pick_color(points[grabbed].color); popup->set_pos(get_global_pos()-Vector2(ms.width-get_size().width,ms.height)); popup->set_size(ms); popup->popup(); diff --git a/scene/gui/color_rect.cpp b/scene/gui/color_rect.cpp index fee96d1ca9..99797aa9c1 100644 --- a/scene/gui/color_rect.cpp +++ b/scene/gui/color_rect.cpp @@ -1,36 +1,61 @@ +/*************************************************************************/ +/* color_rect.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "color_rect.h" - - -void ColorFrame::set_frame_color(const Color& p_color) { +void ColorRect::set_frame_color(const Color& p_color) { color=p_color; update(); } -Color ColorFrame::get_frame_color() const{ +Color ColorRect::get_frame_color() const{ return color; } -void ColorFrame::_notification(int p_what) { +void ColorRect::_notification(int p_what) { if (p_what==NOTIFICATION_DRAW) { draw_rect(Rect2(Point2(),get_size()),color); } } -void ColorFrame::_bind_methods() { +void ColorRect::_bind_methods() { - ClassDB::bind_method(_MD("set_frame_color","color"),&ColorFrame::set_frame_color); - ClassDB::bind_method(_MD("get_frame_color"),&ColorFrame::get_frame_color); + ClassDB::bind_method(_MD("set_frame_color","color"),&ColorRect::set_frame_color); + ClassDB::bind_method(_MD("get_frame_color"),&ColorRect::get_frame_color); ADD_PROPERTY(PropertyInfo(Variant::COLOR,"color"),_SCS("set_frame_color"),_SCS("get_frame_color") ); } -ColorFrame::ColorFrame() { +ColorRect::ColorRect() { color=Color(1,1,1); } - diff --git a/scene/gui/color_rect.h b/scene/gui/color_rect.h index f313bbc4f9..55e413ce27 100644 --- a/scene/gui/color_rect.h +++ b/scene/gui/color_rect.h @@ -1,10 +1,38 @@ -#ifndef COLORRECT_H -#define COLORRECT_H +/*************************************************************************/ +/* color_rect.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef COLOR_RECT_H +#define COLOR_RECT_H #include "scene/gui/control.h" -class ColorFrame : public Control { - GDCLASS(ColorFrame,Control) +class ColorRect : public Control { + GDCLASS(ColorRect,Control) Color color; protected: @@ -16,7 +44,7 @@ public: void set_frame_color(const Color& p_color); Color get_frame_color() const; - ColorFrame(); + ColorRect(); }; -#endif // COLORRECT_H +#endif // COLOR_RECT_H diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index a5a5c61082..de5f35933c 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -147,7 +147,7 @@ void Container::_notification(int p_what) { } break; case NOTIFICATION_VISIBILITY_CHANGED: { - if (is_visible()) { + if (is_visible_in_tree()) { queue_sort(); } } break; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 054622668b..533d24f998 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -468,10 +468,12 @@ void Control::_notification(int p_notification) { } - //if (data.theme.is_null() && data.parent && data.parent->data.theme_owner) { - // data.theme_owner=data.parent->data.theme_owner; - // notification(NOTIFICATION_THEME_CHANGED); - //} + /* + if (data.theme.is_null() && data.parent && data.parent->data.theme_owner) { + data.theme_owner=data.parent->data.theme_owner; + notification(NOTIFICATION_THEME_CHANGED); + } + */ } break; case NOTIFICATION_EXIT_CANVAS: { @@ -503,10 +505,12 @@ void Control::_notification(int p_notification) { data.parent=NULL; data.parent_canvas_item=NULL; - //if (data.theme_owner && data.theme.is_null()) { - // data.theme_owner=NULL; - //notification(NOTIFICATION_THEME_CHANGED); - //} + /* + if (data.theme_owner && data.theme.is_null()) { + data.theme_owner=NULL; + notification(NOTIFICATION_THEME_CHANGED); + } + */ } break; case NOTIFICATION_MOVED_IN_PARENT: { @@ -565,7 +569,7 @@ void Control::_notification(int p_notification) { } break; case NOTIFICATION_VISIBILITY_CHANGED: { - if (!is_visible()) { + if (!is_visible_in_tree()) { if(get_viewport() != NULL) get_viewport()->_gui_hid_control(this); @@ -1660,7 +1664,7 @@ static Control *_next_control(Control *p_from) { for(int i=(next+1);i<parent->get_child_count();i++) { Control *c = parent->get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible() || c->is_set_as_toplevel()) + if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) continue; return c; @@ -1685,7 +1689,7 @@ Control *Control::find_next_valid_focus() const { for(int i=0;i<from->get_child_count();i++) { Control *c = from->get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible() || c->is_set_as_toplevel()) { + if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) { continue; } @@ -1751,7 +1755,7 @@ static Control *_prev_control(Control *p_from) { for(int i=p_from->get_child_count()-1;i>=0;i--) { Control *c = p_from->get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible() || c->is_set_as_toplevel()) + if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) continue; child=c; @@ -1791,7 +1795,7 @@ Control *Control::find_prev_valid_focus() const { Control *c = from->get_parent()->get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible() || c->is_set_as_toplevel()) { + if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) { continue; } @@ -1875,7 +1879,7 @@ void Control::show_modal(bool p_exclusive) { ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(!data.SI); - if (is_visible()) + if (is_visible_in_tree()) hide(); ERR_FAIL_COND( data.MI!=NULL ); @@ -1883,7 +1887,7 @@ void Control::show_modal(bool p_exclusive) { raise(); data.modal_exclusive=p_exclusive; data.MI=get_viewport()->_gui_show_modal(this); - data.modal_frame=OS::get_singleton()->get_frames_drawn(); + data.modal_frame=Engine::get_singleton()->get_frames_drawn(); } @@ -2053,7 +2057,7 @@ Control *Control::_get_focus_neighbour(Margin p_margin,int p_count) { return NULL; } bool valid=true; - if (c->is_hidden()) + if (!c->is_visible()) valid=false; if (c->get_focus_mode()==FOCUS_NONE) valid=false; @@ -2126,7 +2130,7 @@ void Control::_window_find_focus_neighbour(const Vector2& p_dir, Node *p_at,cons Control *c = p_at->cast_to<Control>(); - if (c && c !=this && c->get_focus_mode()==FOCUS_ALL && c->is_visible()) { + if (c && c !=this && c->get_focus_mode()==FOCUS_ALL && c->is_visible_in_tree()) { Point2 points[4]; @@ -2444,7 +2448,7 @@ bool Control::is_clipping_contents() { void Control::_bind_methods() { -// ClassDB::bind_method(_MD("_window_resize_event"),&Control::_window_resize_event); + //ClassDB::bind_method(_MD("_window_resize_event"),&Control::_window_resize_event); ClassDB::bind_method(_MD("_size_changed"),&Control::_size_changed); ClassDB::bind_method(_MD("_update_minimum_size"),&Control::_update_minimum_size); diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h index c7beeea7a3..6650c5eb5d 100644 --- a/scene/gui/dialogs.h +++ b/scene/gui/dialogs.h @@ -94,7 +94,7 @@ class AcceptDialog : public WindowDialog { HBoxContainer *hbc; Label *label; Button *ok; -// Button *cancel; no more cancel (there is X on tht titlebar) + //Button *cancel; no more cancel (there is X on tht titlebar) bool hide_on_ok; diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 1cd04551c5..393f14bee2 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -615,7 +615,7 @@ void FileDialog::set_access(Access p_access) { void FileDialog::invalidate() { - if (is_visible()) { + if (is_visible_in_tree()) { update_file_list(); invalidated=false; } else { diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index b919f0649d..ba1ab1afa8 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -295,7 +295,7 @@ void GraphEdit::_notification(int p_what) { zoom_reset->set_icon(get_icon("reset")); zoom_plus->set_icon(get_icon("more")); snap_button->set_icon(get_icon("snap")); -// zoom_icon->set_texture( get_icon("Zoom", "EditorIcons")); + //zoom_icon->set_texture( get_icon("Zoom", "EditorIcons")); } if (p_what==NOTIFICATION_DRAW) { @@ -1054,7 +1054,7 @@ void GraphEdit::set_zoom(float p_zoom) { _update_scroll(); connections_layer->update(); - if (is_visible()) { + if (is_visible_in_tree()) { Vector2 ofs = sbofs*zoom - get_size()/2; h_scroll->set_value( ofs.x ); diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h index 86b976c4fe..3e9944332f 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -34,7 +34,7 @@ #include "scene/gui/slider.h" #include "scene/gui/tool_button.h" #include "scene/gui/spin_box.h" -#include "texture_frame.h" +#include "scene/gui/texture_rect.h" class GraphEdit; diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index 8b7b84910d..aa8c875f40 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -217,8 +217,8 @@ void GraphNode::_notification(int p_what) { sb = get_stylebox( selected ? "selectedframe" : "frame"); } - sb=sb->duplicate(); - sb->call("set_modulate",modulate); + //sb=sb->duplicate(); + //sb->call("set_modulate",modulate); Ref<Texture> port =get_icon("port"); Ref<Texture> close =get_icon("close"); Ref<Texture> resizer =get_icon("resizer"); @@ -675,16 +675,6 @@ void GraphNode::_gui_input(const InputEvent& p_ev) { } -void GraphNode::set_modulate(const Color &p_color) { - - modulate=p_color; - update(); -} - -Color GraphNode::get_modulate() const{ - - return modulate; -} void GraphNode::set_overlay(Overlay p_overlay) { overlay=p_overlay; @@ -758,9 +748,6 @@ void GraphNode::_bind_methods() { ClassDB::bind_method(_MD("get_connection_input_type","idx"),&GraphNode::get_connection_input_type); ClassDB::bind_method(_MD("get_connection_input_color","idx"),&GraphNode::get_connection_input_color); - ClassDB::bind_method(_MD("set_modulate","color"),&GraphNode::set_modulate); - ClassDB::bind_method(_MD("get_modulate"),&GraphNode::get_modulate); - ClassDB::bind_method(_MD("set_show_close_button","show"),&GraphNode::set_show_close_button); ClassDB::bind_method(_MD("is_close_button_visible"),&GraphNode::is_close_button_visible); @@ -788,7 +775,6 @@ GraphNode::GraphNode() { show_close=false; connpos_dirty=true; set_mouse_filter(MOUSE_FILTER_PASS); - modulate=Color(1,1,1,1); comment=false; resizeable=false; resizing=false; diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h index a128426d38..9cb46fc49c 100644 --- a/scene/gui/graph_node.h +++ b/scene/gui/graph_node.h @@ -92,8 +92,6 @@ private: Overlay overlay; - Color modulate; - bool has_point(const Point2& p_point) const; protected: @@ -147,9 +145,6 @@ public: Color get_connection_output_color(int p_idx); - void set_modulate(const Color& p_color); - Color get_modulate() const; - void set_overlay(Overlay p_overlay); Overlay get_overlay() const; diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp index 7dffaa2fd5..597169ca83 100644 --- a/scene/gui/grid_container.cpp +++ b/scene/gui/grid_container.cpp @@ -53,7 +53,7 @@ void GridContainer::_notification(int p_what) { for(int i=0;i<get_child_count();i++) { Control *c = get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; int row = idx / columns; @@ -70,7 +70,7 @@ void GridContainer::_notification(int p_what) { else row_minh[row]=ms.height; - // print_line("store row "+itos(row)+" mw "+itos(ms.height)); + //print_line("store row "+itos(row)+" mw "+itos(ms.height)); if (c->get_h_size_flags()&SIZE_EXPAND) col_expanded.insert(col); @@ -112,7 +112,7 @@ void GridContainer::_notification(int p_what) { for(int i=0;i<get_child_count();i++) { Control *c = get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; int row = idx / columns; int col = idx % columns; @@ -136,7 +136,7 @@ void GridContainer::_notification(int p_what) { Point2 p(col_ofs,row_ofs); -// print_line("col: "+itos(col)+" row: "+itos(row)+" col_ofs: "+itos(col_ofs)+" row_ofs: "+itos(row_ofs)); + //print_line("col: "+itos(col)+" row: "+itos(row)+" col_ofs: "+itos(col_ofs)+" row_ofs: "+itos(row_ofs)); fit_child_in_rect(c,Rect2(p,s)); //print_line("col: "+itos(col)+" row: "+itos(row)+" rect: "+Rect2(p,s)); @@ -191,7 +191,7 @@ Size2 GridContainer::get_minimum_size() const { for(int i=0;i<get_child_count();i++) { Control *c = get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; int row = idx / columns; int col = idx % columns; diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index ece6171b6e..a3ed0a91cf 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -801,7 +801,7 @@ void ItemList::_notification(int p_what) { float page = size.height-bg->get_minimum_size().height; int width = size.width-bg->get_minimum_size().width; - if (!scroll_bar->is_hidden()){ + if (scroll_bar->is_visible()){ width-=mw+bg->get_margin(MARGIN_RIGHT); } scroll_bar->set_page(page); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index e75785b1ff..3a72e0e445 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -96,8 +96,6 @@ void LineEdit::_gui_input(InputEvent p_event) { } } - // if (!editable) - // non_editable_clicked_signal.call(); update(); } else { @@ -853,7 +851,7 @@ void LineEdit::_reset_caret_blink_timer() { void LineEdit::_toggle_draw_caret() { draw_caret = !draw_caret; - if (is_visible() && has_focus() && window_has_focus) { + if (is_visible_in_tree() && has_focus() && window_has_focus) { update(); } } @@ -873,7 +871,7 @@ void LineEdit::delete_char() { if (cursor_pos==window_pos) { - // set_window_pos(cursor_pos-get_window_length()); + //set_window_pos(cursor_pos-get_window_length()); } _text_changed(); diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp index 883364b2fd..be27c40117 100644 --- a/scene/gui/margin_container.cpp +++ b/scene/gui/margin_container.cpp @@ -45,7 +45,7 @@ Size2 MarginContainer::get_minimum_size() const { continue; if (c->is_set_as_toplevel()) continue; - if (c->is_hidden()) + if (!c->is_visible()) continue; Size2 s = c->get_combined_minimum_size(); diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 755b296666..4a366c55c6 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -36,7 +36,7 @@ void MenuButton::_unhandled_key_input(InputEvent p_event) { if (p_event.is_pressed() && !p_event.is_echo() && (p_event.type==InputEvent::KEY || p_event.type==InputEvent::ACTION || p_event.type==InputEvent::JOYPAD_BUTTON)) { - if (!get_parent() || !is_visible() || is_disabled()) + if (!get_parent() || !is_visible_in_tree() || is_disabled()) return; bool global_only = (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)); @@ -67,7 +67,7 @@ void MenuButton::_gui_input(InputEvent p_event) { /*if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==BUTTON_LEFT) { clicked=p_event.mouse_button.pressed; } - if (clicked && p_event.type==InputEvent::MOUSE_MOTION && popup->is_visible()) { + if (clicked && p_event.type==InputEvent::MOUSE_MOTION && popup->is_visible_in_tree()) { Point2 gt = Point2(p_event.mouse_motion.x,p_event.mouse_motion.y); gt = get_global_transform().xform(gt); @@ -117,7 +117,7 @@ MenuButton::MenuButton() { add_child(popup); popup->set_as_toplevel(true); set_process_unhandled_key_input(true); - set_click_on_press(true); + set_action_mode(ACTION_MODE_BUTTON_PRESS); } diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp index 451a85cf48..48270d12c7 100644 --- a/scene/gui/panel_container.cpp +++ b/scene/gui/panel_container.cpp @@ -43,7 +43,7 @@ Size2 PanelContainer::get_minimum_size() const { for(int i=0;i<get_child_count();i++) { Control *c = get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; @@ -98,7 +98,7 @@ void PanelContainer::_notification(int p_what) { for(int i=0;i<get_child_count();i++) { Control *c = get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; diff --git a/scene/gui/patch_9_frame.cpp b/scene/gui/patch_9_rect.cpp index e32f60a222..4e1856778e 100644 --- a/scene/gui/patch_9_frame.cpp +++ b/scene/gui/patch_9_rect.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* patch_9_frame.cpp */ +/* patch_9_rect.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,11 +26,11 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "patch_9_frame.h" +#include "patch_9_rect.h" #include "servers/visual_server.h" -void Patch9Frame::_notification(int p_what) { +void NinePatchRect::_notification(int p_what) { if (p_what==NOTIFICATION_DRAW) { @@ -40,7 +40,7 @@ void Patch9Frame::_notification(int p_what) { Size2 s=get_size(); RID ci = get_canvas_item(); VS::get_singleton()->canvas_item_add_nine_patch(ci,Rect2(Point2(),s),region_rect,texture->get_rid(),Vector2(margin[MARGIN_LEFT],margin[MARGIN_TOP]),Vector2(margin[MARGIN_RIGHT],margin[MARGIN_BOTTOM]),VS::NINE_PATCH_STRETCH,VS::NINE_PATCH_STRETCH,draw_center); -// draw_texture_rect(texture,Rect2(Point2(),s),false,modulate); + //draw_texture_rect(texture,Rect2(Point2(),s),false,modulate); /* Vector<Point2> points; @@ -61,21 +61,21 @@ void Patch9Frame::_notification(int p_what) { } } -Size2 Patch9Frame::get_minimum_size() const { +Size2 NinePatchRect::get_minimum_size() const { return Size2(margin[MARGIN_LEFT]+margin[MARGIN_RIGHT],margin[MARGIN_TOP]+margin[MARGIN_BOTTOM]); } -void Patch9Frame::_bind_methods() { +void NinePatchRect::_bind_methods() { - ClassDB::bind_method(_MD("set_texture","texture"), & Patch9Frame::set_texture ); - ClassDB::bind_method(_MD("get_texture"), & Patch9Frame::get_texture ); - ClassDB::bind_method(_MD("set_patch_margin","margin","value"), & Patch9Frame::set_patch_margin ); - ClassDB::bind_method(_MD("get_patch_margin","margin"), & Patch9Frame::get_patch_margin ); - ClassDB::bind_method(_MD("set_region_rect","rect"),&Patch9Frame::set_region_rect); - ClassDB::bind_method(_MD("get_region_rect"),&Patch9Frame::get_region_rect); - ClassDB::bind_method(_MD("set_draw_center","draw_center"), & Patch9Frame::set_draw_center ); - ClassDB::bind_method(_MD("get_draw_center"), & Patch9Frame::get_draw_center ); + ClassDB::bind_method(_MD("set_texture","texture"), & NinePatchRect::set_texture ); + ClassDB::bind_method(_MD("get_texture"), & NinePatchRect::get_texture ); + ClassDB::bind_method(_MD("set_patch_margin","margin","value"), & NinePatchRect::set_patch_margin ); + ClassDB::bind_method(_MD("get_patch_margin","margin"), & NinePatchRect::get_patch_margin ); + ClassDB::bind_method(_MD("set_region_rect","rect"),&NinePatchRect::set_region_rect); + ClassDB::bind_method(_MD("get_region_rect"),&NinePatchRect::get_region_rect); + ClassDB::bind_method(_MD("set_draw_center","draw_center"), & NinePatchRect::set_draw_center ); + ClassDB::bind_method(_MD("get_draw_center"), & NinePatchRect::get_draw_center ); ADD_SIGNAL(MethodInfo("texture_changed")); @@ -92,26 +92,28 @@ void Patch9Frame::_bind_methods() { } -void Patch9Frame::set_texture(const Ref<Texture>& p_tex) { +void NinePatchRect::set_texture(const Ref<Texture>& p_tex) { if (texture==p_tex) return; texture=p_tex; update(); - //if (texture.is_valid()) - // texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites + /* + if (texture.is_valid()) + texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites + */ minimum_size_changed(); emit_signal("texture_changed"); } -Ref<Texture> Patch9Frame::get_texture() const { +Ref<Texture> NinePatchRect::get_texture() const { return texture; } -void Patch9Frame::set_patch_margin(Margin p_margin,int p_size) { +void NinePatchRect::set_patch_margin(Margin p_margin,int p_size) { ERR_FAIL_INDEX(p_margin,4); margin[p_margin]=p_size; @@ -133,13 +135,13 @@ void Patch9Frame::set_patch_margin(Margin p_margin,int p_size) { } } -int Patch9Frame::get_patch_margin(Margin p_margin) const{ +int NinePatchRect::get_patch_margin(Margin p_margin) const{ ERR_FAIL_INDEX_V(p_margin,4,0); return margin[p_margin]; } -void Patch9Frame::set_region_rect(const Rect2& p_region_rect) { +void NinePatchRect::set_region_rect(const Rect2& p_region_rect) { if (region_rect==p_region_rect) return; @@ -150,23 +152,23 @@ void Patch9Frame::set_region_rect(const Rect2& p_region_rect) { _change_notify("region_rect"); } -Rect2 Patch9Frame::get_region_rect() const { +Rect2 NinePatchRect::get_region_rect() const { return region_rect; } -void Patch9Frame::set_draw_center(bool p_draw) { +void NinePatchRect::set_draw_center(bool p_draw) { draw_center=p_draw; update(); } -bool Patch9Frame::get_draw_center() const{ +bool NinePatchRect::get_draw_center() const{ return draw_center; } -Patch9Frame::Patch9Frame() { +NinePatchRect::NinePatchRect() { margin[MARGIN_LEFT]=0; @@ -179,6 +181,6 @@ Patch9Frame::Patch9Frame() { } -Patch9Frame::~Patch9Frame() +NinePatchRect::~NinePatchRect() { } diff --git a/scene/gui/patch_9_frame.h b/scene/gui/patch_9_rect.h index afbeca5ae8..b87f2f64ec 100644 --- a/scene/gui/patch_9_frame.h +++ b/scene/gui/patch_9_rect.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* patch_9_frame.h */ +/* patch_9_rect.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -33,9 +33,9 @@ /** @author Juan Linietsky <reduzio@gmail.com> */ -class Patch9Frame : public Control { +class NinePatchRect : public Control { - GDCLASS(Patch9Frame,Control); + GDCLASS(NinePatchRect,Control); bool draw_center; int margin[4]; @@ -61,8 +61,8 @@ public: void set_draw_center(bool p_enable); bool get_draw_center() const; - Patch9Frame(); - ~Patch9Frame(); + NinePatchRect(); + ~NinePatchRect(); }; #endif // PATCH_9_FRAME_H diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 5126568e5f..3f0f76f184 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -39,7 +39,7 @@ void Popup::_gui_input(InputEvent p_event) { void Popup::_notification(int p_what) { if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - if (popped_up && !is_visible()) { + if (popped_up && !is_visible_in_tree()) { popped_up=false; notification(NOTIFICATION_POPUP_HIDE); emit_signal("popup_hide"); @@ -103,7 +103,7 @@ void Popup::set_as_minsize() { Control *c=get_child(i)->cast_to<Control>(); if (!c) continue; - if (c->is_hidden()) + if (!c->is_visible()) continue; Size2 minsize = c->get_combined_minimum_size(); @@ -144,7 +144,7 @@ void Popup::popup_centered_minsize(const Size2& p_minsize) { Control *c=get_child(i)->cast_to<Control>(); if (!c) continue; - if (c->is_hidden()) + if (!c->is_visible()) continue; Size2 minsize = c->get_combined_minimum_size(); @@ -283,7 +283,7 @@ Popup::Popup() { String Popup::get_configuration_warning() const { - if (is_visible()) { + if (is_visible_in_tree()) { return TTR("Popups will hide by default unless you call popup() or any of the popup*() functions. Making them visible for editing is fine though, but they will hide upon running."); } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 9eaf393a21..65e7c3ab39 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -136,7 +136,7 @@ int PopupMenu::_get_mouse_over(const Point2& p_over) const { Ref<Font> font = get_font("font"); int vseparation = get_constant("vseparation"); -// int hseparation = get_constant("hseparation"); + //int hseparation = get_constant("hseparation"); float font_h=font->get_height(); @@ -174,7 +174,7 @@ void PopupMenu::_activate_submenu(int over) { Popup *pm = n->cast_to<Popup>(); ERR_EXPLAIN("item subnode is not a Popup: "+items[over].submenu); ERR_FAIL_COND(!pm); - if (pm->is_visible()) + if (pm->is_visible_in_tree()) return; //already visible! diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp index ee9369fb3a..0f99d4f19e 100644 --- a/scene/gui/progress_bar.cpp +++ b/scene/gui/progress_bar.cpp @@ -53,7 +53,7 @@ void ProgressBar::_notification(int p_what) { Color font_color=get_color("font_color"); draw_style_box(bg,Rect2(Point2(),get_size())); - float r = get_unit_value(); + float r = get_as_ratio(); int mp = fg->get_minimum_size().width; int p = r*get_size().width-mp; if (p>0) { @@ -62,7 +62,7 @@ void ProgressBar::_notification(int p_what) { } if (percent_visible) { - String txt=itos(int(get_unit_value()*100))+"%"; + String txt=itos(int(get_as_ratio()*100))+"%"; font->draw_halign(get_canvas_item(),Point2(0,font->get_ascent()+(get_size().height-font->get_height())/2),HALIGN_CENTER,get_size().width,txt,font_color); } } diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 2f37ed0341..d5c1034c9c 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -135,11 +135,11 @@ double Range::get_page() const { return shared->page; } -void Range::set_unit_value(double p_value) { +void Range::set_as_ratio(double p_value) { double v; - if (shared->exp_unit_value && get_min()>0) { + if (shared->exp_ratio && get_min()>0) { double exp_min = Math::log(get_min())/Math::log(2); double exp_max = Math::log(get_max())/Math::log(2); @@ -156,9 +156,9 @@ void Range::set_unit_value(double p_value) { } set_value( v ); } -double Range::get_unit_value() const { +double Range::get_as_ratio() const { - if (shared->exp_unit_value && get_min()>0) { + if (shared->exp_ratio && get_min()>0) { double exp_min = Math::log(get_min())/Math::log(2); double exp_max = Math::log(get_max())/Math::log(2); @@ -227,17 +227,17 @@ void Range::_bind_methods() { ClassDB::bind_method(_MD("get_max"),&Range::get_max); ClassDB::bind_method(_MD("get_step"),&Range::get_step); ClassDB::bind_method(_MD("get_page"),&Range::get_page); - ClassDB::bind_method(_MD("get_unit_value"),&Range::get_unit_value); + ClassDB::bind_method(_MD("get_as_ratio"),&Range::get_as_ratio); ClassDB::bind_method(_MD("set_value","value"),&Range::set_value); ClassDB::bind_method(_MD("set_min","minimum"),&Range::set_min); ClassDB::bind_method(_MD("set_max","maximum"),&Range::set_max); ClassDB::bind_method(_MD("set_step","step"),&Range::set_step); ClassDB::bind_method(_MD("set_page","pagesize"),&Range::set_page); - ClassDB::bind_method(_MD("set_unit_value","value"),&Range::set_unit_value); - ClassDB::bind_method(_MD("set_rounded_values","enabled"),&Range::set_rounded_values); - ClassDB::bind_method(_MD("is_rounded_values"),&Range::is_rounded_values); - ClassDB::bind_method(_MD("set_exp_unit_value","enabled"),&Range::set_exp_unit_value); - ClassDB::bind_method(_MD("is_unit_value_exp"),&Range::is_unit_value_exp); + ClassDB::bind_method(_MD("set_as_ratio","value"),&Range::set_as_ratio); + ClassDB::bind_method(_MD("set_use_rounded_values","enabled"),&Range::set_use_rounded_values); + ClassDB::bind_method(_MD("is_using_rounded_values"),&Range::is_using_rounded_values); + ClassDB::bind_method(_MD("set_exp_ratio","enabled"),&Range::set_exp_ratio); + ClassDB::bind_method(_MD("is_ratio_exp"),&Range::is_ratio_exp); ClassDB::bind_method(_MD("share","with"),&Range::_share); ClassDB::bind_method(_MD("unshare"),&Range::unshare); @@ -250,29 +250,29 @@ void Range::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::REAL, "step" ), _SCS("set_step"), _SCS("get_step") ); ADD_PROPERTY( PropertyInfo( Variant::REAL, "page" ), _SCS("set_page"), _SCS("get_page") ); ADD_PROPERTY( PropertyInfo( Variant::REAL, "value" ), _SCS("set_value"), _SCS("get_value") ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "exp_edit" ), _SCS("set_exp_unit_value"), _SCS("is_unit_value_exp") ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "rounded" ), _SCS("set_rounded_values"), _SCS("is_rounded_values") ); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "exp_edit" ), _SCS("set_exp_ratio"), _SCS("is_ratio_exp") ); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "rounded" ), _SCS("set_use_rounded_values"), _SCS("is_using_rounded_values") ); } -void Range::set_rounded_values(bool p_enable) { +void Range::set_use_rounded_values(bool p_enable) { _rounded_values = p_enable; } -bool Range::is_rounded_values() const { +bool Range::is_using_rounded_values() const { return _rounded_values; } -void Range::set_exp_unit_value(bool p_enable) { +void Range::set_exp_ratio(bool p_enable) { - shared->exp_unit_value=p_enable; + shared->exp_ratio=p_enable; } -bool Range::is_unit_value_exp() const { +bool Range::is_ratio_exp() const { - return shared->exp_unit_value; + return shared->exp_ratio; } @@ -285,7 +285,7 @@ Range::Range() shared->step=1; shared->page=0; shared->owners.insert(this); - shared->exp_unit_value=false; + shared->exp_ratio=false; _rounded_values = false; } diff --git a/scene/gui/range.h b/scene/gui/range.h index 0872254fff..5f274a6901 100644 --- a/scene/gui/range.h +++ b/scene/gui/range.h @@ -41,7 +41,7 @@ class Range : public Control { struct Shared { double val,min,max; double step,page; - bool exp_unit_value; + bool exp_ratio; Set<Range*> owners; void emit_value_changed(); void emit_changed(const char *p_what=""); @@ -71,20 +71,20 @@ public: void set_max(double p_max); void set_step(double p_step); void set_page(double p_page); - void set_unit_value(double p_value); + void set_as_ratio(double p_value); double get_value() const; double get_min() const; double get_max() const; double get_step() const; double get_page() const; - double get_unit_value() const; + double get_as_ratio() const; - void set_rounded_values(bool p_enable); - bool is_rounded_values() const; + void set_use_rounded_values(bool p_enable); + bool is_using_rounded_values() const; - void set_exp_unit_value(bool p_enable); - bool is_unit_value_exp() const; + void set_exp_ratio(bool p_enable); + bool is_ratio_exp() const; void share(Range *p_range); void unshare(); diff --git a/scene/gui/reference_frame.cpp b/scene/gui/reference_rect.cpp index 37bc3ae6fb..ff4cdf04fd 100644 --- a/scene/gui/reference_frame.cpp +++ b/scene/gui/reference_rect.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* reference_frame.cpp */ +/* reference_rect.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,9 +26,9 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "reference_frame.h" +#include "reference_rect.h" -void ReferenceFrame::_notification(int p_what) { +void ReferenceRect::_notification(int p_what) { if (p_what==NOTIFICATION_DRAW) { @@ -39,6 +39,6 @@ void ReferenceFrame::_notification(int p_what) { } } -ReferenceFrame::ReferenceFrame() +ReferenceRect::ReferenceRect() { } diff --git a/scene/gui/reference_frame.h b/scene/gui/reference_rect.h index 8b4a16cb43..be493f346c 100644 --- a/scene/gui/reference_frame.h +++ b/scene/gui/reference_rect.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* reference_frame.h */ +/* reference_rect.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,20 +26,20 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef REFERENCE_FRAME_H -#define REFERENCE_FRAME_H +#ifndef REFERENCE_RECT_H +#define REFERENCE_RECT_H #include "scene/gui/control.h" -class ReferenceFrame : public Control { +class ReferenceRect : public Control { - GDCLASS( ReferenceFrame, Control); + GDCLASS( ReferenceRect, Control); protected: void _notification(int p_what); public: - ReferenceFrame(); + ReferenceRect(); }; -#endif // REFERENCE_FRAME_H +#endif // REFERENCE_RECT_H diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 790b7500ea..434fb36e24 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -852,32 +852,32 @@ void RichTextLabel::_gui_input(InputEvent p_event) { switch(k.scancode) { case KEY_PAGEUP: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( vscroll->get_value() - vscroll->get_page() ); } break; case KEY_PAGEDOWN: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( vscroll->get_value() + vscroll->get_page() ); } break; case KEY_UP: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( vscroll->get_value() - get_font("normal_font")->get_height() ); } break; case KEY_DOWN: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( vscroll->get_value() + get_font("normal_font")->get_height() ); } break; case KEY_HOME: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( 0 ); } break; case KEY_END: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( vscroll->get_max() ); } break; case KEY_INSERT: @@ -1429,7 +1429,7 @@ bool RichTextLabel::is_scroll_active() const { void RichTextLabel::set_scroll_follow(bool p_follow) { scroll_follow=p_follow; - if (!vscroll->is_visible() || vscroll->get_value()>=(vscroll->get_max()-vscroll->get_page())) + if (!vscroll->is_visible_in_tree() || vscroll->get_value()>=(vscroll->get_max()-vscroll->get_page())) scroll_following=true; } diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index 2c44e51e5e..fc406ff0f5 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -51,9 +51,11 @@ void ScrollBar::_gui_input(InputEvent p_event) { if (b.button_index==5 && b.pressed) { - //if (orientation==VERTICAL) - // set_val( get_val() + get_page() / 4.0 ); - //else + /* + if (orientation==VERTICAL) + set_val( get_val() + get_page() / 4.0 ); + else + */ set_value( get_value() + get_page() / 4.0 ); accept_event(); @@ -61,9 +63,11 @@ void ScrollBar::_gui_input(InputEvent p_event) { if (b.button_index==4 && b.pressed) { - //if (orientation==HORIZONTAL) - // set_val( get_val() - get_page() / 4.0 ); - //else + /* + if (orientation==HORIZONTAL) + set_val( get_val() - get_page() / 4.0 ); + else + */ set_value( get_value() - get_page() / 4.0 ); accept_event(); } @@ -112,7 +116,7 @@ void ScrollBar::_gui_input(InputEvent p_event) { drag.active=true; drag.pos_at_click=grabber_ofs+ofs; - drag.value_at_click=get_unit_value(); + drag.value_at_click=get_as_ratio(); update(); } else { @@ -145,7 +149,7 @@ void ScrollBar::_gui_input(InputEvent p_event) { double diff = (ofs-drag.pos_at_click) / get_area_size(); - set_unit_value( drag.value_at_click + diff ); + set_as_ratio( drag.value_at_click + diff ); } else { @@ -425,8 +429,10 @@ double ScrollBar::get_grabber_size() const { return 0; float page = (get_page()>0)? get_page() : 0; -// if (grabber_range < get_step()) -// grabber_range=get_step(); + /* + if (grabber_range < get_step()) + grabber_range=get_step(); + */ double area_size=get_area_size(); double grabber_size = page / range * area_size; @@ -497,7 +503,7 @@ double ScrollBar::get_click_pos(const Point2& p_pos) const { double ScrollBar::get_grabber_offset() const { - return (get_area_size()) * get_unit_value(); + return (get_area_size()) * get_as_ratio(); } @@ -620,12 +626,16 @@ void ScrollBar::_drag_slave_input(const InputEvent& p_input) { if (orientation==HORIZONTAL) set_value(diff.x); - //else - // drag_slave_accum.x=0; + /* + else + drag_slave_accum.x=0; + */ if (orientation==VERTICAL) set_value(diff.y); - //else - // drag_slave_accum.y=0; + /* + else + drag_slave_accum.y=0; + */ time_since_motion=0; } diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 43c214b0be..b3ed9b209a 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -59,10 +59,10 @@ Size2 ScrollContainer::get_minimum_size() const { } } - if (h_scroll->is_visible()) { + if (h_scroll->is_visible_in_tree()) { min_size.y+=h_scroll->get_minimum_size().y; } - if (v_scroll->is_visible()) { + if (v_scroll->is_visible_in_tree()) { min_size.x+=v_scroll->get_minimum_size().x; } return min_size; @@ -89,19 +89,19 @@ void ScrollContainer::_gui_input(const InputEvent& p_gui_input) { const InputEventMouseButton &mb=p_gui_input.mouse_button; if (mb.button_index==BUTTON_WHEEL_UP && mb.pressed) { - if (h_scroll->is_visible() && !v_scroll->is_visible()){ + if (h_scroll->is_visible_in_tree() && !v_scroll->is_visible_in_tree()){ // only horizontal is enabled, scroll horizontally h_scroll->set_value( h_scroll->get_value()-h_scroll->get_page()/8 ); - } else if (v_scroll->is_visible()) { + } else if (v_scroll->is_visible_in_tree()) { v_scroll->set_value( v_scroll->get_value()-v_scroll->get_page()/8 ); } } if (mb.button_index==BUTTON_WHEEL_DOWN && mb.pressed) { - if (h_scroll->is_visible() && !v_scroll->is_visible()){ + if (h_scroll->is_visible_in_tree() && !v_scroll->is_visible_in_tree()){ // only horizontal is enabled, scroll horizontally h_scroll->set_value( h_scroll->get_value()+h_scroll->get_page()/8 ); - } else if (v_scroll->is_visible()) { + } else if (v_scroll->is_visible_in_tree()) { v_scroll->set_value( v_scroll->get_value()+v_scroll->get_page()/8 ); } } @@ -216,10 +216,10 @@ void ScrollContainer::_notification(int p_what) { child_max_size = Size2(0, 0); Size2 size = get_size(); - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) size.y-=h_scroll->get_minimum_size().y; - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) size.x-=h_scroll->get_minimum_size().x; for(int i=0;i<get_child_count();i++) { @@ -236,14 +236,14 @@ void ScrollContainer::_notification(int p_what) { child_max_size.y = MAX(child_max_size.y, minsize.y); Rect2 r = Rect2(-scroll,minsize); - if (!(scroll_h || h_scroll->is_visible())) { + if (!(scroll_h || h_scroll->is_visible_in_tree())) { r.pos.x=0; if (c->get_h_size_flags()&SIZE_EXPAND) r.size.width=MAX(size.width,minsize.width); else r.size.width=minsize.width; } - if (!(scroll_v || v_scroll->is_visible())) { + if (!(scroll_v || v_scroll->is_visible_in_tree())) { r.pos.y=0; r.size.height=size.height; if (c->get_v_size_flags()&SIZE_EXPAND) diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index dacfc644ee..ad6e8786d7 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -53,11 +53,11 @@ void Slider::_gui_input(InputEvent p_event) { double grab_height = (double)grabber->get_size().height; double max = orientation==VERTICAL ? get_size().height - grab_height : get_size().width - grab_width; if (orientation==VERTICAL) - set_unit_value( 1 - (((double)grab.pos - (grab_height / 2.0)) / max) ); + set_as_ratio( 1 - (((double)grab.pos - (grab_height / 2.0)) / max) ); else - set_unit_value(((double)grab.pos - (grab_width/2.0)) / max); + set_as_ratio(((double)grab.pos - (grab_width/2.0)) / max); grab.active=true; - grab.uvalue=get_unit_value(); + grab.uvalue=get_as_ratio(); } else { grab.active=false; } @@ -81,7 +81,7 @@ void Slider::_gui_input(InputEvent p_event) { if (areasize<=0) return; float umotion = motion / float(areasize); - set_unit_value( grab.uvalue + umotion ); + set_as_ratio( grab.uvalue + umotion ); } } else { @@ -164,8 +164,10 @@ void Slider::_notification(int p_what) { if (orientation==VERTICAL) { style->draw(ci,Rect2i(Point2i(),Size2i(style->get_minimum_size().width+style->get_center_size().width,size.height))); - //if (mouse_inside||has_focus()) - // focus->draw(ci,Rect2i(Point2i(),Size2i(style->get_minimum_size().width+style->get_center_size().width,size.height))); + /* + if (mouse_inside||has_focus()) + focus->draw(ci,Rect2i(Point2i(),Size2i(style->get_minimum_size().width+style->get_center_size().width,size.height))); + */ float areasize = size.height - grabber->get_size().height; if (ticks>1) { int tickarea = size.height - tick->get_height(); @@ -176,11 +178,13 @@ void Slider::_notification(int p_what) { } } - grabber->draw(ci,Point2i(size.width/2-grabber->get_size().width/2,size.height - get_unit_value()*areasize - grabber->get_size().height)); + grabber->draw(ci,Point2i(size.width/2-grabber->get_size().width/2,size.height - get_as_ratio()*areasize - grabber->get_size().height)); } else { style->draw(ci,Rect2i(Point2i(),Size2i(size.width,style->get_minimum_size().height+style->get_center_size().height))); - //if (mouse_inside||has_focus()) - // focus->draw(ci,Rect2i(Point2i(),Size2i(size.width,style->get_minimum_size().height+style->get_center_size().height))); + /* + if (mouse_inside||has_focus()) + focus->draw(ci,Rect2i(Point2i(),Size2i(size.width,style->get_minimum_size().height+style->get_center_size().height))); + */ float areasize = size.width - grabber->get_size().width; if (ticks>1) { @@ -192,7 +196,7 @@ void Slider::_notification(int p_what) { } } - grabber->draw(ci,Point2i(get_unit_value()*areasize,size.height/2-grabber->get_size().height/2)); + grabber->draw(ci,Point2i(get_as_ratio()*areasize,size.height/2-grabber->get_size().height/2)); } } break; diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 070f9fc72e..ec6be0d19d 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -49,8 +49,10 @@ void SpinBox::_value_changed(double) { void SpinBox::_text_entered(const String& p_string) { - //if (!p_string.is_numeric()) - // return; + /* + if (!p_string.is_numeric()) + return; + */ String value = p_string; if (prefix!="" && p_string.begins_with(prefix)) value = p_string.substr(prefix.length(), p_string.length()-prefix.length()); diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index aae3b3fffa..a39ad2fe99 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -47,7 +47,7 @@ Control *SplitContainer::_getch(int p_idx) const { for(int i=0;i<get_child_count();i++) { Control *c=get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 11045eaafd..52d26b29de 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -680,7 +680,7 @@ Size2 TabContainer::get_minimum_size() const { if (c->is_set_as_toplevel()) continue; - if (!c->is_visible()) + if (!c->is_visible_in_tree()) continue; Size2 cms = c->get_combined_minimum_size(); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index cbc0c283de..8efff21fc9 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3036,7 +3036,7 @@ void TextEdit::adjust_viewport_to_cursor() { cursor.line_ofs=cursor.line; int visible_width=cache.size.width-cache.style_normal->get_minimum_size().width-cache.line_number_w-cache.breakpoint_gutter_width; - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) visible_width-=v_scroll->get_combined_minimum_size().width; visible_width-=20; // give it a little more space @@ -3044,7 +3044,7 @@ void TextEdit::adjust_viewport_to_cursor() { //printf("rowofs %i, visrows %i, cursor.line %i\n",cursor.line_ofs,get_visible_rows(),cursor.line); int visible_rows = get_visible_rows(); - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) visible_rows-=((h_scroll->get_combined_minimum_size().height-1)/get_row_height()); if (cursor.line>=(cursor.line_ofs+visible_rows)) @@ -3078,12 +3078,12 @@ void TextEdit::center_viewport_to_cursor() { cursor.line_ofs=cursor.line; int visible_width=cache.size.width-cache.style_normal->get_minimum_size().width-cache.line_number_w-cache.breakpoint_gutter_width; - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) visible_width-=v_scroll->get_combined_minimum_size().width; visible_width-=20; // give it a little more space int visible_rows = get_visible_rows(); - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) visible_rows-=((h_scroll->get_combined_minimum_size().height-1)/get_row_height()); int max_ofs = text.size()-(scroll_past_end_of_file_enabled?1:visible_rows); @@ -3205,9 +3205,9 @@ void TextEdit::_scroll_moved(double p_to_val) { if (updating_scrolls) return; - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) cursor.x_ofs=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) cursor.line_ofs=v_scroll->get_value(); update(); } @@ -3458,7 +3458,7 @@ void TextEdit::_reset_caret_blink_timer() { void TextEdit::_toggle_draw_caret() { draw_caret = !draw_caret; - if (is_visible() && has_focus() && window_has_focus) { + if (is_visible_in_tree() && has_focus() && window_has_focus) { update(); } } @@ -4357,7 +4357,7 @@ void TextEdit::_update_completion_candidates() { if (completion_options.size()==1) { //one option to complete, just complete it automagically _confirm_completion(); - // insert_text_at_cursor(completion_options[0].substr(s.length(),completion_options[0].length()-s.length())); + //insert_text_at_cursor(completion_options[0].substr(s.length(),completion_options[0].length()-s.length())); _cancel_completion(); return; @@ -4732,8 +4732,8 @@ TextEdit::TextEdit() { tab_size=4; text.set_tab_size(tab_size); text.clear(); - // text.insert(1,"Mongolia.."); - // text.insert(2,"PAIS GENEROSO!!"); + //text.insert(1,"Mongolia.."); + //text.insert(2,"PAIS GENEROSO!!"); text.set_color_regions(&color_regions); h_scroll = memnew( HScrollBar ); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index c7467f9b13..6113fd72c2 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -294,7 +294,7 @@ class TextEdit : public Control { void _scroll_lines_up(); void _scroll_lines_down(); -// void mouse_motion(const Point& p_pos, const Point& p_rel, int p_button_mask); + //void mouse_motion(const Point& p_pos, const Point& p_rel, int p_button_mask); Size2 get_minimum_size() const; int get_row_height() const; diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index 83cd853572..03e37e9d9f 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -120,13 +120,13 @@ void TextureButton::_notification(int p_what) { if (texdraw.is_valid()) { Rect2 drect(Point2(),texdraw->get_size()*scale); - draw_texture_rect(texdraw,drect,false,modulate); + draw_texture_rect(texdraw,drect,false); } if (has_focus() && focused.is_valid()) { Rect2 drect(Point2(),focused->get_size()*scale); - draw_texture_rect(focused,drect,false,modulate); + draw_texture_rect(focused,drect,false); }; @@ -143,7 +143,6 @@ void TextureButton::_bind_methods() { ClassDB::bind_method(_MD("set_focused_texture","texture:Texture"),&TextureButton::set_focused_texture); ClassDB::bind_method(_MD("set_click_mask","mask:BitMap"),&TextureButton::set_click_mask); ClassDB::bind_method(_MD("set_texture_scale","scale"),&TextureButton::set_texture_scale); - ClassDB::bind_method(_MD("set_modulate","color"),&TextureButton::set_modulate); ClassDB::bind_method(_MD("get_normal_texture:Texture"),&TextureButton::get_normal_texture); ClassDB::bind_method(_MD("get_pressed_texture:Texture"),&TextureButton::get_pressed_texture); @@ -152,7 +151,6 @@ void TextureButton::_bind_methods() { ClassDB::bind_method(_MD("get_focused_texture:Texture"),&TextureButton::get_focused_texture); ClassDB::bind_method(_MD("get_click_mask:BitMap"),&TextureButton::get_click_mask); ClassDB::bind_method(_MD("get_texture_scale"),&TextureButton::get_texture_scale); - ClassDB::bind_method(_MD("get_modulate"),&TextureButton::get_modulate); ADD_GROUP("Textures","texture_"); ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"texture_normal",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_normal_texture"), _SCS("get_normal_texture")); @@ -241,17 +239,7 @@ Size2 TextureButton::get_texture_scale() const{ return scale; } -void TextureButton::set_modulate(const Color& p_modulate) { - modulate=p_modulate; - update(); -} - -Color TextureButton::get_modulate() const { - return modulate; -} - - TextureButton::TextureButton() { scale=Size2(1.0, 1.0); - modulate=Color(1,1,1); + } diff --git a/scene/gui/texture_button.h b/scene/gui/texture_button.h index b6cb531c71..ef4d4d5b5b 100644 --- a/scene/gui/texture_button.h +++ b/scene/gui/texture_button.h @@ -42,8 +42,6 @@ class TextureButton : public BaseButton { Ref<Texture> focused; Ref<BitMap> click_mask; Size2 scale; - Color modulate; - protected: @@ -71,9 +69,6 @@ public: void set_texture_scale(Size2 p_scale); Size2 get_texture_scale() const; - void set_modulate(const Color& p_modulate); - Color get_modulate() const; - TextureButton(); }; diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp index df0512fc96..f6a33b5643 100644 --- a/scene/gui/texture_progress.cpp +++ b/scene/gui/texture_progress.cpp @@ -135,24 +135,24 @@ void TextureProgress::_notification(int p_what){ Size2 s = progress->get_size(); switch (mode) { case FILL_LEFT_TO_RIGHT: { - Rect2 region=Rect2(Point2(),Size2(s.x*get_unit_value(),s.y)); + Rect2 region=Rect2(Point2(),Size2(s.x*get_as_ratio(),s.y)); draw_texture_rect_region(progress,region,region); } break; case FILL_RIGHT_TO_LEFT: { - Rect2 region=Rect2(Point2(s.x-s.x*get_unit_value(),0),Size2(s.x*get_unit_value(),s.y)); + Rect2 region=Rect2(Point2(s.x-s.x*get_as_ratio(),0),Size2(s.x*get_as_ratio(),s.y)); draw_texture_rect_region(progress,region,region); } break; case FILL_TOP_TO_BOTTOM: { - Rect2 region=Rect2(Point2(),Size2(s.x,s.y*get_unit_value())); + Rect2 region=Rect2(Point2(),Size2(s.x,s.y*get_as_ratio())); draw_texture_rect_region(progress,region,region); } break; case FILL_BOTTOM_TO_TOP: { - Rect2 region=Rect2(Point2(0,s.y-s.y*get_unit_value()),Size2(s.x,s.y*get_unit_value())); + Rect2 region=Rect2(Point2(0,s.y-s.y*get_as_ratio()),Size2(s.x,s.y*get_as_ratio())); draw_texture_rect_region(progress,region,region); } break; case FILL_CLOCKWISE: case FILL_COUNTER_CLOCKWISE: { - float val=get_unit_value()*rad_max_degrees/360; + float val=get_as_ratio()*rad_max_degrees/360; if (val==1) { Rect2 region=Rect2(Point2(),s); draw_texture_rect_region(progress,region,region); @@ -192,7 +192,7 @@ void TextureProgress::_notification(int p_what){ } } break; default: - draw_texture_rect_region(progress,Rect2(Point2(),Size2(s.x*get_unit_value(),s.y)),Rect2(Point2(),Size2(s.x*get_unit_value(),s.y))); + draw_texture_rect_region(progress,Rect2(Point2(),Size2(s.x*get_as_ratio(),s.y)),Rect2(Point2(),Size2(s.x*get_as_ratio(),s.y))); } diff --git a/scene/gui/texture_frame.cpp b/scene/gui/texture_rect.cpp index bfa72ef067..cbb077ef5d 100644 --- a/scene/gui/texture_frame.cpp +++ b/scene/gui/texture_rect.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* texture_frame.cpp */ +/* texture_rect.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,10 +26,10 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "texture_frame.h" +#include "texture_rect.h" #include "servers/visual_server.h" -void TextureFrame::_notification(int p_what) { +void TextureRect::_notification(int p_what) { if (p_what==NOTIFICATION_DRAW) { @@ -85,22 +85,22 @@ void TextureFrame::_notification(int p_what) { } } -Size2 TextureFrame::get_minimum_size() const { +Size2 TextureRect::get_minimum_size() const { if (!expand && !texture.is_null()) return texture->get_size(); else return Size2(); } -void TextureFrame::_bind_methods() { +void TextureRect::_bind_methods() { - ClassDB::bind_method(_MD("set_texture","texture"), & TextureFrame::set_texture ); - ClassDB::bind_method(_MD("get_texture"), & TextureFrame::get_texture ); - ClassDB::bind_method(_MD("set_expand","enable"), & TextureFrame::set_expand ); - ClassDB::bind_method(_MD("has_expand"), & TextureFrame::has_expand ); - ClassDB::bind_method(_MD("set_stretch_mode","stretch_mode"), & TextureFrame::set_stretch_mode ); - ClassDB::bind_method(_MD("get_stretch_mode"), & TextureFrame::get_stretch_mode ); + ClassDB::bind_method(_MD("set_texture","texture"), & TextureRect::set_texture ); + ClassDB::bind_method(_MD("get_texture"), & TextureRect::get_texture ); + ClassDB::bind_method(_MD("set_expand","enable"), & TextureRect::set_expand ); + ClassDB::bind_method(_MD("has_expand"), & TextureRect::has_expand ); + ClassDB::bind_method(_MD("set_stretch_mode","stretch_mode"), & TextureRect::set_stretch_mode ); + ClassDB::bind_method(_MD("get_stretch_mode"), & TextureRect::get_stretch_mode ); ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), _SCS("set_texture"),_SCS("get_texture") ); ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "expand" ), _SCS("set_expand"),_SCS("has_expand") ); @@ -117,44 +117,46 @@ void TextureFrame::_bind_methods() { } -void TextureFrame::set_texture(const Ref<Texture>& p_tex) { +void TextureRect::set_texture(const Ref<Texture>& p_tex) { texture=p_tex; update(); - //if (texture.is_valid()) - // texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites + /* + if (texture.is_valid()) + texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites + */ minimum_size_changed(); } -Ref<Texture> TextureFrame::get_texture() const { +Ref<Texture> TextureRect::get_texture() const { return texture; } -void TextureFrame::set_expand(bool p_expand) { +void TextureRect::set_expand(bool p_expand) { expand=p_expand; update(); minimum_size_changed(); } -bool TextureFrame::has_expand() const { +bool TextureRect::has_expand() const { return expand; } -void TextureFrame::set_stretch_mode(StretchMode p_mode) { +void TextureRect::set_stretch_mode(StretchMode p_mode) { stretch_mode=p_mode; update(); } -TextureFrame::StretchMode TextureFrame::get_stretch_mode() const { +TextureRect::StretchMode TextureRect::get_stretch_mode() const { return stretch_mode; } -TextureFrame::TextureFrame() { +TextureRect::TextureRect() { expand=false; @@ -163,7 +165,7 @@ TextureFrame::TextureFrame() { } -TextureFrame::~TextureFrame() +TextureRect::~TextureRect() { } diff --git a/scene/gui/texture_frame.h b/scene/gui/texture_rect.h index c311748708..e95d742759 100644 --- a/scene/gui/texture_frame.h +++ b/scene/gui/texture_rect.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* texture_frame.h */ +/* texture_rect.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -33,9 +33,9 @@ /** @author Juan Linietsky <reduzio@gmail.com> */ -class TextureFrame : public Control { +class TextureRect : public Control { - GDCLASS(TextureFrame,Control); + GDCLASS(TextureRect,Control); public: enum StretchMode { STRETCH_SCALE_ON_EXPAND, //default, for backwards compatibility @@ -69,10 +69,10 @@ public: void set_stretch_mode(StretchMode p_mode); StretchMode get_stretch_mode() const; - TextureFrame(); - ~TextureFrame(); + TextureRect(); + ~TextureRect(); }; -VARIANT_ENUM_CAST( TextureFrame::StretchMode ); +VARIANT_ENUM_CAST( TextureRect::StretchMode ); #endif // TEXTURE_FRAME_H diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 9f5b9f710d..58c829690f 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -949,8 +949,10 @@ void Tree::draw_item_rect(const TreeItem::Cell& p_cell,const Rect2i& p_rect,cons } -// if (p_tool) -// rect.size.x-=Math::floor(rect.size.y/2); + /* + if (p_tool) + rect.size.x-=Math::floor(rect.size.y/2); + */ Ref<Font> font = cache.font; @@ -1029,7 +1031,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2& } //draw separation. -// if (p_item->get_parent()!=root || !hide_root) + //if (p_item->get_parent()!=root || !hide_root) Ref<Font> font = cache.font; @@ -1115,7 +1117,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2& } else { cache.selected->draw(ci,r ); } - if (text_editor->is_visible()){ + if (text_editor->is_visible_in_tree()){ text_editor->set_pos(get_global_pos() + r.pos); } } @@ -1262,7 +1264,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2& } break; case TreeItem::CELL_MODE_CUSTOM: { - // int option = (int)p_item->cells[i].val; + //int option = (int)p_item->cells[i].val; @@ -1414,8 +1416,10 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c emit_signal("item_selected"); emitted_row=true; } - //if (p_col==i) - // p_current->selected_signal.call(p_col); + /* + if (p_col==i) + p_current->selected_signal.call(p_col); + */ } else if (c.selected) { @@ -1672,9 +1676,11 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_ } } - //if (!c.selected && select_mode==SELECT_MULTI) { - // emit_signal("multi_selected",p_item,col,true); - //} + /* + if (!c.selected && select_mode==SELECT_MULTI) { + emit_signal("multi_selected",p_item,col,true); + } + */ update(); } @@ -1997,7 +2003,7 @@ void Tree::_gui_input(InputEvent p_event) { } break; case KEY_LEFT: { -// TreeItem *next = NULL; + //TreeItem *next = NULL; if (!selected_item) break; if (select_mode==SELECT_ROW) @@ -2027,7 +2033,7 @@ void Tree::_gui_input(InputEvent p_event) { next=selected_item->get_next_visible(); -// if (diff < uint64_t(GLOBAL_DEF("gui/incr_search_max_interval_msec",2000))) { + //if (diff < uint64_t(GLOBAL_DEF("gui/incr_search_max_interval_msec",2000))) { if (last_keypress!=0) { //incr search next int col; @@ -2277,9 +2283,9 @@ void Tree::_gui_input(InputEvent p_event) { mpos.y-=_get_title_button_height(); if (mpos.y>=0) { - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) mpos.x+=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) mpos.y+=v_scroll->get_value(); int col,h,section; @@ -2470,7 +2476,7 @@ void Tree::_gui_input(InputEvent p_event) { if (!click_handled) { drag_speed=0; drag_accum=0; -// last_drag_accum=0; + //last_drag_accum=0; drag_from=v_scroll->get_value(); drag_touching=OS::get_singleton()->has_touchscreen_ui_hint(); drag_touching_deaccel=false; @@ -2567,7 +2573,7 @@ bool Tree::edit_selected() { value_editor->set_max( c.max ); value_editor->set_step( c.step ); value_editor->set_value( c.val ); - value_editor->set_exp_unit_value( c.expr ); + value_editor->set_exp_ratio( c.expr ); updating_value_editor=false; } @@ -2787,13 +2793,10 @@ void Tree::_notification(int p_what) { } int ofs=0; -// int from_y=exposed.pos.y+bg->get_margin(MARGIN_TOP); -// int size_y=exposed.size.height-bg->get_minimum_size().height; for (int i=0;i<(columns.size()-1-1);i++) { ofs+=get_column_width(i); - //get_painter()->draw_fill_rect( Point2(ofs+cache.hseparation/2, from_y), Size2( 1, size_y ),color( COLOR_TREE_GRID) ); } if (show_column_titles) { @@ -3016,8 +3019,10 @@ int Tree::get_edited_column() const { TreeItem* Tree::get_next_selected( TreeItem* p_item) { - //if (!p_item) - // return NULL; + /* + if (!p_item) + return NULL; + */ if (!root) return NULL; @@ -3069,7 +3074,7 @@ int Tree::get_column_width(int p_column) const { int expand_area=get_size().width-(bg->get_margin(MARGIN_LEFT)+bg->get_margin(MARGIN_RIGHT)); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) expand_area-=v_scroll->get_combined_minimum_size().width; int expanding_columns=0; @@ -3254,9 +3259,9 @@ String Tree::get_column_title(int p_column) const { Point2 Tree::get_scroll() const { Point2 ofs; - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) ofs.x=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) ofs.y=v_scroll->get_value(); return ofs; @@ -3395,9 +3400,9 @@ int Tree::get_column_at_pos(const Point2& p_pos) const { if (pos.y<0) return -1; - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) pos.x+=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) pos.y+=v_scroll->get_value(); int col,h,section; @@ -3422,9 +3427,9 @@ int Tree::get_drop_section_at_pos(const Point2& p_pos) const { if (pos.y<0) return -100; - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) pos.x+=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) pos.y+=v_scroll->get_value(); int col,h,section; @@ -3449,9 +3454,9 @@ TreeItem* Tree::get_item_at_pos(const Point2& p_pos) const { if (pos.y<0) return NULL; - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) pos.x+=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) pos.y+=v_scroll->get_value(); int col,h,section; @@ -3477,9 +3482,9 @@ String Tree::get_tooltip(const Point2& p_pos) const { if (pos.y<0) return Control::get_tooltip(p_pos); - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) pos.x+=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) pos.y+=v_scroll->get_value(); int col,h,section; diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 8327e356b3..d715ff4772 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -334,7 +334,7 @@ friend class TreeItem; int compute_item_height(TreeItem *p_item) const; int get_item_height(TreeItem *p_item) const; -// void draw_item_text(String p_text,const Ref<Texture>& p_icon,int p_icon_max_w,bool p_tool,Rect2i p_rect,const Color& p_color); + //void draw_item_text(String p_text,const Ref<Texture>& p_icon,int p_icon_max_w,bool p_tool,Rect2i p_rect,const Color& p_color); void draw_item_rect(const TreeItem::Cell& p_cell,const Rect2i& p_rect,const Color& p_color); int draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2& p_draw_size,TreeItem *p_item); void select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col,TreeItem *p_prev=NULL,bool *r_in_range=NULL,bool p_force_deselect=false); diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index f7d2ad1c63..4c177ea53c 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -394,7 +394,7 @@ void VideoPlayer::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::INT, "audio_track",PROPERTY_HINT_RANGE,"0,128,1"), _SCS("set_audio_track"), _SCS("get_audio_track") ); ADD_PROPERTY( PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE,"VideoStream"), _SCS("set_stream"), _SCS("get_stream") ); -// ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/loop"), _SCS("set_loop"), _SCS("has_loop") ); + //ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/loop"), _SCS("set_loop"), _SCS("has_loop") ); ADD_PROPERTY( PropertyInfo(Variant::REAL, "volume_db", PROPERTY_HINT_RANGE,"-80,24,0.01"), _SCS("set_volume_db"), _SCS("get_volume_db") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL, "autoplay"), _SCS("set_autoplay"), _SCS("has_autoplay") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL, "paused"), _SCS("set_paused"), _SCS("is_paused") ); diff --git a/scene/gui/viewport_container.cpp b/scene/gui/viewport_container.cpp index 37ecd3cb2f..9e89de66dd 100644 --- a/scene/gui/viewport_container.cpp +++ b/scene/gui/viewport_container.cpp @@ -63,7 +63,7 @@ void ViewportContainer::_notification(int p_what) { continue; - if (is_visible()) + if (is_visible_in_tree()) c->set_update_mode(Viewport::UPDATE_ALWAYS); else c->set_update_mode(Viewport::UPDATE_DISABLED); diff --git a/scene/io/resource_format_image.cpp b/scene/io/resource_format_image.cpp index cc3d9baa74..2d098d01f5 100644 --- a/scene/io/resource_format_image.cpp +++ b/scene/io/resource_format_image.cpp @@ -36,7 +36,7 @@ RES ResourceFormatLoaderImage::load(const String &p_path, const String& p_origin if (r_error) *r_error=ERR_CANT_OPEN; - if (p_path.extension()=="cube") { + if (p_path.get_extension()=="cube") { // open as cubemap txture CubeMap* ptr = memnew(CubeMap); @@ -235,7 +235,7 @@ void ResourceFormatLoaderImage::get_recognized_extensions(List<String> *p_extens String ResourceFormatLoaderImage::get_resource_type(const String &p_path) const { - String ext=p_path.extension().to_lower(); + String ext=p_path.get_extension().to_lower(); if (ext=="cube") return "CubeMap"; diff --git a/scene/io/resource_format_wav.cpp b/scene/io/resource_format_wav.cpp index f75836d2df..0a19e6f72b 100644 --- a/scene/io/resource_format_wav.cpp +++ b/scene/io/resource_format_wav.cpp @@ -267,7 +267,7 @@ bool ResourceFormatLoaderWAV::handles_type(const String& p_type) const { String ResourceFormatLoaderWAV::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="wav") + if (p_path.get_extension().to_lower()=="wav") return "Sample"; return ""; } diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index 2e2e1d6c80..84fe2a00f6 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -176,7 +176,7 @@ void CanvasLayer::_notification(int p_what) { } ERR_FAIL_COND(!vp); - viewport=vp->get_viewport(); + viewport=vp->get_viewport_rid(); VisualServer::get_singleton()->viewport_attach_canvas(viewport,canvas->get_canvas()); VisualServer::get_singleton()->viewport_set_canvas_layer(viewport,canvas->get_canvas(),layer); @@ -232,7 +232,7 @@ void CanvasLayer::set_custom_viewport(Node *p_viewport) { else vp=Node::get_viewport(); - viewport = vp->get_viewport(); + viewport = vp->get_viewport_rid(); VisualServer::get_singleton()->viewport_attach_canvas(viewport,canvas->get_canvas()); VisualServer::get_singleton()->viewport_set_canvas_layer(viewport,canvas->get_canvas(),layer); @@ -285,7 +285,7 @@ void CanvasLayer::_bind_methods() { ClassDB::bind_method(_MD("get_custom_viewport:Viewport"),&CanvasLayer::get_custom_viewport); ClassDB::bind_method(_MD("get_world_2d:World2D"),&CanvasLayer::get_world_2d); -// ClassDB::bind_method(_MD("get_viewport"),&CanvasLayer::get_viewport); + //ClassDB::bind_method(_MD("get_viewport"),&CanvasLayer::get_viewport); ADD_PROPERTY( PropertyInfo(Variant::INT,"layer",PROPERTY_HINT_RANGE,"-128,128,1"),_SCS("set_layer"),_SCS("get_layer") ); //ADD_PROPERTY( PropertyInfo(Variant::MATRIX32,"transform",PROPERTY_HINT_RANGE),_SCS("set_transform"),_SCS("get_transform") ); diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 25180b568f..63a81a139d 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -40,7 +40,7 @@ void HTTPRequest::_redirect_request(const String& p_new_url) { Error HTTPRequest::_request() { //print_line("Requesting:\n\tURL: "+url+"\n\tString: "+request_string+"\n\tPort: "+itos(port)+"\n\tSSL: "+itos(use_ssl)+"\n\tValidate SSL: "+itos(validate_ssl)); - return client->connect(url,port,use_ssl,validate_ssl); + return client->connect_to_host(url,port,use_ssl,validate_ssl); } Error HTTPRequest::_parse_url(const String& p_url) { diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 32cefa6085..86b78f60f6 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1384,6 +1384,17 @@ String Node::_generate_serial_child_name(Node *p_child) { if (name=="") { name = p_child->get_class(); + // Adjust casing according to project setting. The current type name is expected to be in PascalCase. + switch (GlobalConfig::get_singleton()->get("editor/node_name_casing").operator int()) { + case NAME_CASING_PASCAL_CASE: + break; + case NAME_CASING_CAMEL_CASE: + name[0] = name.to_lower()[0]; + break; + case NAME_CASING_SNAKE_CASE: + name = name.camelcase_to_underscore(true); + break; + } } // Extract trailing number @@ -2723,7 +2734,7 @@ void Node::_set_tree(SceneTree *p_tree) { SceneTree *tree_changed_a=NULL; SceneTree *tree_changed_b=NULL; -// ERR_FAIL_COND(p_scene && data.parent && !data.parent->data.scene); //nobug if both are null + //ERR_FAIL_COND(p_scene && data.parent && !data.parent->data.scene); //nobug if both are null if (data.tree) { _propagate_exit_tree(); @@ -2888,9 +2899,10 @@ void Node::request_ready() { void Node::_bind_methods() { - _GLOBAL_DEF("editor/node_name_num_separator",0); + GLOBAL_DEF("editor/node_name_num_separator",0); GlobalConfig::get_singleton()->set_custom_property_info("editor/node_name_num_separator",PropertyInfo(Variant::INT,"editor/node_name_num_separator",PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash")); - + GLOBAL_DEF("editor/node_name_casing",NAME_CASING_PASCAL_CASE); + GlobalConfig::get_singleton()->set_custom_property_info("editor/node_name_casing",PropertyInfo(Variant::INT,"editor/node_name_casing",PROPERTY_HINT_ENUM,"PascalCase,camelCase,snake_case")); ClassDB::bind_method(_MD("_add_child_below_node","node:Node","child_node:Node","legible_unique_name"),&Node::add_child_below_node,DEFVAL(false)); @@ -3050,8 +3062,8 @@ void Node::_bind_methods() { ADD_SIGNAL( MethodInfo("tree_entered") ); ADD_SIGNAL( MethodInfo("tree_exited") ); -// ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/process" ),_SCS("set_process"),_SCS("is_processing") ); -// ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/fixed_process" ), _SCS("set_fixed_process"),_SCS("is_fixed_processing") ); + //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/process" ),_SCS("set_process"),_SCS("is_processing") ); + //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/fixed_process" ), _SCS("set_fixed_process"),_SCS("is_fixed_processing") ); //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/input" ), _SCS("set_process_input"),_SCS("is_processing_input" ) ); //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/unhandled_input" ), _SCS("set_process_unhandled_input"),_SCS("is_processing_unhandled_input" ) ); ADD_GROUP("Pause","pause_"); diff --git a/scene/main/node.h b/scene/main/node.h index e27404d46e..14fd19a76f 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -147,6 +147,12 @@ private: } data; + enum NameCasing { + NAME_CASING_PASCAL_CASE, + NAME_CASING_CAMEL_CASE, + NAME_CASING_SNAKE_CASE + }; + void _print_tree(const Node *p_node); diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index d233bf1a72..147409a862 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -141,7 +141,7 @@ void SceneTree::_flush_ugc() { for(int i=0;i<E->get().size();i++) v[i]=E->get()[i]; - call_group(GROUP_CALL_REALTIME,E->key().group,E->key().call,v[0],v[1],v[2],v[3],v[4]); + call_group_flags(GROUP_CALL_REALTIME,E->key().group,E->key().call,v[0],v[1],v[2],v[3],v[4]); unique_group_calls.erase(E); } @@ -166,7 +166,7 @@ void SceneTree::_update_group_order(Group& g) { } -void SceneTree::call_group(uint32_t p_call_flags,const StringName& p_group,const StringName& p_function,VARIANT_ARG_DECLARE) { +void SceneTree::call_group_flags(uint32_t p_call_flags,const StringName& p_group,const StringName& p_function,VARIANT_ARG_DECLARE) { Map<StringName,Group>::Element *E=group_map.find(p_group); if (!E) @@ -216,7 +216,7 @@ void SceneTree::call_group(uint32_t p_call_flags,const StringName& p_group,const continue; if (p_call_flags&GROUP_CALL_REALTIME) { - if (p_call_flags&GROUP_CALL_MULIILEVEL) + if (p_call_flags&GROUP_CALL_MULTILEVEL) nodes[i]->call_multilevel(p_function,VARIANT_ARG_PASS); else nodes[i]->call(p_function,VARIANT_ARG_PASS); @@ -233,7 +233,7 @@ void SceneTree::call_group(uint32_t p_call_flags,const StringName& p_group,const continue; if (p_call_flags&GROUP_CALL_REALTIME) { - if (p_call_flags&GROUP_CALL_MULIILEVEL) + if (p_call_flags&GROUP_CALL_MULTILEVEL) nodes[i]->call_multilevel(p_function,VARIANT_ARG_PASS); else nodes[i]->call(p_function,VARIANT_ARG_PASS); @@ -248,7 +248,7 @@ void SceneTree::call_group(uint32_t p_call_flags,const StringName& p_group,const call_skip.clear(); } -void SceneTree::notify_group(uint32_t p_call_flags,const StringName& p_group,int p_notification) { +void SceneTree::notify_group_flags(uint32_t p_call_flags,const StringName& p_group,int p_notification) { Map<StringName,Group>::Element *E=group_map.find(p_group); if (!E) @@ -298,7 +298,7 @@ void SceneTree::notify_group(uint32_t p_call_flags,const StringName& p_group,int call_skip.clear(); } -void SceneTree::set_group(uint32_t p_call_flags,const StringName& p_group,const String& p_name,const Variant& p_value) { +void SceneTree::set_group_flags(uint32_t p_call_flags,const StringName& p_group,const String& p_name,const Variant& p_value) { Map<StringName,Group>::Element *E=group_map.find(p_group); if (!E) @@ -348,6 +348,23 @@ void SceneTree::set_group(uint32_t p_call_flags,const StringName& p_group,const call_skip.clear(); } + +void SceneTree::call_group(const StringName& p_group,const StringName& p_function,VARIANT_ARG_DECLARE) { + + call_group_flags(0,p_group,VARIANT_ARG_PASS); +} + +void SceneTree::notify_group(const StringName& p_group,int p_notification) { + + notify_group_flags(0,p_group,p_notification); +} + +void SceneTree::set_group(const StringName& p_group,const String& p_name,const Variant& p_value) { + + set_group_flags(0,p_group,p_name,p_value); +} + + void SceneTree::set_input_as_handled() { input_handled=true; @@ -357,7 +374,7 @@ void SceneTree::input_text( const String& p_text ) { root_lock++; - call_group(GROUP_CALL_REALTIME,"_viewports","_vp_input_text",p_text); //special one for GUI, as controls use their own process check + call_group_flags(GROUP_CALL_REALTIME,"_viewports","_vp_input_text",p_text); //special one for GUI, as controls use their own process check root_lock--; @@ -438,21 +455,22 @@ void SceneTree::input_event( const InputEvent& p_event ) { //call_group(GROUP_CALL_REVERSE|GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"input","_input",ev); - /*if (ev.type==InputEvent::KEY && ev.key.pressed && !ev.key.echo && ev.key.scancode==KEY_F12) { + /* + if (ev.type==InputEvent::KEY && ev.key.pressed && !ev.key.echo && ev.key.scancode==KEY_F12) { print_line("RAM: "+itos(Memory::get_static_mem_usage())); print_line("DRAM: "+itos(Memory::get_dynamic_mem_usage())); } -*/ - //if (ev.type==InputEvent::KEY && ev.key.pressed && !ev.key.echo && ev.key.scancode==KEY_F11) { + if (ev.type==InputEvent::KEY && ev.key.pressed && !ev.key.echo && ev.key.scancode==KEY_F11) { - // Memory::dump_static_mem_to_file("memdump.txt"); - //} + Memory::dump_static_mem_to_file("memdump.txt"); + } + */ //transform for the rest #else - call_group(GROUP_CALL_REALTIME,"_viewports","_vp_input",ev); //special one for GUI, as controls use their own process check + call_group_flags(GROUP_CALL_REALTIME,"_viewports","_vp_input",ev); //special one for GUI, as controls use their own process check #endif if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_remote() && ev.type==InputEvent::KEY && ev.key.pressed && !ev.key.echo && ev.key.scancode==KEY_F8) { @@ -477,7 +495,7 @@ void SceneTree::input_event( const InputEvent& p_event ) { } #else - call_group(GROUP_CALL_REALTIME,"_viewports","_vp_unhandled_input",ev); //special one for GUI, as controls use their own process check + call_group_flags(GROUP_CALL_REALTIME,"_viewports","_vp_unhandled_input",ev); //special one for GUI, as controls use their own process check #endif input_handled=true; @@ -528,7 +546,7 @@ bool SceneTree::iteration(float p_time) { _notify_group_pause("fixed_process",Node::NOTIFICATION_FIXED_PROCESS); _flush_ugc(); _flush_transform_notifications(); - call_group(GROUP_CALL_REALTIME,"_viewports","update_worlds"); + call_group_flags(GROUP_CALL_REALTIME,"_viewports","update_worlds"); root_lock--; _flush_delete_queue(); @@ -540,9 +558,9 @@ bool SceneTree::iteration(float p_time) { bool SceneTree::idle(float p_time){ -// print_line("ram: "+itos(OS::get_singleton()->get_static_memory_usage())+" sram: "+itos(OS::get_singleton()->get_dynamic_memory_usage())); -// print_line("node count: "+itos(get_node_count())); -// print_line("TEXTURE RAM: "+itos(VS::get_singleton()->get_render_info(VS::INFO_TEXTURE_MEM_USED))); + //print_line("ram: "+itos(OS::get_singleton()->get_static_memory_usage())+" sram: "+itos(OS::get_singleton()->get_dynamic_memory_usage())); + //print_line("node count: "+itos(get_node_count())); + //print_line("TEXTURE RAM: "+itos(VS::get_singleton()->get_render_info(VS::INFO_TEXTURE_MEM_USED))); root_lock++; @@ -573,7 +591,7 @@ bool SceneTree::idle(float p_time){ _flush_ugc(); _flush_transform_notifications(); //transforms after world update, to avoid unnecesary enter/exit notifications - call_group(GROUP_CALL_REALTIME,"_viewports","update_worlds"); + call_group_flags(GROUP_CALL_REALTIME,"_viewports","update_worlds"); root_lock--; @@ -667,7 +685,7 @@ void SceneTree::_notification(int p_notification) { } break; case NOTIFICATION_WM_UNFOCUS_REQUEST: { - notify_group(GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"input",NOTIFICATION_WM_UNFOCUS_REQUEST); + notify_group_flags(GROUP_CALL_REALTIME|GROUP_CALL_MULTILEVEL,"input",NOTIFICATION_WM_UNFOCUS_REQUEST); } break; @@ -991,7 +1009,7 @@ uint32_t SceneTree::get_last_event_id() const { } -Variant SceneTree::_call_group(const Variant** p_args, int p_argcount, Variant::CallError& r_error) { +Variant SceneTree::_call_group_flags(const Variant** p_args, int p_argcount, Variant::CallError& r_error) { r_error.error=Variant::CallError::CALL_OK; @@ -1011,11 +1029,33 @@ Variant SceneTree::_call_group(const Variant** p_args, int p_argcount, Variant:: v[i]=*p_args[i+3]; } - call_group(flags,group,method,v[0],v[1],v[2],v[3],v[4]); + call_group_flags(flags,group,method,v[0],v[1],v[2],v[3],v[4]); return Variant(); } +Variant SceneTree::_call_group(const Variant** p_args, int p_argcount, Variant::CallError& r_error) { + + + r_error.error=Variant::CallError::CALL_OK; + + ERR_FAIL_COND_V(p_argcount<2,Variant()); + ERR_FAIL_COND_V(p_args[0]->get_type()!=Variant::STRING,Variant()); + ERR_FAIL_COND_V(p_args[1]->get_type()!=Variant::STRING,Variant()); + + StringName group = *p_args[0]; + StringName method = *p_args[1]; + Variant v[VARIANT_ARG_MAX]; + + for(int i=0;i<MIN(p_argcount-2,5);i++) { + + v[i]=*p_args[i+2]; + } + + call_group_flags(0,group,method,v[0],v[1],v[2],v[3],v[4]); + return Variant(); +} + int64_t SceneTree::get_frame() const { return current_frame; @@ -1138,8 +1178,8 @@ void SceneTree::_update_root_rect() { Size2 viewport_size; Size2 screen_size; - float viewport_aspect = desired_res.get_aspect(); - float video_mode_aspect = video_mode.get_aspect(); + float viewport_aspect = desired_res.aspect(); + float video_mode_aspect = video_mode.aspect(); if (stretch_aspect==STRETCH_ASPECT_IGNORE || ABS(viewport_aspect - video_mode_aspect)<CMP_EPSILON) { //same aspect or ignore aspect @@ -1198,8 +1238,8 @@ void SceneTree::_update_root_rect() { VisualServer::get_singleton()->black_bars_set_margins(0,0,0,0); } -// print_line("VP SIZE: "+viewport_size+" OFFSET: "+offset+" = "+(offset*2+viewport_size)); -// print_line("SS: "+video_mode); + //print_line("VP SIZE: "+viewport_size+" OFFSET: "+offset+" = "+(offset*2+viewport_size)); + //print_line("SS: "+video_mode); switch (stretch_mode) { case STRETCH_MODE_2D: { @@ -2181,10 +2221,6 @@ void SceneTree::_bind_methods() { //ClassDB::bind_method(_MD("call_group","call_flags","group","method","arg1","arg2"),&SceneMainLoop::_call_group,DEFVAL(Variant()),DEFVAL(Variant())); - ClassDB::bind_method(_MD("notify_group","call_flags","group","notification"),&SceneTree::notify_group); - ClassDB::bind_method(_MD("set_group","call_flags","group","property","value"),&SceneTree::set_group); - - ClassDB::bind_method(_MD("get_nodes_in_group","group"),&SceneTree::_get_nodes_in_group); ClassDB::bind_method(_MD("get_root:Viewport"),&SceneTree::get_root); ClassDB::bind_method(_MD("has_group","name"),&SceneTree::has_group); @@ -2222,13 +2258,30 @@ void SceneTree::_bind_methods() { MethodInfo mi; - mi.name="call_group"; + mi.name="call_group_flags"; mi.arguments.push_back( PropertyInfo( Variant::INT, "flags")); mi.arguments.push_back( PropertyInfo( Variant::STRING, "group")); mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_group",&SceneTree::_call_group,mi); + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_group_flags",&SceneTree::_call_group_flags,mi); + + ClassDB::bind_method(_MD("notify_group_flags","call_flags","group","notification"),&SceneTree::notify_group_flags); + ClassDB::bind_method(_MD("set_group_flags","call_flags","group","property","value"),&SceneTree::set_group_flags); + + MethodInfo mi2; + mi2.name="call_group"; + mi2.arguments.push_back( PropertyInfo( Variant::STRING, "group")); + mi2.arguments.push_back( PropertyInfo( Variant::STRING, "method")); + + + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_group",&SceneTree::_call_group,mi2); + + ClassDB::bind_method(_MD("notify_group","call_flags","group","notification"),&SceneTree::notify_group); + ClassDB::bind_method(_MD("set_group","call_flags","group","property","value"),&SceneTree::set_group); + + ClassDB::bind_method(_MD("get_nodes_in_group","group"),&SceneTree::_get_nodes_in_group); + ClassDB::bind_method(_MD("set_current_scene","child_node:Node"),&SceneTree::set_current_scene); ClassDB::bind_method(_MD("get_current_scene:Node"),&SceneTree::get_current_scene); diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h index 9de4abe81e..f4271e5454 100644 --- a/scene/main/scene_main_loop.h +++ b/scene/main/scene_main_loop.h @@ -242,9 +242,11 @@ friend class Node; void _notify_group_pause(const StringName& p_group,int p_notification); void _call_input_pause(const StringName& p_group,const StringName& p_method,const InputEvent& p_input); + Variant _call_group_flags(const Variant** p_args, int p_argcount, Variant::CallError& r_error); Variant _call_group(const Variant** p_args, int p_argcount, Variant::CallError& r_error); + static void _debugger_request_tree(void *self); void _flush_delete_queue(); //optimization @@ -332,17 +334,20 @@ public: GROUP_CALL_REVERSE=1, GROUP_CALL_REALTIME=2, GROUP_CALL_UNIQUE=4, - GROUP_CALL_MULIILEVEL=8, + GROUP_CALL_MULTILEVEL=8, }; _FORCE_INLINE_ Viewport *get_root() const { return root; } uint32_t get_last_event_id() const; - void call_group(uint32_t p_call_flags,const StringName& p_group,const StringName& p_function,VARIANT_ARG_LIST); - void notify_group(uint32_t p_call_flags,const StringName& p_group,int p_notification); - void set_group(uint32_t p_call_flags,const StringName& p_group,const String& p_name,const Variant& p_value); + void call_group_flags(uint32_t p_call_flags,const StringName& p_group,const StringName& p_function,VARIANT_ARG_LIST); + void notify_group_flags(uint32_t p_call_flags,const StringName& p_group,int p_notification); + void set_group_flags(uint32_t p_call_flags,const StringName& p_group,const String& p_name,const Variant& p_value); + void call_group(const StringName& p_group,const StringName& p_function,VARIANT_ARG_LIST); + void notify_group(const StringName& p_group,int p_notification); + void set_group(const StringName& p_group,const String& p_name,const Variant& p_value); virtual void input_text( const String& p_text ); virtual void input_event( const InputEvent& p_event ); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index fe363d97f7..c3ece76b05 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -272,7 +272,7 @@ void Viewport::_parent_visibility_changed() { if (parent_control) { Control *c = parent_control; - VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,c->is_visible()); + VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,c->is_visible_in_tree()); _update_listener(); _update_listener_2d(); @@ -293,12 +293,12 @@ void Viewport::_vp_enter_tree() { VisualServer::get_singleton()->canvas_item_set_parent(canvas_item,parent_ci); VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,false); -// VisualServer::get_singleton()->canvas_item_attach_viewport(canvas_item,viewport); + //VisualServer::get_singleton()->canvas_item_attach_viewport(canvas_item,viewport); parent_control->connect("resized",this,"_parent_resized"); parent_control->connect("visibility_changed",this,"_parent_visibility_changed"); } else if (!parent){ -// VisualServer::get_singleton()->viewport_attach_to_screen(viewport,0); + //VisualServer::get_singleton()->viewport_attach_to_screen(viewport,0); } */ @@ -389,7 +389,7 @@ void Viewport::_notification(int p_what) { if (get_parent()) { parent = get_parent()->get_viewport(); - VisualServer::get_singleton()->viewport_set_parent_viewport(viewport,parent->get_viewport()); + VisualServer::get_singleton()->viewport_set_parent_viewport(viewport,parent->get_viewport_rid()); } else { parent=NULL; } @@ -462,8 +462,10 @@ void Viewport::_notification(int p_what) { if (world_2d.is_valid()) world_2d->_remove_viewport(this); - //if (!render_target) - // _vp_exit_tree(); + /* + if (!render_target) + _vp_exit_tree(); + */ VisualServer::get_singleton()->viewport_set_scenario(viewport,RID()); SpatialSoundServer::get_singleton()->listener_set_space(internal_listener, RID()); @@ -734,7 +736,7 @@ void Viewport::_notification(int p_what) { } } -RID Viewport::get_viewport() const { +RID Viewport::get_viewport_rid() const { return viewport; } @@ -782,7 +784,7 @@ Size2 Viewport::get_size() const { void Viewport::_update_listener() { - if (is_inside_tree() && audio_listener && (camera || listener) && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible()))) { + if (is_inside_tree() && audio_listener && (camera || listener) && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible_in_tree()))) { SpatialSoundServer::get_singleton()->listener_set_space(internal_listener, find_world()->get_sound_space()); } else { SpatialSoundServer::get_singleton()->listener_set_space(internal_listener, RID()); @@ -793,7 +795,7 @@ void Viewport::_update_listener() { void Viewport::_update_listener_2d() { - if (is_inside_tree() && audio_listener && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible()))) + if (is_inside_tree() && audio_listener && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible_in_tree()))) SpatialSound2DServer::get_singleton()->listener_set_space(internal_listener_2d, find_world_2d()->get_sound_space()); else SpatialSound2DServer::get_singleton()->listener_set_space(internal_listener_2d, RID()); @@ -1309,7 +1311,7 @@ void Viewport::queue_screen_capture(){ } Image Viewport::get_screen_capture() const { -// return VS::get_singleton()->viewport_get_screen_capture(viewport); + //return VS::get_singleton()->viewport_get_screen_capture(viewport); return Image(); } @@ -1379,7 +1381,7 @@ Viewport::ShadowAtlasQuadrantSubdiv Viewport::get_shadow_atlas_quadrant_subdiv(i void Viewport::clear() { //clear=true; -// VisualServer::get_singleton()->viewport_clear(viewport); + //VisualServer::get_singleton()->viewport_clear(viewport); } @@ -1399,9 +1401,11 @@ Transform2D Viewport::_get_input_pre_xform() const { Vector2 Viewport::_get_window_offset() const { -// if (parent_control) { -// return (parent_control->get_viewport()->get_final_transform() * parent_control->get_global_transform_with_canvas()).get_origin(); -// } + /* + if (parent_control) { + return (parent_control->get_viewport()->get_final_transform() * parent_control->get_global_transform_with_canvas()).get_origin(); + } + */ return Vector2(); } @@ -1521,8 +1525,10 @@ void Viewport::_vp_unhandled_input(const InputEvent& p_ev) { } #endif -// if (parent_control && !parent_control->is_visible()) -// return; + /* + if (parent_control && !parent_control->is_visible_in_tree()) + return; + */ if (to_screen_rect==Rect2()) return; //if render target, can't get input events @@ -1647,7 +1653,7 @@ void Viewport::_gui_show_tooltip() { void Viewport::_gui_call_input(Control *p_control,const InputEvent& p_input) { -// _block(); + //_block(); InputEvent ev = p_input; @@ -1696,7 +1702,7 @@ Control* Viewport::_gui_find_control(const Point2& p_global) { for (List<Control*>::Element *E=gui.subwindows.back();E;E=E->prev()) { Control *sw = E->get(); - if (!sw->is_visible()) + if (!sw->is_visible_in_tree()) continue; Transform2D xform; @@ -1716,7 +1722,7 @@ Control* Viewport::_gui_find_control(const Point2& p_global) { for (List<Control*>::Element *E=gui.roots.back();E;E=E->prev()) { Control *sw = E->get(); - if (!sw->is_visible()) + if (!sw->is_visible_in_tree()) continue; Transform2D xform; @@ -1745,12 +1751,12 @@ Control* Viewport::_gui_find_control_at_pos(CanvasItem* p_node,const Point2& p_g Control *c=p_node->cast_to<Control>(); if (c) { - // print_line("at "+String(c->get_path())+" POS "+c->get_pos()+" bt "+p_xform); + //print_line("at "+String(c->get_path())+" POS "+c->get_pos()+" bt "+p_xform); } //subwindows first!! - if (p_node->is_hidden()) { + if (!p_node->is_visible()) { //return _find_next_visible_control_at_pos(p_node,p_global,r_inv_xform); return NULL; //canvas item hidden, discard } @@ -1798,9 +1804,11 @@ void Viewport::_gui_input_event(InputEvent p_event) { return; } //? -// if (!is_visible()) { -// return; //simple and plain -// } + /* + if (!is_visible()) { + return; //simple and plain + } + */ switch(p_event.type) { @@ -1830,7 +1838,7 @@ void Viewport::_gui_input_event(InputEvent p_event) { Vector2 pos = top->get_global_transform_with_canvas().affine_inverse().xform(mpos); if (!top->has_point(pos)) { - if (top->data.modal_exclusive || top->data.modal_frame==OS::get_singleton()->get_frames_drawn()) { + if (top->data.modal_exclusive || top->data.modal_frame==Engine::get_singleton()->get_frames_drawn()) { //cancel event, sorry, modal exclusive EATS UP ALL //alternative, you can't pop out a window the same frame it was made modal (fixes many issues) get_tree()->set_input_as_handled(); @@ -1849,10 +1857,10 @@ void Viewport::_gui_input_event(InputEvent p_event) { //Matrix32 parent_xform; - //if (data.parent_canvas_item) - // parent_xform=data.parent_canvas_item->get_global_transform(); - - + /* + if (data.parent_canvas_item) + parent_xform=data.parent_canvas_item->get_global_transform(); + */ gui.mouse_focus = _gui_find_control(pos); //print_line("has mf "+itos(gui.mouse_focus!=NULL)); @@ -1903,7 +1911,7 @@ void Viewport::_gui_input_event(InputEvent p_event) { _gui_call_input(gui.mouse_focus,p_event); } - get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); get_tree()->set_input_as_handled(); @@ -1980,7 +1988,7 @@ void Viewport::_gui_input_event(InputEvent p_event) { }*/ - get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); get_tree()->set_input_as_handled(); } @@ -2150,7 +2158,7 @@ void Viewport::_gui_input_event(InputEvent p_event) { case InputEvent::KEY: { - if (gui.key_focus && !gui.key_focus->is_visible()) { + if (gui.key_focus && !gui.key_focus->is_visible_in_tree()) { gui.key_focus->release_focus(); } @@ -2282,7 +2290,7 @@ void Viewport::_gui_remove_from_modal_stack(List<Control*>::Element *MI,ObjectID if (!pfoc) return; - if (!pfoc->is_inside_tree() || !pfoc->is_visible()) + if (!pfoc->is_inside_tree() || !pfoc->is_visible_in_tree()) return; pfoc->grab_focus(); } else { @@ -2419,7 +2427,7 @@ void Viewport::_gui_control_grab_focus(Control* p_control) { if (gui.key_focus && gui.key_focus==p_control) return; - get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"_viewports","_gui_remove_focus"); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME,"_viewports","_gui_remove_focus"); gui.key_focus=p_control; p_control->notification(Control::NOTIFICATION_FOCUS_ENTER); p_control->update(); @@ -2746,7 +2754,7 @@ void Viewport::_bind_methods() { ClassDB::bind_method(_MD("set_physics_object_picking","enable"), &Viewport::set_physics_object_picking); ClassDB::bind_method(_MD("get_physics_object_picking"), &Viewport::get_physics_object_picking); - ClassDB::bind_method(_MD("get_viewport"), &Viewport::get_viewport); + ClassDB::bind_method(_MD("get_viewport_rid"), &Viewport::get_viewport_rid); ClassDB::bind_method(_MD("input","local_event"), &Viewport::input); ClassDB::bind_method(_MD("unhandled_input","local_event"), &Viewport::unhandled_input); @@ -2788,7 +2796,7 @@ void Viewport::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::RECT2,"size"), _SCS("set_size"), _SCS("get_size") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"own_world"), _SCS("set_use_own_world"), _SCS("is_using_own_world") ); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world",PROPERTY_HINT_RESOURCE_TYPE,"World"), _SCS("set_world"), _SCS("get_world") ); -// ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world_2d",PROPERTY_HINT_RESOURCE_TYPE,"World2D"), _SCS("set_world_2d"), _SCS("get_world_2d") ); + //ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world_2d",PROPERTY_HINT_RESOURCE_TYPE,"World2D"), _SCS("set_world_2d"), _SCS("get_world_2d") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"transparent_bg"), _SCS("set_transparent_background"), _SCS("has_transparent_background") ); ADD_GROUP("Rendering",""); ADD_PROPERTY( PropertyInfo(Variant::INT,"msaa",PROPERTY_HINT_ENUM,"Disabled,2x,4x,8x,16x"), _SCS("set_msaa"), _SCS("get_msaa") ); diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 1f30044cef..2831d177c9 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -340,7 +340,7 @@ public: Size2 get_size() const; Rect2 get_visible_rect() const; - RID get_viewport() const; + RID get_viewport_rid() const; void set_world(const Ref<World>& p_world); void set_world_2d(const Ref<World2D>& p_world_2d); diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 2b7c95306f..f68e5ca959 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -54,9 +54,9 @@ #include "scene/gui/spin_box.h" #include "scene/gui/option_button.h" #include "scene/gui/color_picker.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/color_rect.h" -#include "scene/gui/patch_9_frame.h" +#include "scene/gui/patch_9_rect.h" #include "scene/gui/menu_button.h" #include "scene/gui/check_box.h" #include "scene/gui/check_button.h" @@ -81,7 +81,7 @@ #include "scene/gui/grid_container.h" #include "scene/gui/split_container.h" #include "scene/gui/video_player.h" -#include "scene/gui/reference_frame.h" +#include "scene/gui/reference_rect.h" #include "scene/gui/graph_node.h" #include "scene/gui/graph_edit.h" #include "scene/gui/tool_button.h" @@ -319,7 +319,7 @@ void register_scene_types() { ClassDB::register_class<ShortCut>(); ClassDB::register_class<Control>(); -// ClassDB::register_type<EmptyControl>(); + //ClassDB::register_type<EmptyControl>(); ClassDB::register_class<Button>(); ClassDB::register_class<Label>(); ClassDB::register_class<HScrollBar>(); @@ -339,9 +339,9 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init - ClassDB::register_class<TextureFrame>(); - ClassDB::register_class<ColorFrame>(); - ClassDB::register_class<Patch9Frame>(); + ClassDB::register_class<TextureRect>(); + ClassDB::register_class<ColorRect>(); + ClassDB::register_class<NinePatchRect>(); ClassDB::register_class<TabContainer>(); ClassDB::register_class<Tabs>(); ClassDB::register_virtual_class<Separator>(); @@ -383,7 +383,7 @@ void register_scene_types() { ClassDB::register_virtual_class<TreeItem>(); ClassDB::register_class<OptionButton>(); ClassDB::register_class<SpinBox>(); - ClassDB::register_class<ReferenceFrame>(); + ClassDB::register_class<ReferenceRect>(); ClassDB::register_class<ColorPicker>(); ClassDB::register_class<ColorPickerButton>(); ClassDB::register_class<RichTextLabel>(); @@ -494,7 +494,7 @@ void register_scene_types() { ClassDB::register_class<Particles2D>(); ClassDB::register_class<ParticleAttractor2D>(); ClassDB::register_class<Sprite>(); -// ClassDB::register_type<ViewportSprite>(); + //ClassDB::register_type<ViewportSprite>(); ClassDB::register_class<SpriteFrames>(); ClassDB::register_class<AnimatedSprite>(); ClassDB::register_class<Position2D>(); @@ -537,9 +537,9 @@ void register_scene_types() { /* REGISTER RESOURCES */ ClassDB::register_virtual_class<Shader>(); -// ClassDB::register_virtual_type<ShaderGraph>(); + //ClassDB::register_virtual_type<ShaderGraph>(); ClassDB::register_class<CanvasItemShader>(); -// ClassDB::register_type<CanvasItemShaderGraph>(); + //ClassDB::register_type<CanvasItemShaderGraph>(); #ifndef _3D_DISABLED ClassDB::register_class<Mesh>(); @@ -547,9 +547,9 @@ void register_scene_types() { ClassDB::register_class<FixedSpatialMaterial>(); SceneTree::add_idle_callback(FixedSpatialMaterial::flush_changes); FixedSpatialMaterial::init_shaders(); -// ClassDB::register_type<ShaderMaterial>(); + //ClassDB::register_type<ShaderMaterial>(); ClassDB::register_class<RoomBounds>(); -// ClassDB::register_type<MaterialShaderGraph>(); + //ClassDB::register_type<MaterialShaderGraph>(); ClassDB::register_class<SpatialShader>(); ClassDB::register_class<ParticlesShader>(); ClassDB::register_class<MultiMesh>(); @@ -605,7 +605,7 @@ void register_scene_types() { ClassDB::register_virtual_class<AudioStream>(); ClassDB::register_virtual_class<AudioStreamPlayback>(); //TODO: Adapt to the new AudioStream API or drop (GH-3307) -// ClassDB::register_type<AudioStreamGibberish>(); + //ClassDB::register_type<AudioStreamGibberish>(); ClassDB::register_virtual_class<VideoStream>(); OS::get_singleton()->yield(); //may take time to init diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 1fbb149bf3..5b9baa6a67 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -2005,11 +2005,6 @@ void Animation::_transform_track_optimize(int p_idx,float p_alowed_linear_err,fl prev_erased=false; norm=Vector3(); } - - - - // print_line(itos(i)+" could be eliminated: "+rtos(tr)); - //} } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 3c6e65bf41..50c6a6c725 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -125,7 +125,7 @@ static Ref<Texture> make_icon(T p_src) { static Ref<Shader> make_shader(const char*vertex_code,const char*fragment_code,const char*lighting_code) { Ref<Shader> shader = (memnew( Shader(Shader::MODE_CANVAS_ITEM) )); -// shader->set_code(vertex_code, fragment_code, lighting_code); + //shader->set_code(vertex_code, fragment_code, lighting_code); return shader; } @@ -934,12 +934,12 @@ void fill_default_theme(Ref<Theme>& t, const Ref<Font> & default_font, const Ref t->set_stylebox("focus","VButtonArray", focus ); - // ReferenceFrame + // ReferenceRect Ref<StyleBoxTexture> ttnc = make_stylebox( full_panel_bg_png,8,8,8,8); ttnc->set_draw_center(false); - t->set_stylebox("border","ReferenceFrame", make_stylebox( reference_border_png,4,4,4,4) ); + t->set_stylebox("border","ReferenceRect", make_stylebox( reference_border_png,4,4,4,4) ); t->set_stylebox("panelnc","Panel", ttnc ); t->set_stylebox("panelf","Panel", tc_sb ); diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 3aadbdbe19..63a7829d26 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -511,7 +511,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { break; } -// print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" X: "+itos(tex_x)+" Y: "+itos(tex_y)); + //print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" X: "+itos(tex_x)+" Y: "+itos(tex_y)); if (tex_index==-1) { //could not find texture to fit, create one @@ -961,7 +961,7 @@ bool ResourceFormatLoaderDynamicFont::handles_type(const String& p_type) const { String ResourceFormatLoaderDynamicFont::get_resource_type(const String &p_path) const { - String el = p_path.extension().to_lower(); + String el = p_path.get_extension().to_lower(); if (el=="ttf" || el=="otf") return "DynamicFontData"; return ""; diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp index a25667d85a..cbbca49f0f 100644 --- a/scene/resources/dynamic_font_stb.cpp +++ b/scene/resources/dynamic_font_stb.cpp @@ -260,7 +260,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { break; } -// print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" X: "+itos(tex_x)+" Y: "+itos(tex_y)); + //print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" X: "+itos(tex_x)+" Y: "+itos(tex_y)); if (tex_index==-1) { //could not find texture to fit, create one diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 3373478336..b1d0611f48 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -252,8 +252,10 @@ Error BitmapFont::create_from_fnt(const String& p_string) { if (keys.has("face")) set_name(keys["face"]); - //if (keys.has("size")) - // font->set_height(keys["size"].to_int()); + /* + if (keys.has("size")) + font->set_height(keys["size"].to_int()); + */ } else if (type=="common") { diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 74f4e8f5f7..99911eddeb 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -77,19 +77,19 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { String sname=p_name; - if (p_name=="morph_target/names") { + if (p_name=="blend_shape/names") { PoolVector<String> sk=p_value; int sz = sk.size(); PoolVector<String>::Read r = sk.read(); for(int i=0;i<sz;i++) - add_morph_target(r[i]); + add_blend_shape(r[i]); return true; } - if (p_name=="morph_target/mode") { + if (p_name=="blend_shape/mode") { - set_morph_target_mode(MorphTargetMode(int(p_value))); + set_blend_shape_mode(BlendShapeMode(int(p_value))); return true; } @@ -128,8 +128,8 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { if (d.has("arrays")) { //old format - ERR_FAIL_COND_V(!d.has("morph_arrays"),false); - add_surface_from_arrays(PrimitiveType(int(d["primitive"])),d["arrays"],d["morph_arrays"]); + ERR_FAIL_COND_V(!d.has("blend_shape_arrays"),false); + add_surface_from_arrays(PrimitiveType(int(d["primitive"])),d["arrays"],d["blend_shape_arrays"]); } else if (d.has("array_data")) { @@ -151,13 +151,13 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { if (d.has("index_count")) index_count=d["index_count"]; - Vector< PoolVector<uint8_t> > morphs; + Vector< PoolVector<uint8_t> > blend_shapes; - if (d.has("morph_data")) { - Array morph_data=d["morph_data"]; - for(int i=0;i<morph_data.size();i++) { - PoolVector<uint8_t> morph = morph_data[i]; - morphs.push_back(morph_data[i]); + if (d.has("blend_shape_data")) { + Array blend_shape_data=d["blend_shape_data"]; + for(int i=0;i<blend_shape_data.size();i++) { + PoolVector<uint8_t> shape = blend_shape_data[i]; + blend_shapes.push_back(shape); } } @@ -174,7 +174,7 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { } } - add_surface(format,PrimitiveType(primitive),array_data,vertex_count,array_index_data,index_count,aabb,morphs,bone_aabb); + add_surface(format,PrimitiveType(primitive),array_data,vertex_count,array_index_data,index_count,aabb,blend_shapes,bone_aabb); } else { ERR_FAIL_V(false); } @@ -199,16 +199,16 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { String sname=p_name; - if (p_name=="morph_target/names") { + if (p_name=="blend_shape/names") { PoolVector<String> sk; - for(int i=0;i<morph_targets.size();i++) - sk.push_back(morph_targets[i]); + for(int i=0;i<blend_shapes.size();i++) + sk.push_back(blend_shapes[i]); r_ret=sk; return true; - } else if (p_name=="morph_target/mode") { + } else if (p_name=="blend_shape/mode") { - r_ret = get_morph_target_mode(); + r_ret = get_blend_shape_mode(); return true; } else if (sname.begins_with("surface_")) { @@ -251,14 +251,14 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { } d["skeleton_aabb"]=arr; - Vector< PoolVector<uint8_t> > morph_data = VS::get_singleton()->mesh_surface_get_blend_shapes(mesh,idx); + Vector< PoolVector<uint8_t> > blend_shape_data = VS::get_singleton()->mesh_surface_get_blend_shapes(mesh,idx); Array md; - for(int i=0;i<morph_data.size();i++) { - md.push_back(morph_data[i]); + for(int i=0;i<blend_shape_data.size();i++) { + md.push_back(blend_shape_data[i]); } - d["morph_data"]=md; + d["blend_shape_data"]=md; Ref<Material> m = surface_get_material(idx); if (m.is_valid()) @@ -274,9 +274,9 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { void Mesh::_get_property_list( List<PropertyInfo> *p_list) const { - if (morph_targets.size()) { - p_list->push_back(PropertyInfo(Variant::POOL_STRING_ARRAY,"morph_target/names",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::INT,"morph_target/mode",PROPERTY_HINT_ENUM,"Normalized,Relative")); + if (blend_shapes.size()) { + p_list->push_back(PropertyInfo(Variant::POOL_STRING_ARRAY,"blend_shape/names",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::INT,"blend_shape/mode",PROPERTY_HINT_ENUM,"Normalized,Relative")); } for (int i=0;i<surfaces.size();i++) { @@ -364,7 +364,7 @@ Array Mesh::surface_get_arrays(int p_surface) const { return VisualServer::get_singleton()->mesh_surface_get_arrays(mesh,p_surface); } -Array Mesh::surface_get_morph_arrays(int p_surface) const { +Array Mesh::surface_get_blend_shape_arrays(int p_surface) const { ERR_FAIL_INDEX_V(p_surface,surfaces.size(),Array()); return Array(); @@ -379,7 +379,7 @@ int Mesh::get_surface_count() const { return surfaces.size(); } -void Mesh::add_morph_target(const StringName& p_name) { +void Mesh::add_blend_shape(const StringName& p_name) { if (surfaces.size()) { ERR_EXPLAIN("Can't add a shape key count if surfaces are already created."); @@ -388,49 +388,49 @@ void Mesh::add_morph_target(const StringName& p_name) { StringName name=p_name; - if (morph_targets.find(name)!=-1 ) { + if (blend_shapes.find(name)!=-1 ) { int count=2; do { name = String(p_name) + " " + itos(count); count++; - } while(morph_targets.find(name)!=-1); + } while(blend_shapes.find(name)!=-1); } - morph_targets.push_back(name); - VS::get_singleton()->mesh_set_morph_target_count(mesh,morph_targets.size()); + blend_shapes.push_back(name); + VS::get_singleton()->mesh_set_blend_shape_count(mesh,blend_shapes.size()); } -int Mesh::get_morph_target_count() const { +int Mesh::get_blend_shape_count() const { - return morph_targets.size(); + return blend_shapes.size(); } -StringName Mesh::get_morph_target_name(int p_index) const { - ERR_FAIL_INDEX_V( p_index, morph_targets.size(),StringName() ); - return morph_targets[p_index]; +StringName Mesh::get_blend_shape_name(int p_index) const { + ERR_FAIL_INDEX_V( p_index, blend_shapes.size(),StringName() ); + return blend_shapes[p_index]; } -void Mesh::clear_morph_targets() { +void Mesh::clear_blend_shapes() { if (surfaces.size()) { ERR_EXPLAIN("Can't set shape key count if surfaces are already created."); ERR_FAIL_COND(surfaces.size()); } - morph_targets.clear(); + blend_shapes.clear(); } -void Mesh::set_morph_target_mode(MorphTargetMode p_mode) { +void Mesh::set_blend_shape_mode(BlendShapeMode p_mode) { - morph_target_mode=p_mode; - VS::get_singleton()->mesh_set_morph_target_mode(mesh,(VS::MorphTargetMode)p_mode); + blend_shape_mode=p_mode; + VS::get_singleton()->mesh_set_blend_shape_mode(mesh,(VS::BlendShapeMode)p_mode); } -Mesh::MorphTargetMode Mesh::get_morph_target_mode() const { +Mesh::BlendShapeMode Mesh::get_blend_shape_mode() const { - return morph_target_mode; + return blend_shape_mode; } @@ -1019,12 +1019,12 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { void Mesh::_bind_methods() { - ClassDB::bind_method(_MD("add_morph_target","name"),&Mesh::add_morph_target); - ClassDB::bind_method(_MD("get_morph_target_count"),&Mesh::get_morph_target_count); - ClassDB::bind_method(_MD("get_morph_target_name","index"),&Mesh::get_morph_target_name); - ClassDB::bind_method(_MD("clear_morph_targets"),&Mesh::clear_morph_targets); - ClassDB::bind_method(_MD("set_morph_target_mode","mode"),&Mesh::set_morph_target_mode); - ClassDB::bind_method(_MD("get_morph_target_mode"),&Mesh::get_morph_target_mode); + ClassDB::bind_method(_MD("add_blend_shape","name"),&Mesh::add_blend_shape); + ClassDB::bind_method(_MD("get_blend_shape_count"),&Mesh::get_blend_shape_count); + ClassDB::bind_method(_MD("get_blend_shape_name","index"),&Mesh::get_blend_shape_name); + ClassDB::bind_method(_MD("clear_blend_shapes"),&Mesh::clear_blend_shapes); + ClassDB::bind_method(_MD("set_blend_shape_mode","mode"),&Mesh::set_blend_shape_mode); + ClassDB::bind_method(_MD("get_blend_shape_mode"),&Mesh::get_blend_shape_mode); ClassDB::bind_method(_MD("add_surface_from_arrays","primitive","arrays","blend_shapes","compress_flags"),&Mesh::add_surface_from_arrays,DEFVAL(Array()),DEFVAL(ARRAY_COMPRESS_DEFAULT)); ClassDB::bind_method(_MD("get_surface_count"),&Mesh::get_surface_count); @@ -1084,7 +1084,7 @@ void Mesh::_bind_methods() { Mesh::Mesh() { mesh=VisualServer::get_singleton()->mesh_create(); - morph_target_mode=MORPH_MODE_RELATIVE; + blend_shape_mode=BLEND_SHAPE_MODE_RELATIVE; } diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index 8e0b4d4e25..1af33ad836 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -105,10 +105,10 @@ public: PRIMITIVE_TRIANGLE_FAN=VisualServer::PRIMITIVE_TRIANGLE_FAN, }; - enum MorphTargetMode { + enum BlendShapeMode { - MORPH_MODE_NORMALIZED=VS::MORPH_MODE_NORMALIZED, - MORPH_MODE_RELATIVE=VS::MORPH_MODE_RELATIVE, + BLEND_SHAPE_MODE_NORMALIZED=VS::BLEND_SHAPE_MODE_NORMALIZED, + BLEND_SHAPE_MODE_RELATIVE=VS::BLEND_SHAPE_MODE_RELATIVE, }; private: @@ -120,8 +120,8 @@ private: Vector<Surface> surfaces; RID mesh; Rect3 aabb; - MorphTargetMode morph_target_mode; - Vector<StringName> morph_targets; + BlendShapeMode blend_shape_mode; + Vector<StringName> blend_shapes; Rect3 custom_aabb; mutable Ref<TriangleMesh> triangle_mesh; @@ -142,15 +142,15 @@ public: void add_surface(uint32_t p_format,PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<Rect3>& p_bone_aabbs=Vector<Rect3>()); Array surface_get_arrays(int p_surface) const; - virtual Array surface_get_morph_arrays(int p_surface) const; + virtual Array surface_get_blend_shape_arrays(int p_surface) const; - void add_morph_target(const StringName& p_name); - int get_morph_target_count() const; - StringName get_morph_target_name(int p_index) const; - void clear_morph_targets(); + void add_blend_shape(const StringName& p_name); + int get_blend_shape_count() const; + StringName get_blend_shape_name(int p_index) const; + void clear_blend_shapes(); - void set_morph_target_mode(MorphTargetMode p_mode); - MorphTargetMode get_morph_target_mode() const; + void set_blend_shape_mode(BlendShapeMode p_mode); + BlendShapeMode get_blend_shape_mode() const; int get_surface_count() const; void surface_remove(int p_idx); @@ -196,6 +196,6 @@ public: VARIANT_ENUM_CAST( Mesh::ArrayType ); VARIANT_ENUM_CAST( Mesh::PrimitiveType ); -VARIANT_ENUM_CAST( Mesh::MorphTargetMode ); +VARIANT_ENUM_CAST( Mesh::BlendShapeMode ); #endif diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 625cc6a596..5cefca348b 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -529,9 +529,11 @@ Error SceneState::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<S bool isdefault = ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO) && value.is_zero()) || ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONONE) && value.is_one()); -// if (nd.instance<0 && ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO) && value.is_zero()) || ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONONE) && value.is_one())) { -// continue; -// } + /* + if (nd.instance<0 && ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO) && value.is_zero()) || ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONONE) && value.is_one())) { + continue; + } + */ @@ -614,8 +616,10 @@ Error SceneState::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<S if (!gi.persistent) continue; -// if (instance_state_node>=0 && instance_state->is_node_in_group(instance_state_node,gi.name)) -// continue; //group was instanced, don't add here + /* + if (instance_state_node>=0 && instance_state->is_node_in_group(instance_state_node,gi.name)) + continue; //group was instanced, don't add here + */ bool skip=false; for (List<PackState>::Element *F=pack_state_stack.front();F;F=F->next()) { @@ -1166,7 +1170,7 @@ void SceneState::set_bundled_scene(const Dictionary& d) { ERR_FAIL_COND( !d.has("nodes")); ERR_FAIL_COND( !d.has("conn_count")); ERR_FAIL_COND( !d.has("conns")); -// ERR_FAIL_COND( !d.has("path")); + //ERR_FAIL_COND( !d.has("path")); int version=1; if (d.has("version")) @@ -1277,7 +1281,7 @@ void SceneState::set_bundled_scene(const Dictionary& d) { editable_instances[i]=ei[i]; } -// path=d["path"]; + //path=d["path"]; } @@ -1362,7 +1366,7 @@ Dictionary SceneState::get_bundled_scene() const { d["version"]=PACK_VERSION; -// d["path"]=path; + //d["path"]=path; return d; diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index fa56f63465..a913687e7f 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -397,7 +397,7 @@ Error ResourceInteractiveLoaderText::poll() { int type=-1; int name=-1; int instance=-1; -// int base_scene=-1; + //int base_scene=-1; if (next_tag.fields.has("name")) { name=packed_scene->get_state()->add_name(next_tag.fields["name"]); @@ -950,7 +950,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderText::load_interactive(const Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); ria->open(f); return ria; @@ -984,7 +984,7 @@ String ResourceFormatLoaderText::get_resource_type(const String &p_path) const{ - String ext=p_path.extension().to_lower(); + String ext=p_path.get_extension().to_lower(); if (ext=="tscn") return "PackedScene"; else if (ext!="tres") @@ -1001,7 +1001,7 @@ String ResourceFormatLoaderText::get_resource_type(const String &p_path) const{ Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); String r = ria->recognize(f); return r; } @@ -1018,7 +1018,7 @@ void ResourceFormatLoaderText::get_dependencies(const String& p_path,List<String Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); ria->get_dependencies(f,p_dependencies,p_add_types); @@ -1035,7 +1035,7 @@ Error ResourceFormatLoaderText::rename_dependencies(const String &p_path,const M Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); return ria->rename_dependencies(f,p_path,p_map); } @@ -1208,10 +1208,12 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re if (packed_scene.is_null()) title+="type=\""+p_resource->get_class()+"\" "; int load_steps=saved_resources.size()+external_resources.size(); - //if (packed_scene.is_valid()) { - // load_steps+=packed_scene->get_node_count(); - //} + /* + if (packed_scene.is_valid()) { + load_steps+=packed_scene->get_node_count(); + } //no, better to not use load steps from nodes, no point to that + */ if (load_steps>1) { title+="load_steps="+itos(load_steps)+" "; @@ -1299,7 +1301,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re List<PropertyInfo> property_list; res->get_property_list(&property_list); -// property_list.sort(); + //property_list.sort(); for(List<PropertyInfo>::Element *PE = property_list.front();PE;PE=PE->next()) { diff --git a/scene/resources/scene_format_text.h b/scene/resources/scene_format_text.h index 58660fa639..ce18f6a702 100644 --- a/scene/resources/scene_format_text.h +++ b/scene/resources/scene_format_text.h @@ -58,7 +58,7 @@ class ResourceInteractiveLoaderText : public ResourceInteractiveLoader { bool ignore_resource_parsing; -// Map<String,String> remaps; + //Map<String,String> remaps; Map<int,ExtResource> ext_resources; diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 37b019e369..10f852f17c 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -192,7 +192,7 @@ void ShaderGraph::_bind_methods() { ClassDB::bind_method(_MD("xform_const_node_get_value","shader_type","id"),&ShaderGraph::xform_const_node_get_value); -// void get_node_list(ShaderType p_which,List<int> *p_node_list) const; + //void get_node_list(ShaderType p_which,List<int> *p_node_list) const; ClassDB::bind_method(_MD("texture_node_set_filter_size","shader_type","id","filter_size"),&ShaderGraph::texture_node_set_filter_size); ClassDB::bind_method(_MD("texture_node_get_filter_size","shader_type","id"),&ShaderGraph::texture_node_get_filter_size); diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 066062f302..e5e32ba4e9 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -75,8 +75,8 @@ void StyleBox::_bind_methods() { ClassDB::bind_method(_MD("set_default_margin","margin","offset"),&StyleBox::set_default_margin); ClassDB::bind_method(_MD("get_default_margin","margin"),&StyleBox::get_default_margin); -// ClassDB::bind_method(_MD("set_default_margin"),&StyleBox::set_default_margin); -// ClassDB::bind_method(_MD("get_default_margin"),&StyleBox::get_default_margin); + //ClassDB::bind_method(_MD("set_default_margin"),&StyleBox::set_default_margin); + //ClassDB::bind_method(_MD("get_default_margin"),&StyleBox::get_default_margin); ClassDB::bind_method(_MD("get_margin","margin"),&StyleBox::get_margin); ClassDB::bind_method(_MD("get_minimum_size"),&StyleBox::get_minimum_size); diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index cc13c0ff11..27cc7e131b 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -650,9 +650,11 @@ void SurfaceTool::append_from(const Ref<Mesh>& p_existing, int p_surface,const T for(List<int>::Element *E=nindices.front();E;E=E->next()) { int dst_index = E->get()+vfrom; - //if (dst_index <0 || dst_index>=vertex_array.size()) { - // print_line("invalid index!"); - //} + /* + if (dst_index <0 || dst_index>=vertex_array.size()) { + print_line("invalid index!"); + } + */ index_array.push_back(dst_index); } if (index_array.size()%3) diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 462341a751..a1ad5d8237 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -66,7 +66,6 @@ void Texture::_bind_methods() { ClassDB::bind_method(_MD("get_width"),&Texture::get_width); ClassDB::bind_method(_MD("get_height"),&Texture::get_height); ClassDB::bind_method(_MD("get_size"),&Texture::get_size); - ClassDB::bind_method(_MD("get_rid"),&Texture::get_rid); ClassDB::bind_method(_MD("has_alpha"),&Texture::has_alpha); ClassDB::bind_method(_MD("set_flags","flags"),&Texture::set_flags); ClassDB::bind_method(_MD("get_flags"),&Texture::get_flags); @@ -1050,7 +1049,7 @@ void CubeMap::_bind_methods() { ClassDB::bind_method(_MD("get_width"),&CubeMap::get_width); ClassDB::bind_method(_MD("get_height"),&CubeMap::get_height); - ClassDB::bind_method(_MD("get_rid"),&CubeMap::get_rid); + //ClassDB::bind_method(_MD("get_rid"),&CubeMap::get_rid); ClassDB::bind_method(_MD("set_flags","flags"),&CubeMap::set_flags); ClassDB::bind_method(_MD("get_flags"),&CubeMap::get_flags); diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 2e3afbf057..d950407f54 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -267,7 +267,7 @@ void Theme::set_default_font( const Ref<Font>& p_font ) { void Theme::set_icon(const StringName& p_name,const StringName& p_type,const Ref<Texture>& p_icon) { -// ERR_FAIL_COND(p_icon.is_null()); + //ERR_FAIL_COND(p_icon.is_null()); bool new_value=!icon_map.has(p_type) || !icon_map[p_type].has(p_name); @@ -367,7 +367,7 @@ void Theme::get_shader_list(const StringName &p_type, List<StringName> *p_list) void Theme::set_stylebox(const StringName& p_name,const StringName& p_type,const Ref<StyleBox>& p_style) { -// ERR_FAIL_COND(p_style.is_null()); + //ERR_FAIL_COND(p_style.is_null()); bool new_value=!style_map.has(p_type) || !style_map[p_type].has(p_name); @@ -430,7 +430,7 @@ void Theme::get_stylebox_types(List<StringName> *p_list) const { void Theme::set_font(const StringName& p_name,const StringName& p_type,const Ref<Font>& p_font) { -// ERR_FAIL_COND(p_font.is_null()); + //ERR_FAIL_COND(p_font.is_null()); bool new_value=!font_map.has(p_type) || !font_map[p_type].has(p_name); @@ -999,7 +999,7 @@ RES ResourceFormatLoaderTheme::load(const String &p_path, const String& p_origin ERR_FAIL_V(RES()); } -// int margin = params[i+ccodes+1].to_int(); + //int margin = params[i+ccodes+1].to_int(); //sbflat->set_margin_size(Margin(i),margin); } } else if (params.size()!=ccodes+1) { @@ -1147,7 +1147,7 @@ bool ResourceFormatLoaderTheme::handles_type(const String& p_type) const { String ResourceFormatLoaderTheme::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="theme") + if (p_path.get_extension().to_lower()=="theme") return "Theme"; return ""; } diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 1811dee384..c97682f504 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -48,6 +48,8 @@ bool TileSet::_set(const StringName& p_name, const Variant& p_value) { tile_set_texture_offset(id,p_value); else if (what=="material") tile_set_material(id,p_value); + else if (what=="modulate") + tile_set_modulate(id,p_value); else if (what=="shape_offset") tile_set_shape_offset(id,p_value); else if (what=="region") @@ -91,6 +93,8 @@ bool TileSet::_get(const StringName& p_name,Variant &r_ret) const{ r_ret=tile_get_texture_offset(id); else if (what=="material") r_ret=tile_get_material(id); + else if (what=="modulate") + r_ret=tile_get_modulate(id); else if (what=="shape_offset") r_ret=tile_get_shape_offset(id); else if (what=="region") @@ -124,6 +128,7 @@ void TileSet::_get_property_list( List<PropertyInfo> *p_list) const{ p_list->push_back(PropertyInfo(Variant::OBJECT,pre+"texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture")); p_list->push_back(PropertyInfo(Variant::VECTOR2,pre+"tex_offset")); p_list->push_back(PropertyInfo(Variant::OBJECT,pre+"material",PROPERTY_HINT_RESOURCE_TYPE,"CanvasItemMaterial")); + p_list->push_back(PropertyInfo(Variant::COLOR,pre+"modulate")); p_list->push_back(PropertyInfo(Variant::RECT2,pre+"region")); p_list->push_back(PropertyInfo(Variant::VECTOR2,pre+"occluder_offset")); p_list->push_back(PropertyInfo(Variant::OBJECT,pre+"occluder",PROPERTY_HINT_RESOURCE_TYPE,"OccluderPolygon2D")); @@ -175,6 +180,20 @@ Ref<CanvasItemMaterial> TileSet::tile_get_material(int p_id) const{ } +void TileSet::tile_set_modulate(int p_id,const Color &p_modulate) { + + ERR_FAIL_COND(!tile_map.has(p_id)); + tile_map[p_id].modulate=p_modulate; + emit_changed(); + +} + +Color TileSet::tile_get_modulate(int p_id) const{ + + ERR_FAIL_COND_V(!tile_map.has(p_id),Color(1,1,1)); + return tile_map[p_id].modulate; +} + void TileSet::tile_set_texture_offset(int p_id,const Vector2 &p_offset) { ERR_FAIL_COND(!tile_map.has(p_id)); diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index ce40e5ebe3..b80889fc6f 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -52,6 +52,10 @@ class TileSet : public Resource { Vector2 navigation_polygon_offset; Ref<NavigationPolygon> navigation_polygon; Ref<CanvasItemMaterial> material; + Color modulate; + + // Default modulate for back-compat + explicit Data() : modulate(1,1,1) {} }; Map<int,Data> tile_map; @@ -94,6 +98,9 @@ public: void tile_set_material(int p_id,const Ref<CanvasItemMaterial> &p_material); Ref<CanvasItemMaterial> tile_get_material(int p_id) const; + void tile_set_modulate(int p_id,const Color &p_color); + Color tile_get_modulate(int p_id) const; + void tile_set_occluder_offset(int p_id,const Vector2& p_offset); Vector2 tile_get_occluder_offset(int p_id) const; diff --git a/servers/audio/audio_mixer_sw.cpp b/servers/audio/audio_mixer_sw.cpp index faed6905ea..0123b66430 100644 --- a/servers/audio/audio_mixer_sw.cpp +++ b/servers/audio/audio_mixer_sw.cpp @@ -271,7 +271,7 @@ void AudioMixerSW::mix_channel(Channel& c) { bool is_stereo=sample_manager->sample_is_stereo(c.sample); int32_t todo=mix_chunk_size; -// int mixed=0; + //int mixed=0; bool use_filter=false; ResamplerState rstate; diff --git a/servers/audio/reverb_sw.cpp b/servers/audio/reverb_sw.cpp index 0050dbedeb..5e02f37679 100644 --- a/servers/audio/reverb_sw.cpp +++ b/servers/audio/reverb_sw.cpp @@ -100,145 +100,145 @@ struct ReverbParamsSW { static ReverbParamsSW reverb_params_Room = { 0x26C0/2, -// gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall + //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall 0x6D80, 0x54B8, -0x4130, 0x0000, 0x0000, -0x4580, -// gReva gRevb gInputL gInputR + //gReva gRevb gInputL gInputR 0x5800, 0x5300, -0x8000, -0x8000, -// nRevaOldL nRevaOldR nRevbOldL nRevbOldR + //nRevaOldL nRevaOldR nRevbOldL nRevbOldR 0x01B4 - 0x007D, 0x0136 - 0x007D, 0x00B8 - 0x005B, 0x005C - 0x005B, -// nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R + //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R 0x04D6, 0x0333, 0x03F0, 0x0227, 0x0374, 0x01EF, -// nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R + //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R 0x0334, 0x01B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -// nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR + //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR 0x0000, 0x0000, 0x01B4, 0x0136, 0x00B8, 0x005C }; static ReverbParamsSW reverb_params_StudioSmall = { 0x1F40/2, -// gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall + //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall 0x70F0, 0x4FA8, -0x4320, 0x4410, -0x3F10, -0x6400, -// gReva gRevb gInputL gInputR + //gReva gRevb gInputL gInputR 0x5280, 0x4EC0, -0x8000, -0x8000, -// nRevaOldL nRevaOldR nRevbOldL nRevbOldR + //nRevaOldL nRevaOldR nRevbOldL nRevbOldR 0x00B4 - 0x0033, 0x0080 - 0x0033, 0x004C - 0x0025, 0x0026 - 0x0025, -// nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R + //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R 0x03E4, 0x031B, 0x03A4, 0x02AF, 0x0372, 0x0266, -// nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R + //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R 0x031C, 0x025D, 0x025C, 0x018E, 0x022F, 0x0135, 0x01D2, 0x00B7, -// nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR + //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR 0x018F, 0x00B5, 0x00B4, 0x0080, 0x004C, 0x0026 }; static ReverbParamsSW reverb_params_StudioMedium = { 0x4840/2, -// gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall + //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall 0x70F0, 0x4FA8, -0x4320, 0x4510, -0x4110, -0x4B40, -// gReva gRevb gInputL gInputR + //gReva gRevb gInputL gInputR 0x5280, 0x4EC0, -0x8000, -0x8000, -// nRevaOldL nRevaOldR nRevbOldL nRevbOldR + //nRevaOldL nRevaOldR nRevbOldL nRevbOldR 0x0264 - 0x00B1, 0x01B2 - 0x00B1, 0x0100 - 0x007F, 0x0080 - 0x007F, -// nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R + //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R 0x0904, 0x076B, 0x0824, 0x065F, 0x07A2, 0x0616, -// nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R + //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R 0x076C, 0x05ED, 0x05EC, 0x042E, 0x050F, 0x0305, 0x0462, 0x02B7, -// nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR + //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR 0x042F, 0x0265, 0x0264, 0x01B2, 0x0100, 0x0080 }; static ReverbParamsSW reverb_params_StudioLarge = { 0x6FE0/2, -// gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall + //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall 0x6F60, 0x4FA8, -0x4320, 0x4510, -0x4110, -0x5980, -// gReva gRevb gInputL gInputR + //gReva gRevb gInputL gInputR 0x5680, 0x52C0, -0x8000, -0x8000, -// nRevaOldL nRevaOldR nRevbOldL nRevbOldR + //nRevaOldL nRevaOldR nRevbOldL nRevbOldR 0x031C - 0x00E3, 0x0238 - 0x00E3, 0x0154 - 0x00A9, 0x00AA - 0x00A9, -// nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R + //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R 0x0DFB, 0x0B58, 0x0D09, 0x0A3C, 0x0BD9, 0x0973, -// nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R + //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R 0x0B59, 0x08DA, 0x08D9, 0x05E9, 0x07EC, 0x04B0, 0x06EF, 0x03D2, -// nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR + //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR 0x05EA, 0x031D, 0x031C, 0x0238, 0x0154, 0x00AA }; static ReverbParamsSW reverb_params_Hall = { 0xADE0/2, -// gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall + //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall 0x6000, 0x5000, 0x4C00, -0x4800, -0x4400, -0x4000, -// gReva gRevb gInputL gInputR + //gReva gRevb gInputL gInputR 0x6000, 0x5C00, -0x8000, -0x8000, -// nRevaOldL nRevaOldR nRevbOldL nRevbOldR + //nRevaOldL nRevaOldR nRevbOldL nRevbOldR 0x05C0 - 0x01A5, 0x041A - 0x01A5, 0x0274 - 0x0139, 0x013A - 0x0139, -// nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R + //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R 0x15BA, 0x11BB, 0x14C2, 0x10BD, 0x11BC, 0x0DC1, -// nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R + //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R 0x11C0, 0x0DC3, 0x0DC0, 0x09C1, 0x0BC4, 0x07C1, 0x0A00, 0x06CD, -// nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR + //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR 0x09C2, 0x05C1, 0x05C0, 0x041A, 0x0274, 0x013A }; static ReverbParamsSW reverb_params_SpaceEcho = { 0xF6C0/2, -// gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall + //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall 0x7E00, 0x5000, -0x4C00, -0x5000, 0x4C00, -0x5000, -// gReva gRevb gInputL gInputR + //gReva gRevb gInputL gInputR 0x6000, 0x5400, -0x8000, -0x8000, -// nRevaOldL nRevaOldR nRevbOldL nRevbOldR + //nRevaOldL nRevaOldR nRevbOldL nRevbOldR 0x0AE0 - 0x033D, 0x07A2 - 0x033D, 0x0464 - 0x0231, 0x0232 - 0x0231, -// nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R + //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R 0x1ED6, 0x1A31, 0x1D14, 0x183B, 0x1BC2, 0x16B2, -// nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R + //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R 0x1A32, 0x15EF, 0x15EE, 0x1055, 0x1334, 0x0F2D, 0x11F6, 0x0C5D, -// nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR + //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR 0x1056, 0x0AE1, 0x0AE0, 0x07A2, 0x0464, 0x0232 }; static ReverbParamsSW reverb_params_Echo = { 0x18040/2, -// gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall + //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall 0x7FFF, 0x7FFF, 0x0000, 0x0000, 0x0000, -0x7F00, -// gReva gRevb gInputL gInputR + //gReva gRevb gInputL gInputR 0x0000, 0x0000, -0x8000, -0x8000, -// nRevaOldL nRevaOldR nRevbOldL nRevbOldR + //nRevaOldL nRevaOldR nRevbOldL nRevbOldR 0x1004 - 0x0001, 0x1002 - 0x0001, 0x0004 - 0x0001, 0x0002 - 0x0001, -// nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R + //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R 0x1FFF, 0x0FFF, 0x1005, 0x0005, 0x0000, 0x0000, -// nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R + //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R 0x1005, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -// nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR + //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR 0x0000, 0x0000, 0x1004, 0x1002, 0x0004, 0x0002 }; static ReverbParamsSW reverb_params_Delay = { 0x18040/2, -// gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall + //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall 0x7FFF, 0x7FFF, 0x0000, 0x0000, 0x0000, 0x0000, -// gReva gRevb gInputL gInputR + //gReva gRevb gInputL gInputR 0x0000, 0x0000, -0x8000, -0x8000, -// nRevaOldL nRevaOldR nRevbOldL nRevbOldR + //nRevaOldL nRevaOldR nRevbOldL nRevbOldR 0x1004 - 0x0001, 0x1002 - 0x0001, 0x0004 - 0x0001, 0x0002 - 0x0001, -// nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R + //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R 0x1FFF, 0x0FFF, 0x1005, 0x0005, 0x0000, 0x0000, -// nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R + //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R 0x1005, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -// nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR + //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR 0x0000, 0x0000, 0x1004, 0x1002, 0x0004, 0x0002 }; static ReverbParamsSW reverb_params_HalfEcho = { 0x3C00/2, -// gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall + //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall 0x70F0, 0x4FA8, -0x4320, 0x4510, -0x4110, -0x7B00, -// gReva gRevb gInputL gInputR + //gReva gRevb gInputL gInputR 0x5F80, 0x54C0, -0x8000, -0x8000, -// nRevaOldL nRevaOldR nRevbOldL nRevbOldR + //nRevaOldL nRevaOldR nRevbOldL nRevbOldR 0x0058 - 0x0017, 0x0040 - 0x0017, 0x0028 - 0x0013, 0x0014 - 0x0013, -// nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R + //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R 0x0371, 0x02AF, 0x02E5, 0x01DF, 0x02B0, 0x01D7, -// nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R + //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R 0x0358, 0x026A, 0x01D6, 0x011E, 0x012D, 0x00B1, 0x011F, 0x0059, -// nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR + //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR 0x01A0, 0x00E3, 0x0058, 0x0040, 0x0028, 0x0014 }; @@ -265,7 +265,7 @@ bool ReverbSW::process(int *p_input,int *p_output,int p_frames,int p_stereo_stri // p_input must point to a non-looping buffer. // BOTH p_input and p_output must be touched (use ClearModuleBuffer). - // �������LOCAL MACROS ������۲ + // LOCAL MACROS #undef LM_SETSRCOFFSET #define LM_SETSRCOFFSET(x) \ @@ -296,14 +296,14 @@ MULSHIFT_S32 ( x, current_params->y, 15 ) #undef LM_REVERB #define LM_REVERB(x) reverb_buffer[ (x) + cSample ] - // �������LOCAL VARIABLES ������۲ + // LOCAL VARIABLES unsigned int Offset; int lwl, lwr, rwl, rwr; -// unsigned char HZShift; + //unsigned char HZShift; - // �������CODE ������۲ + // CODE lwl = state.lwl; diff --git a/servers/physics/area_pair_sw.cpp b/servers/physics/area_pair_sw.cpp index 1131aa90d3..e95c85d751 100644 --- a/servers/physics/area_pair_sw.cpp +++ b/servers/physics/area_pair_sw.cpp @@ -110,7 +110,7 @@ bool Area2PairSW::setup(float p_step) { return false; } -// bool result = area_a->test_collision_mask(area_b) && CollisionSolverSW::solve(area_a->get_shape(shape_a),area_a->get_transform() * area_a->get_shape_transform(shape_a),Vector2(),area_b->get_shape(shape_b),area_b->get_transform() * area_b->get_shape_transform(shape_b),Vector2(),NULL,this); + //bool result = area_a->test_collision_mask(area_b) && CollisionSolverSW::solve(area_a->get_shape(shape_a),area_a->get_transform() * area_a->get_shape_transform(shape_a),Vector2(),area_b->get_shape(shape_b),area_b->get_transform() * area_b->get_shape_transform(shape_b),Vector2(),NULL,this); bool result = CollisionSolverSW::solve_static(area_a->get_shape(shape_a),area_a->get_transform() * area_a->get_shape_transform(shape_a),area_b->get_shape(shape_b),area_b->get_transform() * area_b->get_shape_transform(shape_b),NULL,this); if (result!=colliding) { diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp index ceeeafe04a..81604dd5e1 100644 --- a/servers/physics/body_sw.cpp +++ b/servers/physics/body_sw.cpp @@ -270,8 +270,10 @@ void BodySW::set_mode(PhysicsServer::BodyMode p_mode) { } _update_inertia(); - //if (get_space()) -// _update_queries(); + /* + if (get_space()) + _update_queries(); + */ } PhysicsServer::BodyMode BodySW::get_mode() const { @@ -319,14 +321,18 @@ void BodySW::set_state(PhysicsServer::BodyState p_state, const Variant& p_varian } break; case PhysicsServer::BODY_STATE_LINEAR_VELOCITY: { - //if (mode==PhysicsServer::BODY_MODE_STATIC) - // break; + /* + if (mode==PhysicsServer::BODY_MODE_STATIC) + break; + */ linear_velocity=p_variant; wakeup(); } break; case PhysicsServer::BODY_STATE_ANGULAR_VELOCITY: { - //if (mode!=PhysicsServer::BODY_MODE_RIGID) - // break; + /* + if (mode!=PhysicsServer::BODY_MODE_RIGID) + break; + */ angular_velocity=p_variant; wakeup(); @@ -400,11 +406,13 @@ void BodySW::set_space(SpaceSW *p_space){ _update_inertia(); if (active) get_space()->body_add_to_active_list(&active_list); -// _update_queries(); - //if (is_active()) { - // active=false; - // set_active(true); - //} + /* + _update_queries(); + if (is_active()) { + active=false; + set_active(true); + } + */ } @@ -479,13 +487,17 @@ void BodySW::integrate_forces(real_t p_step) { // If less than 0, override dampenings with that of the Body if (angular_damp>=0) area_angular_damp=angular_damp; - //else - // area_angular_damp=damp_area->get_angular_damp(); + /* + else + area_angular_damp=damp_area->get_angular_damp(); + */ if (linear_damp>=0) area_linear_damp=linear_damp; - //else - // area_linear_damp=damp_area->get_linear_damp(); + /* + else + area_linear_damp=damp_area->get_linear_damp(); + */ Vector3 motion; @@ -630,10 +642,10 @@ void BodySW::integrate_velocities(real_t p_step) { _update_transform_dependant(); - //if (fi_callback) { - - // get_space()->body_add_to_state_query_list(&direct_state_query_list); - // + /* + if (fi_callback) { + get_space()->body_add_to_state_query_list(&direct_state_query_list); + */ } /* @@ -772,12 +784,12 @@ BodySW::BodySW() : CollisionObjectSW(TYPE_BODY), active_list(this), inertia_upda active=true; mass=1; -// _inv_inertia=Transform(); + //_inv_inertia=Transform(); _inv_mass=1; bounce=0; friction=1; omit_force_integration=false; -// applied_torque=0; + //applied_torque=0; island_step=0; island_next=NULL; island_list_next=NULL; diff --git a/servers/physics/collision_solver_sat.cpp b/servers/physics/collision_solver_sat.cpp index 7f8153611f..d02303e23d 100644 --- a/servers/physics/collision_solver_sat.cpp +++ b/servers/physics/collision_solver_sat.cpp @@ -42,9 +42,11 @@ struct _CollectorCallback { _FORCE_INLINE_ void call(const Vector3& p_point_A, const Vector3& p_point_B) { - //if (normal.dot(p_point_A) >= normal.dot(p_point_B)) - // return; -// print_line("** A: "+p_point_A+" B: "+p_point_B+" D: "+rtos(p_point_A.distance_to(p_point_B))); + /* + if (normal.dot(p_point_A) >= normal.dot(p_point_B)) + return; + print_line("** A: "+p_point_A+" B: "+p_point_B+" D: "+rtos(p_point_A.distance_to(p_point_B))); + */ if (swap) callback(p_point_B,p_point_A,userdata); @@ -108,7 +110,7 @@ static void _generate_contacts_edge_edge(const Vector3 * p_points_A,int p_point_ Vector3 c=rel_A.cross(rel_B).cross(rel_B); -// if ( Math::abs(rel_A.dot(c) )<_EDGE_IS_VALID_SUPPORT_TRESHOLD ) { + //if ( Math::abs(rel_A.dot(c) )<_EDGE_IS_VALID_SUPPORT_TRESHOLD ) { if ( Math::abs(rel_A.dot(c) )<CMP_EPSILON ) { // should handle somehow.. @@ -205,7 +207,7 @@ static void _generate_contacts_face_face(const Vector3 * p_points_A,int p_point_ // check for different sides and non coplanar -// if ( (dist0*dist1) < -CMP_EPSILON && !(edge && j)) { + //if ( (dist0*dist1) < -CMP_EPSILON && !(edge && j)) { if ( (dist0*dist1) < 0 && !(edge && j)) { // calculate intersection @@ -233,8 +235,10 @@ static void _generate_contacts_face_face(const Vector3 * p_points_A,int p_point_ for (int i=0;i<clipbuf_len;i++) { float d = plane_B.distance_to(clipbuf_src[i]); - //if (d>CMP_EPSILON) - // continue; + /* + if (d>CMP_EPSILON) + continue; + */ Vector3 closest_B=clipbuf_src[i] - plane_B.normal*d; @@ -1379,7 +1383,7 @@ static void _collision_convex_polygon_convex_polygon(const ShapeSW *p_a,const Tr for (int i=0;i<face_count_A;i++) { Vector3 axis = p_transform_a.xform( faces_A[i].plane ).normal; -// Vector3 axis = p_transform_a.basis.xform( faces_A[i].plane.normal ).normalized(); + //Vector3 axis = p_transform_a.basis.xform( faces_A[i].plane.normal ).normalized(); if (!separator.test_axis( axis )) return; @@ -1389,7 +1393,7 @@ static void _collision_convex_polygon_convex_polygon(const ShapeSW *p_a,const Tr for (int i=0;i<face_count_B;i++) { Vector3 axis = p_transform_b.xform( faces_B[i].plane ).normal; -// Vector3 axis = p_transform_b.basis.xform( faces_B[i].plane.normal ).normalized(); + //Vector3 axis = p_transform_b.basis.xform( faces_B[i].plane.normal ).normalized(); if (!separator.test_axis( axis )) @@ -1502,7 +1506,7 @@ static void _collision_convex_polygon_face(const ShapeSW *p_a,const Transform &p // faces of A for (int i=0;i<face_count;i++) { -// Vector3 axis = p_transform_a.xform( faces[i].plane ).normal; + //Vector3 axis = p_transform_a.xform( faces[i].plane ).normal; Vector3 axis = p_transform_a.basis.xform( faces[i].plane.normal ).normalized(); if (!separator.test_axis( axis )) diff --git a/servers/physics/collision_solver_sw.cpp b/servers/physics/collision_solver_sw.cpp index 91ef7913cf..3399849ab7 100644 --- a/servers/physics/collision_solver_sw.cpp +++ b/servers/physics/collision_solver_sw.cpp @@ -383,7 +383,7 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A,const Transform& concave_B->cull(local_aabb,concave_distance_callback,&cinfo); if (!cinfo.collided) { -// print_line(itos(cinfo.tested)); + //print_line(itos(cinfo.tested)); r_point_A=cinfo.close_A; r_point_B=cinfo.close_B; diff --git a/servers/physics/joints/cone_twist_joint_sw.cpp b/servers/physics/joints/cone_twist_joint_sw.cpp index 5036a1d8a3..cbf444f1e8 100644 --- a/servers/physics/joints/cone_twist_joint_sw.cpp +++ b/servers/physics/joints/cone_twist_joint_sw.cpp @@ -156,7 +156,7 @@ bool ConeTwistJointSW::setup(float p_step) { if (m_swingSpan1 >= real_t(0.05f)) { b1Axis2 = A->get_transform().basis.xform( this->m_rbAFrame.basis.get_axis(1) ); -// swing1 = btAtan2Fast( b2Axis1.dot(b1Axis2),b2Axis1.dot(b1Axis1) ); + //swing1 = btAtan2Fast( b2Axis1.dot(b1Axis2),b2Axis1.dot(b1Axis1) ); swx = b2Axis1.dot(b1Axis1); swy = b2Axis1.dot(b1Axis2); swing1 = atan2fast(swy, swx); @@ -169,7 +169,7 @@ bool ConeTwistJointSW::setup(float p_step) { if (m_swingSpan2 >= real_t(0.05f)) { b1Axis3 = A->get_transform().basis.xform( this->m_rbAFrame.basis.get_axis(2) ); -// swing2 = btAtan2Fast( b2Axis1.dot(b1Axis3),b2Axis1.dot(b1Axis1) ); + //swing2 = btAtan2Fast( b2Axis1.dot(b1Axis3),b2Axis1.dot(b1Axis1) ); swx = b2Axis1.dot(b1Axis1); swy = b2Axis1.dot(b1Axis3); swing2 = atan2fast(swy, swx); diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp index 5824de0127..48f70d9077 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.cpp +++ b/servers/physics/joints/generic_6dof_joint_sw.cpp @@ -50,10 +50,9 @@ real_t btGetMatrixElem(const Basis& mat, int index) bool matrixToEulerXYZ(const Basis& mat,Vector3& xyz); bool matrixToEulerXYZ(const Basis& mat,Vector3& xyz) { -// // rot = cy*cz -cy*sz sy -// // cz*sx*sy+cx*sz cx*cz-sx*sy*sz -cy*sx -// // -cx*cz*sy+sx*sz cz*sx+cx*sy*sz cx*cy -// + // rot = cy*cz -cy*sz sy + // cz*sx*sy+cx*sz cx*cz-sx*sy*sz -cy*sx + // -cx*cz*sy+sx*sz cz*sx+cx*sy*sz cx*cy if (btGetMatrixElem(mat,2) < real_t(1.0)) { @@ -325,16 +324,18 @@ void Generic6DOFJointSW::calculateAngleInfo() m_calculatedAxis[2] = axis0.cross(m_calculatedAxis[1]); -// if(m_debugDrawer) -// { -// -// char buff[300]; -// sprintf(buff,"\n X: %.2f ; Y: %.2f ; Z: %.2f ", -// m_calculatedAxisAngleDiff[0], -// m_calculatedAxisAngleDiff[1], -// m_calculatedAxisAngleDiff[2]); -// m_debugDrawer->reportErrorWarning(buff); -// } + /* + if(m_debugDrawer) + { + + char buff[300]; + sprintf(buff,"\n X: %.2f ; Y: %.2f ; Z: %.2f ", + m_calculatedAxisAngleDiff[0], + m_calculatedAxisAngleDiff[1], + m_calculatedAxisAngleDiff[2]); + m_debugDrawer->reportErrorWarning(buff); + } + */ } diff --git a/servers/physics/joints/hinge_joint_sw.cpp b/servers/physics/joints/hinge_joint_sw.cpp index 2f07779131..277346fbbb 100644 --- a/servers/physics/joints/hinge_joint_sw.cpp +++ b/servers/physics/joints/hinge_joint_sw.cpp @@ -221,7 +221,7 @@ bool HingeJointSW::setup(float p_step) { // Compute limit information real_t hingeAngle = get_hinge_angle(); -// print_line("angle: "+rtos(hingeAngle)); + //print_line("angle: "+rtos(hingeAngle)); //set bias, sign, clear accumulator m_correction = real_t(0.); m_limitSign = real_t(0.); @@ -235,17 +235,17 @@ bool HingeJointSW::setup(float p_step) { print_line("hi: "+rtos(m_upperLimit)); }*/ -// if (m_lowerLimit < m_upperLimit) + //if (m_lowerLimit < m_upperLimit) if (m_useLimit && m_lowerLimit <= m_upperLimit) { -// if (hingeAngle <= m_lowerLimit*m_limitSoftness) + //if (hingeAngle <= m_lowerLimit*m_limitSoftness) if (hingeAngle <= m_lowerLimit) { m_correction = (m_lowerLimit - hingeAngle); m_limitSign = 1.0f; m_solveLimit = true; } -// else if (hingeAngle >= m_upperLimit*m_limitSoftness) + //else if (hingeAngle >= m_upperLimit*m_limitSoftness) else if (hingeAngle >= m_upperLimit) { m_correction = m_upperLimit - hingeAngle; diff --git a/servers/physics/joints/pin_joint_sw.cpp b/servers/physics/joints/pin_joint_sw.cpp index 292d30443c..9c7fe65684 100644 --- a/servers/physics/joints/pin_joint_sw.cpp +++ b/servers/physics/joints/pin_joint_sw.cpp @@ -68,8 +68,8 @@ void PinJointSW::solve(float p_step){ Vector3 normal(0,0,0); -// Vector3 angvelA = A->get_transform().origin.getBasis().transpose() * A->getAngularVelocity(); -// Vector3 angvelB = B->get_transform().origin.getBasis().transpose() * B->getAngularVelocity(); + //Vector3 angvelA = A->get_transform().origin.getBasis().transpose() * A->getAngularVelocity(); + //Vector3 angvelB = B->get_transform().origin.getBasis().transpose() * B->getAngularVelocity(); for (int i=0;i<3;i++) { diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index 4069ccdccb..b71eae54b0 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -1395,11 +1395,13 @@ void PhysicsServerSW::free(RID p_rid) { BodySW *body = body_owner.get(p_rid); -// if (body->get_state_query()) -// _clear_query(body->get_state_query()); + /* + if (body->get_state_query()) + _clear_query(body->get_state_query()); -// if (body->get_direct_state_query()) -// _clear_query(body->get_direct_state_query()); + if (body->get_direct_state_query()) + _clear_query(body->get_direct_state_query()); + */ body->set_space(NULL); @@ -1422,8 +1424,10 @@ void PhysicsServerSW::free(RID p_rid) { AreaSW *area = area_owner.get(p_rid); -// if (area->get_monitor_query()) -// _clear_query(area->get_monitor_query()); + /* + if (area->get_monitor_query()) + _clear_query(area->get_monitor_query()); + */ area->set_space(NULL); diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h index a3f98392fc..72b133c4b9 100644 --- a/servers/physics/physics_server_sw.h +++ b/servers/physics/physics_server_sw.h @@ -62,7 +62,7 @@ friend class PhysicsDirectSpaceStateSW; mutable RID_Owner<BodySW> body_owner; mutable RID_Owner<JointSW> joint_owner; -// void _clear_query(QuerySW *p_query); + //void _clear_query(QuerySW *p_query); public: struct CollCbkData { diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index 59ade71475..9f8d1107f4 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -1048,8 +1048,10 @@ void ConcavePolygonShapeSW::_cull_segment(int p_idx,_SegmentCullParams *p_params const BVH *bvh=&p_params->bvh[p_idx]; - //if (p_params->dir.dot(bvh->aabb.get_support(-p_params->dir))>p_params->min_d) - // return; //test against whole AABB, which isn't very costly + /* + if (p_params->dir.dot(bvh->aabb.get_support(-p_params->dir))>p_params->min_d) + return; //test against whole AABB, which isn't very costly + */ //printf("addr: %p\n",bvh); @@ -1309,7 +1311,7 @@ _VolumeSW_BVH* _volume_sw_build_bvh(_VolumeSW_BVH_Element *p_elements,int p_size bvh->left=_volume_sw_build_bvh(p_elements,split,count); bvh->right=_volume_sw_build_bvh(&p_elements[split],p_size-split,count); -// printf("branch at %p - %i: %i\n",bvh,count,bvh->face_index); + //printf("branch at %p - %i: %i\n",bvh,count,bvh->face_index); count++; return bvh; } @@ -1322,7 +1324,7 @@ void ConcavePolygonShapeSW::_fill_bvh(_VolumeSW_BVH* p_bvh_tree,BVH* p_bvh_array p_bvh_array[idx].aabb=p_bvh_tree->aabb; p_bvh_array[idx].face_index=p_bvh_tree->face_index; -// printf("%p - %i: %i(%p) -- %p:%p\n",%p_bvh_array[idx],p_idx,p_bvh_array[i]->face_index,&p_bvh_tree->face_index,p_bvh_tree->left,p_bvh_tree->right); + //printf("%p - %i: %i(%p) -- %p:%p\n",%p_bvh_array[idx],p_idx,p_bvh_array[i]->face_index,&p_bvh_tree->face_index,p_bvh_tree->left,p_bvh_tree->right); if (p_bvh_tree->left) { diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h index 3cbd1c9609..919c681105 100644 --- a/servers/physics/shape_sw.h +++ b/servers/physics/shape_sw.h @@ -366,8 +366,8 @@ struct HeightMapShapeSW : public ConcaveShapeSW { int depth; float cell_size; -// void _cull_segment(int p_idx,_SegmentCullParams *p_params) const; -// void _cull(int p_idx,_CullParams *p_params) const; + //void _cull_segment(int p_idx,_SegmentCullParams *p_params) const; + //void _cull(int p_idx,_CullParams *p_params) const; void _setup(PoolVector<float> p_heights,int p_width,int p_depth,float p_cell_size); public: diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index d73d5f140e..eaa3d3194c 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -204,8 +204,10 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID& p_shape, const Transform& aabb=aabb.merge(Rect3(aabb.pos+p_motion,aabb.size)); //motion aabb=aabb.grow(p_margin); - //if (p_motion!=Vector3()) - // print_line(p_motion); + /* + if (p_motion!=Vector3()) + print_line(p_motion); + */ int amount = space->broadphase->cull_aabb(aabb,space->intersection_query_results,SpaceSW::INTERSECTION_QUERY_MAX,space->intersection_query_subindex_results); diff --git a/servers/physics/step_sw.cpp b/servers/physics/step_sw.cpp index e24081761b..30ee33a7de 100644 --- a/servers/physics/step_sw.cpp +++ b/servers/physics/step_sw.cpp @@ -233,7 +233,7 @@ void StepSW::step(SpaceSW* p_space,float p_delta,int p_iterations) { } -// print_line("island count: "+itos(island_count)+" active count: "+itos(active_count)); + //print_line("island count: "+itos(island_count)+" active count: "+itos(active_count)); /* SETUP CONSTRAINT ISLANDS */ { diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index a32e024fe9..093f69a169 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -251,8 +251,10 @@ void Body2DSW::set_mode(Physics2DServer::BodyMode p_mode) { } _update_inertia(); - //if (get_space()) -// _update_queries(); + /* + if (get_space()) + _update_queries(); + */ } Physics2DServer::BodyMode Body2DSW::get_mode() const { @@ -301,15 +303,19 @@ void Body2DSW::set_state(Physics2DServer::BodyState p_state, const Variant& p_va } break; case Physics2DServer::BODY_STATE_LINEAR_VELOCITY: { - //if (mode==Physics2DServer::BODY_MODE_STATIC) - // break; + /* + if (mode==Physics2DServer::BODY_MODE_STATIC) + break; + */ linear_velocity=p_variant; wakeup(); } break; case Physics2DServer::BODY_STATE_ANGULAR_VELOCITY: { - //if (mode!=Physics2DServer::BODY_MODE_RIGID) - // break; + /* + if (mode!=Physics2DServer::BODY_MODE_RIGID) + break; + */ angular_velocity=p_variant; wakeup(); @@ -385,11 +391,13 @@ void Body2DSW::set_space(Space2DSW *p_space){ _update_inertia(); if (active) get_space()->body_add_to_active_list(&active_list); -// _update_queries(); - //if (is_active()) { - // active=false; - // set_active(true); - //} + /* + _update_queries(); + if (is_active()) { + active=false; + set_active(true); + } + */ } @@ -459,13 +467,17 @@ void Body2DSW::integrate_forces(real_t p_step) { // If less than 0, override dampenings with that of the Body2D if (angular_damp>=0) area_angular_damp = angular_damp; - //else - // area_angular_damp=damp_area->get_angular_damp(); + /* + else + area_angular_damp=damp_area->get_angular_damp(); + */ if (linear_damp>=0) area_linear_damp = linear_damp; - //else - // area_linear_damp=damp_area->get_linear_damp(); + /* + else + area_linear_damp=damp_area->get_linear_damp(); + */ Vector2 motion; bool do_motion=false; @@ -482,10 +494,12 @@ void Body2DSW::integrate_forces(real_t p_step) { do_motion=true; - //for(int i=0;i<get_shape_count();i++) { - // set_shape_kinematic_advance(i,Vector2()); - // set_shape_kinematic_retreat(i,0); - //} + /* + for(int i=0;i<get_shape_count();i++) { + set_shape_kinematic_advance(i,Vector2()); + set_shape_kinematic_retreat(i,0); + } + */ } else { if (!omit_force_integration && !first_integration) { diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp index efa12c37cb..d2b37319ad 100644 --- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp +++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp @@ -599,8 +599,10 @@ int BroadPhase2DHashGrid::cull_segment(const Vector2& p_from, const Vector2& p_t E->key()->pass=pass; -// if (use_aabb && !p_aabb.intersects(E->key()->aabb)) -// continue; + /* + if (use_aabb && !p_aabb.intersects(E->key()->aabb)) + continue; + */ if (!E->key()->aabb.intersects_segment(p_from,p_to)) continue; @@ -645,8 +647,10 @@ int BroadPhase2DHashGrid::cull_aabb(const Rect2& p_aabb,CollisionObject2DSW** p_ if (!p_aabb.intersects(E->key()->aabb)) continue; -// if (!E->key()->aabb.intersects_segment(p_from,p_to)) -// continue; + /* + if (!E->key()->aabb.intersects_segment(p_from,p_to)) + continue; + */ p_results[cullcount]=E->key()->owner; p_result_indices[cullcount]=E->key()->subindex; diff --git a/servers/physics_2d/collision_solver_2d_sat.cpp b/servers/physics_2d/collision_solver_2d_sat.cpp index 2e7b0d8835..a09574a94c 100644 --- a/servers/physics_2d/collision_solver_2d_sat.cpp +++ b/servers/physics_2d/collision_solver_2d_sat.cpp @@ -40,8 +40,10 @@ struct _CollectorCallback2D { _FORCE_INLINE_ void call(const Vector2& p_point_A, const Vector2& p_point_B) { - //if (normal.dot(p_point_A) >= normal.dot(p_point_B)) - // return; + /* + if (normal.dot(p_point_A) >= normal.dot(p_point_B)) + return; + */ if (swap) callback(p_point_B,p_point_A,userdata); else @@ -462,7 +464,7 @@ public: } } - // print_line("test axis: "+p_axis+" depth: "+rtos(best_depth)); + //print_line("test axis: "+p_axis+" depth: "+rtos(best_depth)); #ifdef DEBUG_ENABLED best_axis_count++; #endif @@ -610,8 +612,10 @@ static void _collision_segment_segment(const Shape2DSW* p_a,const Transform2D& p //this collision is kind of pointless - //if (!separator.test_previous_axis()) - // return; + /* + if (!separator.test_previous_axis()) + return; + */ if (!separator.test_cast()) return; @@ -850,7 +854,7 @@ static void _collision_circle_rectangle(const Shape2DSW* p_a,const Transform2D& const Vector2 &sphere=p_transform_a.elements[2]; const Vector2 *axis=&p_transform_b.elements[0]; -// const Vector2& half_extents = rectangle_B->get_half_extents(); + //const Vector2& half_extents = rectangle_B->get_half_extents(); if (!separator.test_axis(axis[0].normalized())) return; diff --git a/servers/physics_2d/collision_solver_2d_sw.cpp b/servers/physics_2d/collision_solver_2d_sw.cpp index e509bb76cd..02d59b69f0 100644 --- a/servers/physics_2d/collision_solver_2d_sw.cpp +++ b/servers/physics_2d/collision_solver_2d_sw.cpp @@ -226,7 +226,7 @@ bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A,const Transfo concave_B->cull(local_aabb,concave_callback,&cinfo); -// print_line("Rect2 TESTS: "+itos(cinfo.aabb_tests)); + //print_line("Rect2 TESTS: "+itos(cinfo.aabb_tests)); return cinfo.collided; } @@ -255,9 +255,11 @@ bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A,const Transform2D& p_ if (type_B==Physics2DServer::SHAPE_LINE || type_B==Physics2DServer::SHAPE_RAY) { return false; - //if (type_B==Physics2DServer::SHAPE_RAY) { - // return false; } + /* + if (type_B==Physics2DServer::SHAPE_RAY) { + return false; + */ if (swap) { return solve_static_line(p_shape_B,p_transform_B,p_shape_A,p_transform_A,p_result_callback,p_userdata,true); diff --git a/servers/physics_2d/joints_2d_sw.cpp b/servers/physics_2d/joints_2d_sw.cpp index 7205e90d27..f0703a0894 100644 --- a/servers/physics_2d/joints_2d_sw.cpp +++ b/servers/physics_2d/joints_2d_sw.cpp @@ -407,8 +407,8 @@ bool GrooveJoint2DSW::setup(float p_step) { jn_max = get_max_force() * p_step; // calculate bias velocity -// cpVect delta = cpvsub(cpvadd(b->p, joint->r2), cpvadd(a->p, joint->r1)); -// joint->bias = cpvclamp(cpvmult(delta, -joint->constraint.biasCoef*dt_inv), joint->constraint.maxBias); + //cpVect delta = cpvsub(cpvadd(b->p, joint->r2), cpvadd(a->p, joint->r1)); + //joint->bias = cpvclamp(cpvmult(delta, -joint->constraint.biasCoef*dt_inv), joint->constraint.maxBias); Vector2 delta = (B->get_transform().get_origin() +rB) - (A->get_transform().get_origin() + rA); diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index 3cc69f470e..d134ce7ea8 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -1176,11 +1176,13 @@ void Physics2DServerSW::free(RID p_rid) { Body2DSW *body = body_owner.get(p_rid); -// if (body->get_state_query()) -// _clear_query(body->get_state_query()); + /* + if (body->get_state_query()) + _clear_query(body->get_state_query()); -// if (body->get_direct_state_query()) -// _clear_query(body->get_direct_state_query()); + if (body->get_direct_state_query()) + _clear_query(body->get_direct_state_query()); + */ body->set_space(NULL); @@ -1203,8 +1205,10 @@ void Physics2DServerSW::free(RID p_rid) { Area2DSW *area = area_owner.get(p_rid); -// if (area->get_monitor_query()) -// _clear_query(area->get_monitor_query()); + /* + if (area->get_monitor_query()) + _clear_query(area->get_monitor_query()); + */ area->set_space(NULL); @@ -1380,7 +1384,7 @@ Physics2DServerSW::Physics2DServerSW() { singletonsw=this; BroadPhase2DSW::create_func=BroadPhase2DHashGrid::_create; -// BroadPhase2DSW::create_func=BroadPhase2DBasic::_create; + //BroadPhase2DSW::create_func=BroadPhase2DBasic::_create; active=true; island_count=0; diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h index ba45dd9272..1da7d65dc8 100644 --- a/servers/physics_2d/physics_2d_server_sw.h +++ b/servers/physics_2d/physics_2d_server_sw.h @@ -70,7 +70,7 @@ friend class Physics2DDirectBodyStateSW; static Physics2DServerSW *singletonsw; -// void _clear_query(Query2DSW *p_query); + //void _clear_query(Query2DSW *p_query); public: struct CollCbkData { diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 8b19122f17..886ae7730b 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -639,8 +639,10 @@ bool ConvexPolygonShape2DSW::intersect_segment(const Vector2& p_begin,const Vect for(int i=0;i<point_count;i++) { //hmm crap.. no can do.. - //if (d.dot(points[i].normal)>=0) - // continue; + /* + if (d.dot(points[i].normal)>=0) + continue; + */ Vector2 res; @@ -816,8 +818,10 @@ bool ConcavePolygonShape2DSW::intersect_segment(const Vector2& p_begin,const Vec real_t d=1e10; bool inters=false; - //for(int i=0;i<bvh_depth;i++) - // stack[i]=0; + /* + for(int i=0;i<bvh_depth;i++) + stack[i]=0; + */ int level=0; @@ -1077,8 +1081,10 @@ void ConcavePolygonShape2DSW::cull(const Rect2& p_local_aabb,Callback p_callback }; - //for(int i=0;i<bvh_depth;i++) - // stack[i]=0; + /* + for(int i=0;i<bvh_depth;i++) + stack[i]=0; + */ int level=0; diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 2c7b099b36..e95707f135 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -248,8 +248,10 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID& p_shape, const Transfor aabb=aabb.merge(Rect2(aabb.pos+p_motion,aabb.size)); //motion aabb=aabb.grow(p_margin); - //if (p_motion!=Vector2()) - // print_line(p_motion); + /* + if (p_motion!=Vector2()) + print_line(p_motion); + */ int amount = space->broadphase->cull_aabb(aabb,space->intersection_query_results,Space2DSW::INTERSECTION_QUERY_MAX,space->intersection_query_subindex_results); @@ -661,8 +663,10 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co const Body2DSW *body=static_cast<const Body2DSW*>(col_obj); Vector2 cdir = body->get_one_way_collision_direction(); - //if (cdir!=Vector2() && p_motion.dot(cdir)<0) - // continue; + /* + if (cdir!=Vector2() && p_motion.dot(cdir)<0) + continue; + */ cbk.valid_dir=cdir; cbk.valid_depth=body->get_one_way_collision_max_depth(); @@ -698,11 +702,10 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co float traveled = n.dot(recover_motion); a+=n*traveled; + float d = a.distance_to(b); + if (d<margin) + continue; #endif - // float d = a.distance_to(b); - - //if (d<margin) - /// continue; recover_motion+=(b-a)*0.4; } @@ -972,7 +975,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co if (collide_character) mask|=Physics2DDirectSpaceState::TYPE_MASK_CHARACTER_BODY; -// print_line("motion: "+p_motion+" margin: "+rtos(margin)); + //print_line("motion: "+p_motion+" margin: "+rtos(margin)); //print_line("margin: "+rtos(margin)); do { @@ -999,8 +1002,10 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co float d = a.distance_to(b); - //if (d<margin) - /// continue; + /* + if (d<margin) + continue; + */ recover_motion+=(b-a)*0.4; } diff --git a/servers/physics_2d/step_2d_sw.cpp b/servers/physics_2d/step_2d_sw.cpp index 05c0bf0516..8be4e2b5d5 100644 --- a/servers/physics_2d/step_2d_sw.cpp +++ b/servers/physics_2d/step_2d_sw.cpp @@ -216,7 +216,7 @@ void Step2DSW::step(Space2DSW* p_space,float p_delta,int p_iterations) { p_space->area_remove_from_moved_list((SelfList<Area2DSW>*)aml.first()); //faster to remove here } -// print_line("island count: "+itos(island_count)+" active count: "+itos(active_count)); + //print_line("island count: "+itos(island_count)+" active count: "+itos(active_count)); { //profile profile_endtime=OS::get_singleton()->get_ticks_usec(); diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index c175c04ee9..bd5a58e57b 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -602,7 +602,7 @@ void Physics2DServer::_bind_methods() { ClassDB::bind_method(_MD("body_add_collision_exception","body","excepted_body"),&Physics2DServer::body_add_collision_exception); ClassDB::bind_method(_MD("body_remove_collision_exception","body","excepted_body"),&Physics2DServer::body_remove_collision_exception); -// virtual void body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions)=0; + //virtual void body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions)=0; ClassDB::bind_method(_MD("body_set_max_contacts_reported","body","amount"),&Physics2DServer::body_set_max_contacts_reported); ClassDB::bind_method(_MD("body_get_max_contacts_reported","body"),&Physics2DServer::body_get_max_contacts_reported); @@ -641,9 +641,9 @@ void Physics2DServer::_bind_methods() { ClassDB::bind_method(_MD("get_process_info","process_info"),&Physics2DServer::get_process_info); -// ClassDB::bind_method(_MD("init"),&Physics2DServer::init); -// ClassDB::bind_method(_MD("step"),&Physics2DServer::step); -// ClassDB::bind_method(_MD("sync"),&Physics2DServer::sync); + //ClassDB::bind_method(_MD("init"),&Physics2DServer::init); + //ClassDB::bind_method(_MD("step"),&Physics2DServer::step); + //ClassDB::bind_method(_MD("sync"),&Physics2DServer::sync); //ClassDB::bind_method(_MD("flush_queries"),&Physics2DServer::flush_queries); BIND_CONSTANT( SPACE_PARAM_CONTACT_RECYCLE_RADIUS ); @@ -710,8 +710,8 @@ void Physics2DServer::_bind_methods() { BIND_CONSTANT( CCD_MODE_CAST_RAY ); BIND_CONSTANT( CCD_MODE_CAST_SHAPE ); -// BIND_CONSTANT( TYPE_BODY ); -// BIND_CONSTANT( TYPE_AREA ); + //BIND_CONSTANT( TYPE_BODY ); + //BIND_CONSTANT( TYPE_AREA ); BIND_CONSTANT( AREA_BODY_ADDED ); BIND_CONSTANT( AREA_BODY_REMOVED ); diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index 8f57fcfbdb..93553efb27 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -363,8 +363,8 @@ PhysicsDirectSpaceState::PhysicsDirectSpaceState() { void PhysicsDirectSpaceState::_bind_methods() { -// ClassDB::bind_method(_MD("intersect_ray","from","to","exclude","umask"),&PhysicsDirectSpaceState::_intersect_ray,DEFVAL(Array()),DEFVAL(0)); -// ClassDB::bind_method(_MD("intersect_shape:PhysicsShapeQueryResult","shape","xform","result_max","exclude","umask"),&PhysicsDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0)); + //ClassDB::bind_method(_MD("intersect_ray","from","to","exclude","umask"),&PhysicsDirectSpaceState::_intersect_ray,DEFVAL(Array()),DEFVAL(0)); + //ClassDB::bind_method(_MD("intersect_shape:PhysicsShapeQueryResult","shape","xform","result_max","exclude","umask"),&PhysicsDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0)); ClassDB::bind_method(_MD("intersect_ray:Dictionary","from","to","exclude","layer_mask","type_mask"),&PhysicsDirectSpaceState::_intersect_ray,DEFVAL(Array()),DEFVAL(0x7FFFFFFF),DEFVAL(TYPE_MASK_COLLISION)); ClassDB::bind_method(_MD("intersect_shape","shape:PhysicsShapeQueryParameters","max_results"),&PhysicsDirectSpaceState::_intersect_shape,DEFVAL(32)); @@ -529,7 +529,7 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(_MD("body_add_collision_exception","body","excepted_body"),&PhysicsServer::body_add_collision_exception); ClassDB::bind_method(_MD("body_remove_collision_exception","body","excepted_body"),&PhysicsServer::body_remove_collision_exception); -// virtual void body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions)=0; + //virtual void body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions)=0; ClassDB::bind_method(_MD("body_set_max_contacts_reported","body","amount"),&PhysicsServer::body_set_max_contacts_reported); ClassDB::bind_method(_MD("body_get_max_contacts_reported","body"),&PhysicsServer::body_get_max_contacts_reported); @@ -678,9 +678,9 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(_MD("set_active","active"),&PhysicsServer::set_active); -// ClassDB::bind_method(_MD("init"),&PhysicsServer::init); -// ClassDB::bind_method(_MD("step"),&PhysicsServer::step); -// ClassDB::bind_method(_MD("sync"),&PhysicsServer::sync); + //ClassDB::bind_method(_MD("init"),&PhysicsServer::init); + //ClassDB::bind_method(_MD("step"),&PhysicsServer::step); + //ClassDB::bind_method(_MD("sync"),&PhysicsServer::sync); //ClassDB::bind_method(_MD("flush_queries"),&PhysicsServer::flush_queries); @@ -739,8 +739,8 @@ void PhysicsServer::_bind_methods() { BIND_CONSTANT( DAMPED_STRING_STIFFNESS ); BIND_CONSTANT( DAMPED_STRING_DAMPING ); */ -// BIND_CONSTANT( TYPE_BODY ); -// BIND_CONSTANT( TYPE_AREA ); + //BIND_CONSTANT( TYPE_BODY ); + //BIND_CONSTANT( TYPE_AREA ); BIND_CONSTANT( AREA_BODY_ADDED ); BIND_CONSTANT( AREA_BODY_REMOVED ); diff --git a/servers/physics_server.h b/servers/physics_server.h index d57ca93d92..653959be45 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -135,8 +135,8 @@ class PhysicsDirectSpaceState : public Object { GDCLASS( PhysicsDirectSpaceState, Object ); -// Variant _intersect_ray(const Vector3& p_from, const Vector3& p_to,const Vector<RID>& p_exclude=Vector<RID>(),uint32_t p_collision_mask=0); -// Variant _intersect_shape(const RID& p_shape, const Transform& p_xform,int p_result_max=64,const Vector<RID>& p_exclude=Vector<RID>(),uint32_t p_collision_mask=0); + //Variant _intersect_ray(const Vector3& p_from, const Vector3& p_to,const Vector<RID>& p_exclude=Vector<RID>(),uint32_t p_collision_mask=0); + //Variant _intersect_shape(const RID& p_shape, const Transform& p_xform,int p_result_max=64,const Vector<RID>& p_exclude=Vector<RID>(),uint32_t p_collision_mask=0); public: enum ObjectTypeMask { diff --git a/servers/spatial_sound/spatial_sound_server_sw.cpp b/servers/spatial_sound/spatial_sound_server_sw.cpp index ccde73561f..d550134d82 100644 --- a/servers/spatial_sound/spatial_sound_server_sw.cpp +++ b/servers/spatial_sound/spatial_sound_server_sw.cpp @@ -66,7 +66,7 @@ void SpatialSoundServerSW::_update_sources() { SpatialSoundServerSW::Room::Room() { -// params[ROOM_PARAM_SPEED_OF_SOUND]=343.0; + //params[ROOM_PARAM_SPEED_OF_SOUND]=343.0; params[ROOM_PARAM_SPEED_OF_SOUND_SCALE]=1; params[ROOM_PARAM_DOPPLER_FACTOR]=1.0; params[ROOM_PARAM_PITCH_SCALE]=1.0; diff --git a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp index 33e51eb262..2bcc9644f1 100644 --- a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp +++ b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp @@ -67,7 +67,7 @@ void SpatialSound2DServerSW::_update_sources() { SpatialSound2DServerSW::Room::Room() { -// params[ROOM_PARAM_SPEED_OF_SOUND]=343.0; + //params[ROOM_PARAM_SPEED_OF_SOUND]=343.0; params[ROOM_PARAM_PITCH_SCALE]=1.0; params[ROOM_PARAM_VOLUME_SCALE_DB]=0; params[ROOM_PARAM_REVERB_SEND]=0; @@ -79,7 +79,7 @@ SpatialSound2DServerSW::Room::Room() { params[ROOM_PARAM_ATTENUATION_REVERB_SCALE]=0.0; override_other_sources=false; reverb=ROOM_REVERB_HALL; -// octree_id=0; + //octree_id=0; level=-1; @@ -149,7 +149,7 @@ void SpatialSound2DServerSW::room_set_space(RID p_room,RID p_space) { Space *space = space_owner.get(room->space); space->rooms.erase(p_room); -// space->octree.erase(room->octree_id); + //space->octree.erase(room->octree_id); //room->octree_id=0; } @@ -160,10 +160,10 @@ void SpatialSound2DServerSW::room_set_space(RID p_room,RID p_space) { Space *space = space_owner.get(p_space); ERR_FAIL_COND(!space); space->rooms.insert(p_room); -// room->octree_id=space->octree.create(room,AABB()); + //room->octree_id=space->octree.create(room,AABB()); //set bounds -// AABB aabb = room->bounds.is_empty()?AABB():room->bounds.get_aabb(); - // space->octree.move(room->octree_id,room->transform.xform(aabb)); + //AABB aabb = room->bounds.is_empty()?AABB():room->bounds.get_aabb(); + //space->octree.move(room->octree_id,room->transform.xform(aabb)); room->space=p_space; } @@ -191,11 +191,11 @@ void SpatialSound2DServerSW::room_set_bounds(RID p_room, const PoolVector<Point2 if (!room->space.is_valid()) return; -// AABB aabb = room->bounds.is_empty()?AABB():room->bounds.get_aabb(); -// Space* space = space_owner.get(room->space); -// ERR_FAIL_COND(!space); + //AABB aabb = room->bounds.is_empty()?AABB():room->bounds.get_aabb(); + //Space* space = space_owner.get(room->space); + //ERR_FAIL_COND(!space); -// space->octree.move(room->octree_id,room->transform.xform(aabb)); + //space->octree.move(room->octree_id,room->transform.xform(aabb)); } PoolVector<Point2> SpatialSound2DServerSW::room_get_bounds(RID p_room) const { @@ -603,7 +603,7 @@ void SpatialSound2DServerSW::free(RID p_id) { if (room->space.is_valid()) { Space *space = space_owner.get(room->space); ERR_FAIL_COND(!space); -// space->octree.erase(room->octree_id); + //space->octree.erase(room->octree_id); space->rooms.erase(p_id); } room_owner.free(p_id); diff --git a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h index 16d2c93e7d..7999a8c22b 100644 --- a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h +++ b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h @@ -179,7 +179,7 @@ class SpatialSound2DServerSW : public SpatialSound2DServer { ActiveVoice(Source *p_source=NULL,int p_voice=0) { source=p_source; voice=p_voice; } }; -// Room *cull_rooms[MAX_CULL_ROOMS]; + //Room *cull_rooms[MAX_CULL_ROOMS]; Set<Source*> streaming_sources; Set<ActiveVoice> active_voices; diff --git a/servers/visual/rasterizer.cpp b/servers/visual/rasterizer.cpp index 1adf2ee021..ba85f92e37 100644 --- a/servers/visual/rasterizer.cpp +++ b/servers/visual/rasterizer.cpp @@ -256,7 +256,7 @@ RID Rasterizer::_create_shader(const FixedSpatialMaterialShaderKey& p_key) { vcode+="uniform float "+_fixed_material_point_size_name+";\n"; vcode+="POINT_SIZE="+_fixed_material_point_size_name+";\n"; -// vcode+="POINT_SIZE=10.0;\n"; + //vcode+="POINT_SIZE=10.0;\n"; } String lcode; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 887fc5ac5f..94a514e7c1 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -93,7 +93,7 @@ public: Vector<RID> reflection_probe_instances; Vector<RID> gi_probe_instances; - Vector<float> morph_values; + Vector<float> blend_values; //BakedLightData *baked_light; VS::ShadowCastingSetting cast_shadows; @@ -244,12 +244,12 @@ public: virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<Rect3>& p_bone_aabbs=Vector<Rect3>())=0; - virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; - virtual int mesh_get_morph_target_count(RID p_mesh) const=0; + virtual void mesh_set_blend_shape_count(RID p_mesh,int p_amount)=0; + virtual int mesh_get_blend_shape_count(RID p_mesh) const=0; - virtual void mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode)=0; - virtual VS::MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const=0; + virtual void mesh_set_blend_shape_mode(RID p_mesh,VS::BlendShapeMode p_mode)=0; + virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const=0; virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material)=0; virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const=0; diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index ea634e8f06..6a6f437816 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2920,7 +2920,7 @@ ShaderLanguage::Node* ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha ERR_FAIL_COND_V(op->arguments[0]->type!=Node::TYPE_VARIABLE,p_node); VariableNode *vn = static_cast<VariableNode*>(op->arguments[0]); - // StringName name=vn->name; + //StringName name=vn->name; DataType base=get_scalar_type(op->get_datatype()); diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h index b5f843c114..4f8717088e 100644 --- a/servers/visual/shader_language.h +++ b/servers/visual/shader_language.h @@ -579,7 +579,7 @@ private: public: -// static void get_keyword_list(ShaderType p_type,List<String> *p_keywords); + //static void get_keyword_list(ShaderType p_type,List<String> *p_keywords); void clear(); Error compile(const String& p_code,const Map< StringName, Map<StringName,DataType> > &p_functions,const Set<String>& p_render_modes); diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index d68c580442..2f7bcccf73 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -1188,9 +1188,11 @@ bool VisualServerCanvas::free(RID p_rid) { canvas_item->child_items[i]->parent=RID(); } -// if (canvas_item->material) { -// canvas_item->material->owners.erase(canvas_item); -// } + /* + if (canvas_item->material) { + canvas_item->material->owners.erase(canvas_item); + } + */ canvas_item_owner.free( p_rid ); diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 3262479c43..e3bc0fb6c6 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -85,8 +85,10 @@ void VisualServerRaster::free( RID p_rid ){ void VisualServerRaster::draw(){ - //if (changes) - // print_line("changes: "+itos(changes)); + /* + if (changes) + print_line("changes: "+itos(changes)); + */ changes=0; @@ -181,7 +183,7 @@ BalloonAllocator<> *VisualServerRaster::OctreeAllocator::allocator=NULL; #define VS_CHANGED\ changes++;\ -// print_line(__FUNCTION__); + //print_line(__FUNCTION__); @@ -2928,7 +2930,7 @@ void VisualServerRaster::instance_geometry_set_flag(RID p_instance,InstanceFlags Instance *instance = instance_owner.get( p_instance ); ERR_FAIL_COND( !instance ); -// ERR_FAIL_COND( ! ( (1<<instance->base_type) & INSTANCE_GEOMETRY_MASK) ); + //ERR_FAIL_COND( ! ( (1<<instance->base_type) & INSTANCE_GEOMETRY_MASK) ); switch(p_flags) { @@ -2980,7 +2982,7 @@ bool VisualServerRaster::instance_geometry_get_flag(RID p_instance,InstanceFlags const Instance *instance = instance_owner.get( p_instance ); ERR_FAIL_COND_V( !instance, false ); -// ERR_FAIL_COND_V( ! ( (1<<instance->base_type) & INSTANCE_GEOMETRY_MASK), false ); + //ERR_FAIL_COND_V( ! ( (1<<instance->base_type) & INSTANCE_GEOMETRY_MASK), false ); switch(p_flags) { @@ -3335,8 +3337,10 @@ void VisualServerRaster::_update_instance(Instance *p_instance) { } else { - // if (new_aabb==p_instance->data.transformed_aabb) - // return; + /* + if (new_aabb==p_instance->data.transformed_aabb) + return; + */ p_instance->scenario->octree.move(p_instance->octree_id,new_aabb); } @@ -4656,7 +4660,7 @@ void VisualServerRaster::_free_attached_instances(RID p_rid,bool p_free_scenario void VisualServerRaster::custom_shade_model_set_shader(int p_model, RID p_shader) { VS_CHANGED; -// rasterizer->custom_shade_model_set_shader(p_model,p_shader); + //rasterizer->custom_shade_model_set_shader(p_model,p_shader); } RID VisualServerRaster::custom_shade_model_get_shader(int p_model) const { @@ -4746,8 +4750,10 @@ void VisualServerRaster::free( RID p_rid ) { BakedLightSampler *baked_light_sampler = baked_light_sampler_owner.get(p_rid); ERR_FAIL_COND(!baked_light_sampler); - //if (baked_light->data.octree_texture.is_valid()) - // rasterizer->free(baked_light->data.octree_texture); + /* + if (baked_light->data.octree_texture.is_valid()) + rasterizer->free(baked_light->data.octree_texture); + */ baked_light_sampler_owner.free(p_rid); memdelete(baked_light_sampler); @@ -4766,7 +4772,7 @@ void VisualServerRaster::free( RID p_rid ) { Viewport *viewport = viewport_owner.get( p_rid ); ERR_FAIL_COND(!viewport); -// Viewport *parent=NULL; + //Viewport *parent=NULL; rasterizer->free(viewport->viewport_data); if (viewport->render_target.is_valid()) { @@ -5105,7 +5111,7 @@ void VisualServerRaster::_light_instance_update_pssm_shadow(Instance *p_light,Sc float distances[5]; float texsize=rasterizer->light_instance_get_shadow_size( p_light->light_info->instance ); -// float cull_min=p_cull_range.min; + //float cull_min=p_cull_range.min; //float cull_max=p_cull_range.max; @@ -6657,7 +6663,7 @@ void VisualServerRaster::_render_camera(Viewport *p_viewport,Camera *p_camera, S /* print_line("OT: "+rtos( (OS::get_singleton()->get_ticks_usec()-t)/1000.0)); print_line("OTO: "+itos(p_scenario->octree.get_octant_count())); -// print_line("OTE: "+itos(p_scenario->octree.get_elem_count())); + //print_line("OTE: "+itos(p_scenario->octree.get_elem_count())); print_line("OTP: "+itos(p_scenario->octree.get_pair_count())); */ @@ -6761,7 +6767,7 @@ void VisualServerRaster::_render_camera(Viewport *p_viewport,Camera *p_camera, S if (light_cull_count<MAX_LIGHTS_CULLED) { light_cull_result[light_cull_count++]=ins; -// rasterizer->light_instance_set_active_hint(ins->light_info->instance); + //rasterizer->light_instance_set_active_hint(ins->light_info->instance); { //compute distance to camera using aabb support Vector3 n = ins->data.transform.basis.xform_inv(cull_range.nearp.normal).normalized(); @@ -7284,7 +7290,7 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_ ViewportRect desired_rect=p_viewport->rect; ViewportRect old_rect = viewport_rect; -// bool vpchanged=false; + //bool vpchanged=false; // convert default expanding viewports to actual size //if (desired_rect.x==0 && desired_rect.y==0 && desired_rect.width==0 && desired_rect.height==0) { if (p_parent_w != 0 && p_parent_h != 0) { @@ -7476,7 +7482,7 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_ for (Map<Viewport::CanvasKey,Viewport::CanvasData*>::Element *E=canvas_map.front();E;E=E->next()) { - // print_line("canvas "+itos(i)+" size: "+itos(I->get()->canvas->child_items.size())); + //print_line("canvas "+itos(i)+" size: "+itos(I->get()->canvas->child_items.size())); //print_line("GT "+p_viewport->global_transform+". CT: "+E->get()->transform); Matrix32 xform = p_viewport->global_transform * E->get()->transform; @@ -7508,7 +7514,7 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_ } -// rasterizer->canvas_debug_viewport_shadows(lights_with_shadow); + //rasterizer->canvas_debug_viewport_shadows(lights_with_shadow); } //capture @@ -7721,8 +7727,10 @@ void VisualServerRaster::sync() { } void VisualServerRaster::draw() { - //if (changes) - // print_line("changes: "+itos(changes)); + /* + if (changes) + print_line("changes: "+itos(changes)); + */ changes=0; shadows_enabled=GLOBAL_DEF("render/shadows_enabled",true); room_cull_enabled = GLOBAL_DEF("render/room_cull_enabled",true); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index d9b650d569..5c8105681a 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -673,12 +673,12 @@ public: BIND10(mesh_add_surface,RID,uint32_t,PrimitiveType,const PoolVector<uint8_t>&,int ,const PoolVector<uint8_t>& ,int ,const Rect3&,const Vector<PoolVector<uint8_t> >&,const Vector<Rect3>& ) - BIND2(mesh_set_morph_target_count,RID,int) - BIND1RC(int,mesh_get_morph_target_count,RID) + BIND2(mesh_set_blend_shape_count,RID,int) + BIND1RC(int,mesh_get_blend_shape_count,RID) - BIND2(mesh_set_morph_target_mode,RID,MorphTargetMode) - BIND1RC(MorphTargetMode, mesh_get_morph_target_mode,RID ) + BIND2(mesh_set_blend_shape_mode,RID,BlendShapeMode) + BIND1RC(BlendShapeMode, mesh_get_blend_shape_mode,RID ) BIND3(mesh_surface_set_material,RID, int , RID ) BIND2RC(RID,mesh_surface_get_material,RID, int ) @@ -976,7 +976,7 @@ public: BIND2(instance_set_layer_mask,RID, uint32_t ) BIND2(instance_set_transform,RID, const Transform& ) BIND2(instance_attach_object_instance_ID,RID,ObjectID ) - BIND3(instance_set_morph_target_weight,RID,int , float ) + BIND3(instance_set_blend_shape_weight,RID,int , float ) BIND3(instance_set_surface_material,RID,int , RID ) BIND2(instance_set_visible,RID ,bool) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 4635b0fcfe..157a85be98 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -78,7 +78,7 @@ void VisualServerScene::camera_set_use_vertical_aspect(RID p_camera,bool p_enabl void* VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance *p_A,int, OctreeElementID, Instance *p_B,int) { -// VisualServerScene *self = (VisualServerScene*)p_self; + //VisualServerScene *self = (VisualServerScene*)p_self; Instance *A = p_A; Instance *B = p_B; @@ -204,7 +204,7 @@ void* VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance } void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance *p_A,int, OctreeElementID, Instance *p_B,int,void* udata) { -// VisualServerScene *self = (VisualServerScene*)p_self; + //VisualServerScene *self = (VisualServerScene*)p_self; Instance *A = p_A; Instance *B = p_B; @@ -470,7 +470,7 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ instance->base_data=NULL; } - instance->morph_values.clear(); + instance->blend_values.clear(); for(int i=0;i<instance->materials.size();i++) { if (instance->materials[i].is_valid()) { @@ -829,7 +829,7 @@ void VisualServerScene::instance_attach_object_instance_ID(RID p_instance,Object instance->object_ID=p_ID; } -void VisualServerScene::instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight){ +void VisualServerScene::instance_set_blend_shape_weight(RID p_instance,int p_shape, float p_weight){ Instance *instance = instance_owner.get( p_instance ); ERR_FAIL_COND( !instance ); @@ -838,8 +838,8 @@ void VisualServerScene::instance_set_morph_target_weight(RID p_instance,int p_sh _update_dirty_instance(instance); } - ERR_FAIL_INDEX(p_shape,instance->morph_values.size()); - instance->morph_values[p_shape]=p_weight; + ERR_FAIL_INDEX(p_shape,instance->blend_values.size()); + instance->blend_values[p_shape]=p_weight; } void VisualServerScene::instance_set_surface_material(RID p_instance,int p_surface, RID p_material){ @@ -1239,8 +1239,10 @@ void VisualServerScene::_update_instance(Instance *p_instance) { } else { - // if (new_aabb==p_instance->data.transformed_aabb) - // return; + /* + if (new_aabb==p_instance->data.transformed_aabb) + return; + */ p_instance->scenario->octree.move(p_instance->octree_id,new_aabb); } @@ -1773,7 +1775,7 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform,const Came VSG::scene_render->set_scene_pass(render_pass); -// rasterizer->set_camera(camera->transform, camera_matrix,ortho); + //rasterizer->set_camera(camera->transform, camera_matrix,ortho); Vector<Plane> planes = p_cam_projection.get_projection_planes(p_cam_transform); @@ -1786,11 +1788,11 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform,const Came reflection_probe_cull_count=0; -// light_samplers_culled=0; + //light_samplers_culled=0; /* print_line("OT: "+rtos( (OS::get_singleton()->get_ticks_usec()-t)/1000.0)); print_line("OTO: "+itos(p_scenario->octree.get_octant_count())); -// print_line("OTE: "+itos(p_scenario->octree.get_elem_count())); + //print_line("OTE: "+itos(p_scenario->octree.get_elem_count())); print_line("OTP: "+itos(p_scenario->octree.get_pair_count())); */ @@ -3375,7 +3377,7 @@ void VisualServerScene::render_probes() { probe->dynamic.updating_stage=GI_UPDATE_STAGE_CHECK; -// print_line("UPLOAD TIME: "+rtos((OS::get_singleton()->get_ticks_usec()-us)/1000000.0)); + //print_line("UPLOAD TIME: "+rtos((OS::get_singleton()->get_ticks_usec()-us)/1000000.0)); } break; } @@ -3409,11 +3411,11 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) { } p_instance->materials.resize(new_mat_count); - int new_morph_count = VSG::storage->mesh_get_morph_target_count(p_instance->base); - if (new_morph_count!=p_instance->morph_values.size()) { - p_instance->morph_values.resize(new_morph_count); - for(int i=0;i<new_morph_count;i++) { - p_instance->morph_values[i]=0; + int new_blend_shape_count = VSG::storage->mesh_get_blend_shape_count(p_instance->base); + if (new_blend_shape_count!=p_instance->blend_values.size()) { + p_instance->blend_values.resize(new_blend_shape_count); + for(int i=0;i<new_blend_shape_count;i++) { + p_instance->blend_values[i]=0; } } } diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index fc3ea29b00..1f7de3d005 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -491,7 +491,7 @@ public: virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask); virtual void instance_set_transform(RID p_instance, const Transform& p_transform); virtual void instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID); - virtual void instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight); + virtual void instance_set_blend_shape_weight(RID p_instance,int p_shape, float p_weight); virtual void instance_set_surface_material(RID p_instance,int p_surface, RID p_material); virtual void instance_set_visible(RID p_instance,bool p_visible); diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index 780335a7f4..d2ee32f9cc 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -176,7 +176,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { light=light->shadows_next_ptr; } - // VSG::canvas_render->reset_canvas(); + //VSG::canvas_render->reset_canvas(); } VSG::rasterizer->restore_render_target(); @@ -196,7 +196,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { VisualServerCanvas::Canvas *canvas = static_cast<VisualServerCanvas::Canvas*>(E->get()->canvas); - // print_line("canvas "+itos(i)+" size: "+itos(I->get()->canvas->child_items.size())); + //print_line("canvas "+itos(i)+" size: "+itos(I->get()->canvas->child_items.size())); //print_line("GT "+p_viewport->global_transform+". CT: "+E->get()->transform); Transform2D xform = p_viewport->global_transform * E->get()->transform; diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 71f9c88f2a..da73980e08 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1675,7 +1675,7 @@ RID VisualServer::instance_create2(RID p_base, RID p_scenario) { VisualServer::VisualServer() { -// ERR_FAIL_COND(singleton); + //ERR_FAIL_COND(singleton); singleton=this; } diff --git a/servers/visual_server.h b/servers/visual_server.h index 3e7240af6f..f75223e378 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -246,16 +246,16 @@ public: virtual void mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array(),uint32_t p_compress_format=ARRAY_COMPRESS_DEFAULT); virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<Rect3>& p_bone_aabbs=Vector<Rect3>())=0; - virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; - virtual int mesh_get_morph_target_count(RID p_mesh) const=0; + virtual void mesh_set_blend_shape_count(RID p_mesh,int p_amount)=0; + virtual int mesh_get_blend_shape_count(RID p_mesh) const=0; - enum MorphTargetMode { - MORPH_MODE_NORMALIZED, - MORPH_MODE_RELATIVE, + enum BlendShapeMode { + BLEND_SHAPE_MODE_NORMALIZED, + BLEND_SHAPE_MODE_RELATIVE, }; - virtual void mesh_set_morph_target_mode(RID p_mesh,MorphTargetMode p_mode)=0; - virtual MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const=0; + virtual void mesh_set_blend_shape_mode(RID p_mesh,BlendShapeMode p_mode)=0; + virtual BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const=0; virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material)=0; virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const=0; @@ -706,7 +706,7 @@ public: virtual RID instance_create2(RID p_base, RID p_scenario); -// virtual RID instance_create(RID p_base,RID p_scenario)=0; // from can be mesh, light, area and portal so far. + //virtual RID instance_create(RID p_base,RID p_scenario)=0; // from can be mesh, light, area and portal so far. virtual RID instance_create()=0; // from can be mesh, light, poly, area and portal so far. virtual void instance_set_base(RID p_instance, RID p_base)=0; // from can be mesh, light, poly, area and portal so far. @@ -714,7 +714,7 @@ public: virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask)=0; virtual void instance_set_transform(RID p_instance, const Transform& p_transform)=0; virtual void instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID)=0; - virtual void instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight)=0; + virtual void instance_set_blend_shape_weight(RID p_instance,int p_shape, float p_weight)=0; virtual void instance_set_surface_material(RID p_instance,int p_surface, RID p_material)=0; virtual void instance_set_visible(RID p_instance,bool p_visible)=0; diff --git a/tools/collada/collada.cpp b/tools/collada/collada.cpp index 9f2416223e..daf30b00d7 100644 --- a/tools/collada/collada.cpp +++ b/tools/collada/collada.cpp @@ -103,7 +103,7 @@ Transform Collada::fix_transform(const Transform& p_transform) { } #endif -// tr.scale(Vector3(state.unit_scale.unit_scale.unit_scale)); + //tr.scale(Vector3(state.unit_scale.unit_scale.unit_scale)); return tr; //return state.matrix_fix * p_transform; } @@ -444,9 +444,11 @@ Vector<String> Collada::_read_string_array(XMLParser& parser) { // parse String data String str = parser.get_node_data(); array=str.split_spaces(); - //for(int i=0;i<array.size();i++) { - // print_line(itos(i)+": "+array[i]); - //} + /* + for(int i=0;i<array.size();i++) { + print_line(itos(i)+": "+array[i]); + } + */ } else if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END) @@ -1367,8 +1369,11 @@ void Collada::_parse_skin_controller(XMLParser& parser,String p_id) { skindata.weights=weights; - }// else if (!parser.is_empty()) - // parser.skip_section(); + } + /* + else if (!parser.is_empty()) + parser.skip_section(); + */ } else if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END && parser.get_node_name()=="skin") break; @@ -1396,7 +1401,7 @@ void Collada::_parse_skin_controller(XMLParser& parser,String p_id) { for(int i=0;i<joint_source.sarray.size();i++) { String name = joint_source.sarray[i]; - Transform xform = _read_transform_from_array(ibm_source.array,i*16);// <- this is a mistake, it must be applied to vertices + Transform xform = _read_transform_from_array(ibm_source.array,i*16); //<- this is a mistake, it must be applied to vertices xform.affine_invert(); // inverse for rest, because it's an inverse #ifdef COLLADA_IMPORT_SCALE_SCENE xform.origin*=state.unit_scale; @@ -1442,8 +1447,10 @@ void Collada::_parse_morph_controller(XMLParser& parser, String p_id) { } else if (section=="Name_array" || section=="IDREF_array") { // create a new array and read it. - //if (section=="IDREF_array") - // morphdata.use_idrefs=true; + /* + if (section=="IDREF_array") + morphdata.use_idrefs=true; + */ if (morphdata.sources.has(current_source)) { morphdata.sources[current_source].sarray = _read_string_array(parser); @@ -1491,8 +1498,10 @@ void Collada::_parse_morph_controller(XMLParser& parser, String p_id) { } - // else if (!parser.is_empty()) - // parser.skip_section(); + /* + else if (!parser.is_empty()) + parser.skip_section(); + */ } else if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END && parser.get_node_name()=="morph") break; @@ -1705,7 +1714,7 @@ Collada::Node* Collada::_parse_visual_scene_node(XMLParser& parser) { if ( parser.has_attribute("sid") ) { //bones may not have sid joint->sid=parser.get_attribute_value("sid"); -// state.bone_map[joint->sid]=joint; + //state.bone_map[joint->sid]=joint; } else if (state.idref_joints.has(name)) { joint->sid=name; //kind of a cheat but.. } else if (parser.has_attribute("name")) { diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp index 6b6a864ecc..f18265c541 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/doc/doc_data.cpp @@ -250,7 +250,7 @@ void DocData::generate(bool p_basic_types) { } else if (arginfo.type!=Variant::NIL) // { #endif method.return_type=(arginfo.hint==PROPERTY_HINT_RESOURCE_TYPE)?arginfo.hint_string:Variant::get_type_name(arginfo.type); -// } + //} } else { @@ -804,7 +804,7 @@ Error DocData::_load(Ref<XMLParser> parser) { class_list[name]=ClassDoc(); ClassDoc& c = class_list[name]; -// print_line("class: "+name); + //print_line("class: "+name); c.name=name; if (parser->has_attribute("inherits")) c.inherits = parser->get_attribute_value("inherits"); diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index be4d5f48e2..cb95f5fb7d 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -198,7 +198,7 @@ public: static void _bind_methods() { - // ClassDB::bind_method("_update_obj",&AnimationKeyEdit::_update_obj); + //ClassDB::bind_method("_update_obj",&AnimationKeyEdit::_update_obj); ClassDB::bind_method("_gui_input",&AnimationCurveEdit::_gui_input); ADD_SIGNAL(MethodInfo("transition_changed")); } @@ -647,8 +647,10 @@ public: } break; } - //if (animation->track_get_type(track)!=Animation::TYPE_METHOD) - // p_list->push_back( PropertyInfo( Variant::REAL, "easing", PROPERTY_HINT_EXP_EASING)); + /* + if (animation->track_get_type(track)!=Animation::TYPE_METHOD) + p_list->push_back( PropertyInfo( Variant::REAL, "easing", PROPERTY_HINT_EXP_EASING)); + */ } UndoRedo *undo_redo; @@ -1925,14 +1927,14 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent& p_input) { if (p_input.is_action("ui_up")) selected_track--; - if (v_scroll->is_visible() && p_input.is_action("ui_page_up")) + if (v_scroll->is_visible_in_tree() && p_input.is_action("ui_page_up")) selected_track--; if (selected_track<0) selected_track=0; - if (v_scroll->is_visible()) { + if (v_scroll->is_visible_in_tree()) { if (v_scroll->get_value() > selected_track) v_scroll->set_value(selected_track); @@ -1947,13 +1949,13 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent& p_input) { if (p_input.is_action("ui_down")) selected_track++; - else if (v_scroll->is_visible() && p_input.is_action("ui_page_down")) + else if (v_scroll->is_visible_in_tree() && p_input.is_action("ui_page_down")) selected_track+=v_scroll->get_page(); if (selected_track >= animation->get_track_count()) selected_track=animation->get_track_count()-1; - if (v_scroll->is_visible() && v_scroll->get_page()+v_scroll->get_value() < selected_track+1) { + if (v_scroll->is_visible_in_tree() && v_scroll->get_page()+v_scroll->get_value() < selected_track+1) { v_scroll->set_value(selected_track-v_scroll->get_page()+1); } @@ -2641,8 +2643,10 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent& p_input) { for(Map<SelectedKey,KeyInfo>::Element *E=selection.back();E;E=E->prev()) { float newpos=E->get().pos-from_t+motion; - //if (newpos<0) - // continue; //no add at the begining + /* + if (newpos<0) + continue; //no add at the begining + */ undo_redo->add_do_method(animation.ptr(),"track_insert_key",E->key().track,newpos,animation->track_get_key_value(E->key().track,E->key().key),animation->track_get_key_transition(E->key().track,E->key().key)); } @@ -2651,8 +2655,10 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent& p_input) { for(Map<SelectedKey,KeyInfo>::Element *E=selection.back();E;E=E->prev()) { float newpos=E->get().pos+-from_t+motion; - //if (newpos<0) - // continue; //no remove what no inserted + /* + if (newpos<0) + continue; //no remove what no inserted + */ undo_redo->add_undo_method(animation.ptr(),"track_remove_key_at_pos",E->key().track,newpos); } @@ -2690,7 +2696,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent& p_input) { float oldpos=E->get().pos; float newpos=oldpos-from_t+motion; //if (newpos>=0) - undo_redo->add_do_method(this,"_select_at_anim",animation,E->key().track,newpos); + undo_redo->add_do_method(this,"_select_at_anim",animation,E->key().track,newpos); undo_redo->add_undo_method(this,"_select_at_anim",animation,E->key().track,oldpos); } @@ -3148,7 +3154,7 @@ void AnimationKeyEditor::_notification(int p_what) { } call_select->connect("selected",this,"_add_call_track"); -// rename_anim->set_icon( get_icon("Rename","EditorIcons") ); + //rename_anim->set_icon( get_icon("Rename","EditorIcons") ); /* edit_anim->set_icon( get_icon("Edit","EditorIcons") ); blend_anim->set_icon( get_icon("Blend","EditorIcons") ); @@ -3156,8 +3162,8 @@ void AnimationKeyEditor::_notification(int p_what) { stop->set_icon( get_icon("Stop","EditorIcons") ); pause->set_icon( get_icon("Pause","EditorIcons") ); */ -// menu->set_icon(get_icon("Animation","EditorIcons")); -// play->set_icon(get_icon("AnimationPlay","EditorIcons")); + //menu->set_icon(get_icon("Animation","EditorIcons")); + //play->set_icon(get_icon("AnimationPlay","EditorIcons")); //menu->set_icon(get_icon("Animation","EditorIcons")); _update_menu(); @@ -3270,7 +3276,7 @@ Node *AnimationKeyEditor::get_root() const { void AnimationKeyEditor::update_keying() { - bool keying_enabled=is_visible() && animation.is_valid(); + bool keying_enabled=is_visible_in_tree() && animation.is_valid(); if (keying_enabled==keying) return; @@ -3289,14 +3295,14 @@ bool AnimationKeyEditor::has_keying() const { void AnimationKeyEditor::_query_insert(const InsertData& p_id) { - if (insert_frame!=OS::get_singleton()->get_frames_drawn()) { + if (insert_frame!=Engine::get_singleton()->get_frames_drawn()) { //clear insert list for the frame if frame changed - if (insert_confirm->is_visible()) + if (insert_confirm->is_visible_in_tree()) return; //do nothing insert_data.clear(); insert_query=false; } - insert_frame=OS::get_singleton()->get_frames_drawn(); + insert_frame=Engine::get_singleton()->get_frames_drawn(); for (List<InsertData>::Element *E=insert_data.front();E;E=E->next()) { //prevent insertion of multiple tracks @@ -3920,7 +3926,7 @@ void AnimationKeyEditor::_bind_methods() { ClassDB::bind_method(_MD("set_root"),&AnimationKeyEditor::set_root); -// ClassDB::bind_method(_MD("_confirm_insert"),&AnimationKeyEditor::_confirm_insert); + //ClassDB::bind_method(_MD("_confirm_insert"),&AnimationKeyEditor::_confirm_insert); ClassDB::bind_method(_MD("_confirm_insert_list"),&AnimationKeyEditor::_confirm_insert_list); @@ -4001,7 +4007,7 @@ AnimationKeyEditor::AnimationKeyEditor() { //menu->set_pos(Point2()); //add_child(menu); - zoomicon = memnew( TextureFrame ); + zoomicon = memnew( TextureRect ); hb->add_child(zoomicon); zoomicon->set_tooltip(TTR("Animation zoom.")); @@ -4143,9 +4149,9 @@ AnimationKeyEditor::AnimationKeyEditor() { /* l = memnew( Label ); l->set_text("Base: "); l->set_pos(Point2(0,3)); -// dr_panel->add_child(l);*/ + //dr_panel->add_child(l);*/ -// menu->get_popup()->connect("id_pressed",this,"_menu_callback"); + //menu->get_popup()->connect("id_pressed",this,"_menu_callback"); hb = memnew( HBoxContainer); diff --git a/tools/editor/animation_editor.h b/tools/editor/animation_editor.h index 0c9b0b5ac6..c4539cd763 100644 --- a/tools/editor/animation_editor.h +++ b/tools/editor/animation_editor.h @@ -33,7 +33,7 @@ #include "scene/gui/slider.h" #include "scene/gui/menu_button.h" #include "scene/gui/spin_box.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/scroll_bar.h" #include "scene/gui/tool_button.h" #include "scene/gui/file_dialog.h" @@ -177,7 +177,7 @@ class AnimationKeyEditor : public VBoxContainer { PopupMenu *type_menu; Control *ec; - TextureFrame *zoomicon; + TextureRect *zoomicon; HSlider *zoom; //MenuButton *menu; SpinBox *length; @@ -347,7 +347,7 @@ public: void insert_value_key(const String& p_property, const Variant& p_value, bool p_advance); void insert_transform_key(Spatial *p_node,const String& p_sub,const Transform& p_xform); - void show_select_node_warning(bool p_show) { select_anim_warning->set_hidden(!p_show); } + void show_select_node_warning(bool p_show) { select_anim_warning->set_visible(p_show); } AnimationKeyEditor(); ~AnimationKeyEditor(); }; diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp index 11d7a2b58b..ad17364685 100644 --- a/tools/editor/asset_library_editor_plugin.cpp +++ b/tools/editor/asset_library_editor_plugin.cpp @@ -147,7 +147,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { vb->add_child(rating_hb); for(int i=0;i<5;i++) { - stars[i]=memnew(TextureFrame); + stars[i]=memnew(TextureRect); rating_hb->add_child(stars[i]); } price = memnew( Label ); @@ -296,7 +296,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { desc_bg->add_child(description); desc_bg->add_style_override("panel",get_stylebox("normal","TextEdit")); - preview = memnew( TextureFrame ); + preview = memnew( TextureRect ); preview->set_custom_minimum_size(Size2(640,345)); hbox->add_child(preview); @@ -485,7 +485,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { HBoxContainer *hb = memnew( HBoxContainer); add_child(hb); - icon = memnew( TextureFrame ); + icon = memnew( TextureRect ); hb->add_child(icon); VBoxContainer *vb = memnew( VBoxContainer ); @@ -555,7 +555,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { void EditorAssetLibrary::_notification(int p_what) { if (p_what==NOTIFICATION_READY) { - TextureFrame *tf = memnew(TextureFrame); + TextureRect *tf = memnew(TextureRect); tf->set_texture(get_icon("Error","EditorIcons")); reverse->set_icon(get_icon("Updown","EditorIcons")); @@ -564,7 +564,7 @@ void EditorAssetLibrary::_notification(int p_what) { } if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - if(!is_hidden()) { + if(is_visible()) { _repository_changed(0); // Update when shown for the first time } } @@ -574,8 +574,8 @@ void EditorAssetLibrary::_notification(int p_what) { HTTPClient::Status s = request->get_http_client_status(); bool visible = s!=HTTPClient::STATUS_DISCONNECTED; - if (visible != !load_status->is_hidden()) { - load_status->set_hidden(!visible); + if (visible != load_status->is_visible()) { + load_status->set_visible(visible); } if (visible) { @@ -599,8 +599,8 @@ void EditorAssetLibrary::_notification(int p_what) { } bool no_downloads = downloads_hb->get_child_count()==0; - if (no_downloads != downloads_scroll->is_hidden()) { - downloads_scroll->set_hidden(no_downloads); + if (no_downloads == downloads_scroll->is_visible()) { + downloads_scroll->set_visible(!no_downloads); } } @@ -1462,7 +1462,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { library_vb->set_h_size_flags(SIZE_EXPAND_FILL); library_vb_border->add_child(library_vb); -// margin_panel->set_stop_mouse(false); + //margin_panel->set_stop_mouse(false); asset_top_page = memnew( HBoxContainer ); library_vb->add_child(asset_top_page); diff --git a/tools/editor/asset_library_editor_plugin.h b/tools/editor/asset_library_editor_plugin.h index 4ae229cefe..0598ea90ea 100644 --- a/tools/editor/asset_library_editor_plugin.h +++ b/tools/editor/asset_library_editor_plugin.h @@ -58,7 +58,7 @@ class EditorAssetLibraryItem : public PanelContainer { LinkButton* title; LinkButton* category; LinkButton* author; - TextureFrame *stars[5]; + TextureRect *stars[5]; Label* price; int asset_id; @@ -104,7 +104,7 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog { }; Vector<Preview> preview_images; - TextureFrame *preview; + TextureRect *preview; void set_image(int p_type,int p_index,const Ref<Texture>& p_image); @@ -138,7 +138,7 @@ class EditorAssetLibraryItemDownload : public PanelContainer { GDCLASS(EditorAssetLibraryItemDownload, PanelContainer); - TextureFrame *icon; + TextureRect *icon; Label* title; ProgressBar *progress; Button *install; diff --git a/tools/editor/call_dialog.cpp b/tools/editor/call_dialog.cpp index 054a5098f0..f8966093f6 100644 --- a/tools/editor/call_dialog.cpp +++ b/tools/editor/call_dialog.cpp @@ -283,7 +283,7 @@ CallDialog::CallDialog() { property_editor->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, 15 ); property_editor->set_anchor_and_margin( MARGIN_TOP, ANCHOR_BEGIN, 50 ); -// property_editor->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.55 ); + //property_editor->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.55 ); property_editor->set_anchor_and_margin( MARGIN_BOTTOM, ANCHOR_END, 90 ); property_editor->get_scene_tree()->set_hide_root( true ); property_editor->hide_top_label(); diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index 0d7dc558ac..00767fd297 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -91,7 +91,7 @@ void FindReplaceBar::_notification(int p_what) { } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { - set_process_unhandled_input(is_visible()); + set_process_unhandled_input(is_visible_in_tree()); } } @@ -377,7 +377,7 @@ void FindReplaceBar::popup_search() { void FindReplaceBar::popup_replace() { - if (!replace_hbc->is_visible() || !replace_options_hbc->is_visible()) { + if (!replace_hbc->is_visible_in_tree() || !replace_options_hbc->is_visible_in_tree()) { replace_text->clear(); replace_hbc->show(); replace_options_hbc->show(); @@ -396,7 +396,7 @@ void FindReplaceBar::_search_options_changed(bool p_pressed) { void FindReplaceBar::_editor_text_changed() { - if (is_visible()) { + if (is_visible_in_tree()) { preserve_cursor=true; search_current(); preserve_cursor=false; @@ -714,7 +714,7 @@ void FindReplaceDialog::_replace() { } text_edit->set_v_scroll(vsval); -// text_edit->set_h_scroll(hsval); + //text_edit->set_h_scroll(hsval); error_label->set_text(vformat(TTR("Replaced %d ocurrence(s)."),rc)); @@ -801,7 +801,7 @@ void FindReplaceDialog::_skip_pressed() { bool FindReplaceDialog::is_replace_mode() const { - return replace_text->is_visible(); + return replace_text->is_visible_in_tree(); } bool FindReplaceDialog::is_replace_all_mode() const { @@ -826,7 +826,7 @@ void FindReplaceDialog::ok_pressed() { void FindReplaceDialog::_search_text_entered(const String& p_text) { - if (replace_text->is_visible()) + if (replace_text->is_visible_in_tree()) return; emit_signal("search"); _search(); @@ -835,7 +835,7 @@ void FindReplaceDialog::_search_text_entered(const String& p_text) { void FindReplaceDialog::_replace_text_entered(const String& p_text) { - if (!replace_text->is_visible()) + if (!replace_text->is_visible_in_tree()) return; emit_signal("search"); @@ -951,7 +951,7 @@ FindReplaceDialog::FindReplaceDialog() { VBoxContainer *rvb = memnew( VBoxContainer); opt_mg->add_child(rvb); replace_vb=rvb; -// rvb ->add_child(memnew(HSeparator)); + //rvb ->add_child(memnew(HSeparator)); rvb ->add_child(memnew(Label)); prompt = memnew( CheckButton ); @@ -1061,7 +1061,7 @@ void CodeTextEditor::_text_changed() { } void CodeTextEditor::_code_complete_timer_timeout() { - if (!is_visible()) + if (!is_visible_in_tree()) return; if (enable_complete_timer) text_editor->query_code_comple(); diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp index 6e53c32080..92dd206030 100644 --- a/tools/editor/connections_dialog.cpp +++ b/tools/editor/connections_dialog.cpp @@ -421,7 +421,7 @@ ConnectDialog::ConnectDialog() { -// dst_method_list->get_popup()->connect("id_pressed", this,"_dst_method_list_selected"); + //dst_method_list->get_popup()->connect("id_pressed", this,"_dst_method_list_selected"); tree->connect("node_selected", this,"_tree_node_selected"); set_as_toplevel(true); @@ -432,7 +432,7 @@ ConnectDialog::ConnectDialog() { add_child(error); error->get_ok()->set_text(TTR("Close")); get_ok()->set_text(TTR("Connect")); -// error->get_cancel()->set_text("Close"); + //error->get_cancel()->set_text("Close"); @@ -857,7 +857,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) { hb->add_spacer(); hb->add_child(connect_button); connect_button->connect("pressed",this,"_connect_pressed"); -// add_child(tree); + //add_child(tree); connect_dialog = memnew( ConnectDialog ); connect_dialog->set_as_toplevel(true); diff --git a/tools/editor/connections_dialog.h b/tools/editor/connections_dialog.h index bfc75266e9..64b292bc34 100644 --- a/tools/editor/connections_dialog.h +++ b/tools/editor/connections_dialog.h @@ -77,7 +77,7 @@ protected: public: - bool get_make_callback() { return !make_callback->is_hidden() && make_callback->is_pressed(); } + bool get_make_callback() { return make_callback->is_visible() && make_callback->is_pressed(); } NodePath get_dst_path() const; StringName get_dst_method() const; bool get_deferred() const; @@ -86,8 +86,8 @@ public: void set_dst_method(const StringName& p_method); void set_dst_node(Node* p_node); -// Button *get_ok() { return ok; } -// Button *get_cancel() { return cancel; } + //Button *get_ok() { return ok; } + //Button *get_cancel() { return cancel; } void edit(Node *p_node); ConnectDialog(); diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp index 3e057ecf90..b69234e704 100644 --- a/tools/editor/create_dialog.cpp +++ b/tools/editor/create_dialog.cpp @@ -369,7 +369,7 @@ void CreateDialog::_notification(int p_what) { if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - if (is_visible()) { + if (is_visible_in_tree()) { search_box->call_deferred("grab_focus"); // still not visible search_box->select_all(); @@ -694,7 +694,7 @@ CreateDialog::CreateDialog() { set_hide_on_ok(false); search_options->connect("item_activated",this,"_confirmed"); search_options->connect("cell_selected",this,"_item_selected"); -// search_options->set_hide_root(true); + //search_options->set_hide_root(true); base_type="Object"; help_bit = memnew( EditorHelpBit ); diff --git a/tools/editor/editor_asset_installer.cpp b/tools/editor/editor_asset_installer.cpp index 54099ddce5..9992100ff8 100644 --- a/tools/editor/editor_asset_installer.cpp +++ b/tools/editor/editor_asset_installer.cpp @@ -196,7 +196,7 @@ void EditorAssetInstaller::open(const String& p_path,int p_depth) { ti->set_icon(0,get_icon("folder","FileDialog")); } else { String file = path.get_file(); - String extension = file.extension().to_lower(); + String extension = file.get_extension().to_lower(); if (extension_guess.has(extension)) { ti->set_icon(0,extension_guess[extension]); } else { diff --git a/tools/editor/editor_autoload_settings.cpp b/tools/editor/editor_autoload_settings.cpp index 071a237ea8..087bf1a3b7 100644 --- a/tools/editor/editor_autoload_settings.cpp +++ b/tools/editor/editor_autoload_settings.cpp @@ -307,7 +307,7 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu void EditorAutoloadSettings::_autoload_file_callback(const String& p_path) { - autoload_add_name->set_text(p_path.get_file().basename()); + autoload_add_name->set_text(p_path.get_file().get_basename()); } void EditorAutoloadSettings::update_autoload() { diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index 710d955326..08b03ae65f 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -524,8 +524,10 @@ 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; @@ -814,7 +816,7 @@ EditorData::EditorData() { current_edited_scene=-1; -// load_imported_scenes_from_globals(); + //load_imported_scenes_from_globals(); } /////////// diff --git a/tools/editor/editor_dir_dialog.cpp b/tools/editor/editor_dir_dialog.cpp index 56f9a0fb0b..e2b7d475b0 100644 --- a/tools/editor/editor_dir_dialog.cpp +++ b/tools/editor/editor_dir_dialog.cpp @@ -78,7 +78,7 @@ void EditorDirDialog::_update_dir(TreeItem* p_item) { void EditorDirDialog::reload() { - if (!is_visible()) { + if (!is_visible_in_tree()) { must_reload=true; return; } @@ -111,7 +111,7 @@ void EditorDirDialog::_notification(int p_what) { } if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - if (must_reload && is_visible()) { + if (must_reload && is_visible_in_tree()) { reload(); } } @@ -255,7 +255,7 @@ EditorDirDialog::EditorDirDialog() { VBoxContainer *makevb= memnew( VBoxContainer ); makedialog->add_child(makevb); -// makedialog->set_child_rect(makevb); + //makedialog->set_child_rect(makevb); makedirname = memnew( LineEdit ); makevb->add_margin_child(TTR("Name:"),makedirname); diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index 408818f729..d4ca515493 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -218,10 +218,10 @@ void EditorFileDialog::_post_popup() { else item_list->grab_focus(); - if (is_visible() && get_current_file()!="") + if (is_visible_in_tree() && get_current_file()!="") _request_single_thumbnail(get_current_dir().plus_file(get_current_file())); - if (is_visible()) { + if (is_visible_in_tree()) { Ref<Texture> folder = get_icon("folder","FileDialog"); recent->clear(); @@ -713,8 +713,10 @@ void EditorFileDialog::update_file_list() { } // ?? - //if (tree->get_root() && tree->get_root()->get_children()) - // tree->get_root()->get_children()->select(0); + /* + if (tree->get_root() && tree->get_root()->get_children()) + tree->get_root()->get_children()->select(0); + */ files.clear(); @@ -806,7 +808,7 @@ void EditorFileDialog::set_current_file(const String& p_file) { file->grab_focus(); } - if (is_visible()) + if (is_visible_in_tree()) _request_single_thumbnail(get_current_dir().plus_file(get_current_file())); @@ -882,7 +884,7 @@ void EditorFileDialog::set_access(Access p_access) { void EditorFileDialog::invalidate() { - if (is_visible()) { + if (is_visible_in_tree()) { update_file_list(); invalidated=false; } else { @@ -1405,7 +1407,7 @@ EditorFileDialog::EditorFileDialog() { filter_hb->add_child(preview_vb); CenterContainer *prev_cc = memnew( CenterContainer ); preview_vb->add_margin_child(TTR("Preview:"),prev_cc); - preview = memnew( TextureFrame ); + preview = memnew( TextureRect ); prev_cc->add_child(preview); preview_vb->hide(); diff --git a/tools/editor/editor_file_dialog.h b/tools/editor/editor_file_dialog.h index e2a40cd5df..193cbc513c 100644 --- a/tools/editor/editor_file_dialog.h +++ b/tools/editor/editor_file_dialog.h @@ -35,7 +35,7 @@ #include "scene/gui/option_button.h" #include "os/dir_access.h" #include "scene/gui/box_container.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/tool_button.h" /** @author Juan Linietsky <reduzio@gmail.com> @@ -93,7 +93,7 @@ private: OptionButton *drives; ItemList *item_list; - TextureFrame *preview; + TextureRect *preview; VBoxContainer *preview_vb; HBoxContainer *list_hb; LineEdit *file; diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index 5fb274f38f..1d32415be9 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -378,7 +378,7 @@ void EditorFileSystem::_scan_filesystem() { //save back the findings -// String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("file_cache"); + //String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("file_cache"); f=FileAccess::open(fscache,FileAccess::WRITE); _save_filesystem_cache(new_filesystem,f); @@ -502,7 +502,7 @@ void EditorFileSystem::scan() { _scan_filesystem(); if (filesystem) memdelete(filesystem); -// file_type_cache.clear(); + //file_type_cache.clear(); filesystem=new_filesystem; new_filesystem=NULL; _update_scan_actions(); @@ -670,7 +670,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess for (List<String>::Element*E=files.front();E;E=E->next(),idx++) { - String ext = E->get().extension().to_lower(); + String ext = E->get().get_extension().to_lower(); if (!valid_extensions.has(ext)) continue; //invalid @@ -789,7 +789,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S } else { - String ext = f.extension().to_lower(); + String ext = f.get_extension().to_lower(); if (!valid_extensions.has(ext)) continue; //invalid @@ -1198,7 +1198,7 @@ EditorFileSystemDirectory* EditorFileSystem::find_file(const String& p_file,int* } -EditorFileSystemDirectory *EditorFileSystem::get_path(const String& p_path) { +EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String& p_path) { if (!filesystem || scanning) return NULL; @@ -1352,7 +1352,7 @@ void EditorFileSystem::_bind_methods() { ClassDB::bind_method(_MD("scan"),&EditorFileSystem::scan); ClassDB::bind_method(_MD("scan_sources"),&EditorFileSystem::scan_sources); ClassDB::bind_method(_MD("update_file","path"),&EditorFileSystem::update_file); - ClassDB::bind_method(_MD("get_path:EditorFileSystemDirectory","path"),&EditorFileSystem::get_path); + ClassDB::bind_method(_MD("get_filesystem_path:EditorFileSystemDirectory","path"),&EditorFileSystem::get_filesystem_path); ClassDB::bind_method(_MD("get_file_type","path"),&EditorFileSystem::get_file_type); ADD_SIGNAL( MethodInfo("filesystem_changed") ); diff --git a/tools/editor/editor_file_system.h b/tools/editor/editor_file_system.h index 97c253c70b..3a26f46aa9 100644 --- a/tools/editor/editor_file_system.h +++ b/tools/editor/editor_file_system.h @@ -233,7 +233,7 @@ public: void get_changed_sources(List<String> *r_changed); void update_file(const String& p_file); String find_resource_from_source(const String& p_path) const; - EditorFileSystemDirectory *get_path(const String& p_path); + EditorFileSystemDirectory *get_filesystem_path(const String& p_path); String get_file_type(const String& p_file) const; EditorFileSystemDirectory* find_file(const String& p_file,int* r_index) const; diff --git a/tools/editor/editor_fonts.cpp b/tools/editor/editor_fonts.cpp index 3e128e7759..3c846fc538 100644 --- a/tools/editor/editor_fonts.cpp +++ b/tools/editor/editor_fonts.cpp @@ -127,9 +127,9 @@ void editor_register_fonts(Ref<Theme> p_theme) { p_theme->set_default_theme_font(df); -// Ref<BitmapFont> doc_font = make_font(_bi_font_doc_font_height,_bi_font_doc_font_ascent,0,_bi_font_doc_font_charcount,_bi_font_doc_font_characters,p_theme->get_icon("DocFont","EditorIcons")); -// Ref<BitmapFont> doc_title_font = make_font(_bi_font_doc_title_font_height,_bi_font_doc_title_font_ascent,0,_bi_font_doc_title_font_charcount,_bi_font_doc_title_font_characters,p_theme->get_icon("DocTitleFont","EditorIcons")); -// Ref<BitmapFont> doc_code_font = make_font(_bi_font_doc_code_font_height,_bi_font_doc_code_font_ascent,0,_bi_font_doc_code_font_charcount,_bi_font_doc_code_font_characters,p_theme->get_icon("DocCodeFont","EditorIcons")); + //Ref<BitmapFont> doc_font = make_font(_bi_font_doc_font_height,_bi_font_doc_font_ascent,0,_bi_font_doc_font_charcount,_bi_font_doc_font_characters,p_theme->get_icon("DocFont","EditorIcons")); + //Ref<BitmapFont> doc_title_font = make_font(_bi_font_doc_title_font_height,_bi_font_doc_title_font_ascent,0,_bi_font_doc_title_font_charcount,_bi_font_doc_title_font_characters,p_theme->get_icon("DocTitleFont","EditorIcons")); + //Ref<BitmapFont> doc_code_font = make_font(_bi_font_doc_code_font_height,_bi_font_doc_code_font_ascent,0,_bi_font_doc_code_font_charcount,_bi_font_doc_code_font_characters,p_theme->get_icon("DocCodeFont","EditorIcons")); MAKE_DROID_SANS(df_title,int(EDITOR_DEF("text_editor/help/help_title_font_size",18))*EDSCALE); diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 11eeaffdb6..f96a02bc52 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -287,7 +287,7 @@ void EditorHelpSearch::_notification(int p_what) { if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - if (is_visible()) { + if (is_visible_in_tree()) { search_box->call_deferred("grab_focus"); // still not visible search_box->select_all(); @@ -334,7 +334,7 @@ EditorHelpSearch::EditorHelpSearch() { search_options->connect("item_activated",this,"_confirmed"); set_title(TTR("Search Help")); -// search_options->set_hide_root(true); + //search_options->set_hide_root(true); } @@ -349,8 +349,10 @@ void EditorHelpIndex::add_type(const String& p_type,HashMap<String,TreeItem*>& p if (p_types.has(p_type)) return; -// if (!ClassDB::is_type(p_type,base) || p_type==base) -// return; + /* + if (!ClassDB::is_type(p_type,base) || p_type==base) + return; + */ String inherits=EditorHelp::get_doc_data()->class_list[p_type].inherits; @@ -538,7 +540,7 @@ DocData *EditorHelp::doc=NULL; void EditorHelp::_unhandled_key_input(const InputEvent& p_ev) { - if (!is_visible()) + if (!is_visible_in_tree()) return; if ( p_ev.key.mod.control && p_ev.key.scancode==KEY_F) { @@ -571,15 +573,15 @@ void EditorHelp::_button_pressed(int p_idx) { if (p_idx==PAGE_CLASS_LIST) { - // edited_class->set_pressed(false); - // class_list_button->set_pressed(true); - // tabs->set_current_tab(PAGE_CLASS_LIST); + //edited_class->set_pressed(false); + //class_list_button->set_pressed(true); + //tabs->set_current_tab(PAGE_CLASS_LIST); } else if (p_idx==PAGE_CLASS_DESC) { - // edited_class->set_pressed(true); - // class_list_button->set_pressed(false); - // tabs->set_current_tab(PAGE_CLASS_DESC); + //edited_class->set_pressed(true); + //class_list_button->set_pressed(false); + //tabs->set_current_tab(PAGE_CLASS_DESC); } else if (p_idx==PAGE_CLASS_PREV) { @@ -619,7 +621,7 @@ void EditorHelp::_class_desc_select(const String& p_select) { -// print_line("LINK: "+p_select); + //print_line("LINK: "+p_select); if (p_select.begins_with("#")) { //_goto_desc(p_select.substr(1,p_select.length())); emit_signal("go_to_help","class_name:"+p_select.substr(1,p_select.length())); @@ -674,7 +676,7 @@ void EditorHelp::_scroll_changed(double p_scroll) { if (scroll_locked) return; - if (class_desc->get_v_scroll()->is_hidden()) + if (!class_desc->get_v_scroll()->is_visible()) p_scroll=0; //history[p].scroll=p_scroll; @@ -824,7 +826,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->add_text(TTR("Members:")); class_desc->pop(); class_desc->pop(); -// class_desc->add_newline(); + //class_desc->add_newline(); class_desc->push_indent(1); class_desc->push_table(2); @@ -924,7 +926,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->pop(); //class_desc->add_newline(); -// class_desc->add_newline(); + //class_desc->add_newline(); class_desc->push_indent(1); class_desc->push_table(2); @@ -997,7 +999,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { } class_desc->pop();//monofont -// class_desc->add_newline(); + //class_desc->add_newline(); class_desc->pop(); //cell } @@ -1734,8 +1736,8 @@ void EditorHelp::_notification(int p_what) { case NOTIFICATION_READY: { -// forward->set_icon(get_icon("Forward","EditorIcons")); -// back->set_icon(get_icon("Back","EditorIcons")); + //forward->set_icon(get_icon("Forward","EditorIcons")); + //back->set_icon(get_icon("Back","EditorIcons")); _update_doc(); } break; @@ -1789,7 +1791,7 @@ void EditorHelp::_bind_methods() { ClassDB::bind_method("_class_list_select",&EditorHelp::_class_list_select); ClassDB::bind_method("_class_desc_select",&EditorHelp::_class_desc_select); ClassDB::bind_method("_class_desc_input",&EditorHelp::_class_desc_input); -// ClassDB::bind_method("_button_pressed",&EditorHelp::_button_pressed); + //ClassDB::bind_method("_button_pressed",&EditorHelp::_button_pressed); ClassDB::bind_method("_scroll_changed",&EditorHelp::_scroll_changed); ClassDB::bind_method("_request_help",&EditorHelp::_request_help); ClassDB::bind_method("_unhandled_key_input",&EditorHelp::_unhandled_key_input); @@ -1852,7 +1854,7 @@ EditorHelp::EditorHelp() { editor->get_gui_base()->add_child(class_search); class_search->connect("go_to_help",this,"_help_callback");*/ -// prev_search_page=-1; + //prev_search_page=-1; } EditorHelp::~EditorHelp() { @@ -1872,8 +1874,7 @@ void EditorHelpBit::_go_to_help(String p_what) { void EditorHelpBit::_meta_clicked(String p_select) { - - // print_line("LINK: "+p_select); + //print_line("LINK: "+p_select); if (p_select.begins_with("#")) { //_goto_desc(p_select.substr(1,p_select.length())); _go_to_help("class_name:"+p_select.substr(1,p_select.length())); @@ -1887,10 +1888,11 @@ void EditorHelpBit::_meta_clicked(String p_select) { _go_to_help("class_method:"+m.get_slice(".",0)+":"+m.get_slice(".",0)); } else { -// - // if (!method_line.has(m)) - // return; - //class_desc->scroll_to_line(method_line[m]); + /* + if (!method_line.has(m)) + return; + class_desc->scroll_to_line(method_line[m]); + */ } } diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index 0003e232c8..cf83052ee0 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -89,7 +89,7 @@ void EditorImportPlugin::_bind_methods() { ClassDB::add_virtual_method(get_class_static(),MethodInfo("reimport_multiple_files",PropertyInfo(Variant::POOL_STRING_ARRAY,"files"))); ClassDB::add_virtual_method(get_class_static(),MethodInfo(Variant::BOOL,"can_reimport_multiple_files")); -// BIND_VMETHOD( mi ); + //BIND_VMETHOD( mi ); } String EditorImportPlugin::get_name() const { @@ -420,11 +420,12 @@ Vector<StringName> EditorExportPlatform::get_dependencies(bool p_bundles) const { List<String> l; - // SceneLoader::get_recognized_extensions(&l); - // for(List<String>::Element *E=l.front();E;E=E->next()) { - // - // scene_extensions.insert(E->get()); - // } + /* + SceneLoader::get_recognized_extensions(&l); + for(List<String>::Element *E=l.front();E;E=E->next()) { + scene_extensions.insert(E->get()); + } + */ ResourceLoader::get_recognized_extensions_for_type("",&l); for(List<String>::Element *E=l.front();E;E=E->next()) { @@ -921,7 +922,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func options["lossy_quality"]=group_lossy_quality; options["shrink"]=EditorImportExport::get_singleton()->image_export_group_get_shrink(E->get()); options["image_format"]=group_format; -// f->store_line(options.to_json()); + //f->store_line(options.to_json()); f->store_line(image_list_md5); } @@ -949,7 +950,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func return ERR_CANT_CREATE; } Vector<uint8_t> data = FileAccess::get_file_as_array(path); - String dst_path = F->get().operator String().basename()+".atex"; + String dst_path = F->get().operator String().get_basename()+".atex"; err = p_func(p_udata,dst_path,data,counter++,files.size()); saved.insert(dst_path); if (err) @@ -958,7 +959,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func if (f) { //recreating deps.. String depline; -// depline=String(F->get())+"::"+itos(FileAccess::get_modified_time(F->get()))+"::"+FileAccess::get_md5(F->get()); name unneccesary by top md5 + //depline=String(F->get())+"::"+itos(FileAccess::get_modified_time(F->get()))+"::"+FileAccess::get_md5(F->get()); name unneccesary by top md5 depline=itos(FileAccess::get_modified_time(F->get()))+"::"+FileAccess::get_md5(F->get()); depline+="::"+itos(region.pos.x)+"::"+itos(region.pos.y)+"::"+itos(region.size.x)+"::"+itos(region.size.y); depline+="::"+itos(margin.pos.x)+"::"+itos(margin.pos.y)+"::"+itos(margin.size.x)+"::"+itos(margin.size.y); diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp index 16dfb7afb2..fd2da2e4c0 100644 --- a/tools/editor/editor_log.cpp +++ b/tools/editor/editor_log.cpp @@ -44,8 +44,10 @@ void EditorLog::_error_handler(void *p_self, const char*p_func, const char*p_fil err_str=String(p_file)+":"+itos(p_line)+" - "+String(p_error); } -// if (!self->is_visible()) -// self->emit_signal("show_request"); + /* + if (!self->is_visible_in_tree()) + self->emit_signal("show_request"); + */ err_str=" "+err_str; self->log->add_newline(); @@ -129,7 +131,7 @@ void EditorLog::add_message(const String& p_msg,bool p_error) { log->add_newline(); log->add_text(p_msg); -// button->set_text(p_msg); + //button->set_text(p_msg); if (p_error) log->pop(); diff --git a/tools/editor/editor_log.h b/tools/editor/editor_log.h index e59b877ea0..965d8d6420 100644 --- a/tools/editor/editor_log.h +++ b/tools/editor/editor_log.h @@ -36,7 +36,7 @@ //#include "scene/gui/empty_control.h" #include "scene/gui/box_container.h" #include "scene/gui/panel_container.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/tool_button.h" #include "pane_drag.h" #include "os/thread.h" @@ -48,7 +48,7 @@ class EditorLog : public VBoxContainer { Label *title; RichTextLabel *log; HBoxContainer *title_hb; -// PaneDrag *pd; + //PaneDrag *pd; Control *ec; PanelContainer *pc; @@ -58,7 +58,7 @@ class EditorLog : public VBoxContainer { Thread::ID current; -// void _dragged(const Point2& p_ofs); + //void _dragged(const Point2& p_ofs); void _clear_request(); static void _undo_redo_cbk(void *p_self,const String& p_name); protected: diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 98c59208d2..bb33f19a2b 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -241,7 +241,7 @@ void EditorNode::_notification(int p_what) { } #endif - if (opening_prev && confirmation->is_hidden()) + if (opening_prev && !confirmation->is_visible()) opening_prev=false; if (unsaved_cache != (saved_version!=editor_data.get_undo_redo().get_version())) { @@ -258,7 +258,7 @@ void EditorNode::_notification(int p_what) { //get_root_node()->set_rect(viewport->get_global_rect()); //update the circle - uint64_t frame = OS::get_singleton()->get_frames_drawn(); + uint64_t frame = Engine::get_singleton()->get_frames_drawn(); uint32_t tick = OS::get_singleton()->get_ticks_msec(); if (frame!=circle_step_frame && (tick-circle_step_msec)>(1000/8)) { @@ -322,8 +322,8 @@ void EditorNode::_notification(int p_what) { } if (p_what==NOTIFICATION_READY) { - VisualServer::get_singleton()->viewport_set_hide_scenario(get_scene_root()->get_viewport(),true); - VisualServer::get_singleton()->viewport_set_hide_canvas(get_scene_root()->get_viewport(),true); + VisualServer::get_singleton()->viewport_set_hide_scenario(get_scene_root()->get_viewport_rid(),true); + VisualServer::get_singleton()->viewport_set_hide_canvas(get_scene_root()->get_viewport_rid(),true); VisualServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(),true); _editor_select(EDITOR_3D); @@ -557,8 +557,10 @@ void EditorNode::save_resource_in_path(const Ref<Resource>& p_resource,const Str int flg=0; if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) flg|=ResourceSaver::FLAG_COMPRESS; - //if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) - // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + /* + if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) + flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + */ String path = GlobalConfig::get_singleton()->localize_path(p_path); Error err = ResourceSaver::save(path,p_resource,flg|ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); @@ -568,7 +570,7 @@ void EditorNode::save_resource_in_path(const Ref<Resource>& p_resource,const Str accept->popup_centered_minsize(); return; } -// EditorFileSystem::get_singleton()->update_file(path,p_resource->get_type()); + //EditorFileSystem::get_singleton()->update_file(path,p_resource->get_type()); ((Resource*)p_resource.ptr())->set_path(path); emit_signal("resource_saved",p_resource); @@ -623,7 +625,7 @@ void EditorNode::save_resource_as(const Ref<Resource>& p_resource,const String& file->set_current_path(p_resource->get_path()); if (extensions.size()) { - String ext=p_resource->get_path().extension().to_lower(); + String ext=p_resource->get_path().get_extension().to_lower(); if (extensions.find(ext)==NULL) { file->set_current_path(p_resource->get_path().replacen("."+ext,"."+extensions.front()->get())); } @@ -666,11 +668,11 @@ void EditorNode::_dialog_display_file_error(String p_file,Error p_error) { case ERR_FILE_CANT_WRITE: { - accept->set_text(TTR("Can't open file for writing:")+" "+p_file.extension()); + accept->set_text(TTR("Can't open file for writing:")+" "+p_file.get_extension()); } break; case ERR_FILE_UNRECOGNIZED: { - accept->set_text(TTR("Requested file format unknown:")+" "+p_file.extension()); + accept->set_text(TTR("Requested file format unknown:")+" "+p_file.get_extension()); } break; default: { @@ -770,7 +772,7 @@ bool EditorNode::_find_and_save_resource(RES res,Map<RES,bool>& processed,int32_ bool subchanged = _find_and_save_edited_subresources(res.ptr(),processed,flags); -// print_line("checking if edited: "+res->get_type()+" :: "+res->get_name()+" :: "+res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged)); + //print_line("checking if edited: "+res->get_type()+" :: "+res->get_name()+" :: "+res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged)); if (res->get_path().is_resource_file()) { if (changed || subchanged) { @@ -890,10 +892,10 @@ void EditorNode::_save_scene_with_preview(String p_file) { RID viewport; bool is2d; if (c3d<c2d) { - viewport=scene_root->get_viewport(); + viewport=scene_root->get_viewport_rid(); is2d=true; } else { - viewport=SpatialEditor::get_singleton()->get_editor_viewport(0)->get_viewport_node()->get_viewport(); + viewport=SpatialEditor::get_singleton()->get_editor_viewport(0)->get_viewport_node()->get_viewport_rid(); is2d=false; } @@ -1005,8 +1007,10 @@ void EditorNode::_save_scene(String p_file, int idx) { int flg=0; if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) flg|=ResourceSaver::FLAG_COMPRESS; - //if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) - // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + /* + if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) + flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + */ flg|=ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS; @@ -1245,7 +1249,7 @@ void EditorNode::_dialog_action(String p_file) { ml = Ref<MeshLibrary>( memnew( MeshLibrary )); } -// MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(),ml,true); + //MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(),ml,true); Error err = ResourceSaver::save(p_file,ml); if (err) { @@ -1344,9 +1348,11 @@ void EditorNode::_dialog_action(String p_file) { unzCloseCurrentFile(pkg); print_line(fname); - //for(int i=0;i<512;i++) { - // print_line(itos(data[i])); - //} + /* + for(int i=0;i<512;i++) { + print_line(itos(data[i])); + } + */ file=file.get_file(); @@ -1671,7 +1677,7 @@ void EditorNode::_edit_current() { main_plugin->edit(current_obj); } - else if (main_plugin!=editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible() || ScriptEditor::get_singleton()->can_take_away_focus())) { + else if (main_plugin!=editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible_in_tree() || ScriptEditor::get_singleton()->can_take_away_focus())) { // update screen main_plugin if (!changing_scene) { @@ -2154,7 +2160,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { if (scene->get_filename()!="") { file->set_current_path(scene->get_filename()); if (extensions.size()) { - String ext=scene->get_filename().extension().to_lower(); + String ext=scene->get_filename().get_extension().to_lower(); if (extensions.find(ext)==NULL) { file->set_current_path(scene->get_filename().replacen("."+ext,"."+extensions.front()->get())); } @@ -2217,8 +2223,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { if (scene->get_filename()!="") { cpath = scene->get_filename(); - String fn = cpath.substr(0,cpath.length() - cpath.extension().size()); - String ext=cpath.extension(); + String fn = cpath.substr(0,cpath.length() - cpath.get_extension().size()); + String ext=cpath.get_extension(); cpath=fn+".pot"; @@ -2506,8 +2512,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { editor_data.get_undo_redo().add_undo_method(parent,"remove_child",instanced_scene); editor_data.get_undo_redo().commit_action(); -// parent->add_child(instanced_scene); -// instanced_scene->set_owner(edited_scene); + //parent->add_child(instanced_scene); + //instanced_scene->set_owner(edited_scene); _last_instanced_scene=instanced_scene; } break; @@ -3176,15 +3182,17 @@ void EditorNode::_remove_edited_scene() { _update_title(); _update_scene_tabs(); -// if (editor_data.get_edited_scene_count()==1) { -// //make new scene appear saved -// set_current_version(editor_data.get_undo_redo().get_version()); -// unsaved_cache=false; -// } + /* + if (editor_data.get_edited_scene_count()==1) { + //make new scene appear saved + set_current_version(editor_data.get_undo_redo().get_version()); + unsaved_cache=false; + } + */ } void EditorNode::_remove_scene(int index) { -// printf("Attempting to remove scene %d (current is %d)\n", index, editor_data.get_edited_scene()); + //printf("Attempting to remove scene %d (current is %d)\n", index, editor_data.get_edited_scene()); if (editor_data.get_edited_scene() == index) { //Scene to remove is current scene @@ -3278,8 +3286,8 @@ Error EditorNode::save_translatable_strings(const String& p_to_file) { f->store_line("msgstr \"\""); f->store_line("\"Report-Msgid-Bugs-To: <define>\\n\""); f->store_line("\"POT-Creation-Date: "+itos(date.year)+"-"+itos(date.month)+"-"+itos(date.day)+" "+itos(time.hour)+":"+itos(time.min)+"0000\\n\""); -// f->store_line("\"PO-Revision-Date: 2006-08-30 13:56-0700\\n\""); -// f->store_line("\"Last-Translator: Rubén C. DÃaz Alonso <outime@gmail.com>\\n\""); + //f->store_line("\"PO-Revision-Date: 2006-08-30 13:56-0700\\n\""); + //f->store_line("\"Last-Translator: Rubén C. DÃaz Alonso <outime@gmail.com>\\n\""); f->store_line("\"Language-Team: <define>\\n\""); f->store_line("\"MIME-Version: 1.0\\n\""); f->store_line("\"Content-Type: text/plain; charset=UTF-8\\n\""); @@ -3400,8 +3408,10 @@ Error EditorNode::save_optimized_copy(const String& p_scene,const String& p_pres uint32_t flags=0; -// if (saver->is_bundle_scenes_enabled()) -// flags|=ResourceSaver::FLAG_BUNDLE_INSTANCED_SCENES; + /* + if (saver->is_bundle_scenes_enabled()) + flags|=ResourceSaver::FLAG_BUNDLE_INSTANCED_SCENES; + */ if (saver->is_bundle_resources_enabled()) flags|=ResourceSaver::FLAG_BUNDLE_RESOURCES; if (saver->is_remove_editor_data_enabled()) @@ -3784,8 +3794,10 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo state->set_path(lpath); new_scene->set_scene_inherited_state(state); new_scene->set_filename(String()); - //if (new_scene->get_scene_instance_state().is_valid()) - // new_scene->get_scene_instance_state()->set_path(String()); + /* + if (new_scene->get_scene_instance_state().is_valid()) + new_scene->get_scene_instance_state()->set_path(String()); + */ } new_scene->set_scene_instance_state(Ref<SceneState>()); @@ -3801,7 +3813,7 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo */ editor_data.set_edited_scene_import_metadata( sdata->get_import_metadata() ); -// editor_data.get_undo_redo().clear_history(); + //editor_data.get_undo_redo().clear_history(); saved_version=editor_data.get_undo_redo().get_version(); _update_title(); _update_scene_tabs(); @@ -3893,17 +3905,17 @@ void EditorNode::update_keying() { void EditorNode::_close_messages() { -// left_split->set_dragger_visible(false); + //left_split->set_dragger_visible(false); old_split_ofs = center_split->get_split_offset(); center_split->set_split_offset(0); -// scene_root_parent->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_END,0); + //scene_root_parent->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_END,0); } void EditorNode::_show_messages() { -// left_split->set_dragger_visible(true); + //left_split->set_dragger_visible(true); center_split->set_split_offset(old_split_ofs); -// scene_root_parent->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_END,log->get_margin(MARGIN_TOP)); + //scene_root_parent->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_END,log->get_margin(MARGIN_TOP)); } @@ -3934,7 +3946,7 @@ void EditorNode::animation_editor_make_visible(bool p_visible) { } else { //pd_anim->hide(); animation_editor->hide(); -// scene_root_parent->set_margin(MARGIN_TOP,0); + //scene_root_parent->set_margin(MARGIN_TOP,0); if (!animation_vb->get_parent_control()) return; animation_vb->get_parent_control()->minimum_size_changed(); @@ -3989,7 +4001,7 @@ void EditorNode::_open_recent_scene(int p_idx) { void EditorNode::_save_optimized() { -// save_optimized_copy(optimized_save->get_optimized_scene(),optimized_save->get_preset()); + //save_optimized_copy(optimized_save->get_optimized_scene(),optimized_save->get_preset()); #if 0 String path = optimized_save->get_optimized_scene(); @@ -4159,7 +4171,7 @@ void EditorNode::register_editor_types() { //ClassDB::register_type<EditorImporter>(); -// ClassDB::register_type<EditorPostImport>(); + //ClassDB::register_type<EditorPostImport>(); } void EditorNode::unregister_editor_types() { @@ -4217,7 +4229,7 @@ void EditorNode::progress_end_task_bg(const String& p_task) { Ref<Texture> EditorNode::_file_dialog_get_icon(const String& p_path) { - EditorFileSystemDirectory *efsd = EditorFileSystem::get_singleton()->get_path(p_path.get_base_dir()); + EditorFileSystemDirectory *efsd = EditorFileSystem::get_singleton()->get_filesystem_path(p_path.get_base_dir()); if (efsd) { String file = p_path.get_file(); @@ -4510,7 +4522,7 @@ void EditorNode::_save_docks_to_config(Ref<ConfigFile> p_layout, const String& p for(int i=0;i<DOCK_SLOT_MAX/2;i++) { - if (splits[i]->is_visible()) { + if (splits[i]->is_visible_in_tree()) { p_layout->set_value(p_section,"dock_split_"+itos(i+1),splits[i]->get_split_offset()); } } @@ -4609,7 +4621,7 @@ void EditorNode::_update_dock_slots_visibility() { for(int i=0;i<DOCK_SLOT_MAX;i++) { - if (!dock_slot[i]->is_hidden() && dock_slot[i]->get_tab_count()) { + if (dock_slot[i]->is_visible() && dock_slot[i]->get_tab_count()) { dock_slot[i]->set_current_tab(0); } } @@ -4717,7 +4729,7 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String& for(int i=0;i<DOCK_SLOT_MAX;i++) { - if (!dock_slot[i]->is_hidden() && dock_slot[i]->get_tab_count()) { + if (dock_slot[i]->is_visible() && dock_slot[i]->get_tab_count()) { dock_slot[i]->set_current_tab(0); } } @@ -4955,7 +4967,7 @@ void EditorNode::remove_bottom_panel_item(Control *p_item) { for(int i=0;i<bottom_panel_items.size();i++) { if (bottom_panel_items[i].control==p_item) { - if (p_item->is_visible()) { + if (p_item->is_visible_in_tree()) { _bottom_panel_switch(false,0); } bottom_panel_vb->remove_child(bottom_panel_items[i].control); @@ -4982,7 +4994,7 @@ void EditorNode::_bottom_panel_switch(bool p_enable,int p_idx) { for(int i=0;i<bottom_panel_items.size();i++) { bottom_panel_items[i].button->set_pressed(i==p_idx); - bottom_panel_items[i].control->set_hidden(i!=p_idx); + bottom_panel_items[i].control->set_visible(i==p_idx); } center_split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE); center_split->set_collapsed(false); @@ -4990,7 +5002,7 @@ void EditorNode::_bottom_panel_switch(bool p_enable,int p_idx) { for(int i=0;i<bottom_panel_items.size();i++) { bottom_panel_items[i].button->set_pressed(false); - bottom_panel_items[i].control->set_hidden(true); + bottom_panel_items[i].control->set_visible(false); } center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN); center_split->set_collapsed(true); @@ -5057,7 +5069,7 @@ Variant EditorNode::drag_resource(const Ref<Resource>& p_res,Control* p_from) { Control *drag_control = memnew( Control ); - TextureFrame *drag_preview = memnew( TextureFrame ); + TextureRect *drag_preview = memnew( TextureRect ); Label* label=memnew( Label ); waiting_for_sources_changed=true; // @@ -5308,9 +5320,9 @@ void EditorNode::_bind_methods() { ClassDB::bind_method("_import_action",&EditorNode::_import_action); //ClassDB::bind_method("_import",&EditorNode::_import); -// ClassDB::bind_method("_import_conflicts_solved",&EditorNode::_import_conflicts_solved); + //ClassDB::bind_method("_import_conflicts_solved",&EditorNode::_import_conflicts_solved); ClassDB::bind_method("_open_recent_scene",&EditorNode::_open_recent_scene); -// ClassDB::bind_method("_open_recent_scene_confirm",&EditorNode::_open_recent_scene_confirm); + //ClassDB::bind_method("_open_recent_scene_confirm",&EditorNode::_open_recent_scene_confirm); ClassDB::bind_method("_save_optimized",&EditorNode::_save_optimized); @@ -5517,7 +5529,7 @@ EditorNode::EditorNode() { menu_hb = memnew( HBoxContainer ); main_vbox->add_child(menu_hb); -// top_dark_vb->add_child(scene_tabs); + //top_dark_vb->add_child(scene_tabs); //left left_l_hsplit = memnew( HSplitContainer ); main_vbox->add_child(left_l_hsplit); @@ -5696,12 +5708,12 @@ EditorNode::EditorNode() { //scene_root_base->add_child(scene_root); //scene_root->set_meta("_editor_disable_input",true); - VisualServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport(),true); + VisualServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport_rid(),true); scene_root->set_disable_input(true); scene_root->set_as_audio_listener_2d(true); //scene_root->set_size_override(true,Size2(GlobalConfig::get_singleton()->get("display/width"),GlobalConfig::get_singleton()->get("display/height"))); -// scene_root->set_world_2d( Ref<World2D>( memnew( World2D )) ); + //scene_root->set_world_2d( Ref<World2D>( memnew( World2D )) ); viewport = memnew( VBoxContainer ); @@ -5934,8 +5946,8 @@ EditorNode::EditorNode() { native_play_button->get_popup()->connect("id_pressed",this,"_run_in_device"); run_native->connect("native_run",this,"_menu_option",varray(RUN_PLAY_NATIVE)); -// VSeparator *s1 = memnew( VSeparator ); -// play_hb->add_child(s1); + //VSeparator *s1 = memnew( VSeparator ); + //play_hb->add_child(s1); play_scene_button = memnew( ToolButton ); play_hb->add_child(play_scene_button); @@ -6322,8 +6334,8 @@ EditorNode::EditorNode() { bottom_pc->add_child(bottom_hb);*/ -// center_vb->add_child( log->get_button() ); -// log->get_button()->set_h_size_flags(Control::SIZE_EXPAND_FILL); + //center_vb->add_child( log->get_button() ); + //log->get_button()->set_h_size_flags(Control::SIZE_EXPAND_FILL); //progress_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -6371,7 +6383,7 @@ EditorNode::EditorNode() { -// optimized_save = memnew( OptimizedSaveDialog(&editor_data) ); + //optimized_save = memnew( OptimizedSaveDialog(&editor_data) ); //gui_base->add_child(optimized_save); //optimized_save->connect("confirmed",this,"_save_optimized"); @@ -6432,7 +6444,7 @@ EditorNode::EditorNode() { 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); - TextureFrame *logo = memnew( TextureFrame ); + TextureRect *logo = memnew( TextureRect ); about->add_child(logo); logo->set_pos(Point2(20,20)); logo->set_texture(gui_base->get_icon("Logo","EditorIcons") ); @@ -6524,8 +6536,8 @@ EditorNode::EditorNode() { Ref<EditorSceneImportPlugin> _scene_import = memnew(EditorSceneImportPlugin(this) ); Ref<EditorSceneImporterCollada> _collada_import = memnew( EditorSceneImporterCollada); _scene_import->add_importer(_collada_import); -// Ref<EditorSceneImporterFBXConv> _fbxconv_import = memnew( EditorSceneImporterFBXConv); -// _scene_import->add_importer(_fbxconv_import); + //Ref<EditorSceneImporterFBXConv> _fbxconv_import = memnew( EditorSceneImporterFBXConv); + //_scene_import->add_importer(_fbxconv_import); editor_import_export->add_import_plugin( _scene_import); // TODO: This plugin has no code, it should be either implemented or dropped (GH-3667) // editor_import_export->add_import_plugin( Ref<EditorSceneAnimationImportPlugin>( memnew(EditorSceneAnimationImportPlugin(this)))); @@ -6569,14 +6581,14 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( MeshInstanceEditorPlugin(this) ) ); add_editor_plugin( memnew( AnimationTreeEditorPlugin(this) ) ); //add_editor_plugin( memnew( SamplePlayerEditorPlugin(this) ) ); - this is kind of useless at this point -// add_editor_plugin( memnew( MeshLibraryEditorPlugin(this) ) ); + //add_editor_plugin( memnew( MeshLibraryEditorPlugin(this) ) ); //add_editor_plugin( memnew( StreamEditorPlugin(this) ) ); add_editor_plugin( memnew( StyleBoxEditorPlugin(this) ) ); //add_editor_plugin( memnew( ParticlesEditorPlugin(this) ) ); add_editor_plugin( memnew( ResourcePreloaderEditorPlugin(this) ) ); add_editor_plugin( memnew( ItemListEditorPlugin(this) ) ); //add_editor_plugin( memnew( RichTextEditorPlugin(this) ) ); -// add_editor_plugin( memnew( CollisionPolygonEditorPlugin(this) ) ); + //add_editor_plugin( memnew( CollisionPolygonEditorPlugin(this) ) ); add_editor_plugin( memnew( CollisionPolygon2DEditorPlugin(this) ) ); add_editor_plugin( memnew( TileSetEditorPlugin(this) ) ); add_editor_plugin( memnew( TileMapEditorPlugin(this) ) ); @@ -6585,7 +6597,7 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( Particles2DEditorPlugin(this) ) ); add_editor_plugin( memnew( GIProbeEditorPlugin(this) ) ); add_editor_plugin( memnew( Path2DEditorPlugin(this) ) ); -// add_editor_plugin( memnew( PathEditorPlugin(this) ) ); + //add_editor_plugin( memnew( PathEditorPlugin(this) ) ); //add_editor_plugin( memnew( BakedLightEditorPlugin(this) ) ); add_editor_plugin( memnew( Polygon2DEditorPlugin(this) ) ); add_editor_plugin( memnew( LightOccluder2DEditorPlugin(this) ) ); @@ -6593,8 +6605,8 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( ColorRampEditorPlugin(this) ) ); add_editor_plugin( memnew( CollisionShape2DEditorPlugin(this) ) ); add_editor_plugin( memnew( TextureEditorPlugin(this) ) ); -// add_editor_plugin( memnew( MaterialEditorPlugin(this) ) ); -// add_editor_plugin( memnew( MeshEditorPlugin(this) ) ); + //add_editor_plugin( memnew( MaterialEditorPlugin(this) ) ); + //add_editor_plugin( memnew( MeshEditorPlugin(this) ) ); for(int i=0;i<EditorPlugins::get_plugin_count();i++) add_editor_plugin( EditorPlugins::create(i,this) ); @@ -6614,7 +6626,7 @@ EditorNode::EditorNode() { circle_step_msec=OS::get_singleton()->get_ticks_msec(); - circle_step_frame=OS::get_singleton()->get_frames_drawn(); + circle_step_frame=Engine::get_singleton()->get_frames_drawn(); circle_step=0; _rebuild_import_menu(); @@ -6622,7 +6634,7 @@ EditorNode::EditorNode() { editor_plugin_screen=NULL; editor_plugins_over = memnew(EditorPluginList); -// force_top_viewport(true); + //force_top_viewport(true); _edit_current(); current=NULL; @@ -6631,7 +6643,7 @@ EditorNode::EditorNode() { ScriptServer::set_scripting_enabled(false); // no scripting by default if editor -// GlobalConfig::get_singleton()->set("render/room_cull_enabled",false); + //GlobalConfig::get_singleton()->set("render/room_cull_enabled",false); reference_resource_mem=true; save_external_resources_mem=true; @@ -6684,9 +6696,9 @@ EditorNode::EditorNode() { set_process_unhandled_input(true); _playing_edited=false; -// Panel *errors = memnew( Panel ); + //Panel *errors = memnew( Panel ); load_errors = memnew( RichTextLabel ); -// load_errors->set_readonly(true); + //load_errors->set_readonly(true); load_error_dialog = memnew( AcceptDialog ); load_error_dialog->add_child(load_errors); load_error_dialog->set_title(TTR("Load Errors")); @@ -6722,8 +6734,8 @@ EditorNode::EditorNode() { pick_main_scene->get_ok()->set_text("Select"); pick_main_scene->connect("confirmed",this,"_menu_option",varray(SETTINGS_PICK_MAIN_SCENE)); -// Ref<ImageTexture> it = gui_base->get_icon("logo","Icons"); -// OS::get_singleton()->set_icon( it->get_data() ); + //Ref<ImageTexture> it = gui_base->get_icon("logo","Icons"); + //OS::get_singleton()->set_icon( it->get_data() ); for(int i=0;i<_init_callbacks.size();i++) _init_callbacks[i](); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 2cb1cd00ab..dd5ff1e175 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -286,7 +286,7 @@ private: CreateDialog *create_dialog; -// CallDialog *call_dialog; + //CallDialog *call_dialog; ConfirmationDialog *confirmation; ConfirmationDialog *import_confirmation; ConfirmationDialog *open_recent_confirmation; diff --git a/tools/editor/editor_profiler.cpp b/tools/editor/editor_profiler.cpp index c527aae385..5279711b0f 100644 --- a/tools/editor/editor_profiler.cpp +++ b/tools/editor/editor_profiler.cpp @@ -708,7 +708,7 @@ EditorProfiler::EditorProfiler() variables->connect("item_edited",this,"_item_edited"); - graph = memnew( TextureFrame ); + graph = memnew( TextureRect ); graph->set_expand(true); graph->set_mouse_filter(MOUSE_FILTER_STOP); //graph->set_ignore_mouse(false); @@ -724,7 +724,7 @@ EditorProfiler::EditorProfiler() int metric_size=CLAMP(int(EDITOR_DEF("debugger/profiler_frame_history_size",600)),60,1024); frame_metrics.resize(metric_size); last_metric=-1; -// cursor_metric=-1; + //cursor_metric=-1; hover_metric=-1; @@ -750,6 +750,6 @@ EditorProfiler::EditorProfiler() seeking=false; graph_height=1; -// activate->set_disabled(true); + //activate->set_disabled(true); } diff --git a/tools/editor/editor_profiler.h b/tools/editor/editor_profiler.h index 233bc2e0fd..52b38cdae8 100644 --- a/tools/editor/editor_profiler.h +++ b/tools/editor/editor_profiler.h @@ -3,7 +3,7 @@ #include "scene/gui/box_container.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/button.h" #include "scene/gui/label.h" #include "scene/gui/tree.h" @@ -71,7 +71,7 @@ public: private: Button *activate; - TextureFrame *graph; + TextureRect *graph; Ref<ImageTexture> graph_texture; PoolVector<uint8_t> graph_image; Tree *variables; diff --git a/tools/editor/editor_run_script.cpp b/tools/editor/editor_run_script.cpp index c8f3f9fc5d..4a3cbfbccb 100644 --- a/tools/editor/editor_run_script.cpp +++ b/tools/editor/editor_run_script.cpp @@ -46,7 +46,7 @@ void EditorScript::add_root_node(Node *p_node) { return; } -// editor->set_edited_scene(p_node); + //editor->set_edited_scene(p_node); } Node *EditorScript::get_scene() { diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 6b4b34fcac..807183ae46 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -846,8 +846,8 @@ void EditorSettings::list_text_editor_themes() { d->list_dir_begin(); String file = d->get_next(); while(file != String()) { - if (file.extension() == "tet" && file.basename().to_lower() != "default") { - themes += "," + file.basename(); + if (file.get_extension() == "tet" && file.get_basename().to_lower() != "default") { + themes += "," + file.get_basename(); } file = d->get_next(); } @@ -880,11 +880,11 @@ void EditorSettings::load_text_editor_theme() { String val = cf->get_value("color_theme", key); // don't load if it's not already there! - if (has("text_editor/" + key)) { + if (has("text_editor/highlighting/" + key)) { // make sure it is actually a color if (val.is_valid_html_color() && key.find("color") >= 0) { - props["text_editor/"+key].variant = Color::html(val); // change manually to prevent "Settings changed" console spam + props["text_editor/highlighting/"+key].variant = Color::html(val); // change manually to prevent "Settings changed" console spam } } } @@ -948,34 +948,34 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) { bool EditorSettings::_save_text_editor_theme(String p_file) { String theme_section = "color_theme"; Ref<ConfigFile> cf = memnew( ConfigFile ); // hex is better? - cf->set_value(theme_section, "background_color", ((Color)get("text_editor/background_color")).to_html()); - cf->set_value(theme_section, "completion_background_color", ((Color)get("text_editor/completion_background_color")).to_html()); - cf->set_value(theme_section, "completion_selected_color", ((Color)get("text_editor/completion_selected_color")).to_html()); - cf->set_value(theme_section, "completion_existing_color", ((Color)get("text_editor/completion_existing_color")).to_html()); - cf->set_value(theme_section, "completion_scroll_color", ((Color)get("text_editor/completion_scroll_color")).to_html()); - cf->set_value(theme_section, "completion_font_color", ((Color)get("text_editor/completion_font_color")).to_html()); - cf->set_value(theme_section, "caret_color", ((Color)get("text_editor/caret_color")).to_html()); - cf->set_value(theme_section, "caret_background_color", ((Color)get("text_editor/caret_background_color")).to_html()); - cf->set_value(theme_section, "line_number_color", ((Color)get("text_editor/line_number_color")).to_html()); - cf->set_value(theme_section, "text_color", ((Color)get("text_editor/text_color")).to_html()); - cf->set_value(theme_section, "text_selected_color", ((Color)get("text_editor/text_selected_color")).to_html()); - cf->set_value(theme_section, "keyword_color", ((Color)get("text_editor/keyword_color")).to_html()); - cf->set_value(theme_section, "base_type_color", ((Color)get("text_editor/base_type_color")).to_html()); - cf->set_value(theme_section, "engine_type_color", ((Color)get("text_editor/engine_type_color")).to_html()); - cf->set_value(theme_section, "function_color", ((Color)get("text_editor/function_color")).to_html()); - cf->set_value(theme_section, "member_variable_color", ((Color)get("text_editor/member_variable_color")).to_html()); - cf->set_value(theme_section, "comment_color", ((Color)get("text_editor/comment_color")).to_html()); - cf->set_value(theme_section, "string_color", ((Color)get("text_editor/string_color")).to_html()); - cf->set_value(theme_section, "number_color", ((Color)get("text_editor/number_color")).to_html()); - cf->set_value(theme_section, "symbol_color", ((Color)get("text_editor/symbol_color")).to_html()); - cf->set_value(theme_section, "selection_color", ((Color)get("text_editor/selection_color")).to_html()); - cf->set_value(theme_section, "brace_mismatch_color", ((Color)get("text_editor/brace_mismatch_color")).to_html()); - cf->set_value(theme_section, "current_line_color", ((Color)get("text_editor/current_line_color")).to_html()); - cf->set_value(theme_section, "mark_color", ((Color)get("text_editor/mark_color")).to_html()); - cf->set_value(theme_section, "breakpoint_color", ((Color)get("text_editor/breakpoint_color")).to_html()); - cf->set_value(theme_section, "word_highlighted_color", ((Color)get("text_editor/word_highlighted_color")).to_html()); - cf->set_value(theme_section, "search_result_color", ((Color)get("text_editor/search_result_color")).to_html()); - cf->set_value(theme_section, "search_result_border_color", ((Color)get("text_editor/search_result_border_color")).to_html()); + cf->set_value(theme_section, "background_color", ((Color)get("text_editor/highlighting/background_color")).to_html()); + cf->set_value(theme_section, "completion_background_color", ((Color)get("text_editor/highlighting/completion_background_color")).to_html()); + cf->set_value(theme_section, "completion_selected_color", ((Color)get("text_editor/highlighting/completion_selected_color")).to_html()); + cf->set_value(theme_section, "completion_existing_color", ((Color)get("text_editor/highlighting/completion_existing_color")).to_html()); + cf->set_value(theme_section, "completion_scroll_color", ((Color)get("text_editor/highlighting/completion_scroll_color")).to_html()); + cf->set_value(theme_section, "completion_font_color", ((Color)get("text_editor/highlighting/completion_font_color")).to_html()); + cf->set_value(theme_section, "caret_color", ((Color)get("text_editor/highlighting/caret_color")).to_html()); + cf->set_value(theme_section, "caret_background_color", ((Color)get("text_editor/highlighting/caret_background_color")).to_html()); + cf->set_value(theme_section, "line_number_color", ((Color)get("text_editor/highlighting/line_number_color")).to_html()); + cf->set_value(theme_section, "text_color", ((Color)get("text_editor/highlighting/text_color")).to_html()); + cf->set_value(theme_section, "text_selected_color", ((Color)get("text_editor/highlighting/text_selected_color")).to_html()); + cf->set_value(theme_section, "keyword_color", ((Color)get("text_editor/highlighting/keyword_color")).to_html()); + cf->set_value(theme_section, "base_type_color", ((Color)get("text_editor/highlighting/base_type_color")).to_html()); + cf->set_value(theme_section, "engine_type_color", ((Color)get("text_editor/highlighting/engine_type_color")).to_html()); + cf->set_value(theme_section, "function_color", ((Color)get("text_editor/highlighting/function_color")).to_html()); + cf->set_value(theme_section, "member_variable_color", ((Color)get("text_editor/highlighting/member_variable_color")).to_html()); + cf->set_value(theme_section, "comment_color", ((Color)get("text_editor/highlighting/comment_color")).to_html()); + cf->set_value(theme_section, "string_color", ((Color)get("text_editor/highlighting/string_color")).to_html()); + cf->set_value(theme_section, "number_color", ((Color)get("text_editor/highlighting/number_color")).to_html()); + cf->set_value(theme_section, "symbol_color", ((Color)get("text_editor/highlighting/symbol_color")).to_html()); + cf->set_value(theme_section, "selection_color", ((Color)get("text_editor/highlighting/selection_color")).to_html()); + cf->set_value(theme_section, "brace_mismatch_color", ((Color)get("text_editor/highlighting/brace_mismatch_color")).to_html()); + cf->set_value(theme_section, "current_line_color", ((Color)get("text_editor/highlighting/current_line_color")).to_html()); + cf->set_value(theme_section, "mark_color", ((Color)get("text_editor/highlighting/mark_color")).to_html()); + cf->set_value(theme_section, "breakpoint_color", ((Color)get("text_editor/highlighting/breakpoint_color")).to_html()); + cf->set_value(theme_section, "word_highlighted_color", ((Color)get("text_editor/highlighting/word_highlighted_color")).to_html()); + cf->set_value(theme_section, "search_result_color", ((Color)get("text_editor/highlighting/search_result_color")).to_html()); + cf->set_value(theme_section, "search_result_border_color", ((Color)get("text_editor/highlighting/search_result_border_color")).to_html()); Error err = cf->save(p_file); @@ -1105,7 +1105,7 @@ EditorSettings::EditorSettings() { EditorSettings::~EditorSettings() { -// singleton=NULL; + //singleton=NULL; } Ref<ShortCut> ED_GET_SHORTCUT(const String& p_path) { diff --git a/tools/editor/editor_sub_scene.cpp b/tools/editor/editor_sub_scene.cpp index 8f1f24f769..34c3d47006 100644 --- a/tools/editor/editor_sub_scene.cpp +++ b/tools/editor/editor_sub_scene.cpp @@ -75,7 +75,7 @@ void EditorSubScene::_notification(int p_what) { if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - if (!is_visible()) { + if (!is_visible_in_tree()) { } @@ -203,7 +203,7 @@ EditorSubScene::EditorSubScene() { VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); -// set_child_rect(vb); + //set_child_rect(vb); HBoxContainer *hb = memnew( HBoxContainer ); path = memnew( LineEdit ); diff --git a/tools/editor/fileserver/editor_file_server.cpp b/tools/editor/fileserver/editor_file_server.cpp index d640b0ad1d..6330b06d3e 100644 --- a/tools/editor/fileserver/editor_file_server.cpp +++ b/tools/editor/fileserver/editor_file_server.cpp @@ -38,7 +38,7 @@ void EditorFileServer::_close_client(ClientData *cd) { - cd->connection->disconnect(); + cd->connection->disconnect_from_host(); cd->efs->wait_mutex->lock(); cd->efs->to_wait.insert(cd->thread); cd->efs->wait_mutex->unlock(); diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp index 1bf91d4ceb..792eb54dd4 100644 --- a/tools/editor/filesystem_dock.cpp +++ b/tools/editor/filesystem_dock.cpp @@ -186,7 +186,7 @@ void FileSystemDock::_notification(int p_what) { case NOTIFICATION_DRAG_BEGIN: { Dictionary dd = get_viewport()->gui_get_drag_data(); - if (tree->is_visible() && dd.has("type") ) { + if (tree->is_visible_in_tree() && dd.has("type") ) { if ( (String(dd["type"])=="files") || (String(dd["type"])=="files_and_dirs") || (String(dd["type"])=="resource")) { tree->set_drop_mode_flags(Tree::DROP_MODE_ON_ITEM); } @@ -292,7 +292,7 @@ void FileSystemDock::_thumbnail_done(const String& p_path,const Ref<Texture>& p_ bool valid=false; - if (!search_box->is_hidden()) { + if (search_box->is_visible()) { valid=true; } else { valid=(path==p_path.get_base_dir()); @@ -396,7 +396,7 @@ void FileSystemDock::_update_files(bool p_keep_selection) { current_path->set_text(path); - EditorFileSystemDirectory *efd = EditorFileSystem::get_singleton()->get_path(path); + EditorFileSystemDirectory *efd = EditorFileSystem::get_singleton()->get_filesystem_path(path); if (!efd) return; @@ -624,7 +624,7 @@ void FileSystemDock::_go_to_dir(const String& p_dir){ void FileSystemDock::_preview_invalidated(const String& p_path) { - if (p_path.get_base_dir()==path && search_box->get_text()==String() && file_list_vb->is_visible()) { + if (p_path.get_base_dir()==path && search_box->get_text()==String() && file_list_vb->is_visible_in_tree()) { for(int i=0;i<files->get_item_count();i++) { @@ -649,13 +649,13 @@ void FileSystemDock::_fs_changed() { scanning_vb->hide(); split_box->show(); - if (!tree->is_hidden()) { + if (tree->is_visible()) { button_favorite->show(); _update_tree(); } - if (!file_list_vb->is_hidden()) { + if (file_list_vb->is_visible()) { _update_files(true); } @@ -685,14 +685,14 @@ void FileSystemDock::_fw_history() { path=history[history_pos]; - if (!tree->is_hidden()) { + if (tree->is_visible()) { _update_tree(); tree->grab_focus(); tree->ensure_cursor_is_visible(); } - if (!file_list_vb->is_hidden()) { + if (file_list_vb->is_visible()) { _update_files(false); current_path->set_text(path); } @@ -710,13 +710,13 @@ void FileSystemDock::_bw_history() { path=history[history_pos]; - if (!tree->is_hidden()) { + if (tree->is_visible()) { _update_tree(); tree->grab_focus(); tree->ensure_cursor_is_visible(); } - if (!file_list_vb->is_hidden()) { + if (file_list_vb->is_visible()) { _update_files(false); current_path->set_text(path); } @@ -832,7 +832,7 @@ void FileSystemDock::_move_operation(const String& p_to_path) { return; } - EditorFileSystemDirectory *efsd=EditorFileSystem::get_singleton()->get_path(move_dirs[i]); + EditorFileSystemDirectory *efsd=EditorFileSystem::get_singleton()->get_filesystem_path(move_dirs[i]); if (!efsd) continue; _find_inside_move_files(efsd,inside_files); @@ -1015,7 +1015,7 @@ void FileSystemDock::_file_option(int p_option) { if (move_dirs.empty() && move_files.size()==1) { rename_dialog->clear_filters(); - rename_dialog->add_filter("*."+move_files[0].extension()); + rename_dialog->add_filter("*."+move_files[0].get_extension()); rename_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); rename_dialog->set_current_path(move_files[0]); rename_dialog->popup_centered_ratio(); @@ -1149,7 +1149,7 @@ void FileSystemDock::_open_pressed(){ current_path->set_text(path); _push_to_history(); -// emit_signal("open",path); + //emit_signal("open",path); } @@ -1167,7 +1167,7 @@ void FileSystemDock::_dir_rmb_pressed(const Vector2& p_pos) { void FileSystemDock::_search_changed(const String& p_text) { - if (!search_box->is_visible()) + if (!search_box->is_visible_in_tree()) return; //wtf _update_files(false); @@ -1242,8 +1242,10 @@ Variant FileSystemDock::get_drag_data_fw(const Point2& p_point,Control* p_from) if (seldirs.empty() && selfiles.empty()) return Variant(); - //if (seldirs.size() && selfiles.size()) - // return Variant(); //can't really mix files and dirs (i think?) - yes you can, commenting + /* + if (seldirs.size() && selfiles.size()) + return Variant(); //can't really mix files and dirs (i think?) - yes you can, commenting + */ /*if (selfiles.size()==1) { Ref<Resource> resource = ResourceLoader::load(files->get_item_metadata(selfiles.front()->get())); @@ -1622,7 +1624,7 @@ void FileSystemDock::_bind_methods() { ClassDB::bind_method(_MD("_update_tree"),&FileSystemDock::_update_tree); ClassDB::bind_method(_MD("_rescan"),&FileSystemDock::_rescan); ClassDB::bind_method(_MD("_favorites_pressed"),&FileSystemDock::_favorites_pressed); -// ClassDB::bind_method(_MD("_instance_pressed"),&ScenesDock::_instance_pressed); + //ClassDB::bind_method(_MD("_instance_pressed"),&ScenesDock::_instance_pressed); ClassDB::bind_method(_MD("_open_pressed"),&FileSystemDock::_open_pressed); ClassDB::bind_method(_MD("_dir_rmb_pressed"),&FileSystemDock::_dir_rmb_pressed); @@ -1700,7 +1702,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { button_favorite->set_focus_mode(FOCUS_NONE); -// Control *spacer = memnew( Control); + //Control *spacer = memnew( Control); @@ -1770,8 +1772,8 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { path_hb->add_child(search_box); search_box->connect("text_changed",this,"_search_changed"); - search_icon = memnew( TextureFrame ); - search_icon->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED); + search_icon = memnew( TextureRect ); + search_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED); path_hb->add_child(search_icon); button_display_mode = memnew( ToolButton ); diff --git a/tools/editor/filesystem_dock.h b/tools/editor/filesystem_dock.h index 804017be73..0b0a73b9a2 100644 --- a/tools/editor/filesystem_dock.h +++ b/tools/editor/filesystem_dock.h @@ -95,7 +95,7 @@ private: Button *button_hist_prev; LineEdit *current_path; LineEdit *search_box; - TextureFrame *search_icon; + TextureRect *search_icon; HBoxContainer *path_hb; bool split_mode; diff --git a/tools/editor/icons/2x/icon_patch_9_frame.png b/tools/editor/icons/2x/icon_patch_9_rect.png Binary files differindex 5762a0392e..5762a0392e 100644 --- a/tools/editor/icons/2x/icon_patch_9_frame.png +++ b/tools/editor/icons/2x/icon_patch_9_rect.png diff --git a/tools/editor/icons/2x/icon_reference_frame.png b/tools/editor/icons/2x/icon_reference_rect.png Binary files differindex 63fe559fa7..63fe559fa7 100644 --- a/tools/editor/icons/2x/icon_reference_frame.png +++ b/tools/editor/icons/2x/icon_reference_rect.png diff --git a/tools/editor/icons/2x/icon_texture_frame.png b/tools/editor/icons/2x/icon_texture_rect.png Binary files differindex 50d715dd09..50d715dd09 100644 --- a/tools/editor/icons/2x/icon_texture_frame.png +++ b/tools/editor/icons/2x/icon_texture_rect.png diff --git a/tools/editor/icons/icon_patch_9_frame.png b/tools/editor/icons/icon_patch_9_rect.png Binary files differindex bdd1467144..bdd1467144 100644 --- a/tools/editor/icons/icon_patch_9_frame.png +++ b/tools/editor/icons/icon_patch_9_rect.png diff --git a/tools/editor/icons/icon_reference_frame.png b/tools/editor/icons/icon_reference_rect.png Binary files differindex b253af477f..b253af477f 100644 --- a/tools/editor/icons/icon_reference_frame.png +++ b/tools/editor/icons/icon_reference_rect.png diff --git a/tools/editor/icons/icon_texture_frame.png b/tools/editor/icons/icon_texture_rect.png Binary files differindex 84e4a90bfb..84e4a90bfb 100644 --- a/tools/editor/icons/icon_texture_frame.png +++ b/tools/editor/icons/icon_texture_rect.png diff --git a/tools/editor/icons/source/icon_patch_9_frame.svg b/tools/editor/icons/source/icon_patch_9_rect.svg index f12789c19e..c5a09603a6 100644 --- a/tools/editor/icons/source/icon_patch_9_frame.svg +++ b/tools/editor/icons/source/icon_patch_9_rect.svg @@ -18,7 +18,7 @@ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_center_container.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" - sodipodi:docname="icon_patch_9_frame.svg"> + sodipodi:docname="icon_patch_9_rect.svg"> <defs id="defs4" /> <sodipodi:namedview diff --git a/tools/editor/icons/source/icon_reference_frame.svg b/tools/editor/icons/source/icon_reference_rect.svg index 76c3247f1b..cee814360d 100644 --- a/tools/editor/icons/source/icon_reference_frame.svg +++ b/tools/editor/icons/source/icon_reference_rect.svg @@ -18,7 +18,7 @@ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_center_container.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" - sodipodi:docname="icon_reference_frame.svg"> + sodipodi:docname="icon_reference_rect.svg"> <defs id="defs4" /> <sodipodi:namedview diff --git a/tools/editor/icons/source/icon_texture_frame.svg b/tools/editor/icons/source/icon_texture_rect.svg index afab41de41..88d9b4081f 100644 --- a/tools/editor/icons/source/icon_texture_frame.svg +++ b/tools/editor/icons/source/icon_texture_rect.svg @@ -18,7 +18,7 @@ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_center_container.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" - sodipodi:docname="icon_texture_frame.svg"> + sodipodi:docname="icon_texture_rect.svg"> <defs id="defs4" /> <sodipodi:namedview diff --git a/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp index b4e0c4b82a..722b02f77b 100644 --- a/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp @@ -145,7 +145,7 @@ public: error_dialog->popup_centered(Size2(200, 100)*EDSCALE); } - dst = dst.plus_file(bitmasks[i].get_file().basename() + ".pbm"); + dst = dst.plus_file(bitmasks[i].get_file().get_basename() + ".pbm"); plugin->import(dst, imd); } @@ -167,7 +167,7 @@ public: ClassDB::bind_method("_import", &EditorBitMaskImportDialog::_import); ClassDB::bind_method("_browse", &EditorBitMaskImportDialog::_browse); ClassDB::bind_method("_browse_target", &EditorBitMaskImportDialog::_browse_target); - // ADD_SIGNAL( MethodInfo("imported",PropertyInfo(Variant::OBJECT,"scene")) ); + //ADD_SIGNAL( MethodInfo("imported",PropertyInfo(Variant::OBJECT,"scene")) ); } EditorBitMaskImportDialog(EditorBitMaskImportPlugin *p_plugin) { @@ -225,7 +225,7 @@ public: save_select = memnew(EditorDirDialog); add_child(save_select); - // save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR); + //save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR); save_select->connect("dir_selected", this, "_choose_save_dir"); get_ok()->connect("pressed", this, "_import"); @@ -235,7 +235,7 @@ public: error_dialog = memnew(ConfirmationDialog); add_child(error_dialog); error_dialog->get_ok()->set_text(TTR("Accept")); - // error_dialog->get_cancel()->hide(); + //error_dialog->get_cancel()->hide(); set_hide_on_ok(false); } @@ -294,7 +294,7 @@ void EditorBitMaskImportPlugin::import_from_drop(const Vector<String>& p_drop, c ImageLoader::get_recognized_extensions(&valid_extensions); for(int i=0;i<p_drop.size();i++) { - String extension=p_drop[i].extension().to_lower(); + String extension=p_drop[i].get_extension().to_lower(); for (List<String>::Element *E=valid_extensions.front();E;E=E->next()) { diff --git a/tools/editor/io_plugins/editor_export_scene.cpp b/tools/editor/io_plugins/editor_export_scene.cpp index c2e037cfd7..ea67128f3c 100644 --- a/tools/editor/io_plugins/editor_export_scene.cpp +++ b/tools/editor/io_plugins/editor_export_scene.cpp @@ -42,7 +42,7 @@ Vector<uint8_t> EditorSceneExportPlugin::custom_export(String& p_path,const Ref< } - String extension = p_path.extension(); + String extension = p_path.get_extension(); //step 1 check if scene diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index 388ca4ca89..099535b1ef 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -439,7 +439,7 @@ class EditorFontImportDialog : public ConfirmationDialog { test_label->set_text(""); test_label->set_text(test_string->get_text()); - test_label->add_color_override("font_color",test_color->get_color()); + test_label->add_color_override("font_color",test_color->get_pick_color()); } void _update() { @@ -468,7 +468,7 @@ class EditorFontImportDialog : public ConfirmationDialog { Ref<ImageTexture> tex = font->get_texture(0); if (tex.is_null()) return; - FileAccessRef f=FileAccess::open(p_font.basename()+".inc",FileAccess::WRITE); + FileAccessRef f=FileAccess::open(p_font.get_basename()+".inc",FileAccess::WRITE); Vector<CharType> ck = font->get_char_keys(); f->store_line("static const int _builtin_font_height="+itos(font->get_height())+";"); @@ -499,7 +499,7 @@ class EditorFontImportDialog : public ConfirmationDialog { f->store_line("static const int _builtin_font_img_width="+itos(img.get_width())+";"); f->store_line("static const int _builtin_font_img_height="+itos(img.get_height())+";"); - String fname = p_font.basename()+".sv.png"; + String fname = p_font.get_basename()+".sv.png"; ResourceSaver::save(fname,tex); Vector<uint8_t> data=FileAccess::get_file_as_array(fname); @@ -533,14 +533,14 @@ class EditorFontImportDialog : public ConfirmationDialog { } if (dest->get_line_edit()->get_text().get_file()==".fnt") { - dest->get_line_edit()->set_text(dest->get_line_edit()->get_text().get_base_dir() + "/" + source->get_line_edit()->get_text().get_file().basename() + ".fnt" ); + dest->get_line_edit()->set_text(dest->get_line_edit()->get_text().get_base_dir() + "/" + source->get_line_edit()->get_text().get_file().get_basename() + ".fnt" ); } - if (dest->get_line_edit()->get_text().extension() == dest->get_line_edit()->get_text()) { + if (dest->get_line_edit()->get_text().get_extension() == dest->get_line_edit()->get_text()) { dest->get_line_edit()->set_text(dest->get_line_edit()->get_text() + ".fnt"); } - if (dest->get_line_edit()->get_text().extension().to_lower() != "fnt") { + if (dest->get_line_edit()->get_text().get_extension().to_lower() != "fnt") { error_dialog->set_text(TTR("Invalid file extension.\nPlease use .fnt.")); error_dialog->popup_centered(Size2(200,100)); return; @@ -665,10 +665,12 @@ public: List<String> fl; Ref<BitmapFont> font= memnew(BitmapFont); dest->get_file_dialog()->add_filter("*.fnt ; Font" ); - //ResourceSaver::get_recognized_extensions(font,&fl); - //for(List<String>::Element *E=fl.front();E;E=E->next()) { - // dest->get_file_dialog()->add_filter("*."+E->get()); - //} + /* + ResourceSaver::get_recognized_extensions(font,&fl); + for(List<String>::Element *E=fl.front();E;E=E->next()) { + dest->get_file_dialog()->add_filter("*."+E->get()); + } + */ vbl->add_margin_child(TTR("Dest Resource:"),dest); HBoxContainer *testhb = memnew( HBoxContainer ); @@ -679,7 +681,7 @@ public: testhb->add_child(test_string); test_color = memnew( ColorPickerButton ); - test_color->set_color(get_color("font_color","Label")); + test_color->set_pick_color(get_color("font_color","Label")); test_color->set_h_size_flags(SIZE_EXPAND_FILL); test_color->set_stretch_ratio(1); test_color->connect("color_changed",this,"_update_text3"); @@ -689,7 +691,7 @@ public: vbl->add_margin_child(TTR("Test:")+" ",testhb); /* HBoxContainer *upd_hb = memnew( HBoxContainer ); -// vbl->add_child(upd_hb); + //vbl->add_child(upd_hb); upd_hb->add_spacer(); Button *update = memnew( Button); upd_hb->add_child(update); @@ -754,7 +756,7 @@ struct _EditorFontData { int texture; Image blit; Point2i blit_ofs; -// bool printable; + //bool printable; }; @@ -780,13 +782,13 @@ static unsigned char get_SDF_radial( int x, int y, int max_radius ) { - // hideous brute force method + //hideous brute force method float d2 = max_radius*max_radius+1.0; unsigned char v = fontmap[x+y*w]; for( int radius = 1; (radius <= max_radius) && (radius*radius < d2); ++radius ) { int line, lo, hi; - // north + //north line = y - radius; if( (line >= 0) && (line < h) ) { @@ -797,7 +799,7 @@ static unsigned char get_SDF_radial( int idx = line * w + lo; for( int i = lo; i <= hi; ++i ) { - // check this pixel + //check this pixel if( fontmap[idx] != v ) { float nx = i - x; @@ -808,11 +810,11 @@ static unsigned char get_SDF_radial( d2 = nd2; } } - // move on + //move on ++idx; } } - // south + //south line = y + radius; if( (line >= 0) && (line < h) ) { @@ -823,7 +825,7 @@ static unsigned char get_SDF_radial( int idx = line * w + lo; for( int i = lo; i <= hi; ++i ) { - // check this pixel + //check this pixel if( fontmap[idx] != v ) { float nx = i - x; @@ -834,11 +836,11 @@ static unsigned char get_SDF_radial( d2 = nd2; } } - // move on + //move on ++idx; } } - // west + //west line = x - radius; if( (line >= 0) && (line < w) ) { @@ -849,7 +851,7 @@ static unsigned char get_SDF_radial( int idx = lo * w + line; for( int i = lo; i <= hi; ++i ) { - // check this pixel + //check this pixel if( fontmap[idx] != v ) { float nx = line - x; @@ -860,11 +862,11 @@ static unsigned char get_SDF_radial( d2 = nd2; } } - // move on + //move on idx += w; } } - // east + //east line = x + radius; if( (line >= 0) && (line < w) ) { @@ -875,7 +877,7 @@ static unsigned char get_SDF_radial( int idx = lo * w + line; for( int i = lo; i <= hi; ++i ) { - // check this pixel + //check this pixel if( fontmap[idx] != v ) { float nx = line - x; @@ -886,7 +888,7 @@ static unsigned char get_SDF_radial( d2 = nd2; } } - // move on + //move on idx += w; } } @@ -913,7 +915,7 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe String src_path = EditorImportPlugin::expand_source_path(from->get_source_path(0)); - if (src_path.extension().to_lower()=="fnt") { + if (src_path.get_extension().to_lower()=="fnt") { if (ResourceLoader::load(src_path).is_valid()) { EditorNode::get_singleton()->show_warning(TTR("Path:")+" "+src_path+"\n"+TTR("This file is already a Godot font file, please supply a BMFont type file instead.")); @@ -981,14 +983,14 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe FT_GlyphSlot slot = face->glyph; -// error = FT_Set_Charmap(face,ft_encoding_unicode ); /* encoding.. */ + //error = FT_Set_Charmap(face,ft_encoding_unicode ); /* encoding.. */ /* PRINT CHARACTERS TO INDIVIDUAL BITMAPS */ -// int space_size=5; //size for space, if none found.. 5! -// int min_valign=500; //some ridiculous number + //int space_size=5; //size for space, if none found.. 5! + //int min_valign=500; //some ridiculous number FT_ULong charcode; FT_UInt gindex; @@ -1080,10 +1082,10 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe if (font_mode==_EditorFontImportOptions::FONT_DISTANCE_FIELD) { - // oversize the holding buffer so I can smooth it! + //oversize the holding buffer so I can smooth it! int sw = w + scaler * 4; int sh = h + scaler * 4; - // do the SDF + //do the SDF int sdfw = sw / scaler; int sdfh = sh / scaler; @@ -1139,7 +1141,7 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe if (font_mode==_EditorFontImportOptions::FONT_DISTANCE_FIELD) { - // oversize the holding buffer so I can smooth it! + //oversize the holding buffer so I can smooth it! int sw = w + scaler * 4; int sh = h + scaler * 4; @@ -1578,8 +1580,8 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe //debug the texture Ref<ImageTexture> atlast = memnew( ImageTexture ); atlast->create_from_image(atlas); -// atlast->create_from_image(font_data_list[5]->blit); - TextureFrame *tf = memnew( TextureFrame ); + //atlast->create_from_image(font_data_list[5]->blit); + TextureRect *tf = memnew( TextureRect ); tf->set_texture(atlast); dialog->add_child(tf); } @@ -1682,12 +1684,12 @@ Error EditorFontImportPlugin::import(const String& p_path, const Ref<ResourceImp void EditorFontImportPlugin::import_from_drop(const Vector<String>& p_drop, const String &p_dest_path) { for(int i=0;i<p_drop.size();i++) { - String ext = p_drop[i].extension().to_lower(); + String ext = p_drop[i].get_extension().to_lower(); String file = p_drop[i].get_file(); if (ext=="ttf" || ext=="otf" || ext=="fnt") { import_dialog(); - dialog->set_source_and_dest(p_drop[i],p_dest_path.plus_file(file.basename()+".fnt")); + dialog->set_source_and_dest(p_drop[i],p_dest_path.plus_file(file.get_basename()+".fnt")); break; } } diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 5720e15caa..1cbb594a51 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -236,20 +236,22 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) { return OK; //well, it's an ambient light.. Light *l = memnew( DirectionalLight ); -// l->set_color(Light::COLOR_AMBIENT,ld.color); -// l->set_color(Light::COLOR_DIFFUSE,Color(0,0,0)); -// l->set_color(Light::COLOR_SPECULAR,Color(0,0,0)); + //l->set_color(Light::COLOR_AMBIENT,ld.color); + //l->set_color(Light::COLOR_DIFFUSE,Color(0,0,0)); + //l->set_color(Light::COLOR_SPECULAR,Color(0,0,0)); node = l; } else if (ld.mode==Collada::LightData::MODE_DIRECTIONAL) { //well, it's an ambient light.. Light *l = memnew( DirectionalLight ); - //if (found_ambient) //use it here - // l->set_color(Light::COLOR_AMBIENT,ambient); + /* + if (found_ambient) //use it here + l->set_color(Light::COLOR_AMBIENT,ambient); -// l->set_color(Light::COLOR_DIFFUSE,ld.color); -// l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); + l->set_color(Light::COLOR_DIFFUSE,ld.color); + l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); + */ node = l; } else { @@ -259,14 +261,14 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) { l=memnew( OmniLight ); else { l=memnew( SpotLight ); -// l->set_parameter(Light::PARAM_SPOT_ANGLE,ld.spot_angle); -// l->set_parameter(Light::PARAM_SPOT_ATTENUATION,ld.spot_exp); + //l->set_parameter(Light::PARAM_SPOT_ANGLE,ld.spot_angle); + //l->set_parameter(Light::PARAM_SPOT_ATTENUATION,ld.spot_exp); } // -// l->set_color(Light::COLOR_DIFFUSE,ld.color); -// l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); -// l->approximate_opengl_attenuation(ld.constant_att,ld.linear_att,ld.quad_att); + //l->set_color(Light::COLOR_DIFFUSE,ld.color); + //l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); + //l->approximate_opengl_attenuation(ld.constant_att,ld.linear_att,ld.quad_att); node=l; } @@ -396,13 +398,13 @@ Error ColladaImport::_create_material(const String& p_target) { material->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,texture); material->set_albedo(Color(1,1,1,1)); -// material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,1)); + //material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,1)); } else { missing_textures.push_back(texfile.get_file()); } } } else { -// material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,effect.diffuse.color); + //material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,effect.diffuse.color); } // SPECULAR @@ -417,15 +419,15 @@ Error ColladaImport::_create_material(const String& p_target) { material->set_texture(FixedSpatialMaterial::TEXTURE_SPECULAR,texture); material->set_specular(Color(1,1,1,1)); -// material->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,texture); -// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,Color(1,1,1,1)); + //material->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,texture); + //material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,Color(1,1,1,1)); } else { missing_textures.push_back(texfile.get_file()); } } } else { -// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,effect.specular.color); + //material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,effect.specular.color); } // EMISSION @@ -441,14 +443,14 @@ Error ColladaImport::_create_material(const String& p_target) { material->set_texture(FixedSpatialMaterial::TEXTURE_EMISSION,texture); material->set_emission(Color(1,1,1,1)); -// material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,Color(1,1,1,1)); + //material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,Color(1,1,1,1)); }else { -// missing_textures.push_back(texfile.get_file()); + //missing_textures.push_back(texfile.get_file()); } } } else { -// material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,effect.emission.color); + //material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,effect.emission.color); } // NORMAL @@ -461,18 +463,18 @@ Error ColladaImport::_create_material(const String& p_target) { Ref<Texture> texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { material->set_texture(FixedSpatialMaterial::TEXTURE_NORMAL,texture); -// material->set_emission(Color(1,1,1,1)); + //material->set_emission(Color(1,1,1,1)); - // material->set_texture(FixedSpatialMaterial::PARAM_NORMAL,texture); + //material->set_texture(FixedSpatialMaterial::PARAM_NORMAL,texture); }else { -// missing_textures.push_back(texfile.get_file()); + //missing_textures.push_back(texfile.get_file()); } } } -// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,effect.shininess); + //material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,effect.shininess); if (effect.double_sided) { material->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); } @@ -624,12 +626,12 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con ERR_FAIL_COND_V( !collada.state.mesh_data_map.has(target), ERR_INVALID_DATA ); String name = collada.state.mesh_data_map[target].name; - p_mesh->add_morph_target(name); + p_mesh->add_blend_shape(name); } if (p_morph_data->mode=="RELATIVE") - p_mesh->set_morph_target_mode(Mesh::MORPH_MODE_RELATIVE); + p_mesh->set_blend_shape_mode(Mesh::BLEND_SHAPE_MODE_RELATIVE); else if (p_morph_data->mode=="NORMALIZED") - p_mesh->set_morph_target_mode(Mesh::MORPH_MODE_NORMALIZED); + p_mesh->set_blend_shape_mode(Mesh::BLEND_SHAPE_MODE_NORMALIZED); } @@ -1171,11 +1173,13 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con narrayw = PoolVector<Vector3>::Write(); final_normal_array=narray; - //PoolVector<Vector3> altnaray; - //_generate_normals(index_array,final_vertex_array,altnaray); + /* + PoolVector<Vector3> altnaray; + _generate_normals(index_array,final_vertex_array,altnaray); - //for(int i=0;i<altnaray.size();i++) - // print_line(rtos(altnaray[i].dot(final_normal_array[i]))); + for(int i=0;i<altnaray.size();i++) + print_line(rtos(altnaray[i].dot(final_normal_array[i]))); + */ } else if (primitive==Mesh::PRIMITIVE_TRIANGLES) { //generate normals (even if unused later) @@ -1257,8 +1261,10 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con } -// if (sum<0.8) -// COLLADA_PRINT("ERROR SUMMING INDEX "+itos(k)+" had weights: "+itos(vertex_array[k].weights.size())); + /* + if (sum<0.8) + COLLADA_PRINT("ERROR SUMMING INDEX "+itos(k)+" had weights: "+itos(vertex_array[k].weights.size())); + */ } @@ -1468,7 +1474,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con #endif for(int mi=0;mi<p_morph_meshes.size();mi++) { - // print_line("want surface "+itos(mi)+" has "+itos(p_morph_meshes[mi]->get_surface_count())); + //print_line("want surface "+itos(mi)+" has "+itos(p_morph_meshes[mi]->get_surface_count())); Array a = p_morph_meshes[mi]->surface_get_arrays(surface); //add valid weight and bone arrays if they exist, TODO check if they are unique to shape (generally not) @@ -2375,9 +2381,11 @@ Node* EditorSceneImporterCollada::import_scene(const String& p_path, uint32_t p_ if (state.missing_textures.size()) { - //for(int i=0;i<state.missing_textures.size();i++) { -// EditorNode::add_io_error("Texture Not Found: "+state.missing_textures[i]); -// } + /* + for(int i=0;i<state.missing_textures.size();i++) { + EditorNode::add_io_error("Texture Not Found: "+state.missing_textures[i]); + } + */ if (r_missing_deps) { @@ -2438,7 +2446,7 @@ Ref<Animation> EditorSceneImporterCollada::import_animation(const String& p_path Ref<Animation> anim=state.animations[0]; anim=state.animations[0]; print_line("Anim Load OK"); - String base = p_path.basename().to_lower(); + String base = p_path.get_basename().to_lower(); if (p_flags&IMPORT_ANIMATION_DETECT_LOOP) { if (base.begins_with("loop") || base.ends_with("loop") || base.begins_with("cycle") || base.ends_with("cycle")) { diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp index f33693c304..fa0c36be98 100644 --- a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp @@ -259,7 +259,7 @@ public: imd->add_source(EditorImportPlugin::validate_source_path(meshes[i])); - String file_path = dst.plus_file(meshes[i].get_file().basename()+".msh"); + String file_path = dst.plus_file(meshes[i].get_file().get_basename()+".msh"); plugin->import(file_path,imd); } @@ -568,7 +568,7 @@ void EditorMeshImportPlugin::import_from_drop(const Vector<String>& p_drop, cons Vector<String> files; for(int i=0;i<p_drop.size();i++) { - String ext = p_drop[i].extension().to_lower(); + String ext = p_drop[i].get_extension().to_lower(); String file = p_drop[i].get_file(); if (ext=="obj") { diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index da4e24dc84..eeb61fc443 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -296,7 +296,7 @@ public: error_dialog->popup_centered(Size2(200,100)*EDSCALE); } - dst = dst.plus_file(samples[i].get_file().basename()+".smp"); + dst = dst.plus_file(samples[i].get_file().get_basename()+".smp"); plugin->import(dst,imd); } @@ -323,7 +323,7 @@ public: ClassDB::bind_method("_import",&EditorSampleImportDialog::_import); ClassDB::bind_method("_browse",&EditorSampleImportDialog::_browse); ClassDB::bind_method("_browse_target",&EditorSampleImportDialog::_browse_target); - // ADD_SIGNAL( MethodInfo("imported",PropertyInfo(Variant::OBJECT,"scene")) ); + //ADD_SIGNAL( MethodInfo("imported",PropertyInfo(Variant::OBJECT,"scene")) ); } EditorSampleImportDialog(EditorSampleImportPlugin *p_plugin) { @@ -373,7 +373,7 @@ public: save_select = memnew( EditorDirDialog ); add_child(save_select); - // save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR); + //save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR); save_select->connect("dir_selected", this,"_choose_save_dir"); get_ok()->connect("pressed", this,"_import"); @@ -383,7 +383,7 @@ public: error_dialog = memnew ( ConfirmationDialog ); add_child(error_dialog); error_dialog->get_ok()->set_text(TTR("Accept")); - // error_dialog->get_cancel()->hide(); + //error_dialog->get_cancel()->hide(); set_hide_on_ok(false); options = memnew( _EditorSampleImportOptions ); @@ -648,7 +648,7 @@ Error EditorSampleImportPlugin::import(const String& p_path, const Ref<ResourceI } } -// print_line("compressing ima-adpcm, resulting buffersize is "+itos(dst_data.size())+" from "+itos(data.size())); + //print_line("compressing ima-adpcm, resulting buffersize is "+itos(dst_data.size())+" from "+itos(data.size())); } else { @@ -758,12 +758,14 @@ void EditorSampleImportPlugin::_compress_ima_adpcm(const Vector<float>& p_data,P xm_sample=CLAMP(in[i]*32767.0,-32768,32767); - //if (xm_sample==32767 || xm_sample==-32768) - // printf("clippy!\n",xm_sample); + /* + if (xm_sample==32767 || xm_sample==-32768) + printf("clippy!\n",xm_sample); + */ } - // xm_sample=xm_sample+xm_prev; - // xm_prev=xm_sample; + //xm_sample=xm_sample+xm_prev; + //xm_prev=xm_sample; diff = (int)xm_sample - prev ; @@ -828,7 +830,7 @@ void EditorSampleImportPlugin::import_from_drop(const Vector<String>& p_drop, co Vector<String> files; for(int i=0;i<p_drop.size();i++) { - String ext = p_drop[i].extension().to_lower(); + String ext = p_drop[i].get_extension().to_lower(); if (ext=="wav") { @@ -887,7 +889,7 @@ Vector<uint8_t> EditorSampleExportPlugin::custom_export(String& p_path,const Ref - if (EditorImportExport::get_singleton()->sample_get_action()==EditorImportExport::SAMPLE_ACTION_NONE || p_path.extension().to_lower()!="wav") { + if (EditorImportExport::get_singleton()->sample_get_action()==EditorImportExport::SAMPLE_ACTION_NONE || p_path.get_extension().to_lower()!="wav") { return Vector<uint8_t>(); } @@ -911,7 +913,7 @@ Vector<uint8_t> EditorSampleExportPlugin::custom_export(String& p_path,const Ref ERR_FAIL_COND_V(err!=OK,Vector<uint8_t>()); - p_path=p_path.basename()+".converted.smp"; + p_path=p_path.get_basename()+".converted.smp"; return FileAccess::get_file_as_array(savepath); } diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 8fd78f11f3..79c88e7407 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -377,7 +377,7 @@ void EditorImportAnimationOptions::_bind_methods() { ClassDB::bind_method("_changed",&EditorImportAnimationOptions::_changed); ClassDB::bind_method("_item_edited",&EditorImportAnimationOptions::_item_edited); ClassDB::bind_method("_button_action",&EditorImportAnimationOptions::_button_action); -// ClassDB::bind_method("_changedp",&EditorImportAnimationOptions::_changedp); + //ClassDB::bind_method("_changedp",&EditorImportAnimationOptions::_changedp); ADD_SIGNAL(MethodInfo("changed")); } @@ -390,7 +390,7 @@ void EditorImportAnimationOptions::_notification(int p_what) { flags->connect("item_edited",this,"_changed"); clips_tree->connect("item_edited",this,"_item_edited"); clips_tree->connect("button_pressed",this,"_button_action",varray(),CONNECT_DEFERRED); -// format->connect("item_selected",this,"_changedp"); + //format->connect("item_selected",this,"_changedp"); } } @@ -659,7 +659,7 @@ void EditorSceneImportDialog::_choose_file(const String& p_path) { import_path->set_text(p_path); if (root_node_name->get_text().size()==0){ - root_node_name->set_text(import_path->get_text().get_file().basename()); + root_node_name->set_text(import_path->get_text().get_file().get_basename()); } } @@ -763,7 +763,7 @@ void EditorSceneImportDialog::_import(bool p_and_open) { // Scenes should always be imported as binary format since vertex data is large and would take // up a lot of space and time to load if imported as text format (GH-5778) - String save_file = save_path->get_text().plus_file(import_path->get_text().get_file().basename()+".scn"); + String save_file = save_path->get_text().plus_file(import_path->get_text().get_file().get_basename()+".scn"); print_line("Saving to: "+save_file); @@ -794,7 +794,7 @@ void EditorSceneImportDialog::_import(bool p_and_open) { rim->set_option("root_type",root_type->get_text()); } if (root_node_name->get_text().size()==0) { - root_node_name->set_text(import_path->get_text().get_file().basename()); + root_node_name->set_text(import_path->get_text().get_file().get_basename()); } rim->set_option("root_name",root_node_name->get_text()); @@ -1237,7 +1237,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce error_dialog = memnew ( ConfirmationDialog ); add_child(error_dialog); error_dialog->get_ok()->set_text(TTR("Accept")); -// error_dialog->get_cancel()->hide(); + //error_dialog->get_cancel()->hide(); HBoxContainer *custom_root_hb = memnew( HBoxContainer ); @@ -1302,7 +1302,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce add_child(confirm_import); VBoxContainer *cvb = memnew( VBoxContainer ); confirm_import->add_child(cvb); -// confirm_import->set_child_rect(cvb); + //confirm_import->set_child_rect(cvb); PanelContainer *pc = memnew( PanelContainer ); pc->add_style_override("panel",get_stylebox("normal","TextEdit")); @@ -1421,9 +1421,11 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map<Ref<Imag if (tex.is_valid()) { image_map.insert(tex,TEXTURE_ROLE_NORMALMAP); - //if (p_flags&SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY) - // res->cast_to<FixedSpatialMaterial>()->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_XY_NORMALMAP,true); - }// + /* + if (p_flags&SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY) + res->cast_to<FixedSpatialMaterial>()->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_XY_NORMALMAP,true); + */ + } } else { @@ -1531,10 +1533,10 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> Ref<FixedSpatialMaterial> fm = m->surface_get_material(i); if (fm.is_valid()) { - // fm->set_flag(Material::FLAG_UNSHADED,true); - // fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); - // fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - // fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + //fm->set_flag(Material::FLAG_UNSHADED,true); + //fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); + //fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); + //fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); } } } @@ -1558,8 +1560,8 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> if (p_flags&SCENE_FLAG_DETECT_ALPHA && _teststr(mat->get_name(),"alpha")) { - // mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); - // mat->set_name(_fixstr(mat->get_name(),"alpha")); + //mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + //mat->set_name(_fixstr(mat->get_name(),"alpha")); } if (p_flags&SCENE_FLAG_DETECT_VCOLOR && _teststr(mat->get_name(),"vcol")) { @@ -1640,10 +1642,10 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> Ref<FixedSpatialMaterial> fm = m->surface_get_material(i); if (fm.is_valid()) { - // fm->set_flag(Material::FLAG_UNSHADED,true); - // fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); - // fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - // fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + //fm->set_flag(Material::FLAG_UNSHADED,true); + //fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); + //fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); + //fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); } } } @@ -2124,7 +2126,7 @@ Error EditorSceneImportPlugin::import1(const Ref<ResourceImportMetadata>& p_from String src_path=EditorImportPlugin::expand_source_path(from->get_source_path(0)); Ref<EditorSceneImporter> importer; - String ext=src_path.extension().to_lower(); + String ext=src_path.get_extension().to_lower(); EditorProgress progress("import",TTR("Import Scene"),104); @@ -2172,8 +2174,10 @@ Error EditorSceneImportPlugin::import1(const Ref<ResourceImportMetadata>& p_from import_flags|=EditorSceneImporter::IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS; if (scene_flags&SCENE_FLAG_IMPORT_ANIMATIONS) import_flags|=EditorSceneImporter::IMPORT_ANIMATION; - //if (scene_flags&SCENE_FLAG_FAIL_ON_MISSING_IMAGES) - // import_flags|=EditorSceneImporter::IMPORT_FAIL_ON_MISSING_DEPENDENCIES; + /* + if (scene_flags&SCENE_FLAG_FAIL_ON_MISSING_IMAGES) + import_flags|=EditorSceneImporter::IMPORT_FAIL_ON_MISSING_DEPENDENCIES; + */ if (scene_flags&SCENE_FLAG_GENERATE_TANGENT_ARRAYS) import_flags|=EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS; @@ -2821,7 +2825,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c { - target_path=target_path.basename()+".tex"; + target_path=target_path.get_basename()+".tex"; Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata ); @@ -2936,7 +2940,7 @@ void EditorSceneImportPlugin::import_from_drop(const Vector<String>& p_drop,cons //bool warn_compatible=false; for(int i=0;i<p_drop.size();i++) { - String extension = p_drop[i].extension().to_lower(); + String extension = p_drop[i].get_extension().to_lower(); for(List<String>::Element *E=extensions.front();E;E=E->next()) { diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 3bf2551778..5ba7d0c417 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -344,7 +344,7 @@ void EditorTextureImportDialog::_choose_save_dir(const String& p_path) { void EditorTextureImportDialog::_import() { -// ImportMonitorBlock imb; + //ImportMonitorBlock imb; Vector<String> files=import_path->get_text().split(","); @@ -448,7 +448,7 @@ void EditorTextureImportDialog::_import() { for(int i=0;i<files.size();i++) { String dst_file = dst_path.plus_file(files[i].get_file()); - dst_file=dst_file.basename()+".tex"; + dst_file=dst_file.get_basename()+".tex"; Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata ); //imd->set_editor(); imd->add_source(EditorImportPlugin::validate_source_path(files[i])); @@ -539,7 +539,7 @@ void EditorTextureImportDialog::_notification(int p_what) { List<String> extensions; ImageLoader::get_recognized_extensions(&extensions); - // ResourceLoader::get_recognized_extensions_for_type("PackedTexture",&extensions); + //ResourceLoader::get_recognized_extensions_for_type("PackedTexture",&extensions); file_select->clear_filters(); for(int i=0;i<extensions.size();i++) { @@ -643,7 +643,7 @@ void EditorTextureImportDialog::_bind_methods() { ClassDB::bind_method("_browse",&EditorTextureImportDialog::_browse); ClassDB::bind_method("_browse_target",&EditorTextureImportDialog::_browse_target); ClassDB::bind_method("_mode_changed",&EditorTextureImportDialog::_mode_changed); -// ADD_SIGNAL( MethodInfo("imported",PropertyInfo(Variant::OBJECT,"scene")) ); + //ADD_SIGNAL( MethodInfo("imported",PropertyInfo(Variant::OBJECT,"scene")) ); } EditorTextureImportDialog::EditorTextureImportDialog(EditorTextureImportPlugin* p_plugin) { @@ -760,20 +760,22 @@ EditorTextureImportDialog::EditorTextureImportDialog(EditorTextureImportPlugin* save_select = memnew( EditorDirDialog ); add_child(save_select); -// save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR); + //save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR); save_select->connect("dir_selected", this,"_choose_save_dir"); get_ok()->connect("pressed", this,"_import"); get_ok()->set_text(TTR("Import")); //move stuff up - //for(int i=0;i<4;i++) - // vbc->move_child( vbc->get_child( vbc->get_child_count() -1), 0); + /* + for(int i=0;i<4;i++) + vbc->move_child( vbc->get_child( vbc->get_child_count() -1), 0); + */ error_dialog = memnew ( ConfirmationDialog ); add_child(error_dialog); error_dialog->get_ok()->set_text(TTR("Accept")); -// error_dialog->get_cancel()->hide(); + //error_dialog->get_cancel()->hide(); set_hide_on_ok(false); @@ -784,8 +786,8 @@ EditorTextureImportDialog::EditorTextureImportDialog(EditorTextureImportPlugin* _mode_changed(EditorTextureImportPlugin::MODE_TEXTURE_3D); -// GLOBAL_DEF("import/shared_textures","res://"); -// Globals::get_singleton()->set_custom_property_info("import/shared_textures",PropertyInfo(Variant::STRING,"import/shared_textures",PROPERTY_HINT_DIR)); + //GLOBAL_DEF("import/shared_textures","res://"); + //Globals::get_singleton()->set_custom_property_info("import/shared_textures",PropertyInfo(Variant::STRING,"import/shared_textures",PROPERTY_HINT_DIR)); } @@ -944,10 +946,12 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref<ImageTexture> &textur image.normalmap_to_xy(); } - //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { + /* + if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { - // image.srgb_to_linear(); - //} + image.srgb_to_linear(); + } + */ if (shrink>1) { @@ -1003,11 +1007,13 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref<ImageTexture> &textur image.normalmap_to_xy(); } - //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { -// - // print_line("CONVERT BECAUSE: "+itos(flags)); - // image.srgb_to_linear(); - //} + /* + if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { + + print_line("CONVERT BECAUSE: "+itos(flags)); + image.srgb_to_linear(); + } + */ int orig_w=image.get_width(); int orig_h=image.get_height(); @@ -1307,9 +1313,9 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc String spath = from->get_source_path(E->get()).get_file(); if (p_external) { - apath = p_path.get_base_dir().plus_file(spath.basename()+"."+from->get_source_path(E->get()).md5_text()+".atex"); + apath = p_path.get_base_dir().plus_file(spath.get_basename()+"."+from->get_source_path(E->get()).md5_text()+".atex"); } else { - apath = p_path.get_base_dir().plus_file(spath.basename()+".atex"); + apath = p_path.get_base_dir().plus_file(spath.get_basename()+".atex"); } Ref<AtlasTexture> at; @@ -1425,10 +1431,12 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc image.normalmap_to_xy(); } - //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { + /* + if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { - // image.srgb_to_linear(); - //} + image.srgb_to_linear(); + } + */ if (shrink>1) { @@ -1484,11 +1492,13 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc image.normalmap_to_xy(); } - //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { -// - // print_line("CONVERT BECAUSE: "+itos(flags)); - // image.srgb_to_linear(); - //} + /* + if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { + + print_line("CONVERT BECAUSE: "+itos(flags)); + image.srgb_to_linear(); + } + */ int orig_w=image.get_width(); int orig_h=image.get_height(); @@ -1597,7 +1607,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c rimd->set_option("shrink",group_shrink); rimd->add_source(validated_path,FileAccess::get_md5(p_path)); - } else if (EditorImportExport::get_singleton()->get_image_formats().has(p_path.extension().to_lower()) && EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE) { + } else if (EditorImportExport::get_singleton()->get_image_formats().has(p_path.get_extension().to_lower()) && EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE) { //handled by general image export settings rimd = Ref<ResourceImportMetadata>( memnew( ResourceImportMetadata ) ); @@ -1743,7 +1753,7 @@ void EditorTextureImportPlugin::import_from_drop(const Vector<String>& p_drop,co ImageLoader::get_recognized_extensions(&valid_extensions); for(int i=0;i<p_drop.size();i++) { - String extension=p_drop[i].extension().to_lower(); + String extension=p_drop[i].get_extension().to_lower(); for (List<String>::Element *E=valid_extensions.front();E;E=E->next()) { @@ -1851,21 +1861,21 @@ EditorTextureImportPlugin::EditorTextureImportPlugin(EditorNode *p_editor) { if (pl.is_valid()) { Vector<uint8_t> ce = pl->custom_export(p_path,p_platform); if (ce.size()) { - p_path=p_path.basename()+".converted.tex"; + p_path=p_path.get_basename()+".converted.tex"; return ce; } } } else if (EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE){ - String xt = p_path.extension().to_lower(); + String xt = p_path.get_extension().to_lower(); if (EditorImportExport::get_singleton()->get_image_formats().has(xt)) { //should check for more I guess? Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture"); if (pl.is_valid()) { Vector<uint8_t> ce = pl->custom_export(p_path,p_platform); if (ce.size()) { - p_path=p_path.basename()+".converted.tex"; + p_path=p_path.get_basename()+".converted.tex"; return ce; } } diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.cpp b/tools/editor/io_plugins/editor_translation_import_plugin.cpp index 73d9e989ac..d9288f5990 100644 --- a/tools/editor/io_plugins/editor_translation_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -255,7 +255,7 @@ public: imd->set_option("skip_first",ignore_first->is_pressed()); imd->set_option("compress",compress->is_pressed()); - String savefile = save_path->get_text().plus_file(import_path->get_text().get_file().basename()+"."+locale+".xl"); + String savefile = save_path->get_text().plus_file(import_path->get_text().get_file().get_basename()+"."+locale+".xl"); Error err = plugin->import(savefile,imd); if (err!=OK) { error_dialog->set_text(TTR("Couldn't import!")); @@ -287,7 +287,7 @@ public: ClassDB::bind_method("_import",&EditorTranslationImportDialog::_import); ClassDB::bind_method("_browse",&EditorTranslationImportDialog::_browse); ClassDB::bind_method("_browse_target",&EditorTranslationImportDialog::_browse_target); - // ADD_SIGNAL( MethodInfo("imported",PropertyInfo(Variant::OBJECT,"scene")) ); + //ADD_SIGNAL( MethodInfo("imported",PropertyInfo(Variant::OBJECT,"scene")) ); } EditorTranslationImportDialog(EditorTranslationImportPlugin *p_plugin) { @@ -356,7 +356,7 @@ public: save_select = memnew( EditorDirDialog ); add_child(save_select); - // save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR); + //save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR); save_select->connect("dir_selected", this,"_choose_save_dir"); get_ok()->connect("pressed", this,"_import"); @@ -366,7 +366,7 @@ public: error_dialog = memnew ( ConfirmationDialog ); add_child(error_dialog); error_dialog->get_ok()->set_text(TTR("Accept")); - // error_dialog->get_cancel()->hide(); + //error_dialog->get_cancel()->hide(); set_hide_on_ok(false); @@ -400,7 +400,7 @@ void EditorTranslationImportPlugin::import_from_drop(const Vector<String>& p_dro for(int i=0;i<p_drop.size();i++) { - String ext = p_drop[i].extension().to_lower(); + String ext = p_drop[i].get_extension().to_lower(); if (ext=="csv") { diff --git a/tools/editor/output_strings.cpp b/tools/editor/output_strings.cpp index 9ba97451c0..cb43bb9230 100644 --- a/tools/editor/output_strings.cpp +++ b/tools/editor/output_strings.cpp @@ -82,7 +82,7 @@ void OutputStrings::_notification(int p_what) { Ref<Texture> icon_error = get_icon("Error","EditorIcons"); Ref<Texture> icon_warning = get_icon("Warning","EditorIcons"); - // int lines = (size_height-(int)margin.y) / font_height; + //int lines = (size_height-(int)margin.y) / font_height; Point2 ofs=tree_st->get_offset(); LineMap::Element *E = line_map.find(v_scroll->get_value()); diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 3201db1116..59ab3bc467 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -94,7 +94,7 @@ void AnimationPlayerEditor::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { -// editor->connect("hide_animation_player_editors",this,"_hide_anim_editors"); + //editor->connect("hide_animation_player_editors",this,"_hide_anim_editors"); add_anim->set_icon( get_icon("New","EditorIcons") ); rename_anim->set_icon( get_icon("Rename","EditorIcons") ); duplicate_anim->set_icon( get_icon("Duplicate","EditorIcons") ); @@ -377,8 +377,10 @@ void AnimationPlayerEditor::_animation_save_in_path(const Ref<Resource>& p_resou int flg = 0; if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) flg |= ResourceSaver::FLAG_COMPRESS; - //if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) - // flg |= ResourceSaver::FLAG_RELATIVE_PATHS; + /* + if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) + flg |= ResourceSaver::FLAG_RELATIVE_PATHS; + */ String path = GlobalConfig::get_singleton()->localize_path(p_path); Error err = ResourceSaver::save(path, p_resource, flg | ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); @@ -388,7 +390,7 @@ void AnimationPlayerEditor::_animation_save_in_path(const Ref<Resource>& p_resou accept->popup_centered_minsize(); return; } - // EditorFileSystem::get_singleton()->update_file(path,p_resource->get_type()); + //EditorFileSystem::get_singleton()->update_file(path,p_resource->get_type()); ((Resource*)p_resource.ptr())->set_path(path); editor->emit_signal("resource_saved", p_resource); @@ -421,7 +423,7 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource>& p_resource) if (p_resource->get_path() != "") { file->set_current_path(p_resource->get_path()); if (extensions.size()) { - String ext = p_resource->get_path().extension().to_lower(); + String ext = p_resource->get_path().get_extension().to_lower(); if (extensions.find(ext) == NULL) { file->set_current_path(p_resource->get_path().replacen("." + ext, "." + extensions.front()->get())); } @@ -648,8 +650,8 @@ Dictionary AnimationPlayerEditor::get_state() const { Dictionary d; - d["visible"]=is_visible(); - if (EditorNode::get_singleton()->get_edited_scene() && is_visible() && player) { + d["visible"]=is_visible_in_tree(); + if (EditorNode::get_singleton()->get_edited_scene() && is_visible_in_tree() && player) { d["player"]=EditorNode::get_singleton()->get_edited_scene()->get_path_to(player); d["animation"]=player->get_current_animation(); @@ -672,7 +674,7 @@ void AnimationPlayerEditor::set_state(const Dictionary& p_state) { show(); set_process(true); ensure_visibility(); -// EditorNode::get_singleton()->animation_panel_make_visible(true); + //EditorNode::get_singleton()->animation_panel_make_visible(true); if (p_state.has("animation")) { String anim = p_state["animation"]; @@ -768,7 +770,7 @@ void AnimationPlayerEditor::_dialog_action(String p_file) { void AnimationPlayerEditor::_scale_changed(const String& p_scale) { - player->set_speed(p_scale.to_double()); + player->set_speed_scale(p_scale.to_double()); } void AnimationPlayerEditor::_update_animation() { @@ -790,7 +792,7 @@ void AnimationPlayerEditor::_update_animation() { stop->set_pressed(true); } - scale->set_text( String::num(player->get_speed(),2) ); + scale->set_text( String::num(player->get_speed_scale(),2) ); String current=player->get_current_animation(); for (int i=0;i<animation->get_item_count();i++) { @@ -897,7 +899,7 @@ void AnimationPlayerEditor::edit(AnimationPlayer *p_player) { } else { key_editor->show_select_node_warning(true); -// hide(); + //hide(); } @@ -999,10 +1001,10 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value,bool p_set) { void AnimationPlayerEditor::_animation_player_changed(Object *p_pl) { - if (player==p_pl && is_visible()) { + if (player==p_pl && is_visible_in_tree()) { _update_player(); - if (blend_editor.dialog->is_visible()) + if (blend_editor.dialog->is_visible_in_tree()) _animation_blend(); //update } } @@ -1011,7 +1013,7 @@ void AnimationPlayerEditor::_animation_player_changed(Object *p_pl) { void AnimationPlayerEditor::_list_changed() { - if(is_visible()) + if(is_visible_in_tree()) _update_player(); } #if 0 @@ -1099,7 +1101,7 @@ void AnimationPlayerEditor::_animation_key_editor_anim_step_changed(float p_len) void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos,bool p_drag) { - if (!is_visible()) + if (!is_visible_in_tree()) return; if (!player) return; @@ -1128,7 +1130,7 @@ void AnimationPlayerEditor::_hide_anim_editors() { key_editor->set_animation(Ref<Animation>()); key_editor->set_root(NULL); key_editor->show_select_node_warning(true); -// editor->animation_editor_make_visible(false); + //editor->animation_editor_make_visible(false); } @@ -1220,7 +1222,7 @@ void AnimationPlayerEditor::_animation_save_menu(int p_option) { void AnimationPlayerEditor::_unhandled_key_input(const InputEvent& p_ev) { - if (is_visible() && p_ev.type==InputEvent::KEY && p_ev.key.pressed && !p_ev.key.echo && !p_ev.key.mod.alt && !p_ev.key.mod.control && !p_ev.key.mod.meta) { + if (is_visible_in_tree() && p_ev.type==InputEvent::KEY && p_ev.key.pressed && !p_ev.key.echo && !p_ev.key.mod.alt && !p_ev.key.mod.control && !p_ev.key.mod.meta) { switch(p_ev.key.scancode) { @@ -1267,7 +1269,7 @@ void AnimationPlayerEditor::_bind_methods() { ClassDB::bind_method(_MD("_seek_value_changed"),&AnimationPlayerEditor::_seek_value_changed,DEFVAL(true)); ClassDB::bind_method(_MD("_animation_player_changed"),&AnimationPlayerEditor::_animation_player_changed); ClassDB::bind_method(_MD("_blend_edited"),&AnimationPlayerEditor::_blend_edited); -// ClassDB::bind_method(_MD("_seek_frame_changed"),&AnimationPlayerEditor::_seek_frame_changed); + //ClassDB::bind_method(_MD("_seek_frame_changed"),&AnimationPlayerEditor::_seek_frame_changed); ClassDB::bind_method(_MD("_scale_changed"),&AnimationPlayerEditor::_scale_changed); //ClassDB::bind_method(_MD("_editor_store_all"),&AnimationPlayerEditor::_editor_store_all); ///jectTypeDB::bind_method(_MD("_editor_load_all"),&AnimationPlayerEditor::_editor_load_all); @@ -1552,11 +1554,11 @@ void AnimationPlayerEditorPlugin::make_visible(bool p_visible) { editor->make_bottom_panel_item_visible(anim_editor); anim_editor->set_process(true); anim_editor->ensure_visibility(); -// editor->animation_panel_make_visible(true); + //editor->animation_panel_make_visible(true); } else { -// anim_editor->hide(); -// anim_editor->set_idle_process(false); + //anim_editor->hide(); + //anim_editor->set_idle_process(false); } } diff --git a/tools/editor/plugins/animation_player_editor_plugin.h b/tools/editor/plugins/animation_player_editor_plugin.h index 9074eb127b..840c39ba49 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.h +++ b/tools/editor/plugins/animation_player_editor_plugin.h @@ -73,7 +73,7 @@ class AnimationPlayerEditor : public VBoxContainer { Button *play_bw; Button *play_bw_from; -// Button *pause; + //Button *pause; Button *add_anim; Button *autoplay; Button *rename_anim; diff --git a/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp index 3b28e8610b..eedebab1c9 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.cpp +++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp @@ -621,9 +621,9 @@ void AnimationTreeEditor::_draw_node(const StringName& p_node) { #if 0 void AnimationTreeEditor::_node_param_changed() { -// anim_tree->node_set_param( click_node,property_editor->get_variant() ); -// update(); -// _write_anim_tree_graph(); + //anim_tree->node_set_param( click_node,property_editor->get_variant() ); + //update(); + //_write_anim_tree_graph(); } #endif @@ -792,7 +792,7 @@ void AnimationTreeEditor::_gui_input(InputEvent p_event) { renaming_edit=false; _popup_edit_dialog(); //open editor - // _node_edit_property(click_node); + //_node_edit_property(click_node); } break; default:{} } @@ -856,12 +856,12 @@ void AnimationTreeEditor::_gui_input(InputEvent p_event) { if (dst_click_type==CLICK_INPUT_SLOT && click_type==CLICK_OUTPUT_SLOT) { - anim_tree->connect(click_node,id,slot); + anim_tree->connect_nodes(click_node,id,slot); } if (click_type==CLICK_INPUT_SLOT && dst_click_type==CLICK_OUTPUT_SLOT) { - anim_tree->connect(id,click_node,click_slot); + anim_tree->connect_nodes(id,click_node,click_slot); } } break; @@ -1057,7 +1057,7 @@ void AnimationTreeEditor::_node_menu_item(int p_item) { if (rclick_type==CLICK_INPUT_SLOT) { - anim_tree->disconnect(rclick_node,rclick_slot); + anim_tree->disconnect_nodes(rclick_node,rclick_slot); update(); } @@ -1072,7 +1072,7 @@ void AnimationTreeEditor::_node_menu_item(int p_item) { const AnimationTreePlayer::Connection &c=E->get(); if( c.dst_node==rclick_node) { - anim_tree->disconnect(c.dst_node,c.dst_input); + anim_tree->disconnect_nodes(c.dst_node,c.dst_input); } } update(); @@ -1325,7 +1325,7 @@ void AnimationTreeEditor::_bind_methods() { ClassDB::bind_method( "_add_menu_item", &AnimationTreeEditor::_add_menu_item ); ClassDB::bind_method( "_node_menu_item", &AnimationTreeEditor::_node_menu_item ); ClassDB::bind_method( "_gui_input", &AnimationTreeEditor::_gui_input ); -// ClassDB::bind_method( "_node_param_changed", &AnimationTreeEditor::_node_param_changed ); + //ClassDB::bind_method( "_node_param_changed", &AnimationTreeEditor::_node_param_changed ); ClassDB::bind_method( "_scroll_moved", &AnimationTreeEditor::_scroll_moved ); ClassDB::bind_method( "_edit_dialog_changeds", &AnimationTreeEditor::_edit_dialog_changeds ); ClassDB::bind_method( "_edit_dialog_changede", &AnimationTreeEditor::_edit_dialog_changede ); @@ -1414,8 +1414,8 @@ AnimationTreeEditor::AnimationTreeEditor() { updating_edit=false; edit_dialog = memnew( PopupPanel ); -// edit_dialog->get_ok()->hide(); -// edit_dialog->get_cancel()->hide(); + //edit_dialog->get_ok()->hide(); + //edit_dialog->get_cancel()->hide(); add_child(edit_dialog); edit_option = memnew( OptionButton ); @@ -1502,14 +1502,14 @@ bool AnimationTreeEditorPlugin::handles(Object *p_object) const { void AnimationTreeEditorPlugin::make_visible(bool p_visible) { if (p_visible) { -// editor->hide_animation_player_editors(); -// editor->animation_panel_make_visible(true); + //editor->hide_animation_player_editors(); + //editor->animation_panel_make_visible(true); button->show(); editor->make_bottom_panel_item_visible(anim_tree_editor); anim_tree_editor->set_fixed_process(true); } else { - if (anim_tree_editor->is_visible()) + if (anim_tree_editor->is_visible_in_tree()) editor->hide_bottom_panel(); button->hide(); anim_tree_editor->set_fixed_process(false); diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp index 2d91524ef9..0b12d080e4 100644 --- a/tools/editor/plugins/baked_light_baker.cpp +++ b/tools/editor/plugins/baked_light_baker.cpp @@ -1006,8 +1006,10 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c Triangle *triangle=NULL; - //for(int i=0;i<max_depth;i++) - // stack[i]=0; + /* + for(int i=0;i<max_depth;i++) + stack[i]=0; + */ int level=0; //AABB ray_aabb; @@ -1059,7 +1061,7 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c bool valid = b.aabb.smits_intersect_ray(p_begin,n,0,len); //bool valid = b.aabb.intersects_segment(p_begin,p_end); - // bool valid = b.aabb.intersects(ray_aabb); + //bool valid = b.aabb.intersects(ray_aabb); if (!valid) { @@ -1234,7 +1236,7 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c } //specular later -// _plot_light_point(r_point,octree,octree_aabb,p_light); + //_plot_light_point(r_point,octree,octree_aabb,p_light); Color plot_light=res_light.linear_interpolate(diffuse_at_point,tint); @@ -1678,7 +1680,7 @@ void BakedLightBaker::throw_rays(ThreadStack& thread_stack,int p_amount) { dl.rays_thrown++; baked_light_baker_add_64i(&total_rays,1); _throw_ray(thread_stack,dl.bake_direct,from,to,dl.radius,col,dl.attenuation_table.ptr(),0,dl.radius,max_bounces,true); -// _throw_ray(i,from,to,dl.radius,col,NULL,0,dl.radius,max_bounces,true); + //_throw_ray(i,from,to,dl.radius,col,NULL,0,dl.radius,max_bounces,true); } } break; @@ -1710,7 +1712,7 @@ void BakedLightBaker::throw_rays(ThreadStack& thread_stack,int p_amount) { dl.rays_thrown++; baked_light_baker_add_64i(&total_rays,1); _throw_ray(thread_stack,dl.bake_direct,from,to,dl.radius,col,dl.attenuation_table.ptr(),0,dl.radius,max_bounces,true); - // _throw_ray(i,from,to,dl.radius,col,NULL,0,dl.radius,max_bounces,true); + //_throw_ray(i,from,to,dl.radius,col,NULL,0,dl.radius,max_bounces,true); } } break; @@ -2010,8 +2012,10 @@ void BakedLightBaker::update_octree_images(PoolVector<uint8_t> &p_octree,PoolVec //write colors for(int j=0;j<8;j++) { - //if (!oct.children[j]) - // continue; + /* + if (!oct.children[j]) + continue; + */ uint8_t *iptr=&lptr[ofs+lchild_offsets[j]]; float r=oct.light_accum[j][0]*norm; @@ -2291,7 +2295,7 @@ void BakedLightBaker::_plot_pixel_to_lightmap(int x, int y, int width, int heigh bool valid = b.aabb.smits_intersect_ray(from,n,0,len); //bool valid = b.aabb.intersects_segment(p_begin,p_end); - // bool valid = b.aabb.intersects(ray_aabb); + //bool valid = b.aabb.intersects(ray_aabb); if (!valid) { @@ -2649,10 +2653,13 @@ void BakedLightBaker::clear() { /* * ??? for(int i=0;i<octant_pool.size();i++) { - //if (octant_pool[i].leaf) { - // memdelete_arr( octant_pool[i].light ); - //} Vector<double> norm_arr; - //norm_arr.resize(lights.size()); + /* + if (octant_pool[i].leaf) { + memdelete_arr( octant_pool[i].light ); + } + Vector<double> norm_arr; + norm_arr.resize(lights.size()); + */ for(int i=0;i<lights.size();i++) { norm_arr[i] = 1.0/get_normalization(i); diff --git a/tools/editor/plugins/baked_light_baker.h b/tools/editor/plugins/baked_light_baker.h index 6fcf78dd0a..89788338d9 100644 --- a/tools/editor/plugins/baked_light_baker.h +++ b/tools/editor/plugins/baked_light_baker.h @@ -45,10 +45,11 @@ public: OCTANT_POOL_CHUNK=1000000 }; - //struct OctantLight { - - // double accum[8][3]; - //}; + /* + struct OctantLight { + double accum[8][3]; + }; + */ struct Octant { bool leaf; diff --git a/tools/editor/plugins/baked_light_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp index 8f564a3247..26c3144188 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.cpp +++ b/tools/editor/plugins/baked_light_editor_plugin.cpp @@ -105,8 +105,10 @@ void BakedLightEditor::_notification(int p_option) { colors[i].b=oct->light_accum[i][2]/norm; float lum = colors[i].get_v(); - //if (lum<0.05) - // color.a=0; + /* + if (lum<0.05) + color.a=0; + */ if (lum>max_lum) max_lum=lum; @@ -141,7 +143,7 @@ void BakedLightEditor::_notification(int p_option) { baker->update_octree_images(octree_texture,light_texture); baker->update_octree_sampler(octree_sampler); - // print_line("sampler size: "+itos(octree_sampler.size()*4)); + //print_line("sampler size: "+itos(octree_sampler.size()*4)); #if 1 //debug diff --git a/tools/editor/plugins/camera_editor_plugin.cpp b/tools/editor/plugins/camera_editor_plugin.cpp index 67f776ba0b..1c8c392d65 100644 --- a/tools/editor/plugins/camera_editor_plugin.cpp +++ b/tools/editor/plugins/camera_editor_plugin.cpp @@ -114,10 +114,8 @@ bool CameraEditorPlugin::handles(Object *p_object) const { void CameraEditorPlugin::make_visible(bool p_visible) { if (p_visible) { -// SpatialEditor::get_singleton()->set_can_preview(p_object->cast_to<Camera>()); - + //SpatialEditor::get_singleton()->set_can_preview(p_object->cast_to<Camera>()); } else { - SpatialEditor::get_singleton()->set_can_preview(NULL); } diff --git a/tools/editor/plugins/camera_editor_plugin.h b/tools/editor/plugins/camera_editor_plugin.h index 56702f174b..7e79d0ec74 100644 --- a/tools/editor/plugins/camera_editor_plugin.h +++ b/tools/editor/plugins/camera_editor_plugin.h @@ -60,7 +60,7 @@ class CameraEditorPlugin : public EditorPlugin { GDCLASS( CameraEditorPlugin, EditorPlugin ); -// CameraEditor *camera_editor; + //CameraEditor *camera_editor; EditorNode *editor; public: diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 1abbac4539..66dd98590d 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -41,7 +41,7 @@ #include "os/input.h" #include "tools/editor/editor_settings.h" #include "scene/gui/grid_container.h" -#include "scene/gui/patch_9_frame.h" +#include "scene/gui/patch_9_rect.h" #include "tools/editor/animation_editor.h" #include "tools/editor/plugins/animation_player_editor_plugin.h" #include "tools/editor/script_editor_debugger.h" @@ -79,7 +79,7 @@ public: container = memnew( VBoxContainer ); add_child(container); - // set_child_rect(container); + //set_child_rect(container); child_container = memnew( GridContainer ); child_container->set_columns(3); @@ -209,7 +209,7 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2& mouse_pos) { void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { - if (!is_visible() || get_viewport()->gui_has_modal_stack()) + if (!is_visible_in_tree() || get_viewport()->gui_has_modal_stack()) return; if (p_ev.key.mod.control) @@ -287,7 +287,7 @@ Dictionary CanvasItemEditor::get_state() const { Dictionary state; state["zoom"]=zoom; state["ofs"]=Point2(h_scroll->get_value(),v_scroll->get_value()); -// state["ofs"]=-transform.get_origin(); + //state["ofs"]=-transform.get_origin(); state["snap_offset"]=snap_offset; state["snap_step"]=snap_step; state["snap_rotation_offset"]=snap_rotation_offset; @@ -425,7 +425,7 @@ void CanvasItemEditor::_node_removed(Node *p_node) { void CanvasItemEditor::_keying_changed() { - if (AnimationPlayerEditor::singleton->get_key_editor()->is_visible()) + if (AnimationPlayerEditor::singleton->get_key_editor()->is_visible_in_tree()) animation_hb->show(); else animation_hb->hide(); @@ -465,7 +465,7 @@ CanvasItem* CanvasItemEditor::_select_canvas_item_at_pos(const Point2& p_pos,Nod return r; } - if (c && c->is_visible() && !c->has_meta("_edit_lock_") && !_is_part_of_subscene(c) && !c->cast_to<CanvasLayer>()) { + if (c && c->is_visible_in_tree() && !c->has_meta("_edit_lock_") && !_is_part_of_subscene(c) && !c->cast_to<CanvasLayer>()) { Rect2 rect = c->get_item_rect(); Point2 local_pos = (p_parent_xform * p_canvas_xform * c->get_transform()).affine_inverse().xform(p_pos); @@ -498,7 +498,7 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos,Node* p_nod } - if (c && c->is_visible() && !c->has_meta("_edit_lock_") && !c->cast_to<CanvasLayer>()) { + if (c && c->is_visible_in_tree() && !c->has_meta("_edit_lock_") && !c->cast_to<CanvasLayer>()) { Rect2 rect = c->get_item_rect(); Point2 local_pos = (p_parent_xform * p_canvas_xform * c->get_transform()).affine_inverse().xform(p_pos); @@ -547,7 +547,7 @@ void CanvasItemEditor::_find_canvas_items_at_rect(const Rect2& p_rect,Node* p_no } } - if (c && c->is_visible() && !c->has_meta("_edit_lock_") && !c->cast_to<CanvasLayer>()) { + if (c && c->is_visible_in_tree() && !c->has_meta("_edit_lock_") && !c->cast_to<CanvasLayer>()) { Rect2 rect = c->get_item_rect(); Transform2D xform = p_parent_xform * p_canvas_xform * c->get_transform(); @@ -633,7 +633,7 @@ bool CanvasItemEditor::_select(CanvasItem *item, Point2 p_click_pos, bool p_appe for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) continue; @@ -676,7 +676,7 @@ void CanvasItemEditor::_key_move(const Vector2& p_dir, bool p_snap, KeyMoveMODE for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) continue; @@ -738,7 +738,7 @@ Point2 CanvasItemEditor::_find_topleftmost_point() { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) continue; @@ -769,7 +769,7 @@ int CanvasItemEditor::get_item_count() { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) @@ -791,7 +791,7 @@ CanvasItem *CanvasItemEditor::get_single_item() { for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) continue; @@ -1152,7 +1152,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) continue; @@ -1187,8 +1187,10 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { } return; } - //if (!canvas_items.size()) - // return; + /* + if (!canvas_items.size()) + return; + */ if (b.button_index==BUTTON_LEFT && tool==TOOL_LIST_SELECT) { if (b.pressed) @@ -1247,7 +1249,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) continue; @@ -1417,7 +1419,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { Transform2D xform = transform * canvas_item->get_global_transform_with_canvas(); Rect2 rect=canvas_item->get_item_rect(); - // float handle_radius = handle_len * 1.4144; //magic number, guess what it means! + //float handle_radius = handle_len * 1.4144; //magic number, guess what it means! if (tool==TOOL_SELECT) { drag = _find_drag_type(xform,rect,click,drag_point_from); @@ -1458,7 +1460,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) continue; @@ -1568,7 +1570,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) continue; @@ -1652,7 +1654,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { Vector2 minsize = canvas_item->edit_get_minimum_size(); if (uniform) { - float aspect = local_rect.size.get_aspect(); + float aspect = local_rect.size.aspect(); switch(drag) { case DRAG_BOTTOM_LEFT: case DRAG_TOP_RIGHT: { @@ -1947,9 +1949,9 @@ void CanvasItemEditor::_viewport_draw() { if (viewport->has_focus()) { Size2 size = viewport->get_size(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) size.width-=v_scroll->get_size().width; - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) size.height-=h_scroll->get_size().height; get_stylebox("EditorFocus","EditorStyles")->draw(ci,Rect2(Point2(),size)); @@ -1969,7 +1971,7 @@ void CanvasItemEditor::_viewport_draw() { CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) continue; @@ -2198,7 +2200,7 @@ void CanvasItemEditor::_notification(int p_what) { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) @@ -2226,7 +2228,7 @@ void CanvasItemEditor::_notification(int p_what) { } bool show_anchor = all_control && has_control; - if (show_anchor != !anchor_menu->is_hidden()) { + if (show_anchor != anchor_menu->is_visible()) { if (show_anchor) anchor_menu->show(); else @@ -2342,7 +2344,7 @@ void CanvasItemEditor::_find_canvas_items_span(Node *p_node, Rect2& r_rect, cons for (int i=p_node->get_child_count()-1;i>=0;i--) { -// CanvasItem *r=NULL; + //CanvasItem *r=NULL; if (c && !c->is_set_as_toplevel()) _find_canvas_items_span(p_node->get_child(i),r_rect,p_xform * c->get_transform()); @@ -2473,14 +2475,14 @@ void CanvasItemEditor::_update_scrollbars() { ofs.x=h_scroll->get_value(); } -// transform=Matrix32(); + //transform=Matrix32(); transform.elements[2]=-ofs*zoom; editor->get_scene_root()->set_global_canvas_transform(transform); updating_scroll=false; -// transform.scale_basis(Vector2(zoom,zoom)); + //transform.scale_basis(Vector2(zoom,zoom)); } @@ -2495,7 +2497,7 @@ void CanvasItemEditor::_update_scroll(float) { ofs.x=h_scroll->get_value(); ofs.y=v_scroll->get_value(); -// current_window->set_scroll(-ofs); + //current_window->set_scroll(-ofs); transform=Transform2D(); @@ -2619,7 +2621,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) @@ -2637,7 +2639,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) @@ -2658,7 +2660,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) @@ -2676,7 +2678,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) @@ -2697,7 +2699,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) @@ -2818,7 +2820,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) @@ -2931,7 +2933,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) @@ -2983,7 +2985,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) @@ -3004,8 +3006,10 @@ void CanvasItemEditor::_popup_callback(int p_op) { if (key_pos) ctrl->set_pos(Point2()); - //if (key_scale) - // AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl,"rect/size",ctrl->get_size()); + /* + if (key_scale) + AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl,"rect/size",ctrl->get_size()); + */ } } @@ -3029,7 +3033,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { Node2D *n2d = E->key()->cast_to<Node2D>(); if (!n2d) continue; - if (!n2d->is_visible()) + if (!n2d->is_visible_in_tree()) continue; if (!n2d->get_parent_item()) continue; @@ -3051,7 +3055,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { Node2D *n2d = E->key()->cast_to<Node2D>(); if (!n2d) continue; - if (!n2d->is_visible()) + if (!n2d->is_visible_in_tree()) continue; n2d->set_meta("_edit_bone_",Variant()); @@ -3069,7 +3073,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { for(List<Node*>::Element *E=selection.front();E;E=E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); - if (!canvas_item || !canvas_item->is_visible()) + if (!canvas_item || !canvas_item->is_visible_in_tree()) continue; if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root()) @@ -3093,7 +3097,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { CanvasItem *n2d = E->key()->cast_to<CanvasItem>(); if (!n2d) continue; - if (!n2d->is_visible()) + if (!n2d->is_visible_in_tree()) continue; n2d->set_meta("_edit_ik_",Variant()); @@ -3151,7 +3155,7 @@ void CanvasItemEditor::_focus_selection(int p_op) { // counting invisible items, for now - //if (!canvas_item->is_visible()) continue; + //if (!canvas_item->is_visible_in_tree()) continue; ++count; Rect2 item_rect = canvas_item->get_item_rect(); @@ -3615,14 +3619,14 @@ void CanvasItemEditorPlugin::make_visible(bool p_visible) { if (p_visible) { canvas_item_editor->show(); canvas_item_editor->set_fixed_process(true); - VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport(),false); + VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(),false); canvas_item_editor->viewport->grab_focus(); } else { canvas_item_editor->hide(); canvas_item_editor->set_fixed_process(false); - VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport(),true); + VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(),true); } } @@ -3654,7 +3658,7 @@ CanvasItemEditorPlugin::~CanvasItemEditorPlugin() void CanvasItemEditorViewport::_on_mouse_exit() { - if (selector->is_hidden()){ + if (!selector->is_visible()){ _remove_preview(); } } @@ -3734,7 +3738,7 @@ bool CanvasItemEditorViewport::_cyclical_dependency_exists(const String& p_targe } void CanvasItemEditorViewport::_create_nodes(Node* parent, Node* child, String& path, const Point2& p_point) { - child->set_name(path.get_file().basename()); + child->set_name(path.get_file().get_basename()); Ref<ImageTexture> texture=Ref<ImageTexture> ( ResourceCache::get(path)->cast_to<ImageTexture>() ); Size2 texture_size = texture->get_size(); @@ -3767,7 +3771,7 @@ void CanvasItemEditorViewport::_create_nodes(Node* parent, Node* child, String& editor_data->get_undo_redo().add_do_property(child,property,texture); // make visible for certain node type - if (default_type=="Patch9Frame") { + if (default_type=="Patch9Rect") { editor_data->get_undo_redo().add_do_property(child,"rect/size",texture_size); } else if (default_type=="Polygon2D") { PoolVector<Vector2> list; @@ -3785,7 +3789,7 @@ void CanvasItemEditorViewport::_create_nodes(Node* parent, Node* child, String& } Transform2D trans=canvas->get_canvas_transform(); Point2 target_pos = (p_point-trans.get_origin())/trans.get_scale().x-pos; - if (default_type=="Polygon2D" || default_type=="TouchScreenButton" || default_type=="TextureFrame" || default_type=="Patch9Frame") { + if (default_type=="Polygon2D" || default_type=="TouchScreenButton" || default_type=="TextureRect" || default_type=="Patch9Rect") { target_pos -= texture_size/2; } editor_data->get_undo_redo().add_do_method(child,"set_pos",target_pos); @@ -3857,8 +3861,8 @@ void CanvasItemEditorViewport::_perform_drop_data(){ else if (default_type=="Particles2D") child=memnew(Particles2D); else if (default_type=="Polygon2D") child=memnew(Polygon2D); else if (default_type=="TouchScreenButton") child=memnew(TouchScreenButton); - else if (default_type=="TextureFrame") child=memnew(TextureFrame); - else if (default_type=="Patch9Frame") child=memnew(Patch9Frame); + else if (default_type=="TextureRect") child=memnew(TextureRect); + else if (default_type=="Patch9Rect") child=memnew(NinePatchRect); else child=memnew(Sprite); // default _create_nodes(target_node, child, path, drop_pos); @@ -3875,7 +3879,7 @@ void CanvasItemEditorViewport::_perform_drop_data(){ if (error_files.size()>0) { String files_str; for (int i=0;i<error_files.size();i++) { - files_str += error_files[i].get_file().basename() + ","; + files_str += error_files[i].get_file().get_basename() + ","; } files_str=files_str.substr(0,files_str.length()-1); accept->get_ok()->set_text(TTR("Ugh")); @@ -3992,8 +3996,8 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte types.push_back("Polygon2D"); types.push_back("TouchScreenButton"); // Control - types.push_back("TextureFrame"); - types.push_back("Patch9Frame"); + types.push_back("TextureRect"); + types.push_back("Patch9Rect"); target_node=NULL; editor=p_node; diff --git a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp index da5c07221e..563b8298eb 100644 --- a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp +++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp @@ -203,7 +203,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library, it->create_from_image(img); p_library->set_item_preview(id,it); -// print_line("loaded image, size: "+rtos(m)+" dist: "+rtos(dist)+" empty?"+itos(img.empty())+" w: "+itos(it->get_width())+" h: "+itos(it->get_height())); + //print_line("loaded image, size: "+rtos(m)+" dist: "+rtos(dist)+" empty?"+itos(img.empty())+" w: "+itos(it->get_width())+" h: "+itos(it->get_height())); VS::get_singleton()->free(inst); } diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index 9dcfc2fa94..478fa2308d 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -248,7 +248,7 @@ Ref<Texture> EditorMaterialPreviewPlugin::generate(const RES& p_from) { VS::get_singleton()->viewport_queue_screen_capture(viewport); VS::get_singleton()->viewport_set_render_target_update_mode(viewport,VS::RENDER_TARGET_UPDATE_ONCE); //once used for capture -// print_line("queue capture!"); + //print_line("queue capture!"); Image img; int timeout=1000; @@ -825,7 +825,7 @@ Ref<Texture> EditorMeshPreviewPlugin::generate(const RES& p_from) { VS::get_singleton()->viewport_queue_screen_capture(viewport); VS::get_singleton()->viewport_set_render_target_update_mode(viewport,VS::RENDER_TARGET_UPDATE_ONCE); //once used for capture -// print_line("queue capture!"); + //print_line("queue capture!"); Image img; int timeout=1000; @@ -867,7 +867,7 @@ EditorMeshPreviewPlugin::EditorMeshPreviewPlugin() { camera = VS::get_singleton()->camera_create(); VS::get_singleton()->viewport_attach_camera(viewport,camera); VS::get_singleton()->camera_set_transform(camera,Transform(Matrix3(),Vector3(0,0,3))); -// VS::get_singleton()->camera_set_perspective(camera,45,0.1,10); + //VS::get_singleton()->camera_set_perspective(camera,45,0.1,10); VS::get_singleton()->camera_set_orthogonal(camera,1.0,0.01,1000.0); light = VS::get_singleton()->light_create(VS::LIGHT_DIRECTIONAL); @@ -881,7 +881,7 @@ EditorMeshPreviewPlugin::EditorMeshPreviewPlugin() { VS::get_singleton()->instance_set_transform(light_instance2,Transform().looking_at(Vector3(0,1,0),Vector3(0,0,1))); -// sphere = VS::get_singleton()->mesh_create(); + //sphere = VS::get_singleton()->mesh_create(); mesh_instance = VS::get_singleton()->instance_create(); VS::get_singleton()->instance_set_scenario(mesh_instance,scenario); diff --git a/tools/editor/plugins/material_editor_plugin.cpp b/tools/editor/plugins/material_editor_plugin.cpp index d5ddd3804b..e9bcf063fd 100644 --- a/tools/editor/plugins/material_editor_plugin.cpp +++ b/tools/editor/plugins/material_editor_plugin.cpp @@ -355,11 +355,11 @@ void MaterialEditorPlugin::make_visible(bool p_visible) { if (p_visible) { material_editor->show(); -// material_editor->set_process(true); + //material_editor->set_process(true); } else { material_editor->hide(); -// material_editor->set_process(false); + //material_editor->set_process(false); } } diff --git a/tools/editor/plugins/mesh_editor_plugin.cpp b/tools/editor/plugins/mesh_editor_plugin.cpp index db96a60808..49cb02c9d8 100644 --- a/tools/editor/plugins/mesh_editor_plugin.cpp +++ b/tools/editor/plugins/mesh_editor_plugin.cpp @@ -218,11 +218,11 @@ void MeshEditorPlugin::make_visible(bool p_visible) { if (p_visible) { mesh_editor->show(); -// mesh_editor->set_process(true); + //mesh_editor->set_process(true); } else { mesh_editor->hide(); -// mesh_editor->set_process(false); + //mesh_editor->set_process(false); } } diff --git a/tools/editor/plugins/path_2d_editor_plugin.cpp b/tools/editor/plugins/path_2d_editor_plugin.cpp index 69be969c51..8e475e56f7 100644 --- a/tools/editor/plugins/path_2d_editor_plugin.cpp +++ b/tools/editor/plugins/path_2d_editor_plugin.cpp @@ -38,7 +38,7 @@ void Path2DEditor::_notification(int p_what) { case NOTIFICATION_READY: { -// button_create->set_icon( get_icon("Edit","EditorIcons")); + //button_create->set_icon( get_icon("Edit","EditorIcons")); //button_edit->set_icon( get_icon("MovePoint","EditorIcons")); //set_pressed_button(button_edit); //button_edit->set_pressed(true); @@ -67,7 +67,7 @@ bool Path2DEditor::forward_gui_input(const InputEvent& p_event) { if (!node) return false; - if (!node->is_visible()) + if (!node->is_visible_in_tree()) return false; if (!node->get_curve().is_valid()) @@ -475,7 +475,7 @@ void Path2DEditor::_canvas_draw() { if (!node) return ; - if (!node->is_visible()) + if (!node->is_visible_in_tree()) return; if (!node->get_curve().is_valid()) diff --git a/tools/editor/plugins/path_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp index a69de2e78d..4f0afe9e94 100644 --- a/tools/editor/plugins/path_editor_plugin.cpp +++ b/tools/editor/plugins/path_editor_plugin.cpp @@ -449,7 +449,7 @@ void PathEditorPlugin::edit(Object *p_object) { pre->get_curve()->emit_signal("changed"); } } -// collision_polygon_editor->edit(p_object->cast_to<Node>()); + //collision_polygon_editor->edit(p_object->cast_to<Node>()); } bool PathEditorPlugin::handles(Object *p_object) const { @@ -543,7 +543,7 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) { path_thin_material->set_flag(Material::FLAG_DOUBLE_SIDED,true); path_thin_material->set_flag(Material::FLAG_UNSHADED,true); -// SpatialEditor::get_singleton()->add_gizmo_plugin(this); + //SpatialEditor::get_singleton()->add_gizmo_plugin(this); sep = memnew( VSeparator); sep->hide(); diff --git a/tools/editor/plugins/path_editor_plugin.h b/tools/editor/plugins/path_editor_plugin.h index e446dfa7c7..79e978dc1d 100644 --- a/tools/editor/plugins/path_editor_plugin.h +++ b/tools/editor/plugins/path_editor_plugin.h @@ -83,7 +83,7 @@ public: Ref<FixedSpatialMaterial> path_thin_material; virtual bool forward_spatial_gui_input(Camera* p_camera,const InputEvent& p_event); -// virtual bool forward_gui_input(const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); } + //virtual bool forward_gui_input(const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); } virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial); virtual String get_name() const { return "Path"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index ee625cf703..dc56348700 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -949,7 +949,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) { uv_mode_hb->add_child(sb_step_y); uv_mode_hb->add_child( memnew( VSeparator )); - uv_icon_zoom = memnew( TextureFrame ); + uv_icon_zoom = memnew( TextureRect ); uv_mode_hb->add_child( uv_icon_zoom ); uv_zoom = memnew( HSlider ); uv_zoom->set_min(0.01); diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.h b/tools/editor/plugins/polygon_2d_editor_plugin.h index bff7f4c44c..6011ee1f87 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.h +++ b/tools/editor/plugins/polygon_2d_editor_plugin.h @@ -77,7 +77,7 @@ class Polygon2DEditor : public HBoxContainer { HScrollBar *uv_hscroll; VScrollBar *uv_vscroll; MenuButton *uv_menu; - TextureFrame *uv_icon_zoom; + TextureRect *uv_icon_zoom; Vector2 uv_draw_ofs; float uv_draw_zoom; diff --git a/tools/editor/plugins/resource_preloader_editor_plugin.cpp b/tools/editor/plugins/resource_preloader_editor_plugin.cpp index fc6a548595..0799732e02 100644 --- a/tools/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/tools/editor/plugins/resource_preloader_editor_plugin.cpp @@ -52,7 +52,7 @@ void ResourcePreloaderEditor::_notification(int p_what) { if (p_what==NOTIFICATION_READY) { -// NodePath("/root")->connect("node_removed", this,"_node_removed",Vector<Variant>(),true); + //NodePath("/root")->connect("node_removed", this,"_node_removed",Vector<Variant>(),true); } if (p_what==NOTIFICATION_DRAW) { @@ -79,7 +79,7 @@ void ResourcePreloaderEditor::_files_load_request(const Vector<String>& p_paths) } - String basename = path.get_file().basename(); + String basename = path.get_file().get_basename(); String name=basename; int counter=1; while(preloader->has_resource(name)) { @@ -347,7 +347,7 @@ void ResourcePreloaderEditor::drop_data_fw(const Point2& p_point,const Variant& if (r->get_name()!="") { basename=r->get_name(); } else if (r->get_path().is_resource_file()) { - basename = r->get_path().basename(); + basename = r->get_path().get_basename(); } else { basename="Resource"; } @@ -471,14 +471,14 @@ void ResourcePreloaderEditorPlugin::make_visible(bool p_visible) { //preloader_editor->show(); button->show(); editor->make_bottom_panel_item_visible(preloader_editor); -// preloader_editor->set_process(true); + //preloader_editor->set_process(true); } else { - if (preloader_editor->is_visible()) + if (preloader_editor->is_visible_in_tree()) editor->hide_bottom_panel(); button->hide(); //preloader_editor->hide(); -// preloader_editor->set_process(false); + //preloader_editor->set_process(false); } } @@ -492,8 +492,8 @@ ResourcePreloaderEditorPlugin::ResourcePreloaderEditorPlugin(EditorNode *p_node) button=editor->add_bottom_panel_item("ResourcePreloader",preloader_editor); button->hide(); -// preloader_editor->set_anchor( MARGIN_TOP, Control::ANCHOR_END); -// preloader_editor->set_margin( MARGIN_TOP, 120 ); + //preloader_editor->set_anchor( MARGIN_TOP, Control::ANCHOR_END); + //preloader_editor->set_margin( MARGIN_TOP, 120 ); diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index 12ec7c8260..cbeaeb7d60 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -361,7 +361,7 @@ SampleEditor::SampleEditor() { add_style_override("panel", get_stylebox("panel","Panel")); library = Ref<SampleLibrary>(memnew(SampleLibrary)); player->set_sample_library(library); - sample_texframe = memnew( TextureFrame ); + sample_texframe = memnew( TextureRect ); add_child(sample_texframe); sample_texframe->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5); sample_texframe->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5); @@ -422,11 +422,11 @@ void SampleEditorPlugin::make_visible(bool p_visible) { if (p_visible) { sample_editor->show(); -// sample_editor->set_process(true); + //sample_editor->set_process(true); } else { sample_editor->hide(); -// sample_editor->set_process(false); + //sample_editor->set_process(false); } } diff --git a/tools/editor/plugins/sample_editor_plugin.h b/tools/editor/plugins/sample_editor_plugin.h index 59cdb10304..6a416ddfbf 100644 --- a/tools/editor/plugins/sample_editor_plugin.h +++ b/tools/editor/plugins/sample_editor_plugin.h @@ -47,7 +47,7 @@ class SampleEditor : public Panel { Ref<ImageTexture> peakdisplay; Ref<Sample> sample; Ref<SampleLibrary> library; - TextureFrame *sample_texframe; + TextureRect *sample_texframe; Button *stop; Button *play; diff --git a/tools/editor/plugins/sample_library_editor_plugin.cpp b/tools/editor/plugins/sample_library_editor_plugin.cpp index a7ccfb6978..c3e2481b5a 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.cpp +++ b/tools/editor/plugins/sample_library_editor_plugin.cpp @@ -58,7 +58,7 @@ void SampleLibraryEditor::_notification(int p_what) { if (p_what==NOTIFICATION_READY) { -// NodePath("/root")->connect("node_removed", this,"_node_removed",Vector<Variant>(),true); + //NodePath("/root")->connect("node_removed", this,"_node_removed",Vector<Variant>(),true); } if (p_what==NOTIFICATION_DRAW) { @@ -81,7 +81,7 @@ void SampleLibraryEditor::_file_load_request(const PoolVector<String>& p_path) { dialog->popup_centered_minsize(); return; ///beh should show an error i guess } - String basename = path.get_file().basename(); + String basename = path.get_file().get_basename(); String name=basename; int counter=0; while(sample_library->has_sample(name)) { @@ -376,7 +376,7 @@ void SampleLibraryEditor::drop_data_fw(const Point2& p_point,const Variant& p_da if (sample->get_name()!="") { basename=sample->get_name(); } else if (sample->get_path().is_resource_file()) { - basename = sample->get_path().basename(); + basename = sample->get_path().get_basename(); } else { basename="Sample"; } @@ -506,14 +506,14 @@ void SampleLibraryEditorPlugin::make_visible(bool p_visible) { //sample_library_editor->show(); button->show(); editor->make_bottom_panel_item_visible(sample_library_editor); -// sample_library_editor->set_process(true); + //sample_library_editor->set_process(true); } else { - if (sample_library_editor->is_visible()) + if (sample_library_editor->is_visible_in_tree()) editor->hide_bottom_panel(); button->hide(); -// sample_library_editor->set_process(false); + //sample_library_editor->set_process(false); } } @@ -529,8 +529,8 @@ SampleLibraryEditorPlugin::SampleLibraryEditorPlugin(EditorNode *p_node) { button->hide(); //sample_library_editor->set_area_as_parent_rect(); -// sample_library_editor->set_anchor( MARGIN_TOP, Control::ANCHOR_END); -// sample_library_editor->set_margin( MARGIN_TOP, 120 ); + //sample_library_editor->set_anchor( MARGIN_TOP, Control::ANCHOR_END); + //sample_library_editor->set_margin( MARGIN_TOP, 120 ); //sample_library_editor->hide(); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 5b2cb4aa5d..fa53e87fad 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -278,7 +278,7 @@ ScriptEditor *ScriptEditor::script_editor=NULL; String ScriptEditor::_get_debug_tooltip(const String&p_text,Node *_se) { -// ScriptEditorBase *se=_se->cast_to<ScriptEditorBase>(); + //ScriptEditorBase *se=_se->cast_to<ScriptEditorBase>(); String val = debugger->get_var_value(p_text); if (val!=String()) { @@ -311,7 +311,7 @@ void ScriptEditor::_breaked(bool p_breaked,bool p_can_debug) { void ScriptEditor::_show_debugger(bool p_show) { -// debug_menu->get_popup()->set_item_checked( debug_menu->get_popup()->get_item_index(DEBUG_SHOW), p_show); + //debug_menu->get_popup()->set_item_checked( debug_menu->get_popup()->get_item_index(DEBUG_SHOW), p_show); } void ScriptEditor::_script_created(Ref<Script> p_script) { @@ -426,14 +426,14 @@ void ScriptEditor::_go_to_tab(int p_idx) { script_name_label->set_text(c->cast_to<ScriptEditorBase>()->get_name()); script_icon->set_texture(c->cast_to<ScriptEditorBase>()->get_icon()); - if (is_visible()) + if (is_visible_in_tree()) c->cast_to<ScriptEditorBase>()->ensure_focus(); } if (c->cast_to<EditorHelp>()) { script_name_label->set_text(c->cast_to<EditorHelp>()->get_class()); script_icon->set_texture(get_icon("Help","EditorIcons")); - if (is_visible()) + if (is_visible_in_tree()) c->cast_to<EditorHelp>()->set_focused(); } @@ -1104,7 +1104,7 @@ static const Node * _find_node_with_script(const Node* p_node, const RefPtr & p_ Dictionary ScriptEditor::get_state() const { -// apply_scripts(); + //apply_scripts(); Dictionary state; #if 0 @@ -1281,7 +1281,7 @@ void ScriptEditor::ensure_select_current() { Ref<Script> script = se->get_edited_script(); - if (!grab_focus_block && is_visible()) + if (!grab_focus_block && is_visible_in_tree()) se->ensure_focus(); @@ -1361,7 +1361,7 @@ void ScriptEditor::_update_script_colors() { bool current = tab_container->get_current_tab() == c; if (current && highlight_current) { - script_list->set_item_custom_bg_color(i, EditorSettings::get_singleton()->get("text_editor/current_script_background_color")); + script_list->set_item_custom_bg_color(i, EditorSettings::get_singleton()->get("text_editor/open_scripts/current_script_background_color")); } else if (script_temperature_enabled) { @@ -1516,7 +1516,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script, bool p_grab_focus) { _go_to_tab(i); script_list->select( script_list->find_metadata(i) ); } - if (is_visible()) + if (is_visible_in_tree()) se->ensure_focus(); } return; @@ -1744,7 +1744,7 @@ void ScriptEditor::_script_split_dragged(float) { } void ScriptEditor::_unhandled_input(const InputEvent& p_event) { - if (p_event.key.pressed || !is_visible()) return; + if (p_event.key.pressed || !is_visible_in_tree()) return; if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) { int next_tab = script_list->get_current() + 1; next_tab %= script_list->get_item_count(); @@ -2178,7 +2178,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { menu_hb->add_spacer(); - script_icon = memnew( TextureFrame ); + script_icon = memnew( TextureRect ); menu_hb->add_child(script_icon); script_name_label = memnew( Label ); menu_hb->add_child(script_name_label); @@ -2247,7 +2247,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { { VBoxContainer *vbc = memnew( VBoxContainer ); disk_changed->add_child(vbc); - // disk_changed->set_child_rect(vbc); + //disk_changed->set_child_rect(vbc); Label *dl = memnew( Label ); dl->set_text(TTR("The following files are newer on disk.\nWhat action should be taken?:")); @@ -2293,7 +2293,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { help_index->connect("open_class",this,"_help_class_open"); history_pos=-1; -// debugger_gui->hide(); + //debugger_gui->hide(); edit_pass=0; trim_trailing_whitespace_on_save = false; diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 26120c8497..655568e262 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -179,7 +179,7 @@ class ScriptEditor : public VBoxContainer { String current_theme; - TextureFrame *script_icon; + TextureRect *script_icon; Label *script_name_label; ToolButton *script_back; diff --git a/tools/editor/plugins/script_text_editor.cpp b/tools/editor/plugins/script_text_editor.cpp index 05a2bfdba0..95e7afa04c 100644 --- a/tools/editor/plugins/script_text_editor.cpp +++ b/tools/editor/plugins/script_text_editor.cpp @@ -60,7 +60,7 @@ void ScriptTextEditor::apply_code() { if (script.is_null()) return; -// print_line("applying code"); + //print_line("applying code"); script->set_source_code(code_editor->get_text_edit()->get_text()); script->update_exports(); } @@ -484,7 +484,7 @@ void ScriptTextEditor::_code_complete_scripts(void* p_ud,const String& p_code, L void ScriptTextEditor::_code_complete_script(const String& p_code, List<String>* r_options) { - if (color_panel->is_visible()) return; + if (color_panel->is_visible_in_tree()) return; Node *base = get_tree()->get_edited_scene_root(); if (base) { base = _find_node_for_script(base,base,script); @@ -1194,7 +1194,7 @@ void ScriptTextEditor::_text_edit_gui_input(const InputEvent& ev) { Vector<float> color = stripped.split_floats(","); if (color.size() > 2) { float alpha = color.size() > 3 ? color[3] : 1.0f; - color_picker->set_color(Color(color[0], color[1], color[2], alpha)); + color_picker->set_pick_color(Color(color[0], color[1], color[2], alpha)); } color_panel->set_pos(get_global_transform().xform(get_local_mouse_pos())); Size2 ms = Size2(300, color_picker->get_combined_minimum_size().height+10); diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index 17b10ecd70..90d0f7fc93 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -127,7 +127,7 @@ void ShaderTextEditor::_load_theme_settings() { } //colorize core types -// Color basetype_color= EDITOR_DEF("text_editor/base_type_color",Color(0.3,0.3,0.0)); + //Color basetype_color= EDITOR_DEF("text_editor/base_type_color",Color(0.3,0.3,0.0)); //colorize comments @@ -253,9 +253,9 @@ void ShaderEditor::_menu_option(int p_option) { current->get_find_replace_bar()->popup_replace(); } break; -// case SEARCH_LOCATE_SYMBOL: { + //case SEARCH_LOCATE_SYMBOL: { -// } break; + //} break; case SEARCH_GOTO_LINE: { goto_line_dialog->popup_find_line(current->get_text_edit()); @@ -396,7 +396,7 @@ void ShaderEditor::_bind_methods() { ClassDB::bind_method("_menu_option",&ShaderEditor::_menu_option); ClassDB::bind_method("_params_changed",&ShaderEditor::_params_changed); ClassDB::bind_method("apply_shaders",&ShaderEditor::apply_shaders); -// ClassDB::bind_method("_close_current_tab",&ShaderEditor::_close_current_tab); + //ClassDB::bind_method("_close_current_tab",&ShaderEditor::_close_current_tab); } void ShaderEditor::ensure_select_current() { @@ -481,7 +481,7 @@ ShaderEditor::ShaderEditor() { search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_previous", TTR("Find Previous"), KEY_MASK_SHIFT|KEY_F3), SEARCH_FIND_PREV); search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/replace", TTR("Replace.."), KEY_MASK_CMD|KEY_R), SEARCH_REPLACE); search_menu->get_popup()->add_separator(); -// search_menu->get_popup()->add_item("Locate Symbol..",SEARCH_LOCATE_SYMBOL,KEY_MASK_CMD|KEY_K); + //search_menu->get_popup()->add_item("Locate Symbol..",SEARCH_LOCATE_SYMBOL,KEY_MASK_CMD|KEY_K); search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/goto_line", TTR("Goto Line.."), KEY_MASK_CMD|KEY_L), SEARCH_GOTO_LINE); search_menu->get_popup()->connect("id_pressed", this,"_menu_option"); @@ -512,8 +512,10 @@ bool ShaderEditorPlugin::handles(Object *p_object) const { bool handles = true; Shader *shader=p_object->cast_to<Shader>(); - //if (!shader || shader->cast_to<ShaderGraph>()) // Dont handle ShaderGraph's - // handles = false; + /* + if (!shader || shader->cast_to<ShaderGraph>()) // Dont handle ShaderGraph's + handles = false; + */ return shader!=NULL; } @@ -527,7 +529,7 @@ void ShaderEditorPlugin::make_visible(bool p_visible) { } else { button->hide(); - if (shader_editor->is_visible()) + if (shader_editor->is_visible_in_tree()) editor->hide_bottom_panel(); shader_editor->apply_shaders(); diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index 2ff9f94d99..d989c5b30d 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -2315,7 +2315,7 @@ void ShaderGraphView::_create_node(int p_id) { gn->add_child(le); le->set_text(graph->input_node_get_name(type,p_id)); le->connect("text_entered",this,"_input_name_changed",varray(p_id,le)); - TextureFrame *tex = memnew( TextureFrame ); + TextureRect *tex = memnew( TextureRect ); tex->set_expand(true); tex->set_custom_minimum_size(Size2(80,80)); tex->set_drag_forwarding(this); @@ -2530,7 +2530,7 @@ void ShaderGraphView::_sg_updated() { Variant ShaderGraphView::get_drag_data_fw(const Point2 &p_point, Control *p_from) { - TextureFrame* frame = p_from->cast_to<TextureFrame>(); + TextureRect* frame = p_from->cast_to<TextureRect>(); if (!frame) return Variant(); @@ -2576,7 +2576,7 @@ void ShaderGraphView::drop_data_fw(const Point2 &p_point, const Variant &p_data, if (!can_drop_data_fw(p_point, p_data, p_from)) return; - TextureFrame *frame = p_from->cast_to<TextureFrame>(); + TextureRect *frame = p_from->cast_to<TextureRect>(); if (!frame) return; @@ -2933,9 +2933,9 @@ ShaderGraphEditorPlugin::ShaderGraphEditorPlugin(EditorNode *p_node, bool p_2d) SpatialEditor::get_singleton()->get_shader_split()->add_child(shader_editor); - // editor->get_viewport()->add_child(shader_editor); - // shader_editor->set_area_as_parent_rect(); - // shader_editor->hide(); + //editor->get_viewport()->add_child(shader_editor); + //shader_editor->set_area_as_parent_rect(); + //shader_editor->hide(); } diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index f508ab95c2..0f01f71294 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -278,7 +278,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b Set<Ref<SpatialEditorGizmo> > found_gizmos; //uint32_t closest=0; -// float closest_dist=0; + //float closest_dist=0; r_includes_current=false; @@ -468,7 +468,7 @@ Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3& p_pos) { CameraMatrix cm; - cm.set_perspective(get_fov(),get_size().get_aspect(),get_znear(),get_zfar()); + cm.set_perspective(get_fov(),get_size().aspect(),get_znear(),get_zfar()); float screen_w,screen_h; cm.get_viewport_size(screen_w,screen_h); @@ -580,8 +580,8 @@ void SpatialEditorViewport::_compute_edit(const Point2& p_point) { List<Node*> &selection = editor_selection->get_selected_node_list(); -// Vector3 center; -// int nc=0; + //Vector3 center; + //int nc=0; for(List<Node*>::Element *E=selection.front();E;E=E->next()) { Spatial *sp = E->get()->cast_to<Spatial>(); @@ -593,16 +593,14 @@ void SpatialEditorViewport::_compute_edit(const Point2& p_point) { continue; se->original=se->sp->get_global_transform(); -// center+=se->original.origin; -// nc++; + //center+=se->original.origin; + //nc++; } - -// if (nc) -// _edit.center=center/float(nc); - - - + /* + if (nc) + _edit.center=center/float(nc); + */ } static int _get_key_modifier(const String& p_property) { @@ -618,23 +616,6 @@ static int _get_key_modifier(const String& p_property) { return 0; } -SpatialEditorViewport::NavigationScheme SpatialEditorViewport::_get_navigation_schema(const String& p_property) { - switch(EditorSettings::get_singleton()->get(p_property).operator int()) { - case 0: return NAVIGATION_GODOT; - case 1: return NAVIGATION_MAYA; - case 2: return NAVIGATION_MODO; - } - return NAVIGATION_GODOT; -} - -SpatialEditorViewport::NavigationZoomStyle SpatialEditorViewport::_get_navigation_zoom_style(const String& p_property) { - switch(EditorSettings::get_singleton()->get(p_property).operator int()) { - case 0: return NAVIGATION_ZOOM_VERTICAL; - case 1: return NAVIGATION_ZOOM_HORIZONTAL; - } - return NAVIGATION_ZOOM_VERTICAL; -} - bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hilite_only) { if (!spatial_editor->is_gizmo_visible()) @@ -854,7 +835,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { } break; case BUTTON_RIGHT: { - NavigationScheme nav_scheme = _get_navigation_schema("editors/3d/navigation_scheme"); + NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int(); if (b.pressed && _edit.gizmo.is_valid()) { //restore @@ -1014,7 +995,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (b.pressed) { - NavigationScheme nav_scheme = _get_navigation_schema("editors/3d/navigation_scheme"); + NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int(); if ( (nav_scheme==NAVIGATION_MAYA || nav_scheme==NAVIGATION_MODO) && b.mod.alt) { break; } @@ -1251,7 +1232,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { } - NavigationScheme nav_scheme = _get_navigation_schema("editors/3d/navigation_scheme"); + NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int(); NavigationMode nav_mode = NAVIGATION_NONE; if (_edit.gizmo.is_valid()) { @@ -1558,7 +1539,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { nav_mode = NAVIGATION_PAN; } - } else if (EditorSettings::get_singleton()->get("editors/3d/emulate_3_button_mouse")) { + } else if (EditorSettings::get_singleton()->get("editors/3d/emulate_3_button_mouse")) { // Handle trackpad (no external mouse) use case int mod = 0; if (m.mod.shift) @@ -1606,7 +1587,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (nav_scheme==NAVIGATION_MAYA && m.mod.shift) zoom_speed *= zoom_speed_modifier; - NavigationZoomStyle zoom_style = _get_navigation_zoom_style("3d_editor/zoom_style"); + NavigationZoomStyle zoom_style = (NavigationZoomStyle)EditorSettings::get_singleton()->get("3d_editor/zoom_style").operator int(); if (zoom_style == NAVIGATION_ZOOM_HORIZONTAL) { if ( m.relative_x > 0) cursor.distance*=1-m.relative_x*zoom_speed; @@ -1740,7 +1721,7 @@ void SpatialEditorViewport::_notification(int p_what) { if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - bool visible=is_visible(); + bool visible=is_visible_in_tree(); set_process(visible); @@ -1915,7 +1896,7 @@ void SpatialEditorViewport::_draw() { Size2 ss = Size2( GlobalConfig::get_singleton()->get("display/width"), GlobalConfig::get_singleton()->get("display/height") ); - float aspect = ss.get_aspect(); + float aspect = ss.aspect(); Size2 s = get_size(); Rect2 draw_rect; @@ -2152,7 +2133,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { previewing->disconnect("tree_exited",this,"_preview_exited_scene"); previewing=NULL; - VS::get_singleton()->viewport_attach_camera( viewport->get_viewport(), camera->get_camera() ); //restore + VS::get_singleton()->viewport_attach_camera( viewport->get_viewport_rid(), camera->get_camera() ); //restore if (!preview) preview_camera->hide(); view_menu->show(); @@ -2162,7 +2143,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { previewing=preview; previewing->connect("tree_exited",this,"_preview_exited_scene"); - VS::get_singleton()->viewport_attach_camera( viewport->get_viewport(), preview->get_camera() ); //replace + VS::get_singleton()->viewport_attach_camera( viewport->get_viewport_rid(), preview->get_camera() ); //replace view_menu->hide(); surface->update(); @@ -2205,7 +2186,7 @@ void SpatialEditorViewport::set_can_preview(Camera* p_preview) { void SpatialEditorViewport::update_transform_gizmo_view() { - if (!is_visible()) + if (!is_visible_in_tree()) return; Transform xform = spatial_editor->get_gizmo_transform(); @@ -2267,7 +2248,7 @@ void SpatialEditorViewport::set_state(const Dictionary& p_state) { if (pv && pv->cast_to<Camera>()) { previewing=pv->cast_to<Camera>(); previewing->connect("tree_exited",this,"_preview_exited_scene"); - VS::get_singleton()->viewport_attach_camera( viewport->get_viewport(), previewing->get_camera() ); //replace + VS::get_singleton()->viewport_attach_camera( viewport->get_viewport_rid(), previewing->get_camera() ); //replace view_menu->hide(); surface->update(); preview_camera->set_pressed(true); @@ -2515,7 +2496,7 @@ void SpatialEditor::update_transform_gizmo() { center.expand_to(xf.origin); gizmo_basis=Basis(); } -// count++; + //count++; } Vector3 pcenter = center.pos+center.size*0.5; @@ -2626,7 +2607,7 @@ Dictionary SpatialEditor::get_state() const { d["viewports"]=vpdata; d["default_light"]=view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_DEFAULT_LIGHT) );; - d["ambient_light_color"]=settings_ambient_color->get_color(); + d["ambient_light_color"]=settings_ambient_color->get_pick_color(); d["default_srgb"]=view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_DEFAULT_SRGB) );; d["show_grid"]=view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_GRID) );; @@ -2715,7 +2696,7 @@ void SpatialEditor::set_state(const Dictionary& p_state) { } if (d.has("ambient_light_color")) { - settings_ambient_color->set_color(d["ambient_light_color"]); + settings_ambient_color->set_pick_color(d["ambient_light_color"]); //viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,d["ambient_light_color"]); } @@ -2778,16 +2759,16 @@ void SpatialEditor::edit(Spatial *p_spatial) { } } + /* if (p_spatial) { - //_validate_selection(); - //if (selected.has(p_spatial->get_instance_ID()) && selected.size()==1) - // return; - //_select(p_spatial->get_instance_ID(),false,true); + _validate_selection(); + if (selected.has(p_spatial->get_instance_ID()) && selected.size()==1) + return; + _select(p_spatial->get_instance_ID(),false,true); // should become the selection } - - + */ } void SpatialEditor::_xform_dialog_action() { @@ -2854,8 +2835,8 @@ void SpatialEditor::_menu_item_pressed(int p_option) { tool_button[i]->set_pressed(i==p_option); tool_mode=(ToolMode)p_option; - // static const char *_mode[]={"Selection Mode.","Translation Mode.","Rotation Mode.","Scale Mode.","List Selection Mode."}; -// set_message(_mode[p_option],3); + //static const char *_mode[]={"Selection Mode.","Translation Mode.","Rotation Mode.","Scale Mode.","List Selection Mode."}; + //set_message(_mode[p_option],3); update_transform_gizmo(); } break; @@ -3231,9 +3212,9 @@ void SpatialEditor::_init_indicators() { VisualServer::get_singleton()->mesh_surface_set_material(origin,0,indicator_mat->get_rid()); -// origin = VisualServer::get_singleton()->poly_create(); -// VisualServer::get_singleton()->poly_add_primitive(origin,origin_points,Vector<Vector3>(),origin_colors,Vector<Vector3>()); -// VisualServer::get_singleton()->poly_set_material(origin,indicator_mat,true); + //origin = VisualServer::get_singleton()->poly_create(); + //VisualServer::get_singleton()->poly_add_primitive(origin,origin_points,Vector<Vector3>(),origin_colors,Vector<Vector3>()); + //VisualServer::get_singleton()->poly_set_material(origin,indicator_mat,true); origin_instance = VisualServer::get_singleton()->instance_create2(origin,get_tree()->get_root()->get_world()->get_scenario()); VS::get_singleton()->instance_set_layer_mask(origin_instance,1<<SpatialEditorViewport::GIZMO_GRID_LAYER); @@ -3484,7 +3465,7 @@ void SpatialEditor::_instance_scene() { void SpatialEditor::_unhandled_key_input(InputEvent p_event) { - if (!is_visible() || get_viewport()->gui_has_modal_stack()) + if (!is_visible_in_tree() || get_viewport()->gui_has_modal_stack()) return; #if 0 @@ -3691,7 +3672,7 @@ void SpatialEditor::_node_removed(Node* p_node) { void SpatialEditor::_bind_methods() { -// ClassDB::bind_method("_gui_input",&SpatialEditor::_gui_input); + //ClassDB::bind_method("_gui_input",&SpatialEditor::_gui_input); ClassDB::bind_method("_unhandled_key_input",&SpatialEditor::_unhandled_key_input); ClassDB::bind_method("_node_removed",&SpatialEditor::_node_removed); ClassDB::bind_method("_menu_item_pressed",&SpatialEditor::_menu_item_pressed); @@ -3743,7 +3724,7 @@ void SpatialEditor::clear() { settings_default_light_rot_y=Math_PI*0.2; //viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15)); - settings_ambient_color->set_color(Color(0.15,0.15,0.15)); + settings_ambient_color->set_pick_color(Color(0.15,0.15,0.15)); if (!light_instance.is_valid()) _menu_item_pressed(MENU_VIEW_USE_DEFAULT_LIGHT); @@ -3755,7 +3736,7 @@ void SpatialEditor::clear() { void SpatialEditor::_update_ambient_light_color(const Color& p_color) { -// viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,settings_ambient_color->get_color()); + //viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,settings_ambient_color->get_color()); } @@ -4024,10 +4005,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { settings_ambient_color = memnew( ColorPickerButton ); settings_vbc->add_margin_child(TTR("Ambient Light Color:"),settings_ambient_color); settings_ambient_color->connect("color_changed",this,"_update_ambient_light_color"); - -// viewport_environment->set_enable_fx(Environment::FX_AMBIENT_LIGHT,true); -// viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15)); - settings_ambient_color->set_color(Color(0.15,0.15,0.15)); + settings_ambient_color->set_pick_color(Color(0.15,0.15,0.15)); settings_fov = memnew( SpinBox ); @@ -4171,7 +4149,7 @@ void SpatialEditorPlugin::set_state(const Dictionary& p_state) { void SpatialEditor::snap_cursor_to_plane(const Plane& p_plane) { -// cursor.pos=p_plane.project(cursor.pos); + //cursor.pos=p_plane.project(cursor.pos); } void SpatialEditorPlugin::_bind_methods() { diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index b05b7d8545..6e5243e6ab 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -156,13 +156,11 @@ private: NAVIGATION_MAYA, NAVIGATION_MODO, }; - NavigationScheme _get_navigation_schema(const String& p_property); enum NavigationZoomStyle { NAVIGATION_ZOOM_VERTICAL, NAVIGATION_ZOOM_HORIZONTAL }; - NavigationZoomStyle _get_navigation_zoom_style(const String& p_property); enum NavigationMode { NAVIGATION_NONE, diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp index 67948b0302..095b059836 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp @@ -56,7 +56,7 @@ void SpriteFramesEditor::_notification(int p_what) { if (p_what==NOTIFICATION_READY) { -// NodePath("/root")->connect("node_removed", this,"_node_removed",Vector<Variant>(),true); + //NodePath("/root")->connect("node_removed", this,"_node_removed",Vector<Variant>(),true); } if (p_what==NOTIFICATION_DRAW) { @@ -937,14 +937,14 @@ void SpriteFramesEditorPlugin::make_visible(bool p_visible) { if (p_visible) { button->show(); editor->make_bottom_panel_item_visible(frames_editor); -// frames_editor->set_process(true); + //frames_editor->set_process(true); } else { button->hide(); - if (frames_editor->is_visible()) + if (frames_editor->is_visible_in_tree()) editor->hide_bottom_panel(); -// frames_editor->set_process(false); + //frames_editor->set_process(false); } } diff --git a/tools/editor/plugins/style_box_editor_plugin.cpp b/tools/editor/plugins/style_box_editor_plugin.cpp index 4319832adb..396ebd0052 100644 --- a/tools/editor/plugins/style_box_editor_plugin.cpp +++ b/tools/editor/plugins/style_box_editor_plugin.cpp @@ -49,9 +49,9 @@ void StyleBoxEditor::_sb_changed() { void StyleBoxEditor::_bind_methods() { ClassDB::bind_method("_sb_changed",&StyleBoxEditor::_sb_changed); -// ClassDB::bind_method("_import",&StyleBoxEditor::_import); -// ClassDB::bind_method("_import_accept",&StyleBoxEditor::_import_accept); -// ClassDB::bind_method("_preview_text_changed",&StyleBoxEditor::_preview_text_changed); + //ClassDB::bind_method("_import",&StyleBoxEditor::_import); + //ClassDB::bind_method("_import_accept",&StyleBoxEditor::_import_accept); + //ClassDB::bind_method("_preview_text_changed",&StyleBoxEditor::_preview_text_changed); } StyleBoxEditor::StyleBoxEditor() { @@ -95,7 +95,7 @@ void StyleBoxEditorPlugin::make_visible(bool p_visible){ EditorNode::get_singleton()->make_bottom_panel_item_visible(stylebox_editor); } else { - if (stylebox_editor->is_visible()) + if (stylebox_editor->is_visible_in_tree()) EditorNode::get_singleton()->hide_bottom_panel(); button->hide(); } diff --git a/tools/editor/plugins/style_box_editor_plugin.h b/tools/editor/plugins/style_box_editor_plugin.h index b2288b8e74..29e98efd8b 100644 --- a/tools/editor/plugins/style_box_editor_plugin.h +++ b/tools/editor/plugins/style_box_editor_plugin.h @@ -30,7 +30,7 @@ #define STYLE_BOX_EDITOR_PLUGIN_H #include "scene/resources/style_box.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/option_button.h" #include "tools/editor/editor_node.h" diff --git a/tools/editor/plugins/texture_editor_plugin.cpp b/tools/editor/plugins/texture_editor_plugin.cpp index 7ff7d0f2f7..a846a908d2 100644 --- a/tools/editor/plugins/texture_editor_plugin.cpp +++ b/tools/editor/plugins/texture_editor_plugin.cpp @@ -113,11 +113,11 @@ void TextureEditorPlugin::make_visible(bool p_visible) { if (p_visible) { texture_editor->show(); -// texture_editor->set_process(true); + //texture_editor->set_process(true); } else { texture_editor->hide(); -// texture_editor->set_process(false); + //texture_editor->set_process(false); } } diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp index 50e2cfb199..1ad880c4d6 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.cpp +++ b/tools/editor/plugins/texture_region_editor_plugin.cpp @@ -643,7 +643,7 @@ void TextureRegionEditor::edit(Object *p_obj) atlas_tex->disconnect("atlas_changed",this,"_edit_region"); if (p_obj) { node_sprite = p_obj->cast_to<Sprite>(); - node_patch9 = p_obj->cast_to<Patch9Frame>(); + node_patch9 = p_obj->cast_to<NinePatchRect>(); if (p_obj->cast_to<StyleBoxTexture>()) obj_styleBox = Ref<StyleBoxTexture>(p_obj->cast_to<StyleBoxTexture>()); if (p_obj->cast_to<AtlasTexture>()) { @@ -897,7 +897,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor) separator->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb_tools->add_child(separator); - icon_zoom = memnew( TextureFrame ); + icon_zoom = memnew( TextureRect ); hb_tools->add_child(icon_zoom); zoom_out = memnew( ToolButton ); @@ -935,7 +935,7 @@ void TextureRegionEditorPlugin::edit(Object *p_node) bool TextureRegionEditorPlugin::handles(Object *p_obj) const { - return p_obj->is_class("Sprite") || p_obj->is_class("Patch9Frame") || p_obj->is_class("StyleBoxTexture") || p_obj->is_class("AtlasTexture"); + return p_obj->is_class("Sprite") || p_obj->is_class("Patch9Rect") || p_obj->is_class("StyleBoxTexture") || p_obj->is_class("AtlasTexture"); } void TextureRegionEditorPlugin::make_visible(bool p_visible) diff --git a/tools/editor/plugins/texture_region_editor_plugin.h b/tools/editor/plugins/texture_region_editor_plugin.h index 32cf389c35..35c0f18efa 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.h +++ b/tools/editor/plugins/texture_region_editor_plugin.h @@ -36,7 +36,7 @@ #include "tools/editor/editor_plugin.h" #include "tools/editor/editor_node.h" #include "scene/2d/sprite.h" -#include "scene/gui/patch_9_frame.h" +#include "scene/gui/patch_9_rect.h" #include "scene/resources/style_box.h" #include "scene/resources/texture.h" @@ -53,7 +53,7 @@ class TextureRegionEditor : public Control { friend class TextureRegionEditorPlugin; MenuButton *snap_mode_button; - TextureFrame *icon_zoom; + TextureRect *icon_zoom; ToolButton *zoom_in; ToolButton *zoom_reset; ToolButton *zoom_out; @@ -81,7 +81,7 @@ class TextureRegionEditor : public Control { Vector2 snap_step; Vector2 snap_separation; - Patch9Frame *node_patch9; + NinePatchRect *node_patch9; Sprite *node_sprite; Ref<StyleBoxTexture> obj_styleBox; Ref<AtlasTexture> atlas_tex; diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index a700ddce7a..027e91ade8 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -693,9 +693,9 @@ ThemeEditor::ThemeEditor() { -// main_panel->add_child(panel); -// panel->set_area_as_parent_rect(); -// panel->set_margin( MARGIN_TOP,20 ); + //main_panel->add_child(panel); + //panel->set_area_as_parent_rect(); + //panel->set_margin( MARGIN_TOP,20 ); first_vb->add_child(memnew( Label("Label") )); @@ -975,7 +975,7 @@ void ThemeEditorPlugin::make_visible(bool p_visible){ } else { theme_editor->set_process(false); - if (theme_editor->is_visible()) + if (theme_editor->is_visible_in_tree()) editor->hide_bottom_panel(); button->hide(); } @@ -987,7 +987,7 @@ ThemeEditorPlugin::ThemeEditorPlugin(EditorNode *p_node) { theme_editor = memnew( ThemeEditor ); theme_editor->set_custom_minimum_size(Size2(0,200)); -// p_node->get_viewport()->add_child(theme_editor); + //p_node->get_viewport()->add_child(theme_editor); button=editor->add_bottom_panel_item("Theme",theme_editor); button->hide(); diff --git a/tools/editor/plugins/theme_editor_plugin.h b/tools/editor/plugins/theme_editor_plugin.h index 0af9128bf2..9251da8e07 100644 --- a/tools/editor/plugins/theme_editor_plugin.h +++ b/tools/editor/plugins/theme_editor_plugin.h @@ -30,7 +30,7 @@ #define THEME_EDITOR_PLUGIN_H #include "scene/resources/theme.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/option_button.h" #include "scene/gui/file_dialog.h" #include "scene/gui/check_box.h" diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index 2c64f7cd89..1a8c35a0be 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -53,7 +53,7 @@ void TileMapEditor::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - if (is_visible()) { + if (is_visible_in_tree()) { _update_palette(); } } break; @@ -597,7 +597,7 @@ static inline Vector<Point2i> line(int x0, int x1, int y0, int y1) { bool TileMapEditor::forward_gui_input(const InputEvent& p_event) { - if (!node || !node->get_tileset().is_valid() || !node->is_visible()) + if (!node || !node->get_tileset().is_valid() || !node->is_visible_in_tree()) return false; Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform(); diff --git a/tools/editor/plugins/tile_set_editor_plugin.cpp b/tools/editor/plugins/tile_set_editor_plugin.cpp index 34002ee863..bb6236a6d6 100644 --- a/tools/editor/plugins/tile_set_editor_plugin.cpp +++ b/tools/editor/plugins/tile_set_editor_plugin.cpp @@ -76,6 +76,8 @@ void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_me p_library->tile_set_texture(id,texture); p_library->tile_set_material(id,material); + p_library->tile_set_modulate(id,mi->get_modulate()); + Vector2 phys_offset; Size2 s; diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index 27f2f7dbc9..10005b6850 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -67,14 +67,14 @@ bool ProjectExportDialog::_create_tree(TreeItem *p_parent,EditorFileSystemDirect has_items=true; } -// int cc = p_options.get_slice_count(","); + //int cc = p_options.get_slice_count(","); for (int i=0;i<p_dir->get_file_count();i++) { TreeItem *fitem = tree->create_item(item); //fitem->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); //fitem->set_editable(0,true); - // fitem->set_checked(0,isfave); + //fitem->set_checked(0,isfave); fitem->set_text(0,p_dir->get_file(i)); String path = p_dir->get_file_path(i); fitem->set_tooltip(0,path); @@ -164,8 +164,8 @@ void ProjectExportDialog::_platform_selected() { String p =platforms->get_selected()->get_metadata(0); _update_platform(); -// editor->save_import_export(); -// EditorFileSystem::get_singleton()->scan(); + //editor->save_import_export(); + //EditorFileSystem::get_singleton()->scan(); } @@ -176,7 +176,7 @@ void ProjectExportDialog::_scan_finished() { print_line("**********SCAN DONEEE********"); print_line("**********SCAN DONEEE********");*/ - if (!is_visible()) { + if (!is_visible_in_tree()) { pending_update_tree=true; return; } @@ -288,7 +288,7 @@ void ProjectExportDialog::_notification(int p_what) { CenterContainer *cc = memnew( CenterContainer ); - TextureFrame *tf = memnew( TextureFrame); + TextureRect *tf = memnew( TextureRect); tf->set_texture(get_icon("ErrorSign","EditorIcons")); cc->add_child(tf); plat_errors->add_child(cc); @@ -313,7 +313,7 @@ void ProjectExportDialog::_notification(int p_what) { } EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"_scan_finished"); -// _rescan(); + //_rescan(); _update_platform(); export_mode->select( EditorImportExport::get_singleton()->get_export_filter() ); convert_text_scenes->set_pressed( EditorImportExport::get_singleton()->get_convert_text_scenes() ); @@ -343,7 +343,7 @@ void ProjectExportDialog::_notification(int p_what) { } image_formats->connect("item_edited",this,"_format_toggled"); group_add->set_icon(get_icon("Add","EditorIcons")); -// group_del->set_icon(get_icon("Del","EditorIcons")); + //group_del->set_icon(get_icon("Del","EditorIcons")); _update_group_list(); _update_group(); @@ -368,7 +368,7 @@ void ProjectExportDialog::_notification(int p_what) { } break; case NOTIFICATION_VISIBILITY_CHANGED: { - if (is_visible()) + if (is_visible_in_tree()) _validate_platform(); } break; @@ -921,7 +921,7 @@ bool ProjectExportDialog::_update_group_treef(TreeItem *p_parent,EditorFileSyste for(int i=0;i<p_dir->get_file_count();i++) { String fname = p_dir->get_file(i); - if (p_extensions.has(fname.to_lower().extension())) { + if (p_extensions.has(fname.to_lower().get_extension())) { String path = p_dir->get_file_path(i); if (filter!=String() && path.find(filter)==-1) @@ -1332,8 +1332,8 @@ void ProjectExportDialog::_bind_methods() { ClassDB::bind_method(_MD("_keystore_created"),&ProjectExportDialog::_keystore_created); -// ADD_SIGNAL(MethodInfo("instance")); -// ADD_SIGNAL(MethodInfo("open")); + //ADD_SIGNAL(MethodInfo("instance")); + //ADD_SIGNAL(MethodInfo("open")); } @@ -1578,7 +1578,7 @@ ProjectExportDialog::ProjectExportDialog(EditorNode *p_editor) { ScrollContainer *scroll = memnew( ScrollContainer ); atlas_preview_dialog->add_child(scroll); //atlas_preview_dialog->set_child_rect(scroll); - atlas_preview_frame = memnew( TextureFrame ); + atlas_preview_frame = memnew( TextureRect ); scroll->add_child(atlas_preview_frame); add_child(atlas_preview_dialog); @@ -1775,11 +1775,13 @@ Error ProjectExport::export_project(const String& p_preset) { { List<String> l; -// SceneLoader::get_recognized_extensions(&l); -// for(List<String>::Element *E=l.front();E;E=E->next()) { -// -// scene_extensions.insert(E->get()); -// } + /* + SceneLoader::get_recognized_extensions(&l); + for(List<String>::Element *E=l.front();E;E=E->next()) { + + scene_extensions.insert(E->get()); + } + */ ResourceLoader::get_recognized_extensions_for_type("",&l); for(List<String>::Element *E=l.front();E;E=E->next()) { @@ -1994,8 +1996,10 @@ Error ProjectExport::export_project(const String& p_preset) { uint32_t flags=0; -// if (saver->is_bundle_scenes_enabled()) -// flags|=Reso::FLAG_BUNDLE_INSTANCED_SCENES; + /* + if (saver->is_bundle_scenes_enabled()) + flags|=Reso::FLAG_BUNDLE_INSTANCED_SCENES; + */ saver->set_bundle_exceptions(NULL); if (E->get().depaction>=ProjectExportSettings::DA_BUNDLE) { flags|=ResourceSaver::FLAG_BUNDLE_RESOURCES; @@ -2041,7 +2045,7 @@ Error ProjectExport::export_project(const String& p_preset) { ERR_FAIL_COND_V(err,ERR_CANT_OPEN); } source_file=write_file; - // project_settings->add_remapped_path(src_scene,path,platform); + //project_settings->add_remapped_path(src_scene,path,platform); } @@ -2093,7 +2097,7 @@ Error ProjectExport::export_project(const String& p_preset) { -// added_settings["remap/"+platform]=remaps;` + //added_settings["remap/"+platform]=remaps;` added_settings["remap/"+platform]=Variant(remaps).operator Array(); } diff --git a/tools/editor/project_export.h b/tools/editor/project_export.h index 2110c54b9d..06992a7e34 100644 --- a/tools/editor/project_export.h +++ b/tools/editor/project_export.h @@ -99,7 +99,7 @@ private: bool _create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_dir); void _rescan(); -// void _confirmed(); + //void _confirmed(); void _scan_finished(); void _validate_platform(); @@ -134,7 +134,7 @@ private: AcceptDialog *atlas_preview_dialog; - TextureFrame *atlas_preview_frame; + TextureRect *atlas_preview_frame; VBoxContainer *script_vbox; diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index fa41090624..2cf940a29a 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -42,7 +42,7 @@ #include "scene/gui/center_container.h" #include "io/stream_peer_ssl.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/margin_container.h" #include "io/resource_saver.h" @@ -404,7 +404,7 @@ public: VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); - // set_child_rect(vb); + //set_child_rect(vb); Label* l = memnew(Label); l->set_text(TTR("Project Path:")); @@ -488,7 +488,7 @@ void ProjectManager::_notification(int p_what) { } else if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - set_process_unhandled_input(is_visible()); + set_process_unhandled_input(is_visible_in_tree()); } } @@ -869,7 +869,7 @@ void ProjectManager::_load_recent_projects() { favorite_box->add_child(favorite); hb->add_child(favorite_box); - TextureFrame *tf = memnew( TextureFrame ); + TextureRect *tf = memnew( TextureRect ); tf->set_texture(icon); hb->add_child(tf); @@ -1003,7 +1003,7 @@ void ProjectManager::_run_project_confirm() { Error err = OS::get_singleton()->execute(exec,args,false,&pid); ERR_FAIL_COND(err); } - // get_scene()->quit(); do not quit + //get_scene()->quit(); do not quit } void ProjectManager::_run_project() { diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 968333d466..0396456c49 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -1357,7 +1357,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { message = memnew( ConfirmationDialog ); add_child(message); -// message->get_cancel()->hide(); + //message->get_cancel()->hide(); message->set_hide_on_ok(true); Control *input_base = memnew( Control ); @@ -1424,7 +1424,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { hbc = memnew( HBoxContainer ); device_input->add_child(hbc); -// device_input->set_child_rect(hbc); + //device_input->set_child_rect(hbc); VBoxContainer *vbc_left = memnew( VBoxContainer ); hbc->add_child(vbc_left); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 59538ffc6a..8f294a5102 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -824,7 +824,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty color_picker->show(); color_picker->set_edit_alpha(hint!=PROPERTY_HINT_COLOR_NO_ALPHA); - color_picker->set_color(v); + color_picker->set_pick_color(v); set_size( Size2(300*EDSCALE, color_picker->get_combined_minimum_size().height+10*EDSCALE)); color_picker->set_focus_on_line_edit(); /* @@ -2084,7 +2084,7 @@ CustomPropertyEditor::CustomPropertyEditor() { scene_tree->connect("selected", this,"_node_path_selected"); scene_tree->get_scene_tree()->set_show_enabled_subscene(true); - texture_preview = memnew( TextureFrame ); + texture_preview = memnew( TextureRect ); add_child( texture_preview); texture_preview->hide(); @@ -2161,7 +2161,7 @@ bool PropertyEditor::_get_instanced_node_original_property(const StringName& p_p bool found=false; -// print_line("for prop - "+String(p_prop)); + //print_line("for prop - "+String(p_prop)); while(node) { @@ -2174,13 +2174,13 @@ bool PropertyEditor::_get_instanced_node_original_property(const StringName& p_p } else { ss=node->get_scene_instance_state(); } - // print_line("at - "+String(edited_scene->get_path_to(node))); + //print_line("at - "+String(edited_scene->get_path_to(node))); if (ss.is_valid()) { NodePath np = node->get_path_to(orig); int node_idx = ss->find_node_by_path(np); - // print_line("\t valid, nodeidx "+itos(node_idx)); + //print_line("\t valid, nodeidx "+itos(node_idx)); if (node_idx>=0) { bool lfound=false; Variant lvar; @@ -2189,7 +2189,7 @@ bool PropertyEditor::_get_instanced_node_original_property(const StringName& p_p found=true; value=lvar; - // print_line("\t found value "+String(value)); + //print_line("\t found value "+String(value)); } } } @@ -2215,7 +2215,7 @@ bool PropertyEditor::_is_property_different(const Variant& p_current, const Vari Node* edited_scene =EditorNode::get_singleton()->get_edited_scene(); bool found_state=false; - // print_line("for prop - "+String(p_prop)); + //print_line("for prop - "+String(p_prop)); while(node) { @@ -2802,13 +2802,13 @@ void PropertyEditor::_notification(int p_what) { if (p_what==NOTIFICATION_DRAG_BEGIN) { - if (is_visible() && tree->get_root()) { + if (is_visible_in_tree() && tree->get_root()) { _mark_drop_fields(tree->get_root()); } } if (p_what==NOTIFICATION_DRAG_END) { - if (is_visible() && tree->get_root()) { + if (is_visible_in_tree() && tree->get_root()) { _clear_drop_fields(tree->get_root()); } @@ -2867,7 +2867,7 @@ TreeItem *PropertyEditor::get_parent_node(String p_path,HashMap<String,TreeItem* item = item_paths.get(p_path); } else { -// printf("path %s parent path %s - item name %s\n",p_path.ascii().get_data(),p_path.left( p_path.find_last("/") ).ascii().get_data(),p_path.right( p_path.find_last("/") ).ascii().get_data() ); + //printf("path %s parent path %s - item name %s\n",p_path.ascii().get_data(),p_path.left( p_path.find_last("/") ).ascii().get_data(),p_path.right( p_path.find_last("/") ).ascii().get_data() ); TreeItem *parent = get_parent_node( p_path.left( p_path.find_last("/") ),item_paths,root ); item = tree->create_item( parent ); @@ -3174,8 +3174,10 @@ void PropertyEditor::update_tree() { //printf("property %s\n",basename.ascii().get_data()); TreeItem * parent = get_parent_node(path,item_path,current_category?current_category:root ); - //if (parent->get_parent()==root) - // parent=root; + /* + if (parent->get_parent()==root) + parent=root; + */ int level = 0; if (parent!=root) { level++; @@ -3359,7 +3361,7 @@ void PropertyEditor::update_tree() { item->set_range_config(1,min,max,step,p.hint==PROPERTY_HINT_EXP_RANGE); } else if (p.hint==PROPERTY_HINT_ENUM) { -// int c = p.hint_string.get_slice_count(","); + //int c = p.hint_string.get_slice_count(","); item->set_text(1,p.hint_string); if (show_type_icons) item->set_icon( 0,get_icon("Enum","EditorIcons") ); @@ -3368,7 +3370,7 @@ void PropertyEditor::update_tree() { break; } else if (p.hint==PROPERTY_HINT_OBJECT_ID) { -// int c = p.hint_string.get_slice_count(","); + //int c = p.hint_string.get_slice_count(","); item->set_cell_mode(1,TreeItem::CELL_MODE_CUSTOM); String type=p.hint_string; @@ -3704,7 +3706,7 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_editable( 1, !read_only ); -// item->set_text(1,obj->get(p.name)); + //item->set_text(1,obj->get(p.name)); item->set_custom_bg_color(1,obj->get(p.name)); if (show_type_icons) item->set_icon( 0,get_icon("Color","EditorIcons") ); @@ -3790,7 +3792,7 @@ void PropertyEditor::update_tree() { item->set_icon( 0, get_icon("Object","EditorIcons") ); } -// item->double_click_signal.connect( Method1<int>( Method2<int,String>( this, &Editoritem_obj_edited ), p.name ) ); + //item->double_click_signal.connect( Method1<int>( Method2<int,String>( this, &Editoritem_obj_edited ), p.name ) ); } break; default: {}; diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index 8f429ab979..900d06497f 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -37,7 +37,7 @@ #include "scene/gui/dialogs.h" #include "scene/gui/color_picker.h" #include "scene/gui/menu_button.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/text_edit.h" #include "scene/gui/check_button.h" #include "scene/gui/split_container.h" @@ -96,7 +96,7 @@ class CustomPropertyEditor : public Popup { Button *action_buttons[MAX_ACTION_BUTTONS]; MenuButton *type_button; Vector<String> inheritors_array; - TextureFrame *texture_preview; + TextureRect *texture_preview; ColorPicker *color_picker; TextEdit *text_edit; bool read_only; diff --git a/tools/editor/reparent_dialog.cpp b/tools/editor/reparent_dialog.cpp index a8909b0772..4b6a032b64 100644 --- a/tools/editor/reparent_dialog.cpp +++ b/tools/editor/reparent_dialog.cpp @@ -88,7 +88,7 @@ ReparentDialog::ReparentDialog() { VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); -// set_child_rect(vbc); + //set_child_rect(vbc); tree = memnew( SceneTreeEditor(false) ); tree->set_show_enabled_subscene(true); diff --git a/tools/editor/resources_dock.cpp b/tools/editor/resources_dock.cpp index c8fa1eda77..ddd4a782e4 100644 --- a/tools/editor/resources_dock.cpp +++ b/tools/editor/resources_dock.cpp @@ -126,8 +126,10 @@ void ResourcesDock::save_resource(const String& p_path,const Ref<Resource>& p_re int flg=0; if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources")) flg|=ResourceSaver::FLAG_COMPRESS; - //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) - // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + /* + if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) + flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + */ String path = GlobalConfig::get_singleton()->localize_path(p_path); Error err = ResourceSaver::save(path,p_resource,flg|ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); @@ -137,7 +139,7 @@ void ResourcesDock::save_resource(const String& p_path,const Ref<Resource>& p_re accept->popup_centered_minsize(); return; } -// EditorFileSystem::get_singleton()->update_file(path,p_resource->get_type()); + //EditorFileSystem::get_singleton()->update_file(path,p_resource->get_type()); ((Resource*)p_resource.ptr())->set_path(path); editor->emit_signal("resource_saved",p_resource); diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index c171c49c7b..6a1d1ed3b2 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -295,10 +295,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { switch(p_tool) { case TOOL_NEW: { - - - //if (!_validate_no_foreign()) - // break; + /* + if (!_validate_no_foreign()) + break; + */ create_dialog->popup(true); } break; case TOOL_INSTANCE: { @@ -319,8 +319,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } - //if (!_validate_no_foreign()) - // break; + /* + if (!_validate_no_foreign()) + break; + */ file->set_mode(EditorFileDialog::MODE_OPEN_FILE); List<String> extensions; @@ -345,10 +347,12 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!current) break; - //if (!_validate_no_foreign()) - // break; - //connect_dialog->popup_centered_ratio(); - //connect_dialog->set_node(current); + /* + if (!_validate_no_foreign()) + break; + connect_dialog->popup_centered_ratio(); + connect_dialog->set_node(current); + */ } break; case TOOL_GROUP: { @@ -356,10 +360,12 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { Node *current = scene_tree->get_selected(); if (!current) break; - //if (!_validate_no_foreign()) - // break; - //groups_editor->set_current(current); - //groups_editor->popup_centered_ratio(); + /* + if (!_validate_no_foreign()) + break; + groups_editor->set_current(current); + groups_editor->popup_centered_ratio(); + */ } break; case TOOL_ATTACH_SCRIPT: { @@ -367,8 +373,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!selected) break; - //if (!_validate_no_foreign()) - // break; + /* + if (!_validate_no_foreign()) + break; + */ Ref<Script> existing = selected->get_script(); if (existing.is_valid()) @@ -722,7 +730,7 @@ void SceneTreeDock::_node_selected() { return; } - if (ScriptEditor::get_singleton()->is_visible()) { + if (ScriptEditor::get_singleton()->is_visible_in_tree()) { restore_script_editor_on_drag=true; } @@ -1556,8 +1564,10 @@ void SceneTreeDock::_new_scene_from(String p_file) { int flg=0; if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) flg|=ResourceSaver::FLAG_COMPRESS; - //if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) - // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + /* + if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) + flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + */ err = ResourceSaver::save(p_file,sdata,flg); @@ -1926,9 +1936,9 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec filter = memnew( LineEdit ); filter->set_h_size_flags(SIZE_EXPAND_FILL); filter_hbc->add_child(filter); - filter_icon = memnew( TextureFrame ); + filter_icon = memnew( TextureRect ); filter_hbc->add_child(filter_icon); - filter_icon->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED); + filter_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED); filter->connect("text_changed",this,"_filter_changed"); diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h index 8dade67337..0699da3474 100644 --- a/tools/editor/scene_tree_dock.h +++ b/tools/editor/scene_tree_dock.h @@ -102,7 +102,7 @@ class SceneTreeDock : public VBoxContainer { EditorFileDialog *new_scene_from_dialog; LineEdit *filter; - TextureFrame *filter_icon; + TextureRect *filter_icon; PopupMenu * menu; diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index 1c881dfd5e..7b6a03e20e 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -671,8 +671,8 @@ void SceneTreeEditor::_notification(int p_what) { EditorSettings::get_singleton()->connect("settings_changed",this,"_editor_settings_changed"); -// get_scene()->connect("tree_changed",this,"_tree_changed",Vector<Variant>(),CONNECT_DEFERRED); -// get_scene()->connect("node_removed",this,"_node_removed",Vector<Variant>(),CONNECT_DEFERRED); + //get_scene()->connect("tree_changed",this,"_tree_changed",Vector<Variant>(),CONNECT_DEFERRED); + //get_scene()->connect("node_removed",this,"_node_removed",Vector<Variant>(),CONNECT_DEFERRED); _update_tree(); } if (p_what==NOTIFICATION_EXIT_TREE) { @@ -953,7 +953,7 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2& p_point,Control* p_from) if (i<list_max){ HBoxContainer *hb = memnew( HBoxContainer ); - TextureFrame *tf = memnew(TextureFrame); + TextureRect *tf = memnew(TextureRect); tf->set_texture(icons[i]); hb->add_child(tf); Label *label = memnew( Label( selected[i]->get_name() ) ); @@ -1081,7 +1081,7 @@ void SceneTreeEditor::_warning_changed(Node* p_for_node) { //should use a timer update_timer->start(); -// print_line("WARNING CHANGED "+String(p_for_node->get_name())); + //print_line("WARNING CHANGED "+String(p_for_node->get_name())); } @@ -1186,7 +1186,7 @@ SceneTreeEditor::SceneTreeEditor(bool p_label,bool p_can_rename, bool p_can_open tree->connect("item_edited", this,"_renamed",varray(),CONNECT_DEFERRED); tree->connect("multi_selected",this,"_cell_multi_selected"); tree->connect("button_pressed",this,"_cell_button_pressed"); -// tree->connect("item_edited", this,"_renamed",Vector<Variant>(),true); + //tree->connect("item_edited", this,"_renamed",Vector<Variant>(),true); error = memnew( AcceptDialog ); add_child(error); @@ -1264,7 +1264,7 @@ void SceneTreeDialog::_notification(int p_what) { get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); } - if (p_what==NOTIFICATION_VISIBILITY_CHANGED && is_visible()) { + if (p_what==NOTIFICATION_VISIBILITY_CHANGED && is_visible_in_tree()) { tree->update_tree(); } diff --git a/tools/editor/scene_tree_editor.h b/tools/editor/scene_tree_editor.h index 3cc1bd2388..5586f02c00 100644 --- a/tools/editor/scene_tree_editor.h +++ b/tools/editor/scene_tree_editor.h @@ -175,8 +175,8 @@ class SceneTreeDialog : public ConfirmationDialog { GDCLASS( SceneTreeDialog, ConfirmationDialog ); SceneTreeEditor *tree; -// Button *select; -// Button *cancel; + //Button *select; + //Button *cancel; void update_tree(); void _select(); diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp index d1095271fc..2a76224e33 100644 --- a/tools/editor/script_create_dialog.cpp +++ b/tools/editor/script_create_dialog.cpp @@ -38,7 +38,7 @@ void ScriptCreateDialog::config(const String& p_base_name,const String&p_base_pa class_name->set_text(""); parent_name->set_text(p_base_name); if (p_base_path!="") { - initial_bp=p_base_path.basename(); + initial_bp=p_base_path.get_basename(); file_path->set_text(initial_bp+"."+ScriptServer::get_language( language_menu->get_selected() )->get_extension()); } else { initial_bp=""; @@ -182,7 +182,7 @@ void ScriptCreateDialog::_lang_changed(int l) { String path=file_path->get_text(); String extension=""; if (path.find(".")>=0) { - extension=path.extension(); + extension=path.get_extension(); } if (extension.length()==0) { @@ -199,7 +199,7 @@ void ScriptCreateDialog::_lang_changed(int l) { for(List<String>::Element *E=extensions.front();E;E=E->next()) { if (E->get().nocasecmp_to(extension)==0) { - path=path.basename()+selected_ext; + path=path.get_basename()+selected_ext; _path_changed(path); break; } @@ -288,7 +288,7 @@ void ScriptCreateDialog::_path_changed(const String& p_path) { create_new=!f->file_exists(p); memdelete(f); - String extension=p.extension(); + String extension=p.get_extension(); List<String> extensions; // get all possible extensions for script diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 24b7befb9f..e53e69d9e0 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -177,7 +177,7 @@ void ScriptEditorDebugger::debug_next() { ERR_FAIL_COND(!breaked); ERR_FAIL_COND(connection.is_null()); - ERR_FAIL_COND(!connection->is_connected()); + ERR_FAIL_COND(!connection->is_connected_to_host()); Array msg; msg.push_back("next"); ppeer->put_var(msg); @@ -189,7 +189,7 @@ void ScriptEditorDebugger::debug_step() { ERR_FAIL_COND(!breaked); ERR_FAIL_COND(connection.is_null()); - ERR_FAIL_COND(!connection->is_connected()); + ERR_FAIL_COND(!connection->is_connected_to_host()); Array msg; msg.push_back("step"); @@ -202,7 +202,7 @@ void ScriptEditorDebugger::debug_break() { ERR_FAIL_COND(breaked); ERR_FAIL_COND(connection.is_null()); - ERR_FAIL_COND(!connection->is_connected()); + ERR_FAIL_COND(!connection->is_connected_to_host()); Array msg; msg.push_back("break"); @@ -214,7 +214,7 @@ void ScriptEditorDebugger::debug_continue() { ERR_FAIL_COND(!breaked); ERR_FAIL_COND(connection.is_null()); - ERR_FAIL_COND(!connection->is_connected()); + ERR_FAIL_COND(!connection->is_connected_to_host()); OS::get_singleton()->enable_for_stealing_focus(EditorNode::get_singleton()->get_child_process_id()); @@ -294,7 +294,7 @@ void ScriptEditorDebugger::_scene_tree_property_select_object(ObjectID p_object) void ScriptEditorDebugger::_scene_tree_request() { ERR_FAIL_COND(connection.is_null()); - ERR_FAIL_COND(!connection->is_connected()); + ERR_FAIL_COND(!connection->is_connected_to_host()); Array msg; msg.push_back("request_scene_tree"); @@ -305,7 +305,7 @@ void ScriptEditorDebugger::_scene_tree_request() { void ScriptEditorDebugger::_video_mem_request() { ERR_FAIL_COND(connection.is_null()); - ERR_FAIL_COND(!connection->is_connected()); + ERR_FAIL_COND(!connection->is_connected_to_host()); Array msg; msg.push_back("request_video_mem"); @@ -520,7 +520,7 @@ void ScriptEditorDebugger::_parse_message(const String& p_msg,const Array& p_dat d["frame"]=i; s->set_metadata(0,d); -// String line = itos(i)+" - "+String(d["file"])+":"+itos(d["line"])+" - at func: "+d["function"]; + //String line = itos(i)+" - "+String(d["file"])+":"+itos(d["line"])+" - at func: "+d["function"]; String line = itos(i)+" - "+String(d["file"])+":"+itos(d["line"]); s->set_text(0,line); @@ -580,7 +580,7 @@ void ScriptEditorDebugger::_parse_message(const String& p_msg,const Array& p_dat String t = p_data[i]; //LOG - if (EditorNode::get_log()->is_hidden()) { + if (!EditorNode::get_log()->is_visible()) { if (EditorNode::get_singleton()->are_bottom_panels_hidden()) { EditorNode::get_singleton()->make_bottom_panel_item_visible(EditorNode::get_log()); } @@ -905,7 +905,7 @@ void ScriptEditorDebugger::_notification(int p_what) { inspect_scene_tree_timeout-=get_process_delta_time(); if (inspect_scene_tree_timeout<0) { inspect_scene_tree_timeout=EditorSettings::get_singleton()->get("debugger/scene_tree_refresh_interval"); - if (inspect_scene_tree->is_visible()) { + if (inspect_scene_tree->is_visible_in_tree()) { _scene_tree_request(); if (inspected_object_id!=0) { @@ -921,7 +921,7 @@ void ScriptEditorDebugger::_notification(int p_what) { inspect_edited_object_timeout-=get_process_delta_time(); if (inspect_edited_object_timeout<0) { inspect_edited_object_timeout=EditorSettings::get_singleton()->get("debugger/remote_inspect_refresh_interval"); - if (inspect_scene_tree->is_visible() && inspected_object_id) { + if (inspect_scene_tree->is_visible_in_tree() && inspected_object_id) { //take the chance and re-inspect selected object Array msg; msg.push_back("inspect_object"); @@ -993,7 +993,7 @@ void ScriptEditorDebugger::_notification(int p_what) { } }; - if (!connection->is_connected()) { + if (!connection->is_connected_to_host()) { stop(); editor->notify_child_process_exited(); //somehow, exited break; @@ -1087,7 +1087,7 @@ void ScriptEditorDebugger::start() { stop(); - if (is_visible()) { + if (is_visible_in_tree()) { EditorNode::get_singleton()->make_bottom_panel_item_visible(this); } @@ -1146,7 +1146,7 @@ void ScriptEditorDebugger::stop(){ if (hide_on_stop) { - if (is_visible()) + if (is_visible_in_tree()) EditorNode::get_singleton()->hide_bottom_panel(); emit_signal("show_debugger",false); } @@ -1183,7 +1183,7 @@ void ScriptEditorDebugger::_profiler_activate(bool p_enable) { void ScriptEditorDebugger::_profiler_seeked() { - if (!connection.is_valid() || !connection->is_connected()) + if (!connection.is_valid() || !connection->is_connected_to_host()) return; if (breaked) @@ -1205,7 +1205,7 @@ void ScriptEditorDebugger::_stack_dump_frame_selected() { emit_signal("goto_script_line",s,int(d["line"])-1); ERR_FAIL_COND(connection.is_null()); - ERR_FAIL_COND(!connection->is_connected()); + ERR_FAIL_COND(!connection->is_connected_to_host()); /// Array msg; @@ -1620,7 +1620,7 @@ void ScriptEditorDebugger::set_hide_on_stop(bool p_hide) { void ScriptEditorDebugger::_paused() { ERR_FAIL_COND(connection.is_null()); - ERR_FAIL_COND(!connection->is_connected()); + ERR_FAIL_COND(!connection->is_connected_to_host()); if (!breaked && EditorNode::get_singleton()->get_pause_button()->is_pressed()) { debug_break(); @@ -1986,7 +1986,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){ ScriptEditorDebugger::~ScriptEditorDebugger() { -// inspector->edit(NULL); + //inspector->edit(NULL); memdelete(variables); ppeer->set_stream_peer(Ref<StreamPeer>()); diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 62de22a4b3..82dfa94c06 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -3117,8 +3117,8 @@ void Generic6DOFJointSpatialGizmo::redraw() { float s = ll+i*(Math_PI*2.0)/points; float n = ll+(i+1)*(Math_PI*2.0)/points; -// Vector3 from=Vector3(0,Math::cos(s),-Math::sin(s) )*cs; -// Vector3 to=Vector3( 0,Math::cos(n),-Math::sin(n) )*cs; + //Vector3 from=Vector3(0,Math::cos(s),-Math::sin(s) )*cs; + //Vector3 to=Vector3( 0,Math::cos(n),-Math::sin(n) )*cs; Vector3 from; SET_VTX(from,0, Math::cos(s), -Math::sin(s) ); |