Linking models in generated terrain and later editing it in TerraMonkey

Hello,

I’m very pleased so far with the jMonkeyEngine. However I’m trying to auto-generate terrain from my map files, quite big terrains. And attach jMonkeyEngine models, such as trees, buildings and roads, to the terrain in this generation process. After generation this is saved as a jMonkeyEngine scene, It would be huge effort done in TerraMonkey GUI itself. Which I plan then to use to finalize these scenes. You know, the human touch.

These auto-generated scenes do open up in TerraMonkey, but generate error that the “scene was modified after calling update”. But the main question is, that can I link these models in auto-generation to the scene? This can be done in TerraMonkey GUI, but I would need to do it in code…? Now they just get added, or embedded in the scene.

I don’t understand what you want to do, sorry?

Isn’t TerraMonkey the GUI tool for creating terrain and scenes…?

In that editor I can link models rather than adding them, so that the changes in models are reflected on the scene.

https://wiki.jmonkeyengine.org/legacy/doku.php/sdk:scene_composer

Okay, it is Scene Composer… Not TerraMonkey…

I’m afraid I still don’t understand what you really ask for :frowning:

Linking Models to the scene

You can also link models/objects into your scene, this way they are reloaded dynamically from the other/original file.

Place the SceneComposer cursor where you want the model to be
Select the parent Node for the model in the SceneExplorer
In the Project Explorer right-click the model file you want to link
Choose "Link in SceneComposer"

Note that when linking objects this way, you cannot edit them as part of the scene. To change the model you have to change the original j3o file.

I’m auto-generating the initial scene. But I want to edit it in the Scene Composer. And all is subject to change. But in auto-generation if I:

Spatial s = assetManager.loadModel(“awesomeModel.jm3”);
rootNode.attachChild(s);

The model get ADDED rather than LINKED. And I want linking :slight_smile: Is it possible?

Ah. use an AssetLinkNode, it has methods to load a model via the assetmanager and attach it and it will save those asset names instead of the actual children when saving. Then when loading the model all children will be loaded from those lonked files.

Thank you, sounds like what I wanted. I will try later. Thank you!