Skip to content

Commit

Permalink
Merge next into main (#667)
Browse files Browse the repository at this point in the history
* build(deps): bump tar from 4.4.13 to 4.4.19 (#648)

Bumps [tar](https://github.com/npm/node-tar) from 4.4.13 to 4.4.19.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v4.4.13...v4.4.19)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(text): set the default fill color to white and the stroke to red (#654)

fixes #510

* feat(props): adds sub-property inputs to allow input links (#658)

Up until now, we've not been able to assign input links to any value "under" a prop. These changes
allow this.

* fix(inputs): adds clean-up of inputs when modules or groups are removed (#656)

* fix(inputs): adds clean-up of inputs when modules or groups are removed

* fix(groups): cleans up active modules when group is deleted

* fix(modules): handle non registered modules (#661)

* feat(tooltip): extends v-tooltip to allow for mouseover tooltip messages

* feat(modules): adds $status array to modules

allows user feedback in the case of an error or unexpected behaviour

re #660

* feat(modules): adds status display on active modules

fixes #660

* fix(fs): handle fs errors when files aren't found

This adds fixes for missing files as part of presets

* fix(vec2control): fixes inputlink focus (#666)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tim Pietrusky <[email protected]>
  • Loading branch information
3 people authored Jan 5, 2022
1 parent 6c35693 commit 68fd357
Show file tree
Hide file tree
Showing 23 changed files with 1,462 additions and 334 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"interactive-shader-format": "github:vcync/interactive-shader-format-js#fixedIsfParserAndImageBitmap",
"lfo-for-modv": "0.0.1",
"lodash.get": "^4.4.2",
"lodash.set": "^4.3.2",
"mathjs": "^7.5.1",
"meyda": "^5.2.0",
"mkdirp": "^0.5.1",
Expand Down
4 changes: 2 additions & 2 deletions src/application/sample-modules/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default {

fillColor: {
type: "color",
default: "#000000",
default: "#ffffff",
set(args) {
this.drawText(args);
}
Expand All @@ -103,7 +103,7 @@ export default {

strokeColor: {
type: "color",
default: "#ffffff",
default: "#ff0000",
set(args) {
this.drawText(args);
}
Expand Down
8 changes: 7 additions & 1 deletion src/application/utils/get-prop-default.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Vue from "vue";
import store from "../worker/store";

export default async function getPropDefault(
Expand All @@ -6,7 +7,8 @@ export default async function getPropDefault(
prop,
useExistingData
) {
const { default: defaultValue, random, type } = prop;
const { random, type } = prop;
let defaultValue = prop.default;

if (store.state.dataTypes[type] && store.state.dataTypes[type].create) {
const propData = useExistingData ? module.props[propName] : prop.default;
Expand All @@ -21,6 +23,10 @@ export default async function getPropDefault(
return module.props[propName];
}

if (Array.isArray(defaultValue)) {
defaultValue = Vue.observable(defaultValue);
}

if (
typeof defaultValue !== "undefined" &&
Array.isArray(defaultValue) &&
Expand Down
26 changes: 18 additions & 8 deletions src/application/worker/loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ function loop(delta, features, fftOutput) {
const bind = inputs[inputId];
const link = inputLinks[inputId];

const { type, location, data } = bind;
const {
type,
location,
data,
data: { path }
} = bind;

const {
type: linkType,
Expand All @@ -81,10 +86,11 @@ function loop(delta, features, fftOutput) {
// mutation linkTypes are also skipped as they're handled in index.worker.js in
// the store commit subscription
if (
linkType === "mutation" ||
(source === "meyda" &&
moduleId &&
!store.state.modules.active[moduleId].meta.enabled)
moduleId &&
(linkType === "mutation" ||
(source === "meyda" &&
moduleId &&
!store.state.modules.active[moduleId].meta.enabled))
) {
continue;
}
Expand All @@ -103,9 +109,9 @@ function loop(delta, features, fftOutput) {
}

if (type === "action") {
store.dispatch(location, { ...data, data: value });
store.dispatch(location, { ...data, data: value, path });
} else if (type === "commit") {
store.commit(location, { ...data, data: value });
store.commit(location, { ...data, data: value, path });
}
}

Expand Down Expand Up @@ -194,7 +200,11 @@ function loop(delta, features, fftOutput) {

const module = active[group.modules[j]];

if (!module.meta.enabled || module.meta.alpha < 0.001) {
if (
!module.meta.enabled ||
module.meta.alpha < 0.001 ||
module.$status.length
) {
continue;
}

Expand Down
24 changes: 17 additions & 7 deletions src/application/worker/store/modules/dataTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@ const state = {
get: value => value
},
vec2: {
get: value => value
get: value => value,
inputs: () => ({ 0: 0, 1: 0 })
},
vec3: {
get: value => value
get: value => value,
inputs: () => ({ 0: 0, 1: 0, 2: 0 })
},
vec4: {
get: value => value
get: value => value,
inputs: () => ({ 0: 0, 1: 0, 2: 0, 3: 0 })
},
float: {
get: value => value
},
color: {
get: value => value
get: value => value,
inputs: () => ({ r: 0, g: 0, b: 0, a: 0 })
},
texture: {
async create(textureDefinition = {}, isGallery) {
Expand All @@ -31,9 +35,15 @@ const state = {

if (type === "image") {
const { path } = options;
const { id } = await store.dispatch("images/createImageFromPath", {
path
});
let id;
try {
id = await store.dispatch("images/createImageFromPath", {
path
}).id;
} catch (e) {
console.error(e);
}

textureDefinition.location = "images/image";
textureDefinition.id = id;
}
Expand Down
29 changes: 29 additions & 0 deletions src/application/worker/store/modules/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,35 @@ const actions = {
return group;
},

async removeGroup({ commit }, { groupId, writeToSwap }) {
const group = state.groups.find(group => group.id === groupId);

const inputIds = [
group.alphaInputId,
group.enabledInputId,
group.clearingInputId,
group.inheritInputId,
group.compositeOperationInputId,
group.pipelineInputId
];

for (let i = 0; i < inputIds.length; i += 1) {
const inputId = inputIds[i];

await store.dispatch("inputs/removeInput", {
inputId
});
}

for (let i = 0; i < group.modules.length; i += 1) {
const moduleId = group.modules[i];

await store.dispatch("modules/removeActiveModule", { moduleId });
}

commit("REMOVE_GROUP", { id: groupId, writeToSwap });
},

orderByIds({ commit }, { ids }) {
const newGroups = ids.map(id => {
return state.groups.find(group => group.id === id);
Expand Down
22 changes: 19 additions & 3 deletions src/application/worker/store/modules/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,25 @@ const getters = {

const actions = {
async createImageFromPath({ commit }, { path: filePath }) {
const stream = fs.createReadStream(
path.join(store.state.media.path, filePath)
);
let stream;
let joinedFilePath;

try {
joinedFilePath = path.join(store.state.media.path, filePath);
} catch (e) {
console.log(e);
}

try {
stream = fs.createReadStream(joinedFilePath);
} catch (error) {
throw error;
}

if (!stream) {
return {};
}

const blob = await streamToBlob(stream);
const imageBitmap = await createImageBitmap(blob);

Expand Down
21 changes: 21 additions & 0 deletions src/application/worker/store/modules/inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ const actions = {
return input;
},

removeInput({ commit }, { inputId, writeToSwap }) {
const writeTo = writeToSwap ? swap : state;

if (!writeTo.inputs[inputId]) {
console.warn(
"Did not remove input. Could not find input with id",
inputId
);

return false;
}

commit("REMOVE_INPUT", { inputId, writeToSwap });
return true;
},

createInputLink(
{ commit },
{
Expand Down Expand Up @@ -211,6 +227,11 @@ const mutations = {
writeTo.inputs[input.id] = input;
},

REMOVE_INPUT(state, { inputId, writeToSwap }) {
const writeTo = writeToSwap ? swap : state;
Vue.delete(writeTo.inputs, inputId);
},

ADD_INPUT_LINK(state, { inputLink, writeToSwap }) {
const writeTo = writeToSwap ? swap : state;

Expand Down
Loading

0 comments on commit 68fd357

Please sign in to comment.