Removed faulty function update after get_property_list.

The function tried to rearrange properties but that lead to problems with duplication or deleted properties. Implemented the logic that that function did inside the get_property_list both for tool scripts and non-tool scripts.
This commit is contained in:
Hristo Stamenov 2022-07-31 11:07:48 +03:00
parent 19e0e06dd0
commit 0e1f7e9f89
9 changed files with 110 additions and 116 deletions

View file

@ -101,6 +101,31 @@ Dictionary Script::_get_script_constant_map() {
return ret;
}
#ifdef TOOLS_ENABLED
PropertyInfo Script::get_class_category() const {
String path = get_path();
String name;
if (is_built_in()) {
if (get_name().is_empty()) {
name = TTR("Built-in script");
} else {
name = vformat("%s (%s)", get_name(), TTR("Built-in"));
}
} else {
if (get_name().is_empty()) {
name = path.get_file();
} else {
name = get_name();
}
}
return PropertyInfo(Variant::NIL, name, PROPERTY_HINT_NONE, path, PROPERTY_USAGE_CATEGORY);
}
#endif // TOOLS_ENABLED
void Script::_bind_methods() {
ClassDB::bind_method(D_METHOD("can_instantiate"), &Script::can_instantiate);
//ClassDB::bind_method(D_METHOD("instance_create","base_object"),&Script::instance_create);