= development
:revnumber: 2.0
:revdate: 2020/07/10
:keywords: documentation, sdk, contribute


== Developing for jMonkeyEngine SDK

_Note that all info is subject to change while jMonkeyEngine SDK is still in beta!_

In general, developing plugins for jMonkeyEngine SDK is not much different than creating plugins for the NetBeans Platform which in turn is not much different than creating Swing applications. You can use jMonkeyEngine SDK to develop plugins, be it for personal use or to contribute to the community.

If you feel like you want to make an addition to jMonkeyEngine SDK, don't hesitate to contact the jme team regardless of your knowledge in NetBeans platform development. For new plugins, the basic project creation and layout of the plugin can always be handled by a core developer and you can go on from there fleshing out the plugin. By using the Platform functions, your plugin feels more like a Platform application (global save button, file type support etc.).

=== General Notes

*  *Remember the scene runs on the render thread and most everything you do in the plugin (button events etc.) runs on the AWT thread, always encapsulate calls to either side correctly via Callables/Runnables or register as an AppState to the SceneApplication to have an update() call by the render thread.*
*  Although the scene can be accessed at any time via SceneApplication.getApplication() it is not recommended to modify the scene like that. Other plugins might be accessing the scene and updates will not be properly recognized. Use the sceneRequest object and the lookup of selected nodes and files to access things like the assetManager etc.
*  It became a standard in jMonkeyEngine SDK to start the name of methods that execute directly on the OpenGL thread with "`do`" e.g "`doMoveSpatial`", this makes identifying threading issues easier.
*  The AssetManager of jme3 is threadsafe and can be used from any thread to load assets
*  You can get access to the ProjectAssetManager via the Lookup of a JmeSpatial and other objects
*  Use org.openide.filesystems.FileObject instead of java.io.File for file access, it always uses system-independent "`/`" path separators and has some more advanced functions that make file handling easier.
*  You can get a file from a string using Repository.getDefault().getDefaultFileSystem().getRoot().getFileObject("`aaa/bbb/ccc/whatever`");
*  You can convert a regular java File to a FileObject and vice versa using org.openide.filesystems.FileUtil
*  If you have problems with unresolved classes, check if all needed Libraries are registered in the settings of your Project. To find out which library contains a certain class, just enter the name in the library search field.


=== Teminology used here

*  A "`plugin`" is anything you can tick in the plugin manager of the SDK. It can contain editors, simple "`Java SE Libraries`" that you can add to your projects as jar files and other things like project templates etc.
*  A "`module`" is the project type that allows you to create plugins, strictly speaking all plugins are modules but there can be modules that are never shown in the plugin list and only exist as dependencies of other modules.
*  A "`library`" is an entry for a jar file (and optionally sources and javadocs) which can be added to a SDK project to be used and distributed with it
*  An "`extension`" is a generic name for stuff that extends the jME engine, like pathfinding algorithms or anything that can be used at the game runtime..

So if you have some cool code that others can use in their games too, you would make your extension a library by creating a module that the users can download as a plugin :)


=== Handy things in jMonkeyEngine SDK Core

*  com.jme3.gde.core.scene.controller
**  AbstractCameraController → A basic camera control for plugins, used by SimpleSceneComposer and "`View Model`"
**  SceneToolController → A basic controller for having selection, cursor etc. displayed in the scene, used by SimpleSceneComposer

*  com.jme3.gde.core.scene
**  OffViewPanel → A panel that renders a 3d scene in a preview and displays it in a lightweight swing panel

*  com.jme3.gde.core.util
**  DataObjectSaveNode → Allows enabling the save all button by using any file and implementing the SvaeCookie yourself.


Learn more about NetBeans Plugin Development at link:http://platform.netbeans.org[http://platform.netbeans.org]

//Also check out this Essential NetBeans Platform Refcard: link:http://refcardz.dzone.com/refcardz/essential-netbeans-platform[http://refcardz.dzone.com/refcardz/essential-netbeans-platform]
