Skip to content

Commit

Permalink
Added SceneExtension with sceneLoaded method
Browse files Browse the repository at this point in the history
  • Loading branch information
Dgzt committed Nov 20, 2023
1 parent 676c5a7 commit 07265c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions editor/src/main/com/mbrlabs/mundus/editor/Editor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import com.mbrlabs.mundus.editor.utils.GlUtils
import com.mbrlabs.mundus.editor.utils.UsefulMeshs
import com.mbrlabs.mundus.pluginapi.EventExtension
import com.mbrlabs.mundus.pluginapi.PluginEventManager
import com.mbrlabs.mundus.pluginapi.SceneExtension
import net.mgsx.gltf.scene3d.scene.SceneRenderableSorter
import net.mgsx.gltf.scene3d.shaders.PBRDepthShaderProvider
import org.apache.commons.io.FileUtils
Expand Down Expand Up @@ -225,6 +226,11 @@ class Editor : Lwjgl3WindowAdapter(), ApplicationListener,
compass = Compass(projectManager.loadingProject().currScene.cam)
// change project; this will fire a ProjectChangedEvent
projectManager.changeProject(projectManager.loadingProject())

val pluginManager = Mundus.inject<DefaultPluginManager>()
val sceneExtensions = pluginManager.getExtensions(SceneExtension::class.java)
sceneExtensions.forEach { it.sceneLoaded(projectManager.current().currScene.terrains) }

UI.toggleLoadingScreen(false)
UI.processVersionDialog()
}
Expand Down
10 changes: 10 additions & 0 deletions plugin-api/src/com/mbrlabs/mundus/pluginapi/SceneExtension.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.mbrlabs.mundus.pluginapi;

import com.badlogic.gdx.utils.Array;
import com.mbrlabs.mundus.commons.scene3d.components.TerrainComponent;
import org.pf4j.ExtensionPoint;

public interface SceneExtension extends ExtensionPoint {

void sceneLoaded(Array<TerrainComponent> terrains);
}

0 comments on commit 07265c2

Please sign in to comment.