Skip to content

A debug tool for jmonkeyengine : display a window to browse the content of node (root of the scene by default).

License

Notifications You must be signed in to change notification settings

davidB/jme3_ext_spatial_explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple (extensible) GUI window to display the content (Spatials) of a jmonkeyengine scene. It can be used at runtime, debug/test time.

Requirements: javafx 8 (java 8u20+)

sample

Install

build.gradle

repositories {
	//...
	maven { url "https://jitpack.io" }
}

dependencies {
	//...
	testCompile 'com.github.davidb:jme3_ext_spatial_explorer:-SNAPSHOT'
}

into java code

		SimpleApplication app = ...

		//Setup SpatialExplorer
		Helper.setupSpatialExplorerWithAll(app);
//		app.enqueue(() -> {
//			AppStateSpatialExplorer se = new AppStateSpatialExplorer();
//			Helper.registerAction_Refresh(se.spatialExplorer);
//			Helper.registerAction_ShowLocalAxis(se.spatialExplorer, app);
//			Helper.registerAction_SaveAsJ3O(se.spatialExplorer, app);
//			Helper.registerAction_ShowSkeleton(se.spatialExplorer, app);
//			Helper.registerAction_ShowWireframe(se.spatialExplorer, app);
//			Helper.registerBarAction_ShowFps(se.spatialExplorer, app);
//			Helper.registerBarAction_ShowStats(se.spatialExplorer, app);
//			Helper.registerBarAction_SceneInWireframe(se.spatialExplorer, app);
//			Helper.registerBarAction_SceneInDebugPhysic(se.spatialExplorer, app);
//			app.getStateManager().attach(se);
//			return null;
//		});
		app.enqueue(() -> {
			AppStateSpatialExplorer se = app.getStateManager().getState(AppStateSpatialExplorer.class);
			// register my custom Action and BarAction
			registerBarAction_PrintToto(se.spatialExplorer);
			return null;
		});

see [Demo.java](src/test/java/samples/Demo.java] for a complete sample.

Customization

Add Context Menu action

	@SuppressWarnings("unchecked")
	public static void registerAction_MyVerb(SpatialExplorer se) {
		se.treeItemActions.add(new Action("My Verb Label", (evt) -> {
			TreeItem<Spatial> treeItem = (TreeItem<Spatial>)evt.getSource();
			Spatial spatial = treeItem.getValue();
			// do my stuff
		}));
	}

see registerAction_Refresh or registerAction_ShowLocalAxis in Helper.java for a complete sample.

Add action on selection change

	//oldValue and newValue are Spatial (previous selected, a newly selected)
	se.spatialExplorer.selection.addListener((observable, oldValue, newValue) -> {
		app.enqueue(()->{
			if (oldValue != null) {
				// do job on oldValue
			}
			if (newValue != null) {
				// do job on newValue
			}
			return null;
		});
	});

Add Top ToolBar action

	@SuppressWarnings("unchecked")
	public static void registerAction_MyVerb(SpatialExplorer se) {
		se.barActions.add(new Action("My Verb Label", (evt) -> {
			// do my stuff
		}));
	}

see registerBarAction_Xxx in Helper.java for samples.

About

A debug tool for jmonkeyengine : display a window to browse the content of node (root of the scene by default).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages