mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +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
@@ -31,6 +31,7 @@ import com.volmit.tooling.BlockParts;
|
||||
import com.volmit.tooling.EditableSceneView;
|
||||
import com.volmit.tooling.JsonText;
|
||||
import com.volmit.tooling.NodeGraph;
|
||||
import com.volmit.tooling.SceneCreation;
|
||||
import com.volmit.tooling.SceneEntry;
|
||||
import com.volmit.tooling.SceneFile;
|
||||
import com.volmit.world.PackWorld;
|
||||
@@ -46,6 +47,24 @@ import java.util.Optional;
|
||||
public final class ProceduralObjectScenes implements EditableSceneView {
|
||||
private static final ResourceId ID = ResourceId.parse("iris:objects/procedural");
|
||||
private static final char FOLDER_SEPARATOR = '/';
|
||||
private static final String STARTER = """
|
||||
{
|
||||
"materials": [
|
||||
{"role": "wood", "block": "minecraft:oak_log"},
|
||||
{"role": "leaves", "block": "minecraft:oak_leaves"}
|
||||
],
|
||||
"parts": [
|
||||
{
|
||||
"role": "wood",
|
||||
"stem": {"length": [6, 9], "radius": 0.5},
|
||||
"children": [
|
||||
{"role": "leaves", "mode": "FILL", "blob": {"radius": 3}}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
""";
|
||||
private static final SceneCreation CREATION = new SceneCreation(ProceduralObjectCatalog.DEFINITIONS, STARTER, ProceduralObjectCatalog.KEY_PREFIX);
|
||||
|
||||
@Override
|
||||
public ResourceId id() {
|
||||
@@ -119,6 +138,11 @@ public final class ProceduralObjectScenes implements EditableSceneView {
|
||||
return ProceduralObjectGraph.of(key.substring(key.lastIndexOf(FOLDER_SEPARATOR) + 1), text, read);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SceneCreation> creation() {
|
||||
return Optional.of(CREATION);
|
||||
}
|
||||
|
||||
private static BakeRun runOf(BakeProfile profile) {
|
||||
List<BakeRun.Stage> stages = Arrays.stream(BakeProfile.Stage.values())
|
||||
.map(stage -> new BakeRun.Stage(stage.label(), profile.nanos(stage)))
|
||||
|
||||
Reference in new issue
Block a user