Skip to content

Commit 14afdc1

Browse files
committed
Use explicit ::godot namespace in gdvirtual.gen.inc
1 parent efb46f7 commit 14afdc1

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

binding_generator.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def generate_wrappers(target):
7272

7373
def generate_virtual_version(argcount, const=False, returns=False):
7474
s = """#define GDVIRTUAL$VER($RET m_name $ARG)\\
75-
StringName _gdvirtual_##m_name##_sn = #m_name;\\
75+
::godot::StringName _gdvirtual_##m_name##_sn = #m_name;\\
7676
template <bool required>\\
7777
_FORCE_INLINE_ bool _gdvirtual_##m_name##_call($CALLARGS) $CONST {\\
7878
if (::godot::internal::gdextension_interface_object_has_script_method(_owner, &_gdvirtual_##m_name##_sn)) { \\
@@ -92,10 +92,10 @@ def generate_virtual_version(argcount, const=False, returns=False):
9292
return false;\\
9393
}\\
9494
_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const {\\
95-
return godot::internal::gdextension_interface_object_has_script_method(_owner, &_gdvirtual_##m_name##_sn); \\
95+
return ::godot::internal::gdextension_interface_object_has_script_method(_owner, &_gdvirtual_##m_name##_sn); \\
9696
}\\
97-
_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() {\\
98-
MethodInfo method_info;\\
97+
_FORCE_INLINE_ static ::godot::MethodInfo _gdvirtual_##m_name##_get_method_info() {\\
98+
::godot::MethodInfo method_info;\\
9999
method_info.name = #m_name;\\
100100
method_info.flags = $METHOD_FLAGS;\\
101101
$FILL_METHOD_INFO\\
@@ -110,19 +110,19 @@ def generate_virtual_version(argcount, const=False, returns=False):
110110
sproto += "R"
111111
s = s.replace("$RET", "m_ret,")
112112
s = s.replace("$RVOID", "(void)r_ret;") # If required, may lead to uninitialized errors
113-
method_info += "method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\\\n"
114-
method_info += "\t\tmethod_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;"
113+
method_info += "method_info.return_val = ::godot::GetTypeInfo<m_ret>::get_class_info();\\\n"
114+
method_info += "\t\tmethod_info.return_val_metadata = ::godot::GetTypeInfo<m_ret>::METADATA;"
115115
else:
116116
s = s.replace("$RET ", "")
117117
s = s.replace("\t\t\t$RVOID\\\n", "")
118118

119119
if const:
120120
sproto += "C"
121121
s = s.replace("$CONST", "const")
122-
s = s.replace("$METHOD_FLAGS", "METHOD_FLAG_VIRTUAL | METHOD_FLAG_CONST")
122+
s = s.replace("$METHOD_FLAGS", "::godot::METHOD_FLAG_VIRTUAL | ::godot::METHOD_FLAG_CONST")
123123
else:
124124
s = s.replace("$CONST ", "")
125-
s = s.replace("$METHOD_FLAGS", "METHOD_FLAG_VIRTUAL")
125+
s = s.replace("$METHOD_FLAGS", "::godot::METHOD_FLAG_VIRTUAL")
126126

127127
s = s.replace("$VER", sproto)
128128
argtext = ""
@@ -131,8 +131,8 @@ def generate_virtual_version(argcount, const=False, returns=False):
131131
callsiargptrs = ""
132132
if argcount > 0:
133133
argtext += ", "
134-
callsiargs = f"Variant vargs[{argcount}] = {{ "
135-
callsiargptrs = f"\t\t\tconst Variant *vargptrs[{argcount}] = {{ "
134+
callsiargs = f"::godot::Variant vargs[{argcount}] = {{ "
135+
callsiargptrs = f"\t\t\tconst ::godot::Variant *vargptrs[{argcount}] = {{ "
136136
for i in range(argcount):
137137
if i > 0:
138138
argtext += ", "
@@ -141,12 +141,12 @@ def generate_virtual_version(argcount, const=False, returns=False):
141141
callsiargptrs += ", "
142142
argtext += f"m_type{i + 1}"
143143
callargtext += f"m_type{i + 1} arg{i + 1}"
144-
callsiargs += f"Variant(arg{i + 1})"
144+
callsiargs += f"::godot::Variant(arg{i + 1})"
145145
callsiargptrs += f"&vargs[{i}]"
146146
if method_info:
147147
method_info += "\\\n\t\t"
148-
method_info += f"method_info.arguments.push_back(GetTypeInfo<m_type{i + 1}>::get_class_info());\\\n"
149-
method_info += f"\t\tmethod_info.arguments_metadata.push_back(GetTypeInfo<m_type{i + 1}>::METADATA);"
148+
method_info += f"method_info.arguments.push_back(::godot::GetTypeInfo<m_type{i + 1}>::get_class_info());\\\n"
149+
method_info += f"\t\tmethod_info.arguments_metadata.push_back(::godot::GetTypeInfo<m_type{i + 1}>::METADATA);"
150150

151151
if argcount:
152152
callsiargs += " };\\\n"
@@ -161,7 +161,7 @@ def generate_virtual_version(argcount, const=False, returns=False):
161161
if argcount > 0:
162162
callargtext += ", "
163163
callargtext += "m_ret &r_ret"
164-
s = s.replace("$CALLSIRET", "r_ret = VariantCaster<m_ret>::cast(ret);")
164+
s = s.replace("$CALLSIRET", "r_ret = ::godot::VariantCaster<m_ret>::cast(ret);")
165165
else:
166166
s = s.replace("\t\t\t\t$CALLSIRET\\\n", "")
167167

0 commit comments

Comments
 (0)