From d4b536319ece81660a87a6e1e580786a4e8bf582 Mon Sep 17 00:00:00 2001 From: yyc-git <395976266@qq.com> Date: Sat, 9 Mar 2024 10:34:53 +0800 Subject: [PATCH] perf(editor): if script error, not download eventData, and still continue loop --- contributes/meta3d-action-run/package.json | 2 +- doc/jiehuo.org | 11 +++++++++-- .../meta3d-editor-webgl1-three-whole/package.json | 2 +- .../meta3d-editor-webgl1-three-whole/src/Main.ts | 14 +++++++++----- .../package.json | 6 +++--- .../lib/es6_global/src/service/ServiceType.bs.js | 0 .../meta3d-engine-whole-protocol/lib/bs/.bsbuild | 0 .../meta3d-engine-whole-protocol/lib/bs/.bsdeps | 0 .../lib/bs/.compiler.log | 4 ++-- .../lib/bs/.ninja_log | 14 +++++++------- .../lib/bs/build.ninja | 0 .../lib/bs/install.ninja | 0 .../lib/bs/src/service/ServiceType.ast | Bin .../lib/bs/src/service/ServiceType.d | 0 .../lib/es6_global/src/service/ServiceType.bs.js | 0 .../lib/js/src/service/ServiceType.bs.js | 0 .../lib/es6_global/src/service/ServiceType.bs.js | 0 .../lib/es6_global/src/state/StateType.bs.js | 0 .../lib/js/src/service/ServiceType.bs.js | 0 .../lib/js/src/state/StateType.bs.js | 0 .../element_visual/components/ElementVisual.res | 13 +++++++++++++ .../components/RunElementVisual.res | 11 +++++++++++ .../lib/es6_global/src/DownloadUtils.bs.js | 0 utils/meta3d-script-utils/src/Main.ts | 14 +++++++++++--- 24 files changed, 67 insertions(+), 24 deletions(-) mode change 100755 => 100644 packages/editor-whole/protocols/extension_protocols/meta3d-editor-whole-protocol/lib/es6_global/src/service/ServiceType.bs.js mode change 100755 => 100644 packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.bsbuild mode change 100755 => 100644 packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.bsdeps mode change 100755 => 100644 packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.compiler.log mode change 100755 => 100644 packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.ninja_log mode change 100755 => 100644 packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/build.ninja mode change 100755 => 100644 packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/install.ninja mode change 100755 => 100644 packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/src/service/ServiceType.ast mode change 100755 => 100644 packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/src/service/ServiceType.d mode change 100755 => 100644 packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/es6_global/src/service/ServiceType.bs.js mode change 100755 => 100644 packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/js/src/service/ServiceType.bs.js mode change 100755 => 100644 packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/es6_global/src/service/ServiceType.bs.js mode change 100755 => 100644 packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/es6_global/src/state/StateType.bs.js mode change 100755 => 100644 packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/js/src/service/ServiceType.bs.js mode change 100755 => 100644 packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/js/src/state/StateType.bs.js mode change 100755 => 100644 utils/meta3d-file-utils/lib/es6_global/src/DownloadUtils.bs.js diff --git a/contributes/meta3d-action-run/package.json b/contributes/meta3d-action-run/package.json index 112d1dbd8..c5c5a98be 100755 --- a/contributes/meta3d-action-run/package.json +++ b/contributes/meta3d-action-run/package.json @@ -1,6 +1,6 @@ { "name": "meta3d-action-run", - "version": "1.3.4", + "version": "1.3.5", "publisher": "meta3d", "displayName": "meta3d-action-run", "repoLink": "", diff --git a/doc/jiehuo.org b/doc/jiehuo.org index 9599942e0..f91ee1bef 100755 --- a/doc/jiehuo.org +++ b/doc/jiehuo.org @@ -112,9 +112,9 @@ TODO packages: -* TODO 优化: 错误 打印 +* DONE 优化: 错误 打印 -use error instead of throw +# use error instead of throw @@ -122,9 +122,16 @@ TODO RunElementVisual: if error, show error message and continue(loop) +TODO fix: +continue from event data: recursive + +TODO e,c,p: +editor-whole +gameview c +run diff --git a/packages/editor-whole/extensions/meta3d-editor-webgl1-three-whole/package.json b/packages/editor-whole/extensions/meta3d-editor-webgl1-three-whole/package.json index 1009f888b..4a3fc5cb7 100755 --- a/packages/editor-whole/extensions/meta3d-editor-webgl1-three-whole/package.json +++ b/packages/editor-whole/extensions/meta3d-editor-webgl1-three-whole/package.json @@ -1,6 +1,6 @@ { "name": "meta3d-editor-webgl1-three-whole", - "version": "1.3.3", + "version": "1.3.4", "publisher": "meta3d", "protocol": { "name": "meta3d-editor-whole-protocol" diff --git a/packages/editor-whole/extensions/meta3d-editor-webgl1-three-whole/src/Main.ts b/packages/editor-whole/extensions/meta3d-editor-webgl1-three-whole/src/Main.ts index bf064901c..0557b317f 100755 --- a/packages/editor-whole/extensions/meta3d-editor-webgl1-three-whole/src/Main.ts +++ b/packages/editor-whole/extensions/meta3d-editor-webgl1-three-whole/src/Main.ts @@ -277,7 +277,11 @@ let _exportEventDataForDebug = (meta3dState: meta3dState, eventSourcingService: ) } -let _handleError = (api: api, meta3dState: meta3dState) => { +let _handleError = (api: api, e: Error, meta3dState: meta3dState) => { + if ((e as any).errorType === "script") { + return + } + let eventService = getExn(api.getPackageService(meta3dState, "meta3d-event-protocol")) _exportEventDataForDebug( @@ -306,7 +310,7 @@ let _updateForVisual = (meta3dState, api: api, { clearColor, time, skinName }) = ).then(meta3dState => { return render(meta3dState, ["meta3d-ui-protocol", "meta3d-imgui-renderer-protocol"], time) }).catch(e => { - _handleError(api, meta3dState) + _handleError(api, e, meta3dState) throw e }) } @@ -334,7 +338,7 @@ let _updateForVisualRun = (meta3dState, api: api, { clearColor, time, skinName } }).then(meta3dState => { return _loopEngine(meta3dState, api) }).catch(e => { - _handleError(api, meta3dState) + _handleError(api, e, meta3dState) throw e }) } @@ -460,7 +464,7 @@ export let getExtensionService: getExtensionServiceMeta3D< return _initBackend(api, meta3dState, env) }).catch(e => { - _handleError(api, meta3dState) + _handleError(api, e, meta3dState) throw e }) }, @@ -502,7 +506,7 @@ export let getExtensionService: getExtensionServiceMeta3D< return _initBackend(api, meta3dState, env) }).catch(e => { - _handleError(api, meta3dState) + _handleError(api, e, meta3dState) throw e }).then((meta3dState: meta3dState) => { _loop(api, meta3dState, diff --git a/packages/editor-whole/gameview-render/contributes/meta3d-pipeline-webgl1-three-gameviewrender/package.json b/packages/editor-whole/gameview-render/contributes/meta3d-pipeline-webgl1-three-gameviewrender/package.json index 10d357fef..f774a10ab 100755 --- a/packages/editor-whole/gameview-render/contributes/meta3d-pipeline-webgl1-three-gameviewrender/package.json +++ b/packages/editor-whole/gameview-render/contributes/meta3d-pipeline-webgl1-three-gameviewrender/package.json @@ -1,6 +1,6 @@ { "name": "meta3d-pipeline-webgl1-three-gameviewrender", - "version": "1.3.4", + "version": "1.3.6", "publisher": "meta3d", "protocol": { "name": "meta3d-pipeline-webgl1-three-gameviewrender-protocol" @@ -20,12 +20,12 @@ "meta3d-editor-whole-protocol": "^1.3.0", "meta3d-engine-scene-protocol": "^1.3.0", "meta3d-event-protocol": "^1.3.0", + "meta3d-interact-protocol": "^1.3.0", "meta3d-pipeline-webgl1-three-gameviewrender-protocol": "^1.3.0", "meta3d-three-protocol": "^1.3.0", "meta3d-type": "^1.3.0", "meta3d-ui-control-game-view-protocol": "^1.3.0", - "meta3d-ui-protocol": "^1.3.0", - "meta3d-interact-protocol": "^1.3.0" + "meta3d-ui-protocol": "^1.3.0" }, "devDependencies": { "clean-webpack-plugin": "^4.0.0", diff --git a/packages/editor-whole/protocols/extension_protocols/meta3d-editor-whole-protocol/lib/es6_global/src/service/ServiceType.bs.js b/packages/editor-whole/protocols/extension_protocols/meta3d-editor-whole-protocol/lib/es6_global/src/service/ServiceType.bs.js old mode 100755 new mode 100644 diff --git a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.bsbuild b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.bsbuild old mode 100755 new mode 100644 diff --git a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.bsdeps b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.bsdeps old mode 100755 new mode 100644 diff --git a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.compiler.log b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.compiler.log old mode 100755 new mode 100644 index e6ac94c40..a98b97c91 --- a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.compiler.log +++ b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.compiler.log @@ -1,2 +1,2 @@ -#Start(1709712948934) -#Done(1709712949000) +#Start(1709949306018) +#Done(1709949306129) diff --git a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.ninja_log b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.ninja_log old mode 100755 new mode 100644 index 31e6904f0..ea819b46a --- a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.ninja_log +++ b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/.ninja_log @@ -1,8 +1,8 @@ # ninja log v6 -0 22 1709712948954362457 src/service/ServiceType.ast 785165cefc5839bb -2 23 1709712948954561547 Meta3dEngineWholeProtocol.cmi 5f7f0af9dc9a4eae -22 35 1709712948969515735 src/service/ServiceType.d c1e4bb8db3eac460 -36 66 1709712948999659971 src/service/ServiceType-Meta3dEngineWholeProtocol.cmj 9289db688d33118 -36 66 1709712948999659971 src/service/ServiceType-Meta3dEngineWholeProtocol.cmi 9289db688d33118 -36 66 1709712948999659971 ../es6_global/src/service/ServiceType.bs.js 9289db688d33118 -36 66 1709712948999659971 ../js/src/service/ServiceType.bs.js 9289db688d33118 +0 51 1709949306066317060 src/service/ServiceType.ast 785165cefc5839bb +1 61 1709949306069640066 Meta3dEngineWholeProtocol.cmi 5f7f0af9dc9a4eae +52 79 1709949306097357718 src/service/ServiceType.d c1e4bb8db3eac460 +79 111 1709949306127861955 src/service/ServiceType-Meta3dEngineWholeProtocol.cmj add6d9188dcc48c9 +79 111 1709949306127861955 src/service/ServiceType-Meta3dEngineWholeProtocol.cmi add6d9188dcc48c9 +79 111 1709949306127861955 ../es6_global/src/service/ServiceType.bs.js add6d9188dcc48c9 +79 111 1709949306127861955 ../js/src/service/ServiceType.bs.js add6d9188dcc48c9 diff --git a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/build.ninja b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/build.ninja old mode 100755 new mode 100644 diff --git a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/install.ninja b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/install.ninja old mode 100755 new mode 100644 diff --git a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/src/service/ServiceType.ast b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/src/service/ServiceType.ast old mode 100755 new mode 100644 diff --git a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/src/service/ServiceType.d b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/bs/src/service/ServiceType.d old mode 100755 new mode 100644 diff --git a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/es6_global/src/service/ServiceType.bs.js b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/es6_global/src/service/ServiceType.bs.js old mode 100755 new mode 100644 diff --git a/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/js/src/service/ServiceType.bs.js b/packages/engine-whole/protocols/extension_protocols/meta3d-engine-whole-protocol/lib/js/src/service/ServiceType.bs.js old mode 100755 new mode 100644 diff --git a/packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/es6_global/src/service/ServiceType.bs.js b/packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/es6_global/src/service/ServiceType.bs.js old mode 100755 new mode 100644 diff --git a/packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/es6_global/src/state/StateType.bs.js b/packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/es6_global/src/state/StateType.bs.js old mode 100755 new mode 100644 diff --git a/packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/js/src/service/ServiceType.bs.js b/packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/js/src/service/ServiceType.bs.js old mode 100755 new mode 100644 diff --git a/packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/js/src/state/StateType.bs.js b/packages/event/protocols/extension_protocols/meta3d-event-data-protocol/lib/js/src/state/StateType.bs.js old mode 100755 new mode 100644 diff --git a/platform/frontend/src/external_layer/ui/app/assemble_space/components/element_assemble/element_visual/components/ElementVisual.res b/platform/frontend/src/external_layer/ui/app/assemble_space/components/element_assemble/element_visual/components/ElementVisual.res index d8c8a1a00..16adc7dca 100755 --- a/platform/frontend/src/external_layer/ui/app/assemble_space/components/element_assemble/element_visual/components/ElementVisual.res +++ b/platform/frontend/src/external_layer/ui/app/assemble_space/components/element_assemble/element_visual/components/ElementVisual.res @@ -119,6 +119,19 @@ module Method = { }, _) ->Js.Promise.catch(e => { service.console.errorWithExn(. e->Error.promiseErrorToExn, None)->Obj.magic + + // loopFrameID.current = + // service.other.requestAnimationOtherFrame(time => { + // MessageUtils.showCatchedErrorMessage( + // () => { + // _loop(service, loopFrameID, apInspectorData, time, meta3dState) + // }, + // 5->Some, + // ) + // })->Some + + // ()->Js.Promise.resolve + }, _) ->ignore } diff --git a/platform/frontend/src/external_layer/ui/app/assemble_space/components/element_assemble/run_element_visual/components/RunElementVisual.res b/platform/frontend/src/external_layer/ui/app/assemble_space/components/element_assemble/run_element_visual/components/RunElementVisual.res index 70ea42b7e..aed3d7eb4 100755 --- a/platform/frontend/src/external_layer/ui/app/assemble_space/components/element_assemble/run_element_visual/components/RunElementVisual.res +++ b/platform/frontend/src/external_layer/ui/app/assemble_space/components/element_assemble/run_element_visual/components/RunElementVisual.res @@ -52,6 +52,17 @@ module Method = { }, _) ->Js.Promise.catch(e => { service.console.errorWithExn(. e->Error.promiseErrorToExn, None)->Obj.magic + + (e->Obj.magic)["errorType"] === "script" + ? { + loopFrameID.current = + service.other.requestAnimationOtherFrame(time => { + _loop(service, loopFrameID, apInspectorData, time, meta3dState) + })->Some + + ()->Js.Promise.resolve + } + : e->Js.Exn.anyToExnInternal->Js.Promise.reject }, _) ->ignore } diff --git a/utils/meta3d-file-utils/lib/es6_global/src/DownloadUtils.bs.js b/utils/meta3d-file-utils/lib/es6_global/src/DownloadUtils.bs.js old mode 100755 new mode 100644 diff --git a/utils/meta3d-script-utils/src/Main.ts b/utils/meta3d-script-utils/src/Main.ts index f395a2793..04e6e027d 100755 --- a/utils/meta3d-script-utils/src/Main.ts +++ b/utils/meta3d-script-utils/src/Main.ts @@ -19,9 +19,17 @@ let _exec = (meta3dState: meta3dState, api: scriptAPI, eventFileStrData: Array<[ let [gameObject, eventFileStr] = eventFileStrData[index] - return _eval(eventFileStr)[eventHandleName](meta3dState, api, gameObject).then((meta3dState: meta3dState) => { - return _func(meta3dState, index + 1) - }) + try { + return _eval(eventFileStr)[eventHandleName](meta3dState, api, gameObject).then((meta3dState: meta3dState) => { + return _func(meta3dState, index + 1) + }) + } catch (e: any) { + e.errorType = "script" + + return new Promise((resolve, reject) => { + reject(e) + }) + } } return _func(meta3dState, 0)