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

Editor plugin system #268

Merged
merged 34 commits into from
Apr 21, 2024
Merged

Conversation

Dgzt
Copy link
Collaborator

@Dgzt Dgzt commented Nov 1, 2023

This is a long running PR.

This implements plugin system for editor. The Editor loads plugins from <your_home_directory>/.mundus/plugins directory.

There are 2 new module:

  • plugin-api: The plugins should use this module. It contains the necessary extension interfaces.
  • editor-commons: This contains the common events what the Editor and plugins use.

Extension interfaces:

  • MenuExtension:
    • String getMenuName(): Here can set the name for plugin's menu item in Plugins menu
    • void setupRootDialogWidget(RootWidget): Here can setup the plugin's widget.
  • SceneExtension:
    • void sceneLoaded(Array<TerrainComponent>): Here can get the loaded terrain components at scene loaded
  • TerrainHoverExtension:
    • void hover(TerrainComponent, Vector3): Here can get the mouse hover position on the terrain.
  • StatusBarExtension:
    • void createStatusBarLabel(LabelWidget): Here can create label on statusbar and can set it's label text.
  • RenderExtension:
    • RenderableProvider getRenderableProvider(): Here can pass renderable provider to render it on the scene
  • EventExtension:
    • void manageEvents(PluginEventManager): Here can subscribe to editor's events.
  • DisposeExtension:
    • void dispose(): This method calls in when the Editor disposes its resources.

Subscribable editor events:

  • GameObjectModifiedEvent : If a game object has modified
  • TerrainAddedEvent: If a terrain has added
  • TerrainRemovedEvent: If a terrain has removed
  • TerrainVerticesChangedEvent: If the user has changed terrain's shape

TODO list:

  • Integrate PF4j dependency into Editor
  • Load plugins at editor startup
  • The Plugins menu
  • A pseudo class to create UI in plugins
  • A plugin able to connect to events of editor
  • Render plugin on scene
  • Remove helper lines

Here is the example plugin: https://github.com/Dgzt/mundus-helper-lines-plugin

@Dgzt Dgzt added the enhancement New feature or request label Nov 1, 2023
@Dgzt Dgzt marked this pull request as ready for review March 19, 2024 10:43
@Dgzt Dgzt requested a review from JamesTKhan March 19, 2024 10:43
@JamesTKhan
Copy link
Owner

When no plugins are loaded, we get a little weird empty menu pop up. We should probably handle this differently. Maybe a 'No Plugins Loaded' string or something should appear in the menu drop down?

image

@Dgzt
Copy link
Collaborator Author

Dgzt commented Apr 16, 2024

When no plugins are loaded, we get a little weird empty menu pop up. We should probably handle this differently. Maybe a 'No Plugins Loaded' string or something should appear in the menu drop down?

image

image

Fixed. I've tried to disable 'Plugins' menu if Editor does not have plugins, but seems the VisUI lib doesn't support it.

@JamesTKhan JamesTKhan merged commit 4cb1dbd into JamesTKhan:master Apr 21, 2024
1 check passed
@Dgzt Dgzt deleted the editor-plugin-system branch April 22, 2024 10:06
@Dgzt Dgzt mentioned this pull request May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants