Add Variant::get_type_by_name#1946
Conversation
1dfa60b to
d4d5559
Compare
|
Oh, I forgot that you already made a PR for this! I just posted a new one: #1975 There's some small differences between them: in mine the Otherwise, do you want to update your PR? Or, should we shift over to mine? |
|
Hi, I don't care which PR we go with, that's entirely up to you. But in terms of the return value, I opted for Variant::Type type = Variant::get_type_name(variantTypeName);
if (type == Variant::VARIANT_MAX) {
// Handle error case
}Given that the engine can return #if GODOT_VERSION >= 0x040700
Variant::Type type = Variant::get_type_name(variantTypeName);
if (type == Variant::VARIANT_MAX) {
// Handle error case
}
#else
// Handle unsupported case
#endifI just find the former approach cleaner and leaves the version semantics of what is/isn't supported as an encapsulated concern in this case, since it's obvious from godot-cpp that we cannot call the engine method pre-4.7. But perhaps I am missing something? |
|
I wouldn't expect users of godot-cpp to use an Does your extension support multiple target APIs? Since that's only possible with godot-cpp v10, there won't be a lot of examples in the wild for a while |
We do, but it's compile-time targets, obviously. Our So I was applying that same reasoning here: if we check out godot-cpp v10 and then say we want to compile with 4.6+ compatibility, the This would allow us, for example, to have our plugin's A.B, B.C, and C.D branches all use godot-cpp v10 but compile against different But that may just be an ideal world that's not practical, idk. |
|
Superseded by #1975 Same as I said there, we can keep discussing a possible fallback in a follow-up (either as |
Fixes godotengine/godot-proposals#13633
Engine PR godotengine/godot#117160
@dsnopek, I realize you may want to handle the Extension API and GDExtension JSON files in a separate PR, but I've briefly added them here for testing, given that they're a bit intertwined.