Skip to content

Commit c56e010

Browse files
committed
Update map.py
1 parent 8c12a4d commit c56e010

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

stubgen/map.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,17 @@ def gen_c_writer(gdt_all_in_one: GodotInOne, c_writer: Writer) -> list[str]:
165165
cpp_name = clazz.name
166166
if cpp_name == "ClassDB":
167167
cpp_name = "ClassDBSingleton"
168-
c_writer.write(
169-
f'register_GDNativeSingleton("{clazz.name}", {cpp_name}::get_singleton());'
170-
)
168+
169+
stmt = f'register_GDNativeSingleton("{clazz.name}", {cpp_name}::get_singleton());'
170+
if clazz.name != 'EditorInterface':
171+
c_writer.write(stmt)
172+
else:
173+
c_writer.write('if (Engine::get_singleton()->is_editor_hint()) {')
174+
c_writer.indent()
175+
c_writer.write(stmt)
176+
c_writer.dedent()
177+
c_writer.write('}')
178+
171179

172180
for clazz in gdt_all_in_one.builtin_classes + gdt_all_in_one.classes:
173181
if clazz.name in converters.SINGLETON_CLASS_NAMES:

0 commit comments

Comments
 (0)