summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/doc_tools.cpp515
-rw-r--r--editor/editor_help.cpp15
-rw-r--r--editor/editor_properties.cpp15
-rw-r--r--editor/editor_properties.h3
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp35
-rw-r--r--editor/plugins/sprite_2d_editor_plugin.cpp5
-rw-r--r--editor/project_converter_3_to_4.cpp71
-rw-r--r--editor/scene_tree_editor.cpp9
8 files changed, 366 insertions, 302 deletions
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index a819458417..864871bb7e 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -337,311 +337,318 @@ static Variant get_documentation_default_value(const StringName &p_class_name, c
}
void DocTools::generate(bool p_basic_types) {
- List<StringName> classes;
- ClassDB::get_class_list(&classes);
- classes.sort_custom<StringName::AlphCompare>();
- // Move ProjectSettings, so that other classes can register properties there.
- classes.move_to_back(classes.find("ProjectSettings"));
-
- bool skip_setter_getter_methods = true;
-
- while (classes.size()) {
- HashSet<StringName> setters_getters;
-
- String name = classes.front()->get();
- if (!ClassDB::is_class_exposed(name)) {
- print_verbose(vformat("Class '%s' is not exposed, skipping.", name));
- classes.pop_front();
- continue;
- }
-
- String cname = name;
-
- class_list[cname] = DocData::ClassDoc();
- DocData::ClassDoc &c = class_list[cname];
- c.name = cname;
- c.inherits = ClassDB::get_parent_class(name);
+ // Add ClassDB-exposed classes.
+ {
+ List<StringName> classes;
+ ClassDB::get_class_list(&classes);
+ classes.sort_custom<StringName::AlphCompare>();
+ // Move ProjectSettings, so that other classes can register properties there.
+ classes.move_to_back(classes.find("ProjectSettings"));
+
+ bool skip_setter_getter_methods = true;
+
+ // Populate documentation data for each exposed class.
+ while (classes.size()) {
+ String name = classes.front()->get();
+ if (!ClassDB::is_class_exposed(name)) {
+ print_verbose(vformat("Class '%s' is not exposed, skipping.", name));
+ classes.pop_front();
+ continue;
+ }
- List<PropertyInfo> properties;
- List<PropertyInfo> own_properties;
-
- // Special case for editor and project settings, so they can be documented.
- if (name == "EditorSettings") {
- // We don't create the full blown EditorSettings (+ config file) with `create()`,
- // instead we just make a local instance to get default values.
- Ref<EditorSettings> edset = memnew(EditorSettings);
- edset->get_property_list(&properties);
- own_properties = properties;
- } else if (name == "ProjectSettings") {
- ProjectSettings::get_singleton()->get_property_list(&properties);
- own_properties = properties;
- } else {
- ClassDB::get_property_list(name, &properties);
- ClassDB::get_property_list(name, &own_properties, true);
- }
+ String cname = name;
+ // Property setters and getters do not get exposed as individual methods.
+ HashSet<StringName> setters_getters;
- properties.sort();
- own_properties.sort();
+ class_list[cname] = DocData::ClassDoc();
+ DocData::ClassDoc &c = class_list[cname];
+ c.name = cname;
+ c.inherits = ClassDB::get_parent_class(name);
- List<PropertyInfo>::Element *EO = own_properties.front();
- for (const PropertyInfo &E : properties) {
- bool inherited = true;
- if (EO && EO->get() == E) {
- inherited = false;
- EO = EO->next();
- }
+ List<PropertyInfo> properties;
+ List<PropertyInfo> own_properties;
- if (E.usage & PROPERTY_USAGE_GROUP || E.usage & PROPERTY_USAGE_SUBGROUP || E.usage & PROPERTY_USAGE_CATEGORY || E.usage & PROPERTY_USAGE_INTERNAL || (E.type == Variant::NIL && E.usage & PROPERTY_USAGE_ARRAY)) {
- continue;
+ // Special case for editor and project settings, so they can be documented.
+ if (name == "EditorSettings") {
+ // We don't create the full blown EditorSettings (+ config file) with `create()`,
+ // instead we just make a local instance to get default values.
+ Ref<EditorSettings> edset = memnew(EditorSettings);
+ edset->get_property_list(&properties);
+ own_properties = properties;
+ } else if (name == "ProjectSettings") {
+ ProjectSettings::get_singleton()->get_property_list(&properties);
+ own_properties = properties;
+ } else {
+ ClassDB::get_property_list(name, &properties);
+ ClassDB::get_property_list(name, &own_properties, true);
}
- DocData::PropertyDoc prop;
- prop.name = E.name;
- prop.overridden = inherited;
+ properties.sort();
+ own_properties.sort();
- if (inherited) {
- String parent = ClassDB::get_parent_class(c.name);
- while (!ClassDB::has_property(parent, prop.name, true)) {
- parent = ClassDB::get_parent_class(parent);
+ List<PropertyInfo>::Element *EO = own_properties.front();
+ for (const PropertyInfo &E : properties) {
+ bool inherited = true;
+ if (EO && EO->get() == E) {
+ inherited = false;
+ EO = EO->next();
}
- prop.overrides = parent;
- }
-
- bool default_value_valid = false;
- Variant default_value;
- if (name == "EditorSettings") {
- if (E.name == "resource_local_to_scene" || E.name == "resource_name" || E.name == "resource_path" || E.name == "script") {
- // Don't include spurious properties in the generated EditorSettings class reference.
+ if (E.usage & PROPERTY_USAGE_GROUP || E.usage & PROPERTY_USAGE_SUBGROUP || E.usage & PROPERTY_USAGE_CATEGORY || E.usage & PROPERTY_USAGE_INTERNAL || (E.type == Variant::NIL && E.usage & PROPERTY_USAGE_ARRAY)) {
continue;
}
- }
- if (name == "ProjectSettings") {
- // Special case for project settings, so that settings are not taken from the current project's settings
- if (E.name == "script" || !ProjectSettings::get_singleton()->is_builtin_setting(E.name)) {
- continue;
- }
- if (E.usage & PROPERTY_USAGE_EDITOR) {
- if (!ProjectSettings::get_singleton()->get_ignore_value_in_docs(E.name)) {
- default_value = ProjectSettings::get_singleton()->property_get_revert(E.name);
- default_value_valid = true;
+ DocData::PropertyDoc prop;
+ prop.name = E.name;
+ prop.overridden = inherited;
+
+ if (inherited) {
+ String parent = ClassDB::get_parent_class(c.name);
+ while (!ClassDB::has_property(parent, prop.name, true)) {
+ parent = ClassDB::get_parent_class(parent);
}
+ prop.overrides = parent;
}
- } else {
- default_value = get_documentation_default_value(name, E.name, default_value_valid);
- if (inherited) {
- bool base_default_value_valid = false;
- Variant base_default_value = get_documentation_default_value(ClassDB::get_parent_class(name), E.name, base_default_value_valid);
- if (!default_value_valid || !base_default_value_valid || default_value == base_default_value) {
+
+ bool default_value_valid = false;
+ Variant default_value;
+
+ if (name == "EditorSettings") {
+ if (E.name == "resource_local_to_scene" || E.name == "resource_name" || E.name == "resource_path" || E.name == "script") {
+ // Don't include spurious properties in the generated EditorSettings class reference.
continue;
}
}
- }
- if (default_value_valid && default_value.get_type() != Variant::OBJECT) {
- prop.default_value = default_value.get_construct_string().replace("\n", " ");
- }
-
- StringName setter = ClassDB::get_property_setter(name, E.name);
- StringName getter = ClassDB::get_property_getter(name, E.name);
-
- prop.setter = setter;
- prop.getter = getter;
-
- bool found_type = false;
- if (getter != StringName()) {
- MethodBind *mb = ClassDB::get_method(name, getter);
- if (mb) {
- PropertyInfo retinfo = mb->get_return_info();
-
- found_type = true;
- if (retinfo.type == Variant::INT && retinfo.usage & (PROPERTY_USAGE_CLASS_IS_ENUM | PROPERTY_USAGE_CLASS_IS_BITFIELD)) {
- prop.enumeration = retinfo.class_name;
- prop.type = "int";
- } else if (retinfo.class_name != StringName()) {
- prop.type = retinfo.class_name;
- } else if (retinfo.type == Variant::ARRAY && retinfo.hint == PROPERTY_HINT_ARRAY_TYPE) {
- prop.type = retinfo.hint_string + "[]";
- } else if (retinfo.hint == PROPERTY_HINT_RESOURCE_TYPE) {
- prop.type = retinfo.hint_string;
- } else if (retinfo.type == Variant::NIL && retinfo.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {
- prop.type = "Variant";
- } else if (retinfo.type == Variant::NIL) {
- prop.type = "void";
- } else {
- prop.type = Variant::get_type_name(retinfo.type);
+ if (name == "ProjectSettings") {
+ // Special case for project settings, so that settings are not taken from the current project's settings
+ if (E.name == "script" || !ProjectSettings::get_singleton()->is_builtin_setting(E.name)) {
+ continue;
+ }
+ if (E.usage & PROPERTY_USAGE_EDITOR) {
+ if (!ProjectSettings::get_singleton()->get_ignore_value_in_docs(E.name)) {
+ default_value = ProjectSettings::get_singleton()->property_get_revert(E.name);
+ default_value_valid = true;
+ }
+ }
+ } else {
+ default_value = get_documentation_default_value(name, E.name, default_value_valid);
+ if (inherited) {
+ bool base_default_value_valid = false;
+ Variant base_default_value = get_documentation_default_value(ClassDB::get_parent_class(name), E.name, base_default_value_valid);
+ if (!default_value_valid || !base_default_value_valid || default_value == base_default_value) {
+ continue;
+ }
}
}
- setters_getters.insert(getter);
- }
+ if (default_value_valid && default_value.get_type() != Variant::OBJECT) {
+ prop.default_value = default_value.get_construct_string().replace("\n", " ");
+ }
- if (setter != StringName()) {
- setters_getters.insert(setter);
- }
+ StringName setter = ClassDB::get_property_setter(name, E.name);
+ StringName getter = ClassDB::get_property_getter(name, E.name);
+
+ prop.setter = setter;
+ prop.getter = getter;
+
+ bool found_type = false;
+ if (getter != StringName()) {
+ MethodBind *mb = ClassDB::get_method(name, getter);
+ if (mb) {
+ PropertyInfo retinfo = mb->get_return_info();
+
+ found_type = true;
+ if (retinfo.type == Variant::INT && retinfo.usage & (PROPERTY_USAGE_CLASS_IS_ENUM | PROPERTY_USAGE_CLASS_IS_BITFIELD)) {
+ prop.enumeration = retinfo.class_name;
+ prop.type = "int";
+ } else if (retinfo.class_name != StringName()) {
+ prop.type = retinfo.class_name;
+ } else if (retinfo.type == Variant::ARRAY && retinfo.hint == PROPERTY_HINT_ARRAY_TYPE) {
+ prop.type = retinfo.hint_string + "[]";
+ } else if (retinfo.hint == PROPERTY_HINT_RESOURCE_TYPE) {
+ prop.type = retinfo.hint_string;
+ } else if (retinfo.type == Variant::NIL && retinfo.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {
+ prop.type = "Variant";
+ } else if (retinfo.type == Variant::NIL) {
+ prop.type = "void";
+ } else {
+ prop.type = Variant::get_type_name(retinfo.type);
+ }
+ }
- if (!found_type) {
- if (E.type == Variant::OBJECT && E.hint == PROPERTY_HINT_RESOURCE_TYPE) {
- prop.type = E.hint_string;
- } else {
- prop.type = Variant::get_type_name(E.type);
+ setters_getters.insert(getter);
}
- }
- c.properties.push_back(prop);
- }
+ if (setter != StringName()) {
+ setters_getters.insert(setter);
+ }
- List<MethodInfo> method_list;
- ClassDB::get_method_list(name, &method_list, true);
- method_list.sort();
+ if (!found_type) {
+ if (E.type == Variant::OBJECT && E.hint == PROPERTY_HINT_RESOURCE_TYPE) {
+ prop.type = E.hint_string;
+ } else {
+ prop.type = Variant::get_type_name(E.type);
+ }
+ }
- for (const MethodInfo &E : method_list) {
- if (E.name.is_empty() || (E.name[0] == '_' && !(E.flags & METHOD_FLAG_VIRTUAL))) {
- continue; //hidden, don't count
+ c.properties.push_back(prop);
}
- if (skip_setter_getter_methods && setters_getters.has(E.name)) {
- // Don't skip parametric setters and getters, i.e. method which require
- // one or more parameters to define what property should be set or retrieved.
- // E.g. CPUParticles3D::set_param(Parameter param, float value).
- if (E.arguments.size() == 0 /* getter */ || (E.arguments.size() == 1 && E.return_val.type == Variant::NIL /* setter */)) {
- continue;
- }
- }
+ List<MethodInfo> method_list;
+ ClassDB::get_method_list(name, &method_list, true);
+ method_list.sort();
- DocData::MethodDoc method;
- DocData::method_doc_from_methodinfo(method, E, "");
+ for (const MethodInfo &E : method_list) {
+ if (E.name.is_empty() || (E.name[0] == '_' && !(E.flags & METHOD_FLAG_VIRTUAL))) {
+ continue; //hidden, don't count
+ }
- Vector<Error> errs = ClassDB::get_method_error_return_values(name, E.name);
- if (errs.size()) {
- if (!errs.has(OK)) {
- errs.insert(0, OK);
+ if (skip_setter_getter_methods && setters_getters.has(E.name)) {
+ // Don't skip parametric setters and getters, i.e. method which require
+ // one or more parameters to define what property should be set or retrieved.
+ // E.g. CPUParticles3D::set_param(Parameter param, float value).
+ if (E.arguments.size() == 0 /* getter */ || (E.arguments.size() == 1 && E.return_val.type == Variant::NIL /* setter */)) {
+ continue;
+ }
}
- for (int i = 0; i < errs.size(); i++) {
- if (!method.errors_returned.has(errs[i])) {
- method.errors_returned.push_back(errs[i]);
+
+ DocData::MethodDoc method;
+ DocData::method_doc_from_methodinfo(method, E, "");
+
+ Vector<Error> errs = ClassDB::get_method_error_return_values(name, E.name);
+ if (errs.size()) {
+ if (!errs.has(OK)) {
+ errs.insert(0, OK);
+ }
+ for (int i = 0; i < errs.size(); i++) {
+ if (!method.errors_returned.has(errs[i])) {
+ method.errors_returned.push_back(errs[i]);
+ }
}
}
+
+ c.methods.push_back(method);
}
- c.methods.push_back(method);
- }
+ List<MethodInfo> signal_list;
+ ClassDB::get_signal_list(name, &signal_list, true);
- List<MethodInfo> signal_list;
- ClassDB::get_signal_list(name, &signal_list, true);
+ if (signal_list.size()) {
+ for (List<MethodInfo>::Element *EV = signal_list.front(); EV; EV = EV->next()) {
+ DocData::MethodDoc signal;
+ signal.name = EV->get().name;
+ for (int i = 0; i < EV->get().arguments.size(); i++) {
+ const PropertyInfo &arginfo = EV->get().arguments[i];
+ DocData::ArgumentDoc argument;
+ DocData::argument_doc_from_arginfo(argument, arginfo);
- if (signal_list.size()) {
- for (List<MethodInfo>::Element *EV = signal_list.front(); EV; EV = EV->next()) {
- DocData::MethodDoc signal;
- signal.name = EV->get().name;
- for (int i = 0; i < EV->get().arguments.size(); i++) {
- const PropertyInfo &arginfo = EV->get().arguments[i];
- DocData::ArgumentDoc argument;
- DocData::argument_doc_from_arginfo(argument, arginfo);
+ signal.arguments.push_back(argument);
+ }
- signal.arguments.push_back(argument);
+ c.signals.push_back(signal);
}
-
- c.signals.push_back(signal);
}
- }
- List<String> constant_list;
- ClassDB::get_integer_constant_list(name, &constant_list, true);
+ List<String> constant_list;
+ ClassDB::get_integer_constant_list(name, &constant_list, true);
+
+ for (const String &E : constant_list) {
+ DocData::ConstantDoc constant;
+ constant.name = E;
+ constant.value = itos(ClassDB::get_integer_constant(name, E));
+ constant.is_value_valid = true;
+ constant.enumeration = ClassDB::get_integer_constant_enum(name, E);
+ constant.is_bitfield = ClassDB::is_enum_bitfield(name, constant.enumeration);
+ c.constants.push_back(constant);
+ }
- for (const String &E : constant_list) {
- DocData::ConstantDoc constant;
- constant.name = E;
- constant.value = itos(ClassDB::get_integer_constant(name, E));
- constant.is_value_valid = true;
- constant.enumeration = ClassDB::get_integer_constant_enum(name, E);
- constant.is_bitfield = ClassDB::is_enum_bitfield(name, constant.enumeration);
- c.constants.push_back(constant);
- }
+ // Theme items.
+ {
+ List<StringName> l;
+
+ Theme::get_default()->get_color_list(cname, &l);
+ for (const StringName &E : l) {
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "Color";
+ tid.data_type = "color";
+ tid.default_value = Variant(Theme::get_default()->get_color(E, cname)).get_construct_string().replace("\n", " ");
+ c.theme_properties.push_back(tid);
+ }
- // Theme items.
- {
- List<StringName> l;
-
- Theme::get_default()->get_color_list(cname, &l);
- for (const StringName &E : l) {
- DocData::ThemeItemDoc tid;
- tid.name = E;
- tid.type = "Color";
- tid.data_type = "color";
- tid.default_value = Variant(Theme::get_default()->get_color(E, cname)).get_construct_string().replace("\n", " ");
- c.theme_properties.push_back(tid);
- }
+ l.clear();
+ Theme::get_default()->get_constant_list(cname, &l);
+ for (const StringName &E : l) {
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "int";
+ tid.data_type = "constant";
+ tid.default_value = itos(Theme::get_default()->get_constant(E, cname));
+ c.theme_properties.push_back(tid);
+ }
- l.clear();
- Theme::get_default()->get_constant_list(cname, &l);
- for (const StringName &E : l) {
- DocData::ThemeItemDoc tid;
- tid.name = E;
- tid.type = "int";
- tid.data_type = "constant";
- tid.default_value = itos(Theme::get_default()->get_constant(E, cname));
- c.theme_properties.push_back(tid);
- }
+ l.clear();
+ Theme::get_default()->get_font_list(cname, &l);
+ for (const StringName &E : l) {
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "Font";
+ tid.data_type = "font";
+ c.theme_properties.push_back(tid);
+ }
- l.clear();
- Theme::get_default()->get_font_list(cname, &l);
- for (const StringName &E : l) {
- DocData::ThemeItemDoc tid;
- tid.name = E;
- tid.type = "Font";
- tid.data_type = "font";
- c.theme_properties.push_back(tid);
- }
+ l.clear();
+ Theme::get_default()->get_font_size_list(cname, &l);
+ for (const StringName &E : l) {
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "int";
+ tid.data_type = "font_size";
+ c.theme_properties.push_back(tid);
+ }
- l.clear();
- Theme::get_default()->get_font_size_list(cname, &l);
- for (const StringName &E : l) {
- DocData::ThemeItemDoc tid;
- tid.name = E;
- tid.type = "int";
- tid.data_type = "font_size";
- c.theme_properties.push_back(tid);
- }
+ l.clear();
+ Theme::get_default()->get_icon_list(cname, &l);
+ for (const StringName &E : l) {
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "Texture2D";
+ tid.data_type = "icon";
+ c.theme_properties.push_back(tid);
+ }
- l.clear();
- Theme::get_default()->get_icon_list(cname, &l);
- for (const StringName &E : l) {
- DocData::ThemeItemDoc tid;
- tid.name = E;
- tid.type = "Texture2D";
- tid.data_type = "icon";
- c.theme_properties.push_back(tid);
- }
+ l.clear();
+ Theme::get_default()->get_stylebox_list(cname, &l);
+ for (const StringName &E : l) {
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "StyleBox";
+ tid.data_type = "style";
+ c.theme_properties.push_back(tid);
+ }
- l.clear();
- Theme::get_default()->get_stylebox_list(cname, &l);
- for (const StringName &E : l) {
- DocData::ThemeItemDoc tid;
- tid.name = E;
- tid.type = "StyleBox";
- tid.data_type = "style";
- c.theme_properties.push_back(tid);
+ c.theme_properties.sort();
}
- c.theme_properties.sort();
+ classes.pop_front();
}
-
- classes.pop_front();
}
+ // Add a dummy Variant entry.
{
- // So we can document the concept of Variant even if it's not a usable class per se.
+ // This allows us to document the concept of Variant even though
+ // it's not a ClassDB-exposed class.
class_list["Variant"] = DocData::ClassDoc();
class_list["Variant"].name = "Variant";
}
+ // If we don't want to populate basic types, break here.
if (!p_basic_types) {
return;
}
- // Add Variant types.
+ // Add Variant data types.
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
if (i == Variant::NIL) {
continue; // Not exposed outside of 'null', should not be in class list.
@@ -809,14 +816,14 @@ void DocTools::generate(bool p_basic_types) {
}
}
- //built in constants and functions
-
+ // Add global API (servers, engine singletons, global constants) and Variant utility functions.
{
String cname = "@GlobalScope";
class_list[cname] = DocData::ClassDoc();
DocData::ClassDoc &c = class_list[cname];
c.name = cname;
+ // Global constants.
for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
DocData::ConstantDoc cd;
cd.name = CoreConstants::get_global_constant_name(i);
@@ -830,10 +837,11 @@ void DocTools::generate(bool p_basic_types) {
c.constants.push_back(cd);
}
+ // Servers/engine singletons.
List<Engine::Singleton> singletons;
Engine::get_singleton()->get_singletons(&singletons);
- //servers (this is kind of hackish)
+ // FIXME: this is kind of hackish...
for (const Engine::Singleton &s : singletons) {
DocData::PropertyDoc pd;
if (!s.ptr) {
@@ -847,13 +855,14 @@ void DocTools::generate(bool p_basic_types) {
c.properties.push_back(pd);
}
+ // Variant utility functions.
List<StringName> utility_functions;
Variant::get_utility_function_list(&utility_functions);
utility_functions.sort_custom<StringName::AlphCompare>();
for (const StringName &E : utility_functions) {
DocData::MethodDoc md;
md.name = E;
- //return
+ // Utility function's return type.
if (Variant::has_utility_function_return_value(E)) {
PropertyInfo pi;
pi.type = Variant::get_utility_function_return_type(E);
@@ -865,6 +874,7 @@ void DocTools::generate(bool p_basic_types) {
md.return_type = ad.type;
}
+ // Utility function's arguments.
if (Variant::is_utility_function_vararg(E)) {
md.qualifiers = "vararg";
} else {
@@ -885,11 +895,10 @@ void DocTools::generate(bool p_basic_types) {
}
}
- // Built-in script reference.
- // We only add a doc entry for languages which actually define any built-in
- // methods or constants.
-
+ // Add scripting language built-ins.
{
+ // We only add a doc entry for languages which actually define any built-in
+ // methods, constants, or annotations.
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
ScriptLanguage *lang = ScriptServer::get_language(i);
String cname = "@" + lang->get_name();
@@ -1010,7 +1019,7 @@ static Error _parse_methods(Ref<XMLParser> &parser, Vector<DocData::MethodDoc> &
} else if (name == "returns_error") {
ERR_FAIL_COND_V(!parser->has_attribute("number"), ERR_FILE_CORRUPT);
method.errors_returned.push_back(parser->get_attribute_value("number").to_int());
- } else if (name == "argument") {
+ } else if (name == "param") {
DocData::ArgumentDoc argument;
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
argument.name = parser->get_attribute_value("name");
@@ -1341,9 +1350,9 @@ static void _write_method_doc(Ref<FileAccess> f, const String &p_name, Vector<Do
}
if (!a.default_value.is_empty()) {
- _write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " default=\"" + a.default_value.xml_escape(true) + "\" />");
+ _write_string(f, 3, "<param index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " default=\"" + a.default_value.xml_escape(true) + "\" />");
} else {
- _write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " />");
+ _write_string(f, 3, "<param index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " />");
}
}
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 5c3038c468..8d58469684 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1803,6 +1803,21 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
p_rt->pop();
pos = brk_end + 1;
+ } else if (tag.begins_with("param ")) {
+ const int tag_end = tag.find(" ");
+ const String param_name = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
+
+ // Use monospace font with translucent background color to make code easier to distinguish from other text.
+ p_rt->push_font(doc_code_font);
+ p_rt->push_bgcolor(Color(0.5, 0.5, 0.5, 0.15));
+ p_rt->push_color(code_color);
+ p_rt->add_text(param_name);
+ p_rt->pop();
+ p_rt->pop();
+ p_rt->pop();
+
+ pos = brk_end + 1;
+
} else if (doc->class_list.has(tag)) {
// Class reference tag such as [Node2D] or [SceneTree].
// Use monospace font with translucent colored background color to make clickable references
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 5e66d436fc..f434df3a1e 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1147,6 +1147,17 @@ void EditorPropertyLayersGrid::_bind_methods() {
ADD_SIGNAL(MethodInfo("rename_confirmed", PropertyInfo(Variant::INT, "layer_id"), PropertyInfo(Variant::STRING, "new_name")));
}
+void EditorPropertyLayers::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
+ button->set_normal_texture(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
+ button->set_pressed_texture(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
+ button->set_disabled_texture(get_theme_icon(SNAME("GuiTabMenu"), SNAME("EditorIcons")));
+ } break;
+ }
+}
+
void EditorPropertyLayers::_set_read_only(bool p_read_only) {
button->set_disabled(p_read_only);
grid->set_read_only(p_read_only);
@@ -1283,9 +1294,9 @@ EditorPropertyLayers::EditorPropertyLayers() {
grid->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(grid);
- button = memnew(Button);
+ button = memnew(TextureButton);
+ button->set_stretch_mode(TextureButton::STRETCH_KEEP_CENTERED);
button->set_toggle_mode(true);
- button->set_text("...");
button->connect("pressed", callable_mp(this, &EditorPropertyLayers::_button_pressed));
hb->add_child(button);
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index 5c73a53184..c1dfb5cb1e 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -342,13 +342,14 @@ private:
String basename;
LayerType layer_type;
PopupMenu *layers = nullptr;
- Button *button = nullptr;
+ TextureButton *button = nullptr;
void _button_pressed();
void _menu_pressed(int p_menu);
void _refresh_names();
protected:
+ void _notification(int p_what);
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index 0070226d40..e8f143a637 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -4839,6 +4839,10 @@ void CollisionPolygon3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
////
NavigationRegion3DGizmoPlugin::NavigationRegion3DGizmoPlugin() {
+ create_material("face_material", NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_color(), false, false, true);
+ create_material("face_material_disabled", NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_disabled_color(), false, false, true);
+ create_material("edge_material", NavigationServer3D::get_singleton()->get_debug_navigation_geometry_edge_color());
+ create_material("edge_material_disabled", NavigationServer3D::get_singleton()->get_debug_navigation_geometry_edge_disabled_color());
}
bool NavigationRegion3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
@@ -4924,6 +4928,7 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
tmesh->create(tmeshfaces);
p_gizmo->add_collision_triangles(tmesh);
+ p_gizmo->add_collision_segments(lines);
Ref<ArrayMesh> debug_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
int polygon_count = navigationmesh->get_polygon_count();
@@ -4945,6 +4950,7 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
face_mesh_array[Mesh::ARRAY_VERTEX] = face_vertex_array;
// if enabled add vertex colors to colorize each face individually
+ RandomPCG rand;
bool enabled_geometry_face_random_color = NavigationServer3D::get_singleton()->get_debug_navigation_enable_geometry_face_random_color();
if (enabled_geometry_face_random_color) {
Color debug_navigation_geometry_face_color = NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_color();
@@ -4954,7 +4960,9 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
face_color_array.resize(polygon_count * 3);
for (int i = 0; i < polygon_count; i++) {
- polygon_color = debug_navigation_geometry_face_color * (Color(Math::randf(), Math::randf(), Math::randf()));
+ // Generate the polygon color, slightly randomly modified from the settings one.
+ polygon_color.set_hsv(debug_navigation_geometry_face_color.get_h() + rand.random(-1.0, 1.0) * 0.1, debug_navigation_geometry_face_color.get_s(), debug_navigation_geometry_face_color.get_v() + rand.random(-1.0, 1.0) * 0.2);
+ polygon_color.a = debug_navigation_geometry_face_color.a;
Vector<int> polygon = navigationmesh->get_polygon(i);
@@ -4966,12 +4974,10 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
}
debug_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, face_mesh_array);
- Ref<StandardMaterial3D> debug_geometry_face_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_face_material();
- debug_mesh->surface_set_material(0, debug_geometry_face_material);
+ p_gizmo->add_mesh(debug_mesh, navigationregion->is_enabled() ? get_material("face_material", p_gizmo) : get_material("face_material_disabled", p_gizmo));
// if enabled build geometry edge line surface
bool enabled_edge_lines = NavigationServer3D::get_singleton()->get_debug_navigation_enable_edge_lines();
-
if (enabled_edge_lines) {
Vector<Vector3> line_vertex_array;
line_vertex_array.resize(polygon_count * 6);
@@ -4987,27 +4993,8 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
line_vertex_array.push_back(vertices[polygon[0]]);
}
- Array line_mesh_array;
- line_mesh_array.resize(Mesh::ARRAY_MAX);
- line_mesh_array[Mesh::ARRAY_VERTEX] = line_vertex_array;
- debug_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES, line_mesh_array);
- Ref<StandardMaterial3D> debug_geometry_edge_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_edge_material();
- debug_mesh->surface_set_material(1, debug_geometry_edge_material);
+ p_gizmo->add_lines(line_vertex_array, navigationregion->is_enabled() ? get_material("edge_material", p_gizmo) : get_material("edge_material_disabled", p_gizmo));
}
-
- if (!navigationregion->is_enabled()) {
- if (debug_mesh.is_valid()) {
- if (debug_mesh->get_surface_count() > 0) {
- debug_mesh->surface_set_material(0, NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_face_disabled_material());
- }
- if (debug_mesh->get_surface_count() > 1) {
- debug_mesh->surface_set_material(1, NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_edge_disabled_material());
- }
- }
- }
-
- p_gizmo->add_mesh(debug_mesh);
- p_gizmo->add_collision_segments(lines);
}
//////
diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp
index 3323d865c2..7d350fd46f 100644
--- a/editor/plugins/sprite_2d_editor_plugin.cpp
+++ b/editor/plugins/sprite_2d_editor_plugin.cpp
@@ -160,6 +160,11 @@ void Sprite2DEditor::_menu_option(int p_option) {
}
void Sprite2DEditor::_update_mesh_data() {
+ if (node->get_owner() != get_tree()->get_edited_scene_root()) {
+ err_dialog->set_text(TTR("Can't convert a Sprite2D from a foreign scene."));
+ err_dialog->popup_centered();
+ }
+
Ref<Texture2D> texture = node->get_texture();
if (texture.is_null()) {
err_dialog->set_text(TTR("Sprite2D is empty!"));
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp
index 421e56f9a1..6c544e4437 100644
--- a/editor/project_converter_3_to_4.cpp
+++ b/editor/project_converter_3_to_4.cpp
@@ -358,6 +358,7 @@ static const char *gdscript_function_renames[][2] = {
{ "get_scancode_with_modifiers", "get_keycode_with_modifiers" }, // InputEventKey
{ "get_shift", "is_shift_pressed" }, // InputEventWithModifiers
{ "get_size_override", "get_size_2d_override" }, // SubViewport
+ { "get_slide_count", "get_slide_collision_count" }, // CharacterBody2D, CharacterBody3D
{ "get_slips_on_slope", "get_slide_on_slope" }, // SeparationRayShape2D, SeparationRayShape3D
{ "get_space_override_mode", "get_gravity_space_override_mode" }, // Area2D
{ "get_speed", "get_velocity" }, // InputEventMouseMotion
@@ -2024,8 +2025,8 @@ bool ProjectConverter3To4::test_conversion(const RegExContainer &reg_container)
valid = valid & test_conversion_single_additional_builtin("OS.window_fullscreen = Settings.fullscreen", "ProjectSettings.set(\\\"display/window/size/fullscreen\\\", Settings.fullscreen)", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, true);
valid = valid & test_conversion_single_additional_builtin("OS.get_window_safe_area()", "DisplayServer.get_display_safe_area()", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
- valid = valid & test_conversion_single_additional_builtin("\tvar aa = roman(r.move_and_slide( a, b, c, d, e, f )) # Roman", "\tr.set_motion_velocity(a)\n\tr.set_up_direction(b)\n\tr.set_floor_stop_on_slope_enabled(c)\n\tr.set_max_slides(d)\n\tr.set_floor_max_angle(e)\n\t# TODOConverter40 infinite_inertia were removed in Godot 4.0 - previous value `f`\n\tvar aa = roman(r.move_and_slide()) # Roman", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
- valid = valid & test_conversion_single_additional_builtin("\tvar aa = roman(r.move_and_slide_with_snap( a, g, b, c, d, e, f )) # Roman", "\tr.set_motion_velocity(a)\n\t# TODOConverter40 looks that snap in Godot 4.0 is float, not vector like in Godot 3 - previous value `g`\n\tr.set_up_direction(b)\n\tr.set_floor_stop_on_slope_enabled(c)\n\tr.set_max_slides(d)\n\tr.set_floor_max_angle(e)\n\t# TODOConverter40 infinite_inertia were removed in Godot 4.0 - previous value `f`\n\tvar aa = roman(r.move_and_slide()) # Roman", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid & test_conversion_single_additional_builtin("\tvar aa = roman(r.move_and_slide( a, b, c, d, e, f )) # Roman", "\tr.set_velocity(a)\n\tr.set_up_direction(b)\n\tr.set_floor_stop_on_slope_enabled(c)\n\tr.set_max_slides(d)\n\tr.set_floor_max_angle(e)\n\t# TODOConverter40 infinite_inertia were removed in Godot 4.0 - previous value `f`\n\tr.move_and_slide()\n\tvar aa = roman(r.velocity) # Roman", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid & test_conversion_single_additional_builtin("\tvar aa = roman(r.move_and_slide_with_snap( a, g, b, c, d, e, f )) # Roman", "\tr.set_velocity(a)\n\t# TODOConverter40 looks that snap in Godot 4.0 is float, not vector like in Godot 3 - previous value `g`\n\tr.set_up_direction(b)\n\tr.set_floor_stop_on_slope_enabled(c)\n\tr.set_max_slides(d)\n\tr.set_floor_max_angle(e)\n\t# TODOConverter40 infinite_inertia were removed in Godot 4.0 - previous value `f`\n\tr.move_and_slide()\n\tvar aa = roman(r.velocity) # Roman", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid & test_conversion_single_additional_builtin("list_dir_begin( a , b )", "list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid & test_conversion_single_additional_builtin("list_dir_begin( a )", "list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
@@ -2071,7 +2072,7 @@ bool ProjectConverter3To4::test_conversion(const RegExContainer &reg_container)
valid = valid & test_conversion_single_additional_builtin("get_node(@", "get_node(", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid & test_conversion_single_additional_builtin("yield(this, \"timeout\")", "await this.timeout", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
- valid = valid & test_conversion_single_additional_builtin("yield(this, \"timeout\")", "await this.\"timeout\"", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, true);
+ valid = valid & test_conversion_single_additional_builtin("yield(this, \\\"timeout\\\")", "await this.timeout", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, true);
valid = valid & test_conversion_single_additional_builtin(" Transform.xform(Vector3(a,b,c)) ", " Transform * Vector3(a,b,c) ", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid & test_conversion_single_additional_builtin(" Transform.xform_inv(Vector3(a,b,c)) ", " Vector3(a,b,c) * Transform ", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
@@ -2105,11 +2106,17 @@ bool ProjectConverter3To4::test_conversion(const RegExContainer &reg_container)
valid = valid & test_conversion_single_additional_builtin("(connect(A,B,C,D,E) != OK):", "(connect(A,Callable(B,C).bind(D),E) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid & test_conversion_single_additional_builtin("(start(A,B) != OK):", "(start(Callable(A,B)) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid & test_conversion_single_additional_builtin("func start(A,B):", "func start(A,B):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid & test_conversion_single_additional_builtin("(start(A,B,C,D,E,F,G) != OK):", "(start(Callable(A,B).bind(C),D,E,F,G) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid & test_conversion_single_additional_builtin("disconnect(A,B,C) != OK):", "disconnect(A,Callable(B,C)) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid & test_conversion_single_additional_builtin("is_connected(A,B,C) != OK):", "is_connected(A,Callable(B,C)) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid & test_conversion_single_additional_builtin("is_connected(A,B,C))", "is_connected(A,Callable(B,C)))", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid & test_conversion_single_additional_builtin("(tween_method(A,B,C,D,E).foo())", "(tween_method(Callable(A,B),C,D,E).foo())", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid & test_conversion_single_additional_builtin("(tween_method(A,B,C,D,E,[F,G]).foo())", "(tween_method(Callable(A,B).bind(F,G),C,D,E).foo())", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid & test_conversion_single_additional_builtin("(tween_callback(A,B).foo())", "(tween_callback(Callable(A,B)).foo())", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid & test_conversion_single_additional_builtin("(tween_callback(A,B,[C,D]).foo())", "(tween_callback(Callable(A,B).bind(C,D)).foo())", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+
valid = valid & test_conversion_single_additional_builtin("func _init(p_x:int)->void:", "func _init(p_x:int):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid & test_conversion_single_additional_builtin("q_PackedDataContainer._iter_init(variable1)", "q_PackedDataContainer._iter_init(variable1)", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
@@ -2768,7 +2775,7 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
line = reg_container.reg_os_fullscreen.sub(line, "ProjectSettings.set(\"display/window/size/fullscreen\", $1)", true);
}
- // -- r.move_and_slide( a, b, c, d, e ) -> r.set_motion_velocity(a) ... r.move_and_slide() KinematicBody
+ // -- r.move_and_slide( a, b, c, d, e ) -> r.set_velocity(a) ... r.move_and_slide() KinematicBody
if (line.find("move_and_slide(") != -1) {
int start = line.find("move_and_slide(");
int end = get_end_parenthess(line.substr(start)) + 1;
@@ -2781,7 +2788,7 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
String line_new;
// motion_velocity
- line_new += starting_space + base_obj + "set_motion_velocity(" + parts[0] + ")\n";
+ line_new += starting_space + base_obj + "set_velocity(" + parts[0] + ")\n";
// up_direction
if (parts.size() >= 2) {
@@ -2808,12 +2815,13 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
line_new += starting_space + "# TODOConverter40 infinite_inertia were removed in Godot 4.0 - previous value `" + parts[5] + "`\n";
}
- line = line_new + line.substr(0, start) + "move_and_slide()" + line.substr(end + start);
+ line_new += starting_space + base_obj + "move_and_slide()\n";
+ line = line_new + line.substr(0, start) + "velocity" + line.substr(end + start);
}
}
}
- // -- r.move_and_slide_with_snap( a, b, c, d, e ) -> r.set_motion_velocity(a) ... r.move_and_slide() KinematicBody
+ // -- r.move_and_slide_with_snap( a, b, c, d, e ) -> r.set_velocity(a) ... r.move_and_slide() KinematicBody
if (line.find("move_and_slide_with_snap(") != -1) {
int start = line.find("move_and_slide_with_snap(");
int end = get_end_parenthess(line.substr(start)) + 1;
@@ -2826,7 +2834,7 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
String line_new;
// motion_velocity
- line_new += starting_space + base_obj + "set_motion_velocity(" + parts[0] + ")\n";
+ line_new += starting_space + base_obj + "set_velocity(" + parts[0] + ")\n";
// snap
if (parts.size() >= 2) {
@@ -2858,7 +2866,8 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
line_new += starting_space + "# TODOConverter40 infinite_inertia were removed in Godot 4.0 - previous value `" + parts[6] + "`\n";
}
- line = line_new + line.substr(0, start) + "move_and_slide()" + line.substr(end + start);
+ line_new += starting_space + base_obj + "move_and_slide()\n";
+ line = line_new + line.substr(0, start) + "velocity" + line.substr(end + start); // move_and_slide used to return velocity
}
}
}
@@ -2923,7 +2932,7 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
Vector<String> parts = parse_arguments(line.substr(start, end));
if (parts.size() == 2) {
if (builtin) {
- line = line.substr(0, start) + "await " + parts[0] + "." + parts[1].replace(" ", "") + line.substr(end + start);
+ line = line.substr(0, start) + "await " + parts[0] + "." + parts[1].replace("\\\"", "").replace("\\'", "").replace(" ", "") + line.substr(end + start);
} else {
line = line.substr(0, start) + "await " + parts[0] + "." + parts[1].replace("\"", "").replace("\'", "").replace(" ", "") + line.substr(end + start);
}
@@ -3007,17 +3016,47 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
}
}
}
- // -- start(a,b) -> start(Callable(a,b)) Thread
- // -- start(a,b,c,d) -> start(Callable(a,b).bind(c),d) Thread
- if (line.find("start(") != -1) {
- int start = line.find("start(");
+ // -- "(tween_method(A,B,C,D,E) != OK):", "(tween_method(Callable(A,B),C,D,E) Object
+ // -- "(tween_method(A,B,C,D,E,[F,G]) != OK):", "(tween_method(Callable(A,B).bind(F,G),C,D,E) Object
+ if (line.find("tween_method(") != -1) {
+ int start = line.find("tween_method(");
+ int end = get_end_parenthess(line.substr(start)) + 1;
+ if (end > -1) {
+ Vector<String> parts = parse_arguments(line.substr(start, end));
+ if (parts.size() == 5) {
+ line = line.substr(0, start) + "tween_method(Callable(" + parts[0] + "," + parts[1] + ")," + parts[2] + "," + parts[3] + "," + parts[4] + ")" + line.substr(end + start);
+ } else if (parts.size() >= 6) {
+ line = line.substr(0, start) + "tween_method(Callable(" + parts[0] + "," + parts[1] + ").bind(" + connect_arguments(parts, 5).substr(1).lstrip("[").rstrip("]") + ")," + parts[2] + "," + parts[3] + "," + parts[4] + ")" + line.substr(end + start);
+ }
+ }
+ }
+ // -- "(tween_callback(A,B,[C,D]) != OK):", "(connect(Callable(A,B).bind(C,D)) Object
+ if (line.find("tween_callback(") != -1) {
+ int start = line.find("tween_callback(");
int end = get_end_parenthess(line.substr(start)) + 1;
if (end > -1) {
Vector<String> parts = parse_arguments(line.substr(start, end));
if (parts.size() == 2) {
- line = line.substr(0, start) + "start(Callable(" + parts[0] + "," + parts[1] + "))" + line.substr(end + start);
+ line = line.substr(0, start) + "tween_callback(Callable(" + parts[0] + "," + parts[1] + "))" + line.substr(end + start);
} else if (parts.size() >= 3) {
- line = line.substr(0, start) + "start(Callable(" + parts[0] + "," + parts[1] + ").bind(" + parts[2] + ")" + connect_arguments(parts, 3) + ")" + line.substr(end + start);
+ line = line.substr(0, start) + "tween_callback(Callable(" + parts[0] + "," + parts[1] + ").bind(" + connect_arguments(parts, 2).substr(1).lstrip("[").rstrip("]") + "))" + line.substr(end + start);
+ }
+ }
+ }
+ // -- start(a,b) -> start(Callable(a,b)) Thread
+ // -- start(a,b,c,d) -> start(Callable(a,b).bind(c),d) Thread
+ if (line.find("start(") != -1) {
+ int start = line.find("start(");
+ int end = get_end_parenthess(line.substr(start)) + 1;
+ // Protection from 'func start'
+ if (!line.begins_with("func ")) {
+ if (end > -1) {
+ Vector<String> parts = parse_arguments(line.substr(start, end));
+ if (parts.size() == 2) {
+ line = line.substr(0, start) + "start(Callable(" + parts[0] + "," + parts[1] + "))" + line.substr(end + start);
+ } else if (parts.size() >= 3) {
+ line = line.substr(0, start) + "start(Callable(" + parts[0] + "," + parts[1] + ").bind(" + parts[2] + ")" + connect_arguments(parts, 3) + ")" + line.substr(end + start);
+ }
}
}
}
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 282cfa80e8..ad83db9b60 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -400,7 +400,7 @@ void SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
}
_update_visibility_color(p_node, item);
- } else if (p_node->is_class("CanvasLayer")) {
+ } else if (p_node->is_class("CanvasLayer") || p_node->is_class("Window")) {
bool v = p_node->call("is_visible");
if (v) {
item->add_button(0, get_theme_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons")), BUTTON_VISIBILITY, false, TTR("Toggle Visibility"));
@@ -490,10 +490,7 @@ void SceneTreeEditor::_node_visibility_changed(Node *p_node) {
bool visible = false;
- if (p_node->is_class("CanvasItem")) {
- visible = p_node->call("is_visible");
- CanvasItemEditor::get_singleton()->get_viewport_control()->update();
- } else if (p_node->is_class("CanvasLayer")) {
+ if (p_node->is_class("CanvasItem") || p_node->is_class("CanvasLayer") || p_node->is_class("Window")) {
visible = p_node->call("is_visible");
CanvasItemEditor::get_singleton()->get_viewport_control()->update();
} else if (p_node->is_class("Node3D")) {
@@ -539,7 +536,7 @@ void SceneTreeEditor::_node_removed(Node *p_node) {
p_node->disconnect("script_changed", callable_mp(this, &SceneTreeEditor::_node_script_changed));
}
- if (p_node->is_class("Node3D") || p_node->is_class("CanvasItem") || p_node->is_class("CanvasLayer")) {
+ if (p_node->is_class("Node3D") || p_node->is_class("CanvasItem") || p_node->is_class("CanvasLayer") || p_node->is_class("Window")) {
if (p_node->is_connected("visibility_changed", callable_mp(this, &SceneTreeEditor::_node_visibility_changed))) {
p_node->disconnect("visibility_changed", callable_mp(this, &SceneTreeEditor::_node_visibility_changed));
}