mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 08:44:50 +00:00
Create and delete procedural objects from the studio's entry list
A view's entries can now be created from a starter tree in a chosen folder and deleted from the browser. Deleting lists the pack files that still name the entry, then moves it to the desktop trash, or the pack's .iris/trash where there is none. An EditableSceneView opts in with SceneCreation; the host does the writing. v3: d6e6fc3ef
This commit is contained in:
1 parent
7eb45cebf6
commit
3c03bba7e7
19 files changed
+760
-32
No files matched your search
+1
-1
@@ -46,7 +46,7 @@ types that carry them and lists what the Iris adapter still owes.
|
||||
| Dense chunk output | `Hunk<T>`, `GenerationContext.blocks`, reference `ArrayHunk<T>` |
|
||||
| Positions, boxes and faces | `com.volmit.geometry`: `BlockPosition`, `BlockBox`, `BlockFace` |
|
||||
| Sparse geometry | `GeneratedObject` |
|
||||
| Studio views of what a module builds | `com.volmit.tooling`: `ModuleSetup.tooling()` (`ToolingRegistry.registerView`), sealed `StudioView` (`SceneView` with `SceneEntry`, `BakeRun` (`Stage`), `BlockParts`, `PatternView` with `PatternEntry`, `PatternArea`, `BlockPattern`), `EditableSceneView` (`SceneFile`, `NodeGraph`, `GraphNode` with `Link`, `NodeSettings`, `Edits`, `Addition`), `JsonText`, `JsonPath` (`Key`, `Index`), host `StudioViewRegistration` |
|
||||
| Studio views of what a module builds | `com.volmit.tooling`: `ModuleSetup.tooling()` (`ToolingRegistry.registerView`), sealed `StudioView` (`SceneView` with `SceneEntry`, `BakeRun` (`Stage`), `BlockParts`, `PatternView` with `PatternEntry`, `PatternArea`, `BlockPattern`), `EditableSceneView` (`SceneFile`, `SceneCreation`, `NodeGraph`, `GraphNode` with `Link`, `NodeSettings`, `Edits`, `Addition`), `JsonText`, `JsonPath` (`Key`, `Index`), host `StudioViewRegistration` |
|
||||
| Commands of a module | `com.volmit.tooling`: `ToolingRegistry.registerCommand`, immutable `Command` (`named`, `alias`, `describe`, `child`, `argument`, `runs`, `openToEveryone`), typed `Argument` (`word`, `text`, `integer`, `decimal`, `flag`, `choice`, `resource`, `registered`, `orElse`, `suggesting`), `CommandAction`, `CommandContext` (`get`, `sender`, `pack`, `world`, `platform`), plain-text `Sender`, `ToolPack` (`edit` with `PackEdit`, `outputFolder`, `objects` with `ObjectCodec`), host `CommandRegistration` in `FeatureCatalog.commands()` |
|
||||
| Buffered placement writes | `PlacementRequest`, `PlacementAccess`, host-owned `PlacementEdit` |
|
||||
| Typed generation and persistent storage | `mantle` package |
|
||||
|
||||
@@ -1373,6 +1373,10 @@ API now: `world.running()`, `world.seed(purpose)`, `TerrainSampler`, `FeatureSet
|
||||
reads as nodes (`NodeGraph`). The studio makes every write, so one implementation keeps the author's layout,
|
||||
checks the result is still JSON, refuses edits outside a studio world and moves the file in atomically for the pack
|
||||
watcher. `JsonText` is in the API because a view reads positions from it; splicing text is not.
|
||||
- **Creating and deleting are the host's too.** A view says only how its entries are made (`SceneCreation`: the kind
|
||||
whose folder holds the files, the JSON a new one starts as, and the prefix other files name an entry by). The host
|
||||
checks the key is a folder-safe name, writes the file, lists the files that still name an entry before it goes, and
|
||||
moves it to the trash, so a view never touches the pack's files.
|
||||
- **Paths are typed.** A `JsonPath` step is a `Key` or an `Index`, so a view cannot write a step the file cannot hold.
|
||||
- **The wire is the host's.** The studio protocol may encode an absent part or block as it likes (Iris sends `-1`);
|
||||
the API types say absent with `Optional`/`OptionalInt`.
|
||||
|
||||
+3
-1
@@ -534,7 +534,9 @@ final class RuinScenes implements SceneView {
|
||||
settings (`NodeSettings`, shown as the pack's schema describes their type), the nodes it holds and the `Edits` the
|
||||
studio may make (a child list to move nodes into, whether it moves, the `Addition`s it offers). Places in the file
|
||||
are `JsonPath`s of `Key` and `Index` steps. The studio writes the file itself, rewriting only what changes; the
|
||||
view never writes.
|
||||
view never writes. A view whose entries the studio may create and delete returns a `SceneCreation` from
|
||||
`creation()`: the resource kind of its files, the starter JSON of a new entry and the text other files name an
|
||||
entry by; the studio does the writing, listing of uses and trashing.
|
||||
- Absent values are empty, never blank or `-1`: an entry without a group, a node that draws no part of the scene
|
||||
(`GraphNode.part()`), a column a pattern places nothing at (`BlockPattern.pickAt`).
|
||||
|
||||
|
||||
@@ -20,4 +20,9 @@ public interface EditableSceneView extends SceneView {
|
||||
* @throws IllegalArgumentException when {@code text} does not hold what this view edits
|
||||
*/
|
||||
NodeGraph graph(PackWorld world, String key, JsonText text);
|
||||
|
||||
/** How the studio creates and removes entries of this view; empty when it may not, which is the default. */
|
||||
default Optional<SceneCreation> creation() {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.volmit.tooling;
|
||||
|
||||
import com.volmit.resource.ResourceKind;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* How the studio creates and removes the entries of an editable scene view: each entry is a file of {@code kind}, a new
|
||||
* one starts as the JSON text {@code starter}, and other files of the pack name an entry {@code key} as
|
||||
* {@code referencePrefix + key}, which is how the studio finds what still uses an entry before it is removed.
|
||||
*/
|
||||
public record SceneCreation(ResourceKind<?> kind, String starter, String referencePrefix) {
|
||||
public SceneCreation {
|
||||
Objects.requireNonNull(kind, "kind");
|
||||
Objects.requireNonNull(starter, "starter");
|
||||
Objects.requireNonNull(referencePrefix, "referencePrefix");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user