Eclipse/SWT plugin for RCP and Update Site!

Ok, a long time ago I promised this:

After the last refactoring cycle on our software we finally moved our jmeswt bindings into a separate plugin and release it today to the public.

We have created an update site at http://rifidi.org/update.

We also added the documentation to our wiki at http://wiki.rifidi.org/index.php/Rifidi:jmeswt

This should enable every eclipse developer to include jmonkey into his application.

We are constantly updating and improving this plugin as all our developers and partners are using it.

If you have suggestions just tell us. We are currently moving our subversion so the sourcecode will become availbale sometime this wek (I will post the link in this thread).

I want to thank the whole jmonkey community for the greate work you all did with this engine and I hope that this plugin is of use to somebody in here.

Expect some more tools to come as we are currently cleaning up tons of code. ALl our tools are already open source but very tightly integrated with our software. As soon as we refactored em out they will appear on the update site.



Cheers

pflanzenmoerder

mm… i'm fairly noobish… so please explain as to a child :slight_smile: what does this allow me to do?

You can use this plugin to use jme in an eclipse rcp application.

There is a little tutorial on our wiki (just follow the link).

pflanzenmoerder said:

You can use this plugin to use jme in an eclipse rcp application.
There is a little tutorial on our wiki (just follow the link).

Thanks... I tried the link and browsed through the page.. I am still uncertain what it means. What does it mean to use jMe in eclipse rcp application and why would i want to do it?

Could you please give an example use-case?

Well, Rifidi and MonkeyWorld3D are good use cases for such a plugin.

This is an awesome contribution. Thank you ever so much for making this publicly available.



Can you tell me - does it work with the 3.4 release of Eclipse yet?



I think I set up everything correctly and can see the jars in the Plug-in Dependencies folder but was not able to import from org.rifidi.jmeswt. Probably something stupid my end or due to the custom target I am developing against.



Although your wiki page says "I assume that you are an Eclipse RCP developer so I will just skip the details for creating an RCP project." I think it would be a big help if you provided all the source code needed for this on the wiki (or included it in the plugin) so that people could quickly determine if they have things installed correctly. 



Thanks



Duncan

Sorry, getting married this weekend. Some quick hints (more details on monday).

File->New->Other…->Plug In Project (select "Rich Client Application" yes).

After creating the RCP project select the plugin.xml and declare a dependency to the org.rifidi.jmeswt plugin.

Follow the docs from here in.

If you need more help send me a pm on Monday and I will try to help you resolve your issues.

Cheers

Pflanzenmoerder

fwiw, jme2.0 now includes an SWT implementation

renanse said:

fwiw, jme2.0 now includes an SWT implementation

This is good to hear, i have taken a look at it already (just the sources, never tested it though), and i'm glad to see, that there is no more dependeny to AWT anymore. Are there any plans for an "official" eclipse plugin? One might think there's no need for a plugin, when there is an SWT integration.
But a plugin can offer the following additional features:
- jME based view
- jME based editor
- GameState extensions
- special jME related view contributions (to put elements in a scene)
...

Debugging makes it work?



The Eclipse debugger seems to run jME differently than running it without the debugger ?!



