Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next into main #911

Merged
merged 11 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 18
node-version: 20

- name: Install libndi4_4.5.1-1_amd64.deb
run: wget https://github.com/Palakis/obs-ndi/releases/download/4.9.0/libndi4_4.5.1-1_amd64.deb && sudo dpkg -i libndi4_4.5.1-1_amd64.deb
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test:e2e": "npx playwright test"
},
"dependencies": {
"@electron/remote": "^2.0.4",
"@electron/remote": "^2.1.2",
"animated-gif-detector": "^1.2.0",
"animejs": "3.2.1",
"canvas-text-wrapper": "github:cyberj/canvas-text-wrapper#master",
Expand All @@ -35,6 +35,7 @@
"fuse.js": "^6.2.1",
"golden-layout": "^1.5.9",
"grandiose": "github:vcync/grandiose#feat/workerCompatibility",
"hapticjs": "^1.0.7",
"interactive-shader-format": "github:vcync/interactive-shader-format-js#78b62b6f4c787b870852df4c8e7b1131e331d8a6",
"lodash.get": "^4.4.2",
"lodash.set": "^4.3.2",
Expand Down Expand Up @@ -79,7 +80,7 @@
"babel-eslint": "^10.0.3",
"babel-loader": "^9.1.2",
"core-js": "^3.19.1",
"electron": "25.1.1",
"electron": "29.1.5",
"electron-builder": "^22.9.1",
"electron-notarize": "^1.2.2",
"electron-playwright-helpers": "^1.5.3",
Expand Down Expand Up @@ -109,4 +110,4 @@
"resolutions": {
"electron-builder": "23.0.2"
}
}
}
32 changes: 32 additions & 0 deletions patches/hapticjs+1.0.7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/node_modules/hapticjs/.DS_Store b/node_modules/hapticjs/.DS_Store
new file mode 100644
index 0000000..487d1a1
Binary files /dev/null and b/node_modules/hapticjs/.DS_Store differ
diff --git a/node_modules/hapticjs/app.js b/node_modules/hapticjs/app.js
index 0821d19..1fa9828 100644
--- a/node_modules/hapticjs/app.js
+++ b/node_modules/hapticjs/app.js
@@ -1,10 +1,10 @@
+var os = require("os")
var exec = require('child_process').exec
var path = require('path')
var cmd = path.join(__dirname, 'hapticJS', 'DerivedData', 'hapticJS', 'Build', 'Products', 'Release', 'hapticJS')

exports.vibrate = function() {
if (os.platform().includes('darwin')) {
- console.log('vibrating now...')
exec(cmd, function(error, stdout, stderr) {
// command output is in stdout
})
diff --git a/node_modules/hapticjs/hapticJS/.DS_Store b/node_modules/hapticjs/hapticJS/.DS_Store
new file mode 100644
index 0000000..57ae955
Binary files /dev/null and b/node_modules/hapticjs/hapticJS/.DS_Store differ
diff --git a/node_modules/hapticjs/hapticJS/DerivedData/.DS_Store b/node_modules/hapticjs/hapticJS/DerivedData/.DS_Store
new file mode 100644
index 0000000..487d1a1
Binary files /dev/null and b/node_modules/hapticjs/hapticJS/DerivedData/.DS_Store differ
diff --git a/node_modules/hapticjs/hapticJS/DerivedData/hapticJS/.DS_Store b/node_modules/hapticjs/hapticJS/DerivedData/hapticJS/.DS_Store
new file mode 100644
index 0000000..9d704a3
Binary files /dev/null and b/node_modules/hapticjs/hapticJS/DerivedData/hapticJS/.DS_Store differ
3 changes: 1 addition & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>modV</title>
</head>

<body>
Expand All @@ -20,4 +19,4 @@
<!-- built files will be auto injected -->
</body>

</html>
</html>
3 changes: 2 additions & 1 deletion src/application/plugins/grab-canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const mappingContext = mappingCanvas.getContext("2d", {
// (lights don't have an alpha channel, so let's drop it)
alpha: false,
desynchronized: true,
imageSmoothingEnabled: false
imageSmoothingEnabled: false,
willReadFrequently: true
});

export default {
Expand Down
9 changes: 9 additions & 0 deletions src/application/renderers/isf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down Expand Up @@ -197,6 +199,13 @@ async function setupModule(moduleDefinition) {
});

break;

case "event":
addProp(input.NAME, {
type: "event",
label: input.LABEL || input.NAME
});
break;
}
}

