2.7 KiB
2.7 KiB
Project State Summary
Core Plugin Logic (module_builder_editor_plugin.gd)
The main plugin script has been refactored into a single controller that manages the entire builder workflow. Key functionalities include:
Custom Workspace: The plugin provides a dedicated editor tab with its own isolated SubViewport and a Node2D root, separating the building environment from the main scene.
Camera Controls: It now has a functional Camera2D with working pan (right-click drag) and zoom (mouse wheel) controls, as well as a "Center" button to reset the camera to the origin.
Visual Grid: A CustomGrid.gd script, attached to a Node2D in the viewport, draws a dynamic grid that scales with the camera's zoom level, prevents visual clutter by culling lines, and accurately aligns with the placement snapping.
Piece Placement: The plugin can correctly preview and place structural pieces from the bottom dock into the viewport. The pieces snap to a grid and are added as children to a Module node.
Module Management: It can find existing Module nodes based on the placement position of a new piece. If no module is found, a new one is instantiated.
Undo/Redo System: The plugin now supports a robust undo/redo system for both placing and removing structural pieces. This uses the editor's native EditorUndoRedoManager to ensure actions are reversible with Ctrl+Z and Ctrl+Shift+Z.
Docks: The plugin instantiates and adds custom docks for the ConstructionTree and ConstructionInspector to the left-hand side of the editor.
Other File Updates
builder_dock.gd: The script is now a simple UI controller that emits a signal when a piece button is pressed, centralizing the logic in the main plugin script.
module.gd: The physics recalculation logic is now a public function that correctly combines all child StructuralPiece collision shapes into a single ConcavePolygonShape2D for the parent RigidBody2D.
structural_piece.gd: The is_preview property is used to make preview pieces translucent and non-interactive, allowing mouse events to pass through to the viewport.
Outstanding Tasks
R key binding: The 'R' key binding to rotate pieces is not working correctly and needs to be addressed.
Save Functionality: The _on_save_button_pressed function needs to be implemented to save the built module as a .tscn file.
Dock Functionality: The ConstructionTree dock needs to be populated with the module hierarchy, and the ConstructionInspector needs to display the properties of the selected pieces.
Pressurize Button: The _on_pressurise_button_pressed function needs to be implemented. This will likely involve using the HullVolume.gd script.
This summary provides all the necessary context to continue our work on the plugin.