Skip to content
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

Universal plugins [wip] #35432

Closed
wants to merge 15 commits into from

Conversation

RandomShaper
Copy link
Member

@RandomShaper RandomShaper commented Jan 22, 2020

Goal

The main idea is creating a system that allows plugins to be installed into a specific project or globally (at the OS user level) so they are available for every project.

Remarks

  • Each commit adds a logical step on top of which others are built.
  • Given the big scope of this PR, it's better to review it on a per-commit basis.
  • Some of them (especially, the one marked with [f]) are meant to be squashed together before merging.
  • Feedback and testing is welcome!

Materials

Specification

Please read the full design document.

The most recent commit (Improve UX of universal plugins) is not covered by the design document. It does a number of changes (detailed in the full commit message) to make the feature as easy-to-use as possible).

Screenshots

  • Legacy Plugin is a legacy (model=1, the default) plugin at <project_dir>/addons/.
  • Universal Plugin A is a universal (model=2) plugin at <project_dir>/addons/ (project-level, available to this project only).
  • Universal Plugin B is a universal (model=2) plugin at <godot_config_dir>/addons/ (user-level, available to all projects).
  • Universal Plugin C is a universal (model=2) plugin packed as a PCK file at <godot_config_dir>/addons/ (user-level, available to all projects).

Plugin settings

image

Plugin creation dialog

image

Default plugin code

image
(The explanation is added only for model=2 plugins.)

File system dock

image

File dialog

Browsing resources

image

Directory dialog

image

This code is generously donated by IMVU.

Pedro J. Estébanez added 4 commits January 22, 2020 12:22
Namely, move the drive dropdown to just the left of the path text box and don't include the former
in the latter.

This by itself improves the UX on Windows, but it sets the ground for the following changes.

In the UNIX case, since its concept of drives is (ab)used to provide shortcuts to useful paths, its
dropdown is kept at the original location.
Previously, a change was missed if it happened while the scan was in progress and already past the affected location.

Also:
- Consider the scan changes thread on termination, in addition to the full scan one
- Add FS-reported hidden to the check for hidden by the editor file system
@HeadClot
Copy link

When this gets committed to the main branch does this mean that we will need to update our plugins to account for this change to plugins? Just curious :)

@vnen
Copy link
Member

vnen commented Jan 23, 2020

When this gets committed to the main branch does this mean that we will need to update our plugins to account for this change to plugins? Just curious :)

According to the linked design document, old plugins still work the same way.

@RandomShaper
Copy link
Member Author

According to the linked design document, old plugins still work the same way.

That's right. Anyone not ready or willing to use the new model will enjoy complete backwards compatibility.

@groud
Copy link
Member

groud commented Jan 23, 2020

I think we should be able to display the scope of a plugin directly in the filesystem dock. That would avoid messing up with user-wide plugins in some case.

@fire
Copy link
Member

fire commented Jan 23, 2020

There's CICD failures here https://travis-ci.org/godotengine/godot/builds/640402635

@RandomShaper
Copy link
Member Author

I think we should be able to display the scope of a plugin directly in the filesystem dock. That would avoid messing up with user-wide plugins in some case.

Good idea. Right now the tooltip you get for children of addons:// gives information about where it is physically.

However, using a different color or folder icon would be nice. The plugin settings dialog is using the accent color for user-level. That "language" could be used there, too.

Pedro J. Estébanez added 6 commits January 23, 2020 10:16
First, removed the notion of logical paths from the FS-specific classes so that they deal only with
physical paths. Therefore, translating back and forth between the abstracted (like `res://...`) and
the real one will happen in the base classes. They were already doing part of that work, but the
split wasn't clear enough.

On top of that, `(Dir/File)AccessResources` are introduced to be the ones specifically handling
access to resources. `DirAccessResources` has the notion of drives, being `res://` the only one for
the time being.

`String::simplify_path()` is made simpler and more universal.

`String::is_abs_path()` now also considers paths with a leading Windows drive.
Make the full engine and editor aware of the fact that resources are not necessarily located
under `res://`.
- Add support for multiple `PackedData` instances
- Enhance directory API
- Fix `FileAccess::exists()` not checking for PackedData being disabled
- Fix `DirAccessPack::change_dir()` to handle ".." properyly (before `simplify_path()` disallows it)
- Allow absolute paths in existence checks
@RandomShaper RandomShaper force-pushed the universal_plugins branch 2 times, most recently from f5164d1 to adf25a0 Compare January 23, 2020 11:10
Pedro J. Estébanez added 4 commits January 23, 2020 17:13
If the file name text field is made not-editable, it won't be tried to be changed, keeping any text that has been set to it externally.
Highlights:
- `addons://` is introduced as a virtual resources drive.
- Plugin creation dialog:
  - New model is the default option.
  - If created with new model, the default script contains an explanation about it.
  - Placeholders containing paths are adjusted to the model currently selected.
- If on rescan an enabled plugin is found not to be the same (for instance, a plugin is copied into
  the project while a user-wide one of the same name is enabled), the old one is teared down and
  the new is started up, making the switch seamless.
- If a legacy plugin is located in the editor settings, since that won't work, it's ignored and a
  warning about it is printed.
Makes it able to seamlessly jump between packed and non-packed locations.
Therefore, this commits also reverts what the editor file system scan needed before
this was done.
FS dock:
- Disallow impossible drag & drop cases
- Handle _Show in file manager_ gracefully for items in PCK
- Handle move, rename and remove gracefully for items in PCK
- Hide the _New folder/resource/script_ and _Edit dependencies_ context menu items for read-only folders (PCK or `addons://`)
- Add _[PCK]_ to every PCK plugin's root name
- Paint items in PCK as grayed out
- Add an informative tooltip about the location for children of `addons://`

`EditorDirDialog`:
- Paint items in PCK as grayed out
- Add _[PCK]_ to every PCK plugin's root
- Disable the _Create folder_ button for read-only folders (PCK or `addons://`)
- Disallow picking a read-only folder as a destination path

`EditorFileDialog`:
- Disallow create folder and delete items if read-only (PCK or `addons://`)
- Disallow picking a read-only folder in save mode
- Paint items in PCK as grayed out

Other:
- Force correct PCK filename when exporting a plugin
@RandomShaper
Copy link
Member Author

Not much of general interest. Closing.

@RandomShaper RandomShaper deleted the universal_plugins branch March 6, 2020 12:54
@arkology
Copy link
Contributor

arkology commented Mar 6, 2020

It'll be completely offtopic, but this is how Godot loses great features.

@Xrayez
Copy link
Contributor

Xrayez commented Mar 6, 2020

@RandomShaper I hope a particular implementation will be discussed at GIP at least.

I also wonder what's the real reason for closing the PR, was there any discussion regarding this particular implementation? Not all users follow IRC discussions. There's certainly a general interest in this.

@akien-mga
Copy link
Member

akien-mga commented Mar 6, 2020

I'm not sure why @RandomShaper's closing comment was so laconic, but to clarify, we discussed this at length at the past Godot Sprint in October 2019, and then again during GodotCon in February 2020. This is a wanted feature but not in its current form, which is needlessly complex (because of its flexibility, but flexibility comes at the cost of complexity, and goes against our guidelines).

A new proposal is expected building on this one, which keeps things simple while allowing having global editor plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants