|
@@ -15,19 +15,25 @@ export default defineComponent({
|
|
|
const resource = useResource();
|
|
|
const { store } = resource;
|
|
|
|
|
|
- const replaceMesh = async () => {
|
|
|
- const branchFolder = await resource.showModal<AssetItemFile>(
|
|
|
- <LibraryModal />,
|
|
|
- { width: "900px" }
|
|
|
- );
|
|
|
- const pack = await branchFolder.getAssetDetail();
|
|
|
- const data = queditor.helper.getRelatedSourceByProduct(
|
|
|
- pack.source as Pack["source"],
|
|
|
- branchFolder.state.id
|
|
|
+ const replaceMesh = async (record: any) => {
|
|
|
+ const data = await resource.treeController.selectOnePackScene();
|
|
|
+ if (!data) return;
|
|
|
+
|
|
|
+ console.log("replaceMesh=>", record);
|
|
|
+ const slotId = record.Id || record.id;
|
|
|
+ const meshConf = resource.store.meshSlots.find(
|
|
|
+ (item) => item.id == slotId
|
|
|
);
|
|
|
+ if (meshConf) {
|
|
|
+ meshConf.pack = data;
|
|
|
+ } else {
|
|
|
+ const meshSlot = { id: slotId, pack: data };
|
|
|
+ resource.store.meshSlots.push(meshSlot);
|
|
|
+ }
|
|
|
queditor.actions.insertMesh(data);
|
|
|
};
|
|
|
|
|
|
+
|
|
|
const replaceMat = async (record: any) => {
|
|
|
const mat = await resource.treeController.selectOneMat();
|
|
|
if (!mat) return;
|
|
@@ -101,7 +107,7 @@ export default defineComponent({
|
|
|
<MeshItem
|
|
|
record={record}
|
|
|
active={record.Id == store.activeKeys.id}
|
|
|
- onReplace={replaceMesh}
|
|
|
+ onReplace={()=>{replaceMesh(record)}}
|
|
|
onClick={clickMesh}
|
|
|
/>
|
|
|
<div class="grid gap-y-10px pt-10px pl-10px">
|