I finally came around to adding Custom AppStates in the SDK (similar to Custom Controls). I call it the mother of all SDK features cause it will open up some serious possibilities for the SDK and its general use cases.
Its the first implementation and I am sure theres bugs and issues with it but if you dare you can try around with it in nightly now. Its also at the moment probably a good way to break something in the SDK's SceneComposer severely if you try hard
- Separate Explorer allows adding AppStates from the projects code or libraries to an opened scene
- Gives AppStates access to a fake, safe SimpleApplication, all with assetManager and other features like GUI Node
- Fake application has not all features of full application (partially this will change, partially its inherent with the method)
- Shows any compatible beans properties of the AppState (getter/setter pairs with corresponding field) in the Properties window, editable live
- Open a j3o scene
- Go to the AppStateExplorer
- Press the "attach.." button
- Select an AppState from your code or enter a full class name in the browser that opens
- Select the AppState to see any compatible beans properties
Example use cases:
- Complete coding of games in the SDK with all tools like SceneExplorer etc. to see and influence whats happening.
- Create an AppState that spawns your NPCs (with their custom Controls ^^) or other code to test a level.
- Write some simple AppStates initialize() code to set up a scene (all with your projects assets and classes), then save it as j3o, right in the SceneComposer.
- Sometimes when first adding a new class, the class has to be compiled and the SDK restarted for the file to be recognized
- The AppStateExplorer has to be open when the scene opens to work.
- You can halt the SDK with an infinite loop
- You have to press the "update" button in the SceneExplorer to see changes in the scene.
- The save button might not light up right away when you change the scene via an AppState and you might have to change a detail in the scene via the “normal” tools to be able to actually save it.
- The getter methods of the AppStates should be thread safe in the sense that they should not trigger thread sensitive things, the calling thread isn't guaranteed yet. The setters are always called from the update loop thread.
- Esp. accessing views, renderer etc. will atm. behave strangely, partially this cannot be fixed or only at a later point
I'm sleepy and tired and will update this with some more info later, hope you manage to have some more fun with it than I managed to today