diff --git a/src/application/renderers/isf.js b/src/application/renderers/isf.js index 100a8e5b..1d9bb0d2 100644 --- a/src/application/renderers/isf.js +++ b/src/application/renderers/isf.js @@ -56,6 +56,8 @@ function render({ module, canvas, context, pipeline, props }) { } else { renderer.setValue(input.NAME, canvas); } + } else if (input.TYPE === "event") { + renderer.setValue(input.NAME, !!props[input.NAME]); } else { renderer.setValue(input.NAME, props[input.NAME]); } @@ -197,6 +199,13 @@ async function setupModule(moduleDefinition) { }); break; + + case "event": + addProp(input.NAME, { + type: "event", + label: input.LABEL || input.NAME + }); + break; } } diff --git a/src/application/worker/store/modules/dataTypes.js b/src/application/worker/store/modules/dataTypes.js index 7938e536..8dab2f64 100644 --- a/src/application/worker/store/modules/dataTypes.js +++ b/src/application/worker/store/modules/dataTypes.js @@ -11,6 +11,9 @@ const state = { bool: { get: value => value }, + event: { + get: value => value + }, vec2: { get: value => value, inputs: () => ({ 0: 0, 1: 0 }) diff --git a/src/application/worker/store/modules/modules.js b/src/application/worker/store/modules/modules.js index 91bbcc81..77a333bc 100644 --- a/src/application/worker/store/modules/modules.js +++ b/src/application/worker/store/modules/modules.js @@ -486,12 +486,12 @@ const actions = { let dataOut = data; - dataOut = applyExpression({ inputId, value: dataOut }); - if (store.state.dataTypes[type] && store.state.dataTypes[type].create) { dataOut = await store.state.dataTypes[type].create(dataOut); } + dataOut = applyExpression({ inputId, value: dataOut }); + if (!Array.isArray(dataOut)) { const { strict, min, max, abs } = propData; diff --git a/src/components/Control.vue b/src/components/Control.vue index 84adc12d..0026081a 100644 --- a/src/components/Control.vue +++ b/src/components/Control.vue @@ -78,6 +78,15 @@ > +
+ +
@@ -95,6 +104,7 @@ import Vec4Control from "./Controls/Vec4Control"; import hasLink from "./mixins/has-input-link"; import inputIsFocused from "./mixins/input-is-focused"; import Select from "./inputs/Select.vue"; +import Button from "./inputs/Button.vue"; export default { mixins: [hasLink, inputIsFocused], @@ -140,7 +150,8 @@ export default { ColorControl, Vec3Control, Vec4Control, - Select + Select, + Button }, data() { @@ -168,6 +179,14 @@ export default { id: this.inputId, title: this.inputTitle }); + }, + + buttonDown() { + this.internalValue = 1; + }, + + buttonUp() { + this.internalValue = 0; } }, diff --git a/src/components/inputs/Button.vue b/src/components/inputs/Button.vue index 182b2469..0d1a1d14 100644 --- a/src/components/inputs/Button.vue +++ b/src/components/inputs/Button.vue @@ -26,10 +26,12 @@ button.light { background: #363636; } +button.active, button:active { background: #363636; } +button.light.active, button.light:active { background: #9a9a9a; }