Skip to content

Commit

Permalink
fix(editor): fix export single event->import it bug
Browse files Browse the repository at this point in the history
description
has these bugs:
has Aux Scene->Scene;
name miss;
light has one child;
game view's Camera change;

(fix(action): fix action->bundle duplicate bug)
  • Loading branch information
yyc-git committed Dec 19, 2023
1 parent fb84fb6 commit 88a81bd
Show file tree
Hide file tree
Showing 39 changed files with 128 additions and 69 deletions.
1 change: 1 addition & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
scopes: [
{ name: "editor" },
{ name: "engine" },
{ name: "extension" },
{ name: "platform" },
{ name: "services" },
{ name: "templates" },
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-add-cube/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-action-add-cube",
"version": "0.21.4",
"version": "0.21.5",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"displayName": "add-cube",
"repoLink": "https://github.com/Meta3D-Technology/Meta3D/tree/master/contributes/meta3d-action-add-cube",
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-add-cube/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
state.addedGameObjects.push(addedGameObject)
})

return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState,api, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
}, (meta3dState) => {
let {
addedGameObjects,
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-add-glb-to-scene/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-action-add-glb-to-scene",
"version": "0.21.4",
"version": "0.21.5",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"repoLink": "",
"protocol": {
Expand Down
3 changes: 1 addition & 2 deletions contributes/meta3d-action-add-glb-to-scene/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { eventName, inputData } from "meta3d-action-drop-glb-to-sceneview-protoc
// import { service as converterGameViewService } from "meta3d-scenegraph-converter-three-gameview-protocol/src/service/ServiceType"
// import { service as runEngineGameViewService } from "meta3d-editor-run-engine-gameview-protocol/src/service/ServiceType"
// import { service as assetService } from "meta3d-asset-protocol/src/service/ServiceType"
// import { getExn, isNullable } from "meta3d-commonlib-ts/src/NullableUtils"
// import { getActionState, setElementStateField } from "meta3d-ui-utils/src/ElementStateUtils"
// import { getState, setState } from "./Utils"
import { disposeGameObjectAndAllChildren } from "meta3d-dispose-utils/src/DisposeGameObjectUtils"
Expand Down Expand Up @@ -59,7 +58,7 @@ export let getContribute: getContributeMeta3D<actionContribute<dropAssetFileUIDa
state.importedGameObjects.push(importedGameObject)
})

return runGameViewRenderOnlyOnce(meta3dState, editorWholeService)
return runGameViewRenderOnlyOnce(meta3dState,api, editorWholeService)
})
}, (meta3dState) => {
let {
Expand Down
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.21.3",
"version": "0.21.4",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"repoLink": "",
"protocol": {
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-clone-gameobject/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
allClonedGameObjects: state.allClonedGameObjects.push(api.immutable.createListOfData( clonedGameObjects)),
})

return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState,api, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
}, (meta3dState) => {
let {
allClonedGameObjects,
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-dispose-gameobject/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-action-dispose-gameobject",
"version": "0.21.3",
"version": "0.21.4",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"repoLink": "",
"protocol": {
Expand Down
4 changes: 2 additions & 2 deletions contributes/meta3d-action-dispose-gameobject/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
meta3dState = api.action.setActionState(meta3dState, actionName, {
...state,
allSelectedGameObjects: state.allSelectedGameObjects.push(selectedGameObject),
allDisposedGameObjectData: state.allDisposedGameObjectData.push(api.immutable.createListOfData( disposedGameObjectData)),
allDisposedGameObjectData: state.allDisposedGameObjectData.push(api.immutable.createListOfData(disposedGameObjectData)),
})

meta3dState = api.action.setActionState(meta3dState, selectSceneTreeNodeActionName, {
Expand All @@ -102,7 +102,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
})


return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState, api, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
}, (meta3dState) => {
let {
allSelectedGameObjects,
Expand Down
3 changes: 1 addition & 2 deletions contributes/meta3d-action-import-single-event/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { eventSourcingService } from "meta3d-event-protocol/src/service/ServiceT
import { uiData, actionName, state } from "meta3d-action-import-single-event-protocol"
import { eventName, inputData } from "meta3d-action-import-single-event-protocol/src/EventType"
// import { service as eventSourcingService } from "meta3d-event-sourcing-protocol/src/service/ServiceType"
// import { api.nullable.getExn } from "meta3d-commonlib-ts/src/NullableUtils"
// import { service as importSceneService } from "meta3d-import-scene-protocol/src/service/ServiceType"
// import { service as assetService } from "meta3d-asset-protocol/src/service/ServiceType"
// import { service as runEngineGameViewService } from "meta3d-editor-run-engine-gameview-protocol/src/service/ServiceType"
Expand Down Expand Up @@ -38,7 +37,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =

// meta3dState = assetService.importAsset(meta3dState, assetFile)

return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState,api, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
})
}, (meta3dState) => {
return Promise.resolve(meta3dState)
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-run/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
init: (meta3dState) => {
let eventSourcingService = api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState)

// meta3dState = runGameViewRenderOnlyOnce(meta3dState, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")))
// meta3dState = runGameViewRenderOnlyOnce(meta3dState,api, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")))

return new Promise((resolve, reject) => {
resolve(eventSourcingService.on<inputData>(meta3dState, eventName, 0, (meta3dState) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-action-select-scenetree-node",
"version": "0.21.3",
"version": "0.21.4",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"repoLink": "",
"protocol": {
Expand Down
4 changes: 2 additions & 2 deletions contributes/meta3d-action-select-scenetree-node/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
resolve(eventSourcingService.addEvent<inputData>(meta3dState, {
name: eventName,
inputData: [
findSelectedGameObject(buildHierachyGameObjects([],
findSelectedGameObject(api, buildHierachyGameObjects(api, [],
editorWholeService,
meta3dState, getAllTopGameObjects(meta3dState, editorWholeService)), api.nullable.getExn(uiData))
meta3dState, getAllTopGameObjects(api, meta3dState, editorWholeService)), api.nullable.getExn(uiData))
]
}))
})
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-set-gameobjectname/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
allGameObjectNameData: state.allGameObjectNameData.push([gameObject, oldName]),
})

return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState,api, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
}, (meta3dState) => {
let {
allGameObjectNameData
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-set-localeulerangle/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
allLocalEulerAngleData: state.allLocalEulerAngleData.push([gameObject, oldLocalEulerAngle]),
})

return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState,api, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
}, (meta3dState) => {
let {
allLocalEulerAngleData
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-set-localposition/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
allLocalPositionData: state.allLocalPositionData.push([gameObject, oldLocalPosition]),
})

return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState,api, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
}, (meta3dState) => {
let {
allLocalPositionData
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-set-localscale/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
allLocalScaleData: state.allLocalScaleData.push([gameObject, oldLocalScale]),
})

