feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "bindings_generator.h"
|
||||
|
||||
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
|
||||
#include "../godotsharp_defs.h"
|
||||
#include "../utils/naming_utils.h"
|
||||
|
|
@ -141,6 +141,7 @@ const Vector<String> prop_allowed_inherited_member_hiding = {
|
|||
"MenuBar.TextDirection",
|
||||
"RichTextLabel.TextDirection",
|
||||
"TextEdit.TextDirection",
|
||||
"FoldableContainer.TextDirection",
|
||||
"VisualShaderNodeReroute.PortType",
|
||||
// The following instances are uniquely egregious violations, hiding `GetType()` from `object`.
|
||||
// Included for the sake of CI, with the understanding that they *deserve* warnings.
|
||||
|
|
@ -172,8 +173,7 @@ static String fix_doc_description(const String &p_bbcode) {
|
|||
// This seems to be the correct way to do this. It's the same EditorHelp does.
|
||||
|
||||
return p_bbcode.dedent()
|
||||
.replace("\t", "")
|
||||
.replace("\r", "")
|
||||
.remove_chars("\t\r")
|
||||
.strip_edges();
|
||||
}
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
|||
int brk_end = bbcode.find_char(']', brk_pos + 1);
|
||||
|
||||
if (brk_end == -1) {
|
||||
String text = bbcode.substr(brk_pos, bbcode.length() - brk_pos);
|
||||
String text = bbcode.substr(brk_pos);
|
||||
if (code_tag || tag_stack.size() > 0) {
|
||||
output.append("'" + text + "'");
|
||||
}
|
||||
|
|
@ -229,7 +229,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
|||
String tag = bbcode.substr(brk_pos + 1, brk_end - brk_pos - 1);
|
||||
|
||||
if (tag.begins_with("/")) {
|
||||
bool tag_ok = tag_stack.size() && tag_stack.front()->get() == tag.substr(1, tag.length());
|
||||
bool tag_ok = tag_stack.size() && tag_stack.front()->get() == tag.substr(1);
|
||||
|
||||
if (!tag_ok) {
|
||||
output.append("]");
|
||||
|
|
@ -246,11 +246,11 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
|||
} else if (tag.begins_with("method ") || tag.begins_with("constructor ") || tag.begins_with("operator ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ") || tag.begins_with("param ")) {
|
||||
const int tag_end = tag.find_char(' ');
|
||||
const String link_tag = tag.substr(0, tag_end);
|
||||
const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
|
||||
const String link_target = tag.substr(tag_end + 1).lstrip(" ");
|
||||
|
||||
const Vector<String> link_target_parts = link_target.split(".");
|
||||
|
||||
if (link_target_parts.size() <= 0 || link_target_parts.size() > 2) {
|
||||
if (link_target_parts.is_empty() || link_target_parts.size() > 2) {
|
||||
ERR_PRINT("Invalid reference format: '" + tag + "'.");
|
||||
|
||||
output.append(tag);
|
||||
|
|
@ -401,7 +401,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
|||
pos = brk_end + 1;
|
||||
tag_stack.push_front(tag);
|
||||
} else if (tag.begins_with("url=")) {
|
||||
String url = tag.substr(4, tag.length());
|
||||
String url = tag.substr(4);
|
||||
// Not supported. Just append the url.
|
||||
output.append(url);
|
||||
|
||||
|
|
@ -497,7 +497,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
|||
|
||||
if (brk_end == -1) {
|
||||
if (!line_del) {
|
||||
String text = bbcode.substr(brk_pos, bbcode.length() - brk_pos);
|
||||
String text = bbcode.substr(brk_pos);
|
||||
if (code_tag || tag_stack.size() > 0) {
|
||||
xml_output.append(text.xml_escape());
|
||||
} else {
|
||||
|
|
@ -522,7 +522,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
|||
String tag = bbcode.substr(brk_pos + 1, brk_end - brk_pos - 1);
|
||||
|
||||
if (tag.begins_with("/")) {
|
||||
bool tag_ok = tag_stack.size() && tag_stack.front()->get() == tag.substr(1, tag.length());
|
||||
bool tag_ok = tag_stack.size() && tag_stack.front()->get() == tag.substr(1);
|
||||
|
||||
if (!tag_ok) {
|
||||
if (!line_del) {
|
||||
|
|
@ -558,11 +558,11 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
|||
} else if (tag.begins_with("method ") || tag.begins_with("constructor ") || tag.begins_with("operator ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ") || tag.begins_with("param ")) {
|
||||
const int tag_end = tag.find_char(' ');
|
||||
const String link_tag = tag.substr(0, tag_end);
|
||||
const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
|
||||
const String link_target = tag.substr(tag_end + 1).lstrip(" ");
|
||||
|
||||
const Vector<String> link_target_parts = link_target.split(".");
|
||||
|
||||
if (link_target_parts.size() <= 0 || link_target_parts.size() > 2) {
|
||||
if (link_target_parts.is_empty() || link_target_parts.size() > 2) {
|
||||
ERR_PRINT("Invalid reference format: '" + tag + "'.");
|
||||
|
||||
xml_output.append("<c>");
|
||||
|
|
@ -763,7 +763,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
|||
pos = brk_end + 1;
|
||||
tag_stack.push_front(tag);
|
||||
} else if (tag.begins_with("url=")) {
|
||||
String url = tag.substr(4, tag.length());
|
||||
String url = tag.substr(4);
|
||||
xml_output.append("<a href=\"");
|
||||
xml_output.append(url);
|
||||
xml_output.append("\">");
|
||||
|
|
@ -1741,8 +1741,8 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
da->make_dir("Generated");
|
||||
da->make_dir("Generated/GodotObjects");
|
||||
|
||||
String base_gen_dir = path::join(p_proj_dir, "Generated");
|
||||
String godot_objects_gen_dir = path::join(base_gen_dir, "GodotObjects");
|
||||
String base_gen_dir = Path::join(p_proj_dir, "Generated");
|
||||
String godot_objects_gen_dir = Path::join(base_gen_dir, "GodotObjects");
|
||||
|
||||
Vector<String> compile_items;
|
||||
|
||||
|
|
@ -1750,7 +1750,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
{
|
||||
StringBuilder constants_source;
|
||||
_generate_global_constants(constants_source);
|
||||
String output_file = path::join(base_gen_dir, BINDINGS_GLOBAL_SCOPE_CLASS "_constants.cs");
|
||||
String output_file = Path::join(base_gen_dir, BINDINGS_GLOBAL_SCOPE_CLASS "_constants.cs");
|
||||
Error save_err = _save_file(output_file, constants_source);
|
||||
if (save_err != OK) {
|
||||
return save_err;
|
||||
|
|
@ -1763,7 +1763,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
{
|
||||
StringBuilder extensions_source;
|
||||
_generate_array_extensions(extensions_source);
|
||||
String output_file = path::join(base_gen_dir, BINDINGS_GLOBAL_SCOPE_CLASS "_extensions.cs");
|
||||
String output_file = Path::join(base_gen_dir, BINDINGS_GLOBAL_SCOPE_CLASS "_extensions.cs");
|
||||
Error save_err = _save_file(output_file, extensions_source);
|
||||
if (save_err != OK) {
|
||||
return save_err;
|
||||
|
|
@ -1779,7 +1779,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
continue;
|
||||
}
|
||||
|
||||
String output_file = path::join(godot_objects_gen_dir, itype.proxy_name + ".cs");
|
||||
String output_file = Path::join(godot_objects_gen_dir, itype.proxy_name + ".cs");
|
||||
Error err = _generate_cs_type(itype, output_file);
|
||||
|
||||
if (err == ERR_SKIP) {
|
||||
|
|
@ -1846,7 +1846,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
|
||||
cs_built_in_ctors_content.append(CLOSE_BLOCK);
|
||||
|
||||
String constructors_file = path::join(base_gen_dir, BINDINGS_CLASS_CONSTRUCTOR ".cs");
|
||||
String constructors_file = Path::join(base_gen_dir, BINDINGS_CLASS_CONSTRUCTOR ".cs");
|
||||
Error err = _save_file(constructors_file, cs_built_in_ctors_content);
|
||||
|
||||
if (err != OK) {
|
||||
|
|
@ -1889,7 +1889,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
|
||||
cs_icalls_content.append(CLOSE_BLOCK);
|
||||
|
||||
String internal_methods_file = path::join(base_gen_dir, BINDINGS_CLASS_NATIVECALLS ".cs");
|
||||
String internal_methods_file = Path::join(base_gen_dir, BINDINGS_CLASS_NATIVECALLS ".cs");
|
||||
|
||||
Error err = _save_file(internal_methods_file, cs_icalls_content);
|
||||
if (err != OK) {
|
||||
|
|
@ -1905,14 +1905,14 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
" <ItemGroup>\n");
|
||||
|
||||
for (int i = 0; i < compile_items.size(); i++) {
|
||||
String include = path::relative_to(compile_items[i], p_proj_dir).replace("/", "\\");
|
||||
String include = Path::relative_to(compile_items[i], p_proj_dir).replace_char('/', '\\');
|
||||
includes_props_content.append(" <Compile Include=\"" + include + "\" />\n");
|
||||
}
|
||||
|
||||
includes_props_content.append(" </ItemGroup>\n"
|
||||
"</Project>\n");
|
||||
|
||||
String includes_props_file = path::join(base_gen_dir, "GeneratedIncludes.props");
|
||||
String includes_props_file = Path::join(base_gen_dir, "GeneratedIncludes.props");
|
||||
|
||||
err = _save_file(includes_props_file, includes_props_content);
|
||||
if (err != OK) {
|
||||
|
|
@ -1937,8 +1937,8 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
da->make_dir("Generated");
|
||||
da->make_dir("Generated/GodotObjects");
|
||||
|
||||
String base_gen_dir = path::join(p_proj_dir, "Generated");
|
||||
String godot_objects_gen_dir = path::join(base_gen_dir, "GodotObjects");
|
||||
String base_gen_dir = Path::join(p_proj_dir, "Generated");
|
||||
String godot_objects_gen_dir = Path::join(base_gen_dir, "GodotObjects");
|
||||
|
||||
Vector<String> compile_items;
|
||||
|
||||
|
|
@ -1949,7 +1949,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
continue;
|
||||
}
|
||||
|
||||
String output_file = path::join(godot_objects_gen_dir, itype.proxy_name + ".cs");
|
||||
String output_file = Path::join(godot_objects_gen_dir, itype.proxy_name + ".cs");
|
||||
Error err = _generate_cs_type(itype, output_file);
|
||||
|
||||
if (err == ERR_SKIP) {
|
||||
|
|
@ -2004,7 +2004,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
|
||||
cs_built_in_ctors_content.append(CLOSE_BLOCK);
|
||||
|
||||
String constructors_file = path::join(base_gen_dir, BINDINGS_CLASS_CONSTRUCTOR_EDITOR ".cs");
|
||||
String constructors_file = Path::join(base_gen_dir, BINDINGS_CLASS_CONSTRUCTOR_EDITOR ".cs");
|
||||
Error err = _save_file(constructors_file, cs_built_in_ctors_content);
|
||||
|
||||
if (err != OK) {
|
||||
|
|
@ -2049,7 +2049,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
|
||||
cs_icalls_content.append(CLOSE_BLOCK);
|
||||
|
||||
String internal_methods_file = path::join(base_gen_dir, BINDINGS_CLASS_NATIVECALLS_EDITOR ".cs");
|
||||
String internal_methods_file = Path::join(base_gen_dir, BINDINGS_CLASS_NATIVECALLS_EDITOR ".cs");
|
||||
|
||||
Error err = _save_file(internal_methods_file, cs_icalls_content);
|
||||
if (err != OK) {
|
||||
|
|
@ -2065,14 +2065,14 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
" <ItemGroup>\n");
|
||||
|
||||
for (int i = 0; i < compile_items.size(); i++) {
|
||||
String include = path::relative_to(compile_items[i], p_proj_dir).replace("/", "\\");
|
||||
String include = Path::relative_to(compile_items[i], p_proj_dir).replace_char('/', '\\');
|
||||
includes_props_content.append(" <Compile Include=\"" + include + "\" />\n");
|
||||
}
|
||||
|
||||
includes_props_content.append(" </ItemGroup>\n"
|
||||
"</Project>\n");
|
||||
|
||||
String includes_props_file = path::join(base_gen_dir, "GeneratedIncludes.props");
|
||||
String includes_props_file = Path::join(base_gen_dir, "GeneratedIncludes.props");
|
||||
|
||||
err = _save_file(includes_props_file, includes_props_content);
|
||||
if (err != OK) {
|
||||
|
|
@ -2085,7 +2085,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
Error BindingsGenerator::generate_cs_api(const String &p_output_dir) {
|
||||
ERR_FAIL_COND_V(!initialized, ERR_UNCONFIGURED);
|
||||
|
||||
String output_dir = path::abspath(path::realpath(p_output_dir));
|
||||
String output_dir = Path::abspath(Path::realpath(p_output_dir));
|
||||
|
||||
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
ERR_FAIL_COND_V(da.is_null(), ERR_CANT_CREATE);
|
||||
|
|
@ -3011,7 +3011,7 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
|
|||
}
|
||||
|
||||
// Apparently the name attribute must not include the @
|
||||
String param_tag_name = iarg.name.begins_with("@") ? iarg.name.substr(1, iarg.name.length()) : iarg.name;
|
||||
String param_tag_name = iarg.name.begins_with("@") ? iarg.name.substr(1) : iarg.name;
|
||||
// Escape < and > in the attribute default value
|
||||
String param_def_arg = def_arg.replacen("<", "<").replacen(">", ">");
|
||||
|
||||
|
|
@ -3201,7 +3201,7 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
|
|||
|
||||
// Generate signal
|
||||
{
|
||||
bool is_parameterless = p_isignal.arguments.size() == 0;
|
||||
bool is_parameterless = p_isignal.arguments.is_empty();
|
||||
|
||||
// Delegate name is [SignalName]EventHandler
|
||||
String delegate_name = is_parameterless ? "Action" : p_isignal.proxy_name + "EventHandler";
|
||||
|
|
@ -3800,6 +3800,8 @@ bool BindingsGenerator::_arg_default_value_is_assignable_to_type(const Variant &
|
|||
case Variant::VECTOR2:
|
||||
case Variant::RECT2:
|
||||
case Variant::VECTOR3:
|
||||
case Variant::VECTOR4:
|
||||
case Variant::PROJECTION:
|
||||
case Variant::RID:
|
||||
case Variant::PACKED_BYTE_ARRAY:
|
||||
case Variant::PACKED_INT32_ARRAY:
|
||||
|
|
@ -3829,7 +3831,10 @@ bool BindingsGenerator::_arg_default_value_is_assignable_to_type(const Variant &
|
|||
case Variant::VECTOR3I:
|
||||
return p_arg_type.name == name_cache.type_Vector3 ||
|
||||
p_arg_type.name == Variant::get_type_name(p_val.get_type());
|
||||
default:
|
||||
case Variant::VECTOR4I:
|
||||
return p_arg_type.name == name_cache.type_Vector4 ||
|
||||
p_arg_type.name == Variant::get_type_name(p_val.get_type());
|
||||
case Variant::VARIANT_MAX:
|
||||
CRASH_NOW_MSG("Unexpected Variant type: " + itos(p_val.get_type()));
|
||||
break;
|
||||
}
|
||||
|
|
@ -4112,9 +4117,8 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
imethod.return_type.cname = _get_type_name_from_meta(return_info.type, m ? m->get_argument_meta(-1) : (GodotTypeInfo::Metadata)method_info.return_val_metadata);
|
||||
}
|
||||
|
||||
int idx = 0;
|
||||
for (List<PropertyInfo>::ConstIterator itr = method_info.arguments.begin(); itr != method_info.arguments.end(); ++itr, ++idx) {
|
||||
const PropertyInfo &arginfo = *itr;
|
||||
for (int64_t idx = 0; idx < method_info.arguments.size(); ++idx) {
|
||||
const PropertyInfo &arginfo = method_info.arguments[idx];
|
||||
|
||||
String orig_arg_name = arginfo.name;
|
||||
|
||||
|
|
@ -4204,6 +4208,18 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
// after all the non-compat methods have been added. The compat methods are added in
|
||||
// reverse so the most recently added ones take precedence over older compat methods.
|
||||
if (imethod.is_compat) {
|
||||
// If the method references deprecated types, mark the method as deprecated as well.
|
||||
for (const ArgumentInterface &iarg : imethod.arguments) {
|
||||
String arg_type_name = iarg.type.cname;
|
||||
String doc_name = arg_type_name.begins_with("_") ? arg_type_name.substr(1) : arg_type_name;
|
||||
const DocData::ClassDoc &class_doc = EditorHelp::get_doc_data()->class_list[doc_name];
|
||||
if (class_doc.is_deprecated) {
|
||||
imethod.is_deprecated = true;
|
||||
imethod.deprecation_message = "This method overload is deprecated.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
imethod.is_hidden = true;
|
||||
compat_methods.push_front(imethod);
|
||||
continue;
|
||||
|
|
@ -4244,9 +4260,8 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
isignal.name = method_info.name;
|
||||
isignal.cname = method_info.name;
|
||||
|
||||
int idx = 0;
|
||||
for (List<PropertyInfo>::ConstIterator itr = method_info.arguments.begin(); itr != method_info.arguments.end(); ++itr, ++idx) {
|
||||
const PropertyInfo &arginfo = *itr;
|
||||
for (int64_t idx = 0; idx < method_info.arguments.size(); ++idx) {
|
||||
const PropertyInfo &arginfo = method_info.arguments[idx];
|
||||
|
||||
String orig_arg_name = arginfo.name;
|
||||
|
||||
|
|
@ -4698,7 +4713,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
|
|||
"Parameter of type '" + String(r_iarg.type.cname) + "' can only have null/zero as the default value.");
|
||||
r_iarg.default_argument = "default";
|
||||
break;
|
||||
default:
|
||||
case Variant::VARIANT_MAX:
|
||||
ERR_FAIL_V_MSG(false, "Unexpected Variant type: " + itos(p_val.get_type()));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue