Scene Monitor (new version 1.31)

Edited: Scene Monitor Google Code Project





Hello everyone!



I’ve been working hard the last couple weeks to put together a tool that I think is very handy. The idea has come up recently in a post started by BenImp. Having already made some of the components for this project I decided to go ahead and try me hand at it.



Scene Monitor will allow you to visibly explore the structure of your scene graph while your application is running. Usage is easy as you can see in the test case I’ve included down below. You can register any number of nodes to monitor and they can be selected from the node list at the top.



The main feature of Scene Monitor is the tree model, which captures every element of the jME scene graph (at least I think it does  :wink: ). The tree features custom icons representing nodes, renderstates, controllers and others.



Another great part is the information pane. When an object is selected in the scene tree, the information pane will display data gathered from the selected object. So if you select a node, it will tell you the translation, rotation, and scale, what locks are being used and so on. If you select a lightstate it will tell you its settings and enumerate the lights attached to it with their settings. This is all done through MonitorDescriptor objects. Its a very flexible system allowing you the programmer to also redefine what information is displayed, or define descriptors for any custom class (like controllers) that may appear in the scene graph.



Scene Monitor also supports jME Physics 2! You can see physics nodes and collision geometry in the tree with supporting information pane data. The tool itself will dynamically check for the existence of the physics library.



Scene Monitor is compatible with both jME 1.0 and the new jME 2.0 alpha. The descriptor objects used for the information pane are specific to each version and are supplied in separate jars. The info descriptor pack is done for jME 2.0 and is available. I still need to develop the jME 1.0 descriptors. It shouldn’t take long once I can sit down and do it. Until thats ready, jME 1.0 users can still use Scene Monitor with out them as they are independent from the tool itself.



I developed a custom dialog for the tool, which allows it to hide as a small bar. When expanded, it can be dragged to either side of the screen and the dialog will flip sides accordingly.



This is the first release of the tool and I’m calling it 0.95 beta. All planned functionality is complete it just needs to be thoroughly tested. I’m developing on Windows, so it’s never seen a Mac or Linux machine. Please give it a try and let me know what you think. If you have any suggestions that would make this thing absolutely great then don’t hesitate to speak up.



And now for some screens…  8)



Test case using the TestProjectedWater test:



Larger View





Shot of only the tool while monitoring TestContactCallback in jME Physics:



Larger View





And finally… where to get it?

Edited: Scene Monitor Google Code Project

yes, that really rocks  :smiley:

:-o :-o :-o

This is intense… A must have kind of tool. Any plans for integrating it to jME?

******* Nice tool…:slight_smile: Did you thought in using Reflection to also SET values, instead of only read them? I was thinking in using this aproach to my game component system, so I could evolve a scene editor in small steps.

Very nice work!  Being able to write to the scene graph seems like a logical next step.  It could then be a nice replacement for the handful of small editor panes we currently have.  In your description it seemed like you mentioned being able to register multiple "starting" points to monitor?  How do you choose amongst them?  Can they be something other than nodes?

This looks very useful.



Might be possible to do the "info description" using Annotations in the future?


Thanks for the positive feedback.


Momoko_Fan said:

Any plans for integrating it to jME?

What did you  have in mind?

perick said:

Did you thought in using Reflection to also SET values, instead of only read them?

I'm not very experienced with the reflection API. I actually took the the tree implementation out of another one of my projects and stripped away an implementation which I use to directly change and control the scene graph. So, re-adding that won't be difficult, but it will take to time to make it clean and flexible.

renanse said:

In your description it seemed like you mentioned being able to register multiple "starting" points to monitor?  How do you choose amongst them?  Can they be something other than nodes?

At the top is a drop down which lists the nodes that are currently registered. You can add and remove them from the tool during execution as needed through the register and unregister methods. So the list can change depending on where you are in your app. Currently only Nodes can be listed. What other objects would you find useful?

llama said:

Might be possible to do the "info description" using Annotations in the future?

I'm not familiar with annotations. Can you elaborate?

After a grueling 5 minute thought session I have decided to take it to the next level. I will be devleoping a version 2 of Scene Monitor which will allow modification of the scene graph.



Before I begin though, I would like to hear eveybodys ideas on what they would like to be able to do with it, and a selection of ideas on how that could be implemented.





I’ll start…



I did some reading on annotations after llama mentioned it, but I don’t have a handle on it yet to see if its even feasible. So if someone more familiar could outline a possible scenario for this it would help me greatly.



I was thinking of replacing the information panel with a properties grid to control values. I think this is an interface most everyone will befamiliar with and it looks organized.





I’ve never seen one in Java however. Does somebody have one laying around? I’m looking at the JTable and possibly creating some custom elements and renderers to get this done.

I'm currently working on a scene inspector that has nearly identical functionality. I do use annotations for descriptions of object properties/fields, which works well, although I currently only have the annotations on my custom objects, not on any jME 2.0 out-of-the-box objects. I also generate dropdown options for Enums in jME 2.0 through reflection, and also allow properties of object to be set if a corresponsing setter is present in the object/class. I plan on releasing the scene inspector when i feel like it's past an alpha stage. My inspector also allows you so save/import nodes for a given selection in the scene graph, and rename the nodes as well. I'm at work so I don't have any screencaps, but I'll try and clean up the source and get some more testing in so I can post something soon.



