diff --git a/README.md b/README.md index 0495097fa..5dc52183e 100644 --- a/README.md +++ b/README.md @@ -81,11 +81,12 @@ Then create a production build of the project: ``` npm run build ``` -^ This command is not always needed while testing, you'll need it most prior to deploying your code +^ This command is not always needed while testing, you'll need it most prior to deploying your code because it's basically just an optimisation command you don't need to use much And lastly, to run your project in development: ``` npm start +^ Instead of the usual procedure of running build-engine and then running npm start you can just type npm run engine-quickrun instead :) ``` If it worked, you should see something like this in the terminal. diff --git a/engine/src/base/Clip.js b/engine/src/base/Clip.js index d357c6f09..66b8308a8 100644 --- a/engine/src/base/Clip.js +++ b/engine/src/base/Clip.js @@ -61,6 +61,7 @@ Wick.Clip = class extends Wick.Tickable { this._sourceClipUUID = null; this._assetSourceUUID = null; + this.asseted = false; /* If objects are passed in, add them to the clip and reposition them */ if (args.objects) { @@ -81,6 +82,7 @@ Wick.Clip = class extends Wick.Tickable { data.singleFrameNumber = this._singleFrameNumber; data.assetSourceUUID = this._assetSourceUUID; data.isSynced = this._isSynced; + data.asseted = this.asseted; return data; } @@ -95,6 +97,7 @@ Wick.Clip = class extends Wick.Tickable { this._singleFrameNumber = data.singleFrameNumber || 1; this._assetSourceUUID = data.assetSourceUUID; this._isSynced = data.isSynced; + this.asseted = data.asseted || false; this._playedOnce = false; diff --git a/engine/src/export/wickobj/WickObjectFile.js b/engine/src/export/wickobj/WickObjectFile.js index 417851b7d..7a934310b 100644 --- a/engine/src/export/wickobj/WickObjectFile.js +++ b/engine/src/export/wickobj/WickObjectFile.js @@ -44,7 +44,7 @@ Wick.WickObjectFile = class { /** * Create a wick file from the project. - * @param {Wick.Project} clip - the clip to create a wickobject file from + * @param {Wick.Clip} clip - the clip to create a wickobject file from * @param {string} format - Can be 'blob' or 'dataurl'. */ static toWickObjectFile (clip, format, callback) { @@ -53,7 +53,7 @@ Wick.WickObjectFile = class { var data = clip.export(); var json = JSON.stringify(data); var blob = new Blob([json], {type: "application/json"}); - + if(format === 'blob') { callback(blob); } else if (format === 'dataurl') { diff --git a/engine/src/gui/BreadcrumbsButton.js b/engine/src/gui/BreadcrumbsButton.js index 323542059..4bd4b39bc 100644 --- a/engine/src/gui/BreadcrumbsButton.js +++ b/engine/src/gui/BreadcrumbsButton.js @@ -21,6 +21,7 @@ Wick.GUIElement.BreadcrumbsButton = class extends Wick.GUIElement.Button { constructor (model) { super(model, { clickFn: () => { + this.model.project.focus.asseted = false; this.model.project.focus = model; this.projectWasModified(); } diff --git a/package-lock.json b/package-lock.json index 0dfbdae63..d09792f3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3085,6 +3085,18 @@ "node": ">=8.6" } }, + "node_modules/@jest/core/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@jest/core/node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -3333,6 +3345,18 @@ "node": ">=8.6" } }, + "node_modules/@jest/transform/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@jest/transform/node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -4258,6 +4282,18 @@ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", "license": "MIT" }, + "node_modules/@rollup/pluginutils/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@rtsao/scc": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", @@ -4467,6 +4503,15 @@ "node": ">=10" } }, + "node_modules/@svgr/core/node_modules/yaml": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz", + "integrity": "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==", + "license": "ISC", + "engines": { + "node": ">= 6" + } + }, "node_modules/@svgr/hast-util-to-babel-ast": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/@svgr/hast-util-to-babel-ast/-/hast-util-to-babel-ast-5.5.0.tgz", @@ -4536,6 +4581,15 @@ "node": ">=10" } }, + "node_modules/@svgr/plugin-svgo/node_modules/yaml": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz", + "integrity": "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==", + "license": "ISC", + "engines": { + "node": ">= 6" + } + }, "node_modules/@svgr/webpack": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/@svgr/webpack/-/webpack-5.5.0.tgz", @@ -8336,6 +8390,15 @@ "postcss": "^8.2.15" } }, + "node_modules/cssnano/node_modules/yaml": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz", + "integrity": "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==", + "license": "ISC", + "engines": { + "node": ">= 6" + } + }, "node_modules/csso": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz", @@ -9954,6 +10017,18 @@ "node": ">=8.6" } }, + "node_modules/eslint-webpack-plugin/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/eslint-webpack-plugin/node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -10593,6 +10668,18 @@ "node": ">=8.6" } }, + "node_modules/fast-glob/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/fast-glob/node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -12550,6 +12637,18 @@ "node": ">=8.6" } }, + "node_modules/http-proxy-middleware/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/http-proxy-middleware/node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -13928,6 +14027,18 @@ "node": ">=8.6" } }, + "node_modules/jest-config/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/jest-config/node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -14126,6 +14237,18 @@ "node": ">=8.6" } }, + "node_modules/jest-haste-map/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/jest-haste-map/node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -14260,6 +14383,18 @@ "node": ">=8.6" } }, + "node_modules/jest-message-util/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/jest-message-util/node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -14486,6 +14621,18 @@ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, + "node_modules/jest-util/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/jest-validate": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-27.5.1.tgz", @@ -14760,6 +14907,18 @@ "node": ">=8.6" } }, + "node_modules/jest-watch-typeahead/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/jest-watch-typeahead/node_modules/pretty-format": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", @@ -14913,6 +15072,13 @@ "jiti": "bin/jiti.js" } }, + "node_modules/jquery": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", + "license": "MIT", + "peer": true + }, "node_modules/js-binary-schema-parser": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/js-binary-schema-parser/-/js-binary-schema-parser-2.0.3.tgz", @@ -17018,12 +17184,12 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", - "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "license": "MIT", "engines": { - "node": ">=8.6" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" @@ -17822,6 +17988,15 @@ "node": ">=10" } }, + "node_modules/postcss-loader/node_modules/yaml": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz", + "integrity": "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==", + "license": "ISC", + "engines": { + "node": ">= 6" + } + }, "node_modules/postcss-logical": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/postcss-logical/-/postcss-logical-5.0.4.tgz", @@ -20585,6 +20760,19 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/sass/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/sass/node_modules/readdirp": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz", @@ -22462,6 +22650,18 @@ "node": ">=8.6" } }, + "node_modules/tailwindcss/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/tailwindcss/node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -22750,18 +22950,6 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tinyglobby/node_modules/picomatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", - "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -23163,6 +23351,20 @@ "is-typedarray": "^1.0.0" } }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/ua-parser-js": { "version": "1.0.41", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.41.tgz", @@ -24056,6 +24258,18 @@ "node": ">=0.12.0" } }, + "node_modules/webpack-dev-server/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/webpack-dev-server/node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -24766,15 +24980,6 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "license": "ISC" }, - "node_modules/yaml": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz", - "integrity": "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==", - "license": "ISC", - "engines": { - "node": ">= 6" - } - }, "node_modules/yargs": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.2.tgz", diff --git a/package.json b/package.json index 0020c9524..12c1780ff 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "build": "npm run copy-pdf-worker && npm run copy-ffmpeg-core && react-scripts build && echo 'candlestickers.app' > ./build/CNAME", "build:nocname": "npm run copy-pdf-worker && npm run copy-ffmpeg-core && react-scripts build", "build-engine": "cd engine && shx mkdir -p dist && gulp && shx cp -r dist/. ../public/corelibs/wick-engine/", - "build-engine-windows": "cd engine && shx mkdir -p dist && gulp && shx cp -r dist/. ../public/corelibs/wick-engine/", + "engine-quickrun": "npm run build-engine && npm start", "test": "react-scripts test", "engine-tests": "cd engine && npx http-server", "predeploy": "npm run build", diff --git a/src/Editor/Editor.jsx b/src/Editor/Editor.jsx index 82988bbcd..0b576893e 100644 --- a/src/Editor/Editor.jsx +++ b/src/Editor/Editor.jsx @@ -1408,6 +1408,7 @@ class Editor extends EditorCore { updateLastColors={this.updateLastColors} lastColorsUsed={this.state.lastColorsUsed} getClipAnimationTypes={this.getClipAnimationTypes} + selection={this.project.selection.getSelectedObjects()} /> diff --git a/src/Editor/EditorCore.jsx b/src/Editor/EditorCore.jsx index 6eabb9eb0..135161416 100644 --- a/src/Editor/EditorCore.jsx +++ b/src/Editor/EditorCore.jsx @@ -1019,6 +1019,12 @@ class EditorCore extends Component { * @param {Function} callback - (optional) Callback to return asset to. If the import was unsuccessful, null is sent to the callback. */ importFileAsAsset = async (file, callback) => { + + if (this.project.getAssetByName(file.name)) { + this.toast(`Asset with name '${file.name}' already exists.`, 'warning'); + Object.defineProperty(file, 'name', {value: file.name + '-copy'}); + } + // Content-based dedup: fingerprint the new file (size + first 64 bytes) // then compare against all existing assets via their data-URL base64. try { @@ -1053,7 +1059,7 @@ class EditorCore extends Component { if (asset === null) { this.toast('Could not add files to project: ' + file.name, 'error'); } else { - this.toast(`Imported ${file.name || "project"} successfully.`); + this.toast(`Imported ${file.name || "file"} successfully.`); this.projectDidChange({ actionName: "Import File As Asset" }); } }); @@ -1100,6 +1106,7 @@ class EditorCore extends Component { * @param {object} options - optional flags. Can include "create", which if true will create an instance of the object on the canvas. */ createAssets = (acceptedFiles, rejectedFiles, options) => { + if (!rejectedFiles) rejectedFiles = []; if (!options) options = {}; let toastID = this.toast('Importing files...', 'info'); diff --git a/src/Editor/Modals/ExportOptions/ExportOptions.jsx b/src/Editor/Modals/ExportOptions/ExportOptions.jsx index adecc28f6..f0b94bed7 100644 --- a/src/Editor/Modals/ExportOptions/ExportOptions.jsx +++ b/src/Editor/Modals/ExportOptions/ExportOptions.jsx @@ -407,7 +407,7 @@ class ExportOptions extends Component { icon: "cancel", }, { - text: "Not ineractive", + text: "Not interactive", icon: "cancel" }, ]} /> diff --git a/src/Editor/Panels/Inspector/Inspector.jsx b/src/Editor/Panels/Inspector/Inspector.jsx index 42e5ce414..a91a2d970 100644 --- a/src/Editor/Panels/Inspector/Inspector.jsx +++ b/src/Editor/Panels/Inspector/Inspector.jsx @@ -89,6 +89,7 @@ class Inspector extends Component { 'breakApart': ["clip", "button",], 'convertSelectionToButton': ["path", "text", "image", "multipath", "multiclip", "multicanvas"], 'convertSelectionToClip': ["path", "text", "image", "multipath", "multiclip", "multicanvas"], + 'addToAssetLibraryAsWickobj': ["clip", "button"], 'editTimeline': ["clip", "button"], 'addAssetToCanvas': ["imageasset", "clipasset"], // 'alignX': [ "multipath"] // H.A. @@ -1013,7 +1014,14 @@ class Inspector extends Component { Object.keys(this.actionRules).forEach(action => { let actionList = this.actionRules[action]; - if (actionList.indexOf(selectionType) > -1) actions.push(action); + if (actionList.indexOf(selectionType) > -1) { + if(action === 'addToAssetLibraryAsWickobj') { + if (!this.props.selection[0].assetSourceUUID && !this.props.selection[0].asseted) { + actions.push(action); + } + } + else actions.push(action); + } }); return( diff --git a/src/Editor/actionMap.js b/src/Editor/actionMap.js index f95a2c267..bf474f4aa 100644 --- a/src/Editor/actionMap.js +++ b/src/Editor/actionMap.js @@ -125,6 +125,20 @@ class ActionMapInterface extends Object { id: 'action-edit-timeline', color: 'active-green' }, + addToAssetLibraryAsWickobj: { + tooltip: 'Add to Asset Library', + action: () => { + const selectedObject = this.editor.project?.selection?.getSelectedObject(); + if (selectedObject === null) return; + if (selectedObject.assetSourceUUID) return; + if(!selectedObject.identifier) selectedObject.identifier = 'clip_' + this.editor.project.assets.length; + window.Wick.WickObjectFile.toWickObjectFile(selectedObject, 'blob', file => { + selectedObject.asseted = true; + let FileObj = new File([file], selectedObject.identifier, { type: file.type }); + this.editor.importFileAsAsset(FileObj)}); + }, + id: 'action-add-clip-as-asset', + }, breakApart: { icon: 'breakApart-dark', tooltip: 'Break Apart',