更新编辑模型,添加材质名支持
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<CfFlex class="material-view">
|
||||
<div ref="container" class="material-view-container" />
|
||||
<MaterialAdjuster ref="adjuster" class="material-view-sider" :textureSrcList="textureSrc" @cancel="config.cancelCallback" @submit="config.submitCallback" />
|
||||
<MaterialAdjuster ref="adjuster" class="material-view-sider" :name="matName" :textureSrcList="textureSrc" @cancel="config.cancelCallback" @submit="config.submitCallback" />
|
||||
</CfFlex>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@@ -19,6 +19,7 @@ const container = useTemplateRef('container');
|
||||
const adjusterRef = useTemplateRef('adjuster');
|
||||
const config = GetConfig();
|
||||
const textureSrc = ref<string[]>(Array.from(config.textureSrc));
|
||||
const matName = ref<string>();
|
||||
|
||||
// 禁用右键菜单
|
||||
document.addEventListener('contextmenu', (e) => e.preventDefault());
|
||||
@@ -46,9 +47,9 @@ function HandleChangeTexture() {
|
||||
}
|
||||
|
||||
async function HandleUpdateConfig() {
|
||||
if (config.file && config.file.length > 0) {
|
||||
console.log("base64", config.file);
|
||||
const json = FromDeflateBase64(config.file);
|
||||
if (config.updateModel) {
|
||||
matName.value = config.updateModel.name;
|
||||
const json = FromDeflateBase64(config.updateModel.file);
|
||||
await scene.ImportMaterialAsync(json);
|
||||
}
|
||||
textureSrc.value = Array.from(config.textureSrc);
|
||||
|
Reference in New Issue
Block a user