Skip to content

Commit

Permalink
feat(uicontrol): add Inspector
Browse files Browse the repository at this point in the history
split inspector to multiple ui controls: Input3Float, Text, InputText, CollapsingHeader + Window;
Window add input;
update UIControlInspector, ElementMRUtils;
  • Loading branch information
yyc-git committed Nov 28, 2023
1 parent 86d30c7 commit 6f6e093
Show file tree
Hide file tree
Showing 199 changed files with 4,516 additions and 238 deletions.
2 changes: 1 addition & 1 deletion contributes/meta3d-action-clone-gameobject/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-action-clone-gameobject",
"version": "0.20.1",
"version": "0.20.2",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"repoLink": "",
"protocol": {
Expand Down
1 change: 0 additions & 1 deletion contributes/meta3d-action-clone-gameobject/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
meta3dState = engineSceneService.gameObject.disposeGameObjects(meta3dState, clonedGameObjects)

let state = api.nullable.getExn(api.action.getActionState<state>(meta3dState, actionName))

meta3dState = api.action.setActionState(meta3dState, actionName, {
...state,
allClonedGameObjects: state.allClonedGameObjects.pop(),
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-publish/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-action-publish",
"version": "0.20.13",
"version": "0.20.14",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"protocol": {
"name": "meta3d-action-publish-protocol"
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-publish/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export let getContribute: getContributeMeta3D<actionContribute<clickUIData, stat

return new Promise((resolve, reject) => {
resolve(eventSourcingService.on<inputData>(meta3dState, eventName, 0, (meta3dState) => {
if (api.action.getActionState<runState>(meta3dState, runActionName).isRun) {
if (api.nullable.getWithDefault(api.nullable.map(runState => runState.isRun, api.action.getActionState<runState>(meta3dState, runActionName)), false)) {
console.warn("can't publish when run")

return (new Promise((resolve) => {
Expand Down
19 changes: 19 additions & 0 deletions contributes/meta3d-action-set-gameobjectname/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.DS_Store
.merlin
.idea/
.vscode/
jest_0/
reference/
node_modules/
mine/

coverage

dist/

npm-debug

.bsb.lock

yarn.lock

25 changes: 25 additions & 0 deletions contributes/meta3d-action-set-gameobjectname/gulpfile.js
Original file line number Diff line number Diff line change
@@ -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()
})
});


36 changes: 36 additions & 0 deletions contributes/meta3d-action-set-gameobjectname/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "meta3d-action-set-gameobjectname",
"version": "0.20.1",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"repoLink": "",
"protocol": {
"name": "meta3d-action-set-gameobjectname-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-action-set-gameobjectname-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"
}
}
101 changes: 101 additions & 0 deletions contributes/meta3d-action-set-gameobjectname/src/Main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
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-gameobjectname-protocol"
import { eventName, inputData } from "meta3d-action-set-gameobjectname-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"

export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> = (api) => {
return {
actionName: actionName,
init: (meta3dState) => {
let eventSourcingService = api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState)

return new Promise((resolve, reject) => {
resolve(eventSourcingService.on<inputData>(meta3dState, eventName, 0, (meta3dState, gameObject, name) => {
let editorWholeService = api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))
let engineSceneService = editorWholeService.scene(meta3dState)

let oldName = engineSceneService.gameObject.getGameObjectName(meta3dState,
gameObject
)

meta3dState = engineSceneService.gameObject.setGameObjectName(meta3dState,
gameObject,
name
)


let state = api.nullable.getExn(api.action.getActionState<state>(meta3dState, actionName))
meta3dState = api.action.setActionState(meta3dState, actionName, {
...state,
allGameObjectNameData: state.allGameObjectNameData.push([gameObject, oldName]),
})

return Promise.resolve(api.nullable.getWithDefault(
api.nullable.map(
({ runOnlyOnce }) => {
return runOnlyOnce(meta3dState)
},
editorWholeService.getPluggablePackageService<gameViewRenderService>(meta3dState, "meta3d-editor-gameview-render-protocol")
),
meta3dState
))
}, (meta3dState) => {
let {
allGameObjectNameData
} = api.nullable.getExn(api.action.getActionState<state>(meta3dState, actionName))

if (api.nullable.isNullable(allGameObjectNameData.last())) {
return Promise.resolve(meta3dState)
}

let [gameObject, name] = api.nullable.getExn(allGameObjectNameData.last())

let engineSceneService = api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))
.scene(meta3dState)

meta3dState = api.nullable.getWithDefault(api.nullable.map((name) => {
return engineSceneService.gameObject.setGameObjectName(meta3dState, gameObject, name)
}, name), meta3dState)

let state = api.nullable.getExn(api.action.getActionState<state>(meta3dState, actionName))
meta3dState = api.action.setActionState(meta3dState, actionName, {
...state,
allGameObjectNameData: state.allGameObjectNameData.pop(),
})

return Promise.resolve(meta3dState)
}))
})
},
handler: (meta3dState, uiData) => {
return new Promise<meta3dState>((resolve, reject) => {
let {
selectedGameObject,
} = api.nullable.getExn(api.action.getActionState<selectSceneTreeNodeState>(meta3dState, selectSceneTreeNodeActionName))

if (api.nullable.isNullable(selectedGameObject)) {
resolve(meta3dState)

return
}

let eventSourcingService = api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState)

resolve(eventSourcingService.addEvent<inputData>(meta3dState, {
name: eventName,
inputData: [
api.nullable.getExn(selectedGameObject),
uiData
]
}))
})
},
createState: (meta3dState) => {
return {
allGameObjectNameData: api.immutable.createList(meta3dState)
}
}
}
}
24 changes: 24 additions & 0 deletions contributes/meta3d-action-set-gameobjectname/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
64 changes: 64 additions & 0 deletions contributes/meta3d-action-set-gameobjectname/webpack.config.js
Original file line number Diff line number Diff line change
@@ -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 <PROJECT_DIR>/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: {
}
};
19 changes: 19 additions & 0 deletions contributes/meta3d-action-set-localeulerangle/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.DS_Store
.merlin
.idea/
.vscode/
jest_0/
reference/
node_modules/
mine/

coverage

dist/

npm-debug

.bsb.lock

yarn.lock

25 changes: 25 additions & 0 deletions contributes/meta3d-action-set-localeulerangle/gulpfile.js
Original file line number Diff line number Diff line change
@@ -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()
})
});


36 changes: 36 additions & 0 deletions contributes/meta3d-action-set-localeulerangle/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "meta3d-action-set-localeulerangle",
"version": "0.20.1",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"repoLink": "",
"protocol": {
"name": "meta3d-action-set-localeulerangle-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-action-set-localeulerangle-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"
}
}
Loading

0 comments on commit 6f6e093

Please sign in to comment.