diff --git a/build.gradle.kts b/build.gradle.kts index 73b88aa5..edf19391 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ -val dataforgeVersion by extra("0.1.3") +val dataforgeVersion by extra("0.1.4") plugins { val kotlinVersion = "1.3.50" @@ -15,6 +15,7 @@ plugins { allprojects { repositories { + mavenLocal() maven("https://dl.bintray.com/pdvrieze/maven") maven("http://maven.jzy3d.org/releases") maven("https://kotlin.bintray.com/js-externals") diff --git a/dataforge-vis-common/src/commonMain/kotlin/hep/dataforge/vis/common/VisualPlugin.kt b/dataforge-vis-common/src/commonMain/kotlin/hep/dataforge/vis/common/VisualPlugin.kt index 933e4736..39a1abc0 100644 --- a/dataforge-vis-common/src/commonMain/kotlin/hep/dataforge/vis/common/VisualPlugin.kt +++ b/dataforge-vis-common/src/commonMain/kotlin/hep/dataforge/vis/common/VisualPlugin.kt @@ -30,7 +30,8 @@ class VisualPlugin(meta: Meta) : AbstractPlugin(meta) { companion object : PluginFactory { override val tag: PluginTag = PluginTag(name = "visual", group = PluginTag.DATAFORGE_GROUP) override val type: KClass = VisualPlugin::class - override fun invoke(meta: Meta): VisualPlugin = VisualPlugin(meta) + + override fun invoke(meta: Meta, context: Context): VisualPlugin = VisualPlugin(meta) const val VISUAL_FACTORY_TYPE = "visual.factory" } diff --git a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/FXPlugin.kt b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/FXPlugin.kt index 12e9c4a3..ffe2ef64 100644 --- a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/FXPlugin.kt +++ b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/FXPlugin.kt @@ -96,7 +96,7 @@ class FXPlugin(meta: Meta = EmptyMeta) : AbstractPlugin(meta) { companion object : PluginFactory { override val type: KClass = FXPlugin::class override val tag: PluginTag = PluginTag("vis.fx", group = PluginTag.DATAFORGE_GROUP) - override fun invoke(meta: Meta): FXPlugin = FXPlugin(meta) + override fun invoke(meta: Meta, context: Context): FXPlugin = FXPlugin(meta) } } diff --git a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/meta/FXMeta.kt b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/meta/FXMeta.kt index 82d48491..9a1929c8 100644 --- a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/meta/FXMeta.kt +++ b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/meta/FXMeta.kt @@ -84,7 +84,7 @@ class FXMetaNode>( override val hasValue: ObservableBooleanValue = nodeProperty.booleanBinding { it != null } private val filter: (FXMeta) -> Boolean = { cfg -> - !(cfg.descriptor?.tags?.contains(ConfigEditor.NO_CONFIGURATOR_TAG) ?: false) + !(cfg.descriptor?.attributes?.get(ConfigEditor.NO_CONFIGURATOR_TAG)?.boolean ?: false) } val children = object : ListBinding>() { @@ -172,7 +172,7 @@ fun > FXMetaNode.remove(name: NameToken) { private fun > M.createEmptyNode(token: NameToken, append: Boolean): M { return if (append && token.index.isNotEmpty()) { val name = token.asName() - val index = (getAll(name).keys.mapNotNull { it.toIntOrNull() }.max() ?: -1) + 1 + val index = (getIndexed(name).keys.mapNotNull { it.toIntOrNull() }.max() ?: -1) + 1 val newName = name.withIndex(index.toString()) set(newName, EmptyMeta) get(newName).node!! diff --git a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ColorValueChooser.kt b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ColorValueChooser.kt index e0e0f94a..e63ee25b 100644 --- a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ColorValueChooser.kt +++ b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ColorValueChooser.kt @@ -1,6 +1,8 @@ package hep.dataforge.vis.fx.values import hep.dataforge.meta.Meta +import hep.dataforge.names.Name +import hep.dataforge.names.asName import hep.dataforge.values.Null import hep.dataforge.values.Value import hep.dataforge.values.asValue @@ -39,8 +41,8 @@ class ColorValueChooser : ValueChooserBase() { return node } - companion object: ValueChooser.Factory{ - override val name: String = "color" + companion object : ValueChooser.Factory { + override val name: Name = "color".asName() override fun invoke(meta: Meta): ValueChooser = ColorValueChooser() } diff --git a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ComboBoxValueChooser.kt b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ComboBoxValueChooser.kt index 0f6460e0..f2a830d6 100644 --- a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ComboBoxValueChooser.kt +++ b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ComboBoxValueChooser.kt @@ -8,6 +8,8 @@ package hep.dataforge.vis.fx.values import hep.dataforge.meta.Meta import hep.dataforge.meta.get import hep.dataforge.meta.value +import hep.dataforge.names.Name +import hep.dataforge.names.asName import hep.dataforge.values.Value import hep.dataforge.values.parseValue import javafx.collections.FXCollections @@ -50,7 +52,7 @@ class ComboBoxValueChooser(val values: Collection? = null) : ValueChooser } companion object : ValueChooser.Factory { - override val name: String = "combo" + override val name: Name = "combo".asName() override fun invoke(meta: Meta): ValueChooser = ComboBoxValueChooser(meta["values"].value?.list) } diff --git a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/TextValueChooser.kt b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/TextValueChooser.kt index b273b71f..f1726fbf 100644 --- a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/TextValueChooser.kt +++ b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/TextValueChooser.kt @@ -6,6 +6,8 @@ package hep.dataforge.vis.fx.values import hep.dataforge.meta.Meta +import hep.dataforge.names.Name +import hep.dataforge.names.asName import hep.dataforge.values.* import javafx.beans.value.ObservableValue import javafx.scene.control.TextField @@ -100,7 +102,7 @@ class TextValueChooser : ValueChooserBase() { } companion object : ValueChooser.Factory { - override val name: String = "text" + override val name: Name = "text".asName() override fun invoke(meta: Meta): ValueChooser = TextValueChooser() } } diff --git a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ValueChooser.kt b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ValueChooser.kt index 77ec9f28..6624e653 100644 --- a/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ValueChooser.kt +++ b/dataforge-vis-common/src/jvmMain/kotlin/hep/dataforge/vis/fx/values/ValueChooser.kt @@ -10,6 +10,7 @@ import hep.dataforge.context.Named import hep.dataforge.descriptors.ValueDescriptor import hep.dataforge.meta.EmptyMeta import hep.dataforge.meta.Meta +import hep.dataforge.names.toName import hep.dataforge.provider.Type import hep.dataforge.provider.provideByType import hep.dataforge.values.Null @@ -71,7 +72,7 @@ interface ValueChooser { companion object { private fun findWidgetByType(context: Context, type: String): Factory? { - return when (type) { + return when (type.toName()) { TextValueChooser.name -> TextValueChooser ColorValueChooser.name -> ColorValueChooser ComboBoxValueChooser.name -> ComboBoxValueChooser diff --git a/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/GDMLTransformer.kt b/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/GDMLTransformer.kt index ee646f7a..f4671bcc 100644 --- a/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/GDMLTransformer.kt +++ b/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/GDMLTransformer.kt @@ -29,7 +29,7 @@ class GDMLTransformer(val root: GDML) { /** * A special group for local templates */ - val templates by lazy { VisualGroup3D() } + val proto by lazy { VisualGroup3D() } private val styleCache = HashMap() var lUnit: LUnit = LUnit.MM @@ -67,7 +67,7 @@ class GDMLTransformer(val root: GDML) { var onFinish: GDMLTransformer.() -> Unit = {} internal fun finalize(final: VisualGroup3D): VisualGroup3D { - final.templates = templates + final.prototypes = proto styleCache.forEach { final.addStyle(it.key, it.value, false) } diff --git a/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt b/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt index 3271fe38..97b6b474 100644 --- a/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt +++ b/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt @@ -161,8 +161,8 @@ private fun VisualGroup3D.addPhysicalVolume( } GDMLTransformer.Action.CACHE -> { val fullName = volumesName + volume.name.asName() - if (context.templates[fullName] == null) { - context.templates[fullName] = volume(context, volume) + if (context.proto[fullName] == null) { + context.proto[fullName] = volume(context, volume) } this[physVolume.name ?: ""] = Proxy(fullName).apply { @@ -215,8 +215,8 @@ private fun volume( } } GDMLTransformer.Action.CACHE -> { - if (context.templates[solid.name] == null) { - context.templates.addSolid(context, solid, solid.name) { + if (context.proto[solid.name] == null) { + context.proto.addSolid(context, solid, solid.name) { context.configureSolid(this, group, solid) } } diff --git a/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt b/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt index 0c1da7ed..67d4d184 100644 --- a/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt +++ b/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt @@ -119,14 +119,14 @@ private class GDMLDemoApp : Application { val three = context.plugins.load(ThreePlugin) //val url = URL("https://drive.google.com/open?id=1w5e7fILMN83JGgB8WANJUYm8OW2s0WVO") - val canvas = document.getElementById("canvas") ?: error("Element with id 'canvas' not found on page") - val layers = document.getElementById("layers") ?: error("Element with id 'layers' not found on page") - val tree = document.getElementById("tree") ?: error("Element with id 'tree' not found on page") - val editor = document.getElementById("editor") ?: error("Element with id 'editor' not found on page") - canvas.clear() + val canvasElement = document.getElementById("canvas") ?: error("Element with id 'canvas' not found on page") + val configElement = document.getElementById("layers") ?: error("Element with id 'layers' not found on page") + val treeElement = document.getElementById("tree") ?: error("Element with id 'tree' not found on page") + val editorElement = document.getElementById("editor") ?: error("Element with id 'editor' not found on page") + canvasElement.clear() val action: (name: String, data: String) -> Unit = { name, data -> - canvas.clear() + canvasElement.clear() spinner(true) message("Loading GDML") val gdml = GDML.format.parse(GDML.serializer(), data) @@ -149,12 +149,12 @@ private class GDMLDemoApp : Application { message("Rendering") //output.camera.layers.enable(1) - val output = three.output(canvas as HTMLElement) + val output = three.output(canvasElement as HTMLElement) output.camera.layers.set(0) - layers.threeOutputConfig(output) + configElement.threeOutputConfig(output) //tree.visualObjectTree(visual, editor::propertyEditor) - tree.objectTree(NameToken("World"),visual, editor::propertyEditor) + treeElement.objectTree(NameToken("World"),visual, editorElement::propertyEditor) output.render(visual) diff --git a/dataforge-vis-spatial-gdml/src/jvmMain/kotlin/hep/dataforge/vis/spatial/gdml/testJson.kt b/dataforge-vis-spatial-gdml/src/jvmMain/kotlin/hep/dataforge/vis/spatial/gdml/testJson.kt new file mode 100644 index 00000000..ad722578 --- /dev/null +++ b/dataforge-vis-spatial-gdml/src/jvmMain/kotlin/hep/dataforge/vis/spatial/gdml/testJson.kt @@ -0,0 +1,16 @@ +package hep.dataforge.vis.spatial.gdml + +import hep.dataforge.names.toName +import hep.dataforge.vis.spatial.* + +fun main() { + val vis = VisualGroup3D().apply { + val box = Box(100f, 100f, 20f).apply { + color(0u, 0u, 255u) + } + proxy("some.name".toName(), box, "obj") + } + + val string = Visual3DPlugin.json.stringify(VisualGroup3D.serializer(),vis) + println(string) +} \ No newline at end of file diff --git a/dataforge-vis-spatial/build.gradle.kts b/dataforge-vis-spatial/build.gradle.kts index 41672aee..1d562140 100644 --- a/dataforge-vis-spatial/build.gradle.kts +++ b/dataforge-vis-spatial/build.gradle.kts @@ -21,7 +21,6 @@ kotlin { } jvmMain { dependencies { - implementation(project(":dataforge-vis-fx")) implementation("org.fxyz3d:fxyz3d:0.5.2") } } diff --git a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Proxy.kt b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Proxy.kt index e4125590..4dd11e79 100644 --- a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Proxy.kt +++ b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Proxy.kt @@ -3,7 +3,8 @@ package hep.dataforge.vis.spatial import hep.dataforge.io.ConfigSerializer -import hep.dataforge.io.NameSerializer + +import hep.dataforge.io.serialization.NameSerializer import hep.dataforge.meta.* import hep.dataforge.names.Name import hep.dataforge.names.NameToken @@ -36,7 +37,7 @@ class Proxy(val templateName: Name) : AbstractVisualObject(), VisualGroup, Visua * Recursively search for defined template in the parent */ val prototype: VisualObject3D - get() = (parent as? VisualGroup3D)?.getTemplate(templateName) + get() = (parent as? VisualGroup3D)?.getPrototype(templateName) ?: error("Template with name $templateName not found in $parent") override fun getStyle(name: Name): Meta? = (parent as VisualGroup?)?.getStyle(name) @@ -65,9 +66,11 @@ class Proxy(val templateName: Name) : AbstractVisualObject(), VisualGroup, Visua } override val children: Map - get() = (prototype as? MutableVisualGroup)?.children?.mapValues { - ProxyChild(it.key.asName()) - } ?: emptyMap() + get() = (prototype as? MutableVisualGroup)?.children + ?.filter { !it.key.toString().startsWith("@") } + ?.mapValues { + ProxyChild(it.key.asName()) + } ?: emptyMap() private val propertyCache: HashMap = HashMap() @@ -152,8 +155,30 @@ val VisualObject.prototype: VisualObject? else -> null } +/** + * Create ref for existing prototype + */ inline fun VisualGroup3D.ref( templateName: Name, name: String = "", - action: Proxy.() -> Unit = {} -) = Proxy(templateName).apply(action).also { set(name, it) } + block: Proxy.() -> Unit = {} +) = Proxy(templateName).apply(block).also { set(name, it) } + +/** + * Add new proxy wrapping given object and automatically adding it to the prototypes + */ +fun VisualGroup3D.proxy( + templateName: Name, + obj: VisualObject3D, + name: String = "", + attachToParent: Boolean = false, + block: Proxy.() -> Unit = {} +): Proxy { + val existing = getPrototype(templateName) + if (existing == null) { + setPrototype(templateName,obj, attachToParent) + } else if(existing != obj) { + error("Can't add different prototype on top of existing one") + } + return ref(templateName, name, block) +} diff --git a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Visual3DPlugin.kt b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Visual3DPlugin.kt index 02886ed9..093c7cfe 100644 --- a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Visual3DPlugin.kt +++ b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Visual3DPlugin.kt @@ -1,11 +1,12 @@ package hep.dataforge.vis.spatial import hep.dataforge.context.AbstractPlugin +import hep.dataforge.context.Context import hep.dataforge.context.PluginFactory import hep.dataforge.context.PluginTag import hep.dataforge.io.ConfigSerializer import hep.dataforge.io.MetaSerializer -import hep.dataforge.io.NameSerializer +import hep.dataforge.io.serialization.NameSerializer import hep.dataforge.meta.* import hep.dataforge.names.Name import hep.dataforge.vis.common.VisualObject @@ -30,7 +31,7 @@ class Visual3DPlugin(meta: Meta) : AbstractPlugin(meta) { companion object : PluginFactory { override val tag: PluginTag = PluginTag(name = "visual.spatial", group = PluginTag.DATAFORGE_GROUP) override val type: KClass = Visual3DPlugin::class - override fun invoke(meta: Meta): Visual3DPlugin = Visual3DPlugin(meta) + override fun invoke(meta: Meta, context: Context): Visual3DPlugin = Visual3DPlugin(meta) val serialModule = SerializersModule { contextual(Point3DSerializer) diff --git a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualGroup3D.kt b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualGroup3D.kt index 7d3050e3..fca6f7ed 100644 --- a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualGroup3D.kt +++ b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualGroup3D.kt @@ -10,7 +10,7 @@ package hep.dataforge.vis.spatial import hep.dataforge.io.ConfigSerializer import hep.dataforge.io.MetaSerializer -import hep.dataforge.io.NameSerializer +import hep.dataforge.io.serialization.NameSerializer import hep.dataforge.meta.Config import hep.dataforge.meta.Meta import hep.dataforge.meta.MetaBuilder @@ -32,7 +32,8 @@ class VisualGroup3D : AbstractVisualGroup(), VisualObject3D { /** * A container for templates visible inside this group */ - var templates: VisualGroup3D? = null + @SerialName(PROTOTYPES_KEY) + var prototypes: VisualGroup3D? = null set(value) { value?.parent = this field = value @@ -85,18 +86,26 @@ class VisualGroup3D : AbstractVisualGroup(), VisualObject3D { } } - fun getTemplate(name: Name): VisualObject3D? = - templates?.get(name) as? VisualObject3D - ?: (parent as? VisualGroup3D)?.getTemplate(name) + fun getPrototype(name: Name): VisualObject3D? = + prototypes?.get(name) as? VisualObject3D ?: (parent as? VisualGroup3D)?.getPrototype(name) + + fun setPrototype(name: Name, obj: VisualObject3D, attachToParent: Boolean = false) { + val parent = this.parent + if (attachToParent && parent is VisualGroup3D) { + parent.setPrototype(name, obj, attachToParent) + } else { + (prototypes ?: VisualGroup3D().also { this.prototypes = it }).set(name, obj) + } + } override fun MetaBuilder.updateMeta() { - set(TEMPLATES_KEY, templates?.toMeta()) + set(PROTOTYPES_KEY, prototypes?.toMeta()) updatePosition() updateChildren() } companion object { - const val TEMPLATES_KEY = "templates" + const val PROTOTYPES_KEY = "templates" } } @@ -109,7 +118,7 @@ fun VisualGroup.attachChildren() { (it as? VisualGroup)?.attachChildren() } if (this is VisualGroup3D) { - templates?.also { + prototypes?.also { it.parent = this it.attachChildren() } @@ -117,4 +126,4 @@ fun VisualGroup.attachChildren() { } fun VisualGroup3D.group(key: String = "", action: VisualGroup3D.() -> Unit = {}): VisualGroup3D = - VisualGroup3D().apply(action).also { set(key, it) } + VisualGroup3D().apply(action).also { set(key, it) } \ No newline at end of file diff --git a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualObject3D.kt b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualObject3D.kt index 1e91dde9..1f26ff0b 100644 --- a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualObject3D.kt +++ b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualObject3D.kt @@ -2,15 +2,15 @@ package hep.dataforge.vis.spatial -import hep.dataforge.io.NameSerializer +import hep.dataforge.io.serialization.NameSerializer import hep.dataforge.meta.* import hep.dataforge.names.asName import hep.dataforge.names.plus import hep.dataforge.output.Output import hep.dataforge.vis.common.VisualObject import hep.dataforge.vis.spatial.VisualObject3D.Companion.DETAIL_KEY -import hep.dataforge.vis.spatial.VisualObject3D.Companion.LAYER_KEY import hep.dataforge.vis.spatial.VisualObject3D.Companion.IGNORE_KEY +import hep.dataforge.vis.spatial.VisualObject3D.Companion.LAYER_KEY import hep.dataforge.vis.spatial.VisualObject3D.Companion.SELECTED_KEY import hep.dataforge.vis.spatial.VisualObject3D.Companion.VISIBLE_KEY import kotlinx.serialization.UseSerializers diff --git a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/transform/RemoveSingleChild.kt b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/transform/RemoveSingleChild.kt index e8135dc3..1fc1e52b 100644 --- a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/transform/RemoveSingleChild.kt +++ b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/transform/RemoveSingleChild.kt @@ -49,7 +49,7 @@ object RemoveSingleChild : VisualTreeTransform() { } replaceChildren() - templates?.replaceChildren() + prototypes?.replaceChildren() } override fun VisualGroup3D.clone(): VisualGroup3D { diff --git a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/transform/UnRef.kt b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/transform/UnRef.kt index b09561e4..12681b24 100644 --- a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/transform/UnRef.kt +++ b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/transform/UnRef.kt @@ -24,7 +24,7 @@ object UnRef : VisualTreeTransform() { } private fun MutableVisualGroup.unref(name: Name) { - (this as? VisualGroup3D)?.templates?.set(name, null) + (this as? VisualGroup3D)?.prototypes?.set(name, null) children.filter { (it.value as? Proxy)?.templateName == name }.forEach { (key, value) -> val proxy = value as Proxy val newChild = mergeChild(proxy, proxy.prototype) diff --git a/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreePlugin.kt b/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreePlugin.kt index 2d3c027f..2831a155 100644 --- a/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreePlugin.kt +++ b/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreePlugin.kt @@ -1,9 +1,6 @@ package hep.dataforge.vis.spatial.three -import hep.dataforge.context.AbstractPlugin -import hep.dataforge.context.PluginFactory -import hep.dataforge.context.PluginTag -import hep.dataforge.context.content +import hep.dataforge.context.* import hep.dataforge.meta.Meta import hep.dataforge.names.Name import hep.dataforge.names.asName @@ -88,7 +85,7 @@ class ThreePlugin : AbstractPlugin() { companion object : PluginFactory { override val tag = PluginTag("visual.three", PluginTag.DATAFORGE_GROUP) override val type = ThreePlugin::class - override fun invoke(meta: Meta) = ThreePlugin() + override fun invoke(meta: Meta,context: Context) = ThreePlugin() } } diff --git a/spatial-js-demo/src/main/kotlin/hep/dataforge/vis/spatial/demo/ThreeDemoGrid.kt b/spatial-js-demo/src/main/kotlin/hep/dataforge/vis/spatial/demo/ThreeDemoGrid.kt index 9eb190d8..0f2b8283 100644 --- a/spatial-js-demo/src/main/kotlin/hep/dataforge/vis/spatial/demo/ThreeDemoGrid.kt +++ b/spatial-js-demo/src/main/kotlin/hep/dataforge/vis/spatial/demo/ThreeDemoGrid.kt @@ -79,7 +79,7 @@ class ThreeDemoGrid(meta: Meta) : AbstractPlugin(meta), OutputManager { override val type: KClass = ThreeDemoGrid::class - override fun invoke(meta: Meta): ThreeDemoGrid = ThreeDemoGrid(meta) + override fun invoke(meta: Meta,context: Context): ThreeDemoGrid = ThreeDemoGrid(meta) } } diff --git a/wrappers/build.gradle.kts b/wrappers/build.gradle.kts index 177713d0..0d79fcc0 100644 --- a/wrappers/build.gradle.kts +++ b/wrappers/build.gradle.kts @@ -13,8 +13,8 @@ kotlin{ sourceSets["main"].apply{ dependencies{ api(npm("style-loader")) - api(npm("inspire-tree","6.0.1")) - api(npm("inspire-tree-dom","4.0.6")) +// api(npm("inspire-tree","6.0.1")) +// api(npm("inspire-tree-dom","4.0.6")) api(npm("jsoneditor")) api(npm("dat.gui")) //api("org.jetbrains:kotlin-extensions:1.0.1-pre.83-kotlin-1.3.50")