feat(pbs): add sprite animation and shared Studio authoring

Implement DEC-0084 with factory-only Sprite/Animator structs, complete result
lowering, validated animation sidecars, generated PBS factories and JavaFX/MCP
authoring through shared services.

Qualify native dev/release with ordinary and optimized producers, zero-allocation
playback, private-cycle reclamation, canonical Composer pixels, installed JARs
and JavaFX lifecycle. Preserve the runtime checkout and existing host ABI.
This commit is contained in:
2026-11-05 15:16:07 +00:00
parent 1d8b8c2101
commit bf31184d4d
151 changed files with 4823 additions and 98 deletions
@@ -12,6 +12,7 @@ public class BuilderPipelineContext {
public final BuilderPipelineConfig config;
public final SourceProviderFactory sourceProviderFactory;
public p.animation.GlyphBankLayoutSource glyphBankLayoutSource;
public Path rootProjectPathCanon;
public ResolvedWorkspace resolvedWorkspace;
@@ -18,13 +18,20 @@ public final class AssetSurfaceContextLoader {
private static final Path REGISTRY_PATH = Path.of("assets", ".prometeu", "index.json");
private final ObjectMapper mapper;
private final p.animation.GlyphBankLayoutSource layouts;
public AssetSurfaceContextLoader() {
this(new ObjectMapper());
this(new ObjectMapper(), null);
}
AssetSurfaceContextLoader(final ObjectMapper mapper) {
this.mapper = Objects.requireNonNull(mapper, "mapper");
this(mapper, null);
}
public AssetSurfaceContextLoader(p.animation.GlyphBankLayoutSource layouts) { this(new ObjectMapper(), layouts); }
private AssetSurfaceContextLoader(ObjectMapper mapper, p.animation.GlyphBankLayoutSource layouts) {
this.mapper = Objects.requireNonNull(mapper, "mapper"); this.layouts = layouts;
}
public FESurfaceContext load(final Path projectRoot) {
@@ -38,15 +45,29 @@ public final class AssetSurfaceContextLoader {
try {
final var document = mapper.readValue(registryPath.toFile(), RegistryDocument.class);
final var addressables = new ArrayList<Addressable>();
final var animations = new ArrayList<p.animation.AnimationSource>();
if (document.assets != null) {
for (final var asset : document.assets) {
if (asset == null || !isIncludedInBuild(asset)) {
continue;
}
addressables.add(new Addressable(toAddress(asset.root()), asset.assetId()));
var bankRoot=projectRoot.toAbsolutePath().normalize().resolve("assets").resolve(normalizeRoot(asset.root()));
var definition=bankRoot.resolve(p.animation.AnimationDocument.FILE_NAME);
if (Files.isRegularFile(definition)) {
if(layouts==null)throw new IllegalStateException("E_ANIMATION_LAYOUT_RESOLVER: included animation bank requires GlyphBankLayoutSource");
String text=Files.readString(definition, java.nio.charset.StandardCharsets.UTF_8);
var animation=new p.animation.AnimationCodec().decode(text);
var uuid=java.util.UUID.fromString(animation.bankAssetUuid());
var bank=layouts.resolve(projectRoot,uuid);
if(!bank.assetRoot().toRealPath().equals(bankRoot.toRealPath()))throw new IllegalArgumentException("Animation UUID does not identify its containing registered bank");
new p.animation.AnimationValidator().requireValid(animation,bank);
String projectName=mapper.readTree(projectRoot.resolve("prometeu.json").toFile()).path("name").asText();
animations.add(new p.animation.AnimationSource(projectName,projectRoot.toAbsolutePath().normalize(),definition,p.animation.AnimationRevision.of(text),animation,bank));
}
}
}
return new FESurfaceContext(ReadOnlyList.wrap(addressables));
return new FESurfaceContext(ReadOnlyList.wrap(addressables),ReadOnlyList.wrap(animations));
} catch (IOException exception) {
throw new IllegalStateException("Unable to load asset surface registry: " + registryPath, exception);
}
@@ -12,7 +12,6 @@ import p.studio.utilities.logs.LogAggregator;
@Slf4j
public class FrontendPhasePipelineStage implements PipelineStage {
private final AssetSurfaceContextLoader assetSurfaceContextLoader = new AssetSurfaceContextLoader();
@Override
public BuildingIssueSink run(final BuilderPipelineContext ctx, final LogAggregator logs) {
@@ -20,6 +19,15 @@ public class FrontendPhasePipelineStage implements PipelineStage {
final var provider = FrontendRegistryService.require(frontedSpec.getLanguageId());
final var projectTable = ctx.resolvedWorkspace.graph().projectTable();
final var fileTable = ctx.fileTable;
final var issues = BuildingIssueSink.empty();
final p.studio.compiler.messages.FESurfaceContext surface;
try {
surface = new AssetSurfaceContextLoader(ctx.glyphBankLayoutSource).load(ctx.resolvedWorkspace.mainProject().getRootPath());
} catch (IllegalArgumentException | IllegalStateException failure) {
issues.report(builder -> builder.error(true).phase("frontend").code("E_ANIMATION_SURFACE")
.message(failure.getMessage()));
return issues;
}
final var frontendPhaseContext = new FrontendPhaseContext(
projectTable,
fileTable,
@@ -27,9 +35,8 @@ public class FrontendPhasePipelineStage implements PipelineStage {
ctx.resolvedWorkspace.stdlib(),
ctx.resolvedWorkspace.target(),
p.studio.compiler.messages.HostAdmissionContext.permissiveDefault(),
assetSurfaceContextLoader.load(ctx.resolvedWorkspace.mainProject().getRootPath()));
surface);
final var diagnostics = DiagnosticSink.empty();
final var issues = BuildingIssueSink.empty();
ctx.irBackend = provider.compiler().compile(frontendPhaseContext, diagnostics, logs, issues);
logs.using(log).debug("Frontend phase completed successfully!");
adaptDiagnostics(diagnostics, issues);