return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState,api, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
}, (meta3dState) => {
let {
allLocalScaleData
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-action-set-parent/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-action-set-parent",
"version": "0.21.3",
"version": "0.21.7",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"repoLink": "",
"protocol": {
Expand Down
10 changes: 5 additions & 5 deletions contributes/meta3d-action-set-parent/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
})


return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
return Promise.resolve(runGameViewRenderOnlyOnce(meta3dState, api, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol"))))
}, (meta3dState) => {
let state = api.nullable.getExn(api.action.getActionState<state>(meta3dState, actionName))
let {
Expand Down Expand Up @@ -79,15 +79,15 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =

let { source, target } = uiData

let hierachyGameObjects = buildHierachyGameObjects([],
let hierachyGameObjects = buildHierachyGameObjects(api, [],
editorWholeService,
meta3dState, getAllTopGameObjects(meta3dState, editorWholeService))
meta3dState, getAllTopGameObjects(api, meta3dState, editorWholeService))

resolve(eventSourcingService.addEvent<inputData>(meta3dState, {
name: eventName,
inputData: [{
source: findSelectedGameObject(hierachyGameObjects, source),
target: target.length == 0 ? null : findSelectedGameObject(hierachyGameObjects, target)
source: findSelectedGameObject(api, hierachyGameObjects, source),
target: target.length == 0 ? null : findSelectedGameObject(api, hierachyGameObjects, target)
}]
}))
})
Expand Down
2 changes: 1 addition & 1 deletion contributes/meta3d-input-scenetree/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-input-scenetree",
"version": "0.21.3",
"version": "0.21.5",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"description": "",
"protocol": {
Expand Down
13 changes: 7 additions & 6 deletions contributes/meta3d-input-scenetree/src/Main.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { state as meta3dState, getContribute as getContributeMeta3D } from "meta3d-type"
import { state as meta3dState, getContribute as getContributeMeta3D, api } 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 = (
api: api,
editorWholeService: service,
meta3dState: meta3dState, hierachyGameObjects: hierachyGameObjects,
): data => {
let { gameObject } = editorWholeService.scene(meta3dState)

return hierachyGameObjects.map(([gameObject_, children]) => {
return [
getWithDefault(gameObject.getGameObjectName(meta3dState, gameObject_), ""),
api.nullable.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)
_convertToTreeData(api, editorWholeService, meta3dState, children)
]
})
}
Expand All @@ -28,11 +28,12 @@ export let getContribute: getContributeMeta3D<inputContribute<data>> = (api) =>
func: (meta3dState) => {
let editorWholeService = api.nullable.getExn(api.getPackageService<service>(meta3dState, "meta3d-editor-whole-protocol"))

let hierachyGameObjects = buildHierachyGameObjects([],
let hierachyGameObjects = buildHierachyGameObjects(api,[],
editorWholeService,
meta3dState, getAllTopGameObjects(meta3dState, editorWholeService))
meta3dState, getAllTopGameObjects(api, meta3dState, editorWholeService))

return Promise.resolve(_convertToTreeData(
api,
editorWholeService,
meta3dState, hierachyGameObjects
))
Expand Down
38 changes: 38 additions & 0 deletions doc/1.0.0-beta1_3.org
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,44 @@ TODO fix message
TODO add all ui controls


TODO fix: wheel event not work

# TODO fix: dispose gameObject error

# TODO fix: import: cube: position,color not the same
TODO fix: export single event:
# another Aux Scene
# name miss
//Cube name change
# light has one child
# Camera change


TODO update and publish:
engine-whole
editor-whole
asset
three



TODO test publish




TODO not newest ui control?




TODO test controller

TODO test asset

TODO test inspector



# * TODO 更新extension

Expand Down
2 changes: 1 addition & 1 deletion packages/asset/extensions/meta3d-load-glb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-load-glb",
"version": "0.21.4",
"version": "0.21.5",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"protocol": {
"name": "meta3d-load-glb-protocol"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,14 @@ class GLTFLightsExtension {
case 'directional':
lightNode = new DirectionalLight(color);
lightNode.target.position.set(0, 0, - 1);
lightNode.add(lightNode.target);


/*! edit by Meta3D
*
*/
// lightNode.add(lightNode.target);


break;

case 'point':
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-editor-webgl1-three-whole",
"version": "0.21.5",
"version": "0.21.6",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"protocol": {
"name": "meta3d-editor-whole-protocol"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export let sync = (meta3dState: meta3dState, api: api) => {
).then(meta3dState => {
return eventSourcingService.replaceAllEvents(meta3dState, allEvents.slice(0, allEvents.count() - events.count()))
}).then(meta3dState => {
return runGameViewRenderOnlyOnce(meta3dState, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")))
return runGameViewRenderOnlyOnce(meta3dState,api, api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")))
})
// .then(meta3dState => {
// return eventSourcingService.cleanAllNeedEvents(meta3dState)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-export-scene",
"version": "0.21.4",
"version": "0.21.5",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"protocol": {
"name": "meta3d-export-scene-protocol"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,7 @@ const PATH_PROPERTIES = {
};


/*! edit by Meta3D
*
*/
/*! edit by Meta3D */
// const DEFAULT_SPECULAR_COLOR = new Color();
var DEFAULT_SPECULAR_COLOR = null;

Expand Down Expand Up @@ -2405,7 +2403,6 @@ class GLTFWriter {
for (let i = 0; i < input.length; i++) {

if (input[i] instanceof Scene) {

this.processScene(input[i]);

} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-import-scene",
"version": "0.21.4",
"version": "0.21.5",
"publisher": "0xf63e1991A343814EdE505D7cfC368615EAe75307",
"displayName": "meta3d-import-scene",
"protocol": {
Expand Down
Loading

0 comments on commit 88a81bd

Please sign in to comment.