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

New component via plugin #289

Merged
merged 34 commits into from
Nov 22, 2024
Merged

Conversation

Dgzt
Copy link
Collaborator

@Dgzt Dgzt commented May 5, 2024

This PR expands functionality of plugin system. The purpose is that plugin can add new component what runtime can load (via plugin's runtime module).

Changes:

Add a new component type: PHYSICS.

Add optional CustomComponentConverter argument to constructor of Mundus runtime class. This converter can read read custom component properties.

New extension interfaces:

  • CustomShaderRenderExtension:
    • void render(Camera camera): Can render model with custom shader.
  • 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 component, RootWidget rootWidget): Setups widget for custom component for Inspector.
    • CustomComponentConverter getConverter(): Returns with converter for load and save properties for custom component.

Plugin's RootWidget additions:

  • addTextButton(String text, ButtonListener listener): Adds text button onto widget.
  • addSelectBox(Array<T> selectList, SelectBoxListener<T> listener): Adds dropdown/selectbox onto widget and the first item is the default selected..
  • addSelectBox(Array<T> selectList, T defaultValue, SelectBoxListener<T> listener): Adds dropdown/selectbox onto widget and can set the default selected value.
  • addEmptyWidget(): Adds an empty widget.
  • clearWidgets(): Clears the widget.

Tested it with HTML and it works well.

Example: ode4j plugin.

You can try it with Mundus Example Project with Ode4j plugin:
https://github.com/Dgzt/MundusRuntimeExample/tree/ode4j-plugin
(use 1,2,3 buttons to throw shapes)

@Dgzt Dgzt marked this pull request as draft May 5, 2024 09:06
@Dgzt Dgzt marked this pull request as ready for review September 6, 2024 13:25
@JamesTKhan JamesTKhan merged commit 89bedee into JamesTKhan:master Nov 22, 2024
1 check passed
@Dgzt Dgzt deleted the plugin-new-component branch December 14, 2024 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants