Skip to content

ResourceDeepDuplicateMode enum is wrongly formatted as a global enum in extension_api.json in method definitions. #107138

Closed
@Yarwin

Description

@Yarwin

Tested versions

System information

Any.

Issue description

In extension_api.json ResourceDeepDuplicateMode enum is being marked as a global EngineEnum (enum::ResourceDeepDuplicateMode) instead of class enum (i.e. it should be something along the lines of: enum::Resource.ResourceDeepDuplicateMode).

Usually class enums in methods are marked as:

Example of properly marked class & global enums in method signature in extension api dump.
{
	"name": "load_threaded_request",
	"is_const": false,
	"is_vararg": false,
	"is_static": false,
	"is_virtual": false,
	"hash": 3614384323,
	"hash_compatibility": [
		1939848623
	],
	"return_value": {
		"type": "enum::Error"
	},
	"arguments": [
		{
			"name": "path",
			"type": "String"
		},
		{
			"name": "type_hint",
			"type": "String",
			"default_value": "\"\""
		},
		{
			"name": "use_sub_threads",
			"type": "bool",
			"default_value": "false"
		},
		{
			"name": "cache_mode",
			"type": "enum::ResourceLoader.CacheMode",
			"default_value": "1"
		}
	]
},
{
	"name": "push_paragraph",
	"is_const": false,
	"is_vararg": false,
	"is_static": false,
	"is_virtual": false,
	"hash": 3089306873,
	"hash_compatibility": [
		3218895358
	],
	"arguments": [
		{
			"name": "alignment",
			"type": "enum::HorizontalAlignment"
		},
		{
			"name": "base_direction",
			"type": "enum::Control.TextDirection",
			"default_value": "0"
		},
		{
			"name": "language",
			"type": "String",
			"default_value": "\"\""
		},
		{
			"name": "st_parser",
			"type": "enum::TextServer.StructuredTextParser",
			"default_value": "0"
		},
		{
			"name": "justification_flags",
			"type": "bitfield::TextServer.JustificationFlag",
			"default_value": "163"
		},
		{
			"name": "tab_stops",
			"type": "PackedFloat32Array",
			"default_value": "PackedFloat32Array()"
		}
	]
},

While ResourceDeepDuplicateMode is being specified as:

{
	"name": "duplicate_deep",
	"is_const": true,
	"is_vararg": false,
	"is_static": false,
	"is_virtual": false,
	"hash": 1807532819,
	"return_value": {
		"type": "Resource"
	},
	"arguments": [
		{
			"name": "deep_subresources_mode",
			"type": "enum::ResourceDeepDuplicateMode",
			"default_value": "1"
		}
	]
}

This broke our codegen.

Said enum is bound as:
image

Instead of, for example
image

which desugars to:

#define BIND_ENUM_CONSTANT(m_constant) \
    ::ClassDB::bind_integer_constant(get_class_static(), __constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant);

template <typename T>
inline StringName __constant_get_enum_name(T param, const String &p_constant) {
return GetTypeInfo<T>::get_class_info().class_name;
}

void ClassDB::bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int64_t p_constant, bool p_is_bitfield) {

Steps to reproduce

  1. Dump extension API: ./godot_editor --headless --dump-extension-api
  2. Analyze the dump.

Minimal reproduction project (MRP)

./godot_editor --headless --dump-extension-api.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions