diff --git a/web/config/webpack.config.js b/web/config/webpack.config.js index d78b1f3..3afe484 100644 --- a/web/config/webpack.config.js +++ b/web/config/webpack.config.js @@ -4,9 +4,35 @@ module.exports = (config, { env }) => { config.plugins.forEach((plugin) => { if (plugin.constructor.name === 'HtmlWebpackPlugin') { plugin.options.favicon = './src/favicon.svg' + } else if (plugin.constructor.name === 'CopyPlugin') { + plugin.patterns.push({ + from: './src/cascade/js/StandardLibraryIntellisense.ts', + to: 'js/StandardLibraryIntellisense.ts', + }) + plugin.patterns.push({ + from: './src/cascade/static_node_modules/opencascade.js/dist/oc.d.ts', + to: 'opencascade.d.ts', + }) + plugin.patterns.push({ + from: '../node_modules/three/src/Three.d.ts', + to: 'Three.d.ts', + }) + plugin.patterns.push({ + from: './src/cascade/fonts', + to: 'fonts', + }) + plugin.patterns.push({ + from: './src/cascade/textures', + to: 'textures', + }) } }) config.plugins.push(new MonacoWebpackPlugin()) + config.module.rules[0].oneOf.push({ + test: /opencascade\.wasm\.wasm$/, + type: 'javascript/auto', + loader: 'file-loader', + }) return config } diff --git a/web/package.json b/web/package.json index 46c5198..bb28497 100644 --- a/web/package.json +++ b/web/package.json @@ -42,7 +42,9 @@ "devDependencies": { "autoprefixer": "9.8.6", "html-webpack-plugin": "^4.5.0", + "opentype.js": "^1.3.3", "postcss-loader": "4.0.2", - "tailwindcss": "^1.9.1" + "tailwindcss": "^1.9.1", + "worker-loader": "^3.0.7" } } diff --git a/web/src/cascade b/web/src/cascade index 33d1b22..69e7864 160000 --- a/web/src/cascade +++ b/web/src/cascade @@ -1 +1 @@ -Subproject commit 33d1b225f76f5571eac947019bdd5acf0b7ae28f +Subproject commit 69e7864059c7537c0753e7dcf1c1ecdbb25d0748 diff --git a/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js b/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js index f97c1c9..72cf624 100644 --- a/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js +++ b/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js @@ -2,6 +2,7 @@ import { useAuth } from '@redwoodjs/auth' import CascadeController from 'src/helpers/cascadeController' import IdeToolbar from 'src/components/IdeToolbar' import { useEffect, useState } from 'react' +import { threejsViewport } from 'src/cascade/js/MainPage/CascadeState' const defaultExampleCode = `// Welcome to Cascade Studio! Here are some useful functions: // Translate(), Rotate(), Scale(), Union(), Difference(), Intersection() diff --git a/web/src/components/IdeToolbar/IdeToolbar.js b/web/src/components/IdeToolbar/IdeToolbar.js index 81947ad..ba5307a 100644 --- a/web/src/components/IdeToolbar/IdeToolbar.js +++ b/web/src/components/IdeToolbar/IdeToolbar.js @@ -292,23 +292,16 @@ const IdeToolbar = ({ transformOrigin={transformOrigin} className="material-ui-overrides transform translate-y-4" > -
+
- Model never generating? + Can't export stl/obj/STEP?
- Due to the current integration with CascadeStudio and the order in - which the code initialise sometimes the 3d model never generates -
Work around
-

- Usually going to the homepage, then refreshing, - waiting a good 10 seconds before navigating back to the part - your interested in should fix the issue. -

+ Currently exports are only working for chrome and edge browsers

If this problem is frustrating to you, leave a comment on its{' '} github issue {' '} diff --git a/web/src/helpers/cascadeController.js b/web/src/helpers/cascadeController.js index b9c9bb9..5cc6e61 100644 --- a/web/src/helpers/cascadeController.js +++ b/web/src/helpers/cascadeController.js @@ -1,4 +1,5 @@ -import { initialize, getEditor } from 'src/cascade/js/MainPage/CascadeMain' +import { initialize } from 'src/cascade/js/MainPage/CascadeMain' +import { monacoEditor } from 'src/cascade/js/MainPage/CascadeState' class CascadeController { _hasInitialised = false @@ -9,14 +10,14 @@ class CascadeController { initialise(onCodeChange, code) { const onInit = () => { - const editor = getEditor() + const editor = monacoEditor editor.setValue(code) editor.evaluateCode(false) } // only inits on first call, after that it just updates the editor and revaluates code, maybe should rename? this.incomingOnCodeChang = onCodeChange if (!this._hasInitialised) { - initialize(this.controllerOnCodeChange, code, onInit) + new initialize(this.controllerOnCodeChange, code, onInit) this._hasInitialised = true return } diff --git a/yarn.lock b/yarn.lock index 5bcd2b1..6d2dd47 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12136,6 +12136,14 @@ opener@^1.5.1: resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.1.tgz#6d2f0e77f1a0af0032aca716c2c1fbb8e7e8abed" integrity sha512-goYSy5c2UXE4Ra1xixabeVh1guIX/ZV/YokJksb6q2lubWu6UbvPQ20p542/sFIll1nl8JnCyK9oBaOcCWXwvA== +opentype.js@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/opentype.js/-/opentype.js-1.3.3.tgz#65b8645b090a1ad444065b784d442fa19d1061f6" + integrity sha512-/qIY/+WnKGlPIIPhbeNjynfD2PO15G9lA/xqlX2bDH+4lc3Xz5GCQ68mqxj3DdUv6AJqCeaPvuAoH8mVL0zcuA== + dependencies: + string.prototype.codepointat "^0.2.1" + tiny-inflate "^1.0.3" + opn@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/opn/-/opn-5.5.0.tgz#fc7164fab56d235904c51c3b27da6758ca3b9bfc" @@ -14851,6 +14859,11 @@ string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string.prototype.codepointat@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/string.prototype.codepointat/-/string.prototype.codepointat-0.2.1.tgz#004ad44c8afc727527b108cd462b4d971cd469bc" + integrity sha512-2cBVCj6I4IOvEnjgO/hWqXjqBGsY+zwPmHl12Srk9IXSZ56Jwwmy+66XO5Iut/oQVR7t5ihYdLB0GMa4alEUcg== + "string.prototype.matchall@^4.0.0 || ^3.0.1", string.prototype.matchall@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.2.tgz#48bb510326fb9fdeb6a33ceaa81a6ea04ef7648e" @@ -15360,6 +15373,11 @@ tiny-emitter@^2.0.0: resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423" integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q== +tiny-inflate@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tiny-inflate/-/tiny-inflate-1.0.3.tgz#122715494913a1805166aaf7c93467933eea26c4" + integrity sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw== + tiny-warning@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" @@ -16349,6 +16367,14 @@ worker-farm@^1.7.0: dependencies: errno "~0.1.7" +worker-loader@^3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/worker-loader/-/worker-loader-3.0.7.tgz#9cf2122a9a781d6742cb873c58c3769591b31988" + integrity sha512-LjYLuYJw6kqQKDoygpoD5vWeR1CbZjuVSW3/8pFsptMlUl8gatNM/pszhasSDAWt+dYxMipWB6695k+1zId+iQ== + dependencies: + loader-utils "^2.0.0" + schema-utils "^3.0.0" + worker-rpc@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/worker-rpc/-/worker-rpc-0.1.1.tgz#cb565bd6d7071a8f16660686051e969ad32f54d5"