GDScript: Allow overriding default values of base class variables#93787
GDScript: Allow overriding default values of base class variables#93787dalexeev wants to merge 1 commit intogodotengine:masterfrom
Conversation
|
How far does the Also I see my PR to highlight overridden properties is being put to even better use now. |
Good, but in practice it would still be desirable to narrow it down with covariance like in #82477
This may actually not be too much of a deal-breaker for most, but it is certainly a waste of processing time which would be nice to avoid. |
This way, we have a scene that has the default configuration (collision layers and mask) of the interact area already setup. I made it this way instead of by modifying the interact_area.gd because I'd like to let the contributors modify the collision layers of the nodes after they were created. I think that this would not be needed anymore once we this pull request is merged into godot and default values for inherited properties can be overriden: godotengine/godot#93787 -- godotengine/godot-proposals#338
This way, we have a scene that has the default configuration (collision layers and mask) of the interact area already setup. I made it this way instead of by modifying the interact_area.gd because I'd like to let the contributors modify the collision layers of the nodes after they were created. I think that this would not be needed anymore once we this pull request is merged into godot and default values for inherited properties can be overriden: godotengine/godot#93787 -- godotengine/godot-proposals#338
This way, we have a scene that has the default configuration (collision layers and mask) of the interact area already setup. I made it this way instead of by modifying the interact_area.gd because I'd like to let the contributors modify the collision layers of the nodes after they were created. I think that this would not be needed anymore once we this pull request is merged into godot and default values for inherited properties can be overriden: godotengine/godot#93787 -- godotengine/godot-proposals#338
This way, we have a scene that has the default configuration (collision layers and mask) of the interact area already setup. I made it this way instead of by modifying the interact_area.gd because I'd like to let the contributors modify the collision layers of the nodes after they were created. I think that this would not be needed anymore once we this pull request is merged into godot and default values for inherited properties can be overriden: godotengine/godot#93787 -- godotengine/godot-proposals#338
This way, we have a scene that has the default configuration (collision layers and mask) of the interact area already setup. I made it this way instead of by modifying the interact_area.gd because I'd like to let the contributors modify the collision layers of the nodes after they were created. I think that this would not be needed anymore once we this pull request is merged into godot and default values for inherited properties can be overriden: godotengine/godot#93787 -- godotengine/godot-proposals#338
This way, we have a scene that has the default configuration (collision layers and mask) of the interact area already setup. I made it this way instead of by modifying the interact_area.gd because I'd like to let the contributors modify the collision layers of the nodes after they were created. I think that this would not be needed anymore once we this pull request is merged into godot and default values for inherited properties can be overriden: godotengine/godot#93787 -- godotengine/godot-proposals#338
👍 Since you can override the content of the setter/getter function like any other function, changing the variable so it points to a different setter/getter entirely would be completely pointless and make everything needlessly confusing. How messed up would it be if you called a setter function in code, only to find out it wasn't the correct setter in the specific object you were dealing with? 🥶 |
|
Just chiming in to say this is an absolutely necessary feature for using inheritance with Resources and RefCounteds. Especially RefCounteds, since they cannot be exported to the inspector. I was going about my business making abstract Resource classes in my project, expecting being able to easily override their variables to be completely par for the course. I was very happy to find that abstract classes and methods will be added in 4.5, but a bit surprised that overriding parent variables wouldn’t also be part of the package just yet. These things go hand in hand. Would really appreciate this! |
Yeah, the only workaround is using _init method on the extended script, but that is cumbersome |

TODO: Implement proposal godotengine/godot-proposals#8045 (only possible for inline setters/getters).