示例#1
0
void CommandCopyPasteHeightmap::Execute()
{
	LandscapeEditorHeightmap* editor = GetEditor();
	if (!editor)
	{
		SetState(STATE_INVALID);
		return;
	}

	// Apply new heightmap
	if (heightmap)
	{
		if (editor->IsActive())
		{
			Heightmap* heightmap = editor->GetHeightmap();
			heightmap->Load(heightmapRedoFilename);
			editor->UpdateHeightmap(heightmap, updatedRect);
		}
		else
		{
			UpdateLandscapeHeightmap(heightmapRedoFilename);
		}
	}

	// Apply new tilemap
	if (tilemap)
	{
		UpdateLandscapeTilemap(tilemapRedoImage);
	}
}
示例#2
0
void CommandCopyPasteHeightmap::Cancel()
{
	// Restore old heightmap
	if (heightmap)
	{
		LandscapeEditorHeightmap* editor = GetEditor();
		if (!editor)
			return;
		
		if (editor->IsActive())
		{
			Heightmap* heightmap = editor->GetHeightmap();
			heightmap->Load(heightmapUndoFilename);
			editor->UpdateHeightmap(heightmap, updatedRect);
		}
		else
		{
			UpdateLandscapeHeightmap(heightmapUndoFilename);
		}
	}

	// Restore old tilemap
	if (tilemap)
	{
		UpdateLandscapeTilemap(tilemapUndoImage);
	}
}
void CommandDrawHeightmap::Cancel()
{
	LandscapeEditorHeightmap* editor = GetEditor();
	if (editor)
	{
		Heightmap* heightmap;
		editor->GetHeightmap(&heightmap);

		heightmap->Load(undoFilename);
		editor->UpdateHeightmap(heightmap);
	}
}
CommandDrawHeightmap::CommandDrawHeightmap()
:	Command(COMMAND_UNDO_REDO)
{
	redoFilename = "";

	LandscapeEditorHeightmap* editor = GetEditor();
	if (editor)
	{
		Heightmap* heightmap;
		editor->GetHeightmap(&heightmap);
		undoFilename = SaveHeightmap(heightmap, "_" + GetRandomString(10));
	}
}
示例#5
0
void CommandDrawHeightmap::Cancel()
{
	LandscapeEditorHeightmap* editor = GetEditor();
	if (!editor)
		return;

	if (editor->IsActive())
	{
		Heightmap* heightmap = editor->GetHeightmap();
		heightmap->Load(undoFilename);
		editor->UpdateHeightmap(heightmap, updatedRect);
	}
	else
	{
		UpdateLandscapeHeightmap(undoFilename);
	}
}
示例#6
0
void CommandDrawHeightmap::Execute()
{
	LandscapeEditorHeightmap* editor = GetEditor();
	if (editor == NULL)
	{
		SetState(STATE_INVALID);
		return;
	}

	if (editor->IsActive())
	{
		Heightmap* heightmap = editor->GetHeightmap();
		heightmap->Load(redoFilename);
		editor->UpdateHeightmap(heightmap, updatedRect);
	}
	else
	{
		UpdateLandscapeHeightmap(redoFilename);
	}
}
void CommandDrawHeightmap::Execute()
{
	LandscapeEditorHeightmap* editor = GetEditor();
	if (editor == NULL)
	{
		SetState(STATE_INVALID);
		return;
	}

	Heightmap* heightmap;
	editor->GetHeightmap(&heightmap);

	if (redoFilename == "")
	{
		redoFilename = SaveHeightmap(heightmap, "_" + GetRandomString(10));
	}
	else
	{
		
		heightmap->Load(redoFilename);
		editor->UpdateHeightmap(heightmap);
	}
}