From 3a5ef9297a63fd06e8fbfe26b0377d26c4ece034 Mon Sep 17 00:00:00 2001 From: Niklas Date: Thu, 24 Oct 2024 10:42:40 +0200 Subject: [PATCH] Tried to fix assertion --- py4godot/script_language/PyLanguage.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/py4godot/script_language/PyLanguage.cpp b/py4godot/script_language/PyLanguage.cpp index 34a64c00..56a9d4d3 100644 --- a/py4godot/script_language/PyLanguage.cpp +++ b/py4godot/script_language/PyLanguage.cpp @@ -11,9 +11,24 @@ #include "py4godot/cppclasses/ImageTexture/ImageTexture.h" #include "py4godot/cppclasses/Image/Image.h" #include "py4godot/pluginscript_api/api.h" + + +//TODO: generate this +bool theme_has_method(){ + StringName _class_name = c_string_to_string_name("EditorInterface"); + _class_name.shouldBeDeleted = true; + StringName _method_name = c_string_to_string_name("get_editor_theme"); + _method_name.shouldBeDeleted = true; + GDExtensionMethodBindPtr method_bind = functions::get_classdb_get_method_bind()(&_class_name.godot_owner,&_method_name.godot_owner, 3846893731); + return method_bind != nullptr; +} + void PyLanguage::init_theme_icon(){ if(counter == 1){ auto instance = EditorInterface::get_instance(); + if(!theme_has_method()){ + return; + } auto theme = instance ->get_editor_theme(); std::shared_ptr image_texture = ImageTexture::constructor(); auto icon_path = c_string_to_string("addons/py4godot/Python.svg");