diff options
330 files changed, 4325 insertions, 1924 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index ce08b3f754..273ef78669 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -112,8 +112,8 @@ bool _ResourceLoader::has(const String &p_path) { void _ResourceLoader::_bind_methods() { - ClassDB::bind_method(D_METHOD("load_interactive:ResourceInteractiveLoader", "path", "type_hint"), &_ResourceLoader::load_interactive, DEFVAL("")); - ClassDB::bind_method(D_METHOD("load:Resource", "path", "type_hint", "p_no_cache"), &_ResourceLoader::load, DEFVAL(""), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("load_interactive", "path", "type_hint"), &_ResourceLoader::load_interactive, DEFVAL("")); + ClassDB::bind_method(D_METHOD("load", "path", "type_hint", "p_no_cache"), &_ResourceLoader::load, DEFVAL(""), DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_recognized_extensions_for_type", "type"), &_ResourceLoader::get_recognized_extensions_for_type); ClassDB::bind_method(D_METHOD("set_abort_on_missing_resources", "abort"), &_ResourceLoader::set_abort_on_missing_resources); ClassDB::bind_method(D_METHOD("get_dependencies", "path"), &_ResourceLoader::get_dependencies); @@ -148,8 +148,8 @@ _ResourceSaver *_ResourceSaver::singleton = NULL; void _ResourceSaver::_bind_methods() { - ClassDB::bind_method(D_METHOD("save", "path", "resource:Resource", "flags"), &_ResourceSaver::save, DEFVAL(0)); - ClassDB::bind_method(D_METHOD("get_recognized_extensions", "type:Resource"), &_ResourceSaver::get_recognized_extensions); + ClassDB::bind_method(D_METHOD("save", "path", "resource", "flags"), &_ResourceSaver::save, DEFVAL(0)); + ClassDB::bind_method(D_METHOD("get_recognized_extensions", "type"), &_ResourceSaver::get_recognized_extensions); BIND_CONSTANT(FLAG_RELATIVE_PATHS); BIND_CONSTANT(FLAG_BUNDLE_RESOURCES); @@ -180,8 +180,8 @@ int _OS::get_mouse_button_state() const { return OS::get_singleton()->get_mouse_button_state(); } -String _OS::get_unique_ID() const { - return OS::get_singleton()->get_unique_ID(); +String _OS::get_unique_id() const { + return OS::get_singleton()->get_unique_id(); } bool _OS::has_touchscreen_ui_hint() const { @@ -369,9 +369,9 @@ Error _OS::kill(int p_pid) { return OS::get_singleton()->kill(p_pid); } -int _OS::get_process_ID() const { +int _OS::get_process_id() const { - return OS::get_singleton()->get_process_ID(); + return OS::get_singleton()->get_process_id(); }; bool _OS::has_environment(const String &p_var) const { @@ -800,7 +800,7 @@ void _OS::print_all_textures_by_size() { img.fmt = fmt; img.path = E->get()->get_path(); img.vram = Image::get_image_data_size(img.size.width, img.size.height, Image::Format(img.fmt)); - img.id = E->get()->get_instance_ID(); + img.id = E->get()->get_instance_id(); total += img.vram; imgs.push_back(img); } @@ -1019,7 +1019,7 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("execute", "path", "arguments", "blocking", "output"), &_OS::execute, DEFVAL(Array())); ClassDB::bind_method(D_METHOD("kill", "pid"), &_OS::kill); ClassDB::bind_method(D_METHOD("shell_open", "uri"), &_OS::shell_open); - ClassDB::bind_method(D_METHOD("get_process_ID"), &_OS::get_process_ID); + ClassDB::bind_method(D_METHOD("get_process_id"), &_OS::get_process_id); ClassDB::bind_method(D_METHOD("get_environment", "environment"), &_OS::get_environment); ClassDB::bind_method(D_METHOD("has_environment", "environment"), &_OS::has_environment); @@ -1038,7 +1038,7 @@ void _OS::_bind_methods() { &_OS::get_unix_time_from_datetime); ClassDB::bind_method(D_METHOD("get_system_time_secs"), &_OS::get_system_time_secs); - ClassDB::bind_method(D_METHOD("set_icon", "icon:Image"), &_OS::set_icon); + ClassDB::bind_method(D_METHOD("set_icon", "icon"), &_OS::set_icon); ClassDB::bind_method(D_METHOD("get_exit_code"), &_OS::get_exit_code); ClassDB::bind_method(D_METHOD("set_exit_code", "code"), &_OS::set_exit_code); @@ -1074,7 +1074,7 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_data_dir"), &_OS::get_data_dir); ClassDB::bind_method(D_METHOD("get_system_dir", "dir"), &_OS::get_system_dir); - ClassDB::bind_method(D_METHOD("get_unique_ID"), &_OS::get_unique_ID); + ClassDB::bind_method(D_METHOD("get_unique_id"), &_OS::get_unique_id); ClassDB::bind_method(D_METHOD("is_ok_left_and_cancel_right"), &_OS::is_ok_left_and_cancel_right); @@ -1750,7 +1750,7 @@ void _File::_bind_methods() { ClassDB::bind_method(D_METHOD("get_sha256", "path"), &_File::get_sha256); ClassDB::bind_method(D_METHOD("get_endian_swap"), &_File::get_endian_swap); ClassDB::bind_method(D_METHOD("set_endian_swap", "enable"), &_File::set_endian_swap); - ClassDB::bind_method(D_METHOD("get_error:Error"), &_File::get_error); + ClassDB::bind_method(D_METHOD("get_error"), &_File::get_error); ClassDB::bind_method(D_METHOD("get_var"), &_File::get_var); ClassDB::bind_method(D_METHOD("get_csv_line", "delim"), &_File::get_csv_line, DEFVAL(",")); @@ -1954,7 +1954,7 @@ Error _Directory::remove(String p_name) { void _Directory::_bind_methods() { - ClassDB::bind_method(D_METHOD("open:Error", "path"), &_Directory::open); + ClassDB::bind_method(D_METHOD("open", "path"), &_Directory::open); ClassDB::bind_method(D_METHOD("list_dir_begin", "skip_navigational", "skip_hidden"), &_Directory::list_dir_begin, DEFVAL(false), DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_next"), &_Directory::get_next); ClassDB::bind_method(D_METHOD("current_is_dir"), &_Directory::current_is_dir); @@ -1962,17 +1962,17 @@ void _Directory::_bind_methods() { ClassDB::bind_method(D_METHOD("get_drive_count"), &_Directory::get_drive_count); ClassDB::bind_method(D_METHOD("get_drive", "idx"), &_Directory::get_drive); ClassDB::bind_method(D_METHOD("get_current_drive"), &_Directory::get_current_drive); - ClassDB::bind_method(D_METHOD("change_dir:Error", "todir"), &_Directory::change_dir); + ClassDB::bind_method(D_METHOD("change_dir", "todir"), &_Directory::change_dir); ClassDB::bind_method(D_METHOD("get_current_dir"), &_Directory::get_current_dir); - ClassDB::bind_method(D_METHOD("make_dir:Error", "path"), &_Directory::make_dir); - ClassDB::bind_method(D_METHOD("make_dir_recursive:Error", "path"), &_Directory::make_dir_recursive); + ClassDB::bind_method(D_METHOD("make_dir", "path"), &_Directory::make_dir); + ClassDB::bind_method(D_METHOD("make_dir_recursive", "path"), &_Directory::make_dir_recursive); ClassDB::bind_method(D_METHOD("file_exists", "path"), &_Directory::file_exists); ClassDB::bind_method(D_METHOD("dir_exists", "path"), &_Directory::dir_exists); //ClassDB::bind_method(D_METHOD("get_modified_time","file"),&_Directory::get_modified_time); ClassDB::bind_method(D_METHOD("get_space_left"), &_Directory::get_space_left); - ClassDB::bind_method(D_METHOD("copy:Error", "from", "to"), &_Directory::copy); - ClassDB::bind_method(D_METHOD("rename:Error", "from", "to"), &_Directory::rename); - ClassDB::bind_method(D_METHOD("remove:Error", "path"), &_Directory::remove); + ClassDB::bind_method(D_METHOD("copy", "from", "to"), &_Directory::copy); + ClassDB::bind_method(D_METHOD("rename", "from", "to"), &_Directory::rename); + ClassDB::bind_method(D_METHOD("remove", "path"), &_Directory::remove); } _Directory::_Directory() { @@ -2109,14 +2109,14 @@ String _Marshalls::base64_to_utf8(const String &p_str) { void _Marshalls::_bind_methods() { - ClassDB::bind_method(D_METHOD("variant_to_base64:String", "variant"), &_Marshalls::variant_to_base64); - ClassDB::bind_method(D_METHOD("base64_to_variant:Variant", "base64_str"), &_Marshalls::base64_to_variant); + ClassDB::bind_method(D_METHOD("variant_to_base64", "variant"), &_Marshalls::variant_to_base64); + ClassDB::bind_method(D_METHOD("base64_to_variant", "base64_str"), &_Marshalls::base64_to_variant); - ClassDB::bind_method(D_METHOD("raw_to_base64:String", "array"), &_Marshalls::raw_to_base64); - ClassDB::bind_method(D_METHOD("base64_to_raw:PoolByteArray", "base64_str"), &_Marshalls::base64_to_raw); + ClassDB::bind_method(D_METHOD("raw_to_base64", "array"), &_Marshalls::raw_to_base64); + ClassDB::bind_method(D_METHOD("base64_to_raw", "base64_str"), &_Marshalls::base64_to_raw); - ClassDB::bind_method(D_METHOD("utf8_to_base64:String", "utf8_str"), &_Marshalls::utf8_to_base64); - ClassDB::bind_method(D_METHOD("base64_to_utf8:String", "base64_str"), &_Marshalls::base64_to_utf8); + ClassDB::bind_method(D_METHOD("utf8_to_base64", "utf8_str"), &_Marshalls::utf8_to_base64); + ClassDB::bind_method(D_METHOD("base64_to_utf8", "base64_str"), &_Marshalls::base64_to_utf8); }; //////////////// @@ -2133,8 +2133,8 @@ Error _Semaphore::post() { void _Semaphore::_bind_methods() { - ClassDB::bind_method(D_METHOD("wait:Error"), &_Semaphore::wait); - ClassDB::bind_method(D_METHOD("post:Error"), &_Semaphore::post); + ClassDB::bind_method(D_METHOD("wait"), &_Semaphore::wait); + ClassDB::bind_method(D_METHOD("post"), &_Semaphore::post); } _Semaphore::_Semaphore() { @@ -2167,7 +2167,7 @@ void _Mutex::unlock() { void _Mutex::_bind_methods() { ClassDB::bind_method(D_METHOD("lock"), &_Mutex::lock); - ClassDB::bind_method(D_METHOD("try_lock:Error"), &_Mutex::try_lock); + ClassDB::bind_method(D_METHOD("try_lock"), &_Mutex::try_lock); ClassDB::bind_method(D_METHOD("unlock"), &_Mutex::unlock); } @@ -2256,7 +2256,7 @@ String _Thread::get_id() const { if (!thread) return String(); - return itos(thread->get_ID()); + return itos(thread->get_id()); } bool _Thread::is_active() const { @@ -2280,10 +2280,10 @@ Variant _Thread::wait_to_finish() { void _Thread::_bind_methods() { - ClassDB::bind_method(D_METHOD("start:Error", "instance", "method", "userdata", "priority"), &_Thread::start, DEFVAL(Variant()), DEFVAL(PRIORITY_NORMAL)); + ClassDB::bind_method(D_METHOD("start", "instance", "method", "userdata", "priority"), &_Thread::start, DEFVAL(Variant()), DEFVAL(PRIORITY_NORMAL)); ClassDB::bind_method(D_METHOD("get_id"), &_Thread::get_id); ClassDB::bind_method(D_METHOD("is_active"), &_Thread::is_active); - ClassDB::bind_method(D_METHOD("wait_to_finish:Variant"), &_Thread::wait_to_finish); + ClassDB::bind_method(D_METHOD("wait_to_finish"), &_Thread::wait_to_finish); BIND_CONSTANT(PRIORITY_LOW); BIND_CONSTANT(PRIORITY_NORMAL); @@ -2483,15 +2483,15 @@ void _ClassDB::_bind_methods() { ClassDB::bind_method(D_METHOD("class_exists", "class"), &_ClassDB::class_exists); ClassDB::bind_method(D_METHOD("is_parent_class", "class", "inherits"), &_ClassDB::is_parent_class); ClassDB::bind_method(D_METHOD("can_instance", "class"), &_ClassDB::can_instance); - ClassDB::bind_method(D_METHOD("instance:Variant", "class"), &_ClassDB::instance); + ClassDB::bind_method(D_METHOD("instance", "class"), &_ClassDB::instance); ClassDB::bind_method(D_METHOD("class_has_signal", "class", "signal"), &_ClassDB::has_signal); ClassDB::bind_method(D_METHOD("class_get_signal", "class", "signal"), &_ClassDB::get_signal); ClassDB::bind_method(D_METHOD("class_get_signal_list", "class", "no_inheritance"), &_ClassDB::get_signal_list, DEFVAL(false)); ClassDB::bind_method(D_METHOD("class_get_property_list", "class", "no_inheritance"), &_ClassDB::get_property_list, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("class_get_property:Variant", "object", "property"), &_ClassDB::get_property); - ClassDB::bind_method(D_METHOD("class_set_property:Error", "object", "property", "value"), &_ClassDB::set_property); + ClassDB::bind_method(D_METHOD("class_get_property", "object", "property"), &_ClassDB::get_property); + ClassDB::bind_method(D_METHOD("class_set_property", "object", "property", "value"), &_ClassDB::set_property); ClassDB::bind_method(D_METHOD("class_has_method", "class", "method", "no_inheritance"), &_ClassDB::has_method, DEFVAL(false)); @@ -2583,7 +2583,7 @@ void _Engine::_bind_methods() { ClassDB::bind_method(D_METHOD("get_frames_drawn"), &_Engine::get_frames_drawn); ClassDB::bind_method(D_METHOD("get_frames_per_second"), &_Engine::get_frames_per_second); - ClassDB::bind_method(D_METHOD("get_main_loop:MainLoop"), &_Engine::get_main_loop); + ClassDB::bind_method(D_METHOD("get_main_loop"), &_Engine::get_main_loop); ClassDB::bind_method(D_METHOD("get_version_info"), &_Engine::get_version_info); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index ec4fd3f476..e18d663d85 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -175,7 +175,7 @@ public: Error kill(int p_pid); Error shell_open(String p_uri); - int get_process_ID() const; + int get_process_id() const; bool has_environment(const String &p_var) const; String get_environment(const String &p_var) const; @@ -204,7 +204,7 @@ public: bool is_debug_build() const; - String get_unique_ID() const; + String get_unique_id() const; String get_scancode_string(uint32_t p_code) const; bool is_scancode_unicode(uint32_t p_unicode) const; diff --git a/core/class_db.cpp b/core/class_db.cpp index 6b8c290a99..0503f7c6fc 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -46,9 +46,9 @@ #ifdef DEBUG_METHODS_ENABLED -ParamDef::ParamDef(const Variant &p_variant) { - used = true; - val = p_variant; +ParamDef::ParamDef(const Variant &p_variant) + : used(true), + val(p_variant) { } MethodDefinition D_METHOD(const char *p_name) { @@ -937,6 +937,28 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia return false; } +int ClassDB::get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid) { + + ClassInfo *type = classes.getptr(p_class); + ClassInfo *check = type; + while (check) { + const PropertySetGet *psg = check->property_setget.getptr(p_property); + if (psg) { + + if (r_is_valid) + *r_is_valid = true; + + return psg->index; + } + + check = check->inherits_ptr; + } + if (r_is_valid) + *r_is_valid = false; + + return -1; +} + Variant::Type ClassDB::get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid) { ClassInfo *type = classes.getptr(p_class); @@ -1060,12 +1082,6 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const c StringName mdname = StaticCString::create(method_name); #endif - StringName rettype; - if (mdname.operator String().find(":") != -1) { - rettype = mdname.operator String().get_slice(":", 1); - mdname = mdname.operator String().get_slice(":", 0); - } - OBJTYPE_WLOCK; ERR_FAIL_COND_V(!p_bind, NULL); p_bind->set_name(mdname); @@ -1084,7 +1100,7 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const c if (!type) { ERR_PRINTS("Couldn't bind method '" + mdname + "' for instance: " + instance_type); memdelete(p_bind); - ERR_FAIL_COND_V(!type, NULL); + ERR_FAIL_V(NULL); } if (type->method_map.has(mdname)) { @@ -1093,11 +1109,20 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const c ERR_EXPLAIN("Method already bound: " + instance_type + "::" + mdname); ERR_FAIL_V(NULL); } + #ifdef DEBUG_METHODS_ENABLED + + if (method_name.args.size() > p_bind->get_argument_count()) { + memdelete(p_bind); + ERR_EXPLAIN("Method definition provides more arguments than the method actually has: " + instance_type + "::" + mdname); + ERR_FAIL_V(NULL); + } + p_bind->set_argument_names(method_name.args); - p_bind->set_return_type(rettype); + type->method_order.push_back(mdname); #endif + type->method_map[mdname] = p_bind; Vector<Variant> defvals; diff --git a/core/class_db.h b/core/class_db.h index 4f00a16e91..f73e082c52 100644 --- a/core/class_db.h +++ b/core/class_db.h @@ -45,12 +45,11 @@ struct ParamHint { String hint_text; Variant default_val; - ParamHint(const String &p_name = "", PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_text = "", Variant p_default_val = Variant()) { - - name = p_name; - hint = p_hint; - hint_text = p_hint_text; - default_val = p_default_val; + ParamHint(const String &p_name = "", PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_text = "", Variant p_default_val = Variant()) + : name(p_name), + hint(p_hint), + hint_text(p_hint_text), + default_val(p_default_val) { } }; @@ -73,8 +72,10 @@ struct MethodDefinition { StringName name; Vector<StringName> args; MethodDefinition() {} - MethodDefinition(const char *p_name) { name = p_name; } - MethodDefinition(const StringName &p_name) { name = p_name; } + MethodDefinition(const char *p_name) + : name(p_name) {} + MethodDefinition(const StringName &p_name) + : name(p_name) {} }; MethodDefinition D_METHOD(const char *p_name); @@ -436,12 +437,6 @@ public: MethodBind *bind = create_vararg_method_bind(p_method, p_info); ERR_FAIL_COND_V(!bind, NULL); - String rettype; - if (p_name.operator String().find(":") != -1) { - rettype = p_name.operator String().get_slice(":", 1); - p_name = p_name.operator String().get_slice(":", 0); - } - bind->set_name(p_name); bind->set_default_arguments(p_default_args); @@ -461,8 +456,7 @@ public: } type->method_map[p_name] = bind; #ifdef DEBUG_METHODS_ENABLED - if (!rettype.empty()) - bind->set_return_type(rettype); + bind->set_return_type("Variant"); type->method_order.push_back(p_name); #endif @@ -480,6 +474,7 @@ public: static bool set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid = NULL); static bool get_property(Object *p_object, const StringName &p_property, Variant &r_value); static bool has_property(const StringName &p_class, const StringName &p_property, bool p_no_inheritance = false); + static int get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid = NULL); static Variant::Type get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid = NULL); static StringName get_property_setter(StringName p_class, const StringName p_property); static StringName get_property_getter(StringName p_class, const StringName p_property); diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 9bdd960424..172249c5d7 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -306,7 +306,7 @@ void PHashTranslation::_get_property_list(List<PropertyInfo> *p_list) const { } void PHashTranslation::_bind_methods() { - ClassDB::bind_method(D_METHOD("generate", "from:Translation"), &PHashTranslation::generate); + ClassDB::bind_method(D_METHOD("generate", "from"), &PHashTranslation::generate); } PHashTranslation::PHashTranslation() { diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp index 2adc15447a..2f5a684373 100644 --- a/core/core_string_names.cpp +++ b/core/core_string_names.cpp @@ -31,21 +31,20 @@ CoreStringNames *CoreStringNames::singleton = NULL; -CoreStringNames::CoreStringNames() { - - _free = StaticCString::create("free"); - changed = StaticCString::create("changed"); - _meta = StaticCString::create("__meta__"); - _script = StaticCString::create("script"); - script_changed = StaticCString::create("script_changed"); - ___pdcdata = StaticCString::create("___pdcdata"); - __getvar = StaticCString::create("__getvar"); - _iter_init = StaticCString::create("_iter_init"); - _iter_next = StaticCString::create("_iter_next"); - _iter_get = StaticCString::create("_iter_get"); - get_rid = StaticCString::create("get_rid"); - _custom_features = StaticCString::create("_custom_features"); +CoreStringNames::CoreStringNames() + : _free(StaticCString::create("free")), + changed(StaticCString::create("changed")), + _meta(StaticCString::create("__meta__")), + _script(StaticCString::create("script")), + script_changed(StaticCString::create("script_changed")), + ___pdcdata(StaticCString::create("___pdcdata")), + __getvar(StaticCString::create("__getvar")), + _iter_init(StaticCString::create("_iter_init")), + _iter_next(StaticCString::create("_iter_next")), + _iter_get(StaticCString::create("_iter_get")), + get_rid(StaticCString::create("get_rid")), #ifdef TOOLS_ENABLED - _sections_unfolded = StaticCString::create("_sections_unfolded"); + _sections_unfolded(StaticCString::create("_sections_unfolded")), #endif + _custom_features(StaticCString::create("_custom_features")) { } diff --git a/core/core_string_names.h b/core/core_string_names.h index 501185f5b7..40f76aa9c0 100644 --- a/core/core_string_names.h +++ b/core/core_string_names.h @@ -61,10 +61,10 @@ public: StringName _iter_next; StringName _iter_get; StringName get_rid; - StringName _custom_features; #ifdef TOOLS_ENABLED StringName _sections_unfolded; #endif + StringName _custom_features; }; #endif // SCENE_STRING_NAMES_H diff --git a/core/func_ref.cpp b/core/func_ref.cpp index 1121c6d3e4..5622a03665 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -48,7 +48,7 @@ Variant FuncRef::call_func(const Variant **p_args, int p_argcount, Variant::Call void FuncRef::set_instance(Object *p_obj) { ERR_FAIL_NULL(p_obj); - id = p_obj->get_instance_ID(); + id = p_obj->get_instance_id(); } void FuncRef::set_function(const StringName &p_func) { @@ -61,7 +61,7 @@ void FuncRef::_bind_methods() { MethodInfo mi; mi.name = "call_func"; Vector<Variant> defargs; - ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "call_func:Variant", &FuncRef::call_func, mi, defargs); + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "call_func", &FuncRef::call_func, mi, defargs); } ClassDB::bind_method(D_METHOD("set_instance", "instance"), &FuncRef::set_instance); diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 18071d7748..9e745ecb98 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -67,8 +67,8 @@ static _GlobalConstant _global_constants[] = { BIND_GLOBAL_CONSTANT(KEY_TAB), BIND_GLOBAL_CONSTANT(KEY_BACKTAB), BIND_GLOBAL_CONSTANT(KEY_BACKSPACE), - BIND_GLOBAL_CONSTANT(KEY_RETURN), BIND_GLOBAL_CONSTANT(KEY_ENTER), + BIND_GLOBAL_CONSTANT(KEY_KP_ENTER), BIND_GLOBAL_CONSTANT(KEY_INSERT), BIND_GLOBAL_CONSTANT(KEY_DELETE), BIND_GLOBAL_CONSTANT(KEY_PAUSE), diff --git a/core/hash_map.h b/core/hash_map.h index 45e7b82d24..2d7249e2fc 100644 --- a/core/hash_map.h +++ b/core/hash_map.h @@ -96,9 +96,9 @@ public: TData data; Pair() {} - Pair(const TKey &p_key, const TData &p_data) { - key = p_key; - data = p_data; + Pair(const TKey &p_key, const TData &p_data) + : key(p_key), + data(p_data) { } }; diff --git a/core/image.cpp b/core/image.cpp index 50dc9c109d..2db9cb1571 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -2254,16 +2254,16 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("srgb_to_linear"), &Image::srgb_to_linear); ClassDB::bind_method(D_METHOD("normalmap_to_xy"), &Image::normalmap_to_xy); - ClassDB::bind_method(D_METHOD("blit_rect", "src:Image", "src_rect", "dst"), &Image::blit_rect); - ClassDB::bind_method(D_METHOD("blit_rect_mask", "src:Image", "mask:Image", "src_rect", "dst"), &Image::blit_rect_mask); - ClassDB::bind_method(D_METHOD("blend_rect", "src:Image", "src_rect", "dst"), &Image::blend_rect); - ClassDB::bind_method(D_METHOD("blend_rect_mask", "src:Image", "mask:Image", "src_rect", "dst"), &Image::blend_rect_mask); + ClassDB::bind_method(D_METHOD("blit_rect", "src", "src_rect", "dst"), &Image::blit_rect); + ClassDB::bind_method(D_METHOD("blit_rect_mask", "src", "mask", "src_rect", "dst"), &Image::blit_rect_mask); + ClassDB::bind_method(D_METHOD("blend_rect", "src", "src_rect", "dst"), &Image::blend_rect); + ClassDB::bind_method(D_METHOD("blend_rect_mask", "src", "mask", "src_rect", "dst"), &Image::blend_rect_mask); ClassDB::bind_method(D_METHOD("fill", "color"), &Image::fill); ClassDB::bind_method(D_METHOD("get_used_rect"), &Image::get_used_rect); - ClassDB::bind_method(D_METHOD("get_rect:Image", "rect"), &Image::get_rect); + ClassDB::bind_method(D_METHOD("get_rect", "rect"), &Image::get_rect); - ClassDB::bind_method(D_METHOD("copy_from", "src:Image"), &Image::copy_internals_from); + ClassDB::bind_method(D_METHOD("copy_from", "src"), &Image::copy_internals_from); ClassDB::bind_method(D_METHOD("_set_data", "data"), &Image::_set_data); ClassDB::bind_method(D_METHOD("_get_data"), &Image::_get_data); diff --git a/core/input_map.cpp b/core/input_map.cpp index 24d0624e98..8435882325 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -41,11 +41,11 @@ void InputMap::_bind_methods() { ClassDB::bind_method(D_METHOD("add_action", "action"), &InputMap::add_action); ClassDB::bind_method(D_METHOD("erase_action", "action"), &InputMap::erase_action); - ClassDB::bind_method(D_METHOD("action_add_event", "action", "event:InputEvent"), &InputMap::action_add_event); - ClassDB::bind_method(D_METHOD("action_has_event", "action", "event:InputEvent"), &InputMap::action_has_event); - ClassDB::bind_method(D_METHOD("action_erase_event", "action", "event:InputEvent"), &InputMap::action_erase_event); + ClassDB::bind_method(D_METHOD("action_add_event", "action", "event"), &InputMap::action_add_event); + ClassDB::bind_method(D_METHOD("action_has_event", "action", "event"), &InputMap::action_has_event); + ClassDB::bind_method(D_METHOD("action_erase_event", "action", "event"), &InputMap::action_erase_event); ClassDB::bind_method(D_METHOD("get_action_list", "action"), &InputMap::_get_action_list); - ClassDB::bind_method(D_METHOD("event_is_action", "event:InputEvent", "action"), &InputMap::event_is_action); + ClassDB::bind_method(D_METHOD("event_is_action", "event", "action"), &InputMap::event_is_action); ClassDB::bind_method(D_METHOD("load_from_globals"), &InputMap::load_from_globals); } @@ -219,11 +219,11 @@ void InputMap::load_default() { add_action("ui_accept"); key.instance(); - key->set_scancode(KEY_RETURN); + key->set_scancode(KEY_ENTER); action_add_event("ui_accept", key); key.instance(); - key->set_scancode(KEY_ENTER); + key->set_scancode(KEY_KP_ENTER); action_add_event("ui_accept", key); key.instance(); diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 4067899068..edd090adf2 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -205,7 +205,7 @@ Error ConfigFile::load(const String &p_path) { void ConfigFile::_bind_methods() { ClassDB::bind_method(D_METHOD("set_value", "section", "key", "value"), &ConfigFile::set_value); - ClassDB::bind_method(D_METHOD("get_value:Variant", "section", "key", "default"), &ConfigFile::get_value, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("get_value", "section", "key", "default"), &ConfigFile::get_value, DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("has_section", "section"), &ConfigFile::has_section); ClassDB::bind_method(D_METHOD("has_section_key", "section", "key"), &ConfigFile::has_section_key); @@ -215,8 +215,8 @@ void ConfigFile::_bind_methods() { ClassDB::bind_method(D_METHOD("erase_section", "section"), &ConfigFile::erase_section); - ClassDB::bind_method(D_METHOD("load:Error", "path"), &ConfigFile::load); - ClassDB::bind_method(D_METHOD("save:Error", "path"), &ConfigFile::save); + ClassDB::bind_method(D_METHOD("load", "path"), &ConfigFile::load); + ClassDB::bind_method(D_METHOD("save", "path"), &ConfigFile::save); } ConfigFile::ConfigFile() { diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 79aa39521f..c3bcfc840b 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -308,10 +308,9 @@ bool FileAccessPack::file_exists(const String &p_name) { return false; } -FileAccessPack::FileAccessPack(const String &p_path, const PackedData::PackedFile &p_file) { - - pf = p_file; - f = FileAccess::open(pf.pack, FileAccess::READ); +FileAccessPack::FileAccessPack(const String &p_path, const PackedData::PackedFile &p_file) + : pf(p_file), + f(FileAccess::open(pf.pack, FileAccess::READ)) { if (!f) { ERR_EXPLAIN("Can't open pack-referenced file: " + String(pf.pack)); ERR_FAIL_COND(!f); diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 0c84a5213f..4d5b88cfa1 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -624,9 +624,9 @@ Error HTTPClient::_get_http_data(uint8_t *p_buffer, int p_bytes, int &r_received void HTTPClient::_bind_methods() { - ClassDB::bind_method(D_METHOD("connect_to_host:Error", "host", "port", "use_ssl", "verify_host"), &HTTPClient::connect_to_host, DEFVAL(false), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("set_connection", "connection:StreamPeer"), &HTTPClient::set_connection); - ClassDB::bind_method(D_METHOD("get_connection:StreamPeer"), &HTTPClient::get_connection); + ClassDB::bind_method(D_METHOD("connect_to_host", "host", "port", "use_ssl", "verify_host"), &HTTPClient::connect_to_host, DEFVAL(false), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("set_connection", "connection"), &HTTPClient::set_connection); + ClassDB::bind_method(D_METHOD("get_connection"), &HTTPClient::get_connection); ClassDB::bind_method(D_METHOD("request_raw", "method", "url", "headers", "body"), &HTTPClient::request_raw); ClassDB::bind_method(D_METHOD("request", "method", "url", "headers", "body"), &HTTPClient::request, DEFVAL(String())); ClassDB::bind_method(D_METHOD("send_body_text", "body"), &HTTPClient::send_body_text); @@ -646,9 +646,9 @@ void HTTPClient::_bind_methods() { ClassDB::bind_method(D_METHOD("is_blocking_mode_enabled"), &HTTPClient::is_blocking_mode_enabled); ClassDB::bind_method(D_METHOD("get_status"), &HTTPClient::get_status); - ClassDB::bind_method(D_METHOD("poll:Error"), &HTTPClient::poll); + ClassDB::bind_method(D_METHOD("poll"), &HTTPClient::poll); - ClassDB::bind_method(D_METHOD("query_string_from_dict:String", "fields"), &HTTPClient::query_string_from_dict); + ClassDB::bind_method(D_METHOD("query_string_from_dict", "fields"), &HTTPClient::query_string_from_dict); BIND_CONSTANT(METHOD_GET); BIND_CONSTANT(METHOD_HEAD); diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index a3d33593dd..c028d7d197 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -120,11 +120,11 @@ Error PacketPeer::_get_packet_error() const { void PacketPeer::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_var:Variant"), &PacketPeer::_bnd_get_var); - ClassDB::bind_method(D_METHOD("put_var", "var:Variant"), &PacketPeer::put_var); + ClassDB::bind_method(D_METHOD("get_var"), &PacketPeer::_bnd_get_var); + ClassDB::bind_method(D_METHOD("put_var", "var"), &PacketPeer::put_var); ClassDB::bind_method(D_METHOD("get_packet"), &PacketPeer::_get_packet); - ClassDB::bind_method(D_METHOD("put_packet:Error", "buffer"), &PacketPeer::_put_packet); - ClassDB::bind_method(D_METHOD("get_packet_error:Error"), &PacketPeer::_get_packet_error); + ClassDB::bind_method(D_METHOD("put_packet", "buffer"), &PacketPeer::_put_packet); + ClassDB::bind_method(D_METHOD("get_packet_error"), &PacketPeer::_get_packet_error); ClassDB::bind_method(D_METHOD("get_available_packet_count"), &PacketPeer::get_available_packet_count); }; @@ -138,7 +138,9 @@ void PacketPeerStream::_set_stream_peer(REF p_peer) { void PacketPeerStream::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_stream_peer", "peer:StreamPeer"), &PacketPeerStream::_set_stream_peer); + ClassDB::bind_method(D_METHOD("set_stream_peer", "peer"), &PacketPeerStream::_set_stream_peer); + ClassDB::bind_method(D_METHOD("set_input_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_input_buffer_max_size); + ClassDB::bind_method(D_METHOD("set_output_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_output_buffer_max_size); } Error PacketPeerStream::_poll_buffer() const { @@ -146,13 +148,13 @@ Error PacketPeerStream::_poll_buffer() const { ERR_FAIL_COND_V(peer.is_null(), ERR_UNCONFIGURED); int read = 0; - Error err = peer->get_partial_data(&temp_buffer[0], ring_buffer.space_left(), read); + Error err = peer->get_partial_data(&input_buffer[0], ring_buffer.space_left(), read); if (err) return err; if (read == 0) return OK; - int w = ring_buffer.write(&temp_buffer[0], read); + int w = ring_buffer.write(&input_buffer[0], read); ERR_FAIL_COND_V(w != read, ERR_BUG); return OK; @@ -198,9 +200,9 @@ Error PacketPeerStream::get_packet(const uint8_t **r_buffer, int &r_buffer_size) ERR_FAIL_COND_V(remaining < (int)len, ERR_UNAVAILABLE); ring_buffer.read(lbuf, 4); //get rid of first 4 bytes - ring_buffer.read(&temp_buffer[0], len); // read packet + ring_buffer.read(&input_buffer[0], len); // read packet - *r_buffer = &temp_buffer[0]; + *r_buffer = &input_buffer[0]; r_buffer_size = len; return OK; } @@ -217,19 +219,19 @@ Error PacketPeerStream::put_packet(const uint8_t *p_buffer, int p_buffer_size) { return OK; ERR_FAIL_COND_V(p_buffer_size < 0, ERR_INVALID_PARAMETER); - ERR_FAIL_COND_V(p_buffer_size + 4 > temp_buffer.size(), ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_buffer_size + 4 > output_buffer.size(), ERR_INVALID_PARAMETER); - encode_uint32(p_buffer_size, &temp_buffer[0]); - uint8_t *dst = &temp_buffer[4]; + encode_uint32(p_buffer_size, &output_buffer[0]); + uint8_t *dst = &output_buffer[4]; for (int i = 0; i < p_buffer_size; i++) dst[i] = p_buffer[i]; - return peer->put_data(&temp_buffer[0], p_buffer_size + 4); + return peer->put_data(&output_buffer[0], p_buffer_size + 4); } int PacketPeerStream::get_max_packet_size() const { - return temp_buffer.size(); + return output_buffer.size(); } void PacketPeerStream::set_stream_peer(const Ref<StreamPeer> &p_peer) { @@ -249,7 +251,12 @@ void PacketPeerStream::set_input_buffer_max_size(int p_max_size) { ERR_EXPLAIN("Buffer in use, resizing would cause loss of data"); ERR_FAIL_COND(ring_buffer.data_left()); ring_buffer.resize(nearest_shift(p_max_size + 4)); - temp_buffer.resize(nearest_power_of_2(p_max_size + 4)); + input_buffer.resize(nearest_power_of_2(p_max_size + 4)); +} + +void PacketPeerStream::set_output_buffer_max_size(int p_max_size) { + + output_buffer.resize(nearest_power_of_2(p_max_size + 4)); } PacketPeerStream::PacketPeerStream() { @@ -257,5 +264,6 @@ PacketPeerStream::PacketPeerStream() { int rbsize = GLOBAL_GET("network/limits/packet_peer_stream/max_buffer_po2"); ring_buffer.resize(rbsize); - temp_buffer.resize(1 << rbsize); + input_buffer.resize(1 << rbsize); + output_buffer.resize(1 << rbsize); } diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h index 95806aa511..ed6b252d80 100644 --- a/core/io/packet_peer.h +++ b/core/io/packet_peer.h @@ -75,7 +75,8 @@ class PacketPeerStream : public PacketPeer { mutable Ref<StreamPeer> peer; mutable RingBuffer<uint8_t> ring_buffer; - mutable Vector<uint8_t> temp_buffer; + mutable Vector<uint8_t> input_buffer; + mutable Vector<uint8_t> output_buffer; Error _poll_buffer() const; @@ -92,6 +93,7 @@ public: void set_stream_peer(const Ref<StreamPeer> &p_peer); void set_input_buffer_max_size(int p_max_size); + void set_output_buffer_max_size(int p_max_size); PacketPeerStream(); }; diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index 8bc3241cc5..d1729819a8 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -59,9 +59,9 @@ Error PacketPeerUDP::_set_dest_address(const String &p_address, int p_port) { void PacketPeerUDP::_bind_methods() { - ClassDB::bind_method(D_METHOD("listen:Error", "port", "bind_address", "recv_buf_size"), &PacketPeerUDP::listen, DEFVAL("*"), DEFVAL(65536)); + ClassDB::bind_method(D_METHOD("listen", "port", "bind_address", "recv_buf_size"), &PacketPeerUDP::listen, DEFVAL("*"), DEFVAL(65536)); ClassDB::bind_method(D_METHOD("close"), &PacketPeerUDP::close); - ClassDB::bind_method(D_METHOD("wait:Error"), &PacketPeerUDP::wait); + ClassDB::bind_method(D_METHOD("wait"), &PacketPeerUDP::wait); ClassDB::bind_method(D_METHOD("is_listening"), &PacketPeerUDP::is_listening); ClassDB::bind_method(D_METHOD("get_packet_ip"), &PacketPeerUDP::_get_packet_ip); //ClassDB::bind_method(D_METHOD("get_packet_address"),&PacketPeerUDP::_get_packet_address); diff --git a/core/io/resource_import.h b/core/io/resource_import.h index 9d2a5180dc..d3f98cbc07 100644 --- a/core/io/resource_import.h +++ b/core/io/resource_import.h @@ -85,9 +85,9 @@ public: PropertyInfo option; Variant default_value; - ImportOption(const PropertyInfo &p_info, const Variant &p_default) { - option = p_info; - default_value = p_default; + ImportOption(const PropertyInfo &p_info, const Variant &p_default) + : option(p_info), + default_value(p_default) { } ImportOption() {} }; diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 9b89fa3399..5347cd6ee1 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -84,7 +84,7 @@ void ResourceLoader::get_recognized_extensions_for_type(const String &p_type, Li void ResourceInteractiveLoader::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_resource:Resource"), &ResourceInteractiveLoader::get_resource); + ClassDB::bind_method(D_METHOD("get_resource"), &ResourceInteractiveLoader::get_resource); ClassDB::bind_method(D_METHOD("poll"), &ResourceInteractiveLoader::poll); ClassDB::bind_method(D_METHOD("wait"), &ResourceInteractiveLoader::wait); ClassDB::bind_method(D_METHOD("get_stage"), &ResourceInteractiveLoader::get_stage); diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index 0dbcb3cf56..fdad7c7bdf 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -385,7 +385,7 @@ void StreamPeer::_bind_methods() { ClassDB::bind_method(D_METHOD("put_float", "val"), &StreamPeer::put_float); ClassDB::bind_method(D_METHOD("put_double", "val"), &StreamPeer::put_double); ClassDB::bind_method(D_METHOD("put_utf8_string", "val"), &StreamPeer::put_utf8_string); - ClassDB::bind_method(D_METHOD("put_var", "val:Variant"), &StreamPeer::put_var); + ClassDB::bind_method(D_METHOD("put_var", "val"), &StreamPeer::put_var); ClassDB::bind_method(D_METHOD("get_8"), &StreamPeer::get_8); ClassDB::bind_method(D_METHOD("get_u8"), &StreamPeer::get_u8); @@ -399,7 +399,7 @@ void StreamPeer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_double"), &StreamPeer::get_double); ClassDB::bind_method(D_METHOD("get_string", "bytes"), &StreamPeer::get_string); ClassDB::bind_method(D_METHOD("get_utf8_string", "bytes"), &StreamPeer::get_utf8_string); - ClassDB::bind_method(D_METHOD("get_var:Variant"), &StreamPeer::get_var); + ClassDB::bind_method(D_METHOD("get_var"), &StreamPeer::get_var); } //////////////////////////////// @@ -412,7 +412,7 @@ void StreamPeerBuffer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_data_array", "data"), &StreamPeerBuffer::set_data_array); ClassDB::bind_method(D_METHOD("get_data_array"), &StreamPeerBuffer::get_data_array); ClassDB::bind_method(D_METHOD("clear"), &StreamPeerBuffer::clear); - ClassDB::bind_method(D_METHOD("duplicate:StreamPeerBuffer"), &StreamPeerBuffer::duplicate); + ClassDB::bind_method(D_METHOD("duplicate"), &StreamPeerBuffer::duplicate); } Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) { diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp index 57cffd073a..ef3c264375 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_ssl.cpp @@ -51,8 +51,8 @@ bool StreamPeerSSL::is_available() { void StreamPeerSSL::_bind_methods() { - ClassDB::bind_method(D_METHOD("accept_stream:Error", "stream:StreamPeer"), &StreamPeerSSL::accept_stream); - ClassDB::bind_method(D_METHOD("connect_to_stream:Error", "stream:StreamPeer", "validate_certs", "for_hostname"), &StreamPeerSSL::connect_to_stream, DEFVAL(false), DEFVAL(String())); + ClassDB::bind_method(D_METHOD("accept_stream", "stream"), &StreamPeerSSL::accept_stream); + ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname"), &StreamPeerSSL::connect_to_stream, DEFVAL(false), DEFVAL(String())); ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerSSL::get_status); ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerSSL::disconnect_from_stream); BIND_CONSTANT(STATUS_DISCONNECTED); diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp index 4c891188ee..29a80ecc19 100644 --- a/core/io/tcp_server.cpp +++ b/core/io/tcp_server.cpp @@ -49,7 +49,7 @@ void TCP_Server::_bind_methods() { ClassDB::bind_method(D_METHOD("listen", "port", "bind_address"), &TCP_Server::listen, DEFVAL("*")); ClassDB::bind_method(D_METHOD("is_connection_available"), &TCP_Server::is_connection_available); - ClassDB::bind_method(D_METHOD("take_connection:StreamPeerTCP"), &TCP_Server::take_connection); + ClassDB::bind_method(D_METHOD("take_connection"), &TCP_Server::take_connection); ClassDB::bind_method(D_METHOD("stop"), &TCP_Server::stop); } diff --git a/core/make_binders.py b/core/make_binders.py index 74b5e9fda3..a5cdb78443 100644 --- a/core/make_binders.py +++ b/core/make_binders.py @@ -11,11 +11,18 @@ public: #ifdef DEBUG_METHODS_ENABLED virtual Variant::Type _gen_argument_type(int p_arg) const { return _get_argument_type(p_arg); } Variant::Type _get_argument_type(int p_argument) const { - $ifret if (p_argument==-1) return Variant::get_type_for<R>();$ - $arg if (p_argument==(@-1)) return Variant::get_type_for<P@>(); + $ifret if (p_argument==-1) return (Variant::Type)GetTypeInfo<R>::VARIANT_TYPE;$ + $arg if (p_argument==(@-1)) return (Variant::Type)GetTypeInfo<P@>::VARIANT_TYPE; $ return Variant::NIL; } + virtual StringName _gen_argument_type_name(int p_arg) const { return _gen_argument_type_hint(p_arg); } + StringName _gen_argument_type_hint(int p_argument) const { + $ifret if (p_argument==-1) return GetTypeInfo<R>::get_class_name();$ + $arg if (p_argument==(@-1)) return GetTypeInfo<P@>::get_class_name(); + $ + return StringName(); + } #endif virtual String get_instance_class() const { return T::get_class_static(); @@ -91,11 +98,20 @@ public: virtual Variant::Type _gen_argument_type(int p_arg) const { return _get_argument_type(p_arg); } Variant::Type _get_argument_type(int p_argument) const { - $ifret if (p_argument==-1) return Variant::get_type_for<R>();$ - $arg if (p_argument==(@-1)) return Variant::get_type_for<P@>(); + $ifret if (p_argument==-1) return (Variant::Type)GetTypeInfo<R>::VARIANT_TYPE;$ + $arg if (p_argument==(@-1)) return (Variant::Type)GetTypeInfo<P@>::VARIANT_TYPE; $ return Variant::NIL; } + + virtual StringName _gen_argument_type_name(int p_arg) const { return _gen_argument_type_hint(p_arg); } + + StringName _gen_argument_type_hint(int p_argument) const { + $ifret if (p_argument==-1) return GetTypeInfo<R>::get_class_name();$ + $arg if (p_argument==(@-1)) return GetTypeInfo<P@>::get_class_name(); + $ + return StringName(); + } #endif virtual String get_instance_class() const { return type_name; diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp index 327a6017c3..e22bc2b05e 100644 --- a/core/math/bsp_tree.cpp +++ b/core/math/bsp_tree.cpp @@ -577,12 +577,11 @@ BSP_Tree::BSP_Tree(const PoolVector<Face3> &p_faces, real_t p_error_radius) { error_radius = p_error_radius; } -BSP_Tree::BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const Rect3 &p_aabb, real_t p_error_radius) { - - nodes = p_nodes; - planes = p_planes; - aabb = p_aabb; - error_radius = p_error_radius; +BSP_Tree::BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const Rect3 &p_aabb, real_t p_error_radius) + : nodes(p_nodes), + planes(p_planes), + aabb(p_aabb), + error_radius(p_error_radius) { } BSP_Tree::~BSP_Tree() { diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 780bb532d7..b679371e03 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -378,13 +378,13 @@ struct Rect2 { operator String() const { return String(position) + ", " + String(size); } Rect2() {} - Rect2(real_t p_x, real_t p_y, real_t p_width, real_t p_height) { - position = Point2(p_x, p_y); - size = Size2(p_width, p_height); + Rect2(real_t p_x, real_t p_y, real_t p_width, real_t p_height) + : position(Point2(p_x, p_y)), + size(Size2(p_width, p_height)) { } - Rect2(const Point2 &p_pos, const Size2 &p_size) { - position = p_pos; - size = p_size; + Rect2(const Point2 &p_pos, const Size2 &p_size) + : position(p_pos), + size(p_size) { } }; @@ -571,18 +571,18 @@ struct Rect2i { operator String() const { return String(position) + ", " + String(size); } operator Rect2() const { return Rect2(position, size); } - Rect2i(const Rect2 &p_r2) { - position = p_r2.position; - size = p_r2.size; + Rect2i(const Rect2 &p_r2) + : position(p_r2.position), + size(p_r2.size) { } Rect2i() {} - Rect2i(int p_x, int p_y, int p_width, int p_height) { - position = Point2(p_x, p_y); - size = Size2(p_width, p_height); + Rect2i(int p_x, int p_y, int p_width, int p_height) + : position(Point2(p_x, p_y)), + size(Size2(p_width, p_height)) { } - Rect2i(const Point2 &p_pos, const Size2 &p_size) { - position = p_pos; - size = p_size; + Rect2i(const Point2 &p_pos, const Size2 &p_size) + : position(p_pos), + size(p_size) { } }; diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp index b59fecc196..b64f34d977 100644 --- a/core/math/matrix3.cpp +++ b/core/math/matrix3.cpp @@ -30,7 +30,7 @@ #include "matrix3.h" #include "math_funcs.h" #include "os/copymem.h" - +#include "print_string.h" #define cofac(row1, col1, row2, col2) \ (elements[row1][col1] * elements[row2][col2] - elements[row1][col2] * elements[row2][col1]) @@ -364,8 +364,16 @@ Vector3 Basis::get_euler() const { euler.y = Math::asin(elements[0][2]); if (euler.y < Math_PI * 0.5) { if (euler.y > -Math_PI * 0.5) { - euler.x = Math::atan2(-elements[1][2], elements[2][2]); - euler.z = Math::atan2(-elements[0][1], elements[0][0]); + //if rotation is Y-only, return a proper -pi,pi range like in x or z for the same case. + if (elements[1][0] == 0.0 && elements[0][1] == 0.0 && elements[0][0] < 0.0) { + if (euler.y > 0.0) + euler.y = Math_PI - euler.y; + else + euler.y = -(Math_PI + euler.y); + } else { + euler.x = Math::atan2(-elements[1][2], elements[2][2]); + euler.z = Math::atan2(-elements[0][1], elements[0][0]); + } } else { real_t r = Math::atan2(elements[1][0], elements[1][1]); diff --git a/core/math/plane.h b/core/math/plane.h index 5a048674e4..92ebcd8024 100644 --- a/core/math/plane.h +++ b/core/math/plane.h @@ -75,7 +75,8 @@ public: _FORCE_INLINE_ Plane() { d = 0; } _FORCE_INLINE_ Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d) - : normal(p_a, p_b, p_c), d(p_d){}; + : normal(p_a, p_b, p_c), + d(p_d){}; _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d); _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3 &p_normal); @@ -99,16 +100,14 @@ bool Plane::has_point(const Vector3 &p_point, real_t _epsilon) const { return (dist <= _epsilon); } -Plane::Plane(const Vector3 &p_normal, real_t p_d) { - - normal = p_normal; - d = p_d; +Plane::Plane(const Vector3 &p_normal, real_t p_d) + : normal(p_normal), + d(p_d) { } -Plane::Plane(const Vector3 &p_point, const Vector3 &p_normal) { - - normal = p_normal; - d = p_normal.dot(p_point); +Plane::Plane(const Vector3 &p_point, const Vector3 &p_normal) + : normal(p_normal), + d(p_normal.dot(p_point)) { } Plane::Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir) { diff --git a/core/math/rect3.h b/core/math/rect3.h index b7c94ad9f7..e5d7462009 100644 --- a/core/math/rect3.h +++ b/core/math/rect3.h @@ -101,9 +101,9 @@ public: operator String() const; _FORCE_INLINE_ Rect3() {} - inline Rect3(const Vector3 &p_pos, const Vector3 &p_size) { - position = p_pos; - size = p_size; + inline Rect3(const Vector3 &p_pos, const Vector3 &p_size) + : position(p_pos), + size(p_size) { } }; diff --git a/core/math/transform.cpp b/core/math/transform.cpp index 7a50214596..3a86fbfc6c 100644 --- a/core/math/transform.cpp +++ b/core/math/transform.cpp @@ -208,8 +208,7 @@ Transform::operator String() const { return basis.operator String() + " - " + origin.operator String(); } -Transform::Transform(const Basis &p_basis, const Vector3 &p_origin) { - - basis = p_basis; - origin = p_origin; +Transform::Transform(const Basis &p_basis, const Vector3 &p_origin) + : basis(p_basis), + origin(p_origin) { } diff --git a/core/message_queue.cpp b/core/message_queue.cpp index 93d0b0730a..564069d8bb 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -153,16 +153,16 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) { Error MessageQueue::push_call(Object *p_object, const StringName &p_method, VARIANT_ARG_DECLARE) { - return push_call(p_object->get_instance_ID(), p_method, VARIANT_ARG_PASS); + return push_call(p_object->get_instance_id(), p_method, VARIANT_ARG_PASS); } Error MessageQueue::push_notification(Object *p_object, int p_notification) { - return push_notification(p_object->get_instance_ID(), p_notification); + return push_notification(p_object->get_instance_id(), p_notification); } Error MessageQueue::push_set(Object *p_object, const StringName &p_prop, const Variant &p_value) { - return push_set(p_object->get_instance_ID(), p_prop, p_value); + return push_set(p_object->get_instance_id(), p_prop, p_value); } void MessageQueue::statistics() { diff --git a/core/method_bind.cpp b/core/method_bind.cpp index 51c0e72bc7..6792b62703 100644 --- a/core/method_bind.cpp +++ b/core/method_bind.cpp @@ -38,12 +38,16 @@ PropertyInfo MethodBind::get_argument_info(int p_argument) const { if (p_argument >= 0) { - String name = (p_argument < arg_names.size()) ? String(arg_names[p_argument]) : String("arg" + itos(p_argument)); + String name = p_argument < arg_names.size() ? String(arg_names[p_argument]) : String("arg" + itos(p_argument)); PropertyInfo pi(get_argument_type(p_argument), name); - if ((pi.type == Variant::OBJECT) && name.find(":") != -1) { - pi.hint = PROPERTY_HINT_RESOURCE_TYPE; - pi.hint_string = name.get_slicec(':', 1); - pi.name = name.get_slicec(':', 0); + + if (!is_vararg() && pi.type == Variant::OBJECT) { + StringName type_hint = arg_type_hints[p_argument]; + + if (type_hint != StringName()) { + pi.hint = PROPERTY_HINT_RESOURCE_TYPE; + pi.hint_string = type_hint.operator String(); + } } return pi; @@ -87,6 +91,16 @@ Vector<StringName> MethodBind::get_argument_names() const { return arg_names; } +void MethodBind::set_argument_type_hints(const Vector<StringName> &p_type_hints) { + + arg_type_hints = p_type_hints; +} + +Vector<StringName> MethodBind::get_argument_type_hints() const { + + return arg_type_hints; +} + #endif void MethodBind::set_default_arguments(const Vector<Variant> &p_defargs) { @@ -98,11 +112,19 @@ void MethodBind::set_default_arguments(const Vector<Variant> &p_defargs) { void MethodBind::_generate_argument_types(int p_count) { set_argument_count(p_count); + Variant::Type *argt = memnew_arr(Variant::Type, p_count + 1); - argt[0] = _gen_argument_type(-1); + + arg_type_hints.resize(p_count); + + argt[0] = _gen_argument_type(-1); // return type + set_return_type(_gen_argument_type_hint(-1)); + for (int i = 0; i < p_count; i++) { argt[i + 1] = _gen_argument_type(i); + arg_type_hints[i] = _gen_argument_type_hint(i); } + set_argument_types(argt); } diff --git a/core/method_bind.h b/core/method_bind.h index dbc9cca082..3b4ff96a19 100644 --- a/core/method_bind.h +++ b/core/method_bind.h @@ -44,6 +44,8 @@ #define DEBUG_METHODS_ENABLED #endif +#include "type_info.h" + enum MethodFlags { METHOD_FLAG_NORMAL = 1, @@ -87,12 +89,10 @@ struct VariantCaster<const T &> { #define _VC(m_idx) \ (VariantCaster<P##m_idx>::cast((m_idx - 1) >= p_arg_count ? get_default_argument(m_idx - 1) : *p_args[m_idx - 1])) -//SIMPLE_NUMERIC_TYPE is used to avoid a warning on Variant::get_type_for - #ifdef PTRCALL_ENABLED #define VARIANT_ENUM_CAST(m_enum) \ - SIMPLE_NUMERIC_TYPE(m_enum); \ + MAKE_ENUM_TYPE_INFO(m_enum) \ template <> \ struct VariantCaster<m_enum> { \ \ @@ -113,7 +113,7 @@ struct VariantCaster<const T &> { #else #define VARIANT_ENUM_CAST(m_enum) \ - SIMPLE_NUMERIC_TYPE(m_enum); \ + MAKE_ENUM_TYPE_INFO(m_enum) \ template <> \ struct VariantCaster<m_enum> { \ \ @@ -165,6 +165,7 @@ class MethodBind { int argument_count; #ifdef DEBUG_METHODS_ENABLED Vector<StringName> arg_names; + Vector<StringName> arg_type_hints; Variant::Type *argument_types; StringName ret_type; #endif @@ -176,6 +177,7 @@ protected: void _set_returns(bool p_returns); #ifdef DEBUG_METHODS_ENABLED virtual Variant::Type _gen_argument_type(int p_arg) const = 0; + virtual StringName _gen_argument_type_hint(int p_arg) const = 0; void _generate_argument_types(int p_count); void set_argument_types(Variant::Type *p_types) { argument_types = p_types; } #endif @@ -220,6 +222,9 @@ public: void set_argument_names(const Vector<StringName> &p_names); Vector<StringName> get_argument_names() const; + + void set_argument_type_hints(const Vector<StringName> &p_type_hints); + Vector<StringName> get_argument_type_hints() const; #endif void set_hint_flags(uint32_t p_hint) { hint_flags = p_hint; } uint32_t get_hint_flags() const { return hint_flags | (is_const() ? METHOD_FLAG_CONST : 0) | (is_vararg() ? METHOD_FLAG_VARARG : 0); } @@ -282,11 +287,17 @@ public: return Variant::NIL; } + virtual StringName _gen_argument_type_hint(int p_arg) const { + + return "Variant"; + } + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Variant::CallError &r_error) { T *instance = static_cast<T *>(p_object); return (instance->*call_method)(p_args, p_arg_count, r_error); } + void set_method_info(const MethodInfo &p_info) { set_argument_count(p_info.arguments.size()); diff --git a/core/path_db.cpp b/core/node_path.cpp index d5c84a2457..ad2eae859d 100644 --- a/core/path_db.cpp +++ b/core/node_path.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* path_db.cpp */ +/* node_path.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,7 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "path_db.h" +#include "node_path.h" #include "print_string.h" diff --git a/core/path_db.h b/core/node_path.h index 1aed7535ca..31446ab9b4 100644 --- a/core/path_db.h +++ b/core/node_path.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* path_db.h */ +/* node_path.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,8 +27,8 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef PATH_DB_H -#define PATH_DB_H +#ifndef NODE_PATH_H +#define NODE_PATH_H #include "string_db.h" #include "ustring.h" diff --git a/core/object.cpp b/core/object.cpp index 316c624268..62b2b5d545 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -122,10 +122,9 @@ MethodInfo::operator Dictionary() const { return d; } -MethodInfo::MethodInfo() { - - id = 0; - flags = METHOD_FLAG_NORMAL; +MethodInfo::MethodInfo() + : flags(METHOD_FLAG_NORMAL), + id(0) { } MethodInfo MethodInfo::from_dict(const Dictionary &p_dict) { @@ -161,125 +160,114 @@ MethodInfo MethodInfo::from_dict(const Dictionary &p_dict) { return mi; } -MethodInfo::MethodInfo(const String &p_name) { - - id = 0; - name = p_name; - flags = METHOD_FLAG_NORMAL; +MethodInfo::MethodInfo(const String &p_name) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { } -MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1) { - - id = 0; - name = p_name; +MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { arguments.push_back(p_param1); - flags = METHOD_FLAG_NORMAL; } -MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2) { - - id = 0; - name = p_name; +MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { arguments.push_back(p_param1); arguments.push_back(p_param2); - flags = METHOD_FLAG_NORMAL; } -MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3) { - - id = 0; - name = p_name; +MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { arguments.push_back(p_param1); arguments.push_back(p_param2); arguments.push_back(p_param3); - flags = METHOD_FLAG_NORMAL; } -MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4) { - - id = 0; - name = p_name; +MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { arguments.push_back(p_param1); arguments.push_back(p_param2); arguments.push_back(p_param3); arguments.push_back(p_param4); - flags = METHOD_FLAG_NORMAL; } -MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5) { - id = 0; - name = p_name; +MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { arguments.push_back(p_param1); arguments.push_back(p_param2); arguments.push_back(p_param3); arguments.push_back(p_param4); arguments.push_back(p_param5); - flags = METHOD_FLAG_NORMAL; } -MethodInfo::MethodInfo(Variant::Type ret) { - - id = 0; - flags = METHOD_FLAG_NORMAL; +MethodInfo::MethodInfo(Variant::Type ret) + : flags(METHOD_FLAG_NORMAL), + id(0) { return_val.type = ret; } -MethodInfo::MethodInfo(Variant::Type ret, const String &p_name) { - - id = 0; - name = p_name; - flags = METHOD_FLAG_NORMAL; +MethodInfo::MethodInfo(Variant::Type ret, const String &p_name) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { return_val.type = ret; } -MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1) { - - id = 0; - name = p_name; - arguments.push_back(p_param1); - flags = METHOD_FLAG_NORMAL; +MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { return_val.type = ret; + arguments.push_back(p_param1); } -MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2) { - - id = 0; - name = p_name; +MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { + return_val.type = ret; arguments.push_back(p_param1); arguments.push_back(p_param2); - flags = METHOD_FLAG_NORMAL; - return_val.type = ret; } -MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3) { - - id = 0; - name = p_name; +MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { + return_val.type = ret; arguments.push_back(p_param1); arguments.push_back(p_param2); arguments.push_back(p_param3); - flags = METHOD_FLAG_NORMAL; - return_val.type = ret; } -MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4) { - - id = 0; - name = p_name; +MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { + return_val.type = ret; arguments.push_back(p_param1); arguments.push_back(p_param2); arguments.push_back(p_param3); arguments.push_back(p_param4); - flags = METHOD_FLAG_NORMAL; - return_val.type = ret; } -MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5) { - id = 0; - name = p_name; +MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5) + : name(p_name), + flags(METHOD_FLAG_NORMAL), + id(0) { + return_val.type = ret; arguments.push_back(p_param1); arguments.push_back(p_param2); arguments.push_back(p_param3); arguments.push_back(p_param4); arguments.push_back(p_param5); - flags = METHOD_FLAG_NORMAL; - return_val.type = ret; } Object::Connection::operator Variant() const { @@ -599,7 +587,7 @@ Variant Object::_call_deferred_bind(const Variant **p_args, int p_argcount, Vari StringName method = *p_args[0]; - MessageQueue::get_singleton()->push_call(get_instance_ID(), method, &p_args[1], p_argcount - 1); + MessageQueue::get_singleton()->push_call(get_instance_id(), method, &p_args[1], p_argcount - 1); return Variant(); } @@ -1182,10 +1170,10 @@ Variant Object::_emit_signal(const Variant **p_args, int p_argcount, Variant::Ca return Variant(); } -void Object::emit_signal(const StringName &p_name, const Variant **p_args, int p_argcount) { +Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int p_argcount) { if (_block_signals) - return; //no emit, signals blocked + return ERR_CANT_AQUIRE_RESOURCE; //no emit, signals blocked Signal *s = signal_map.getptr(p_name); if (!s) { @@ -1194,11 +1182,11 @@ void Object::emit_signal(const StringName &p_name, const Variant **p_args, int p //check in script if (!signal_is_valid && !script.is_null() && !Ref<Script>(script)->has_script_signal(p_name)) { ERR_EXPLAIN("Can't emit non-existing signal " + String("\"") + p_name + "\"."); - ERR_FAIL(); + ERR_FAIL_V(ERR_UNAVAILABLE); } #endif //not connected? just return - return; + return ERR_UNAVAILABLE; } List<_ObjectSignalDisconnectData> disconnect_data; @@ -1214,6 +1202,8 @@ void Object::emit_signal(const StringName &p_name, const Variant **p_args, int p Vector<const Variant *> bind_mem; + Error err = OK; + for (int i = 0; i < ssize; i++) { const Connection &c = slot_map.getv(i).conn; @@ -1245,16 +1235,18 @@ void Object::emit_signal(const StringName &p_name, const Variant **p_args, int p } if (c.flags & CONNECT_DEFERRED) { - MessageQueue::get_singleton()->push_call(target->get_instance_ID(), c.method, args, argc, true); + MessageQueue::get_singleton()->push_call(target->get_instance_id(), c.method, args, argc, true); } else { Variant::CallError ce; target->call(c.method, args, argc, ce); + if (ce.error != Variant::CallError::CALL_OK) { if (ce.error == Variant::CallError::CALL_ERROR_INVALID_METHOD && !ClassDB::class_exists(target->get_class_name())) { //most likely object is not initialized yet, do not throw error. } else { ERR_PRINTS("Error calling method from signal '" + String(p_name) + "': " + Variant::get_call_error_text(target, c.method, args, argc, ce)); + err = ERR_METHOD_NOT_FOUND; } } } @@ -1274,21 +1266,24 @@ void Object::emit_signal(const StringName &p_name, const Variant **p_args, int p disconnect(dd.signal, dd.target, dd.method); disconnect_data.pop_front(); } + + return err; } -void Object::emit_signal(const StringName &p_name, VARIANT_ARG_DECLARE) { +Error Object::emit_signal(const StringName &p_name, VARIANT_ARG_DECLARE) { VARIANT_ARGPTRS; int argc = 0; for (int i = 0; i < VARIANT_ARG_MAX; i++) { + if (argptr[i]->get_type() == Variant::NIL) break; argc++; } - emit_signal(p_name, argptr, argc); + return emit_signal(p_name, argptr, argc); } void Object::_add_user_signal(const String &p_name, const Array &p_args) { @@ -1471,7 +1466,7 @@ Error Object::connect(const StringName &p_signal, Object *p_to_object, const Str s = &signal_map[p_signal]; } - Signal::Target target(p_to_object->get_instance_ID(), p_to_method); + Signal::Target target(p_to_object->get_instance_id(), p_to_method); if (s->slot_map.has(target)) { ERR_EXPLAIN("Signal '" + p_signal + "'' already connected to given method '" + p_to_method + "' in that object."); ERR_FAIL_COND_V(s->slot_map.has(target), ERR_INVALID_PARAMETER); @@ -1509,7 +1504,7 @@ bool Object::is_connected(const StringName &p_signal, Object *p_to_object, const ERR_FAIL_COND_V(!s, false); } - Signal::Target target(p_to_object->get_instance_ID(), p_to_method); + Signal::Target target(p_to_object->get_instance_id(), p_to_method); return s->slot_map.has(target); //const Map<Signal::Target,Signal::Slot>::Element *E = s->slot_map.find(target); @@ -1529,7 +1524,7 @@ void Object::disconnect(const StringName &p_signal, Object *p_to_object, const S ERR_FAIL_COND(s->lock > 0); } - Signal::Target target(p_to_object->get_instance_ID(), p_to_method); + Signal::Target target(p_to_object->get_instance_id(), p_to_method); if (!s->slot_map.has(target)) { ERR_EXPLAIN("Disconnecting nonexistent signal '" + p_signal + "', slot: " + itos(target._id) + ":" + target.method); @@ -1656,17 +1651,17 @@ void Object::_bind_methods() { ClassDB::bind_method(D_METHOD("get_class"), &Object::get_class); ClassDB::bind_method(D_METHOD("is_class", "type"), &Object::is_class); ClassDB::bind_method(D_METHOD("set", "property", "value"), &Object::_set_bind); - ClassDB::bind_method(D_METHOD("get:Variant", "property"), &Object::_get_bind); + ClassDB::bind_method(D_METHOD("get", "property"), &Object::_get_bind); ClassDB::bind_method(D_METHOD("get_property_list"), &Object::_get_property_list_bind); ClassDB::bind_method(D_METHOD("get_method_list"), &Object::_get_method_list_bind); ClassDB::bind_method(D_METHOD("notification", "what", "reversed"), &Object::notification, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("get_instance_ID"), &Object::get_instance_ID); + ClassDB::bind_method(D_METHOD("get_instance_id"), &Object::get_instance_id); - ClassDB::bind_method(D_METHOD("set_script", "script:Script"), &Object::set_script); - ClassDB::bind_method(D_METHOD("get_script:Script"), &Object::get_script); + ClassDB::bind_method(D_METHOD("set_script", "script"), &Object::set_script); + ClassDB::bind_method(D_METHOD("get_script"), &Object::get_script); ClassDB::bind_method(D_METHOD("set_meta", "name", "value"), &Object::set_meta); - ClassDB::bind_method(D_METHOD("get_meta:Variant", "name", "value"), &Object::get_meta); + ClassDB::bind_method(D_METHOD("get_meta", "name"), &Object::get_meta); ClassDB::bind_method(D_METHOD("has_meta", "name"), &Object::has_meta); ClassDB::bind_method(D_METHOD("get_meta_list"), &Object::_get_meta_list_bind); @@ -1692,7 +1687,7 @@ void Object::_bind_methods() { mi.name = "call"; mi.arguments.push_back(PropertyInfo(Variant::STRING, "method")); - ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "call:Variant", &Object::_call_bind, mi); + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "call", &Object::_call_bind, mi); } { @@ -1703,7 +1698,7 @@ void Object::_bind_methods() { ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "call_deferred", &Object::_call_deferred_bind, mi); } - ClassDB::bind_method(D_METHOD("callv:Variant", "method", "arg_array"), &Object::callv); + ClassDB::bind_method(D_METHOD("callv", "method", "arg_array"), &Object::callv); ClassDB::bind_method(D_METHOD("has_method", "method"), &Object::has_method); @@ -1711,9 +1706,9 @@ void Object::_bind_methods() { ClassDB::bind_method(D_METHOD("get_signal_connection_list", "signal"), &Object::_get_signal_connection_list); ClassDB::bind_method(D_METHOD("get_incoming_connections"), &Object::_get_incoming_connections); - ClassDB::bind_method(D_METHOD("connect", "signal", "target:Object", "method", "binds", "flags"), &Object::connect, DEFVAL(Array()), DEFVAL(0)); - ClassDB::bind_method(D_METHOD("disconnect", "signal", "target:Object", "method"), &Object::disconnect); - ClassDB::bind_method(D_METHOD("is_connected", "signal", "target:Object", "method"), &Object::is_connected); + ClassDB::bind_method(D_METHOD("connect", "signal", "target", "method", "binds", "flags"), &Object::connect, DEFVAL(Array()), DEFVAL(0)); + ClassDB::bind_method(D_METHOD("disconnect", "signal", "target", "method"), &Object::disconnect); + ClassDB::bind_method(D_METHOD("is_connected", "signal", "target", "method"), &Object::is_connected); ClassDB::bind_method(D_METHOD("set_block_signals", "enable"), &Object::set_block_signals); ClassDB::bind_method(D_METHOD("is_blocking_signals"), &Object::is_blocking_signals); @@ -1731,7 +1726,7 @@ void Object::_bind_methods() { ADD_SIGNAL(MethodInfo("script_changed")); BIND_VMETHOD(MethodInfo("_notification", PropertyInfo(Variant::INT, "what"))); - BIND_VMETHOD(MethodInfo("_set", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value"))); + BIND_VMETHOD(MethodInfo("_set:bool", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value"))); #ifdef TOOLS_ENABLED MethodInfo miget("_get", PropertyInfo(Variant::STRING, "property")); miget.return_val.name = "Variant"; @@ -1929,7 +1924,7 @@ ObjectID ObjectDB::instance_counter = 1; HashMap<Object *, ObjectID, ObjectDB::ObjectPtrHash> ObjectDB::instance_checks; ObjectID ObjectDB::add_instance(Object *p_object) { - ERR_FAIL_COND_V(p_object->get_instance_ID() != 0, 0); + ERR_FAIL_COND_V(p_object->get_instance_id() != 0, 0); rw_lock->write_lock(); instances[++instance_counter] = p_object; @@ -1945,7 +1940,7 @@ void ObjectDB::remove_instance(Object *p_object) { rw_lock->write_lock(); - instances.erase(p_object->get_instance_ID()); + instances.erase(p_object->get_instance_id()); #ifdef DEBUG_ENABLED instance_checks.erase(p_object); #endif @@ -2008,7 +2003,7 @@ void ObjectDB::cleanup() { String node_name; if (instances[*K]->is_class("Node")) node_name = " - Node Name: " + String(instances[*K]->call("get_name")); - if (instances[*K]->is_class("Resoucre")) + if (instances[*K]->is_class("Resource")) node_name = " - Resource Name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path")); print_line("Leaked Instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name); } diff --git a/core/object.h b/core/object.h index 148a73fbc4..551c3c31b9 100644 --- a/core/object.h +++ b/core/object.h @@ -105,6 +105,7 @@ enum PropertyUsageFlags { PROPERTY_USAGE_STORE_IF_NULL = 16384, PROPERTY_USAGE_ANIMATE_AS_TRIGGER = 32768, PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 65536, + PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE = 1 << 17, PROPERTY_USAGE_DEFAULT = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK, PROPERTY_USAGE_DEFAULT_INTL = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK | PROPERTY_USAGE_INTERNATIONALIZED, @@ -138,17 +139,17 @@ struct PropertyInfo { static PropertyInfo from_dict(const Dictionary &p_dict); - PropertyInfo() { - type = Variant::NIL; - hint = PROPERTY_HINT_NONE; - usage = PROPERTY_USAGE_DEFAULT; + PropertyInfo() + : type(Variant::NIL), + hint(PROPERTY_HINT_NONE), + usage(PROPERTY_USAGE_DEFAULT) { } - PropertyInfo(Variant::Type p_type, const String p_name, PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = "", uint32_t p_usage = PROPERTY_USAGE_DEFAULT) { - type = p_type; - name = p_name; - hint = p_hint; - hint_string = p_hint_string; - usage = p_usage; + PropertyInfo(Variant::Type p_type, const String p_name, PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = "", uint32_t p_usage = PROPERTY_USAGE_DEFAULT) + : type(p_type), + name(p_name), + hint(p_hint), + hint_string(p_hint_string), + usage(p_usage) { } bool operator<(const PropertyInfo &p_info) const { return name < p_info.name; @@ -400,9 +401,9 @@ private: _FORCE_INLINE_ bool operator<(const Target &p_target) const { return (_id == p_target._id) ? (method < p_target.method) : (_id < p_target._id); } - Target(const ObjectID &p_id, const StringName &p_method) { - _id = p_id; - method = p_method; + Target(const ObjectID &p_id, const StringName &p_method) + : _id(p_id), + method(p_method) { } Target() { _id = 0; } }; @@ -533,7 +534,7 @@ public: bool _is_gpl_reversed() const { return false; } - _FORCE_INLINE_ ObjectID get_instance_ID() const { return _instance_ID; } + _FORCE_INLINE_ ObjectID get_instance_id() const { return _instance_ID; } // this is used for editors void add_change_receptor(Object *p_receptor); @@ -654,8 +655,8 @@ public: void set_script_and_instance(const RefPtr &p_script, ScriptInstance *p_instance); //some script languages can't control instance creation, so this function eases the process void add_user_signal(const MethodInfo &p_signal); - void emit_signal(const StringName &p_name, VARIANT_ARG_LIST); - void emit_signal(const StringName &p_name, const Variant **p_args, int p_argcount); + Error emit_signal(const StringName &p_name, VARIANT_ARG_LIST); + Error emit_signal(const StringName &p_name, const Variant **p_args, int p_argcount); void get_signal_list(List<MethodInfo> *p_signals) const; void get_signal_connection_list(const StringName &p_signal, List<Connection> *p_connections) const; void get_all_signal_connections(List<Connection> *p_connections) const; diff --git a/core/os/input.cpp b/core/os/input.cpp index a90a552d1d..c7b32b939a 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -83,8 +83,8 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("warp_mouse_pos", "to"), &Input::warp_mouse_pos); ClassDB::bind_method(D_METHOD("action_press", "action"), &Input::action_press); ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release); - ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image:Texture", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(Vector2())); - ClassDB::bind_method(D_METHOD("parse_input_event", "event:InputEvent"), &Input::parse_input_event); + ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(Vector2())); + ClassDB::bind_method(D_METHOD("parse_input_event", "event"), &Input::parse_input_event); BIND_CONSTANT(MOUSE_MODE_VISIBLE); BIND_CONSTANT(MOUSE_MODE_HIDDEN); diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 0a07b6b2b7..fe0e2c2524 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -134,12 +134,12 @@ void InputEvent::_bind_methods() { ClassDB::bind_method(D_METHOD("as_text"), &InputEvent::as_text); - ClassDB::bind_method(D_METHOD("action_match", "event:InputEvent"), &InputEvent::action_match); - ClassDB::bind_method(D_METHOD("shortcut_match", "event:InputEvent"), &InputEvent::shortcut_match); + ClassDB::bind_method(D_METHOD("action_match", "event"), &InputEvent::action_match); + ClassDB::bind_method(D_METHOD("shortcut_match", "event"), &InputEvent::shortcut_match); ClassDB::bind_method(D_METHOD("is_action_type"), &InputEvent::is_action_type); - ClassDB::bind_method(D_METHOD("xformed_by:InputEvent", "xform", "local_ofs"), &InputEvent::xformed_by, DEFVAL(Vector2())); + ClassDB::bind_method(D_METHOD("xformed_by", "xform", "local_ofs"), &InputEvent::xformed_by, DEFVAL(Vector2())); ADD_PROPERTY(PropertyInfo(Variant::INT, "device"), "set_device", "get_device"); } diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp index e154b1934d..9b3e376ea6 100644 --- a/core/os/keyboard.cpp +++ b/core/os/keyboard.cpp @@ -42,8 +42,8 @@ static const _KeyCodeText _keycodes[] = { {KEY_TAB ,"Tab"}, {KEY_BACKTAB ,"BackTab"}, {KEY_BACKSPACE ,"BackSpace"}, - {KEY_RETURN ,"Return"}, {KEY_ENTER ,"Enter"}, + {KEY_KP_ENTER ,"Kp Enter"}, {KEY_INSERT ,"Insert"}, {KEY_DELETE ,"Delete"}, {KEY_PAUSE ,"Pause"}, @@ -294,8 +294,8 @@ bool keycode_has_unicode(uint32_t p_keycode) { case KEY_TAB: case KEY_BACKTAB: case KEY_BACKSPACE: - case KEY_RETURN: case KEY_ENTER: + case KEY_KP_ENTER: case KEY_INSERT: case KEY_DELETE: case KEY_PAUSE: diff --git a/core/os/keyboard.h b/core/os/keyboard.h index c6985c887d..1ed93e3540 100644 --- a/core/os/keyboard.h +++ b/core/os/keyboard.h @@ -57,8 +57,8 @@ enum KeyList { KEY_TAB = SPKEY | 0x02, KEY_BACKTAB = SPKEY | 0x03, KEY_BACKSPACE = SPKEY | 0x04, - KEY_RETURN = SPKEY | 0x05, - KEY_ENTER = SPKEY | 0x06, + KEY_ENTER = SPKEY | 0x05, + KEY_KP_ENTER = SPKEY | 0x06, KEY_INSERT = SPKEY | 0x07, KEY_DELETE = SPKEY | 0x08, KEY_PAUSE = SPKEY | 0x09, diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index 93658c07c2..248f5537c6 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -32,7 +32,7 @@ void MainLoop::_bind_methods() { - ClassDB::bind_method(D_METHOD("input_event", "ev:InputEvent"), &MainLoop::input_event); + ClassDB::bind_method(D_METHOD("input_event", "ev"), &MainLoop::input_event); ClassDB::bind_method(D_METHOD("input_text", "text"), &MainLoop::input_text); ClassDB::bind_method(D_METHOD("init"), &MainLoop::init); ClassDB::bind_method(D_METHOD("iteration", "delta"), &MainLoop::iteration); diff --git a/core/os/os.cpp b/core/os/os.cpp index 8e4c357195..3a06a3fa8f 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -129,7 +129,7 @@ String OS::get_executable_path() const { return _execpath; } -int OS::get_process_ID() const { +int OS::get_process_id() const { return -1; }; @@ -175,7 +175,7 @@ static void _OS_printres(Object *p_obj) { if (!res) return; - String str = itos(res->get_instance_ID()) + String(res->get_class()) + ":" + String(res->get_name()) + " - " + res->get_path(); + String str = itos(res->get_instance_id()) + String(res->get_class()) + ":" + String(res->get_name()) + " - " + res->get_path(); if (_OSPRF) _OSPRF->store_line(str); else @@ -412,7 +412,7 @@ void OS::make_rendering_thread() { void OS::swap_buffers() { } -String OS::get_unique_ID() const { +String OS::get_unique_id() const { ERR_FAIL_V(""); } diff --git a/core/os/os.h b/core/os/os.h index 703c6a6bcd..8e2257a0e4 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -197,7 +197,7 @@ public: virtual String get_executable_path() const; virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL) = 0; virtual Error kill(const ProcessID &p_pid) = 0; - virtual int get_process_ID() const; + virtual int get_process_id() const; virtual Error shell_open(String p_uri); virtual Error set_cwd(const String &p_cwd); @@ -370,7 +370,7 @@ public: virtual int get_processor_count() const; - virtual String get_unique_ID() const; + virtual String get_unique_id() const; virtual Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track); virtual bool native_video_is_playing() const; diff --git a/core/os/thread.cpp b/core/os/thread.cpp index 98f1968629..bd565334c3 100644 --- a/core/os/thread.cpp +++ b/core/os/thread.cpp @@ -30,16 +30,16 @@ #include "thread.h" Thread *(*Thread::create_func)(ThreadCreateCallback, void *, const Settings &) = NULL; -Thread::ID (*Thread::get_thread_ID_func)() = NULL; +Thread::ID (*Thread::get_thread_id_func)() = NULL; void (*Thread::wait_to_finish_func)(Thread *) = NULL; Error (*Thread::set_name_func)(const String &) = NULL; Thread::ID Thread::_main_thread_id = 0; -Thread::ID Thread::get_caller_ID() { +Thread::ID Thread::get_caller_id() { - if (get_thread_ID_func) - return get_thread_ID_func(); + if (get_thread_id_func) + return get_thread_id_func(); return 0; } diff --git a/core/os/thread.h b/core/os/thread.h index 3ad5d4bf2c..1103f67ff2 100644 --- a/core/os/thread.h +++ b/core/os/thread.h @@ -58,7 +58,7 @@ public: protected: static Thread *(*create_func)(ThreadCreateCallback p_callback, void *, const Settings &); - static ID (*get_thread_ID_func)(); + static ID (*get_thread_id_func)(); static void (*wait_to_finish_func)(Thread *); static Error (*set_name_func)(const String &); @@ -69,11 +69,11 @@ protected: Thread(); public: - virtual ID get_ID() const = 0; + virtual ID get_id() const = 0; static Error set_name(const String &p_name); - _FORCE_INLINE_ static ID get_main_ID() { return _main_thread_id; } ///< get the ID of the main thread - static ID get_caller_ID(); ///< get the ID of the caller function ID + _FORCE_INLINE_ static ID get_main_id() { return _main_thread_id; } ///< get the ID of the main thread + static ID get_caller_id(); ///< get the ID of the caller function ID static void wait_to_finish(Thread *p_thread); ///< waits until thread is finished, and deallocates it. static Thread *create(ThreadCreateCallback p_callback, void *p_user, const Settings &p_settings = Settings()); ///< Static function to create a thread, will call p_callback diff --git a/core/os/thread_dummy.h b/core/os/thread_dummy.h index 4155103bbf..64941a71f8 100644 --- a/core/os/thread_dummy.h +++ b/core/os/thread_dummy.h @@ -39,7 +39,7 @@ class ThreadDummy : public Thread { static Thread *create(ThreadCreateCallback p_callback, void *p_user, const Settings &p_settings = Settings()); public: - virtual ID get_ID() const { return 0; }; + virtual ID get_id() const { return 0; }; static void make_default(); }; diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index 0565d0d3f5..eb4aeb758a 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -368,7 +368,7 @@ void PackedDataContainer::_bind_methods() { ClassDB::bind_method(D_METHOD("_iter_init"), &PackedDataContainer::_iter_init); ClassDB::bind_method(D_METHOD("_iter_get"), &PackedDataContainer::_iter_get); ClassDB::bind_method(D_METHOD("_iter_next"), &PackedDataContainer::_iter_next); - ClassDB::bind_method(D_METHOD("pack:Error", "value"), &PackedDataContainer::pack); + ClassDB::bind_method(D_METHOD("pack", "value"), &PackedDataContainer::pack); ClassDB::bind_method(D_METHOD("size"), &PackedDataContainer::size); ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "__data__"), "_set_data", "_get_data"); diff --git a/core/pair.h b/core/pair.h index 761caf7791..d4b1897537 100644 --- a/core/pair.h +++ b/core/pair.h @@ -37,9 +37,9 @@ struct Pair { S second; Pair() {} - Pair(F p_first, S p_second) { - first = p_first; - second = p_second; + Pair(F p_first, S p_second) + : first(p_first), + second(p_second) { } }; diff --git a/core/project_settings.cpp b/core/project_settings.cpp index b31f78ec20..4a1b35ea4a 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -900,7 +900,7 @@ void ProjectSettings::_bind_methods() { ClassDB::bind_method(D_METHOD("get_singleton", "name"), &ProjectSettings::get_singleton_object); ClassDB::bind_method(D_METHOD("load_resource_pack", "pack"), &ProjectSettings::_load_resource_pack); ClassDB::bind_method(D_METHOD("property_can_revert", "name"), &ProjectSettings::property_can_revert); - ClassDB::bind_method(D_METHOD("property_get_revert:Variant", "name"), &ProjectSettings::property_get_revert); + ClassDB::bind_method(D_METHOD("property_get_revert", "name"), &ProjectSettings::property_get_revert); ClassDB::bind_method(D_METHOD("save_custom", "file"), &ProjectSettings::_save_custom_bnd); } @@ -925,10 +925,10 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF("application/config/use_shared_user_dir", true); key.instance(); - key->set_scancode(KEY_RETURN); + key->set_scancode(KEY_ENTER); va.push_back(key); key.instance(); - key->set_scancode(KEY_ENTER); + key->set_scancode(KEY_KP_ENTER); va.push_back(key); key.instance(); key->set_scancode(KEY_SPACE); diff --git a/core/project_settings.h b/core/project_settings.h index c58ac3ca49..c64bb393d1 100644 --- a/core/project_settings.h +++ b/core/project_settings.h @@ -48,9 +48,9 @@ public: struct Singleton { StringName name; Object *ptr; - Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL) { - name = p_name; - ptr = p_ptr; + Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL) + : name(p_name), + ptr(p_ptr) { } }; enum { @@ -66,18 +66,18 @@ protected: Variant initial; bool hide_from_editor; bool overrided; - VariantContainer() { - order = 0; - hide_from_editor = false; - persist = false; - overrided = false; + VariantContainer() + : order(0), + persist(false), + hide_from_editor(false), + overrided(false) { } - VariantContainer(const Variant &p_variant, int p_order, bool p_persist = false) { - variant = p_variant; - order = p_order; - hide_from_editor = false; - persist = p_persist; - overrided = false; + VariantContainer(const Variant &p_variant, int p_order, bool p_persist = false) + : order(p_order), + persist(p_persist), + variant(p_variant), + hide_from_editor(false), + overrided(false) { } }; diff --git a/core/reference.cpp b/core/reference.cpp index 060608eacb..e9629ee7c0 100644 --- a/core/reference.cpp +++ b/core/reference.cpp @@ -108,12 +108,12 @@ Variant WeakRef::get_ref() const { } void WeakRef::set_obj(Object *p_object) { - ref = p_object ? p_object->get_instance_ID() : 0; + ref = p_object ? p_object->get_instance_id() : 0; } void WeakRef::set_ref(const REF &p_ref) { - ref = p_ref.is_valid() ? p_ref->get_instance_ID() : 0; + ref = p_ref.is_valid() ? p_ref->get_instance_id() : 0; } WeakRef::WeakRef() { @@ -122,7 +122,7 @@ WeakRef::WeakRef() { void WeakRef::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_ref:Object"), &WeakRef::get_ref); + ClassDB::bind_method(D_METHOD("get_ref"), &WeakRef::get_ref); } #if 0 diff --git a/core/reference.h b/core/reference.h index 90f2791f4b..7f48f8323e 100644 --- a/core/reference.h +++ b/core/reference.h @@ -374,5 +374,23 @@ struct PtrToArg<const RefPtr &> { } }; +template <class T> +struct GetTypeInfo<Ref<T> > { + enum { VARIANT_TYPE = Variant::OBJECT }; + + static inline StringName get_class_name() { + return T::get_class_static(); + } +}; + +template <class T> +struct GetTypeInfo<const Ref<T> &> { + enum { VARIANT_TYPE = Variant::OBJECT }; + + static inline StringName get_class_name() { + return T::get_class_static(); + } +}; + #endif #endif // REFERENCE_H diff --git a/core/resource.cpp b/core/resource.cpp index 5625784396..a0b0fd24e1 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -32,6 +32,7 @@ #include "core_string_names.h" #include "io/resource_loader.h" #include "os/file_access.h" +#include "scene/main/node.h" //only so casting works #include "script_language.h" #include <stdio.h> @@ -227,12 +228,12 @@ RID Resource::get_rid() const { void Resource::register_owner(Object *p_owner) { - owners.insert(p_owner->get_instance_ID()); + owners.insert(p_owner->get_instance_id()); } void Resource::unregister_owner(Object *p_owner) { - owners.erase(p_owner->get_instance_ID()); + owners.erase(p_owner->get_instance_id()); } void Resource::notify_change_to_owners() { @@ -336,10 +337,10 @@ void Resource::_bind_methods() { ClassDB::bind_method(D_METHOD("get_rid"), &Resource::get_rid); ClassDB::bind_method(D_METHOD("set_local_to_scene", "enable"), &Resource::set_local_to_scene); ClassDB::bind_method(D_METHOD("is_local_to_scene"), &Resource::is_local_to_scene); - ClassDB::bind_method(D_METHOD("get_local_scene:Node"), &Resource::get_local_scene); + ClassDB::bind_method(D_METHOD("get_local_scene"), &Resource::get_local_scene); ClassDB::bind_method(D_METHOD("setup_local_to_scene"), &Resource::setup_local_to_scene); - ClassDB::bind_method(D_METHOD("duplicate:Resource", "subresources"), &Resource::duplicate, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("duplicate", "subresources"), &Resource::duplicate, DEFVAL(false)); ADD_SIGNAL(MethodInfo("changed")); ADD_GROUP("Resource", "resource_"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "resource_local_to_scene"), "set_local_to_scene", "is_local_to_scene"); diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index d19fe213f6..3628f2ecaf 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -95,7 +95,7 @@ static Object *_ScriptDebuggerRemote_find = NULL; static void _ScriptDebuggerRemote_debug_func(Object *p_obj) { if (_ScriptDebuggerRemote_find == p_obj) { - _ScriptDebuggerRemote_found_id = p_obj->get_instance_ID(); + _ScriptDebuggerRemote_found_id = p_obj->get_instance_id(); } } @@ -109,7 +109,7 @@ static ObjectID safe_get_instance_id(const Variant &p_v) { REF r = p_v; if (r.is_valid()) { - return r->get_instance_ID(); + return r->get_instance_id(); } else { _ScriptDebuggerRemote_found_id = 0; @@ -572,7 +572,7 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) { ObjectID id2; Object *obj = var; if (obj) { - id2 = obj->get_instance_ID(); + id2 = obj->get_instance_id(); } else { id2 = 0; } @@ -940,28 +940,32 @@ void ScriptDebuggerRemote::profiling_set_frame_times(float p_frame_time, float p ScriptDebuggerRemote::ResourceUsageFunc ScriptDebuggerRemote::resource_usage_func = NULL; -ScriptDebuggerRemote::ScriptDebuggerRemote() { +ScriptDebuggerRemote::ScriptDebuggerRemote() + : profiling(false), + max_frame_functions(16), + skip_profile_frame(false), + reload_all_scripts(false), + tcp_client(StreamPeerTCP::create_ref()), + packet_peer_stream(Ref<PacketPeerStream>(memnew(PacketPeerStream))), + last_perf_time(0), + performance(ProjectSettings::get_singleton()->get_singleton_object("Performance")), + requested_quit(false), + mutex(Mutex::create()), + max_cps(GLOBAL_GET("network/limits/debugger_stdout/max_chars_per_second")), + char_count(0), + last_msec(0), + msec_count(0), + locking(false), + poll_every(0), + request_scene_tree(NULL), + live_edit_funcs(NULL) { - tcp_client = StreamPeerTCP::create_ref(); - packet_peer_stream = Ref<PacketPeerStream>(memnew(PacketPeerStream)); packet_peer_stream->set_stream_peer(tcp_client); - mutex = Mutex::create(); - locking = false; + packet_peer_stream->set_output_buffer_max_size(1024 * 1024 * 8); //8mb should be way more than enough phl.printfunc = _print_handler; phl.userdata = this; add_print_handler(&phl); - requested_quit = false; - performance = ProjectSettings::get_singleton()->get_singleton_object("Performance"); - last_perf_time = 0; - poll_every = 0; - request_scene_tree = NULL; - live_edit_funcs = NULL; - max_cps = GLOBAL_GET("network/limits/debugger_stdout/max_chars_per_second"); - char_count = 0; - msec_count = 0; - last_msec = 0; - skip_profile_frame = false; eh.errfunc = _err_handler; eh.userdata = this; @@ -969,9 +973,6 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() { profile_info.resize(CLAMP(int(ProjectSettings::get_singleton()->get("debug/settings/profiler/max_functions")), 128, 65535)); profile_info_ptrs.resize(profile_info.size()); - profiling = false; - max_frame_functions = 16; - reload_all_scripts = false; } ScriptDebuggerRemote::~ScriptDebuggerRemote() { diff --git a/core/script_language.cpp b/core/script_language.cpp index aeb1573840..4664049145 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -280,8 +280,23 @@ ScriptDebugger::ScriptDebugger() { bool PlaceHolderScriptInstance::set(const StringName &p_name, const Variant &p_value) { if (values.has(p_name)) { + Variant defval; + if (script->get_property_default_value(p_name, defval)) { + if (defval == p_value) { + values.erase(p_name); + return true; + } + } values[p_name] = p_value; return true; + } else { + Variant defval; + if (script->get_property_default_value(p_name, defval)) { + if (defval != p_value) { + values[p_name] = p_value; + } + return true; + } } return false; } @@ -291,12 +306,22 @@ bool PlaceHolderScriptInstance::get(const StringName &p_name, Variant &r_ret) co r_ret = values[p_name]; return true; } + + Variant defval; + if (script->get_property_default_value(p_name, defval)) { + r_ret = defval; + return true; + } return false; } void PlaceHolderScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const { for (const List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) { + PropertyInfo pinfo = E->get(); + if (!values.has(pinfo.name)) { + pinfo.usage |= PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE; + } p_properties->push_back(E->get()); } } @@ -336,6 +361,14 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c if (!new_values.has(E->key())) to_remove.push_back(E->key()); + + Variant defval; + if (script->get_property_default_value(E->key(), defval)) { + //remove because it's the same as the default value + if (defval == E->get()) { + to_remove.push_back(E->key()); + } + } } while (to_remove.size()) { @@ -351,11 +384,10 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c //change notify } -PlaceHolderScriptInstance::PlaceHolderScriptInstance(ScriptLanguage *p_language, Ref<Script> p_script, Object *p_owner) { - - language = p_language; - script = p_script; - owner = p_owner; +PlaceHolderScriptInstance::PlaceHolderScriptInstance(ScriptLanguage *p_language, Ref<Script> p_script, Object *p_owner) + : owner(p_owner), + language(p_language), + script(p_script) { } PlaceHolderScriptInstance::~PlaceHolderScriptInstance() { diff --git a/core/translation.cpp b/core/translation.cpp index 50694e4a2d..c38d5d8b4d 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -923,9 +923,8 @@ void Translation::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING, "locale"), "set_locale", "get_locale"); } -Translation::Translation() { - - locale = "en"; +Translation::Translation() + : locale("en") { } /////////////////////////////////////////////// @@ -1125,8 +1124,8 @@ void TranslationServer::_bind_methods() { ClassDB::bind_method(D_METHOD("translate", "message"), &TranslationServer::translate); - ClassDB::bind_method(D_METHOD("add_translation", "translation:Translation"), &TranslationServer::add_translation); - ClassDB::bind_method(D_METHOD("remove_translation", "translation:Translation"), &TranslationServer::remove_translation); + ClassDB::bind_method(D_METHOD("add_translation", "translation"), &TranslationServer::add_translation); + ClassDB::bind_method(D_METHOD("remove_translation", "translation"), &TranslationServer::remove_translation); ClassDB::bind_method(D_METHOD("clear"), &TranslationServer::clear); } @@ -1144,9 +1143,8 @@ void TranslationServer::load_translations() { } } -TranslationServer::TranslationServer() { - +TranslationServer::TranslationServer() + : locale("en"), + enabled(true) { singleton = this; - locale = "en"; - enabled = true; } diff --git a/core/type_info.h b/core/type_info.h new file mode 100644 index 0000000000..10912fd074 --- /dev/null +++ b/core/type_info.h @@ -0,0 +1,203 @@ +#ifndef GET_TYPE_INFO_H +#define GET_TYPE_INFO_H + +template <bool C, typename T = void> +struct EnableIf { + + typedef T type; +}; + +template <typename T> +struct EnableIf<false, T> { +}; + +template <typename, typename> +struct TypesAreSame { + + static bool const value = false; +}; + +template <typename A> +struct TypesAreSame<A, A> { + + static bool const value = true; +}; + +template <typename B, typename D> +struct TypeInherits { + + static D *get_d(); + + static char (&test(B *))[1]; + static char (&test(...))[2]; + + static bool const value = sizeof(test(get_d())) == sizeof(char) && + !TypesAreSame<B volatile const, void volatile const>::value; +}; + +template <class T, typename = void> +struct GetTypeInfo { + enum { VARIANT_TYPE = Variant::NIL }; + + static inline StringName get_class_name() { + ERR_PRINT("Fallback type info. Bug!"); + return ""; // Not "Nil", this is an error + } +}; + +#define MAKE_TYPE_INFO(m_type, m_var_type) \ + template <> \ + struct GetTypeInfo<m_type> { \ + enum { VARIANT_TYPE = m_var_type }; \ + static inline StringName get_class_name() { \ + return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \ + } \ + }; \ + template <> \ + struct GetTypeInfo<const m_type &> { \ + enum { VARIANT_TYPE = m_var_type }; \ + static inline StringName get_class_name() { \ + return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \ + } \ + }; + +MAKE_TYPE_INFO(bool, Variant::BOOL) +MAKE_TYPE_INFO(uint8_t, Variant::INT) +MAKE_TYPE_INFO(int8_t, Variant::INT) +MAKE_TYPE_INFO(uint16_t, Variant::INT) +MAKE_TYPE_INFO(int16_t, Variant::INT) +MAKE_TYPE_INFO(uint32_t, Variant::INT) +MAKE_TYPE_INFO(int32_t, Variant::INT) +MAKE_TYPE_INFO(int64_t, Variant::INT) +MAKE_TYPE_INFO(uint64_t, Variant::INT) +MAKE_TYPE_INFO(float, Variant::REAL) +MAKE_TYPE_INFO(double, Variant::REAL) + +MAKE_TYPE_INFO(String, Variant::STRING) +MAKE_TYPE_INFO(Vector2, Variant::VECTOR2) +MAKE_TYPE_INFO(Rect2, Variant::RECT2) +MAKE_TYPE_INFO(Vector3, Variant::VECTOR3) +MAKE_TYPE_INFO(Transform2D, Variant::TRANSFORM2D) +MAKE_TYPE_INFO(Plane, Variant::PLANE) +MAKE_TYPE_INFO(Quat, Variant::QUAT) +MAKE_TYPE_INFO(Rect3, Variant::RECT3) +MAKE_TYPE_INFO(Basis, Variant::BASIS) +MAKE_TYPE_INFO(Transform, Variant::TRANSFORM) +MAKE_TYPE_INFO(Color, Variant::COLOR) +MAKE_TYPE_INFO(NodePath, Variant::NODE_PATH) +MAKE_TYPE_INFO(RID, Variant::_RID) +MAKE_TYPE_INFO(Dictionary, Variant::DICTIONARY) +MAKE_TYPE_INFO(Array, Variant::ARRAY) +MAKE_TYPE_INFO(PoolByteArray, Variant::POOL_BYTE_ARRAY) +MAKE_TYPE_INFO(PoolIntArray, Variant::POOL_INT_ARRAY) +MAKE_TYPE_INFO(PoolRealArray, Variant::POOL_REAL_ARRAY) +MAKE_TYPE_INFO(PoolStringArray, Variant::POOL_STRING_ARRAY) +MAKE_TYPE_INFO(PoolVector2Array, Variant::POOL_VECTOR2_ARRAY) +MAKE_TYPE_INFO(PoolVector3Array, Variant::POOL_VECTOR3_ARRAY) +MAKE_TYPE_INFO(PoolColorArray, Variant::POOL_COLOR_ARRAY) + +MAKE_TYPE_INFO(StringName, Variant::STRING) +MAKE_TYPE_INFO(IP_Address, Variant::STRING) + +class BSP_Tree; +MAKE_TYPE_INFO(BSP_Tree, Variant::DICTIONARY) + +#define MAKE_TYPE_INFO_WITH_NAME(m_type, m_var_type, m_class_name) \ + template <> \ + struct GetTypeInfo<m_type> { \ + enum { VARIANT_TYPE = m_var_type }; \ + static inline StringName get_class_name() { \ + return m_class_name; \ + } \ + }; \ + template <> \ + struct GetTypeInfo<const m_type &> { \ + enum { VARIANT_TYPE = m_var_type }; \ + static inline StringName get_class_name() { \ + return m_class_name; \ + } \ + }; + +MAKE_TYPE_INFO_WITH_NAME(RefPtr, Variant::OBJECT, "Reference") +MAKE_TYPE_INFO_WITH_NAME(Variant, Variant::NIL, "Variant") + +#define MAKE_TEMPLATE_TYPE_INFO(m_template, m_type, m_var_type) \ + template <> \ + struct GetTypeInfo<m_template<m_type> > { \ + enum { VARIANT_TYPE = m_var_type }; \ + static inline StringName get_class_name() { \ + return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \ + } \ + }; \ + template <> \ + struct GetTypeInfo<const m_template<m_type> &> { \ + enum { VARIANT_TYPE = m_var_type }; \ + static inline StringName get_class_name() { \ + return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \ + } \ + }; + +MAKE_TEMPLATE_TYPE_INFO(Vector, uint8_t, Variant::POOL_BYTE_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, int, Variant::POOL_INT_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, float, Variant::POOL_REAL_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, String, Variant::POOL_STRING_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, Vector2, Variant::POOL_VECTOR2_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, Vector3, Variant::POOL_VECTOR3_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, Color, Variant::POOL_COLOR_ARRAY) + +MAKE_TEMPLATE_TYPE_INFO(Vector, Variant, Variant::ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, RID, Variant::ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, Plane, Variant::ARRAY) + +MAKE_TEMPLATE_TYPE_INFO(PoolVector, Plane, Variant::ARRAY) +MAKE_TEMPLATE_TYPE_INFO(PoolVector, Face3, Variant::POOL_VECTOR3_ARRAY) + +#define MAKE_ENUM_TYPE_INFO(m_enum) \ + template <> \ + struct GetTypeInfo<m_enum> { \ + enum { VARIANT_TYPE = Variant::INT }; \ + static inline StringName get_class_name() { \ + return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \ + } \ + }; \ + template <> \ + struct GetTypeInfo<m_enum const> { \ + enum { VARIANT_TYPE = Variant::INT }; \ + static inline StringName get_class_name() { \ + return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \ + } \ + }; \ + template <> \ + struct GetTypeInfo<m_enum &> { \ + enum { VARIANT_TYPE = Variant::INT }; \ + static inline StringName get_class_name() { \ + return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \ + } \ + }; \ + template <> \ + struct GetTypeInfo<const m_enum &> { \ + enum { VARIANT_TYPE = Variant::INT }; \ + static inline StringName get_class_name() { \ + return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \ + } \ + }; + +template <typename T> +struct GetTypeInfo<T *, typename EnableIf<TypeInherits<Object, T>::value>::type> { + enum { VARIANT_TYPE = Variant::OBJECT }; + + static inline StringName get_class_name() { + return T::get_class_static(); + } +}; + +template <typename T> +struct GetTypeInfo<const T *, typename EnableIf<TypeInherits<Object, T>::value>::type> { + enum { VARIANT_TYPE = Variant::OBJECT }; + + static inline StringName get_class_name() { + return T::get_class_static(); + } +}; + +#endif // GET_TYPE_INFO_H diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index b3ac9d274e..19b9f161b7 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -110,7 +110,7 @@ void UndoRedo::add_do_method(Object *p_object, const String &p_method, VARIANT_A ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND((current_action + 1) >= actions.size()); Operation do_op; - do_op.object = p_object->get_instance_ID(); + do_op.object = p_object->get_instance_id(); if (p_object->cast_to<Resource>()) do_op.resref = Ref<Resource>(p_object->cast_to<Resource>()); @@ -134,7 +134,7 @@ void UndoRedo::add_undo_method(Object *p_object, const String &p_method, VARIANT return; Operation undo_op; - undo_op.object = p_object->get_instance_ID(); + undo_op.object = p_object->get_instance_id(); if (p_object->cast_to<Resource>()) undo_op.resref = Ref<Resource>(p_object->cast_to<Resource>()); @@ -151,7 +151,7 @@ void UndoRedo::add_do_property(Object *p_object, const String &p_property, const ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND((current_action + 1) >= actions.size()); Operation do_op; - do_op.object = p_object->get_instance_ID(); + do_op.object = p_object->get_instance_id(); if (p_object->cast_to<Resource>()) do_op.resref = Ref<Resource>(p_object->cast_to<Resource>()); @@ -170,7 +170,7 @@ void UndoRedo::add_undo_property(Object *p_object, const String &p_property, con return; Operation undo_op; - undo_op.object = p_object->get_instance_ID(); + undo_op.object = p_object->get_instance_id(); if (p_object->cast_to<Resource>()) undo_op.resref = Ref<Resource>(p_object->cast_to<Resource>()); @@ -184,7 +184,7 @@ void UndoRedo::add_do_reference(Object *p_object) { ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND((current_action + 1) >= actions.size()); Operation do_op; - do_op.object = p_object->get_instance_ID(); + do_op.object = p_object->get_instance_id(); if (p_object->cast_to<Resource>()) do_op.resref = Ref<Resource>(p_object->cast_to<Resource>()); @@ -201,7 +201,7 @@ void UndoRedo::add_undo_reference(Object *p_object) { return; Operation undo_op; - undo_op.object = p_object->get_instance_ID(); + undo_op.object = p_object->get_instance_id(); if (p_object->cast_to<Resource>()) undo_op.resref = Ref<Resource>(p_object->cast_to<Resource>()); @@ -496,8 +496,8 @@ void UndoRedo::_bind_methods() { ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "add_undo_method", &UndoRedo::_add_undo_method, mi); } - ClassDB::bind_method(D_METHOD("add_do_property", "object", "property", "value:Variant"), &UndoRedo::add_do_property); - ClassDB::bind_method(D_METHOD("add_undo_property", "object", "property", "value:Variant"), &UndoRedo::add_undo_property); + ClassDB::bind_method(D_METHOD("add_do_property", "object", "property", "value"), &UndoRedo::add_do_property); + ClassDB::bind_method(D_METHOD("add_undo_property", "object", "property", "value"), &UndoRedo::add_undo_property); ClassDB::bind_method(D_METHOD("add_do_reference", "object"), &UndoRedo::add_do_reference); ClassDB::bind_method(D_METHOD("add_undo_reference", "object"), &UndoRedo::add_undo_reference); ClassDB::bind_method(D_METHOD("clear_history"), &UndoRedo::clear_history); diff --git a/core/variant.cpp b/core/variant.cpp index 0807a33788..51c4b70bdc 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -1600,7 +1600,7 @@ Variant::operator String() const { }; }; #endif - return "[" + _get_obj().obj->get_class() + ":" + itos(_get_obj().obj->get_instance_ID()) + "]"; + return "[" + _get_obj().obj->get_class() + ":" + itos(_get_obj().obj->get_instance_id()) + "]"; } else return "[Object:null]"; diff --git a/core/variant.h b/core/variant.h index 661d31cf16..40de1a9bce 100644 --- a/core/variant.h +++ b/core/variant.h @@ -42,14 +42,13 @@ #include "io/ip_address.h" #include "math_2d.h" #include "matrix3.h" +#include "node_path.h" #include "os/power.h" -#include "path_db.h" #include "plane.h" #include "quat.h" #include "rect3.h" #include "ref_ptr.h" #include "rid.h" -#include "simple_type.h" #include "transform.h" #include "ustring.h" #include "vector3.h" @@ -154,15 +153,6 @@ public: static bool can_convert(Type p_type_from, Type p_type_to); static bool can_convert_strict(Type p_type_from, Type p_type_to); - template <class T> - static Type get_type_for() { - - GetSimpleType<T> t; - Variant v(t.type); - Type r = v.get_type(); - return r; - } - bool is_ref() const; _FORCE_INLINE_ bool is_num() const { return type == INT || type == REAL; }; _FORCE_INLINE_ bool is_array() const { return type >= ARRAY; }; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 4a806aec6c..aabc2546bc 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -130,9 +130,9 @@ struct _VariantCall { StringName name; Variant::Type type; Arg() { type = Variant::NIL; } - Arg(Variant::Type p_type, const StringName &p_name) { - name = p_name; - type = p_type; + Arg(Variant::Type p_type, const StringName &p_name) + : name(p_name), + type(p_type) { } }; diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 268bfeca1a..7dd22d7cb0 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -846,10 +846,10 @@ <constant name="KEY_BACKSPACE" value="16777220"> Backspace Key </constant> - <constant name="KEY_RETURN" value="16777221"> + <constant name="KEY_ENTER" value="16777221"> Return Key (On Main Keyboard) </constant> - <constant name="KEY_ENTER" value="16777222"> + <constant name="KEY_KP_ENTER" value="16777222"> Enter Key (On Numpad) </constant> <constant name="KEY_INSERT" value="16777223"> @@ -27432,7 +27432,7 @@ <description> </description> </method> - <method name="get_process_ID" qualifiers="const"> + <method name="get_process_id" qualifiers="const"> <return type="int"> </return> <description> @@ -27558,7 +27558,7 @@ <description> </description> </method> - <method name="get_unique_ID" qualifiers="const"> + <method name="get_unique_id" qualifiers="const"> <return type="String"> </return> <description> @@ -28150,7 +28150,7 @@ - "method_name" is a name of method to which signal is connected. </description> </method> - <method name="get_instance_ID" qualifiers="const"> + <method name="get_instance_id" qualifiers="const"> <return type="int"> </return> <description> @@ -28498,7 +28498,7 @@ Clear all the items in the [OptionButton]. </description> </method> - <method name="get_item_ID" qualifiers="const"> + <method name="get_item_id" qualifiers="const"> <return type="int"> </return> <argument index="0" name="idx" type="int"> @@ -28547,7 +28547,7 @@ Return the current item index </description> </method> - <method name="get_selected_ID" qualifiers="const"> + <method name="get_selected_id" qualifiers="const"> <return type="int"> </return> <description> @@ -28580,7 +28580,7 @@ Select an item by index and make it the current item. </description> </method> - <method name="set_item_ID"> + <method name="set_item_id"> <argument index="0" name="idx" type="int"> </argument> <argument index="1" name="id" type="int"> @@ -30915,7 +30915,7 @@ Add a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. </description> </method> - <method name="area_attach_object_instance_ID"> + <method name="area_attach_object_instance_id"> <argument index="0" name="area" type="RID"> </argument> <argument index="1" name="id" type="int"> @@ -30938,7 +30938,7 @@ Create an [Area2D]. </description> </method> - <method name="area_get_object_instance_ID" qualifiers="const"> + <method name="area_get_object_instance_id" qualifiers="const"> <return type="int"> </return> <argument index="0" name="area" type="RID"> @@ -31169,7 +31169,7 @@ Add a positioned impulse to the applied force and torque. Both the force and the offset from the body origin are in global coordinates. </description> </method> - <method name="body_attach_object_instance_ID"> + <method name="body_attach_object_instance_id"> <argument index="0" name="body" type="RID"> </argument> <argument index="1" name="id" type="int"> @@ -31241,7 +31241,7 @@ Return the body mode. </description> </method> - <method name="body_get_object_instance_ID" qualifiers="const"> + <method name="body_get_object_instance_id" qualifiers="const"> <return type="int"> </return> <argument index="0" name="body" type="RID"> @@ -32659,7 +32659,7 @@ <description> </description> </method> - <method name="area_attach_object_instance_ID"> + <method name="area_attach_object_instance_id"> <argument index="0" name="area" type="RID"> </argument> <argument index="1" name="id" type="int"> @@ -32679,7 +32679,7 @@ <description> </description> </method> - <method name="area_get_object_instance_ID" qualifiers="const"> + <method name="area_get_object_instance_id" qualifiers="const"> <return type="int"> </return> <argument index="0" name="area" type="RID"> @@ -32887,7 +32887,7 @@ <description> </description> </method> - <method name="body_attach_object_instance_ID"> + <method name="body_attach_object_instance_id"> <argument index="0" name="body" type="RID"> </argument> <argument index="1" name="id" type="int"> @@ -32951,7 +32951,7 @@ <description> </description> </method> - <method name="body_get_object_instance_ID" qualifiers="const"> + <method name="body_get_object_instance_id" qualifiers="const"> <return type="int"> </return> <argument index="0" name="body" type="RID"> @@ -33401,7 +33401,7 @@ <description> </description> </method> - <method name="pin_joint_get_local_A" qualifiers="const"> + <method name="pin_joint_get_local_a" qualifiers="const"> <return type="Vector3"> </return> <argument index="0" name="joint" type="RID"> @@ -33409,7 +33409,7 @@ <description> </description> </method> - <method name="pin_joint_get_local_B" qualifiers="const"> + <method name="pin_joint_get_local_b" qualifiers="const"> <return type="Vector3"> </return> <argument index="0" name="joint" type="RID"> @@ -33427,7 +33427,7 @@ <description> </description> </method> - <method name="pin_joint_set_local_A"> + <method name="pin_joint_set_local_a"> <argument index="0" name="joint" type="RID"> </argument> <argument index="1" name="local_A" type="Vector3"> @@ -33435,7 +33435,7 @@ <description> </description> </method> - <method name="pin_joint_set_local_B"> + <method name="pin_joint_set_local_b"> <argument index="0" name="joint" type="RID"> </argument> <argument index="1" name="local_B" type="Vector3"> @@ -35378,7 +35378,7 @@ Clear the popup menu, in effect removing all items. </description> </method> - <method name="get_item_ID" qualifiers="const"> + <method name="get_item_id" qualifiers="const"> <return type="int"> </return> <argument index="0" name="idx" type="int"> @@ -35535,7 +35535,7 @@ Sets whether or not the PopupMenu will hide on item selection. </description> </method> - <method name="set_item_ID"> + <method name="set_item_id"> <argument index="0" name="idx" type="int"> </argument> <argument index="1" name="id" type="int"> diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 56d9f2cc47..e6ffa39197 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -941,6 +941,8 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material, void RasterizerCanvasGLES3::_copy_texscreen(const Rect2 &p_rect) { + glDisable(GL_BLEND); + state.canvas_texscreen_used = true; //blur diffuse into effect mipmaps using separatable convolution //storage->shaders.copy.set_conditional(CopyShaderGLES3::GAUSSIAN_HORIZONTAL,true); @@ -1003,12 +1005,16 @@ void RasterizerCanvasGLES3::_copy_texscreen(const Rect2 &p_rect) { glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo); //back to front glViewport(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height); + state.canvas_shader.bind(); //back to canvas + _bind_canvas_texture(state.current_tex, state.current_normal); if (state.using_texture_rect) { state.using_texture_rect = false; _set_texture_rect_mode(state.using_texture_rect, state.using_ninepatch); } + + glEnable(GL_BLEND); } void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light) { @@ -1595,6 +1601,67 @@ void RasterizerCanvasGLES3::draw_generic_textured_rect(const Rect2 &p_rect, cons glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } +void RasterizerCanvasGLES3::draw_window_margins(int *black_margin, RID *black_image) { + + Vector2 window_size = OS::get_singleton()->get_window_size(); + int window_h = window_size.height; + int window_w = window_size.width; + + glBindFramebuffer(GL_FRAMEBUFFER, storage->system_fbo); + glViewport(0, 0, window_size.width, window_size.height); + canvas_begin(); + + if (black_image[MARGIN_LEFT].is_valid()) { + _bind_canvas_texture(black_image[MARGIN_LEFT], RID()); + Size2 sz(storage->texture_get_width(black_image[MARGIN_LEFT]), storage->texture_get_height(black_image[MARGIN_LEFT])); + draw_generic_textured_rect(Rect2(0, 0, black_margin[MARGIN_LEFT], window_h), Rect2(0, 0, sz.x, sz.y)); + } else if (black_margin[MARGIN_LEFT]) { + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, storage->resources.black_tex); + + draw_generic_textured_rect(Rect2(0, 0, black_margin[MARGIN_LEFT], window_h), Rect2(0, 0, 1, 1)); + } + + if (black_image[MARGIN_RIGHT].is_valid()) { + _bind_canvas_texture(black_image[MARGIN_RIGHT], RID()); + Size2 sz(storage->texture_get_width(black_image[MARGIN_RIGHT]), storage->texture_get_height(black_image[MARGIN_RIGHT])); + draw_generic_textured_rect(Rect2(window_w - black_margin[MARGIN_RIGHT], 0, black_margin[MARGIN_RIGHT], window_h), Rect2(0, 0, sz.x, sz.y)); + } else if (black_margin[MARGIN_RIGHT]) { + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, storage->resources.black_tex); + + draw_generic_textured_rect(Rect2(window_w - black_margin[MARGIN_RIGHT], 0, black_margin[MARGIN_RIGHT], window_h), Rect2(0, 0, 1, 1)); + } + + if (black_image[MARGIN_TOP].is_valid()) { + _bind_canvas_texture(black_image[MARGIN_TOP], RID()); + + Size2 sz(storage->texture_get_width(black_image[MARGIN_TOP]), storage->texture_get_height(black_image[MARGIN_TOP])); + draw_generic_textured_rect(Rect2(0, 0, window_w, black_margin[MARGIN_TOP]), Rect2(0, 0, sz.x, sz.y)); + + } else if (black_margin[MARGIN_TOP]) { + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, storage->resources.black_tex); + + draw_generic_textured_rect(Rect2(0, 0, window_w, black_margin[MARGIN_TOP]), Rect2(0, 0, 1, 1)); + } + + if (black_image[MARGIN_BOTTOM].is_valid()) { + + _bind_canvas_texture(black_image[MARGIN_BOTTOM], RID()); + + Size2 sz(storage->texture_get_width(black_image[MARGIN_BOTTOM]), storage->texture_get_height(black_image[MARGIN_BOTTOM])); + draw_generic_textured_rect(Rect2(0, window_h - black_margin[MARGIN_BOTTOM], window_w, black_margin[MARGIN_BOTTOM]), Rect2(0, 0, sz.x, sz.y)); + + } else if (black_margin[MARGIN_BOTTOM]) { + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, storage->resources.black_tex); + + draw_generic_textured_rect(Rect2(0, window_h - black_margin[MARGIN_BOTTOM], window_w, black_margin[MARGIN_BOTTOM]), Rect2(0, 0, 1, 1)); + } +} + void RasterizerCanvasGLES3::initialize() { { diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h index c0af22b5e8..26003f543f 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.h +++ b/drivers/gles3/rasterizer_canvas_gles3.h @@ -138,6 +138,8 @@ public: void initialize(); void finalize(); + virtual void draw_window_margins(int *black_margin, RID *black_image); + RasterizerCanvasGLES3(); }; diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 3fc5bed80b..e025992c0b 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -197,18 +197,28 @@ void RasterizerGLES3::begin_frame() { uint64_t tick = OS::get_singleton()->get_ticks_usec(); - double time_total = double(tick) / 1000000.0; + double delta = double(tick - prev_ticks) / 1000000.0; + delta *= Engine::get_singleton()->get_time_scale(); + + time_total += delta; + + if (delta == 0) { + //to avoid hiccups + delta = 0.001; + } + + prev_ticks = tick; + + double time_roll_over = GLOBAL_GET("rendering/limits/time/time_rollover_secs"); + if (time_total > time_roll_over) + time_total = 0; //roll over every day (should be customz storage->frame.time[0] = time_total; storage->frame.time[1] = Math::fmod(time_total, 3600); storage->frame.time[2] = Math::fmod(time_total, 900); storage->frame.time[3] = Math::fmod(time_total, 60); storage->frame.count++; - storage->frame.delta = double(tick - storage->frame.prev_tick) / 1000000.0; - if (storage->frame.prev_tick == 0) { - //to avoid hiccups - storage->frame.delta = 0.001; - } + storage->frame.delta = delta; storage->frame.prev_tick = tick; @@ -408,6 +418,7 @@ void RasterizerGLES3::register_config() { GLOBAL_DEF("rendering/quality/filters/use_nearest_mipmap_filter", false); GLOBAL_DEF("rendering/quality/filters/anisotropic_filter_level", 4.0); + GLOBAL_DEF("rendering/limits/time/time_rollover_secs", 3600); } RasterizerGLES3::RasterizerGLES3() { @@ -420,6 +431,9 @@ RasterizerGLES3::RasterizerGLES3() { storage->canvas = canvas; scene->storage = storage; storage->scene = scene; + + prev_ticks = 0; + time_total = 0; } RasterizerGLES3::~RasterizerGLES3() { diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h index ce18d6b6c1..4bc267ec7e 100644 --- a/drivers/gles3/rasterizer_gles3.h +++ b/drivers/gles3/rasterizer_gles3.h @@ -43,6 +43,9 @@ class RasterizerGLES3 : public Rasterizer { RasterizerCanvasGLES3 *canvas; RasterizerSceneGLES3 *scene; + uint64_t prev_ticks; + double time_total; + public: virtual RasterizerStorage *get_storage(); virtual RasterizerCanvas *get_canvas(); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index cd74c450f5..30a77c4b39 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1561,7 +1561,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { if (!c.normals.empty()) { glEnableVertexAttribArray(VS::ARRAY_NORMAL); - glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector3) * vertices, c.normals.ptr()); + glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector3) * vertices, c.normals.ptr()); glVertexAttribPointer(VS::ARRAY_NORMAL, 3, GL_FLOAT, false, sizeof(Vector3) * vertices, ((uint8_t *)NULL) + buf_ofs); buf_ofs += sizeof(Vector3) * vertices; @@ -1573,7 +1573,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { if (!c.tangents.empty()) { glEnableVertexAttribArray(VS::ARRAY_TANGENT); - glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Plane) * vertices, c.tangents.ptr()); + glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Plane) * vertices, c.tangents.ptr()); glVertexAttribPointer(VS::ARRAY_TANGENT, 4, GL_FLOAT, false, sizeof(Plane) * vertices, ((uint8_t *)NULL) + buf_ofs); buf_ofs += sizeof(Plane) * vertices; @@ -1585,7 +1585,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { if (!c.colors.empty()) { glEnableVertexAttribArray(VS::ARRAY_COLOR); - glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Color) * vertices, c.colors.ptr()); + glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Color) * vertices, c.colors.ptr()); glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, false, sizeof(Color), ((uint8_t *)NULL) + buf_ofs); buf_ofs += sizeof(Color) * vertices; @@ -1598,7 +1598,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { if (!c.uvs.empty()) { glEnableVertexAttribArray(VS::ARRAY_TEX_UV); - glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * vertices, c.uvs.ptr()); + glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector2) * vertices, c.uvs.ptr()); glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, false, sizeof(Vector2), ((uint8_t *)NULL) + buf_ofs); buf_ofs += sizeof(Vector2) * vertices; @@ -1610,7 +1610,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { if (!c.uvs2.empty()) { glEnableVertexAttribArray(VS::ARRAY_TEX_UV2); - glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * vertices, c.uvs2.ptr()); + glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector2) * vertices, c.uvs2.ptr()); glVertexAttribPointer(VS::ARRAY_TEX_UV2, 2, GL_FLOAT, false, sizeof(Vector2), ((uint8_t *)NULL) + buf_ofs); buf_ofs += sizeof(Vector2) * vertices; @@ -1620,7 +1620,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { } glEnableVertexAttribArray(VS::ARRAY_VERTEX); - glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector3) * vertices, c.vertices.ptr()); + glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector3) * vertices, c.vertices.ptr()); glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, false, sizeof(Vector3), ((uint8_t *)NULL) + buf_ofs); glDrawArrays(gl_primitive[c.primitive], 0, c.vertices.size()); } @@ -2182,7 +2182,7 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *m, bool p_shadow) { - bool has_base_alpha = (m->shader->spatial.uses_alpha || m->shader->spatial.uses_screen_texture || m->shader->spatial.unshaded); + bool has_base_alpha = (m->shader->spatial.uses_alpha && !m->shader->spatial.uses_alpha_scissor) || m->shader->spatial.uses_screen_texture || m->shader->spatial.unshaded; bool has_blend_alpha = m->shader->spatial.blend_mode != RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX || m->shader->spatial.ontop; bool has_alpha = has_base_alpha || has_blend_alpha; bool shadow = false; @@ -2206,7 +2206,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G if (has_blend_alpha || (has_base_alpha && m->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS)) return; //bye - if (!m->shader->spatial.writes_modelview_or_projection && !m->shader->spatial.uses_vertex && !m->shader->spatial.uses_discard && m->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { + if (!m->shader->spatial.uses_alpha_scissor && !m->shader->spatial.writes_modelview_or_projection && !m->shader->spatial.uses_vertex && !m->shader->spatial.uses_discard && m->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { //shader does not use discard and does not write a vertex position, use generic material if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) m = storage->material_owner.getptr(default_material_twosided); @@ -3051,6 +3051,11 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p } break; case VS::INSTANCE_IMMEDIATE: { + RasterizerStorageGLES3::Immediate *immediate = storage->immediate_owner.getptr(inst->base); + ERR_CONTINUE(!immediate); + + _add_geometry(immediate, inst, NULL, -1, p_shadow); + } break; case VS::INSTANCE_PARTICLES: { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 89bea1e8cc..a8e4bc0d4b 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1596,6 +1596,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const { p_shader->spatial.depth_draw_mode = Shader::Spatial::DEPTH_DRAW_OPAQUE; p_shader->spatial.cull_mode = Shader::Spatial::CULL_MODE_BACK; p_shader->spatial.uses_alpha = false; + p_shader->spatial.uses_alpha_scissor = false; p_shader->spatial.uses_discard = false; p_shader->spatial.unshaded = false; p_shader->spatial.ontop = false; @@ -1625,6 +1626,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const { shaders.actions_scene.render_mode_flags["vertex_lighting"] = &p_shader->spatial.uses_vertex_lighting; shaders.actions_scene.usage_flag_pointers["ALPHA"] = &p_shader->spatial.uses_alpha; + shaders.actions_scene.usage_flag_pointers["ALPHA_SCISSOR"] = &p_shader->spatial.uses_alpha_scissor; shaders.actions_scene.usage_flag_pointers["VERTEX"] = &p_shader->spatial.uses_vertex; shaders.actions_scene.usage_flag_pointers["SSS_STRENGTH"] = &p_shader->spatial.uses_sss; @@ -6902,17 +6904,19 @@ void RasterizerStorageGLES3::initialize() { config.use_fast_texture_filter = int(ProjectSettings::get_singleton()->get("rendering/quality/filters/use_nearest_mipmap_filter")); config.use_anisotropic_filter = config.extensions.has("rendering/quality/filters/anisotropic_filter_level"); - config.s3tc_supported = config.extensions.has("GL_EXT_texture_compression_dxt1") || config.extensions.has("GL_EXT_texture_compression_s3tc") || config.extensions.has("WEBGL_compressed_texture_s3tc"); config.etc_supported = config.extensions.has("GL_OES_compressed_ETC1_RGB8_texture"); config.latc_supported = config.extensions.has("GL_EXT_texture_compression_latc"); - config.rgtc_supported = config.extensions.has("GL_EXT_texture_compression_rgtc"); config.bptc_supported = config.extensions.has("GL_ARB_texture_compression_bptc"); #ifdef GLES_OVER_GL config.hdr_supported = true; config.etc2_supported = false; + config.s3tc_supported = true; + config.rgtc_supported = true; //RGTC - core since OpenGL version 3.0 #else config.etc2_supported = true; config.hdr_supported = false; + config.s3tc_supported = config.extensions.has("GL_EXT_texture_compression_dxt1") || config.extensions.has("GL_EXT_texture_compression_s3tc") || config.extensions.has("WEBGL_compressed_texture_s3tc"); + config.rgtc_supported = config.extensions.has("GL_EXT_texture_compression_rgtc") || config.extensions.has("GL_ARB_texture_compression_rgtc"); #endif config.pvrtc_supported = config.extensions.has("GL_IMG_texture_compression_pvrtc"); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index b536c9841c..5a272f43fb 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -442,6 +442,7 @@ public: int cull_mode; bool uses_alpha; + bool uses_alpha_scissor; bool unshaded; bool ontop; bool uses_vertex; diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 206f270f68..c014caee8d 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -762,6 +762,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_SPATIAL].renames["SCREEN_TEXTURE"] = "screen_texture"; actions[VS::SHADER_SPATIAL].renames["DEPTH_TEXTURE"] = "depth_buffer"; actions[VS::SHADER_SPATIAL].renames["SIDE"] = "side"; + actions[VS::SHADER_SPATIAL].renames["ALPHA_SCISSOR"] = "alpha_scissor"; actions[VS::SHADER_SPATIAL].usage_defines["TANGENT"] = "#define ENABLE_TANGENT_INTERP\n"; actions[VS::SHADER_SPATIAL].usage_defines["BINORMAL"] = "@TANGENT"; @@ -778,6 +779,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP_DEPTH"] = "@NORMALMAP"; actions[VS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n"; actions[VS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n"; + actions[VS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n"; actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n"; actions[VS::SHADER_SPATIAL].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n"; diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 340a1f24d2..3f0498746b 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1523,6 +1523,10 @@ void main() { #endif +#if defined(ALPHA_SCISSOR_USED) + float alpha_scissor = 0.5; +#endif + #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) vec3 binormal = normalize(binormal_interp)*side; vec3 tangent = normalize(tangent_interp)*side; @@ -1571,6 +1575,12 @@ FRAGMENT_SHADER_CODE } +#if defined(ALPHA_SCISSOR_USED) + if (alpha<alpha_scissor) { + discard; + } +#endif + #if defined(ENABLE_NORMALMAP) @@ -1929,7 +1939,7 @@ FRAGMENT_SHADER_CODE if (fog_depth_enabled) { - float fog_z = smoothstep(fog_depth_begin,z_far,-vertex.z); + float fog_z = smoothstep(fog_depth_begin,z_far,length(vertex)); fog_amount = pow(fog_z,fog_depth_curve); if (fog_transmit_enabled) { diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp index da998db66f..3de25c32ad 100644 --- a/drivers/rtaudio/audio_driver_rtaudio.cpp +++ b/drivers/rtaudio/audio_driver_rtaudio.cpp @@ -79,7 +79,7 @@ int AudioDriverRtAudio::callback(void *outputBuffer, void *inputBuffer, unsigned Error AudioDriverRtAudio::init() { active = false; - mutex = NULL; + mutex = Mutex::create(true); dac = memnew(RtAudio); ERR_EXPLAIN("Cannot initialize RtAudio audio driver: No devices present.") @@ -136,7 +136,6 @@ Error AudioDriverRtAudio::init() { try { dac->openStream(¶meters, NULL, RTAUDIO_SINT32, mix_rate, &buffer_size, &callback, this, &options); - mutex = Mutex::create(true); active = true; break; @@ -162,6 +161,7 @@ Error AudioDriverRtAudio::init() { try { dac->closeStream(); + active = false; } catch (RtAudioError &e) { ERR_PRINT(e.what()); ERR_FAIL_V(ERR_UNAVAILABLE); @@ -212,17 +212,27 @@ void AudioDriverRtAudio::unlock() { void AudioDriverRtAudio::finish() { - if (active && dac->isStreamOpen()) + lock(); + if (active && dac->isStreamOpen()) { dac->closeStream(); - if (mutex) + active = false; + } + unlock(); + + if (mutex) { memdelete(mutex); - if (dac) + mutex = NULL; + } + if (dac) { memdelete(dac); + dac = NULL; + } } AudioDriverRtAudio::AudioDriverRtAudio() { mutex = NULL; + dac = NULL; mix_rate = 44100; speaker_mode = SPEAKER_MODE_STEREO; } diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index e424590881..0f4e8f757c 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -415,7 +415,7 @@ Error OS_Unix::kill(const ProcessID &p_pid) { return ret ? ERR_INVALID_PARAMETER : OK; } -int OS_Unix::get_process_ID() const { +int OS_Unix::get_process_id() const { return getpid(); }; diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index fdc6d6e28f..6cd0016bb0 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -103,7 +103,7 @@ public: virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL); virtual Error kill(const ProcessID &p_pid); - virtual int get_process_ID() const; + virtual int get_process_id() const; virtual bool has_environment(const String &p_var) const; virtual String get_environment(const String &p_var) const; diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp index c1559619d7..3b895ff9c1 100644 --- a/drivers/unix/thread_posix.cpp +++ b/drivers/unix/thread_posix.cpp @@ -38,7 +38,7 @@ #include "os/memory.h" -Thread::ID ThreadPosix::get_ID() const { +Thread::ID ThreadPosix::get_id() const { return id; } @@ -75,7 +75,7 @@ Thread *ThreadPosix::create_func_posix(ThreadCreateCallback p_callback, void *p_ return tr; } -Thread::ID ThreadPosix::get_thread_ID_func_posix() { +Thread::ID ThreadPosix::get_thread_id_func_posix() { return (ID)pthread_self(); } @@ -122,7 +122,7 @@ Error ThreadPosix::set_name_func_posix(const String &p_name) { void ThreadPosix::make_default() { create_func = create_func_posix; - get_thread_ID_func = get_thread_ID_func_posix; + get_thread_id_func = get_thread_id_func_posix; wait_to_finish_func = wait_to_finish_func_posix; set_name_func = set_name_func_posix; } diff --git a/drivers/unix/thread_posix.h b/drivers/unix/thread_posix.h index c0c3e578bb..21e1d290a9 100644 --- a/drivers/unix/thread_posix.h +++ b/drivers/unix/thread_posix.h @@ -53,7 +53,7 @@ class ThreadPosix : public Thread { static void *thread_callback(void *userdata); static Thread *create_func_posix(ThreadCreateCallback p_callback, void *, const Settings &); - static ID get_thread_ID_func_posix(); + static ID get_thread_id_func_posix(); static void wait_to_finish_func_posix(Thread *p_thread); static Error set_name_func_posix(const String &p_name); @@ -61,7 +61,7 @@ class ThreadPosix : public Thread { ThreadPosix(); public: - virtual ID get_ID() const; + virtual ID get_id() const; static void make_default(); diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp index 79077a54c8..01ddf42649 100644 --- a/drivers/windows/thread_windows.cpp +++ b/drivers/windows/thread_windows.cpp @@ -33,7 +33,7 @@ #include "os/memory.h" -Thread::ID ThreadWindows::get_ID() const { +Thread::ID ThreadWindows::get_id() const { return id; } @@ -72,7 +72,7 @@ Thread *ThreadWindows::create_func_windows(ThreadCreateCallback p_callback, void return tr; } -Thread::ID ThreadWindows::get_thread_ID_func_windows() { +Thread::ID ThreadWindows::get_thread_id_func_windows() { return (ID)GetCurrentThreadId(); //must implement } @@ -88,7 +88,7 @@ void ThreadWindows::wait_to_finish_func_windows(Thread *p_thread) { void ThreadWindows::make_default() { create_func = create_func_windows; - get_thread_ID_func = get_thread_ID_func_windows; + get_thread_id_func = get_thread_id_func_windows; wait_to_finish_func = wait_to_finish_func_windows; } diff --git a/drivers/windows/thread_windows.h b/drivers/windows/thread_windows.h index 162df08975..143825039c 100644 --- a/drivers/windows/thread_windows.h +++ b/drivers/windows/thread_windows.h @@ -52,13 +52,13 @@ class ThreadWindows : public Thread { static DWORD WINAPI thread_callback(LPVOID userdata); static Thread *create_func_windows(ThreadCreateCallback p_callback, void *, const Settings &); - static ID get_thread_ID_func_windows(); + static ID get_thread_id_func_windows(); static void wait_to_finish_func_windows(Thread *p_thread); ThreadWindows(); public: - virtual ID get_ID() const; + virtual ID get_id() const; static void make_default(); diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index 45da365695..3675948b1d 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -1091,11 +1091,11 @@ void AnimationKeyEditor::_track_editor_draw() { int sep = get_constant("vseparation", "Tree"); int hsep = get_constant("hseparation", "Tree"); Color color = get_color("font_color", "Tree"); - Color sepcolor = get_color("light_color_1", "Editor"); - Color timecolor = get_color("dark_color_2", "Editor"); + Color sepcolor = Color(1, 1, 1, 0.2); + Color timecolor = Color(1, 1, 1, 0.2); Color hover_color = Color(1, 1, 1, 0.05); Color select_color = Color(1, 1, 1, 0.1); - Color invalid_path_color = Color(1, 0.6, 0.4, 0.5); + Color invalid_path_color = get_color("error_color", "Editor"); Color track_select_color = get_color("highlight_color", "Editor"); Ref<Texture> remove_icon = get_icon("Remove", "EditorIcons"); @@ -1156,11 +1156,12 @@ void AnimationKeyEditor::_track_editor_draw() { int settings_limit = size.width - right_separator_ofs; int name_limit = settings_limit * name_column_ratio; - te->draw_line(ofs + Point2(name_limit, 0), ofs + Point2(name_limit, size.height), color); - te->draw_line(ofs + Point2(settings_limit, 0), ofs + Point2(settings_limit, size.height), color); + Color linecolor = Color(1, 1, 1, 0.2); + te->draw_line(ofs + Point2(name_limit, 0), ofs + Point2(name_limit, size.height), linecolor); + te->draw_line(ofs + Point2(settings_limit, 0), ofs + Point2(settings_limit, size.height), linecolor); te->draw_texture(hsize_icon, ofs + Point2(name_limit - hsize_icon->get_width() - hsep, (h - hsize_icon->get_height()) / 2)); - te->draw_line(ofs + Point2(0, h), ofs + Point2(size.width, h), color); + te->draw_line(ofs + Point2(0, h), ofs + Point2(size.width, h), linecolor); // draw time float keys_from; @@ -1180,7 +1181,7 @@ void AnimationKeyEditor::_track_editor_draw() { int end_px = (l - h_scroll->get_value()) * scale; int begin_px = -h_scroll->get_value() * scale; - Color notimecol = get_color("light_color_1", "Editor"); + Color notimecol = get_color("dark_color_2", "Editor"); { @@ -1276,7 +1277,7 @@ void AnimationKeyEditor::_track_editor_draw() { if ((sc / step) != (prev_sc / step) || (prev_sc < 0 && sc >= 0)) { int scd = sc < 0 ? prev_sc : sc; - te->draw_line(ofs + Point2(name_limit + i, 0), ofs + Point2(name_limit + i, h), color); + te->draw_line(ofs + Point2(name_limit + i, 0), ofs + Point2(name_limit + i, h), linecolor); te->draw_string(font, ofs + Point2(name_limit + i + 3, (h - font->get_height()) / 2 + font->get_ascent()).floor(), String::num((scd - (scd % step)) / double(SC_ADJ), decimals), sub ? color_time_dec : color_time_sec, zoomw - i); } } @@ -1335,7 +1336,7 @@ void AnimationKeyEditor::_track_editor_draw() { te->draw_line(ofs + Point2(0, y + h), ofs + Point2(size.width, y + h), sepcolor); Point2 icon_ofs = ofs + Point2(size.width, y + (h - remove_icon->get_height()) / 2).floor(); - icon_ofs.y += 4; + icon_ofs.y += 4 * EDSCALE; /* icon_ofs.x-=remove_icon->get_width(); @@ -1353,7 +1354,7 @@ void AnimationKeyEditor::_track_editor_draw() { */ track_ofs[0] = size.width - icon_ofs.x; icon_ofs.x -= down_icon->get_width(); - te->draw_texture(down_icon, icon_ofs); + te->draw_texture(down_icon, icon_ofs - Size2(0, 4 * EDSCALE)); int wrap_type = animation->track_get_interpolation_loop_wrap(idx) ? 1 : 0; icon_ofs.x -= hsep; @@ -1366,7 +1367,7 @@ void AnimationKeyEditor::_track_editor_draw() { track_ofs[1] = size.width - icon_ofs.x; icon_ofs.x -= down_icon->get_width(); - te->draw_texture(down_icon, icon_ofs); + te->draw_texture(down_icon, icon_ofs - Size2(0, 4 * EDSCALE)); int interp_type = animation->track_get_interpolation_type(idx); ERR_CONTINUE(interp_type < 0 || interp_type >= 3); @@ -1385,7 +1386,7 @@ void AnimationKeyEditor::_track_editor_draw() { icon_ofs.x -= hsep; icon_ofs.x -= down_icon->get_width(); - te->draw_texture(down_icon, icon_ofs); + te->draw_texture(down_icon, icon_ofs - Size2(0, 4 * EDSCALE)); icon_ofs.x -= hsep; icon_ofs.x -= cont_icon[umode]->get_width(); @@ -3745,7 +3746,7 @@ AnimationKeyEditor::AnimationKeyEditor() { history = EditorNode::get_singleton()->get_editor_history(); ec = memnew(Control); - ec->set_custom_minimum_size(Size2(0, 150)); + ec->set_custom_minimum_size(Size2(0, 150) * EDSCALE); add_child(ec); ec->set_v_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp index 81d5309712..06d7d5fdc8 100644 --- a/editor/array_property_edit.cpp +++ b/editor/array_property_edit.cpp @@ -251,7 +251,7 @@ void ArrayPropertyEdit::edit(Object *p_obj, const StringName &p_prop, const Stri page = 0; property = p_prop; - obj = p_obj->get_instance_ID(); + obj = p_obj->get_instance_id(); default_type = p_deftype; if (!p_hint_string.empty()) { diff --git a/editor/asset_library_editor_plugin.cpp b/editor/asset_library_editor_plugin.cpp index f92b70d0c0..2a22cde2fb 100644 --- a/editor/asset_library_editor_plugin.cpp +++ b/editor/asset_library_editor_plugin.cpp @@ -1136,7 +1136,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const item->connect("category_selected", this, "_select_category"); if (r.has("icon_url") && r["icon_url"] != "") { - _request_image(item->get_instance_ID(), r["icon_url"], IMAGE_QUEUE_ICON, 0); + _request_image(item->get_instance_id(), r["icon_url"], IMAGE_QUEUE_ICON, 0); } } } break; @@ -1173,7 +1173,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const item->connect("category_selected",this,"_category_selected");*/ if (r.has("icon_url") && r["icon_url"] != "") { - _request_image(description->get_instance_ID(), r["icon_url"], IMAGE_QUEUE_ICON, 0); + _request_image(description->get_instance_id(), r["icon_url"], IMAGE_QUEUE_ICON, 0); } if (d.has("previews")) { @@ -1195,12 +1195,12 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const description->add_preview(i, is_video, video_url); if (p.has("thumbnail")) { - _request_image(description->get_instance_ID(), p["thumbnail"], IMAGE_QUEUE_THUMBNAIL, i); + _request_image(description->get_instance_id(), p["thumbnail"], IMAGE_QUEUE_THUMBNAIL, i); } if (is_video) { - //_request_image(description->get_instance_ID(),p["link"],IMAGE_QUEUE_SCREENSHOT,i); + //_request_image(description->get_instance_id(),p["link"],IMAGE_QUEUE_SCREENSHOT,i); } else { - _request_image(description->get_instance_ID(), p["link"], IMAGE_QUEUE_SCREENSHOT, i); + _request_image(description->get_instance_id(), p["link"], IMAGE_QUEUE_SCREENSHOT, i); } } } diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp index ab1e397ccc..169c34782d 100644 --- a/editor/collada/collada.cpp +++ b/editor/collada/collada.cpp @@ -2220,6 +2220,7 @@ void Collada::_merge_skeletons(VisualScene *p_vscene, Node *p_node) { ERR_CONTINUE(!state.scene_map.has(nodeid)); //weird, it should have it... NodeJoint *nj = SAFE_CAST<NodeJoint *>(state.scene_map[nodeid]); + ERR_CONTINUE(!nj); //broken collada if (!nj->owner) { print_line("no owner for: " + String(nodeid)); } diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 9762bd2000..47c2cb5536 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -220,7 +220,7 @@ void ConnectDialog::_add_bind() { if (cdbinds->params.size() >= VARIANT_ARG_MAX) return; - Variant::Type vt = (Variant::Type)type_list->get_item_ID(type_list->get_selected()); + Variant::Type vt = (Variant::Type)type_list->get_item_id(type_list->get_selected()); Variant value; diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 08b093aecb..219f05ef95 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -1061,20 +1061,19 @@ EditorAudioBuses::EditorAudioBuses() { top_hb = memnew(HBoxContainer); add_child(top_hb); + file = memnew(ToolButton); + file->set_text("default_bus_layout.tres"); + top_hb->add_child(file); + file->connect("pressed", this, "_select_layout"); + add = memnew(Button); top_hb->add_child(add); - ; add->set_text(TTR("Add Bus")); add->connect("pressed", this, "_add_bus"); top_hb->add_spacer(); - file = memnew(ToolButton); - file->set_text("default_bus_layout.tres"); - top_hb->add_child(file); - file->connect("pressed", this, "_select_layout"); - load = memnew(Button); load->set_text(TTR("Load")); top_hb->add_child(load); @@ -1096,6 +1095,7 @@ EditorAudioBuses::EditorAudioBuses() { _new->connect("pressed", this, "_new_layout"); bus_scroll = memnew(ScrollContainer); + bus_scroll->add_style_override("panel", memnew(StyleBoxEmpty)); bus_scroll->set_v_size_flags(SIZE_EXPAND_FILL); bus_scroll->set_enable_h_scroll(true); bus_scroll->set_enable_v_scroll(false); diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index c82e8f1226..e788fe2c13 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -183,7 +183,7 @@ ObjectID EditorHistory::get_current() { if (!obj) return 0; - return obj->get_instance_ID(); + return obj->get_instance_id(); } int EditorHistory::get_path_size() const { @@ -208,7 +208,7 @@ ObjectID EditorHistory::get_path_object(int p_index) const { if (!obj) return 0; - return obj->get_instance_ID(); + return obj->get_instance_id(); } String EditorHistory::get_path_property(int p_index) const { @@ -867,8 +867,8 @@ void EditorSelection::_bind_methods() { ClassDB::bind_method(D_METHOD("_node_removed"), &EditorSelection::_node_removed); ClassDB::bind_method(D_METHOD("clear"), &EditorSelection::clear); - ClassDB::bind_method(D_METHOD("add_node", "node:Node"), &EditorSelection::add_node); - ClassDB::bind_method(D_METHOD("remove_node", "node:Node"), &EditorSelection::remove_node); + ClassDB::bind_method(D_METHOD("add_node", "node"), &EditorSelection::add_node); + ClassDB::bind_method(D_METHOD("remove_node", "node"), &EditorSelection::remove_node); ClassDB::bind_method(D_METHOD("get_selected_nodes"), &EditorSelection::_get_selected_nodes); ClassDB::bind_method(D_METHOD("get_transformable_selected_nodes"), &EditorSelection::_get_transformable_selected_nodes); ADD_SIGNAL(MethodInfo("selection_changed")); diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 6bf92ddd2d..36fd86d88f 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -3218,24 +3218,24 @@ PoolVector<String> EditorImportExport::_get_export_platforms() { void EditorImportExport::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_import_plugin","plugin:EditorImportPlugin"),&EditorImportExport::add_import_plugin); - ClassDB::bind_method(D_METHOD("remove_import_plugin","plugin:EditorImportPlugin"),&EditorImportExport::remove_import_plugin); + ClassDB::bind_method(D_METHOD("add_import_plugin","plugin"),&EditorImportExport::add_import_plugin); + ClassDB::bind_method(D_METHOD("remove_import_plugin","plugin"),&EditorImportExport::remove_import_plugin); ClassDB::bind_method(D_METHOD("get_import_plugin_count"),&EditorImportExport::get_import_plugin_count); - ClassDB::bind_method(D_METHOD("get_import_plugin:EditorImportPlugin","idx"),&EditorImportExport::get_import_plugin); - ClassDB::bind_method(D_METHOD("get_import_plugin_by_name:EditorImportPlugin","name"),&EditorImportExport::get_import_plugin_by_name); + ClassDB::bind_method(D_METHOD("get_import_plugin","idx"),&EditorImportExport::get_import_plugin); + ClassDB::bind_method(D_METHOD("get_import_plugin_by_name","name"),&EditorImportExport::get_import_plugin_by_name); - ClassDB::bind_method(D_METHOD("add_export_plugin","plugin:EditorExportPlugin"),&EditorImportExport::add_export_plugin); - ClassDB::bind_method(D_METHOD("remove_export_plugin","plugin:EditorExportPlugin"),&EditorImportExport::remove_export_plugin); + ClassDB::bind_method(D_METHOD("add_export_plugin","plugin"),&EditorImportExport::add_export_plugin); + ClassDB::bind_method(D_METHOD("remove_export_plugin","plugin"),&EditorImportExport::remove_export_plugin); ClassDB::bind_method(D_METHOD("get_export_plugin_count"),&EditorImportExport::get_export_plugin_count); - ClassDB::bind_method(D_METHOD("get_export_plugin:EditorExportPlugin","idx"),&EditorImportExport::get_export_plugin); + ClassDB::bind_method(D_METHOD("get_export_plugin","idx"),&EditorImportExport::get_export_plugin); ClassDB::bind_method(D_METHOD("set_export_file_action","file","action"),&EditorImportExport::set_export_file_action); ClassDB::bind_method(D_METHOD("get_export_file_action","file"),&EditorImportExport::get_export_file_action); ClassDB::bind_method(D_METHOD("get_export_file_list"),&EditorImportExport::_get_export_file_list); - ClassDB::bind_method(D_METHOD("add_export_platform","platform:EditorExportplatform"),&EditorImportExport::add_export_platform); - //ClassDB::bind_method(D_METHOD("remove_export_platform","platform:EditorExportplatform"),&EditorImportExport::add_export_platform); - ClassDB::bind_method(D_METHOD("get_export_platform:EditorExportPlatform","name"),&EditorImportExport::get_export_platform); + ClassDB::bind_method(D_METHOD("add_export_platform","platform"),&EditorImportExport::add_export_platform); + //ClassDB::bind_method(D_METHOD("remove_export_platform","platform"),&EditorImportExport::add_export_platform); + ClassDB::bind_method(D_METHOD("get_export_platform","name"),&EditorImportExport::get_export_platform); ClassDB::bind_method(D_METHOD("get_export_platforms"),&EditorImportExport::_get_export_platforms); ClassDB::bind_method(D_METHOD("set_export_filter","filter"),&EditorImportExport::set_export_filter); diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index c2a408e8ab..d572ee8724 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -1154,7 +1154,7 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("set_current_path", "path"), &EditorFileDialog::set_current_path); ClassDB::bind_method(D_METHOD("set_mode", "mode"), &EditorFileDialog::set_mode); ClassDB::bind_method(D_METHOD("get_mode"), &EditorFileDialog::get_mode); - ClassDB::bind_method(D_METHOD("get_vbox:VBoxContainer"), &EditorFileDialog::get_vbox); + ClassDB::bind_method(D_METHOD("get_vbox"), &EditorFileDialog::get_vbox); ClassDB::bind_method(D_METHOD("set_access", "access"), &EditorFileDialog::set_access); ClassDB::bind_method(D_METHOD("get_access"), &EditorFileDialog::get_access); ClassDB::bind_method(D_METHOD("set_show_hidden_files", "show"), &EditorFileDialog::set_show_hidden_files); @@ -1454,9 +1454,9 @@ void EditorLineEditFileChooser::_bind_methods() { ClassDB::bind_method(D_METHOD("_browse"), &EditorLineEditFileChooser::_browse); ClassDB::bind_method(D_METHOD("_chosen"), &EditorLineEditFileChooser::_chosen); - ClassDB::bind_method(D_METHOD("get_button:Button"), &EditorLineEditFileChooser::get_button); - ClassDB::bind_method(D_METHOD("get_line_edit:LineEdit"), &EditorLineEditFileChooser::get_line_edit); - ClassDB::bind_method(D_METHOD("get_file_dialog:EditorFileDialog"), &EditorLineEditFileChooser::get_file_dialog); + ClassDB::bind_method(D_METHOD("get_button"), &EditorLineEditFileChooser::get_button); + ClassDB::bind_method(D_METHOD("get_line_edit"), &EditorLineEditFileChooser::get_line_edit); + ClassDB::bind_method(D_METHOD("get_file_dialog"), &EditorLineEditFileChooser::get_file_dialog); } void EditorLineEditFileChooser::_chosen(const String &p_text) { diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index ed58116304..eeb2f5ae8a 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -137,14 +137,14 @@ EditorFileSystemDirectory *EditorFileSystemDirectory::get_parent() { void EditorFileSystemDirectory::_bind_methods() { ClassDB::bind_method(D_METHOD("get_subdir_count"), &EditorFileSystemDirectory::get_subdir_count); - ClassDB::bind_method(D_METHOD("get_subdir:EditorFileSystemDirectory", "idx"), &EditorFileSystemDirectory::get_subdir); + ClassDB::bind_method(D_METHOD("get_subdir", "idx"), &EditorFileSystemDirectory::get_subdir); ClassDB::bind_method(D_METHOD("get_file_count"), &EditorFileSystemDirectory::get_file_count); ClassDB::bind_method(D_METHOD("get_file", "idx"), &EditorFileSystemDirectory::get_file); ClassDB::bind_method(D_METHOD("get_file_path", "idx"), &EditorFileSystemDirectory::get_file_path); ClassDB::bind_method(D_METHOD("get_file_type", "idx"), &EditorFileSystemDirectory::get_file_type); ClassDB::bind_method(D_METHOD("get_name"), &EditorFileSystemDirectory::get_name); ClassDB::bind_method(D_METHOD("get_path"), &EditorFileSystemDirectory::get_path); - ClassDB::bind_method(D_METHOD("get_parent:EditorFileSystemDirectory"), &EditorFileSystemDirectory::get_parent); + ClassDB::bind_method(D_METHOD("get_parent"), &EditorFileSystemDirectory::get_parent); ClassDB::bind_method(D_METHOD("find_file_index", "name"), &EditorFileSystemDirectory::find_file_index); ClassDB::bind_method(D_METHOD("find_dir_index", "name"), &EditorFileSystemDirectory::find_dir_index); } @@ -512,6 +512,8 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess if (FileAccess::exists(cd.plus_file(f).plus_file("project.godot"))) // skip if another project inside this continue; + if (FileAccess::exists(cd.plus_file(f).plus_file(".gdignore"))) // skip if another project inside this + continue; dirs.push_back(f); @@ -691,6 +693,8 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const if (FileAccess::exists(cd.plus_file(f).plus_file("project.godot"))) // skip if another project inside this continue; + if (FileAccess::exists(cd.plus_file(f).plus_file(".gdignore"))) // skip if another project inside this + continue; EditorFileSystemDirectory *efd = memnew(EditorFileSystemDirectory); @@ -1399,13 +1403,13 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) { void EditorFileSystem::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_filesystem:EditorFileSystemDirectory"), &EditorFileSystem::get_filesystem); + ClassDB::bind_method(D_METHOD("get_filesystem"), &EditorFileSystem::get_filesystem); ClassDB::bind_method(D_METHOD("is_scanning"), &EditorFileSystem::is_scanning); ClassDB::bind_method(D_METHOD("get_scanning_progress"), &EditorFileSystem::get_scanning_progress); ClassDB::bind_method(D_METHOD("scan"), &EditorFileSystem::scan); ClassDB::bind_method(D_METHOD("scan_sources"), &EditorFileSystem::scan_changes); ClassDB::bind_method(D_METHOD("update_file", "path"), &EditorFileSystem::update_file); - ClassDB::bind_method(D_METHOD("get_filesystem_path:EditorFileSystemDirectory", "path"), &EditorFileSystem::get_filesystem_path); + ClassDB::bind_method(D_METHOD("get_filesystem_path", "path"), &EditorFileSystem::get_filesystem_path); ClassDB::bind_method(D_METHOD("get_file_type", "path"), &EditorFileSystem::get_file_type); ADD_SIGNAL(MethodInfo("filesystem_changed")); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index e890082ee1..f80c4ee0e2 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1621,12 +1621,18 @@ void EditorHelp::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { - //forward->set_icon(get_icon("Forward","EditorIcons")); //back->set_icon(get_icon("Back","EditorIcons")); _update_doc(); + } break; + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + Ref<StyleBoxFlat> style(memnew(StyleBoxFlat)); + style->set_bg_color(EditorSettings::get_singleton()->get("text_editor/highlighting/background_color")); + background_panel->add_style_override("panel", style); } break; + + default: break; } } @@ -1695,14 +1701,14 @@ EditorHelp::EditorHelp() { //class_list->set_selection_enabled(true); { - Panel *pc = memnew(Panel); + background_panel = memnew(Panel); Ref<StyleBoxFlat> style(memnew(StyleBoxFlat)); style->set_bg_color(EditorSettings::get_singleton()->get("text_editor/highlighting/background_color")); - pc->set_v_size_flags(SIZE_EXPAND_FILL); - pc->add_style_override("panel", style); //get_stylebox("normal","TextEdit")); - vbc->add_child(pc); + background_panel->set_v_size_flags(SIZE_EXPAND_FILL); + background_panel->add_style_override("panel", style); //get_stylebox("normal","TextEdit")); + vbc->add_child(background_panel); class_desc = memnew(RichTextLabel); - pc->add_child(class_desc); + background_panel->add_child(class_desc); class_desc->set_area_as_parent_rect(8); class_desc->connect("meta_clicked", this, "_class_desc_select"); class_desc->connect("gui_input", this, "_class_desc_input"); diff --git a/editor/editor_help.h b/editor/editor_help.h index 46d83490f4..de30b543fc 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -129,6 +129,7 @@ class EditorHelp : public VBoxContainer { HSplitContainer *h_split; static DocData *doc; + Panel *background_panel; ConfirmationDialog *search_dialog; LineEdit *search; diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 5d13c7c254..c5e15b97b0 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -36,7 +36,7 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type) { EditorLog *self = (EditorLog *)p_self; - if (self->current != Thread::get_caller_ID()) + if (self->current != Thread::get_caller_id()) return; String err_str; @@ -52,31 +52,6 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f */ err_str = " " + err_str; - self->log->add_newline(); - - Ref<Texture> icon; - - switch (p_type) { - case ERR_HANDLER_ERROR: { - - icon = self->get_icon("Error", "EditorIcons"); - return; // these are confusing - } break; - case ERR_HANDLER_WARNING: { - - icon = self->get_icon("Error", "EditorIcons"); - - } break; - case ERR_HANDLER_SCRIPT: { - - icon = self->get_icon("ScriptError", "EditorIcons"); - } break; - case ERR_HANDLER_SHADER: { - - icon = self->get_icon("Shader", "EditorIcons"); - } break; - } - self->add_message(err_str, true); } @@ -114,16 +89,16 @@ void EditorLog::clear() { void EditorLog::add_message(const String &p_msg, bool p_error) { + log->add_newline(); if (p_error) { + log->push_color(get_color("fg_error", "Editor")); Ref<Texture> icon = get_icon("Error", "EditorIcons"); log->add_image(icon); //button->set_icon(icon); - log->push_color(get_color("fg_error", "Editor")); } else { //button->set_icon(Ref<Texture>()); } - log->add_newline(); log->add_text(p_msg); //button->set_text(p_msg); @@ -168,15 +143,10 @@ EditorLog::EditorLog() { HBoxContainer *hb = memnew(HBoxContainer); vb->add_child(hb); title = memnew(Label); - title->set_text(TTR(" Output:")); + title->set_text(TTR("Output:")); title->set_h_size_flags(SIZE_EXPAND_FILL); hb->add_child(title); - //pd = memnew( PaneDrag ); - //hb->add_child(pd); - //pd->connect("dragged",this,"_dragged"); - //pd->set_default_cursor_shape(Control::CURSOR_MOVE); - clearbutton = memnew(Button); hb->add_child(clearbutton); clearbutton->set_text(TTR("Clear")); @@ -184,7 +154,7 @@ EditorLog::EditorLog() { ec = memnew(Control); vb->add_child(ec); - ec->set_custom_minimum_size(Size2(0, 180)); + ec->set_custom_minimum_size(Size2(0, 180) * EDSCALE); ec->set_v_size_flags(SIZE_EXPAND_FILL); pc = memnew(PanelContainer); @@ -204,7 +174,7 @@ EditorLog::EditorLog() { eh.userdata = this; add_error_handler(&eh); - current = Thread::get_caller_ID(); + current = Thread::get_caller_id(); EditorNode::get_undo_redo()->set_commit_notify_callback(_undo_redo_cbk, this); } diff --git a/editor/editor_name_dialog.cpp b/editor/editor_name_dialog.cpp index 7435e9a9f7..6ebfcbf313 100644 --- a/editor/editor_name_dialog.cpp +++ b/editor/editor_name_dialog.cpp @@ -42,8 +42,8 @@ void EditorNameDialog::_line_gui_input(const Ref<InputEvent> &p_event) { return; switch (k->get_scancode()) { - case KEY_ENTER: - case KEY_RETURN: { + case KEY_KP_ENTER: + case KEY_ENTER: { if (get_hide_on_ok()) hide(); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 4d5dd14172..730ba3cacc 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1358,7 +1358,7 @@ void EditorNode::push_item(Object *p_object, const String &p_property) { return; } - uint32_t id = p_object->get_instance_ID(); + uint32_t id = p_object->get_instance_id(); if (id != editor_history.get_current()) { if (p_property == "") diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp index 8ce4f88590..fdac68ea1f 100644 --- a/editor/editor_path.cpp +++ b/editor/editor_path.cpp @@ -63,7 +63,7 @@ void EditorPath::_add_children_to_popup(Object *p_obj, int p_depth) { int index = popup->get_item_count(); popup->add_icon_item(icon, E->get().name.capitalize(), objects.size()); popup->set_item_h_offset(index, p_depth * 10 * EDSCALE); - objects.push_back(obj->get_instance_ID()); + objects.push_back(obj->get_instance_id()); _add_children_to_popup(obj, p_depth + 1); } diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index c65065db43..19c77ef737 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -407,41 +407,41 @@ EditorFileSystem *EditorPlugin::get_resource_file_system() { void EditorPlugin::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_control_to_container", "container", "control:Control"), &EditorPlugin::add_control_to_container); - ClassDB::bind_method(D_METHOD("add_control_to_bottom_panel:ToolButton", "control:Control", "title"), &EditorPlugin::add_control_to_bottom_panel); - ClassDB::bind_method(D_METHOD("add_control_to_dock", "slot", "control:Control"), &EditorPlugin::add_control_to_dock); - ClassDB::bind_method(D_METHOD("remove_control_from_docks", "control:Control"), &EditorPlugin::remove_control_from_docks); - ClassDB::bind_method(D_METHOD("remove_control_from_bottom_panel", "control:Control"), &EditorPlugin::remove_control_from_bottom_panel); + ClassDB::bind_method(D_METHOD("add_control_to_container", "container", "control"), &EditorPlugin::add_control_to_container); + ClassDB::bind_method(D_METHOD("add_control_to_bottom_panel", "control", "title"), &EditorPlugin::add_control_to_bottom_panel); + ClassDB::bind_method(D_METHOD("add_control_to_dock", "slot", "control"), &EditorPlugin::add_control_to_dock); + ClassDB::bind_method(D_METHOD("remove_control_from_docks", "control"), &EditorPlugin::remove_control_from_docks); + ClassDB::bind_method(D_METHOD("remove_control_from_bottom_panel", "control"), &EditorPlugin::remove_control_from_bottom_panel); //ClassDB::bind_method(D_METHOD("add_tool_menu_item", "name", "handler", "callback", "ud"),&EditorPlugin::add_tool_menu_item,DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("add_tool_submenu_item", "name", "submenu:PopupMenu"), &EditorPlugin::add_tool_submenu_item); + ClassDB::bind_method(D_METHOD("add_tool_submenu_item", "name", "submenu"), &EditorPlugin::add_tool_submenu_item); //ClassDB::bind_method(D_METHOD("remove_tool_menu_item", "name"),&EditorPlugin::remove_tool_menu_item); - ClassDB::bind_method(D_METHOD("add_custom_type", "type", "base", "script:Script", "icon:Texture"), &EditorPlugin::add_custom_type); + ClassDB::bind_method(D_METHOD("add_custom_type", "type", "base", "script", "icon"), &EditorPlugin::add_custom_type); ClassDB::bind_method(D_METHOD("remove_custom_type", "type"), &EditorPlugin::remove_custom_type); - ClassDB::bind_method(D_METHOD("get_editor_viewport:Control"), &EditorPlugin::get_editor_viewport); + ClassDB::bind_method(D_METHOD("get_editor_viewport"), &EditorPlugin::get_editor_viewport); - ClassDB::bind_method(D_METHOD("get_resource_previewer:EditorResourcePreview"), &EditorPlugin::get_resource_previewer); - ClassDB::bind_method(D_METHOD("get_resource_filesystem:EditorFileSystem"), &EditorPlugin::get_resource_file_system); + ClassDB::bind_method(D_METHOD("get_resource_previewer"), &EditorPlugin::get_resource_previewer); + ClassDB::bind_method(D_METHOD("get_resource_filesystem"), &EditorPlugin::get_resource_file_system); ClassDB::bind_method(D_METHOD("inspect_object", "object", "for_property"), &EditorPlugin::inspect_object, DEFVAL(String())); ClassDB::bind_method(D_METHOD("update_canvas"), &EditorPlugin::update_canvas); - ClassDB::bind_method(D_METHOD("make_bottom_panel_item_visible", "item:Control"), &EditorPlugin::make_bottom_panel_item_visible); + ClassDB::bind_method(D_METHOD("make_bottom_panel_item_visible", "item"), &EditorPlugin::make_bottom_panel_item_visible); ClassDB::bind_method(D_METHOD("hide_bottom_panel"), &EditorPlugin::hide_bottom_panel); - ClassDB::bind_method(D_METHOD("get_base_control:Control"), &EditorPlugin::get_base_control); - ClassDB::bind_method(D_METHOD("get_undo_redo:UndoRedo"), &EditorPlugin::_get_undo_redo); - ClassDB::bind_method(D_METHOD("get_selection:EditorSelection"), &EditorPlugin::get_selection); - ClassDB::bind_method(D_METHOD("get_editor_settings:EditorSettings"), &EditorPlugin::get_editor_settings); - ClassDB::bind_method(D_METHOD("get_script_editor:ScriptEditor"), &EditorPlugin::get_script_editor); + ClassDB::bind_method(D_METHOD("get_base_control"), &EditorPlugin::get_base_control); + ClassDB::bind_method(D_METHOD("get_undo_redo"), &EditorPlugin::_get_undo_redo); + ClassDB::bind_method(D_METHOD("get_selection"), &EditorPlugin::get_selection); + ClassDB::bind_method(D_METHOD("get_editor_settings"), &EditorPlugin::get_editor_settings); + ClassDB::bind_method(D_METHOD("get_script_editor"), &EditorPlugin::get_script_editor); ClassDB::bind_method(D_METHOD("queue_save_layout"), &EditorPlugin::queue_save_layout); - ClassDB::bind_method(D_METHOD("edit_resource", "resource:Resource"), &EditorPlugin::edit_resource); + ClassDB::bind_method(D_METHOD("edit_resource", "resource"), &EditorPlugin::edit_resource); ClassDB::bind_method(D_METHOD("open_scene_from_path", "scene_filepath"), &EditorPlugin::open_scene_from_path); ClassDB::bind_method(D_METHOD("reload_scene_from_path", "scene_filepath"), &EditorPlugin::reload_scene_from_path); - ClassDB::bind_method(D_METHOD("add_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::add_import_plugin); - ClassDB::bind_method(D_METHOD("remove_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::remove_import_plugin); + ClassDB::bind_method(D_METHOD("add_import_plugin", "importer"), &EditorPlugin::add_import_plugin); + ClassDB::bind_method(D_METHOD("remove_import_plugin", "importer"), &EditorPlugin::remove_import_plugin); ClassDB::bind_method(D_METHOD("set_input_event_forwarding_always_enabled"), &EditorPlugin::set_input_event_forwarding_always_enabled); ClassDB::bind_method(D_METHOD("get_open_scenes"), &EditorPlugin::get_open_scenes); - ClassDB::bind_method(D_METHOD("get_edited_scene_root:Node"), &EditorPlugin::get_edited_scene_root); + ClassDB::bind_method(D_METHOD("get_edited_scene_root"), &EditorPlugin::get_edited_scene_root); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_draw_over_canvas", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "canvas:Control"))); diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index 63bee33092..712a3ac001 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -193,15 +193,16 @@ EditorPluginSettings::EditorPluginSettings() { plugin_list->set_column_expand(1, false); plugin_list->set_column_expand(2, false); plugin_list->set_column_expand(3, false); - plugin_list->set_column_min_width(1, 100); - plugin_list->set_column_min_width(2, 250); - plugin_list->set_column_min_width(3, 80); + plugin_list->set_column_min_width(1, 100 * EDSCALE); + plugin_list->set_column_min_width(2, 250 * EDSCALE); + plugin_list->set_column_min_width(3, 80 * EDSCALE); plugin_list->set_hide_root(true); plugin_list->connect("item_edited", this, "_plugin_activity_changed"); - MarginContainer *mc = memnew(MarginContainer); + VBoxContainer *mc = memnew(VBoxContainer); mc->add_child(plugin_list); mc->set_v_size_flags(SIZE_EXPAND_FILL); + mc->set_h_size_flags(SIZE_EXPAND_FILL); add_child(mc); diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 64cf275c3a..78bc99caae 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -129,10 +129,11 @@ String EditorProfiler::_get_time_as_text(Metric &m, float p_time, int p_calls) { Color EditorProfiler::_get_color_from_signature(const StringName &p_signature) const { + Color bc = get_color("error_color", "Editor"); double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF)); Color c; - c.set_hsv(rot, 1, 1); - return c; + c.set_hsv(rot, bc.get_s(), bc.get_v()); + return c.linear_interpolate(get_color("base_color", "Editor"), 0.07); } void EditorProfiler::_item_edited() { @@ -387,7 +388,6 @@ void EditorProfiler::_update_frame() { if (plot_sigs.has(m.categories[i].signature)) { category->set_checked(0, true); - category->set_custom_bg_color(0, Color(0, 0, 0)); category->set_custom_color(0, _get_color_from_signature(m.categories[i].signature)); } @@ -411,7 +411,6 @@ void EditorProfiler::_update_frame() { if (plot_sigs.has(it.signature)) { item->set_checked(0, true); - item->set_custom_bg_color(0, Color(0, 0, 0)); item->set_custom_color(0, _get_color_from_signature(it.signature)); } } diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 89fa004eb1..dcfe68b286 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -295,7 +295,7 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource> &p preview_mutex->lock(); - String path_id = "ID:" + itos(p_res->get_instance_ID()); + String path_id = "ID:" + itos(p_res->get_instance_id()); if (cache.has(path_id) && cache[path_id].last_hash == p_res->hash_edited_version()) { @@ -310,7 +310,7 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource> &p //print_line("send to thread "+p_path); QueueItem item; item.function = p_receiver_func; - item.id = p_receiver->get_instance_ID(); + item.id = p_receiver->get_instance_id(); item.resource = p_res; item.path = path_id; item.userdata = p_userdata; @@ -334,7 +334,7 @@ void EditorResourcePreview::queue_resource_preview(const String &p_path, Object //print_line("send to thread "+p_path); QueueItem item; item.function = p_receiver_func; - item.id = p_receiver->get_instance_ID(); + item.id = p_receiver->get_instance_id(); item.path = p_path; item.userdata = p_userdata; @@ -362,10 +362,10 @@ void EditorResourcePreview::_bind_methods() { ClassDB::bind_method("_preview_ready", &EditorResourcePreview::_preview_ready); - ClassDB::bind_method(D_METHOD("queue_resource_preview", "path", "receiver", "receiver_func", "userdata:Variant"), &EditorResourcePreview::queue_resource_preview); - ClassDB::bind_method(D_METHOD("queue_edited_resource_preview", "resource:Resource", "receiver", "receiver_func", "userdata:Variant"), &EditorResourcePreview::queue_edited_resource_preview); - ClassDB::bind_method(D_METHOD("add_preview_generator", "generator:EditorResourcePreviewGenerator"), &EditorResourcePreview::add_preview_generator); - ClassDB::bind_method(D_METHOD("remove_preview_generator", "generator:EditorResourcePreviewGenerator"), &EditorResourcePreview::remove_preview_generator); + ClassDB::bind_method(D_METHOD("queue_resource_preview", "path", "receiver", "receiver_func", "userdata"), &EditorResourcePreview::queue_resource_preview); + ClassDB::bind_method(D_METHOD("queue_edited_resource_preview", "resource", "receiver", "receiver_func", "userdata"), &EditorResourcePreview::queue_edited_resource_preview); + ClassDB::bind_method(D_METHOD("add_preview_generator", "generator"), &EditorResourcePreview::add_preview_generator); + ClassDB::bind_method(D_METHOD("remove_preview_generator", "generator"), &EditorResourcePreview::remove_preview_generator); ClassDB::bind_method(D_METHOD("check_for_invalidation", "path"), &EditorResourcePreview::check_for_invalidation); ADD_SIGNAL(MethodInfo("preview_invalidated", PropertyInfo(Variant::STRING, "path"))); diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp index aa97dd237b..4954b1f741 100644 --- a/editor/editor_run.cpp +++ b/editor/editor_run.cpp @@ -55,7 +55,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li } args.push_back("-epid"); - args.push_back(String::num(OS::get_singleton()->get_process_ID())); + args.push_back(String::num(OS::get_singleton()->get_process_id())); if (debug_collisions) { args.push_back("-debugcol"); diff --git a/editor/editor_run_script.cpp b/editor/editor_run_script.cpp index 0e980b040e..8bd1b8f4fd 100644 --- a/editor/editor_run_script.cpp +++ b/editor/editor_run_script.cpp @@ -81,8 +81,8 @@ void EditorScript::set_editor(EditorNode *p_editor) { void EditorScript::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_root_node", "node:Node"), &EditorScript::add_root_node); - ClassDB::bind_method(D_METHOD("get_scene:Node"), &EditorScript::get_scene); + ClassDB::bind_method(D_METHOD("add_root_node", "node"), &EditorScript::add_root_node); + ClassDB::bind_method(D_METHOD("get_scene"), &EditorScript::get_scene); BIND_VMETHOD(MethodInfo("_run")); } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 755ac75180..07af60d634 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -216,17 +216,43 @@ Variant _EDITOR_DEF(const String &p_var, const Variant &p_default) { return p_default; } +static Dictionary _get_builtin_script_templates() { + Dictionary templates; + + //No Comments + templates["no_comments.gd"] = + "extends %BASE%\n" + "\n" + "func _ready():\n" + "%TS%pass\n"; + + //Empty + templates["empty.gd"] = + "extends %BASE%" + "\n" + "\n"; + + return templates; +} + static void _create_script_templates(const String &p_path) { - FileAccess *file = FileAccess::open(p_path.plus_file("no_comments.gd"), FileAccess::WRITE); - ERR_FAIL_COND(!file); - String script = String("extends %BASE%\n\nfunc _ready():\n%TS%pass\n"); - file->store_string(script); - file->close(); - file->reopen(p_path.plus_file("empty.gd"), FileAccess::WRITE); - script = "extends %BASE%\n\n"; - file->store_string(script); - file->close(); + Dictionary templates = _get_builtin_script_templates(); + List<Variant> keys; + templates.get_key_list(&keys); + FileAccess *file = FileAccess::create(FileAccess::ACCESS_FILESYSTEM); + + DirAccess *dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + dir->change_dir(p_path); + for (int i = 0; i < keys.size(); i++) { + if (!dir->file_exists(keys[i])) { + file->reopen(p_path.plus_file((String)keys[i]), FileAccess::WRITE); + ERR_FAIL_COND(!file); + file->store_string(templates[keys[i]]); + file->close(); + } + } + memdelete(file); } @@ -308,10 +334,10 @@ void EditorSettings::create() { if (dir->change_dir("script_templates") != OK) { dir->make_dir("script_templates"); - _create_script_templates(dir->get_current_dir() + "/script_templates"); } else { dir->change_dir(".."); } + _create_script_templates(dir->get_current_dir() + "/script_templates"); if (dir->change_dir("tmp") != OK) { dir->make_dir("tmp"); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index df16de947e..156f00f6a3 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -143,7 +143,7 @@ Ref<Theme> create_editor_theme() { Color light_color_1 = base_color.linear_interpolate(Color(1, 1, 1, 1), contrast); Color light_color_2 = base_color.linear_interpolate(Color(1, 1, 1, 1), contrast * 1.5); - const int border_width = (border_size % 3) * EDSCALE; + const int border_width = CLAMP(border_size, 0, 3) * EDSCALE; Color title_color_hl = base_color; if (highlight_tabs) @@ -163,7 +163,7 @@ Ref<Theme> create_editor_theme() { theme->set_color("light_color_1", "Editor", light_color_1); theme->set_color("light_color_2", "Editor", light_color_2); - Color success_color = highlight_color.linear_interpolate(Color(0, 1, .8), 0.8); + Color success_color = highlight_color.linear_interpolate(Color(.6, 1, .6), 0.8); Color warning_color = highlight_color.linear_interpolate(Color(1, 1, .2), 0.8); Color error_color = highlight_color.linear_interpolate(Color(1, .2, .2), 0.8); theme->set_color("success_color", "Editor", success_color); @@ -238,7 +238,7 @@ Ref<Theme> create_editor_theme() { theme->set_stylebox("panel", "TabContainer", style_content_panel); theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp); - Ref<StyleBoxFlat> style_button_type = make_flat_stylebox(dark_color_1, 4, 4, 6, 4); + Ref<StyleBoxFlat> style_button_type = make_flat_stylebox(dark_color_1, 6, 4, 6, 4); style_button_type->set_draw_center(true); style_button_type->set_border_size(border_width); style_button_type->set_light_color(light_color_1); @@ -287,12 +287,12 @@ Ref<Theme> create_editor_theme() { // PopupMenu Ref<StyleBoxFlat> style_popup_menu = make_flat_stylebox(dark_color_1, 8, 8, 8, 8); - style_popup_menu->set_border_size(border_width); + style_popup_menu->set_border_size(MAX(EDSCALE, border_width)); style_popup_menu->set_light_color(light_color_1); style_popup_menu->set_dark_color(light_color_1); style_popup_menu->set_border_blend(false); theme->set_stylebox("panel", "PopupMenu", style_popup_menu); - theme->set_stylebox("separator", "PopupMenu", make_line_stylebox(separator_color, border_width, 8 - border_width)); + theme->set_stylebox("separator", "PopupMenu", make_line_stylebox(separator_color, MAX(EDSCALE, border_width), 8 - MAX(EDSCALE, border_width))); // Tree & ItemList background Ref<StyleBoxFlat> style_tree_bg = make_flat_stylebox(dark_color_1, 2, 4, 2, 4); @@ -382,12 +382,12 @@ Ref<Theme> create_editor_theme() { theme->set_stylebox("SceneTabBG", "EditorStyles", make_empty_stylebox(6, 5, 6, 5)); theme->set_icon("close", "Tabs", title_hl_close_icon); - // Separatos (no separatos) + // Separators (no separators) theme->set_stylebox("separator", "HSeparator", make_line_stylebox(separator_color, border_width)); theme->set_stylebox("separator", "VSeparator", make_line_stylebox(separator_color, border_width, 0, true)); // Debugger - Ref<StyleBoxFlat> style_panel_debugger = make_flat_stylebox(dark_color_2, 0, 4, 0, 0); + Ref<StyleBoxFlat> style_panel_debugger = make_flat_stylebox(dark_color_2, 4, 4, 4, 4); theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger); Ref<StyleBoxFlat> style_tab_fg_debugger = make_flat_stylebox(dark_color_2, 10, 5, 10, 5); @@ -431,7 +431,7 @@ Ref<Theme> create_editor_theme() { // WindowDialog Ref<StyleBoxFlat> style_window = make_flat_stylebox(dark_color_2, 4, 4, 4, 4); - style_window->set_border_size(border_width); + style_window->set_border_size(MAX(EDSCALE, border_width)); style_window->set_border_blend(false); style_window->set_light_color(title_color_hl); style_window->set_dark_color(title_color_hl); @@ -478,6 +478,9 @@ Ref<Theme> create_editor_theme() { theme->set_icon("grabber", "VSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons")); theme->set_icon("grabber_highlight", "VSlider", theme->get_icon("GuiSliderGrabberHl", "EditorIcons")); + //RichTextLabel + theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox()); + // Panel theme->set_stylebox("panel", "Panel", style_panel); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 77ca1a5145..8e40850a0c 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -102,7 +102,7 @@ void FileSystemDock::_notification(int p_what) { case NOTIFICATION_RESIZED: { - bool new_mode = get_size().height < get_viewport_rect().size.height * 3 / 4; + bool new_mode = get_size().height < get_viewport_rect().size.height / 2; if (new_mode != split_mode) { @@ -589,7 +589,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_in_tree()) { + if (display_mode == DISPLAY_THUMBNAILS && 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++) { @@ -1737,7 +1737,6 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { file_list_vb->set_v_size_flags(SIZE_EXPAND_FILL); path_hb = memnew(HBoxContainer); - path_hb->add_child(memnew(Control)); file_list_vb->add_child(path_hb); button_back = memnew(ToolButton); diff --git a/editor/icons/2x/icon_audio_stream_player_3_d.png b/editor/icons/2x/icon_audio_stream_player_3_d.png Binary files differnew file mode 100644 index 0000000000..917719f54b --- /dev/null +++ b/editor/icons/2x/icon_audio_stream_player_3_d.png diff --git a/editor/icons/2x/icon_bus_vu_frozen.png b/editor/icons/2x/icon_bus_vu_frozen.png Binary files differindex 367322b21c..94d5d335d6 100644 --- a/editor/icons/2x/icon_bus_vu_frozen.png +++ b/editor/icons/2x/icon_bus_vu_frozen.png diff --git a/editor/icons/2x/icon_connect.png b/editor/icons/2x/icon_connect.png Binary files differindex e3f4b8fd12..2a36b1716a 100644 --- a/editor/icons/2x/icon_connect.png +++ b/editor/icons/2x/icon_connect.png diff --git a/editor/icons/2x/icon_native_script.png b/editor/icons/2x/icon_native_script.png Binary files differnew file mode 100644 index 0000000000..31cc130867 --- /dev/null +++ b/editor/icons/2x/icon_native_script.png diff --git a/editor/icons/icon_audio_stream_player_3_d.png b/editor/icons/icon_audio_stream_player_3_d.png Binary files differnew file mode 100644 index 0000000000..60e3528ffd --- /dev/null +++ b/editor/icons/icon_audio_stream_player_3_d.png diff --git a/editor/icons/icon_bus_vu_frozen.png b/editor/icons/icon_bus_vu_frozen.png Binary files differindex 1a6ca6e767..4e9b8f4b4b 100644 --- a/editor/icons/icon_bus_vu_frozen.png +++ b/editor/icons/icon_bus_vu_frozen.png diff --git a/editor/icons/icon_connect.png b/editor/icons/icon_connect.png Binary files differindex 51615838a9..0963063bed 100644 --- a/editor/icons/icon_connect.png +++ b/editor/icons/icon_connect.png diff --git a/editor/icons/icon_native_script.png b/editor/icons/icon_native_script.png Binary files differnew file mode 100644 index 0000000000..ea4fe06704 --- /dev/null +++ b/editor/icons/icon_native_script.png diff --git a/editor/icons/source/icon_audio_stream_player_3_d.svg b/editor/icons/source/icon_audio_stream_player_3_d.svg new file mode 100644 index 0000000000..1858f8fe33 --- /dev/null +++ b/editor/icons/source/icon_audio_stream_player_3_d.svg @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + viewBox="0 0 16 16" + id="svg2" + version="1.1" + inkscape:version="0.92+devel unknown" + inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png" + inkscape:export-xdpi="45" + inkscape:export-ydpi="45" + sodipodi:docname="icon_audio_stream_player_3_d.svg"> + <defs + id="defs4"> + <linearGradient + id="linearGradient959-5" + inkscape:collect="always"> + <stop + style="stop-color:#ff8484;stop-opacity:1" + offset="0" + id="stop957-3" /> + <stop + id="stop955-5" + offset="0.5" + style="stop-color:#e1dc7a;stop-opacity:1" /> + <stop + style="stop-color:#84ffb1;stop-opacity:1" + offset="1" + id="stop953-6" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient959-5" + id="linearGradient4552" + x1="8" + y1="1" + x2="8" + y2="15" + gradientUnits="userSpaceOnUse" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="11.313709" + inkscape:cx="-0.23400447" + inkscape:cy="10.117538" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="false" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1920" + inkscape:window-height="1016" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:snap-midpoints="true" + inkscape:snap-smooth-nodes="true" + inkscape:object-nodes="true" + inkscape:document-rotation="0"> + <inkscape:grid + type="xygrid" + id="grid3336" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1036.3622)"> + <path + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#fc9c9c;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.97227669;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + d="m 10.023235,1044.3625 c -0.5613918,-0.013 -1.0235345,0.4264 -1.0234377,0.9724 v 5.0542 c 6.911e-4,0.7482 0.8336124,1.2154 1.4999997,0.8414 l 4,-2.5262 c 0.666937,-0.3743 0.666937,-1.3104 0,-1.6847 l -4,-2.5261 c -0.145049,-0.082 -0.308928,-0.1269 -0.476562,-0.131 z" + id="path4507" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccccc" /> + <path + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:url(#linearGradient4552);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + d="M 11.970703 1.0019531 A 1.0001 1.0001 0 0 0 11.724609 1.0390625 L 4.7246094 3.0390625 A 1.0001 1.0001 0 0 0 4 4 L 4 9.5507812 A 2.5 2.4999914 0 0 0 3.5 9.5 A 2.5 2.4999914 0 0 0 1 12 A 2.5 2.4999914 0 0 0 3.5 14.5 A 2.5 2.4999914 0 0 0 5.9960938 12.087891 A 1.0001 1.0001 0 0 0 6 12 L 6 4.7558594 L 11 3.328125 L 11 6.5 L 13 5.5 L 13 2 A 1.0001 1.0001 0 0 0 11.970703 1.0019531 z " + transform="translate(0,1036.3622)" + id="path4514" /> + </g> +</svg> diff --git a/editor/icons/source/icon_bus_vu_frozen.svg b/editor/icons/source/icon_bus_vu_frozen.svg index 0324076402..40577a1a77 100644 --- a/editor/icons/source/icon_bus_vu_frozen.svg +++ b/editor/icons/source/icon_bus_vu_frozen.svg @@ -15,7 +15,7 @@ viewBox="0 0 16 128" id="svg2" version="1.1" - inkscape:version="0.92.1 r" + inkscape:version="0.92+devel unknown" inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_vu_empty.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" @@ -56,8 +56,8 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="5.6568543" - inkscape:cx="9.4951314" - inkscape:cy="71.853257" + inkscape:cx="14.809902" + inkscape:cy="65.349668" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -69,8 +69,8 @@ inkscape:snap-bbox-midpoints="true" inkscape:snap-object-midpoints="true" inkscape:snap-center="true" - inkscape:window-width="1600" - inkscape:window-height="836" + inkscape:window-width="1920" + inkscape:window-height="1016" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" @@ -78,7 +78,8 @@ inkscape:snap-intersection-paths="false" inkscape:object-nodes="false" inkscape:snap-smooth-nodes="false" - inkscape:snap-midpoints="false"> + inkscape:snap-midpoints="false" + inkscape:document-rotation="0"> <inkscape:grid type="xygrid" id="grid3336" @@ -92,7 +93,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> + <dc:title /> </cc:Work> </rdf:RDF> </metadata> @@ -102,7 +103,7 @@ id="layer1" transform="translate(0,-924.3622)"> <path - style="fill:url(#linearGradient951);fill-opacity:1;stroke:none;stroke-width:1.28571427;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:url(#linearGradient951);fill-opacity:1;stroke:none;stroke-width:1.28571427;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:0.7" d="M 3 2 C 2.4459952 2 2 2.4459952 2 3 C 2 3.5540048 2.4459952 4 3 4 L 13 4 C 13.554005 4 14 3.5540048 14 3 C 14 2.4459952 13.554005 2 13 2 L 3 2 z M 3 5 C 2.4459952 5 2 5.4459952 2 6 C 2 6.5540048 2.4459952 7 3 7 L 13 7 C 13.554005 7 14 6.5540048 14 6 C 14 5.4459952 13.554005 5 13 5 L 3 5 z M 3 8 C 2.4459952 8 2 8.4459952 2 9 C 2 9.5540048 2.4459952 10 3 10 L 13 10 C 13.554005 10 14 9.5540048 14 9 C 14 8.4459952 13.554005 8 13 8 L 3 8 z M 3 11 C 2.4459952 11 2 11.445995 2 12 C 2 12.554005 2.4459952 13 3 13 L 13 13 C 13.554005 13 14 12.554005 14 12 C 14 11.445995 13.554005 11 13 11 L 3 11 z M 3 14 C 2.4459952 14 2 14.445995 2 15 C 2 15.554005 2.4459952 16 3 16 L 13 16 C 13.554005 16 14 15.554005 14 15 C 14 14.445995 13.554005 14 13 14 L 3 14 z M 3 17 C 2.4459952 17 2 17.445995 2 18 C 2 18.554005 2.4459952 19 3 19 L 13 19 C 13.554005 19 14 18.554005 14 18 C 14 17.445995 13.554005 17 13 17 L 3 17 z M 3 20 C 2.4459952 20 2 20.445995 2 21 C 2 21.554005 2.4459952 22 3 22 L 13 22 C 13.554005 22 14 21.554005 14 21 C 14 20.445995 13.554005 20 13 20 L 3 20 z M 3 23 C 2.4459952 23 2 23.445995 2 24 C 2 24.554005 2.4459952 25 3 25 L 13 25 C 13.554005 25 14 24.554005 14 24 C 14 23.445995 13.554005 23 13 23 L 3 23 z M 3 26 C 2.4459952 26 2 26.445995 2 27 C 2 27.554005 2.4459952 28 3 28 L 13 28 C 13.554005 28 14 27.554005 14 27 C 14 26.445995 13.554005 26 13 26 L 3 26 z M 3 31 C 2.4459952 31 2 31.445995 2 32 C 2 32.554005 2.4459952 33 3 33 L 13 33 C 13.554005 33 14 32.554005 14 32 C 14 31.445995 13.554005 31 13 31 L 3 31 z M 3 34 C 2.4459952 34 2 34.445995 2 35 C 2 35.554005 2.4459952 36 3 36 L 13 36 C 13.554005 36 14 35.554005 14 35 C 14 34.445995 13.554005 34 13 34 L 3 34 z M 3 37 C 2.4459952 37 2 37.445995 2 38 C 2 38.554005 2.4459952 39 3 39 L 13 39 C 13.554005 39 14 38.554005 14 38 C 14 37.445995 13.554005 37 13 37 L 3 37 z M 3 40 C 2.4459952 40 2 40.445995 2 41 C 2 41.554005 2.4459952 42 3 42 L 13 42 C 13.554005 42 14 41.554005 14 41 C 14 40.445995 13.554005 40 13 40 L 3 40 z M 3 43 C 2.4459952 43 2 43.445995 2 44 C 2 44.554005 2.4459952 45 3 45 L 13 45 C 13.554005 45 14 44.554005 14 44 C 14 43.445995 13.554005 43 13 43 L 3 43 z M 3 46 C 2.4459952 46 2 46.445995 2 47 C 2 47.554005 2.4459952 48 3 48 L 13 48 C 13.554005 48 14 47.554005 14 47 C 14 46.445995 13.554005 46 13 46 L 3 46 z M 3 49 C 2.4459952 49 2 49.445995 2 50 C 2 50.554005 2.4459952 51 3 51 L 13 51 C 13.554005 51 14 50.554005 14 50 C 14 49.445995 13.554005 49 13 49 L 3 49 z M 3 52 C 2.4459952 52 2 52.445995 2 53 C 2 53.554005 2.4459952 54 3 54 L 13 54 C 13.554005 54 14 53.554005 14 53 C 14 52.445995 13.554005 52 13 52 L 3 52 z M 3 55 C 2.4459952 55 2 55.445995 2 56 C 2 56.554005 2.4459952 57 3 57 L 13 57 C 13.554005 57 14 56.554005 14 56 C 14 55.445995 13.554005 55 13 55 L 3 55 z M 3 58 C 2.4459952 58 2 58.445995 2 59 C 2 59.554005 2.4459952 60 3 60 L 13 60 C 13.554005 60 14 59.554005 14 59 C 14 58.445995 13.554005 58 13 58 L 3 58 z M 3 61 C 2.4459952 61 2 61.445995 2 62 C 2 62.554005 2.4459952 63 3 63 L 13 63 C 13.554005 63 14 62.554005 14 62 C 14 61.445995 13.554005 61 13 61 L 3 61 z M 3 64 C 2.4459952 64 2 64.445995 2 65 C 2 65.554005 2.4459952 66 3 66 L 13 66 C 13.554005 66 14 65.554005 14 65 C 14 64.445995 13.554005 64 13 64 L 3 64 z M 3 67 C 2.4459952 67 2 67.445995 2 68 C 2 68.554005 2.4459952 69 3 69 L 13 69 C 13.554005 69 14 68.554005 14 68 C 14 67.445995 13.554005 67 13 67 L 3 67 z M 3 70 C 2.4459952 70 2 70.445995 2 71 C 2 71.554005 2.4459952 72 3 72 L 13 72 C 13.554005 72 14 71.554005 14 71 C 14 70.445995 13.554005 70 13 70 L 3 70 z M 3 73 C 2.4459952 73 2 73.445995 2 74 C 2 74.554005 2.4459952 75 3 75 L 13 75 C 13.554005 75 14 74.554005 14 74 C 14 73.445995 13.554005 73 13 73 L 3 73 z M 3 76 C 2.4459952 76 2 76.445995 2 77 C 2 77.554005 2.4459952 78 3 78 L 13 78 C 13.554005 78 14 77.554005 14 77 C 14 76.445995 13.554005 76 13 76 L 3 76 z M 3 79 C 2.4459952 79 2 79.445995 2 80 C 2 80.554005 2.4459952 81 3 81 L 13 81 C 13.554005 81 14 80.554005 14 80 C 14 79.445995 13.554005 79 13 79 L 3 79 z M 3 82 C 2.4459952 82 2 82.445995 2 83 C 2 83.554005 2.4459952 84 3 84 L 13 84 C 13.554005 84 14 83.554005 14 83 C 14 82.445995 13.554005 82 13 82 L 3 82 z M 3 85 C 2.4459952 85 2 85.445995 2 86 C 2 86.554005 2.4459952 87 3 87 L 13 87 C 13.554005 87 14 86.554005 14 86 C 14 85.445995 13.554005 85 13 85 L 3 85 z M 3 88 C 2.4459952 88 2 88.445995 2 89 C 2 89.554005 2.4459952 90 3 90 L 13 90 C 13.554005 90 14 89.554005 14 89 C 14 88.445995 13.554005 88 13 88 L 3 88 z M 3 91 C 2.4459952 91 2 91.445995 2 92 C 2 92.554005 2.4459952 93 3 93 L 13 93 C 13.554005 93 14 92.554005 14 92 C 14 91.445995 13.554005 91 13 91 L 3 91 z M 3 94 C 2.4459952 94 2 94.445995 2 95 C 2 95.554005 2.4459952 96 3 96 L 13 96 C 13.554005 96 14 95.554005 14 95 C 14 94.445995 13.554005 94 13 94 L 3 94 z M 3 97 C 2.4459952 97 2 97.445995 2 98 C 2 98.554005 2.4459952 99 3 99 L 13 99 C 13.554005 99 14 98.554005 14 98 C 14 97.445995 13.554005 97 13 97 L 3 97 z M 3 100 C 2.4459952 100 2 100.446 2 101 C 2 101.554 2.4459952 102 3 102 L 13 102 C 13.554005 102 14 101.554 14 101 C 14 100.446 13.554005 100 13 100 L 3 100 z M 3 103 C 2.4459952 103 2 103.446 2 104 C 2 104.554 2.4459952 105 3 105 L 13 105 C 13.554005 105 14 104.554 14 104 C 14 103.446 13.554005 103 13 103 L 3 103 z M 3 106 C 2.4459952 106 2 106.446 2 107 C 2 107.554 2.4459952 108 3 108 L 13 108 C 13.554005 108 14 107.554 14 107 C 14 106.446 13.554005 106 13 106 L 3 106 z M 3 109 C 2.4459952 109 2 109.446 2 110 C 2 110.554 2.4459952 111 3 111 L 13 111 C 13.554005 111 14 110.554 14 110 C 14 109.446 13.554005 109 13 109 L 3 109 z M 3 112 C 2.4459952 112 2 112.446 2 113 C 2 113.554 2.4459952 114 3 114 L 13 114 C 13.554005 114 14 113.554 14 113 C 14 112.446 13.554005 112 13 112 L 3 112 z M 3 115 C 2.4459952 115 2 115.446 2 116 C 2 116.554 2.4459952 117 3 117 L 13 117 C 13.554005 117 14 116.554 14 116 C 14 115.446 13.554005 115 13 115 L 3 115 z M 3 118 C 2.4459952 118 2 118.446 2 119 C 2 119.554 2.4459952 120 3 120 L 13 120 C 13.554005 120 14 119.554 14 119 C 14 118.446 13.554005 118 13 118 L 3 118 z M 3 121 C 2.4459952 121 2 121.446 2 122 C 2 122.554 2.4459952 123 3 123 L 13 123 C 13.554005 123 14 122.554 14 122 C 14 121.446 13.554005 121 13 121 L 3 121 z M 3 124 C 2.4459952 124 2 124.446 2 125 C 2 125.554 2.4459952 126 3 126 L 13 126 C 13.554005 126 14 125.554 14 125 C 14 124.446 13.554005 124 13 124 L 3 124 z " id="rect852" transform="translate(0,924.3622)" /> diff --git a/editor/icons/source/icon_g_d_native_script.svg b/editor/icons/source/icon_native_script.svg index 33a8e52a5d..33a8e52a5d 100644 --- a/editor/icons/source/icon_g_d_native_script.svg +++ b/editor/icons/source/icon_native_script.svg diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index 8cb712cb78..07f1f4dd9f 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -123,6 +123,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s int format_channels = 0; AudioStreamSample::LoopMode loop = AudioStreamSample::LOOP_DISABLED; + uint16_t compression_code = 1; bool format_found = false; bool data_found = false; int format_freq = 0; @@ -151,11 +152,10 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s if (chunkID[0] == 'f' && chunkID[1] == 'm' && chunkID[2] == 't' && chunkID[3] == ' ' && !format_found) { /* IS FORMAT CHUNK */ - uint16_t compression_code = file->get_16(); - //Issue: #7755 : Not a bug - usage of other formats (format codes) are unsupported in current importer version. //Consider revision for engine version 3.0 - if (compression_code != 1) { + compression_code = file->get_16(); + if (compression_code != 1 && compression_code != 3) { ERR_PRINT("Format not supported for WAVE file (not PCM). Save WAVE files as uncompressed PCM instead."); break; } @@ -210,33 +210,37 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s data.resize(frames * format_channels); - for (int i = 0; i < frames; i++) { - - for (int c = 0; c < format_channels; c++) { - - if (format_bits == 8) { - // 8 bit samples are UNSIGNED - - uint8_t s = file->get_8(); - s -= 128; - int8_t *sp = (int8_t *)&s; + if (format_bits == 8) { + for (int i = 0; i < frames * format_channels; i++) { + // 8 bit samples are UNSIGNED - data[i * format_channels + c] = float(*sp) / 128.0; + data[i] = int8_t(file->get_8() - 128) / 128.f; + } + } else if (format_bits == 32 && compression_code == 3) { + for (int i = 0; i < frames * format_channels; i++) { + //32 bit IEEE Float - } else { - //16+ bits samples are SIGNED - // if sample is > 16 bits, just read extra bytes + data[i] = file->get_float(); + } + } else if (format_bits == 16) { + for (int i = 0; i < frames * format_channels; i++) { + //16 bit SIGNED - uint32_t s = 0; - for (int b = 0; b < (format_bits >> 3); b++) { + data[i] = int16_t(file->get_16()) / 32768.f; + } + } else { + for (int i = 0; i < frames * format_channels; i++) { + //16+ bits samples are SIGNED + // if sample is > 16 bits, just read extra bytes - s |= ((uint32_t)file->get_8()) << (b * 8); - } - s <<= (32 - format_bits); - int32_t ss = s; + uint32_t s = 0; + for (int b = 0; b < (format_bits >> 3); b++) { - data[i * format_channels + c] = (ss >> 16) / 32768.0; + s |= ((uint32_t)file->get_8()) << (b * 8); } + s <<= (32 - format_bits); + + data[i] = (int32_t(s) >> 16) / 32768.f; } } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index a809a68c23..ac6d78adc2 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -375,6 +375,8 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) { int idx = skeleton_menu->get_item_index(SKELETON_SHOW_BONES); skeleton_menu->set_item_checked(idx, skeleton_show_bones); } + + viewport->update(); } void CanvasItemEditor::_add_canvas_item(CanvasItem *p_canvas_item) { @@ -385,7 +387,7 @@ void CanvasItemEditor::_add_canvas_item(CanvasItem *p_canvas_item) { return; canvas_items.insert(p_canvas_item,p_info); - p_canvas_item->connect("hide",this,"_visibility_changed",varray(p_canvas_item->get_instance_ID()),CONNECT_ONESHOT); + p_canvas_item->connect("hide",this,"_visibility_changed",varray(p_canvas_item->get_instance_id()),CONNECT_ONESHOT); #endif } @@ -1390,7 +1392,12 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { while ((n && n != scene && n->get_owner() != scene) || (n && !n->is_class("CanvasItem"))) { n = n->get_parent(); }; - c = n->cast_to<CanvasItem>(); + + if (n) { + c = n->cast_to<CanvasItem>(); + } else { + c = NULL; + } // Select the item additive_selection = b->get_shift(); @@ -2204,7 +2211,7 @@ void CanvasItemEditor::_find_canvas_items_span(Node *p_node, Rect2 &r_rect, cons if (c->has_meta("_edit_bone_")) { - ObjectID id = c->get_instance_ID(); + ObjectID id = c->get_instance_id(); if (!bone_list.has(id)) { BoneList bone; bone.bone = id; @@ -2769,7 +2776,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { pc.pos = n2d->get_position(); pc.rot = n2d->get_rotation(); pc.scale = n2d->get_scale(); - pc.id = n2d->get_instance_ID(); + pc.id = n2d->get_instance_id(); pose_clipboard.push_back(pc); } } diff --git a/editor/plugins/item_list_editor_plugin.h b/editor/plugins/item_list_editor_plugin.h index 4fed8e49f5..bc009b3d7a 100644 --- a/editor/plugins/item_list_editor_plugin.h +++ b/editor/plugins/item_list_editor_plugin.h @@ -116,8 +116,8 @@ public: virtual void set_item_enabled(int p_idx, int p_enabled) { ob->set_item_disabled(p_idx, !p_enabled); } virtual bool is_item_enabled(int p_idx) const { return !ob->is_item_disabled(p_idx); } - virtual void set_item_id(int p_idx, int p_id) { ob->set_item_ID(p_idx, p_id); } - virtual int get_item_id(int p_idx) const { return ob->get_item_ID(p_idx); } + virtual void set_item_id(int p_idx, int p_id) { ob->set_item_id(p_idx, p_id); } + virtual int get_item_id(int p_idx) const { return ob->get_item_id(p_idx); } virtual void add_item(); virtual int get_item_count() const; @@ -152,8 +152,8 @@ public: virtual void set_item_enabled(int p_idx, int p_enabled) { pp->set_item_disabled(p_idx, !p_enabled); } virtual bool is_item_enabled(int p_idx) const { return !pp->is_item_disabled(p_idx); } - virtual void set_item_id(int p_idx, int p_id) { pp->set_item_ID(p_idx, p_idx); } - virtual int get_item_id(int p_idx) const { return pp->get_item_ID(p_idx); } + virtual void set_item_id(int p_idx, int p_id) { pp->set_item_id(p_idx, p_idx); } + virtual int get_item_id(int p_idx) const { return pp->get_item_id(p_idx); } virtual void set_item_separator(int p_idx, bool p_separator) { pp->set_item_as_separator(p_idx, p_separator); } virtual bool is_item_separator(int p_idx) const { return pp->is_item_separator(p_idx); } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 77c540b746..1873a3f58b 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -211,9 +211,11 @@ void ScriptEditorQuickOpen::_confirmed() { void ScriptEditorQuickOpen::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { - connect("confirmed", this, "_confirmed"); + connect("confirmed", this, "_confirmed"); + } break; } } @@ -1064,58 +1066,73 @@ void ScriptEditor::_tab_changed(int p_which) { void ScriptEditor::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { - - editor->connect("play_pressed", this, "_editor_play"); - editor->connect("pause_pressed", this, "_editor_pause"); - editor->connect("stop_pressed", this, "_editor_stop"); - editor->connect("script_add_function_request", this, "_add_callback"); - editor->connect("resource_saved", this, "_res_saved_callback"); - script_list->connect("item_selected", this, "_script_selected"); - members_overview->connect("item_selected", this, "_members_overview_selected"); - script_split->connect("dragged", this, "_script_split_dragged"); - autosave_timer->connect("timeout", this, "_autosave_scripts"); - { - float autosave_time = EditorSettings::get_singleton()->get("text_editor/files/autosave_interval_secs"); - if (autosave_time > 0) { - autosave_timer->set_wait_time(autosave_time); - autosave_timer->start(); - } else { - autosave_timer->stop(); + switch (p_what) { + + case NOTIFICATION_ENTER_TREE: { + + editor->connect("play_pressed", this, "_editor_play"); + editor->connect("pause_pressed", this, "_editor_pause"); + editor->connect("stop_pressed", this, "_editor_stop"); + editor->connect("script_add_function_request", this, "_add_callback"); + editor->connect("resource_saved", this, "_res_saved_callback"); + script_list->connect("item_selected", this, "_script_selected"); + members_overview->connect("item_selected", this, "_members_overview_selected"); + script_split->connect("dragged", this, "_script_split_dragged"); + autosave_timer->connect("timeout", this, "_autosave_scripts"); + { + float autosave_time = EditorSettings::get_singleton()->get("text_editor/files/autosave_interval_secs"); + if (autosave_time > 0) { + autosave_timer->set_wait_time(autosave_time); + autosave_timer->start(); + } else { + autosave_timer->stop(); + } } - } - EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed"); - help_search->set_icon(get_icon("HelpSearch", "EditorIcons")); - site_search->set_icon(get_icon("Instance", "EditorIcons")); - class_search->set_icon(get_icon("ClassList", "EditorIcons")); + EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed"); + help_search->set_icon(get_icon("HelpSearch", "EditorIcons")); + site_search->set_icon(get_icon("Instance", "EditorIcons")); + class_search->set_icon(get_icon("ClassList", "EditorIcons")); - script_forward->set_icon(get_icon("Forward", "EditorIcons")); - script_back->set_icon(get_icon("Back", "EditorIcons")); - } + script_forward->set_icon(get_icon("Forward", "EditorIcons")); + script_back->set_icon(get_icon("Back", "EditorIcons")); + } break; - if (p_what == NOTIFICATION_READY) { + case NOTIFICATION_READY: { - get_tree()->connect("tree_changed", this, "_tree_changed"); - editor->connect("request_help", this, "_request_help"); - editor->connect("request_help_search", this, "_help_search"); - editor->connect("request_help_index", this, "_help_index"); - } + get_tree()->connect("tree_changed", this, "_tree_changed"); + editor->connect("request_help", this, "_request_help"); + editor->connect("request_help_search", this, "_help_search"); + editor->connect("request_help_index", this, "_help_index"); + } break; - if (p_what == NOTIFICATION_EXIT_TREE) { + case NOTIFICATION_EXIT_TREE: { - editor->disconnect("play_pressed", this, "_editor_play"); - editor->disconnect("pause_pressed", this, "_editor_pause"); - editor->disconnect("stop_pressed", this, "_editor_stop"); - } + editor->disconnect("play_pressed", this, "_editor_play"); + editor->disconnect("pause_pressed", this, "_editor_pause"); + editor->disconnect("stop_pressed", this, "_editor_stop"); + } break; - if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_IN) { + case MainLoop::NOTIFICATION_WM_FOCUS_IN: { - _test_script_times_on_disk(); - _update_modified_scripts_for_external_editor(); - } + _test_script_times_on_disk(); + _update_modified_scripts_for_external_editor(); + } break; + + case NOTIFICATION_PROCESS: { + } break; - if (p_what == NOTIFICATION_PROCESS) { + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + + tab_container->add_style_override("panel", editor->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles")); + + Ref<StyleBox> sb = editor->get_gui_base()->get_stylebox("panel", "TabContainer")->duplicate(); + sb->set_default_margin(MARGIN_TOP, 0); + add_style_override("panel", sb); + } break; + + default: + break; } } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index e3184a028e..62fcc4b489 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -456,7 +456,7 @@ String ScriptTextEditor::get_name() { } else if (script->get_name() != "") name = script->get_name(); else - name = script->get_class() + "(" + itos(script->get_instance_ID()) + ")"; + name = script->get_class() + "(" + itos(script->get_instance_id()) + ")"; return name; } diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 2d77bfb2c1..0dba1f12a2 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -57,6 +57,12 @@ #define FREELOOK_MIN_SPEED 0.1 +#define MIN_Z 0.01 +#define MAX_Z 10000 + +#define MIN_FOV 0.01 +#define MAX_FOV 179 + void SpatialEditorViewport::_update_camera() { if (orthogonal) { //camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar()); @@ -153,26 +159,15 @@ int SpatialEditorViewport::get_selected_count() const { float SpatialEditorViewport::get_znear() const { - float val = spatial_editor->get_znear(); - if (val < 0.001) - val = 0.001; - return val; + return CLAMP(spatial_editor->get_znear(), MIN_Z, MAX_Z); } float SpatialEditorViewport::get_zfar() const { - float val = spatial_editor->get_zfar(); - if (val < 0.001) - val = 0.001; - return val; + return CLAMP(spatial_editor->get_zfar(), MIN_Z, MAX_Z); } float SpatialEditorViewport::get_fov() const { - float val = spatial_editor->get_fov(); - if (val < 0.001) - val = 0.001; - if (val > 89) - val = 89; - return val; + return CLAMP(spatial_editor->get_fov(), MIN_FOV, MAX_FOV); } Transform SpatialEditorViewport::_get_camera_transform() const { @@ -665,7 +660,7 @@ void SpatialEditorViewport::_list_select(Ref<InputEventMouseButton> b) { if (selection_results.size() == 1) { - clicked = selection_results[0].item->get_instance_ID(); + clicked = selection_results[0].item->get_instance_id(); selection_results.clear(); if (clicked) { @@ -1195,17 +1190,47 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { motion = motion_mask.dot(motion) * motion_mask; } + //set_message("Translating: "+motion); + + List<Node *> &selection = editor_selection->get_selected_node_list(); + float snap = 0; if (_edit.snap || spatial_editor->is_snap_enabled()) { snap = spatial_editor->get_translate_snap(); - motion.snap(Vector3(snap, snap, snap)); - } + bool local_coords = spatial_editor->are_local_coords_enabled(); + + if (local_coords) { + bool multiple = false; + Spatial *node = NULL; + for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { + + Spatial *sp = E->get()->cast_to<Spatial>(); + if (!sp) { + continue; + } + if (node) { + multiple = true; + break; + } else { + node = sp; + } + } - //set_message("Translating: "+motion); + if (multiple) { + motion.snap(Vector3(snap, snap, snap)); + } else { + Basis b = node->get_global_transform().basis.orthonormalized(); + Vector3 local_motion = b.inverse().xform(motion); + local_motion.snap(Vector3(snap, snap, snap)); + motion = b.xform(local_motion); + } - List<Node *> &selection = editor_selection->get_selected_node_list(); + } else { + motion.snap(Vector3(snap, snap, snap)); + } + } for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -2166,7 +2191,7 @@ void SpatialEditorViewport::_selection_result_pressed(int p_result) { if (selection_results.size() <= p_result) return; - clicked = selection_results[p_result].item->get_instance_ID(); + clicked = selection_results[p_result].item->get_instance_id(); if (clicked) { _select_clicked(clicked_wants_append, true); @@ -2390,7 +2415,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed view_menu = memnew(MenuButton); surface->add_child(view_menu); - view_menu->set_position(Point2(4, 4)); + view_menu->set_position(Point2(4, 4) * EDSCALE); view_menu->set_self_modulate(Color(1, 1, 1, 0.5)); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/top_view"), VIEW_TOP); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/bottom_view"), VIEW_BOTTOM); @@ -2434,8 +2459,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed preview_camera = memnew(Button); preview_camera->set_toggle_mode(true); - preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, 90); - preview_camera->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10); + preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, 90 * EDSCALE); + preview_camera->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE); preview_camera->set_text("preview"); surface->add_child(preview_camera); preview_camera->hide(); @@ -2455,7 +2480,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed selection_menu = memnew(PopupMenu); add_child(selection_menu); - selection_menu->set_custom_minimum_size(Vector2(100, 0)); + selection_menu->set_custom_minimum_size(Size2(100, 0) * EDSCALE); selection_menu->connect("id_pressed", this, "_selection_result_pressed"); selection_menu->connect("popup_hide", this, "_selection_menu_hide"); @@ -2464,7 +2489,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed viewport->set_as_audio_listener(true); } - name = TTR("Top"); + name = ""; _update_name(); EditorSettings::get_singleton()->connect("settings_changed", this, "update_transform_gizmo_view"); @@ -3039,9 +3064,9 @@ void SpatialEditor::edit(Spatial *p_spatial) { /* if (p_spatial) { _validate_selection(); - if (selected.has(p_spatial->get_instance_ID()) && selected.size()==1) + if (selected.has(p_spatial->get_instance_id()) && selected.size()==1) return; - _select(p_spatial->get_instance_ID(),false,true); + _select(p_spatial->get_instance_id(),false,true); // should become the selection } @@ -3933,27 +3958,27 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { settings_dialog->set_title(TTR("Viewport Settings")); add_child(settings_dialog); settings_vbc = memnew(VBoxContainer); - settings_vbc->set_custom_minimum_size(Size2(200, 0)); + settings_vbc->set_custom_minimum_size(Size2(200, 0) * EDSCALE); settings_dialog->add_child(settings_vbc); //settings_dialog->set_child_rect(settings_vbc); settings_fov = memnew(SpinBox); - settings_fov->set_max(179); - settings_fov->set_min(1); + settings_fov->set_max(MAX_FOV); + settings_fov->set_min(MIN_FOV); settings_fov->set_step(0.01); settings_fov->set_value(EDITOR_DEF("editors/3d/default_fov", 55.0)); settings_vbc->add_margin_child(TTR("Perspective FOV (deg.):"), settings_fov); settings_znear = memnew(SpinBox); - settings_znear->set_max(10000); - settings_znear->set_min(0.1); + settings_znear->set_max(MAX_Z); + settings_znear->set_min(MIN_Z); settings_znear->set_step(0.01); settings_znear->set_value(EDITOR_DEF("editors/3d/default_z_near", 0.1)); settings_vbc->add_margin_child(TTR("View Z-Near:"), settings_znear); settings_zfar = memnew(SpinBox); - settings_zfar->set_max(10000); - settings_zfar->set_min(0.1); + settings_zfar->set_max(MAX_Z); + settings_zfar->set_min(MIN_Z); settings_zfar->set_step(0.01); settings_zfar->set_value(EDITOR_DEF("editors/3d/default_z_far", 1500)); settings_vbc->add_margin_child(TTR("View Z-Far:"), settings_zfar); diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h index 9b626054c0..e9857f8b0c 100644 --- a/editor/plugins/spatial_editor_plugin.h +++ b/editor/plugins/spatial_editor_plugin.h @@ -514,6 +514,8 @@ public: float get_rotate_snap() const { return snap_rotate->get_text().to_double(); } float get_scale_snap() const { return snap_scale->get_text().to_double(); } + bool are_local_coords_enabled() const { return transform_menu->get_popup()->is_item_checked(transform_menu->get_popup()->get_item_index(SpatialEditor::MENU_TRANSFORM_LOCAL_COORDS)); } + Ref<ArrayMesh> get_move_gizmo(int idx) const { return move_gizmo[idx]; } Ref<ArrayMesh> get_rotate_gizmo(int idx) const { return rotate_gizmo[idx]; } diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index f5bb9d4a35..d45a3b1312 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -104,7 +104,7 @@ struct _TECategory { Ref<T> item; StringName name; - bool operator<(const RefItem<T> &p) const { return item->get_instance_ID() < p.item->get_instance_ID(); } + bool operator<(const RefItem<T> &p) const { return item->get_instance_id() < p.item->get_instance_id(); } }; template <class T> diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index e7bc8a4dab..a52a875338 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -1451,6 +1451,11 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { ED_SHORTCUT("tile_map_editor/mirror_x", TTR("Mirror X"), KEY_A); ED_SHORTCUT("tile_map_editor/mirror_y", TTR("Mirror Y"), KEY_S); + HBoxContainer *tool_hb1 = memnew(HBoxContainer); + add_child(tool_hb1); + HBoxContainer *tool_hb2 = memnew(HBoxContainer); + add_child(tool_hb2); + search_box = memnew(LineEdit); search_box->set_h_size_flags(SIZE_EXPAND_FILL); search_box->connect("text_entered", this, "_text_entered"); @@ -1514,47 +1519,44 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { transp->set_tooltip(TTR("Transpose") + " (" + ED_GET_SHORTCUT("tile_map_editor/transpose")->get_as_text() + ")"); transp->set_focus_mode(FOCUS_NONE); transp->connect("pressed", this, "_update_transform_buttons", make_binds(transp)); - toolbar->add_child(transp); + tool_hb1->add_child(transp); mirror_x = memnew(ToolButton); mirror_x->set_toggle_mode(true); mirror_x->set_tooltip(TTR("Mirror X") + " (" + ED_GET_SHORTCUT("tile_map_editor/mirror_x")->get_as_text() + ")"); mirror_x->set_focus_mode(FOCUS_NONE); mirror_x->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_x)); - toolbar->add_child(mirror_x); + tool_hb1->add_child(mirror_x); mirror_y = memnew(ToolButton); mirror_y->set_toggle_mode(true); mirror_y->set_tooltip(TTR("Mirror Y") + " (" + ED_GET_SHORTCUT("tile_map_editor/mirror_y")->get_as_text() + ")"); mirror_y->set_focus_mode(FOCUS_NONE); mirror_y->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_y)); - toolbar->add_child(mirror_y); - - toolbar->add_child(memnew(VSeparator)); + tool_hb1->add_child(mirror_y); rotate_0 = memnew(ToolButton); rotate_0->set_toggle_mode(true); rotate_0->set_tooltip(TTR("Rotate 0 degrees")); rotate_0->set_focus_mode(FOCUS_NONE); rotate_0->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_0)); - toolbar->add_child(rotate_0); + tool_hb2->add_child(rotate_0); rotate_90 = memnew(ToolButton); rotate_90->set_toggle_mode(true); rotate_90->set_tooltip(TTR("Rotate 90 degrees")); rotate_90->set_focus_mode(FOCUS_NONE); rotate_90->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_90)); - toolbar->add_child(rotate_90); + tool_hb2->add_child(rotate_90); rotate_180 = memnew(ToolButton); rotate_180->set_toggle_mode(true); rotate_180->set_tooltip(TTR("Rotate 180 degrees")); rotate_180->set_focus_mode(FOCUS_NONE); rotate_180->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_180)); - toolbar->add_child(rotate_180); + tool_hb2->add_child(rotate_180); rotate_270 = memnew(ToolButton); rotate_270->set_toggle_mode(true); rotate_270->set_tooltip(TTR("Rotate 270 degrees")); rotate_270->set_focus_mode(FOCUS_NONE); rotate_270->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_270)); - toolbar->add_child(rotate_270); - toolbar->hide(); + tool_hb2->add_child(rotate_270); rotate_0->set_pressed(true); } diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 82f17b80d5..b77544befa 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -491,17 +491,8 @@ void ProjectManager::_update_project_buttons() { item->update(); } - bool has_runnable_scene = false; - for (Map<String, String>::Element *E = selected_list.front(); E; E = E->next()) { - const String &selected_main = E->get(); - if (selected_main == "") continue; - has_runnable_scene = true; - break; - } - erase_btn->set_disabled(selected_list.size() < 1); open_btn->set_disabled(selected_list.size() < 1); - run_btn->set_disabled(!has_runnable_scene); } void ProjectManager::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) { @@ -573,7 +564,7 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) { switch (k->get_scancode()) { - case KEY_RETURN: { + case KEY_ENTER: { _open_project(); } break; @@ -969,10 +960,22 @@ void ProjectManager::_run_project_confirm() { for (Map<String, String>::Element *E = selected_list.front(); E; E = E->next()) { const String &selected_main = E->get(); - if (selected_main == "") continue; + if (selected_main == "") { + run_error_diag->set_text(TTR("Can't run project: no main scene defined.\nPlease edit the project and set the main scene in \"Project Settings\" under the \"Application\" category.")); + run_error_diag->popup_centered(); + return; + } + const String &selected = E->key(); String path = EditorSettings::get_singleton()->get("projects/" + selected); + + if (!DirAccess::exists(path + "/.import")) { + run_error_diag->set_text(TTR("Can't run project: Assets need to be imported.\nPlease edit the project to trigger the initial import.")); + run_error_diag->popup_centered(); + return; + } + print_line("OPENING: " + path + " (" + selected + ")"); List<String> args; @@ -1390,6 +1393,10 @@ ProjectManager::ProjectManager() { last_clicked = ""; SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped"); + + run_error_diag = memnew(AcceptDialog); + gui_base->add_child(run_error_diag); + run_error_diag->set_title(TTR("Can't run project")); } ProjectManager::~ProjectManager() { diff --git a/editor/project_manager.h b/editor/project_manager.h index 27886132c5..181d3cc5d9 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -57,6 +57,7 @@ class ProjectManager : public Control { ConfirmationDialog *multi_open_ask; ConfirmationDialog *multi_run_ask; ConfirmationDialog *multi_scan_ask; + AcceptDialog *run_error_diag; NewProjectDialog *npdialog; ScrollContainer *scroll; VBoxContainer *scroll_childs; diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 6238cad14d..019ed47e81 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -1534,14 +1534,14 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { VBoxContainer *vbc = memnew(VBoxContainer); input_base->add_child(vbc); - vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 5); - vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 5); - vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5); - vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 5); + vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0); + vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); + vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0); + vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); l = memnew(Label); vbc->add_child(l); - l->set_position(Point2(6, 5)); + l->set_position(Point2(6, 5) * EDSCALE); l->set_text(TTR("Action:")); hbc = memnew(HBoxContainer); @@ -1632,6 +1632,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { //translations TabContainer *translations = memnew(TabContainer); + translations->add_style_override("panel", memnew(StyleBoxEmpty)); translations->set_tab_align(TabContainer::ALIGN_LEFT); translations->set_name(TTR("Localization")); tab_container->add_child(translations); @@ -1648,7 +1649,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { Button *addtr = memnew(Button(TTR("Add.."))); addtr->connect("pressed", this, "_translation_file_open"); thb->add_child(addtr); - MarginContainer *tmc = memnew(MarginContainer); + VBoxContainer *tmc = memnew(VBoxContainer); tvb->add_child(tmc); tmc->set_v_size_flags(SIZE_EXPAND_FILL); translation_list = memnew(Tree); @@ -1672,7 +1673,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { Button *addtr = memnew(Button(TTR("Add.."))); addtr->connect("pressed", this, "_translation_res_file_open"); thb->add_child(addtr); - MarginContainer *tmc = memnew(MarginContainer); + VBoxContainer *tmc = memnew(VBoxContainer); tvb->add_child(tmc); tmc->set_v_size_flags(SIZE_EXPAND_FILL); translation_remap = memnew(Tree); @@ -1694,7 +1695,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { addtr->connect("pressed", this, "_translation_res_option_file_open"); translation_res_option_add_button = addtr; thb->add_child(addtr); - tmc = memnew(MarginContainer); + tmc = memnew(VBoxContainer); tvb->add_child(tmc); tmc->set_v_size_flags(SIZE_EXPAND_FILL); translation_remap_options = memnew(Tree); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index ec085ea9f2..438eb2a73f 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -320,7 +320,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: CheckBox *c = checks20[0]; c->set_text("True"); - checks20gc->set_position(Vector2(4, 4)); + checks20gc->set_position(Vector2(4, 4) * EDSCALE); c->set_pressed(v); c->show(); @@ -433,14 +433,14 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: } else if (hint == PROPERTY_HINT_EXP_EASING) { - easing_draw->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5); - easing_draw->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 5); - easing_draw->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 5); - easing_draw->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 30); - type_button->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 3); - type_button->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 3); - type_button->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, 25); - type_button->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 7); + easing_draw->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5 * EDSCALE); + easing_draw->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 5 * EDSCALE); + easing_draw->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 5 * EDSCALE); + easing_draw->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 30 * EDSCALE); + type_button->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 3 * EDSCALE); + type_button->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 3 * EDSCALE); + type_button->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, 25 * EDSCALE); + type_button->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 7 * EDSCALE); type_button->set_text(TTR("Preset..")); type_button->get_popup()->clear(); type_button->get_popup()->add_item(TTR("Linear"), EASING_LINEAR); @@ -523,7 +523,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: action_buttons[0]->set_anchor(MARGIN_TOP, ANCHOR_END); action_buttons[0]->set_anchor(MARGIN_RIGHT, ANCHOR_END); action_buttons[0]->set_anchor(MARGIN_BOTTOM, ANCHOR_END); - action_buttons[0]->set_begin(Point2(70, button_margin - 5)); + action_buttons[0]->set_begin(Point2(70 * EDSCALE, button_margin - 5 * EDSCALE)); action_buttons[0]->set_end(Point2(margin, margin)); action_buttons[0]->set_text(TTR("Close")); action_buttons[0]->show(); @@ -875,7 +875,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: break; menu->clear(); - menu->set_size(Size2(1, 1)); + menu->set_size(Size2(1, 1) * EDSCALE); if (p_name == "script" && hint_text == "Script" && owner->cast_to<Node>()) { menu->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script"), OBJ_MENU_NEW_SCRIPT); @@ -924,7 +924,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: if (!RES(v).is_null()) { - menu->add_icon_item(get_icon("EditResource", "EditorIcons"), "Edit", OBJ_MENU_EDIT); + menu->add_icon_item(get_icon("Edit", "EditorIcons"), "Edit", OBJ_MENU_EDIT); menu->add_icon_item(get_icon("Del", "EditorIcons"), "Clear", OBJ_MENU_CLEAR); menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), "Make Unique", OBJ_MENU_MAKE_UNIQUE); RES r = v; @@ -2384,7 +2384,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p p_item->set_text(1, res->get_path().get_file()); } else if (!res->is_class("Texture")) { //texture already previews via itself - EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res, this, "_resource_preview_done", p_item->get_instance_ID()); + EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res, this, "_resource_preview_done", p_item->get_instance_id()); } } @@ -3644,7 +3644,7 @@ void PropertyEditor::update_tree() { item->set_text(1, res->get_path().get_file()); } else if (!res->is_class("Texture")) { //texture already previews via itself - EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res, this, "_resource_preview_done", item->get_instance_ID()); + EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res, this, "_resource_preview_done", item->get_instance_id()); } } @@ -3872,7 +3872,7 @@ void PropertyEditor::_item_edited() { break; if (type == Variant::INT) - _edit_set(name, round(item->get_range(1)), refresh_all); + _edit_set(name, int64_t(round(item->get_range(1))), refresh_all); else _edit_set(name, item->get_range(1), refresh_all); } break; @@ -4600,7 +4600,7 @@ void SectionedPropertyEditor::edit(Object *p_object) { return; } - ObjectID id = p_object->get_instance_ID(); + ObjectID id = p_object->get_instance_id(); if (obj != id) { diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index c6af993676..bd68eac9f2 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -418,7 +418,7 @@ void PropertySelector::select_method_from_script(const Ref<Script> &p_script, co base_type = p_script->get_instance_base_type(); selected = p_current; type = Variant::NIL; - script = p_script->get_instance_ID(); + script = p_script->get_instance_id(); properties = false; instance = NULL; @@ -452,7 +452,7 @@ void PropertySelector::select_method_from_instance(Object *p_instance, const Str { Ref<Script> scr = p_instance->get_script(); if (scr.is_valid()) - script = scr->get_instance_ID(); + script = scr->get_instance_id(); } properties = false; instance = NULL; @@ -485,7 +485,7 @@ void PropertySelector::select_property_from_script(const Ref<Script> &p_script, base_type = p_script->get_instance_base_type(); selected = p_current; type = Variant::NIL; - script = p_script->get_instance_ID(); + script = p_script->get_instance_id(); properties = true; instance = NULL; diff --git a/editor/resources_dock.cpp b/editor/resources_dock.cpp index d3b68d92e4..db3bf6a352 100644 --- a/editor/resources_dock.cpp +++ b/editor/resources_dock.cpp @@ -204,7 +204,7 @@ void ResourcesDock::_update_name(TreeItem *item) { else if (res->get_path() != "" && res->get_path().find("::") == -1) item->set_text(0, res->get_path().get_file()); else - item->set_text(0, res->get_class() + " (" + itos(res->get_instance_ID()) + ")"); + item->set_text(0, res->get_class() + " (" + itos(res->get_instance_id()) + ")"); } void ResourcesDock::remove_resource(const Ref<Resource> &p_resource) { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 47a9185389..ce3b85332f 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1369,8 +1369,8 @@ void SceneTreeDock::_delete_confirm() { editor_data->get_undo_redo().add_undo_reference(n); ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger(); - editor_data->get_undo_redo().add_do_method(sed, "live_debug_remove_and_keep_node", edited_scene->get_path_to(n), n->get_instance_ID()); - editor_data->get_undo_redo().add_undo_method(sed, "live_debug_restore_node", n->get_instance_ID(), edited_scene->get_path_to(n->get_parent()), n->get_index()); + editor_data->get_undo_redo().add_do_method(sed, "live_debug_remove_and_keep_node", edited_scene->get_path_to(n), n->get_instance_id()); + editor_data->get_undo_redo().add_undo_method(sed, "live_debug_restore_node", n->get_instance_id(), edited_scene->get_path_to(n->get_parent()), n->get_index()); } } editor_data->get_undo_redo().commit_action(); @@ -1824,7 +1824,7 @@ void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) { int index = menu->get_item_count(); menu->add_icon_item(icon, E->get().name.capitalize(), EDIT_SUBRESOURCE_BASE + subresources.size()); menu->set_item_h_offset(index, p_depth * 10 * EDSCALE); - subresources.push_back(obj->get_instance_ID()); + subresources.push_back(obj->get_instance_id()); _add_children_to_popup(obj, p_depth + 1); } diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index f35e098065..94ef712c25 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -185,19 +185,19 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { if (part_of_subscene) { //item->set_selectable(0,marked_selectable); - item->set_custom_color(0, Color(0.8, 0.4, 0.20)); + item->set_custom_color(0, get_color("error_color", "Editor").linear_interpolate(get_color("warning_color", "Editor"), 0.4)); } else if (marked.has(p_node)) { item->set_selectable(0, marked_selectable); - item->set_custom_color(0, Color(0.8, 0.1, 0.10)); + item->set_custom_color(0, get_color("error_color", "Editor")); } else if (!marked_selectable && !marked_children_selectable) { Node *node = p_node; while (node) { if (marked.has(node)) { item->set_selectable(0, false); - item->set_custom_color(0, Color(0.8, 0.1, 0.10)); + item->set_custom_color(0, get_color("error_color", "Editor")); break; } node = node->get_parent(); @@ -411,9 +411,9 @@ void SceneTreeEditor::_update_tree() { void SceneTreeEditor::_compute_hash(Node *p_node, uint64_t &hash) { - hash = hash_djb2_one_64(p_node->get_instance_ID(), hash); + hash = hash_djb2_one_64(p_node->get_instance_id(), hash); if (p_node->get_parent()) - hash = hash_djb2_one_64(p_node->get_parent()->get_instance_ID(), hash); //so a reparent still produces a different hash + hash = hash_djb2_one_64(p_node->get_parent()->get_instance_id(), hash); //so a reparent still produces a different hash for (int i = 0; i < p_node->get_child_count(); i++) { @@ -625,8 +625,8 @@ void SceneTreeEditor::_renamed() { } else { undo_redo->create_action(TTR("Rename Node")); emit_signal("node_prerename", n, new_name); - undo_redo->add_do_method(this, "_rename_node", n->get_instance_ID(), new_name); - undo_redo->add_undo_method(this, "_rename_node", n->get_instance_ID(), n->get_name()); + undo_redo->add_do_method(this, "_rename_node", n->get_instance_id(), new_name); + undo_redo->add_undo_method(this, "_rename_node", n->get_instance_id(), n->get_name()); undo_redo->commit_action(); } } diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index f4ed430d3d..01cfdc1b57 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -637,7 +637,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da } else if (p_msg == "profile_sig") { //cache a signature - print_line("SIG: " + String(Variant(p_data))); profiler_signature[p_data[1]] = p_data[0]; } else if (p_msg == "profile_frame" || p_msg == "profile_total") { @@ -796,8 +795,9 @@ void ScriptEditorDebugger::_performance_draw() { r.position += graph_sb->get_offset(); r.size -= graph_sb->get_minimum_size(); int pi = which[i]; - Color c = Color(0.7, 0.9, 0.5); + Color c = get_color("success_color", "Editor"); c.set_hsv(Math::fmod(c.get_h() + pi * 0.7654, 1), c.get_s(), c.get_v()); + //c = c.linear_interpolate(get_color("base_color", "Editor"), 0.9); c.a = 0.8; perf_draw->draw_string(graph_font, r.position + Point2(0, graph_font->get_ascent()), perf_items[pi]->get_text(0), c, r.size.x); @@ -848,6 +848,8 @@ void ScriptEditorDebugger::_notification(int p_what) { error_stack->connect("item_selected", this, "_error_stack_selected"); vmem_refresh->set_icon(get_icon("Reload", "EditorIcons")); + reason->add_color_override("font_color", get_color("error_color", "Editor")); + } break; case NOTIFICATION_PROCESS: { @@ -1595,6 +1597,7 @@ void ScriptEditorDebugger::_bind_methods() { ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { ppeer = Ref<PacketPeerStream>(memnew(PacketPeerStream)); + ppeer->set_input_buffer_max_size(1024 * 1024 * 8); //8mb should be enough editor = p_editor; tabs = memnew(TabContainer); @@ -1615,13 +1618,10 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { HBoxContainer *hbc = memnew(HBoxContainer); vbc->add_child(hbc); - reason = memnew(LineEdit); + reason = memnew(Label); reason->set_text(""); - reason->set_editable(false); hbc->add_child(reason); - reason->add_color_override("font_color", Color(1, 0.4, 0.0, 0.8)); reason->set_h_size_flags(SIZE_EXPAND_FILL); - //reason->set_clip_text(true); hbc->add_child(memnew(VSeparator)); @@ -1647,8 +1647,6 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { docontinue->set_tooltip(TTR("Continue")); docontinue->connect("pressed", this, "debug_continue"); - //hbc->add_child( memnew( VSeparator) ); - back = memnew(Button); hbc->add_child(back); back->set_tooltip(TTR("Inspect Previous Instance")); @@ -1690,10 +1688,6 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { breaked = false; tabs->add_child(dbg); - //tabs->move_child(vbc,0); - - hbc = memnew(HBoxContainer); - vbc->add_child(hbc); } { //errors @@ -1821,7 +1815,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { vmem_vb->add_child(vmem_hb); vmem_refresh->connect("pressed", this, "_video_mem_request"); - MarginContainer *vmmc = memnew(MarginContainer); + VBoxContainer *vmmc = memnew(VBoxContainer); vmem_tree = memnew(Tree); vmem_tree->set_v_size_flags(SIZE_EXPAND_FILL); vmem_tree->set_h_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h index 907c267d49..d255d73167 100644 --- a/editor/script_editor_debugger.h +++ b/editor/script_editor_debugger.h @@ -89,7 +89,7 @@ class ScriptEditorDebugger : public Control { TabContainer *tabs; - LineEdit *reason; + Label *reason; ScriptEditorDebuggerVariables *variables; Button *step; diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index faf9dee5d0..24be2095ce 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -70,7 +70,7 @@ void EditorSpatialGizmo::redraw() { void EditorSpatialGizmo::Instance::create_instance(Spatial *p_base) { instance = VS::get_singleton()->instance_create2(mesh->get_rid(), p_base->get_world()->get_scenario()); - VS::get_singleton()->instance_attach_object_instance_ID(instance, p_base->get_instance_ID()); + VS::get_singleton()->instance_attach_object_instance_id(instance, p_base->get_instance_id()); if (skeleton.is_valid()) VS::get_singleton()->instance_attach_skeleton(instance, skeleton); if (extra_margin) @@ -562,13 +562,13 @@ void EditorSpatialGizmo::free() { void EditorSpatialGizmo::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_lines", "lines", "material:Material", "billboard"), &EditorSpatialGizmo::add_lines, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("add_mesh", "mesh:Mesh", "billboard", "skeleton"), &EditorSpatialGizmo::add_mesh, DEFVAL(false), DEFVAL(RID())); + ClassDB::bind_method(D_METHOD("add_lines", "lines", "material", "billboard"), &EditorSpatialGizmo::add_lines, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("add_mesh", "mesh", "billboard", "skeleton"), &EditorSpatialGizmo::add_mesh, DEFVAL(false), DEFVAL(RID())); ClassDB::bind_method(D_METHOD("add_collision_segments", "segments"), &EditorSpatialGizmo::add_collision_segments); - ClassDB::bind_method(D_METHOD("add_collision_triangles", "triangles:TriangleMesh"), &EditorSpatialGizmo::add_collision_triangles); - ClassDB::bind_method(D_METHOD("add_unscaled_billboard", "material:Material", "default_scale"), &EditorSpatialGizmo::add_unscaled_billboard, DEFVAL(1)); + ClassDB::bind_method(D_METHOD("add_collision_triangles", "triangles"), &EditorSpatialGizmo::add_collision_triangles); + ClassDB::bind_method(D_METHOD("add_unscaled_billboard", "material", "default_scale"), &EditorSpatialGizmo::add_unscaled_billboard, DEFVAL(1)); ClassDB::bind_method(D_METHOD("add_handles", "handles", "billboard", "secondary"), &EditorSpatialGizmo::add_handles, DEFVAL(false), DEFVAL(false)); - ClassDB::bind_method(D_METHOD("set_spatial_node", "node:Spatial"), &EditorSpatialGizmo::_set_spatial_node); + ClassDB::bind_method(D_METHOD("set_spatial_node", "node"), &EditorSpatialGizmo::_set_spatial_node); ClassDB::bind_method(D_METHOD("clear"), &EditorSpatialGizmo::clear); BIND_VMETHOD(MethodInfo("redraw")); diff --git a/main/input_default.cpp b/main/input_default.cpp index 3361aa0678..4e2fd6f9d4 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -453,7 +453,8 @@ void InputDefault::set_mouse_position(const Point2 &p_posf) { mouse_speed_track.update(p_posf - mouse_pos); mouse_pos = p_posf; if (custom_cursor.is_valid()) { - VisualServer::get_singleton()->cursor_set_pos(get_mouse_position()); + //removed, please insist that we implement hardware cursors + // VisualServer::get_singleton()->cursor_set_pos(get_mouse_position()); } } @@ -538,6 +539,7 @@ bool InputDefault::is_emulating_touchscreen() const { } void InputDefault::set_custom_mouse_cursor(const RES &p_cursor, const Vector2 &p_hotspot) { + /* no longer supported, leaving this for reference to anyone who might want to implement hardware cursors if (custom_cursor == p_cursor) return; @@ -545,7 +547,8 @@ void InputDefault::set_custom_mouse_cursor(const RES &p_cursor, const Vector2 &p if (p_cursor.is_null()) { set_mouse_mode(MOUSE_MODE_VISIBLE); - VisualServer::get_singleton()->cursor_set_visible(false); + //removed, please insist us to implement hardare cursors + //VisualServer::get_singleton()->cursor_set_visible(false); } else { Ref<AtlasTexture> atex = custom_cursor; Rect2 region = atex.is_valid() ? atex->get_region() : Rect2(); @@ -554,10 +557,11 @@ void InputDefault::set_custom_mouse_cursor(const RES &p_cursor, const Vector2 &p VisualServer::get_singleton()->cursor_set_texture(custom_cursor->get_rid(), p_hotspot, 0, region); VisualServer::get_singleton()->cursor_set_pos(get_mouse_position()); } + */ } void InputDefault::set_mouse_in_window(bool p_in_window) { - + /* no longer supported, leaving this for reference to anyone who might want to implement hardware cursors if (custom_cursor.is_valid()) { if (p_in_window) { @@ -568,6 +572,7 @@ void InputDefault::set_mouse_in_window(bool p_in_window) { VisualServer::get_singleton()->cursor_set_visible(false); } } + */ } // from github.com/gabomdq/SDL_GameControllerDB diff --git a/main/main.cpp b/main/main.cpp index ed6ed019f4..9376d83204 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -203,7 +203,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph MAIN_PRINT("Main: Initialize Globals"); - Thread::_main_thread_id = Thread::get_caller_ID(); + Thread::_main_thread_id = Thread::get_caller_id(); globals = memnew(ProjectSettings); input_map = memnew(InputMap); diff --git a/misc/scripts/makeargs.py b/misc/scripts/makeargs.py index 2cd47ae087..26d9cc5a00 100644 --- a/misc/scripts/makeargs.py +++ b/misc/scripts/makeargs.py @@ -2,7 +2,7 @@ text = """ #define FUNC$numR(m_r,m_func,$argt)\\ virtual m_r m_func($argtp) { \\ - if (Thread::get_caller_ID()!=server_thread) {\\ + if (Thread::get_caller_id()!=server_thread) {\\ m_r ret;\\ command_queue.push_and_ret( visual_server, &VisualServer::m_func,$argp,&ret);\\ return ret;\\ @@ -13,7 +13,7 @@ text = """ #define FUNC$numRC(m_r,m_func,$argt)\\ virtual m_r m_func($argtp) const { \\ - if (Thread::get_caller_ID()!=server_thread) {\\ + if (Thread::get_caller_id()!=server_thread) {\\ m_r ret;\\ command_queue.push_and_ret( visual_server, &VisualServer::m_func,$argp,&ret);\\ return ret;\\ @@ -25,7 +25,7 @@ text = """ #define FUNC$numS(m_func,$argt)\\ virtual void m_func($argtp) { \\ - if (Thread::get_caller_ID()!=server_thread) {\\ + if (Thread::get_caller_id()!=server_thread) {\\ command_queue.push_and_sync( visual_server, &VisualServer::m_func,$argp);\\ } else {\\ visual_server->m_func($argp);\\ @@ -34,7 +34,7 @@ text = """ #define FUNC$numSC(m_func,$argt)\\ virtual void m_func($argtp) const { \\ - if (Thread::get_caller_ID()!=server_thread) {\\ + if (Thread::get_caller_id()!=server_thread) {\\ command_queue.push_and_sync( visual_server, &VisualServer::m_func,$argp);\\ } else {\\ visual_server->m_func($argp);\\ @@ -44,7 +44,7 @@ text = """ #define FUNC$num(m_func,$argt)\\ virtual void m_func($argtp) { \\ - if (Thread::get_caller_ID()!=server_thread) {\\ + if (Thread::get_caller_id()!=server_thread) {\\ command_queue.push( visual_server, &VisualServer::m_func,$argp);\\ } else {\\ visual_server->m_func($argp);\\ @@ -53,7 +53,7 @@ text = """ #define FUNC$numC(m_func,$argt)\\ virtual void m_func($argtp) const { \\ - if (Thread::get_caller_ID()!=server_thread) {\\ + if (Thread::get_caller_id()!=server_thread) {\\ command_queue.push( visual_server, &VisualServer::m_func,$argp);\\ } else {\\ visual_server->m_func($argp);\\ diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index 738bd27ed3..68d5c9e611 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -508,7 +508,7 @@ uint32_t NetworkedMultiplayerENet::_gen_unique_id() const { (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 ); + (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 diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 07dba921b1..440cc45479 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -169,8 +169,8 @@ void GDNative::_compile_dummy_for_api() { } void GDNative::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_library", "library:GDNativeLibrary"), &GDNative::set_library); - ClassDB::bind_method(D_METHOD("get_library:GDNativeLibrary"), &GDNative::get_library); + ClassDB::bind_method(D_METHOD("set_library", "library"), &GDNative::set_library); + ClassDB::bind_method(D_METHOD("get_library"), &GDNative::get_library); ClassDB::bind_method(D_METHOD("initialize"), &GDNative::initialize); ClassDB::bind_method(D_METHOD("terminate"), &GDNative::terminate); @@ -178,7 +178,7 @@ void GDNative::_bind_methods() { // TODO(karroffel): get_native_(raw_)call_types binding? // TODO(karroffel): make this a varargs function? - ClassDB::bind_method(D_METHOD("call_native:Variant", "procedure_name", "arguments:Array"), &GDNative::call_native); + ClassDB::bind_method(D_METHOD("call_native", "procedure_name", "arguments"), &GDNative::call_native); ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "GDNativeLibrary"), "set_library", "get_library"); } diff --git a/modules/gdnative/godot/node_path.cpp b/modules/gdnative/godot/node_path.cpp index e718a9e55f..f4179361be 100644 --- a/modules/gdnative/godot/node_path.cpp +++ b/modules/gdnative/godot/node_path.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include <godot/node_path.h> -#include "core/path_db.h" +#include "core/node_path.h" #include "core/variant.h" #ifdef __cplusplus diff --git a/modules/gdnative/godot/string.cpp b/modules/gdnative/godot/string.cpp index 3573f266ac..76cf1fba12 100644 --- a/modules/gdnative/godot/string.cpp +++ b/modules/gdnative/godot/string.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include <godot/string.h> +#include "core/variant.h" #include "string_db.h" #include "ustring.h" @@ -112,6 +113,1155 @@ void GDAPI godot_string_destroy(godot_string *p_self) { self->~String(); } +/* Standard size stuff */ + +godot_int GDAPI godot_string_length(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->length(); +} + +/* Helpers */ + +godot_bool GDAPI godot_string_begins_with(const godot_string *p_self, const godot_string *p_string) { + const String *self = (const String *)p_self; + const String *string = (const String *)p_string; + + return self->begins_with(*string); +} + +godot_bool GDAPI godot_string_begins_with_char_array(const godot_string *p_self, const char *p_char_array) { + const String *self = (const String *)p_self; + + return self->begins_with(p_char_array); +} + +godot_array GDAPI godot_string_bigrams(const godot_string *p_self) { + const String *self = (const String *)p_self; + Vector<String> return_value = self->bigrams(); + + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_string GDAPI godot_string_chr(wchar_t p_character) { + godot_string result; + memnew_placement(&result, String(String::chr(p_character))); + + return result; +} + +godot_bool GDAPI godot_string_ends_with(const godot_string *p_self, const godot_string *p_string) { + const String *self = (const String *)p_self; + const String *string = (const String *)p_string; + + return self->ends_with(*string); +} + +godot_int GDAPI godot_string_find(const godot_string *p_self, godot_string p_what) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->find(*what); +} + +godot_int GDAPI godot_string_find_from(const godot_string *p_self, godot_string p_what, godot_int p_from) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->find(*what, p_from); +} + +godot_int GDAPI godot_string_findmk(const godot_string *p_self, const godot_array *p_keys) { + const String *self = (const String *)p_self; + + Vector<String> keys; + Array *keys_proxy = (Array *)p_keys; + keys.resize(keys_proxy->size()); + for (int i = 0; i < keys_proxy->size(); i++) { + keys[i] = (*keys_proxy)[i]; + } + + return self->findmk(keys); +} + +godot_int GDAPI godot_string_findmk_from(const godot_string *p_self, const godot_array *p_keys, godot_int p_from) { + const String *self = (const String *)p_self; + + Vector<String> keys; + Array *keys_proxy = (Array *)p_keys; + keys.resize(keys_proxy->size()); + for (int i = 0; i < keys_proxy->size(); i++) { + keys[i] = (*keys_proxy)[i]; + } + + return self->findmk(keys, p_from); +} + +godot_int GDAPI godot_string_findmk_from_in_place(const godot_string *p_self, const godot_array *p_keys, godot_int p_from, godot_int *r_key) { + const String *self = (const String *)p_self; + + Vector<String> keys; + Array *keys_proxy = (Array *)p_keys; + keys.resize(keys_proxy->size()); + for (int i = 0; i < keys_proxy->size(); i++) { + keys[i] = (*keys_proxy)[i]; + } + + return self->findmk(keys, p_from, r_key); +} + +godot_int GDAPI godot_string_findn(const godot_string *p_self, godot_string p_what) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->findn(*what); +} + +godot_int GDAPI godot_string_findn_from(const godot_string *p_self, godot_string p_what, godot_int p_from) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->findn(*what, p_from); +} + +godot_int GDAPI find_last(const godot_string *p_self, godot_string p_what) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->find_last(*what); +} + +godot_string GDAPI godot_string_format(const godot_string *p_self, const godot_variant *p_values) { + const String *self = (const String *)p_self; + const Variant *values = (const Variant *)p_values; + godot_string result; + memnew_placement(&result, String(self->format(*values))); + + return result; +} + +godot_string GDAPI godot_string_format_with_custom_placeholder(const godot_string *p_self, const godot_variant *p_values, const char *p_placeholder) { + const String *self = (const String *)p_self; + const Variant *values = (const Variant *)p_values; + String placeholder = String(p_placeholder); + godot_string result; + memnew_placement(&result, String(self->format(*values, placeholder))); + + return result; +} + +godot_string GDAPI godot_string_hex_encode_buffer(const uint8_t *p_buffer, godot_int p_len) { + godot_string result; + memnew_placement(&result, String(String::hex_encode_buffer(p_buffer, p_len))); + + return result; +} + +godot_int GDAPI godot_string_hex_to_int(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hex_to_int(); +} + +godot_int GDAPI godot_string_hex_to_int_without_prefix(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hex_to_int(true); +} + +godot_string GDAPI godot_string_insert(const godot_string *p_self, godot_int at_pos, godot_string p_content) { + const String *self = (const String *)p_self; + String *content = (String *)&p_content; + godot_string result; + memnew_placement(&result, String(self->insert(at_pos, *content))); + + return result; +} + +godot_bool GDAPI godot_string_is_numeric(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_numeric(); +} + +godot_bool GDAPI godot_string_is_subsequence_of(const godot_string *p_self, const godot_string *p_string) { + const String *self = (const String *)p_self; + const String *string = (const String *)p_string; + + return self->is_subsequence_of(*string); +} + +godot_bool GDAPI godot_string_is_subsequence_ofi(const godot_string *p_self, const godot_string *p_string) { + const String *self = (const String *)p_self; + const String *string = (const String *)p_string; + + return self->is_subsequence_ofi(*string); +} + +godot_string GDAPI godot_string_lpad(const godot_string *p_self, godot_int p_min_length) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->lpad(p_min_length))); + + return result; +} + +godot_string GDAPI godot_string_lpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character) { + const String *self = (const String *)p_self; + const String *character = (const String *)p_character; + godot_string result; + memnew_placement(&result, String(self->lpad(p_min_length, *character))); + + return result; +} + +godot_bool GDAPI godot_string_match(const godot_string *p_self, const godot_string *p_wildcard) { + const String *self = (const String *)p_self; + const String *wildcard = (const String *)p_wildcard; + + return self->match(*wildcard); +} + +godot_bool GDAPI godot_string_matchn(const godot_string *p_self, const godot_string *p_wildcard) { + const String *self = (const String *)p_self; + const String *wildcard = (const String *)p_wildcard; + + return self->matchn(*wildcard); +} + +godot_string GDAPI godot_string_md5(const uint8_t *p_md5) { + godot_string result; + memnew_placement(&result, String(String::md5(p_md5))); + + return result; +} + +godot_string GDAPI godot_string_num(double p_num) { + godot_string result; + memnew_placement(&result, String(String::num(p_num))); + + return result; +} + +godot_string GDAPI godot_string_num_int64(int64_t p_num, godot_int p_base) { + godot_string result; + memnew_placement(&result, String(String::num_int64(p_num, p_base))); + + return result; +} + +godot_string GDAPI godot_string_num_int64_capitalized(int64_t p_num, godot_int p_base, godot_bool p_capitalize_hex) { + godot_string result; + memnew_placement(&result, String(String::num_int64(p_num, p_base, true))); + + return result; +} + +godot_string GDAPI godot_string_num_real(double p_num) { + godot_string result; + memnew_placement(&result, String(String::num_real(p_num))); + + return result; +} + +godot_string GDAPI godot_string_num_scientific(double p_num) { + godot_string result; + memnew_placement(&result, String(String::num_scientific(p_num))); + + return result; +} + +godot_string GDAPI godot_string_num_with_decimals(double p_num, godot_int p_decimals) { + godot_string result; + memnew_placement(&result, String(String::num(p_num, p_decimals))); + + return result; +} + +godot_string GDAPI godot_string_pad_decimals(const godot_string *p_self, godot_int p_digits) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->pad_decimals(p_digits))); + + return result; +} + +godot_string GDAPI godot_string_pad_zeros(const godot_string *p_self, godot_int p_digits) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->pad_zeros(p_digits))); + + return result; +} + +godot_string GDAPI godot_string_replace(const godot_string *p_self, godot_string p_key, godot_string p_with) { + const String *self = (const String *)p_self; + String *key = (String *)&p_key; + String *with = (String *)&p_with; + godot_string result; + memnew_placement(&result, String(self->replace(*key, *with))); + + return result; +} + +godot_string GDAPI godot_string_replacen(const godot_string *p_self, godot_string p_key, godot_string p_with) { + const String *self = (const String *)p_self; + String *key = (String *)&p_key; + String *with = (String *)&p_with; + godot_string result; + memnew_placement(&result, String(self->replacen(*key, *with))); + + return result; +} + +godot_int GDAPI godot_string_rfind(const godot_string *p_self, godot_string p_what) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->rfind(*what); +} + +godot_int GDAPI godot_string_rfindn(const godot_string *p_self, godot_string p_what) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->rfindn(*what); +} + +godot_int GDAPI godot_string_rfind_from(const godot_string *p_self, godot_string p_what, godot_int p_from) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->rfind(*what, p_from); +} + +godot_int GDAPI godot_string_rfindn_from(const godot_string *p_self, godot_string p_what, godot_int p_from) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->rfindn(*what, p_from); +} + +godot_string GDAPI godot_string_replace_first(const godot_string *p_self, godot_string p_key, godot_string p_with) { + const String *self = (const String *)p_self; + String *key = (String *)&p_key; + String *with = (String *)&p_with; + godot_string result; + memnew_placement(&result, String(self->replace_first(*key, *with))); + + return result; +} + +godot_string GDAPI godot_string_rpad(const godot_string *p_self, godot_int p_min_length) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->rpad(p_min_length))); + + return result; +} + +godot_string GDAPI godot_string_rpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character) { + const String *self = (const String *)p_self; + const String *character = (const String *)p_character; + godot_string result; + memnew_placement(&result, String(self->rpad(p_min_length, *character))); + + return result; +} + +godot_real GDAPI godot_string_similarity(const godot_string *p_self, const godot_string *p_string) { + const String *self = (const String *)p_self; + const String *string = (const String *)p_string; + + return self->similarity(*string); +} + +godot_string GDAPI godot_string_sprintf(const godot_string *p_self, const godot_array *p_values, godot_bool *p_error) { + const String *self = (const String *)p_self; + const Array *values = (const Array *)p_values; + + godot_string result; + String return_value = self->sprintf(*values, p_error); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_substr(const godot_string *p_self, godot_int p_from, godot_int p_chars) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->substr(p_from, p_chars))); + + return result; +} + +double GDAPI godot_string_to_double(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->to_double(); +} + +godot_real GDAPI godot_string_to_float(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->to_float(); +} + +godot_int GDAPI godot_string_to_int(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->to_int(); +} + +godot_string GDAPI godot_string_capitalize(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->capitalize())); + + return result; +}; + +godot_string GDAPI godot_string_camelcase_to_underscore(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->camelcase_to_underscore(false))); + + return result; +}; + +godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->camelcase_to_underscore())); + + return result; +}; + +double GDAPI godot_string_char_to_double(const char *p_what) { + return String::to_double(p_what); +}; + +godot_int GDAPI godot_string_char_to_int(const char *p_what) { + return String::to_int(p_what); +}; + +int64_t GDAPI godot_string_wchar_to_int(const wchar_t *p_str) { + return String::to_int(p_str); +}; + +godot_int GDAPI godot_string_char_to_int_with_len(const char *p_what, godot_int p_len) { + return String::to_int(p_what, p_len); +}; + +int64_t GDAPI godot_string_char_to_int64_with_len(const wchar_t *p_str, int p_len) { + return String::to_int(p_str, p_len); +}; + +int64_t GDAPI godot_string_hex_to_int64(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hex_to_int64(false); +}; + +int64_t GDAPI godot_string_hex_to_int64_with_prefix(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hex_to_int64(); +}; + +int64_t GDAPI godot_string_to_int64(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->to_int64(); +}; + +double GDAPI godot_string_unicode_char_to_double(const wchar_t *p_str, const wchar_t **r_end) { + return String::to_double(p_str, r_end); +} + +godot_string GDAPI godot_string_get_slice(const godot_string *p_self, godot_string p_splitter, godot_int p_slice) { + const String *self = (const String *)p_self; + String *splitter = (String *)&p_splitter; + godot_string result; + memnew_placement(&result, String(self->get_slice(*splitter, p_slice))); + + return result; +}; + +godot_string GDAPI godot_string_get_slicec(const godot_string *p_self, wchar_t p_splitter, godot_int p_slice) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->get_slicec(p_splitter, p_slice))); + + return result; +}; + +godot_array GDAPI godot_string_split(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector<String> return_value = self->split(*splitter, false); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_array GDAPI godot_string_split_allow_empty(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector<String> return_value = self->split(*splitter); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_array GDAPI godot_string_split_floats(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector<float> return_value = self->split_floats(*splitter, false); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_array GDAPI godot_string_split_floats_allows_empty(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector<float> return_value = self->split_floats(*splitter); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_array GDAPI godot_string_split_floats_mk(const godot_string *p_self, const godot_array *p_splitters) { + const String *self = (const String *)p_self; + + Vector<String> splitters; + Array *splitter_proxy = (Array *)p_splitters; + splitters.resize(splitter_proxy->size()); + for (int i = 0; i < splitter_proxy->size(); i++) { + splitters[i] = (*splitter_proxy)[i]; + } + + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector<float> return_value = self->split_floats_mk(splitters, false); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_array GDAPI godot_string_split_floats_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters) { + const String *self = (const String *)p_self; + + Vector<String> splitters; + Array *splitter_proxy = (Array *)p_splitters; + splitters.resize(splitter_proxy->size()); + for (int i = 0; i < splitter_proxy->size(); i++) { + splitters[i] = (*splitter_proxy)[i]; + } + + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector<float> return_value = self->split_floats_mk(splitters); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_array GDAPI godot_string_split_ints(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector<int> return_value = self->split_ints(*splitter, false); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_array GDAPI godot_string_split_ints_allows_empty(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector<int> return_value = self->split_ints(*splitter); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const godot_array *p_splitters) { + const String *self = (const String *)p_self; + + Vector<String> splitters; + Array *splitter_proxy = (Array *)p_splitters; + splitters.resize(splitter_proxy->size()); + for (int i = 0; i < splitter_proxy->size(); i++) { + splitters[i] = (*splitter_proxy)[i]; + } + + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector<int> return_value = self->split_ints_mk(splitters, false); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_array GDAPI godot_string_split_ints_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters) { + const String *self = (const String *)p_self; + + Vector<String> splitters; + Array *splitter_proxy = (Array *)p_splitters; + splitters.resize(splitter_proxy->size()); + for (int i = 0; i < splitter_proxy->size(); i++) { + splitters[i] = (*splitter_proxy)[i]; + } + + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector<int> return_value = self->split_ints_mk(splitters); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_array GDAPI godot_string_split_spaces(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector<String> return_value = self->split_spaces(); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, godot_string p_splitter) { + const String *self = (const String *)p_self; + String *splitter = (String *)&p_splitter; + + return self->get_slice_count(*splitter); +}; + +wchar_t GDAPI godot_string_char_lowercase(wchar_t p_char) { + return String::char_lowercase(p_char); +}; + +wchar_t GDAPI godot_string_char_uppercase(wchar_t p_char) { + return String::char_uppercase(p_char); +}; + +godot_string GDAPI godot_string_to_lower(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->to_lower())); + + return result; +}; + +godot_string GDAPI godot_string_to_upper(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->to_upper())); + + return result; +}; + +godot_string GDAPI godot_string_get_basename(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->get_basename())); + + return result; +}; + +godot_string GDAPI godot_string_get_extension(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->get_extension())); + + return result; +}; + +godot_string GDAPI godot_string_left(const godot_string *p_self, godot_int p_pos) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->left(p_pos))); + + return result; +}; + +wchar_t GDAPI godot_string_ord_at(const godot_string *p_self, godot_int p_idx) { + const String *self = (const String *)p_self; + + return self->ord_at(p_idx); +}; + +godot_string GDAPI godot_string_plus_file(const godot_string *p_self, const godot_string *p_file) { + const String *self = (const String *)p_self; + const String *file = (const String *)p_file; + godot_string result; + memnew_placement(&result, String(self->plus_file(*file))); + + return result; +}; + +godot_string GDAPI godot_string_right(const godot_string *p_self, godot_int p_pos) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->right(p_pos))); + + return result; +}; + +godot_string GDAPI godot_string_strip_edges(const godot_string *p_self, godot_bool p_left, godot_bool p_right) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->strip_edges(p_left, p_right))); + + return result; +}; + +godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->strip_escapes())); + + return result; +}; + +void GDAPI godot_string_erase(godot_string *p_self, godot_int p_pos, godot_int p_chars) { + String *self = (String *)p_self; + + return self->erase(p_pos, p_chars); +}; + +void GDAPI godot_string_ascii(godot_string *p_self, char *result) { + String *self = (String *)p_self; + Vector<char> return_value = self->ascii(); + + for (int i = 0; i < return_value.size(); i++) { + result[i] = return_value[i]; + } +} + +void GDAPI godot_string_ascii_extended(godot_string *p_self, char *result) { + String *self = (String *)p_self; + Vector<char> return_value = self->ascii(true); + + for (int i = 0; i < return_value.size(); i++) { + result[i] = return_value[i]; + } +} + +void GDAPI godot_string_utf8(godot_string *p_self, char *result) { + String *self = (String *)p_self; + Vector<char> return_value = self->utf8(); + + for (int i = 0; i < return_value.size(); i++) { + result[i] = return_value[i]; + } +} + +godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8) { + String *self = (String *)p_self; + + return self->parse_utf8(p_utf8); +}; + +godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len) { + String *self = (String *)p_self; + + return self->parse_utf8(p_utf8, p_len); +}; + +godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8) { + godot_string result; + memnew_placement(&result, String(String::utf8(p_utf8))); + + return result; +}; + +godot_string GDAPI godot_string_chars_to_utf8_with_len(const char *p_utf8, godot_int p_len) { + godot_string result; + memnew_placement(&result, String(String::utf8(p_utf8, p_len))); + + return result; +}; + +uint32_t GDAPI godot_string_hash(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hash(); +}; + +uint64_t GDAPI godot_string_hash64(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hash64(); +}; + +uint32_t GDAPI godot_string_hash_chars(const char *p_cstr) { + return String::hash(p_cstr); +}; + +uint32_t GDAPI godot_string_hash_chars_with_len(const char *p_cstr, godot_int p_len) { + return String::hash(p_cstr, p_len); +}; + +uint32_t GDAPI godot_string_hash_utf8_chars(const wchar_t *p_str) { + return String::hash(p_str); +}; + +uint32_t GDAPI godot_string_hash_utf8_chars_with_len(const wchar_t *p_str, godot_int p_len) { + return String::hash(p_str, p_len); +}; + +godot_pool_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self) { + const String *self = (const String *)p_self; + Vector<uint8_t> tmp_result = self->md5_buffer(); + + godot_pool_byte_array result; + memnew_placement(&result, PoolByteArray); + PoolByteArray *proxy = (PoolByteArray *)&result; + PoolByteArray::Write proxy_writer = proxy->write(); + proxy->resize(tmp_result.size()); + + for (int i = 0; i < tmp_result.size(); i++) { + proxy_writer[i] = tmp_result[i]; + } + + return result; +}; + +godot_string GDAPI godot_string_md5_text(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->md5_text())); + + return result; +}; + +godot_pool_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self) { + const String *self = (const String *)p_self; + Vector<uint8_t> tmp_result = self->sha256_buffer(); + + godot_pool_byte_array result; + memnew_placement(&result, PoolByteArray); + PoolByteArray *proxy = (PoolByteArray *)&result; + PoolByteArray::Write proxy_writer = proxy->write(); + proxy->resize(tmp_result.size()); + + for (int i = 0; i < tmp_result.size(); i++) { + proxy_writer[i] = tmp_result[i]; + } + + return result; +}; + +godot_string GDAPI godot_string_sha256_text(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->sha256_text())); + + return result; +}; + +godot_bool godot_string_empty(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->empty(); +}; + +// path functions +godot_string GDAPI godot_string_get_base_dir(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->get_base_dir(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_get_file(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->get_file(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_humanize_size(size_t p_size) { + godot_string result; + String return_value = String::humanize_size(p_size); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_bool GDAPI godot_string_is_abs_path(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_abs_path(); +}; + +godot_bool GDAPI godot_string_is_rel_path(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_rel_path(); +}; + +godot_bool GDAPI godot_string_is_resource_file(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_resource_file(); +}; + +godot_string GDAPI godot_string_path_to(const godot_string *p_self, const godot_string *p_path) { + const String *self = (const String *)p_self; + String *path = (String *)p_path; + godot_string result; + String return_value = self->path_to(*path); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_path_to_file(const godot_string *p_self, const godot_string *p_path) { + const String *self = (const String *)p_self; + String *path = (String *)p_path; + godot_string result; + String return_value = self->path_to_file(*path); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_simplify_path(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->simplify_path(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_c_escape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->c_escape(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_c_escape_multiline(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->c_escape_multiline(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_c_unescape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->c_unescape(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_http_escape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->http_escape(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_http_unescape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->http_unescape(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_json_escape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->json_escape(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_word_wrap(const godot_string *p_self, godot_int p_chars_per_line) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->word_wrap(p_chars_per_line); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_xml_escape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->xml_escape(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_xml_escape_with_quotes(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->xml_escape(true); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_xml_unescape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->xml_unescape(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_percent_decode(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->percent_decode(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_string GDAPI godot_string_percent_encode(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->percent_encode(); + memnew_placement(&result, String(return_value)); + + return result; +}; + +godot_bool GDAPI godot_string_is_valid_float(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_valid_float(); +}; + +godot_bool GDAPI godot_string_is_valid_hex_number(const godot_string *p_self, godot_bool p_with_prefix) { + const String *self = (const String *)p_self; + + return self->is_valid_hex_number(p_with_prefix); +}; + +godot_bool GDAPI godot_string_is_valid_html_color(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_valid_html_color(); +}; + +godot_bool GDAPI godot_string_is_valid_identifier(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_valid_identifier(); +}; + +godot_bool GDAPI godot_string_is_valid_integer(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_valid_integer(); +}; + +godot_bool GDAPI godot_string_is_valid_ip_address(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_valid_ip_address(); +}; + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/godot/string.h b/modules/gdnative/godot/string.h index 9013326454..bfe66aa5ec 100644 --- a/modules/gdnative/godot/string.h +++ b/modules/gdnative/godot/string.h @@ -47,6 +47,7 @@ typedef struct { #endif #include <godot/gdnative.h> +#include <godot/variant.h> void GDAPI godot_string_new(godot_string *r_dest); void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src); @@ -63,9 +64,160 @@ godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const g godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b); godot_string GDAPI godot_string_operator_plus(const godot_string *p_self, const godot_string *p_b); -// @Incomplete -// hmm, I guess exposing the whole API doesn't make much sense -// since the language used in the library has its own string funcs +/* Standard size stuff */ + +godot_int GDAPI godot_string_length(const godot_string *p_self); + +/* Helpers */ + +godot_bool GDAPI godot_string_begins_with(const godot_string *p_self, const godot_string *p_string); +godot_bool GDAPI godot_string_begins_with_char_array(const godot_string *p_self, const char *p_char_array); +godot_array GDAPI godot_string_bigrams(const godot_string *p_self); +godot_string GDAPI godot_string_chr(wchar_t p_character); +godot_bool GDAPI godot_string_ends_with(const godot_string *p_self, const godot_string *p_string); +godot_int GDAPI godot_string_find(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_find_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_int GDAPI godot_string_findmk(const godot_string *p_self, const godot_array *p_keys); +godot_int GDAPI godot_string_findmk_from(const godot_string *p_self, const godot_array *p_keys, godot_int p_from); +godot_int GDAPI godot_string_findmk_from_in_place(const godot_string *p_self, const godot_array *p_keys, godot_int p_from, godot_int *r_key); +godot_int GDAPI godot_string_findn(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_findn_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_int GDAPI find_last(const godot_string *p_self, godot_string p_what); +godot_string GDAPI godot_string_format(const godot_string *p_self, const godot_variant *values); +godot_string GDAPI godot_string_format_with_custom_placeholder(const godot_string *p_self, const godot_variant *values, const char *placeholder); +godot_string GDAPI godot_string_hex_encode_buffer(const uint8_t *p_buffer, godot_int p_len); +godot_int GDAPI godot_string_hex_to_int(const godot_string *p_self); +godot_int GDAPI godot_string_hex_to_int_without_prefix(const godot_string *p_self); +godot_string GDAPI godot_string_insert(const godot_string *p_self, godot_int p_at_pos, godot_string p_string); +godot_bool GDAPI godot_string_is_numeric(const godot_string *p_self); +godot_bool GDAPI godot_string_is_subsequence_of(const godot_string *p_self, const godot_string *p_string); +godot_bool GDAPI godot_string_is_subsequence_ofi(const godot_string *p_self, const godot_string *p_string); +godot_string GDAPI godot_string_lpad(const godot_string *p_self, godot_int p_min_length); +godot_string GDAPI godot_string_lpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); +godot_bool GDAPI godot_string_match(const godot_string *p_self, const godot_string *p_wildcard); +godot_bool GDAPI godot_string_matchn(const godot_string *p_self, const godot_string *p_wildcard); +godot_string GDAPI godot_string_md5(const uint8_t *p_md5); +godot_string GDAPI godot_string_num(double p_num); +godot_string GDAPI godot_string_num_int64(int64_t p_num, godot_int p_base); +godot_string GDAPI godot_string_num_int64_capitalized(int64_t p_num, godot_int p_base, godot_bool p_capitalize_hex); +godot_string GDAPI godot_string_num_real(double p_num); +godot_string GDAPI godot_string_num_scientific(double p_num); +godot_string GDAPI godot_string_num_with_decimals(double p_num, godot_int p_decimals); +godot_string GDAPI godot_string_pad_decimals(const godot_string *p_self, godot_int p_digits); +godot_string GDAPI godot_string_pad_zeros(const godot_string *p_self, godot_int p_digits); +godot_string GDAPI godot_string_replace_first(const godot_string *p_self, godot_string p_key, godot_string p_with); +godot_string GDAPI godot_string_replace(const godot_string *p_self, godot_string p_key, godot_string p_with); +godot_string GDAPI godot_string_replacen(const godot_string *p_self, godot_string p_key, godot_string p_with); +godot_int GDAPI godot_string_rfind(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_rfindn(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_rfind_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_int GDAPI godot_string_rfindn_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_string GDAPI godot_string_rpad(const godot_string *p_self, godot_int p_min_length); +godot_string GDAPI godot_string_rpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); +godot_real GDAPI godot_string_similarity(const godot_string *p_self, const godot_string *p_string); +godot_string GDAPI godot_string_sprintf(const godot_string *p_self, const godot_array *p_values, godot_bool *p_error); +godot_string GDAPI godot_string_substr(const godot_string *p_self, godot_int p_from, godot_int p_chars); +double GDAPI godot_string_to_double(const godot_string *p_self); +godot_real GDAPI godot_string_to_float(const godot_string *p_self); +godot_int GDAPI godot_string_to_int(const godot_string *p_self); + +godot_string GDAPI godot_string_camelcase_to_underscore(const godot_string *p_self); +godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_string *p_self); +godot_string GDAPI godot_string_capitalize(const godot_string *p_self); +double GDAPI godot_string_char_to_double(const char *p_what); +godot_int GDAPI godot_string_char_to_int(const char *p_what); +int64_t GDAPI godot_string_wchar_to_int(const wchar_t *p_str); +godot_int GDAPI godot_string_char_to_int_with_len(const char *p_what, godot_int p_len); +int64_t GDAPI godot_string_char_to_int64_with_len(const wchar_t *p_str, int p_len); +int64_t GDAPI godot_string_hex_to_int64(const godot_string *p_self); +int64_t GDAPI godot_string_hex_to_int64_with_prefix(const godot_string *p_self); +int64_t GDAPI godot_string_to_int64(const godot_string *p_self); +double GDAPI godot_string_unicode_char_to_double(const wchar_t *p_str, const wchar_t **r_end); + +godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, godot_string p_splitter); +godot_string GDAPI godot_string_get_slice(const godot_string *p_self, godot_string p_splitter, godot_int p_slice); +godot_string GDAPI godot_string_get_slicec(const godot_string *p_self, wchar_t p_splitter, godot_int p_slice); + +godot_array GDAPI godot_string_split(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_allow_empty(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_floats(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_floats_allows_empty(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_floats_mk(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_floats_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_ints(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_ints_allows_empty(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_ints_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_spaces(const godot_string *p_self); + +wchar_t GDAPI godot_string_char_lowercase(wchar_t p_char); +wchar_t GDAPI godot_string_char_uppercase(wchar_t p_char); +godot_string GDAPI godot_string_to_lower(const godot_string *p_self); +godot_string GDAPI godot_string_to_upper(const godot_string *p_self); + +godot_string GDAPI godot_string_get_basename(const godot_string *p_self); +godot_string GDAPI godot_string_get_extension(const godot_string *p_self); +godot_string GDAPI godot_string_left(const godot_string *p_self, godot_int p_pos); +wchar_t GDAPI godot_string_ord_at(const godot_string *p_self, godot_int p_idx); +godot_string GDAPI godot_string_plus_file(const godot_string *p_self, const godot_string *p_file); +godot_string GDAPI godot_string_right(const godot_string *p_self, godot_int p_pos); +godot_string GDAPI godot_string_strip_edges(const godot_string *p_self, godot_bool p_left, godot_bool p_right); +godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self); + +void GDAPI godot_string_erase(godot_string *p_self, godot_int p_pos, godot_int p_chars); + +void GDAPI godot_string_ascii(godot_string *p_self, char *result); +void GDAPI godot_string_ascii_extended(godot_string *p_self, char *result); +void GDAPI godot_string_utf8(godot_string *p_self, char *result); +godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8); +godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len); +godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8); +godot_string GDAPI godot_string_chars_utf8_with_len(const char *p_utf8, godot_int p_len); + +uint32_t GDAPI godot_string_hash(const godot_string *p_self); +uint64_t GDAPI godot_string_hash64(const godot_string *p_self); +uint32_t GDAPI godot_string_hash_chars(const char *p_cstr); +uint32_t GDAPI godot_string_hash_chars_with_len(const char *p_cstr, godot_int p_len); +uint32_t GDAPI godot_string_hash_utf8_chars(const wchar_t *p_str); +uint32_t GDAPI godot_string_hash_utf8_chars_with_len(const wchar_t *p_str, godot_int p_len); +godot_pool_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self); +godot_string GDAPI godot_string_md5_text(const godot_string *p_self); +godot_pool_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self); +godot_string GDAPI godot_string_sha256_text(const godot_string *p_self); + +godot_bool godot_string_empty(const godot_string *p_self); + +// path functions +godot_string GDAPI godot_string_get_base_dir(const godot_string *p_self); +godot_string GDAPI godot_string_get_file(const godot_string *p_self); +godot_string GDAPI godot_string_humanize_size(size_t p_size); +godot_bool GDAPI godot_string_is_abs_path(const godot_string *p_self); +godot_bool GDAPI godot_string_is_rel_path(const godot_string *p_self); +godot_bool GDAPI godot_string_is_resource_file(const godot_string *p_self); +godot_string GDAPI godot_string_path_to(const godot_string *p_self, const godot_string *p_path); +godot_string GDAPI godot_string_path_to_file(const godot_string *p_self, const godot_string *p_path); +godot_string GDAPI godot_string_simplify_path(const godot_string *p_self); + +godot_string GDAPI godot_string_c_escape(const godot_string *p_self); +godot_string GDAPI godot_string_c_escape_multiline(const godot_string *p_self); +godot_string GDAPI godot_string_c_unescape(const godot_string *p_self); +godot_string GDAPI godot_string_http_escape(const godot_string *p_self); +godot_string GDAPI godot_string_http_unescape(const godot_string *p_self); +godot_string GDAPI godot_string_json_escape(const godot_string *p_self); +godot_string GDAPI godot_string_word_wrap(const godot_string *p_self, godot_int p_chars_per_line); +godot_string GDAPI godot_string_xml_escape(const godot_string *p_self); +godot_string GDAPI godot_string_xml_escape_with_quotes(const godot_string *p_self); +godot_string GDAPI godot_string_xml_unescape(const godot_string *p_self); + +godot_string GDAPI godot_string_percent_decode(const godot_string *p_self); +godot_string GDAPI godot_string_percent_encode(const godot_string *p_self); + +godot_bool GDAPI godot_string_is_valid_float(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_hex_number(const godot_string *p_self, godot_bool p_with_prefix); +godot_bool GDAPI godot_string_is_valid_html_color(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_identifier(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_integer(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_ip_address(const godot_string *p_self); void GDAPI godot_string_destroy(godot_string *p_self); diff --git a/modules/gdnative/godot/variant.cpp b/modules/gdnative/godot/variant.cpp index 506614583c..d814ef913c 100644 --- a/modules/gdnative/godot/variant.cpp +++ b/modules/gdnative/godot/variant.cpp @@ -433,7 +433,6 @@ godot_variant GDAPI godot_variant_call(godot_variant *p_self, const godot_string Variant *dest = (Variant *)&raw_dest; Variant::CallError error; memnew_placement_custom(dest, Variant, Variant(self->call(*method, args, p_argcount, error))); - *dest = self->call(StringName(*method), args, p_argcount, r_error); if (r_error) { r_error->error = (godot_variant_call_error_error)error.error; r_error->argument = error.argument; diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index c88889767c..f8b45af85a 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -157,7 +157,7 @@ Script *GDScriptLanguage::create_script() const { bool GDScriptLanguage::debug_break_parse(const String &p_file, int p_line, const String &p_error) { //break because of parse error - if (ScriptDebugger::get_singleton() && Thread::get_caller_ID() == Thread::get_main_ID()) { + if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) { _debug_parse_err_line = p_line; _debug_parse_err_file = p_file; @@ -171,7 +171,7 @@ bool GDScriptLanguage::debug_break_parse(const String &p_file, int p_line, const bool GDScriptLanguage::debug_break(const String &p_error, bool p_allow_continue) { - if (ScriptDebugger::get_singleton() && Thread::get_caller_ID() == Thread::get_main_ID()) { + if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) { _debug_parse_err_line = -1; _debug_parse_err_file = ""; diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index 795371af60..cafcc1e965 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -888,8 +888,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a gdfs->state._class = _class; gdfs->state.ip = ip + ipofs; gdfs->state.line = line; - gdfs->state.instance_id = (p_instance && p_instance->get_owner()) ? p_instance->get_owner()->get_instance_ID() : 0; - gdfs->state.script_id = _class->get_instance_ID(); + gdfs->state.instance_id = (p_instance && p_instance->get_owner()) ? p_instance->get_owner()->get_instance_id() : 0; + gdfs->state.script_id = _class->get_instance_id(); //gdfs->state.result_pos=ip+ipofs-1; gdfs->state.defarg = defarg; gdfs->state.instance = p_instance; @@ -1507,7 +1507,7 @@ Variant GDFunctionState::resume(const Variant &p_arg) { void GDFunctionState::_bind_methods() { - ClassDB::bind_method(D_METHOD("resume:Variant", "arg"), &GDFunctionState::resume, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("resume", "arg"), &GDFunctionState::resume, DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("is_valid", "extended_check"), &GDFunctionState::is_valid, DEFVAL(false)); ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &GDFunctionState::_signal_callback, MethodInfo("_signal_callback")); diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index 8bc3b24a5e..209bdadd67 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -113,6 +113,7 @@ const char *GDFunctions::get_func_name(Function p_func) { "ColorN", "print_stack", "instance_from_id", + "len", }; return _names[p_func]; @@ -1154,6 +1155,62 @@ void GDFunctions::call(Function p_func, const Variant **p_args, int p_arg_count, r_ret = ObjectDB::get_instance(id); } break; + case LEN: { + + VALIDATE_ARG_COUNT(1); + switch (p_args[0]->get_type()) { + case Variant::DICTIONARY: { + Dictionary d = *p_args[0]; + r_ret = d.size(); + } break; + case Variant::ARRAY: { + Array d = *p_args[0]; + r_ret = d.size(); + } break; + case Variant::POOL_BYTE_ARRAY: { + PoolVector<uint8_t> d = *p_args[0]; + r_ret = d.size(); + + } break; + case Variant::POOL_INT_ARRAY: { + PoolVector<int> d = *p_args[0]; + r_ret = d.size(); + } break; + case Variant::POOL_REAL_ARRAY: { + + PoolVector<real_t> d = *p_args[0]; + r_ret = d.size(); + } break; + case Variant::POOL_STRING_ARRAY: { + PoolVector<String> d = *p_args[0]; + r_ret = d.size(); + + } break; + case Variant::POOL_VECTOR2_ARRAY: { + PoolVector<Vector2> d = *p_args[0]; + r_ret = d.size(); + + } break; + case Variant::POOL_VECTOR3_ARRAY: { + + PoolVector<Vector3> d = *p_args[0]; + r_ret = d.size(); + } break; + case Variant::POOL_COLOR_ARRAY: { + + PoolVector<Color> d = *p_args[0]; + r_ret = d.size(); + } break; + default: { + r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument = 0; + r_error.expected = Variant::OBJECT; + r_ret = Variant(); + r_ret = RTR("Object can't provide a length."); + } + } + + } break; case FUNC_MAX: { ERR_FAIL(); @@ -1210,6 +1267,7 @@ bool GDFunctions::is_deterministic(Function p_func) { case TEXT_CHAR: case TEXT_STR: case COLOR8: + case LEN: // enable for debug only, otherwise not desirable - case GEN_RANGE: return true; default: @@ -1621,6 +1679,11 @@ MethodInfo GDFunctions::get_info(Function p_func) { mi.return_val.type = Variant::OBJECT; return mi; } break; + case LEN: { + MethodInfo mi("len", PropertyInfo(Variant::NIL, "var")); + mi.return_val.type = Variant::INT; + return mi; + } break; case FUNC_MAX: { diff --git a/modules/gdscript/gd_functions.h b/modules/gdscript/gd_functions.h index 4d52abaeab..93cb524118 100644 --- a/modules/gdscript/gd_functions.h +++ b/modules/gdscript/gd_functions.h @@ -105,6 +105,7 @@ public: COLORN, PRINT_STACK, INSTANCE_FROM_ID, + LEN, FUNC_MAX }; diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 36aa249398..9023fd4bf4 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2369,8 +2369,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { check_block = check_block->parent_block; } - p_block->variables.push_back(n); //line? - p_block->variable_lines.push_back(tokenizer->get_token_line()); + int var_line = tokenizer->get_token_line(); //must know when the local variable is declared LocalVarNode *lv = alloc_node<LocalVarNode>(); @@ -2400,6 +2399,10 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { c->value = Variant(); assigned = c; } + //must be added later, to avoid self-referencing. + p_block->variables.push_back(n); //line? + p_block->variable_lines.push_back(var_line); + IdentifierNode *id = alloc_node<IdentifierNode>(); id->name = n; diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index fe87433a89..9d304c6d34 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -479,7 +479,7 @@ bool GDScript::_update_exports() { const GDParser::ClassNode *c = static_cast<const GDParser::ClassNode *>(root); if (base_cache.is_valid()) { - base_cache->inheriters_cache.erase(get_instance_ID()); + base_cache->inheriters_cache.erase(get_instance_id()); base_cache = Ref<GDScript>(); } @@ -505,7 +505,7 @@ bool GDScript::_update_exports() { //print_line("parent is: "+bf->get_path()); base_cache = bf; - bf->inheriters_cache.insert(get_instance_ID()); + bf->inheriters_cache.insert(get_instance_id()); //bf->_update_exports(p_instances,true,false); } @@ -1693,7 +1693,7 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so if (obj->get_script_instance()) { obj->get_script_instance()->get_property_state(state); - map[obj->get_instance_ID()] = state; + map[obj->get_instance_id()] = state; obj->set_script(RefPtr()); } } @@ -1709,7 +1709,7 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so if (obj->get_script_instance()) { obj->get_script_instance()->get_property_state(state); - map[obj->get_instance_ID()] = state; + map[obj->get_instance_id()] = state; obj->set_script(RefPtr()); } else { // no instance found. Let's remove it so we don't loop forever @@ -1743,8 +1743,8 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so obj->set_script(scr.get_ref_ptr()); if (!obj->get_script_instance()) { //failed, save reload state for next time if not saved - if (!scr->pending_reload_state.has(obj->get_instance_ID())) { - scr->pending_reload_state[obj->get_instance_ID()] = F->get(); + if (!scr->pending_reload_state.has(obj->get_instance_id())) { + scr->pending_reload_state[obj->get_instance_id()] = F->get(); } continue; } @@ -1753,7 +1753,7 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so obj->get_script_instance()->set(G->get().first, G->get().second); } - scr->pending_reload_state.erase(obj->get_instance_ID()); //as it reloaded, remove pending state + scr->pending_reload_state.erase(obj->get_instance_id()); //as it reloaded, remove pending state } //if instance states were saved, set them! diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 0add348ca9..17e7b0bc03 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -298,7 +298,7 @@ public: _FORCE_INLINE_ void enter_function(GDInstance *p_instance, GDFunction *p_function, Variant *p_stack, int *p_ip, int *p_line) { - if (Thread::get_main_ID() != Thread::get_caller_ID()) + if (Thread::get_main_id() != Thread::get_caller_id()) return; //no support for other threads than main for now if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0) @@ -321,7 +321,7 @@ public: _FORCE_INLINE_ void exit_function() { - if (Thread::get_main_ID() != Thread::get_caller_ID()) + if (Thread::get_main_id() != Thread::get_caller_id()) return; //no support for other threads than main for now if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0) @@ -338,7 +338,7 @@ public: } virtual Vector<StackInfo> debug_get_current_stack_info() { - if (Thread::get_main_ID() != Thread::get_caller_ID()) + if (Thread::get_main_id() != Thread::get_caller_id()) return Vector<StackInfo>(); Vector<StackInfo> csi; diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 8c2c2ea345..f241a96e58 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -345,7 +345,7 @@ void GridMap::set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_rot) { Octant *g = memnew(Octant); g->dirty = true; g->static_body = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC); - PhysicsServer::get_singleton()->body_attach_object_instance_ID(g->static_body, get_instance_ID()); + PhysicsServer::get_singleton()->body_attach_object_instance_id(g->static_body, get_instance_id()); if (is_inside_world()) PhysicsServer::get_singleton()->body_set_space(g->static_body, get_world()->get_space()); @@ -830,8 +830,8 @@ void GridMap::_update_dirty_map_callback() { void GridMap::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_theme", "theme:MeshLibrary"), &GridMap::set_theme); - ClassDB::bind_method(D_METHOD("get_theme:MeshLibrary"), &GridMap::get_theme); + ClassDB::bind_method(D_METHOD("set_theme", "theme"), &GridMap::set_theme); + ClassDB::bind_method(D_METHOD("get_theme"), &GridMap::get_theme); ClassDB::bind_method(D_METHOD("set_cell_size", "size"), &GridMap::set_cell_size); ClassDB::bind_method(D_METHOD("get_cell_size"), &GridMap::get_cell_size); @@ -857,7 +857,7 @@ void GridMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_clip", "enabled", "clipabove", "floor", "axis"), &GridMap::set_clip, DEFVAL(true), DEFVAL(0), DEFVAL(Vector3::AXIS_X)); ClassDB::bind_method(D_METHOD("create_area", "id", "area"), &GridMap::create_area); - ClassDB::bind_method(D_METHOD("area_get_bounds", "area", "bounds"), &GridMap::area_get_bounds); + ClassDB::bind_method(D_METHOD("area_get_bounds", "area"), &GridMap::area_get_bounds); ClassDB::bind_method(D_METHOD("area_set_exterior_portal", "area", "enable"), &GridMap::area_set_exterior_portal); ClassDB::bind_method(D_METHOD("area_set_name", "area", "name"), &GridMap::area_set_name); ClassDB::bind_method(D_METHOD("area_get_name", "area"), &GridMap::area_get_name); @@ -867,7 +867,7 @@ void GridMap::_bind_methods() { ClassDB::bind_method(D_METHOD("area_set_portal_disable_color", "area", "color"), &GridMap::area_set_portal_disable_color); ClassDB::bind_method(D_METHOD("area_get_portal_disable_color", "area"), &GridMap::area_get_portal_disable_color); ClassDB::bind_method(D_METHOD("erase_area", "area"), &GridMap::erase_area); - ClassDB::bind_method(D_METHOD("get_unused_area_id", "area"), &GridMap::get_unused_area_id); + ClassDB::bind_method(D_METHOD("get_unused_area_id"), &GridMap::get_unused_area_id); ClassDB::bind_method(D_METHOD("clear"), &GridMap::clear); diff --git a/modules/nativescript/nativescript.cpp b/modules/nativescript/nativescript.cpp index fb334e573c..101928a668 100644 --- a/modules/nativescript/nativescript.cpp +++ b/modules/nativescript/nativescript.cpp @@ -55,11 +55,11 @@ ////// Script stuff void NativeScript::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_class_name", "class_name:String"), &NativeScript::set_class_name); - ClassDB::bind_method(D_METHOD("get_class_name:String"), &NativeScript::get_class_name); + ClassDB::bind_method(D_METHOD("set_class_name", "class_name"), &NativeScript::set_class_name); + ClassDB::bind_method(D_METHOD("get_class_name"), &NativeScript::get_class_name); - ClassDB::bind_method(D_METHOD("set_library", "library:GDNativeLibrary"), &NativeScript::set_library); - ClassDB::bind_method(D_METHOD("get_library:GDNativeLibrary"), &NativeScript::get_library); + ClassDB::bind_method(D_METHOD("set_library", "library"), &NativeScript::set_library); + ClassDB::bind_method(D_METHOD("get_library"), &NativeScript::get_library); ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "class_name"), "set_class_name", "get_class_name"); ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "GDNativeLibrary"), "set_library", "get_library"); @@ -77,14 +77,12 @@ void NativeScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) ERR_FAIL_COND(!script_data); List<PropertyInfo> info; + get_script_property_list(&info); Map<StringName, Variant> values; - - for (Map<StringName, NativeScriptDesc::Property>::Element *E = script_data->properties.front(); E; E = E->next()) { - PropertyInfo p = E->get().info; - p.name = String(E->key()); - - info.push_back(p); - values[p.name] = E->get().default_value; + for (List<PropertyInfo>::Element *E = info.front(); E; E = E->next()) { + Variant value; + get_property_default_value(E->get().name, value); + values[E->get().name] = value; } p_placeholder->update(info, values); @@ -113,7 +111,7 @@ void NativeScript::set_library(Ref<GDNativeLibrary> p_library) { lib_path = library->get_active_library_path(); #ifndef NO_THREADS - if (Thread::get_caller_ID() != Thread::get_main_ID()) { + if (Thread::get_caller_id() != Thread::get_main_id()) { NSL->defer_init_library(p_library, this); } else #endif @@ -317,11 +315,11 @@ void NativeScript::get_script_signal_list(List<MethodInfo> *r_signals) const { bool NativeScript::get_property_default_value(const StringName &p_property, Variant &r_value) const { NativeScriptDesc *script_data = get_script_desc(); - if (!script_data) - return false; - - Map<StringName, NativeScriptDesc::Property>::Element *P = script_data->properties.find(p_property); - + Map<StringName, NativeScriptDesc::Property>::Element *P = NULL; + while (!P && script_data) { + P = script_data->properties.find(p_property); + script_data = script_data->base_data; + } if (!P) return false; diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index c3e97e357d..c728657d6b 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -1496,7 +1496,7 @@ void RegEx::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &RegEx::clear); ClassDB::bind_method(D_METHOD("compile", "pattern"), &RegEx::compile); - ClassDB::bind_method(D_METHOD("search:RegExMatch", "text", "start", "end"), &RegEx::search, DEFVAL(0), DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("search", "text", "start", "end"), &RegEx::search, DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("sub", "text", "replacement", "all", "start", "end"), &RegEx::sub, DEFVAL(false), DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("is_valid"), &RegEx::is_valid); ClassDB::bind_method(D_METHOD("get_pattern"), &RegEx::get_pattern); diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index f15abec7e2..d1cf0f1dce 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -122,9 +122,9 @@ Array VisualScriptNode::_get_default_input_values() const { void VisualScriptNode::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_visual_script:VisualScript"), &VisualScriptNode::get_visual_script); - ClassDB::bind_method(D_METHOD("set_default_input_value", "port_idx", "value:Variant"), &VisualScriptNode::set_default_input_value); - ClassDB::bind_method(D_METHOD("get_default_input_value:Variant", "port_idx"), &VisualScriptNode::get_default_input_value); + ClassDB::bind_method(D_METHOD("get_visual_script"), &VisualScriptNode::get_visual_script); + ClassDB::bind_method(D_METHOD("set_default_input_value", "port_idx", "value"), &VisualScriptNode::set_default_input_value); + ClassDB::bind_method(D_METHOD("get_default_input_value", "port_idx"), &VisualScriptNode::get_default_input_value); ClassDB::bind_method(D_METHOD("_set_default_input_values", "values"), &VisualScriptNode::_set_default_input_values); ClassDB::bind_method(D_METHOD("_get_default_input_values"), &VisualScriptNode::_get_default_input_values); @@ -1058,6 +1058,10 @@ MethodInfo VisualScript::get_method_info(const StringName &p_method) const { arg.type = func->get_argument_type(i); mi.arguments.push_back(arg); } + + if (!func->is_sequenced()) { + mi.flags |= METHOD_FLAG_CONST; + } } } @@ -1267,11 +1271,11 @@ void VisualScript::_bind_methods() { ClassDB::bind_method(D_METHOD("set_function_scroll", "name", "ofs"), &VisualScript::set_function_scroll); ClassDB::bind_method(D_METHOD("get_function_scroll", "name"), &VisualScript::get_function_scroll); - ClassDB::bind_method(D_METHOD("add_node", "func", "id", "node:VisualScriptNode", "pos"), &VisualScript::add_node, DEFVAL(Point2())); + ClassDB::bind_method(D_METHOD("add_node", "func", "id", "node", "pos"), &VisualScript::add_node, DEFVAL(Point2())); ClassDB::bind_method(D_METHOD("remove_node", "func", "id"), &VisualScript::remove_node); ClassDB::bind_method(D_METHOD("get_function_node_id", "name"), &VisualScript::get_function_node_id); - ClassDB::bind_method(D_METHOD("get_node:VisualScriptNode", "func", "id"), &VisualScript::get_node); + ClassDB::bind_method(D_METHOD("get_node", "func", "id"), &VisualScript::get_node); ClassDB::bind_method(D_METHOD("has_node", "func", "id"), &VisualScript::has_node); ClassDB::bind_method(D_METHOD("set_node_pos", "func", "id", "pos"), &VisualScript::set_node_pos); ClassDB::bind_method(D_METHOD("get_node_pos", "func", "id"), &VisualScript::get_node_pos); @@ -1401,6 +1405,10 @@ void VisualScriptInstance::get_method_list(List<MethodInfo> *p_list) const { mi.arguments.push_back(arg); } + if (!vsf->is_sequenced()) { //assumed constant if not sequenced + mi.flags |= METHOD_FLAG_CONST; + } + //vsf->Get_ for now at least it does not return.. } } @@ -1607,8 +1615,8 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p } //step 1, capture all state - state->instance_id = get_owner_ptr()->get_instance_ID(); - state->script_id = get_script()->get_instance_ID(); + state->instance_id = get_owner_ptr()->get_instance_id(); + state->script_id = get_script()->get_instance_id(); state->instance = this; state->function = p_method; state->working_mem_index = node->working_mem_idx; @@ -2318,7 +2326,7 @@ Variant VisualScriptFunctionState::resume(Array p_args) { void VisualScriptFunctionState::_bind_methods() { ClassDB::bind_method(D_METHOD("connect_to_signal", "obj", "signals", "args"), &VisualScriptFunctionState::connect_to_signal); - ClassDB::bind_method(D_METHOD("resume:Array", "args"), &VisualScriptFunctionState::resume, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("resume", "args"), &VisualScriptFunctionState::resume, DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("is_valid"), &VisualScriptFunctionState::is_valid); ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &VisualScriptFunctionState::_signal_callback, MethodInfo("_signal_callback")); } @@ -2417,7 +2425,7 @@ void VisualScriptLanguage::add_global_constant(const StringName &p_variable, con bool VisualScriptLanguage::debug_break_parse(const String &p_file, int p_node, const String &p_error) { //break because of parse error - if (ScriptDebugger::get_singleton() && Thread::get_caller_ID() == Thread::get_main_ID()) { + if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) { _debug_parse_err_node = p_node; _debug_parse_err_file = p_file; @@ -2431,7 +2439,7 @@ bool VisualScriptLanguage::debug_break_parse(const String &p_file, int p_node, c bool VisualScriptLanguage::debug_break(const String &p_error, bool p_allow_continue) { - if (ScriptDebugger::get_singleton() && Thread::get_caller_ID() == Thread::get_main_ID()) { + if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) { _debug_parse_err_node = -1; _debug_parse_err_file = ""; diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index cdd7eded18..63ac5769c6 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -509,7 +509,7 @@ public: _FORCE_INLINE_ void enter_function(VisualScriptInstance *p_instance, const StringName *p_function, Variant *p_stack, Variant **p_work_mem, int *current_id) { - if (Thread::get_main_ID() != Thread::get_caller_ID()) + if (Thread::get_main_id() != Thread::get_caller_id()) return; //no support for other threads than main for now if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0) @@ -532,7 +532,7 @@ public: _FORCE_INLINE_ void exit_function() { - if (Thread::get_main_ID() != Thread::get_caller_ID()) + if (Thread::get_main_id() != Thread::get_caller_id()) return; //no support for other threads than main for now if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0) diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 35358d5a1f..8912227692 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -615,7 +615,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Ref<Resource> res = value; Array arr; - arr.push_back(button->get_instance_ID()); + arr.push_back(button->get_instance_id()); arr.push_back(String(value)); EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res, this, "_button_resource_previewed", arr); @@ -869,15 +869,27 @@ void VisualScriptEditor::_member_edited() { } selected = new_name; - _update_graph(); - + int node_id = script->get_function_node_id(name); + Ref<VisualScriptFunction> func; + if (script->has_node(name, node_id)) { + func = script->get_node(name, node_id); + } undo_redo->create_action(TTR("Rename Function")); undo_redo->add_do_method(script.ptr(), "rename_function", name, new_name); undo_redo->add_undo_method(script.ptr(), "rename_function", new_name, name); + if (func.is_valid()) { + + undo_redo->add_do_method(func.ptr(), "set_name", new_name); + undo_redo->add_undo_method(func.ptr(), "set_name", name); + } undo_redo->add_do_method(this, "_update_members"); undo_redo->add_undo_method(this, "_update_members"); + undo_redo->add_do_method(this, "_update_graph"); + undo_redo->add_undo_method(this, "_update_graph"); undo_redo->commit_action(); + // _update_graph(); + return; //or crash because it will become invalid } @@ -1969,7 +1981,7 @@ String VisualScriptEditor::get_name() { } else if (script->get_name() != "") name = script->get_name(); else - name = script->get_class() + "(" + itos(script->get_instance_ID()) + ")"; + name = script->get_class() + "(" + itos(script->get_instance_id()) + ")"; return name; } diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index c438edd21f..3c057cdbd5 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -603,13 +603,13 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const } else if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid()) { property.hint = PROPERTY_HINT_METHOD_OF_SCRIPT; - property.hint_string = itos(get_visual_script()->get_instance_ID()); + property.hint_string = itos(get_visual_script()->get_instance_id()); } else if (call_mode == CALL_MODE_SINGLETON) { Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); if (obj) { property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; - property.hint_string = itos(obj->get_instance_ID()); + property.hint_string = itos(obj->get_instance_id()); } else { property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; @@ -631,7 +631,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const if (script.is_valid()) { property.hint = PROPERTY_HINT_METHOD_OF_SCRIPT; - property.hint_string = itos(script->get_instance_ID()); + property.hint_string = itos(script->get_instance_id()); } } } @@ -640,7 +640,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const Node *node = _get_base_node(); if (node) { property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; - property.hint_string = itos(node->get_instance_ID()); + property.hint_string = itos(node->get_instance_id()); } else { property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; property.hint_string = get_base_type(); @@ -1379,7 +1379,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { } else if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid()) { property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(get_visual_script()->get_instance_ID()); + property.hint_string = itos(get_visual_script()->get_instance_id()); } else if (call_mode == CALL_MODE_INSTANCE) { property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; property.hint_string = base_type; @@ -1396,7 +1396,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { if (script.is_valid()) { property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(script->get_instance_ID()); + property.hint_string = itos(script->get_instance_id()); } } } @@ -1405,7 +1405,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { Node *node = _get_base_node(); if (node) { property.hint = PROPERTY_HINT_PROPERTY_OF_INSTANCE; - property.hint_string = itos(node->get_instance_ID()); + property.hint_string = itos(node->get_instance_id()); } else { property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; property.hint_string = get_base_type(); @@ -2095,7 +2095,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const { } else if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid()) { property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(get_visual_script()->get_instance_ID()); + property.hint_string = itos(get_visual_script()->get_instance_id()); } else if (call_mode == CALL_MODE_INSTANCE) { property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; property.hint_string = base_type; @@ -2112,7 +2112,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const { if (script.is_valid()) { property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(script->get_instance_ID()); + property.hint_string = itos(script->get_instance_id()); } } } @@ -2120,7 +2120,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const { Node *node = _get_base_node(); if (node) { property.hint = PROPERTY_HINT_PROPERTY_OF_INSTANCE; - property.hint_string = itos(node->get_instance_ID()); + property.hint_string = itos(node->get_instance_id()); } else { property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; property.hint_string = get_base_type(); diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 69aa10ebca..923e425997 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -95,6 +95,12 @@ bool VisualScriptFunction::_set(const StringName &p_name, const Variant &p_value return true; } + if (p_name == "sequenced/sequenced") { + sequenced = p_value; + ports_changed_notify(); + return true; + } + return false; } @@ -133,6 +139,11 @@ bool VisualScriptFunction::_get(const StringName &p_name, Variant &r_ret) const return true; } + if (p_name == "sequenced/sequenced") { + r_ret = sequenced; + return true; + } + return false; } void VisualScriptFunction::_get_property_list(List<PropertyInfo> *p_list) const { @@ -147,6 +158,9 @@ void VisualScriptFunction::_get_property_list(List<PropertyInfo> *p_list) const p_list->push_back(PropertyInfo(Variant::INT, "argument_" + itos(i + 1) + "/type", PROPERTY_HINT_ENUM, argt)); p_list->push_back(PropertyInfo(Variant::STRING, "argument_" + itos(i + 1) + "/name")); } + + p_list->push_back(PropertyInfo(Variant::BOOL, "sequenced/sequenced")); + if (!stack_less) { p_list->push_back(PropertyInfo(Variant::INT, "stack/size", PROPERTY_HINT_RANGE, "1,100000")); } @@ -302,6 +316,7 @@ VisualScriptFunction::VisualScriptFunction() { stack_size = 256; stack_less = false; + sequenced = true; rpc_mode = ScriptInstance::RPC_MODE_DISABLED; } @@ -314,6 +329,16 @@ bool VisualScriptFunction::is_stack_less() const { return stack_less; } +void VisualScriptFunction::set_sequenced(bool p_enable) { + + sequenced = p_enable; +} + +bool VisualScriptFunction::is_sequenced() const { + + return sequenced; +} + void VisualScriptFunction::set_stack_size(int p_size) { ERR_FAIL_COND(p_size < 1 || p_size > 100000); @@ -1076,7 +1101,7 @@ void VisualScriptConstant::_bind_methods() { ClassDB::bind_method(D_METHOD("get_constant_type"), &VisualScriptConstant::get_constant_type); ClassDB::bind_method(D_METHOD("set_constant_value", "value"), &VisualScriptConstant::set_constant_value); - ClassDB::bind_method(D_METHOD("get_constant_value:Variant"), &VisualScriptConstant::get_constant_value); + ClassDB::bind_method(D_METHOD("get_constant_value"), &VisualScriptConstant::get_constant_value); String argt = "Null"; for (int i = 1; i < Variant::VARIANT_MAX; i++) { @@ -1190,8 +1215,8 @@ Ref<Resource> VisualScriptPreload::get_preload() const { void VisualScriptPreload::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_preload", "resource:Resource"), &VisualScriptPreload::set_preload); - ClassDB::bind_method(D_METHOD("get_preload:Resource"), &VisualScriptPreload::get_preload); + ClassDB::bind_method(D_METHOD("set_preload", "resource"), &VisualScriptPreload::set_preload); + ClassDB::bind_method(D_METHOD("get_preload"), &VisualScriptPreload::get_preload); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), "set_preload", "get_preload"); } @@ -1467,7 +1492,7 @@ void VisualScriptGlobalConstant::_bind_methods() { cc += ","; cc += GlobalConstants::get_global_constant_name(i); } - ADD_PROPERTY(PropertyInfo(Variant::INT, "constant", PROPERTY_HINT_ENUM, cc), "set_global_constant", "get_global_constant"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "constant/constant", PROPERTY_HINT_ENUM, cc), "set_global_constant", "get_global_constant"); } VisualScriptGlobalConstant::VisualScriptGlobalConstant() { @@ -1572,7 +1597,7 @@ VisualScriptNodeInstance *VisualScriptClassConstant::instance(VisualScriptInstan void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "constant") { + if (property.name == "constant/constant") { List<String> constants; ClassDB::get_integer_constant_list(base_type, &constants, true); @@ -1596,7 +1621,7 @@ void VisualScriptClassConstant::_bind_methods() { ClassDB::bind_method(D_METHOD("get_base_type"), &VisualScriptClassConstant::get_base_type); ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type", PROPERTY_HINT_TYPE_STRING, "Object"), "set_base_type", "get_base_type"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant", PROPERTY_HINT_ENUM, ""), "set_class_constant", "get_class_constant"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant/constant", PROPERTY_HINT_ENUM, ""), "set_class_constant", "get_class_constant"); } VisualScriptClassConstant::VisualScriptClassConstant() { @@ -1701,7 +1726,7 @@ VisualScriptNodeInstance *VisualScriptBasicTypeConstant::instance(VisualScriptIn void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "constant") { + if (property.name == "constant/constant") { List<StringName> constants; Variant::get_numeric_constants_for_type(type, &constants); @@ -1734,7 +1759,7 @@ void VisualScriptBasicTypeConstant::_bind_methods() { } ADD_PROPERTY(PropertyInfo(Variant::INT, "basic_type", PROPERTY_HINT_ENUM, argt), "set_basic_type", "get_basic_type"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant", PROPERTY_HINT_ENUM, ""), "set_basic_type_constant", "get_basic_type_constant"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant/constant", PROPERTY_HINT_ENUM, ""), "set_basic_type_constant", "get_basic_type_constant"); } VisualScriptBasicTypeConstant::VisualScriptBasicTypeConstant() { @@ -1855,7 +1880,7 @@ void VisualScriptMathConstant::_bind_methods() { cc += ","; cc += const_name[i]; } - ADD_PROPERTY(PropertyInfo(Variant::INT, "constant", PROPERTY_HINT_ENUM, cc), "set_math_constant", "get_math_constant"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "constant/constant", PROPERTY_HINT_ENUM, cc), "set_math_constant", "get_math_constant"); } VisualScriptMathConstant::VisualScriptMathConstant() { @@ -1976,7 +2001,7 @@ void VisualScriptEngineSingleton::_bind_methods() { cc += E->get().name; } - ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant", PROPERTY_HINT_ENUM, cc), "set_singleton", "get_singleton"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant/constant", PROPERTY_HINT_ENUM, cc), "set_singleton", "get_singleton"); } VisualScriptEngineSingleton::VisualScriptEngineSingleton() { @@ -2798,7 +2823,7 @@ public: r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; return 0; } - *p_outputs[0] = subcall->call(VisualScriptLanguage::singleton->_subcall, p_inputs, input_args, r_error_str); + *p_outputs[0] = subcall->call(VisualScriptLanguage::singleton->_subcall, p_inputs, input_args, r_error); return 0; } }; @@ -2819,7 +2844,7 @@ VisualScriptNodeInstance *VisualScriptSubCall::instance(VisualScriptInstance *p_ void VisualScriptSubCall::_bind_methods() { - BIND_VMETHOD(MethodInfo(Variant::NIL, "_subcall", PropertyInfo(Variant::NIL, "arguments:Variant"))); + BIND_VMETHOD(MethodInfo(Variant::NIL, "_subcall:Variant", PropertyInfo(Variant::NIL, "arguments:Variant"))); } VisualScriptSubCall::VisualScriptSubCall() { @@ -3702,11 +3727,11 @@ void register_visual_script_nodes() { VisualScriptLanguage::singleton->add_register_func("data/preload", create_node_generic<VisualScriptPreload>); VisualScriptLanguage::singleton->add_register_func("data/action", create_node_generic<VisualScriptInputAction>); - VisualScriptLanguage::singleton->add_register_func("constants/constant", create_node_generic<VisualScriptConstant>); - VisualScriptLanguage::singleton->add_register_func("constants/math_constant", create_node_generic<VisualScriptMathConstant>); - VisualScriptLanguage::singleton->add_register_func("constants/class_constant", create_node_generic<VisualScriptClassConstant>); - VisualScriptLanguage::singleton->add_register_func("constants/global_constant", create_node_generic<VisualScriptGlobalConstant>); - VisualScriptLanguage::singleton->add_register_func("constants/basic_type_constant", create_node_generic<VisualScriptBasicTypeConstant>); + VisualScriptLanguage::singleton->add_register_func("constant/constants/constant", create_node_generic<VisualScriptConstant>); + VisualScriptLanguage::singleton->add_register_func("constant/constants/math_constant", create_node_generic<VisualScriptMathConstant>); + VisualScriptLanguage::singleton->add_register_func("constant/constants/class_constant", create_node_generic<VisualScriptClassConstant>); + VisualScriptLanguage::singleton->add_register_func("constant/constants/global_constant", create_node_generic<VisualScriptGlobalConstant>); + VisualScriptLanguage::singleton->add_register_func("constant/constants/basic_type_constant", create_node_generic<VisualScriptBasicTypeConstant>); VisualScriptLanguage::singleton->add_register_func("custom/custom_node", create_node_generic<VisualScriptCustomNode>); VisualScriptLanguage::singleton->add_register_func("custom/sub_call", create_node_generic<VisualScriptSubCall>); diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h index 7a3b26fe55..ff49417114 100644 --- a/modules/visual_script/visual_script_nodes.h +++ b/modules/visual_script/visual_script_nodes.h @@ -46,6 +46,7 @@ class VisualScriptFunction : public VisualScriptNode { bool stack_less; int stack_size; ScriptInstance::RPCMode rpc_mode; + bool sequenced; protected: bool _set(const StringName &p_name, const Variant &p_value); @@ -79,9 +80,18 @@ public: void set_stack_less(bool p_enable); bool is_stack_less() const; + void set_sequenced(bool p_enable); + bool is_sequenced() const; + void set_stack_size(int p_size); int get_stack_size() const; + void set_return_type_enabled(bool p_returns); + bool is_return_type_enabled() const; + + void set_return_type(Variant::Type p_type); + Variant::Type get_return_type() const; + void set_rpc_mode(ScriptInstance::RPCMode p_mode); ScriptInstance::RPCMode get_rpc_mode() const; diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp index 52ff9cd562..bd266c76bf 100644 --- a/platform/android/java_class_wrapper.cpp +++ b/platform/android/java_class_wrapper.cpp @@ -546,7 +546,7 @@ JavaObject::~JavaObject() { void JavaClassWrapper::_bind_methods() { - ClassDB::bind_method(D_METHOD("wrap:JavaClass", "name"), &JavaClassWrapper::wrap); + ClassDB::bind_method(D_METHOD("wrap", "name"), &JavaClassWrapper::wrap); } bool JavaClassWrapper::_get_type_sig(JNIEnv *env, jobject obj, uint32_t &sig, String &strsig) { diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 0508989d2f..683e1cfb22 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -895,7 +895,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, jobject obj, jint width, jint height, jboolean reload) { - __android_log_print(ANDROID_LOG_INFO, "godot", "^_^_^_^_^ resize %lld, %i, %i\n", Thread::get_caller_ID(), width, height); + __android_log_print(ANDROID_LOG_INFO, "godot", "^_^_^_^_^ resize %lld, %i, %i\n", Thread::get_caller_id(), width, height); if (os_android) os_android->set_display_size(Size2(width, height)); @@ -909,7 +909,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, j JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv *env, jobject obj, bool p_32_bits) { - __android_log_print(ANDROID_LOG_INFO, "godot", "^_^_^_^_^ newcontext %lld\n", Thread::get_caller_ID()); + __android_log_print(ANDROID_LOG_INFO, "godot", "^_^_^_^_^ newcontext %lld\n", Thread::get_caller_id()); if (os_android) { os_android->set_context_is_16_bits(!p_32_bits); @@ -995,7 +995,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job ThreadAndroid::setup_thread(); - //__android_log_print(ANDROID_LOG_INFO,"godot","**STEP EVENT! - %p-%i\n",env,Thread::get_caller_ID()); + //__android_log_print(ANDROID_LOG_INFO,"godot","**STEP EVENT! - %p-%i\n",env,Thread::get_caller_id()); suspend_mutex->lock(); input_mutex->lock(); @@ -1069,7 +1069,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job jclass cls = env->FindClass("org/godotengine/godot/Godot"); jmethodID _finish = env->GetMethodID(cls, "forceQuit", "()V"); env->CallVoidMethod(_godot_instance, _finish); - __android_log_print(ANDROID_LOG_INFO, "godot", "**FINISH REQUEST!!! - %p-%i\n", env, Thread::get_caller_ID()); + __android_log_print(ANDROID_LOG_INFO, "godot", "**FINISH REQUEST!!! - %p-%i\n", env, Thread::get_caller_id()); } suspend_mutex->unlock(); @@ -1077,7 +1077,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch(JNIEnv *env, jobject obj, jint ev, jint pointer, jint count, jintArray positions) { - //__android_log_print(ANDROID_LOG_INFO,"godot","**TOUCH EVENT! - %p-%i\n",env,Thread::get_caller_ID()); + //__android_log_print(ANDROID_LOG_INFO,"godot","**TOUCH EVENT! - %p-%i\n",env,Thread::get_caller_id()); Vector<OS_Android::TouchPos> points; for (int i = 0; i < count; i++) { diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index ad46ceb43f..a027e78de9 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -135,7 +135,7 @@ void OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int visual_server = memnew(VisualServerWrapMT(visual_server, false)); };*/ visual_server->init(); - visual_server->cursor_set_visible(false, 0); + // visual_server->cursor_set_visible(false, 0); AudioDriverManager::get_driver(p_audio_driver)->set_singleton(); @@ -686,11 +686,11 @@ void OS_Android::set_screen_orientation(ScreenOrientation p_orientation) { set_screen_orientation_func(p_orientation); } -String OS_Android::get_unique_ID() const { +String OS_Android::get_unique_id() const { if (get_unique_id_func) return get_unique_id_func(); - return OS::get_unique_ID(); + return OS::get_unique_id(); } Error OS_Android::native_video_play(String p_path, float p_volume) { diff --git a/platform/android/os_android.h b/platform/android/os_android.h index 393bc68d8a..54d7e562e0 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -222,7 +222,7 @@ public: virtual String get_model_name() const; virtual int get_screen_dpi(int p_screen = 0) const; - virtual String get_unique_ID() const; + virtual String get_unique_id() const; virtual String get_system_dir(SystemDir p_dir) const; diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp index 401f3cd73b..924ae3fe43 100644 --- a/platform/android/thread_jandroid.cpp +++ b/platform/android/thread_jandroid.cpp @@ -32,7 +32,7 @@ #include "os/memory.h" #include "script_language.h" -Thread::ID ThreadAndroid::get_ID() const { +Thread::ID ThreadAndroid::get_id() const { return id; } @@ -66,7 +66,7 @@ Thread *ThreadAndroid::create_func_jandroid(ThreadCreateCallback p_callback, voi return tr; } -Thread::ID ThreadAndroid::get_thread_ID_func_jandroid() { +Thread::ID ThreadAndroid::get_thread_id_func_jandroid() { return (ID)pthread_self(); } @@ -107,7 +107,7 @@ void ThreadAndroid::make_default(JavaVM *p_java_vm) { java_vm = p_java_vm; create_func = create_func_jandroid; - get_thread_ID_func = get_thread_ID_func_jandroid; + get_thread_id_func = get_thread_id_func_jandroid; wait_to_finish_func = wait_to_finish_func_jandroid; pthread_key_create(&jvm_key, _thread_destroyed); setup_thread(); diff --git a/platform/android/thread_jandroid.h b/platform/android/thread_jandroid.h index 6174066968..5267329744 100644 --- a/platform/android/thread_jandroid.h +++ b/platform/android/thread_jandroid.h @@ -52,7 +52,7 @@ class ThreadAndroid : public Thread { static void *thread_callback(void *userdata); static Thread *create_func_jandroid(ThreadCreateCallback p_callback, void *, const Settings &); - static ID get_thread_ID_func_jandroid(); + static ID get_thread_id_func_jandroid(); static void wait_to_finish_func_jandroid(Thread *p_thread); static void _thread_destroyed(void *value); @@ -62,7 +62,7 @@ class ThreadAndroid : public Thread { static JavaVM *java_vm; public: - virtual ID get_ID() const; + virtual ID get_id() const; static void make_default(JavaVM *p_java_vm); static void setup_thread(); diff --git a/platform/haiku/key_mapping_haiku.cpp b/platform/haiku/key_mapping_haiku.cpp index 9df7b2f047..3db31fa3e4 100644 --- a/platform/haiku/key_mapping_haiku.cpp +++ b/platform/haiku/key_mapping_haiku.cpp @@ -83,7 +83,7 @@ static _HaikuTranslatePair _fn_to_keycode[] = { static _HaikuTranslatePair _hb_to_keycode[] = { { KEY_BACKSPACE, B_BACKSPACE }, { KEY_TAB, B_TAB }, - { KEY_RETURN, B_RETURN }, + { KEY_ENTER, B_RETURN }, { KEY_CAPSLOCK, B_CAPS_LOCK }, { KEY_ESCAPE, B_ESCAPE }, { KEY_SPACE, B_SPACE }, diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index da6dfcf53f..362cfd1478 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -424,7 +424,7 @@ static int frame_count = 0; } } - OSIPhone::get_singleton()->set_unique_ID(String::utf8([uuid UTF8String])); + OSIPhone::get_singleton()->set_unique_id(String::utf8([uuid UTF8String])); }; break; /* diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index cb5c022764..df497349ae 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -83,12 +83,12 @@ void OSIPhone::set_data_dir(String p_dir) { memdelete(da); }; -void OSIPhone::set_unique_ID(String p_ID) { +void OSIPhone::set_unique_id(String p_ID) { unique_ID = p_ID; }; -String OSIPhone::get_unique_ID() const { +String OSIPhone::get_unique_id() const { return unique_ID; }; @@ -119,7 +119,7 @@ void OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_ */ visual_server->init(); - visual_server->cursor_set_visible(false, 0); + // visual_server->cursor_set_visible(false, 0); // reset this to what it should be, it will have been set to 0 after visual_server->init() is called RasterizerStorageGLES3::system_fbo = gl_view_base_fb; @@ -224,11 +224,9 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_ Ref<InputEventMouseButton> ev; ev.instance(); - // swaped it for tilted screen - //ev->get_pos().x = ev.mouse_button.global_x = video_mode.height - p_y; - //ev->get_pos().y = ev.mouse_button.global_y = p_x; - ev->set_position(Vector2(video_mode.height - p_y, p_x)); - ev->set_global_position(Vector2(video_mode.height - p_y, p_x)); + + ev->set_position(Vector2(p_x, p_y)); + ev->set_global_position(Vector2(p_x, p_y)); //mouse_list.pressed[p_idx] = p_pressed; diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index b15e9fdffb..cf2766bb33 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -190,8 +190,8 @@ public: void set_locale(String p_locale); String get_locale() const; - void set_unique_ID(String p_ID); - String get_unique_ID() const; + void set_unique_id(String p_ID); + String get_unique_id() const; virtual Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track); virtual bool native_video_is_playing() const; diff --git a/platform/javascript/dom_keys.h b/platform/javascript/dom_keys.h index 979731d157..4b8b764c45 100644 --- a/platform/javascript/dom_keys.h +++ b/platform/javascript/dom_keys.h @@ -249,7 +249,7 @@ int dom2godot_scancode(int dom_keycode) { case DOM_VK_RETURN: case DOM_VK_ENTER: // unused according to MDN - return KEY_RETURN; + return KEY_ENTER; case DOM_VK_SHIFT: return KEY_SHIFT; case DOM_VK_CONTROL: return KEY_CONTROL; diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 0708d46196..d339baf024 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -96,30 +96,18 @@ static EM_BOOL _browser_resize_callback(int event_type, const EmscriptenUiEvent ERR_FAIL_COND_V(event_type != EMSCRIPTEN_EVENT_RESIZE, false); OS_JavaScript *os = static_cast<OS_JavaScript *>(user_data); - - // the order in which _browser_resize_callback and - // _fullscreen_change_callback are called is browser-dependent, - // so try adjusting for fullscreen in both - if (os->is_window_fullscreen() || os->is_window_maximized()) { - - OS::VideoMode vm = os->get_video_mode(); - vm.width = ui_event->windowInnerWidth; - vm.height = ui_event->windowInnerHeight; - os->set_video_mode(vm); - emscripten_set_canvas_size(ui_event->windowInnerWidth, ui_event->windowInnerHeight); - } + // The order of the fullscreen change event and the window size change + // event varies, even within just one browser, so defer handling + os->request_canvas_size_adjustment(); return false; } -static Size2 _windowed_size; - static EM_BOOL _fullscreen_change_callback(int event_type, const EmscriptenFullscreenChangeEvent *event, void *user_data) { ERR_FAIL_COND_V(event_type != EMSCRIPTEN_EVENT_FULLSCREENCHANGE, false); OS_JavaScript *os = static_cast<OS_JavaScript *>(user_data); String id = String::utf8(event->id); - // empty id is canvas if (id.empty() || id == "canvas") { @@ -127,18 +115,8 @@ static EM_BOOL _fullscreen_change_callback(int event_type, const EmscriptenFulls // this event property is the only reliable information on // browser fullscreen state vm.fullscreen = event->isFullscreen; - - if (event->isFullscreen) { - vm.width = event->screenWidth; - vm.height = event->screenHeight; - os->set_video_mode(vm); - emscripten_set_canvas_size(vm.width, vm.height); - } else { - os->set_video_mode(vm); - if (!os->is_window_maximized()) { - os->set_window_size(_windowed_size); - } - } + os->set_video_mode(vm); + os->request_canvas_size_adjustment(); } return false; } @@ -498,7 +476,7 @@ void OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, i print_line("Init VS"); visual_server = memnew(VisualServerRaster()); - visual_server->cursor_set_visible(false, 0); + // visual_server->cursor_set_visible(false, 0); print_line("Init Physicsserver"); @@ -719,14 +697,17 @@ Size2 OS_JavaScript::get_screen_size(int p_screen) const { void OS_JavaScript::set_window_size(const Size2 p_size) { - window_maximized = false; + windowed_size = p_size; if (is_window_fullscreen()) { + window_maximized = false; set_window_fullscreen(false); + } else if (is_window_maximized()) { + set_window_maximized(false); + } else { + video_mode.width = p_size.x; + video_mode.height = p_size.y; + emscripten_set_canvas_size(p_size.x, p_size.y); } - _windowed_size = p_size; - video_mode.width = p_size.x; - video_mode.height = p_size.y; - emscripten_set_canvas_size(p_size.x, p_size.y); } Size2 OS_JavaScript::get_window_size() const { @@ -739,20 +720,30 @@ Size2 OS_JavaScript::get_window_size() const { void OS_JavaScript::set_window_maximized(bool p_enabled) { window_maximized = p_enabled; - if (p_enabled) { - - if (is_window_fullscreen()) { - // _browser_resize callback will set canvas size - set_window_fullscreen(false); - } else { - /* clang-format off */ - video_mode.width = EM_ASM_INT_V(return window.innerWidth); - video_mode.height = EM_ASM_INT_V(return window.innerHeight); - /* clang-format on */ - emscripten_set_canvas_size(video_mode.width, video_mode.height); - } - } else { - set_window_size(_windowed_size); + if (is_window_fullscreen()) { + set_window_fullscreen(false); + return; + } + // Calling emscripten_enter_soft_fullscreen mutltiple times hides all + // page elements except the canvas permanently, so track state + if (p_enabled && !soft_fs_enabled) { + + EmscriptenFullscreenStrategy strategy; + strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH; + strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF; + strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT; + strategy.canvasResizedCallback = NULL; + emscripten_enter_soft_fullscreen(NULL, &strategy); + soft_fs_enabled = true; + video_mode.width = get_window_size().width; + video_mode.height = get_window_size().height; + } else if (!p_enabled) { + + emscripten_exit_soft_fullscreen(); + soft_fs_enabled = false; + video_mode.width = windowed_size.width; + video_mode.height = windowed_size.height; + emscripten_set_canvas_size(video_mode.width, video_mode.height); } } @@ -766,9 +757,17 @@ void OS_JavaScript::set_window_fullscreen(bool p_enable) { // _browser_resize_callback or _fullscreen_change_callback EMSCRIPTEN_RESULT result; if (p_enable) { - /* clang-format off */ - EM_ASM(Module.requestFullscreen(false, false);); - /* clang-format on */ + if (window_maximized) { + // soft fs during real fs can cause issues + set_window_maximized(false); + window_maximized = true; + } + EmscriptenFullscreenStrategy strategy; + strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH; + strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF; + strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT; + strategy.canvasResizedCallback = NULL; + emscripten_request_fullscreen_strategy(NULL, false, &strategy); } else { result = emscripten_exit_fullscreen(); if (result != EMSCRIPTEN_RESULT_SUCCESS) { @@ -782,6 +781,11 @@ bool OS_JavaScript::is_window_fullscreen() const { return video_mode.fullscreen; } +void OS_JavaScript::request_canvas_size_adjustment() { + + canvas_size_adjustment_requested = true; +} + void OS_JavaScript::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const { Size2 screen = get_screen_size(); @@ -841,6 +845,17 @@ bool OS_JavaScript::main_loop_iterate() { } } process_joypads(); + if (canvas_size_adjustment_requested) { + + if (video_mode.fullscreen || window_maximized) { + video_mode.width = get_window_size().width; + video_mode.height = get_window_size().height; + } + if (!video_mode.fullscreen) { + set_window_maximized(window_maximized); + } + canvas_size_adjustment_requested = false; + } return Main::iteration(); } @@ -857,7 +872,11 @@ void OS_JavaScript::process_accelerometer(const Vector3 &p_accelerometer) { bool OS_JavaScript::has_touchscreen_ui_hint() const { - return false; //??? + /* clang-format off */ + return EM_ASM_INT_V( + return 'ontouchstart' in window; + ); + /* clang-format on */ } void OS_JavaScript::main_loop_request_quit() { @@ -980,6 +999,8 @@ OS_JavaScript::OS_JavaScript(const char *p_execpath, GetDataDirFunc p_get_data_d main_loop = NULL; gl_extensions = NULL; window_maximized = false; + soft_fs_enabled = false; + canvas_size_adjustment_requested = false; get_data_dir_func = p_get_data_dir_func; FileAccessUnix::close_notification_func = _close_notification_funcs; diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index 24e96e20dd..13c500b3dc 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -59,7 +59,10 @@ class OS_JavaScript : public OS_Unix { const char *gl_extensions; InputDefault *input; + Vector2 windowed_size; bool window_maximized; + bool soft_fs_enabled; + bool canvas_size_adjustment_requested; VideoMode video_mode; CursorShape cursor_shape; MainLoop *main_loop; @@ -130,6 +133,8 @@ public: virtual void set_window_fullscreen(bool p_enable); virtual bool is_window_fullscreen() const; + void request_canvas_size_adjustment(); + virtual String get_name(); virtual MainLoop *get_main_loop() const; diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index cb9dd1dd8e..4b5682518f 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -136,6 +136,8 @@ public: virtual String get_name(); + virtual void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type = ERR_ERROR); + virtual void alert(const String &p_alert, const String &p_title = "ALERT!"); virtual void set_cursor_shape(CursorShape p_shape); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 4a01532d89..e884058052 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -44,6 +44,9 @@ #include <IOKit/IOKitLib.h> #include <IOKit/hid/IOHIDKeys.h> #include <IOKit/hid/IOHIDLib.h> +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 +#include <os/log.h> +#endif #include <fcntl.h> #include <libproc.h> @@ -518,7 +521,7 @@ static int translateKey(unsigned int key) { /* 21 */ KEY_BRACELEFT, /* 22 */ KEY_I, /* 23 */ KEY_P, - /* 24 */ KEY_RETURN, + /* 24 */ KEY_ENTER, /* 25 */ KEY_L, /* 26 */ KEY_J, /* 27 */ KEY_APOSTROPHE, @@ -558,7 +561,7 @@ static int translateKey(unsigned int key) { /* 49 */ KEY_UNKNOWN, /* VolumeDown */ /* 4a */ KEY_UNKNOWN, /* Mute */ /* 4b */ KEY_KP_DIVIDE, - /* 4c */ KEY_ENTER, + /* 4c */ KEY_KP_ENTER, /* 4d */ KEY_UNKNOWN, /* 4e */ KEY_KP_SUBTRACT, /* 4f */ KEY_UNKNOWN, @@ -953,7 +956,7 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD)); } visual_server->init(); - visual_server->cursor_set_visible(false, 0); + // visual_server->cursor_set_visible(false, 0); AudioDriverManager::get_driver(p_audio_driver)->set_singleton(); @@ -1017,6 +1020,45 @@ String OS_OSX::get_name() { return "OSX"; } +void OS_OSX::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) { + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 + if (!_print_error_enabled) + return; + + const char *err_details; + if (p_rationale && p_rationale[0]) + err_details = p_rationale; + else + err_details = p_code; + + switch (p_type) { + case ERR_ERROR: + os_log_error(OS_LOG_DEFAULT, "ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", p_function, err_details, p_file, p_line); + print("\E[1;31mERROR: %s: \E[0m\E[1m%s\n", p_function, err_details); + print("\E[0;31m At: %s:%i.\E[0m\n", p_file, p_line); + break; + case ERR_WARNING: + os_log_info(OS_LOG_DEFAULT, "WARNING: %{public}s: %{public}s\nAt: %{public}s:%i.", p_function, err_details, p_file, p_line); + print("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n", p_function, err_details); + print("\E[0;33m At: %s:%i.\E[0m\n", p_file, p_line); + break; + case ERR_SCRIPT: + os_log_error(OS_LOG_DEFAULT, "SCRIPT ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", p_function, err_details, p_file, p_line); + print("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details); + print("\E[0;35m At: %s:%i.\E[0m\n", p_file, p_line); + break; + case ERR_SHADER: + os_log_error(OS_LOG_DEFAULT, "SHADER ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", p_function, err_details, p_file, p_line); + print("\E[1;36mSHADER ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details); + print("\E[0;36m At: %s:%i.\E[0m\n", p_file, p_line); + break; + } +#else + OS_Unix::print_error(p_function, p_file, p_line, p_code, p_rationale, p_type); +#endif +} + void OS_OSX::alert(const String &p_alert, const String &p_title) { // Set OS X-compliant variables NSAlert *window = [[NSAlert alloc] init]; @@ -1081,18 +1123,13 @@ void OS_OSX::warp_mouse_pos(const Point2 &p_to) { mouse_y = p_to.y; } else { //set OS position - /* this code has not been tested, please be a kind soul and fix it if it fails! */ - //local point in window coords - NSPoint localPoint = { p_to.x, p_to.y }; - - NSPoint pointInWindow = [window_view convertPoint:localPoint toView:nil]; - NSRect pointInWindowRect; - pointInWindowRect.origin = pointInWindow; + const NSRect contentRect = [window_view frame]; + NSRect pointInWindowRect = NSMakeRect(p_to.x / display_scale, contentRect.size.height - (p_to.y / display_scale) - 1, 0, 0); NSPoint pointOnScreen = [[window_view window] convertRectToScreen:pointInWindowRect].origin; //point in scren coords - CGPoint lMouseWarpPos = { pointOnScreen.x, pointOnScreen.y }; + CGPoint lMouseWarpPos = { pointOnScreen.x, CGDisplayBounds(CGMainDisplayID()).size.height - pointOnScreen.y }; //do the warping CGEventSourceRef lEventRef = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState); diff --git a/platform/uwp/joypad_uwp.cpp b/platform/uwp/joypad_uwp.cpp index 34e36f7b66..f3d4eb99c8 100644 --- a/platform/uwp/joypad_uwp.cpp +++ b/platform/uwp/joypad_uwp.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "joypad_uwp.h" +#include "core/os/os.h" using namespace Windows::Gaming::Input; using namespace Windows::Foundation; @@ -45,27 +46,44 @@ void JoypadUWP::process_controllers() { for (int i = 0; i < MAX_CONTROLLERS; i++) { - if (!controllers[i].connected) break; + ControllerDevice &joy = controllers[i]; - switch (controllers[i].type) { + if (!joy.connected) break; + + switch (joy.type) { case ControllerType::GAMEPAD_CONTROLLER: { - GamepadReading reading = ((Gamepad ^)controllers[i].controller_reference)->GetCurrentReading(); + GamepadReading reading = ((Gamepad ^) joy.controller_reference)->GetCurrentReading(); int button_mask = (int)GamepadButtons::Menu; for (int j = 0; j < 14; j++) { - input->joy_button(controllers[i].id, j, (int)reading.Buttons & button_mask); + input->joy_button(joy.id, j, (int)reading.Buttons & button_mask); button_mask *= 2; } - input->joy_axis(controllers[i].id, JOY_AXIS_0, axis_correct(reading.LeftThumbstickX)); - input->joy_axis(controllers[i].id, JOY_AXIS_1, axis_correct(reading.LeftThumbstickY, true)); - input->joy_axis(controllers[i].id, JOY_AXIS_2, axis_correct(reading.RightThumbstickX)); - input->joy_axis(controllers[i].id, JOY_AXIS_3, axis_correct(reading.RightThumbstickY, true)); - input->joy_axis(controllers[i].id, JOY_AXIS_4, axis_correct(reading.LeftTrigger, false, true)); - input->joy_axis(controllers[i].id, JOY_AXIS_5, axis_correct(reading.RightTrigger, false, true)); + input->joy_axis(joy.id, JOY_AXIS_0, axis_correct(reading.LeftThumbstickX)); + input->joy_axis(joy.id, JOY_AXIS_1, axis_correct(reading.LeftThumbstickY, true)); + input->joy_axis(joy.id, JOY_AXIS_2, axis_correct(reading.RightThumbstickX)); + input->joy_axis(joy.id, JOY_AXIS_3, axis_correct(reading.RightThumbstickY, true)); + input->joy_axis(joy.id, JOY_AXIS_4, axis_correct(reading.LeftTrigger, false, true)); + input->joy_axis(joy.id, JOY_AXIS_5, axis_correct(reading.RightTrigger, false, true)); + + uint64_t timestamp = input->get_joy_vibration_timestamp(joy.id); + if (timestamp > joy.ff_timestamp) { + Vector2 strength = input->get_joy_vibration_strength(joy.id); + float duration = input->get_joy_vibration_duration(joy.id); + if (strength.x == 0 && strength.y == 0) { + joypad_vibration_stop(i, timestamp); + } else { + joypad_vibration_start(i, strength.x, strength.y, duration, timestamp); + } + } else if (joy.vibrating && joy.ff_end_timestamp != 0) { + uint64_t current_time = OS::get_singleton()->get_ticks_usec(); + if (current_time >= joy.ff_end_timestamp) + joypad_vibration_stop(i, current_time); + } break; } @@ -122,15 +140,7 @@ void JoypadUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Inp ERR_FAIL_COND(idx == -1); - for (int i = idx + 1; i < MAX_CONTROLLERS - 1; i++) { - - if (!controllers[i].connected) { - break; - } - - controllers[i - 1] = controllers[i]; - } - controllers[MAX_CONTROLLERS - 1] = ControllerDevice(); + controllers[idx] = ControllerDevice(); input->joy_connection_changed(idx, false, "Xbox Controller"); } @@ -144,3 +154,30 @@ InputDefault::JoyAxis JoypadUWP::axis_correct(double p_val, bool p_negate, bool return jx; } + +void JoypadUWP::joypad_vibration_start(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp) { + ControllerDevice &joy = controllers[p_device]; + if (joy.connected) { + GamepadVibration vibration; + vibration.LeftMotor = p_strong_magnitude; + vibration.RightMotor = p_weak_magnitude; + ((Gamepad ^) joy.controller_reference)->Vibration = vibration; + + joy.ff_timestamp = p_timestamp; + joy.ff_end_timestamp = p_duration == 0 ? 0 : p_timestamp + (uint64_t)(p_duration * 1000000.0); + joy.vibrating = true; + } +} + +void JoypadUWP::joypad_vibration_stop(int p_device, uint64_t p_timestamp) { + ControllerDevice &joy = controllers[p_device]; + if (joy.connected) { + GamepadVibration vibration; + vibration.LeftMotor = 0.0; + vibration.RightMotor = 0.0; + ((Gamepad ^) joy.controller_reference)->Vibration = vibration; + + joy.ff_timestamp = p_timestamp; + joy.vibrating = false; + } +} diff --git a/platform/uwp/joypad_uwp.h b/platform/uwp/joypad_uwp.h index 7337ffb3ce..c55e1e7ab7 100644 --- a/platform/uwp/joypad_uwp.h +++ b/platform/uwp/joypad_uwp.h @@ -62,11 +62,17 @@ private: int id; bool connected; ControllerType type; + float ff_timestamp; + float ff_end_timestamp; + bool vibrating; ControllerDevice() { id = -1; connected = false; type = ControllerType::GAMEPAD_CONTROLLER; + ff_timestamp = 0.0f; + ff_end_timestamp = 0.0f; + vibrating = false; } }; @@ -78,6 +84,8 @@ private: void OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value); InputDefault::JoyAxis axis_correct(double p_val, bool p_negate = false, bool p_trigger = false) const; + void joypad_vibration_start(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp); + void joypad_vibration_stop(int p_device, uint64_t p_timestamp); }; #endif diff --git a/platform/uwp/thread_uwp.cpp b/platform/uwp/thread_uwp.cpp index 436941707c..0549a8ed47 100644 --- a/platform/uwp/thread_uwp.cpp +++ b/platform/uwp/thread_uwp.cpp @@ -41,7 +41,7 @@ Thread *ThreadUWP::create_func_uwp(ThreadCreateCallback p_callback, void *p_user return thread; }; -Thread::ID ThreadUWP::get_thread_ID_func_uwp() { +Thread::ID ThreadUWP::get_thread_id_func_uwp() { return std::hash<std::thread::id>()(std::this_thread::get_id()); }; @@ -52,14 +52,14 @@ void ThreadUWP::wait_to_finish_func_uwp(Thread *p_thread) { tp->thread.join(); }; -Thread::ID ThreadUWP::get_ID() const { +Thread::ID ThreadUWP::get_id() const { return std::hash<std::thread::id>()(thread.get_id()); }; void ThreadUWP::make_default() { create_func = create_func_uwp; - get_thread_ID_func = get_thread_ID_func_uwp; + get_thread_id_func = get_thread_id_func_uwp; wait_to_finish_func = wait_to_finish_func_uwp; }; diff --git a/platform/uwp/thread_uwp.h b/platform/uwp/thread_uwp.h index 0424f0f577..b8cccfb7c3 100644 --- a/platform/uwp/thread_uwp.h +++ b/platform/uwp/thread_uwp.h @@ -41,13 +41,13 @@ class ThreadUWP : public Thread { std::thread thread; static Thread *create_func_uwp(ThreadCreateCallback p_callback, void *, const Settings &); - static ID get_thread_ID_func_uwp(); + static ID get_thread_id_func_uwp(); static void wait_to_finish_func_uwp(Thread *p_thread); ThreadUWP(); public: - virtual ID get_ID() const; + virtual ID get_id() const; static void make_default(); diff --git a/platform/windows/key_mapping_win.cpp b/platform/windows/key_mapping_win.cpp index bffacb3a82..83e2af72b2 100644 --- a/platform/windows/key_mapping_win.cpp +++ b/platform/windows/key_mapping_win.cpp @@ -44,7 +44,7 @@ static _WinTranslatePair _vk_to_keycode[] = { //VK_CLEAR (0x0C) - { KEY_RETURN, VK_RETURN }, //(0x0D) + { KEY_ENTER, VK_RETURN }, //(0x0D) { KEY_SHIFT, VK_SHIFT }, //(0x10) diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index da14d5c284..f72e5ef595 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -807,7 +807,7 @@ void OS_Windows::process_key_events() { if ((ke.lParam & (1 << 24)) && (ke.wParam == VK_RETURN)) { // Special case for Numpad Enter key - k->set_scancode(KEY_ENTER); + k->set_scancode(KEY_KP_ENTER); } else { k->set_scancode(KeyMappingWindows::get_keysym(ke.wParam)); } @@ -1192,10 +1192,6 @@ void OS_Windows::finalize() { main_loop = NULL; - for (int i = 0; i < get_audio_driver_count(); i++) { - AudioDriverManager::get_driver(i)->finish(); - } - memdelete(joypad); memdelete(input); @@ -1952,7 +1948,7 @@ Error OS_Windows::kill(const ProcessID &p_pid) { return ret != 0 ? OK : FAILED; }; -int OS_Windows::get_process_ID() const { +int OS_Windows::get_process_id() const { return _getpid(); } diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 6856e7e9b8..beaf5d5e35 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -247,7 +247,7 @@ public: virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL); virtual Error kill(const ProcessID &p_pid); - virtual int get_process_ID() const; + virtual int get_process_id() const; virtual bool has_environment(const String &p_var) const; virtual String get_environment(const String &p_var) const; diff --git a/platform/x11/key_mapping_x11.cpp b/platform/x11/key_mapping_x11.cpp index 1d7eb1692c..32a9806b22 100644 --- a/platform/x11/key_mapping_x11.cpp +++ b/platform/x11/key_mapping_x11.cpp @@ -44,7 +44,7 @@ static _XTranslatePair _xkeysym_to_keycode[] = { { XK_Tab, KEY_TAB }, { XK_ISO_Left_Tab, KEY_BACKTAB }, { XK_BackSpace, KEY_BACKSPACE }, - { XK_Return, KEY_RETURN }, + { XK_Return, KEY_ENTER }, { XK_Insert, KEY_INSERT }, { XK_Delete, KEY_DELETE }, { XK_Clear, KEY_DELETE }, @@ -78,7 +78,7 @@ static _XTranslatePair _xkeysym_to_keycode[] = { { XK_Help, KEY_HELP }, { XK_KP_Space, KEY_SPACE }, { XK_KP_Tab, KEY_TAB }, - { XK_KP_Enter, KEY_ENTER }, + { XK_KP_Enter, KEY_KP_ENTER }, { XK_Home, KEY_HOME }, { XK_Left, KEY_LEFT }, { XK_Up, KEY_UP }, diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 1dde328eda..ade3a0a0c5 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -529,10 +529,6 @@ void OS_X11::finalize() { memdelete(main_loop); main_loop = NULL; - for (int i = 0; i < get_audio_driver_count(); i++) { - AudioDriverManager::get_driver(i)->finish(); - } - /* if (debugger_connection_console) { memdelete(debugger_connection_console); diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index 22649cedd7..366c3a8bd8 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -223,10 +223,10 @@ void SpriteFrames::_bind_methods() { ClassDB::bind_method(D_METHOD("set_animation_loop", "anim", "loop"), &SpriteFrames::set_animation_loop); ClassDB::bind_method(D_METHOD("get_animation_loop", "anim"), &SpriteFrames::get_animation_loop); - ClassDB::bind_method(D_METHOD("add_frame", "anim", "frame:Texture", "atpos"), &SpriteFrames::add_frame, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("add_frame", "anim", "frame", "atpos"), &SpriteFrames::add_frame, DEFVAL(-1)); ClassDB::bind_method(D_METHOD("get_frame_count", "anim"), &SpriteFrames::get_frame_count); - ClassDB::bind_method(D_METHOD("get_frame:Texture", "anim", "idx"), &SpriteFrames::get_frame); - ClassDB::bind_method(D_METHOD("set_frame", "anim", "idx", "txt:Texture"), &SpriteFrames::set_frame); + ClassDB::bind_method(D_METHOD("get_frame", "anim", "idx"), &SpriteFrames::get_frame); + ClassDB::bind_method(D_METHOD("set_frame", "anim", "idx", "txt"), &SpriteFrames::set_frame); ClassDB::bind_method(D_METHOD("remove_frame", "anim", "idx"), &SpriteFrames::remove_frame); ClassDB::bind_method(D_METHOD("clear", "anim"), &SpriteFrames::clear); ClassDB::bind_method(D_METHOD("clear_all"), &SpriteFrames::clear_all); @@ -346,6 +346,7 @@ void AnimatedSprite::_notification(int p_what) { update(); _change_notify("frame"); + emit_signal(SceneStringNames::get_singleton()->frame_changed); } float to_process = MIN(timeout, remaining); @@ -616,8 +617,8 @@ String AnimatedSprite::get_configuration_warning() const { void AnimatedSprite::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames:SpriteFrames"), &AnimatedSprite::set_sprite_frames); - ClassDB::bind_method(D_METHOD("get_sprite_frames:SpriteFrames"), &AnimatedSprite::get_sprite_frames); + ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames"), &AnimatedSprite::set_sprite_frames); + ClassDB::bind_method(D_METHOD("get_sprite_frames"), &AnimatedSprite::get_sprite_frames); ClassDB::bind_method(D_METHOD("set_animation", "animation"), &AnimatedSprite::set_animation); ClassDB::bind_method(D_METHOD("get_animation"), &AnimatedSprite::get_animation); diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index 841e2ef7d3..02a0509449 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -480,7 +480,7 @@ Array Area2D::get_overlapping_areas() const { bool Area2D::overlaps_area(Node *p_area) const { ERR_FAIL_NULL_V(p_area, false); - const Map<ObjectID, AreaState>::Element *E = area_map.find(p_area->get_instance_ID()); + const Map<ObjectID, AreaState>::Element *E = area_map.find(p_area->get_instance_id()); if (!E) return false; return E->get().in_tree; @@ -489,7 +489,7 @@ bool Area2D::overlaps_area(Node *p_area) const { bool Area2D::overlaps_body(Node *p_body) const { ERR_FAIL_NULL_V(p_body, false); - const Map<ObjectID, BodyState>::Element *E = body_map.find(p_body->get_instance_ID()); + const Map<ObjectID, BodyState>::Element *E = body_map.find(p_body->get_instance_id()); if (!E) return false; return E->get().in_tree; diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index cef473dcdf..1423a804ff 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -400,7 +400,7 @@ uint32_t AudioStreamPlayer2D::get_area_mask() const { void AudioStreamPlayer2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_stream", "stream:AudioStream"), &AudioStreamPlayer2D::set_stream); + ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer2D::set_stream); ClassDB::bind_method(D_METHOD("get_stream"), &AudioStreamPlayer2D::get_stream); ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer2D::set_volume_db); diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 908c95b50c..b11c1dd642 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -580,7 +580,7 @@ void Camera2D::set_custom_viewport(Node *p_viewport) { custom_viewport = p_viewport->cast_to<Viewport>(); if (custom_viewport) { - custom_viewport_id = custom_viewport->get_instance_ID(); + custom_viewport_id = custom_viewport->get_instance_id(); } else { custom_viewport_id = 0; } @@ -679,8 +679,8 @@ void Camera2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_zoom", "zoom"), &Camera2D::set_zoom); ClassDB::bind_method(D_METHOD("get_zoom"), &Camera2D::get_zoom); - ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport:Viewport"), &Camera2D::set_custom_viewport); - ClassDB::bind_method(D_METHOD("get_custom_viewport:Viewport"), &Camera2D::get_custom_viewport); + ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport"), &Camera2D::set_custom_viewport); + ClassDB::bind_method(D_METHOD("get_custom_viewport"), &Camera2D::get_custom_viewport); ClassDB::bind_method(D_METHOD("set_follow_smoothing", "follow_smoothing"), &Camera2D::set_follow_smoothing); ClassDB::bind_method(D_METHOD("get_follow_smoothing"), &Camera2D::get_follow_smoothing); diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 40c25c8bf6..3d0b5047ae 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -939,7 +939,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_callback"), &CanvasItem::_update_callback); ClassDB::bind_method(D_METHOD("edit_set_state", "state"), &CanvasItem::edit_set_state); - ClassDB::bind_method(D_METHOD("edit_get_state:Variant"), &CanvasItem::edit_get_state); + ClassDB::bind_method(D_METHOD("edit_get_state"), &CanvasItem::edit_get_state); ClassDB::bind_method(D_METHOD("edit_set_rect", "rect"), &CanvasItem::edit_set_rect); ClassDB::bind_method(D_METHOD("edit_rotate", "degrees"), &CanvasItem::edit_rotate); @@ -980,15 +980,15 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("draw_polyline_colors", "points", "colors", "width", "antialiased"), &CanvasItem::draw_polyline_colors, DEFVAL(1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_rect", "rect", "color", "filled"), &CanvasItem::draw_rect, DEFVAL(true)); ClassDB::bind_method(D_METHOD("draw_circle", "pos", "radius", "color"), &CanvasItem::draw_circle); - ClassDB::bind_method(D_METHOD("draw_texture", "texture:Texture", "pos", "modulate", "normal_map:Texture"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_texture_rect", "texture:Texture", "rect", "tile", "modulate", "transpose", "normal_map:Texture"), &CanvasItem::draw_texture_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture:Texture", "rect", "src_rect", "modulate", "transpose", "normal_map:Texture", "clip_uv"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("draw_style_box", "style_box:StyleBox", "rect"), &CanvasItem::draw_style_box); - ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture:Texture", "width", "normal_map:Texture"), &CanvasItem::draw_primitive, DEFVAL(Variant()), DEFVAL(1.0), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture:Texture", "normal_map:Texture"), &CanvasItem::draw_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture:Texture", "normal_map:Texture"), &CanvasItem::draw_colored_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_string", "font:Font", "pos", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1)), DEFVAL(-1)); - ClassDB::bind_method(D_METHOD("draw_char", "font:Font", "pos", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1))); + ClassDB::bind_method(D_METHOD("draw_texture", "texture", "pos", "modulate", "normal_map"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_texture_rect", "texture", "rect", "tile", "modulate", "transpose", "normal_map"), &CanvasItem::draw_texture_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("draw_style_box", "style_box", "rect"), &CanvasItem::draw_style_box); + ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture", "width", "normal_map"), &CanvasItem::draw_primitive, DEFVAL(Variant()), DEFVAL(1.0), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture", "normal_map"), &CanvasItem::draw_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture", "normal_map"), &CanvasItem::draw_colored_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_string", "font", "pos", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1)), DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("draw_char", "font", "pos", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1))); ClassDB::bind_method(D_METHOD("draw_set_transform", "pos", "rot", "scale"), &CanvasItem::draw_set_transform); ClassDB::bind_method(D_METHOD("draw_set_transform_matrix", "xform"), &CanvasItem::draw_set_transform_matrix); @@ -1001,11 +1001,11 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("get_local_mouse_pos"), &CanvasItem::get_local_mouse_pos); ClassDB::bind_method(D_METHOD("get_global_mouse_position"), &CanvasItem::get_global_mouse_position); ClassDB::bind_method(D_METHOD("get_canvas"), &CanvasItem::get_canvas); - ClassDB::bind_method(D_METHOD("get_world_2d:World2D"), &CanvasItem::get_world_2d); + ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasItem::get_world_2d); //ClassDB::bind_method(D_METHOD("get_viewport"),&CanvasItem::get_viewport); - ClassDB::bind_method(D_METHOD("set_material", "material:Material"), &CanvasItem::set_material); - ClassDB::bind_method(D_METHOD("get_material:Material"), &CanvasItem::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &CanvasItem::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &CanvasItem::get_material); ClassDB::bind_method(D_METHOD("set_use_parent_material", "enable"), &CanvasItem::set_use_parent_material); ClassDB::bind_method(D_METHOD("get_use_parent_material"), &CanvasItem::get_use_parent_material); @@ -1018,7 +1018,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("make_canvas_pos_local", "screen_point"), &CanvasItem::make_canvas_pos_local); - ClassDB::bind_method(D_METHOD("make_input_local:InputEvent", "event:InputEvent"), &CanvasItem::make_input_local); + ClassDB::bind_method(D_METHOD("make_input_local", "event"), &CanvasItem::make_input_local); BIND_VMETHOD(MethodInfo("_draw")); diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index eb47682884..d3bb5a8d4e 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -333,17 +333,17 @@ void CollisionObject2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pickable", "enabled"), &CollisionObject2D::set_pickable); ClassDB::bind_method(D_METHOD("is_pickable"), &CollisionObject2D::is_pickable); - ClassDB::bind_method(D_METHOD("create_shape_owner", "owner:Object"), &CollisionObject2D::create_shape_owner); + ClassDB::bind_method(D_METHOD("create_shape_owner", "owner"), &CollisionObject2D::create_shape_owner); ClassDB::bind_method(D_METHOD("remove_shape_owner", "owner_id"), &CollisionObject2D::remove_shape_owner); ClassDB::bind_method(D_METHOD("get_shape_owners"), &CollisionObject2D::_get_shape_owners); - ClassDB::bind_method(D_METHOD("shape_owner_set_transform", "owner_id", "transform:Transform2D"), &CollisionObject2D::shape_owner_set_transform); + ClassDB::bind_method(D_METHOD("shape_owner_set_transform", "owner_id", "transform"), &CollisionObject2D::shape_owner_set_transform); ClassDB::bind_method(D_METHOD("shape_owner_get_transform", "owner_id"), &CollisionObject2D::shape_owner_get_transform); ClassDB::bind_method(D_METHOD("shape_owner_get_owner", "owner_id"), &CollisionObject2D::shape_owner_get_owner); ClassDB::bind_method(D_METHOD("shape_owner_set_disabled", "owner_id", "disabled"), &CollisionObject2D::shape_owner_set_disabled); ClassDB::bind_method(D_METHOD("is_shape_owner_disabled", "owner_id"), &CollisionObject2D::is_shape_owner_disabled); ClassDB::bind_method(D_METHOD("shape_owner_set_one_way_collision", "owner_id", "enable"), &CollisionObject2D::shape_owner_set_one_way_collision); ClassDB::bind_method(D_METHOD("is_shape_owner_one_way_collision_enabled", "owner_id"), &CollisionObject2D::is_shape_owner_one_way_collision_enabled); - ClassDB::bind_method(D_METHOD("shape_owner_add_shape", "owner_id", "shape:Shape2D"), &CollisionObject2D::shape_owner_add_shape); + ClassDB::bind_method(D_METHOD("shape_owner_add_shape", "owner_id", "shape"), &CollisionObject2D::shape_owner_add_shape); ClassDB::bind_method(D_METHOD("shape_owner_get_shape_count", "owner_id"), &CollisionObject2D::shape_owner_get_shape_count); ClassDB::bind_method(D_METHOD("shape_owner_get_shape", "owner_id", "shape_id"), &CollisionObject2D::shape_owner_get_shape); ClassDB::bind_method(D_METHOD("shape_owner_get_shape_index", "owner_id", "shape_id"), &CollisionObject2D::shape_owner_get_shape_index); @@ -372,9 +372,9 @@ CollisionObject2D::CollisionObject2D(RID p_rid, bool p_area) { if (p_area) { - Physics2DServer::get_singleton()->area_attach_object_instance_ID(rid, get_instance_ID()); + Physics2DServer::get_singleton()->area_attach_object_instance_id(rid, get_instance_id()); } else { - Physics2DServer::get_singleton()->body_attach_object_instance_ID(rid, get_instance_ID()); + Physics2DServer::get_singleton()->body_attach_object_instance_id(rid, get_instance_id()); } } diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index 890ac0c1f3..ff4aa245ec 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -201,8 +201,8 @@ bool CollisionShape2D::is_one_way_collision_enabled() const { void CollisionShape2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shape", "shape:Shape2D"), &CollisionShape2D::set_shape); - ClassDB::bind_method(D_METHOD("get_shape:Shape2D"), &CollisionShape2D::get_shape); + ClassDB::bind_method(D_METHOD("set_shape", "shape"), &CollisionShape2D::set_shape); + ClassDB::bind_method(D_METHOD("get_shape"), &CollisionShape2D::get_shape); ClassDB::bind_method(D_METHOD("set_disabled", "disabled"), &CollisionShape2D::set_disabled); ClassDB::bind_method(D_METHOD("is_disabled"), &CollisionShape2D::is_disabled); ClassDB::bind_method(D_METHOD("set_one_way_collision", "enabled"), &CollisionShape2D::set_one_way_collision); diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index 044cb06c02..e8c2122bd1 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -355,8 +355,8 @@ void Light2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_editor_only", "editor_only"), &Light2D::set_editor_only); ClassDB::bind_method(D_METHOD("is_editor_only"), &Light2D::is_editor_only); - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Light2D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Light2D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Light2D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Light2D::get_texture); ClassDB::bind_method(D_METHOD("set_texture_offset", "texture_offset"), &Light2D::set_texture_offset); ClassDB::bind_method(D_METHOD("get_texture_offset"), &Light2D::get_texture_offset); diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index f1df2b0daf..a1a8e7d9c4 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -212,8 +212,8 @@ String LightOccluder2D::get_configuration_warning() const { void LightOccluder2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_occluder_polygon", "polygon:OccluderPolygon2D"), &LightOccluder2D::set_occluder_polygon); - ClassDB::bind_method(D_METHOD("get_occluder_polygon:OccluderPolygon2D"), &LightOccluder2D::get_occluder_polygon); + ClassDB::bind_method(D_METHOD("set_occluder_polygon", "polygon"), &LightOccluder2D::set_occluder_polygon); + ClassDB::bind_method(D_METHOD("get_occluder_polygon"), &LightOccluder2D::get_occluder_polygon); ClassDB::bind_method(D_METHOD("set_occluder_light_mask", "mask"), &LightOccluder2D::set_occluder_light_mask); ClassDB::bind_method(D_METHOD("get_occluder_light_mask"), &LightOccluder2D::get_occluder_light_mask); diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 22e54cfb54..5438557d0b 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -283,11 +283,11 @@ void Line2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_default_color", "color"), &Line2D::set_default_color); ClassDB::bind_method(D_METHOD("get_default_color"), &Line2D::get_default_color); - ClassDB::bind_method(D_METHOD("set_gradient", "color:Gradient"), &Line2D::set_gradient); - ClassDB::bind_method(D_METHOD("get_gradient:Gradient"), &Line2D::get_gradient); + ClassDB::bind_method(D_METHOD("set_gradient", "color"), &Line2D::set_gradient); + ClassDB::bind_method(D_METHOD("get_gradient"), &Line2D::get_gradient); - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Line2D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Line2D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Line2D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Line2D::get_texture); ClassDB::bind_method(D_METHOD("set_texture_mode", "mode"), &Line2D::set_texture_mode); ClassDB::bind_method(D_METHOD("get_texture_mode"), &Line2D::get_texture_mode); diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp index bfe5a359f7..e579838903 100644 --- a/scene/2d/navigation2d.cpp +++ b/scene/2d/navigation2d.cpp @@ -763,7 +763,7 @@ Object *Navigation2D::get_closest_point_owner(const Vector2 &p_point) { void Navigation2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("navpoly_create", "mesh:NavigationPolygon", "xform", "owner"), &Navigation2D::navpoly_create, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("navpoly_create", "mesh", "xform", "owner"), &Navigation2D::navpoly_create, DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("navpoly_set_transform", "id", "xform"), &Navigation2D::navpoly_set_transform); ClassDB::bind_method(D_METHOD("navpoly_remove", "id"), &Navigation2D::navpoly_remove); diff --git a/scene/2d/navigation2d.h b/scene/2d/navigation2d.h index e5d71f48c3..54e89de9e2 100644 --- a/scene/2d/navigation2d.h +++ b/scene/2d/navigation2d.h @@ -57,9 +57,9 @@ class Navigation2D : public Node2D { return (a.key == p_key.a.key) ? (b.key < p_key.b.key) : (a.key < p_key.a.key); }; - EdgeKey(const Point &p_a = Point(), const Point &p_b = Point()) { - a = p_a; - b = p_b; + EdgeKey(const Point &p_a = Point(), const Point &p_b = Point()) + : a(p_a), + b(p_b) { if (a.key > b.key) { SWAP(a, b); } diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 807f72e81f..779751c1c5 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -459,8 +459,8 @@ String NavigationPolygonInstance::get_configuration_warning() const { void NavigationPolygonInstance::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly:NavigationPolygon"), &NavigationPolygonInstance::set_navigation_polygon); - ClassDB::bind_method(D_METHOD("get_navigation_polygon:NavigationPolygon"), &NavigationPolygonInstance::get_navigation_polygon); + ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationPolygonInstance::set_navigation_polygon); + ClassDB::bind_method(D_METHOD("get_navigation_polygon"), &NavigationPolygonInstance::get_navigation_polygon); ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationPolygonInstance::set_enabled); ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationPolygonInstance::is_enabled); diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 0acc85681d..98d6a467b1 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -243,7 +243,7 @@ void Node2D::global_translate(const Vector2 &p_amount) { set_global_position(get_global_position() + p_amount); } -void Node2D::scale(const Size2 &p_amount) { +void Node2D::apply_scale(const Size2 &p_amount) { set_scale(get_scale() * p_amount); } @@ -429,7 +429,7 @@ void Node2D::_bind_methods() { ClassDB::bind_method(D_METHOD("move_local_y", "delta", "scaled"), &Node2D::move_y, DEFVAL(false)); ClassDB::bind_method(D_METHOD("translate", "offset"), &Node2D::translate); ClassDB::bind_method(D_METHOD("global_translate", "offset"), &Node2D::global_translate); - ClassDB::bind_method(D_METHOD("scale", "ratio"), &Node2D::scale); + ClassDB::bind_method(D_METHOD("apply_scale", "ratio"), &Node2D::apply_scale); ClassDB::bind_method(D_METHOD("set_global_position", "pos"), &Node2D::set_global_position); ClassDB::bind_method(D_METHOD("get_global_position"), &Node2D::get_global_position); @@ -457,7 +457,7 @@ void Node2D::_bind_methods() { ClassDB::bind_method(D_METHOD("edit_set_pivot", "pivot"), &Node2D::edit_set_pivot); - ClassDB::bind_method(D_METHOD("get_relative_transform_to_parent", "parent:Node"), &Node2D::get_relative_transform_to_parent); + ClassDB::bind_method(D_METHOD("get_relative_transform_to_parent", "parent"), &Node2D::get_relative_transform_to_parent); ADD_GROUP("Transform", ""); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "position"), "set_position", "get_position"); diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index 5b3a28d5c3..df9a05ff79 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -78,7 +78,7 @@ public: void move_y(float p_delta, bool p_scaled = false); void translate(const Vector2 &p_amount); void global_translate(const Vector2 &p_amount); - void scale(const Size2 &p_amount); + void apply_scale(const Size2 &p_amount); Point2 get_position() const; float get_rotation() const; diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index aa9258c7b4..4aa841131a 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -300,6 +300,15 @@ void Particles2D::_notification(int p_what) { #endif } + if (p_what == NOTIFICATION_PAUSED || p_what == NOTIFICATION_UNPAUSED) { + if (can_process()) { + VS::get_singleton()->particles_set_speed_scale(particles, speed_scale); + } else { + + VS::get_singleton()->particles_set_speed_scale(particles, 0); + } + } + if (p_what == NOTIFICATION_TRANSFORM_CHANGED) { _update_particle_emission_transform(); } @@ -318,7 +327,7 @@ void Particles2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &Particles2D::set_use_local_coordinates); ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &Particles2D::set_fixed_fps); ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &Particles2D::set_fractional_delta); - ClassDB::bind_method(D_METHOD("set_process_material", "material:Material"), &Particles2D::set_process_material); + ClassDB::bind_method(D_METHOD("set_process_material", "material"), &Particles2D::set_process_material); ClassDB::bind_method(D_METHOD("set_speed_scale", "scale"), &Particles2D::set_speed_scale); ClassDB::bind_method(D_METHOD("is_emitting"), &Particles2D::is_emitting); @@ -332,17 +341,17 @@ void Particles2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &Particles2D::get_use_local_coordinates); ClassDB::bind_method(D_METHOD("get_fixed_fps"), &Particles2D::get_fixed_fps); ClassDB::bind_method(D_METHOD("get_fractional_delta"), &Particles2D::get_fractional_delta); - ClassDB::bind_method(D_METHOD("get_process_material:Material"), &Particles2D::get_process_material); + ClassDB::bind_method(D_METHOD("get_process_material"), &Particles2D::get_process_material); ClassDB::bind_method(D_METHOD("get_speed_scale"), &Particles2D::get_speed_scale); ClassDB::bind_method(D_METHOD("set_draw_order", "order"), &Particles2D::set_draw_order); ClassDB::bind_method(D_METHOD("get_draw_order"), &Particles2D::get_draw_order); - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Particles2D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Particles2D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Particles2D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Particles2D::get_texture); - ClassDB::bind_method(D_METHOD("set_normal_map", "texture:Texture"), &Particles2D::set_normal_map); - ClassDB::bind_method(D_METHOD("get_normal_map:Texture"), &Particles2D::get_normal_map); + ClassDB::bind_method(D_METHOD("set_normal_map", "texture"), &Particles2D::set_normal_map); + ClassDB::bind_method(D_METHOD("get_normal_map"), &Particles2D::get_normal_map); ClassDB::bind_method(D_METHOD("capture_rect"), &Particles2D::capture_rect); @@ -396,6 +405,7 @@ Particles2D::Particles2D() { set_randomness_ratio(0); set_visibility_rect(Rect2(Vector2(-100, -100), Vector2(200, 200))); set_use_local_coordinates(true); + set_draw_order(DRAW_ORDER_INDEX); set_speed_scale(1); h_frames = 1; v_frames = 1; diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 0b486bd821..6b30e97de8 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -82,8 +82,8 @@ Ref<Curve2D> Path2D::get_curve() const { void Path2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_curve", "curve:Curve2D"), &Path2D::set_curve); - ClassDB::bind_method(D_METHOD("get_curve:Curve2D", "curve"), &Path2D::get_curve); + ClassDB::bind_method(D_METHOD("set_curve", "curve"), &Path2D::set_curve); + ClassDB::bind_method(D_METHOD("get_curve"), &Path2D::get_curve); ClassDB::bind_method(D_METHOD("_curve_changed"), &Path2D::_curve_changed); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve2D"), "set_curve", "get_curve"); diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 8b2653f639..2f1e8925b8 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -70,8 +70,8 @@ void PhysicsBody2D::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_layers", "mask"), &PhysicsBody2D::_set_layers); ClassDB::bind_method(D_METHOD("_get_layers"), &PhysicsBody2D::_get_layers); - ClassDB::bind_method(D_METHOD("add_collision_exception_with", "body:PhysicsBody2D"), &PhysicsBody2D::add_collision_exception_with); - ClassDB::bind_method(D_METHOD("remove_collision_exception_with", "body:PhysicsBody2D"), &PhysicsBody2D::remove_collision_exception_with); + ClassDB::bind_method(D_METHOD("add_collision_exception_with", "body"), &PhysicsBody2D::add_collision_exception_with); + ClassDB::bind_method(D_METHOD("remove_collision_exception_with", "body"), &PhysicsBody2D::remove_collision_exception_with); ADD_PROPERTY(PropertyInfo(Variant::INT, "layers", PROPERTY_HINT_LAYERS_2D_PHYSICS, "", 0), "_set_layers", "_get_layers"); //for backwards compat ADD_GROUP("Collision", "collision_"); @@ -798,6 +798,40 @@ bool RigidBody2D::is_contact_monitor_enabled() const { return contact_monitor != NULL; } +void RigidBody2D::_notification(int p_what) { + +#ifdef TOOLS_ENABLED + if (p_what == NOTIFICATION_ENTER_TREE) { + if (get_tree()->is_editor_hint()) { + set_notify_local_transform(true); //used for warnings and only in editor + } + } + + if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) { + if (get_tree()->is_editor_hint()) { + update_configuration_warning(); + } + } + +#endif +} + +String RigidBody2D::get_configuration_warning() const { + + Transform2D t = get_transform(); + + String warning = CollisionObject2D::get_configuration_warning(); + + if ((get_mode() == MODE_RIGID || get_mode() == MODE_CHARACTER) && (ABS(t.elements[0].length() - 1.0) > 0.05 || ABS(t.elements[1].length() - 1.0) > 0.05)) { + if (warning != String()) { + warning += "\n"; + } + warning += TTR("Size changes to RigidBody2D (in character or rigid modes) will be overriden by the physics engine when running.\nChange the size in children collision shapes instead."); + } + + return warning; +} + void RigidBody2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_mode", "mode"), &RigidBody2D::set_mode); @@ -862,7 +896,7 @@ void RigidBody2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_can_sleep", "able_to_sleep"), &RigidBody2D::set_can_sleep); ClassDB::bind_method(D_METHOD("is_able_to_sleep"), &RigidBody2D::is_able_to_sleep); - ClassDB::bind_method(D_METHOD("test_motion", "motion", "margin", "result:Physics2DTestMotionResult"), &RigidBody2D::_test_motion, DEFVAL(0.08), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("test_motion", "motion", "margin", "result"), &RigidBody2D::_test_motion, DEFVAL(0.08), DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("_direct_state_changed"), &RigidBody2D::_direct_state_changed); ClassDB::bind_method(D_METHOD("_body_enter_tree"), &RigidBody2D::_body_enter_tree); @@ -1170,7 +1204,7 @@ void KinematicBody2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_floor_velocity"), &KinematicBody2D::get_floor_velocity); ClassDB::bind_method(D_METHOD("set_safe_margin", "pixels"), &KinematicBody2D::set_safe_margin); - ClassDB::bind_method(D_METHOD("get_safe_margin", "pixels"), &KinematicBody2D::get_safe_margin); + ClassDB::bind_method(D_METHOD("get_safe_margin"), &KinematicBody2D::get_safe_margin); ClassDB::bind_method(D_METHOD("get_collision_count"), &KinematicBody2D::get_collision_count); ClassDB::bind_method(D_METHOD("get_collision_position", "collision"), &KinematicBody2D::get_collision_position); diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index 8c8e4ebc77..54bd263b15 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -185,6 +185,7 @@ private: bool _test_motion(const Vector2 &p_motion, float p_margin = 0.08, const Ref<Physics2DTestMotionResult> &p_result = Ref<Physics2DTestMotionResult>()); protected: + void _notification(int p_what); static void _bind_methods(); public: @@ -253,6 +254,8 @@ public: Array get_colliding_bodies() const; //function for script + virtual String get_configuration_warning() const; + RigidBody2D(); ~RigidBody2D(); }; diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 4a68df5706..5c1c953a37 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -330,8 +330,8 @@ void Polygon2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_vertex_colors", "vertex_colors"), &Polygon2D::set_vertex_colors); ClassDB::bind_method(D_METHOD("get_vertex_colors"), &Polygon2D::get_vertex_colors); - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Polygon2D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Polygon2D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Polygon2D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Polygon2D::get_texture); ClassDB::bind_method(D_METHOD("set_texture_offset", "texture_offset"), &Polygon2D::set_texture_offset); ClassDB::bind_method(D_METHOD("get_texture_offset"), &Polygon2D::get_texture_offset); diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp index 4298377499..cbd7ac06f5 100644 --- a/scene/2d/remote_transform_2d.cpp +++ b/scene/2d/remote_transform_2d.cpp @@ -39,7 +39,7 @@ void RemoteTransform2D::_update_cache() { return; } - cache = node->get_instance_ID(); + cache = node->get_instance_id(); } } diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index 24c9137807..37139b2b93 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -356,17 +356,17 @@ bool TouchScreenButton::is_passby_press_enabled() const { void TouchScreenButton::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &TouchScreenButton::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &TouchScreenButton::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &TouchScreenButton::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &TouchScreenButton::get_texture); - ClassDB::bind_method(D_METHOD("set_texture_pressed", "texture_pressed:Texture"), &TouchScreenButton::set_texture_pressed); - ClassDB::bind_method(D_METHOD("get_texture_pressed:Texture"), &TouchScreenButton::get_texture_pressed); + ClassDB::bind_method(D_METHOD("set_texture_pressed", "texture_pressed"), &TouchScreenButton::set_texture_pressed); + ClassDB::bind_method(D_METHOD("get_texture_pressed"), &TouchScreenButton::get_texture_pressed); - ClassDB::bind_method(D_METHOD("set_bitmask", "bitmask:BitMap"), &TouchScreenButton::set_bitmask); - ClassDB::bind_method(D_METHOD("get_bitmask:BitMap"), &TouchScreenButton::get_bitmask); + ClassDB::bind_method(D_METHOD("set_bitmask", "bitmask"), &TouchScreenButton::set_bitmask); + ClassDB::bind_method(D_METHOD("get_bitmask"), &TouchScreenButton::get_bitmask); - ClassDB::bind_method(D_METHOD("set_shape", "shape:Shape2D"), &TouchScreenButton::set_shape); - ClassDB::bind_method(D_METHOD("get_shape:Shape2D"), &TouchScreenButton::get_shape); + ClassDB::bind_method(D_METHOD("set_shape", "shape"), &TouchScreenButton::set_shape); + ClassDB::bind_method(D_METHOD("get_shape"), &TouchScreenButton::get_shape); ClassDB::bind_method(D_METHOD("set_shape_centered", "bool"), &TouchScreenButton::set_shape_centered); ClassDB::bind_method(D_METHOD("is_shape_centered"), &TouchScreenButton::is_shape_centered); diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index ad34dfd63a..2ec529a166 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -237,7 +237,7 @@ void Sprite::set_vframes(int p_amount) { vframes = p_amount; update(); item_rect_changed(); - _change_notify("frame"); + _change_notify(); } int Sprite::get_vframes() const { @@ -250,7 +250,7 @@ void Sprite::set_hframes(int p_amount) { hframes = p_amount; update(); item_rect_changed(); - _change_notify("frame"); + _change_notify(); } int Sprite::get_hframes() const { @@ -298,11 +298,11 @@ void Sprite::_validate_property(PropertyInfo &property) const { void Sprite::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Sprite::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Sprite::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Sprite::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Sprite::get_texture); - ClassDB::bind_method(D_METHOD("set_normal_map", "normal_map:Texture"), &Sprite::set_normal_map); - ClassDB::bind_method(D_METHOD("get_normal_map:Texture"), &Sprite::get_normal_map); + ClassDB::bind_method(D_METHOD("set_normal_map", "normal_map"), &Sprite::set_normal_map); + ClassDB::bind_method(D_METHOD("get_normal_map"), &Sprite::get_normal_map); ClassDB::bind_method(D_METHOD("set_centered", "centered"), &Sprite::set_centered); ClassDB::bind_method(D_METHOD("is_centered"), &Sprite::is_centered); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 02dcc7d059..e4494742a1 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -589,7 +589,7 @@ Map<TileMap::PosKey, TileMap::Quadrant>::Element *TileMap::_create_quadrant(cons xform.set_origin(q.pos); //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_attach_object_instance_id(q.body, get_instance_id()); Physics2DServer::get_singleton()->body_set_collision_layer(q.body, collision_layer); Physics2DServer::get_singleton()->body_set_collision_mask(q.body, collision_mask); Physics2DServer::get_singleton()->body_set_param(q.body, Physics2DServer::BODY_PARAM_FRICTION, friction); @@ -1208,8 +1208,8 @@ void TileMap::set_light_mask(int p_light_mask) { void TileMap::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_tileset", "tileset:TileSet"), &TileMap::set_tileset); - ClassDB::bind_method(D_METHOD("get_tileset:TileSet"), &TileMap::get_tileset); + ClassDB::bind_method(D_METHOD("set_tileset", "tileset"), &TileMap::set_tileset); + ClassDB::bind_method(D_METHOD("get_tileset"), &TileMap::get_tileset); ClassDB::bind_method(D_METHOD("set_mode", "mode"), &TileMap::set_mode); ClassDB::bind_method(D_METHOD("get_mode"), &TileMap::get_mode); diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index a37c74cb07..fb71b61d45 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -33,6 +33,7 @@ #include "scene/2d/animated_sprite.h" #include "scene/2d/physics_body_2d.h" #include "scene/animation/animation_player.h" +#include "scene/main/viewport.h" #include "scene/scene_string_names.h" #include "scene/scene_string_names.h" diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index 59227070b3..c64b807e43 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -475,7 +475,7 @@ Array Area::get_overlapping_areas() const { bool Area::overlaps_area(Node *p_area) const { ERR_FAIL_NULL_V(p_area, false); - const Map<ObjectID, AreaState>::Element *E = area_map.find(p_area->get_instance_ID()); + const Map<ObjectID, AreaState>::Element *E = area_map.find(p_area->get_instance_id()); if (!E) return false; return E->get().in_tree; @@ -484,7 +484,7 @@ bool Area::overlaps_area(Node *p_area) const { bool Area::overlaps_body(Node *p_body) const { ERR_FAIL_NULL_V(p_body, false); - const Map<ObjectID, BodyState>::Element *E = body_map.find(p_body->get_instance_ID()); + const Map<ObjectID, BodyState>::Element *E = body_map.find(p_body->get_instance_id()); if (!E) return false; return E->get().in_tree; diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 87ea018425..6abc2caac8 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -807,7 +807,7 @@ AudioStreamPlayer3D::DopplerTracking AudioStreamPlayer3D::get_doppler_tracking() void AudioStreamPlayer3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_stream", "stream:AudioStream"), &AudioStreamPlayer3D::set_stream); + ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer3D::set_stream); ClassDB::bind_method(D_METHOD("get_stream"), &AudioStreamPlayer3D::get_stream); ClassDB::bind_method(D_METHOD("set_unit_db", "unit_db"), &AudioStreamPlayer3D::set_unit_db); diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 697d91c863..3c5eb21d38 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -556,8 +556,8 @@ void Camera::_bind_methods() { ClassDB::bind_method(D_METHOD("get_v_offset"), &Camera::get_v_offset); ClassDB::bind_method(D_METHOD("set_cull_mask", "mask"), &Camera::set_cull_mask); ClassDB::bind_method(D_METHOD("get_cull_mask"), &Camera::get_cull_mask); - ClassDB::bind_method(D_METHOD("set_environment", "env:Environment"), &Camera::set_environment); - ClassDB::bind_method(D_METHOD("get_environment:Environment"), &Camera::get_environment); + ClassDB::bind_method(D_METHOD("set_environment", "env"), &Camera::set_environment); + ClassDB::bind_method(D_METHOD("get_environment"), &Camera::get_environment); ClassDB::bind_method(D_METHOD("set_keep_aspect_mode", "mode"), &Camera::set_keep_aspect_mode); ClassDB::bind_method(D_METHOD("get_keep_aspect_mode"), &Camera::get_keep_aspect_mode); ClassDB::bind_method(D_METHOD("set_doppler_tracking", "mode"), &Camera::set_doppler_tracking); diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp index 5a3d8e013f..1aba26673c 100644 --- a/scene/3d/collision_object.cpp +++ b/scene/3d/collision_object.cpp @@ -128,15 +128,15 @@ void CollisionObject::_bind_methods() { ClassDB::bind_method(D_METHOD("set_capture_input_on_drag", "enable"), &CollisionObject::set_capture_input_on_drag); ClassDB::bind_method(D_METHOD("get_capture_input_on_drag"), &CollisionObject::get_capture_input_on_drag); ClassDB::bind_method(D_METHOD("get_rid"), &CollisionObject::get_rid); - ClassDB::bind_method(D_METHOD("create_shape_owner", "owner:Object"), &CollisionObject::create_shape_owner); + ClassDB::bind_method(D_METHOD("create_shape_owner", "owner"), &CollisionObject::create_shape_owner); ClassDB::bind_method(D_METHOD("remove_shape_owner", "owner_id"), &CollisionObject::remove_shape_owner); ClassDB::bind_method(D_METHOD("get_shape_owners"), &CollisionObject::_get_shape_owners); - ClassDB::bind_method(D_METHOD("shape_owner_set_transform", "owner_id", "transform:Transform"), &CollisionObject::shape_owner_set_transform); + ClassDB::bind_method(D_METHOD("shape_owner_set_transform", "owner_id", "transform"), &CollisionObject::shape_owner_set_transform); ClassDB::bind_method(D_METHOD("shape_owner_get_transform", "owner_id"), &CollisionObject::shape_owner_get_transform); ClassDB::bind_method(D_METHOD("shape_owner_get_owner", "owner_id"), &CollisionObject::shape_owner_get_owner); ClassDB::bind_method(D_METHOD("shape_owner_set_disabled", "owner_id", "disabled"), &CollisionObject::shape_owner_set_disabled); ClassDB::bind_method(D_METHOD("is_shape_owner_disabled", "owner_id"), &CollisionObject::is_shape_owner_disabled); - ClassDB::bind_method(D_METHOD("shape_owner_add_shape", "owner_id", "shape:Shape"), &CollisionObject::shape_owner_add_shape); + ClassDB::bind_method(D_METHOD("shape_owner_add_shape", "owner_id", "shape"), &CollisionObject::shape_owner_add_shape); ClassDB::bind_method(D_METHOD("shape_owner_get_shape_count", "owner_id"), &CollisionObject::shape_owner_get_shape_count); ClassDB::bind_method(D_METHOD("shape_owner_get_shape", "owner_id", "shape_id"), &CollisionObject::shape_owner_get_shape); ClassDB::bind_method(D_METHOD("shape_owner_get_shape_index", "owner_id", "shape_id"), &CollisionObject::shape_owner_get_shape_index); @@ -346,9 +346,9 @@ CollisionObject::CollisionObject(RID p_rid, bool p_area) { total_subshapes = 0; if (p_area) { - PhysicsServer::get_singleton()->area_attach_object_instance_ID(rid, get_instance_ID()); + PhysicsServer::get_singleton()->area_attach_object_instance_id(rid, get_instance_id()); } else { - PhysicsServer::get_singleton()->body_attach_object_instance_ID(rid, get_instance_ID()); + PhysicsServer::get_singleton()->body_attach_object_instance_id(rid, get_instance_id()); } //set_transform_notify(true); } diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp index a7cfc6fef2..4fd215bd1a 100644 --- a/scene/3d/collision_shape.cpp +++ b/scene/3d/collision_shape.cpp @@ -127,9 +127,9 @@ String CollisionShape::get_configuration_warning() const { void CollisionShape::_bind_methods() { //not sure if this should do anything - ClassDB::bind_method(D_METHOD("resource_changed", "resource:Resource"), &CollisionShape::resource_changed); - ClassDB::bind_method(D_METHOD("set_shape", "shape:Shape"), &CollisionShape::set_shape); - ClassDB::bind_method(D_METHOD("get_shape:Shape"), &CollisionShape::get_shape); + ClassDB::bind_method(D_METHOD("resource_changed", "resource"), &CollisionShape::resource_changed); + ClassDB::bind_method(D_METHOD("set_shape", "shape"), &CollisionShape::set_shape); + ClassDB::bind_method(D_METHOD("get_shape"), &CollisionShape::get_shape); ClassDB::bind_method(D_METHOD("set_disabled", "enable"), &CollisionShape::set_disabled); ClassDB::bind_method(D_METHOD("is_disabled"), &CollisionShape::is_disabled); ClassDB::bind_method(D_METHOD("make_convex_from_brothers"), &CollisionShape::make_convex_from_brothers); diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 7aaf4a6e3d..2174f924ac 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -1443,8 +1443,8 @@ PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const { void GIProbe::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_probe_data", "data:GIProbeData"), &GIProbe::set_probe_data); - ClassDB::bind_method(D_METHOD("get_probe_data:GIProbeData"), &GIProbe::get_probe_data); + ClassDB::bind_method(D_METHOD("set_probe_data", "data"), &GIProbe::set_probe_data); + ClassDB::bind_method(D_METHOD("get_probe_data"), &GIProbe::get_probe_data); ClassDB::bind_method(D_METHOD("set_subdiv", "subdiv"), &GIProbe::set_subdiv); ClassDB::bind_method(D_METHOD("get_subdiv"), &GIProbe::get_subdiv); @@ -1473,7 +1473,7 @@ void GIProbe::_bind_methods() { ClassDB::bind_method(D_METHOD("set_compress", "enable"), &GIProbe::set_compress); ClassDB::bind_method(D_METHOD("is_compressed"), &GIProbe::is_compressed); - ClassDB::bind_method(D_METHOD("bake", "from_node:Node", "create_visual_debug"), &GIProbe::bake, DEFVAL(Variant()), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("bake", "from_node", "create_visual_debug"), &GIProbe::bake, DEFVAL(Variant()), DEFVAL(false)); ClassDB::bind_method(D_METHOD("debug_bake"), &GIProbe::_debug_bake); ClassDB::set_method_flags(get_class_static(), _scs_create("debug_bake"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR); diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp index 128c8b44c3..060e088750 100644 --- a/scene/3d/immediate_geometry.cpp +++ b/scene/3d/immediate_geometry.cpp @@ -143,7 +143,7 @@ void ImmediateGeometry::add_sphere(int p_lats, int p_lons, float p_radius, bool void ImmediateGeometry::_bind_methods() { - ClassDB::bind_method(D_METHOD("begin", "primitive", "texture:Texture"), &ImmediateGeometry::begin, DEFVAL(Ref<Texture>())); + ClassDB::bind_method(D_METHOD("begin", "primitive", "texture"), &ImmediateGeometry::begin, DEFVAL(Ref<Texture>())); ClassDB::bind_method(D_METHOD("set_normal", "normal"), &ImmediateGeometry::set_normal); ClassDB::bind_method(D_METHOD("set_tangent", "tangent"), &ImmediateGeometry::set_tangent); ClassDB::bind_method(D_METHOD("set_color", "color"), &ImmediateGeometry::set_color); diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index 3855244787..36a6660bf9 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -132,7 +132,7 @@ void InterpolatedCamera::_bind_methods() { ClassDB::bind_method(D_METHOD("set_target_path", "target_path"), &InterpolatedCamera::set_target_path); ClassDB::bind_method(D_METHOD("get_target_path"), &InterpolatedCamera::get_target_path); - ClassDB::bind_method(D_METHOD("set_target", "target:Camera"), &InterpolatedCamera::_set_target); + ClassDB::bind_method(D_METHOD("set_target", "target"), &InterpolatedCamera::_set_target); ClassDB::bind_method(D_METHOD("set_speed", "speed"), &InterpolatedCamera::set_speed); ClassDB::bind_method(D_METHOD("get_speed"), &InterpolatedCamera::get_speed); diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index 51237c0bc3..da25afbf57 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -352,13 +352,13 @@ void MeshInstance::create_debug_tangents() { void MeshInstance::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_mesh", "mesh:Mesh"), &MeshInstance::set_mesh); - ClassDB::bind_method(D_METHOD("get_mesh:Mesh"), &MeshInstance::get_mesh); - ClassDB::bind_method(D_METHOD("set_skeleton_path", "skeleton_path:NodePath"), &MeshInstance::set_skeleton_path); - ClassDB::bind_method(D_METHOD("get_skeleton_path:NodePath"), &MeshInstance::get_skeleton_path); + ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &MeshInstance::set_mesh); + ClassDB::bind_method(D_METHOD("get_mesh"), &MeshInstance::get_mesh); + ClassDB::bind_method(D_METHOD("set_skeleton_path", "skeleton_path"), &MeshInstance::set_skeleton_path); + ClassDB::bind_method(D_METHOD("get_skeleton_path"), &MeshInstance::get_skeleton_path); - ClassDB::bind_method(D_METHOD("set_surface_material", "surface", "material:Material"), &MeshInstance::set_surface_material); - ClassDB::bind_method(D_METHOD("get_surface_material:Material", "surface"), &MeshInstance::get_surface_material); + ClassDB::bind_method(D_METHOD("set_surface_material", "surface", "material"), &MeshInstance::set_surface_material); + ClassDB::bind_method(D_METHOD("get_surface_material", "surface"), &MeshInstance::get_surface_material); ClassDB::bind_method(D_METHOD("create_trimesh_collision"), &MeshInstance::create_trimesh_collision); ClassDB::set_method_flags("MeshInstance", "create_trimesh_collision", METHOD_FLAGS_DEFAULT); diff --git a/scene/3d/multimesh_instance.cpp b/scene/3d/multimesh_instance.cpp index b4558698cc..b51953f27c 100644 --- a/scene/3d/multimesh_instance.cpp +++ b/scene/3d/multimesh_instance.cpp @@ -31,8 +31,8 @@ void MultiMeshInstance::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_multimesh", "multimesh:MultiMesh"), &MultiMeshInstance::set_multimesh); - ClassDB::bind_method(D_METHOD("get_multimesh:MultiMesh"), &MultiMeshInstance::get_multimesh); + ClassDB::bind_method(D_METHOD("set_multimesh", "multimesh"), &MultiMeshInstance::set_multimesh); + ClassDB::bind_method(D_METHOD("get_multimesh"), &MultiMeshInstance::get_multimesh); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multimesh", PROPERTY_HINT_RESOURCE_TYPE, "MultiMesh"), "set_multimesh", "get_multimesh"); } diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index de6b242bfe..a1183326d7 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -690,7 +690,7 @@ Vector3 Navigation::get_up_vector() const { void Navigation::_bind_methods() { - ClassDB::bind_method(D_METHOD("navmesh_create", "mesh:NavigationMesh", "xform", "owner"), &Navigation::navmesh_create, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("navmesh_create", "mesh", "xform", "owner"), &Navigation::navmesh_create, DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("navmesh_set_transform", "id", "xform"), &Navigation::navmesh_set_transform); ClassDB::bind_method(D_METHOD("navmesh_remove", "id"), &Navigation::navmesh_remove); diff --git a/scene/3d/navigation.h b/scene/3d/navigation.h index 53e0b6399a..80699fce72 100644 --- a/scene/3d/navigation.h +++ b/scene/3d/navigation.h @@ -58,9 +58,9 @@ class Navigation : public Spatial { return (a.key == p_key.a.key) ? (b.key < p_key.b.key) : (a.key < p_key.a.key); }; - EdgeKey(const Point &p_a = Point(), const Point &p_b = Point()) { - a = p_a; - b = p_b; + EdgeKey(const Point &p_a = Point(), const Point &p_b = Point()) + : a(p_a), + b(p_b) { if (a.key > b.key) { SWAP(a, b); } diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 7392998d57..4c93bcfb5e 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -374,8 +374,8 @@ String NavigationMeshInstance::get_configuration_warning() const { void NavigationMeshInstance::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh:NavigationMesh"), &NavigationMeshInstance::set_navigation_mesh); - ClassDB::bind_method(D_METHOD("get_navigation_mesh:NavigationMesh"), &NavigationMeshInstance::get_navigation_mesh); + ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationMeshInstance::set_navigation_mesh); + ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationMeshInstance::get_navigation_mesh); ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationMeshInstance::set_enabled); ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationMeshInstance::is_enabled); diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index c8f45a8d7e..081caf4419 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -266,6 +266,18 @@ void Particles::_validate_property(PropertyInfo &property) const { } } +void Particles::_notification(int p_what) { + + if (p_what == NOTIFICATION_PAUSED || p_what == NOTIFICATION_UNPAUSED) { + if (can_process()) { + VS::get_singleton()->particles_set_speed_scale(particles, speed_scale); + } else { + + VS::get_singleton()->particles_set_speed_scale(particles, 0); + } + } +} + void Particles::_bind_methods() { ClassDB::bind_method(D_METHOD("set_emitting", "emitting"), &Particles::set_emitting); @@ -279,7 +291,7 @@ void Particles::_bind_methods() { ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &Particles::set_use_local_coordinates); ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &Particles::set_fixed_fps); ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &Particles::set_fractional_delta); - ClassDB::bind_method(D_METHOD("set_process_material", "material:Material"), &Particles::set_process_material); + ClassDB::bind_method(D_METHOD("set_process_material", "material"), &Particles::set_process_material); ClassDB::bind_method(D_METHOD("set_speed_scale", "scale"), &Particles::set_speed_scale); ClassDB::bind_method(D_METHOD("is_emitting"), &Particles::is_emitting); @@ -293,7 +305,7 @@ void Particles::_bind_methods() { ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &Particles::get_use_local_coordinates); ClassDB::bind_method(D_METHOD("get_fixed_fps"), &Particles::get_fixed_fps); ClassDB::bind_method(D_METHOD("get_fractional_delta"), &Particles::get_fractional_delta); - ClassDB::bind_method(D_METHOD("get_process_material:Material"), &Particles::get_process_material); + ClassDB::bind_method(D_METHOD("get_process_material"), &Particles::get_process_material); ClassDB::bind_method(D_METHOD("get_speed_scale"), &Particles::get_speed_scale); ClassDB::bind_method(D_METHOD("set_draw_order", "order"), &Particles::set_draw_order); @@ -301,10 +313,10 @@ void Particles::_bind_methods() { ClassDB::bind_method(D_METHOD("get_draw_order"), &Particles::get_draw_order); ClassDB::bind_method(D_METHOD("set_draw_passes", "passes"), &Particles::set_draw_passes); - ClassDB::bind_method(D_METHOD("set_draw_pass_mesh", "pass", "mesh:Mesh"), &Particles::set_draw_pass_mesh); + ClassDB::bind_method(D_METHOD("set_draw_pass_mesh", "pass", "mesh"), &Particles::set_draw_pass_mesh); ClassDB::bind_method(D_METHOD("get_draw_passes"), &Particles::get_draw_passes); - ClassDB::bind_method(D_METHOD("get_draw_pass_mesh:Mesh", "pass"), &Particles::get_draw_pass_mesh); + ClassDB::bind_method(D_METHOD("get_draw_pass_mesh", "pass"), &Particles::get_draw_pass_mesh); ClassDB::bind_method(D_METHOD("restart"), &Particles::restart); ClassDB::bind_method(D_METHOD("capture_aabb"), &Particles::capture_aabb); @@ -1360,8 +1372,8 @@ void ParticlesMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_color", "color"), &ParticlesMaterial::set_color); ClassDB::bind_method(D_METHOD("get_color"), &ParticlesMaterial::get_color); - ClassDB::bind_method(D_METHOD("set_color_ramp", "ramp:Texture"), &ParticlesMaterial::set_color_ramp); - ClassDB::bind_method(D_METHOD("get_color_ramp:Texture"), &ParticlesMaterial::get_color_ramp); + ClassDB::bind_method(D_METHOD("set_color_ramp", "ramp"), &ParticlesMaterial::set_color_ramp); + ClassDB::bind_method(D_METHOD("get_color_ramp"), &ParticlesMaterial::get_color_ramp); ClassDB::bind_method(D_METHOD("set_flag", "flag", "enable"), &ParticlesMaterial::set_flag); ClassDB::bind_method(D_METHOD("get_flag", "flag"), &ParticlesMaterial::get_flag); @@ -1375,14 +1387,14 @@ void ParticlesMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_emission_box_extents", "extents"), &ParticlesMaterial::set_emission_box_extents); ClassDB::bind_method(D_METHOD("get_emission_box_extents"), &ParticlesMaterial::get_emission_box_extents); - ClassDB::bind_method(D_METHOD("set_emission_point_texture", "texture:Texture"), &ParticlesMaterial::set_emission_point_texture); - ClassDB::bind_method(D_METHOD("get_emission_point_texture:Texture"), &ParticlesMaterial::get_emission_point_texture); + ClassDB::bind_method(D_METHOD("set_emission_point_texture", "texture"), &ParticlesMaterial::set_emission_point_texture); + ClassDB::bind_method(D_METHOD("get_emission_point_texture"), &ParticlesMaterial::get_emission_point_texture); - ClassDB::bind_method(D_METHOD("set_emission_normal_texture", "texture:Texture"), &ParticlesMaterial::set_emission_normal_texture); - ClassDB::bind_method(D_METHOD("get_emission_normal_texture:Texture"), &ParticlesMaterial::get_emission_normal_texture); + ClassDB::bind_method(D_METHOD("set_emission_normal_texture", "texture"), &ParticlesMaterial::set_emission_normal_texture); + ClassDB::bind_method(D_METHOD("get_emission_normal_texture"), &ParticlesMaterial::get_emission_normal_texture); - ClassDB::bind_method(D_METHOD("set_emission_color_texture", "texture:Texture"), &ParticlesMaterial::set_emission_color_texture); - ClassDB::bind_method(D_METHOD("get_emission_color_texture:Texture"), &ParticlesMaterial::get_emission_color_texture); + ClassDB::bind_method(D_METHOD("set_emission_color_texture", "texture"), &ParticlesMaterial::set_emission_color_texture); + ClassDB::bind_method(D_METHOD("get_emission_color_texture"), &ParticlesMaterial::get_emission_color_texture); ClassDB::bind_method(D_METHOD("set_emission_point_count", "point_count"), &ParticlesMaterial::set_emission_point_count); ClassDB::bind_method(D_METHOD("get_emission_point_count"), &ParticlesMaterial::get_emission_point_count); @@ -1390,11 +1402,11 @@ void ParticlesMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_trail_divisor", "divisor"), &ParticlesMaterial::set_trail_divisor); ClassDB::bind_method(D_METHOD("get_trail_divisor"), &ParticlesMaterial::get_trail_divisor); - ClassDB::bind_method(D_METHOD("set_trail_size_modifier", "texture:CurveTexture"), &ParticlesMaterial::set_trail_size_modifier); - ClassDB::bind_method(D_METHOD("get_trail_size_modifier:CurveTexture"), &ParticlesMaterial::get_trail_size_modifier); + ClassDB::bind_method(D_METHOD("set_trail_size_modifier", "texture"), &ParticlesMaterial::set_trail_size_modifier); + ClassDB::bind_method(D_METHOD("get_trail_size_modifier"), &ParticlesMaterial::get_trail_size_modifier); - ClassDB::bind_method(D_METHOD("set_trail_color_modifier", "texture:GradientTexture"), &ParticlesMaterial::set_trail_color_modifier); - ClassDB::bind_method(D_METHOD("get_trail_color_modifier:GradientTexture"), &ParticlesMaterial::get_trail_color_modifier); + ClassDB::bind_method(D_METHOD("set_trail_color_modifier", "texture"), &ParticlesMaterial::set_trail_color_modifier); + ClassDB::bind_method(D_METHOD("get_trail_color_modifier"), &ParticlesMaterial::get_trail_color_modifier); ClassDB::bind_method(D_METHOD("get_gravity"), &ParticlesMaterial::get_gravity); ClassDB::bind_method(D_METHOD("set_gravity", "accel_vec"), &ParticlesMaterial::set_gravity); diff --git a/scene/3d/particles.h b/scene/3d/particles.h index 0549eb4c09..31ca85a59a 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -78,6 +78,7 @@ private: protected: static void _bind_methods(); + void _notification(int p_what); virtual void _validate_property(PropertyInfo &property) const; public: diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index 5c29918118..f8df21004e 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -78,8 +78,8 @@ Ref<Curve3D> Path::get_curve() const { void Path::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_curve", "curve:Curve3D"), &Path::set_curve); - ClassDB::bind_method(D_METHOD("get_curve:Curve3D", "curve"), &Path::get_curve); + ClassDB::bind_method(D_METHOD("set_curve", "curve"), &Path::set_curve); + ClassDB::bind_method(D_METHOD("get_curve"), &Path::get_curve); ClassDB::bind_method(D_METHOD("_curve_changed"), &Path::_curve_changed); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve3D"), "set_curve", "get_curve"); diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 7e599ce2f5..dc8f72d77e 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -229,8 +229,8 @@ void StaticBody::_bind_methods() { ClassDB::bind_method(D_METHOD("set_bounce", "bounce"), &StaticBody::set_bounce); ClassDB::bind_method(D_METHOD("get_bounce"), &StaticBody::get_bounce); - ClassDB::bind_method(D_METHOD("add_collision_exception_with", "body:PhysicsBody"), &PhysicsBody::add_collision_exception_with); - ClassDB::bind_method(D_METHOD("remove_collision_exception_with", "body:PhysicsBody"), &PhysicsBody::remove_collision_exception_with); + ClassDB::bind_method(D_METHOD("add_collision_exception_with", "body"), &PhysicsBody::add_collision_exception_with); + ClassDB::bind_method(D_METHOD("remove_collision_exception_with", "body"), &PhysicsBody::remove_collision_exception_with); ADD_PROPERTY(PropertyInfo(Variant::REAL, "friction", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_friction", "get_friction"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "bounce", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_bounce", "get_bounce"); @@ -473,6 +473,21 @@ void RigidBody::_direct_state_changed(Object *p_state) { } void RigidBody::_notification(int p_what) { + +#ifdef TOOLS_ENABLED + if (p_what == NOTIFICATION_ENTER_TREE) { + if (get_tree()->is_editor_hint()) { + set_notify_local_transform(true); //used for warnings and only in editor + } + } + + if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) { + if (get_tree()->is_editor_hint()) { + update_configuration_warning(); + } + } + +#endif } void RigidBody::set_mode(Mode p_mode) { @@ -747,6 +762,22 @@ Array RigidBody::get_colliding_bodies() const { return ret; } +String RigidBody::get_configuration_warning() const { + + Transform t = get_transform(); + + String warning = CollisionObject::get_configuration_warning(); + + if ((get_mode() == MODE_RIGID || get_mode() == MODE_CHARACTER) && (ABS(t.basis.get_axis(0).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(1).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(0).length() - 1.0) > 0.05)) { + if (warning != String()) { + warning += "\n"; + } + warning += TTR("Size changes to RigidBody (in character or rigid modes) will be overriden by the physics engine when running.\nChange the size in children collision shapes instead."); + } + + return warning; +} + void RigidBody::_bind_methods() { ClassDB::bind_method(D_METHOD("set_mode", "mode"), &RigidBody::set_mode); @@ -1107,7 +1138,7 @@ void KinematicBody::_bind_methods() { ClassDB::bind_method(D_METHOD("get_floor_velocity"), &KinematicBody::get_floor_velocity); ClassDB::bind_method(D_METHOD("set_safe_margin", "pixels"), &KinematicBody::set_safe_margin); - ClassDB::bind_method(D_METHOD("get_safe_margin", "pixels"), &KinematicBody::get_safe_margin); + ClassDB::bind_method(D_METHOD("get_safe_margin"), &KinematicBody::get_safe_margin); ClassDB::bind_method(D_METHOD("get_collision_count"), &KinematicBody::get_collision_count); ClassDB::bind_method(D_METHOD("get_collision_position", "collision"), &KinematicBody::get_collision_position); diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h index f86d7d957f..83811a1d93 100644 --- a/scene/3d/physics_body.h +++ b/scene/3d/physics_body.h @@ -252,6 +252,8 @@ public: void apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse); + virtual String get_configuration_warning() const; + RigidBody(); ~RigidBody(); }; diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp index 3fb5c828c2..61d496935b 100644 --- a/scene/3d/physics_joint.cpp +++ b/scene/3d/physics_joint.cpp @@ -979,9 +979,9 @@ Generic6DOFJoint::Generic6DOFJoint() { void PhysicsJoint::_set(const String& p_name, const Variant& p_value) { if (p_name=="body_A") - set_body_A(p_value); + set_body_a(p_value); else if (p_name=="body_B") - set_body_B(p_value); + set_body_b(p_value); else if (p_name=="active") set_active(p_value); else if (p_name=="no_collision") @@ -990,9 +990,9 @@ void PhysicsJoint::_set(const String& p_name, const Variant& p_value) { Variant PhysicsJoint::_get(const String& p_name) const { if (p_name=="body_A") - return get_body_A(); + return get_body_a(); else if (p_name=="body_B") - return get_body_B(); + return get_body_b(); else if (p_name=="active") return is_active(); else if (p_name=="no_collision") @@ -1034,7 +1034,7 @@ void PhysicsJoint::_notification(int p_what) { if (indicator.is_valid()) { indicator_instance=VisualServer::get_singleton()->instance_create(indicator,get_world()->get_scenario()); - VisualServer::get_singleton()->instance_attach_object_instance_ID( indicator_instance,get_instance_ID() ); + VisualServer::get_singleton()->instance_attach_object_instance_id( indicator_instance,get_instance_id() ); } } break; case NOTIFICATION_TRANSFORM_CHANGED: { @@ -1067,10 +1067,10 @@ RID PhysicsJoint::_get_visual_instance_rid() const { void PhysicsJoint::_bind_methods() { ClassDB::bind_method(D_METHOD("_get_visual_instance_rid"),&PhysicsJoint::_get_visual_instance_rid); - ClassDB::bind_method(D_METHOD("set_body_A","path"),&PhysicsJoint::set_body_A); - ClassDB::bind_method(D_METHOD("set_body_B"),&PhysicsJoint::set_body_B); - ClassDB::bind_method(D_METHOD("get_body_A","path"),&PhysicsJoint::get_body_A); - ClassDB::bind_method(D_METHOD("get_body_B"),&PhysicsJoint::get_body_B); + ClassDB::bind_method(D_METHOD("set_body_a","path"),&PhysicsJoint::set_body_a); + ClassDB::bind_method(D_METHOD("set_body_b"),&PhysicsJoint::set_body_b); + ClassDB::bind_method(D_METHOD("get_body_a","path"),&PhysicsJoint::get_body_a); + ClassDB::bind_method(D_METHOD("get_body_b"),&PhysicsJoint::get_body_b); ClassDB::bind_method(D_METHOD("set_active","active"),&PhysicsJoint::set_active); ClassDB::bind_method(D_METHOD("is_active"),&PhysicsJoint::is_active); @@ -1085,14 +1085,14 @@ void PhysicsJoint::_bind_methods() { } -void PhysicsJoint::set_body_A(const NodePath& p_path) { +void PhysicsJoint::set_body_a(const NodePath& p_path) { _disconnect(); body_A=p_path; _connect(); _change_notify("body_A"); } -void PhysicsJoint::set_body_B(const NodePath& p_path) { +void PhysicsJoint::set_body_b(const NodePath& p_path) { _disconnect(); body_B=p_path; @@ -1100,11 +1100,11 @@ void PhysicsJoint::set_body_B(const NodePath& p_path) { _change_notify("body_B"); } -NodePath PhysicsJoint::get_body_A() const { +NodePath PhysicsJoint::get_body_a() const { return body_A; } -NodePath PhysicsJoint::get_body_B() const { +NodePath PhysicsJoint::get_body_b() const { return body_B; } diff --git a/scene/3d/physics_joint.h b/scene/3d/physics_joint.h index 2b221e25f2..b834aaf6d2 100644 --- a/scene/3d/physics_joint.h +++ b/scene/3d/physics_joint.h @@ -354,10 +354,10 @@ protected: void _connect(); public: - void set_body_A(const NodePath& p_path); - void set_body_B(const NodePath& p_path); - NodePath get_body_A() const; - NodePath get_body_B() const; + void set_body_a(const NodePath& p_path); + void set_body_b(const NodePath& p_path); + NodePath get_body_a() const; + NodePath get_body_b() const; void set_active(bool p_active); bool is_active() const; diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp index 4dcfb5f94e..492930ea9b 100644 --- a/scene/3d/remote_transform.cpp +++ b/scene/3d/remote_transform.cpp @@ -39,7 +39,7 @@ void RemoteTransform::_update_cache() { return; } - cache = node->get_instance_ID(); + cache = node->get_instance_id(); } } diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index 7827768c09..c5ea6c54da 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -143,8 +143,8 @@ void Room::_bounds_changed() { void Room::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_room", "room:Room"), &Room::set_room); - ClassDB::bind_method(D_METHOD("get_room:Room"), &Room::get_room); + ClassDB::bind_method(D_METHOD("set_room", "room"), &Room::set_room); + ClassDB::bind_method(D_METHOD("get_room"), &Room::get_room); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "room/room", PROPERTY_HINT_RESOURCE_TYPE, "Area"), "set_room", "get_room"); } diff --git a/scene/3d/scenario_fx.cpp b/scene/3d/scenario_fx.cpp index abc7766ecb..0780ce22ff 100644 --- a/scene/3d/scenario_fx.cpp +++ b/scene/3d/scenario_fx.cpp @@ -93,8 +93,8 @@ String WorldEnvironment::get_configuration_warning() const { void WorldEnvironment::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_environment", "env:Environment"), &WorldEnvironment::set_environment); - ClassDB::bind_method(D_METHOD("get_environment:Environment"), &WorldEnvironment::get_environment); + ClassDB::bind_method(D_METHOD("set_environment", "env"), &WorldEnvironment::set_environment); + ClassDB::bind_method(D_METHOD("get_environment"), &WorldEnvironment::get_environment); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment"); } diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index 71af77c027..0d91014314 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -407,7 +407,7 @@ void Skeleton::bind_child_node_to_bone(int p_bone, Node *p_node) { ERR_FAIL_NULL(p_node); ERR_FAIL_INDEX(p_bone, bones.size()); - uint32_t id = p_node->get_instance_ID(); + uint32_t id = p_node->get_instance_id(); for (List<uint32_t>::Element *E = bones[p_bone].nodes_bound.front(); E; E = E->next()) { @@ -422,7 +422,7 @@ void Skeleton::unbind_child_node_from_bone(int p_bone, Node *p_node) { ERR_FAIL_NULL(p_node); ERR_FAIL_INDEX(p_bone, bones.size()); - uint32_t id = p_node->get_instance_ID(); + uint32_t id = p_node->get_instance_id(); bones[p_bone].nodes_bound.erase(id); } void Skeleton::get_bound_child_nodes_to_bone(int p_bone, List<Node *> *p_bound) const { @@ -518,8 +518,8 @@ void Skeleton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_bone_disable_rest", "bone_idx", "disable"), &Skeleton::set_bone_disable_rest); ClassDB::bind_method(D_METHOD("is_bone_rest_disabled", "bone_idx"), &Skeleton::is_bone_rest_disabled); - ClassDB::bind_method(D_METHOD("bind_child_node_to_bone", "bone_idx", "node:Node"), &Skeleton::bind_child_node_to_bone); - ClassDB::bind_method(D_METHOD("unbind_child_node_from_bone", "bone_idx", "node:Node"), &Skeleton::unbind_child_node_from_bone); + ClassDB::bind_method(D_METHOD("bind_child_node_to_bone", "bone_idx", "node"), &Skeleton::bind_child_node_to_bone); + ClassDB::bind_method(D_METHOD("unbind_child_node_from_bone", "bone_idx", "node"), &Skeleton::unbind_child_node_from_bone); ClassDB::bind_method(D_METHOD("get_bound_child_nodes_to_bone", "bone_idx"), &Skeleton::_get_bound_child_nodes_to_bone); ClassDB::bind_method(D_METHOD("clear_bones"), &Skeleton::clear_bones); diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 6106b0904a..848b08eb8f 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -72,8 +72,12 @@ SpatialGizmo::SpatialGizmo() { void Spatial::_notify_dirty() { +#ifdef TOOLS_ENABLED + if ((data.gizmo.is_valid() || data.notify_transform) && !data.ignore_notification && !xform_change.in_list()) { +#else if (data.notify_transform && !data.ignore_notification && !xform_change.in_list()) { +#endif get_tree()->xform_change_list.add(&xform_change); } } @@ -104,9 +108,11 @@ void Spatial::_propagate_transform_changed(Spatial *p_origin) { continue; //don't propagate to a toplevel E->get()->_propagate_transform_changed(p_origin); } - +#ifdef TOOLS_ENABLED + if ((data.gizmo.is_valid() || data.notify_transform) && !data.ignore_notification && !xform_change.in_list()) { +#else if (data.notify_transform && !data.ignore_notification && !xform_change.in_list()) { - +#endif get_tree()->xform_change_list.add(&xform_change); } data.dirty |= DIRTY_GLOBAL; @@ -714,11 +720,11 @@ void Spatial::_bind_methods() { ClassDB::bind_method(D_METHOD("get_scale"), &Spatial::get_scale); ClassDB::bind_method(D_METHOD("set_global_transform", "global"), &Spatial::set_global_transform); ClassDB::bind_method(D_METHOD("get_global_transform"), &Spatial::get_global_transform); - ClassDB::bind_method(D_METHOD("get_parent_spatial:Spatial"), &Spatial::get_parent_spatial); + ClassDB::bind_method(D_METHOD("get_parent_spatial"), &Spatial::get_parent_spatial); ClassDB::bind_method(D_METHOD("set_ignore_transform_notification", "enabled"), &Spatial::set_ignore_transform_notification); ClassDB::bind_method(D_METHOD("set_as_toplevel", "enable"), &Spatial::set_as_toplevel); ClassDB::bind_method(D_METHOD("is_set_as_toplevel"), &Spatial::is_set_as_toplevel); - ClassDB::bind_method(D_METHOD("get_world:World"), &Spatial::get_world); + ClassDB::bind_method(D_METHOD("get_world"), &Spatial::get_world); // TODO: Obsolete those two methods (old name) properly (GH-4397) ClassDB::bind_method(D_METHOD("_set_rotation_deg", "rotation_deg"), &Spatial::_set_rotation_deg); @@ -729,8 +735,8 @@ void Spatial::_bind_methods() { #endif ClassDB::bind_method(D_METHOD("update_gizmo"), &Spatial::update_gizmo); - ClassDB::bind_method(D_METHOD("set_gizmo", "gizmo:SpatialGizmo"), &Spatial::set_gizmo); - ClassDB::bind_method(D_METHOD("get_gizmo:SpatialGizmo"), &Spatial::get_gizmo); + ClassDB::bind_method(D_METHOD("set_gizmo", "gizmo"), &Spatial::set_gizmo); + ClassDB::bind_method(D_METHOD("get_gizmo"), &Spatial::get_gizmo); ClassDB::bind_method(D_METHOD("set_visible", "visible"), &Spatial::set_visible); ClassDB::bind_method(D_METHOD("is_visible"), &Spatial::is_visible); diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 78e8e92afc..978662f7dc 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -389,7 +389,7 @@ void Sprite3D::_draw() { int axis = get_axis(); normal[axis] = 1.0; - RID mat = VS::get_singleton()->material_2d_get(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); + RID mat = SpatialMaterial::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); VS::get_singleton()->immediate_set_material(immediate, mat); VS::get_singleton()->immediate_begin(immediate, VS::PRIMITIVE_TRIANGLE_FAN, texture->get_rid()); @@ -502,7 +502,7 @@ void Sprite3D::set_vframes(int p_amount) { ERR_FAIL_COND(p_amount < 1); vframes = p_amount; _queue_update(); - _change_notify("frame"); + _change_notify(); } int Sprite3D::get_vframes() const { @@ -514,7 +514,7 @@ void Sprite3D::set_hframes(int p_amount) { ERR_FAIL_COND(p_amount < 1); hframes = p_amount; _queue_update(); - _change_notify("frame"); + _change_notify(); } int Sprite3D::get_hframes() const { @@ -562,8 +562,8 @@ void Sprite3D::_validate_property(PropertyInfo &property) const { void Sprite3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Sprite3D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Sprite3D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Sprite3D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Sprite3D::get_texture); ClassDB::bind_method(D_METHOD("set_region", "enabled"), &Sprite3D::set_region); ClassDB::bind_method(D_METHOD("is_region"), &Sprite3D::is_region); @@ -724,8 +724,8 @@ void AnimatedSprite3D::_draw() { void AnimatedSprite3D::_bind_methods(){ - ClassDB::bind_method(D_METHOD("set_sprite_frames","sprite_frames:SpriteFrames"),&AnimatedSprite3D::set_sprite_frames); - ClassDB::bind_method(D_METHOD("get_sprite_frames:Texture"),&AnimatedSprite3D::get_sprite_frames); + ClassDB::bind_method(D_METHOD("set_sprite_frames","sprite_frames"),&AnimatedSprite3D::set_sprite_frames); + ClassDB::bind_method(D_METHOD("get_sprite_frames"),&AnimatedSprite3D::get_sprite_frames); ClassDB::bind_method(D_METHOD("set_frame","frame"),&AnimatedSprite3D::set_frame); ClassDB::bind_method(D_METHOD("get_frame"),&AnimatedSprite3D::get_frame); @@ -892,7 +892,8 @@ void AnimatedSprite3D::_draw() { int axis = get_axis(); normal[axis] = 1.0; - RID mat = VS::get_singleton()->material_2d_get(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); + RID mat = SpatialMaterial::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); + VS::get_singleton()->immediate_set_material(immediate, mat); VS::get_singleton()->immediate_begin(immediate, VS::PRIMITIVE_TRIANGLE_FAN, texture->get_rid()); @@ -1245,8 +1246,8 @@ String AnimatedSprite3D::get_configuration_warning() const { void AnimatedSprite3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames:SpriteFrames"), &AnimatedSprite3D::set_sprite_frames); - ClassDB::bind_method(D_METHOD("get_sprite_frames:SpriteFrames"), &AnimatedSprite3D::get_sprite_frames); + ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames"), &AnimatedSprite3D::set_sprite_frames); + ClassDB::bind_method(D_METHOD("get_sprite_frames"), &AnimatedSprite3D::get_sprite_frames); ClassDB::bind_method(D_METHOD("set_animation", "animation"), &AnimatedSprite3D::set_animation); ClassDB::bind_method(D_METHOD("get_animation"), &AnimatedSprite3D::get_animation); diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index 5e6561adb7..cc81a4cb56 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "visibility_notifier.h" +#include "scene/3d/camera.h" #include "scene/3d/physics_body.h" #include "scene/animation/animation_player.h" #include "scene/scene_string_names.h" @@ -42,6 +43,7 @@ void VisibilityNotifier::_enter_camera(Camera *p_camera) { emit_signal(SceneStringNames::get_singleton()->screen_entered); _screen_enter(); } + emit_signal(SceneStringNames::get_singleton()->camera_entered, p_camera); } diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 6f8c38eddd..1a294d016a 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -149,7 +149,7 @@ void VisualInstance::set_base(const RID &p_base) { VisualInstance::VisualInstance() { instance = VisualServer::get_singleton()->instance_create(); - VisualServer::get_singleton()->instance_attach_object_instance_ID(instance, get_instance_ID()); + VisualServer::get_singleton()->instance_attach_object_instance_id(instance, get_instance_id()); layers = 1; set_notify_transform(true); } diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 543b64bd15..e2a0636466 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -247,7 +247,7 @@ void AnimationPlayer::_generate_node_caches(AnimationData *p_anim) { ERR_EXPLAIN("On Animation: '" + p_anim->name + "', couldn't resolve track: '" + String(a->track_get_path(i)) + "'"); } ERR_CONTINUE(!child); // couldn't find the child node - uint32_t id = resource.is_valid() ? resource->get_instance_ID() : child->get_instance_ID(); + uint32_t id = resource.is_valid() ? resource->get_instance_id() : child->get_instance_id(); int bone_idx = -1; if (a->track_get_path(i).get_property() && child->cast_to<Skeleton>()) { @@ -1215,11 +1215,11 @@ void AnimationPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationPlayer::_node_removed); ClassDB::bind_method(D_METHOD("_animation_changed"), &AnimationPlayer::_animation_changed); - ClassDB::bind_method(D_METHOD("add_animation", "name", "animation:Animation"), &AnimationPlayer::add_animation); + ClassDB::bind_method(D_METHOD("add_animation", "name", "animation"), &AnimationPlayer::add_animation); ClassDB::bind_method(D_METHOD("remove_animation", "name"), &AnimationPlayer::remove_animation); ClassDB::bind_method(D_METHOD("rename_animation", "name", "newname"), &AnimationPlayer::rename_animation); ClassDB::bind_method(D_METHOD("has_animation", "name"), &AnimationPlayer::has_animation); - ClassDB::bind_method(D_METHOD("get_animation:Animation", "name"), &AnimationPlayer::get_animation); + ClassDB::bind_method(D_METHOD("get_animation", "name"), &AnimationPlayer::get_animation); ClassDB::bind_method(D_METHOD("get_animation_list"), &AnimationPlayer::_get_animation_list); ClassDB::bind_method(D_METHOD("animation_set_next", "anim_from", "anim_to"), &AnimationPlayer::animation_set_next); @@ -1256,7 +1256,7 @@ void AnimationPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("seek", "pos_sec", "update"), &AnimationPlayer::seek, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_pos"), &AnimationPlayer::get_current_animation_pos); - ClassDB::bind_method(D_METHOD("find_animation", "animation:Animation"), &AnimationPlayer::find_animation); + ClassDB::bind_method(D_METHOD("find_animation", "animation"), &AnimationPlayer::find_animation); ClassDB::bind_method(D_METHOD("clear_caches"), &AnimationPlayer::clear_caches); @@ -1268,7 +1268,7 @@ void AnimationPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationPlayer::advance); - ADD_GROUP("Playback", "playback_"); + ADD_GROUP("Playback Options", "playback_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), "set_animation_process_mode", "get_animation_process_mode"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "playback_default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_default_blend_time", "get_default_blend_time"); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "root_node"), "set_root", "get_root"); diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index 7c2684ba47..c12e97c4a5 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -1481,7 +1481,7 @@ AnimationTreePlayer::Track *AnimationTreePlayer::_find_track(const NodePath &p_p return NULL; } - ObjectID id = child->get_instance_ID(); + ObjectID id = child->get_instance_id(); StringName property; int bone_idx = -1; @@ -1709,8 +1709,8 @@ void AnimationTreePlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("node_get_input_count", "id"), &AnimationTreePlayer::node_get_input_count); ClassDB::bind_method(D_METHOD("node_get_input_source", "id", "idx"), &AnimationTreePlayer::node_get_input_source); - ClassDB::bind_method(D_METHOD("animation_node_set_animation", "id", "animation:Animation"), &AnimationTreePlayer::animation_node_set_animation); - ClassDB::bind_method(D_METHOD("animation_node_get_animation:Animation", "id"), &AnimationTreePlayer::animation_node_get_animation); + ClassDB::bind_method(D_METHOD("animation_node_set_animation", "id", "animation"), &AnimationTreePlayer::animation_node_set_animation); + ClassDB::bind_method(D_METHOD("animation_node_get_animation", "id"), &AnimationTreePlayer::animation_node_get_animation); ClassDB::bind_method(D_METHOD("animation_node_set_master_animation", "id", "source"), &AnimationTreePlayer::animation_node_set_master_animation); ClassDB::bind_method(D_METHOD("animation_node_get_master_animation", "id"), &AnimationTreePlayer::animation_node_get_master_animation); diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index ad0b0fbfb2..78d3357bb4 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -1024,7 +1024,7 @@ bool Tween::interpolate_property(Object *p_object, String p_property, Variant p_ data.finish = false; data.elapsed = 0; - data.id = p_object->get_instance_ID(); + data.id = p_object->get_instance_id(); data.key = p_property; data.initial_val = p_initial_val; data.final_val = p_final_val; @@ -1066,7 +1066,7 @@ bool Tween::interpolate_method(Object *p_object, String p_method, Variant p_init data.finish = false; data.elapsed = 0; - data.id = p_object->get_instance_ID(); + data.id = p_object->get_instance_id(); data.key = p_method; data.initial_val = p_initial_val; data.final_val = p_final_val; @@ -1103,7 +1103,7 @@ bool Tween::interpolate_callback(Object *p_object, real_t p_duration, String p_c data.call_deferred = false; data.elapsed = 0; - data.id = p_object->get_instance_ID(); + data.id = p_object->get_instance_id(); data.key = p_callback; data.duration = p_duration; data.delay = 0; @@ -1155,7 +1155,7 @@ bool Tween::interpolate_deferred_callback(Object *p_object, real_t p_duration, S data.call_deferred = true; data.elapsed = 0; - data.id = p_object->get_instance_ID(); + data.id = p_object->get_instance_id(); data.key = p_callback; data.duration = p_duration; data.delay = 0; @@ -1222,10 +1222,10 @@ bool Tween::follow_property(Object *p_object, String p_property, Variant p_initi data.finish = false; data.elapsed = 0; - data.id = p_object->get_instance_ID(); + data.id = p_object->get_instance_id(); data.key = p_property; data.initial_val = p_initial_val; - data.target_id = p_target->get_instance_ID(); + data.target_id = p_target->get_instance_id(); data.target_key = p_target_property; data.duration = p_duration; data.trans_type = p_trans_type; @@ -1272,10 +1272,10 @@ bool Tween::follow_method(Object *p_object, String p_method, Variant p_initial_v data.finish = false; data.elapsed = 0; - data.id = p_object->get_instance_ID(); + data.id = p_object->get_instance_id(); data.key = p_method; data.initial_val = p_initial_val; - data.target_id = p_target->get_instance_ID(); + data.target_id = p_target->get_instance_id(); data.target_key = p_target_method; data.duration = p_duration; data.trans_type = p_trans_type; @@ -1321,9 +1321,9 @@ bool Tween::targeting_property(Object *p_object, String p_property, Object *p_in data.finish = false; data.elapsed = 0; - data.id = p_object->get_instance_ID(); + data.id = p_object->get_instance_id(); data.key = p_property; - data.target_id = p_initial->get_instance_ID(); + data.target_id = p_initial->get_instance_id(); data.target_key = p_initial_property; data.initial_val = initial_val; data.final_val = p_final_val; @@ -1375,9 +1375,9 @@ bool Tween::targeting_method(Object *p_object, String p_method, Object *p_initia data.finish = false; data.elapsed = 0; - data.id = p_object->get_instance_ID(); + data.id = p_object->get_instance_id(); data.key = p_method; - data.target_id = p_initial->get_instance_ID(); + data.target_id = p_initial->get_instance_id(); data.target_key = p_initial_method; data.initial_val = initial_val; data.final_val = p_final_val; diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp index fdf61c40d8..a8ddcbbb45 100644 --- a/scene/audio/audio_player.cpp +++ b/scene/audio/audio_player.cpp @@ -262,8 +262,8 @@ void AudioStreamPlayer::_bus_layout_changed() { void AudioStreamPlayer::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_stream", "stream:AudioStream"), &AudioStreamPlayer::set_stream); - ClassDB::bind_method(D_METHOD("get_stream:AudioStream"), &AudioStreamPlayer::get_stream); + ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer::set_stream); + ClassDB::bind_method(D_METHOD("get_stream"), &AudioStreamPlayer::get_stream); ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer::set_volume_db); ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer::get_volume_db); diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 9a5f55698e..9c20decef0 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -493,11 +493,11 @@ void BaseButton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_enabled_focus_mode", "mode"), &BaseButton::set_enabled_focus_mode); ClassDB::bind_method(D_METHOD("get_enabled_focus_mode"), &BaseButton::get_enabled_focus_mode); - ClassDB::bind_method(D_METHOD("set_shortcut", "shortcut:ShortCut"), &BaseButton::set_shortcut); - ClassDB::bind_method(D_METHOD("get_shortcut:ShortCut"), &BaseButton::get_shortcut); + ClassDB::bind_method(D_METHOD("set_shortcut", "shortcut"), &BaseButton::set_shortcut); + ClassDB::bind_method(D_METHOD("get_shortcut"), &BaseButton::get_shortcut); - ClassDB::bind_method(D_METHOD("set_button_group", "button_group:ButtonGroup"), &BaseButton::set_button_group); - ClassDB::bind_method(D_METHOD("get_button_group:ButtonGroup"), &BaseButton::get_button_group); + ClassDB::bind_method(D_METHOD("set_button_group", "button_group"), &BaseButton::set_button_group); + ClassDB::bind_method(D_METHOD("get_button_group"), &BaseButton::get_button_group); BIND_VMETHOD(MethodInfo("_pressed")); BIND_VMETHOD(MethodInfo("_toggled", PropertyInfo(Variant::BOOL, "pressed"))); @@ -508,7 +508,7 @@ void BaseButton::_bind_methods() { ADD_SIGNAL(MethodInfo("toggled", PropertyInfo(Variant::BOOL, "pressed"))); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toggle_mode"), "set_toggle_mode", "is_toggle_mode"); - ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "is_pressed"), "set_pressed", "is_pressed"); + ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed"); ADD_PROPERTYNO(PropertyInfo(Variant::INT, "action_mode", PROPERTY_HINT_ENUM, "Button Press,Button Release"), "set_action_mode", "get_action_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "enabled_focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_enabled_focus_mode", "get_enabled_focus_mode"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "ShortCut"), "set_shortcut", "get_shortcut"); @@ -563,7 +563,7 @@ BaseButton *ButtonGroup::get_pressed_button() { void ButtonGroup::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_pressed_button:BaseButton"), &ButtonGroup::get_pressed_button); + ClassDB::bind_method(D_METHOD("get_pressed_button"), &ButtonGroup::get_pressed_button); } ButtonGroup::ButtonGroup() { diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 03798c01a2..9a0b3b3c89 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -236,8 +236,8 @@ void Button::_bind_methods() { ClassDB::bind_method(D_METHOD("set_text", "text"), &Button::set_text); ClassDB::bind_method(D_METHOD("get_text"), &Button::get_text); - ClassDB::bind_method(D_METHOD("set_button_icon", "texture:Texture"), &Button::set_icon); - ClassDB::bind_method(D_METHOD("get_button_icon:Texture"), &Button::get_icon); + ClassDB::bind_method(D_METHOD("set_button_icon", "texture"), &Button::set_icon); + ClassDB::bind_method(D_METHOD("get_button_icon"), &Button::get_icon); ClassDB::bind_method(D_METHOD("set_flat", "enabled"), &Button::set_flat); ClassDB::bind_method(D_METHOD("set_clip_text", "enabled"), &Button::set_clip_text); ClassDB::bind_method(D_METHOD("get_clip_text"), &Button::get_clip_text); diff --git a/scene/gui/button_group.cpp b/scene/gui/button_group.cpp index 75fe438448..e54e810d7d 100644 --- a/scene/gui/button_group.cpp +++ b/scene/gui/button_group.cpp @@ -152,12 +152,12 @@ int ButtonGroup::get_pressed_button_index() const { void ButtonGroup::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_pressed_button:BaseButton"),&ButtonGroup::get_pressed_button); + ClassDB::bind_method(D_METHOD("get_pressed_button"),&ButtonGroup::get_pressed_button); ClassDB::bind_method(D_METHOD("get_pressed_button_index"),&ButtonGroup::get_pressed_button_index); - ClassDB::bind_method(D_METHOD("get_focused_button:BaseButton"),&ButtonGroup::get_focused_button); + ClassDB::bind_method(D_METHOD("get_focused_button"),&ButtonGroup::get_focused_button); ClassDB::bind_method(D_METHOD("get_button_list"),&ButtonGroup::_get_button_list); ClassDB::bind_method(D_METHOD("_pressed"),&ButtonGroup::_pressed); - ClassDB::bind_method(D_METHOD("set_pressed_button","button:BaseButton"),&ButtonGroup::_pressed); + ClassDB::bind_method(D_METHOD("set_pressed_button","button"),&ButtonGroup::_pressed); ADD_SIGNAL( MethodInfo("button_selected",PropertyInfo(Variant::OBJECT,"button",PROPERTY_HINT_RESOURCE_TYPE,"BaseButton"))); } diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 48cac69956..dddd53dd95 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -674,7 +674,7 @@ void ColorPickerButton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pick_color", "color"), &ColorPickerButton::set_pick_color); ClassDB::bind_method(D_METHOD("get_pick_color"), &ColorPickerButton::get_pick_color); - ClassDB::bind_method(D_METHOD("get_picker:ColorPicker"), &ColorPickerButton::get_picker); + ClassDB::bind_method(D_METHOD("get_picker"), &ColorPickerButton::get_picker); ClassDB::bind_method(D_METHOD("set_edit_alpha", "show"), &ColorPickerButton::set_edit_alpha); ClassDB::bind_method(D_METHOD("is_editing_alpha"), &ColorPickerButton::is_editing_alpha); ClassDB::bind_method(D_METHOD("_color_changed"), &ColorPickerButton::_color_changed); diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index 2a96f8260c..4bbe15ed7e 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -168,7 +168,7 @@ void Container::_bind_methods() { ClassDB::bind_method(D_METHOD("_child_minsize_changed"), &Container::_child_minsize_changed); ClassDB::bind_method(D_METHOD("queue_sort"), &Container::queue_sort); - ClassDB::bind_method(D_METHOD("fit_child_in_rect", "child:Control", "rect"), &Container::fit_child_in_rect); + ClassDB::bind_method(D_METHOD("fit_child_in_rect", "child", "rect"), &Container::fit_child_in_rect); BIND_CONSTANT(NOTIFICATION_SORT_CHILDREN); ADD_SIGNAL(MethodInfo("sort_children")); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index ca81b72e89..01570e28c4 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -603,7 +603,7 @@ bool Control::has_point(const Point2 &p_point) const { void Control::set_drag_forwarding(Control *p_target) { if (p_target) - data.drag_owner = p_target->get_instance_ID(); + data.drag_owner = p_target->get_instance_id(); else data.drag_owner = 0; } @@ -2411,7 +2411,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("has_focus"), &Control::has_focus); ClassDB::bind_method(D_METHOD("grab_focus"), &Control::grab_focus); ClassDB::bind_method(D_METHOD("release_focus"), &Control::release_focus); - ClassDB::bind_method(D_METHOD("get_focus_owner:Control"), &Control::get_focus_owner); + ClassDB::bind_method(D_METHOD("get_focus_owner"), &Control::get_focus_owner); ClassDB::bind_method(D_METHOD("set_h_size_flags", "flags"), &Control::set_h_size_flags); ClassDB::bind_method(D_METHOD("get_h_size_flags"), &Control::get_h_size_flags); @@ -2422,19 +2422,19 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("set_v_size_flags", "flags"), &Control::set_v_size_flags); ClassDB::bind_method(D_METHOD("get_v_size_flags"), &Control::get_v_size_flags); - ClassDB::bind_method(D_METHOD("set_theme", "theme:Theme"), &Control::set_theme); - ClassDB::bind_method(D_METHOD("get_theme:Theme"), &Control::get_theme); + ClassDB::bind_method(D_METHOD("set_theme", "theme"), &Control::set_theme); + ClassDB::bind_method(D_METHOD("get_theme"), &Control::get_theme); - ClassDB::bind_method(D_METHOD("add_icon_override", "name", "texture:Texture"), &Control::add_icon_override); - ClassDB::bind_method(D_METHOD("add_shader_override", "name", "shader:Shader"), &Control::add_shader_override); - ClassDB::bind_method(D_METHOD("add_style_override", "name", "stylebox:StyleBox"), &Control::add_style_override); - ClassDB::bind_method(D_METHOD("add_font_override", "name", "font:Font"), &Control::add_font_override); + ClassDB::bind_method(D_METHOD("add_icon_override", "name", "texture"), &Control::add_icon_override); + ClassDB::bind_method(D_METHOD("add_shader_override", "name", "shader"), &Control::add_shader_override); + ClassDB::bind_method(D_METHOD("add_style_override", "name", "stylebox"), &Control::add_style_override); + ClassDB::bind_method(D_METHOD("add_font_override", "name", "font"), &Control::add_font_override); ClassDB::bind_method(D_METHOD("add_color_override", "name", "color"), &Control::add_color_override); ClassDB::bind_method(D_METHOD("add_constant_override", "name", "constant"), &Control::add_constant_override); - ClassDB::bind_method(D_METHOD("get_icon:Texture", "name", "type"), &Control::get_icon, DEFVAL("")); - ClassDB::bind_method(D_METHOD("get_stylebox:StyleBox", "name", "type"), &Control::get_stylebox, DEFVAL("")); - ClassDB::bind_method(D_METHOD("get_font:Font", "name", "type"), &Control::get_font, DEFVAL("")); + ClassDB::bind_method(D_METHOD("get_icon", "name", "type"), &Control::get_icon, DEFVAL("")); + ClassDB::bind_method(D_METHOD("get_stylebox", "name", "type"), &Control::get_stylebox, DEFVAL("")); + ClassDB::bind_method(D_METHOD("get_font", "name", "type"), &Control::get_font, DEFVAL("")); ClassDB::bind_method(D_METHOD("get_color", "name", "type"), &Control::get_color, DEFVAL("")); ClassDB::bind_method(D_METHOD("get_constant", "name", "type"), &Control::get_constant, DEFVAL("")); @@ -2450,7 +2450,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("has_color", "name", "type"), &Control::has_color, DEFVAL("")); ClassDB::bind_method(D_METHOD("has_constant", "name", "type"), &Control::has_constant, DEFVAL("")); - ClassDB::bind_method(D_METHOD("get_parent_control:Control"), &Control::get_parent_control); + ClassDB::bind_method(D_METHOD("get_parent_control"), &Control::get_parent_control); ClassDB::bind_method(D_METHOD("set_h_grow_direction", "direction"), &Control::set_h_grow_direction); ClassDB::bind_method(D_METHOD("get_h_grow_direction"), &Control::get_h_grow_direction); @@ -2469,7 +2469,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("set_focus_neighbour", "margin", "neighbour"), &Control::set_focus_neighbour); ClassDB::bind_method(D_METHOD("get_focus_neighbour", "margin"), &Control::get_focus_neighbour); - ClassDB::bind_method(D_METHOD("force_drag", "data", "preview:Control"), &Control::force_drag); + ClassDB::bind_method(D_METHOD("force_drag", "data", "preview"), &Control::force_drag); ClassDB::bind_method(D_METHOD("set_mouse_filter", "filter"), &Control::set_mouse_filter); ClassDB::bind_method(D_METHOD("get_mouse_filter"), &Control::get_mouse_filter); @@ -2479,8 +2479,8 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("grab_click_focus"), &Control::grab_click_focus); - ClassDB::bind_method(D_METHOD("set_drag_forwarding", "target:Control"), &Control::set_drag_forwarding); - ClassDB::bind_method(D_METHOD("set_drag_preview", "control:Control"), &Control::set_drag_preview); + ClassDB::bind_method(D_METHOD("set_drag_forwarding", "target"), &Control::set_drag_forwarding); + ClassDB::bind_method(D_METHOD("set_drag_preview", "control"), &Control::set_drag_preview); ClassDB::bind_method(D_METHOD("warp_mouse", "to_pos"), &Control::warp_mouse); @@ -2597,7 +2597,7 @@ void Control::_bind_methods() { ADD_SIGNAL(MethodInfo("minimum_size_changed")); ADD_SIGNAL(MethodInfo("modal_closed")); - BIND_VMETHOD(MethodInfo("has_point", PropertyInfo(Variant::VECTOR2, "point"))); + BIND_VMETHOD(MethodInfo("has_point:bool", PropertyInfo(Variant::VECTOR2, "point"))); } Control::Control() { diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 7d7c636bc2..dedf44d407 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -308,7 +308,7 @@ void WindowDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("set_resizable", "resizable"), &WindowDialog::set_resizable); ClassDB::bind_method(D_METHOD("get_resizable"), &WindowDialog::get_resizable); ClassDB::bind_method(D_METHOD("_closed"), &WindowDialog::_closed); - ClassDB::bind_method(D_METHOD("get_close_button:TextureButton"), &WindowDialog::get_close_button); + ClassDB::bind_method(D_METHOD("get_close_button"), &WindowDialog::get_close_button); ADD_PROPERTY(PropertyInfo(Variant::STRING, "window_title", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT_INTL), "set_title", "get_title"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "resizable", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT_INTL), "set_resizable", "get_resizable"); @@ -515,10 +515,10 @@ void AcceptDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("get_label"), &AcceptDialog::get_label); ClassDB::bind_method(D_METHOD("set_hide_on_ok", "enabled"), &AcceptDialog::set_hide_on_ok); ClassDB::bind_method(D_METHOD("get_hide_on_ok"), &AcceptDialog::get_hide_on_ok); - ClassDB::bind_method(D_METHOD("add_button:Button", "text", "right", "action"), &AcceptDialog::add_button, DEFVAL(false), DEFVAL("")); - ClassDB::bind_method(D_METHOD("add_cancel:Button", "name"), &AcceptDialog::add_cancel); + ClassDB::bind_method(D_METHOD("add_button", "text", "right", "action"), &AcceptDialog::add_button, DEFVAL(false), DEFVAL("")); + ClassDB::bind_method(D_METHOD("add_cancel", "name"), &AcceptDialog::add_cancel); ClassDB::bind_method(D_METHOD("_builtin_text_entered"), &AcceptDialog::_builtin_text_entered); - ClassDB::bind_method(D_METHOD("register_text_enter:LineEdit", "line_edit"), &AcceptDialog::register_text_enter); + ClassDB::bind_method(D_METHOD("register_text_enter", "line_edit"), &AcceptDialog::register_text_enter); ClassDB::bind_method(D_METHOD("_custom_action"), &AcceptDialog::_custom_action); ClassDB::bind_method(D_METHOD("set_text", "text"), &AcceptDialog::set_text); ClassDB::bind_method(D_METHOD("get_text"), &AcceptDialog::get_text); @@ -573,7 +573,7 @@ AcceptDialog::~AcceptDialog() { void ConfirmationDialog::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_cancel:Button"), &ConfirmationDialog::get_cancel); + ClassDB::bind_method(D_METHOD("get_cancel"), &ConfirmationDialog::get_cancel); } Button *ConfirmationDialog::get_cancel() { diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 3527b834c7..74255b38bf 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -701,7 +701,7 @@ void FileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("set_current_path", "path"), &FileDialog::set_current_path); ClassDB::bind_method(D_METHOD("set_mode", "mode"), &FileDialog::set_mode); ClassDB::bind_method(D_METHOD("get_mode"), &FileDialog::get_mode); - ClassDB::bind_method(D_METHOD("get_vbox:VBoxContainer"), &FileDialog::get_vbox); + ClassDB::bind_method(D_METHOD("get_vbox"), &FileDialog::get_vbox); ClassDB::bind_method(D_METHOD("set_access", "access"), &FileDialog::set_access); ClassDB::bind_method(D_METHOD("get_access"), &FileDialog::get_access); ClassDB::bind_method(D_METHOD("set_show_hidden_files", "show"), &FileDialog::set_show_hidden_files); @@ -850,9 +850,9 @@ void LineEditFileChooser::_bind_methods() { ClassDB::bind_method(D_METHOD("_browse"), &LineEditFileChooser::_browse); ClassDB::bind_method(D_METHOD("_chosen"), &LineEditFileChooser::_chosen); - ClassDB::bind_method(D_METHOD("get_button:Button"), &LineEditFileChooser::get_button); - ClassDB::bind_method(D_METHOD("get_line_edit:LineEdit"), &LineEditFileChooser::get_line_edit); - ClassDB::bind_method(D_METHOD("get_file_dialog:FileDialog"), &LineEditFileChooser::get_file_dialog); + ClassDB::bind_method(D_METHOD("get_button"), &LineEditFileChooser::get_button); + ClassDB::bind_method(D_METHOD("get_line_edit"), &LineEditFileChooser::get_line_edit); + ClassDB::bind_method(D_METHOD("get_file_dialog"), &LineEditFileChooser::get_file_dialog); } void LineEditFileChooser::_chosen(const String &p_text) { diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 11f750ea70..e85ef73f4e 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -207,9 +207,10 @@ void GraphEdit::_graph_node_raised(Node *p_gn) { GraphNode *gn = p_gn->cast_to<GraphNode>(); ERR_FAIL_COND(!gn); - gn->raise(); if (gn->is_comment()) { move_child(gn, 0); + } else { + gn->raise(); } int first_not_comment = 0; for (int i = 0; i < get_child_count(); i++) { @@ -870,21 +871,19 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { if (b->get_button_index() == BUTTON_LEFT && b->is_pressed()) { GraphNode *gn = NULL; - GraphNode *gn_selected = NULL; + for (int i = get_child_count() - 1; i >= 0; i--) { - gn_selected = get_child(i)->cast_to<GraphNode>(); + GraphNode *gn_selected = get_child(i)->cast_to<GraphNode>(); if (gn_selected) { - if (gn_selected->is_resizing()) continue; - Rect2 r = gn_selected->get_rect(); - r.size *= zoom; - if (r.has_point(get_local_mouse_pos())) + if (gn_selected->has_point(gn_selected->get_local_mouse_pos())) { gn = gn_selected; - break; + break; + } } } @@ -1158,7 +1157,7 @@ void GraphEdit::_snap_value_changed(double) { void GraphEdit::_bind_methods() { - ClassDB::bind_method(D_METHOD("connect_node:Error", "from", "from_port", "to", "to_port"), &GraphEdit::connect_node); + ClassDB::bind_method(D_METHOD("connect_node", "from", "from_port", "to", "to_port"), &GraphEdit::connect_node); ClassDB::bind_method(D_METHOD("is_node_connected", "from", "from_port", "to", "to_port"), &GraphEdit::is_node_connected); ClassDB::bind_method(D_METHOD("disconnect_node", "from", "from_port", "to", "to_port"), &GraphEdit::disconnect_node); ClassDB::bind_method(D_METHOD("get_connection_list"), &GraphEdit::_get_connection_list); @@ -1193,7 +1192,7 @@ void GraphEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_scroll_offset"), &GraphEdit::_update_scroll_offset); ClassDB::bind_method(D_METHOD("_connections_layer_draw"), &GraphEdit::_connections_layer_draw); - ClassDB::bind_method(D_METHOD("set_selected", "node:Node"), &GraphEdit::set_selected); + ClassDB::bind_method(D_METHOD("set_selected", "node"), &GraphEdit::set_selected); ADD_SIGNAL(MethodInfo("connection_request", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot"))); ADD_SIGNAL(MethodInfo("disconnection_request", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot"))); @@ -1225,6 +1224,7 @@ GraphEdit::GraphEdit() { connections_layer->connect("draw", this, "_connections_layer_draw"); connections_layer->set_name("CLAYER"); connections_layer->set_disable_visibility_clip(true); // so it can draw freely and be offseted + connections_layer->set_mouse_filter(MOUSE_FILTER_IGNORE); h_scroll = memnew(HScrollBar); h_scroll->set_name("_h_scroll"); diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index 538dd846e4..b9062295b5 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -176,6 +176,7 @@ bool GraphNode::has_point(const Point2 &p_point) const { if (Rect2(get_size() - resizer->get_size(), resizer->get_size()).has_point(p_point)) { return true; } + if (Rect2(0, 0, get_size().width, comment->get_margin(MARGIN_TOP)).has_point(p_point)) { return true; } @@ -663,7 +664,7 @@ void GraphNode::_bind_methods() { ClassDB::bind_method(D_METHOD("set_slot", "idx", "enable_left", "type_left", "color_left", "enable_right", "type_right", "color_right", "custom_left", "custom_right"), &GraphNode::set_slot, DEFVAL(Ref<Texture>()), DEFVAL(Ref<Texture>())); ClassDB::bind_method(D_METHOD("clear_slot", "idx"), &GraphNode::clear_slot); - ClassDB::bind_method(D_METHOD("clear_all_slots", "idx"), &GraphNode::clear_all_slots); + ClassDB::bind_method(D_METHOD("clear_all_slots"), &GraphNode::clear_all_slots); ClassDB::bind_method(D_METHOD("is_slot_enabled_left", "idx"), &GraphNode::is_slot_enabled_left); ClassDB::bind_method(D_METHOD("get_slot_type_left", "idx"), &GraphNode::get_slot_type_left); ClassDB::bind_method(D_METHOD("get_slot_color_left", "idx"), &GraphNode::get_slot_color_left); @@ -719,7 +720,7 @@ GraphNode::GraphNode() { overlay = OVERLAY_DISABLED; show_close = false; connpos_dirty = true; - set_mouse_filter(MOUSE_FILTER_PASS); + set_mouse_filter(MOUSE_FILTER_STOP); comment = false; resizeable = false; resizing = false; diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h index 056b699aa6..a7d9e8ddb0 100644 --- a/scene/gui/graph_node.h +++ b/scene/gui/graph_node.h @@ -99,8 +99,6 @@ private: Overlay overlay; - bool has_point(const Point2 &p_point) const; - protected: void _gui_input(const Ref<InputEvent> &p_ev); void _notification(int p_what); @@ -111,6 +109,8 @@ protected: void _get_property_list(List<PropertyInfo> *p_list) const; public: + bool has_point(const Point2 &p_point) const; + void set_slot(int p_idx, bool p_enable_left, int p_type_left, const Color &p_color_left, bool p_enable_right, int p_type_right, const Color &p_color_right, const Ref<Texture> &p_custom_left = Ref<Texture>(), const Ref<Texture> &p_custom_right = Ref<Texture>()); void clear_slot(int p_idx); void clear_all_slots(); diff --git a/scene/gui/input_action.cpp b/scene/gui/input_action.cpp index 3f80c31c8b..c08059a049 100644 --- a/scene/gui/input_action.cpp +++ b/scene/gui/input_action.cpp @@ -116,12 +116,12 @@ bool ShortCut::is_valid() const { void ShortCut::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shortcut", "event:InputEvent"), &ShortCut::set_shortcut); - ClassDB::bind_method(D_METHOD("get_shortcut:InputEvent"), &ShortCut::get_shortcut); + ClassDB::bind_method(D_METHOD("set_shortcut", "event"), &ShortCut::set_shortcut); + ClassDB::bind_method(D_METHOD("get_shortcut"), &ShortCut::get_shortcut); ClassDB::bind_method(D_METHOD("is_valid"), &ShortCut::is_valid); - ClassDB::bind_method(D_METHOD("is_shortcut", "event:InputEvent"), &ShortCut::is_shortcut); + ClassDB::bind_method(D_METHOD("is_shortcut", "event"), &ShortCut::is_shortcut); ClassDB::bind_method(D_METHOD("get_as_text"), &ShortCut::get_as_text); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), "set_shortcut", "get_shortcut"); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 34533375b2..484051f546 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1277,14 +1277,14 @@ bool ItemList::has_auto_height() const { void ItemList::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_item", "text", "icon:Texture", "selectable"), &ItemList::add_item, DEFVAL(Variant()), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("add_icon_item", "icon:Texture", "selectable"), &ItemList::add_icon_item, DEFVAL(true)); + ClassDB::bind_method(D_METHOD("add_item", "text", "icon", "selectable"), &ItemList::add_item, DEFVAL(Variant()), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("add_icon_item", "icon", "selectable"), &ItemList::add_icon_item, DEFVAL(true)); ClassDB::bind_method(D_METHOD("set_item_text", "idx", "text"), &ItemList::set_item_text); ClassDB::bind_method(D_METHOD("get_item_text", "idx"), &ItemList::get_item_text); - ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "icon:Texture"), &ItemList::set_item_icon); - ClassDB::bind_method(D_METHOD("get_item_icon:Texture", "idx"), &ItemList::get_item_icon); + ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "icon"), &ItemList::set_item_icon); + ClassDB::bind_method(D_METHOD("get_item_icon", "idx"), &ItemList::get_item_icon); ClassDB::bind_method(D_METHOD("set_item_icon_region", "idx", "rect"), &ItemList::set_item_icon_region); ClassDB::bind_method(D_METHOD("get_item_icon_region", "idx"), &ItemList::get_item_icon_region); @@ -1296,7 +1296,7 @@ void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("is_item_disabled", "idx"), &ItemList::is_item_disabled); ClassDB::bind_method(D_METHOD("set_item_metadata", "idx", "metadata"), &ItemList::set_item_metadata); - ClassDB::bind_method(D_METHOD("get_item_metadata:Variant", "idx"), &ItemList::get_item_metadata); + ClassDB::bind_method(D_METHOD("get_item_metadata", "idx"), &ItemList::get_item_metadata); ClassDB::bind_method(D_METHOD("set_item_custom_bg_color", "idx", "custom_bg_color"), &ItemList::set_item_custom_bg_color); ClassDB::bind_method(D_METHOD("get_item_custom_bg_color", "idx"), &ItemList::get_item_custom_bg_color); @@ -1352,7 +1352,7 @@ void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("ensure_current_is_visible"), &ItemList::ensure_current_is_visible); - ClassDB::bind_method(D_METHOD("get_v_scroll:VScrollBar"), &ItemList::get_v_scroll); + ClassDB::bind_method(D_METHOD("get_v_scroll"), &ItemList::get_v_scroll); ClassDB::bind_method(D_METHOD("_scroll_changed"), &ItemList::_scroll_changed); ClassDB::bind_method(D_METHOD("_gui_input"), &ItemList::_gui_input); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index f4dd3e92cd..2e4f7d1730 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -229,8 +229,8 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { bool handled = true; switch (code) { - case KEY_ENTER: - case KEY_RETURN: { + case KEY_KP_ENTER: + case KEY_ENTER: { emit_signal("text_entered", text); if (OS::get_singleton()->has_virtual_keyboard()) @@ -1277,7 +1277,7 @@ void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("is_secret"), &LineEdit::is_secret); ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("menu_option", "option"), &LineEdit::menu_option); - ClassDB::bind_method(D_METHOD("get_menu:PopupMenu"), &LineEdit::get_menu); + ClassDB::bind_method(D_METHOD("get_menu"), &LineEdit::get_menu); ADD_SIGNAL(MethodInfo("text_changed", PropertyInfo(Variant::STRING, "text"))); ADD_SIGNAL(MethodInfo("text_entered", PropertyInfo(Variant::STRING, "text"))); diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 57aa72b7d0..93284f2b6c 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -94,7 +94,7 @@ void MenuButton::_set_items(const Array &p_items) { void MenuButton::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_popup:PopupMenu"), &MenuButton::get_popup); + ClassDB::bind_method(D_METHOD("get_popup"), &MenuButton::get_popup); ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &MenuButton::_unhandled_key_input); ClassDB::bind_method(D_METHOD("_set_items"), &MenuButton::_set_items); ClassDB::bind_method(D_METHOD("_get_items"), &MenuButton::_get_items); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index b842419eab..25ac8d5259 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -82,7 +82,7 @@ void OptionButton::_selected(int p_which) { int selid = -1; for (int i = 0; i < popup->get_item_count(); i++) { - bool is_clicked = popup->get_item_ID(i) == p_which; + bool is_clicked = popup->get_item_id(i) == p_which; if (is_clicked) { selid = i; break; @@ -129,9 +129,9 @@ void OptionButton::set_item_icon(int p_idx, const Ref<Texture> &p_icon) { popup->set_item_icon(p_idx, p_icon); } -void OptionButton::set_item_ID(int p_idx, int p_ID) { +void OptionButton::set_item_id(int p_idx, int p_ID) { - popup->set_item_ID(p_idx, p_ID); + popup->set_item_id(p_idx, p_ID); } void OptionButton::set_item_metadata(int p_idx, const Variant &p_metadata) { @@ -154,9 +154,9 @@ Ref<Texture> OptionButton::get_item_icon(int p_idx) const { return popup->get_item_icon(p_idx); } -int OptionButton::get_item_ID(int p_idx) const { +int OptionButton::get_item_id(int p_idx) const { - return popup->get_item_ID(p_idx); + return popup->get_item_id(p_idx); } Variant OptionButton::get_item_metadata(int p_idx) const { @@ -224,12 +224,12 @@ int OptionButton::get_selected() const { return current; } -int OptionButton::get_selected_ID() const { +int OptionButton::get_selected_id() const { int idx = get_selected(); if (idx < 0) return 0; - return get_item_ID(current); + return get_item_id(current); } Variant OptionButton::get_selected_metadata() const { @@ -252,7 +252,7 @@ Array OptionButton::_get_items() const { items.push_back(get_item_text(i)); items.push_back(get_item_icon(i)); items.push_back(is_item_disabled(i)); - items.push_back(get_item_ID(i)); + items.push_back(get_item_id(i)); items.push_back(get_item_metadata(i)); } @@ -289,24 +289,24 @@ void OptionButton::_bind_methods() { ClassDB::bind_method(D_METHOD("_selected"), &OptionButton::_selected); ClassDB::bind_method(D_METHOD("add_item", "label", "id"), &OptionButton::add_item, DEFVAL(-1)); - ClassDB::bind_method(D_METHOD("add_icon_item", "texture:Texture", "label", "id"), &OptionButton::add_icon_item); + ClassDB::bind_method(D_METHOD("add_icon_item", "texture", "label", "id"), &OptionButton::add_icon_item); ClassDB::bind_method(D_METHOD("set_item_text", "idx", "text"), &OptionButton::set_item_text); - ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "texture:Texture"), &OptionButton::set_item_icon); + ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "texture"), &OptionButton::set_item_icon); ClassDB::bind_method(D_METHOD("set_item_disabled", "idx", "disabled"), &OptionButton::set_item_disabled); - ClassDB::bind_method(D_METHOD("set_item_ID", "idx", "id"), &OptionButton::set_item_ID); + ClassDB::bind_method(D_METHOD("set_item_id", "idx", "id"), &OptionButton::set_item_id); ClassDB::bind_method(D_METHOD("set_item_metadata", "idx", "metadata"), &OptionButton::set_item_metadata); ClassDB::bind_method(D_METHOD("get_item_text", "idx"), &OptionButton::get_item_text); - ClassDB::bind_method(D_METHOD("get_item_icon:Texture", "idx"), &OptionButton::get_item_icon); - ClassDB::bind_method(D_METHOD("get_item_ID", "idx"), &OptionButton::get_item_ID); - ClassDB::bind_method(D_METHOD("get_item_metadata:Variant", "idx"), &OptionButton::get_item_metadata); + ClassDB::bind_method(D_METHOD("get_item_icon", "idx"), &OptionButton::get_item_icon); + ClassDB::bind_method(D_METHOD("get_item_id", "idx"), &OptionButton::get_item_id); + ClassDB::bind_method(D_METHOD("get_item_metadata", "idx"), &OptionButton::get_item_metadata); ClassDB::bind_method(D_METHOD("is_item_disabled", "idx"), &OptionButton::is_item_disabled); ClassDB::bind_method(D_METHOD("get_item_count"), &OptionButton::get_item_count); ClassDB::bind_method(D_METHOD("add_separator"), &OptionButton::add_separator); ClassDB::bind_method(D_METHOD("clear"), &OptionButton::clear); ClassDB::bind_method(D_METHOD("select", "idx"), &OptionButton::select); ClassDB::bind_method(D_METHOD("get_selected"), &OptionButton::get_selected); - ClassDB::bind_method(D_METHOD("get_selected_ID"), &OptionButton::get_selected_ID); - ClassDB::bind_method(D_METHOD("get_selected_metadata:Variant"), &OptionButton::get_selected_metadata); + ClassDB::bind_method(D_METHOD("get_selected_id"), &OptionButton::get_selected_id); + ClassDB::bind_method(D_METHOD("get_selected_metadata"), &OptionButton::get_selected_metadata); ClassDB::bind_method(D_METHOD("remove_item", "idx"), &OptionButton::remove_item); ClassDB::bind_method(D_METHOD("_select_int"), &OptionButton::_select_int); diff --git a/scene/gui/option_button.h b/scene/gui/option_button.h index 887d199c90..db921b8b97 100644 --- a/scene/gui/option_button.h +++ b/scene/gui/option_button.h @@ -62,13 +62,13 @@ public: void set_item_text(int p_idx, const String &p_text); void set_item_icon(int p_idx, const Ref<Texture> &p_icon); - void set_item_ID(int p_idx, int p_ID); + void set_item_id(int p_idx, int p_ID); void set_item_metadata(int p_idx, const Variant &p_metadata); void set_item_disabled(int p_idx, bool p_disabled); String get_item_text(int p_idx) const; Ref<Texture> get_item_icon(int p_idx) const; - int get_item_ID(int p_idx) const; + int get_item_id(int p_idx) const; Variant get_item_metadata(int p_idx) const; bool is_item_disabled(int p_idx) const; @@ -80,7 +80,7 @@ public: void select(int p_idx); int get_selected() const; - int get_selected_ID() const; + int get_selected_id() const; Variant get_selected_metadata() const; void remove_item(int p_idx); diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp index e577000f99..249090830d 100644 --- a/scene/gui/patch_9_rect.cpp +++ b/scene/gui/patch_9_rect.cpp @@ -54,8 +54,8 @@ Size2 NinePatchRect::get_minimum_size() const { } void NinePatchRect::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &NinePatchRect::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &NinePatchRect::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &NinePatchRect::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &NinePatchRect::get_texture); ClassDB::bind_method(D_METHOD("set_patch_margin", "margin", "value"), &NinePatchRect::set_patch_margin); ClassDB::bind_method(D_METHOD("get_patch_margin", "margin"), &NinePatchRect::get_patch_margin); ClassDB::bind_method(D_METHOD("set_region_rect", "rect"), &NinePatchRect::set_region_rect); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index f59a2e06eb..46aa0e5054 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -249,8 +249,8 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) { } } } break; - case KEY_RETURN: - case KEY_ENTER: { + case KEY_ENTER: + case KEY_KP_ENTER: { if (mouse_over >= 0 && mouse_over < items.size() && !items[mouse_over].separator) { @@ -647,7 +647,7 @@ void PopupMenu::set_item_checked(int p_idx, bool p_checked) { update(); } -void PopupMenu::set_item_ID(int p_idx, int p_ID) { +void PopupMenu::set_item_id(int p_idx, int p_ID) { ERR_FAIL_INDEX(p_idx, items.size()); items[p_idx].ID = p_ID; @@ -737,7 +737,7 @@ bool PopupMenu::is_item_checked(int p_idx) const { return items[p_idx].checked; } -int PopupMenu::get_item_ID(int p_idx) const { +int PopupMenu::get_item_id(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, items.size(), 0); return items[p_idx].ID; @@ -956,7 +956,7 @@ Array PopupMenu::_get_items() const { items.push_back(is_item_checked(i)); items.push_back(is_item_disabled(i)); - items.push_back(get_item_ID(i)); + items.push_back(get_item_id(i)); items.push_back(get_item_accelerator(i)); items.push_back(get_item_metadata(i)); items.push_back(get_item_submenu(i)); @@ -1011,7 +1011,7 @@ void PopupMenu::_set_items(const Array &p_items) { set_item_as_checkable(idx, checkable); set_item_checked(idx, checked); set_item_disabled(idx, disabled); - set_item_ID(idx, id); + set_item_id(idx, id); set_item_metadata(idx, meta); set_item_as_separator(idx, sep); set_item_accelerator(idx, accel); @@ -1075,21 +1075,21 @@ void PopupMenu::clear_autohide_areas() { void PopupMenu::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &PopupMenu::_gui_input); - ClassDB::bind_method(D_METHOD("add_icon_item", "texture:Texture", "label", "id", "accel"), &PopupMenu::add_icon_item, DEFVAL(-1), DEFVAL(0)); + ClassDB::bind_method(D_METHOD("add_icon_item", "texture", "label", "id", "accel"), &PopupMenu::add_icon_item, DEFVAL(-1), DEFVAL(0)); ClassDB::bind_method(D_METHOD("add_item", "label", "id", "accel"), &PopupMenu::add_item, DEFVAL(-1), DEFVAL(0)); - ClassDB::bind_method(D_METHOD("add_icon_check_item", "texture:Texture", "label", "id", "accel"), &PopupMenu::add_icon_check_item, DEFVAL(-1), DEFVAL(0)); + ClassDB::bind_method(D_METHOD("add_icon_check_item", "texture", "label", "id", "accel"), &PopupMenu::add_icon_check_item, DEFVAL(-1), DEFVAL(0)); ClassDB::bind_method(D_METHOD("add_check_item", "label", "id", "accel"), &PopupMenu::add_check_item, DEFVAL(-1), DEFVAL(0)); ClassDB::bind_method(D_METHOD("add_submenu_item", "label", "submenu", "id"), &PopupMenu::add_submenu_item, DEFVAL(-1)); - ClassDB::bind_method(D_METHOD("add_icon_shortcut", "texture:Texture", "shortcut:ShortCut", "id", "global"), &PopupMenu::add_icon_shortcut, DEFVAL(-1), DEFVAL(false)); - ClassDB::bind_method(D_METHOD("add_shortcut", "shortcut:ShortCut", "id", "global"), &PopupMenu::add_shortcut, DEFVAL(-1), DEFVAL(false)); - ClassDB::bind_method(D_METHOD("add_icon_check_shortcut", "texture:Texture", "shortcut:ShortCut", "id", "global"), &PopupMenu::add_icon_check_shortcut, DEFVAL(-1), DEFVAL(false)); - ClassDB::bind_method(D_METHOD("add_check_shortcut", "shortcut:ShortCut", "id", "global"), &PopupMenu::add_check_shortcut, DEFVAL(-1), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("add_icon_shortcut", "texture", "shortcut", "id", "global"), &PopupMenu::add_icon_shortcut, DEFVAL(-1), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("add_shortcut", "shortcut", "id", "global"), &PopupMenu::add_shortcut, DEFVAL(-1), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("add_icon_check_shortcut", "texture", "shortcut", "id", "global"), &PopupMenu::add_icon_check_shortcut, DEFVAL(-1), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("add_check_shortcut", "shortcut", "id", "global"), &PopupMenu::add_check_shortcut, DEFVAL(-1), DEFVAL(false)); ClassDB::bind_method(D_METHOD("set_item_text", "idx", "text"), &PopupMenu::set_item_text); - ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "icon:Texture"), &PopupMenu::set_item_icon); + ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "icon"), &PopupMenu::set_item_icon); ClassDB::bind_method(D_METHOD("set_item_checked", "idx", "checked"), &PopupMenu::set_item_checked); - ClassDB::bind_method(D_METHOD("set_item_ID", "idx", "id"), &PopupMenu::set_item_ID); + ClassDB::bind_method(D_METHOD("set_item_id", "idx", "id"), &PopupMenu::set_item_id); ClassDB::bind_method(D_METHOD("set_item_accelerator", "idx", "accel"), &PopupMenu::set_item_accelerator); ClassDB::bind_method(D_METHOD("set_item_metadata", "idx", "metadata"), &PopupMenu::set_item_metadata); ClassDB::bind_method(D_METHOD("set_item_disabled", "idx", "disabled"), &PopupMenu::set_item_disabled); @@ -1097,23 +1097,23 @@ void PopupMenu::_bind_methods() { ClassDB::bind_method(D_METHOD("set_item_as_separator", "idx", "enable"), &PopupMenu::set_item_as_separator); ClassDB::bind_method(D_METHOD("set_item_as_checkable", "idx", "enable"), &PopupMenu::set_item_as_checkable); ClassDB::bind_method(D_METHOD("set_item_tooltip", "idx", "tooltip"), &PopupMenu::set_item_tooltip); - ClassDB::bind_method(D_METHOD("set_item_shortcut", "idx", "shortcut:ShortCut", "global"), &PopupMenu::set_item_shortcut, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("set_item_shortcut", "idx", "shortcut", "global"), &PopupMenu::set_item_shortcut, DEFVAL(false)); ClassDB::bind_method(D_METHOD("toggle_item_checked", "idx"), &PopupMenu::toggle_item_checked); ClassDB::bind_method(D_METHOD("get_item_text", "idx"), &PopupMenu::get_item_text); - ClassDB::bind_method(D_METHOD("get_item_icon:Texture", "idx"), &PopupMenu::get_item_icon); + ClassDB::bind_method(D_METHOD("get_item_icon", "idx"), &PopupMenu::get_item_icon); ClassDB::bind_method(D_METHOD("is_item_checked", "idx"), &PopupMenu::is_item_checked); - ClassDB::bind_method(D_METHOD("get_item_ID", "idx"), &PopupMenu::get_item_ID); + ClassDB::bind_method(D_METHOD("get_item_id", "idx"), &PopupMenu::get_item_id); ClassDB::bind_method(D_METHOD("get_item_index", "id"), &PopupMenu::get_item_index); ClassDB::bind_method(D_METHOD("get_item_accelerator", "idx"), &PopupMenu::get_item_accelerator); - ClassDB::bind_method(D_METHOD("get_item_metadata:Variant", "idx"), &PopupMenu::get_item_metadata); + ClassDB::bind_method(D_METHOD("get_item_metadata", "idx"), &PopupMenu::get_item_metadata); ClassDB::bind_method(D_METHOD("is_item_disabled", "idx"), &PopupMenu::is_item_disabled); ClassDB::bind_method(D_METHOD("get_item_submenu", "idx"), &PopupMenu::get_item_submenu); ClassDB::bind_method(D_METHOD("is_item_separator", "idx"), &PopupMenu::is_item_separator); ClassDB::bind_method(D_METHOD("is_item_checkable", "idx"), &PopupMenu::is_item_checkable); ClassDB::bind_method(D_METHOD("get_item_tooltip", "idx"), &PopupMenu::get_item_tooltip); - ClassDB::bind_method(D_METHOD("get_item_shortcut:ShortCut", "idx"), &PopupMenu::get_item_shortcut); + ClassDB::bind_method(D_METHOD("get_item_shortcut", "idx"), &PopupMenu::get_item_shortcut); ClassDB::bind_method(D_METHOD("get_item_count"), &PopupMenu::get_item_count); diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index 6f1a2db363..cbfe7873e6 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -118,7 +118,7 @@ public: void set_item_text(int p_idx, const String &p_text); void set_item_icon(int p_idx, const Ref<Texture> &p_icon); void set_item_checked(int p_idx, bool p_checked); - void set_item_ID(int p_idx, int p_ID); + void set_item_id(int p_idx, int p_ID); void set_item_accelerator(int p_idx, uint32_t p_accel); void set_item_metadata(int p_idx, const Variant &p_meta); void set_item_disabled(int p_idx, bool p_disabled); @@ -135,7 +135,7 @@ public: int get_item_idx_from_text(const String &text) const; Ref<Texture> get_item_icon(int p_idx) const; bool is_item_checked(int p_idx) const; - int get_item_ID(int p_idx) const; + int get_item_id(int p_idx) const; int get_item_index(int p_ID) const; uint32_t get_item_accelerator(int p_idx) const; Variant get_item_metadata(int p_idx) const; diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 6bec365dcf..68afe8150a 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -234,7 +234,7 @@ void Range::_bind_methods() { ClassDB::bind_method(D_METHOD("set_exp_ratio", "enabled"), &Range::set_exp_ratio); ClassDB::bind_method(D_METHOD("is_ratio_exp"), &Range::is_ratio_exp); - ClassDB::bind_method(D_METHOD("share", "with:Node"), &Range::_share); + ClassDB::bind_method(D_METHOD("share", "with"), &Range::_share); ClassDB::bind_method(D_METHOD("unshare"), &Range::unshare); ADD_SIGNAL(MethodInfo("value_changed", PropertyInfo(Variant::REAL, "value"))); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 9f71fa070c..0e4004c27b 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1853,10 +1853,10 @@ void RichTextLabel::_bind_methods() { ClassDB::bind_method(D_METHOD("get_text"), &RichTextLabel::get_text); ClassDB::bind_method(D_METHOD("add_text", "text"), &RichTextLabel::add_text); ClassDB::bind_method(D_METHOD("set_text", "text"), &RichTextLabel::set_text); - ClassDB::bind_method(D_METHOD("add_image", "image:Texture"), &RichTextLabel::add_image); + ClassDB::bind_method(D_METHOD("add_image", "image"), &RichTextLabel::add_image); ClassDB::bind_method(D_METHOD("newline"), &RichTextLabel::add_newline); ClassDB::bind_method(D_METHOD("remove_line", "line"), &RichTextLabel::remove_line); - ClassDB::bind_method(D_METHOD("push_font", "font:Font"), &RichTextLabel::push_font); + ClassDB::bind_method(D_METHOD("push_font", "font"), &RichTextLabel::push_font); ClassDB::bind_method(D_METHOD("push_color", "color"), &RichTextLabel::push_color); ClassDB::bind_method(D_METHOD("push_align", "align"), &RichTextLabel::push_align); ClassDB::bind_method(D_METHOD("push_indent", "level"), &RichTextLabel::push_indent); @@ -1879,7 +1879,7 @@ void RichTextLabel::_bind_methods() { ClassDB::bind_method(D_METHOD("set_scroll_follow", "follow"), &RichTextLabel::set_scroll_follow); ClassDB::bind_method(D_METHOD("is_scroll_following"), &RichTextLabel::is_scroll_following); - ClassDB::bind_method(D_METHOD("get_v_scroll:VScrollBar"), &RichTextLabel::get_v_scroll); + ClassDB::bind_method(D_METHOD("get_v_scroll"), &RichTextLabel::get_v_scroll); ClassDB::bind_method(D_METHOD("scroll_to_line", "line"), &RichTextLabel::scroll_to_line); diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 1ba6e6e4bd..c5b9df15b9 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -253,7 +253,7 @@ void SpinBox::_bind_methods() { ClassDB::bind_method(D_METHOD("set_editable", "editable"), &SpinBox::set_editable); ClassDB::bind_method(D_METHOD("is_editable"), &SpinBox::is_editable); ClassDB::bind_method(D_METHOD("_line_edit_focus_exit"), &SpinBox::_line_edit_focus_exit); - ClassDB::bind_method(D_METHOD("get_line_edit:LineEdit"), &SpinBox::get_line_edit); + ClassDB::bind_method(D_METHOD("get_line_edit"), &SpinBox::get_line_edit); ClassDB::bind_method(D_METHOD("_line_edit_input"), &SpinBox::_line_edit_input); ClassDB::bind_method(D_METHOD("_range_click_timeout"), &SpinBox::_range_click_timeout); diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 5ebcef3e8d..4b8b180b0e 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -627,20 +627,20 @@ void TabContainer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_current_tab", "tab_idx"), &TabContainer::set_current_tab); ClassDB::bind_method(D_METHOD("get_current_tab"), &TabContainer::get_current_tab); ClassDB::bind_method(D_METHOD("get_previous_tab"), &TabContainer::get_previous_tab); - ClassDB::bind_method(D_METHOD("get_current_tab_control:Control"), &TabContainer::get_current_tab_control); - ClassDB::bind_method(D_METHOD("get_tab_control:Control", "idx"), &TabContainer::get_tab_control); + ClassDB::bind_method(D_METHOD("get_current_tab_control"), &TabContainer::get_current_tab_control); + ClassDB::bind_method(D_METHOD("get_tab_control", "idx"), &TabContainer::get_tab_control); ClassDB::bind_method(D_METHOD("set_tab_align", "align"), &TabContainer::set_tab_align); ClassDB::bind_method(D_METHOD("get_tab_align"), &TabContainer::get_tab_align); ClassDB::bind_method(D_METHOD("set_tabs_visible", "visible"), &TabContainer::set_tabs_visible); ClassDB::bind_method(D_METHOD("are_tabs_visible"), &TabContainer::are_tabs_visible); ClassDB::bind_method(D_METHOD("set_tab_title", "tab_idx", "title"), &TabContainer::set_tab_title); ClassDB::bind_method(D_METHOD("get_tab_title", "tab_idx"), &TabContainer::get_tab_title); - ClassDB::bind_method(D_METHOD("set_tab_icon", "tab_idx", "icon:Texture"), &TabContainer::set_tab_icon); - ClassDB::bind_method(D_METHOD("get_tab_icon:Texture", "tab_idx"), &TabContainer::get_tab_icon); + ClassDB::bind_method(D_METHOD("set_tab_icon", "tab_idx", "icon"), &TabContainer::set_tab_icon); + ClassDB::bind_method(D_METHOD("get_tab_icon", "tab_idx"), &TabContainer::get_tab_icon); ClassDB::bind_method(D_METHOD("set_tab_disabled", "tab_idx", "disabled"), &TabContainer::set_tab_disabled); ClassDB::bind_method(D_METHOD("get_tab_disabled", "tab_idx"), &TabContainer::get_tab_disabled); - ClassDB::bind_method(D_METHOD("set_popup", "popup:Popup"), &TabContainer::set_popup); - ClassDB::bind_method(D_METHOD("get_popup:Popup"), &TabContainer::get_popup); + ClassDB::bind_method(D_METHOD("set_popup", "popup"), &TabContainer::set_popup); + ClassDB::bind_method(D_METHOD("get_popup"), &TabContainer::get_popup); ClassDB::bind_method(D_METHOD("_child_renamed_callback"), &TabContainer::_child_renamed_callback); diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index 24eb19fbc2..155b03fddf 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -226,7 +226,6 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) { if (found != -1) { set_current_tab(found); - emit_signal("tab_changed", found); } } } @@ -419,6 +418,7 @@ int Tabs::get_tab_count() const { void Tabs::set_current_tab(int p_current) { + if (current == p_current) return; ERR_FAIL_INDEX(p_current, get_tab_count()); current = p_current; @@ -426,6 +426,8 @@ void Tabs::set_current_tab(int p_current) { _change_notify("current_tab"); _update_cache(); update(); + + emit_signal("tab_changed", p_current); } int Tabs::get_current_tab() const { @@ -788,12 +790,12 @@ void Tabs::_bind_methods() { ClassDB::bind_method(D_METHOD("get_current_tab"), &Tabs::get_current_tab); ClassDB::bind_method(D_METHOD("set_tab_title", "tab_idx", "title"), &Tabs::set_tab_title); ClassDB::bind_method(D_METHOD("get_tab_title", "tab_idx"), &Tabs::get_tab_title); - ClassDB::bind_method(D_METHOD("set_tab_icon", "tab_idx", "icon:Texture"), &Tabs::set_tab_icon); - ClassDB::bind_method(D_METHOD("get_tab_icon:Texture", "tab_idx"), &Tabs::get_tab_icon); + ClassDB::bind_method(D_METHOD("set_tab_icon", "tab_idx", "icon"), &Tabs::set_tab_icon); + ClassDB::bind_method(D_METHOD("get_tab_icon", "tab_idx"), &Tabs::get_tab_icon); ClassDB::bind_method(D_METHOD("set_tab_disabled", "tab_idx", "disabled"), &Tabs::set_tab_disabled); ClassDB::bind_method(D_METHOD("get_tab_disabled", "tab_idx"), &Tabs::get_tab_disabled); ClassDB::bind_method(D_METHOD("remove_tab", "tab_idx"), &Tabs::remove_tab); - ClassDB::bind_method(D_METHOD("add_tab", "title", "icon:Texture"), &Tabs::add_tab, DEFVAL(""), DEFVAL(Ref<Texture>())); + ClassDB::bind_method(D_METHOD("add_tab", "title", "icon"), &Tabs::add_tab, DEFVAL(""), DEFVAL(Ref<Texture>())); ClassDB::bind_method(D_METHOD("set_tab_align", "align"), &Tabs::set_tab_align); ClassDB::bind_method(D_METHOD("get_tab_align"), &Tabs::get_tab_align); ClassDB::bind_method(D_METHOD("ensure_tab_visible", "idx"), &Tabs::ensure_tab_visible); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 2fc3204f3a..1636eb1921 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1805,7 +1805,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { return; } - if (k->get_scancode() == KEY_ENTER || k->get_scancode() == KEY_RETURN || k->get_scancode() == KEY_TAB) { + if (k->get_scancode() == KEY_KP_ENTER || k->get_scancode() == KEY_ENTER || k->get_scancode() == KEY_TAB) { _confirm_completion(); accept_event(); @@ -1974,8 +1974,8 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { switch (k->get_scancode()) { - case KEY_ENTER: - case KEY_RETURN: { + case KEY_KP_ENTER: + case KEY_ENTER: { if (readonly) break; @@ -4596,7 +4596,7 @@ void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("get_selection_to_column"), &TextEdit::get_selection_to_column); ClassDB::bind_method(D_METHOD("get_selection_text"), &TextEdit::get_selection_text); ClassDB::bind_method(D_METHOD("get_word_under_cursor"), &TextEdit::get_word_under_cursor); - ClassDB::bind_method(D_METHOD("search", "flags", "from_line", "from_column", "to_line", "to_column"), &TextEdit::_search_bind); + ClassDB::bind_method(D_METHOD("search", "key", "flags", "from_line", "from_column"), &TextEdit::_search_bind); ClassDB::bind_method(D_METHOD("undo"), &TextEdit::undo); ClassDB::bind_method(D_METHOD("redo"), &TextEdit::redo); @@ -4615,7 +4615,7 @@ void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("add_color_region", "begin_key", "end_key", "color", "line_only"), &TextEdit::add_color_region, DEFVAL(false)); ClassDB::bind_method(D_METHOD("clear_colors"), &TextEdit::clear_colors); ClassDB::bind_method(D_METHOD("menu_option", "option"), &TextEdit::menu_option); - ClassDB::bind_method(D_METHOD("get_menu:PopupMenu"), &TextEdit::get_menu); + ClassDB::bind_method(D_METHOD("get_menu"), &TextEdit::get_menu); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "syntax_highlighting"), "set_syntax_coloring", "is_syntax_coloring_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_line_numbers"), "set_show_line_numbers", "is_show_line_numbers_enabled"); diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index 2912aa82fc..00849c4e5a 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -180,21 +180,21 @@ void TextureButton::_notification(int p_what) { void TextureButton::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_normal_texture", "texture:Texture"), &TextureButton::set_normal_texture); - ClassDB::bind_method(D_METHOD("set_pressed_texture", "texture:Texture"), &TextureButton::set_pressed_texture); - ClassDB::bind_method(D_METHOD("set_hover_texture", "texture:Texture"), &TextureButton::set_hover_texture); - ClassDB::bind_method(D_METHOD("set_disabled_texture", "texture:Texture"), &TextureButton::set_disabled_texture); - ClassDB::bind_method(D_METHOD("set_focused_texture", "texture:Texture"), &TextureButton::set_focused_texture); - ClassDB::bind_method(D_METHOD("set_click_mask", "mask:BitMap"), &TextureButton::set_click_mask); + ClassDB::bind_method(D_METHOD("set_normal_texture", "texture"), &TextureButton::set_normal_texture); + ClassDB::bind_method(D_METHOD("set_pressed_texture", "texture"), &TextureButton::set_pressed_texture); + ClassDB::bind_method(D_METHOD("set_hover_texture", "texture"), &TextureButton::set_hover_texture); + ClassDB::bind_method(D_METHOD("set_disabled_texture", "texture"), &TextureButton::set_disabled_texture); + ClassDB::bind_method(D_METHOD("set_focused_texture", "texture"), &TextureButton::set_focused_texture); + ClassDB::bind_method(D_METHOD("set_click_mask", "mask"), &TextureButton::set_click_mask); ClassDB::bind_method(D_METHOD("set_expand", "p_expand"), &TextureButton::set_expand); ClassDB::bind_method(D_METHOD("set_stretch_mode", "p_mode"), &TextureButton::set_stretch_mode); - ClassDB::bind_method(D_METHOD("get_normal_texture:Texture"), &TextureButton::get_normal_texture); - ClassDB::bind_method(D_METHOD("get_pressed_texture:Texture"), &TextureButton::get_pressed_texture); - ClassDB::bind_method(D_METHOD("get_hover_texture:Texture"), &TextureButton::get_hover_texture); - ClassDB::bind_method(D_METHOD("get_disabled_texture:Texture"), &TextureButton::get_disabled_texture); - ClassDB::bind_method(D_METHOD("get_focused_texture:Texture"), &TextureButton::get_focused_texture); - ClassDB::bind_method(D_METHOD("get_click_mask:BitMap"), &TextureButton::get_click_mask); + ClassDB::bind_method(D_METHOD("get_normal_texture"), &TextureButton::get_normal_texture); + ClassDB::bind_method(D_METHOD("get_pressed_texture"), &TextureButton::get_pressed_texture); + ClassDB::bind_method(D_METHOD("get_hover_texture"), &TextureButton::get_hover_texture); + ClassDB::bind_method(D_METHOD("get_disabled_texture"), &TextureButton::get_disabled_texture); + ClassDB::bind_method(D_METHOD("get_focused_texture"), &TextureButton::get_focused_texture); + ClassDB::bind_method(D_METHOD("get_click_mask"), &TextureButton::get_click_mask); ClassDB::bind_method(D_METHOD("get_expand"), &TextureButton::get_expand); ClassDB::bind_method(D_METHOD("get_stretch_mode"), &TextureButton::get_stretch_mode); diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp index 40995b19fa..081c7ddb73 100644 --- a/scene/gui/texture_progress.cpp +++ b/scene/gui/texture_progress.cpp @@ -242,14 +242,14 @@ Point2 TextureProgress::get_radial_center_offset() { void TextureProgress::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_under_texture", "tex:Texture"), &TextureProgress::set_under_texture); - ClassDB::bind_method(D_METHOD("get_under_texture:Texture"), &TextureProgress::get_under_texture); + ClassDB::bind_method(D_METHOD("set_under_texture", "tex"), &TextureProgress::set_under_texture); + ClassDB::bind_method(D_METHOD("get_under_texture"), &TextureProgress::get_under_texture); - ClassDB::bind_method(D_METHOD("set_progress_texture", "tex:Texture"), &TextureProgress::set_progress_texture); - ClassDB::bind_method(D_METHOD("get_progress_texture:Texture"), &TextureProgress::get_progress_texture); + ClassDB::bind_method(D_METHOD("set_progress_texture", "tex"), &TextureProgress::set_progress_texture); + ClassDB::bind_method(D_METHOD("get_progress_texture"), &TextureProgress::get_progress_texture); - ClassDB::bind_method(D_METHOD("set_over_texture", "tex:Texture"), &TextureProgress::set_over_texture); - ClassDB::bind_method(D_METHOD("get_over_texture:Texture"), &TextureProgress::get_over_texture); + ClassDB::bind_method(D_METHOD("set_over_texture", "tex"), &TextureProgress::set_over_texture); + ClassDB::bind_method(D_METHOD("get_over_texture"), &TextureProgress::get_over_texture); ClassDB::bind_method(D_METHOD("set_fill_mode", "mode"), &TextureProgress::set_fill_mode); ClassDB::bind_method(D_METHOD("get_fill_mode"), &TextureProgress::get_fill_mode); diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp index 9459002bc0..92a3db6a74 100644 --- a/scene/gui/texture_rect.cpp +++ b/scene/gui/texture_rect.cpp @@ -101,8 +101,8 @@ Size2 TextureRect::get_minimum_size() const { } void TextureRect::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &TextureRect::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &TextureRect::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &TextureRect::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &TextureRect::get_texture); ClassDB::bind_method(D_METHOD("set_expand", "enable"), &TextureRect::set_expand); ClassDB::bind_method(D_METHOD("has_expand"), &TextureRect::has_expand); ClassDB::bind_method(D_METHOD("set_stretch_mode", "stretch_mode"), &TextureRect::set_stretch_mode); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 0b57841be7..93757304aa 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -291,7 +291,7 @@ void TreeItem::set_custom_draw(int p_column, Object *p_object, const StringName ERR_FAIL_INDEX(p_column, cells.size()); ERR_FAIL_NULL(p_object); - cells[p_column].custom_draw_obj = p_object->get_instance_ID(); + cells[p_column].custom_draw_obj = p_object->get_instance_id(); cells[p_column].custom_draw_callback = p_callback; } @@ -680,8 +680,8 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_text", "column", "text"), &TreeItem::set_text); ClassDB::bind_method(D_METHOD("get_text", "column"), &TreeItem::get_text); - ClassDB::bind_method(D_METHOD("set_icon", "column", "texture:Texture"), &TreeItem::set_icon); - ClassDB::bind_method(D_METHOD("get_icon:Texture", "column"), &TreeItem::get_icon); + ClassDB::bind_method(D_METHOD("set_icon", "column", "texture"), &TreeItem::set_icon); + ClassDB::bind_method(D_METHOD("get_icon", "column"), &TreeItem::get_icon); ClassDB::bind_method(D_METHOD("set_icon_region", "column", "region"), &TreeItem::set_icon_region); ClassDB::bind_method(D_METHOD("get_icon_region", "column"), &TreeItem::get_icon_region); @@ -702,13 +702,13 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_collapsed", "enable"), &TreeItem::set_collapsed); ClassDB::bind_method(D_METHOD("is_collapsed"), &TreeItem::is_collapsed); - ClassDB::bind_method(D_METHOD("get_next:TreeItem"), &TreeItem::get_next); - ClassDB::bind_method(D_METHOD("get_prev:TreeItem"), &TreeItem::get_prev); - ClassDB::bind_method(D_METHOD("get_parent:TreeItem"), &TreeItem::get_parent); - ClassDB::bind_method(D_METHOD("get_children:TreeItem"), &TreeItem::get_children); + ClassDB::bind_method(D_METHOD("get_next"), &TreeItem::get_next); + ClassDB::bind_method(D_METHOD("get_prev"), &TreeItem::get_prev); + ClassDB::bind_method(D_METHOD("get_parent"), &TreeItem::get_parent); + ClassDB::bind_method(D_METHOD("get_children"), &TreeItem::get_children); - ClassDB::bind_method(D_METHOD("get_next_visible:TreeItem"), &TreeItem::get_next_visible); - ClassDB::bind_method(D_METHOD("get_prev_visible:TreeItem"), &TreeItem::get_prev_visible); + ClassDB::bind_method(D_METHOD("get_next_visible"), &TreeItem::get_next_visible); + ClassDB::bind_method(D_METHOD("get_prev_visible"), &TreeItem::get_prev_visible); ClassDB::bind_method(D_METHOD("remove_child", "child"), &TreeItem::_remove_child); @@ -732,10 +732,10 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_custom_as_button", "column", "enable"), &TreeItem::set_custom_as_button); ClassDB::bind_method(D_METHOD("is_custom_set_as_button", "column"), &TreeItem::is_custom_set_as_button); - ClassDB::bind_method(D_METHOD("add_button", "column", "button:Texture", "button_idx", "disabled", "tooltip"), &TreeItem::add_button, DEFVAL(-1), DEFVAL(false), DEFVAL("")); + ClassDB::bind_method(D_METHOD("add_button", "column", "button", "button_idx", "disabled", "tooltip"), &TreeItem::add_button, DEFVAL(-1), DEFVAL(false), DEFVAL("")); ClassDB::bind_method(D_METHOD("get_button_count", "column"), &TreeItem::get_button_count); - ClassDB::bind_method(D_METHOD("get_button:Texture", "column", "button_idx"), &TreeItem::get_button); - ClassDB::bind_method(D_METHOD("set_button", "column", "button_idx", "button:Texture"), &TreeItem::set_button); + ClassDB::bind_method(D_METHOD("get_button", "column", "button_idx"), &TreeItem::get_button); + ClassDB::bind_method(D_METHOD("set_button", "column", "button_idx", "button"), &TreeItem::set_button); ClassDB::bind_method(D_METHOD("erase_button", "column", "button_idx"), &TreeItem::erase_button); ClassDB::bind_method(D_METHOD("is_button_disabled", "column", "button_idx"), &TreeItem::is_button_disabled); @@ -1917,8 +1917,8 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool void Tree::_text_editor_modal_close() { if (Input::get_singleton()->is_key_pressed(KEY_ESCAPE) || - Input::get_singleton()->is_key_pressed(KEY_ENTER) || - Input::get_singleton()->is_key_pressed(KEY_RETURN)) { + Input::get_singleton()->is_key_pressed(KEY_KP_ENTER) || + Input::get_singleton()->is_key_pressed(KEY_ENTER)) { return; } @@ -2237,8 +2237,8 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { } break; case KEY_F2: - case KEY_RETURN: - case KEY_ENTER: { + case KEY_ENTER: + case KEY_KP_ENTER: { if (selected_item) { //bring up editor if possible @@ -3594,16 +3594,16 @@ void Tree::_bind_methods() { ClassDB::bind_method(D_METHOD("_scroll_moved"), &Tree::_scroll_moved); ClassDB::bind_method(D_METHOD("clear"), &Tree::clear); - ClassDB::bind_method(D_METHOD("create_item:TreeItem", "parent:TreeItem"), &Tree::_create_item, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("create_item", "parent"), &Tree::_create_item, DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("get_root:TreeItem"), &Tree::get_root); + ClassDB::bind_method(D_METHOD("get_root"), &Tree::get_root); ClassDB::bind_method(D_METHOD("set_column_min_width", "column", "min_width"), &Tree::set_column_min_width); ClassDB::bind_method(D_METHOD("set_column_expand", "column", "expand"), &Tree::set_column_expand); ClassDB::bind_method(D_METHOD("get_column_width", "column"), &Tree::get_column_width); ClassDB::bind_method(D_METHOD("set_hide_root", "enable"), &Tree::set_hide_root); - ClassDB::bind_method(D_METHOD("get_next_selected:TreeItem", "from:TreeItem"), &Tree::_get_next_selected); - ClassDB::bind_method(D_METHOD("get_selected:TreeItem"), &Tree::get_selected); + ClassDB::bind_method(D_METHOD("get_next_selected", "from"), &Tree::_get_next_selected); + ClassDB::bind_method(D_METHOD("get_selected"), &Tree::get_selected); ClassDB::bind_method(D_METHOD("get_selected_column"), &Tree::get_selected_column); ClassDB::bind_method(D_METHOD("get_pressed_button"), &Tree::get_pressed_button); ClassDB::bind_method(D_METHOD("set_select_mode", "mode"), &Tree::set_select_mode); @@ -3611,11 +3611,11 @@ void Tree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_columns", "amount"), &Tree::set_columns); ClassDB::bind_method(D_METHOD("get_columns"), &Tree::get_columns); - ClassDB::bind_method(D_METHOD("get_edited:TreeItem"), &Tree::get_edited); + ClassDB::bind_method(D_METHOD("get_edited"), &Tree::get_edited); ClassDB::bind_method(D_METHOD("get_edited_column"), &Tree::get_edited_column); ClassDB::bind_method(D_METHOD("get_custom_popup_rect"), &Tree::get_custom_popup_rect); - ClassDB::bind_method(D_METHOD("get_item_area_rect", "item:TreeItem", "column"), &Tree::_get_item_rect, DEFVAL(-1)); - ClassDB::bind_method(D_METHOD("get_item_at_pos:TreeItem", "pos"), &Tree::get_item_at_pos); + ClassDB::bind_method(D_METHOD("get_item_area_rect", "item", "column"), &Tree::_get_item_rect, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("get_item_at_pos", "pos"), &Tree::get_item_at_pos); ClassDB::bind_method(D_METHOD("get_column_at_pos", "pos"), &Tree::get_column_at_pos); ClassDB::bind_method(D_METHOD("ensure_cursor_is_visible"), &Tree::ensure_cursor_is_visible); diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index e1a149d801..9c018a4e7c 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -348,8 +348,8 @@ bool VideoPlayer::has_autoplay() const { void VideoPlayer::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_stream", "stream:VideoStream"), &VideoPlayer::set_stream); - ClassDB::bind_method(D_METHOD("get_stream:VideoStream"), &VideoPlayer::get_stream); + ClassDB::bind_method(D_METHOD("set_stream", "stream"), &VideoPlayer::set_stream); + ClassDB::bind_method(D_METHOD("get_stream"), &VideoPlayer::get_stream); ClassDB::bind_method(D_METHOD("play"), &VideoPlayer::play); ClassDB::bind_method(D_METHOD("stop"), &VideoPlayer::stop); @@ -381,7 +381,7 @@ void VideoPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_buffering_msec", "msec"), &VideoPlayer::set_buffering_msec); ClassDB::bind_method(D_METHOD("get_buffering_msec"), &VideoPlayer::get_buffering_msec); - ClassDB::bind_method(D_METHOD("get_video_texture:Texture"), &VideoPlayer::get_video_texture); + ClassDB::bind_method(D_METHOD("get_video_texture"), &VideoPlayer::get_video_texture); ADD_PROPERTY(PropertyInfo(Variant::INT, "audio_track", PROPERTY_HINT_RANGE, "0,128,1"), "set_audio_track", "get_audio_track"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "VideoStream"), "set_stream", "get_stream"); diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index 150aee99ba..77407fdde7 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -204,7 +204,7 @@ void CanvasLayer::set_custom_viewport(Node *p_viewport) { custom_viewport = p_viewport->cast_to<Viewport>(); if (custom_viewport) { - custom_viewport_id = custom_viewport->get_instance_ID(); + custom_viewport_id = custom_viewport->get_instance_id(); } else { custom_viewport_id = 0; } @@ -262,10 +262,10 @@ void CanvasLayer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_scale", "scale"), &CanvasLayer::set_scale); ClassDB::bind_method(D_METHOD("get_scale"), &CanvasLayer::get_scale); - ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport:Viewport"), &CanvasLayer::set_custom_viewport); - ClassDB::bind_method(D_METHOD("get_custom_viewport:Viewport"), &CanvasLayer::get_custom_viewport); + ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport"), &CanvasLayer::set_custom_viewport); + ClassDB::bind_method(D_METHOD("get_custom_viewport"), &CanvasLayer::get_custom_viewport); - ClassDB::bind_method(D_METHOD("get_world_2d:World2D"), &CanvasLayer::get_world_2d); + ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasLayer::get_world_2d); //ClassDB::bind_method(D_METHOD("get_viewport"),&CanvasLayer::get_viewport); ADD_PROPERTY(PropertyInfo(Variant::INT, "layer", PROPERTY_HINT_RANGE, "-128,128,1"), "set_layer", "get_layer"); diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp index 8668020b2c..5580ef486e 100644 --- a/scene/main/instance_placeholder.cpp +++ b/scene/main/instance_placeholder.cpp @@ -123,7 +123,7 @@ Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) { void InstancePlaceholder::_bind_methods() { ClassDB::bind_method(D_METHOD("get_stored_values", "with_order"), &InstancePlaceholder::get_stored_values, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("replace_by_instance", "custom_scene:PackedScene"), &InstancePlaceholder::replace_by_instance, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("replace_by_instance", "custom_scene"), &InstancePlaceholder::replace_by_instance, DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("get_instance_path"), &InstancePlaceholder::get_instance_path); } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index c3849f79df..0d872d906e 100755 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -77,11 +77,11 @@ void Node::_notification(int p_notification) { } if (data.input) - add_to_group("_vp_input" + itos(get_viewport()->get_instance_ID())); + add_to_group("_vp_input" + itos(get_viewport()->get_instance_id())); if (data.unhandled_input) - add_to_group("_vp_unhandled_input" + itos(get_viewport()->get_instance_ID())); + add_to_group("_vp_unhandled_input" + itos(get_viewport()->get_instance_id())); if (data.unhandled_key_input) - add_to_group("_vp_unhandled_key_input" + itos(get_viewport()->get_instance_ID())); + add_to_group("_vp_unhandled_key_input" + itos(get_viewport()->get_instance_id())); get_tree()->node_count++; @@ -90,11 +90,11 @@ void Node::_notification(int p_notification) { get_tree()->node_count--; if (data.input) - remove_from_group("_vp_input" + itos(get_viewport()->get_instance_ID())); + remove_from_group("_vp_input" + itos(get_viewport()->get_instance_id())); if (data.unhandled_input) - remove_from_group("_vp_unhandled_input" + itos(get_viewport()->get_instance_ID())); + remove_from_group("_vp_unhandled_input" + itos(get_viewport()->get_instance_id())); if (data.unhandled_key_input) - remove_from_group("_vp_unhandled_key_input" + itos(get_viewport()->get_instance_ID())); + remove_from_group("_vp_unhandled_key_input" + itos(get_viewport()->get_instance_id())); data.pause_owner = NULL; if (data.path_cache) { @@ -705,12 +705,12 @@ void Node::rpcp(int p_peer_id, bool p_unreliable, const StringName &p_method, co ERR_FAIL_COND(!is_inside_tree()); bool skip_rpc = false; + bool call_local_native = false; + bool call_local_script = false; if (p_peer_id == 0 || p_peer_id == get_tree()->get_network_unique_id() || (p_peer_id < 0 && p_peer_id != -get_tree()->get_network_unique_id())) { //check that send mode can use local call - bool call_local = false; - Map<StringName, RPCMode>::Element *E = data.rpc_methods.find(p_method); if (E) { @@ -724,29 +724,22 @@ void Node::rpcp(int p_peer_id, bool p_unreliable, const StringName &p_method, co } break; case RPC_MODE_SYNC: { //call it, sync always results in call - call_local = true; + call_local_native = true; } break; case RPC_MODE_MASTER: { - call_local = is_network_master(); - if (call_local) { + call_local_native = is_network_master(); + if (call_local_native) { skip_rpc = true; //no other master so.. } } break; case RPC_MODE_SLAVE: { - call_local = !is_network_master(); + call_local_native = !is_network_master(); } break; } } - if (call_local) { - Variant::CallError ce; - call(p_method, p_arg, p_argcount, ce); - if (ce.error != Variant::CallError::CALL_OK) { - String error = Variant::get_call_error_text(this, p_method, p_arg, p_argcount, ce); - error = "rpc() aborted in local call: - " + error; - ERR_PRINTS(error); - return; - } + if (call_local_native) { + // done below } else if (get_script_instance()) { //attempt with script ScriptInstance::RPCMode rpc_mode = get_script_instance()->get_rpc_mode(p_method); @@ -761,37 +754,47 @@ void Node::rpcp(int p_peer_id, bool p_unreliable, const StringName &p_method, co } break; case ScriptInstance::RPC_MODE_SYNC: { //call it, sync always results in call - call_local = true; + call_local_script = true; } break; case ScriptInstance::RPC_MODE_MASTER: { - call_local = is_network_master(); - if (call_local) { + call_local_script = is_network_master(); + if (call_local_script) { skip_rpc = true; //no other master so.. } } break; case ScriptInstance::RPC_MODE_SLAVE: { - call_local = !is_network_master(); + call_local_script = !is_network_master(); } break; } - - if (call_local) { - Variant::CallError ce; - ce.error = Variant::CallError::CALL_OK; - get_script_instance()->call(p_method, p_arg, p_argcount, ce); - if (ce.error != Variant::CallError::CALL_OK) { - String error = Variant::get_call_error_text(this, p_method, p_arg, p_argcount, ce); - error = "rpc() aborted in script local call: - " + error; - ERR_PRINTS(error); - return; - } - } } } - if (skip_rpc) - return; + if (!skip_rpc) { + get_tree()->_rpc(this, p_peer_id, p_unreliable, false, p_method, p_arg, p_argcount); + } + + if (call_local_native) { + Variant::CallError ce; + call(p_method, p_arg, p_argcount, ce); + if (ce.error != Variant::CallError::CALL_OK) { + String error = Variant::get_call_error_text(this, p_method, p_arg, p_argcount, ce); + error = "rpc() aborted in local call: - " + error; + ERR_PRINTS(error); + return; + } + } - get_tree()->_rpc(this, p_peer_id, p_unreliable, false, p_method, p_arg, p_argcount); + if (call_local_script) { + Variant::CallError ce; + ce.error = Variant::CallError::CALL_OK; + get_script_instance()->call(p_method, p_arg, p_argcount, ce); + if (ce.error != Variant::CallError::CALL_OK) { + String error = Variant::get_call_error_text(this, p_method, p_arg, p_argcount, ce); + error = "rpc() aborted in script local call: - " + error; + ERR_PRINTS(error); + return; + } + } } /******** RSET *********/ @@ -1115,9 +1118,9 @@ void Node::set_process_input(bool p_enable) { return; if (p_enable) - add_to_group("_vp_input" + itos(get_viewport()->get_instance_ID())); + add_to_group("_vp_input" + itos(get_viewport()->get_instance_id())); else - remove_from_group("_vp_input" + itos(get_viewport()->get_instance_ID())); + remove_from_group("_vp_input" + itos(get_viewport()->get_instance_id())); } bool Node::is_processing_input() const { @@ -1133,9 +1136,9 @@ void Node::set_process_unhandled_input(bool p_enable) { return; if (p_enable) - add_to_group("_vp_unhandled_input" + itos(get_viewport()->get_instance_ID())); + add_to_group("_vp_unhandled_input" + itos(get_viewport()->get_instance_id())); else - remove_from_group("_vp_unhandled_input" + itos(get_viewport()->get_instance_ID())); + remove_from_group("_vp_unhandled_input" + itos(get_viewport()->get_instance_id())); } bool Node::is_processing_unhandled_input() const { @@ -1151,9 +1154,9 @@ void Node::set_process_unhandled_key_input(bool p_enable) { return; if (p_enable) - add_to_group("_vp_unhandled_key_input" + itos(get_viewport()->get_instance_ID())); + add_to_group("_vp_unhandled_key_input" + itos(get_viewport()->get_instance_id())); else - remove_from_group("_vp_unhandled_key_input" + itos(get_viewport()->get_instance_ID())); + remove_from_group("_vp_unhandled_key_input" + itos(get_viewport()->get_instance_id())); } bool Node::is_processing_unhandled_key_input() const { @@ -2606,7 +2609,7 @@ static void _Node_debug_sn(Object *p_obj) { path = n->get_name(); else path = String(p->get_name()) + "/" + p->get_path_to(n); - print_line(itos(p_obj->get_instance_ID()) + "- Stray Node: " + path + " (Type: " + n->get_class() + ")"); + print_line(itos(p_obj->get_instance_id()) + "- Stray Node: " + path + " (Type: " + n->get_class() + ")"); } void Node::_print_stray_nodes() { @@ -2721,36 +2724,36 @@ void Node::_bind_methods() { GLOBAL_DEF("node/name_casing", NAME_CASING_PASCAL_CASE); ProjectSettings::get_singleton()->set_custom_property_info("node/name_casing", PropertyInfo(Variant::INT, "node/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case")); - ClassDB::bind_method(D_METHOD("_add_child_below_node", "node:Node", "child_node:Node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("_add_child_below_node", "node", "child_node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false)); ClassDB::bind_method(D_METHOD("set_name", "name"), &Node::set_name); ClassDB::bind_method(D_METHOD("get_name"), &Node::get_name); - ClassDB::bind_method(D_METHOD("add_child", "node:Node", "legible_unique_name"), &Node::add_child, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("remove_child", "node:Node"), &Node::remove_child); - //ClassDB::bind_method(D_METHOD("remove_and_delete_child","node:Node"),&Node::remove_and_delete_child); + ClassDB::bind_method(D_METHOD("add_child", "node", "legible_unique_name"), &Node::add_child, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("remove_child", "node"), &Node::remove_child); + //ClassDB::bind_method(D_METHOD("remove_and_delete_child","node"),&Node::remove_and_delete_child); ClassDB::bind_method(D_METHOD("get_child_count"), &Node::get_child_count); ClassDB::bind_method(D_METHOD("get_children"), &Node::_get_children); - ClassDB::bind_method(D_METHOD("get_child:Node", "idx"), &Node::get_child); + ClassDB::bind_method(D_METHOD("get_child", "idx"), &Node::get_child); ClassDB::bind_method(D_METHOD("has_node", "path"), &Node::has_node); - ClassDB::bind_method(D_METHOD("get_node:Node", "path"), &Node::get_node); - ClassDB::bind_method(D_METHOD("get_parent:Node"), &Node::get_parent); - ClassDB::bind_method(D_METHOD("find_node:Node", "mask", "recursive", "owned"), &Node::find_node, DEFVAL(true), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("get_node", "path"), &Node::get_node); + ClassDB::bind_method(D_METHOD("get_parent"), &Node::get_parent); + ClassDB::bind_method(D_METHOD("find_node", "mask", "recursive", "owned"), &Node::find_node, DEFVAL(true), DEFVAL(true)); ClassDB::bind_method(D_METHOD("has_node_and_resource", "path"), &Node::has_node_and_resource); ClassDB::bind_method(D_METHOD("get_node_and_resource", "path"), &Node::_get_node_and_resource); ClassDB::bind_method(D_METHOD("is_inside_tree"), &Node::is_inside_tree); - ClassDB::bind_method(D_METHOD("is_a_parent_of", "node:Node"), &Node::is_a_parent_of); - ClassDB::bind_method(D_METHOD("is_greater_than", "node:Node"), &Node::is_greater_than); + ClassDB::bind_method(D_METHOD("is_a_parent_of", "node"), &Node::is_a_parent_of); + ClassDB::bind_method(D_METHOD("is_greater_than", "node"), &Node::is_greater_than); ClassDB::bind_method(D_METHOD("get_path"), &Node::get_path); - ClassDB::bind_method(D_METHOD("get_path_to", "node:Node"), &Node::get_path_to); + ClassDB::bind_method(D_METHOD("get_path_to", "node"), &Node::get_path_to); ClassDB::bind_method(D_METHOD("add_to_group", "group", "persistent"), &Node::add_to_group, DEFVAL(false)); ClassDB::bind_method(D_METHOD("remove_from_group", "group"), &Node::remove_from_group); ClassDB::bind_method(D_METHOD("is_in_group", "group"), &Node::is_in_group); - ClassDB::bind_method(D_METHOD("move_child", "child_node:Node", "to_pos"), &Node::move_child); + ClassDB::bind_method(D_METHOD("move_child", "child_node", "to_pos"), &Node::move_child); ClassDB::bind_method(D_METHOD("get_groups"), &Node::_get_groups); ClassDB::bind_method(D_METHOD("raise"), &Node::raise); - ClassDB::bind_method(D_METHOD("set_owner", "owner:Node"), &Node::set_owner); - ClassDB::bind_method(D_METHOD("get_owner:Node"), &Node::get_owner); + ClassDB::bind_method(D_METHOD("set_owner", "owner"), &Node::set_owner); + ClassDB::bind_method(D_METHOD("get_owner"), &Node::get_owner); ClassDB::bind_method(D_METHOD("remove_and_skip"), &Node::remove_and_skip); ClassDB::bind_method(D_METHOD("get_index"), &Node::get_index); ClassDB::bind_method(D_METHOD("print_tree"), &Node::print_tree); @@ -2783,15 +2786,15 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("set_fixed_process_internal", "enable"), &Node::set_fixed_process_internal); ClassDB::bind_method(D_METHOD("is_fixed_processing_internal"), &Node::is_fixed_processing_internal); - ClassDB::bind_method(D_METHOD("get_tree:SceneTree"), &Node::get_tree); + ClassDB::bind_method(D_METHOD("get_tree"), &Node::get_tree); - ClassDB::bind_method(D_METHOD("duplicate:Node", "flags"), &Node::duplicate, DEFVAL(DUPLICATE_USE_INSTANCING | DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS)); - ClassDB::bind_method(D_METHOD("replace_by", "node:Node", "keep_data"), &Node::replace_by, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("duplicate", "flags"), &Node::duplicate, DEFVAL(DUPLICATE_USE_INSTANCING | DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS)); + ClassDB::bind_method(D_METHOD("replace_by", "node", "keep_data"), &Node::replace_by, DEFVAL(false)); ClassDB::bind_method(D_METHOD("set_scene_instance_load_placeholder", "load_placeholder"), &Node::set_scene_instance_load_placeholder); ClassDB::bind_method(D_METHOD("get_scene_instance_load_placeholder"), &Node::get_scene_instance_load_placeholder); - ClassDB::bind_method(D_METHOD("get_viewport:Viewport"), &Node::get_viewport); + ClassDB::bind_method(D_METHOD("get_viewport"), &Node::get_viewport); ClassDB::bind_method(D_METHOD("queue_free"), &Node::queue_delete); @@ -2830,10 +2833,10 @@ void Node::_bind_methods() { ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "rpc_unreliable_id", &Node::_rpc_unreliable_id_bind, mi); } - ClassDB::bind_method(D_METHOD("rset", "property", "value:Variant"), &Node::rset); - ClassDB::bind_method(D_METHOD("rset_id", "peer_id", "property", "value:Variant"), &Node::rset_id); - ClassDB::bind_method(D_METHOD("rset_unreliable", "property", "value:Variant"), &Node::rset_unreliable); - ClassDB::bind_method(D_METHOD("rset_unreliable_id", "peer_id", "property", "value:Variant"), &Node::rset_unreliable_id); + ClassDB::bind_method(D_METHOD("rset", "property", "value"), &Node::rset); + ClassDB::bind_method(D_METHOD("rset_id", "peer_id", "property", "value"), &Node::rset_id); + ClassDB::bind_method(D_METHOD("rset_unreliable", "property", "value"), &Node::rset_unreliable); + ClassDB::bind_method(D_METHOD("rset_unreliable_id", "peer_id", "property", "value"), &Node::rset_unreliable_id); BIND_CONSTANT(NOTIFICATION_ENTER_TREE); BIND_CONSTANT(NOTIFICATION_EXIT_TREE); diff --git a/scene/main/node.h b/scene/main/node.h index 1794cce9f6..0447deccc1 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -33,7 +33,7 @@ #include "class_db.h" #include "map.h" #include "object.h" -#include "path_db.h" +#include "node_path.h" #include "project_settings.h" #include "scene/main/scene_tree.h" #include "script_language.h" diff --git a/scene/main/resource_preloader.cpp b/scene/main/resource_preloader.cpp index febb95a181..ae323ba021 100644 --- a/scene/main/resource_preloader.cpp +++ b/scene/main/resource_preloader.cpp @@ -153,11 +153,11 @@ void ResourcePreloader::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_resources"), &ResourcePreloader::_set_resources); ClassDB::bind_method(D_METHOD("_get_resources"), &ResourcePreloader::_get_resources); - ClassDB::bind_method(D_METHOD("add_resource", "name", "resource:Resource"), &ResourcePreloader::add_resource); + ClassDB::bind_method(D_METHOD("add_resource", "name", "resource"), &ResourcePreloader::add_resource); ClassDB::bind_method(D_METHOD("remove_resource", "name"), &ResourcePreloader::remove_resource); ClassDB::bind_method(D_METHOD("rename_resource", "name", "newname"), &ResourcePreloader::rename_resource); ClassDB::bind_method(D_METHOD("has_resource", "name"), &ResourcePreloader::has_resource); - ClassDB::bind_method(D_METHOD("get_resource:Resource", "name"), &ResourcePreloader::get_resource); + ClassDB::bind_method(D_METHOD("get_resource", "name"), &ResourcePreloader::get_resource); ClassDB::bind_method(D_METHOD("get_resource_list"), &ResourcePreloader::_get_resource_list); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "resources", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_resources", "_get_resources"); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 48e6a44745..af7dac7ec9 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -540,6 +540,7 @@ bool SceneTree::iteration(float p_time) { _notify_group_pause("fixed_process_internal", Node::NOTIFICATION_INTERNAL_FIXED_PROCESS); _notify_group_pause("fixed_process", Node::NOTIFICATION_FIXED_PROCESS); _flush_ugc(); + MessageQueue::get_singleton()->flush(); //small little hack _flush_transform_notifications(); call_group_flags(GROUP_CALL_REALTIME, "_viewports", "update_worlds"); root_lock--; @@ -566,6 +567,8 @@ bool SceneTree::idle(float p_time) { emit_signal("idle_frame"); + MessageQueue::get_singleton()->flush(); //small little hack + _flush_transform_notifications(); _notify_group_pause("idle_process_internal", Node::NOTIFICATION_INTERNAL_PROCESS); @@ -581,6 +584,7 @@ bool SceneTree::idle(float p_time) { } _flush_ugc(); + MessageQueue::get_singleton()->flush(); //small little hack _flush_transform_notifications(); //transforms after world update, to avoid unnecessary enter/exit notifications call_group_flags(GROUP_CALL_REALTIME, "_viewports", "update_worlds"); @@ -1106,7 +1110,7 @@ static void _fill_array(Node *p_node, Array &array, int p_level) { array.push_back(p_level); array.push_back(p_node->get_name()); array.push_back(p_node->get_class()); - array.push_back(p_node->get_instance_ID()); + array.push_back(p_node->get_instance_id()); for (int i = 0; i < p_node->get_child_count(); i++) { _fill_array(p_node->get_child(i), array, p_level + 1); @@ -1141,7 +1145,7 @@ void SceneTree::queue_delete(Object *p_object) { _THREAD_SAFE_METHOD_ ERR_FAIL_NULL(p_object); p_object->_is_queued_for_deletion = true; - delete_queue.push_back(p_object->get_instance_ID()); + delete_queue.push_back(p_object->get_instance_id()); } int SceneTree::get_node_count() const { @@ -2180,7 +2184,7 @@ void SceneTree::_bind_methods() { //ClassDB::bind_method(D_METHOD("call_group","call_flags","group","method","arg1","arg2"),&SceneMainLoop::_call_group,DEFVAL(Variant()),DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("get_root:Viewport"), &SceneTree::get_root); + ClassDB::bind_method(D_METHOD("get_root"), &SceneTree::get_root); ClassDB::bind_method(D_METHOD("has_group", "name"), &SceneTree::has_group); ClassDB::bind_method(D_METHOD("set_auto_accept_quit", "enabled"), &SceneTree::set_auto_accept_quit); @@ -2193,8 +2197,8 @@ void SceneTree::_bind_methods() { ClassDB::bind_method(D_METHOD("is_debugging_navigation_hint"), &SceneTree::is_debugging_navigation_hint); #ifdef TOOLS_ENABLED - ClassDB::bind_method(D_METHOD("set_edited_scene_root", "scene:Node"), &SceneTree::set_edited_scene_root); - ClassDB::bind_method(D_METHOD("get_edited_scene_root:Node"), &SceneTree::get_edited_scene_root); + ClassDB::bind_method(D_METHOD("set_edited_scene_root", "scene"), &SceneTree::set_edited_scene_root); + ClassDB::bind_method(D_METHOD("get_edited_scene_root"), &SceneTree::get_edited_scene_root); #endif ClassDB::bind_method(D_METHOD("set_pause", "enable"), &SceneTree::set_pause); @@ -2202,7 +2206,7 @@ void SceneTree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_input_as_handled"), &SceneTree::set_input_as_handled); ClassDB::bind_method(D_METHOD("is_input_handled"), &SceneTree::is_input_handled); - ClassDB::bind_method(D_METHOD("create_timer:SceneTreeTimer", "time_sec", "pause_mode_process"), &SceneTree::create_timer, DEFVAL(true)); + ClassDB::bind_method(D_METHOD("create_timer", "time_sec", "pause_mode_process"), &SceneTree::create_timer, DEFVAL(true)); ClassDB::bind_method(D_METHOD("get_node_count"), &SceneTree::get_node_count); ClassDB::bind_method(D_METHOD("get_frame"), &SceneTree::get_frame); @@ -2230,22 +2234,22 @@ void SceneTree::_bind_methods() { ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "call_group", &SceneTree::_call_group, mi2); - ClassDB::bind_method(D_METHOD("notify_group", "call_flags", "group", "notification"), &SceneTree::notify_group); - ClassDB::bind_method(D_METHOD("set_group", "call_flags", "group", "property", "value"), &SceneTree::set_group); + ClassDB::bind_method(D_METHOD("notify_group", "group", "notification"), &SceneTree::notify_group); + ClassDB::bind_method(D_METHOD("set_group", "group", "property", "value"), &SceneTree::set_group); ClassDB::bind_method(D_METHOD("get_nodes_in_group", "group"), &SceneTree::_get_nodes_in_group); - ClassDB::bind_method(D_METHOD("set_current_scene", "child_node:Node"), &SceneTree::set_current_scene); - ClassDB::bind_method(D_METHOD("get_current_scene:Node"), &SceneTree::get_current_scene); + ClassDB::bind_method(D_METHOD("set_current_scene", "child_node"), &SceneTree::set_current_scene); + ClassDB::bind_method(D_METHOD("get_current_scene"), &SceneTree::get_current_scene); ClassDB::bind_method(D_METHOD("change_scene", "path"), &SceneTree::change_scene); - ClassDB::bind_method(D_METHOD("change_scene_to", "packed_scene:PackedScene"), &SceneTree::change_scene_to); + ClassDB::bind_method(D_METHOD("change_scene_to", "packed_scene"), &SceneTree::change_scene_to); ClassDB::bind_method(D_METHOD("reload_current_scene"), &SceneTree::reload_current_scene); ClassDB::bind_method(D_METHOD("_change_scene"), &SceneTree::_change_scene); - ClassDB::bind_method(D_METHOD("set_network_peer", "peer:NetworkedMultiplayerPeer"), &SceneTree::set_network_peer); + ClassDB::bind_method(D_METHOD("set_network_peer", "peer"), &SceneTree::set_network_peer); ClassDB::bind_method(D_METHOD("is_network_server"), &SceneTree::is_network_server); ClassDB::bind_method(D_METHOD("has_network_peer"), &SceneTree::has_network_peer); ClassDB::bind_method(D_METHOD("get_network_connected_peers"), &SceneTree::get_network_connected_peers); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 76b281ebac..717e76c5fd 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2028,6 +2028,89 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { } } + Ref<InputEventScreenTouch> touch_event = p_event; + if (touch_event.is_valid()) { + + Size2 pos = touch_event->get_position(); + if (touch_event->is_pressed()) { + + Control *over = _gui_find_control(pos); + if (over) { + + if (!gui.modal_stack.empty()) { + + Control *top = gui.modal_stack.back()->get(); + if (over != top && !top->is_a_parent_of(over)) { + + return; + } + } + if (over->can_process()) { + + touch_event = touch_event->xformed_by(Transform2D()); //make a copy + if (over == gui.mouse_focus) { + pos = gui.focus_inv_xform.xform(pos); + } else { + pos = over->get_global_transform_with_canvas().affine_inverse().xform(pos); + } + touch_event->set_position(pos); + _gui_call_input(over, touch_event); + } + get_tree()->set_input_as_handled(); + return; + } + } else if (gui.mouse_focus) { + + if (gui.mouse_focus->can_process()) { + + touch_event = touch_event->xformed_by(Transform2D()); //make a copy + touch_event->set_position(gui.focus_inv_xform.xform(pos)); + + _gui_call_input(gui.mouse_focus, touch_event); + } + get_tree()->set_input_as_handled(); + return; + } + } + + Ref<InputEventScreenDrag> drag_event = p_event; + if (drag_event.is_valid()) { + + Control *over = gui.mouse_focus; + if (!over) { + over = _gui_find_control(drag_event->get_position()); + } + if (over) { + + if (!gui.modal_stack.empty()) { + + Control *top = gui.modal_stack.back()->get(); + if (over != top && !top->is_a_parent_of(over)) { + + return; + } + } + if (over->can_process()) { + + Transform2D localizer = over->get_global_transform_with_canvas().affine_inverse(); + Size2 pos = localizer.xform(drag_event->get_position()); + Vector2 speed = localizer.basis_xform(drag_event->get_speed()); + Vector2 rel = localizer.basis_xform(drag_event->get_relative()); + + drag_event = drag_event->xformed_by(Transform2D()); //make a copy + + drag_event->set_speed(speed); + drag_event->set_relative(rel); + drag_event->set_position(pos); + + _gui_call_input(over, drag_event); + } + + get_tree()->set_input_as_handled(); + return; + } + } + if (mm.is_null() && mb.is_null() && p_event->is_action_type()) { if (gui.key_focus && !gui.key_focus->is_visible_in_tree()) { @@ -2303,7 +2386,7 @@ List<Control *>::Element *Viewport::_gui_show_modal(Control *p_control) { gui.modal_stack.push_back(p_control); if (gui.key_focus) - p_control->_modal_set_prev_focus_owner(gui.key_focus->get_instance_ID()); + p_control->_modal_set_prev_focus_owner(gui.key_focus->get_instance_id()); else p_control->_modal_set_prev_focus_owner(0); @@ -2558,12 +2641,12 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("set_size", "size"), &Viewport::set_size); ClassDB::bind_method(D_METHOD("get_size"), &Viewport::get_size); - ClassDB::bind_method(D_METHOD("set_world_2d", "world_2d:World2D"), &Viewport::set_world_2d); - ClassDB::bind_method(D_METHOD("get_world_2d:World2D"), &Viewport::get_world_2d); - ClassDB::bind_method(D_METHOD("find_world_2d:World2D"), &Viewport::find_world_2d); - ClassDB::bind_method(D_METHOD("set_world", "world:World"), &Viewport::set_world); - ClassDB::bind_method(D_METHOD("get_world:World"), &Viewport::get_world); - ClassDB::bind_method(D_METHOD("find_world:World"), &Viewport::find_world); + ClassDB::bind_method(D_METHOD("set_world_2d", "world_2d"), &Viewport::set_world_2d); + ClassDB::bind_method(D_METHOD("get_world_2d"), &Viewport::get_world_2d); + ClassDB::bind_method(D_METHOD("find_world_2d"), &Viewport::find_world_2d); + ClassDB::bind_method(D_METHOD("set_world", "world"), &Viewport::set_world); + ClassDB::bind_method(D_METHOD("get_world"), &Viewport::get_world); + ClassDB::bind_method(D_METHOD("find_world"), &Viewport::find_world); ClassDB::bind_method(D_METHOD("set_canvas_transform", "xform"), &Viewport::set_canvas_transform); ClassDB::bind_method(D_METHOD("get_canvas_transform"), &Viewport::get_canvas_transform); @@ -2613,34 +2696,34 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("get_render_info", "info"), &Viewport::get_render_info); - ClassDB::bind_method(D_METHOD("get_texture:ViewportTexture"), &Viewport::get_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Viewport::get_texture); ClassDB::bind_method(D_METHOD("set_physics_object_picking", "enable"), &Viewport::set_physics_object_picking); ClassDB::bind_method(D_METHOD("get_physics_object_picking"), &Viewport::get_physics_object_picking); ClassDB::bind_method(D_METHOD("get_viewport_rid"), &Viewport::get_viewport_rid); - ClassDB::bind_method(D_METHOD("input", "local_event:InputEvent"), &Viewport::input); - ClassDB::bind_method(D_METHOD("unhandled_input", "local_event:InputEvent"), &Viewport::unhandled_input); + ClassDB::bind_method(D_METHOD("input", "local_event"), &Viewport::input); + ClassDB::bind_method(D_METHOD("unhandled_input", "local_event"), &Viewport::unhandled_input); ClassDB::bind_method(D_METHOD("update_worlds"), &Viewport::update_worlds); ClassDB::bind_method(D_METHOD("set_use_own_world", "enable"), &Viewport::set_use_own_world); ClassDB::bind_method(D_METHOD("is_using_own_world"), &Viewport::is_using_own_world); - ClassDB::bind_method(D_METHOD("get_camera:Camera"), &Viewport::get_camera); + ClassDB::bind_method(D_METHOD("get_camera"), &Viewport::get_camera); ClassDB::bind_method(D_METHOD("set_as_audio_listener", "enable"), &Viewport::set_as_audio_listener); - ClassDB::bind_method(D_METHOD("is_audio_listener", "enable"), &Viewport::is_audio_listener); + ClassDB::bind_method(D_METHOD("is_audio_listener"), &Viewport::is_audio_listener); ClassDB::bind_method(D_METHOD("set_as_audio_listener_2d", "enable"), &Viewport::set_as_audio_listener_2d); - ClassDB::bind_method(D_METHOD("is_audio_listener_2d", "enable"), &Viewport::is_audio_listener_2d); + ClassDB::bind_method(D_METHOD("is_audio_listener_2d"), &Viewport::is_audio_listener_2d); ClassDB::bind_method(D_METHOD("set_attach_to_screen_rect", "rect"), &Viewport::set_attach_to_screen_rect); ClassDB::bind_method(D_METHOD("get_mouse_position"), &Viewport::get_mouse_position); ClassDB::bind_method(D_METHOD("warp_mouse", "to_pos"), &Viewport::warp_mouse); ClassDB::bind_method(D_METHOD("gui_has_modal_stack"), &Viewport::gui_has_modal_stack); - ClassDB::bind_method(D_METHOD("gui_get_drag_data:Variant"), &Viewport::gui_get_drag_data); + ClassDB::bind_method(D_METHOD("gui_get_drag_data"), &Viewport::gui_get_drag_data); ClassDB::bind_method(D_METHOD("set_disable_input", "disable"), &Viewport::set_disable_input); ClassDB::bind_method(D_METHOD("is_input_disabled"), &Viewport::is_input_disabled); @@ -2769,7 +2852,7 @@ Viewport::Viewport() { set_shadow_atlas_quadrant_subdiv(2, SHADOW_ATLAS_QUADRANT_SUBDIV_16); set_shadow_atlas_quadrant_subdiv(3, SHADOW_ATLAS_QUADRANT_SUBDIV_64); - String id = itos(get_instance_ID()); + String id = itos(get_instance_id()); input_group = "_vp_input" + id; gui_input_group = "_vp_gui_input" + id; unhandled_input_group = "_vp_unhandled_input" + id; diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index 73a759278b..a473067937 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -170,7 +170,7 @@ Dictionary BitMap::_get_data() const { void BitMap::_bind_methods() { ClassDB::bind_method(D_METHOD("create", "size"), &BitMap::create); - ClassDB::bind_method(D_METHOD("create_from_image_alpha", "image:Image"), &BitMap::create_from_image_alpha); + ClassDB::bind_method(D_METHOD("create_from_image_alpha", "image"), &BitMap::create_from_image_alpha); ClassDB::bind_method(D_METHOD("set_bit", "pos", "bit"), &BitMap::set_bit); ClassDB::bind_method(D_METHOD("get_bit", "pos"), &BitMap::get_bit); diff --git a/scene/resources/color_ramp.cpp b/scene/resources/color_ramp.cpp index 3cf8845189..1825225abd 100644 --- a/scene/resources/color_ramp.cpp +++ b/scene/resources/color_ramp.cpp @@ -52,7 +52,7 @@ Gradient::~Gradient() { void Gradient::_bind_methods() { ClassDB::bind_method(D_METHOD("add_point", "offset", "color"), &Gradient::add_point); - ClassDB::bind_method(D_METHOD("remove_point", "offset", "color"), &Gradient::remove_point); + ClassDB::bind_method(D_METHOD("remove_point", "offset"), &Gradient::remove_point); ClassDB::bind_method(D_METHOD("set_offset", "point", "offset"), &Gradient::set_offset); ClassDB::bind_method(D_METHOD("get_offset", "point"), &Gradient::get_offset); diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 2fdc4c9e24..23bf6be68c 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -861,8 +861,8 @@ void DynamicFont::_get_property_list(List<PropertyInfo> *p_list) const { void DynamicFont::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_font_data", "data:DynamicFontData"), &DynamicFont::set_font_data); - ClassDB::bind_method(D_METHOD("get_font_data:DynamicFontData"), &DynamicFont::get_font_data); + ClassDB::bind_method(D_METHOD("set_font_data", "data"), &DynamicFont::set_font_data); + ClassDB::bind_method(D_METHOD("get_font_data"), &DynamicFont::get_font_data); ClassDB::bind_method(D_METHOD("set_size", "data"), &DynamicFont::set_size); ClassDB::bind_method(D_METHOD("get_size"), &DynamicFont::get_size); @@ -874,9 +874,9 @@ void DynamicFont::_bind_methods() { ClassDB::bind_method(D_METHOD("set_spacing", "type", "value"), &DynamicFont::set_spacing); ClassDB::bind_method(D_METHOD("get_spacing", "type"), &DynamicFont::get_spacing); - ClassDB::bind_method(D_METHOD("add_fallback", "data:DynamicFontData"), &DynamicFont::add_fallback); - ClassDB::bind_method(D_METHOD("set_fallback", "idx", "data:DynamicFontData"), &DynamicFont::set_fallback); - ClassDB::bind_method(D_METHOD("get_fallback:DynamicFontData", "idx"), &DynamicFont::get_fallback); + ClassDB::bind_method(D_METHOD("add_fallback", "data"), &DynamicFont::add_fallback); + ClassDB::bind_method(D_METHOD("set_fallback", "idx", "data"), &DynamicFont::set_fallback); + ClassDB::bind_method(D_METHOD("get_fallback", "idx"), &DynamicFont::get_fallback); ClassDB::bind_method(D_METHOD("remove_fallback", "idx"), &DynamicFont::remove_fallback); ClassDB::bind_method(D_METHOD("get_fallback_count"), &DynamicFont::get_fallback_count); diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp index 397349bbf9..8efad94b9a 100644 --- a/scene/resources/dynamic_font_stb.cpp +++ b/scene/resources/dynamic_font_stb.cpp @@ -386,8 +386,8 @@ DynamicFontAtSize::~DynamicFontAtSize() { void DynamicFont::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_font_data", "data:DynamicFontData"), &DynamicFont::set_font_data); - ClassDB::bind_method(D_METHOD("get_font_data:DynamicFontData"), &DynamicFont::get_font_data); + ClassDB::bind_method(D_METHOD("set_font_data", "data"), &DynamicFont::set_font_data); + ClassDB::bind_method(D_METHOD("get_font_data"), &DynamicFont::get_font_data); ClassDB::bind_method(D_METHOD("set_size", "data"), &DynamicFont::set_size); ClassDB::bind_method(D_METHOD("get_size"), &DynamicFont::get_size); diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index accced404b..3245c3cf03 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -819,7 +819,7 @@ float Environment::get_fog_height_curve() const { void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_background", "mode"), &Environment::set_background); - ClassDB::bind_method(D_METHOD("set_sky", "sky:Sky"), &Environment::set_sky); + ClassDB::bind_method(D_METHOD("set_sky", "sky"), &Environment::set_sky); ClassDB::bind_method(D_METHOD("set_sky_scale", "scale"), &Environment::set_sky_scale); ClassDB::bind_method(D_METHOD("set_bg_color", "color"), &Environment::set_bg_color); ClassDB::bind_method(D_METHOD("set_bg_energy", "energy"), &Environment::set_bg_energy); @@ -829,7 +829,7 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_ambient_light_sky_contribution", "energy"), &Environment::set_ambient_light_sky_contribution); ClassDB::bind_method(D_METHOD("get_background"), &Environment::get_background); - ClassDB::bind_method(D_METHOD("get_sky:CubeMap"), &Environment::get_sky); + ClassDB::bind_method(D_METHOD("get_sky"), &Environment::get_sky); ClassDB::bind_method(D_METHOD("get_sky_scale"), &Environment::get_sky_scale); ClassDB::bind_method(D_METHOD("get_bg_color"), &Environment::get_bg_color); ClassDB::bind_method(D_METHOD("get_bg_energy"), &Environment::get_bg_energy); @@ -1104,8 +1104,8 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_adjustment_saturation", "saturation"), &Environment::set_adjustment_saturation); ClassDB::bind_method(D_METHOD("get_adjustment_saturation"), &Environment::get_adjustment_saturation); - ClassDB::bind_method(D_METHOD("set_adjustment_color_correction", "color_correction:Texture"), &Environment::set_adjustment_color_correction); - ClassDB::bind_method(D_METHOD("get_adjustment_color_correction:Texture"), &Environment::get_adjustment_color_correction); + ClassDB::bind_method(D_METHOD("set_adjustment_color_correction", "color_correction"), &Environment::set_adjustment_color_correction); + ClassDB::bind_method(D_METHOD("get_adjustment_color_correction"), &Environment::get_adjustment_color_correction); ADD_GROUP("Adjustments", "adjustment_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "adjustment_enabled"), "set_adjustment_enable", "is_adjustment_enabled"); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index a6a70d775f..d1431176d6 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -549,11 +549,11 @@ void BitmapFont::_bind_methods() { ClassDB::bind_method(D_METHOD("add_kerning_pair", "char_a", "char_b", "kerning"), &BitmapFont::add_kerning_pair); ClassDB::bind_method(D_METHOD("get_kerning_pair", "char_a", "char_b"), &BitmapFont::get_kerning_pair); - ClassDB::bind_method(D_METHOD("add_texture", "texture:Texture"), &BitmapFont::add_texture); + ClassDB::bind_method(D_METHOD("add_texture", "texture"), &BitmapFont::add_texture); ClassDB::bind_method(D_METHOD("add_char", "character", "texture", "rect", "align", "advance"), &BitmapFont::add_char, DEFVAL(Point2()), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("get_texture_count"), &BitmapFont::get_texture_count); - ClassDB::bind_method(D_METHOD("get_texture:Texture", "idx"), &BitmapFont::get_texture); + ClassDB::bind_method(D_METHOD("get_texture", "idx"), &BitmapFont::get_texture); ClassDB::bind_method(D_METHOD("get_char_size", "char", "next"), &BitmapFont::get_char_size, DEFVAL(0)); @@ -570,8 +570,8 @@ void BitmapFont::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_textures"), &BitmapFont::_set_textures); ClassDB::bind_method(D_METHOD("_get_textures"), &BitmapFont::_get_textures); - ClassDB::bind_method(D_METHOD("set_fallback", "fallback:BitmapFont"), &BitmapFont::set_fallback); - ClassDB::bind_method(D_METHOD("get_fallback:BitmapFont"), &BitmapFont::get_fallback); + ClassDB::bind_method(D_METHOD("set_fallback", "fallback"), &BitmapFont::set_fallback); + ClassDB::bind_method(D_METHOD("get_fallback"), &BitmapFont::get_fallback); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_textures", "_get_textures"); ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "chars", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_chars", "_get_chars"); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 5a79e49240..a88f7cc049 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -54,8 +54,8 @@ RID Material::get_rid() const { void Material::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_next_pass", "next_pass:Material"), &Material::set_next_pass); - ClassDB::bind_method(D_METHOD("get_next_pass:Material"), &Material::get_next_pass); + ClassDB::bind_method(D_METHOD("set_next_pass", "next_pass"), &Material::set_next_pass); + ClassDB::bind_method(D_METHOD("get_next_pass"), &Material::get_next_pass); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "next_pass", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_next_pass", "get_next_pass"); } @@ -160,10 +160,10 @@ Variant ShaderMaterial::get_shader_param(const StringName &p_param) const { void ShaderMaterial::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shader", "shader:Shader"), &ShaderMaterial::set_shader); - ClassDB::bind_method(D_METHOD("get_shader:Shader"), &ShaderMaterial::get_shader); + ClassDB::bind_method(D_METHOD("set_shader", "shader"), &ShaderMaterial::set_shader); + ClassDB::bind_method(D_METHOD("get_shader"), &ShaderMaterial::get_shader); ClassDB::bind_method(D_METHOD("set_shader_param", "param", "value"), &ShaderMaterial::set_shader_param); - ClassDB::bind_method(D_METHOD("get_shader_param:Variant", "param"), &ShaderMaterial::get_shader_param); + ClassDB::bind_method(D_METHOD("get_shader_param", "param"), &ShaderMaterial::get_shader_param); } void ShaderMaterial::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const { @@ -241,6 +241,7 @@ void SpatialMaterial::init_shaders() { shader_names->rim_texture_channel = "rim_texture_channel"; shader_names->depth_texture_channel = "depth_texture_channel"; shader_names->refraction_texture_channel = "refraction_texture_channel"; + shader_names->alpha_scissor_threshold = "alpha_scissor_threshold"; shader_names->texture_names[TEXTURE_ALBEDO] = "texture_albedo"; shader_names->texture_names[TEXTURE_METALLIC] = "texture_metallic"; @@ -259,8 +260,14 @@ void SpatialMaterial::init_shaders() { shader_names->texture_names[TEXTURE_DETAIL_NORMAL] = "texture_detail_normal"; } +Ref<SpatialMaterial> SpatialMaterial::materials_for_2d[SpatialMaterial::MAX_MATERIALS_FOR_2D]; + void SpatialMaterial::finish_shaders() { + for (int i = 0; i < MAX_MATERIALS_FOR_2D; i++) { + materials_for_2d[i].unref(); + } + #ifndef NO_THREADS memdelete(material_mutex); #endif @@ -359,6 +366,9 @@ void SpatialMaterial::_update_shader() { code += "uniform float grow;\n"; } + if (flags[FLAG_USE_ALPHA_SCISSOR]) { + code += "uniform float alpha_scissor_threshold;\n"; + } code += "uniform float roughness : hint_range(0,1);\n"; code += "uniform float point_size : hint_range(0,128);\n"; code += "uniform sampler2D texture_metallic : hint_white;\n"; @@ -674,7 +684,7 @@ void SpatialMaterial::_update_shader() { code += "\tALBEDO *= 1.0 - ref_amount;\n"; code += "\tALPHA = 1.0;\n"; - } else if (features[FEATURE_TRANSPARENT]) { + } else if (features[FEATURE_TRANSPARENT] || features[FLAG_USE_ALPHA_SCISSOR]) { code += "\tALPHA = albedo.a * albedo_tex.a;\n"; } @@ -774,6 +784,10 @@ void SpatialMaterial::_update_shader() { code += "\tvec3 detail_norm = mix(NORMALMAP,detail_norm_tex.rgb,detail_tex.a);\n"; code += "\tNORMALMAP = mix(NORMALMAP,detail_norm,detail_mask_tex.r);\n"; code += "\tALBEDO.rgb = mix(ALBEDO.rgb,detail,detail_mask_tex.r);\n"; + + if (flags[FLAG_USE_ALPHA_SCISSOR]) { + code += "\tALPHA_SCISSOR=alpha_scissor_threshold;\n"; + } } code += "}\n"; @@ -1086,6 +1100,9 @@ void SpatialMaterial::set_flag(Flags p_flag, bool p_enabled) { return; flags[p_flag] = p_enabled; + if (p_flag == FLAG_USE_ALPHA_SCISSOR) { + _change_notify(); + } _queue_shader_change(); } @@ -1130,9 +1147,6 @@ void SpatialMaterial::_validate_feature(const String &text, Feature feature, Pro if (property.name.begins_with(text) && property.name != text + "_enabled" && !features[feature]) { property.usage = 0; } - if ((property.name == "depth_min_layers" || property.name == "depth_max_layers") && !deep_parallax) { - property.usage = 0; - } } void SpatialMaterial::_validate_property(PropertyInfo &property) const { @@ -1154,6 +1168,14 @@ void SpatialMaterial::_validate_property(PropertyInfo &property) const { if (property.name == "params_grow_amount" && !grow_enabled) { property.usage = 0; } + + if (property.name == "params_alpha_scissor_threshold" && !flags[FLAG_USE_ALPHA_SCISSOR]) { + property.usage = 0; + } + + if ((property.name == "depth_min_layers" || property.name == "depth_max_layers") && !deep_parallax) { + property.usage = 0; + } } void SpatialMaterial::set_line_width(float p_line_width) { @@ -1329,6 +1351,16 @@ bool SpatialMaterial::is_grow_enabled() const { return grow_enabled; } +void SpatialMaterial::set_alpha_scissor_threshold(float p_treshold) { + alpha_scissor_threshold = p_treshold; + VS::get_singleton()->material_set_param(_get_material(), shader_names->alpha_scissor_threshold, p_treshold); +} + +float SpatialMaterial::get_alpha_scissor_threshold() const { + + return alpha_scissor_threshold; +} + void SpatialMaterial::set_grow(float p_grow) { grow = p_grow; VS::get_singleton()->material_set_param(_get_material(), shader_names->grow, p_grow); @@ -1391,6 +1423,40 @@ SpatialMaterial::TextureChannel SpatialMaterial::get_refraction_texture_channel( return refraction_texture_channel; } +RID SpatialMaterial::get_material_rid_for_2d(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass) { + + int version = 0; + if (p_shaded) + version = 1; + if (p_transparent) + version |= 2; + if (p_cut_alpha) + version |= 4; + if (p_opaque_prepass) + version |= 8; + if (p_double_sided) + version |= 16; + + if (materials_for_2d[version].is_valid()) { + return materials_for_2d[version]->get_rid(); + } + + Ref<SpatialMaterial> material; + material.instance(); + + material->set_flag(FLAG_UNSHADED, !p_shaded); + material->set_feature(FEATURE_TRANSPARENT, p_transparent); + material->set_cull_mode(p_double_sided ? CULL_DISABLED : CULL_BACK); + material->set_depth_draw_mode(p_opaque_prepass ? DEPTH_DRAW_ALPHA_OPAQUE_PREPASS : DEPTH_DRAW_OPAQUE_ONLY); + material->set_flag(FLAG_SRGB_VERTEX_COLOR, true); + material->set_flag(FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + material->set_flag(FLAG_USE_ALPHA_SCISSOR, p_cut_alpha); + + materials_for_2d[version] = material; + + return materials_for_2d[version]->get_rid(); +} + void SpatialMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_albedo", "albedo"), &SpatialMaterial::set_albedo); @@ -1468,8 +1534,8 @@ void SpatialMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_feature", "feature", "enable"), &SpatialMaterial::set_feature); ClassDB::bind_method(D_METHOD("get_feature", "feature"), &SpatialMaterial::get_feature); - ClassDB::bind_method(D_METHOD("set_texture", "param", "texture:Texture"), &SpatialMaterial::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture", "param"), &SpatialMaterial::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "param", "texture"), &SpatialMaterial::set_texture); + ClassDB::bind_method(D_METHOD("get_texture", "param"), &SpatialMaterial::get_texture); ClassDB::bind_method(D_METHOD("set_detail_blend_mode", "detail_blend_mode"), &SpatialMaterial::set_detail_blend_mode); ClassDB::bind_method(D_METHOD("get_detail_blend_mode"), &SpatialMaterial::get_detail_blend_mode); @@ -1516,6 +1582,9 @@ void SpatialMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_grow", "amount"), &SpatialMaterial::set_grow); ClassDB::bind_method(D_METHOD("get_grow"), &SpatialMaterial::get_grow); + ClassDB::bind_method(D_METHOD("set_alpha_scissor_threshold", "threshold"), &SpatialMaterial::set_alpha_scissor_threshold); + ClassDB::bind_method(D_METHOD("get_alpha_scissor_threshold"), &SpatialMaterial::get_alpha_scissor_threshold); + ClassDB::bind_method(D_METHOD("set_grow_enabled", "enable"), &SpatialMaterial::set_grow_enabled); ClassDB::bind_method(D_METHOD("is_grow_enabled"), &SpatialMaterial::is_grow_enabled); @@ -1553,6 +1622,8 @@ void SpatialMaterial::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "params_billboard_mode", PROPERTY_HINT_ENUM, "Disabled,Enabled,Y-Billboard,Particle Billboard"), "set_billboard_mode", "get_billboard_mode"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "params_grow"), "set_grow_enabled", "is_grow_enabled"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "params_grow_amount", PROPERTY_HINT_RANGE, "-16,10,0.01"), "set_grow", "get_grow"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "params_use_alpha_scissor"), "set_flag", "get_flag", FLAG_USE_ALPHA_SCISSOR); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "params_alpha_scissor_threshold", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_alpha_scissor_threshold", "get_alpha_scissor_threshold"); ADD_GROUP("Particles Anim", "particles_anim_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "particles_anim_h_frames", PROPERTY_HINT_RANGE, "1,128,1"), "set_particles_anim_h_frames", "get_particles_anim_h_frames"); ADD_PROPERTY(PropertyInfo(Variant::INT, "particles_anim_v_frames", PROPERTY_HINT_RANGE, "1,128,1"), "set_particles_anim_v_frames", "get_particles_anim_v_frames"); @@ -1697,9 +1768,13 @@ void SpatialMaterial::_bind_methods() { BIND_CONSTANT(FLAG_USE_VERTEX_LIGHTING); BIND_CONSTANT(FLAG_ONTOP); BIND_CONSTANT(FLAG_ALBEDO_FROM_VERTEX_COLOR); - BIND_CONSTANT(FLAG_SRGB_VERTEX_COLOR) - BIND_CONSTANT(FLAG_USE_POINT_SIZE) - BIND_CONSTANT(FLAG_FIXED_SIZE) + BIND_CONSTANT(FLAG_SRGB_VERTEX_COLOR); + BIND_CONSTANT(FLAG_USE_POINT_SIZE); + BIND_CONSTANT(FLAG_FIXED_SIZE); + BIND_CONSTANT(FLAG_UV1_USE_TRIPLANAR); + BIND_CONSTANT(FLAG_UV2_USE_TRIPLANAR); + BIND_CONSTANT(FLAG_AO_ON_UV2); + BIND_CONSTANT(FLAG_USE_ALPHA_SCISSOR); BIND_CONSTANT(FLAG_MAX); BIND_CONSTANT(DIFFUSE_LAMBERT); @@ -1757,6 +1832,7 @@ SpatialMaterial::SpatialMaterial() set_particles_anim_h_frames(1); set_particles_anim_v_frames(1); set_particles_anim_loop(false); + set_alpha_scissor_threshold(0.98); set_metallic_texture_channel(TEXTURE_CHANNEL_RED); set_roughness_texture_channel(TEXTURE_CHANNEL_RED); diff --git a/scene/resources/material.h b/scene/resources/material.h index 1484b79fc6..25628e272a 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -164,6 +164,7 @@ public: FLAG_UV1_USE_TRIPLANAR, FLAG_UV2_USE_TRIPLANAR, FLAG_AO_ON_UV2, + FLAG_USE_ALPHA_SCISSOR, FLAG_MAX }; @@ -207,7 +208,7 @@ private: uint64_t blend_mode : 2; uint64_t depth_draw_mode : 2; uint64_t cull_mode : 2; - uint64_t flags : 9; + uint64_t flags : 11; uint64_t detail_blend_mode : 2; uint64_t diffuse_mode : 3; uint64_t specular_mode : 2; @@ -298,6 +299,7 @@ private: StringName rim_texture_channel; StringName depth_texture_channel; StringName refraction_texture_channel; + StringName alpha_scissor_threshold; StringName texture_names[TEXTURE_MAX]; }; @@ -329,6 +331,7 @@ private: float refraction; float line_width; float point_size; + float alpha_scissor_threshold; bool grow_enabled; float grow; int particles_anim_h_frames; @@ -369,6 +372,12 @@ private: _FORCE_INLINE_ void _validate_feature(const String &text, Feature feature, PropertyInfo &property) const; + enum { + MAX_MATERIALS_FOR_2D = 32 + }; + + static Ref<SpatialMaterial> materials_for_2d[MAX_MATERIALS_FOR_2D]; //used by Sprite3D and other stuff + protected: static void _bind_methods(); void _validate_property(PropertyInfo &property) const; @@ -499,6 +508,9 @@ public: void set_grow(float p_grow); float get_grow() const; + void set_alpha_scissor_threshold(float p_treshold); + float get_alpha_scissor_threshold() const; + void set_metallic_texture_channel(TextureChannel p_channel); TextureChannel get_metallic_texture_channel() const; void set_roughness_texture_channel(TextureChannel p_channel); @@ -512,6 +524,8 @@ public: static void finish_shaders(); static void flush_changes(); + static RID get_material_rid_for_2d(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass); + SpatialMaterial(); virtual ~SpatialMaterial(); }; diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 310ab5e371..af30e75aed 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -1006,19 +1006,19 @@ void ArrayMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("surface_get_array_index_len", "surf_idx"), &ArrayMesh::surface_get_array_index_len); ClassDB::bind_method(D_METHOD("surface_get_format", "surf_idx"), &ArrayMesh::surface_get_format); ClassDB::bind_method(D_METHOD("surface_get_primitive_type", "surf_idx"), &ArrayMesh::surface_get_primitive_type); - ClassDB::bind_method(D_METHOD("surface_set_material", "surf_idx", "material:Material"), &ArrayMesh::surface_set_material); - ClassDB::bind_method(D_METHOD("surface_get_material:Material", "surf_idx"), &ArrayMesh::surface_get_material); + ClassDB::bind_method(D_METHOD("surface_set_material", "surf_idx", "material"), &ArrayMesh::surface_set_material); + ClassDB::bind_method(D_METHOD("surface_get_material", "surf_idx"), &ArrayMesh::surface_get_material); ClassDB::bind_method(D_METHOD("surface_set_name", "surf_idx", "name"), &ArrayMesh::surface_set_name); ClassDB::bind_method(D_METHOD("surface_get_name", "surf_idx"), &ArrayMesh::surface_get_name); - ClassDB::bind_method(D_METHOD("create_trimesh_shape:Shape"), &ArrayMesh::create_trimesh_shape); - ClassDB::bind_method(D_METHOD("create_convex_shape:Shape"), &ArrayMesh::create_convex_shape); - ClassDB::bind_method(D_METHOD("create_outline:ArrayMesh", "margin"), &ArrayMesh::create_outline); + ClassDB::bind_method(D_METHOD("create_trimesh_shape"), &ArrayMesh::create_trimesh_shape); + ClassDB::bind_method(D_METHOD("create_convex_shape"), &ArrayMesh::create_convex_shape); + ClassDB::bind_method(D_METHOD("create_outline", "margin"), &ArrayMesh::create_outline); ClassDB::bind_method(D_METHOD("center_geometry"), &ArrayMesh::center_geometry); ClassDB::set_method_flags(get_class_static(), _scs_create("center_geometry"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR); ClassDB::bind_method(D_METHOD("regen_normalmaps"), &ArrayMesh::regen_normalmaps); ClassDB::set_method_flags(get_class_static(), _scs_create("regen_normalmaps"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR); ClassDB::bind_method(D_METHOD("get_faces"), &ArrayMesh::get_faces); - ClassDB::bind_method(D_METHOD("generate_triangle_mesh:TriangleMesh"), &ArrayMesh::generate_triangle_mesh); + ClassDB::bind_method(D_METHOD("generate_triangle_mesh"), &ArrayMesh::generate_triangle_mesh); ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &ArrayMesh::set_custom_aabb); ClassDB::bind_method(D_METHOD("get_custom_aabb"), &ArrayMesh::get_custom_aabb); diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index 5dc596abff..f1092a90cb 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -520,8 +520,8 @@ void MeshDataTool::set_material(const Ref<Material> &p_material) { void MeshDataTool::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &MeshDataTool::clear); - ClassDB::bind_method(D_METHOD("create_from_surface", "mesh:ArrayMesh", "surface"), &MeshDataTool::create_from_surface); - ClassDB::bind_method(D_METHOD("commit_to_surface", "mesh:ArrayMesh"), &MeshDataTool::commit_to_surface); + ClassDB::bind_method(D_METHOD("create_from_surface", "mesh", "surface"), &MeshDataTool::create_from_surface); + ClassDB::bind_method(D_METHOD("commit_to_surface", "mesh"), &MeshDataTool::commit_to_surface); ClassDB::bind_method(D_METHOD("get_format"), &MeshDataTool::get_format); @@ -554,27 +554,27 @@ void MeshDataTool::_bind_methods() { ClassDB::bind_method(D_METHOD("get_vertex_weights", "idx"), &MeshDataTool::get_vertex_weights); ClassDB::bind_method(D_METHOD("set_vertex_meta", "idx", "meta"), &MeshDataTool::set_vertex_meta); - ClassDB::bind_method(D_METHOD("get_vertex_meta:Variant", "idx"), &MeshDataTool::get_vertex_meta); + ClassDB::bind_method(D_METHOD("get_vertex_meta", "idx"), &MeshDataTool::get_vertex_meta); ClassDB::bind_method(D_METHOD("get_vertex_edges", "idx"), &MeshDataTool::get_vertex_edges); ClassDB::bind_method(D_METHOD("get_vertex_faces", "idx"), &MeshDataTool::get_vertex_faces); ClassDB::bind_method(D_METHOD("get_edge_vertex", "idx", "vertex"), &MeshDataTool::get_edge_vertex); - ClassDB::bind_method(D_METHOD("get_edge_faces", "idx", "faces"), &MeshDataTool::get_edge_faces); + ClassDB::bind_method(D_METHOD("get_edge_faces", "idx"), &MeshDataTool::get_edge_faces); ClassDB::bind_method(D_METHOD("set_edge_meta", "idx", "meta"), &MeshDataTool::set_edge_meta); - ClassDB::bind_method(D_METHOD("get_edge_meta:Variant", "idx"), &MeshDataTool::get_edge_meta); + ClassDB::bind_method(D_METHOD("get_edge_meta", "idx"), &MeshDataTool::get_edge_meta); ClassDB::bind_method(D_METHOD("get_face_vertex", "idx", "vertex"), &MeshDataTool::get_face_vertex); ClassDB::bind_method(D_METHOD("get_face_edge", "idx", "edge"), &MeshDataTool::get_face_edge); ClassDB::bind_method(D_METHOD("set_face_meta", "idx", "meta"), &MeshDataTool::set_face_meta); - ClassDB::bind_method(D_METHOD("get_face_meta:Variant", "idx"), &MeshDataTool::get_face_meta); + ClassDB::bind_method(D_METHOD("get_face_meta", "idx"), &MeshDataTool::get_face_meta); ClassDB::bind_method(D_METHOD("get_face_normal", "idx"), &MeshDataTool::get_face_normal); - ClassDB::bind_method(D_METHOD("set_material", "material:Material"), &MeshDataTool::set_material); - ClassDB::bind_method(D_METHOD("get_material:Material", "material"), &MeshDataTool::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &MeshDataTool::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &MeshDataTool::get_material); } MeshDataTool::MeshDataTool() { diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp index 22e5659e72..7d51a2617e 100644 --- a/scene/resources/mesh_library.cpp +++ b/scene/resources/mesh_library.cpp @@ -230,13 +230,13 @@ void MeshLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("create_item", "id"), &MeshLibrary::create_item); ClassDB::bind_method(D_METHOD("set_item_name", "id", "name"), &MeshLibrary::set_item_name); - ClassDB::bind_method(D_METHOD("set_item_mesh", "id", "mesh:Mesh"), &MeshLibrary::set_item_mesh); - ClassDB::bind_method(D_METHOD("set_item_navmesh", "id", "navmesh:NavigationMesh"), &MeshLibrary::set_item_navmesh); - ClassDB::bind_method(D_METHOD("set_item_shape", "id", "shape:Shape"), &MeshLibrary::set_item_shape); + ClassDB::bind_method(D_METHOD("set_item_mesh", "id", "mesh"), &MeshLibrary::set_item_mesh); + ClassDB::bind_method(D_METHOD("set_item_navmesh", "id", "navmesh"), &MeshLibrary::set_item_navmesh); + ClassDB::bind_method(D_METHOD("set_item_shape", "id", "shape"), &MeshLibrary::set_item_shape); ClassDB::bind_method(D_METHOD("get_item_name", "id"), &MeshLibrary::get_item_name); - ClassDB::bind_method(D_METHOD("get_item_mesh:Mesh", "id"), &MeshLibrary::get_item_mesh); - ClassDB::bind_method(D_METHOD("get_item_navmesh:NavigationMesh", "id"), &MeshLibrary::get_item_navmesh); - ClassDB::bind_method(D_METHOD("get_item_shape:Shape", "id"), &MeshLibrary::get_item_shape); + ClassDB::bind_method(D_METHOD("get_item_mesh", "id"), &MeshLibrary::get_item_mesh); + ClassDB::bind_method(D_METHOD("get_item_navmesh", "id"), &MeshLibrary::get_item_navmesh); + ClassDB::bind_method(D_METHOD("get_item_shape", "id"), &MeshLibrary::get_item_shape); ClassDB::bind_method(D_METHOD("remove_item", "id"), &MeshLibrary::remove_item); ClassDB::bind_method(D_METHOD("clear"), &MeshLibrary::clear); ClassDB::bind_method(D_METHOD("get_item_list"), &MeshLibrary::get_item_list); diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index d32f221fd9..231e59cdb5 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -186,8 +186,8 @@ MultiMesh::TransformFormat MultiMesh::get_transform_format() const { void MultiMesh::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_mesh", "mesh:Mesh"), &MultiMesh::set_mesh); - ClassDB::bind_method(D_METHOD("get_mesh:Mesh"), &MultiMesh::get_mesh); + ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &MultiMesh::set_mesh); + ClassDB::bind_method(D_METHOD("get_mesh"), &MultiMesh::get_mesh); ClassDB::bind_method(D_METHOD("set_color_format", "format"), &MultiMesh::set_color_format); ClassDB::bind_method(D_METHOD("get_color_format"), &MultiMesh::get_color_format); ClassDB::bind_method(D_METHOD("set_transform_format", "format"), &MultiMesh::set_transform_format); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 6bf3590c12..ce1d6f311f 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -516,6 +516,9 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map 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 (E->get().usage & PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE) { + isdefault = true; //is script default value + } /* 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; @@ -1667,11 +1670,11 @@ void SceneState::_bind_methods() { ClassDB::bind_method(D_METHOD("get_node_owner_path", "idx"), &SceneState::get_node_owner_path); ClassDB::bind_method(D_METHOD("is_node_instance_placeholder", "idx"), &SceneState::is_node_instance_placeholder); ClassDB::bind_method(D_METHOD("get_node_instance_placeholder", "idx"), &SceneState::get_node_instance_placeholder); - ClassDB::bind_method(D_METHOD("get_node_instance:PackedScene", "idx"), &SceneState::get_node_instance); + ClassDB::bind_method(D_METHOD("get_node_instance", "idx"), &SceneState::get_node_instance); ClassDB::bind_method(D_METHOD("get_node_groups", "idx"), &SceneState::_get_node_groups); ClassDB::bind_method(D_METHOD("get_node_property_count", "idx"), &SceneState::get_node_property_count); ClassDB::bind_method(D_METHOD("get_node_property_name", "idx", "prop_idx"), &SceneState::get_node_property_name); - ClassDB::bind_method(D_METHOD("get_node_property_value:Variant", "idx", "prop_idx"), &SceneState::get_node_property_value); + ClassDB::bind_method(D_METHOD("get_node_property_value", "idx", "prop_idx"), &SceneState::get_node_property_value); ClassDB::bind_method(D_METHOD("get_connection_count"), &SceneState::get_connection_count); ClassDB::bind_method(D_METHOD("get_connection_source", "idx"), &SceneState::get_connection_source); ClassDB::bind_method(D_METHOD("get_connection_signal", "idx"), &SceneState::get_connection_signal); @@ -1774,12 +1777,12 @@ void PackedScene::set_path(const String &p_path, bool p_take_over) { void PackedScene::_bind_methods() { - ClassDB::bind_method(D_METHOD("pack", "path:Node"), &PackedScene::pack); - ClassDB::bind_method(D_METHOD("instance:Node", "edit_state"), &PackedScene::instance, DEFVAL(GEN_EDIT_STATE_DISABLED)); + ClassDB::bind_method(D_METHOD("pack", "path"), &PackedScene::pack); + ClassDB::bind_method(D_METHOD("instance", "edit_state"), &PackedScene::instance, DEFVAL(GEN_EDIT_STATE_DISABLED)); ClassDB::bind_method(D_METHOD("can_instance"), &PackedScene::can_instance); ClassDB::bind_method(D_METHOD("_set_bundled_scene"), &PackedScene::_set_bundled_scene); ClassDB::bind_method(D_METHOD("_get_bundled_scene"), &PackedScene::_get_bundled_scene); - ClassDB::bind_method(D_METHOD("get_state:SceneState"), &PackedScene::get_state); + ClassDB::bind_method(D_METHOD("get_state"), &PackedScene::get_state); ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "_bundled"), "_set_bundled_scene", "_get_bundled_scene"); diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 327de2f6f3..065e7a84dd 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -148,8 +148,8 @@ RID PrimitiveMesh::get_rid() const { void PrimitiveMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("_update"), &PrimitiveMesh::_update); - ClassDB::bind_method(D_METHOD("set_material", "material:Material"), &PrimitiveMesh::set_material); - ClassDB::bind_method(D_METHOD("get_material:Material"), &PrimitiveMesh::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &PrimitiveMesh::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &PrimitiveMesh::get_material); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_material", "get_material"); } diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index fafe68188b..b72eb9fbef 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -128,8 +128,8 @@ void Shader::_bind_methods() { ClassDB::bind_method(D_METHOD("set_code", "code"), &Shader::set_code); ClassDB::bind_method(D_METHOD("get_code"), &Shader::get_code); - ClassDB::bind_method(D_METHOD("set_default_texture_param", "param", "texture:Texture"), &Shader::set_default_texture_param); - ClassDB::bind_method(D_METHOD("get_default_texture_param:Texture", "param"), &Shader::get_default_texture_param); + ClassDB::bind_method(D_METHOD("set_default_texture_param", "param", "texture"), &Shader::set_default_texture_param); + ClassDB::bind_method(D_METHOD("get_default_texture_param", "param"), &Shader::get_default_texture_param); ClassDB::bind_method(D_METHOD("has_param", "name"), &Shader::has_param); diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 61dc9185a0..f68aed6af9 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -238,11 +238,11 @@ void ShaderGraph::_bind_methods() { ClassDB::bind_method(D_METHOD("xform_input_node_set_value","shader_type","id","value"),&ShaderGraph::xform_input_node_set_value); ClassDB::bind_method(D_METHOD("xform_input_node_get_value","shader_type","id"),&ShaderGraph::xform_input_node_get_value); - ClassDB::bind_method(D_METHOD("texture_input_node_set_value","shader_type","id","value:Texture"),&ShaderGraph::texture_input_node_set_value); - ClassDB::bind_method(D_METHOD("texture_input_node_get_value:Texture","shader_type","id"),&ShaderGraph::texture_input_node_get_value); + ClassDB::bind_method(D_METHOD("texture_input_node_set_value","shader_type","id","value"),&ShaderGraph::texture_input_node_set_value); + ClassDB::bind_method(D_METHOD("texture_input_node_get_value","shader_type","id"),&ShaderGraph::texture_input_node_get_value); - ClassDB::bind_method(D_METHOD("cubemap_input_node_set_value","shader_type","id","value:CubeMap"),&ShaderGraph::cubemap_input_node_set_value); - ClassDB::bind_method(D_METHOD("cubemap_input_node_get_value:CubeMap","shader_type","id"),&ShaderGraph::cubemap_input_node_get_value); + ClassDB::bind_method(D_METHOD("cubemap_input_node_set_value","shader_type","id","value"),&ShaderGraph::cubemap_input_node_set_value); + ClassDB::bind_method(D_METHOD("cubemap_input_node_get_value","shader_type","id"),&ShaderGraph::cubemap_input_node_get_value); ClassDB::bind_method(D_METHOD("comment_node_set_text","shader_type","id","text"),&ShaderGraph::comment_node_set_text); ClassDB::bind_method(D_METHOD("comment_node_get_text","shader_type","id"),&ShaderGraph::comment_node_get_text); @@ -254,7 +254,7 @@ void ShaderGraph::_bind_methods() { ClassDB::bind_method(D_METHOD("curve_map_node_set_points","shader_type","id","points"),&ShaderGraph::curve_map_node_set_points); ClassDB::bind_method(D_METHOD("curve_map_node_get_points","shader_type","id"),&ShaderGraph::curve_map_node_get_points); - ClassDB::bind_method(D_METHOD("connect_node:Error","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::connect_node); + ClassDB::bind_method(D_METHOD("connect_node","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::connect_node); ClassDB::bind_method(D_METHOD("is_node_connected","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::is_node_connected); ClassDB::bind_method(D_METHOD("disconnect_node","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::disconnect_node); ClassDB::bind_method(D_METHOD("get_node_connections","shader_type"),&ShaderGraph::_get_connections); @@ -262,7 +262,7 @@ void ShaderGraph::_bind_methods() { ClassDB::bind_method(D_METHOD("clear","shader_type"),&ShaderGraph::clear); ClassDB::bind_method(D_METHOD("node_set_state","shader_type","id","state"),&ShaderGraph::node_set_state); - ClassDB::bind_method(D_METHOD("node_get_state:Variant","shader_type","id"),&ShaderGraph::node_get_state); + ClassDB::bind_method(D_METHOD("node_get_state","shader_type","id"),&ShaderGraph::node_get_state); ClassDB::bind_method(D_METHOD("_set_data"),&ShaderGraph::_set_data); ClassDB::bind_method(D_METHOD("_get_data"),&ShaderGraph::_get_data); diff --git a/scene/resources/shape_2d.cpp b/scene/resources/shape_2d.cpp index f1a00336fa..818c749e8c 100644 --- a/scene/resources/shape_2d.cpp +++ b/scene/resources/shape_2d.cpp @@ -99,10 +99,10 @@ void Shape2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_custom_solver_bias", "bias"), &Shape2D::set_custom_solver_bias); ClassDB::bind_method(D_METHOD("get_custom_solver_bias"), &Shape2D::get_custom_solver_bias); - ClassDB::bind_method(D_METHOD("collide", "local_xform", "with_shape:Shape2D", "shape_xform"), &Shape2D::collide); - ClassDB::bind_method(D_METHOD("collide_with_motion", "local_xform", "local_motion", "with_shape:Shape2D", "shape_xform", "shape_motion"), &Shape2D::collide_with_motion); - ClassDB::bind_method(D_METHOD("collide_and_get_contacts:Variant", "local_xform", "with_shape:Shape2D", "shape_xform"), &Shape2D::collide_and_get_contacts); - ClassDB::bind_method(D_METHOD("collide_with_motion_and_get_contacts:Variant", "local_xform", "local_motion", "with_shape:Shape2D", "shape_xform", "shape_motion"), &Shape2D::collide_with_motion_and_get_contacts); + ClassDB::bind_method(D_METHOD("collide", "local_xform", "with_shape", "shape_xform"), &Shape2D::collide); + ClassDB::bind_method(D_METHOD("collide_with_motion", "local_xform", "local_motion", "with_shape", "shape_xform", "shape_motion"), &Shape2D::collide_with_motion); + ClassDB::bind_method(D_METHOD("collide_and_get_contacts", "local_xform", "with_shape", "shape_xform"), &Shape2D::collide_and_get_contacts); + ClassDB::bind_method(D_METHOD("collide_with_motion_and_get_contacts", "local_xform", "local_motion", "with_shape", "shape_xform", "shape_motion"), &Shape2D::collide_with_motion_and_get_contacts); ADD_PROPERTY(PropertyInfo(Variant::REAL, "custom_solver_bias", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_custom_solver_bias", "get_custom_solver_bias"); } diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp index b1ca72571e..5750960845 100644 --- a/scene/resources/sky_box.cpp +++ b/scene/resources/sky_box.cpp @@ -100,8 +100,8 @@ RID PanoramaSky::get_rid() const { void PanoramaSky::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_panorama", "texture:Texture"), &PanoramaSky::set_panorama); - ClassDB::bind_method(D_METHOD("get_panorama:Texture"), &PanoramaSky::get_panorama); + ClassDB::bind_method(D_METHOD("set_panorama", "texture"), &PanoramaSky::set_panorama); + ClassDB::bind_method(D_METHOD("get_panorama"), &PanoramaSky::get_panorama); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "panorama", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_panorama", "get_panorama"); } diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 3666c18487..bdb17c0ea5 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -224,11 +224,11 @@ Color StyleBoxTexture::get_modulate() const { void StyleBoxTexture::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &StyleBoxTexture::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &StyleBoxTexture::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &StyleBoxTexture::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &StyleBoxTexture::get_texture); - ClassDB::bind_method(D_METHOD("set_normal_map", "normal_map:Texture"), &StyleBoxTexture::set_normal_map); - ClassDB::bind_method(D_METHOD("get_normal_map:Texture"), &StyleBoxTexture::get_normal_map); + ClassDB::bind_method(D_METHOD("set_normal_map", "normal_map"), &StyleBoxTexture::set_normal_map); + ClassDB::bind_method(D_METHOD("get_normal_map"), &StyleBoxTexture::get_normal_map); ClassDB::bind_method(D_METHOD("set_margin_size", "margin", "size"), &StyleBoxTexture::set_margin_size); ClassDB::bind_method(D_METHOD("get_margin_size", "margin"), &StyleBoxTexture::get_margin_size); diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 3932917ebe..a3c683f857 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -865,13 +865,13 @@ void SurfaceTool::_bind_methods() { ClassDB::bind_method(D_METHOD("add_to_format", "flags"), &SurfaceTool::add_to_format); - ClassDB::bind_method(D_METHOD("set_material", "material:Material"), &SurfaceTool::set_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &SurfaceTool::set_material); ClassDB::bind_method(D_METHOD("clear"), &SurfaceTool::clear); - ClassDB::bind_method(D_METHOD("create_from", "existing:Mesh", "surface"), &SurfaceTool::create_from); - ClassDB::bind_method(D_METHOD("append_from", "existing:Mesh", "surface", "transform"), &SurfaceTool::append_from); - ClassDB::bind_method(D_METHOD("commit:Mesh", "existing:Mesh"), &SurfaceTool::commit, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("create_from", "existing", "surface"), &SurfaceTool::create_from); + ClassDB::bind_method(D_METHOD("append_from", "existing", "surface", "transform"), &SurfaceTool::append_from); + ClassDB::bind_method(D_METHOD("commit", "existing"), &SurfaceTool::commit, DEFVAL(Variant())); } SurfaceTool::SurfaceTool() { diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index fe7cd0097c..9a251c029d 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -70,9 +70,10 @@ void Texture::_bind_methods() { ClassDB::bind_method(D_METHOD("has_alpha"), &Texture::has_alpha); ClassDB::bind_method(D_METHOD("set_flags", "flags"), &Texture::set_flags); ClassDB::bind_method(D_METHOD("get_flags"), &Texture::get_flags); - ClassDB::bind_method(D_METHOD("draw", "canvas_item", "pos", "modulate", "transpose", "normal_map:Texture"), &Texture::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_rect", "canvas_item", "rect", "tile", "modulate", "transpose", "normal_map:Texture"), &Texture::draw_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map:Texture", "clip_uv"), &Texture::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("draw", "canvas_item", "pos", "modulate", "transpose", "normal_map"), &Texture::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_rect", "canvas_item", "rect", "tile", "modulate", "transpose", "normal_map"), &Texture::draw_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &Texture::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("get_data"), &Texture::get_data); BIND_CONSTANT(FLAG_MIPMAPS); BIND_CONSTANT(FLAG_REPEAT); @@ -194,6 +195,7 @@ void ImageTexture::create(int p_width, int p_height, Image::Format p_format, uin } void ImageTexture::create_from_image(const Ref<Image> &p_image, uint32_t p_flags) { + ERR_FAIL_COND(p_image.is_null()); flags = p_flags; w = p_image->get_width(); h = p_image->get_height(); @@ -348,11 +350,10 @@ void ImageTexture::_set_data(Dictionary p_data) { void ImageTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("create", "width", "height", "format", "flags"), &ImageTexture::create, DEFVAL(FLAGS_DEFAULT)); - ClassDB::bind_method(D_METHOD("create_from_image", "image:Image", "flags"), &ImageTexture::create_from_image, DEFVAL(FLAGS_DEFAULT)); + ClassDB::bind_method(D_METHOD("create_from_image", "image", "flags"), &ImageTexture::create_from_image, DEFVAL(FLAGS_DEFAULT)); ClassDB::bind_method(D_METHOD("get_format"), &ImageTexture::get_format); ClassDB::bind_method(D_METHOD("load", "path"), &ImageTexture::load); - ClassDB::bind_method(D_METHOD("set_data", "image:Image"), &ImageTexture::set_data); - ClassDB::bind_method(D_METHOD("get_data:Image", "cube_side"), &ImageTexture::get_data); + ClassDB::bind_method(D_METHOD("set_data", "image"), &ImageTexture::set_data); ClassDB::bind_method(D_METHOD("set_storage", "mode"), &ImageTexture::set_storage); ClassDB::bind_method(D_METHOD("get_storage"), &ImageTexture::get_storage); ClassDB::bind_method(D_METHOD("set_lossy_storage_quality", "quality"), &ImageTexture::set_lossy_storage_quality); @@ -867,8 +868,8 @@ Rect2 AtlasTexture::get_margin() const { void AtlasTexture::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_atlas", "atlas:Texture"), &AtlasTexture::set_atlas); - ClassDB::bind_method(D_METHOD("get_atlas:Texture"), &AtlasTexture::get_atlas); + ClassDB::bind_method(D_METHOD("set_atlas", "atlas"), &AtlasTexture::set_atlas); + ClassDB::bind_method(D_METHOD("get_atlas"), &AtlasTexture::get_atlas); ClassDB::bind_method(D_METHOD("set_region", "region"), &AtlasTexture::set_region); ClassDB::bind_method(D_METHOD("get_region"), &AtlasTexture::get_region); @@ -1099,15 +1100,15 @@ Ref<Texture> LargeTexture::get_piece_texture(int p_idx) const { void LargeTexture::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_piece", "ofs", "texture:Texture"), &LargeTexture::add_piece); + ClassDB::bind_method(D_METHOD("add_piece", "ofs", "texture"), &LargeTexture::add_piece); ClassDB::bind_method(D_METHOD("set_piece_offset", "idx", "ofs"), &LargeTexture::set_piece_offset); - ClassDB::bind_method(D_METHOD("set_piece_texture", "idx", "texture:Texture"), &LargeTexture::set_piece_texture); + ClassDB::bind_method(D_METHOD("set_piece_texture", "idx", "texture"), &LargeTexture::set_piece_texture); ClassDB::bind_method(D_METHOD("set_size", "size"), &LargeTexture::set_size); ClassDB::bind_method(D_METHOD("clear"), &LargeTexture::clear); ClassDB::bind_method(D_METHOD("get_piece_count"), &LargeTexture::get_piece_count); ClassDB::bind_method(D_METHOD("get_piece_offset", "idx"), &LargeTexture::get_piece_offset); - ClassDB::bind_method(D_METHOD("get_piece_texture:Texture", "idx"), &LargeTexture::get_piece_texture); + ClassDB::bind_method(D_METHOD("get_piece_texture", "idx"), &LargeTexture::get_piece_texture); ClassDB::bind_method(D_METHOD("_set_data", "data"), &LargeTexture::_set_data); ClassDB::bind_method(D_METHOD("_get_data"), &LargeTexture::_get_data); @@ -1327,8 +1328,8 @@ void CubeMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_flags", "flags"), &CubeMap::set_flags); ClassDB::bind_method(D_METHOD("get_flags"), &CubeMap::get_flags); - ClassDB::bind_method(D_METHOD("set_side", "side", "image:Image"), &CubeMap::set_side); - ClassDB::bind_method(D_METHOD("get_side:Image", "side"), &CubeMap::get_side); + ClassDB::bind_method(D_METHOD("set_side", "side", "image"), &CubeMap::set_side); + ClassDB::bind_method(D_METHOD("get_side", "side"), &CubeMap::get_side); ClassDB::bind_method(D_METHOD("set_storage", "mode"), &CubeMap::set_storage); ClassDB::bind_method(D_METHOD("get_storage"), &CubeMap::get_storage); ClassDB::bind_method(D_METHOD("set_lossy_storage_quality", "quality"), &CubeMap::set_lossy_storage_quality); @@ -1379,8 +1380,8 @@ void CurveTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("set_width", "width"), &CurveTexture::set_width); - ClassDB::bind_method(D_METHOD("set_curve", "curve:Curve"), &CurveTexture::set_curve); - ClassDB::bind_method(D_METHOD("get_curve:Curve"), &CurveTexture::get_curve); + ClassDB::bind_method(D_METHOD("set_curve", "curve"), &CurveTexture::set_curve); + ClassDB::bind_method(D_METHOD("get_curve"), &CurveTexture::get_curve); ClassDB::bind_method(D_METHOD("_update"), &CurveTexture::_update); @@ -1496,8 +1497,8 @@ GradientTexture::~GradientTexture() { void GradientTexture::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_gradient", "gradient:Gradient"), &GradientTexture::set_gradient); - ClassDB::bind_method(D_METHOD("get_gradient:Gradient"), &GradientTexture::get_gradient); + ClassDB::bind_method(D_METHOD("set_gradient", "gradient"), &GradientTexture::set_gradient); + ClassDB::bind_method(D_METHOD("get_gradient"), &GradientTexture::get_gradient); ClassDB::bind_method(D_METHOD("set_width", "width"), &GradientTexture::set_width); diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index d5c68457d0..1d5aed0444 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -629,21 +629,21 @@ void Theme::get_type_list(List<StringName> *p_list) const { void Theme::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_icon", "name", "type", "texture:Texture"), &Theme::set_icon); - ClassDB::bind_method(D_METHOD("get_icon:Texture", "name", "type"), &Theme::get_icon); + ClassDB::bind_method(D_METHOD("set_icon", "name", "type", "texture"), &Theme::set_icon); + ClassDB::bind_method(D_METHOD("get_icon", "name", "type"), &Theme::get_icon); ClassDB::bind_method(D_METHOD("has_icon", "name", "type"), &Theme::has_icon); ClassDB::bind_method(D_METHOD("clear_icon", "name", "type"), &Theme::clear_icon); ClassDB::bind_method(D_METHOD("get_icon_list", "type"), &Theme::_get_icon_list); - ClassDB::bind_method(D_METHOD("set_stylebox", "name", "type", "texture:StyleBox"), &Theme::set_stylebox); - ClassDB::bind_method(D_METHOD("get_stylebox:StyleBox", "name", "type"), &Theme::get_stylebox); + ClassDB::bind_method(D_METHOD("set_stylebox", "name", "type", "texture"), &Theme::set_stylebox); + ClassDB::bind_method(D_METHOD("get_stylebox", "name", "type"), &Theme::get_stylebox); ClassDB::bind_method(D_METHOD("has_stylebox", "name", "type"), &Theme::has_stylebox); ClassDB::bind_method(D_METHOD("clear_stylebox", "name", "type"), &Theme::clear_stylebox); ClassDB::bind_method(D_METHOD("get_stylebox_list", "type"), &Theme::_get_stylebox_list); ClassDB::bind_method(D_METHOD("get_stylebox_types"), &Theme::_get_stylebox_types); - ClassDB::bind_method(D_METHOD("set_font", "name", "type", "font:Font"), &Theme::set_font); - ClassDB::bind_method(D_METHOD("get_font:Font", "name", "type"), &Theme::get_font); + ClassDB::bind_method(D_METHOD("set_font", "name", "type", "font"), &Theme::set_font); + ClassDB::bind_method(D_METHOD("get_font", "name", "type"), &Theme::get_font); ClassDB::bind_method(D_METHOD("has_font", "name", "type"), &Theme::has_font); ClassDB::bind_method(D_METHOD("clear_font", "name", "type"), &Theme::clear_font); ClassDB::bind_method(D_METHOD("get_font_list", "type"), &Theme::_get_font_list); @@ -660,8 +660,8 @@ void Theme::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_constant", "name", "type"), &Theme::clear_constant); ClassDB::bind_method(D_METHOD("get_constant_list", "type"), &Theme::_get_constant_list); - ClassDB::bind_method(D_METHOD("set_default_font", "font:Font"), &Theme::set_default_theme_font); - ClassDB::bind_method(D_METHOD("get_default_font:Font"), &Theme::get_default_theme_font); + ClassDB::bind_method(D_METHOD("set_default_font", "font"), &Theme::set_default_theme_font); + ClassDB::bind_method(D_METHOD("get_default_font"), &Theme::get_default_theme_font); ClassDB::bind_method(D_METHOD("get_type_list", "type"), &Theme::_get_type_list); diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index dc8f6a0a69..44fe676ddc 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -517,32 +517,32 @@ void TileSet::_bind_methods() { ClassDB::bind_method(D_METHOD("create_tile", "id"), &TileSet::create_tile); ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &TileSet::tile_set_name); ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &TileSet::tile_get_name); - ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture:Texture"), &TileSet::tile_set_texture); - ClassDB::bind_method(D_METHOD("tile_get_texture:Texture", "id"), &TileSet::tile_get_texture); - ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map:Texture"), &TileSet::tile_set_normal_map); - ClassDB::bind_method(D_METHOD("tile_get_normal_map:Texture", "id"), &TileSet::tile_get_normal_map); - ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material:ShaderMaterial"), &TileSet::tile_set_material); - ClassDB::bind_method(D_METHOD("tile_get_material:ShaderMaterial", "id"), &TileSet::tile_get_material); + ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture"), &TileSet::tile_set_texture); + ClassDB::bind_method(D_METHOD("tile_get_texture", "id"), &TileSet::tile_get_texture); + ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map"), &TileSet::tile_set_normal_map); + ClassDB::bind_method(D_METHOD("tile_get_normal_map", "id"), &TileSet::tile_get_normal_map); + ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material"), &TileSet::tile_set_material); + ClassDB::bind_method(D_METHOD("tile_get_material", "id"), &TileSet::tile_get_material); ClassDB::bind_method(D_METHOD("tile_set_texture_offset", "id", "texture_offset"), &TileSet::tile_set_texture_offset); ClassDB::bind_method(D_METHOD("tile_get_texture_offset", "id"), &TileSet::tile_get_texture_offset); ClassDB::bind_method(D_METHOD("tile_set_region", "id", "region"), &TileSet::tile_set_region); ClassDB::bind_method(D_METHOD("tile_get_region", "id"), &TileSet::tile_get_region); - ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape:Shape2D"), &TileSet::tile_set_shape); - ClassDB::bind_method(D_METHOD("tile_get_shape:Shape2D", "id", "shape_id"), &TileSet::tile_get_shape); + ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape"), &TileSet::tile_set_shape); + ClassDB::bind_method(D_METHOD("tile_get_shape", "id", "shape_id"), &TileSet::tile_get_shape); ClassDB::bind_method(D_METHOD("tile_set_shape_transform", "id", "shape_id", "shape_transform"), &TileSet::tile_set_shape_transform); ClassDB::bind_method(D_METHOD("tile_get_shape_transform", "id", "shape_id"), &TileSet::tile_get_shape_transform); ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way); ClassDB::bind_method(D_METHOD("tile_get_shape_one_way", "id", "shape_id"), &TileSet::tile_get_shape_one_way); - ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape:Shape2D", "shape_transform", "one_way"), &TileSet::tile_add_shape, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape", "shape_transform", "one_way"), &TileSet::tile_add_shape, DEFVAL(false)); ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &TileSet::tile_get_shape_count); ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &TileSet::_tile_set_shapes); ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &TileSet::_tile_get_shapes); - ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon:NavigationPolygon"), &TileSet::tile_set_navigation_polygon); - ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon:NavigationPolygon", "id"), &TileSet::tile_get_navigation_polygon); + ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon"), &TileSet::tile_set_navigation_polygon); + ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon", "id"), &TileSet::tile_get_navigation_polygon); ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon_offset", "id", "navigation_polygon_offset"), &TileSet::tile_set_navigation_polygon_offset); ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon_offset", "id"), &TileSet::tile_get_navigation_polygon_offset); - ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder:OccluderPolygon2D"), &TileSet::tile_set_light_occluder); - ClassDB::bind_method(D_METHOD("tile_get_light_occluder:OccluderPolygon2D", "id"), &TileSet::tile_get_light_occluder); + ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder"), &TileSet::tile_set_light_occluder); + ClassDB::bind_method(D_METHOD("tile_get_light_occluder", "id"), &TileSet::tile_get_light_occluder); ClassDB::bind_method(D_METHOD("tile_set_occluder_offset", "id", "occluder_offset"), &TileSet::tile_set_occluder_offset); ClassDB::bind_method(D_METHOD("tile_get_occluder_offset", "id"), &TileSet::tile_get_occluder_offset); @@ -550,7 +550,7 @@ void TileSet::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &TileSet::clear); ClassDB::bind_method(D_METHOD("get_last_unused_tile_id"), &TileSet::get_last_unused_tile_id); ClassDB::bind_method(D_METHOD("find_tile_by_name", "name"), &TileSet::find_tile_by_name); - ClassDB::bind_method(D_METHOD("get_tiles_ids", "name"), &TileSet::_get_tiles_ids); + ClassDB::bind_method(D_METHOD("get_tiles_ids"), &TileSet::_get_tiles_ids); } TileSet::TileSet() { diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index b84cc9563e..b0d14125a0 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -310,11 +310,11 @@ void World::_bind_methods() { ClassDB::bind_method(D_METHOD("get_space"), &World::get_space); ClassDB::bind_method(D_METHOD("get_scenario"), &World::get_scenario); - ClassDB::bind_method(D_METHOD("set_environment", "env:Environment"), &World::set_environment); - ClassDB::bind_method(D_METHOD("get_environment:Environment"), &World::get_environment); - ClassDB::bind_method(D_METHOD("set_fallback_environment", "env:Environment"), &World::set_fallback_environment); - ClassDB::bind_method(D_METHOD("get_fallback_environment:Environment"), &World::get_fallback_environment); - ClassDB::bind_method(D_METHOD("get_direct_space_state:PhysicsDirectSpaceState"), &World::get_direct_space_state); + ClassDB::bind_method(D_METHOD("set_environment", "env"), &World::set_environment); + ClassDB::bind_method(D_METHOD("get_environment"), &World::get_environment); + ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World::set_fallback_environment); + ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World::get_fallback_environment); + ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World::get_direct_space_state); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment"); } diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 056c49f1ae..2f43f903ba 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -371,7 +371,7 @@ void World2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_canvas"), &World2D::get_canvas); ClassDB::bind_method(D_METHOD("get_space"), &World2D::get_space); - ClassDB::bind_method(D_METHOD("get_direct_space_state:Physics2DDirectSpaceState"), &World2D::get_direct_space_state); + ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World2D::get_direct_space_state); } Physics2DDirectSpaceState *World2D::get_direct_space_state() { diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index ec71333ded..f247e7cde8 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -142,9 +142,9 @@ SceneStringNames::SceneStringNames() { h_offset = StaticCString::create("h_offset"); v_offset = StaticCString::create("v_offset"); - transform_pos = StaticCString::create("transform/pos"); - transform_rot = StaticCString::create("transform/rot"); - transform_scale = StaticCString::create("transform/scale"); + transform_pos = StaticCString::create("position"); + transform_rot = StaticCString::create("rotation_deg"); + transform_scale = StaticCString::create("scale"); _update_remote = StaticCString::create("_update_remote"); _update_pairs = StaticCString::create("_update_pairs"); @@ -158,8 +158,6 @@ SceneStringNames::SceneStringNames() { line_separation = StaticCString::create("line_separation"); - play_play = StaticCString::create("play/play"); - get_drag_data = StaticCString::create("get_drag_data"); drop_data = StaticCString::create("drop_data"); can_drop_data = StaticCString::create("can_drop_data"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index 0802a73973..0b70cd36ff 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -30,7 +30,7 @@ #ifndef SCENE_STRING_NAMES_H #define SCENE_STRING_NAMES_H -#include "path_db.h" +#include "node_path.h" #include "string_db.h" class SceneStringNames { @@ -173,8 +173,6 @@ public: StringName _get_minimum_size; - StringName play_play; - StringName _im_update; StringName _queue_update; diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp index 78b3e514e6..6398d87007 100644 --- a/servers/arvr_server.cpp +++ b/servers/arvr_server.cpp @@ -48,10 +48,10 @@ void ARVRServer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "world_scale"), "set_world_scale", "get_world_scale"); ClassDB::bind_method(D_METHOD("get_interface_count"), &ARVRServer::get_interface_count); - ClassDB::bind_method(D_METHOD("get_interface:ARVRInterface", "idx"), &ARVRServer::get_interface); - ClassDB::bind_method(D_METHOD("find_interface:ARVRInterface", "name"), &ARVRServer::find_interface); + ClassDB::bind_method(D_METHOD("get_interface", "idx"), &ARVRServer::get_interface); + ClassDB::bind_method(D_METHOD("find_interface", "name"), &ARVRServer::find_interface); ClassDB::bind_method(D_METHOD("get_tracker_count"), &ARVRServer::get_tracker_count); - ClassDB::bind_method(D_METHOD("get_tracker:ARVRPositionalTracker", "idx"), &ARVRServer::get_tracker); + ClassDB::bind_method(D_METHOD("get_tracker", "idx"), &ARVRServer::get_tracker); ClassDB::bind_method(D_METHOD("set_primary_interface"), &ARVRServer::set_primary_interface); diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 0d2550e53b..3547f86eb3 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -772,10 +772,11 @@ void AudioServer::finish() { buses.clear(); - if (AudioDriver::get_singleton()) { - AudioDriver::get_singleton()->finish(); + for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) { + AudioDriverManager::get_driver(i)->finish(); } } + void AudioServer::update() { } @@ -985,11 +986,11 @@ void AudioServer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_bus_bypass_effects", "bus_idx", "enable"), &AudioServer::set_bus_bypass_effects); ClassDB::bind_method(D_METHOD("is_bus_bypassing_effects", "bus_idx"), &AudioServer::is_bus_bypassing_effects); - ClassDB::bind_method(D_METHOD("add_bus_effect", "bus_idx", "effect:AudioEffect", "at_pos"), &AudioServer::add_bus_effect, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("add_bus_effect", "bus_idx", "effect", "at_pos"), &AudioServer::add_bus_effect, DEFVAL(-1)); ClassDB::bind_method(D_METHOD("remove_bus_effect", "bus_idx", "effect_idx"), &AudioServer::remove_bus_effect); ClassDB::bind_method(D_METHOD("get_bus_effect_count", "bus_idx"), &AudioServer::get_bus_effect_count); - ClassDB::bind_method(D_METHOD("get_bus_effect:AudioEffect", "bus_idx", "effect_idx"), &AudioServer::get_bus_effect); + ClassDB::bind_method(D_METHOD("get_bus_effect", "bus_idx", "effect_idx"), &AudioServer::get_bus_effect); ClassDB::bind_method(D_METHOD("swap_bus_effects", "bus_idx", "effect_idx", "by_effect_idx"), &AudioServer::swap_bus_effects); ClassDB::bind_method(D_METHOD("set_bus_effect_enabled", "bus_idx", "effect_idx", "enabled"), &AudioServer::set_bus_effect_enabled); @@ -1004,8 +1005,8 @@ void AudioServer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_speaker_mode"), &AudioServer::get_speaker_mode); ClassDB::bind_method(D_METHOD("get_mix_rate"), &AudioServer::get_mix_rate); - ClassDB::bind_method(D_METHOD("set_bus_layout", "bus_layout:AudioBusLayout"), &AudioServer::set_bus_layout); - ClassDB::bind_method(D_METHOD("generate_bus_layout:AudioBusLayout"), &AudioServer::generate_bus_layout); + ClassDB::bind_method(D_METHOD("set_bus_layout", "bus_layout"), &AudioServer::set_bus_layout); + ClassDB::bind_method(D_METHOD("generate_bus_layout"), &AudioServer::generate_bus_layout); ADD_SIGNAL(MethodInfo("bus_layout_changed")); } diff --git a/servers/physics/joints/pin_joint_sw.h b/servers/physics/joints/pin_joint_sw.h index 644c204066..1d580b6c21 100644 --- a/servers/physics/joints/pin_joint_sw.h +++ b/servers/physics/joints/pin_joint_sw.h @@ -83,11 +83,11 @@ public: void set_param(PhysicsServer::PinJointParam p_param, real_t p_value); real_t get_param(PhysicsServer::PinJointParam p_param) const; - void set_pos_A(const Vector3 &p_pos) { m_pivotInA = p_pos; } - void set_pos_B(const Vector3 &p_pos) { m_pivotInB = p_pos; } + void set_pos_a(const Vector3 &p_pos) { m_pivotInA = p_pos; } + void set_pos_b(const Vector3 &p_pos) { m_pivotInB = p_pos; } - Vector3 get_pos_A() { return m_pivotInB; } - Vector3 get_pos_B() { return m_pivotInA; } + Vector3 get_pos_a() { return m_pivotInB; } + Vector3 get_pos_b() { return m_pivotInA; } PinJointSW(BodySW *p_body_a, const Vector3 &p_pos_a, BodySW *p_body_b, const Vector3 &p_pos_b); ~PinJointSW(); diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index 833c77216e..c40503c426 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -350,7 +350,7 @@ void PhysicsServerSW::area_set_shape_disabled(RID p_area, int p_shape_idx, bool area->set_shape_as_disabled(p_shape_idx, p_disabled); } -void PhysicsServerSW::area_attach_object_instance_ID(RID p_area, ObjectID p_ID) { +void PhysicsServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_ID) { if (space_owner.owns(p_area)) { SpaceSW *space = space_owner.get(p_area); @@ -360,7 +360,7 @@ void PhysicsServerSW::area_attach_object_instance_ID(RID p_area, ObjectID p_ID) ERR_FAIL_COND(!area); area->set_instance_id(p_ID); } -ObjectID PhysicsServerSW::area_get_object_instance_ID(RID p_area) const { +ObjectID PhysicsServerSW::area_get_object_instance_id(RID p_area) const { if (space_owner.owns(p_area)) { SpaceSW *space = space_owner.get(p_area); @@ -438,7 +438,7 @@ void PhysicsServerSW::area_set_monitor_callback(RID p_area, Object *p_receiver, AreaSW *area = area_owner.get(p_area); ERR_FAIL_COND(!area); - area->set_monitor_callback(p_receiver ? p_receiver->get_instance_ID() : 0, p_method); + area->set_monitor_callback(p_receiver ? p_receiver->get_instance_id() : 0, p_method); } void PhysicsServerSW::area_set_ray_pickable(RID p_area, bool p_enable) { @@ -462,7 +462,7 @@ void PhysicsServerSW::area_set_area_monitor_callback(RID p_area, Object *p_recei AreaSW *area = area_owner.get(p_area); ERR_FAIL_COND(!area); - area->set_area_monitor_callback(p_receiver ? p_receiver->get_instance_ID() : 0, p_method); + area->set_area_monitor_callback(p_receiver ? p_receiver->get_instance_id() : 0, p_method); } /* BODY API */ @@ -662,7 +662,7 @@ uint32_t PhysicsServerSW::body_get_collision_mask(RID p_body) const { return body->get_collision_mask(); } -void PhysicsServerSW::body_attach_object_instance_ID(RID p_body, uint32_t p_ID) { +void PhysicsServerSW::body_attach_object_instance_id(RID p_body, uint32_t p_ID) { BodySW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); @@ -670,7 +670,7 @@ void PhysicsServerSW::body_attach_object_instance_ID(RID p_body, uint32_t p_ID) body->set_instance_id(p_ID); }; -uint32_t PhysicsServerSW::body_get_object_instance_ID(RID p_body) const { +uint32_t PhysicsServerSW::body_get_object_instance_id(RID p_body) const { BodySW *body = body_owner.get(p_body); ERR_FAIL_COND_V(!body, 0); @@ -877,7 +877,7 @@ void PhysicsServerSW::body_set_force_integration_callback(RID p_body, Object *p_ BodySW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); - body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_ID() : ObjectID(0), p_method, p_udata); + body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(0), p_method, p_udata); } void PhysicsServerSW::body_set_ray_pickable(RID p_body, bool p_enable) { @@ -944,38 +944,38 @@ real_t PhysicsServerSW::pin_joint_get_param(RID p_joint, PinJointParam p_param) return pin_joint->get_param(p_param); } -void PhysicsServerSW::pin_joint_set_local_A(RID p_joint, const Vector3 &p_A) { +void PhysicsServerSW::pin_joint_set_local_a(RID p_joint, const Vector3 &p_A) { JointSW *joint = joint_owner.get(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_PIN); PinJointSW *pin_joint = static_cast<PinJointSW *>(joint); - pin_joint->set_pos_A(p_A); + pin_joint->set_pos_a(p_A); } -Vector3 PhysicsServerSW::pin_joint_get_local_A(RID p_joint) const { +Vector3 PhysicsServerSW::pin_joint_get_local_a(RID p_joint) const { JointSW *joint = joint_owner.get(p_joint); ERR_FAIL_COND_V(!joint, Vector3()); ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, Vector3()); PinJointSW *pin_joint = static_cast<PinJointSW *>(joint); - return pin_joint->get_pos_A(); + return pin_joint->get_pos_a(); } -void PhysicsServerSW::pin_joint_set_local_B(RID p_joint, const Vector3 &p_B) { +void PhysicsServerSW::pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) { JointSW *joint = joint_owner.get(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_PIN); PinJointSW *pin_joint = static_cast<PinJointSW *>(joint); - pin_joint->set_pos_B(p_B); + pin_joint->set_pos_b(p_B); } -Vector3 PhysicsServerSW::pin_joint_get_local_B(RID p_joint) const { +Vector3 PhysicsServerSW::pin_joint_get_local_b(RID p_joint) const { JointSW *joint = joint_owner.get(p_joint); ERR_FAIL_COND_V(!joint, Vector3()); ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, Vector3()); PinJointSW *pin_joint = static_cast<PinJointSW *>(joint); - return pin_joint->get_pos_B(); + return pin_joint->get_pos_b(); } RID PhysicsServerSW::joint_create_hinge(RID p_body_A, const Transform &p_frame_A, RID p_body_B, const Transform &p_frame_B) { diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h index 591fe4af46..bae2839b71 100644 --- a/servers/physics/physics_server_sw.h +++ b/servers/physics/physics_server_sw.h @@ -121,8 +121,8 @@ public: virtual void area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled); - virtual void area_attach_object_instance_ID(RID p_area, ObjectID p_ID); - virtual ObjectID area_get_object_instance_ID(RID p_area) const; + virtual void area_attach_object_instance_id(RID p_area, ObjectID p_ID); + virtual ObjectID area_get_object_instance_id(RID p_area) const; virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value); virtual void area_set_transform(RID p_area, const Transform &p_transform); @@ -165,8 +165,8 @@ public: virtual void body_remove_shape(RID p_body, int p_shape_idx); virtual void body_clear_shapes(RID p_body); - virtual void body_attach_object_instance_ID(RID p_body, uint32_t p_ID); - virtual uint32_t body_get_object_instance_ID(RID p_body) const; + virtual void body_attach_object_instance_id(RID p_body, uint32_t p_ID); + virtual uint32_t body_get_object_instance_id(RID p_body) const; virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable); virtual bool body_is_continuous_collision_detection_enabled(RID p_body) const; @@ -226,11 +226,11 @@ public: virtual void pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value); virtual real_t pin_joint_get_param(RID p_joint, PinJointParam p_param) const; - virtual void pin_joint_set_local_A(RID p_joint, const Vector3 &p_A); - virtual Vector3 pin_joint_get_local_A(RID p_joint) const; + virtual void pin_joint_set_local_a(RID p_joint, const Vector3 &p_A); + virtual Vector3 pin_joint_get_local_a(RID p_joint) const; - virtual void pin_joint_set_local_B(RID p_joint, const Vector3 &p_B); - virtual Vector3 pin_joint_get_local_B(RID p_joint) const; + virtual void pin_joint_set_local_b(RID p_joint, const Vector3 &p_B); + virtual Vector3 pin_joint_get_local_b(RID p_joint) const; virtual RID joint_create_hinge(RID p_body_A, const Transform &p_frame_A, RID p_body_B, const Transform &p_frame_B); virtual RID joint_create_hinge_simple(RID p_body_A, const Vector3 &p_pivot_A, const Vector3 &p_axis_A, RID p_body_B, const Vector3 &p_pivot_B, const Vector3 &p_axis_B); diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index add376bfb2..debd38d43a 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -415,7 +415,7 @@ void Physics2DServerSW::area_clear_shapes(RID p_area) { area->remove_shape(0); } -void Physics2DServerSW::area_attach_object_instance_ID(RID p_area, ObjectID p_ID) { +void Physics2DServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_ID) { if (space_owner.owns(p_area)) { Space2DSW *space = space_owner.get(p_area); @@ -425,7 +425,7 @@ void Physics2DServerSW::area_attach_object_instance_ID(RID p_area, ObjectID p_ID ERR_FAIL_COND(!area); area->set_instance_id(p_ID); } -ObjectID Physics2DServerSW::area_get_object_instance_ID(RID p_area) const { +ObjectID Physics2DServerSW::area_get_object_instance_id(RID p_area) const { if (space_owner.owns(p_area)) { Space2DSW *space = space_owner.get(p_area); @@ -510,7 +510,7 @@ void Physics2DServerSW::area_set_monitor_callback(RID p_area, Object *p_receiver Area2DSW *area = area_owner.get(p_area); ERR_FAIL_COND(!area); - area->set_monitor_callback(p_receiver ? p_receiver->get_instance_ID() : 0, p_method); + area->set_monitor_callback(p_receiver ? p_receiver->get_instance_id() : 0, p_method); } void Physics2DServerSW::area_set_area_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) { @@ -518,7 +518,7 @@ void Physics2DServerSW::area_set_area_monitor_callback(RID p_area, Object *p_rec Area2DSW *area = area_owner.get(p_area); ERR_FAIL_COND(!area); - area->set_area_monitor_callback(p_receiver ? p_receiver->get_instance_ID() : 0, p_method); + area->set_area_monitor_callback(p_receiver ? p_receiver->get_instance_id() : 0, p_method); } /* BODY API */ @@ -706,7 +706,7 @@ Physics2DServerSW::CCDMode Physics2DServerSW::body_get_continuous_collision_dete return body->get_continuous_collision_detection_mode(); } -void Physics2DServerSW::body_attach_object_instance_ID(RID p_body, uint32_t p_ID) { +void Physics2DServerSW::body_attach_object_instance_id(RID p_body, uint32_t p_ID) { Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); @@ -714,7 +714,7 @@ void Physics2DServerSW::body_attach_object_instance_ID(RID p_body, uint32_t p_ID body->set_instance_id(p_ID); }; -uint32_t Physics2DServerSW::body_get_object_instance_ID(RID p_body) const { +uint32_t Physics2DServerSW::body_get_object_instance_id(RID p_body) const { Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND_V(!body, 0); @@ -922,7 +922,7 @@ void Physics2DServerSW::body_set_force_integration_callback(RID p_body, Object * Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); - body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_ID() : ObjectID(0), p_method, p_udata); + body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(0), p_method, p_udata); } bool Physics2DServerSW::body_collide_shape(RID p_body, int p_body_shape, RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, Vector2 *r_results, int p_result_max, int &r_result_count) { diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h index da72784b6f..830ba91c98 100644 --- a/servers/physics_2d/physics_2d_server_sw.h +++ b/servers/physics_2d/physics_2d_server_sw.h @@ -128,8 +128,8 @@ public: virtual void area_remove_shape(RID p_area, int p_shape_idx); virtual void area_clear_shapes(RID p_area); - virtual void area_attach_object_instance_ID(RID p_area, ObjectID p_ID); - virtual ObjectID area_get_object_instance_ID(RID p_area) const; + virtual void area_attach_object_instance_id(RID p_area, ObjectID p_ID); + virtual ObjectID area_get_object_instance_id(RID p_area) const; virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value); virtual void area_set_transform(RID p_area, const Transform2D &p_transform); @@ -172,8 +172,8 @@ public: virtual void body_set_shape_disabled(RID p_body, int p_shape, bool p_disabled); virtual void body_set_shape_as_one_way_collision(RID p_body, int p_shape, bool p_enabled); - virtual void body_attach_object_instance_ID(RID p_body, uint32_t p_ID); - virtual uint32_t body_get_object_instance_ID(RID p_body) const; + virtual void body_attach_object_instance_id(RID p_body, uint32_t p_ID); + virtual uint32_t body_get_object_instance_id(RID p_body) const; virtual void body_set_continuous_collision_detection_mode(RID p_body, CCDMode p_mode); virtual CCDMode body_get_continuous_collision_detection_mode(RID p_body) const; diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.cpp b/servers/physics_2d/physics_2d_server_wrap_mt.cpp index d39231b161..8d19153268 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.cpp +++ b/servers/physics_2d/physics_2d_server_wrap_mt.cpp @@ -51,7 +51,7 @@ void Physics2DServerWrapMT::_thread_callback(void *_instance) { void Physics2DServerWrapMT::thread_loop() { - server_thread = Thread::get_caller_ID(); + server_thread = Thread::get_caller_id(); OS::get_singleton()->make_rendering_thread(); @@ -169,12 +169,12 @@ Physics2DServerWrapMT::Physics2DServerWrapMT(Physics2DServer *p_contained, bool damped_spring_joint_pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc"); if (!p_create_thread) { - server_thread = Thread::get_caller_ID(); + server_thread = Thread::get_caller_id(); } else { server_thread = 0; } - main_thread = Thread::get_caller_ID(); + main_thread = Thread::get_caller_id(); first_frame = true; } diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h index 8b6609d119..8058709c06 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.h +++ b/servers/physics_2d/physics_2d_server_wrap_mt.h @@ -98,7 +98,7 @@ public: //these work well, but should be used from the main thread only bool shape_collide(RID p_shape_A, const Transform2D &p_xform_A, const Vector2 &p_motion_A, RID p_shape_B, const Transform2D &p_xform_B, const Vector2 &p_motion_B, Vector2 *r_results, int p_result_max, int &r_result_count) { - ERR_FAIL_COND_V(main_thread != Thread::get_caller_ID(), false); + ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), false); return physics_2d_server->shape_collide(p_shape_A, p_xform_A, p_motion_A, p_shape_B, p_xform_B, p_motion_B, r_results, p_result_max, r_result_count); } @@ -114,20 +114,20 @@ public: // this function only works on fixed process, errors and returns null otherwise Physics2DDirectSpaceState *space_get_direct_state(RID p_space) { - ERR_FAIL_COND_V(main_thread != Thread::get_caller_ID(), NULL); + ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), NULL); return physics_2d_server->space_get_direct_state(p_space); } FUNC2(space_set_debug_contacts, RID, int); virtual Vector<Vector2> space_get_contacts(RID p_space) const { - ERR_FAIL_COND_V(main_thread != Thread::get_caller_ID(), Vector<Vector2>()); + ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), Vector<Vector2>()); return physics_2d_server->space_get_contacts(p_space); } virtual int space_get_contact_count(RID p_space) const { - ERR_FAIL_COND_V(main_thread != Thread::get_caller_ID(), 0); + ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), 0); return physics_2d_server->space_get_contact_count(p_space); } @@ -153,8 +153,8 @@ public: FUNC2(area_remove_shape, RID, int); FUNC1(area_clear_shapes, RID); - FUNC2(area_attach_object_instance_ID, RID, ObjectID); - FUNC1RC(ObjectID, area_get_object_instance_ID, RID); + FUNC2(area_attach_object_instance_id, RID, ObjectID); + FUNC1RC(ObjectID, area_get_object_instance_id, RID); FUNC3(area_set_param, RID, AreaParameter, const Variant &); FUNC2(area_set_transform, RID, const Transform2D &); @@ -198,8 +198,8 @@ public: FUNC2(body_remove_shape, RID, int); FUNC1(body_clear_shapes, RID); - FUNC2(body_attach_object_instance_ID, RID, uint32_t); - FUNC1RC(uint32_t, body_get_object_instance_ID, RID); + FUNC2(body_attach_object_instance_id, RID, uint32_t); + FUNC1RC(uint32_t, body_get_object_instance_id, RID); FUNC2(body_set_continuous_collision_detection_mode, RID, CCDMode); FUNC1RC(CCDMode, body_get_continuous_collision_detection_mode, RID); @@ -249,7 +249,7 @@ public: bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, real_t p_margin = 0.001, MotionResult *r_result = NULL) { - ERR_FAIL_COND_V(main_thread != Thread::get_caller_ID(), false); + ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), false); return physics_2d_server->body_test_motion(p_body, p_from, p_motion, p_margin, r_result); } diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index fb7e89bd9e..7b0e5ab445 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -100,11 +100,11 @@ void Physics2DDirectBodyState::_bind_methods() { ClassDB::bind_method(D_METHOD("get_contact_collider_id", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_id); ClassDB::bind_method(D_METHOD("get_contact_collider_object", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_object); ClassDB::bind_method(D_METHOD("get_contact_collider_shape", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_shape); - ClassDB::bind_method(D_METHOD("get_contact_collider_shape_metadata:Variant", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_shape_metadata); + ClassDB::bind_method(D_METHOD("get_contact_collider_shape_metadata", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_shape_metadata); ClassDB::bind_method(D_METHOD("get_contact_collider_velocity_at_pos", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_velocity_at_pos); ClassDB::bind_method(D_METHOD("get_step"), &Physics2DDirectBodyState::get_step); ClassDB::bind_method(D_METHOD("integrate_forces"), &Physics2DDirectBodyState::integrate_forces); - ClassDB::bind_method(D_METHOD("get_space_state:Physics2DDirectSpaceState"), &Physics2DDirectBodyState::get_space_state); + ClassDB::bind_method(D_METHOD("get_space_state"), &Physics2DDirectBodyState::get_space_state); } Physics2DDirectBodyState::Physics2DDirectBodyState() {} @@ -191,7 +191,7 @@ Vector<RID> Physics2DShapeQueryParameters::get_exclude() const { void Physics2DShapeQueryParameters::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shape", "shape:Shape2D"), &Physics2DShapeQueryParameters::set_shape); + ClassDB::bind_method(D_METHOD("set_shape", "shape"), &Physics2DShapeQueryParameters::set_shape); ClassDB::bind_method(D_METHOD("set_shape_rid", "shape"), &Physics2DShapeQueryParameters::set_shape_rid); ClassDB::bind_method(D_METHOD("get_shape_rid"), &Physics2DShapeQueryParameters::get_shape_rid); @@ -347,11 +347,11 @@ Physics2DDirectSpaceState::Physics2DDirectSpaceState() { void Physics2DDirectSpaceState::_bind_methods() { ClassDB::bind_method(D_METHOD("intersect_point", "point", "max_results", "exclude", "collision_layer", "type_mask"), &Physics2DDirectSpaceState::_intersect_point, DEFVAL(32), DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION)); - ClassDB::bind_method(D_METHOD("intersect_ray:Dictionary", "from", "to", "exclude", "collision_layer", "type_mask"), &Physics2DDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION)); - ClassDB::bind_method(D_METHOD("intersect_shape", "shape:Physics2DShapeQueryParameters", "max_results"), &Physics2DDirectSpaceState::_intersect_shape, DEFVAL(32)); - ClassDB::bind_method(D_METHOD("cast_motion", "shape:Physics2DShapeQueryParameters"), &Physics2DDirectSpaceState::_cast_motion); - ClassDB::bind_method(D_METHOD("collide_shape", "shape:Physics2DShapeQueryParameters", "max_results"), &Physics2DDirectSpaceState::_collide_shape, DEFVAL(32)); - ClassDB::bind_method(D_METHOD("get_rest_info", "shape:Physics2DShapeQueryParameters"), &Physics2DDirectSpaceState::_get_rest_info); + ClassDB::bind_method(D_METHOD("intersect_ray", "from", "to", "exclude", "collision_layer", "type_mask"), &Physics2DDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION)); + ClassDB::bind_method(D_METHOD("intersect_shape", "shape", "max_results"), &Physics2DDirectSpaceState::_intersect_shape, DEFVAL(32)); + ClassDB::bind_method(D_METHOD("cast_motion", "shape"), &Physics2DDirectSpaceState::_cast_motion); + ClassDB::bind_method(D_METHOD("collide_shape", "shape", "max_results"), &Physics2DDirectSpaceState::_collide_shape, DEFVAL(32)); + ClassDB::bind_method(D_METHOD("get_rest_info", "shape"), &Physics2DDirectSpaceState::_get_rest_info); //ClassDB::bind_method(D_METHOD("cast_motion","shape","xform","motion","exclude","umask"),&Physics2DDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0)); BIND_CONSTANT(TYPE_MASK_STATIC_BODY); @@ -484,7 +484,7 @@ void Physics2DServer::_bind_methods() { ClassDB::bind_method(D_METHOD("space_is_active", "space"), &Physics2DServer::space_is_active); ClassDB::bind_method(D_METHOD("space_set_param", "space", "param", "value"), &Physics2DServer::space_set_param); ClassDB::bind_method(D_METHOD("space_get_param", "space", "param"), &Physics2DServer::space_get_param); - ClassDB::bind_method(D_METHOD("space_get_direct_state:Physics2DDirectSpaceState", "space"), &Physics2DServer::space_get_direct_state); + ClassDB::bind_method(D_METHOD("space_get_direct_state", "space"), &Physics2DServer::space_get_direct_state); ClassDB::bind_method(D_METHOD("area_create"), &Physics2DServer::area_create); ClassDB::bind_method(D_METHOD("area_set_space", "area", "space"), &Physics2DServer::area_set_space); @@ -514,8 +514,8 @@ void Physics2DServer::_bind_methods() { ClassDB::bind_method(D_METHOD("area_get_param", "area", "param"), &Physics2DServer::area_get_param); ClassDB::bind_method(D_METHOD("area_get_transform", "area"), &Physics2DServer::area_get_transform); - ClassDB::bind_method(D_METHOD("area_attach_object_instance_ID", "area", "id"), &Physics2DServer::area_attach_object_instance_ID); - ClassDB::bind_method(D_METHOD("area_get_object_instance_ID", "area"), &Physics2DServer::area_get_object_instance_ID); + ClassDB::bind_method(D_METHOD("area_attach_object_instance_id", "area", "id"), &Physics2DServer::area_attach_object_instance_id); + ClassDB::bind_method(D_METHOD("area_get_object_instance_id", "area"), &Physics2DServer::area_get_object_instance_id); ClassDB::bind_method(D_METHOD("area_set_monitor_callback", "area", "receiver", "method"), &Physics2DServer::area_set_monitor_callback); @@ -543,8 +543,8 @@ void Physics2DServer::_bind_methods() { ClassDB::bind_method(D_METHOD("body_set_shape_disabled", "body", "shape_idx", "disable"), &Physics2DServer::body_set_shape_disabled); ClassDB::bind_method(D_METHOD("body_set_shape_as_one_way_collision", "body", "shape_idx", "enable"), &Physics2DServer::body_set_shape_as_one_way_collision); - ClassDB::bind_method(D_METHOD("body_attach_object_instance_ID", "body", "id"), &Physics2DServer::body_attach_object_instance_ID); - ClassDB::bind_method(D_METHOD("body_get_object_instance_ID", "body"), &Physics2DServer::body_get_object_instance_ID); + ClassDB::bind_method(D_METHOD("body_attach_object_instance_id", "body", "id"), &Physics2DServer::body_attach_object_instance_id); + ClassDB::bind_method(D_METHOD("body_get_object_instance_id", "body"), &Physics2DServer::body_get_object_instance_id); ClassDB::bind_method(D_METHOD("body_set_continuous_collision_detection_mode", "body", "mode"), &Physics2DServer::body_set_continuous_collision_detection_mode); ClassDB::bind_method(D_METHOD("body_get_continuous_collision_detection_mode", "body"), &Physics2DServer::body_get_continuous_collision_detection_mode); @@ -577,7 +577,7 @@ void Physics2DServer::_bind_methods() { ClassDB::bind_method(D_METHOD("body_set_force_integration_callback", "body", "receiver", "method", "userdata"), &Physics2DServer::body_set_force_integration_callback, DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("body_test_motion", "body", "from", "motion", "margin", "result:Physics2DTestMotionResult"), &Physics2DServer::_body_test_motion, DEFVAL(0.08), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("body_test_motion", "body", "from", "motion", "margin", "result"), &Physics2DServer::_body_test_motion, DEFVAL(0.08), DEFVAL(Variant())); /* JOINT API */ diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index e396424707..f3acd8df18 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -334,8 +334,8 @@ public: virtual void area_set_shape_disabled(RID p_area, int p_shape, bool p_disabled) = 0; - virtual void area_attach_object_instance_ID(RID p_area, ObjectID p_ID) = 0; - virtual ObjectID area_get_object_instance_ID(RID p_area) const = 0; + virtual void area_attach_object_instance_id(RID p_area, ObjectID p_ID) = 0; + virtual ObjectID area_get_object_instance_id(RID p_area) const = 0; virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) = 0; virtual void area_set_transform(RID p_area, const Transform2D &p_transform) = 0; @@ -388,8 +388,8 @@ public: virtual void body_remove_shape(RID p_body, int p_shape_idx) = 0; virtual void body_clear_shapes(RID p_body) = 0; - virtual void body_attach_object_instance_ID(RID p_body, uint32_t p_ID) = 0; - virtual uint32_t body_get_object_instance_ID(RID p_body) const = 0; + virtual void body_attach_object_instance_id(RID p_body, uint32_t p_ID) = 0; + virtual uint32_t body_get_object_instance_id(RID p_body) const = 0; enum CCDMode { CCD_MODE_DISABLED, diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index 6b6db1ff8c..fbf104c6ac 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -109,7 +109,7 @@ void PhysicsDirectBodyState::_bind_methods() { ClassDB::bind_method(D_METHOD("get_contact_collider_velocity_at_pos", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_velocity_at_pos); ClassDB::bind_method(D_METHOD("get_step"), &PhysicsDirectBodyState::get_step); ClassDB::bind_method(D_METHOD("integrate_forces"), &PhysicsDirectBodyState::integrate_forces); - ClassDB::bind_method(D_METHOD("get_space_state:PhysicsDirectSpaceState"), &PhysicsDirectBodyState::get_space_state); + ClassDB::bind_method(D_METHOD("get_space_state"), &PhysicsDirectBodyState::get_space_state); } PhysicsDirectBodyState::PhysicsDirectBodyState() {} @@ -188,7 +188,7 @@ Vector<RID> PhysicsShapeQueryParameters::get_exclude() const { void PhysicsShapeQueryParameters::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shape", "shape:Shape"), &PhysicsShapeQueryParameters::set_shape); + ClassDB::bind_method(D_METHOD("set_shape", "shape"), &PhysicsShapeQueryParameters::set_shape); ClassDB::bind_method(D_METHOD("set_shape_rid", "shape"), &PhysicsShapeQueryParameters::set_shape_rid); ClassDB::bind_method(D_METHOD("get_shape_rid"), &PhysicsShapeQueryParameters::get_shape_rid); @@ -341,13 +341,13 @@ PhysicsDirectSpaceState::PhysicsDirectSpaceState() { void PhysicsDirectSpaceState::_bind_methods() { //ClassDB::bind_method(D_METHOD("intersect_ray","from","to","exclude","umask"),&PhysicsDirectSpaceState::_intersect_ray,DEFVAL(Array()),DEFVAL(0)); - //ClassDB::bind_method(D_METHOD("intersect_shape:PhysicsShapeQueryResult","shape","xform","result_max","exclude","umask"),&PhysicsDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0)); + //ClassDB::bind_method(D_METHOD("intersect_shape","shape","xform","result_max","exclude","umask"),&PhysicsDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0)); - ClassDB::bind_method(D_METHOD("intersect_ray:Dictionary", "from", "to", "exclude", "collision_layer", "type_mask"), &PhysicsDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION)); - ClassDB::bind_method(D_METHOD("intersect_shape", "shape:PhysicsShapeQueryParameters", "max_results"), &PhysicsDirectSpaceState::_intersect_shape, DEFVAL(32)); - ClassDB::bind_method(D_METHOD("cast_motion", "shape:PhysicsShapeQueryParameters", "motion"), &PhysicsDirectSpaceState::_cast_motion); - ClassDB::bind_method(D_METHOD("collide_shape", "shape:PhysicsShapeQueryParameters", "max_results"), &PhysicsDirectSpaceState::_collide_shape, DEFVAL(32)); - ClassDB::bind_method(D_METHOD("get_rest_info", "shape:PhysicsShapeQueryParameters"), &PhysicsDirectSpaceState::_get_rest_info); + ClassDB::bind_method(D_METHOD("intersect_ray", "from", "to", "exclude", "collision_layer", "type_mask"), &PhysicsDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION)); + ClassDB::bind_method(D_METHOD("intersect_shape", "shape", "max_results"), &PhysicsDirectSpaceState::_intersect_shape, DEFVAL(32)); + ClassDB::bind_method(D_METHOD("cast_motion", "shape", "motion"), &PhysicsDirectSpaceState::_cast_motion); + ClassDB::bind_method(D_METHOD("collide_shape", "shape", "max_results"), &PhysicsDirectSpaceState::_collide_shape, DEFVAL(32)); + ClassDB::bind_method(D_METHOD("get_rest_info", "shape"), &PhysicsDirectSpaceState::_get_rest_info); BIND_CONSTANT(TYPE_MASK_STATIC_BODY); BIND_CONSTANT(TYPE_MASK_KINEMATIC_BODY); @@ -405,7 +405,7 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(D_METHOD("space_is_active", "space"), &PhysicsServer::space_is_active); ClassDB::bind_method(D_METHOD("space_set_param", "space", "param", "value"), &PhysicsServer::space_set_param); ClassDB::bind_method(D_METHOD("space_get_param", "space", "param"), &PhysicsServer::space_get_param); - ClassDB::bind_method(D_METHOD("space_get_direct_state:PhysicsDirectSpaceState", "space"), &PhysicsServer::space_get_direct_state); + ClassDB::bind_method(D_METHOD("space_get_direct_state", "space"), &PhysicsServer::space_get_direct_state); ClassDB::bind_method(D_METHOD("area_create"), &PhysicsServer::area_create); ClassDB::bind_method(D_METHOD("area_set_space", "area", "space"), &PhysicsServer::area_set_space); @@ -434,8 +434,8 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(D_METHOD("area_get_param", "area", "param"), &PhysicsServer::area_get_param); ClassDB::bind_method(D_METHOD("area_get_transform", "area"), &PhysicsServer::area_get_transform); - ClassDB::bind_method(D_METHOD("area_attach_object_instance_ID", "area", "id"), &PhysicsServer::area_attach_object_instance_ID); - ClassDB::bind_method(D_METHOD("area_get_object_instance_ID", "area"), &PhysicsServer::area_get_object_instance_ID); + ClassDB::bind_method(D_METHOD("area_attach_object_instance_id", "area", "id"), &PhysicsServer::area_attach_object_instance_id); + ClassDB::bind_method(D_METHOD("area_get_object_instance_id", "area"), &PhysicsServer::area_get_object_instance_id); ClassDB::bind_method(D_METHOD("area_set_monitor_callback", "area", "receiver", "method"), &PhysicsServer::area_set_monitor_callback); @@ -467,8 +467,8 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(D_METHOD("body_remove_shape", "body", "shape_idx"), &PhysicsServer::body_remove_shape); ClassDB::bind_method(D_METHOD("body_clear_shapes", "body"), &PhysicsServer::body_clear_shapes); - ClassDB::bind_method(D_METHOD("body_attach_object_instance_ID", "body", "id"), &PhysicsServer::body_attach_object_instance_ID); - ClassDB::bind_method(D_METHOD("body_get_object_instance_ID", "body"), &PhysicsServer::body_get_object_instance_ID); + ClassDB::bind_method(D_METHOD("body_attach_object_instance_id", "body", "id"), &PhysicsServer::body_attach_object_instance_id); + ClassDB::bind_method(D_METHOD("body_get_object_instance_id", "body"), &PhysicsServer::body_get_object_instance_id); ClassDB::bind_method(D_METHOD("body_set_enable_continuous_collision_detection", "body", "enable"), &PhysicsServer::body_set_enable_continuous_collision_detection); ClassDB::bind_method(D_METHOD("body_is_continuous_collision_detection_enabled", "body"), &PhysicsServer::body_is_continuous_collision_detection_enabled); @@ -516,11 +516,11 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(D_METHOD("pin_joint_set_param", "joint", "param", "value"), &PhysicsServer::pin_joint_set_param); ClassDB::bind_method(D_METHOD("pin_joint_get_param", "joint", "param"), &PhysicsServer::pin_joint_get_param); - ClassDB::bind_method(D_METHOD("pin_joint_set_local_A", "joint", "local_A"), &PhysicsServer::pin_joint_set_local_A); - ClassDB::bind_method(D_METHOD("pin_joint_get_local_A", "joint"), &PhysicsServer::pin_joint_get_local_A); + ClassDB::bind_method(D_METHOD("pin_joint_set_local_a", "joint", "local_A"), &PhysicsServer::pin_joint_set_local_a); + ClassDB::bind_method(D_METHOD("pin_joint_get_local_a", "joint"), &PhysicsServer::pin_joint_get_local_a); - ClassDB::bind_method(D_METHOD("pin_joint_set_local_B", "joint", "local_B"), &PhysicsServer::pin_joint_set_local_B); - ClassDB::bind_method(D_METHOD("pin_joint_get_local_B", "joint"), &PhysicsServer::pin_joint_get_local_B); + ClassDB::bind_method(D_METHOD("pin_joint_set_local_b", "joint", "local_B"), &PhysicsServer::pin_joint_set_local_b); + ClassDB::bind_method(D_METHOD("pin_joint_get_local_b", "joint"), &PhysicsServer::pin_joint_get_local_b); BIND_CONSTANT(PIN_JOINT_BIAS); BIND_CONSTANT(PIN_JOINT_DAMPING); diff --git a/servers/physics_server.h b/servers/physics_server.h index 0f07fca637..b38e14eb0c 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -328,8 +328,8 @@ public: virtual void area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) = 0; - virtual void area_attach_object_instance_ID(RID p_area, ObjectID p_ID) = 0; - virtual ObjectID area_get_object_instance_ID(RID p_area) const = 0; + virtual void area_attach_object_instance_id(RID p_area, ObjectID p_ID) = 0; + virtual ObjectID area_get_object_instance_id(RID p_area) const = 0; virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) = 0; virtual void area_set_transform(RID p_area, const Transform &p_transform) = 0; @@ -381,8 +381,8 @@ public: virtual void body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) = 0; - virtual void body_attach_object_instance_ID(RID p_body, uint32_t p_ID) = 0; - virtual uint32_t body_get_object_instance_ID(RID p_body) const = 0; + virtual void body_attach_object_instance_id(RID p_body, uint32_t p_ID) = 0; + virtual uint32_t body_get_object_instance_id(RID p_body) const = 0; virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) = 0; virtual bool body_is_continuous_collision_detection_enabled(RID p_body) const = 0; @@ -508,11 +508,11 @@ public: virtual void pin_joint_set_param(RID p_joint, PinJointParam p_param, float p_value) = 0; virtual float pin_joint_get_param(RID p_joint, PinJointParam p_param) const = 0; - virtual void pin_joint_set_local_A(RID p_joint, const Vector3 &p_A) = 0; - virtual Vector3 pin_joint_get_local_A(RID p_joint) const = 0; + virtual void pin_joint_set_local_a(RID p_joint, const Vector3 &p_A) = 0; + virtual Vector3 pin_joint_get_local_a(RID p_joint) const = 0; - virtual void pin_joint_set_local_B(RID p_joint, const Vector3 &p_B) = 0; - virtual Vector3 pin_joint_get_local_B(RID p_joint) const = 0; + virtual void pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) = 0; + virtual Vector3 pin_joint_get_local_b(RID p_joint) const = 0; enum HingeJointParam { diff --git a/servers/server_wrap_mt_common.h b/servers/server_wrap_mt_common.h index e285483e2b..1ffa5ad14c 100644 --- a/servers/server_wrap_mt_common.h +++ b/servers/server_wrap_mt_common.h @@ -30,7 +30,7 @@ #define FUNC0R(m_r, m_type) \ virtual m_r m_type() { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, &ret); \ SYNC_DEBUG \ @@ -55,7 +55,7 @@ } \ } \ virtual RID m_type##_create() { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ RID rid; \ alloc_mutex->lock(); \ if (m_type##_id_pool.size() == 0) { \ @@ -85,7 +85,7 @@ } \ } \ virtual RID m_type##_create(m_arg1 p1) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ RID rid; \ alloc_mutex->lock(); \ if (m_type##_id_pool.size() == 0) { \ @@ -115,7 +115,7 @@ } \ } \ virtual RID m_type##_create(m_arg1 p1, m_arg2 p2) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ RID rid; \ alloc_mutex->lock(); \ if (m_type##_id_pool.size() == 0) { \ @@ -145,7 +145,7 @@ } \ } \ virtual RID m_type##_create(m_arg1 p1, m_arg2 p2, m_arg3 p3) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ RID rid; \ alloc_mutex->lock(); \ if (m_type##_id_pool.size() == 0) { \ @@ -175,7 +175,7 @@ } \ } \ virtual RID m_type##_create(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ RID rid; \ alloc_mutex->lock(); \ if (m_type##_id_pool.size() == 0) { \ @@ -205,7 +205,7 @@ } \ } \ virtual RID m_type##_create(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ RID rid; \ alloc_mutex->lock(); \ if (m_type##_id_pool.size() == 0) { \ @@ -223,7 +223,7 @@ #define FUNC0RC(m_r, m_type) \ virtual m_r m_type() const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, &ret); \ SYNC_DEBUG \ @@ -235,7 +235,7 @@ #define FUNC0(m_type) \ virtual void m_type() { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type); \ } else { \ server_name->m_type(); \ @@ -244,7 +244,7 @@ #define FUNC0C(m_type) \ virtual void m_type() const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type); \ } else { \ server_name->m_type(); \ @@ -253,7 +253,7 @@ #define FUNC0S(m_type) \ virtual void m_type() { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type); \ } else { \ server_name->m_type(); \ @@ -262,7 +262,7 @@ #define FUNC0SC(m_type) \ virtual void m_type() const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type); \ } else { \ server_name->m_type(); \ @@ -273,7 +273,7 @@ #define FUNC1R(m_r, m_type, m_arg1) \ virtual m_r m_type(m_arg1 p1) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, &ret); \ SYNC_DEBUG \ @@ -285,7 +285,7 @@ #define FUNC1RC(m_r, m_type, m_arg1) \ virtual m_r m_type(m_arg1 p1) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, &ret); \ SYNC_DEBUG \ @@ -297,7 +297,7 @@ #define FUNC1S(m_type, m_arg1) \ virtual void m_type(m_arg1 p1) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1); \ } else { \ server_name->m_type(p1); \ @@ -306,7 +306,7 @@ #define FUNC1SC(m_type, m_arg1) \ virtual void m_type(m_arg1 p1) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1); \ } else { \ server_name->m_type(p1); \ @@ -315,7 +315,7 @@ #define FUNC1(m_type, m_arg1) \ virtual void m_type(m_arg1 p1) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1); \ } else { \ server_name->m_type(p1); \ @@ -324,7 +324,7 @@ #define FUNC1C(m_type, m_arg1) \ virtual void m_type(m_arg1 p1) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1); \ } else { \ server_name->m_type(p1); \ @@ -333,7 +333,7 @@ #define FUNC2R(m_r, m_type, m_arg1, m_arg2) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, &ret); \ SYNC_DEBUG \ @@ -345,7 +345,7 @@ #define FUNC2RC(m_r, m_type, m_arg1, m_arg2) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, &ret); \ SYNC_DEBUG \ @@ -357,7 +357,7 @@ #define FUNC2S(m_type, m_arg1, m_arg2) \ virtual void m_type(m_arg1 p1, m_arg2 p2) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2); \ } else { \ server_name->m_type(p1, p2); \ @@ -366,7 +366,7 @@ #define FUNC2SC(m_type, m_arg1, m_arg2) \ virtual void m_type(m_arg1 p1, m_arg2 p2) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2); \ } else { \ server_name->m_type(p1, p2); \ @@ -375,7 +375,7 @@ #define FUNC2(m_type, m_arg1, m_arg2) \ virtual void m_type(m_arg1 p1, m_arg2 p2) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2); \ } else { \ server_name->m_type(p1, p2); \ @@ -384,7 +384,7 @@ #define FUNC2C(m_type, m_arg1, m_arg2) \ virtual void m_type(m_arg1 p1, m_arg2 p2) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2); \ } else { \ server_name->m_type(p1, p2); \ @@ -393,7 +393,7 @@ #define FUNC3R(m_r, m_type, m_arg1, m_arg2, m_arg3) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, &ret); \ SYNC_DEBUG \ @@ -405,7 +405,7 @@ #define FUNC3RC(m_r, m_type, m_arg1, m_arg2, m_arg3) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, &ret); \ return ret; \ @@ -416,7 +416,7 @@ #define FUNC3S(m_type, m_arg1, m_arg2, m_arg3) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3); \ } else { \ server_name->m_type(p1, p2, p3); \ @@ -425,7 +425,7 @@ #define FUNC3SC(m_type, m_arg1, m_arg2, m_arg3) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3); \ } else { \ server_name->m_type(p1, p2, p3); \ @@ -434,7 +434,7 @@ #define FUNC3(m_type, m_arg1, m_arg2, m_arg3) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3); \ } else { \ server_name->m_type(p1, p2, p3); \ @@ -443,7 +443,7 @@ #define FUNC3C(m_type, m_arg1, m_arg2, m_arg3) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3); \ } else { \ server_name->m_type(p1, p2, p3); \ @@ -452,7 +452,7 @@ #define FUNC4R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, &ret); \ SYNC_DEBUG \ @@ -464,7 +464,7 @@ #define FUNC4RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, &ret); \ SYNC_DEBUG \ @@ -476,7 +476,7 @@ #define FUNC4S(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4); \ } else { \ server_name->m_type(p1, p2, p3, p4); \ @@ -485,7 +485,7 @@ #define FUNC4SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4); \ } else { \ server_name->m_type(p1, p2, p3, p4); \ @@ -494,7 +494,7 @@ #define FUNC4(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4); \ } else { \ server_name->m_type(p1, p2, p3, p4); \ @@ -503,7 +503,7 @@ #define FUNC4C(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4); \ } else { \ server_name->m_type(p1, p2, p3, p4); \ @@ -512,7 +512,7 @@ #define FUNC5R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, &ret); \ SYNC_DEBUG \ @@ -524,7 +524,7 @@ #define FUNC5RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, &ret); \ SYNC_DEBUG \ @@ -536,7 +536,7 @@ #define FUNC5S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5); \ @@ -545,7 +545,7 @@ #define FUNC5SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5); \ @@ -554,7 +554,7 @@ #define FUNC5(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5); \ @@ -563,7 +563,7 @@ #define FUNC5C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5); \ @@ -572,7 +572,7 @@ #define FUNC6R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, &ret); \ SYNC_DEBUG \ @@ -584,7 +584,7 @@ #define FUNC6RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, &ret); \ return ret; \ @@ -595,7 +595,7 @@ #define FUNC6S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6); \ @@ -604,7 +604,7 @@ #define FUNC6SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6); \ @@ -613,7 +613,7 @@ #define FUNC6(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6); \ @@ -622,7 +622,7 @@ #define FUNC6C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6); \ @@ -631,7 +631,7 @@ #define FUNC7R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, &ret); \ SYNC_DEBUG \ @@ -643,7 +643,7 @@ #define FUNC7RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, &ret); \ SYNC_DEBUG \ @@ -655,7 +655,7 @@ #define FUNC7S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \ @@ -664,7 +664,7 @@ #define FUNC7SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \ @@ -673,7 +673,7 @@ #define FUNC7(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \ @@ -682,7 +682,7 @@ #define FUNC7C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \ @@ -691,7 +691,7 @@ #define FUNC8R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, &ret); \ SYNC_DEBUG \ @@ -703,7 +703,7 @@ #define FUNC8RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \ virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ m_r ret; \ command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, &ret); \ SYNC_DEBUG \ @@ -715,7 +715,7 @@ #define FUNC8S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \ @@ -724,7 +724,7 @@ #define FUNC8SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \ @@ -733,7 +733,7 @@ #define FUNC8(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \ @@ -742,7 +742,7 @@ #define FUNC8C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) const { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \ @@ -751,7 +751,7 @@ #define FUNC9(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9); \ @@ -760,7 +760,7 @@ #define FUNC10(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); \ @@ -769,7 +769,7 @@ #define FUNC11(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11) \ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11) { \ - if (Thread::get_caller_ID() != server_thread) { \ + if (Thread::get_caller_id() != server_thread) { \ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); \ } else { \ server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); \ diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 9c264ead49..9405f6e012 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -1014,6 +1014,8 @@ public: virtual void reset_canvas() = 0; + virtual void draw_window_margins(int *p_margins, RID *p_margin_textures) = 0; + virtual ~RasterizerCanvas() {} }; diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index 3de0841f2a..3f1403d532 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -109,6 +109,7 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["SCREEN_UV"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["POINT_COORD"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["SIDE"] = ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ALPHA_SCISSOR"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["WORLD_MATRIX"] = ShaderLanguage::TYPE_MAT4; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["INV_CAMERA_MATRIX"] = ShaderLanguage::TYPE_MAT4; diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index f17411f11a..cc4fe0809d 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -41,23 +41,29 @@ int VisualServerRaster::changes = 0; -/* CURSOR */ -void VisualServerRaster::cursor_set_rotation(float p_rotation, int p_cursor) { -} -void VisualServerRaster::cursor_set_texture(RID p_texture, const Point2 &p_center_offset, int p_cursor, const Rect2 &p_region) { -} -void VisualServerRaster::cursor_set_visible(bool p_visible, int p_cursor) { -} -void VisualServerRaster::cursor_set_pos(const Point2 &p_pos, int p_cursor) { -} - /* BLACK BARS */ void VisualServerRaster::black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom) { + + black_margin[MARGIN_LEFT] = p_left; + black_margin[MARGIN_TOP] = p_top; + black_margin[MARGIN_RIGHT] = p_right; + black_margin[MARGIN_BOTTOM] = p_bottom; } + void VisualServerRaster::black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom) { + + black_image[MARGIN_LEFT] = p_left; + black_image[MARGIN_TOP] = p_top; + black_image[MARGIN_RIGHT] = p_right; + black_image[MARGIN_BOTTOM] = p_bottom; } +void VisualServerRaster::_draw_margins() { + + VSG::canvas_render->draw_window_margins(black_margin, black_image); +}; + /* FREE */ void VisualServerRaster::free(RID p_rid) { @@ -78,7 +84,7 @@ void VisualServerRaster::request_frame_drawn_callback(Object *p_where, const Str ERR_FAIL_NULL(p_where); FrameDrawnCallbacks fdc; - fdc.object = p_where->get_instance_ID(); + fdc.object = p_where->get_instance_id(); fdc.method = p_method; fdc.param = p_userdata; @@ -121,6 +127,8 @@ void VisualServerRaster::draw() { frame_drawn_callbacks.pop_front(); } + + _draw_margins(); } void VisualServerRaster::sync() { } @@ -189,6 +197,9 @@ VisualServerRaster::VisualServerRaster() { VSG::storage = VSG::rasterizer->get_storage(); VSG::canvas_render = VSG::rasterizer->get_canvas(); VSG::scene_render = VSG::rasterizer->get_scene(); + + for (int i = 0; i < 4; i++) + black_margin[i] = 0; } VisualServerRaster::~VisualServerRaster() { @@ -2626,14 +2637,14 @@ AABB VisualServerRaster::instance_get_base_aabb(RID p_instance) const { } -void VisualServerRaster::instance_attach_object_instance_ID(RID p_instance,uint32_t p_ID) { +void VisualServerRaster::instance_attach_object_instance_id(RID p_instance,uint32_t p_ID) { VS_CHANGED; Instance *instance = instance_owner.get( p_instance ); ERR_FAIL_COND( !instance ); instance->object_ID=p_ID; } -uint32_t VisualServerRaster::instance_get_object_instance_ID(RID p_instance) const { +uint32_t VisualServerRaster::instance_get_object_instance_id(RID p_instance) const { Instance *instance = instance_owner.get( p_instance ); ERR_FAIL_COND_V( !instance, 0 ); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index b13bb904ab..596dd5c10e 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -61,6 +61,9 @@ class VisualServerRaster : public VisualServer { bool draw_extra_frame; RID test_cube; + int black_margin[4]; + RID black_image[4]; + struct FrameDrawnCallbacks { ObjectID object; @@ -584,6 +587,8 @@ class VisualServerRaster : public VisualServer { #endif + void _draw_margins(); + public: _FORCE_INLINE_ static void redraw_request() { changes++; } @@ -998,7 +1003,7 @@ public: BIND2(instance_set_scenario, RID, RID) // from can be mesh, light, poly, area and portal so far. BIND2(instance_set_layer_mask, RID, uint32_t) BIND2(instance_set_transform, RID, const Transform &) - BIND2(instance_attach_object_instance_ID, RID, ObjectID) + BIND2(instance_attach_object_instance_id, RID, ObjectID) BIND3(instance_set_blend_shape_weight, RID, int, float) BIND3(instance_set_surface_material, RID, int, RID) BIND2(instance_set_visible, RID, bool) @@ -1110,12 +1115,6 @@ public: BIND2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode) - /* CURSOR */ - virtual void cursor_set_rotation(float p_rotation, int p_cursor = 0); // radians - virtual void cursor_set_texture(RID p_texture, const Point2 &p_center_offset = Point2(0, 0), int p_cursor = 0, const Rect2 &p_region = Rect2()); - virtual void cursor_set_visible(bool p_visible, int p_cursor = 0); - virtual void cursor_set_pos(const Point2 &p_pos, int p_cursor = 0); - /* BLACK BARS */ virtual void black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom); diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 87431a2ce4..11a9c8c9c1 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -797,7 +797,7 @@ void VisualServerScene::instance_set_transform(RID p_instance, const Transform & instance->transform = p_transform; _instance_queue_update(instance, true); } -void VisualServerScene::instance_attach_object_instance_ID(RID p_instance, ObjectID p_ID) { +void VisualServerScene::instance_attach_object_instance_id(RID p_instance, ObjectID p_ID) { Instance *instance = instance_owner.get(p_instance); ERR_FAIL_COND(!instance); @@ -880,13 +880,13 @@ void VisualServerScene::instance_attach_skeleton(RID p_instance, RID p_skeleton) return; if (instance->skeleton.is_valid()) { - VSG::storage->instance_remove_skeleton(p_skeleton, instance); + VSG::storage->instance_remove_skeleton(instance->skeleton, instance); } instance->skeleton = p_skeleton; if (instance->skeleton.is_valid()) { - VSG::storage->instance_add_skeleton(p_skeleton, instance); + VSG::storage->instance_add_skeleton(instance->skeleton, instance); } _instance_queue_update(instance, true); diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 17b95946b3..a4895382a4 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -489,7 +489,7 @@ public: virtual void instance_set_scenario(RID p_instance, RID p_scenario); // from can be mesh, light, poly, area and portal so far. 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_attach_object_instance_id(RID p_instance, ObjectID p_ID); 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_wrap_mt.cpp b/servers/visual/visual_server_wrap_mt.cpp index 525e3dc2f9..827f47a16e 100644 --- a/servers/visual/visual_server_wrap_mt.cpp +++ b/servers/visual/visual_server_wrap_mt.cpp @@ -68,7 +68,7 @@ void VisualServerWrapMT::_thread_callback(void *_instance) { void VisualServerWrapMT::thread_loop() { - server_thread = Thread::get_caller_ID(); + server_thread = Thread::get_caller_id(); OS::get_singleton()->make_rendering_thread(); @@ -179,7 +179,7 @@ VisualServerWrapMT::VisualServerWrapMT(VisualServer *p_contained, bool p_create_ pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc"); if (!p_create_thread) { - server_thread = Thread::get_caller_ID(); + server_thread = Thread::get_caller_id(); } else { server_thread = 0; } diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index e6ce3f6a54..20223f9651 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -430,7 +430,7 @@ public: FUNC2(instance_set_scenario, RID, RID) // from can be mesh, light, poly, area and portal so far. FUNC2(instance_set_layer_mask, RID, uint32_t) FUNC2(instance_set_transform, RID, const Transform &) - FUNC2(instance_attach_object_instance_ID, RID, ObjectID) + FUNC2(instance_attach_object_instance_id, RID, ObjectID) FUNC3(instance_set_blend_shape_weight, RID, int, float) FUNC3(instance_set_surface_material, RID, int, RID) FUNC2(instance_set_visible, RID, bool) @@ -538,12 +538,6 @@ public: FUNC2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode) - /* CURSOR */ - FUNC2(cursor_set_rotation, float, int) // radians - FUNC4(cursor_set_texture, RID, const Point2 &, int, const Rect2 &) - FUNC2(cursor_set_visible, bool, int) - FUNC2(cursor_set_pos, const Point2 &, int) - /* BLACK BARS */ FUNC4(black_bars_set_margins, int, int, int, int) diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 307f4107eb..65dd4d7661 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -136,11 +136,6 @@ void VisualServer::_free_internal_rids() { free(white_texture); if (test_material.is_valid()) free(test_material); - - for (int i = 0; i < 32; i++) { - if (material_2d[i].is_valid()) - free(material_2d[i]); - } } RID VisualServer::_make_test_cube() { @@ -284,37 +279,6 @@ RID VisualServer::make_sphere_mesh(int p_lats, int p_lons, float p_radius) { return mesh; } -RID VisualServer::material_2d_get(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass) { - - int version = 0; - if (p_shaded) - version = 1; - if (p_transparent) - version |= 2; - if (p_cut_alpha) - version |= 4; - if (p_opaque_prepass) - version |= 8; - if (p_double_sided) - version |= 16; - if (material_2d[version].is_valid()) - return material_2d[version]; - - //not valid, make - - /* material_2d[version]=fixed_material_create(); - fixed_material_set_flag(material_2d[version],FIXED_MATERIAL_FLAG_USE_ALPHA,p_transparent); - fixed_material_set_flag(material_2d[version],FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true); - fixed_material_set_flag(material_2d[version],FIXED_MATERIAL_FLAG_DISCARD_ALPHA,p_cut_alpha); - material_set_flag(material_2d[version],MATERIAL_FLAG_UNSHADED,!p_shaded); - material_set_flag(material_2d[version], MATERIAL_FLAG_DOUBLE_SIDED, p_double_sided); - material_set_depth_draw_mode(material_2d[version],p_opaque_prepass?MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA:MATERIAL_DEPTH_DRAW_OPAQUE_ONLY); - fixed_material_set_texture(material_2d[version],FIXED_MATERIAL_PARAM_DIFFUSE,get_white_texture()); - //material cut alpha?*/ - - return material_2d[version]; -} - RID VisualServer::get_white_texture() { if (white_texture.is_valid()) @@ -1475,12 +1439,12 @@ Array VisualServer::mesh_surface_get_arrays(RID p_mesh, int p_surface) const { void VisualServer::_bind_methods() { ClassDB::bind_method(D_METHOD("texture_create"), &VisualServer::texture_create); - ClassDB::bind_method(D_METHOD("texture_create_from_image", "image:Image", "flags"), &VisualServer::texture_create_from_image, DEFVAL(TEXTURE_FLAGS_DEFAULT)); + ClassDB::bind_method(D_METHOD("texture_create_from_image", "image", "flags"), &VisualServer::texture_create_from_image, DEFVAL(TEXTURE_FLAGS_DEFAULT)); //ClassDB::bind_method(D_METHOD("texture_allocate"),&VisualServer::texture_allocate,DEFVAL( TEXTURE_FLAGS_DEFAULT ) ); //ClassDB::bind_method(D_METHOD("texture_set_data"),&VisualServer::texture_blit_rect,DEFVAL( CUBEMAP_LEFT ) ); //ClassDB::bind_method(D_METHOD("texture_get_rect"),&VisualServer::texture_get_rect ); - ClassDB::bind_method(D_METHOD("texture_set_flags", "texture"), &VisualServer::texture_set_flags); - ClassDB::bind_method(D_METHOD("texture_get_flags", "texture", "flags"), &VisualServer::texture_get_flags); + ClassDB::bind_method(D_METHOD("texture_set_flags", "texture", "flags"), &VisualServer::texture_set_flags); + ClassDB::bind_method(D_METHOD("texture_get_flags", "texture"), &VisualServer::texture_get_flags); ClassDB::bind_method(D_METHOD("texture_get_width", "texture"), &VisualServer::texture_get_width); ClassDB::bind_method(D_METHOD("texture_get_height", "texture"), &VisualServer::texture_get_height); diff --git a/servers/visual_server.h b/servers/visual_server.h index 5c9f4202f9..ddf32a9ea1 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -60,7 +60,6 @@ protected: RID test_texture; RID white_texture; RID test_material; - RID material_2d[32]; Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, Rect3 &r_aabb, Vector<Rect3> r_bone_aabb); @@ -727,7 +726,7 @@ public: virtual void instance_set_scenario(RID p_instance, RID p_scenario) = 0; // from can be mesh, light, poly, area and portal so far. 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_attach_object_instance_id(RID p_instance, ObjectID p_ID) = 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; @@ -875,12 +874,6 @@ public: }; virtual void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, CanvasOccluderPolygonCullMode p_mode) = 0; - /* CURSOR */ - virtual void cursor_set_rotation(float p_rotation, int p_cursor = 0) = 0; // radians - virtual void cursor_set_texture(RID p_texture, const Point2 &p_center_offset = Point2(0, 0), int p_cursor = 0, const Rect2 &p_region = Rect2()) = 0; - virtual void cursor_set_visible(bool p_visible, int p_cursor = 0) = 0; - virtual void cursor_set_pos(const Point2 &p_pos, int p_cursor = 0) = 0; - /* BLACK BARS */ virtual void black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom) = 0; @@ -920,8 +913,6 @@ public: /* Materials for 2D on 3D */ - RID material_2d_get(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass); - /* TESTING */ virtual RID get_test_cube() = 0; |