Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot 4.0 alpha6 Gdextension bug with GridMap #60238

Open
LiBooks opened this issue Apr 14, 2022 · 6 comments
Open

Godot 4.0 alpha6 Gdextension bug with GridMap #60238

LiBooks opened this issue Apr 14, 2022 · 6 comments

Comments

@LiBooks
Copy link

LiBooks commented Apr 14, 2022

Godot version

4.0 alpha 6

System information

Windows10 Vulkan

Issue description

I try to make a class extends different classes . The classes include “Control”,"Node","Node3D","Camera3D","GridMap". However, when I choose GridMap, GDextension doesn't work as normal.The class that inherits gridmap is not registered in ClassDB.

Steps to reproduce

#ifndef GRID_MAP_EXTENDS_H
#define GRID_MAP_EXTENDS_H

#include <godot_cpp/classes/grid_map.hpp>

using namespace godot;

using godot::ClassDB;

class GridMapExtends:public Node{
GDCLASS(GridMapExtends, Node)
protected:
static void _bind_methods(){}
};

#endif

Minimal reproduction project

No response

@timothyqiu
Copy link
Member

timothyqiu commented Apr 14, 2022

These extensions are all registered before module types currently:

godot/main/main.cpp

Lines 409 to 439 in 12cb05b

register_core_extensions();
// From `Main::setup2()`.
preregister_module_types();
preregister_server_types();
register_core_singletons();
register_server_types();
translation_server->setup(); //register translations, load them, etc.
if (!locale.is_empty()) {
translation_server->set_locale(locale);
}
translation_server->load_translations();
ResourceLoader::load_translation_remaps(); //load remaps for resources
ResourceLoader::load_path_remaps();
register_scene_types();
register_driver_types();
#ifdef TOOLS_ENABLED
ClassDB::set_current_api(ClassDB::API_EDITOR);
EditorNode::register_editor_types();
ClassDB::set_current_api(ClassDB::API_CORE);
#endif
register_platform_apis();
register_module_types();

@LiBooks
Copy link
Author

LiBooks commented Apr 14, 2022

所以大佬,我应该怎么办

@timothyqiu
Copy link
Member

So, what should I do?

I believe there's no workaround currently. But until a proper fix is made, you can try moving register_core_extensions() around. I'm not sure.

@LiBooks
Copy link
Author

LiBooks commented Apr 14, 2022

So, what should I do?

I believe there's no workaround currently. But until a proper fix is made, you can try moving register_core_extensions() around. I'm not sure.

thank you

@Calinou Calinou added this to the 4.0 milestone Apr 14, 2022
@vonwell
Copy link

vonwell commented Apr 14, 2022

什么时候可以用上简易使用的C++?

@kidrigger
Copy link
Contributor

kidrigger commented Apr 17, 2022

@LiBooks You can try the PR timothyqiu mentions. Note it is not designed or tested for this purpose but you can experiment and it should work. Note: You need to use the corresponding godot-cpp PR for this.

@aaronfranke aaronfranke modified the milestones: 4.0, 4.x Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants