Skip to content

Editor plugins

Zsuró Tibor edited this page Dec 16, 2024 · 7 revisions

The functionality of Mundus Editor can be extended via plugins.

Plugin template generator

You can generate plugin repository with Mundus editor plugin template repository.

Plugin build

After you generated a plugin, you can build it with this command:

./gradlew clean build

After you built the plugin you should copy the plugin jar file from plugin/build/libs/ directory to <your_home>/.mundus/.plugins/ directory.

Plugin in Mundus Editor

In the Log tab you can see the loaded plugins. Here is the built your-plugin.

image

And in the Plugins menu you can see the your plugin's menu button.

image

And if you click in to the menu button then you can see your plugin's menu.

image

Plugin customize

If you want change your plugin's name or change your built jar file name here you can find more information.

Plugin settings

Extensions

In your plugin you can use extension interfaces to expand Mundus Editor functionality:

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.
  • TerrainSceneExtension:
    • 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
  • CustomShaderRenderExtension:
    • void render(Camera camera): Here can render model with custom shader.
  • EventExtension:
    • void manageEvents(PluginEventManager): Here can subscribe to editor's events. See events below.
  • ComponentExtension:
    • Component.Type getComponentType(): Returns with the component type what the plugin use.
    • String getComponentName(): Returns with the component name.
    • Component createComponent(GameObject gameObject): Creates custom component for given game object.
    • void setupComponentInspectorWidget(Component, RootWidget): Setups widget for custom component for Inspector.
    • CustomComponentConverter getConverter(): Returns with converter for load and save properties for custom component.
  • DisposeExtension:
    • void dispose(): This method calls in when the Editor disposes its resources.

Editor events

You can subscribe for Editor events.

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

Example plugins:

Helper lines plugin

image

Link: https://github.com/Dgzt/mundus-helper-lines-plugin