-
Notifications
You must be signed in to change notification settings - Fork 7
Move mode and extension installation to main scripts #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughRefactors extension and mode import flows to delegate unpack/install logic to centralized APIs. Scenes now call Extensions.install_extension(path) and EditorAPI.import_mode(path). Adds a close_requested→queue_free connection in the mode manager scene. Introduces new install/import methods with validation, ZIP handling, directory creation, reloads, and user notifications. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant ExtensionsUI as Extensions UI
participant Extensions as Extensions Core
participant FS as FileSystem/ZIP
participant Editor as Editor Runtime
User->>ExtensionsUI: Select .tfx file
ExtensionsUI->>Extensions: install_extension(path)
Extensions->>FS: Open ZIP, create dirs, write files
FS-->>Extensions: Extraction result
Extensions->>Editor: Reload extensions/modes
Editor-->>Extensions: Reload complete
Extensions->>User: Notify completion / prompt to reload
sequenceDiagram
autonumber
actor User
participant ModeMgrUI as Mode Manager UI
participant EditorAPI as Editor API
participant FS as FileSystem/ZIP
participant Editor as Editor Runtime
User->>ModeMgrUI: Import .tfmode
ModeMgrUI->>EditorAPI: import_mode(path)
EditorAPI->>FS: Validate, open ZIP, create dirs, write files
FS-->>EditorAPI: Extraction result
EditorAPI->>Editor: Reload modes
Editor-->>EditorAPI: Reload complete
EditorAPI->>User: Notify success or error
User-->>ModeMgrUI: Close window
ModeMgrUI->>ModeMgrUI: queue_free()
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (3)
core/extensions/extensions.gd (1)
100-103: Don’t reload modes after installing extensions.Reloading modes here is likely unintended; extensions should be reloaded (you already prompt to do so). Remove the modes reload to avoid extra work and confusion.
The diff above removes the reload_modes() call. If you do want an immediate reload, call setup_extensions() directly instead of reloading modes.
action_scripts/scenes/mode_manager.gd (1)
37-39: Delegate import: OK. Align file dialog filters to the new API.EditorAPI.import_mode only accepts .tfmode. Update the file dialog filter (Line 34) to drop “*.zip” to prevent “Invalid mode file!” errors when users pick a .zip.
Also consider updating export filters (Lines 59 and 124) to prefer .tfmode to keep import/export consistent.
action_scripts/scenes/extensions.gd (1)
52-52: Good delegation. Sync the open-file filter with the stricter installer.Extensions.install_extension now rejects non-.tfx. Update the file dialog filter (Line 48) from ".tfx,.zip" to "*.tfx" to avoid user-facing errors.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
action_scripts/scenes/extensions.gd(1 hunks)action_scripts/scenes/mode_manager.gd(2 hunks)action_scripts/scenes/mode_manager.tscn(1 hunks)core/extensions/extensions.gd(1 hunks)core/scripts/editor_api.gd(1 hunks)
🔇 Additional comments (2)
action_scripts/scenes/mode_manager.tscn (1)
105-105: Good: close requests free the window immediately.Connecting Window.close_requested to queue_free on the node itself is correct and matches the script changes.
action_scripts/scenes/mode_manager.gd (1)
55-55: LGTM: use queue_free after opening the script.Matches the scene’s close_request handling and cleans up promptly.
Type of Change
Description
Moves
import_modeandinstall_extensiontoEditorAPIandExtensionCorefrom action script helpers, because these functions are useful and internal.Testing
Nothing
Impact
Nothing
Additional Information
This is a refactor for #106
Checklist
Summary by CodeRabbit
New Features
Refactor