From af853825b83284aed26241423841105536f196af Mon Sep 17 00:00:00 2001 From: yyc-git <395976266@qq.com> Date: Mon, 27 Nov 2023 18:13:57 +0800 Subject: [PATCH] feat(uicontrol): add Scene Tree separate header, body: header = multiple Image Buttons; rename to Tree; add new Input; --- contributes/meta3d-action-add-cube/.gitignore | 19 ++ .../meta3d-action-add-cube/gulpfile.js | 25 ++ .../meta3d-action-add-cube/package.json | 37 +++ .../meta3d-action-add-cube/src/Main.ts | 87 ++++++ .../meta3d-action-add-cube/tsconfig.json | 24 ++ .../meta3d-action-add-cube/webpack.config.js | 64 +++++ .../meta3d-action-clone-gameobject/.gitignore | 19 ++ .../gulpfile.js | 25 ++ .../package.json | 36 +++ .../src/Main.ts | 106 +++++++ .../tsconfig.json | 24 ++ .../webpack.config.js | 64 +++++ .../.gitignore | 19 ++ .../gulpfile.js | 25 ++ .../package.json | 36 +++ .../src/Main.ts | 194 +++++++++++++ .../tsconfig.json | 24 ++ .../webpack.config.js | 64 +++++ .../.gitignore | 19 ++ .../gulpfile.js | 25 ++ .../package.json | 35 +++ .../src/Main.ts | 66 +++++ .../tsconfig.json | 24 ++ .../webpack.config.js | 64 +++++ .../meta3d-action-set-parent/.gitignore | 19 ++ .../meta3d-action-set-parent/gulpfile.js | 25 ++ .../meta3d-action-set-parent/package.json | 35 +++ .../meta3d-action-set-parent/src/Main.ts | 107 +++++++ .../meta3d-action-set-parent/tsconfig.json | 24 ++ .../webpack.config.js | 64 +++++ .../meta3d-input-runstopbutton/package.json | 5 +- contributes/meta3d-input-scenetree/.gitignore | 19 ++ .../meta3d-input-scenetree/gulpfile.js | 25 ++ .../meta3d-input-scenetree/package.json | 35 +++ .../meta3d-input-scenetree/src/Main.ts | 41 +++ .../meta3d-input-scenetree/tsconfig.json | 24 ++ .../meta3d-input-scenetree/webpack.config.js | 64 +++++ .../meta3d-ui-control-asset/src/Main.ts | 33 +-- .../src/Main.ts | 85 ++++-- contributes/meta3d-ui-control-tree/.gitignore | 19 ++ .../meta3d-ui-control-tree/gulpfile.js | 25 ++ contributes/meta3d-ui-control-tree/jest.json | 27 ++ .../meta3d-ui-control-tree/jest_coverage.json | 40 +++ .../meta3d-ui-control-tree/package.json | 39 +++ .../meta3d-ui-control-tree/src/Main.ts | 212 ++++++++++++++ .../test/features/tree_data.feature | 21 ++ .../test/helper/jest/specHelper.js | 264 ++++++++++++++++++ .../meta3d-ui-control-tree/test/jest.d.ts | 8 + .../test/step-definitions/tree_data.steps.ts | 169 +++++++++++ .../test/tool/APITool.ts | 17 ++ .../meta3d-ui-control-tree/tsconfig.json | 29 ++ .../meta3d-ui-control-tree/url-loader.d.ts | 6 + .../meta3d-ui-control-tree/webpack.config.js | 64 +++++ .../meta3d-commonlib-ts/src/NullableUtils.ts | 4 + .../UIControlProtocolConfigType.res | 2 + .../contribute/UIControlProtocolConfigType.ts | 2 +- doc/0.21.0.org | 32 ++- .../meta3d-imgui-webgl1-renderer/package.json | 2 +- .../meta3d-imgui-webgl1-renderer/src/Main.ts | 5 +- .../meta3d-imgui-webgl1-renderer/src/Tree.ts | 150 ++++++++++ .../meta3d-ui/dist/static/js/main.js | 4 +- .../meta3d-ui/lib/es6_global/src/Main.bs.js | 4 +- .../lib/es6_global/src/UIManager.bs.js | 6 +- .../test/tool/ImguiRendererServiceTool.bs.js | 6 +- .../test/tool/ImguiRendererServiceTool.bs.js | 6 +- .../ui/extensions/meta3d-ui/package.json | 2 +- .../ui/extensions/meta3d-ui/src/Main.res | 2 +- .../ui/extensions/meta3d-ui/src/UIManager.res | 18 +- .../test/tool/ImguiRendererServiceTool.res | 4 +- .../package.json | 2 +- .../src/service/ServiceType.res | 55 ++-- .../src/service/ServiceType.ts | 34 +-- .../meta3d-ui-protocol/package.json | 2 +- .../src/service/ServiceType.res | 27 +- .../src/service/ServiceType.ts | 29 +- .../.gitignore | 19 ++ .../gulpfile.js | 23 ++ .../meta3d-action-add-cube-protocol/icon.png | Bin 0 -> 3766 bytes .../package.json | 19 ++ .../src/EventType.ts | 3 + .../src/StateType.ts | 12 + .../tsconfig.json | 24 ++ .../.gitignore | 19 ++ .../gulpfile.js | 23 ++ .../icon.png | Bin 0 -> 3766 bytes .../package.json | 19 ++ .../src/EventType.ts | 5 + .../src/StateType.ts | 10 + .../tsconfig.json | 24 ++ .../.gitignore | 19 ++ .../gulpfile.js | 23 ++ .../icon.png | Bin 0 -> 3766 bytes .../package.json | 19 ++ .../src/EventType.ts | 5 + .../src/StateType.ts | 15 + .../tsconfig.json | 24 ++ .../.gitignore | 19 ++ .../gulpfile.js | 23 ++ .../icon.png | Bin 0 -> 3766 bytes .../package.json | 19 ++ .../src/EventType.ts | 5 + .../src/StateType.ts | 13 + .../tsconfig.json | 24 ++ .../.gitignore | 19 ++ .../gulpfile.js | 23 ++ .../icon.png | Bin 0 -> 3766 bytes .../package.json | 19 ++ .../src/EventType.ts | 9 + .../src/StateType.ts | 17 ++ .../tsconfig.json | 24 ++ .../meta3d-input-tree-protocol/.gitignore | 19 ++ .../meta3d-input-tree-protocol/gulpfile.js | 23 ++ .../meta3d-input-tree-protocol/icon.png | Bin 0 -> 3766 bytes .../meta3d-input-tree-protocol/package.json | 19 ++ .../meta3d-input-tree-protocol/src/Index.ts | 13 + .../meta3d-input-tree-protocol/tsconfig.json | 24 ++ .../.gitignore | 19 ++ .../gulpfile.js | 45 +++ .../meta3d-ui-control-tree-protocol/icon.png | Bin 0 -> 3766 bytes .../package.json | 28 ++ .../src/Config.ts | 69 +++++ .../src/Index.ts | 48 ++++ .../tsconfig.json | 24 ++ .../webpack.config.js | 64 +++++ utils/meta3d-scenetree-utils/.gitignore | 19 ++ utils/meta3d-scenetree-utils/package.json | 16 ++ .../src/SceneTreeUtils.ts | 50 ++++ utils/meta3d-scenetree-utils/tsconfig.json | 24 ++ utils/meta3d-ui-control-utils/.gitignore | 19 ++ utils/meta3d-ui-control-utils/package.json | 16 ++ .../src/SpecificDataUtils.ts | 34 +++ utils/meta3d-ui-control-utils/tsconfig.json | 24 ++ 132 files changed, 4025 insertions(+), 159 deletions(-) create mode 100755 contributes/meta3d-action-add-cube/.gitignore create mode 100755 contributes/meta3d-action-add-cube/gulpfile.js create mode 100755 contributes/meta3d-action-add-cube/package.json create mode 100755 contributes/meta3d-action-add-cube/src/Main.ts create mode 100755 contributes/meta3d-action-add-cube/tsconfig.json create mode 100755 contributes/meta3d-action-add-cube/webpack.config.js create mode 100755 contributes/meta3d-action-clone-gameobject/.gitignore create mode 100755 contributes/meta3d-action-clone-gameobject/gulpfile.js create mode 100755 contributes/meta3d-action-clone-gameobject/package.json create mode 100755 contributes/meta3d-action-clone-gameobject/src/Main.ts create mode 100755 contributes/meta3d-action-clone-gameobject/tsconfig.json create mode 100755 contributes/meta3d-action-clone-gameobject/webpack.config.js create mode 100755 contributes/meta3d-action-dispose-gameobject/.gitignore create mode 100755 contributes/meta3d-action-dispose-gameobject/gulpfile.js create mode 100755 contributes/meta3d-action-dispose-gameobject/package.json create mode 100755 contributes/meta3d-action-dispose-gameobject/src/Main.ts create mode 100755 contributes/meta3d-action-dispose-gameobject/tsconfig.json create mode 100755 contributes/meta3d-action-dispose-gameobject/webpack.config.js create mode 100755 contributes/meta3d-action-select-scenetree-node/.gitignore create mode 100755 contributes/meta3d-action-select-scenetree-node/gulpfile.js create mode 100755 contributes/meta3d-action-select-scenetree-node/package.json create mode 100755 contributes/meta3d-action-select-scenetree-node/src/Main.ts create mode 100755 contributes/meta3d-action-select-scenetree-node/tsconfig.json create mode 100755 contributes/meta3d-action-select-scenetree-node/webpack.config.js create mode 100755 contributes/meta3d-action-set-parent/.gitignore create mode 100755 contributes/meta3d-action-set-parent/gulpfile.js create mode 100755 contributes/meta3d-action-set-parent/package.json create mode 100755 contributes/meta3d-action-set-parent/src/Main.ts create mode 100755 contributes/meta3d-action-set-parent/tsconfig.json create mode 100755 contributes/meta3d-action-set-parent/webpack.config.js create mode 100755 contributes/meta3d-input-scenetree/.gitignore create mode 100755 contributes/meta3d-input-scenetree/gulpfile.js create mode 100755 contributes/meta3d-input-scenetree/package.json create mode 100755 contributes/meta3d-input-scenetree/src/Main.ts create mode 100755 contributes/meta3d-input-scenetree/tsconfig.json create mode 100755 contributes/meta3d-input-scenetree/webpack.config.js create mode 100755 contributes/meta3d-ui-control-tree/.gitignore create mode 100755 contributes/meta3d-ui-control-tree/gulpfile.js create mode 100755 contributes/meta3d-ui-control-tree/jest.json create mode 100755 contributes/meta3d-ui-control-tree/jest_coverage.json create mode 100755 contributes/meta3d-ui-control-tree/package.json create mode 100755 contributes/meta3d-ui-control-tree/src/Main.ts create mode 100755 contributes/meta3d-ui-control-tree/test/features/tree_data.feature create mode 100755 contributes/meta3d-ui-control-tree/test/helper/jest/specHelper.js create mode 100755 contributes/meta3d-ui-control-tree/test/jest.d.ts create mode 100755 contributes/meta3d-ui-control-tree/test/step-definitions/tree_data.steps.ts create mode 100644 contributes/meta3d-ui-control-tree/test/tool/APITool.ts create mode 100755 contributes/meta3d-ui-control-tree/tsconfig.json create mode 100755 contributes/meta3d-ui-control-tree/url-loader.d.ts create mode 100755 contributes/meta3d-ui-control-tree/webpack.config.js create mode 100755 packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/src/Tree.ts create mode 100755 protocols/contribute_protocols/meta3d-action-add-cube-protocol/.gitignore create mode 100755 protocols/contribute_protocols/meta3d-action-add-cube-protocol/gulpfile.js create mode 100755 protocols/contribute_protocols/meta3d-action-add-cube-protocol/icon.png create mode 100755 protocols/contribute_protocols/meta3d-action-add-cube-protocol/package.json create mode 100755 protocols/contribute_protocols/meta3d-action-add-cube-protocol/src/EventType.ts create mode 100755 protocols/contribute_protocols/meta3d-action-add-cube-protocol/src/StateType.ts create mode 100755 protocols/contribute_protocols/meta3d-action-add-cube-protocol/tsconfig.json create mode 100755 protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/.gitignore create mode 100755 protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/gulpfile.js create mode 100755 protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/icon.png create mode 100755 protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/package.json create mode 100755 protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/src/EventType.ts create mode 100755 protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/src/StateType.ts create mode 100755 protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/tsconfig.json create mode 100755 protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/.gitignore create mode 100755 protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/gulpfile.js create mode 100755 protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/icon.png create mode 100755 protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/package.json create mode 100755 protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/src/EventType.ts create mode 100755 protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/src/StateType.ts create mode 100755 protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/tsconfig.json create mode 100755 protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/.gitignore create mode 100755 protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/gulpfile.js create mode 100755 protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/icon.png create mode 100755 protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/package.json create mode 100755 protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/src/EventType.ts create mode 100755 protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/src/StateType.ts create mode 100755 protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/tsconfig.json create mode 100755 protocols/contribute_protocols/meta3d-action-set-parent-protocol/.gitignore create mode 100755 protocols/contribute_protocols/meta3d-action-set-parent-protocol/gulpfile.js create mode 100755 protocols/contribute_protocols/meta3d-action-set-parent-protocol/icon.png create mode 100755 protocols/contribute_protocols/meta3d-action-set-parent-protocol/package.json create mode 100755 protocols/contribute_protocols/meta3d-action-set-parent-protocol/src/EventType.ts create mode 100755 protocols/contribute_protocols/meta3d-action-set-parent-protocol/src/StateType.ts create mode 100755 protocols/contribute_protocols/meta3d-action-set-parent-protocol/tsconfig.json create mode 100755 protocols/contribute_protocols/meta3d-input-tree-protocol/.gitignore create mode 100755 protocols/contribute_protocols/meta3d-input-tree-protocol/gulpfile.js create mode 100755 protocols/contribute_protocols/meta3d-input-tree-protocol/icon.png create mode 100755 protocols/contribute_protocols/meta3d-input-tree-protocol/package.json create mode 100755 protocols/contribute_protocols/meta3d-input-tree-protocol/src/Index.ts create mode 100755 protocols/contribute_protocols/meta3d-input-tree-protocol/tsconfig.json create mode 100755 protocols/contribute_protocols/meta3d-ui-control-tree-protocol/.gitignore create mode 100755 protocols/contribute_protocols/meta3d-ui-control-tree-protocol/gulpfile.js create mode 100755 protocols/contribute_protocols/meta3d-ui-control-tree-protocol/icon.png create mode 100755 protocols/contribute_protocols/meta3d-ui-control-tree-protocol/package.json create mode 100755 protocols/contribute_protocols/meta3d-ui-control-tree-protocol/src/Config.ts create mode 100755 protocols/contribute_protocols/meta3d-ui-control-tree-protocol/src/Index.ts create mode 100755 protocols/contribute_protocols/meta3d-ui-control-tree-protocol/tsconfig.json create mode 100755 protocols/contribute_protocols/meta3d-ui-control-tree-protocol/webpack.config.js create mode 100755 utils/meta3d-scenetree-utils/.gitignore create mode 100755 utils/meta3d-scenetree-utils/package.json create mode 100755 utils/meta3d-scenetree-utils/src/SceneTreeUtils.ts create mode 100755 utils/meta3d-scenetree-utils/tsconfig.json create mode 100755 utils/meta3d-ui-control-utils/.gitignore create mode 100755 utils/meta3d-ui-control-utils/package.json create mode 100755 utils/meta3d-ui-control-utils/src/SpecificDataUtils.ts create mode 100755 utils/meta3d-ui-control-utils/tsconfig.json diff --git a/contributes/meta3d-action-add-cube/.gitignore b/contributes/meta3d-action-add-cube/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/contributes/meta3d-action-add-cube/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/contributes/meta3d-action-add-cube/gulpfile.js b/contributes/meta3d-action-add-cube/gulpfile.js new file mode 100755 index 000000000..a4c8812fc --- /dev/null +++ b/contributes/meta3d-action-add-cube/gulpfile.js @@ -0,0 +1,25 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish") + +gulp.task("publish_local_env", function (done) { + publish.publishContribute( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContribute( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + + diff --git a/contributes/meta3d-action-add-cube/package.json b/contributes/meta3d-action-add-cube/package.json new file mode 100755 index 000000000..a882d0245 --- /dev/null +++ b/contributes/meta3d-action-add-cube/package.json @@ -0,0 +1,37 @@ +{ + "name": "meta3d-action-add-cube", + "version": "0.20.1", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "displayName": "add-cube", + "repoLink": "https://github.com/Meta3D-Technology/Meta3D/tree/master/contributes/meta3d-action-add-cube", + "description": "add cube action", + "protocol": { + "name": "meta3d-action-add-cube-protocol" + }, + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "webpack": "webpack --config webpack.config.js", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publish_local_env", + "meta3d:publish_pro": "cross-env NODE_ENV=production npm run webpack && gulp publish_production_env" + }, + "keywords": [], + "dependencies": { + "meta3d-action-add-cube-protocol": "^0.20.0", + "meta3d-editor-whole-protocol": "^0.20.0", + "meta3d-type": "^0.20.0" + }, + "devDependencies": { + "clean-webpack-plugin": "^4.0.0", + "cross-env": "^7.0.3", + "cz-customizable": "^6.3.0", + "gulp": "^4.0.2", + "meta3d-tool-publish": "^0.20.0", + "source-map-loader": "^3.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.2.3", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + } +} diff --git a/contributes/meta3d-action-add-cube/src/Main.ts b/contributes/meta3d-action-add-cube/src/Main.ts new file mode 100755 index 000000000..798c158b0 --- /dev/null +++ b/contributes/meta3d-action-add-cube/src/Main.ts @@ -0,0 +1,87 @@ +import { state as meta3dState, getContribute as getContributeMeta3D, api } from "meta3d-type" +import { actionContribute, service as editorWholeService } from "meta3d-editor-whole-protocol/src/service/ServiceType" +import { actionName, state, uiData } from "meta3d-action-add-cube-protocol" +import { eventName, inputData } from "meta3d-action-add-cube-protocol/src/EventType" +import { disposeGameObjectAndAllChildren } from "meta3d-dispose-utils/src/DisposeGameObjectUtils" +import { createCubeGameObject } from "meta3d-primitive-utils/src/CubeUtils" +import { service as gameViewRenderService } from "meta3d-editor-gameview-render-protocol/src/service/ServiceType" + +let _createCube = (meta3dState: meta3dState, api: api) => { + let engineSceneService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).scene(meta3dState) + + let diffuseColor: [number, number, number] = [Math.random(), Math.random(), Math.random()] + let localPosition: [number, number, number] = [Math.random() * 10 - 5, Math.random() * 10 - 5, 0] + + return createCubeGameObject(meta3dState, engineSceneService, [localPosition, diffuseColor]) +} + +export let getContribute: getContributeMeta3D> = (api) => { + return { + actionName: actionName, + init: (meta3dState) => { + let eventSourcingService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState) + + return new Promise((resolve, reject) => { + resolve(eventSourcingService.on(meta3dState, eventName, 0, (meta3dState) => { + let data = _createCube(meta3dState, api) + meta3dState = data[0] + let addedGameObject = data[1] + + let state = api.nullable.getExn( + api.action.getActionState(meta3dState, actionName) + ) + + meta3dState = api.action.setActionState(meta3dState, actionName, { + ...state, + addedGameObjects: + state.addedGameObjects.push(addedGameObject) + }) + + let editorWholeService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")) + return Promise.resolve(api.nullable.getWithDefault( + api.nullable.map( + ({ runOnlyOnce }) => { + return runOnlyOnce(meta3dState) + }, + editorWholeService.getPluggablePackageService(meta3dState, "meta3d-editor-gameview-render-protocol") + ), + meta3dState + )) + }, (meta3dState) => { + let { + addedGameObjects, + } = api.nullable.getExn(api.action.getActionState(meta3dState, actionName)) + + let disposedGameObject = api.nullable.getExn(addedGameObjects.last()) + + let state = api.nullable.getExn(api.action.getActionState(meta3dState, actionName)) + + meta3dState = api.action.setActionState(meta3dState, actionName, { + ...state, + addedGameObjects: + state.addedGameObjects.pop() + }) + + meta3dState = disposeGameObjectAndAllChildren(meta3dState, api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")), disposedGameObject) + + return Promise.resolve(meta3dState) + })) + }) + }, + handler: (meta3dState, uiData) => { + return new Promise((resolve, reject) => { + let eventSourcingService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState) + + resolve(eventSourcingService.addEvent(meta3dState, { + name: eventName, + inputData: [] + })) + }) + }, + createState: (meta3dState) => { + return { + addedGameObjects: api.immutable.createList(meta3dState), + } + } + } +} diff --git a/contributes/meta3d-action-add-cube/tsconfig.json b/contributes/meta3d-action-add-cube/tsconfig.json new file mode 100755 index 000000000..a8418c65b --- /dev/null +++ b/contributes/meta3d-action-add-cube/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + // "noUnusedLocals": true, + // "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/contributes/meta3d-action-add-cube/webpack.config.js b/contributes/meta3d-action-add-cube/webpack.config.js new file mode 100755 index 000000000..1de4da2d5 --- /dev/null +++ b/contributes/meta3d-action-add-cube/webpack.config.js @@ -0,0 +1,64 @@ +const path = require('path'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); + +module.exports = { + entry: "./src/Main.ts", + mode: process.env.NODE_ENV.trim() == 'production' ? 'production' : 'development', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'static/js/[name].js', + library: { + name: 'Contribute', + type: 'window', + }, + }, + + // Enable sourcemaps for debugging webpack's output. + // devtool: "source-map", + + resolve: { + extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss'], + modules: ['node_modules'] + }, + + module: { + rules: [ + // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'. + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: "ts-loader" + }, + // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. + { + enforce: 'pre', + test: /\.js$/, + loader: "source-map-loader" + }, + ] + }, + plugins: [ + /** + * All files inside webpack's output.path directory will be removed once, but the + * directory itself will not be. If using webpack 4+'s default configuration, + * everything under /dist/ will be removed. + * Use cleanOnceBeforeBuildPatterns to override this behavior. + * + * During rebuilds, all webpack assets that are not used anymore + * will be removed automatically. + * + * See `Options and Defaults` for information + */ + new CleanWebpackPlugin(), + // new HtmlWebpackPlugin({ + // template: './user.html', + // filename: 'user.html', + // }), + ], + // When importing a module whose path matches one of the following, just + // assume a corresponding global variable exists and use that instead. + // This is important because it allows us to avoid bundling all of our + // dependencies, which allows browsers to cache those libraries between builds. + externals: { + } +}; \ No newline at end of file diff --git a/contributes/meta3d-action-clone-gameobject/.gitignore b/contributes/meta3d-action-clone-gameobject/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/contributes/meta3d-action-clone-gameobject/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/contributes/meta3d-action-clone-gameobject/gulpfile.js b/contributes/meta3d-action-clone-gameobject/gulpfile.js new file mode 100755 index 000000000..a4c8812fc --- /dev/null +++ b/contributes/meta3d-action-clone-gameobject/gulpfile.js @@ -0,0 +1,25 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish") + +gulp.task("publish_local_env", function (done) { + publish.publishContribute( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContribute( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + + diff --git a/contributes/meta3d-action-clone-gameobject/package.json b/contributes/meta3d-action-clone-gameobject/package.json new file mode 100755 index 000000000..c8b788f19 --- /dev/null +++ b/contributes/meta3d-action-clone-gameobject/package.json @@ -0,0 +1,36 @@ +{ + "name": "meta3d-action-clone-gameobject", + "version": "0.20.1", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "repoLink": "", + "protocol": { + "name": "meta3d-action-clone-gameobject-protocol" + }, + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "webpack": "webpack --config webpack.config.js", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publish_local_env", + "meta3d:publish_pro": "cross-env NODE_ENV=production npm run webpack && gulp publish_production_env" + }, + "keywords": [], + "dependencies": { + "meta3d-action-clone-gameobject-protocol": "^0.20.0", + "meta3d-action-select-scenetree-node-protocol": "^0.20.0", + "meta3d-editor-whole-protocol": "^0.20.0", + "meta3d-type": "^0.20.0" + }, + "devDependencies": { + "clean-webpack-plugin": "^4.0.0", + "cross-env": "^7.0.3", + "cz-customizable": "^6.3.0", + "gulp": "^4.0.2", + "meta3d-tool-publish": "^0.20.0", + "source-map-loader": "^3.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.2.3", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + } +} diff --git a/contributes/meta3d-action-clone-gameobject/src/Main.ts b/contributes/meta3d-action-clone-gameobject/src/Main.ts new file mode 100755 index 000000000..303179b26 --- /dev/null +++ b/contributes/meta3d-action-clone-gameobject/src/Main.ts @@ -0,0 +1,106 @@ +import { state as meta3dState, getContribute as getContributeMeta3D, api } from "meta3d-type" +import { actionContribute, service as editorWholeService } from "meta3d-editor-whole-protocol/src/service/ServiceType" +import { actionName, state, uiData } from "meta3d-action-clone-gameobject-protocol" +import { eventName, inputData } from "meta3d-action-clone-gameobject-protocol/src/EventType" +import { actionName as selectSceneTreeNodeActionName, state as selectSceneTreeNodeState } from "meta3d-action-select-scenetree-node-protocol" +import { service as gameViewRenderService } from "meta3d-editor-gameview-render-protocol/src/service/ServiceType" +import { gameObject } from "meta3d-gameobject-protocol" +import { flatten } from "meta3d-structure-utils/src/ArrayUtils" + +let _clone = (meta3dState: meta3dState, api: api, selectedGameObject: gameObject) => { + let engineSceneService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).scene(meta3dState) + + let data = engineSceneService.gameObject.cloneGameObject(meta3dState, 1, { isShareMaterial: true, }, selectedGameObject) + meta3dState = data[0] + let clonedGameObjects = flatten(data[1]) + + + return [meta3dState, clonedGameObjects] +} + +export let getContribute: getContributeMeta3D> = (api) => { + return { + actionName: actionName, + init: (meta3dState) => { + let eventSourcingService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState) + + return new Promise((resolve, reject) => { + resolve(eventSourcingService.on(meta3dState, eventName, 0, (meta3dState, selectedGameObject) => { + let data = _clone(meta3dState, api, selectedGameObject) + meta3dState = data[0] as meta3dState + let clonedGameObjects = data[1] as any as Array + + let state = api.nullable.getExn( + api.action.getActionState(meta3dState, actionName) + ) + + meta3dState = api.action.setActionState(meta3dState, actionName, { + ...state, + allClonedGameObjects: state.allClonedGameObjects.push(api.immutable.createListOfData(meta3dState, clonedGameObjects)), + }) + + let editorWholeService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")) + return Promise.resolve(api.nullable.getWithDefault( + api.nullable.map( + ({ runOnlyOnce }) => { + return runOnlyOnce(meta3dState) + }, + editorWholeService.getPluggablePackageService(meta3dState, "meta3d-editor-gameview-render-protocol") + ), + meta3dState + )) + }, (meta3dState) => { + let { + allClonedGameObjects, + } = api.nullable.getExn(api.action.getActionState(meta3dState, actionName)) + + if (api.nullable.isNullable(allClonedGameObjects.last())) { + return Promise.resolve(meta3dState) + } + + let clonedGameObjects = api.nullable.getExn(allClonedGameObjects.last()).toArray() + + let engineSceneService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).scene(meta3dState) + + meta3dState = engineSceneService.gameObject.disposeGameObjects(meta3dState, clonedGameObjects) + + let state = api.nullable.getExn(api.action.getActionState(meta3dState, actionName)) + + meta3dState = api.action.setActionState(meta3dState, actionName, { + ...state, + allClonedGameObjects: state.allClonedGameObjects.pop(), + }) + + return Promise.resolve(meta3dState) + })) + }) + }, + handler: (meta3dState, uiData) => { + return new Promise((resolve, reject) => { + let { + selectedGameObject, + } = api.nullable.getExn(api.action.getActionState(meta3dState, selectSceneTreeNodeActionName)) + + if (api.nullable.isNullable(selectedGameObject)) { + resolve(meta3dState) + + return + } + + let eventSourcingService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState) + + resolve(eventSourcingService.addEvent(meta3dState, { + name: eventName, + inputData: [ + api.nullable.getExn(selectedGameObject), + ] + })) + }) + }, + createState: (meta3dState) => { + return { + allClonedGameObjects: api.immutable.createList(meta3dState), + } + } + } +} diff --git a/contributes/meta3d-action-clone-gameobject/tsconfig.json b/contributes/meta3d-action-clone-gameobject/tsconfig.json new file mode 100755 index 000000000..a8418c65b --- /dev/null +++ b/contributes/meta3d-action-clone-gameobject/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + // "noUnusedLocals": true, + // "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/contributes/meta3d-action-clone-gameobject/webpack.config.js b/contributes/meta3d-action-clone-gameobject/webpack.config.js new file mode 100755 index 000000000..1de4da2d5 --- /dev/null +++ b/contributes/meta3d-action-clone-gameobject/webpack.config.js @@ -0,0 +1,64 @@ +const path = require('path'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); + +module.exports = { + entry: "./src/Main.ts", + mode: process.env.NODE_ENV.trim() == 'production' ? 'production' : 'development', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'static/js/[name].js', + library: { + name: 'Contribute', + type: 'window', + }, + }, + + // Enable sourcemaps for debugging webpack's output. + // devtool: "source-map", + + resolve: { + extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss'], + modules: ['node_modules'] + }, + + module: { + rules: [ + // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'. + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: "ts-loader" + }, + // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. + { + enforce: 'pre', + test: /\.js$/, + loader: "source-map-loader" + }, + ] + }, + plugins: [ + /** + * All files inside webpack's output.path directory will be removed once, but the + * directory itself will not be. If using webpack 4+'s default configuration, + * everything under /dist/ will be removed. + * Use cleanOnceBeforeBuildPatterns to override this behavior. + * + * During rebuilds, all webpack assets that are not used anymore + * will be removed automatically. + * + * See `Options and Defaults` for information + */ + new CleanWebpackPlugin(), + // new HtmlWebpackPlugin({ + // template: './user.html', + // filename: 'user.html', + // }), + ], + // When importing a module whose path matches one of the following, just + // assume a corresponding global variable exists and use that instead. + // This is important because it allows us to avoid bundling all of our + // dependencies, which allows browsers to cache those libraries between builds. + externals: { + } +}; \ No newline at end of file diff --git a/contributes/meta3d-action-dispose-gameobject/.gitignore b/contributes/meta3d-action-dispose-gameobject/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/contributes/meta3d-action-dispose-gameobject/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/contributes/meta3d-action-dispose-gameobject/gulpfile.js b/contributes/meta3d-action-dispose-gameobject/gulpfile.js new file mode 100755 index 000000000..a4c8812fc --- /dev/null +++ b/contributes/meta3d-action-dispose-gameobject/gulpfile.js @@ -0,0 +1,25 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish") + +gulp.task("publish_local_env", function (done) { + publish.publishContribute( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContribute( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + + diff --git a/contributes/meta3d-action-dispose-gameobject/package.json b/contributes/meta3d-action-dispose-gameobject/package.json new file mode 100755 index 000000000..7a557cf43 --- /dev/null +++ b/contributes/meta3d-action-dispose-gameobject/package.json @@ -0,0 +1,36 @@ +{ + "name": "meta3d-action-dispose-gameobject", + "version": "0.20.2", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "repoLink": "", + "protocol": { + "name": "meta3d-action-dispose-gameobject-protocol" + }, + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "webpack": "webpack --config webpack.config.js", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publish_local_env", + "meta3d:publish_pro": "cross-env NODE_ENV=production npm run webpack && gulp publish_production_env" + }, + "keywords": [], + "dependencies": { + "meta3d-action-dispose-gameobject-protocol": "^0.20.0", + "meta3d-action-select-scenetree-node-protocol": "^0.20.0", + "meta3d-editor-whole-protocol": "^0.20.0", + "meta3d-type": "^0.20.0" + }, + "devDependencies": { + "clean-webpack-plugin": "^4.0.0", + "cross-env": "^7.0.3", + "cz-customizable": "^6.3.0", + "gulp": "^4.0.2", + "meta3d-tool-publish": "^0.20.0", + "source-map-loader": "^3.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.2.3", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + } +} diff --git a/contributes/meta3d-action-dispose-gameobject/src/Main.ts b/contributes/meta3d-action-dispose-gameobject/src/Main.ts new file mode 100755 index 000000000..25fe185ac --- /dev/null +++ b/contributes/meta3d-action-dispose-gameobject/src/Main.ts @@ -0,0 +1,194 @@ +import { state as meta3dState, getContribute as getContributeMeta3D, api } from "meta3d-type" +import { actionContribute, service as editorWholeService } from "meta3d-editor-whole-protocol/src/service/ServiceType" +import { actionName, state, uiData } from "meta3d-action-dispose-gameobject-protocol" +import { eventName, inputData } from "meta3d-action-dispose-gameobject-protocol/src/EventType" +import { actionName as selectSceneTreeNodeActionName, state as selectSceneTreeNodeState } from "meta3d-action-select-scenetree-node-protocol" +import { state as treeState } from "meta3d-ui-control-tree-protocol" +import { gameObject } from "meta3d-gameobject-protocol" +import { removeGameObjectData } from "meta3d-engine-scene-protocol/src/service/ecs/GameObject" +import { service as gameViewRenderService } from "meta3d-editor-gameview-render-protocol/src/service/ServiceType" +import { nullable } from "meta3d-commonlib-ts/src/nullable" +import { treeIndexData } from "meta3d-imgui-renderer-protocol/src/service/ServiceType" +import { assertNullableExist, ensureCheck, test } from "meta3d-ts-contract-utils" + +let _dispose = (meta3dState: meta3dState, api: api, selectedGameObject: gameObject) => { + let engineSceneService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).scene(meta3dState) + + let removedGameObjects = engineSceneService.gameObject.getGameObjectAndAllChildren(meta3dState, selectedGameObject) + + let disposedGameObjectData = removedGameObjects.map(gameObject => { + let transform = engineSceneService.gameObject.getTransform(meta3dState, gameObject) + + return { + gameObject, + name: engineSceneService.gameObject.getGameObjectName(meta3dState, gameObject), + localScale: engineSceneService.transform.getLocalScale(meta3dState, transform), + localPosition: engineSceneService.transform.getLocalPosition(meta3dState, transform), + } + }) + + meta3dState = engineSceneService.gameObject.removeGameObjects(meta3dState, removedGameObjects) + + return [meta3dState, disposedGameObjectData] +} + +let _getLastTreeSelectedData = (sceneTreeState: treeState) => { + return ensureCheck( + sceneTreeState.lastTreeSelectedData + , ( + lastTreeSelectedData + : nullable) => { + test("lastTreeSelectedData should exist", () => { + return assertNullableExist(lastTreeSelectedData) + }) + }, true) +} + +let _buildSceneTreeLabel = () => "Scene Tree" + +let _getSceneTreeUIControlState = (meta3dState: meta3dState, api: api, sceneTreeLabel: string) => { + let state = api.uiControl.getUIControlState(meta3dState, sceneTreeLabel) + + if (api.nullable.isNullable(state)) { + throw new Error("should exist UI Control whose label is Scene Tree"); + } + + return api.nullable.getExn(state) +} + +export let getContribute: getContributeMeta3D> = (api) => { + return { + actionName: actionName, + init: (meta3dState) => { + let eventSourcingService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState) + + return new Promise((resolve, reject) => { + resolve(eventSourcingService.on(meta3dState, eventName, 0, (meta3dState, selectedGameObject) => { + let data = _dispose(meta3dState, api, selectedGameObject) + meta3dState = data[0] as meta3dState + let disposedGameObjectData = data[1] as any as Array + + let state = api.nullable.getExn( + api.action.getActionState(meta3dState, actionName) + ) + + meta3dState = api.action.setActionState(meta3dState, actionName, { + ...state, + allSelectedGameObjects: state.allSelectedGameObjects.push(selectedGameObject), + allDisposedGameObjectData: state.allDisposedGameObjectData.push(api.immutable.createListOfData(meta3dState, disposedGameObjectData)), + }) + + meta3dState = api.action.setActionState(meta3dState, selectSceneTreeNodeActionName, { + ...api.action.getActionState(meta3dState, selectSceneTreeNodeActionName), + selectedGameObject: null + }) + + + let sceneTreeLabel = _buildSceneTreeLabel() + + let sceneTreeState = _getSceneTreeUIControlState(meta3dState, api, sceneTreeLabel) + + let lastTreeSelectedData = _getLastTreeSelectedData(sceneTreeState) + + + meta3dState = api.uiControl.setUIControlState(meta3dState, sceneTreeLabel, { + ...sceneTreeState, + lastTreeSelectedData: null + }) + + meta3dState = api.action.setActionState(meta3dState, actionName, { + ...api.action.getActionState(meta3dState, actionName), + allLastSceneTreeSelectedData: state.allLastSceneTreeSelectedData.push(lastTreeSelectedData), + }) + + + + let editorWholeService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")) + return Promise.resolve(api.nullable.getWithDefault( + api.nullable.map( + ({ runOnlyOnce }) => { + return runOnlyOnce(meta3dState) + }, + editorWholeService.getPluggablePackageService(meta3dState, "meta3d-editor-gameview-render-protocol") + ), + meta3dState + )) + }, (meta3dState) => { + let { + allSelectedGameObjects, + allLastSceneTreeSelectedData, + allDisposedGameObjectData, + } = api.nullable.getExn(api.action.getActionState(meta3dState, actionName)) + + if (api.nullable.isNullable(allDisposedGameObjectData.last())) { + return Promise.resolve(meta3dState) + } + + let disposedGameObjectData = api.nullable.getExn(allDisposedGameObjectData.last()).toArray() + + let engineSceneService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).scene(meta3dState) + + meta3dState = engineSceneService.gameObject.restoreRemovedGameObjects(meta3dState, disposedGameObjectData) + + let selectedGameObject = api.nullable.getExn(allSelectedGameObjects.last()) + + meta3dState = api.action.setActionState(meta3dState, selectSceneTreeNodeActionName, { + ...api.action.getActionState(meta3dState, selectSceneTreeNodeActionName), + selectedGameObject + }) + + + let sceneTreeLabel = _buildSceneTreeLabel() + + let sceneTreeState = _getSceneTreeUIControlState(meta3dState, api, sceneTreeLabel) + + meta3dState = api.uiControl.setUIControlState(meta3dState, sceneTreeLabel, { + ...sceneTreeState, + lastTreeSelectedData: api.nullable.getExn(allLastSceneTreeSelectedData.last()) + }) + + + let state = api.nullable.getExn(api.action.getActionState(meta3dState, actionName)) + + meta3dState = api.action.setActionState(meta3dState, actionName, { + ...state, + allSelectedGameObjects: state.allSelectedGameObjects.pop(), + allLastSceneTreeSelectedData: state.allLastSceneTreeSelectedData.pop(), + allDisposedGameObjectData: state.allDisposedGameObjectData.pop(), + }) + + return Promise.resolve(meta3dState) + })) + }) + }, + handler: (meta3dState, uiData) => { + return new Promise((resolve, reject) => { + let { + selectedGameObject, + } = api.nullable.getExn(api.action.getActionState(meta3dState, selectSceneTreeNodeActionName)) + + if (api.nullable.isNullable(selectedGameObject)) { + resolve(meta3dState) + + return + } + + let eventSourcingService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState) + + resolve(eventSourcingService.addEvent(meta3dState, { + name: eventName, + inputData: [ + api.nullable.getExn(selectedGameObject), + ] + })) + }) + }, + createState: (meta3dState) => { + return { + allSelectedGameObjects: api.immutable.createList(meta3dState), + allLastSceneTreeSelectedData: api.immutable.createList(meta3dState), + allDisposedGameObjectData: api.immutable.createList(meta3dState), + } + } + } +} diff --git a/contributes/meta3d-action-dispose-gameobject/tsconfig.json b/contributes/meta3d-action-dispose-gameobject/tsconfig.json new file mode 100755 index 000000000..a8418c65b --- /dev/null +++ b/contributes/meta3d-action-dispose-gameobject/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + // "noUnusedLocals": true, + // "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/contributes/meta3d-action-dispose-gameobject/webpack.config.js b/contributes/meta3d-action-dispose-gameobject/webpack.config.js new file mode 100755 index 000000000..1de4da2d5 --- /dev/null +++ b/contributes/meta3d-action-dispose-gameobject/webpack.config.js @@ -0,0 +1,64 @@ +const path = require('path'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); + +module.exports = { + entry: "./src/Main.ts", + mode: process.env.NODE_ENV.trim() == 'production' ? 'production' : 'development', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'static/js/[name].js', + library: { + name: 'Contribute', + type: 'window', + }, + }, + + // Enable sourcemaps for debugging webpack's output. + // devtool: "source-map", + + resolve: { + extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss'], + modules: ['node_modules'] + }, + + module: { + rules: [ + // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'. + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: "ts-loader" + }, + // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. + { + enforce: 'pre', + test: /\.js$/, + loader: "source-map-loader" + }, + ] + }, + plugins: [ + /** + * All files inside webpack's output.path directory will be removed once, but the + * directory itself will not be. If using webpack 4+'s default configuration, + * everything under /dist/ will be removed. + * Use cleanOnceBeforeBuildPatterns to override this behavior. + * + * During rebuilds, all webpack assets that are not used anymore + * will be removed automatically. + * + * See `Options and Defaults` for information + */ + new CleanWebpackPlugin(), + // new HtmlWebpackPlugin({ + // template: './user.html', + // filename: 'user.html', + // }), + ], + // When importing a module whose path matches one of the following, just + // assume a corresponding global variable exists and use that instead. + // This is important because it allows us to avoid bundling all of our + // dependencies, which allows browsers to cache those libraries between builds. + externals: { + } +}; \ No newline at end of file diff --git a/contributes/meta3d-action-select-scenetree-node/.gitignore b/contributes/meta3d-action-select-scenetree-node/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/contributes/meta3d-action-select-scenetree-node/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/contributes/meta3d-action-select-scenetree-node/gulpfile.js b/contributes/meta3d-action-select-scenetree-node/gulpfile.js new file mode 100755 index 000000000..a4c8812fc --- /dev/null +++ b/contributes/meta3d-action-select-scenetree-node/gulpfile.js @@ -0,0 +1,25 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish") + +gulp.task("publish_local_env", function (done) { + publish.publishContribute( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContribute( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + + diff --git a/contributes/meta3d-action-select-scenetree-node/package.json b/contributes/meta3d-action-select-scenetree-node/package.json new file mode 100755 index 000000000..cf4449ed8 --- /dev/null +++ b/contributes/meta3d-action-select-scenetree-node/package.json @@ -0,0 +1,35 @@ +{ + "name": "meta3d-action-select-scenetree-node", + "version": "0.20.1", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "repoLink": "", + "protocol": { + "name": "meta3d-action-select-scenetree-node-protocol" + }, + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "webpack": "webpack --config webpack.config.js", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publish_local_env", + "meta3d:publish_pro": "cross-env NODE_ENV=production npm run webpack && gulp publish_production_env" + }, + "keywords": [], + "dependencies": { + "meta3d-action-select-scenetree-node-protocol": "^0.20.0", + "meta3d-editor-whole-protocol": "^0.20.0", + "meta3d-type": "^0.20.0" + }, + "devDependencies": { + "clean-webpack-plugin": "^4.0.0", + "cross-env": "^7.0.3", + "cz-customizable": "^6.3.0", + "gulp": "^4.0.2", + "meta3d-tool-publish": "^0.20.0", + "source-map-loader": "^3.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.2.3", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + } +} diff --git a/contributes/meta3d-action-select-scenetree-node/src/Main.ts b/contributes/meta3d-action-select-scenetree-node/src/Main.ts new file mode 100755 index 000000000..e6603178d --- /dev/null +++ b/contributes/meta3d-action-select-scenetree-node/src/Main.ts @@ -0,0 +1,66 @@ +import { state as meta3dState, api, getContribute as getContributeMeta3D } from "meta3d-type" +import { actionContribute, service as editorWholeService } from "meta3d-editor-whole-protocol/src/service/ServiceType" +import { actionName, state, uiData } from "meta3d-action-select-scenetree-node-protocol" +import { eventName, inputData } from "meta3d-action-select-scenetree-node-protocol/src/EventType" +import { findSelectedGameObject, getAllTopGameObjects, buildHierachyGameObjects } from "meta3d-scenetree-utils/src/SceneTreeUtils" + +export let getContribute: getContributeMeta3D> = (api) => { + return { + actionName: actionName, + init: (meta3dState) => { + let eventSourcingService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState) + + return new Promise((resolve, reject) => { + resolve(eventSourcingService.on(meta3dState, eventName, 0, (meta3dState, selectedGameObject) => { + let state = api.nullable.getExn(api.action.getActionState(meta3dState, actionName)) + + meta3dState = api.action.setActionState(meta3dState, actionName, { + ...state, + allSelectedGameObjects: state.allSelectedGameObjects.push(selectedGameObject), + selectedGameObject: selectedGameObject, + }) + + return Promise.resolve(meta3dState) + }, (meta3dState) => { + let state = api.nullable.getExn(api.action.getActionState(meta3dState, actionName)) + let { + allSelectedGameObjects + } = state + + if (api.nullable.isNullable(allSelectedGameObjects.last())) { + return Promise.resolve(meta3dState) + } + + meta3dState = api.action.setActionState(meta3dState, actionName, { + ...state, + allSelectedGameObjects: state.allSelectedGameObjects.pop(), + selectedGameObject: api.nullable.getExn(state.allSelectedGameObjects.last()) + }) + + return Promise.resolve(meta3dState) + })) + }) + }, + handler: (meta3dState, uiData) => { + return new Promise((resolve, reject) => { + let editorWholeService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")) + let eventSourcingService = editorWholeService.event(meta3dState).eventSourcing(meta3dState) + + resolve(eventSourcingService.addEvent(meta3dState, { + name: eventName, + inputData: [ + findSelectedGameObject(buildHierachyGameObjects([], + editorWholeService, + meta3dState, getAllTopGameObjects(meta3dState, editorWholeService)), api.nullable.getExn(uiData)) + ] + })) + }) + }, + createState: (meta3dState) => { + return { + selectedGameObject: null, + allSelectedGameObjects: api.immutable.createList(meta3dState), + } + } + } +} diff --git a/contributes/meta3d-action-select-scenetree-node/tsconfig.json b/contributes/meta3d-action-select-scenetree-node/tsconfig.json new file mode 100755 index 000000000..a8418c65b --- /dev/null +++ b/contributes/meta3d-action-select-scenetree-node/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + // "noUnusedLocals": true, + // "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/contributes/meta3d-action-select-scenetree-node/webpack.config.js b/contributes/meta3d-action-select-scenetree-node/webpack.config.js new file mode 100755 index 000000000..1de4da2d5 --- /dev/null +++ b/contributes/meta3d-action-select-scenetree-node/webpack.config.js @@ -0,0 +1,64 @@ +const path = require('path'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); + +module.exports = { + entry: "./src/Main.ts", + mode: process.env.NODE_ENV.trim() == 'production' ? 'production' : 'development', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'static/js/[name].js', + library: { + name: 'Contribute', + type: 'window', + }, + }, + + // Enable sourcemaps for debugging webpack's output. + // devtool: "source-map", + + resolve: { + extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss'], + modules: ['node_modules'] + }, + + module: { + rules: [ + // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'. + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: "ts-loader" + }, + // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. + { + enforce: 'pre', + test: /\.js$/, + loader: "source-map-loader" + }, + ] + }, + plugins: [ + /** + * All files inside webpack's output.path directory will be removed once, but the + * directory itself will not be. If using webpack 4+'s default configuration, + * everything under /dist/ will be removed. + * Use cleanOnceBeforeBuildPatterns to override this behavior. + * + * During rebuilds, all webpack assets that are not used anymore + * will be removed automatically. + * + * See `Options and Defaults` for information + */ + new CleanWebpackPlugin(), + // new HtmlWebpackPlugin({ + // template: './user.html', + // filename: 'user.html', + // }), + ], + // When importing a module whose path matches one of the following, just + // assume a corresponding global variable exists and use that instead. + // This is important because it allows us to avoid bundling all of our + // dependencies, which allows browsers to cache those libraries between builds. + externals: { + } +}; \ No newline at end of file diff --git a/contributes/meta3d-action-set-parent/.gitignore b/contributes/meta3d-action-set-parent/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/contributes/meta3d-action-set-parent/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/contributes/meta3d-action-set-parent/gulpfile.js b/contributes/meta3d-action-set-parent/gulpfile.js new file mode 100755 index 000000000..a4c8812fc --- /dev/null +++ b/contributes/meta3d-action-set-parent/gulpfile.js @@ -0,0 +1,25 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish") + +gulp.task("publish_local_env", function (done) { + publish.publishContribute( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContribute( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + + diff --git a/contributes/meta3d-action-set-parent/package.json b/contributes/meta3d-action-set-parent/package.json new file mode 100755 index 000000000..058f232ad --- /dev/null +++ b/contributes/meta3d-action-set-parent/package.json @@ -0,0 +1,35 @@ +{ + "name": "meta3d-action-set-parent", + "version": "0.20.2", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "repoLink": "", + "protocol": { + "name": "meta3d-action-set-parent-protocol" + }, + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "webpack": "webpack --config webpack.config.js", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publish_local_env", + "meta3d:publish_pro": "cross-env NODE_ENV=production npm run webpack && gulp publish_production_env" + }, + "keywords": [], + "dependencies": { + "meta3d-action-set-parent-protocol": "^0.20.0", + "meta3d-editor-whole-protocol": "^0.20.0", + "meta3d-type": "^0.20.0" + }, + "devDependencies": { + "clean-webpack-plugin": "^4.0.0", + "cross-env": "^7.0.3", + "cz-customizable": "^6.3.0", + "gulp": "^4.0.2", + "meta3d-tool-publish": "^0.20.0", + "source-map-loader": "^3.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.2.3", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + } +} diff --git a/contributes/meta3d-action-set-parent/src/Main.ts b/contributes/meta3d-action-set-parent/src/Main.ts new file mode 100755 index 000000000..6f94f1d22 --- /dev/null +++ b/contributes/meta3d-action-set-parent/src/Main.ts @@ -0,0 +1,107 @@ +import { state as meta3dState, api, getContribute as getContributeMeta3D } from "meta3d-type" +import { actionContribute, service as editorWholeService } from "meta3d-editor-whole-protocol/src/service/ServiceType" +import { actionName, state, uiData } from "meta3d-action-set-parent-protocol" +import { eventName, inputData } from "meta3d-action-set-parent-protocol/src/EventType" +import { findSelectedGameObject, getAllTopGameObjects, buildHierachyGameObjects } from "meta3d-scenetree-utils/src/SceneTreeUtils" +import { service as gameViewRenderService } from "meta3d-editor-gameview-render-protocol/src/service/ServiceType" + +export let getContribute: getContributeMeta3D> = (api) => { + return { + actionName: actionName, + init: (meta3dState) => { + let eventSourcingService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState) + + return new Promise((resolve, reject) => { + resolve(eventSourcingService.on(meta3dState, eventName, 0, (meta3dState, { source, target }) => { + let editorWholeService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")) + let engineSceneService = editorWholeService.scene(meta3dState) + + let sourceTranform = engineSceneService.gameObject.getTransform(meta3dState, source) + let targetTranform = api.nullable.map(target => { + return engineSceneService.gameObject.getTransform(meta3dState, target) + }, target) + + let oldParent = api.nullable.bind((parent) => { + return engineSceneService.transform.getGameObjects(meta3dState, parent)[0] + }, engineSceneService.transform.getParent(meta3dState, sourceTranform)) + + meta3dState = engineSceneService.transform.setParent(meta3dState, sourceTranform, targetTranform) + + + let state = api.nullable.getExn(api.action.getActionState(meta3dState, actionName)) + + meta3dState = api.action.setActionState(meta3dState, actionName, { + ...state, + allHierachyData: state.allHierachyData.push({ + source, + oldParent + }), + }) + + return Promise.resolve(api.nullable.getWithDefault( + api.nullable.map( + ({ runOnlyOnce }) => { + return runOnlyOnce(meta3dState) + }, + editorWholeService.getPluggablePackageService(meta3dState, "meta3d-editor-gameview-render-protocol") + ), + meta3dState + )) + }, (meta3dState) => { + let state = api.nullable.getExn(api.action.getActionState(meta3dState, actionName)) + let { + allHierachyData + } = state + + if (api.nullable.isNullable(allHierachyData.last())) { + return Promise.resolve(meta3dState) + } + + let { source, oldParent } = api.nullable.getExn(allHierachyData.last()) + + let editorWholeService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")) + let engineSceneService = editorWholeService.scene(meta3dState) + + meta3dState = engineSceneService.transform.setParent(meta3dState, + engineSceneService.gameObject.getTransform(meta3dState, source), + api.nullable.bind((oldParent) => { + return engineSceneService.gameObject.getTransform(meta3dState, oldParent) + }, oldParent) + ) + + meta3dState = api.action.setActionState(meta3dState, actionName, { + ...api.action.getActionState(meta3dState, actionName), + allHierachyData: state.allHierachyData.pop(), + }) + + return Promise.resolve(meta3dState) + })) + }) + }, + handler: (meta3dState, uiData) => { + return new Promise((resolve, reject) => { + let editorWholeService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")) + let eventSourcingService = editorWholeService.event(meta3dState).eventSourcing(meta3dState) + + let { source, target } = uiData + + let hierachyGameObjects = buildHierachyGameObjects([], + editorWholeService, + meta3dState, getAllTopGameObjects(meta3dState, editorWholeService)) + + resolve(eventSourcingService.addEvent(meta3dState, { + name: eventName, + inputData: [{ + source: findSelectedGameObject(hierachyGameObjects, source), + target: target.length == 0 ? null : findSelectedGameObject(hierachyGameObjects, target) + }] + })) + }) + }, + createState: (meta3dState) => { + return { + allHierachyData: api.immutable.createList(meta3dState) + } + } + } +} diff --git a/contributes/meta3d-action-set-parent/tsconfig.json b/contributes/meta3d-action-set-parent/tsconfig.json new file mode 100755 index 000000000..a8418c65b --- /dev/null +++ b/contributes/meta3d-action-set-parent/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + // "noUnusedLocals": true, + // "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/contributes/meta3d-action-set-parent/webpack.config.js b/contributes/meta3d-action-set-parent/webpack.config.js new file mode 100755 index 000000000..1de4da2d5 --- /dev/null +++ b/contributes/meta3d-action-set-parent/webpack.config.js @@ -0,0 +1,64 @@ +const path = require('path'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); + +module.exports = { + entry: "./src/Main.ts", + mode: process.env.NODE_ENV.trim() == 'production' ? 'production' : 'development', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'static/js/[name].js', + library: { + name: 'Contribute', + type: 'window', + }, + }, + + // Enable sourcemaps for debugging webpack's output. + // devtool: "source-map", + + resolve: { + extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss'], + modules: ['node_modules'] + }, + + module: { + rules: [ + // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'. + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: "ts-loader" + }, + // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. + { + enforce: 'pre', + test: /\.js$/, + loader: "source-map-loader" + }, + ] + }, + plugins: [ + /** + * All files inside webpack's output.path directory will be removed once, but the + * directory itself will not be. If using webpack 4+'s default configuration, + * everything under /dist/ will be removed. + * Use cleanOnceBeforeBuildPatterns to override this behavior. + * + * During rebuilds, all webpack assets that are not used anymore + * will be removed automatically. + * + * See `Options and Defaults` for information + */ + new CleanWebpackPlugin(), + // new HtmlWebpackPlugin({ + // template: './user.html', + // filename: 'user.html', + // }), + ], + // When importing a module whose path matches one of the following, just + // assume a corresponding global variable exists and use that instead. + // This is important because it allows us to avoid bundling all of our + // dependencies, which allows browsers to cache those libraries between builds. + externals: { + } +}; \ No newline at end of file diff --git a/contributes/meta3d-input-runstopbutton/package.json b/contributes/meta3d-input-runstopbutton/package.json index d34521428..9fef68e5f 100755 --- a/contributes/meta3d-input-runstopbutton/package.json +++ b/contributes/meta3d-input-runstopbutton/package.json @@ -11,12 +11,13 @@ "watch": "tsc -w -noEmit", "webpack": "webpack --config webpack.config.js", "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", -"meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publish_local_env", + "meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publish_local_env", "meta3d:publish_pro": "cross-env NODE_ENV=production npm run webpack && gulp publish_production_env" }, "keywords": [], "dependencies": { "meta3d-type": "^0.20.0", + "meta3d-editor-whole-protocol": "^0.20.0", "meta3d-input-switch-button-protocol": "^0.20.0" }, "devDependencies": { @@ -31,4 +32,4 @@ "webpack": "^5.62.1", "webpack-cli": "^4.9.1" } -} +} \ No newline at end of file diff --git a/contributes/meta3d-input-scenetree/.gitignore b/contributes/meta3d-input-scenetree/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/contributes/meta3d-input-scenetree/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/contributes/meta3d-input-scenetree/gulpfile.js b/contributes/meta3d-input-scenetree/gulpfile.js new file mode 100755 index 000000000..a4c8812fc --- /dev/null +++ b/contributes/meta3d-input-scenetree/gulpfile.js @@ -0,0 +1,25 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish") + +gulp.task("publish_local_env", function (done) { + publish.publishContribute( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContribute( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + + diff --git a/contributes/meta3d-input-scenetree/package.json b/contributes/meta3d-input-scenetree/package.json new file mode 100755 index 000000000..49ab9aad6 --- /dev/null +++ b/contributes/meta3d-input-scenetree/package.json @@ -0,0 +1,35 @@ +{ + "name": "meta3d-input-scenetree", + "version": "0.20.2", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "description": "", + "protocol": { + "name": "meta3d-input-tree-protocol" + }, + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "webpack": "webpack --config webpack.config.js", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publish_local_env", + "meta3d:publish_pro": "cross-env NODE_ENV=production npm run webpack && gulp publish_production_env" + }, + "keywords": [], + "dependencies": { + "meta3d-editor-whole-protocol": "^0.20.0", + "meta3d-input-tree-protocol": "^0.20.0", + "meta3d-type": "^0.20.0" + }, + "devDependencies": { + "clean-webpack-plugin": "^4.0.0", + "cross-env": "^7.0.3", + "cz-customizable": "^6.3.0", + "gulp": "^4.0.2", + "meta3d-tool-publish": "^0.20.0", + "source-map-loader": "^3.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.2.3", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + } +} diff --git a/contributes/meta3d-input-scenetree/src/Main.ts b/contributes/meta3d-input-scenetree/src/Main.ts new file mode 100755 index 000000000..ab1620d7d --- /dev/null +++ b/contributes/meta3d-input-scenetree/src/Main.ts @@ -0,0 +1,41 @@ +import { state as meta3dState, getContribute as getContributeMeta3D } from "meta3d-type" +import { data, nodeType } from "meta3d-input-tree-protocol" +import { inputContribute } from "meta3d-editor-whole-protocol/src/service/ServiceType" +import { hierachyGameObjects, getAllTopGameObjects, buildHierachyGameObjects } from "meta3d-scenetree-utils/src/SceneTreeUtils" +import { service } from "meta3d-editor-whole-protocol/src/service/ServiceType" +import { getWithDefault } from "meta3d-commonlib-ts/src/NullableUtils" + +let _convertToTreeData = ( + editorWholeService: service, + meta3dState: meta3dState, hierachyGameObjects: hierachyGameObjects, +): data => { + let { gameObject } = editorWholeService.scene(meta3dState) + + return hierachyGameObjects.map(([gameObject_, children]) => { + return [ + getWithDefault(gameObject.getGameObjectName(meta3dState, gameObject_), ""), + gameObject.hasBasicCameraView(meta3dState, gameObject_) && gameObject.hasPerspectiveCameraProjection(meta3dState, gameObject_) ? nodeType.Type1 : + gameObject.hasDirectionLight(meta3dState, gameObject_) ? nodeType.Type2 : + nodeType.Type3, + _convertToTreeData(editorWholeService, meta3dState, children) + ] + }) +} + +export let getContribute: getContributeMeta3D> = (api) => { + return { + inputName: "SceneTreeInput", + func: (meta3dState) => { + let editorWholeService = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")) + + let hierachyGameObjects = buildHierachyGameObjects([], + editorWholeService, + meta3dState, getAllTopGameObjects(meta3dState, editorWholeService)) + + return Promise.resolve(_convertToTreeData( + editorWholeService, + meta3dState, hierachyGameObjects + )) + } + } +} diff --git a/contributes/meta3d-input-scenetree/tsconfig.json b/contributes/meta3d-input-scenetree/tsconfig.json new file mode 100755 index 000000000..a8418c65b --- /dev/null +++ b/contributes/meta3d-input-scenetree/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + // "noUnusedLocals": true, + // "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/contributes/meta3d-input-scenetree/webpack.config.js b/contributes/meta3d-input-scenetree/webpack.config.js new file mode 100755 index 000000000..1de4da2d5 --- /dev/null +++ b/contributes/meta3d-input-scenetree/webpack.config.js @@ -0,0 +1,64 @@ +const path = require('path'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); + +module.exports = { + entry: "./src/Main.ts", + mode: process.env.NODE_ENV.trim() == 'production' ? 'production' : 'development', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'static/js/[name].js', + library: { + name: 'Contribute', + type: 'window', + }, + }, + + // Enable sourcemaps for debugging webpack's output. + // devtool: "source-map", + + resolve: { + extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss'], + modules: ['node_modules'] + }, + + module: { + rules: [ + // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'. + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: "ts-loader" + }, + // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. + { + enforce: 'pre', + test: /\.js$/, + loader: "source-map-loader" + }, + ] + }, + plugins: [ + /** + * All files inside webpack's output.path directory will be removed once, but the + * directory itself will not be. If using webpack 4+'s default configuration, + * everything under /dist/ will be removed. + * Use cleanOnceBeforeBuildPatterns to override this behavior. + * + * During rebuilds, all webpack assets that are not used anymore + * will be removed automatically. + * + * See `Options and Defaults` for information + */ + new CleanWebpackPlugin(), + // new HtmlWebpackPlugin({ + // template: './user.html', + // filename: 'user.html', + // }), + ], + // When importing a module whose path matches one of the following, just + // assume a corresponding global variable exists and use that instead. + // This is important because it allows us to avoid bundling all of our + // dependencies, which allows browsers to cache those libraries between builds. + externals: { + } +}; \ No newline at end of file diff --git a/contributes/meta3d-ui-control-asset/src/Main.ts b/contributes/meta3d-ui-control-asset/src/Main.ts index 8c532142c..cece967e1 100755 --- a/contributes/meta3d-ui-control-asset/src/Main.ts +++ b/contributes/meta3d-ui-control-asset/src/Main.ts @@ -3,36 +3,27 @@ import { inputFunc, specificData, outputData, uiControlName, imageBase64, state import { service, uiControlContribute } from "meta3d-editor-whole-protocol/src/service/ServiceType" import { state as meta3dState } from "meta3d-type" import { nullable } from "meta3d-commonlib-ts/src/nullable" +import { loadImage } from "meta3d-ui-control-utils/src/SpecificDataUtils" -// TODO refactor: duplicate let _loadImage = ( meta3dState: meta3dState, api: api, label: string, image: nullable, ): Promise => { - let { loadImage } = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).ui(meta3dState) + return loadImage(meta3dState, api, [(meta3dState) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) - let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) + return state.lastFileTextureImageBase64 + }, (meta3dState, texture, image) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) - - let promise = null - if (!api.nullable.isNullable(image) && api.nullable.getWithDefault(api.nullable.map(lastFileTextureImageBase64 => lastFileTextureImageBase64 != api.nullable.getExn(image), state.lastFileTextureImageBase64), true)) { - promise = loadImage(meta3dState, api.nullable.getExn(image)).then((fileTexture: any) => { - meta3dState = api.uiControl.setUIControlState(meta3dState, label, { - ...state, - fileTexture, - lastFileTextureImageBase64: api.nullable.getExn(image) - }) - - return meta3dState - }) - } - else { - promise = Promise.resolve(meta3dState) - } - - return promise + return { + ...state, + fileTexture: texture, + lastFileTextureImageBase64: image + } + }], label, image) } export let getContribute: getContributeMeta3D> = (api) => { diff --git a/contributes/meta3d-ui-control-switch-button/src/Main.ts b/contributes/meta3d-ui-control-switch-button/src/Main.ts index 6f1c65426..f9684c76a 100755 --- a/contributes/meta3d-ui-control-switch-button/src/Main.ts +++ b/contributes/meta3d-ui-control-switch-button/src/Main.ts @@ -3,6 +3,7 @@ import { state as meta3dState } from "meta3d-type" import { inputFunc, specificData, outputData, uiControlName, state, imageBase64 } from "meta3d-ui-control-switch-button-protocol" import { service, uiControlContribute } from "meta3d-editor-whole-protocol/src/service/ServiceType" import { nullable } from "meta3d-commonlib-ts/src/nullable" +import { loadImage } from "meta3d-ui-control-utils/src/SpecificDataUtils" let _loadImage = ( meta3dState: meta3dState, @@ -11,42 +12,70 @@ let _loadImage = ( image1: nullable, image2: nullable ): Promise => { - let { loadImage } = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).ui(meta3dState) + return loadImage(meta3dState, api, [(meta3dState) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) - let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) + return state.lastClick1TextureImageBase64 + }, (meta3dState, texture, image) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) + return { + ...state, + click1Texture: texture, + lastClick1TextureImageBase64: image + } + }], label, image1).then(meta3dState => { + return loadImage(meta3dState, api, [(meta3dState) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) + + return state.lastClick2TextureImageBase64 + }, (meta3dState, texture, image) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) - let promise = null - if (!api.nullable.isNullable(image1) && api.nullable.getWithDefault(api.nullable.map(lastClick1TextureImageBase64 => lastClick1TextureImageBase64 != api.nullable.getExn(image1), state.lastClick1TextureImageBase64), true)) { - promise = loadImage(meta3dState, api.nullable.getExn(image1)).then((click1Texture: any) => { - meta3dState = api.uiControl.setUIControlState(meta3dState, label, { + return { ...state, - click1Texture, - lastClick1TextureImageBase64: api.nullable.getExn(image1) - }) + click2Texture: texture, + lastClick2TextureImageBase64: image + } + }], label, image2) + }) - return meta3dState - }) - } - else { - promise = Promise.resolve(meta3dState) - } + // let { loadImage } = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).ui(meta3dState) - if (!api.nullable.isNullable(image2) && api.nullable.getWithDefault(api.nullable.map(lastClick2TextureImageBase64 => lastClick2TextureImageBase64 != api.nullable.getExn(image2), state.lastClick2TextureImageBase64), true)) { - return promise.then(meta3dState => { - return loadImage(meta3dState, api.nullable.getExn(image2)).then((click2Texture: any) => { - meta3dState = api.uiControl.setUIControlState(meta3dState, label, { - ...state, - click2Texture, - lastClick2TextureImageBase64: api.nullable.getExn(image2) - }) + // let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) - return meta3dState - }) - }) - } - return promise + // let promise = null + // if (!api.nullable.isNullable(image1) && api.nullable.getWithDefault(api.nullable.map(lastClick1TextureImageBase64 => lastClick1TextureImageBase64 != api.nullable.getExn(image1), state.lastClick1TextureImageBase64), true)) { + // promise = loadImage(meta3dState, api.nullable.getExn(image1)).then((click1Texture: any) => { + // meta3dState = api.uiControl.setUIControlState(meta3dState, label, { + // ...state, + // click1Texture, + // lastClick1TextureImageBase64: api.nullable.getExn(image1) + // }) + + // return meta3dState + // }) + // } + // else { + // promise = Promise.resolve(meta3dState) + // } + + // if (!api.nullable.isNullable(image2) && api.nullable.getWithDefault(api.nullable.map(lastClick2TextureImageBase64 => lastClick2TextureImageBase64 != api.nullable.getExn(image2), state.lastClick2TextureImageBase64), true)) { + // return promise.then(meta3dState => { + // return loadImage(meta3dState, api.nullable.getExn(image2)).then((click2Texture: any) => { + // meta3dState = api.uiControl.setUIControlState(meta3dState, label, { + // ...state, + // click2Texture, + // lastClick2TextureImageBase64: api.nullable.getExn(image2) + // }) + + // return meta3dState + // }) + // }) + // } + + // return promise } export let getContribute: getContributeMeta3D> = (api) => { diff --git a/contributes/meta3d-ui-control-tree/.gitignore b/contributes/meta3d-ui-control-tree/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/contributes/meta3d-ui-control-tree/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/contributes/meta3d-ui-control-tree/gulpfile.js b/contributes/meta3d-ui-control-tree/gulpfile.js new file mode 100755 index 000000000..a4c8812fc --- /dev/null +++ b/contributes/meta3d-ui-control-tree/gulpfile.js @@ -0,0 +1,25 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish") + +gulp.task("publish_local_env", function (done) { + publish.publishContribute( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContribute( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + + diff --git a/contributes/meta3d-ui-control-tree/jest.json b/contributes/meta3d-ui-control-tree/jest.json new file mode 100755 index 000000000..8402ba92b --- /dev/null +++ b/contributes/meta3d-ui-control-tree/jest.json @@ -0,0 +1,27 @@ +{ + "preset": "ts-jest", + "automock": false, + "testEnvironment": "jsdom", + "transform": { + "^.+\\js$": "babel-jest" + }, + "moduleFileExtensions": [ + "js", + "json", + "jsx", + "ts", + "tsx", + "node" + ], + "testMatch": [ + "/test/step-definitions/**/*.steps.ts" + ], + "testPathIgnorePatterns": [ + "/mine" + ], + "setupFilesAfterEnv": [ + "/test/helper/jest/specHelper.js" + ], + "notify": false, + "verbose": true +} \ No newline at end of file diff --git a/contributes/meta3d-ui-control-tree/jest_coverage.json b/contributes/meta3d-ui-control-tree/jest_coverage.json new file mode 100755 index 000000000..e4b9ec9a7 --- /dev/null +++ b/contributes/meta3d-ui-control-tree/jest_coverage.json @@ -0,0 +1,40 @@ +{ + "preset": "ts-jest", + "automock": false, + "moduleFileExtensions": [ + "js", + "jsx", + "ts", + "tsx" + ], + "testRegex": "test/step-definitions/.+.steps.ts", + "transformIgnorePatterns": [ + "/node_modules/jest-cucumber" + ], + "setupFilesAfterEnv": [ + "/test/helper/jest/specHelper.js" + ], + "notify": false, + "verbose": true, + "collectCoverage": true, + "coverageDirectory": "/coverage/", + "coveragePathIgnorePatterns": [ + "Main.ts", + "/src/domain_layer/.+", + "/src/.+/cloudbase/.+", + "/src/.+/common/.+" + ], + "collectCoverageFrom": [ + "src/**/*.ts", + "!**/node_modules/**", + "!**/vendor/**" + ], + "coverageThreshold": { + "global": { + "lines": 1, + "statements": 1, + "branches": 1, + "functions": 1 + } + } +} \ No newline at end of file diff --git a/contributes/meta3d-ui-control-tree/package.json b/contributes/meta3d-ui-control-tree/package.json new file mode 100755 index 000000000..03b2c98e9 --- /dev/null +++ b/contributes/meta3d-ui-control-tree/package.json @@ -0,0 +1,39 @@ +{ + "name": "meta3d-ui-control-tree", + "version": "0.20.3", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "description": "", + "protocol": { + "name": "meta3d-ui-control-tree-protocol" + }, + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "webpack": "webpack --config webpack.config.js", + "test:watch": "jest --maxWorkers=4 --watch --config jest.json", + "test:ci": "tsc --build --clean && jest --maxWorkers=4 --config jest_coverage.json && tsc --build", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publish_local_env", + "meta3d:publish_pro": "cross-env NODE_ENV=production npm run webpack && gulp publish_production_env" + }, + "keywords": [], + "dependencies": { + "meta3d-editor-whole-protocol": "^0.20.0", + "meta3d-imgui-renderer-protocol": "^0.20.0", + "meta3d-type": "^0.20.0", + "meta3d-ui-control-tree-protocol": "^0.20.0" + }, + "devDependencies": { + "clean-webpack-plugin": "^4.0.0", + "cross-env": "^7.0.3", + "cz-customizable": "^6.3.0", + "gulp": "^4.0.2", + "meta3d-tool-publish": "^0.20.0", + "source-map-loader": "^3.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.2.3", + "url-loader": "^4.1.1", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + } +} diff --git a/contributes/meta3d-ui-control-tree/src/Main.ts b/contributes/meta3d-ui-control-tree/src/Main.ts new file mode 100755 index 000000000..28fa0aff5 --- /dev/null +++ b/contributes/meta3d-ui-control-tree/src/Main.ts @@ -0,0 +1,212 @@ +import { api, getContribute as getContributeMeta3D, state as meta3dState } from "meta3d-type" +import { inputFunc, specificData, outputData, uiControlName, imageBase64, state } from "meta3d-ui-control-tree-protocol" +import { service, uiControlContribute } from "meta3d-editor-whole-protocol/src/service/ServiceType" +import { imguiImplTexture, treeData } from "meta3d-imgui-renderer-protocol/src/service/ServiceType" +import { nullable } from "meta3d-commonlib-ts/src/nullable" +import { loadImage } from "meta3d-ui-control-utils/src/SpecificDataUtils" +import { data, nodeType, nodeLabel } from "meta3d-input-tree-protocol" + +let _loadImage = ( + meta3dState: meta3dState, + api: api, + label: string, + nodeType1Image: nullable, + nodeType2Image: nullable, + nodeType3Image: nullable, +): Promise => { + return loadImage(meta3dState, api, [(meta3dState) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) + + return state.lastNodeType1TextureImageBase64 + }, (meta3dState, texture, image) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) + + return { + ...state, + nodeType1Texture: texture, + lastNodeType1TextureImageBase64: image + } + }], label, nodeType1Image).then(meta3dState => { + return loadImage(meta3dState, api, [(meta3dState) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) + + return state.lastNodeType2TextureImageBase64 + }, (meta3dState, texture, image) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) + + return { + ...state, + nodeType2Texture: texture, + lastNodeType2TextureImageBase64: image + } + }], label, nodeType2Image) + }).then(meta3dState => { + return loadImage(meta3dState, api, [(meta3dState) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) + + return state.lastNodeType3TextureImageBase64 + }, (meta3dState, texture, image) => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) + + return { + ...state, + nodeType3Texture: texture, + lastNodeType3TextureImageBase64: image + } + }], label, nodeType3Image) + }) +} + +export let _convertTreeData = ( + api: api, + treeData: data, + nodeType1Texture: nullable, + nodeType2Texture: nullable, + nodeType3Texture: nullable, +): nullable => { + let _func = (result: nullable, treeData: data): nullable => { + if (api.nullable.isNullable(result)) { + return api.nullable.getEmpty() + } + + // if (treeData.length == 0) { + // return api.nullable.return([]) + // } + + return treeData.reduce((result: nullable, [nodeLabel, nodeType_, data]: [nodeLabel, nodeType, treeData]) => { + return api.nullable.bind(result => { + let texture: nullable = api.nullable.getEmpty() + + switch (nodeType_) { + case nodeType.Type1: + texture = nodeType1Texture + break + case nodeType.Type2: + texture = nodeType2Texture + break + case nodeType.Type3: + texture = nodeType3Texture + break + default: + throw new Error("error") + } + + return api.nullable.bind(texture => { + // let childrenResult = _func(api.nullable.return(result), data) + + // if (api.nullable.isNullable(childrenResult)) { + // return api.nullable.getEmpty() + // } + + // childrenResult = api.nullable.getExn(childrenResult) + + // if (childrenResult.length != 0) { + // result.push([nodeLabel, texture, api.nullable.getExn(childrenResult)]) + // } + // else { + // result.push([nodeLabel, texture, []]) + // } + + // return api.nullable.return(result) + + + if (data.length != 0) { + return api.nullable.bind(childResult => { + result.push([nodeLabel, texture, childResult]) + + return result + // }, _func(api.nullable.return(result), data)) + }, _func(api.nullable.return([]), data)) + } + + result.push([nodeLabel, texture, []]) + + return api.nullable.return(result) + }, texture) + }, result) + }, result) + } + + return _func(api.nullable.return([]), treeData) +} + +export let getContribute: getContributeMeta3D> = (api) => { + return { + uiControlName: uiControlName, + func: (meta3dState, + getInputFunc, + { + rect, + label, + rootNodeLabel, + nodeType1Image, + nodeType2Image, + nodeType3Image, + } + ) => { + if (api.nullable.isNullable(getInputFunc)) { + return Promise.resolve([meta3dState, [null, null]]) + } + + return api.nullable.getExn(getInputFunc)(meta3dState).then((treeData) => { + if (api.nullable.isNullable(api.uiControl.getUIControlState(meta3dState, label))) { + meta3dState = api.uiControl.setUIControlState(meta3dState, label, { + lastTreeSelectedData: null, + nodeType1Texture: null, + nodeType2Texture: null, + nodeType3Texture: null, + lastNodeType1TextureImageBase64: null, + lastNodeType2TextureImageBase64: null, + lastNodeType3TextureImageBase64: null, + }) + } + + return _loadImage( + meta3dState, + api, + label, + nodeType1Image, + nodeType2Image, + nodeType3Image, + ).then(meta3dState => { + let state = api.nullable.getExn(api.uiControl.getUIControlState(meta3dState, label)) + let { + lastTreeSelectedData, + nodeType1Texture, + nodeType2Texture, + nodeType3Texture, + } = state + let { tree } = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).ui(meta3dState) + + return api.nullable.getWithDefault( + api.nullable.map(treeData => { + let data = tree(meta3dState, treeData, + rootNodeLabel, + lastTreeSelectedData, + "Tree Window", rect) + meta3dState = data[0] + let [treeSelectedData, treeDragData] = data[1] + + meta3dState = api.uiControl.setUIControlState(meta3dState, label, { + ...state, + lastTreeSelectedData: api.nullable.isNullable(treeSelectedData) ? lastTreeSelectedData : treeSelectedData + }) + + return [meta3dState, [treeSelectedData, treeDragData]] + }, _convertTreeData( + api, + treeData, + nodeType1Texture, + nodeType2Texture, + nodeType3Texture, + )), [meta3dState, [null, null]] + ) + + }) + }) + }, + init: (meta3dState) => { + return Promise.resolve(meta3dState) + } + } +} diff --git a/contributes/meta3d-ui-control-tree/test/features/tree_data.feature b/contributes/meta3d-ui-control-tree/test/features/tree_data.feature new file mode 100755 index 000000000..57714f99d --- /dev/null +++ b/contributes/meta3d-ui-control-tree/test/features/tree_data.feature @@ -0,0 +1,21 @@ +Feature: Tree Data + As a Tree Data + I want to generate tree's data + So that I can show tree + + Background: prepare + Given prepare sandbox + + Rule: convertTreeData + + Scenario: convert tree data with all texture data + Given prepare api + And prepare tree data + When convert tree data with all texture data + Then should get the same structure but replace nodeType to texture + + Scenario: convert tree data with some texture data + Given prepare api + And prepare tree data + When convert tree data with some texture data + Then should get empty diff --git a/contributes/meta3d-ui-control-tree/test/helper/jest/specHelper.js b/contributes/meta3d-ui-control-tree/test/helper/jest/specHelper.js new file mode 100755 index 000000000..7a106ade5 --- /dev/null +++ b/contributes/meta3d-ui-control-tree/test/helper/jest/specHelper.js @@ -0,0 +1,264 @@ +beforeEach(function () { + (function (jasmine) { + //* 引入YTool的judge和convert方法 + + var Tool = {}; + // var global = window; + + + function _verifyIsStub(stub) { + var method; + + for (var i = 0, l = arguments.length; i < l; ++i) { + method = arguments[i]; + + if (!method) { + //assert.fail("fake is not a spy"); + return false; + } + + if (method.proxy && method.proxy.isSinonProxy) { + verifyIsStub(method.proxy); + } + else { + if (typeof method !== "function") { + //assert.fail(method + " is not a function"); + return false; + } + + if (typeof method.getCall !== "function") { + //assert.fail(method + " is not stubbed"); + return false; + } + } + } + + return true; + } + + function _isSpecificCall(stub) { + return !stub.firstCall + } + function _isCalled(stub) { + var actualArg = null; + + if (stub && stub.callId) { + return true; + } + + if(stub&&stub.args === undefined){ + return false; + } + + actualArg = _isSpecificCall(stub) || _verifyIsStub(stub) ? stub.args : stub.args[0]; + + return actualArg && actualArg.length > 0; + } + function getActualArg(stub) { + var actualArg = _isSpecificCall(stub) || _verifyIsStub(stub) ? stub.args : stub.args[0]; + + return actualArg; + } + + + jasmine.addMatchers({ + toCalledWith: function () { + return { + compare: function (actual, expected) { + var actualArg = getActualArg(actual), + expectedArg = null, + message = null, + toString = function (arg) { + return JSON.stringify (arg); + }; + + // expectedArg = Array.prototype.slice.call(arguments, 1); + expectedArg = expected; + + + message = "Expected to called with " + toString(expectedArg); + + if (!_isCalled(actual)) { + message += ", but actual is not called"; + } + else { + message += ", but actual is " + toString(actualArg); + } + + return { + pass: actual.calledWith.apply(actual, expectedArg), + message: function () { + return message; + } + } + }, + negativeCompare: function (actual, expected) { + var actualArg = getActualArg(actual), + expectedArg = null, + message = null, + toString = function (arg) { + return JSON.stringify (arg); + }; + + // expectedArg = Array.prototype.slice.call(arguments, 1); + expectedArg = expected; + + + message = "Expected not to called with " + toString(expectedArg); + + if (!_isCalled(actual)) { + message += ", but actual is called"; + } + else { + message += ", but actual is called with " + toString(actualArg[0]); + } + return { + pass: (actual.calledWith.apply(actual, expectedArg)), + message: function () { + return message; + } + } + } + }; + }, + toCalled: function () { + return { + compare: function (actual, expected) { + return { + pass: actual.called, + message: function () { + return "Expected to be called, but actual is not called"; + } + } + }, + negativeCompare: function (actual, expected) { + return { + pass: actual.called, + message: function () { + return "Expected to be not called, but actual is called"; + } + } + } + }; + }, + toCalledOnce: function () { + return { + compare: function (actual, expected) { + return { + pass: actual.calledOnce, + message: function () { + return "Expected to be called Once, but actual callCount is " + actual.callCount + } + } + }, + negativeCompare: function (actual, expected) { + return { + pass: actual.calledOnce, + message: function () { + return "Expected not to be called Once, but actual callCount is " + actual.callCount; + } + } + } + }; + }, + toCalledTwice: function () { + return { + compare: function (actual, expected) { + return { + pass: actual.calledTwice, + message: function () { + return "Expected to be called Twice, but actual callCount is " + actual.callCount + + } + } + }, + negativeCompare: function (actual, expected) { + return { + pass: actual.calledTwice, + message: function () { + return "Expected not to be called Twice, but actual callCount is " + actual.callCount + + } + } + } + }; + }, + toCalledThrice: function () { + return { + compare: function (actual, expected) { + return { + pass: actual.calledThrice, + message: function () { + return "Expected to be called thrice, but actual callCount is " + actual.callCount + } + } + }, + negativeCompare: function (actual, expected) { + return { + pass: actual.calledThrice, + message: function () { + return "Expected not to be called thrice, but actual callCount is " + actual.callCount + } + } + } + }; + }, + toCalledBefore: function () { + return { + compare: function (actual, expected) { + var msg = null, + pass = null; + + msg = "Expected to be called before, "; + + if (!_isCalled(expected)) { + pass = false; + msg += "but expected not called"; + } + else { + pass = actual.calledBefore(expected); + msg += _isCalled(actual) ? "but the actual is be called after" : "but the actual is not called"; + } + + return { + pass: pass, + message: function () { + return msg; + } + } + } + }; + }, + toCalledAfter: function () { + return { + compare: function (actual, expected) { + var msg = null, + pass = null; + + msg = "Expected to be called after, "; + + if (!_isCalled(expected)) { + pass = false; + msg += "but the expected is not called"; + } + else if (!_isCalled(actual)) { + pass = false; + msg += "but the actual is not called"; + } + else { + pass = actual.calledAfter(expected); + msg += _isCalled(actual) ? "but the actual is be called before" : "but the actual is not called"; + } + + return { + pass: pass, + message: function () { + return msg; + } + } + } + }; + } + }); + }(jasmine)); +}); \ No newline at end of file diff --git a/contributes/meta3d-ui-control-tree/test/jest.d.ts b/contributes/meta3d-ui-control-tree/test/jest.d.ts new file mode 100755 index 000000000..23f974dbf --- /dev/null +++ b/contributes/meta3d-ui-control-tree/test/jest.d.ts @@ -0,0 +1,8 @@ +declare namespace jest { + interface Matchers { + toCalled(): CustomMatcherResult; + toCalledOnce(): CustomMatcherResult; + toCalledTwice(): CustomMatcherResult; + toCalledWith(expected: any): CustomMatcherResult; + } +} \ No newline at end of file diff --git a/contributes/meta3d-ui-control-tree/test/step-definitions/tree_data.steps.ts b/contributes/meta3d-ui-control-tree/test/step-definitions/tree_data.steps.ts new file mode 100755 index 000000000..28acd021e --- /dev/null +++ b/contributes/meta3d-ui-control-tree/test/step-definitions/tree_data.steps.ts @@ -0,0 +1,169 @@ +import { loadFeature, defineFeature } from "jest-cucumber" +import { empty, just, map } from "most"; +import { createSandbox } from "sinon"; +import { buildAPI } from "../tool/APITool"; +import { data, nodeType } from "meta3d-input-tree-protocol"; +import { _convertTreeData } from "../../src/Main"; +import { imguiImplTexture, treeData } from "meta3d-imgui-renderer-protocol/src/service/ServiceType" +import { nullable } from "meta3d-commonlib-ts/src/nullable"; + +const feature = loadFeature("./test/features/tree_data.feature") + +defineFeature(feature, test => { + let sandbox = null + + let _prepare = (given) => { + given('prepare sandbox', () => { + sandbox = createSandbox() + }); + } + + test('convert tree data with all texture data', ({ given, and, when, then }) => { + let api + let treeData: data + let nodeType1Texture: nullable + let nodeType2Texture: nullable + let nodeType3Texture: nullable + let result: nullable + + _prepare(given) + + given('prepare api', () => { + api = buildAPI() + }); + + and('prepare tree data', () => { + treeData = [ + [ + "camera", + nodeType.Type1, + [ + [ + "cube1", + nodeType.Type3, + [] + ], + [ + "cube2", + nodeType.Type3, + [ + [ + "cube3", + nodeType.Type3, + [] + ] + ] + ] + ] + ], + [ + "light", + nodeType.Type2, + [ + [ + "cube4", + nodeType.Type3, + [] + ], + ] + ] + ] + + nodeType1Texture = api.nullable.return(1) + nodeType2Texture = api.nullable.return(2) + nodeType3Texture = api.nullable.return(3) + }); + + when('convert tree data with all texture data', () => { + result = _convertTreeData(api, treeData, nodeType1Texture, nodeType2Texture, nodeType3Texture) + }); + + then('should get the same structure but replace nodeType to texture', () => { + // console.log(JSON.stringify(result)) + expect(result).toEqual([ + [ + "camera", + nodeType1Texture, + [ + [ + "cube1", + nodeType3Texture, + [] + ], + [ + "cube2", + nodeType3Texture, + [ + [ + "cube3", + nodeType3Texture, + [] + ] + ] + ] + ] + ], + [ + "light", + nodeType2Texture, + [ + [ + "cube4", + nodeType3Texture, + [] + ], + ] + ] + ]) + }); + }); + + test('convert tree data with some texture data', ({ given, and, when, then }) => { + let api + let treeData: data + let nodeType1Texture: nullable + let nodeType2Texture: nullable + let nodeType3Texture: nullable + + let result: nullable + + _prepare(given) + + given('prepare api', () => { + api = buildAPI() + }); + + and('prepare tree data', () => { + treeData = [ + [ + "camera", + nodeType.Type1, + [ + [ + "cube1", + nodeType.Type3, + [] + ] + ] + ], + [ + "light", + nodeType.Type2, + [] + ] + ] + + nodeType1Texture = api.nullable.return(1) + nodeType2Texture = api.nullable.getEmpty() + nodeType3Texture = api.nullable.getEmpty() + }); + + when('convert tree data with some texture data', () => { + result = _convertTreeData(api, treeData, nodeType1Texture, nodeType2Texture, nodeType3Texture) + }); + + then('should get empty', () => { + expect(result).toEqual(api.nullable.getEmpty()) + }); + }); +}) \ No newline at end of file diff --git a/contributes/meta3d-ui-control-tree/test/tool/APITool.ts b/contributes/meta3d-ui-control-tree/test/tool/APITool.ts new file mode 100644 index 000000000..20f05fe59 --- /dev/null +++ b/contributes/meta3d-ui-control-tree/test/tool/APITool.ts @@ -0,0 +1,17 @@ +import { bind, getExn, isNullable, map, return_, getEmpty } from "meta3d-commonlib-ts/src/NullableUtils"; +import { api } from "meta3d-type"; + +export let buildAPI = ( + +): api => { + return { + nullable: { + isNullable: isNullable, + map: map, + bind: bind, + getExn: getExn, + return: return_, + getEmpty: getEmpty + } + } as any +} \ No newline at end of file diff --git a/contributes/meta3d-ui-control-tree/tsconfig.json b/contributes/meta3d-ui-control-tree/tsconfig.json new file mode 100755 index 000000000..f2f9ee4eb --- /dev/null +++ b/contributes/meta3d-ui-control-tree/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + // "noUnusedLocals": true, + // "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [ + "node", + "jest" + ], + "strict": false + }, + "include": [ + "./src", + "./test", + "./url-loader.d.ts" + ] +} \ No newline at end of file diff --git a/contributes/meta3d-ui-control-tree/url-loader.d.ts b/contributes/meta3d-ui-control-tree/url-loader.d.ts new file mode 100755 index 000000000..6be34756a --- /dev/null +++ b/contributes/meta3d-ui-control-tree/url-loader.d.ts @@ -0,0 +1,6 @@ +declare module 'url-loader!*' { + type base64 = string + // const contents: { default: string } + const contents: base64 + export = contents +} \ No newline at end of file diff --git a/contributes/meta3d-ui-control-tree/webpack.config.js b/contributes/meta3d-ui-control-tree/webpack.config.js new file mode 100755 index 000000000..1de4da2d5 --- /dev/null +++ b/contributes/meta3d-ui-control-tree/webpack.config.js @@ -0,0 +1,64 @@ +const path = require('path'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); + +module.exports = { + entry: "./src/Main.ts", + mode: process.env.NODE_ENV.trim() == 'production' ? 'production' : 'development', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'static/js/[name].js', + library: { + name: 'Contribute', + type: 'window', + }, + }, + + // Enable sourcemaps for debugging webpack's output. + // devtool: "source-map", + + resolve: { + extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss'], + modules: ['node_modules'] + }, + + module: { + rules: [ + // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'. + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: "ts-loader" + }, + // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. + { + enforce: 'pre', + test: /\.js$/, + loader: "source-map-loader" + }, + ] + }, + plugins: [ + /** + * All files inside webpack's output.path directory will be removed once, but the + * directory itself will not be. If using webpack 4+'s default configuration, + * everything under /dist/ will be removed. + * Use cleanOnceBeforeBuildPatterns to override this behavior. + * + * During rebuilds, all webpack assets that are not used anymore + * will be removed automatically. + * + * See `Options and Defaults` for information + */ + new CleanWebpackPlugin(), + // new HtmlWebpackPlugin({ + // template: './user.html', + // filename: 'user.html', + // }), + ], + // When importing a module whose path matches one of the following, just + // assume a corresponding global variable exists and use that instead. + // This is important because it allows us to avoid bundling all of our + // dependencies, which allows browsers to cache those libraries between builds. + externals: { + } +}; \ No newline at end of file diff --git a/defaults/meta3d-commonlib-ts/src/NullableUtils.ts b/defaults/meta3d-commonlib-ts/src/NullableUtils.ts index 79ca8e915..7017484f1 100755 --- a/defaults/meta3d-commonlib-ts/src/NullableUtils.ts +++ b/defaults/meta3d-commonlib-ts/src/NullableUtils.ts @@ -51,4 +51,8 @@ export let getWithDefault = (nullableValue: nullable, default_: T): T => { } return nullableValue as T +} + +export let getEmpty = (): nullable => { + return undefined } \ No newline at end of file diff --git a/defaults/meta3d-type/src/contribute/UIControlProtocolConfigType.res b/defaults/meta3d-type/src/contribute/UIControlProtocolConfigType.res index 8b932d4d1..4b47be4fd 100755 --- a/defaults/meta3d-type/src/contribute/UIControlProtocolConfigType.res +++ b/defaults/meta3d-type/src/contribute/UIControlProtocolConfigType.res @@ -15,6 +15,8 @@ type supportedEventName = [ | #click2 | #select_asset | #drop_asset + | #select_tree_node + | #drag_tree_node ] type actionName = Js.Nullable.t diff --git a/defaults/meta3d-type/src/contribute/UIControlProtocolConfigType.ts b/defaults/meta3d-type/src/contribute/UIControlProtocolConfigType.ts index 40e137a87..861d51d85 100755 --- a/defaults/meta3d-type/src/contribute/UIControlProtocolConfigType.ts +++ b/defaults/meta3d-type/src/contribute/UIControlProtocolConfigType.ts @@ -10,7 +10,7 @@ export type rect = { export type childrenFunc = (state: state) => state -export type supportedEventName = "button_click" | "run" | "stop" | "click1" | "click2" | "select_asset" | "drop_asset" +export type supportedEventName = "button_click" | "run" | "stop" | "click1" | "click2" | "select_asset" | "drop_asset" | "select_tree_node" | "drag_tree_node" export type actionName = nullable diff --git a/doc/0.21.0.org b/doc/0.21.0.org index dc8a22918..b963f8d18 100755 --- a/doc/0.21.0.org +++ b/doc/0.21.0.org @@ -1004,14 +1004,40 @@ TODO run test -** TODO SceneTree +** DONE SceneTree separate header, body: header = multiple Image Buttons +TODO rename to Tree + +TODO add Input + + + +TODO update: +engine-whole +ui + imgui render +editor whole + +ui control tree +dispose action + + + +TODO fix: +not selected +set parent bug +ui control should move out + + ** TODO Inspector -TODO split inspector to multiple ui controls(e.g. Input3Float, Text, InputText, CollapsingHeader) +TODO split inspector to multiple ui controls(e.g. Input3Float, Text, InputText, CollapsingHeader + Window) + + +TODO Window need input TODO can make inspector show in element visual: @@ -1182,3 +1208,5 @@ if continue 1.->2., then will render more lighter! * TODO remove meta3d-imgui-webgl1-three-renderer in ui package + +* TODO feat(platform): ap assemble: PackageInspector, ContributeInspector show protocol,implement repo link \ No newline at end of file diff --git a/packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/package.json b/packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/package.json index a37b7cdfd..1fa4ffc07 100755 --- a/packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/package.json +++ b/packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/package.json @@ -1,6 +1,6 @@ { "name": "meta3d-imgui-webgl1-renderer", - "version": "0.20.3", + "version": "0.20.5", "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", "displayName": "imgui-webgl1-renderer", "protocol": { diff --git a/packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/src/Main.ts b/packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/src/Main.ts index cbf3ffae6..3c52e4ce1 100755 --- a/packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/src/Main.ts +++ b/packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/src/Main.ts @@ -4,7 +4,7 @@ import { state } from "meta3d-imgui-renderer-protocol/src/state/StateType" import * as ImGui from "./lib/imgui" import * as ImGui_Impl from "./lib/imgui_impl" import { setNextWindowRect } from "./Utils" -// import { sceneTree } from "./SceneTree" +import { tree } from "./Tree" import { asset } from "./Asset" // import { inspector } from "./Inspector" @@ -227,9 +227,8 @@ export let getExtensionService: getExtensionServiceMeta3D< return selectItemLabel }, - // sceneTree: sceneTree, // inspector: inspector, - sceneTree: {} as any, + tree: tree, inspector: {} as any, switchButton: (isClick1State, { click1Texture, click2Texture }, [width, height]) => { let isClick1 = false diff --git a/packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/src/Tree.ts b/packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/src/Tree.ts new file mode 100755 index 000000000..7a75e522d --- /dev/null +++ b/packages/editor-whole/ui/extensions/meta3d-imgui-webgl1-renderer/src/Tree.ts @@ -0,0 +1,150 @@ +import { treeFunc, treeData, treeDragData, treeIndexData } from "meta3d-imgui-renderer-protocol/src/service/ServiceType" +import { nullable } from "meta3d-commonlib-ts/src/nullable" +import { setNextWindowRect } from "./Utils" +import imgui, * as ImGui from "./lib/imgui" +import { getExn, getWithDefault, isNullable, map } from "meta3d-commonlib-ts/src/NullableUtils" +import { dragDropType } from "meta3d-ui-control-tree-protocol" +import { isArraysEqual, push } from "meta3d-structure-utils/src/ArrayUtils" + +let _renderTree = ([selectedData, dragData]: [nullable, nullable], lastTreeSelectedData: nullable, + index: nullable, + indexData: treeIndexData, + treeData: treeData): [nullable, nullable] => { + if (treeData.length == 0) { + return [selectedData, dragData] + } + + indexData = getWithDefault( + map((index) => { + indexData = indexData.slice() + indexData.push(index) + + return indexData + }, index), + indexData + ) + + return treeData.reduce(([selectedData, dragData], [nodeLabel, nodeIconTexture, children], index) => { + let flag = children.length == 0 ? ImGui.TreeNodeFlags.Leaf : ImGui.TreeNodeFlags.OpenOnArrow + + + if (!isNullable(lastTreeSelectedData)) { + let data = getExn(lastTreeSelectedData) + + if (isArraysEqual(data, push(indexData.slice(), index))) { + flag = flag | ImGui.TreeNodeFlags.Selected + } + } + + let isOpen = ImGui.TreeNodeEx(((indexData.length - 1) * 100000 + index).toString(), flag, nodeLabel.slice(0, 20)) + + if (ImGui.IsItemClicked() && !ImGui.IsItemToggledOpen()) { + indexData = push(indexData.slice(), index) + selectedData = indexData + } + + if (ImGui.BeginDragDropSource()) { + ImGui.SetDragDropPayload(dragDropType, push(indexData.slice(), index)) + ImGui.Text(nodeLabel) + ImGui.EndDragDropSource() + } + + if (ImGui.BeginDragDropTarget()) { + let payload = ImGui.AcceptDragDropPayload(dragDropType) + + if (payload !== null) { + dragData = { + source: payload.Data, + target: push(indexData.slice(), index) + } + } + ImGui.EndDragDropTarget() + } + + /*! Icons in the tree + * refer to: + https://github.com/ocornut/imgui/issues/282 + https://github.com/ocornut/imgui/issues/1863 + */ + ImGui.SameLine() + ImGui.Image(nodeIconTexture._texture, new ImGui.ImVec2(20, 20)) + + + let returnData: any = [null, null] + + if (isOpen) { + returnData = _renderTree([selectedData, dragData], lastTreeSelectedData, index, indexData, children) + + ImGui.TreePop() + } + else { + returnData = [selectedData, dragData] + } + + return returnData + }, [selectedData, dragData]) +} + +export let tree: treeFunc = (treeData, rootNodeLabel, lastTreeSelectedData, windowName, rect) => { + // let headerHeight = 40 + + // setNextWindowRect({ + // ...rect, + // height: headerHeight + // }) + + // ImGui.Begin(`${windowName}_header`, null, ImGui.WindowFlags.NoTitleBar | ImGui.WindowFlags.NoScrollbar) + + + // let sizeX = 20 + // let sizeY = sizeX + + // let isAddCube = ImGui.ImageButton(addCubeTexture._texture, new ImGui.ImVec2(sizeX, sizeY)) + // ImGui.SameLine() + // let isDisposeGameObject = ImGui.ImageButton(disposeTexture._texture, new ImGui.ImVec2(sizeX, sizeY)) + // ImGui.SameLine() + // let isCloneGameObject = ImGui.ImageButton(cloneTexture._texture, new ImGui.ImVec2(sizeX, sizeY)) + + // ImGui.End() + + + // setNextWindowRect({ + // ...rect, + // y: rect.y + headerHeight, + // height: rect.height - headerHeight + // }) + setNextWindowRect(rect) + + ImGui.Begin(`${windowName}`, null, ImGui.WindowFlags.NoTitleBar | ImGui.WindowFlags.HorizontalScrollbar) + + ImGui.SetNextItemOpen(true, ImGui.Cond.Always) + + let data: [nullable, nullable] = [null, null] + let dragData: nullable = null + + if (ImGui.TreeNode(rootNodeLabel)) { + if (ImGui.BeginDragDropTarget()) { + let payload = ImGui.AcceptDragDropPayload(dragDropType) + + if (payload !== null) { + dragData = { + source: payload.Data, + target: [] + } + } + ImGui.EndDragDropTarget() + } + + + + data = _renderTree([null, dragData], lastTreeSelectedData, null, [], treeData) + + ImGui.TreePop(); + } + + + + ImGui.End() + + return [data[0], data[1]] +} \ No newline at end of file diff --git a/packages/editor-whole/ui/extensions/meta3d-ui/dist/static/js/main.js b/packages/editor-whole/ui/extensions/meta3d-ui/dist/static/js/main.js index 217917f74..dbf282c9b 100644 --- a/packages/editor-whole/ui/extensions/meta3d-ui/dist/static/js/main.js +++ b/packages/editor-whole/ui/extensions/meta3d-ui/dist/static/js/main.js @@ -336,7 +336,7 @@ eval("\n\nvar Curry = __webpack_require__(/*! ./curry.js */ \"../../../../../nod \*******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -eval("\n\nvar UIManager$Meta3dUi = __webpack_require__(/*! ./UIManager.bs.js */ \"./lib/js/src/UIManager.bs.js\");\nvar NullableSt$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/NullableSt.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/NullableSt.bs.js\");\nvar ImmutableHashMap$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/hash_map/ImmutableHashMap.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/hash_map/ImmutableHashMap.bs.js\");\n\nfunction getExtensionService(api) {\n var partial_arg = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$1 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$2 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$3 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$4 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$5 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$6 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$7 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n return {\n registerElement: (function (meta3dState, elementContribute) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.registerElement(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), elementContribute));\n }),\n registerSkin: (function (meta3dState, skinContribute) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.registerSkin(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), skinContribute));\n }),\n registerUIControl: (function (meta3dState, uiControlContribute) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.registerUIControl(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), uiControlContribute));\n }),\n registerInput: (function (meta3dState, inputContribute) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.registerInput(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), inputContribute));\n }),\n render: (function (param, param$1, param$2) {\n return UIManager$Meta3dUi.render(api, param, param$1, param$2);\n }),\n show: (function (meta3dState, elementName) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.show(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), elementName));\n }),\n hide: (function (meta3dState, elementName) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.hide(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), elementName));\n }),\n isStateChange: (function (meta3dState, elementName) {\n return UIManager$Meta3dUi.isStateChange(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), elementName);\n }),\n getElementState: (function (meta3dState, elementName) {\n return UIManager$Meta3dUi.getElementState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), elementName);\n }),\n updateElementState: (function (meta3dState, updateElementStateFunc) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.updateElementState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), updateElementStateFunc));\n }),\n getSkin: (function (meta3dState, skinName) {\n return UIManager$Meta3dUi.getSkin(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), skinName);\n }),\n getUIControlFunc: (function (meta3dState, uiControlName) {\n return UIManager$Meta3dUi.getUIControlFuncExn(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), uiControlName);\n }),\n getInputFunc: (function (meta3dState, inputName) {\n return UIManager$Meta3dUi.getInputFunc(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), inputName);\n }),\n getUIControlState: (function (meta3dState, uiControlName) {\n return UIManager$Meta3dUi.getUIControlState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), uiControlName);\n }),\n setUIControlState: (function (meta3dState, uiControlName, uiControlState) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.setUIControlState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), uiControlName, uiControlState));\n }),\n setStyle: (function (meta3dState, style) {\n return UIManager$Meta3dUi.setStyle(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], style);\n }),\n beginWindow: (function (meta3dState, label) {\n return UIManager$Meta3dUi.beginWindow(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], label);\n }),\n endWindow: (function (meta3dState) {\n return UIManager$Meta3dUi.endWindow(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ]);\n }),\n beginChild: (function (meta3dState, label) {\n return UIManager$Meta3dUi.beginChild(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], label);\n }),\n endChild: (function (meta3dState) {\n return UIManager$Meta3dUi.endChild(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ]);\n }),\n setNextWindowRect: (function (meta3dState, rect) {\n return UIManager$Meta3dUi.setNextWindowRect(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], rect);\n }),\n addFBOTexture: (function (meta3dState, texture, rect) {\n return UIManager$Meta3dUi.addFBOTexture(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], texture, rect);\n }),\n getFBOTexture: (function (meta3dState, textureID) {\n return UIManager$Meta3dUi.getFBOTexture(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), textureID);\n }),\n setFBOTexture: (function (meta3dState, textureID, texture) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.setFBOTexture(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), textureID, texture));\n }),\n getWindowBarHeight: (function (meta3dState) {\n return UIManager$Meta3dUi.getWindowBarHeight(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ]);\n }),\n getContext: (function (meta3dState) {\n return UIManager$Meta3dUi.getContext(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ]);\n }),\n button: (function (meta3dState, label, size) {\n return UIManager$Meta3dUi.button(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], label, size);\n }),\n setCursorPos: (function (meta3dState, pos) {\n return UIManager$Meta3dUi.setCursorPos(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], pos);\n }),\n loadImage: (function (param, param$1) {\n return UIManager$Meta3dUi.loadImage(partial_arg, param, param$1);\n }),\n asset: (function (param, param$1, param$2, param$3, param$4) {\n return UIManager$Meta3dUi.asset(partial_arg$1, param, param$1, param$2, param$3, param$4);\n }),\n handleDragDropTarget: (function (param, param$1) {\n return UIManager$Meta3dUi.handleDragDropTarget(partial_arg$2, param, param$1);\n }),\n menu: (function (param, param$1, param$2, param$3) {\n return UIManager$Meta3dUi.menu(partial_arg$3, param, param$1, param$2, param$3);\n }),\n sceneTree: (function (param, param$1, param$2, param$3, param$4, param$5) {\n return UIManager$Meta3dUi.sceneTree(partial_arg$4, param, param$1, param$2, param$3, param$4, param$5);\n }),\n inspector: (function (param, param$1, param$2, param$3, param$4, param$5, param$6) {\n return UIManager$Meta3dUi.inspector(partial_arg$5, param, param$1, param$2, param$3, param$4, param$5, param$6);\n }),\n switchButton: (function (param, param$1, param$2, param$3) {\n return UIManager$Meta3dUi.switchButton(partial_arg$6, param, param$1, param$2, param$3);\n }),\n imageButton: (function (param, param$1, param$2) {\n return UIManager$Meta3dUi.imageButton(partial_arg$7, param, param$1, param$2);\n }),\n init: UIManager$Meta3dUi.init,\n clear: UIManager$Meta3dUi.clear,\n getCurrentElementState: (function (meta3dState) {\n return UIManager$Meta3dUi.getCurrentElementState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"));\n }),\n setCurrentElementState: (function (meta3dState, currentElementState) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.setCurrentElementState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), currentElementState));\n })\n };\n}\n\nfunction createExtensionState(param) {\n return {\n elementFuncMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n elementStateMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n elementExecOrderMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n isShowMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n isStateChangeMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n skinContributeMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n uiControlContributeMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n uiControlStateMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n inputContributeMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n currentElementName: undefined,\n fboTextureMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined)\n };\n}\n\nfunction getExtensionLife(api, param) {\n return {\n onRegister: null,\n onRestore: NullableSt$Meta3dCommonlib.$$return(function (param, param$1) {\n return UIManager$Meta3dUi.restore(api, param, param$1);\n }),\n onDeepCopy: NullableSt$Meta3dCommonlib.$$return(function (param) {\n return UIManager$Meta3dUi.deepCopy(api, param);\n }),\n onStart: null,\n onInit: null,\n onUpdate: null\n };\n}\n\nexports.getExtensionService = getExtensionService;\nexports.createExtensionState = createExtensionState;\nexports.getExtensionLife = getExtensionLife;\n/* No side effect */\n\n\n//# sourceURL=webpack://Extension/./lib/js/src/Main.bs.js?"); +eval("\n\nvar UIManager$Meta3dUi = __webpack_require__(/*! ./UIManager.bs.js */ \"./lib/js/src/UIManager.bs.js\");\nvar NullableSt$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/NullableSt.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/NullableSt.bs.js\");\nvar ImmutableHashMap$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/hash_map/ImmutableHashMap.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/hash_map/ImmutableHashMap.bs.js\");\n\nfunction getExtensionService(api) {\n var partial_arg = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$1 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$2 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$3 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$4 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$5 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$6 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n var partial_arg$7 = [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ];\n return {\n registerElement: (function (meta3dState, elementContribute) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.registerElement(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), elementContribute));\n }),\n registerSkin: (function (meta3dState, skinContribute) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.registerSkin(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), skinContribute));\n }),\n registerUIControl: (function (meta3dState, uiControlContribute) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.registerUIControl(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), uiControlContribute));\n }),\n registerInput: (function (meta3dState, inputContribute) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.registerInput(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), inputContribute));\n }),\n render: (function (param, param$1, param$2) {\n return UIManager$Meta3dUi.render(api, param, param$1, param$2);\n }),\n show: (function (meta3dState, elementName) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.show(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), elementName));\n }),\n hide: (function (meta3dState, elementName) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.hide(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), elementName));\n }),\n isStateChange: (function (meta3dState, elementName) {\n return UIManager$Meta3dUi.isStateChange(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), elementName);\n }),\n getElementState: (function (meta3dState, elementName) {\n return UIManager$Meta3dUi.getElementState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), elementName);\n }),\n updateElementState: (function (meta3dState, updateElementStateFunc) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.updateElementState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), updateElementStateFunc));\n }),\n getSkin: (function (meta3dState, skinName) {\n return UIManager$Meta3dUi.getSkin(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), skinName);\n }),\n getUIControlFunc: (function (meta3dState, uiControlName) {\n return UIManager$Meta3dUi.getUIControlFuncExn(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), uiControlName);\n }),\n getInputFunc: (function (meta3dState, inputName) {\n return UIManager$Meta3dUi.getInputFunc(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), inputName);\n }),\n getUIControlState: (function (meta3dState, uiControlName) {\n return UIManager$Meta3dUi.getUIControlState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), uiControlName);\n }),\n setUIControlState: (function (meta3dState, uiControlName, uiControlState) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.setUIControlState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), uiControlName, uiControlState));\n }),\n setStyle: (function (meta3dState, style) {\n return UIManager$Meta3dUi.setStyle(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], style);\n }),\n beginWindow: (function (meta3dState, label) {\n return UIManager$Meta3dUi.beginWindow(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], label);\n }),\n endWindow: (function (meta3dState) {\n return UIManager$Meta3dUi.endWindow(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ]);\n }),\n beginChild: (function (meta3dState, label) {\n return UIManager$Meta3dUi.beginChild(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], label);\n }),\n endChild: (function (meta3dState) {\n return UIManager$Meta3dUi.endChild(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ]);\n }),\n setNextWindowRect: (function (meta3dState, rect) {\n return UIManager$Meta3dUi.setNextWindowRect(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], rect);\n }),\n addFBOTexture: (function (meta3dState, texture, rect) {\n return UIManager$Meta3dUi.addFBOTexture(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], texture, rect);\n }),\n getFBOTexture: (function (meta3dState, textureID) {\n return UIManager$Meta3dUi.getFBOTexture(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), textureID);\n }),\n setFBOTexture: (function (meta3dState, textureID, texture) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.setFBOTexture(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), textureID, texture));\n }),\n getWindowBarHeight: (function (meta3dState) {\n return UIManager$Meta3dUi.getWindowBarHeight(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ]);\n }),\n getContext: (function (meta3dState) {\n return UIManager$Meta3dUi.getContext(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ]);\n }),\n button: (function (meta3dState, label, size) {\n return UIManager$Meta3dUi.button(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], label, size);\n }),\n setCursorPos: (function (meta3dState, pos) {\n return UIManager$Meta3dUi.setCursorPos(meta3dState, [\n api,\n \"meta3d-imgui-renderer-protocol\"\n ], pos);\n }),\n loadImage: (function (param, param$1) {\n return UIManager$Meta3dUi.loadImage(partial_arg, param, param$1);\n }),\n asset: (function (param, param$1, param$2, param$3, param$4) {\n return UIManager$Meta3dUi.asset(partial_arg$1, param, param$1, param$2, param$3, param$4);\n }),\n handleDragDropTarget: (function (param, param$1) {\n return UIManager$Meta3dUi.handleDragDropTarget(partial_arg$2, param, param$1);\n }),\n menu: (function (param, param$1, param$2, param$3) {\n return UIManager$Meta3dUi.menu(partial_arg$3, param, param$1, param$2, param$3);\n }),\n tree: (function (param, param$1, param$2, param$3, param$4, param$5) {\n return UIManager$Meta3dUi.tree(partial_arg$4, param, param$1, param$2, param$3, param$4, param$5);\n }),\n inspector: (function (param, param$1, param$2, param$3, param$4, param$5, param$6) {\n return UIManager$Meta3dUi.inspector(partial_arg$5, param, param$1, param$2, param$3, param$4, param$5, param$6);\n }),\n switchButton: (function (param, param$1, param$2, param$3) {\n return UIManager$Meta3dUi.switchButton(partial_arg$6, param, param$1, param$2, param$3);\n }),\n imageButton: (function (param, param$1, param$2) {\n return UIManager$Meta3dUi.imageButton(partial_arg$7, param, param$1, param$2);\n }),\n init: UIManager$Meta3dUi.init,\n clear: UIManager$Meta3dUi.clear,\n getCurrentElementState: (function (meta3dState) {\n return UIManager$Meta3dUi.getCurrentElementState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"));\n }),\n setCurrentElementState: (function (meta3dState, currentElementState) {\n return api.setExtensionState(meta3dState, \"meta3d-ui-protocol\", UIManager$Meta3dUi.setCurrentElementState(api.getExtensionState(meta3dState, \"meta3d-ui-protocol\"), currentElementState));\n })\n };\n}\n\nfunction createExtensionState(param) {\n return {\n elementFuncMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n elementStateMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n elementExecOrderMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n isShowMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n isStateChangeMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n skinContributeMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n uiControlContributeMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n uiControlStateMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n inputContributeMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined),\n currentElementName: undefined,\n fboTextureMap: ImmutableHashMap$Meta3dCommonlib.createEmpty(undefined, undefined)\n };\n}\n\nfunction getExtensionLife(api, param) {\n return {\n onRegister: null,\n onRestore: NullableSt$Meta3dCommonlib.$$return(function (param, param$1) {\n return UIManager$Meta3dUi.restore(api, param, param$1);\n }),\n onDeepCopy: NullableSt$Meta3dCommonlib.$$return(function (param) {\n return UIManager$Meta3dUi.deepCopy(api, param);\n }),\n onStart: null,\n onInit: null,\n onUpdate: null\n };\n}\n\nexports.getExtensionService = getExtensionService;\nexports.createExtensionState = createExtensionState;\nexports.getExtensionLife = getExtensionLife;\n/* No side effect */\n\n\n//# sourceURL=webpack://Extension/./lib/js/src/Main.bs.js?"); /***/ }), @@ -346,7 +346,7 @@ eval("\n\nvar UIManager$Meta3dUi = __webpack_require__(/*! ./UIManager.bs.js */ \************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -eval("\n\nvar Curry = __webpack_require__(/*! rescript/lib/js/curry.js */ \"../../../../../node_modules/rescript/lib/js/curry.js\");\nvar Caml_obj = __webpack_require__(/*! rescript/lib/js/caml_obj.js */ \"../../../../../node_modules/rescript/lib/js/caml_obj.js\");\nvar Js_array = __webpack_require__(/*! rescript/lib/js/js_array.js */ \"../../../../../node_modules/rescript/lib/js/js_array.js\");\nvar Caml_option = __webpack_require__(/*! rescript/lib/js/caml_option.js */ \"../../../../../node_modules/rescript/lib/js/caml_option.js\");\nvar ArraySt$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/ArraySt.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/ArraySt.bs.js\");\nvar OptionSt$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/OptionSt.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/OptionSt.bs.js\");\nvar PromiseSt$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/PromiseSt.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/PromiseSt.bs.js\");\nvar NullableSt$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/NullableSt.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/NullableSt.bs.js\");\nvar ImmutableHashMap$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/hash_map/ImmutableHashMap.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/hash_map/ImmutableHashMap.bs.js\");\n\nfunction hide(state, elementName) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: ImmutableHashMap$Meta3dCommonlib.set(state.isShowMap, elementName, false),\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction show(state, elementName) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: ImmutableHashMap$Meta3dCommonlib.set(state.isShowMap, elementName, true),\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction _markStateChange(state, elementName) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: ImmutableHashMap$Meta3dCommonlib.set(state.isStateChangeMap, elementName, true),\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction _markStateNotChange(state, elementName) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: ImmutableHashMap$Meta3dCommonlib.set(state.isStateChangeMap, elementName, false),\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction _markAllStateNotChange(state, needMarkStateNotChangeIds) {\n return ArraySt$Meta3dCommonlib.reduceOneParam(needMarkStateNotChangeIds, _markStateNotChange, state);\n}\n\nfunction _getElementStateExn(param, elementName) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(param.elementStateMap, elementName);\n}\n\nfunction getElementState(param, elementName) {\n return ImmutableHashMap$Meta3dCommonlib.getNullable(param.elementStateMap, elementName);\n}\n\nfunction _setElementState(state, elementName, elementState) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: ImmutableHashMap$Meta3dCommonlib.set(state.elementStateMap, elementName, elementState),\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction _getElementExecOrderExn(state, elementName) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(state.elementExecOrderMap, elementName);\n}\n\nfunction _setElementExecOrder(state, elementName, execOrder) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: ImmutableHashMap$Meta3dCommonlib.set(state.elementExecOrderMap, elementName, execOrder),\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction _getCurrentElementName(state) {\n return OptionSt$Meta3dCommonlib.getExn(state.currentElementName);\n}\n\nfunction _setCurrentElementName(state, elementName) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: elementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction updateElementState(state, updateElementStateFunc) {\n var elementName = OptionSt$Meta3dCommonlib.getExn(state.currentElementName);\n var oldElementState = _getElementStateExn(state, elementName);\n var newElementState = Curry._1(updateElementStateFunc, oldElementState);\n if (Caml_obj.notequal(oldElementState, newElementState)) {\n return _setElementState(_markStateChange(state, elementName), elementName, newElementState);\n } else {\n return _markStateNotChange(state, elementName);\n }\n}\n\nfunction _exec(meta3dState, state) {\n var elementFuncMap = state.elementFuncMap;\n var __x = ImmutableHashMap$Meta3dCommonlib.entries(state.isShowMap);\n return ArraySt$Meta3dCommonlib.traverseReducePromiseM(Js_array.sortInPlaceWith((function (param, param$1) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(state.elementExecOrderMap, param[0]) - ImmutableHashMap$Meta3dCommonlib.getExn(state.elementExecOrderMap, param$1[0]) | 0;\n }), __x), (function (param, param$1) {\n var needMarkStateNotChangeIds = param[1];\n var meta3dState = param[0];\n if (!param$1[1]) {\n return Promise.resolve([\n meta3dState,\n needMarkStateNotChangeIds\n ]);\n }\n var elementName = param$1[0];\n var elementFunc = ImmutableHashMap$Meta3dCommonlib.getExn(elementFuncMap, elementName);\n return PromiseSt$Meta3dCommonlib.map(elementFunc(meta3dState, _getElementStateExn(state, elementName)), (function (meta3dState) {\n return [\n meta3dState,\n ArraySt$Meta3dCommonlib.push(needMarkStateNotChangeIds, elementName)\n ];\n }));\n }), [\n meta3dState,\n []\n ]);\n}\n\nfunction _invokeIMGUIRenderFunc(meta3dState, invokeFunc, param) {\n var imguiRendererExtensionProtocolName = param[1];\n var api = param[0];\n var imguiRendererState = api.getExtensionState(meta3dState, imguiRendererExtensionProtocolName);\n var imguiRendererService = api.getExtensionService(meta3dState, imguiRendererExtensionProtocolName);\n var imguiRendererState$1 = invokeFunc(imguiRendererState, imguiRendererService);\n return api.setExtensionState(meta3dState, imguiRendererExtensionProtocolName, imguiRendererState$1);\n}\n\nfunction _invokeIMGUIRenderFuncWithParam(meta3dState, invokeFunc, param) {\n var imguiRendererExtensionProtocolName = param[1];\n var api = param[0];\n var imguiRendererState = api.getExtensionState(meta3dState, imguiRendererExtensionProtocolName);\n var imguiRendererService = api.getExtensionService(meta3dState, imguiRendererExtensionProtocolName);\n var match = invokeFunc(imguiRendererState, imguiRendererService);\n var meta3dState$1 = api.setExtensionState(meta3dState, imguiRendererExtensionProtocolName, match[0]);\n return [\n meta3dState$1,\n match[1]\n ];\n}\n\nfunction _invokeIMGUIRenderFuncReturnData(meta3dState, invokeFunc, param) {\n var imguiRendererExtensionProtocolName = param[1];\n var api = param[0];\n var imguiRendererState = api.getExtensionState(meta3dState, imguiRendererExtensionProtocolName);\n var imguiRendererService = api.getExtensionService(meta3dState, imguiRendererExtensionProtocolName);\n return invokeFunc(imguiRendererState, imguiRendererService);\n}\n\nfunction render(api, meta3dState, param, time) {\n var imguiRendererExtensionProtocolName = param[1];\n var uiExtensionProtocolName = param[0];\n var state = api.getExtensionState(meta3dState, uiExtensionProtocolName);\n var meta3dState$1 = api.setExtensionState(meta3dState, uiExtensionProtocolName, state);\n var meta3dState$2 = _invokeIMGUIRenderFunc(meta3dState$1, (function (imguiRendererState, imguiRendererService) {\n return imguiRendererService.beforeExec(imguiRendererState, time);\n }), [\n api,\n imguiRendererExtensionProtocolName\n ]);\n return PromiseSt$Meta3dCommonlib.map(PromiseSt$Meta3dCommonlib.map(_exec(meta3dState$2, state), (function (param) {\n var meta3dState = param[0];\n var state = api.getExtensionState(meta3dState, uiExtensionProtocolName);\n var state$1 = _markAllStateNotChange(state, param[1]);\n return api.setExtensionState(meta3dState, uiExtensionProtocolName, state$1);\n })), (function (meta3dState) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n Curry._1(imguiRendererService.afterExec, undefined);\n Curry._1(imguiRendererService.render, undefined);\n return imguiRendererState;\n }), [\n api,\n imguiRendererExtensionProtocolName\n ]);\n }));\n}\n\nfunction _setElementFunc(state, elementName, elementFunc) {\n return {\n elementFuncMap: ImmutableHashMap$Meta3dCommonlib.set(state.elementFuncMap, elementName, elementFunc),\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction registerElement(state, param) {\n var elementName = param.elementName;\n return _markStateChange(show(_setElementExecOrder(_setElementState(_setElementFunc(_setCurrentElementName(state, elementName), elementName, param.elementFunc), elementName, param.elementState), elementName, param.execOrder), elementName), elementName);\n}\n\nfunction registerSkin(state, skinContribute) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: ImmutableHashMap$Meta3dCommonlib.set(state.skinContributeMap, skinContribute.skinName, skinContribute),\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction registerUIControl(state, uiControlContribute) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: ImmutableHashMap$Meta3dCommonlib.set(state.uiControlContributeMap, uiControlContribute.uiControlName, uiControlContribute),\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction registerInput(state, inputContribute) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: ImmutableHashMap$Meta3dCommonlib.set(state.inputContributeMap, inputContribute.inputName, inputContribute),\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction getSkin(state, skinName) {\n return ImmutableHashMap$Meta3dCommonlib.getNullable(state.skinContributeMap, skinName);\n}\n\nfunction _getUIControlExn(state, uiControlName) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(state.uiControlContributeMap, uiControlName);\n}\n\nfunction getUIControlFuncExn(state, uiControlName) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(state.uiControlContributeMap, uiControlName).func;\n}\n\nfunction getInputFunc(state, inputName) {\n return NullableSt$Meta3dCommonlib.map(ImmutableHashMap$Meta3dCommonlib.getNullable(state.inputContributeMap, inputName), (function (param) {\n return param.func;\n }));\n}\n\nfunction getUIControlState(state, uiControlName) {\n return ImmutableHashMap$Meta3dCommonlib.getNullable(state.uiControlStateMap, uiControlName);\n}\n\nfunction setUIControlState(state, uiControlName, uiControlState) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: ImmutableHashMap$Meta3dCommonlib.set(state.uiControlStateMap, uiControlName, uiControlState),\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction isStateChange(state, elementName) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(state.isStateChangeMap, elementName);\n}\n\nfunction setStyle(meta3dState, data, style) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return imguiRendererService.setStyle(imguiRendererState, style);\n }), data);\n}\n\nfunction beginWindow(meta3dState, data, label) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.beginWindow(label);\n return imguiRendererState;\n }), data);\n}\n\nfunction endWindow(meta3dState, data) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n Curry._1(imguiRendererService.endWindow, undefined);\n return imguiRendererState;\n }), data);\n}\n\nfunction beginChild(meta3dState, data, label) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.beginChild(label);\n return imguiRendererState;\n }), data);\n}\n\nfunction endChild(meta3dState, data) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n Curry._1(imguiRendererService.endChild, undefined);\n return imguiRendererState;\n }), data);\n}\n\nfunction setNextWindowRect(meta3dState, data, rect) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.setNextWindowRect(rect);\n return imguiRendererState;\n }), data);\n}\n\nfunction getFBOTexture(state, textureID) {\n return ImmutableHashMap$Meta3dCommonlib.getNullable(state.fboTextureMap, textureID);\n}\n\nfunction setFBOTexture(state, textureID, texture) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: ImmutableHashMap$Meta3dCommonlib.set(state.fboTextureMap, textureID, texture)\n };\n}\n\nfunction addFBOTexture(meta3dState, data, texture, rect) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.addFBOTexture(texture, rect);\n return imguiRendererState;\n }), data);\n}\n\nfunction getWindowBarHeight(meta3dState, data) {\n return _invokeIMGUIRenderFuncReturnData(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return Curry._1(imguiRendererService.getWindowBarHeight, undefined);\n }), data);\n}\n\nfunction getContext(meta3dState, data) {\n return _invokeIMGUIRenderFuncReturnData(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return Curry._1(imguiRendererService.getContext, undefined);\n }), data);\n}\n\nfunction button(meta3dState, data, label, size) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.button(label, size)\n ];\n }), data);\n}\n\nfunction setCursorPos(meta3dState, data, pos) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.setCursorPos(pos);\n return imguiRendererState;\n }), data);\n}\n\nfunction loadImage(data, meta3dState, imageBase64Src) {\n return _invokeIMGUIRenderFuncReturnData(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return imguiRendererService.loadImage(imageBase64Src);\n }), data);\n}\n\nfunction asset(data, meta3dState, fileTexture, files, label, rect) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.asset(fileTexture, files, label, rect)\n ];\n }), data);\n}\n\nfunction handleDragDropTarget(data, meta3dState, type_) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.handleDragDropTarget(type_)\n ];\n }), data);\n}\n\nfunction menu(data, meta3dState, allLabels, windowName, rect) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.menu(allLabels, windowName, rect)\n ];\n }), data);\n}\n\nfunction sceneTree(data, meta3dState, sceneTreeData, lastSceneTreeSelectedData, textures, windowName, rect) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.sceneTree(sceneTreeData, lastSceneTreeSelectedData, textures, windowName, rect)\n ];\n }), data);\n}\n\nfunction inspector(data, meta3dState, gameObjectName, localPosition, localEulerAngles, localScale, windowName, rect) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.inspector(gameObjectName, localPosition, localEulerAngles, localScale, windowName, rect)\n ];\n }), data);\n}\n\nfunction switchButton(data, meta3dState, isRun, textures, size) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.switchButton(isRun, textures, size)\n ];\n }), data);\n}\n\nfunction imageButton(data, meta3dState, texture, size) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.imageButton(texture, size)\n ];\n }), data);\n}\n\nfunction clear(meta3dState, data, clearColor) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.clear(clearColor);\n return imguiRendererState;\n }), data);\n}\n\nfunction _getCurrentElementStateOption(state) {\n return OptionSt$Meta3dCommonlib.bind(state.currentElementName, (function (currentElementName) {\n return ImmutableHashMap$Meta3dCommonlib.get(state.elementStateMap, currentElementName);\n }));\n}\n\nfunction getCurrentElementState(state) {\n return getElementState(state, OptionSt$Meta3dCommonlib.getExn(state.currentElementName));\n}\n\nfunction setCurrentElementState(state, currentElementState) {\n return _setElementState(state, OptionSt$Meta3dCommonlib.getExn(state.currentElementName), currentElementState);\n}\n\nfunction init(meta3dState, param, isInitEvent, isDebug, canvas) {\n var imguiRendererExtensionProtocolName = param[1];\n var api = param[0];\n var uiExtensionProtocolName = \"meta3d-ui-protocol\";\n var uiState = api.getExtensionState(meta3dState, uiExtensionProtocolName);\n var elementState = _getCurrentElementStateOption(uiState);\n var meta3dState$1;\n if (elementState !== undefined) {\n var eventExtensionProtocolName = \"meta3d-event-protocol\";\n var eventService = api.getExtensionService(meta3dState, eventExtensionProtocolName);\n var eventState = api.getExtensionState(meta3dState, eventExtensionProtocolName);\n var elementState$1 = ArraySt$Meta3dCommonlib.reduceOneParam(Curry._1(eventService.getAllActionContributes, eventState), (function (elementState, param) {\n return ImmutableHashMap$Meta3dCommonlib.set(elementState, param[0], Curry._1(param[1].createState, meta3dState));\n }), Caml_option.valFromOption(elementState));\n var uiState$1 = setCurrentElementState(uiState, elementState$1);\n meta3dState$1 = api.setExtensionState(meta3dState, uiExtensionProtocolName, uiState$1);\n } else {\n meta3dState$1 = meta3dState;\n }\n var imguiRendererState = api.getExtensionState(meta3dState$1, imguiRendererExtensionProtocolName);\n var imguiRendererService = api.getExtensionService(meta3dState$1, imguiRendererExtensionProtocolName);\n return PromiseSt$Meta3dCommonlib.map(imguiRendererService.init(imguiRendererState, isInitEvent, isDebug, canvas), (function (imguiRendererState) {\n return api.setExtensionState(meta3dState$1, imguiRendererExtensionProtocolName, imguiRendererState);\n }));\n}\n\nfunction restore(api, currentMeta3dState, targetMeta3dState) {\n var eventExtensionProtocolName = \"meta3d-event-protocol\";\n var uiExtensionProtocolName = \"meta3d-ui-protocol\";\n var eventService = api.getExtensionService(targetMeta3dState, eventExtensionProtocolName);\n var eventState = api.getExtensionState(targetMeta3dState, eventExtensionProtocolName);\n var currentUIState = api.getExtensionState(currentMeta3dState, uiExtensionProtocolName);\n var currentElementState = NullableSt$Meta3dCommonlib.getExn(getElementState(currentUIState, OptionSt$Meta3dCommonlib.getExn(currentUIState.currentElementName)));\n var targetUIState = api.getExtensionState(targetMeta3dState, uiExtensionProtocolName);\n var targetElementState = ArraySt$Meta3dCommonlib.reduceOneParam(Curry._1(eventService.getAllActionContributes, eventState), (function (targetElementState, param) {\n var actionName = param[0];\n return NullableSt$Meta3dCommonlib.getWithDefault(NullableSt$Meta3dCommonlib.map(param[1].restore, (function (restore) {\n return ImmutableHashMap$Meta3dCommonlib.set(targetElementState, actionName, Curry._2(restore, ImmutableHashMap$Meta3dCommonlib.getExn(currentElementState, actionName), ImmutableHashMap$Meta3dCommonlib.getExn(targetElementState, actionName)));\n })), targetElementState);\n }), NullableSt$Meta3dCommonlib.getExn(getElementState(targetUIState, OptionSt$Meta3dCommonlib.getExn(targetUIState.currentElementName))));\n var targetUIState$1 = setCurrentElementState(targetUIState, targetElementState);\n return api.setExtensionState(targetMeta3dState, uiExtensionProtocolName, targetUIState$1);\n}\n\nfunction deepCopy(api, meta3dState) {\n var eventExtensionProtocolName = \"meta3d-event-protocol\";\n var uiExtensionProtocolName = \"meta3d-ui-protocol\";\n var eventService = api.getExtensionService(meta3dState, eventExtensionProtocolName);\n var eventState = api.getExtensionState(meta3dState, eventExtensionProtocolName);\n var uiState = api.getExtensionState(meta3dState, uiExtensionProtocolName);\n var elementState = ArraySt$Meta3dCommonlib.reduceOneParam(Curry._1(eventService.getAllActionContributes, eventState), (function (elementState, param) {\n var actionName = param[0];\n return NullableSt$Meta3dCommonlib.getWithDefault(NullableSt$Meta3dCommonlib.map(param[1].deepCopy, (function (deepCopy) {\n return ImmutableHashMap$Meta3dCommonlib.set(elementState, actionName, Curry._1(deepCopy, ImmutableHashMap$Meta3dCommonlib.getExn(elementState, actionName)));\n })), elementState);\n }), NullableSt$Meta3dCommonlib.getExn(getElementState(uiState, OptionSt$Meta3dCommonlib.getExn(uiState.currentElementName))));\n var uiState$1 = setCurrentElementState(uiState, elementState);\n return api.setExtensionState(meta3dState, uiExtensionProtocolName, uiState$1);\n}\n\nexports.hide = hide;\nexports.show = show;\nexports._markStateChange = _markStateChange;\nexports._markStateNotChange = _markStateNotChange;\nexports._markAllStateNotChange = _markAllStateNotChange;\nexports._getElementStateExn = _getElementStateExn;\nexports.getElementState = getElementState;\nexports._setElementState = _setElementState;\nexports._getElementExecOrderExn = _getElementExecOrderExn;\nexports._setElementExecOrder = _setElementExecOrder;\nexports._getCurrentElementName = _getCurrentElementName;\nexports._setCurrentElementName = _setCurrentElementName;\nexports.updateElementState = updateElementState;\nexports._exec = _exec;\nexports._invokeIMGUIRenderFunc = _invokeIMGUIRenderFunc;\nexports._invokeIMGUIRenderFuncWithParam = _invokeIMGUIRenderFuncWithParam;\nexports._invokeIMGUIRenderFuncReturnData = _invokeIMGUIRenderFuncReturnData;\nexports.render = render;\nexports._setElementFunc = _setElementFunc;\nexports.registerElement = registerElement;\nexports.registerSkin = registerSkin;\nexports.registerUIControl = registerUIControl;\nexports.registerInput = registerInput;\nexports.getSkin = getSkin;\nexports._getUIControlExn = _getUIControlExn;\nexports.getUIControlFuncExn = getUIControlFuncExn;\nexports.getInputFunc = getInputFunc;\nexports.getUIControlState = getUIControlState;\nexports.setUIControlState = setUIControlState;\nexports.isStateChange = isStateChange;\nexports.setStyle = setStyle;\nexports.beginWindow = beginWindow;\nexports.endWindow = endWindow;\nexports.beginChild = beginChild;\nexports.endChild = endChild;\nexports.setNextWindowRect = setNextWindowRect;\nexports.getFBOTexture = getFBOTexture;\nexports.setFBOTexture = setFBOTexture;\nexports.addFBOTexture = addFBOTexture;\nexports.getWindowBarHeight = getWindowBarHeight;\nexports.getContext = getContext;\nexports.button = button;\nexports.setCursorPos = setCursorPos;\nexports.loadImage = loadImage;\nexports.asset = asset;\nexports.handleDragDropTarget = handleDragDropTarget;\nexports.menu = menu;\nexports.sceneTree = sceneTree;\nexports.inspector = inspector;\nexports.switchButton = switchButton;\nexports.imageButton = imageButton;\nexports.clear = clear;\nexports._getCurrentElementStateOption = _getCurrentElementStateOption;\nexports.getCurrentElementState = getCurrentElementState;\nexports.setCurrentElementState = setCurrentElementState;\nexports.init = init;\nexports.restore = restore;\nexports.deepCopy = deepCopy;\n/* No side effect */\n\n\n//# sourceURL=webpack://Extension/./lib/js/src/UIManager.bs.js?"); +eval("\n\nvar Curry = __webpack_require__(/*! rescript/lib/js/curry.js */ \"../../../../../node_modules/rescript/lib/js/curry.js\");\nvar Caml_obj = __webpack_require__(/*! rescript/lib/js/caml_obj.js */ \"../../../../../node_modules/rescript/lib/js/caml_obj.js\");\nvar Js_array = __webpack_require__(/*! rescript/lib/js/js_array.js */ \"../../../../../node_modules/rescript/lib/js/js_array.js\");\nvar Caml_option = __webpack_require__(/*! rescript/lib/js/caml_option.js */ \"../../../../../node_modules/rescript/lib/js/caml_option.js\");\nvar ArraySt$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/ArraySt.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/ArraySt.bs.js\");\nvar OptionSt$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/OptionSt.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/OptionSt.bs.js\");\nvar PromiseSt$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/PromiseSt.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/PromiseSt.bs.js\");\nvar NullableSt$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/NullableSt.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/NullableSt.bs.js\");\nvar ImmutableHashMap$Meta3dCommonlib = __webpack_require__(/*! meta3d-commonlib/lib/js/src/structure/hash_map/ImmutableHashMap.bs.js */ \"../../../../../defaults/meta3d-commonlib/lib/js/src/structure/hash_map/ImmutableHashMap.bs.js\");\n\nfunction hide(state, elementName) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: ImmutableHashMap$Meta3dCommonlib.set(state.isShowMap, elementName, false),\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction show(state, elementName) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: ImmutableHashMap$Meta3dCommonlib.set(state.isShowMap, elementName, true),\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction _markStateChange(state, elementName) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: ImmutableHashMap$Meta3dCommonlib.set(state.isStateChangeMap, elementName, true),\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction _markStateNotChange(state, elementName) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: ImmutableHashMap$Meta3dCommonlib.set(state.isStateChangeMap, elementName, false),\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction _markAllStateNotChange(state, needMarkStateNotChangeIds) {\n return ArraySt$Meta3dCommonlib.reduceOneParam(needMarkStateNotChangeIds, _markStateNotChange, state);\n}\n\nfunction _getElementStateExn(param, elementName) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(param.elementStateMap, elementName);\n}\n\nfunction getElementState(param, elementName) {\n return ImmutableHashMap$Meta3dCommonlib.getNullable(param.elementStateMap, elementName);\n}\n\nfunction _setElementState(state, elementName, elementState) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: ImmutableHashMap$Meta3dCommonlib.set(state.elementStateMap, elementName, elementState),\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction _getElementExecOrderExn(state, elementName) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(state.elementExecOrderMap, elementName);\n}\n\nfunction _setElementExecOrder(state, elementName, execOrder) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: ImmutableHashMap$Meta3dCommonlib.set(state.elementExecOrderMap, elementName, execOrder),\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction _getCurrentElementName(state) {\n return OptionSt$Meta3dCommonlib.getExn(state.currentElementName);\n}\n\nfunction _setCurrentElementName(state, elementName) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: elementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction updateElementState(state, updateElementStateFunc) {\n var elementName = OptionSt$Meta3dCommonlib.getExn(state.currentElementName);\n var oldElementState = _getElementStateExn(state, elementName);\n var newElementState = Curry._1(updateElementStateFunc, oldElementState);\n if (Caml_obj.notequal(oldElementState, newElementState)) {\n return _setElementState(_markStateChange(state, elementName), elementName, newElementState);\n } else {\n return _markStateNotChange(state, elementName);\n }\n}\n\nfunction _exec(meta3dState, state) {\n var elementFuncMap = state.elementFuncMap;\n var __x = ImmutableHashMap$Meta3dCommonlib.entries(state.isShowMap);\n return ArraySt$Meta3dCommonlib.traverseReducePromiseM(Js_array.sortInPlaceWith((function (param, param$1) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(state.elementExecOrderMap, param[0]) - ImmutableHashMap$Meta3dCommonlib.getExn(state.elementExecOrderMap, param$1[0]) | 0;\n }), __x), (function (param, param$1) {\n var needMarkStateNotChangeIds = param[1];\n var meta3dState = param[0];\n if (!param$1[1]) {\n return Promise.resolve([\n meta3dState,\n needMarkStateNotChangeIds\n ]);\n }\n var elementName = param$1[0];\n var elementFunc = ImmutableHashMap$Meta3dCommonlib.getExn(elementFuncMap, elementName);\n return PromiseSt$Meta3dCommonlib.map(elementFunc(meta3dState, _getElementStateExn(state, elementName)), (function (meta3dState) {\n return [\n meta3dState,\n ArraySt$Meta3dCommonlib.push(needMarkStateNotChangeIds, elementName)\n ];\n }));\n }), [\n meta3dState,\n []\n ]);\n}\n\nfunction _invokeIMGUIRenderFunc(meta3dState, invokeFunc, param) {\n var imguiRendererExtensionProtocolName = param[1];\n var api = param[0];\n var imguiRendererState = api.getExtensionState(meta3dState, imguiRendererExtensionProtocolName);\n var imguiRendererService = api.getExtensionService(meta3dState, imguiRendererExtensionProtocolName);\n var imguiRendererState$1 = invokeFunc(imguiRendererState, imguiRendererService);\n return api.setExtensionState(meta3dState, imguiRendererExtensionProtocolName, imguiRendererState$1);\n}\n\nfunction _invokeIMGUIRenderFuncWithParam(meta3dState, invokeFunc, param) {\n var imguiRendererExtensionProtocolName = param[1];\n var api = param[0];\n var imguiRendererState = api.getExtensionState(meta3dState, imguiRendererExtensionProtocolName);\n var imguiRendererService = api.getExtensionService(meta3dState, imguiRendererExtensionProtocolName);\n var match = invokeFunc(imguiRendererState, imguiRendererService);\n var meta3dState$1 = api.setExtensionState(meta3dState, imguiRendererExtensionProtocolName, match[0]);\n return [\n meta3dState$1,\n match[1]\n ];\n}\n\nfunction _invokeIMGUIRenderFuncReturnData(meta3dState, invokeFunc, param) {\n var imguiRendererExtensionProtocolName = param[1];\n var api = param[0];\n var imguiRendererState = api.getExtensionState(meta3dState, imguiRendererExtensionProtocolName);\n var imguiRendererService = api.getExtensionService(meta3dState, imguiRendererExtensionProtocolName);\n return invokeFunc(imguiRendererState, imguiRendererService);\n}\n\nfunction render(api, meta3dState, param, time) {\n var imguiRendererExtensionProtocolName = param[1];\n var uiExtensionProtocolName = param[0];\n var state = api.getExtensionState(meta3dState, uiExtensionProtocolName);\n var meta3dState$1 = api.setExtensionState(meta3dState, uiExtensionProtocolName, state);\n var meta3dState$2 = _invokeIMGUIRenderFunc(meta3dState$1, (function (imguiRendererState, imguiRendererService) {\n return imguiRendererService.beforeExec(imguiRendererState, time);\n }), [\n api,\n imguiRendererExtensionProtocolName\n ]);\n return PromiseSt$Meta3dCommonlib.map(PromiseSt$Meta3dCommonlib.map(_exec(meta3dState$2, state), (function (param) {\n var meta3dState = param[0];\n var state = api.getExtensionState(meta3dState, uiExtensionProtocolName);\n var state$1 = _markAllStateNotChange(state, param[1]);\n return api.setExtensionState(meta3dState, uiExtensionProtocolName, state$1);\n })), (function (meta3dState) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n Curry._1(imguiRendererService.afterExec, undefined);\n Curry._1(imguiRendererService.render, undefined);\n return imguiRendererState;\n }), [\n api,\n imguiRendererExtensionProtocolName\n ]);\n }));\n}\n\nfunction _setElementFunc(state, elementName, elementFunc) {\n return {\n elementFuncMap: ImmutableHashMap$Meta3dCommonlib.set(state.elementFuncMap, elementName, elementFunc),\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction registerElement(state, param) {\n var elementName = param.elementName;\n return _markStateChange(show(_setElementExecOrder(_setElementState(_setElementFunc(_setCurrentElementName(state, elementName), elementName, param.elementFunc), elementName, param.elementState), elementName, param.execOrder), elementName), elementName);\n}\n\nfunction registerSkin(state, skinContribute) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: ImmutableHashMap$Meta3dCommonlib.set(state.skinContributeMap, skinContribute.skinName, skinContribute),\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction registerUIControl(state, uiControlContribute) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: ImmutableHashMap$Meta3dCommonlib.set(state.uiControlContributeMap, uiControlContribute.uiControlName, uiControlContribute),\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction registerInput(state, inputContribute) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: ImmutableHashMap$Meta3dCommonlib.set(state.inputContributeMap, inputContribute.inputName, inputContribute),\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction getSkin(state, skinName) {\n return ImmutableHashMap$Meta3dCommonlib.getNullable(state.skinContributeMap, skinName);\n}\n\nfunction _getUIControlExn(state, uiControlName) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(state.uiControlContributeMap, uiControlName);\n}\n\nfunction getUIControlFuncExn(state, uiControlName) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(state.uiControlContributeMap, uiControlName).func;\n}\n\nfunction getInputFunc(state, inputName) {\n return NullableSt$Meta3dCommonlib.map(ImmutableHashMap$Meta3dCommonlib.getNullable(state.inputContributeMap, inputName), (function (param) {\n return param.func;\n }));\n}\n\nfunction getUIControlState(state, uiControlName) {\n return ImmutableHashMap$Meta3dCommonlib.getNullable(state.uiControlStateMap, uiControlName);\n}\n\nfunction setUIControlState(state, uiControlName, uiControlState) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: ImmutableHashMap$Meta3dCommonlib.set(state.uiControlStateMap, uiControlName, uiControlState),\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: state.fboTextureMap\n };\n}\n\nfunction isStateChange(state, elementName) {\n return ImmutableHashMap$Meta3dCommonlib.getExn(state.isStateChangeMap, elementName);\n}\n\nfunction setStyle(meta3dState, data, style) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return imguiRendererService.setStyle(imguiRendererState, style);\n }), data);\n}\n\nfunction beginWindow(meta3dState, data, label) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.beginWindow(label);\n return imguiRendererState;\n }), data);\n}\n\nfunction endWindow(meta3dState, data) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n Curry._1(imguiRendererService.endWindow, undefined);\n return imguiRendererState;\n }), data);\n}\n\nfunction beginChild(meta3dState, data, label) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.beginChild(label);\n return imguiRendererState;\n }), data);\n}\n\nfunction endChild(meta3dState, data) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n Curry._1(imguiRendererService.endChild, undefined);\n return imguiRendererState;\n }), data);\n}\n\nfunction setNextWindowRect(meta3dState, data, rect) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.setNextWindowRect(rect);\n return imguiRendererState;\n }), data);\n}\n\nfunction getFBOTexture(state, textureID) {\n return ImmutableHashMap$Meta3dCommonlib.getNullable(state.fboTextureMap, textureID);\n}\n\nfunction setFBOTexture(state, textureID, texture) {\n return {\n elementFuncMap: state.elementFuncMap,\n elementStateMap: state.elementStateMap,\n elementExecOrderMap: state.elementExecOrderMap,\n isShowMap: state.isShowMap,\n isStateChangeMap: state.isStateChangeMap,\n skinContributeMap: state.skinContributeMap,\n uiControlContributeMap: state.uiControlContributeMap,\n uiControlStateMap: state.uiControlStateMap,\n inputContributeMap: state.inputContributeMap,\n currentElementName: state.currentElementName,\n fboTextureMap: ImmutableHashMap$Meta3dCommonlib.set(state.fboTextureMap, textureID, texture)\n };\n}\n\nfunction addFBOTexture(meta3dState, data, texture, rect) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.addFBOTexture(texture, rect);\n return imguiRendererState;\n }), data);\n}\n\nfunction getWindowBarHeight(meta3dState, data) {\n return _invokeIMGUIRenderFuncReturnData(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return Curry._1(imguiRendererService.getWindowBarHeight, undefined);\n }), data);\n}\n\nfunction getContext(meta3dState, data) {\n return _invokeIMGUIRenderFuncReturnData(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return Curry._1(imguiRendererService.getContext, undefined);\n }), data);\n}\n\nfunction button(meta3dState, data, label, size) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.button(label, size)\n ];\n }), data);\n}\n\nfunction setCursorPos(meta3dState, data, pos) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.setCursorPos(pos);\n return imguiRendererState;\n }), data);\n}\n\nfunction loadImage(data, meta3dState, imageBase64Src) {\n return _invokeIMGUIRenderFuncReturnData(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return imguiRendererService.loadImage(imageBase64Src);\n }), data);\n}\n\nfunction asset(data, meta3dState, fileTexture, files, label, rect) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.asset(fileTexture, files, label, rect)\n ];\n }), data);\n}\n\nfunction handleDragDropTarget(data, meta3dState, type_) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.handleDragDropTarget(type_)\n ];\n }), data);\n}\n\nfunction menu(data, meta3dState, allLabels, windowName, rect) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.menu(allLabels, windowName, rect)\n ];\n }), data);\n}\n\nfunction tree(data, meta3dState, treeData, treeNodeLabel, lastTreeSelectedData, windowName, rect) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.tree(treeData, treeNodeLabel, lastTreeSelectedData, windowName, rect)\n ];\n }), data);\n}\n\nfunction inspector(data, meta3dState, gameObjectName, localPosition, localEulerAngles, localScale, windowName, rect) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.inspector(gameObjectName, localPosition, localEulerAngles, localScale, windowName, rect)\n ];\n }), data);\n}\n\nfunction switchButton(data, meta3dState, isRun, textures, size) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.switchButton(isRun, textures, size)\n ];\n }), data);\n}\n\nfunction imageButton(data, meta3dState, texture, size) {\n return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) {\n return [\n imguiRendererState,\n imguiRendererService.imageButton(texture, size)\n ];\n }), data);\n}\n\nfunction clear(meta3dState, data, clearColor) {\n return _invokeIMGUIRenderFunc(meta3dState, (function (imguiRendererState, imguiRendererService) {\n imguiRendererService.clear(clearColor);\n return imguiRendererState;\n }), data);\n}\n\nfunction _getCurrentElementStateOption(state) {\n return OptionSt$Meta3dCommonlib.bind(state.currentElementName, (function (currentElementName) {\n return ImmutableHashMap$Meta3dCommonlib.get(state.elementStateMap, currentElementName);\n }));\n}\n\nfunction getCurrentElementState(state) {\n return getElementState(state, OptionSt$Meta3dCommonlib.getExn(state.currentElementName));\n}\n\nfunction setCurrentElementState(state, currentElementState) {\n return _setElementState(state, OptionSt$Meta3dCommonlib.getExn(state.currentElementName), currentElementState);\n}\n\nfunction init(meta3dState, param, isInitEvent, isDebug, canvas) {\n var imguiRendererExtensionProtocolName = param[1];\n var api = param[0];\n var uiExtensionProtocolName = \"meta3d-ui-protocol\";\n var uiState = api.getExtensionState(meta3dState, uiExtensionProtocolName);\n var elementState = _getCurrentElementStateOption(uiState);\n var meta3dState$1;\n if (elementState !== undefined) {\n var eventExtensionProtocolName = \"meta3d-event-protocol\";\n var eventService = api.getExtensionService(meta3dState, eventExtensionProtocolName);\n var eventState = api.getExtensionState(meta3dState, eventExtensionProtocolName);\n var elementState$1 = ArraySt$Meta3dCommonlib.reduceOneParam(Curry._1(eventService.getAllActionContributes, eventState), (function (elementState, param) {\n return ImmutableHashMap$Meta3dCommonlib.set(elementState, param[0], Curry._1(param[1].createState, meta3dState));\n }), Caml_option.valFromOption(elementState));\n var uiState$1 = setCurrentElementState(uiState, elementState$1);\n meta3dState$1 = api.setExtensionState(meta3dState, uiExtensionProtocolName, uiState$1);\n } else {\n meta3dState$1 = meta3dState;\n }\n var imguiRendererState = api.getExtensionState(meta3dState$1, imguiRendererExtensionProtocolName);\n var imguiRendererService = api.getExtensionService(meta3dState$1, imguiRendererExtensionProtocolName);\n return PromiseSt$Meta3dCommonlib.map(imguiRendererService.init(imguiRendererState, isInitEvent, isDebug, canvas), (function (imguiRendererState) {\n return api.setExtensionState(meta3dState$1, imguiRendererExtensionProtocolName, imguiRendererState);\n }));\n}\n\nfunction restore(api, currentMeta3dState, targetMeta3dState) {\n var eventExtensionProtocolName = \"meta3d-event-protocol\";\n var uiExtensionProtocolName = \"meta3d-ui-protocol\";\n var eventService = api.getExtensionService(targetMeta3dState, eventExtensionProtocolName);\n var eventState = api.getExtensionState(targetMeta3dState, eventExtensionProtocolName);\n var currentUIState = api.getExtensionState(currentMeta3dState, uiExtensionProtocolName);\n var currentElementState = NullableSt$Meta3dCommonlib.getExn(getElementState(currentUIState, OptionSt$Meta3dCommonlib.getExn(currentUIState.currentElementName)));\n var targetUIState = api.getExtensionState(targetMeta3dState, uiExtensionProtocolName);\n var targetElementState = ArraySt$Meta3dCommonlib.reduceOneParam(Curry._1(eventService.getAllActionContributes, eventState), (function (targetElementState, param) {\n var actionName = param[0];\n return NullableSt$Meta3dCommonlib.getWithDefault(NullableSt$Meta3dCommonlib.map(param[1].restore, (function (restore) {\n return ImmutableHashMap$Meta3dCommonlib.set(targetElementState, actionName, Curry._2(restore, ImmutableHashMap$Meta3dCommonlib.getExn(currentElementState, actionName), ImmutableHashMap$Meta3dCommonlib.getExn(targetElementState, actionName)));\n })), targetElementState);\n }), NullableSt$Meta3dCommonlib.getExn(getElementState(targetUIState, OptionSt$Meta3dCommonlib.getExn(targetUIState.currentElementName))));\n var targetUIState$1 = setCurrentElementState(targetUIState, targetElementState);\n return api.setExtensionState(targetMeta3dState, uiExtensionProtocolName, targetUIState$1);\n}\n\nfunction deepCopy(api, meta3dState) {\n var eventExtensionProtocolName = \"meta3d-event-protocol\";\n var uiExtensionProtocolName = \"meta3d-ui-protocol\";\n var eventService = api.getExtensionService(meta3dState, eventExtensionProtocolName);\n var eventState = api.getExtensionState(meta3dState, eventExtensionProtocolName);\n var uiState = api.getExtensionState(meta3dState, uiExtensionProtocolName);\n var elementState = ArraySt$Meta3dCommonlib.reduceOneParam(Curry._1(eventService.getAllActionContributes, eventState), (function (elementState, param) {\n var actionName = param[0];\n return NullableSt$Meta3dCommonlib.getWithDefault(NullableSt$Meta3dCommonlib.map(param[1].deepCopy, (function (deepCopy) {\n return ImmutableHashMap$Meta3dCommonlib.set(elementState, actionName, Curry._1(deepCopy, ImmutableHashMap$Meta3dCommonlib.getExn(elementState, actionName)));\n })), elementState);\n }), NullableSt$Meta3dCommonlib.getExn(getElementState(uiState, OptionSt$Meta3dCommonlib.getExn(uiState.currentElementName))));\n var uiState$1 = setCurrentElementState(uiState, elementState);\n return api.setExtensionState(meta3dState, uiExtensionProtocolName, uiState$1);\n}\n\nexports.hide = hide;\nexports.show = show;\nexports._markStateChange = _markStateChange;\nexports._markStateNotChange = _markStateNotChange;\nexports._markAllStateNotChange = _markAllStateNotChange;\nexports._getElementStateExn = _getElementStateExn;\nexports.getElementState = getElementState;\nexports._setElementState = _setElementState;\nexports._getElementExecOrderExn = _getElementExecOrderExn;\nexports._setElementExecOrder = _setElementExecOrder;\nexports._getCurrentElementName = _getCurrentElementName;\nexports._setCurrentElementName = _setCurrentElementName;\nexports.updateElementState = updateElementState;\nexports._exec = _exec;\nexports._invokeIMGUIRenderFunc = _invokeIMGUIRenderFunc;\nexports._invokeIMGUIRenderFuncWithParam = _invokeIMGUIRenderFuncWithParam;\nexports._invokeIMGUIRenderFuncReturnData = _invokeIMGUIRenderFuncReturnData;\nexports.render = render;\nexports._setElementFunc = _setElementFunc;\nexports.registerElement = registerElement;\nexports.registerSkin = registerSkin;\nexports.registerUIControl = registerUIControl;\nexports.registerInput = registerInput;\nexports.getSkin = getSkin;\nexports._getUIControlExn = _getUIControlExn;\nexports.getUIControlFuncExn = getUIControlFuncExn;\nexports.getInputFunc = getInputFunc;\nexports.getUIControlState = getUIControlState;\nexports.setUIControlState = setUIControlState;\nexports.isStateChange = isStateChange;\nexports.setStyle = setStyle;\nexports.beginWindow = beginWindow;\nexports.endWindow = endWindow;\nexports.beginChild = beginChild;\nexports.endChild = endChild;\nexports.setNextWindowRect = setNextWindowRect;\nexports.getFBOTexture = getFBOTexture;\nexports.setFBOTexture = setFBOTexture;\nexports.addFBOTexture = addFBOTexture;\nexports.getWindowBarHeight = getWindowBarHeight;\nexports.getContext = getContext;\nexports.button = button;\nexports.setCursorPos = setCursorPos;\nexports.loadImage = loadImage;\nexports.asset = asset;\nexports.handleDragDropTarget = handleDragDropTarget;\nexports.menu = menu;\nexports.tree = tree;\nexports.inspector = inspector;\nexports.switchButton = switchButton;\nexports.imageButton = imageButton;\nexports.clear = clear;\nexports._getCurrentElementStateOption = _getCurrentElementStateOption;\nexports.getCurrentElementState = getCurrentElementState;\nexports.setCurrentElementState = setCurrentElementState;\nexports.init = init;\nexports.restore = restore;\nexports.deepCopy = deepCopy;\n/* No side effect */\n\n\n//# sourceURL=webpack://Extension/./lib/js/src/UIManager.bs.js?"); /***/ }) diff --git a/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/src/Main.bs.js b/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/src/Main.bs.js index 3174f3f1b..db85a9eff 100644 --- a/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/src/Main.bs.js +++ b/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/src/Main.bs.js @@ -167,8 +167,8 @@ function getExtensionService(api) { menu: (function (param, param$1, param$2, param$3) { return UIManager$Meta3dUi.menu(partial_arg$3, param, param$1, param$2, param$3); }), - sceneTree: (function (param, param$1, param$2, param$3, param$4, param$5) { - return UIManager$Meta3dUi.sceneTree(partial_arg$4, param, param$1, param$2, param$3, param$4, param$5); + tree: (function (param, param$1, param$2, param$3, param$4, param$5) { + return UIManager$Meta3dUi.tree(partial_arg$4, param, param$1, param$2, param$3, param$4, param$5); }), inspector: (function (param, param$1, param$2, param$3, param$4, param$5, param$6) { return UIManager$Meta3dUi.inspector(partial_arg$5, param, param$1, param$2, param$3, param$4, param$5, param$6); diff --git a/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/src/UIManager.bs.js b/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/src/UIManager.bs.js index 31d3667a0..cefb3e32f 100644 --- a/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/src/UIManager.bs.js +++ b/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/src/UIManager.bs.js @@ -479,11 +479,11 @@ function menu(data, meta3dState, allLabels, windowName, rect) { }), data); } -function sceneTree(data, meta3dState, sceneTreeData, lastSceneTreeSelectedData, textures, windowName, rect) { +function tree(data, meta3dState, treeData, treeNodeLabel, lastTreeSelectedData, windowName, rect) { return _invokeIMGUIRenderFuncWithParam(meta3dState, (function (imguiRendererState, imguiRendererService) { return [ imguiRendererState, - imguiRendererService.sceneTree(sceneTreeData, lastSceneTreeSelectedData, textures, windowName, rect) + imguiRendererService.tree(treeData, treeNodeLabel, lastTreeSelectedData, windowName, rect) ]; }), data); } @@ -644,7 +644,7 @@ export { asset , handleDragDropTarget , menu , - sceneTree , + tree , inspector , switchButton , imageButton , diff --git a/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/test/tool/ImguiRendererServiceTool.bs.js b/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/test/tool/ImguiRendererServiceTool.bs.js index 103c2860d..05602d9f7 100644 --- a/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/test/tool/ImguiRendererServiceTool.bs.js +++ b/packages/editor-whole/ui/extensions/meta3d-ui/lib/es6_global/test/tool/ImguiRendererServiceTool.bs.js @@ -3,7 +3,7 @@ import * as Sinon from "../../../../../../../../../node_modules/meta3d-bs-sinon/lib/es6_global/src/sinon.bs.js"; import * as Caml_option from "../../../../../../../../../node_modules/rescript/lib/es6/caml_option.js"; -function buildService(sandbox, initOpt, clearOpt, renderOpt, beforeExecOpt, afterExecOpt, setStyleOpt, beginWindowOpt, endWindowOpt, beginChildOpt, endChildOpt, setNextWindowRectOpt, addFBOTextureOpt, getWindowBarHeightOpt, getContextOpt, buttonOpt, setCursorPosOpt, loadImageOpt, assetOpt, handleDragDropTargetOpt, menuOpt, sceneTreeOpt, inspectorOpt, switchButtonOpt, imageButtonOpt, param) { +function buildService(sandbox, initOpt, clearOpt, renderOpt, beforeExecOpt, afterExecOpt, setStyleOpt, beginWindowOpt, endWindowOpt, beginChildOpt, endChildOpt, setNextWindowRectOpt, addFBOTextureOpt, getWindowBarHeightOpt, getContextOpt, buttonOpt, setCursorPosOpt, loadImageOpt, assetOpt, handleDragDropTargetOpt, menuOpt, treeOpt, inspectorOpt, switchButtonOpt, imageButtonOpt, param) { var init = initOpt !== undefined ? initOpt : Sinon.createEmptyStub(sandbox.contents); var clear = clearOpt !== undefined ? clearOpt : Sinon.createEmptyStub(sandbox.contents); var render = renderOpt !== undefined ? renderOpt : Sinon.createEmptyStub(sandbox.contents); @@ -24,7 +24,7 @@ function buildService(sandbox, initOpt, clearOpt, renderOpt, beforeExecOpt, afte var asset = assetOpt !== undefined ? assetOpt : Sinon.createEmptyStub(sandbox.contents); var handleDragDropTarget = handleDragDropTargetOpt !== undefined ? Caml_option.valFromOption(handleDragDropTargetOpt) : Sinon.createEmptyStub(sandbox.contents); var menu = menuOpt !== undefined ? menuOpt : Sinon.createEmptyStub(sandbox.contents); - var sceneTree = sceneTreeOpt !== undefined ? sceneTreeOpt : Sinon.createEmptyStub(sandbox.contents); + var tree = treeOpt !== undefined ? treeOpt : Sinon.createEmptyStub(sandbox.contents); var inspector = inspectorOpt !== undefined ? inspectorOpt : Sinon.createEmptyStub(sandbox.contents); var switchButton = switchButtonOpt !== undefined ? switchButtonOpt : Sinon.createEmptyStub(sandbox.contents); var imageButton = imageButtonOpt !== undefined ? imageButtonOpt : Sinon.createEmptyStub(sandbox.contents); @@ -48,7 +48,7 @@ function buildService(sandbox, initOpt, clearOpt, renderOpt, beforeExecOpt, afte asset: asset, handleDragDropTarget: handleDragDropTarget, menu: menu, - sceneTree: sceneTree, + tree: tree, inspector: inspector, switchButton: switchButton, imageButton: imageButton, diff --git a/packages/editor-whole/ui/extensions/meta3d-ui/lib/js/test/tool/ImguiRendererServiceTool.bs.js b/packages/editor-whole/ui/extensions/meta3d-ui/lib/js/test/tool/ImguiRendererServiceTool.bs.js index 39828d6da..e37f3c355 100644 --- a/packages/editor-whole/ui/extensions/meta3d-ui/lib/js/test/tool/ImguiRendererServiceTool.bs.js +++ b/packages/editor-whole/ui/extensions/meta3d-ui/lib/js/test/tool/ImguiRendererServiceTool.bs.js @@ -3,7 +3,7 @@ var Sinon = require("meta3d-bs-sinon/lib/js/src/sinon.bs.js"); var Caml_option = require("rescript/lib/js/caml_option.js"); -function buildService(sandbox, initOpt, clearOpt, renderOpt, beforeExecOpt, afterExecOpt, setStyleOpt, beginWindowOpt, endWindowOpt, beginChildOpt, endChildOpt, setNextWindowRectOpt, addFBOTextureOpt, getWindowBarHeightOpt, getContextOpt, buttonOpt, setCursorPosOpt, loadImageOpt, assetOpt, handleDragDropTargetOpt, menuOpt, sceneTreeOpt, inspectorOpt, switchButtonOpt, imageButtonOpt, param) { +function buildService(sandbox, initOpt, clearOpt, renderOpt, beforeExecOpt, afterExecOpt, setStyleOpt, beginWindowOpt, endWindowOpt, beginChildOpt, endChildOpt, setNextWindowRectOpt, addFBOTextureOpt, getWindowBarHeightOpt, getContextOpt, buttonOpt, setCursorPosOpt, loadImageOpt, assetOpt, handleDragDropTargetOpt, menuOpt, treeOpt, inspectorOpt, switchButtonOpt, imageButtonOpt, param) { var init = initOpt !== undefined ? initOpt : Sinon.createEmptyStub(sandbox.contents); var clear = clearOpt !== undefined ? clearOpt : Sinon.createEmptyStub(sandbox.contents); var render = renderOpt !== undefined ? renderOpt : Sinon.createEmptyStub(sandbox.contents); @@ -24,7 +24,7 @@ function buildService(sandbox, initOpt, clearOpt, renderOpt, beforeExecOpt, afte var asset = assetOpt !== undefined ? assetOpt : Sinon.createEmptyStub(sandbox.contents); var handleDragDropTarget = handleDragDropTargetOpt !== undefined ? Caml_option.valFromOption(handleDragDropTargetOpt) : Sinon.createEmptyStub(sandbox.contents); var menu = menuOpt !== undefined ? menuOpt : Sinon.createEmptyStub(sandbox.contents); - var sceneTree = sceneTreeOpt !== undefined ? sceneTreeOpt : Sinon.createEmptyStub(sandbox.contents); + var tree = treeOpt !== undefined ? treeOpt : Sinon.createEmptyStub(sandbox.contents); var inspector = inspectorOpt !== undefined ? inspectorOpt : Sinon.createEmptyStub(sandbox.contents); var switchButton = switchButtonOpt !== undefined ? switchButtonOpt : Sinon.createEmptyStub(sandbox.contents); var imageButton = imageButtonOpt !== undefined ? imageButtonOpt : Sinon.createEmptyStub(sandbox.contents); @@ -48,7 +48,7 @@ function buildService(sandbox, initOpt, clearOpt, renderOpt, beforeExecOpt, afte asset: asset, handleDragDropTarget: handleDragDropTarget, menu: menu, - sceneTree: sceneTree, + tree: tree, inspector: inspector, switchButton: switchButton, imageButton: imageButton, diff --git a/packages/editor-whole/ui/extensions/meta3d-ui/package.json b/packages/editor-whole/ui/extensions/meta3d-ui/package.json index 8134af9a9..10c171f9f 100755 --- a/packages/editor-whole/ui/extensions/meta3d-ui/package.json +++ b/packages/editor-whole/ui/extensions/meta3d-ui/package.json @@ -1,6 +1,6 @@ { "name": "meta3d-ui", - "version": "0.20.9", + "version": "0.20.14", "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", "displayName": "ui", "protocol": { diff --git a/packages/editor-whole/ui/extensions/meta3d-ui/src/Main.res b/packages/editor-whole/ui/extensions/meta3d-ui/src/Main.res index 5e3109a80..7666792db 100755 --- a/packages/editor-whole/ui/extensions/meta3d-ui/src/Main.res +++ b/packages/editor-whole/ui/extensions/meta3d-ui/src/Main.res @@ -154,7 +154,7 @@ let getExtensionService: Meta3dType.Index.getExtensionService< asset: UIManager.asset((api, "meta3d-imgui-renderer-protocol")), handleDragDropTarget: UIManager.handleDragDropTarget((api, "meta3d-imgui-renderer-protocol")), menu: UIManager.menu((api, "meta3d-imgui-renderer-protocol")), - sceneTree: UIManager.sceneTree((api, "meta3d-imgui-renderer-protocol")), + tree: UIManager.tree((api, "meta3d-imgui-renderer-protocol")), inspector: UIManager.inspector((api, "meta3d-imgui-renderer-protocol")), switchButton: UIManager.switchButton((api, "meta3d-imgui-renderer-protocol")), imageButton: UIManager.imageButton((api, "meta3d-imgui-renderer-protocol")), diff --git a/packages/editor-whole/ui/extensions/meta3d-ui/src/UIManager.res b/packages/editor-whole/ui/extensions/meta3d-ui/src/UIManager.res index 2ba223938..99dd4dd00 100755 --- a/packages/editor-whole/ui/extensions/meta3d-ui/src/UIManager.res +++ b/packages/editor-whole/ui/extensions/meta3d-ui/src/UIManager.res @@ -722,24 +722,16 @@ let menu = (data, meta3dState, allLabels, windowName, rect) => { ) } -let sceneTree = ( - data, - meta3dState, - sceneTreeData, - lastSceneTreeSelectedData, - textures, - windowName, - rect, -) => { +let tree = (data, meta3dState, treeData, treeNodeLabel, lastTreeSelectedData, windowName, rect) => { _invokeIMGUIRenderFuncWithParam( meta3dState, (. imguiRendererState, imguiRendererService) => { ( imguiRendererState, - imguiRendererService.sceneTree(. - sceneTreeData, - lastSceneTreeSelectedData, - textures, + imguiRendererService.tree(. + treeData, + treeNodeLabel, + lastTreeSelectedData, windowName, rect, ), diff --git a/packages/editor-whole/ui/extensions/meta3d-ui/test/tool/ImguiRendererServiceTool.res b/packages/editor-whole/ui/extensions/meta3d-ui/test/tool/ImguiRendererServiceTool.res index aeb141b16..10b55e963 100755 --- a/packages/editor-whole/ui/extensions/meta3d-ui/test/tool/ImguiRendererServiceTool.res +++ b/packages/editor-whole/ui/extensions/meta3d-ui/test/tool/ImguiRendererServiceTool.res @@ -22,7 +22,7 @@ let buildService = ( ~asset=createEmptyStub(refJsObjToSandbox(sandbox.contents)), ~handleDragDropTarget=createEmptyStub(refJsObjToSandbox(sandbox.contents)), ~menu=createEmptyStub(refJsObjToSandbox(sandbox.contents)), - ~sceneTree=createEmptyStub(refJsObjToSandbox(sandbox.contents)), + ~tree=createEmptyStub(refJsObjToSandbox(sandbox.contents)), ~inspector=createEmptyStub(refJsObjToSandbox(sandbox.contents)), ~switchButton=createEmptyStub(refJsObjToSandbox(sandbox.contents)), ~imageButton=createEmptyStub(refJsObjToSandbox(sandbox.contents)), @@ -49,7 +49,7 @@ let buildService = ( asset, handleDragDropTarget: handleDragDropTarget->Obj.magic, menu, - sceneTree, + tree, inspector, switchButton, imageButton, diff --git a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/package.json b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/package.json index 03cbb2e64..15d767f3b 100755 --- a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/package.json +++ b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/package.json @@ -1,6 +1,6 @@ { "name": "meta3d-imgui-renderer-protocol", - "version": "0.20.4", + "version": "0.20.5", "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", "displayName": "renderer protocol", "author": "Wonder", diff --git a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/src/service/ServiceType.res b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/src/service/ServiceType.res index 69e6cf298..5cda3eb95 100755 --- a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/src/service/ServiceType.res +++ b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/src/service/ServiceType.res @@ -33,12 +33,12 @@ type menuAllLabels = array<(menuLabel, array)> type selectItemMap = Meta3dCommonlibType.ImmutableHashMapType.t -type sceneTreeNodeLabel = string +type treeNodeLabel = string /* ! TODO like this -// type rec sceneTreeData = array<(sceneTreeNodeLabel, imguiImplTexture, sceneTreeData)> +// type rec treeData = array<(treeNodeLabel, imguiImplTexture, treeData)> -type sceneTreeData = +type treeData = | ScriptEventFunctionNode(nodeId, scriptEventFunctionNodeData) | ScriptAttributeNode(nodeId, scriptAttributeNodeData) | TextureNode(nodeId, textureNodeData) @@ -53,26 +53,26 @@ type sceneTreeData = | FolderNode( nodeId, folderNodeData, - UIStateAssetType.uiState(array(sceneTreeData)), + UIStateAssetType.uiState(array(treeData)), ); */ -type sceneTreeData +type treeData type index = int -type sceneTreeIndexData = array +type treeIndexData = array -type sceneTreeDragData = { - source: sceneTreeIndexData, - target: sceneTreeIndexData, +type treeDragData = { + source: treeIndexData, + target: treeIndexData, } -type sceneTreeReturnData = ( - bool, - bool, - bool, - Js.Nullable.t, - Js.Nullable.t, +type treeReturnData = ( + // bool, + // bool, + // bool, + Js.Nullable.t, + Js.Nullable.t, ) type inspectorReturnData = ( @@ -113,20 +113,21 @@ type service = { ) => Js.Nullable.t, handleDragDropTarget: 'data. (. string) => Js.Nullable.t<'data>, menu: (. menuAllLabels, string, rect) => Js.Nullable.t, - sceneTree: ( - . sceneTreeData, - Js.Nullable.t, - { - "addCubeTexture": imguiImplTexture, - "disposeTexture": imguiImplTexture, - "cloneTexture": imguiImplTexture, - // "cameraIconTexture": imguiImplTexture, - // "meshIconTexture": imguiImplTexture, - // "lightIconTexture": imguiImplTexture, - }, + tree: ( + . treeData, + treeNodeLabel, + Js.Nullable.t, + // { + // "addCubeTexture": imguiImplTexture, + // "disposeTexture": imguiImplTexture, + // "cloneTexture": imguiImplTexture, + // // "cameraIconTexture": imguiImplTexture, + // // "meshIconTexture": imguiImplTexture, + // // "lightIconTexture": imguiImplTexture, + // }, string, rect, - ) => sceneTreeReturnData, + ) => treeReturnData, inspector: ( . string, (float, float, float), diff --git a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/src/service/ServiceType.ts b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/src/service/ServiceType.ts index cad6e0cd5..3bf0856cb 100755 --- a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/src/service/ServiceType.ts +++ b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-imgui-renderer-protocol/src/service/ServiceType.ts @@ -43,31 +43,33 @@ export type menuLabel = string export type menuAllLabels = Array<[menuLabel, Array]> -type sceneTreeNodeLabel = string +export type treeNodeLabel = string -export type sceneTreeData = Array<[sceneTreeNodeLabel, imguiImplTexture, sceneTreeData]> +export type treeData = Array<[treeNodeLabel, imguiImplTexture, treeData]> // export type level = number type index = number -// export type sceneTreeIndexData = [level, index] -export type sceneTreeIndexData = Array +// export type treeIndexData = [level, index] +export type treeIndexData = Array -export type sceneTreeDragData = { - source: sceneTreeIndexData, - target: sceneTreeIndexData +export type treeDragData = { + source: treeIndexData, + target: treeIndexData } -export type sceneTreeReturnData = [boolean, boolean, boolean, nullable, nullable] +export type treeReturnData = [nullable, nullable] -export type sceneTreeFunc = (sceneTreeData: sceneTreeData, - lastSceneTreeSelectedData: nullable, - textures: { - "addCubeTexture": imguiImplTexture, - "disposeTexture": imguiImplTexture, - "cloneTexture": imguiImplTexture - }, windowName: string, rect: rect) => sceneTreeReturnData +export type treeFunc = (treeData: treeData, + rootNodeLabel: treeNodeLabel, + lastTreeSelectedData: nullable, + // textures: { + // "addCubeTexture": imguiImplTexture, + // "disposeTexture": imguiImplTexture, + // "cloneTexture": imguiImplTexture + // }, + windowName: string, rect: rect) => treeReturnData // type fileName = string @@ -151,7 +153,7 @@ export type service = { readonly asset: assetFunc; readonly handleDragDropTarget: (type: string) => nullable; readonly menu: (allLabels: menuAllLabels, windowName: string, rect: rect) => nullable; - readonly sceneTree: sceneTreeFunc; + readonly tree: treeFunc; readonly inspector: inspectorFunc; readonly switchButton: ( isRunState: boolean, diff --git a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/package.json b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/package.json index 852e2fc51..db347dcb4 100755 --- a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/package.json +++ b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/package.json @@ -1,6 +1,6 @@ { "name": "meta3d-ui-protocol", - "version": "0.20.5", + "version": "0.20.6", "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", "displayName": "ui protocol", "author": "Wonder", diff --git a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/src/service/ServiceType.res b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/src/service/ServiceType.res index aaab4f8e5..6bf8a994d 100755 --- a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/src/service/ServiceType.res +++ b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/src/service/ServiceType.res @@ -141,21 +141,22 @@ type service = { string, Meta3dImguiRendererProtocol.ServiceType.rect, ) => (Meta3dType.Index.state, Js.Nullable.t), - sceneTree: ( - Meta3dType.Index.state, - Meta3dImguiRendererProtocol.ServiceType.sceneTreeData, - Js.Nullable.t, - { - "addCubeTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, - "disposeTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, - "cloneTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, - // "cameraIconTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, - // "meshIconTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, - // "lightIconTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, - }, + tree: ( + Meta3dType.Index.state, + Meta3dImguiRendererProtocol.ServiceType.treeData, + Meta3dImguiRendererProtocol.ServiceType.treeNodeLabel, + Js.Nullable.t, + // { + // "addCubeTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, + // "disposeTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, + // "cloneTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, + // // "cameraIconTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, + // // "meshIconTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, + // // "lightIconTexture": Meta3dImguiRendererProtocol.ServiceType.imguiImplTexture, + // }, string, Meta3dImguiRendererProtocol.ServiceType.rect, - ) => (Meta3dType.Index.state, Meta3dImguiRendererProtocol.ServiceType.sceneTreeReturnData), + ) => (Meta3dType.Index.state, Meta3dImguiRendererProtocol.ServiceType.treeReturnData), inspector: ( Meta3dType.Index.state, string, diff --git a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/src/service/ServiceType.ts b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/src/service/ServiceType.ts index cdebf5784..76c4b1270 100755 --- a/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/src/service/ServiceType.ts +++ b/packages/editor-whole/ui/protocols/extension_protocols/meta3d-ui-protocol/src/service/ServiceType.ts @@ -3,7 +3,7 @@ import { elementContribute, elementName } from "../contribute/ElementContributeT import { textureID, elementState } from "../state/StateType" import { skinContribute, skinName } from "../contribute/SkinContributeType" import { uiControlContribute, uiControlFunc, uiControlName } from "../contribute/UIControlContributeType" -import { style, label, pos, size, rect, texture as imguiTexture, context, imguiImplTexture, imageSrc, menuAllLabels, menuLabel, sceneTreeData, sceneTreeIndexData, sceneTreeReturnData, getValueFunc, setValueFunc } from "meta3d-imgui-renderer-protocol/src/service/ServiceType" +import { style, label, pos, size, rect, texture as imguiTexture, context, imguiImplTexture, imageSrc, menuAllLabels, menuLabel, treeData, treeNodeLabel, treeIndexData, treeReturnData } from "meta3d-imgui-renderer-protocol/src/service/ServiceType" import { nullable, strictNullable } from "meta3d-commonlib-ts/src/nullable" import { name } from "meta3d-gameobject-protocol" import { localEulerAngles, localPosition, localScale } from "meta3d-component-transform-protocol" @@ -183,18 +183,21 @@ export type service = { windowName: string, rect: rect, ) => [meta3dState, nullable]; - readonly sceneTree: ( - meta3dState: meta3dState, - sceneTreeData: sceneTreeData, - lastSceneTreeSelectedData: nullable, - textures: { - "addCubeTexture": imguiImplTexture, - "disposeTexture": imguiImplTexture, - "cloneTexture": imguiImplTexture, - // "cameraIconTexture": imguiImplTexture, - // "meshIconTexture": imguiImplTexture, - // "lightIconTexture": imguiImplTexture, - }, windowName: string, rect: rect) => [meta3dState, sceneTreeReturnData]; + readonly tree: ( + meta3dState: meta3dState, + treeData: treeData, + rootNodeLabel: treeNodeLabel, + lastTreeSelectedData: nullable, + // textures: + // { + // "addCubeTexture": imguiImplTexture, + // "disposeTexture": imguiImplTexture, + // "cloneTexture": imguiImplTexture, + // // "cameraIconTexture": imguiImplTexture, + // // "meshIconTexture": imguiImplTexture, + // // "lightIconTexture": imguiImplTexture, + // }, + windowName: string, rect: rect) => [meta3dState, treeReturnData]; readonly inspector: ( meta3dState: meta3dState, // [ diff --git a/protocols/contribute_protocols/meta3d-action-add-cube-protocol/.gitignore b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/protocols/contribute_protocols/meta3d-action-add-cube-protocol/gulpfile.js b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/gulpfile.js new file mode 100755 index 000000000..97d4eec4c --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/gulpfile.js @@ -0,0 +1,23 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish-protocol") + +gulp.task("publish_local_env", function (done) { + publish.publishContributeProtocol( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContributeProtocol( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); diff --git a/protocols/contribute_protocols/meta3d-action-add-cube-protocol/icon.png b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..828c6d76a7f6cdd3f6e8c8fa455188982b05b555 GIT binary patch literal 3766 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 literal 0 HcmV?d00001 diff --git a/protocols/contribute_protocols/meta3d-action-add-cube-protocol/package.json b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/package.json new file mode 100755 index 000000000..6d797778a --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/package.json @@ -0,0 +1,19 @@ +{ + "name": "meta3d-action-add-cube-protocol", + "version": "0.20.1", + "description": "", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "author": "Meta3D", + "main": "src/StateType.ts", + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "gulp publish_local_env", + "meta3d:publish_pro": "gulp publish_production_env" + }, + "keywords": [], + "devDependencies": { + "typescript": "^4.2.3" + } +} diff --git a/protocols/contribute_protocols/meta3d-action-add-cube-protocol/src/EventType.ts b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/src/EventType.ts new file mode 100755 index 000000000..05dcda7dc --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/src/EventType.ts @@ -0,0 +1,3 @@ +export const eventName = "AddCubeEvent" + +export type inputData = [] \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-action-add-cube-protocol/src/StateType.ts b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/src/StateType.ts new file mode 100755 index 000000000..62ff19418 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/src/StateType.ts @@ -0,0 +1,12 @@ +import { gameObject } from "meta3d-gameobject-protocol" +import type { List } from "immutable" + +export const actionName = "AddCube" + +export type uiData = null + +export type state = { + addedGameObjects: List, +} + + diff --git a/protocols/contribute_protocols/meta3d-action-add-cube-protocol/tsconfig.json b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/tsconfig.json new file mode 100755 index 000000000..518e066d1 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-add-cube-protocol/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/.gitignore b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/gulpfile.js b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/gulpfile.js new file mode 100755 index 000000000..97d4eec4c --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/gulpfile.js @@ -0,0 +1,23 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish-protocol") + +gulp.task("publish_local_env", function (done) { + publish.publishContributeProtocol( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContributeProtocol( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); diff --git a/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/icon.png b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..828c6d76a7f6cdd3f6e8c8fa455188982b05b555 GIT binary patch literal 3766 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 literal 0 HcmV?d00001 diff --git a/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/package.json b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/package.json new file mode 100755 index 000000000..c03cb366a --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/package.json @@ -0,0 +1,19 @@ +{ + "name": "meta3d-action-clone-gameobject-protocol", + "version": "0.20.1", + "description": "", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "author": "Meta3D", + "main": "src/StateType.ts", + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "gulp publish_local_env", + "meta3d:publish_pro": "gulp publish_production_env" + }, + "keywords": [], + "devDependencies": { + "typescript": "^4.2.3" + } +} diff --git a/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/src/EventType.ts b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/src/EventType.ts new file mode 100755 index 000000000..db7480f63 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/src/EventType.ts @@ -0,0 +1,5 @@ +import { gameObject } from "meta3d-gameobject-protocol" + +export const eventName = "CloneGameObjectEvent" + +export type inputData = [gameObject] \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/src/StateType.ts b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/src/StateType.ts new file mode 100755 index 000000000..6d70c5c96 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/src/StateType.ts @@ -0,0 +1,10 @@ +import type { List } from "immutable" +import { gameObject } from "meta3d-gameobject-protocol" + +export const actionName = "CloneGameObject" + +export type uiData = null + +export type state = { + allClonedGameObjects: List>, +} \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/tsconfig.json b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/tsconfig.json new file mode 100755 index 000000000..518e066d1 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-clone-gameobject-protocol/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/.gitignore b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/gulpfile.js b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/gulpfile.js new file mode 100755 index 000000000..97d4eec4c --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/gulpfile.js @@ -0,0 +1,23 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish-protocol") + +gulp.task("publish_local_env", function (done) { + publish.publishContributeProtocol( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContributeProtocol( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); diff --git a/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/icon.png b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..828c6d76a7f6cdd3f6e8c8fa455188982b05b555 GIT binary patch literal 3766 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 literal 0 HcmV?d00001 diff --git a/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/package.json b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/package.json new file mode 100755 index 000000000..99989beee --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/package.json @@ -0,0 +1,19 @@ +{ + "name": "meta3d-action-dispose-gameobject-protocol", + "version": "0.20.1", + "description": "", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "author": "Meta3D", + "main": "src/StateType.ts", + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "gulp publish_local_env", + "meta3d:publish_pro": "gulp publish_production_env" + }, + "keywords": [], + "devDependencies": { + "typescript": "^4.2.3" + } +} diff --git a/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/src/EventType.ts b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/src/EventType.ts new file mode 100755 index 000000000..95bcaeff0 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/src/EventType.ts @@ -0,0 +1,5 @@ +import { gameObject } from "meta3d-gameobject-protocol" + +export const eventName = "DisposeGameObjectEvent" + +export type inputData = [gameObject] \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/src/StateType.ts b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/src/StateType.ts new file mode 100755 index 000000000..b110daeab --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/src/StateType.ts @@ -0,0 +1,15 @@ +import type { List } from "immutable" +import { nullable } from "meta3d-commonlib-ts/src/nullable" +import { removeGameObjectData } from "meta3d-engine-scene-protocol/src/service/ecs/GameObject" +import { gameObject } from "meta3d-gameobject-protocol" +import { treeIndexData } from "meta3d-imgui-renderer-protocol/src/service/ServiceType" + +export const actionName = "DisposeGameObject" + +export type uiData = null + +export type state = { + allSelectedGameObjects: List, + allLastSceneTreeSelectedData: List>, + allDisposedGameObjectData: List>, +} diff --git a/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/tsconfig.json b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/tsconfig.json new file mode 100755 index 000000000..518e066d1 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-dispose-gameobject-protocol/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/.gitignore b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/gulpfile.js b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/gulpfile.js new file mode 100755 index 000000000..97d4eec4c --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/gulpfile.js @@ -0,0 +1,23 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish-protocol") + +gulp.task("publish_local_env", function (done) { + publish.publishContributeProtocol( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContributeProtocol( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); diff --git a/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/icon.png b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..828c6d76a7f6cdd3f6e8c8fa455188982b05b555 GIT binary patch literal 3766 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 literal 0 HcmV?d00001 diff --git a/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/package.json b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/package.json new file mode 100755 index 000000000..cb4393632 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/package.json @@ -0,0 +1,19 @@ +{ + "name": "meta3d-action-select-scenetree-node-protocol", + "version": "0.20.1", + "description": "", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "author": "Meta3D", + "main": "src/StateType.ts", + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "gulp publish_local_env", + "meta3d:publish_pro": "gulp publish_production_env" + }, + "keywords": [], + "devDependencies": { + "typescript": "^4.2.3" + } +} diff --git a/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/src/EventType.ts b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/src/EventType.ts new file mode 100755 index 000000000..f0c91d8d4 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/src/EventType.ts @@ -0,0 +1,5 @@ +import { gameObject } from "meta3d-gameobject-protocol" + +export const eventName = "SelectSceneTreeNodeEvent" + +export type inputData = [gameObject] \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/src/StateType.ts b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/src/StateType.ts new file mode 100755 index 000000000..e799d3750 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/src/StateType.ts @@ -0,0 +1,13 @@ +import { nullable } from "meta3d-commonlib-ts/src/nullable" +import type { List } from "immutable" +import { gameObject } from "meta3d-gameobject-protocol" +import { treeIndexData } from "meta3d-imgui-renderer-protocol/src/service/ServiceType" + +export const actionName = "SelectSceneTreeNode" + +export type uiData = treeIndexData + +export type state = { + selectedGameObject: nullable, + allSelectedGameObjects: List +} diff --git a/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/tsconfig.json b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/tsconfig.json new file mode 100755 index 000000000..518e066d1 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-select-scenetree-node-protocol/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-action-set-parent-protocol/.gitignore b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/protocols/contribute_protocols/meta3d-action-set-parent-protocol/gulpfile.js b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/gulpfile.js new file mode 100755 index 000000000..97d4eec4c --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/gulpfile.js @@ -0,0 +1,23 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish-protocol") + +gulp.task("publish_local_env", function (done) { + publish.publishContributeProtocol( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContributeProtocol( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); diff --git a/protocols/contribute_protocols/meta3d-action-set-parent-protocol/icon.png b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..828c6d76a7f6cdd3f6e8c8fa455188982b05b555 GIT binary patch literal 3766 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 literal 0 HcmV?d00001 diff --git a/protocols/contribute_protocols/meta3d-action-set-parent-protocol/package.json b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/package.json new file mode 100755 index 000000000..ab637be22 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/package.json @@ -0,0 +1,19 @@ +{ + "name": "meta3d-action-set-parent-protocol", + "version": "0.20.1", + "description": "", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "author": "Meta3D", + "main": "src/StateType.ts", + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "gulp publish_local_env", + "meta3d:publish_pro": "gulp publish_production_env" + }, + "keywords": [], + "devDependencies": { + "typescript": "^4.2.3" + } +} diff --git a/protocols/contribute_protocols/meta3d-action-set-parent-protocol/src/EventType.ts b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/src/EventType.ts new file mode 100755 index 000000000..f1c52d7be --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/src/EventType.ts @@ -0,0 +1,9 @@ +import { nullable } from "meta3d-commonlib-ts/src/nullable" +import { gameObject } from "meta3d-gameobject-protocol" + +export const eventName = "SetParentEvent" + +export type inputData = [{ + source: gameObject, + target: nullable +}] \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-action-set-parent-protocol/src/StateType.ts b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/src/StateType.ts new file mode 100755 index 000000000..299ecc930 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/src/StateType.ts @@ -0,0 +1,17 @@ +import type { List } from "immutable" +import { gameObject } from "meta3d-gameobject-protocol" +import { nullable } from "meta3d-commonlib-ts/src/nullable" +import { treeDragData } from "meta3d-imgui-renderer-protocol/src/service/ServiceType" + +export const actionName = "SetParent" + +export type uiData = treeDragData + +export type state = { + allHierachyData: List<{ + source: gameObject, + oldParent: nullable + }> +} + + diff --git a/protocols/contribute_protocols/meta3d-action-set-parent-protocol/tsconfig.json b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/tsconfig.json new file mode 100755 index 000000000..518e066d1 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-action-set-parent-protocol/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-input-tree-protocol/.gitignore b/protocols/contribute_protocols/meta3d-input-tree-protocol/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/protocols/contribute_protocols/meta3d-input-tree-protocol/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/protocols/contribute_protocols/meta3d-input-tree-protocol/gulpfile.js b/protocols/contribute_protocols/meta3d-input-tree-protocol/gulpfile.js new file mode 100755 index 000000000..ce0e8ab73 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-input-tree-protocol/gulpfile.js @@ -0,0 +1,23 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish-protocol") + +gulp.task("publish_local_env", function (done) { + publish.publishContributeProtocol( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContributeProtocol( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-input-tree-protocol/icon.png b/protocols/contribute_protocols/meta3d-input-tree-protocol/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..828c6d76a7f6cdd3f6e8c8fa455188982b05b555 GIT binary patch literal 3766 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 literal 0 HcmV?d00001 diff --git a/protocols/contribute_protocols/meta3d-input-tree-protocol/package.json b/protocols/contribute_protocols/meta3d-input-tree-protocol/package.json new file mode 100755 index 000000000..dfcf1e9c8 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-input-tree-protocol/package.json @@ -0,0 +1,19 @@ +{ + "name": "meta3d-input-tree-protocol", + "version": "0.20.1", + "description": "", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "author": "Meta3D", + "main": "src/Index.ts", + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "gulp publish_local_env", + "meta3d:publish_pro": "gulp publish_production_env" + }, + "keywords": [], + "devDependencies": { + "typescript": "^4.2.3" + } +} diff --git a/protocols/contribute_protocols/meta3d-input-tree-protocol/src/Index.ts b/protocols/contribute_protocols/meta3d-input-tree-protocol/src/Index.ts new file mode 100755 index 000000000..a6de191b7 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-input-tree-protocol/src/Index.ts @@ -0,0 +1,13 @@ +import { inputFunc } from "meta3d-ui-protocol/src/contribute/InputContributeType" + +export type nodeLabel = string + +export enum nodeType { + Type1, + Type2, + Type3 +} + +export type data = Array<[nodeLabel, nodeType, data]> + +export type func = inputFunc \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-input-tree-protocol/tsconfig.json b/protocols/contribute_protocols/meta3d-input-tree-protocol/tsconfig.json new file mode 100755 index 000000000..518e066d1 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-input-tree-protocol/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/.gitignore b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/gulpfile.js b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/gulpfile.js new file mode 100755 index 000000000..2fb5dff8d --- /dev/null +++ b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/gulpfile.js @@ -0,0 +1,45 @@ +var gulp = require("gulp"); +var path = require("path"); +var publish = require("meta3d-tool-publish-protocol") + +gulp.task("publish_local_env", function (done) { + publish.publishContributeProtocol( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); + +gulp.task("publish_production_env", function (done) { + publish.publishContributeProtocol( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "icon.png") + ).then(() => { + done() + }) +}); + +gulp.task("publishConfig_local_env", function (done) { + publish.publishContributeProtocolConfig( + "local", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + +gulp.task("publishConfig_production_env", function (done) { + publish.publishContributeProtocolConfig( + "production", + path.join(__dirname, "package.json"), + path.join(__dirname, "dist/static/js", "main.js") + ).then(() => { + done() + }) +}); + + diff --git a/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/icon.png b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..828c6d76a7f6cdd3f6e8c8fa455188982b05b555 GIT binary patch literal 3766 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 literal 0 HcmV?d00001 diff --git a/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/package.json b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/package.json new file mode 100755 index 000000000..54fbbe0e7 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/package.json @@ -0,0 +1,28 @@ +{ + "name": "meta3d-ui-control-tree-protocol", + "version": "0.20.1", + "publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307", + "author": "Meta3D", + "main": "src/Index.ts", + "license": "MIT", + "scripts": { + "watch": "tsc -w -noEmit", + "webpack": "webpack --config webpack.config.js", + "meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev", + "meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publishConfig_local_env && gulp publish_local_env", + "meta3d:publish_pro": "cross-env NODE_ENV=production npm run webpack && gulp publishConfig_production_env &&gulp publish_production_env" + }, + "keywords": [], + "devDependencies": { + "clean-webpack-plugin": "^4.0.0", + "cross-env": "^7.0.3", + "cz-customizable": "^6.3.0", + "gulp": "^4.0.2", + "meta3d-tool-publish": "^0.20.0", + "source-map-loader": "^3.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.2.3", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + } +} diff --git a/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/src/Config.ts b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/src/Config.ts new file mode 100755 index 000000000..62a7f4fea --- /dev/null +++ b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/src/Config.ts @@ -0,0 +1,69 @@ +import { + generateUIControlCommonDataStr as generateUIControlCommonDataStrMeta3D, + getUIControlSpecificDataFields as getUIControlSpecificDataFieldsMeta3D, + hasChildren as hasChildrenMeta3D, + getUIControlSupportedEventNames as getUIControlSupportedEventNamesMeta3D, generateHandleUIControlEventStr as generateHandleUIControlEventStrMeta3D +} from "meta3d-type/src/contribute/UIControlProtocolConfigType" +import { isNullable } from "meta3d-commonlib-ts/src/NullableUtils" + +export let generateUIControlCommonDataStr: generateUIControlCommonDataStrMeta3D = (rect) => { + return "\n {\n rect: " + rect + "}\n " +} + +let _generateUniqueId = () => { + return Math.floor(Math.random() * 1000000.0).toString() +} + +export let getUIControlSpecificDataFields: getUIControlSpecificDataFieldsMeta3D = () => [ + { + name: "label", + type_: "string", + value: "Tree##" + _generateUniqueId() + }, + { + name: "rootNodeLabel", + type_: "string", + value: "Root" + }, + { + name: "nodeType1Image", + type_: "imageBase64", + value: null + }, + { + name: "nodeType2Image", + type_: "imageBase64", + value: null + }, + { + name: "nodeType3Image", + type_: "imageBase64", + value: null + } +] + +export let hasChildren: hasChildrenMeta3D = () => false + +export let getUIControlSupportedEventNames: getUIControlSupportedEventNamesMeta3D = () => ["select_tree_node", "drag_tree_node"] + +export let generateHandleUIControlEventStr: generateHandleUIControlEventStrMeta3D = ([selectTreeNodeActionName, dragTreeNodeActionName]) => { + if (!isNullable(selectTreeNodeActionName) && !isNullable(dragTreeNodeActionName)) { + return ` + let [selectedTreeNodeId, dragData] = data[1] + + if (!api.nullable.isNullable(selectedTreeNodeId)) { + let { trigger } = api.getExtensionService(meta3dState, "meta3d-event-protocol") + + return trigger(meta3dState, "meta3d-event-protocol", "${selectTreeNodeActionName}", api.nullable.getExn(selectedTreeNodeId)) + } + + if (!api.nullable.isNullable(dragData)) { + let { trigger } = api.getExtensionService(meta3dState, "meta3d-event-protocol") + + return trigger(meta3dState, "meta3d-event-protocol", "${dragTreeNodeActionName}", api.nullable.getExn(dragData)) + } + ` + } + + return "" +} \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/src/Index.ts b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/src/Index.ts new file mode 100755 index 000000000..1b4c3c438 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/src/Index.ts @@ -0,0 +1,48 @@ +import { rect } from "meta3d-type/src/contribute/UIControlProtocolConfigType" +import { func } from "meta3d-input-tree-protocol" +import { nullable } from "meta3d-commonlib-ts/src/nullable" +import { imguiImplTexture, treeIndexData, treeReturnData } from "meta3d-imgui-renderer-protocol/src/service/ServiceType" + +export const uiControlName = "Tree" + +export const dragDropType = "DND_TreeNode" + +export type imageBase64 = string + +export type state = { + lastTreeSelectedData: nullable, + nodeType1Texture: nullable, + lastNodeType1TextureImageBase64: nullable, + nodeType2Texture: nullable, + lastNodeType2TextureImageBase64: nullable, + nodeType3Texture: nullable, + lastNodeType3TextureImageBase64: nullable, +} + +export type inputData = { + rect: rect, + label: string, +} + +export type inputFunc = nullable + +export type specificData = { + rect: rect, + label: string, + rootNodeLabel: string, + nodeType1Image: nullable, + nodeType2Image: nullable, + nodeType3Image: nullable, +} + +// type treeNodeId = string + +// type selectedTreeNodeId = nullable + +// type dragData = nullable<{ +// source: nullable, +// target: nullable +// }> + +// export type outputData = [selectedTreeNodeId, dragData] +export type outputData = treeReturnData \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/tsconfig.json b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/tsconfig.json new file mode 100755 index 000000000..518e066d1 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/webpack.config.js b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/webpack.config.js new file mode 100755 index 000000000..0bd03b441 --- /dev/null +++ b/protocols/contribute_protocols/meta3d-ui-control-tree-protocol/webpack.config.js @@ -0,0 +1,64 @@ +const path = require('path'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); + +module.exports = { + entry: "./src/Config.ts", + mode: process.env.NODE_ENV.trim() == 'production' ? 'production' : 'development', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'static/js/[name].js', + library: { + name: 'UIControlProtocolConfig', + type: 'window', + }, + }, + + // Enable sourcemaps for debugging webpack's output. + // devtool: "source-map", + + resolve: { + extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss'], + modules: ['node_modules'] + }, + + module: { + rules: [ + // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'. + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: "ts-loader" + }, + // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. + { + enforce: 'pre', + test: /\.js$/, + loader: "source-map-loader" + }, + ] + }, + plugins: [ + /** + * All files inside webpack's output.path directory will be removed once, but the + * directory itself will not be. If using webpack 4+'s default configuration, + * everything under /dist/ will be removed. + * Use cleanOnceBeforeBuildPatterns to override this behavior. + * + * During rebuilds, all webpack assets that are not used anymore + * will be removed automatically. + * + * See `Options and Defaults` for information + */ + new CleanWebpackPlugin(), + // new HtmlWebpackPlugin({ + // template: './user.html', + // filename: 'user.html', + // }), + ], + // When importing a module whose path matches one of the following, just + // assume a corresponding global variable exists and use that instead. + // This is important because it allows us to avoid bundling all of our + // dependencies, which allows browsers to cache those libraries between builds. + externals: { + } +}; \ No newline at end of file diff --git a/utils/meta3d-scenetree-utils/.gitignore b/utils/meta3d-scenetree-utils/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/utils/meta3d-scenetree-utils/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/utils/meta3d-scenetree-utils/package.json b/utils/meta3d-scenetree-utils/package.json new file mode 100755 index 000000000..c5ea88594 --- /dev/null +++ b/utils/meta3d-scenetree-utils/package.json @@ -0,0 +1,16 @@ +{ + "name": "meta3d-scenetree-utils", + "version": "0.20.0", + "license": "", + "scripts": { + "watch": "tsc -w -noEmit" + }, + "keywords": [], + "dependencies": { + "meta3d-type": "^0.20.0", + "meta3d-ui-protocol": "^0.20.0" + }, + "devDependencies": { + "typescript": "^4.2.3" + } +} diff --git a/utils/meta3d-scenetree-utils/src/SceneTreeUtils.ts b/utils/meta3d-scenetree-utils/src/SceneTreeUtils.ts new file mode 100755 index 000000000..334d47801 --- /dev/null +++ b/utils/meta3d-scenetree-utils/src/SceneTreeUtils.ts @@ -0,0 +1,50 @@ +import { gameObject } from "meta3d-gameobject-protocol" +import { state as meta3dState, api } from "meta3d-type" +import { service } from "meta3d-editor-whole-protocol/src/service/ServiceType" +import { getExn, isNullable } from "meta3d-commonlib-ts/src/NullableUtils" +import { treeIndexData } from "meta3d-imgui-renderer-protocol/src/service/ServiceType" + +export type hierachyGameObjects = Array<[gameObject, hierachyGameObjects]> + +export let getAllTopGameObjects = (meta3dState: meta3dState, editorWholeService: service) => { + let { gameObject, transform } = editorWholeService.scene(meta3dState) + + return gameObject.getAllGameObjects(meta3dState).filter(gameObject_ => { + return isNullable(transform.getParent(meta3dState, gameObject.getTransform(meta3dState, gameObject_))) + }) +} + +export let buildHierachyGameObjects = (result: hierachyGameObjects, + editorWholeService: service, + meta3dState: meta3dState, parentGameObjects: Array): hierachyGameObjects => { + let { gameObject, transform } = editorWholeService.scene(meta3dState) + + return parentGameObjects.reduce((result, parentGameObject) => { + let children = transform.getChildren(meta3dState, gameObject.getTransform(meta3dState, parentGameObject)) + + if (isNullable(children) || getExn(children).length == 0) { + result.push([parentGameObject, []]) + } + else { + result.push([parentGameObject, buildHierachyGameObjects([], editorWholeService, meta3dState, getExn(children).map(child => { + return transform.getGameObjects(meta3dState, child)[0] + }) + )]) + } + + return result + }, result) +} + + +export let findSelectedGameObject = (hierachyGameObjects: hierachyGameObjects, treeIndexData: treeIndexData): gameObject => { + let _func = (hierachyGameObjects: hierachyGameObjects, index: number, treeIndexData: treeIndexData): gameObject => { + if (treeIndexData.length == 0) { + return hierachyGameObjects[index][0] + } + + return _func(hierachyGameObjects[index][1], getExn(treeIndexData[0]), treeIndexData.slice(1)) + } + + return _func(hierachyGameObjects, getExn(treeIndexData[0]), treeIndexData.slice(1)) +} \ No newline at end of file diff --git a/utils/meta3d-scenetree-utils/tsconfig.json b/utils/meta3d-scenetree-utils/tsconfig.json new file mode 100755 index 000000000..35222fb79 --- /dev/null +++ b/utils/meta3d-scenetree-utils/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + // "noUnusedLocals": true, + // "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/utils/meta3d-ui-control-utils/.gitignore b/utils/meta3d-ui-control-utils/.gitignore new file mode 100755 index 000000000..27f6619fb --- /dev/null +++ b/utils/meta3d-ui-control-utils/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/utils/meta3d-ui-control-utils/package.json b/utils/meta3d-ui-control-utils/package.json new file mode 100755 index 000000000..8c9fd531d --- /dev/null +++ b/utils/meta3d-ui-control-utils/package.json @@ -0,0 +1,16 @@ +{ + "name": "meta3d-ui-control-utils", + "version": "0.20.0", + "license": "", + "scripts": { + "watch": "tsc -w -noEmit" + }, + "keywords": [], + "dependencies": { + "meta3d-type": "^0.20.0", + "meta3d-ui-protocol": "^0.20.0" + }, + "devDependencies": { + "typescript": "^4.2.3" + } +} diff --git a/utils/meta3d-ui-control-utils/src/SpecificDataUtils.ts b/utils/meta3d-ui-control-utils/src/SpecificDataUtils.ts new file mode 100755 index 000000000..ec5b10bf5 --- /dev/null +++ b/utils/meta3d-ui-control-utils/src/SpecificDataUtils.ts @@ -0,0 +1,34 @@ +import { nullable } from "meta3d-commonlib-ts/src/nullable" +import { state as meta3dState, api } from "meta3d-type" +import { service } from "meta3d-editor-whole-protocol/src/service/ServiceType" + +type imageBase64 = string + +export let loadImage = ( + meta3dState: meta3dState, + api: api, + [getLastImageFunc, setImageDataFunc]: [(meta3dState: meta3dState) => nullable, (meta3dState: meta3dState, texture: any, image: imageBase64) => any], + label: string, + image: nullable, +): Promise => { + let { loadImage } = api.nullable.getExn(api.getPackageService(meta3dState, "meta3d-editor-whole-protocol")).ui(meta3dState) + + let promise = null + if (!api.nullable.isNullable(image) && api.nullable.getWithDefault(api.nullable.map(lastFileTextureImageBase64 => lastFileTextureImageBase64 != api.nullable.getExn(image), getLastImageFunc(meta3dState)), true)) { + promise = loadImage(meta3dState, api.nullable.getExn(image)).then((texture: any) => { + meta3dState = api.uiControl.setUIControlState(meta3dState, label, + setImageDataFunc( + meta3dState, + texture, + api.nullable.getExn(image) + )) + + return meta3dState + }) + } + else { + promise = Promise.resolve(meta3dState) + } + + return promise +} \ No newline at end of file diff --git a/utils/meta3d-ui-control-utils/tsconfig.json b/utils/meta3d-ui-control-utils/tsconfig.json new file mode 100755 index 000000000..35222fb79 --- /dev/null +++ b/utils/meta3d-ui-control-utils/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "jsx": "react", + // "noEmit": true, + // "noUnusedLocals": true, + // "noUnusedParameters": true, + "noImplicitReturns": true, + "lib": [ + "DOM", + "ESNext", + ], + "types": [], + "strict": true + }, + "include": [ + "./src" + ] +} \ No newline at end of file