[Plugin] jME Code Templates (faster way to code jME!)

I’ve released a plugin, based on this thread I made a week ago:



http://hub.jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/code-templates-in-the-jmedk/



Same video (although some of the shortcuts have since changed ^^):

http://www.youtube.com/watch?v=Si6AuLwe-gQ



There are ~100 different code templates i’ve put in, I will document a full list properly later today :P. For now you can find them inside:


Tools > Options > Editor > Code Templates > Java


Although there are other generic java ones in there as well.

To use them, you type the shortcut, and then tab (this can be changed in the above location). The format I choose, was all lower case for a lower case version, upper case for an upper case version, and new (followed by type), to create a new object (although i seem to have missed a few xD). For example:
[java]newumat -> Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
si -> simpleApplication
Si -> SimplApplication[/java]

Note: it requires a restart of the jMEDK after install, even though it doesn't say it (fixed in svn)
6 Likes

Just this, “newumat”, will make my life so much easier :slight_smile:

1 Like

Cool, this should be helpful for a lot of people.

1 Like

Yeah, this really makes things easier. Things like these are real time saver.

1 Like

Here is the list of available shortcuts, A few of these I just added and will be available in svn, and I will continue to update them as I go along. The shortcut is on the left, and anything after the comma will be replaced with it. With the “new” commands, the name will be highlighted, and you can change them straight after. This helps with naming conflicts, and the cursor will be placed in appropriate places if further input is required.



[java]newqua, Quaternion quat = new Quaternion();

scs, sphereCollisionShape

newpmat, Material particleMat = new Material (assetManager, “Common/MatDefs/Misc/Particle.j3md”);

newvec3, Vector3f vec3 = new Vector3f(1f, 1f, 1f);

newtest, public class ${TYPE default=“ClassName”} extends SimpleApplication {

public static void main (String[] args) {

new ${TYPE}().start();

}



@Override

public void simpleInitApp () {

}

}

newvec2, Vector2f vec2 = new Vector2f(1f, 1f);

no, node

newchar, CharacterControl charControl = new CharacterControl (cShape, 0.1f);

Rbc, RigidBodyControl

gc, ghostControl

ge, geometry

bu, bulletAppState

sph, sphere

Ccs, CapsuleCollisionShape

gui, guiNode

Co, Control

newccs, CapsuleCollisionShape capCShape = new CapsuleCollisionShape (1f, 3f, 1);

newme, Mesh mesh = new Mesh ();

Inp, InputManager

physt, PhysicsTickListener

Qua, Quaternion

newcol, ColorRGBA color = new ColorRGBA (0.5f, 0.5f, 0.5f, 1f);

newbcs, BoxCollisionShape boxCShape = new BoxCollisionShape (1, 1, 1);

inp, inputManager

ColM, “ColorMap”

Dir, DirectionalLight

sp, spatial

sta, stateManager

newray, Ray ray = new Ray(cam.getLocation(), cam.getDirection());

physc, PhysicsCollisionListener

se, settings

si, simpleApplication

Me, Mesh

co, control

newumat, Material unshadedMat = new Material (assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

newtmat, Material terrainMat = new Material (assetManager, “Common/MatDefs/Terrain/Terrain.j3md”);

newsph, Sphere sphere} = new Sphere(10, 10, 1);

ColR, CollisionResults

Shi, “Shininess”

ro, rootNode

roach, rootNode.attachChild();

newgc, GhostControl ghostControl = new GhostControl ();

vi, viewport

Si, SimpleApplication

newac, ActionListener actionListener = new ActionListener() {

public void onAction(String name, boolean keyPressed, float tpf) {

if (name.equals("") && !keyPressed) {



}

}

};

newge, Geometry geometry = new Geometry (“name”, );

newam, AmbientLight ambientLight = new AmbientLight ();

newan, AnalogListener actionListener = new AnalogListener() {

public void onAnalog(String name, float value, float tpf) {

if ("") {



}

}

};

newno, Node node = new Node (“nodeName”);

newdir, DirectionalLight dirLight = new DirectionalLight (new Vector3f (1, 1, 1);



Sph, Sphere

Sp, Spatial

Vec3, Vector3f

Vec2, Vector2f

Ni, Nifty

Ab, AbstractAppState

Ac, ActionListener

Am, AmbientLight

An, AnalogListener

me, mesh

DiffM, “DiffuseMap”

rbc, rigidBodyControl

Scs, SphereCollisionShape

Ge, Geometry

AnimL, AnimEventListener

newbi, BitmapText bitmapText = new BitmapText (guiFont, false);

app, AppSettings

Gc, GhostControl

Mcs, MeshCollisionShape

Tan, TangentBinormalGenerator

newcolr, CollisionResults results = new CollisionResults ();

Bu, BulletAppState

newlmat, Material lightMat = new Material (assetManager, “Common/MatDefs/Lighting/Lighting.j3md”);

Bcs, BoxCollisionShape

newscs, SphereCollisionShape sphereCShape = new SphereCollisionShape (1);

No, Node

newbox, Box box = new Box (Vector3f.ZERO, new Vector3f());

newrb, RigidBodyControl rbControl = new RigidBodyControl ();

newmcs, MeshCollisionShape meshCShape = new MeshCollisionShape ();

Bi, BitmapText

Col, ColorRGBA

AnimCo, AnimControl

an, analogListener

ac, actionListener

bcs, boxCollisionShape

Sta, StateManager

Cha, CharacterControl

ni, nifty

AnimCh, AnimChannel[/java]

1 Like