Add protections against registering classes that didn't use GDCLASS()#1279
Add protections against registering classes that didn't use GDCLASS()#1279dsnopek merged 1 commit intogodotengine:masterfrom
GDCLASS()#1279Conversation
|
What happens if you register a custom class with a built-in parent? The check for I.e. add |
Well, you'd get other compiler errors even without the Because native classes with However, I suppose it'd be nice to have the |
|
I'd say that sounds good! At minimum adding the definition to |
002987c to
a61cdc8
Compare
|
Just for completeness I'd add: typedef Wrapped self_type;To wrapped, though extending wrapped directly shouldn't happen it'd ensure the check doesn't break (and has parity with the engine) |
|
I added the stub methods as well as class ExampleNoGDCLASS : public Object {
}; |
|
Cherry-picked for 4.1 in PR #1281 |
This adds the same protections against registering classes that didn't use
GDCLASS(), as were added to the engine in PR godotengine/godot#81020This same problem affects godot-cpp, but to a much lesser degree. I was able to reproduce the issue by making a class heirarchy like:
With out this PR, registering
ExampleChildwas allowed to go ahead, which meant really registeringExampleagain under a different name. However, with this PR, it gives the compiler errorClass not declared properly, please use GDCLASS., just like in the engine.