nymon, There currently is no property sheet component built into swing/awt, but there are several libs out there with implementations. Also, here is an example of what my fields descriptions look like:



public class SceneObject extends Node {
    /* ... */

    @SceneInspectorDescription(
        fieldLabel       = "Object UID",
        fieldDescription = "A generic scene object.",
        fieldType        = String.class
    )
    private String uid = -1;

    // this will be used as the setter for the inspector gui,
    // which will search the object's class for a method
    // called set<FieldName> with a single argument that's a String.
    public void setUid(String uid){
        /* Do some stuff before you set the uid */

        this.uid = uid;
    }
  
    /* ... */
}



Annotations can be very useful when you need to add metadata about types, methods, and other fields.

Awesome! I'd love to see it. Thanks for annotation example, that REALLY helps me understand better how that would work.



It sounds like your closer than I am to achieving this. I'm glad you spoke up, I think 'competition' is good. Your approach is taking paths I'm not too familiar with, I like it. How far are you from wrapping up this project?



How do you feel about collaborating? If for nothing else I think I'll be able to learn new ways, which is just as much a motivator to me as finishing a project. If your interested PM me.

Awesome work. This is really something that could become useful, please keep at it. Two more things are needed to make this tool extremely useful (at least for me  :D) :


  1. Highlighting in the application of the object that is selected (leaf or subtree), preferably a highlight that is visible even if the object is hidden behind something else. Perhaps a wireframe render in an additional renderpass (which is rendered last and clears the z-buffer before rendering)?


  2. As mentioned, modifying the objects



    Do you need anything? I might be able to help.

Thanks immutate for explaining what I intended to say (and implementing it before I ever said anything too  :D) Sorry I didn't answer sooner.



I think a good tool like this would benifit jME a lot… you'd have to run it by the other developers but I think including annotations for this in the jME classes would definatly be an option if someone is willing to write them up. (if only for the fact that it would be a form of documentation too).

Tobias said:

1) Highlighting in the application of the object that is selected (leaf or subtree), preferably a highlight that is visible even if the object is hidden behind something else. Perhaps a wireframe render in an additional renderpass (which is rendered last and clears the z-buffer before rendering)?


Beautiful idea! I'll start working this into the plan. I would like to finish my documentation (almost done) on the code I have so far, then I will begin implementation on the new ideas.
Tobias said:

Do you need anything? I might be able to help.

More great ideas like that.  8)

I'm going to get as much done on it as I can in the next two weeks, but then I move to Oakland, and will have to take a short break. If someone is really interested in helping out and can devote some time to it, I would bring them on board. This really isn't a large project and would go really fast with some help.

(Anybody interested, PM me)

Awesome work, man.  I do believe you took this idea further and faster than I would have.  I'm definitely watching this project.  I think I can already stop working on my own browser and go back to focusing on actually making that game thing :slight_smile:

Hi, great work!



I tried the jME v1 .jar on my project and it loaded the rootNode correctly, but it does not display any information?

(Only displays: "No Information is currently available")



Setup exactly as shown in the demo code in your start post. (update set)

Methius said:

I tried the jME v1 .jar on my project and it loaded the rootNode correctly, but it does not display any information?
(Only displays: "No Information is currently available")

Setup exactly as shown in the demo code in your start post. (update set)

I havn't made a jME v1 information library yet. Did you mean to say jME 2? If you are using jME 1 then "No Information" is expected at this point. If you are using jME 2 and the descriptor library jar is on your class path, then something is up. Can you glance through the console output, some logging will say if it actually found it or not. Thanks.

I have Good News!   :)



This week I implemented a properties table as an extension of JTable. I think it turned out pretty good. It’s not jME specific be any means, so it can be used by anyone for any other purpose, I’ll let it out soon.





Now for the really good news!  :smiley:



I refactored out the textual display system of the scene graph information into a independant library, allowing any number of different ways to display the data, just depends on which one is in your path (like physics implementations in jME Physics). The new one I’ve been working on this week uses the property table.



Larger View



Ask and you shall receive! You will be happy to know that every property shown is editable. I have written all the necessary JTable cell editors to allow you to change vectors, enum values, all of it. Now you can immediately tinker in your app and find the best setup, including moving things around and adjusting your lights.



I’m still finishing up a few remaining property sheets on the physics objects, and still need to decide how I want to handle editing a quaternion. What I’m most proud of is the handling of enumerations using generics. Any enum is automatically supported, and all values will be listed in a drop down when edited. Building a property sheet is super easy.



Maybe tomorrow I’ll have a link to the latest version.

I'm running it on jME v1, so my bad. :wink:

Thanks for the info. But I'm waiting a bit before switching to jME v2

nymon - Thanks for this excellent work.  Really looking forward to playing with the next version.