mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-01 02:04:51 +00:00
Make the Caves view a viewer only
The Caves view no longer edits cave files. It shows each cave at the chosen size and variant, and redraws when a file is saved. The form, creating caves from the studio and EditableSceneView.showsNodes() are gone.
This commit is contained in:
1 parent
263f5baa3c
commit
22d69f362f
9 files changed
+14
-151
No files matched your search
@@ -385,7 +385,7 @@ public final class StudioBridge implements AutoCloseable {
|
||||
boolean editable = editors.edits(view.id());
|
||||
SceneSizesWire sizes = scenes.sizes(view.id()).map(SceneSizesWire::of).orElse(null);
|
||||
return new SceneViewInfo(view.id(), view.label(), view.description(), editable, editable && editors.creates(view.id()),
|
||||
editable && editors.showsNodes(view.id()), scenes.isBaked(view.id()), scenes.hasParts(view.id()), sizes);
|
||||
scenes.isBaked(view.id()), scenes.hasParts(view.id()), sizes);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@@ -922,8 +922,8 @@ public final class StudioBridge implements AutoCloseable {
|
||||
|
||||
/** A scene view as the studio lists it; {@code editable} when its entries can be edited as nodes, {@code creatable} when they can also be created and deleted, {@code baked} when their bake can be timed, {@code parts} when the blocks of a scene can be told by the part that placed them. */
|
||||
/** @param sizes null when the view's entries each have a size of their own */
|
||||
private record SceneViewInfo(String id, String label, String description, boolean editable, boolean creatable, boolean nodes,
|
||||
boolean baked, boolean parts, SceneSizesWire sizes) {
|
||||
private record SceneViewInfo(String id, String label, String description, boolean editable, boolean creatable, boolean baked,
|
||||
boolean parts, SceneSizesWire sizes) {
|
||||
}
|
||||
|
||||
private record SceneSizesWire(List<Integer> blocksAcross, int opening) {
|
||||
|
||||
@@ -119,11 +119,6 @@ public final class StudioEditors {
|
||||
return save(viewId, key, file, text);
|
||||
}
|
||||
|
||||
/** Whether the studio shows the files of {@code viewId} as nodes, rather than as one node's settings beside the scene. */
|
||||
public boolean showsNodes(String viewId) {
|
||||
return views.ask(viewId, "tell whether its files show as nodes", EditableSceneView::showsNodes);
|
||||
}
|
||||
|
||||
/** Whether entries of {@code viewId} can be created and removed from the studio. */
|
||||
public boolean creates(String viewId) {
|
||||
return views.ask(viewId, "tell whether entries are created", view -> view.creation().isPresent());
|
||||
|
||||
@@ -5,11 +5,10 @@ import art.arcane.iris.engine.object.TestSettings;
|
||||
import com.volmit.geometry.BlockPosition;
|
||||
import com.volmit.object.GeneratedObject;
|
||||
import com.volmit.object.ObjectBlock;
|
||||
import com.volmit.tooling.GraphNode;
|
||||
import com.volmit.tooling.JsonText;
|
||||
import com.volmit.tooling.NodeGraph;
|
||||
import com.volmit.tooling.EditableSceneView;
|
||||
import com.volmit.tooling.SceneEntry;
|
||||
import com.volmit.tooling.SceneRequest;
|
||||
import com.volmit.tooling.SceneView;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -88,22 +87,9 @@ public class CaveScenesTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aCaveFileIsOneNodeWithASectionForEachPart() {
|
||||
NodeGraph graph = view.graph(world, "deep/mixed", JsonText.parse(MIXED));
|
||||
|
||||
assertFalse(view.showsNodes());
|
||||
GraphNode cave = graph.roots().getFirst();
|
||||
assertEquals("mixed", cave.title());
|
||||
assertTrue(cave.children().isEmpty());
|
||||
assertEquals(List.of("Cave", "Tunnel", "Cavern", "Pillars"), cave.settings().stream().map(GraphNode.NodeSettings::title).toList());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void anUnwrittenPartHasASectionSoSettingItWritesIt() {
|
||||
NodeGraph graph = view.graph(world, "tunnels", JsonText.parse(TUNNELS_ONLY));
|
||||
|
||||
assertEquals(List.of("Cave", "Tunnel", "Cavern (unset)", "Pillars (unset)"),
|
||||
graph.roots().getFirst().settings().stream().map(GraphNode.NodeSettings::title).toList());
|
||||
public void theViewOnlyShowsCavesAndEditsNone() {
|
||||
SceneView registered = view;
|
||||
assertFalse(registered instanceof EditableSceneView);
|
||||
}
|
||||
|
||||
private GeneratedObject scene(String key, int variant, int size) {
|
||||
|
||||
Reference in new issue
Block a user