Skip to content

Commit

Permalink
Merge pull request #268 from Dgzt/editor-plugin-system
Browse files Browse the repository at this point in the history
Editor plugin system
  • Loading branch information
JamesTKhan authored Apr 21, 2024
2 parents 231cafc + c5b043b commit 4cb1dbd
Show file tree
Hide file tree
Showing 83 changed files with 1,089 additions and 804 deletions.
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

0 comments on commit 4cb1dbd

Please sign in to comment.