Here is what I did:

  • Used Eclipse "Install New Software… " to get the jme plugins at http://rifidi.org/update including:

    -org.monklypse.jme2_1.0.0

    -org.monklypse.jme2.physics_1.0.0

    -org.monklypse.lwjgl_1.0.0
  • Created a new Eclipse plug-in project
  • Added org.monklypse.jme2 as a dependency in my new project
  • Created the following class (in my new project):



    package jme.sample;



    import java.util.HashMap;



    import org.eclipse.swt.SWT;

    import org.eclipse.swt.layout.FillLayout;

    import org.eclipse.swt.widgets.Composite;

    import org.eclipse.ui.part.ViewPart;



    import com.jme.bounding.BoundingBox;

    import com.jme.input.FirstPersonHandler;

    import com.jme.input.InputHandler;

    import com.jme.input.KeyInput;

    import com.jme.math.FastMath;

    import com.jme.math.Quaternion;

    import com.jme.math.Vector3f;

    import com.jme.renderer.Renderer;

    import com.jme.scene.shape.Box;

    import com.jme.system.DisplaySystem;

    import com.jme.system.canvas.SimpleCanvasImpl;

    import com.jme.system.lwjgl.LWJGLSystemProvider;

    import com.jmex.swt.input.SWTKeyInput;

    import com.jmex.swt.input.SWTMouseInput;

    import com.jmex.swt.lwjgl.LWJGLSWTCanvas;

    import com.jmex.swt.lwjgl.LWJGLSWTCanvasConstructor;

    import com.jmex.swt.lwjgl.LWJGLSWTConstants;



    public class SampleView extends ViewPart

    {

    public static final String ID = “jme.SampleView”;



    Composite comp;

    LWJGLSWTCanvas canvas;

    public SampleView()

    {



    }



    @Override

    public void createPartControl(Composite parent)

    {

    int width = 400;

    int height = 400;

    comp = new Composite(parent, SWT.NONE);

    comp.setLayout(new FillLayout());



    DisplaySystem ds = DisplaySystem.getDisplaySystem(LWJGLSystemProvider.LWJGL_SYSTEM_IDENTIFIER);

    ds.registerCanvasConstructor(“SWT”, LWJGLSWTCanvasConstructor.class);



    HashMap<String, Object> props = new HashMap<String, Object>();

    props.put(LWJGLSWTConstants.PARENT, comp);

    props.put(LWJGLSWTConstants.STYLE, SWT.NONE);

    props.put(LWJGLSWTConstants.DEPTH_BITS, 8);

    canvas = (LWJGLSWTCanvas)ds.createCanvas(width, height, “SWT”, props);

    canvas.setUpdateInput(true);

    canvas.setTargetRate(60);



    KeyInput.setProvider(SWTKeyInput.class.getCanonicalName());

    canvas.addKeyListener((SWTKeyInput) KeyInput.get());



    SWTMouseInput.setup(canvas, true);



    // Important! Here is where we add the guts to the panel:

    MyImplementor impl = new MyImplementor(width, height);

    canvas.setImplementor(impl);



    canvas.setSize(width, height);



    canvas.init();

    canvas.render();





    }



    @Override

    public void setFocus()

    {

    if (comp != null)

    {

    comp.setFocus();



    }



    }



    class MyImplementor extends SimpleCanvasImpl {



    private Quaternion rotQuat;

    private float angle = 0;

    private Vector3f axis;

    private Box box;

    long startTime = 0;

    long fps = 0;

    private InputHandler input;



    public MyImplementor(int width, int height) {

    super(width, height);

    }



    public void simpleSetup() {



    // Normal Scene setup stuff…

    rotQuat = new Quaternion();

    axis = new Vector3f(1, 1, 0.5f);

    axis.normalizeLocal();



    Vector3f max = new Vector3f(5, 5, 5);

    Vector3f min = new Vector3f(-5, -5, -5);



    box = new Box(“Box”, min, max);

    box.setModelBound(new BoundingBox());

    box.updateModelBound();

    box.setLocalTranslation(new Vector3f(0, 0, -10));

    box.setRenderQueueMode(Renderer.QUEUE_SKIP);

    rootNode.attachChild(box);



    box.setRandomColors();



    startTime = System.currentTimeMillis() + 5000;



    input = new FirstPersonHandler(cam, 50, 1);

    }



    public void simpleUpdate() {

    input.update(tpf);



    // Code for rotating the box… This might not get pasted into the forum text correctly.

    if (tpf < 1) {

    angle = angle + (tpf * 25);

    if (angle > 360) {

    angle = 0;

    }

    }

    rotQuat.fromAngleNormalAxis(angle * FastMath.DEG_TO_RAD, axis);

    box.setLocalRotation(rotQuat);



    if (startTime > System.currentTimeMillis()) {

    fps++;

    } else {

    long timeUsed = 5000 + (startTime - System.currentTimeMillis());

    startTime = System.currentTimeMillis() + 5000;

    fps = 0;

    }

    }

    }

    }





    When I run an Eclipse Application (including my new plugin), my view appears blank

    When I debug the Eclipse Application (without any break points) the view works fine and I see a rotating box. Hmmm…



    Can someone help me get it working when I just run the application?

I’m surprised, that the update site is still online. The project isnt maintained actively, but maybe source from http://code.google.com/p/monklypse/ are a better choice

At http://code.google.com/p/monklypse/ the “Downloads” page only has the demoapp.zip (which I downloaded)

http://code.google.com/p/monklypse/wiki/Tutorial mentions the update site http://www.rifidi.org/update for the monklypse plugins (I think that is the same as http://rifidi.org/update mentioned above)



Interestingly enough the demoapp plugin exhibits the same behaviour (i.e. works when I debug, but not when I run).



I am using Eclipse 3.6 Helios. I am not sure if the behaviour is different on a different version of Eclipse.



Thoughts?

Hmmm… It seems to work correctly with Eclipse 3.5.2 (Galileo) but Eclipse 3.6 (Helios) exhibits the behaviour above.



Sort of a side note: When I manually open the view (Show View …) it does not display correctly (even in 3.5.2) but when I run the app the second time (now that the view in the workspace) the view is displayed correctly. I think that means I need to delay some initialization code (i.e. not in createPartControl, but in open or something )



Please look at Helios to see if there are some issues there.



Thank you

mark Lovell

This project is noot maintained anymore. If you want it fixed, you will have to do it yourself.

Cheers,

Normen

Are you saying that Monklypse is dead (i.e. not maintained) or jMonkeyEngine is dead?

I am talking about Monklypse of course.

jMonkeyEngine is more like the walking dead. You’ll never quite be able to kill it for good.

Well, earlier this year, MW3D found a new comitter, who wanted to port things to Eclipse 3.6



I haven’t been here for quite a while now, but got attracted again, after seeing BigPoints PoisonVille. Unfortunatly i did not have the time to take a closer look at the changes Udo has contibuted to MW3D. It should not be that much of an issue though, to get monkylpse up and running again. But then again, it should use JME3…

Or you just use jMonkeyPlatform, which is actively developed by the core jme team :stuck_out_tongue:

Seeing Monklypse/MW3D back in action would be great, but frankly, additional jMonkeyPlatform contributors would be greater :wink:



I imagine you’d have a lot of work in store for you bringing your entire toolset up to speed with jME3. jMP has been tried and tested for some time now, being used by a great amount of developers. It’s officially supported and promoted. It’s got a dedicated developer. It’s got its own plugin repository and (unofficial) contribution conventions. And it’s quite feature rich already.



My main point is, the further jMonkeyPlatform develops, it will look and behave less like NetBeans, and more like plain jME3’s SDK.