Skip to content

Commit f921f61

Browse files
committed
feat: continue "load custom model"
model can be None;
1 parent 0801694 commit f921f61

9 files changed

Lines changed: 54 additions & 12 deletions

File tree

contributes/meta3d-action-mod-unit-publish-to-game/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "meta3d-action-mod-unit-publish-to-game",
3-
"version": "1.3.40",
3+
"version": "1.3.41",
44
"publisher": "meta3d",
55
"protocol": {
66
"name": "meta3d-action-mod-unit-publish-to-game-protocol"

contributes/meta3d-action-mod-unit-select-model/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "meta3d-action-mod-unit-select-model",
3-
"version": "1.3.2",
3+
"version": "1.3.3",
44
"publisher": "meta3d",
55
"protocol": {
66
"name": "meta3d-action-mod-unit-select-model-protocol"

contributes/meta3d-action-mod-unit-select-model/src/Main.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { actionContribute, service as editorWholeService } from "meta3d-editor-w
33
import { actionName, state, uiData } from "meta3d-action-mod-unit-select-model-protocol"
44
import { eventName, inputData } from "meta3d-action-mod-unit-select-model-protocol/src/EventType"
55
import { actionName as initActionName, state as initState } from "meta3d-action-mod-unit-init-protocol"
6+
import { actionName as uploadModelFileActionName, state as uploadModelFileState } from "meta3d-action-mod-unit-upload-model-file-protocol"
7+
import { actionName as uploadModelSnapshotActionName, state as uploadModelSnapshotState } from "meta3d-action-mod-unit-upload-model-snapshot-protocol"
68

79
export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> = (api) => {
810
return {
@@ -18,6 +20,15 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
1820
isShowModelModal: false
1921
})
2022

23+
meta3dState = api.action.setActionState<uploadModelFileState>(meta3dState, uploadModelFileActionName, {
24+
...api.nullable.getExn(api.action.getActionState<uploadModelFileState>(meta3dState, uploadModelFileActionName)),
25+
files: api.immutable.createMap()
26+
})
27+
meta3dState = api.action.setActionState<uploadModelSnapshotState>(meta3dState, uploadModelSnapshotActionName, {
28+
...api.nullable.getExn(api.action.getActionState<uploadModelSnapshotState>(meta3dState, uploadModelSnapshotActionName)),
29+
snapshot: api.nullable.getEmpty()
30+
})
31+
2132
return Promise.resolve(meta3dState)
2233
}, (meta3dState) => {
2334
return Promise.resolve(meta3dState)

contributes/meta3d-action-mod-unit-upload-model-file/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "meta3d-action-mod-unit-upload-model-file",
3-
"version": "1.3.6",
3+
"version": "1.3.7",
44
"publisher": "meta3d",
55
"protocol": {
66
"name": "meta3d-action-mod-unit-upload-model-file-protocol"

contributes/meta3d-action-mod-unit-upload-model-file/src/Main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { nullable } from "meta3d-commonlib-ts/src/nullable"
77
import { importFile } from "meta3d-file-ts-utils/src/ImportFileUtils"
88
import { getLanguageTextData, getLanguageTextVariableData } from "meta3d-language-utils/src/Main"
99
import { languageKey, languageVariableKey } from "meta3d-language-utils/src/Type"
10+
import { model } from "meta3d-action-mod-unit-publish-to-game-protocol/src/UnitType"
1011

1112
let _loadFBX = (api: api): Promise<[boolean, nullable<fbxName>, nullable<fbxData>]> => {
1213
return new Promise((resolve, reject) => {
@@ -65,6 +66,12 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
6566
files: state.files.set(key, [fbxName, fbxData]),
6667
})
6768

69+
meta3dState = api.action.setActionState<initState>(meta3dState, initActionName, {
70+
...initState,
71+
selectedModelIndex: api.nullable.getEmpty()
72+
})
73+
74+
6875
return Promise.resolve(meta3dState)
6976
}, (meta3dState) => {
7077
return Promise.resolve(meta3dState)

doc/1.3.1.org

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,21 +2866,34 @@ TODO update ui
28662866

28672867
TODO update Play
28682868

2869-
** TODO if upload model, set selectedModel to None
2869+
** DONE if upload model, set selectedModel to None
2870+
2871+
** DONE if select model to not None, clear upload model data
2872+
2873+
2874+
** DONE update 文字、图片: hidden
2875+
2876+
** DONE play:
2877+
update UnitType->model
2878+
2879+
update _loadSceneResourceHandler
2880+
28702881

2871-
** TODO if select model to not None, clear upload model data
28722882

2873-
** TODO play: update _loadSceneResourceHandler
28742883

28752884

2876-
** TODO update 文字、图片: hidden
28772885

28782886
** TODO show fbx name after upload button instead
28792887

28802888

28812889
** TODO after upload model file, show upload snapshot button
28822890

2883-
** TODO show snapshot after upload snapshot
2891+
** TODO show snapshot image after upload snapshot
2892+
2893+
** TODO update init
2894+
2895+
** TODO update publish
2896+
28842897

28852898

28862899

@@ -2902,7 +2915,7 @@ should has select model
29022915

29032916

29042917

2905-
** TODO update editor
2918+
** TODO pass Play run test
29062919

29072920

29082921
# ** TODO refactor: add fbxPaths?

protocols/contribute_protocols/meta3d-action-mod-unit-init-protocol/src/StateType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export type state = {
5959
allFeatureData: features,
6060
allPropData: props,
6161

62-
selectedModelIndex: number,
62+
selectedModelIndex: nullable<number>,
6363
selectedSmallSkillObjectActionIndex: number,
6464
selectedSmallSkillObjectEmitterParticleImageIndex: nullable<number>,
6565
selectedSmallSkillObjectEmitterInstanceIndex: nullable<number>,

protocols/contribute_protocols/meta3d-action-mod-unit-publish-to-game-protocol/src/UnitType.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { autoDifficulty } from "./Type";
22

33
export enum model {
4+
None = "None",
45
EliteGiantess1 = "EliteGiantess1",
56
EliteGiantess2 = "EliteGiantess2",
67
EliteGiantess3 = "EliteGiantess3",

utils/meta3d-action-mod-unit-publish-utils/src/Main.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,12 @@ let _buildDistFileContent = (api: api, meta3dState: meta3dState, name, displayNa
159159
} = state
160160

161161

162-
let model = api.nullable.getExn(allModelData.get(category_))[api.nullable.getExn(selectedModelIndex)].model
162+
let model_ = api.nullable.getWithDefault(
163+
api.nullable.map(selectedModelIndex => {
164+
return api.nullable.getExn(allModelData.get(category_))[selectedModelIndex].model
165+
}, selectedModelIndex),
166+
model.None
167+
)
163168

164169

165170
let updateFuncStr
@@ -306,7 +311,7 @@ let _buildDistFileContent = (api: api, meta3dState: meta3dState, name, displayNa
306311
displayNameEN: "${displayNameEN}",
307312
}
308313
},
309-
getModel: () => "${model}",
314+
getModel: () => "${model_}",
310315
getCategory: () => "${category_}",
311316
getValue: (api, state) => {
312317
return api.${updateFuncStr}(state, ${JSON.stringify({
@@ -459,6 +464,11 @@ let _getAssetFiles = (api: api, meta3dState: meta3dState, name) => {
459464
return result
460465
}, [])
461466

467+
468+
if (api.nullable.isNullable(api.action.getActionState<uploadModelSnapshotState>(meta3dState, uploadModelSnapshotActionName).snapshot)) {
469+
return Promise.resolve(result)
470+
}
471+
462472
return _base64ToUint8Array(api.nullable.getExn(api.action.getActionState<uploadModelSnapshotState>(meta3dState, uploadModelSnapshotActionName).snapshot)).then(data => {
463473
result.push([
464474
`./${name}_model_snapshot.png`,

0 commit comments

Comments
 (0)