Quick and dirty terrain texture editing

main
copygirl 2 months ago
parent 8ad77c4616
commit 99e9779300
  1. 19
      terrain/Terrain+Editing.cs

@ -84,6 +84,25 @@ public partial class Terrain
NotifyPropertyListChanged();
}
if ((ev is InputEventMouseButton { ButtonIndex: var wheel2, Pressed: var pressed2, CtrlPressed: true })
&& (wheel2 is MouseButton.WheelUp or MouseButton.WheelDown) && (_selection != null))
{
GetViewport().SetInputAsHandled();
if (!pressed2) return;
var amount = (wheel2 == MouseButton.WheelUp) ? 1 : -1;
var selection = TileRegion.From(_selection.Value);
foreach (var pos in selection.GetAllTiles()) {
var tile = GetTile(pos);
tile.TexturePrimary = PosMod(tile.TexturePrimary + amount, 4);
SetTile(pos, tile);
}
UpdateMeshAndShape();
NotifyPropertyListChanged();
}
if (ev is InputEventMouseMotion)
_unhandledMotion = true;
}

Loading…
Cancel
Save