Basic Scenegraph Editor questions

Hi!

In my current project I need to create a basic Scene-Editor for JME (using Swing components as the editorframe) and need some advice and help from you regarding the preparation. Following things are to be done:


  • Add boxes
  • Translate/Rotate/Scale boxes
  • Save/Load scene



    RenParticleEditor is a good startpoint for now. I want to clear up however some things before starting. My first questions are:

    If I save a scene in .jme format, can I edit each of the objects again in the scene after loading the file in the editor again? Or is the .jme format something like a "closed fixed file" that can only load the whole scene, and all previously different objects are suddenly handled as 1 whole single object? (e.g. if I add 3 boxes and save it and then load again - will these 3 boxes then be 1 single object, or can I still handle each of the boxes differently?)



    Also I know of MonkeyWorld3D and tried out the new release which is very nice. Unfortunately some mechanisms of how the scene's saving and loading works are confusing me and I need some explanation:



    In MW3D a project starts with creating a *.jme file. Saving and loading works on this very well using the "Save" option. There is however the option "Save as…" which offers to "Save as XML" or to save as "Binary format of JME". I don't understand what the purpose of these 2 is: if I save the scene as "xml" or as the "binary format" I am not able to load the scene again using only these 2 files. The only file working with saving and loading is the one created at the beginning of the project.



    So where is the difference between these 3 "Save-files"? Why can't I load the xml files? - isn't this supposed to be just another way of saving/loading the scene?

    And what is the "other binary format" which I can't load again in MW3D? (Nullpointerexception)

    Which one is recommended for a Scenegraph Editor?



    Another thing: I am wondering how it works when creating rings/arrows to rotate or translate objects. If I assume that I have a button in my GUI with "Add Box". Do I need to add a Node for each box? e.g. I need to "attach" circles/arrows to the object/box (in order to use it with mousepicks and pull or rotate it) which is only possible by attaching it to a node. Though I didn't see such additional nodes (when adding a box) listed in the Node/Object Explorer of MW3D. How does this work?  :?



    If there are others things I need to keep in mind feel free to add it. I am still a beginner in JME and any hints or help are appreciated :slight_smile:

Do what is natural and if performance sucks look at it in a different way.



Most of your specific things are already answered on the forum, you just need to know what to search for…



Try searching for say "terrain marker"…

Hi,



Regarding the save as options in the editor, those are for saving the scene graph in xml formate and binary as well. Before havee's new xml formate, there was an old xml formate for the jMe, which users can persist their scene graph objects with. havee added a new xml formate which is also capable of doing this as well, but with a different structure. Basically we support those both formates, the old xml which is very old, and the new one from havee. Now if your needs require that you want to persist your scene graph in xml, then you can just do it with save as option, and share your files with others, or use a version control for them for later comparison. XML is very handy in this, and not like the binary formate, which is the main reason why we added this support.



To be able to load those files again, "old formate must be named with .xml", and the new must be named with ".nxml" try to right click on those files, and open with spatial editor, and you should be able to have the same structure that you saved your file with. If you open them in the regular way, then you will see pure xml file.


And what is the "other binary format" which I can't load again in MW3D? (Nullpointerexception)
Which one is recommended for a Scenegraph Editor?


Where did you find this ? Anything appears on your log ? If yes can you please post it.


Node/Object Explorer of MW3D. How does this work?

We do have a wiki page about how those works, here is the link for the content outline that shows the structure of the managed objects.
http://www.monkeyworld3d.com/wiki/index.php?title=Content_outline_view

Its not that much :D.
Try select your object from there, and try to see what happens on the 3d viewport, once the object is selected, then you will be able to see properties view changes to reflect the properties of that object, try to play around there and see what happens.

Also the entry to the main wiki page:
http://www.monkeyworld3d.com/wiki/index.php?title=Main_Page

Hope those help.

TerrainMarker: http://www.jmonkeyengine.com/jmeforum/index.php?topic=8590.msg66721#msg66721

Outrunner said:

To be able to load those files again, "old formate must be named with .xml", and the new must be named with ".nxml" try to right click on those files, and open with spatial editor, and you should be able to have the same structure that you saved your file with. If you open them in the regular way, then you will see pure xml file.

And what is the "other binary format" which I can't load again in MW3D? (Nullpointerexception)
Which one is recommended for a Scenegraph Editor?


Where did you find this ? Anything appears on your log ? If yes can you please post it.

Ah that's how it works! I didn't use the rightclick->"open with Spatial Editor" but used "Open File..." instead trying to load the saved XML-files - which resulted in an error message. Now I tried them again the way you described it and everything loaded flawlessly without any error. :)

Regarding the Terrain-Marker I'm not sure it's the thing I need... although partially maybee :? What I specifically wanted to know was how it is possible to attach these (red/green/blue) x/y/z-Arrows to the box to translate the object in any direction. I've investigated your sample code in the topic you posted and from what I've seen you created a fixed "Marker" and updated it's position each time the position of the Box is updated. I thought that in order to translate the box the Marker must be attached to the box although it is not possible to directly attach objects to primitive spatials!

EDIT: aaaaaaaaah that's it ... now I get what you meant: the marker's position will always be updated with the "selected object's" position although it's never attached (like attaching to a Node) to the Box itself! This explains it. So I can handle these 3 Arrows the same way as the TerrainMarker. I conclude that when selecting the "Object Translation Mode" in MW3D those arrows will be positioned at the same coordinates as the center of the Box - and when dragging the mouse in x/y/z direction also the "selected box's" position will be updated.

Thanks for guiding me in the right direction!