Add plugin updaters to playground examples.

This commit is contained in:
Alexander Nozik 2021-01-12 13:25:43 +03:00
parent 716487d70a
commit 5eb9925d35
6 changed files with 13 additions and 5 deletions

View File

@ -34,7 +34,7 @@ fun main() {
}
}
VisionForge.makeVisionFile(
VisionForge.withSolids().makeVisionFile(
fragment,
Paths.get("randomSpheres.html"),
resourceLocation = ResourceLocation.EMBED

View File

@ -7,6 +7,7 @@ import hep.dataforge.vision.html.ResourceLocation
import hep.dataforge.vision.html.fragment
import hep.dataforge.vision.solid.box
import hep.dataforge.vision.solid.solid
import hep.dataforge.vision.solid.withSolids
@OptIn(DFExperimental::class)
fun main() {
@ -18,5 +19,5 @@ fun main() {
}
}
VisionForge.makeVisionFile(content, resourceLocation = ResourceLocation.SYSTEM)
VisionForge.withSolids().makeVisionFile(content, resourceLocation = ResourceLocation.SYSTEM)
}

View File

@ -86,7 +86,6 @@ public abstract class VisionPlugin(meta: Meta = Meta.EMPTY) : AbstractPlugin(met
VisionManager.VISION_SERIALIZER_MODULE_TARGET -> mapOf(tag.toString().toName() to visionSerializersModule)
else -> super.content(target)
}
}
/**

View File

@ -18,7 +18,7 @@ public data class Page(
fragment(it)
}
}
title(title)
title(this@Page.title)
}
body {
embedVisionFragment(context.visionManager, fragment = content)

View File

@ -68,4 +68,8 @@ public class SolidManager(meta: Meta) : VisionPlugin(meta) {
@VisionBuilder
@DFExperimental
public inline fun VisionOutput.solid(block: SolidGroup.() -> Unit): SolidGroup = SolidGroup().apply(block)
public inline fun VisionOutput.solid(block: SolidGroup.() -> Unit): SolidGroup = SolidGroup().apply(block)
public fun Context.withSolids(): Context = apply {
plugins.fetch(SolidManager)
}

View File

@ -199,4 +199,8 @@ internal fun Object3D.findChild(name: Name): Object3D? {
name.length == 1 -> this.children.find { it.name == name.tokens.first().toString() }
else -> findChild(name.tokens.first().asName())?.findChild(name.cutFirst())
}
}
public fun Context.withThreeJs(): Context = apply {
plugins.fetch(ThreePlugin)
}