Godot Doctor is a robust validation plugin designed for Godot that helps identify errors early in the development process. Utilizing a declarative, test-driven approach, it allows for seamless validation of scenes, nodes, and resources without requiring @tool
. Enhance your development workflow with proactive error management.
Godot Doctor is an advanced validation plugin designed for the Godot game engine that enables developers to identify and rectify errors before they lead to runtime issues. By utilizing a declarative, test-driven approach, Godot Doctor streamlines scene, node, and resource validation without the need for the @tool
annotation, ensuring that gameplay code remains clean and focused.
Features
No @tool Required
Godot Doctor operates independently of the @tool
annotation, eliminating the need to embed editor-specific logic into gameplay scripts. This separation preserves the integrity of gameplay code while enhancing development efficiency.
Verify PackedScene Types
Prevent type safety issues with PackedScene
instances. Godot Doctor provides the ability to validate that the scenes being instantiated conform to expected types, avoiding common pitfalls during development.
// Example: Validation condition for `PackedScene`
ValidationCondition.scene_is_of_type(scene_of_foo_type, Foo)
Automatic Scene Validation
Validation checks occur automatically upon saving scenes, providing instant feedback during the development process. Errors are highlighted in a dedicated interface, allowing direct navigation to the affected nodes.
Validate Nodes and Resources
The plugin extends validation capabilities beyond nodes; it also supports Resource
scripts to define specific validation conditions. This feature is particularly valuable for ensuring that resources do not contain conflicting data or missing references.
Test-Driven Validation
Godot Doctor encourages a validation methodology similar to unit tests for maximum organization and maintainability. This results in:
- Testable validation conditions
- Enhanced code organization
- Improved maintainability
- Separation of validation logic and error messaging, facilitating clearer code management.
Declarative Syntax
Unlike traditional warning code generation, Godot Doctor allows developers to structure validation logic distinctly from the associated error messages. This separation promotes better readability and manageability of the codebase.
How It Works
- Automatic Discovery: Upon saving a scene, Godot Doctor examines all nodes to identify their
_get_validation_conditions()
methods. - Instance Creation: For non-
@tool
scripts, temporary instances are instantiated to execute validation logic. - Validation Execution: Each validation condition’s callable is evaluated.
- Error Reporting: Any failed conditions display their respective error messages within the Godot Doctor interface.
- Error Navigation: Users can click on listed errors to promptly navigate to the associated nodes.
Explore more detailed examples and common validation patterns in the project's examples README. With Godot Doctor, streamline your development workflow and ensure robust, error-free games.
No comments yet.
Sign in to be the first to comment.