Add parallel typed ship authoring and Blender LineArt capture
This commit is contained in:
parent
4b594e116c
commit
42eb5214ce
8 changed files with 636 additions and 1 deletions
|
|
@ -36,8 +36,9 @@ public static class Program
|
|||
case "targeting-catalog": return TargetingCatalog(args.Contains("apply"));
|
||||
case "targeting-catalog-6c": return TargetingCatalog6c(args.Contains("apply"));
|
||||
case "targeting-catalog-6d": return TargetingCatalog6d(args.Contains("apply"));
|
||||
case "ship-authoring": return ShipAuthoringCommands.Run(args.Skip(1).ToArray());
|
||||
default:
|
||||
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply]");
|
||||
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
62
tools/AetherDb/ShipAuthoringCommands.cs
Normal file
62
tools/AetherDb/ShipAuthoringCommands.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
// Uses the existing database executable; mod authoring does not earn another binary target.
|
||||
public static class ShipAuthoringCommands
|
||||
{
|
||||
public static int Run(string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
Console.Error.WriteLine("ship-authoring create <ship.cc> <stable-id> <name> | inspect <ship.cc> | validate <ship.cc>");
|
||||
return 1;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (args[0] == "inspect" && args.Length == 2)
|
||||
{
|
||||
using var cache = ShipAuthoringStore.Open(args[1]);
|
||||
var records = cache.GetAll<ShipAuthoring>().ToArray();
|
||||
if (records.Length != 1) throw new InvalidOperationException($"Expected one ship, found {records.Length}.");
|
||||
var ship = records[0];
|
||||
Console.WriteLine($"{ship.Id}: {ship.Hull?.Name}, {ship.Hull?.Hardpoints?.Count ?? 0} hardpoints, {ship.SchematicLines?.Count ?? 0} lines, {ship.SchematicLines?.Sum(line => line.Points?.Length / 3 ?? 0) ?? 0} points");
|
||||
return 0;
|
||||
}
|
||||
if (args[0] == "validate" && args.Length == 2)
|
||||
{
|
||||
var ship = ShipAuthoringStore.Read(args[1]);
|
||||
Console.WriteLine($"{ship.Id}: {ship.Hull.Name}, {ship.Hull.Hardpoints.Count} hardpoints, {ship.SchematicLines.Count} lines");
|
||||
return 0;
|
||||
}
|
||||
if (args[0] == "create" && args.Length == 4)
|
||||
{
|
||||
var path = Path.GetFullPath(args[1]);
|
||||
if (File.Exists(path)) throw new InvalidOperationException($"Refusing to replace {path}");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
var ship = new ShipAuthoring
|
||||
{
|
||||
Id = args[2],
|
||||
Hull = new HullData { Name = args[3], Shape = new Shape() },
|
||||
ModelAsset = "ship.glb",
|
||||
Anchors = new List<ShipAnchor>()
|
||||
};
|
||||
using (var cache = ShipAuthoringStore.Open(path, writable: true))
|
||||
{
|
||||
cache.Upsert(ship);
|
||||
cache.FlushAsync().Wait();
|
||||
}
|
||||
Console.WriteLine($"Created draft {path}; fill its model bindings and schematic in Blender.");
|
||||
return 0;
|
||||
}
|
||||
Console.Error.WriteLine("ship-authoring create <ship.cc> <stable-id> <name> | inspect <ship.cc> | validate <ship.cc>");
|
||||
return 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine(ex.Message);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue