mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 03:59:19 +02:00
Editor terrain: texture browser, undo, conversion from terrain files
- Terrain work mode shows a browser of the textures folder in place of the node bank; textures/materials can be dragged onto the palette entries (replacing the material), the material field and the water material field - Ctrl+Z/Ctrl+Y for heightmap terrain changes: a brush stroke or an operation is one step of the editor history - Ground conversion reads only the files of the terrain directives (.txtf with origin/rotate, or .btf without text), paints the chunks with the materials of the triangles, drops only the shapes of those files - Fix: ground grids converted out-of-range floats to int, so whole-scene queries returned the triangles of a single cell (shifted chunks) - Fix: terrain layers copied from textures already uploaded without their data stayed grey - Fix: ImGui ID conflict between terrain tool radios and section headers - Fix: layers of terrain .txtf files named with the scenery/ prefix and could not be saved - Editor selftest commands for the terrain
This commit is contained in:
@@ -57,6 +57,7 @@ state_serializer::deserialize_begin( std::string const &Scenariofile ) {
|
||||
// drop any streamed editor terrain from a previously loaded scenery before the old region (and
|
||||
// its sections, which those chunks referenced) is destroyed below
|
||||
EditorTerrain.reset();
|
||||
scene::terrain_file::references().clear();
|
||||
|
||||
// TODO: move initialization to separate routine so we can reuse it
|
||||
SafeDelete( Region );
|
||||
@@ -722,6 +723,9 @@ state_serializer::deserialize_node( cParser &Input, scene::scratch_data &Scratch
|
||||
++Scratchpad.binary.geometry_imported;
|
||||
auto shape { scene::shape_node().import( Input, nodedata ) };
|
||||
material = shape.data().material;
|
||||
if( true == Global.editor_session ) {
|
||||
shape.source_file( scene::terrain_file::reference_of( Input.Name() ) );
|
||||
}
|
||||
simulation::Region->insert(
|
||||
std::move( shape ),
|
||||
Scratchpad,
|
||||
@@ -1188,6 +1192,11 @@ include_terrain_file( std::string File, std::string &Includes, scene::scratch_da
|
||||
return;
|
||||
}
|
||||
binary.terrain_textfiles.emplace_back( File );
|
||||
// the editor converts the triangles of the terrain files to heightmap terrain, it has to know them and where they're placed
|
||||
scene::terrain_file::references().push_back( {
|
||||
File,
|
||||
( Scratchpad.location.offset.empty() ? glm::dvec3( 0.0 ) : Scratchpad.location.offset.top() ),
|
||||
Scratchpad.location.rotation } );
|
||||
|
||||
auto const textfile { Global.asCurrentSceneryPath + File + ".txtf" };
|
||||
auto const binaryfile { Global.asCurrentSceneryPath + File + ".btf" };
|
||||
|
||||
Reference in New Issue
Block a user