Jump to content

[SOLVED] Append imports and changes to existing files


photo

Recommended Posts

Hey chaps,

 

Is it possible to append new imported nodes and height changes in the landscape into existing files, such as world file and landscape files? I'd like to change my world generically, save it and load it by an IG with communication.

 

Thanks a lot

Renato

Link to comment

Hey Renato!

 

Yup, it's possible to save both world and terrain data.

 

1) To save current world, you need to execute console command "world_save" by hands or in C++:

Unigine::Console *console = Unigine::Console::get();
console->run("world_save");

2) After you applied some changes to terrain you can save them by calling ObjectTerrain::saveTerrain function (https://developer.unigine.com/en/docs/1.0/cpp_api/reference/api_objectterrain_class#c_saveTerrain_constcharm_int)

Link to comment

Hi Andrey

 

Jup, I get my plugin to save my world changes, with exactly how you propose it!

 

Right now, I'm trying to append the node data to an existing .world file! I can save them to a new one, but not append them to an existing. I have to say that I load the nodes from my dll through

objTerrain->loadNode(path);

After loading the nodes, the editor tells me "ObjectMeshStatic external is not an editor node".

 

Cheers,

Renato

Link to comment

Renato,

That's because you haven't added node to the editor yet:

// load node to the world
Unigine::World *world = Unigine::World::get();
Unigine::NodePtr node = world->loadNode("some node");

// add node to the editor so it might be saved to .world file later
Unigine::Editor *editor = Unigine::Editor::get();
editor->addNode(node);
	
// release ownership (engine will take care of the node after we added it to the editor)
node->release();

Link to comment
×
×
  • Create New...