Expand Down
13 changes: 10 additions & 3 deletions src/application/renderers/three.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ store.dispatch("outputs/addAuxillaryOutput", {

const renderer = new THREE.WebGLRenderer({
alpha: true,
antialias: true,
canvas: threeCanvas
antialias: false,
canvas: threeCanvas,
powerPreference: "high-performance",
premultipliedAlpha: false
});
renderer.setPixelRatio(1);

Expand Down Expand Up @@ -178,6 +180,10 @@ function resize({ width, height }) {
renderer.setSize(width, height, false);
}

function getModuleData(name) {
return threeModuleData[name];
}

export default {
render,
updateModule,
Expand All @@ -186,6 +192,7 @@ export default {
setupModule,
removeModule,
createPresetData,
loadPresetData
loadPresetData,
getModuleData
};
export { threeModuleData };
4 changes: 3 additions & 1 deletion src/application/worker/index.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ async function start() {
tick,
resize,
createPresetData,
loadPresetData
loadPresetData,
getModuleData
} = renderers(rendererName).default;

store.commit("renderers/ADD_RENDERER", {
Expand All @@ -142,6 +143,7 @@ async function start() {
resizeModule,
createPresetData,
loadPresetData,
getModuleData,
tick
});
}
Expand Down
9 changes: 0 additions & 9 deletions src/application/worker/loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,6 @@ function loop(delta, features, fftOutput) {
debugCanvas.width,
debugCanvas.height
);
debugContext.font = "32px monospace";
debugContext.textBaseline = "hanging";
debugContext.fillStyle = "#fff";
debugContext.globalCompositeOperation = "difference";
debugContext.fillText(
`${canvasToDebug.context.canvas.width} × ${canvasToDebug.context.canvas.height}`,
10,
10
);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/application/worker/store/modules/dataTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const state = {
bool: {
get: value => value
},
event: {
get: value => value
},
vec2: {
get: value => value,
inputs: () => ({ 0: 0, 1: 0 })
Expand Down
62 changes: 39 additions & 23 deletions src/application/worker/store/modules/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,22 @@ const actions = {
}
}
} else {
const { renderers } = rootState;
const { type } = module.meta;

if (renderers[type].setupModule) {
try {
const newDef = await renderers[type].setupModule(moduleDefinition);
module.data = newDef.data;
} catch (e) {
console.error(
`Error in ${type} renderer setup whilst registering "${name}". This module was ommited from registration. \n\n${e}`
);

return false;
}
}

await initialiseModuleProperties(
props,
module,
Expand Down Expand Up @@ -446,8 +462,8 @@ const actions = {
},

async updateProp(
{ state, commit },
{ moduleId, prop, data, group, path = "", groupName, writeToSwap }
{ state, commit, rootState },
{ moduleId, prop, data, path = "", writeToSwap }
) {
if (!state.active[moduleId]) {
console.error(`The module with the moduleId ${moduleId} doesn't exist.`);
Expand All @@ -464,22 +480,18 @@ const actions = {
);
const { type } = propData;

// if (group || groupName) {
// propData = state.active[name].props[groupName].props[prop];
// }

if (data === currentValue) {
return;
}

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;

Expand All @@ -504,28 +516,32 @@ const actions = {
type: propData.type,
path
},
group,
groupName,

writeToSwap
});

if (group || groupName) {
if ("set" in state.registered[moduleName].props[groupName].props[prop]) {
state.registered[moduleName].props[groupName].props[prop].set.bind(
state.registered[moduleName]
)({
data: { ...state.active[moduleId].data },
props: state.active[moduleId].props
});
}
} else if ("set" in state.registered[moduleName].props[prop]) {
state.registered[moduleName].props[prop].set.bind(
state.registered[moduleName]
)({
const registeredModule = state.registered[moduleName];

if ("set" in registeredModule.props[prop]) {
const { renderers } = rootState;

const { getModuleData = () => ({}) } = renderers[
registeredModule.meta.type
];

const newData = registeredModule.props[prop].set.bind(registeredModule)({
...getModuleData(registeredModule.meta.name),
data: { ...state.active[moduleId].data },
props: state.active[moduleId].props
});

if (newData) {
commit("UPDATE_ACTIVE_MODULE", {
id: moduleId,
key: "data",
value: newData
});
}
}
},

Expand Down
7 changes: 7 additions & 0 deletions src/background/menu-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ async function save(filePath) {
} catch (e) {
console.error(e);
}

windows["mainWindow"].setRepresentedFilename(lastFileSavedPath);
windows["mainWindow"].setDocumentEdited(false);
windows["mainWindow"].setTitle(path.basename(lastFileSavedPath));
}

async function writePresetToFile(filePath) {
Expand Down Expand Up @@ -99,6 +103,9 @@ export function generateMenuTemplate() {
if (!result.canceled) {
const filePath = result.filePaths[0];
openFile(filePath);
windows["mainWindow"].setRepresentedFilename(filePath);
windows["mainWindow"].setDocumentEdited(false);
windows["mainWindow"].setTitle(path.basename(filePath));
}
}
},
Expand Down
6 changes: 6 additions & 0 deletions src/background/window-prefs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { app, dialog, ipcMain, screen, BrowserWindow } from "electron";
import os from "node:os";

import store from "../media-manager/store";
import { autoUpdater } from "electron-updater";
Expand Down Expand Up @@ -81,6 +82,10 @@ const windowPrefs = {

ipcMain.handle("is-modv-ready", () => modVReady);

window.setRepresentedFilename(os.homedir());
window.setDocumentEdited(true);
window.setTitle("Untitled");

// Configure child windows to open without a menubar (windows/linux)
window.webContents.on(
"new-window",
Expand Down Expand Up @@ -189,6 +194,7 @@ const windowPrefs = {
ipcMain.removeAllListeners("save-file");
ipcMain.removeAllListeners("current-project");
ipcMain.removeAllListeners("input-update");
ipcMain.removeHandler("is-modv-ready");
}
},

Expand Down
Loading
Loading