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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c4e7a07
Add pf4j dependency
Dgzt Nov 1, 2023
677e1dc
Init plugin-api module
Dgzt Nov 1, 2023
fe37dc5
Load Example extensions from plugins
Dgzt Nov 2, 2023
aa91faf
Use plugins dir in mundus home dir
Dgzt Nov 3, 2023
617369a
Create editor-common module. Connect plugin's event listeners to the …
Dgzt Nov 3, 2023
be768c8
Add plugins menu into menubar and show plugin's menu item
Dgzt Nov 8, 2023
fff319a
Shows plugin's dialog, can add radio buttons
Dgzt Nov 16, 2023
58a113c
New row and addSpinner method into ui plugin class
Dgzt Nov 16, 2023
676c5a7
Add checkbox method
Dgzt Nov 16, 2023
07265c2
Added SceneExtension with sceneLoaded method
Dgzt Nov 20, 2023
d238f17
Render plugin on scene
Dgzt Nov 20, 2023
1f48d38
Merge branch 'master' into editor-plugin-system
Dgzt Nov 26, 2023
39c974f
Merge branch 'master' into editor-plugin-system
Dgzt Mar 9, 2024
38459f7
Update pf4j to 3.11
Dgzt Mar 13, 2024
7a94e2e
Return Widget where can set align
Dgzt Mar 13, 2024
77386f4
Add StatusBarExtension and TerrainHooverExtension
Dgzt Mar 14, 2024
2275ec9
Can add default value for widgets
Dgzt Mar 14, 2024
c3e6686
Fix radio button if default selected second button
Dgzt Mar 14, 2024
a9db43a
Add float spinner. try-catch around plugin rendering.
Dgzt Mar 14, 2024
f2e6c85
batch begin and end for each plugin rendering
Dgzt Mar 16, 2024
1504338
Move TerrainAddedEvent, TerrainRemovedEvent and GameObjectModifiedEve…
Dgzt Mar 16, 2024
f55e36c
Add try-catch to remained getExtension functions
Dgzt Mar 17, 2024
b11b9a3
Fix package of classes in editor-commons
Dgzt Mar 17, 2024
9bbe75c
Add DisposeExtension
Dgzt Mar 17, 2024
80bf0fa
Add comments
Dgzt Mar 17, 2024
6d98608
Add create label widget to RootWidget
Dgzt Mar 17, 2024
2e46c9f
Remove helper lines
Dgzt Mar 17, 2024
63f190d
Add try-catch block around plugin's sceneLoaded method
Dgzt Mar 18, 2024
20856a9
Update README
Dgzt Mar 18, 2024
7befdbb
Add pad option to cell
Dgzt Mar 19, 2024
4f3a952
Show no plugins loaded text if does not have plugins
Dgzt Apr 16, 2024
0f034cb
Fix typo
Dgzt Apr 16, 2024
7e32fbb
Renamed SceneExtension to TerrainSceneExtension
Dgzt Apr 16, 2024
c5b043b
Merge remote-tracking branch 'refs/remotes/origin/master' into editor…
Dgzt Apr 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ allprojects {
commonsLangVersion = '3.12.0'
gltfVersion = '2.1.0'
args4jVersion = '2.33'
pf4jVersion = '3.11.0'

ktxVersion = '1.12.0-rc1'
}
Expand Down Expand Up @@ -63,12 +64,22 @@ project(":commons") {
}
}

project(":editor-commons") {
apply plugin: "java"
apply plugin: "java-library"

dependencies {
api project(":commons")
}
}

