From e85a5b842214ddfc4e22c14381daa592259eddc3 Mon Sep 17 00:00:00 2001 From: ayuan9957 <107920784+ayuan9957@users.noreply.github.com> Date: Thu, 21 May 2026 17:33:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B8=85=E7=90=86=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E4=B8=AD=E7=9A=84=E5=A4=9A=E4=BD=993D?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=E4=B8=8E=E5=85=89=E6=BA=90=EF=BC=8C=E4=BB=85?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E7=9B=B8=E6=9C=BA=E5=92=8C=E6=96=B9=E5=90=91?= =?UTF-8?q?=E5=85=89=EF=BC=8C=E5=90=8C=E6=AD=A5=E6=9B=B4=E6=96=B0=E5=86=92?= =?UTF-8?q?=E7=83=9F=E6=B5=8B=E8=AF=95=E5=B9=B6=E9=87=8D=E6=96=B0=E7=83=98?= =?UTF-8?q?=E7=84=99=E8=BF=90=E8=A1=8C=E6=97=B6=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SandboxProject/Runtime/Bindings.mcruntime | Bin 0 -> 1316 bytes SandboxProject/Runtime/DataSources.mcruntime | Bin 0 -> 1487 bytes .../Runtime/ProjectRuntime.mcruntimecfg | Bin 0 -> 270 bytes SandboxProject/Runtime/RuntimeReplay.mcstream | 17 + SandboxProject/Scenes/Main.mcscene | Bin 7699 -> 2447 bytes SandboxProject/Scenes/Untitled.mcscene | 567 +----------------- .../MetaCoreScene/Private/MetaCoreScene.cpp | 14 - tests/MetaCoreSmokeTests.cpp | 40 +- 8 files changed, 44 insertions(+), 594 deletions(-) create mode 100644 SandboxProject/Runtime/Bindings.mcruntime create mode 100644 SandboxProject/Runtime/DataSources.mcruntime create mode 100644 SandboxProject/Runtime/ProjectRuntime.mcruntimecfg create mode 100644 SandboxProject/Runtime/RuntimeReplay.mcstream diff --git a/SandboxProject/Runtime/Bindings.mcruntime b/SandboxProject/Runtime/Bindings.mcruntime new file mode 100644 index 0000000000000000000000000000000000000000..92a18bad94b2b28671b6181668dbbfe2632c19aa GIT binary patch literal 1316 zcmcJPQES355Xb9uL)n}RCcY^92Kf-O7awGM@O>n0kkgn*lNJ2-OUwmrNlPKD5U#!a zuf1RIa)T_(26m0@a@QJU0dlWLkN)||o2$mTCislHO|e4994+%NAo(xj~8tLeLuLjS~D@Bb=gs63L}fA3MLMnpFj9`-Dbm0qc~2Bd==5cw`CGtM|+5ZBKVhrEZjz5LvF|0IcQm#eC46pV)}J zO8I*zj_7imV#$#*`?^kvCnhquro{!tAsE}!>dnbr^)qRC0#)>AVGc2;#h+*^_Kh+sN5{g!*&yI2{{dW>J@@Lie;^w8$K4W2-aEk8&Q#E z8ugqID_2U?F*7iVlu&vRv~wgHfzjh>;Ci2OCUOWDXzombM%e$kYnglxm+Nj#q7nFS cck8`kg6Sl5pD0N8sTIq39cmJd!1yot0(!jyTL1t6 literal 0 HcmV?d00001 diff --git a/SandboxProject/Runtime/ProjectRuntime.mcruntimecfg b/SandboxProject/Runtime/ProjectRuntime.mcruntimecfg new file mode 100644 index 0000000000000000000000000000000000000000..8d590d8dd5b346ad7b3de893597830824d4b401b GIT binary patch literal 270 zcmZQ%U|?VYVgVoqf#8zFqLR{r;N;Z2)PTg23~7ikgD{i^OBCz-CT8a8a2I4Irsw4smt-b`4bXyWgc$^P0YVwVjN+2Sl2icEphDIF literal 0 HcmV?d00001 diff --git a/SandboxProject/Runtime/RuntimeReplay.mcstream b/SandboxProject/Runtime/RuntimeReplay.mcstream new file mode 100644 index 0000000..8b52118 --- /dev/null +++ b/SandboxProject/Runtime/RuntimeReplay.mcstream @@ -0,0 +1,17 @@ +# emit_after_seconds data_point_id value_type payload +0.00 cube.position vec3 0.0 0.5 0.0 +0.00 cube.visible bool true +0.00 cube.base_color vec3 0.4 0.6 0.9 +0.00 valve.visible bool true +0.00 tank.base_color vec3 0.35 0.65 0.90 +0.00 alarm.intensity double 0.0 +0.50 cube.position vec3 1.5 0.5 0.0 +0.50 cube.base_color vec3 0.8 0.6 0.5 +0.50 tank.base_color vec3 0.20 0.80 0.25 +0.50 alarm.intensity double 2.0 +1.00 cube.visible bool false +1.00 valve.visible bool false +1.50 cube.position vec3 -1.5 0.5 0.0 +1.50 cube.visible bool true +1.50 valve.visible bool true +1.50 alarm.intensity double 0.0 diff --git a/SandboxProject/Scenes/Main.mcscene b/SandboxProject/Scenes/Main.mcscene index 9a6ed48e3c109970820f2394a01103758bba0bfa..3360ccefca08c17beb8ae925c8c6cf8fd9ba071d 100644 GIT binary patch delta 427 zcmbPi(=R+>yHR0g*2#?*o&U@`d-h+pTkZ`m1_%hwFD*(=^++tv;DCy3-M8!FKDTG- z6JJ&{8ct4SbYPr2*^^Ovay=8rjW_6>`l> zOv*`3ncT}3tpu~vH$NpcCn!I^BqT8%W)B10#LZ0XI*fer$VM_xw&8G;Kr<4ilW}r@ OsJsX^vnLnIE&>3=w_#oY literal 7699 zcmeHM&2Jk;6yFpmP|8;uDk>1lrAR%{3d#kf#9#TqQk__F2;zWXygO?TUGG{m>kuO$ zg&PugpgC}Z8(dHi+zKZSj>L&S0f|fDUL-nicYeE0ybkL)5+BV+@iD_tXZ8)&;v4-gA10qM zK={)3gu=f$MEGyU@+Zx6k$1W8 zaNq7vVEt#tCt0q6_2-O&N>7DB$Ao4A9be|qfl1U^-wT-2;C84}S>=oG*M}(RT#T*9 zWR``;hvR?#g_us+L)Y2(p=(X}S30(`bxJ;iZ#-m`K=KBCTny}9hx?(SMdd*6C=29j zN$E_Sx^~u@?`xM(-p?9^S%xD0sm`koro8*!?5)C^^;;NWd|cJZvJD>00-1_93{}cI z#*<*h6U7NS{ZDC&lp>>{8sEsfP_?4z@$}Tk&&EPA4-!QdA~@-spcMAknbfgJ>9L&s zMw~Yvp_q)At7z?#Ay^xd`O4MZ^drNI$s~FLB`7m7A!6GboGn_`&qYLLJqQ``EcHAt z7kNu^u2TN)4@Pv-JR3Ii5)WC{P60RE5Zkz8#?6pT5COYX8})mI_&ZJvEsjHDfbrlJLtc(Y*YHMihIGf8%@hJN@_;%QnJU0x(Ry?0KFEzaa z@H}C!2fbFC*2~ihMw42l6}&gCG$7nkM<^w>__XqnZ>3;bNywsu5y^_)-#I&LOr{^R z7{|CMi*;o7Sxl(d#h|D6BMsqj2fcd+X^E^EE@gDKB$HBN+L%jTx6P;mQexU8B4VW% z2Ch3qF2HK!z=7_Mj7~RGNk~$NC>CbFT`A0;c`HGIs0^vxqE#dG{iQFAYV?}amPY7U zV{8f~w1*PspvxZ9N&zOp=Xp>Eu7W9>%-iA!%*2qRmw~sncmHw7`O~-}2joyPAc5~g z$U&}<8|XR#m*Hca*eB`VF`e_sn2PE<0hefPa-V?9?#;IguKVl4-r)KI>g`_-E&vEL zj6C21Tm&#}F#pCh*izJ$czoD$?b>$*-20Ci0MO}4m_~K%^G~oP?T6-V%ytH;0)FKB z$;Jg98GfE%%f1a@78Zkmhg55MQ zrsOf%nJaT<2mX;UCa%Z1B0Ztt@T2T_1pNg-9>yZtmW^s8<(*c{n2D zbTeJ*k2#UX*ar9Fv*R5zS2B(cIC0((GjJ#V0i)`S9G{`@m-G)>TjqC;(Vr>yi_^ay Llzh7#$Wg|7VDv>0 diff --git a/SandboxProject/Scenes/Untitled.mcscene b/SandboxProject/Scenes/Untitled.mcscene index fc3e9de..3b6b412 100644 --- a/SandboxProject/Scenes/Untitled.mcscene +++ b/SandboxProject/Scenes/Untitled.mcscene @@ -57,575 +57,14 @@ 1.0 ] } - }, - { - "Id": 3, - "MeshRenderer": { - "AlphaCutoff": 0.5, - "AlphaMode": 0, - "AoTextureGuid": "", - "AoTexturePath": "", - "BaseColor": [ - 0.75, - 0.7799999713897705, - 0.8399999737739563 - ], - "BaseColorTextureGuid": "", - "BaseColorTexturePath": "", - "BuiltinMesh": 0, - "DoubleSided": true, - "EmissiveColor": [ - 0.0, - 0.0, - 0.0 - ], - "EmissiveTextureGuid": "", - "EmissiveTexturePath": "", - "MaterialAssetGuids": [], - "MeshAssetGuid": "", - "MeshSource": 1, - "Metallic": 0.0, - "MetallicRoughnessTextureGuid": "", - "MetallicRoughnessTexturePath": "", - "ModelNodeIndex": -1, - "NormalTextureGuid": "", - "NormalTexturePath": "", - "Roughness": 1.0, - "SourceModelAssetGuid": "", - "SourceModelPath": "Assets/Models/box1.glb", - "SourceNodePath": "", - "SubMeshIndex": -1, - "Visible": true - }, - "Name": "box1.glb", - "ParentId": 0, - "Transform": { - "Position": [ - 0.0, - 0.5, - 0.0 - ], - "RotationEulerDegrees": [ - 0.0, - 0.0, - 0.0 - ], - "Scale": [ - 1.0, - 1.0, - 1.0 - ] - } - }, - { - "Id": 4, - "Light": { - "Color": [ - 1.0, - 0.15000000596046448, - 0.10000000149011612 - ], - "Intensity": 0.0 - }, - "Name": "Alarm Beacon", - "ParentId": 0, - "Transform": { - "Position": [ - 0.0, - 2.5, - 0.0 - ], - "RotationEulerDegrees": [ - 0.0, - 0.0, - 0.0 - ], - "Scale": [ - 1.0, - 1.0, - 1.0 - ] - } - }, - { - "Id": 5, - "MeshRenderer": { - "AlphaCutoff": 0.5, - "AlphaMode": 0, - "AoTextureGuid": "", - "AoTexturePath": "", - "BaseColor": [ - 0.75, - 0.7799999713897705, - 0.8399999737739563 - ], - "BaseColorTextureGuid": "", - "BaseColorTexturePath": "", - "BuiltinMesh": 0, - "DoubleSided": true, - "EmissiveColor": [ - 0.0, - 0.0, - 0.0 - ], - "EmissiveTextureGuid": "", - "EmissiveTexturePath": "", - "MaterialAssetGuids": [], - "MeshAssetGuid": "", - "MeshSource": 1, - "Metallic": 0.0, - "MetallicRoughnessTextureGuid": "", - "MetallicRoughnessTexturePath": "", - "ModelNodeIndex": 0, - "NormalTextureGuid": "", - "NormalTexturePath": "", - "Roughness": 1.0, - "SourceModelAssetGuid": "", - "SourceModelPath": "", - "SourceNodePath": "", - "SubMeshIndex": -1, - "Visible": true - }, - "Name": "立方体", - "ParentId": 3, - "Transform": { - "Position": [ - -1.6927926540374756, - -4.459673881530762, - 1.949385364241607e-07 - ], - "RotationEulerDegrees": [ - 0.0, - -0.0, - 0.0 - ], - "Scale": [ - 0.9999998807907104, - 1.0, - 1.0 - ] - } - }, - { - "Id": 6, - "MeshRenderer": { - "AlphaCutoff": 0.5, - "AlphaMode": 0, - "AoTextureGuid": "", - "AoTexturePath": "", - "BaseColor": [ - 0.75, - 0.7799999713897705, - 0.8399999737739563 - ], - "BaseColorTextureGuid": "", - "BaseColorTexturePath": "", - "BuiltinMesh": 0, - "DoubleSided": true, - "EmissiveColor": [ - 0.0, - 0.0, - 0.0 - ], - "EmissiveTextureGuid": "", - "EmissiveTexturePath": "", - "MaterialAssetGuids": [], - "MeshAssetGuid": "", - "MeshSource": 1, - "Metallic": 0.0, - "MetallicRoughnessTextureGuid": "", - "MetallicRoughnessTexturePath": "", - "ModelNodeIndex": 1, - "NormalTextureGuid": "", - "NormalTexturePath": "", - "Roughness": 1.0, - "SourceModelAssetGuid": "", - "SourceModelPath": "", - "SourceNodePath": "", - "SubMeshIndex": -1, - "Visible": true - }, - "Name": "立方体.001", - "ParentId": 5, - "Transform": { - "Position": [ - 0.0, - -3.55507755279541, - 1.553973731915903e-07 - ], - "RotationEulerDegrees": [ - 0.0, - -0.0, - 0.0 - ], - "Scale": [ - 0.9999998807907104, - 1.0, - 1.0 - ] - } - }, - { - "Id": 7, - "MeshRenderer": { - "AlphaCutoff": 0.5, - "AlphaMode": 0, - "AoTextureGuid": "", - "AoTexturePath": "", - "BaseColor": [ - 0.75, - 0.7799999713897705, - 0.8399999737739563 - ], - "BaseColorTextureGuid": "", - "BaseColorTexturePath": "", - "BuiltinMesh": 0, - "DoubleSided": true, - "EmissiveColor": [ - 0.0, - 0.0, - 0.0 - ], - "EmissiveTextureGuid": "", - "EmissiveTexturePath": "", - "MaterialAssetGuids": [], - "MeshAssetGuid": "", - "MeshSource": 1, - "Metallic": 0.0, - "MetallicRoughnessTextureGuid": "", - "MetallicRoughnessTexturePath": "", - "ModelNodeIndex": 2, - "NormalTextureGuid": "", - "NormalTexturePath": "", - "Roughness": 1.0, - "SourceModelAssetGuid": "", - "SourceModelPath": "", - "SourceNodePath": "", - "SubMeshIndex": -1, - "Visible": true - }, - "Name": "立方体.007", - "ParentId": 6, - "Transform": { - "Position": [ - 4.175572872161865, - 0.0, - 0.0 - ], - "RotationEulerDegrees": [ - 0.0, - -0.0, - 0.0 - ], - "Scale": [ - 0.9999998807907104, - 1.0, - 1.0 - ] - } - }, - { - "Id": 8, - "MeshRenderer": { - "AlphaCutoff": 0.5, - "AlphaMode": 0, - "AoTextureGuid": "", - "AoTexturePath": "", - "BaseColor": [ - 0.75, - 0.7799999713897705, - 0.8399999737739563 - ], - "BaseColorTextureGuid": "", - "BaseColorTexturePath": "", - "BuiltinMesh": 0, - "DoubleSided": true, - "EmissiveColor": [ - 0.0, - 0.0, - 0.0 - ], - "EmissiveTextureGuid": "", - "EmissiveTexturePath": "", - "MaterialAssetGuids": [], - "MeshAssetGuid": "", - "MeshSource": 1, - "Metallic": 0.0, - "MetallicRoughnessTextureGuid": "", - "MetallicRoughnessTexturePath": "", - "ModelNodeIndex": 3, - "NormalTextureGuid": "", - "NormalTexturePath": "", - "Roughness": 1.0, - "SourceModelAssetGuid": "", - "SourceModelPath": "", - "SourceNodePath": "", - "SubMeshIndex": -1, - "Visible": true - }, - "Name": "立方体.003", - "ParentId": 3, - "Transform": { - "Position": [ - 0.0, - 0.0, - 0.0 - ], - "RotationEulerDegrees": [ - 0.0, - -0.0, - 0.0 - ], - "Scale": [ - 0.9999998807907104, - 1.0, - 1.0 - ] - } - }, - { - "Id": 9, - "MeshRenderer": { - "AlphaCutoff": 0.5, - "AlphaMode": 0, - "AoTextureGuid": "", - "AoTexturePath": "", - "BaseColor": [ - 0.75, - 0.7799999713897705, - 0.8399999737739563 - ], - "BaseColorTextureGuid": "", - "BaseColorTexturePath": "", - "BuiltinMesh": 0, - "DoubleSided": true, - "EmissiveColor": [ - 0.0, - 0.0, - 0.0 - ], - "EmissiveTextureGuid": "", - "EmissiveTexturePath": "", - "MaterialAssetGuids": [], - "MeshAssetGuid": "", - "MeshSource": 1, - "Metallic": 0.0, - "MetallicRoughnessTextureGuid": "", - "MetallicRoughnessTexturePath": "", - "ModelNodeIndex": 4, - "NormalTextureGuid": "", - "NormalTexturePath": "", - "Roughness": 1.0, - "SourceModelAssetGuid": "", - "SourceModelPath": "", - "SourceNodePath": "", - "SubMeshIndex": -1, - "Visible": true - }, - "Name": "立方体.002", - "ParentId": 8, - "Transform": { - "Position": [ - 0.0, - -1.4481612709005276e-07, - -3.31300687789917 - ], - "RotationEulerDegrees": [ - 0.0, - -0.0, - 0.0 - ], - "Scale": [ - 0.9999998807907104, - 1.0, - 1.0 - ] - } - }, - { - "Id": 10, - "MeshRenderer": { - "AlphaCutoff": 0.5, - "AlphaMode": 0, - "AoTextureGuid": "", - "AoTexturePath": "", - "BaseColor": [ - 0.75, - 0.7799999713897705, - 0.8399999737739563 - ], - "BaseColorTextureGuid": "", - "BaseColorTexturePath": "", - "BuiltinMesh": 0, - "DoubleSided": true, - "EmissiveColor": [ - 0.0, - 0.0, - 0.0 - ], - "EmissiveTextureGuid": "", - "EmissiveTexturePath": "", - "MaterialAssetGuids": [], - "MeshAssetGuid": "", - "MeshSource": 1, - "Metallic": 0.0, - "MetallicRoughnessTextureGuid": "", - "MetallicRoughnessTexturePath": "", - "ModelNodeIndex": 5, - "NormalTextureGuid": "", - "NormalTexturePath": "", - "Roughness": 1.0, - "SourceModelAssetGuid": "", - "SourceModelPath": "", - "SourceNodePath": "", - "SubMeshIndex": -1, - "Visible": true - }, - "Name": "立方体.004", - "ParentId": 8, - "Transform": { - "Position": [ - 3.776623010635376, - 0.0, - 0.0 - ], - "RotationEulerDegrees": [ - 0.0, - -0.0, - 0.0 - ], - "Scale": [ - 0.9999998807907104, - 1.0, - 1.0 - ] - } - }, - { - "Id": 11, - "MeshRenderer": { - "AlphaCutoff": 0.5, - "AlphaMode": 0, - "AoTextureGuid": "", - "AoTexturePath": "", - "BaseColor": [ - 0.75, - 0.7799999713897705, - 0.8399999737739563 - ], - "BaseColorTextureGuid": "", - "BaseColorTexturePath": "", - "BuiltinMesh": 0, - "DoubleSided": true, - "EmissiveColor": [ - 0.0, - 0.0, - 0.0 - ], - "EmissiveTextureGuid": "", - "EmissiveTexturePath": "", - "MaterialAssetGuids": [], - "MeshAssetGuid": "", - "MeshSource": 1, - "Metallic": 0.0, - "MetallicRoughnessTextureGuid": "", - "MetallicRoughnessTexturePath": "", - "ModelNodeIndex": 6, - "NormalTextureGuid": "", - "NormalTexturePath": "", - "Roughness": 1.0, - "SourceModelAssetGuid": "", - "SourceModelPath": "", - "SourceNodePath": "", - "SubMeshIndex": -1, - "Visible": true - }, - "Name": "立方体.005", - "ParentId": 8, - "Transform": { - "Position": [ - 0.0, - 4.31797981262207, - -1.8874489171594178e-07 - ], - "RotationEulerDegrees": [ - 0.0, - -0.0, - 0.0 - ], - "Scale": [ - 0.9999998807907104, - 1.0, - 1.0 - ] - } - }, - { - "Id": 12, - "MeshRenderer": { - "AlphaCutoff": 0.5, - "AlphaMode": 0, - "AoTextureGuid": "", - "AoTexturePath": "", - "BaseColor": [ - 0.75, - 0.7799999713897705, - 0.8399999737739563 - ], - "BaseColorTextureGuid": "", - "BaseColorTexturePath": "", - "BuiltinMesh": 0, - "DoubleSided": true, - "EmissiveColor": [ - 0.0, - 0.0, - 0.0 - ], - "EmissiveTextureGuid": "", - "EmissiveTexturePath": "", - "MaterialAssetGuids": [], - "MeshAssetGuid": "", - "MeshSource": 1, - "Metallic": 0.0, - "MetallicRoughnessTextureGuid": "", - "MetallicRoughnessTexturePath": "", - "ModelNodeIndex": 7, - "NormalTextureGuid": "", - "NormalTexturePath": "", - "Roughness": 1.0, - "SourceModelAssetGuid": "", - "SourceModelPath": "", - "SourceNodePath": "", - "SubMeshIndex": -1, - "Visible": true - }, - "Name": "立方体.006", - "ParentId": 8, - "Transform": { - "Position": [ - -12.448348045349121, - 0.0, - 0.0 - ], - "RotationEulerDegrees": [ - 0.0, - 0.0, - -0.0 - ], - "Scale": [ - 0.9999998807907104, - 1.0, - 1.0 - ] - } } ], "SceneName": "Untitled", "Selection": { - "ActiveObjectId": 12, + "ActiveObjectId": 1, "SelectedObjectIds": [ - 12 + 1 ], - "SelectionAnchorId": 12 + "SelectionAnchorId": 1 } } \ No newline at end of file diff --git a/Source/MetaCoreScene/Private/MetaCoreScene.cpp b/Source/MetaCoreScene/Private/MetaCoreScene.cpp index 054a340..b22176f 100644 --- a/Source/MetaCoreScene/Private/MetaCoreScene.cpp +++ b/Source/MetaCoreScene/Private/MetaCoreScene.cpp @@ -457,20 +457,6 @@ MetaCoreScene MetaCoreCreateDefaultScene() { directionalLight.AddComponent(); directionalLight.GetComponent().RotationEulerDegrees = glm::vec3(-45.0F, 30.0F, 0.0F); - MetaCoreGameObject cube = scene.CreateGameObject("box1.glb"); - auto& meshRenderer = cube.AddComponent(); - meshRenderer.MeshSource = MetaCoreMeshSourceKind::Asset; - meshRenderer.SourceModelPath = "Assets/Models/box1.glb"; - meshRenderer.SourceModelAssetGuid = MetaCoreAssetRegistry::Get().ResolvePathToGuid("Assets/Models/box1.glb"); - cube.AddComponent(MetaCoreModelRootTag{ "Assets/Models/box1.glb" }); - cube.GetComponent().Position = glm::vec3(0.0F, 0.5F, 0.0F); - - MetaCoreGameObject alarmBeacon = scene.CreateGameObject("Alarm Beacon"); - auto& beaconLight = alarmBeacon.AddComponent(); - beaconLight.Intensity = 0.0F; - beaconLight.Color = glm::vec3(1.0F, 0.15F, 0.1F); - alarmBeacon.GetComponent().Position = glm::vec3(0.0F, 2.5F, 0.0F); - return scene; } diff --git a/tests/MetaCoreSmokeTests.cpp b/tests/MetaCoreSmokeTests.cpp index 2cd76fa..07d9b47 100644 --- a/tests/MetaCoreSmokeTests.cpp +++ b/tests/MetaCoreSmokeTests.cpp @@ -6,6 +6,7 @@ #include "MetaCoreFoundation/MetaCoreGeneratedReflection.h" #include "MetaCoreFoundation/MetaCoreLogService.h" #include "MetaCoreFoundation/MetaCoreProject.h" +#include "MetaCoreFoundation/MetaCoreAssetRegistry.h" #include "MetaCorePlatform/MetaCoreWindow.h" #include "MetaCoreRender/MetaCoreEditorViewportRenderer.h" #include "MetaCoreRender/MetaCoreRenderDevice.h" @@ -593,16 +594,16 @@ void MetaCoreTestJsonSceneSaveCurrentSceneUsesMcsceneJson() { const auto scenePersistenceService = moduleRegistry.ResolveService(); MetaCoreExpect(scenePersistenceService != nullptr, "应解析到 ScenePersistenceService"); - MetaCore::MetaCoreId cubeId = 0; + MetaCore::MetaCoreId lightId = 0; for (const MetaCore::MetaCoreGameObject& object : scene.GetGameObjects()) { - if (object.GetName() == "box1.glb") { - cubeId = object.GetId(); + if (object.GetName() == "Directional Light") { + lightId = object.GetId(); break; } } - MetaCoreExpect(cubeId != 0, "默认场景应包含 box1.glb"); + MetaCoreExpect(lightId != 0, "默认场景应包含 Directional Light"); - editorContext.SelectOnly(cubeId); + editorContext.SelectOnly(lightId); const std::filesystem::path scenePath = std::filesystem::path("Scenes") / "Main.mcscene.json"; MetaCoreExpect(scenePersistenceService->SaveSceneAs(editorContext, scenePath), "应能保存 JSON 场景"); MetaCoreExpect(scenePersistenceService->GetCurrentScenePath() == scenePath, "当前场景路径应使用 .mcscene.json"); @@ -611,7 +612,7 @@ void MetaCoreTestJsonSceneSaveCurrentSceneUsesMcsceneJson() { MetaCoreExpect(!scenePersistenceService->IsSceneDirty(), "保存后场景不应为 dirty"); const bool renamed = editorContext.ExecuteSnapshotCommand("重命名对象", [&]() { - return scene.RenameGameObject(cubeId, "RoundTripCube"); + return scene.RenameGameObject(lightId, "RoundTripLight"); }); MetaCoreExpect(renamed, "应能修改场景对象"); MetaCoreExpect(scenePersistenceService->IsSceneDirty(), "修改后场景应变为 dirty"); @@ -624,17 +625,17 @@ void MetaCoreTestJsonSceneSaveCurrentSceneUsesMcsceneJson() { MetaCoreExpect(scene.GetGameObjects().empty(), "清空快照后场景应为空"); MetaCoreExpect(scenePersistenceService->LoadScene(editorContext, scenePath), "应能重新加载 JSON 场景"); - MetaCoreExpect(scene.GetGameObjects().size() == 4, "重新加载后对象数量应恢复"); + MetaCoreExpect(scene.GetGameObjects().size() == 2, "重新加载后对象数量应恢复"); MetaCoreExpect(editorContext.GetSelectedObjectId() != 0, "重新加载后应恢复选中对象"); - bool foundRenamedCube = false; + bool foundRenamedLight = false; for (const MetaCore::MetaCoreGameObject& object : scene.GetGameObjects()) { - if (object.GetName() == "RoundTripCube") { - foundRenamedCube = true; + if (object.GetName() == "RoundTripLight") { + foundRenamedLight = true; break; } } - MetaCoreExpect(foundRenamedCube, "重新加载后应保留保存过的对象名称"); + MetaCoreExpect(foundRenamedLight, "重新加载后应保留保存过的对象名称"); coreServicesModule->Shutdown(moduleRegistry); moduleRegistry.ShutdownServices(); @@ -1261,7 +1262,7 @@ void MetaCoreTestBootstrapStartupSceneCreation() { MetaCoreExpect(std::filesystem::exists(tempProjectRoot / bootstrapScenePath), "应生成 Main.mcscene.json"); MetaCoreExpect(scenePersistenceService->LoadStartupScene(editorContext), "设置后应能加载 startup scene"); MetaCoreExpect(scenePersistenceService->GetCurrentScenePath() == bootstrapScenePath, "startup scene 路径应正确"); - MetaCoreExpect(scene.GetGameObjects().size() == 4, "bootstrap scene 应保存默认场景内容"); + MetaCoreExpect(scene.GetGameObjects().size() == 2, "bootstrap scene 应保存默认场景内容"); coreServicesModule->Shutdown(moduleRegistry); moduleRegistry.ShutdownServices(); @@ -2427,6 +2428,16 @@ void MetaCoreTestUiDocumentSerialization() { void MetaCoreTestDecoupledSnapshotSync() { // 1. 创建默认场景并收集核心对象 ID MetaCore::MetaCoreScene scene = MetaCore::MetaCoreCreateDefaultScene(); + + // 动态添加一个 box1.glb,测试需要它作为网格对象进行解耦同步验证 + MetaCore::MetaCoreGameObject cubeObj = scene.CreateGameObject("box1.glb"); + auto& meshRenderer = cubeObj.AddComponent(); + meshRenderer.MeshSource = MetaCore::MetaCoreMeshSourceKind::Asset; + meshRenderer.SourceModelPath = "Assets/Models/box1.glb"; + meshRenderer.SourceModelAssetGuid = MetaCore::MetaCoreAssetRegistry::Get().ResolvePathToGuid("Assets/Models/box1.glb"); + cubeObj.AddComponent(MetaCore::MetaCoreModelRootTag{ "Assets/Models/box1.glb" }); + cubeObj.GetComponent().Position = glm::vec3(0.0F, 0.5F, 0.0F); + MetaCore::MetaCoreId cubeId = 0; MetaCore::MetaCoreId lightId = 0; MetaCore::MetaCoreId cameraId = 0; @@ -2533,20 +2544,17 @@ int main() { std::cout << "[RUN] MetaCoreCreateDefaultScene..." << std::endl; MetaCore::MetaCoreScene scene = MetaCore::MetaCoreCreateDefaultScene(); std::cout << "[RUN] MetaCoreExpect default objects count..." << std::endl; - MetaCoreExpect(scene.GetGameObjects().size() == 4, "默认场景应包含四个对象"); + MetaCoreExpect(scene.GetGameObjects().size() == 2, "默认场景应包含两个对象"); bool hasCamera = false; bool hasLight = false; - bool hasCube = false; for (const MetaCore::MetaCoreGameObject& object : scene.GetGameObjects()) { hasCamera = hasCamera || object.HasComponent(); hasLight = hasLight || object.HasComponent(); - hasCube = hasCube || object.HasComponent(); } MetaCoreExpect(hasCamera, "默认场景应包含摄像机"); MetaCoreExpect(hasLight, "默认场景应包含光源"); - MetaCoreExpect(hasCube, "默认场景应包含立方体"); std::cout << "[RUN] MetaCoreDummyPanelProvider test..." << std::endl; MetaCore::MetaCoreEditorModuleRegistry moduleRegistry;