mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 08:44:50 +00:00
Edit procedural objects as nodes in the studio
- Show procedural parts as a scene view and leave them out of the objects view
This commit is contained in:
1 parent
47aef59858
commit
9af3ec30ad
13 files changed
+756
-46
No files matched your search
@@ -0,0 +1,236 @@
|
||||
package art.arcane.iris.generation.procedural;
|
||||
|
||||
import art.arcane.iris.generation.procedural.part.PartBlob;
|
||||
import art.arcane.iris.generation.procedural.part.PartBranches;
|
||||
import art.arcane.iris.generation.procedural.part.PartCluster;
|
||||
import art.arcane.iris.generation.procedural.part.PartOutline;
|
||||
import art.arcane.iris.generation.procedural.part.PartStem;
|
||||
import art.arcane.iris.generation.procedural.part.ProceduralDecoration;
|
||||
import art.arcane.iris.generation.procedural.part.ProceduralMaterial;
|
||||
import art.arcane.iris.generation.procedural.part.ProceduralObject;
|
||||
import art.arcane.iris.generation.procedural.part.ProceduralPart;
|
||||
import art.arcane.iris.studio.scene.GraphNode;
|
||||
import art.arcane.iris.studio.scene.GraphNode.Addition;
|
||||
import art.arcane.iris.studio.scene.GraphNode.Edits;
|
||||
import art.arcane.iris.studio.scene.GraphNode.Link;
|
||||
import art.arcane.iris.studio.scene.GraphNode.NodeSettings;
|
||||
import art.arcane.iris.studio.scene.JsonPath;
|
||||
import art.arcane.iris.studio.scene.SceneBlocks;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A procedural object's file as nodes: the object with its parts growing from it, each part with the parts it holds,
|
||||
* and its materials and decorations beside it. A part, material or decoration written as the name of a snippet is
|
||||
* edited in the snippet's file, so it is shown without settings and can't be changed here.
|
||||
*/
|
||||
final class ProceduralObjectGraph {
|
||||
private static final String PARTS = "parts";
|
||||
private static final String CHILDREN = "children";
|
||||
private static final String COPIED_PART = "part";
|
||||
private static final String MATERIALS = "materials";
|
||||
private static final String DECORATIONS = "decorations";
|
||||
private static final String ROLE = "role";
|
||||
private static final String DECORATED_ROLES = "on";
|
||||
private static final String DEFAULT_MATERIAL_ROLE = "main";
|
||||
private static final String EACH_COPY = "each copy";
|
||||
private static final String GROWS = "";
|
||||
private static final Set<String> OBJECT_NODES = Set.of(MATERIALS, PARTS, DECORATIONS);
|
||||
private static final Set<String> PART_NODES = Set.of(Shape.STEM.key, Shape.BLOB.key, Shape.BRANCHES.key, Shape.CLUSTER.key, CHILDREN);
|
||||
private static final Set<String> COPY_NODES = Set.of(COPIED_PART);
|
||||
private static final Set<String> NO_NODES = Set.of();
|
||||
|
||||
private final PartOutline outline;
|
||||
|
||||
private ProceduralObjectGraph(PartOutline outline) {
|
||||
this.outline = outline;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param read what the pack reads from {@code file}, so its parts line up with the file's; parts it could not read
|
||||
* get no part
|
||||
*/
|
||||
static List<GraphNode> of(String name, JsonObject file, ProceduralObject read) {
|
||||
return new ProceduralObjectGraph(PartOutline.of(read)).graph(name, file, read);
|
||||
}
|
||||
|
||||
private List<GraphNode> graph(String name, JsonObject file, ProceduralObject read) {
|
||||
JsonPath parts = JsonPath.ROOT.member(PARTS);
|
||||
GraphNode object = new GraphNode(NodeKind.OBJECT.label, name, JsonPath.ROOT, SceneBlocks.NO_PART, List.of(),
|
||||
List.of(new NodeSettings(NodeKind.OBJECT.label, JsonPath.ROOT, ProceduralObject.class, OBJECT_NODES)),
|
||||
parts(parts, file.get(PARTS), read.parts(), read.defaultRole()),
|
||||
new Edits(Optional.of(parts), false, objectAdditions(parts)));
|
||||
List<GraphNode> roots = new ArrayList<>();
|
||||
roots.add(object);
|
||||
roots.addAll(listed(MATERIALS, file.get(MATERIALS), NodeKind.MATERIAL, ProceduralMaterial.class));
|
||||
roots.addAll(listed(DECORATIONS, file.get(DECORATIONS), NodeKind.DECORATION, ProceduralDecoration.class));
|
||||
return roots;
|
||||
}
|
||||
|
||||
// The pack reads the file's arrays element for element, so the definition's lists line up with them.
|
||||
private List<Link> parts(JsonPath arrayPath, JsonElement array, List<ProceduralPart> read, String parentRole) {
|
||||
if (!(array instanceof JsonArray elements)) {
|
||||
return List.of();
|
||||
}
|
||||
List<Link> links = new ArrayList<>();
|
||||
for (int index = 0; index < elements.size(); index++) {
|
||||
ProceduralPart part = index < read.size() ? read.get(index) : null;
|
||||
links.add(new Link(GROWS, part(arrayPath.element(index), elements.get(index), part, parentRole, true)));
|
||||
}
|
||||
return links;
|
||||
}
|
||||
|
||||
private GraphNode part(JsonPath path, JsonElement json, ProceduralPart read, String parentRole, boolean movable) {
|
||||
int drawnPart = read == null ? SceneBlocks.NO_PART : outline.idOf(read);
|
||||
if (!(json instanceof JsonObject object)) {
|
||||
return sharedNode(NodeKind.SHARED_PART, path, json, drawnPart, List.of(parentRole));
|
||||
}
|
||||
String role = stringAt(object, ROLE).filter(written -> !written.isBlank()).orElse(parentRole);
|
||||
List<NodeSettings> settings = new ArrayList<>();
|
||||
settings.add(new NodeSettings(NodeKind.PART.label, path, ProceduralPart.class, PART_NODES));
|
||||
List<Link> children = new ArrayList<>();
|
||||
NodeKind kind = NodeKind.GROUP;
|
||||
for (Shape shape : Shape.values()) {
|
||||
if (!(object.get(shape.key) instanceof JsonObject shapeObject)) {
|
||||
continue;
|
||||
}
|
||||
kind = kind == NodeKind.GROUP || shape.copiesAPart() ? shape.kind : kind;
|
||||
JsonPath shapePath = path.member(shape.key);
|
||||
settings.add(new NodeSettings(shape.kind.label, shapePath, shape.settings, shape.copiesAPart() ? COPY_NODES : NO_NODES));
|
||||
JsonElement copied = shapeObject.get(COPIED_PART);
|
||||
if (shape.copiesAPart() && copied != null) {
|
||||
children.add(new Link(EACH_COPY, part(shapePath.member(COPIED_PART), copied, copiedPartOf(read, shape), role, false)));
|
||||
}
|
||||
}
|
||||
JsonPath childList = path.member(CHILDREN);
|
||||
children.addAll(parts(childList, object.get(CHILDREN), read == null ? List.of() : read.children(), role));
|
||||
return new GraphNode(kind.label, kind.label, path, drawnPart, List.of(role), settings, children,
|
||||
new Edits(Optional.of(childList), movable, partAdditions(childList)));
|
||||
}
|
||||
|
||||
private static GraphNode sharedNode(NodeKind kind, JsonPath path, JsonElement json, int drawnPart, List<String> roles) {
|
||||
String title = json instanceof JsonPrimitive primitive && primitive.isString() ? primitive.getAsString() : String.valueOf(json);
|
||||
return new GraphNode(kind.label, title, path, drawnPart, roles, List.of(), List.of(), Edits.NONE);
|
||||
}
|
||||
|
||||
private static ProceduralPart copiedPartOf(ProceduralPart part, Shape shape) {
|
||||
if (part == null) {
|
||||
return null;
|
||||
}
|
||||
if (shape == Shape.BRANCHES) {
|
||||
return part.branches() == null ? null : part.branches().part();
|
||||
}
|
||||
return part.cluster() == null ? null : part.cluster().part();
|
||||
}
|
||||
|
||||
private static List<GraphNode> listed(String key, JsonElement array, NodeKind kind, Class<?> settings) {
|
||||
if (!(array instanceof JsonArray elements)) {
|
||||
return List.of();
|
||||
}
|
||||
List<GraphNode> nodes = new ArrayList<>();
|
||||
for (int index = 0; index < elements.size(); index++) {
|
||||
JsonPath path = JsonPath.ROOT.member(key).element(index);
|
||||
if (!(elements.get(index) instanceof JsonObject element)) {
|
||||
nodes.add(sharedNode(kind.shared, path, elements.get(index), SceneBlocks.NO_PART, List.of()));
|
||||
continue;
|
||||
}
|
||||
nodes.add(new GraphNode(kind.label, kind.label, path, SceneBlocks.NO_PART, rolesOf(kind, element),
|
||||
List.of(new NodeSettings(kind.label, path, settings, NO_NODES)), List.of(), Edits.NONE));
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
private static List<String> rolesOf(NodeKind kind, JsonObject element) {
|
||||
if (kind == NodeKind.MATERIAL) {
|
||||
return List.of(stringAt(element, ROLE).orElse(DEFAULT_MATERIAL_ROLE));
|
||||
}
|
||||
if (!(element.get(DECORATED_ROLES) instanceof JsonArray roles)) {
|
||||
return List.of();
|
||||
}
|
||||
List<String> decorated = new ArrayList<>();
|
||||
for (JsonElement role : roles) {
|
||||
if (role instanceof JsonPrimitive primitive && primitive.isString()) {
|
||||
decorated.add(primitive.getAsString());
|
||||
}
|
||||
}
|
||||
return decorated;
|
||||
}
|
||||
|
||||
private static Optional<String> stringAt(JsonObject object, String key) {
|
||||
return object.get(key) instanceof JsonPrimitive primitive && primitive.isString() ? Optional.of(primitive.getAsString()) : Optional.empty();
|
||||
}
|
||||
|
||||
/** What a new part starts as, so it bakes into something visible at once. */
|
||||
private static List<Addition> partAdditions(JsonPath list) {
|
||||
return List.of(
|
||||
new Addition("Stem", list, "{\"stem\": {\"length\": 6}}"),
|
||||
new Addition("Blob", list, "{\"blob\": {\"radius\": 2}}"),
|
||||
new Addition("Branches", list, "{\"branches\": {\"count\": 4, \"part\": {\"stem\": {\"length\": 4}}}}"),
|
||||
new Addition("Cluster", list, "{\"cluster\": {\"count\": 5, \"part\": {\"stem\": {\"length\": 3}}}}"),
|
||||
new Addition("Group", list, "{}"));
|
||||
}
|
||||
|
||||
private static List<Addition> objectAdditions(JsonPath parts) {
|
||||
List<Addition> additions = new ArrayList<>(partAdditions(parts));
|
||||
additions.add(new Addition("Material", JsonPath.ROOT.member(MATERIALS), "{\"role\": \"main\", \"block\": \"minecraft:stone\"}"));
|
||||
additions.add(new Addition("Decoration", JsonPath.ROOT.member(DECORATIONS), "{\"block\": \"minecraft:vine\"}"));
|
||||
return additions;
|
||||
}
|
||||
|
||||
private enum NodeKind {
|
||||
OBJECT("Object"),
|
||||
PART("Part"),
|
||||
STEM("Stem"),
|
||||
BLOB("Blob"),
|
||||
BRANCHES("Branches"),
|
||||
CLUSTER("Cluster"),
|
||||
GROUP("Group"),
|
||||
SHARED_PART("Shared part"),
|
||||
SHARED_MATERIAL("Shared material"),
|
||||
SHARED_DECORATION("Shared decoration"),
|
||||
MATERIAL("Material", SHARED_MATERIAL),
|
||||
DECORATION("Decoration", SHARED_DECORATION);
|
||||
|
||||
private final String label;
|
||||
/** What an element of this kind is called when it is written as a snippet's name. */
|
||||
private final NodeKind shared;
|
||||
|
||||
NodeKind(String label) {
|
||||
this(label, null);
|
||||
}
|
||||
|
||||
NodeKind(String label, NodeKind shared) {
|
||||
this.label = label;
|
||||
this.shared = shared;
|
||||
}
|
||||
}
|
||||
|
||||
/** The shapes a part can take, each written as a member of the part holding its settings. */
|
||||
private enum Shape {
|
||||
STEM("stem", NodeKind.STEM, PartStem.class),
|
||||
BLOB("blob", NodeKind.BLOB, PartBlob.class),
|
||||
BRANCHES("branches", NodeKind.BRANCHES, PartBranches.class),
|
||||
CLUSTER("cluster", NodeKind.CLUSTER, PartCluster.class);
|
||||
|
||||
private final String key;
|
||||
private final NodeKind kind;
|
||||
private final Class<?> settings;
|
||||
|
||||
Shape(String key, NodeKind kind, Class<?> settings) {
|
||||
this.key = key;
|
||||
this.kind = kind;
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
boolean copiesAPart() {
|
||||
return this == BRANCHES || this == CLUSTER;
|
||||
}
|
||||
}
|
||||
}
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
package art.arcane.iris.generation.procedural;
|
||||
|
||||
import art.arcane.iris.generation.geometry.IrisBlockVector;
|
||||
import art.arcane.iris.generation.procedural.part.ProceduralObject;
|
||||
import art.arcane.iris.generation.procedural.part.ResolvedProceduralObject;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.pack.loading.ObjectResourceLoader;
|
||||
import art.arcane.iris.pack.loading.ResourceLoader;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
import art.arcane.iris.studio.scene.EditableSceneView;
|
||||
import art.arcane.iris.studio.scene.GraphNode;
|
||||
import art.arcane.iris.studio.scene.SceneBakeTiming;
|
||||
import art.arcane.iris.studio.scene.SceneBlocks;
|
||||
import art.arcane.iris.studio.scene.SceneEntry;
|
||||
import art.arcane.iris.studio.scene.SceneRequest;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* The pack's procedural objects, every variant in 3D with the part that placed each block, edited in the studio as a
|
||||
* graph of their parts.
|
||||
*/
|
||||
public final class ProceduralPartsSceneView implements EditableSceneView {
|
||||
private static final char FOLDER_SEPARATOR = '/';
|
||||
private static final String STARTER = """
|
||||
{"variants":6,"seed":1337,"materials":[{"role":"rock","block":"minecraft:stone"}],"parts":[{"role":"rock","blob":{"radius":[2,4],"height":[2,3]}}]}""";
|
||||
private static final Creation CREATION = new Creation("procedural", STARTER, ProceduralObjectCatalog.KEY_PREFIX);
|
||||
|
||||
@Override
|
||||
public String id() {
|
||||
return "proceduralParts";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String label() {
|
||||
return "Procedural parts";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Procedural objects built from parts, every variant in 3D, edited as nodes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SceneEntry> entries(Engine engine) {
|
||||
ProceduralObjectCatalog catalog = catalogOf(engine.getData());
|
||||
return Arrays.stream(definitions(engine.getData()).getPossibleKeys()).sorted()
|
||||
.flatMap(path -> catalog.variants(ProceduralObjectCatalog.KEY_PREFIX + path).stream())
|
||||
.map(ProceduralPartsSceneView::entryOf)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SceneBlocks scene(Engine engine, SceneRequest request) {
|
||||
ResolvedProceduralObject object = resolved(engine, request.key());
|
||||
IrisObject variant = object.variant(Math.floorMod(request.variant(), object.variantCount()))
|
||||
.orElseThrow(() -> new NoSuchElementException("Variant " + request.variant() + " of " + request.key() + " bakes no blocks"));
|
||||
Map<IrisBlockVector, Integer> parts = object.parts(variant);
|
||||
SceneBlocks scene = new SceneBlocks();
|
||||
variant.getBlocks().forEach((position, state) -> scene.add(position.getBlockX(), position.getBlockY(), position.getBlockZ(), state.key(),
|
||||
parts.getOrDefault(position, SceneBlocks.NO_PART)));
|
||||
return scene;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tracesParts() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBaked() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SceneBakeTiming timeBake(Engine engine, String key) {
|
||||
BakeProfile profile = resolved(engine, key).profile();
|
||||
List<SceneBakeTiming.Stage> stages = Arrays.stream(BakeProfile.Stage.values())
|
||||
.map(stage -> new SceneBakeTiming.Stage(stage.label(), profile.nanos(stage)))
|
||||
.toList();
|
||||
return new SceneBakeTiming(profile.variantCount(), stages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<File> fileOf(Engine engine, String key) {
|
||||
ResourceLoader<ProceduralObject> definitions = definitions(engine.getData());
|
||||
if (!Arrays.asList(definitions.getPossibleKeys()).contains(key)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.ofNullable(definitions.findFile(key));
|
||||
}
|
||||
|
||||
// Text the pack can't read bakes no parts, so its nodes are drawn without any.
|
||||
@Override
|
||||
public List<GraphNode> graph(Engine engine, String key, JsonObject file) {
|
||||
ProceduralObject read;
|
||||
try {
|
||||
read = engine.getData().getGson().fromJson(file, ProceduralObject.class);
|
||||
} catch (JsonParseException unreadable) {
|
||||
read = new ProceduralObject();
|
||||
}
|
||||
return ProceduralObjectGraph.of(key.substring(key.lastIndexOf(FOLDER_SEPARATOR) + 1), file, read == null ? new ProceduralObject() : read);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Creation> creation() {
|
||||
return Optional.of(CREATION);
|
||||
}
|
||||
|
||||
private static ResolvedProceduralObject resolved(Engine engine, String key) {
|
||||
return catalogOf(engine.getData()).variants(ProceduralObjectCatalog.KEY_PREFIX + key)
|
||||
.filter(ResolvedProceduralObject.class::isInstance)
|
||||
.map(ResolvedProceduralObject.class::cast)
|
||||
.orElseThrow(() -> new NoSuchElementException("No procedural object " + key));
|
||||
}
|
||||
|
||||
private static ResourceLoader<ProceduralObject> definitions(IrisData data) {
|
||||
ResourceLoader<ProceduralObject> loader = data.getProceduralObjectLoader();
|
||||
if (loader == null) {
|
||||
throw new NoSuchElementException("This pack has no procedural objects");
|
||||
}
|
||||
return loader;
|
||||
}
|
||||
|
||||
// The object loader's catalog is the one world generation bakes from, and forgets its bakes when the pack reloads.
|
||||
private static ProceduralObjectCatalog catalogOf(IrisData data) {
|
||||
if (data.getObjectLoader() instanceof ObjectResourceLoader objects) {
|
||||
return objects.procedural();
|
||||
}
|
||||
return new ProceduralObjectCatalog(data);
|
||||
}
|
||||
|
||||
private static SceneEntry entryOf(ProceduralVariants variants) {
|
||||
String path = variants.path();
|
||||
int lastSeparator = path.lastIndexOf(FOLDER_SEPARATOR);
|
||||
String folder = lastSeparator < 0 ? "" : path.substring(0, lastSeparator);
|
||||
return new SceneEntry(path, path.substring(lastSeparator + 1), folder, variants.variantCount());
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,11 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject> {
|
||||
loadCache = new KCache<>(this::loadRaw, IrisSettings.get().getPerformance().getObjectLoaderCacheSize());
|
||||
}
|
||||
|
||||
/** The procedural objects this loader bakes and places, forgotten whenever its cache is cleared. */
|
||||
public ProceduralObjectCatalog procedural() {
|
||||
return procedural;
|
||||
}
|
||||
|
||||
public boolean supportsSchemas() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package art.arcane.iris.studio.bridge;
|
||||
|
||||
import art.arcane.iris.generation.procedural.ProceduralObjectCatalog;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
import art.arcane.iris.studio.scene.SceneBlocks;
|
||||
@@ -29,7 +30,10 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/** The pack's object files in 3D, filed by their folders. */
|
||||
/**
|
||||
* The pack's object files in 3D, filed by their folders. The object loader also lists the procedural objects it bakes,
|
||||
* which the procedural parts view shows instead.
|
||||
*/
|
||||
final class PackObjectsSceneView implements SceneView {
|
||||
static final String ID = "iris:objects";
|
||||
private static final char FOLDER_SEPARATOR = '/';
|
||||
@@ -53,6 +57,7 @@ final class PackObjectsSceneView implements SceneView {
|
||||
@Override
|
||||
public List<SceneEntry> entries(Engine engine) {
|
||||
return Arrays.stream(engine.getData().getObjectLoader().getPossibleKeys())
|
||||
.filter(key -> !ProceduralObjectCatalog.isProceduralKey(key))
|
||||
.sorted()
|
||||
.map(PackObjectsSceneView::entryOf)
|
||||
.toList();
|
||||
@@ -61,6 +66,9 @@ final class PackObjectsSceneView implements SceneView {
|
||||
@Override
|
||||
public SceneBlocks scene(Engine engine, SceneRequest request) {
|
||||
String key = request.key();
|
||||
if (ProceduralObjectCatalog.isProceduralKey(key)) {
|
||||
throw new NoSuchElementException("No object file " + key);
|
||||
}
|
||||
IrisObject object = engine.getData().getObjectLoader().load(key);
|
||||
if (object == null) {
|
||||
throw new NoSuchElementException("No object file " + key);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package art.arcane.iris.studio.bridge;
|
||||
|
||||
import art.arcane.iris.generation.procedural.part.ProceduralValue;
|
||||
import art.arcane.iris.pack.loading.IrisRegistrant;
|
||||
import art.arcane.iris.pack.schema.annotation.ArrayType;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
@@ -75,7 +76,7 @@ final class SettingsTypes {
|
||||
|
||||
/** Whether a setting of {@code type} is an object of settings of its own, such as a palette, rather than a plain value. */
|
||||
private static boolean isSettingsObject(Class<?> type) {
|
||||
return type.getName().startsWith(IRIS_PACKAGE) && !type.isEnum() && !type.isArray()
|
||||
return type.getName().startsWith(IRIS_PACKAGE) && !type.isEnum() && !type.isArray() && type != ProceduralValue.class
|
||||
&& !KeyedType.isKeyed(type) && !Collection.class.isAssignableFrom(type) && !Map.class.isAssignableFrom(type);
|
||||
}
|
||||
|
||||
@@ -131,6 +132,9 @@ final class SettingsTypes {
|
||||
if (type == String.class) {
|
||||
return textKindOf(field);
|
||||
}
|
||||
if (type == ProceduralValue.class) {
|
||||
return wire("any");
|
||||
}
|
||||
if (type.isEnum()) {
|
||||
return wire("enum", "constants", Arrays.stream(type.getEnumConstants()).map(constant -> constantOf((Enum<?>) constant)).toList());
|
||||
}
|
||||
@@ -207,6 +211,7 @@ final class SettingsTypes {
|
||||
case Number plain -> plain;
|
||||
case String plain -> plain;
|
||||
case Enum<?> constant -> constant.name();
|
||||
case ProceduralValue procedural -> GSON.toJsonTree(procedural);
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package art.arcane.iris.studio.map;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Where the studio gets the objects it shows: the pack's object files.
|
||||
*/
|
||||
public interface ObjectSource {
|
||||
/** The key of every entry, where a slash separates folders. */
|
||||
List<String> keys(IrisData data);
|
||||
|
||||
/** The objects of the entry, one for an object file and one per variant for an entry with variants; empty when none load. */
|
||||
List<IrisObject> variants(IrisData data, String key);
|
||||
}
|
||||
@@ -20,6 +20,7 @@ package art.arcane.iris.studio.scene;
|
||||
|
||||
import art.arcane.iris.generation.cave.CaveProfileSceneView;
|
||||
import art.arcane.iris.generation.hydrology.config.FluidProfileSceneView;
|
||||
import art.arcane.iris.generation.procedural.ProceduralPartsSceneView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -31,7 +32,8 @@ import java.util.Set;
|
||||
public final class SceneViews {
|
||||
private static final List<SceneView> VIEWS = distinct(List.of(
|
||||
new CaveProfileSceneView(),
|
||||
new FluidProfileSceneView()));
|
||||
new FluidProfileSceneView(),
|
||||
new ProceduralPartsSceneView()));
|
||||
|
||||
private SceneViews() {
|
||||
}
|
||||
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
package art.arcane.iris.generation.procedural;
|
||||
|
||||
import art.arcane.iris.generation.procedural.part.PartOutline;
|
||||
import art.arcane.iris.generation.procedural.part.ProceduralObject;
|
||||
import art.arcane.iris.generation.procedural.part.ProceduralPart;
|
||||
import art.arcane.iris.studio.scene.GraphNode;
|
||||
import art.arcane.iris.studio.scene.JsonPath;
|
||||
import art.arcane.iris.studio.scene.SceneBlocks;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ProceduralObjectGraphTest {
|
||||
private static final Gson GSON = new Gson();
|
||||
private static final String TREE = """
|
||||
{
|
||||
"materials": [{"role": "wood", "block": "minecraft:oak_log"}, {"role": "leaves", "block": "minecraft:oak_leaves"}],
|
||||
"parts": [
|
||||
{
|
||||
"stem": {"length": 6},
|
||||
"children": [{"role": "leaves", "blob": {"radius": 3}}]
|
||||
},
|
||||
{"branches": {"count": 3, "part": {"stem": {"length": 2}}}}
|
||||
],
|
||||
"decorations": [{"block": "minecraft:vine", "on": ["wood", "leaves"]}]
|
||||
}""";
|
||||
|
||||
@Test
|
||||
public void theObjectHoldsItsPartsWithItsMaterialsAndDecorationsBeside() {
|
||||
List<GraphNode> roots = graphOf(TREE, TREE);
|
||||
|
||||
assertEquals(List.of("Object", "Material", "Material", "Decoration"), roots.stream().map(GraphNode::kind).toList());
|
||||
GraphNode object = roots.get(0);
|
||||
assertEquals("oak", object.title());
|
||||
assertEquals(JsonPath.ROOT, object.path());
|
||||
assertEquals(Optional.of(JsonPath.ROOT.member("parts")), object.edits().childList());
|
||||
assertEquals(List.of("Stem", "Branches"), object.children().stream().map(link -> link.node().kind()).toList());
|
||||
assertEquals(List.of("leaves"), roots.get(2).roles());
|
||||
assertEquals(List.of("wood", "leaves"), roots.get(3).roles());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aPartTakesItsParentsRoleUnlessItSetsOne() {
|
||||
GraphNode stem = graphOf(TREE, TREE).get(0).children().get(0).node();
|
||||
GraphNode crown = stem.children().get(0).node();
|
||||
|
||||
assertEquals(List.of("wood"), stem.roles());
|
||||
assertEquals(List.of("leaves"), crown.roles());
|
||||
assertEquals(JsonPath.ROOT.member("parts").element(0).member("children").element(0), crown.path());
|
||||
assertTrue(crown.edits().movable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aPartShowsItsOwnSettingsAndItsShapesWithoutWhatAreNodes() {
|
||||
GraphNode branches = graphOf(TREE, TREE).get(0).children().get(1).node();
|
||||
|
||||
assertEquals(List.of("Part", "Branches"), branches.settings().stream().map(GraphNode.NodeSettings::title).toList());
|
||||
assertTrue(branches.settings().get(0).shownAsNodes().contains("branches"));
|
||||
assertEquals(Set.of("part"),branches.settings().get(1).shownAsNodes());
|
||||
assertEquals(JsonPath.ROOT.member("parts").element(1).member("branches"), branches.settings().get(1).path());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void eachCopyOfABranchIsWiredAsSuchAndStaysInPlace() {
|
||||
GraphNode.Link copy = graphOf(TREE, TREE).get(0).children().get(1).node().children().get(0);
|
||||
|
||||
assertEquals("each copy", copy.wire());
|
||||
assertEquals(JsonPath.ROOT.member("parts").element(1).member("branches").member("part"), copy.node().path());
|
||||
assertFalse(copy.node().edits().movable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void partsAreNumberedAsTheOutlineOfWhatThePackReadNumbersThem() {
|
||||
ProceduralObject read = GSON.fromJson(TREE, ProceduralObject.class);
|
||||
PartOutline outline = PartOutline.of(read);
|
||||
List<GraphNode> roots = ProceduralObjectGraph.of("oak", parse(TREE), read);
|
||||
|
||||
GraphNode stem = roots.get(0).children().get(0).node();
|
||||
GraphNode crown = stem.children().get(0).node();
|
||||
ProceduralPart readStem = read.parts().get(0);
|
||||
assertEquals(outline.idOf(readStem), stem.part());
|
||||
assertEquals(outline.idOf(readStem.children().get(0)), crown.part());
|
||||
assertEquals(SceneBlocks.NO_PART, roots.get(0).part());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aPartThePackHasNotReadYetDrawsNoPart() {
|
||||
String older = """
|
||||
{"parts": [{"stem": {"length": 6}}]}""";
|
||||
|
||||
List<GraphNode> roots = graphOf(TREE, older);
|
||||
|
||||
assertEquals(SceneBlocks.NO_PART, roots.get(0).children().get(1).node().part());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aPartWrittenAsASnippetIsShownButNotEdited() {
|
||||
String file = """
|
||||
{"parts": ["snippet/procedural-part/crown"]}""";
|
||||
String asThePackReadsIt = """
|
||||
{"parts": [{"blob": {"radius": 3}}]}""";
|
||||
|
||||
GraphNode shared = graphOf(file, asThePackReadsIt).get(0).children().get(0).node();
|
||||
|
||||
assertEquals("Shared part", shared.kind());
|
||||
assertEquals("snippet/procedural-part/crown", shared.title());
|
||||
assertTrue(shared.settings().isEmpty());
|
||||
assertEquals(GraphNode.Edits.NONE, shared.edits());
|
||||
assertEquals(0, shared.part());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aMaterialWrittenAsASnippetIsShownButNotEdited() {
|
||||
String file = """
|
||||
{"materials": ["snippet/procedural-material/bark"]}""";
|
||||
|
||||
GraphNode shared = graphOf(file, "{}").get(1);
|
||||
|
||||
assertEquals("Shared material", shared.kind());
|
||||
assertTrue(shared.settings().isEmpty());
|
||||
assertEquals(GraphNode.Edits.NONE, shared.edits());
|
||||
}
|
||||
|
||||
private static List<GraphNode> graphOf(String file, String asThePackReadsIt) {
|
||||
return ProceduralObjectGraph.of("oak", parse(file), GSON.fromJson(asThePackReadsIt, ProceduralObject.class));
|
||||
}
|
||||
|
||||
private static JsonObject parse(String json) {
|
||||
return JsonParser.parseString(json).getAsJsonObject();
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,8 @@ import java.util.NoSuchElementException;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class PackObjectsSceneViewTest {
|
||||
@@ -25,8 +27,8 @@ public class PackObjectsSceneViewTest {
|
||||
private final PackObjectsSceneView view = new PackObjectsSceneView();
|
||||
|
||||
@Test
|
||||
public void objectFilesAreListedByFolder() {
|
||||
when(objects.getPossibleKeys()).thenReturn(new String[]{"trees/oak", "well"});
|
||||
public void objectFilesAreListedByFolderWithoutTheBakedProceduralObjects() {
|
||||
when(objects.getPossibleKeys()).thenReturn(new String[]{"trees/oak", "procedural/rocks/boulder", "well"});
|
||||
|
||||
List<SceneEntry> entries = view.entries(engine);
|
||||
|
||||
@@ -48,6 +50,12 @@ public class PackObjectsSceneViewTest {
|
||||
assertThrows(NoSuchElementException.class, () -> view.scene(engine, request("gone")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aProceduralObjectIsNotBakedAsAnObjectFile() {
|
||||
assertThrows(NoSuchElementException.class, () -> view.scene(engine, request("procedural/rocks/boulder")));
|
||||
verify(objects, never()).load("procedural/rocks/boulder");
|
||||
}
|
||||
|
||||
private static SceneRequest request(String key) {
|
||||
return new SceneRequest(key, 0, 0, Map.of());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
package art.arcane.iris.studio.bridge;
|
||||
|
||||
import art.arcane.iris.generation.procedural.part.PartBlob;
|
||||
import art.arcane.iris.generation.procedural.part.ProceduralMaterial;
|
||||
import art.arcane.iris.generation.procedural.part.ProceduralObject;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.pack.loading.ResourceLoader;
|
||||
import art.arcane.iris.studio.scene.JsonPath;
|
||||
import com.google.gson.Gson;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class StudioEditorsTest {
|
||||
private static final String VIEW = "proceduralParts";
|
||||
private static final String KEY = "rocks/boulder";
|
||||
private static final String BOULDER = """
|
||||
{
|
||||
// A lone boulder
|
||||
"materials": [{"role": "rock", "block": "minecraft:stone"}],
|
||||
"parts": [{"role": "rock", "blob": {"radius": [2, 4]}}]
|
||||
}""";
|
||||
private static final SceneFiles.DesktopTrash NO_DESKTOP = file -> false;
|
||||
|
||||
@Rule
|
||||
public final TemporaryFolder folder = new TemporaryFolder();
|
||||
|
||||
private Path pack;
|
||||
// A studio world generates from a copy of the pack, which no edit may touch.
|
||||
private Path loadedCopy;
|
||||
private Path boulder;
|
||||
private Engine engine;
|
||||
|
||||
@Before
|
||||
public void writePack() throws IOException {
|
||||
pack = folder.newFolder("pack").toPath();
|
||||
boulder = pack.resolve("procedural/rocks/boulder.json");
|
||||
Files.createDirectories(boulder.getParent());
|
||||
Files.writeString(boulder, BOULDER, StandardCharsets.UTF_8);
|
||||
loadedCopy = folder.newFolder("loaded").toPath();
|
||||
Path loadedBoulder = loadedCopy.resolve("procedural/rocks/boulder.json");
|
||||
Files.createDirectories(loadedBoulder.getParent());
|
||||
Files.copy(boulder, loadedBoulder);
|
||||
engine = studioEngine(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void anEntryIsReadAsNodesWithTheSettingsTypesTheyShow() throws IOException {
|
||||
StudioEditors.EditorState state = editors().read(VIEW, KEY);
|
||||
|
||||
assertEquals("procedural/rocks/boulder.json", state.file());
|
||||
assertEquals(BOULDER, state.text());
|
||||
assertNull(state.problem());
|
||||
assertNull(state.locked());
|
||||
assertEquals(List.of("Object", "Material"), state.roots().stream().map(StudioEditors.NodeWire::kind).toList());
|
||||
StudioEditors.NodeWire blob = state.roots().get(0).children().get(0).node();
|
||||
assertEquals(List.of("parts", 0), blob.path());
|
||||
assertEquals(0, blob.partId());
|
||||
assertTrue(blob.duplicable());
|
||||
assertTrue(state.types().containsKey(ProceduralObject.class.getName()));
|
||||
assertEquals(Map.of("kind", "any"), optionOf(state, PartBlob.class, "radius").kind());
|
||||
assertEquals("BLOCK_TYPE", optionOf(state, ProceduralMaterial.class, "block").kind().get("reference"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void anEditChangesOnlyTheValueItSets() throws IOException {
|
||||
StudioEditors editors = editors();
|
||||
String revision = editors.read(VIEW, KEY).revision();
|
||||
|
||||
StudioEditors.EditorState edited = editors.edit(VIEW, KEY, revision, new GraphEdit.Set(JsonPath.ROOT, "variants", "3"));
|
||||
|
||||
String expected = BOULDER.replace("\"parts\": [{\"role\": \"rock\", \"blob\": {\"radius\": [2, 4]}}]",
|
||||
"\"parts\": [{\"role\": \"rock\", \"blob\": {\"radius\": [2, 4]}}],\n \"variants\": 3");
|
||||
assertEquals(expected, Files.readString(boulder, StandardCharsets.UTF_8));
|
||||
assertEquals(expected, edited.text());
|
||||
assertNotEquals(revision, edited.revision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void anEditOnTextThatChangedSinceIsRefused() throws IOException {
|
||||
StudioEditors editors = editors();
|
||||
String revision = editors.read(VIEW, KEY).revision();
|
||||
Files.writeString(boulder, BOULDER.replace("A lone boulder", "Edited elsewhere"), StandardCharsets.UTF_8);
|
||||
|
||||
assertThrows(StudioEditors.StaleEditException.class, () -> editors.edit(VIEW, KEY, revision, new GraphEdit.Unset(JsonPath.ROOT, "parts")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void undoingWritesTheWholeFileBack() throws IOException {
|
||||
StudioEditors editors = editors();
|
||||
String revision = editors.edit(VIEW, KEY, editors.read(VIEW, KEY).revision(), new GraphEdit.Unset(JsonPath.ROOT, "materials")).revision();
|
||||
|
||||
editors.write(VIEW, KEY, revision, BOULDER);
|
||||
|
||||
assertEquals(BOULDER, Files.readString(boulder, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void outsideAStudioWorldTheFileIsShownButNotEdited() throws IOException {
|
||||
engine = studioEngine(false);
|
||||
StudioEditors editors = editors();
|
||||
String revision = editors.read(VIEW, KEY).revision();
|
||||
|
||||
assertNotNull(editors.read(VIEW, KEY).locked());
|
||||
assertThrows(StudioEditors.EditsLockedException.class, () -> editors.edit(VIEW, KEY, revision, new GraphEdit.Unset(JsonPath.ROOT, "parts")));
|
||||
assertThrows(StudioEditors.EditsLockedException.class, () -> editors.create(VIEW, "rocks/pebble"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aFileThatIsNoLongerJsonIsShownWithWhy() throws IOException {
|
||||
Files.writeString(boulder, "{\"parts\": [", StandardCharsets.UTF_8);
|
||||
|
||||
StudioEditors.EditorState state = editors().read(VIEW, KEY);
|
||||
|
||||
assertNull(state.roots());
|
||||
assertNotNull(state.problem());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aNewEntryStartsFromTheStarterAndIsNotWrittenTwice() throws IOException {
|
||||
StudioEditors editors = editors();
|
||||
|
||||
editors.create(VIEW, "rocks/pebble");
|
||||
|
||||
Path pebble = pack.resolve("procedural/rocks/pebble.json");
|
||||
assertTrue(Files.readString(pebble, StandardCharsets.UTF_8).contains("\"blob\":{\"radius\":[2,4],\"height\":[2,3]}"));
|
||||
assertThrows(IllegalArgumentException.class, () -> editors.create(VIEW, "rocks/pebble"));
|
||||
assertThrows(IllegalArgumentException.class, () -> editors.create(VIEW, "Rocks/../escape"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theFilesThatPlaceAnEntryAreItsUses() throws IOException {
|
||||
Path forest = pack.resolve("biomes/forest.json");
|
||||
Files.createDirectories(forest.getParent());
|
||||
Files.writeString(forest, "{\"objects\": [{\"place\": [\"procedural/rocks/boulder\"]}]}", StandardCharsets.UTF_8);
|
||||
Path schema = pack.resolve(".iris/schema/biomes.json");
|
||||
Files.createDirectories(schema.getParent());
|
||||
Files.writeString(schema, "{\"enum\": [\"procedural/rocks/boulder\"]}", StandardCharsets.UTF_8);
|
||||
|
||||
assertEquals(List.of("biomes/forest.json"), editors().usesOf(VIEW, KEY));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aDeletedEntryGoesToThePacksTrashWithoutADesktop() throws IOException {
|
||||
String trashedTo = editors().delete(VIEW, KEY);
|
||||
|
||||
assertEquals(".iris/trash", trashedTo);
|
||||
assertFalse(Files.exists(boulder));
|
||||
try (var trashed = Files.list(pack.resolve(".iris/trash"))) {
|
||||
assertEquals(1, trashed.count());
|
||||
}
|
||||
}
|
||||
|
||||
private StudioEditors editors() {
|
||||
return new StudioEditors(new StudioScenes(), engine, NO_DESKTOP);
|
||||
}
|
||||
|
||||
private static SettingsTypes.OptionWire optionOf(StudioEditors.EditorState state, Class<?> type, String name) {
|
||||
return state.types().get(type.getName()).options().stream().filter(option -> option.name().equals(name)).findFirst().orElseThrow();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Engine studioEngine(boolean studio) {
|
||||
ResourceLoader<ProceduralObject> definitions = mock(ResourceLoader.class);
|
||||
when(definitions.getPossibleKeys()).thenReturn(new String[]{KEY});
|
||||
when(definitions.findFile(anyString())).thenAnswer(asked -> loadedCopy.resolve("procedural").resolve(asked.getArgument(0) + ".json").toFile());
|
||||
IrisData data = mock(IrisData.class);
|
||||
when(data.getDataFolder()).thenReturn(loadedCopy.toFile());
|
||||
when(data.getProceduralObjectLoader()).thenReturn(definitions);
|
||||
when(data.getGson()).thenReturn(new Gson());
|
||||
Engine studioEngine = mock(Engine.class);
|
||||
when(studioEngine.getData()).thenReturn(data);
|
||||
when(studioEngine.getPackSource()).thenReturn(pack);
|
||||
when(studioEngine.isStudio()).thenReturn(studio);
|
||||
return studioEngine;
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public class SceneContractTest {
|
||||
public void theViewsTheStudioAlreadyShowsKeepTheirIds() {
|
||||
List<String> ids = SceneViews.all().stream().map(SceneView::id).toList();
|
||||
|
||||
assertEquals(List.of("caveProfiles", "fluidProfiles"), ids);
|
||||
assertEquals(List.of("caveProfiles", "fluidProfiles", "proceduralParts"), ids);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -17,11 +17,9 @@ import {
|
||||
Package,
|
||||
Palette,
|
||||
Pickaxe,
|
||||
Pyramid,
|
||||
Shapes,
|
||||
Sprout,
|
||||
TreeDeciduous,
|
||||
TreePine,
|
||||
Trees,
|
||||
Waves,
|
||||
Workflow,
|
||||
@@ -47,15 +45,13 @@ const VIEW_ICONS: Record<string, LucideIcon> = {
|
||||
'decorator-load': Sprout,
|
||||
'layer-load': Layers,
|
||||
caveProfiles: Pickaxe,
|
||||
treeProfiles: TreePine,
|
||||
formationProfiles: Pyramid,
|
||||
fluidProfiles: Droplets,
|
||||
world3d: Box,
|
||||
savedWorld: HardDrive,
|
||||
'iris:terrain/palettes': Palette,
|
||||
'iris:decorant/decorators': Flower2,
|
||||
'iris:objects': Package,
|
||||
'iris:objects/procedural': Workflow,
|
||||
proceduralParts: Workflow,
|
||||
noise: AudioWaveform,
|
||||
imageMaps: ImageIcon,
|
||||
pregen: Zap
|
||||
|
||||
@@ -74,7 +74,7 @@ const VIEW_KEYS: Record<string, Chord> = {
|
||||
world3d: '4',
|
||||
'iris:terrain/palettes': 'p',
|
||||
'iris:objects': 'o',
|
||||
'iris:objects/procedural': 't',
|
||||
proceduralParts: 't',
|
||||
noise: 'n',
|
||||
savedWorld: 'w'
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user