project(":editor") {
apply plugin: "java"
apply plugin: "kotlin"

dependencies {
api project(":commons")
api project(":editor-commons")

// Kotlin libs
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
Expand All @@ -86,6 +97,10 @@ project(":editor") {
implementation "org.apache.commons:commons-lang3:$commonsLangVersion"
implementation "commons-io:commons-io:$commonsIoVersion"

// Plugin framework
implementation "org.pf4j:pf4j:$pf4jVersion"
api project(":plugin-api")

// other
implementation "com.kotcrab.vis:vis-ui:$visuiVersion"
implementation "com.esotericsoftware:kryo:$kryoVersion"
Expand All @@ -107,6 +122,18 @@ project(":gdx-runtime") {
}
}

project(":plugin-api") {
apply plugin: "java"
apply plugin: "java-library"

dependencies {
api project(":editor-commons")

// Plugin framework
api "org.pf4j:pf4j:$pf4jVersion"
}
}

tasks.eclipse.doLast {
delete ".project"
}
30 changes: 30 additions & 0 deletions editor-commons/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apply plugin: "java"
apply plugin: "maven-publish"

group = 'com.github.jamestkhan.mundus'
version = '0.5.1'

sourceCompatibility = 1.7
targetCompatibility = 1.7

[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = ["src/"]
sourceSets.main.resources.srcDirs = ["src/"]

task sourcesJar(type: Jar, dependsOn: classes) {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
classifier = 'sources'
from sourceSets.main.allSource
}

publishing {
publications {
maven(MavenPublication) {
groupId project.group
artifactId project.name
version project.version
from components.java
artifact sourcesJar
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016. See AUTHORS file.
* Copyright (c) 2024. See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,11 +14,7 @@
* limitations under the License.
*/

package com.mbrlabs.mundus.editor.events
package com.mbrlabs.mundus.editorcommons;

/**
* @author Marcus Brummer
* @version 12-12-2015
*/
@Retention(AnnotationRetention.RUNTIME)
annotation class Subscribe
public interface EventListener {
}
24 changes: 24 additions & 0 deletions editor-commons/src/com/mbrlabs/mundus/editorcommons/Subscribe.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2024. See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.mbrlabs.mundus.editorcommons;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
public @interface Subscribe {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2024. See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.mbrlabs.mundus.editorcommons.events;

import com.mbrlabs.mundus.commons.scene3d.GameObject;
import com.mbrlabs.mundus.editorcommons.EventListener;
import com.mbrlabs.mundus.editorcommons.Subscribe;

public class GameObjectModifiedEvent {

private GameObject gameObject;

public GameObjectModifiedEvent(final GameObject gameObject) {
this.gameObject = gameObject;
}

public GameObject getGameObject() {
return gameObject;
}

public void setGameObject(GameObject gameObject) {
this.gameObject = gameObject;
}

public interface GameObjectModifiedListener extends EventListener {

@Subscribe
void onGameObjectModified(GameObjectModifiedEvent event);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2024. See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.mbrlabs.mundus.editorcommons.events;

import com.mbrlabs.mundus.commons.scene3d.components.TerrainComponent;
import com.mbrlabs.mundus.editorcommons.EventListener;
import com.mbrlabs.mundus.editorcommons.Subscribe;

public class TerrainAddedEvent {

private final TerrainComponent terrainComponent;

public TerrainAddedEvent(TerrainComponent terrainComponent) {
this.terrainComponent = terrainComponent;
}

public TerrainComponent getTerrainComponent() {
return terrainComponent;
}

public interface TerrainAddedEventListener extends EventListener {

@Subscribe
void onTerrainAdded(TerrainAddedEvent event);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2024. See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.mbrlabs.mundus.editorcommons.events;

import com.mbrlabs.mundus.commons.scene3d.components.TerrainComponent;
import com.mbrlabs.mundus.editorcommons.EventListener;
import com.mbrlabs.mundus.editorcommons.Subscribe;

public class TerrainRemovedEvent {

private final TerrainComponent terrainComponent;

public TerrainRemovedEvent(TerrainComponent terrainComponent) {
this.terrainComponent = terrainComponent;
}

public TerrainComponent getTerrainComponent() {
return terrainComponent;
}

public interface TerrainRemovedEventListener extends EventListener {

@Subscribe
void onTerrainRemoved(TerrainRemovedEvent event);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2023. See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.mbrlabs.mundus.editorcommons.events;

import com.mbrlabs.mundus.commons.scene3d.components.TerrainComponent;
import com.mbrlabs.mundus.editorcommons.EventListener;
import com.mbrlabs.mundus.editorcommons.Subscribe;

public class TerrainVerticesChangedEvent {

private final TerrainComponent terrainComponent;

public TerrainVerticesChangedEvent(TerrainComponent terrainComponent) {
this.terrainComponent = terrainComponent;
}

public TerrainComponent getTerrainComponent() {
return terrainComponent;
}

public interface TerrainVerticesChangedEventListener extends EventListener {

@Subscribe
void onTerrainVerticesChanged(TerrainVerticesChangedEvent event);
}
}
2 changes: 2 additions & 0 deletions editor/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
- Fix add water and terrain as child
- Thumbnail view for model asset in Asset Dock
- Add checkShadowDuringFrustumCulling setting into CullableComponent to disable/enable shadow checking during frustum culling
- Add editor plugin support
- Removed helper lines (moved into plugin, see https://github.com/Dgzt/mundus-helper-lines-plugin)

[0.5.1] ~ 08/08/2023
- Added FPS launcher argument, always call setForegroundFPS
Expand Down
Loading
Loading