2 Commits

3 changed files with 5 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "material-editor", "name": "material-editor",
"private": true, "private": true,
"version": "1.0.29", "version": "1.0.31",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -200,17 +200,17 @@ const uploading = ref(false);
// }); // });
const materialInfo = reactive({ const materialInfo = reactive({
dirId: DirectoryId.MaterialDir, // 正常来说是2 dirId: DirectoryId.MaterialDir, // 正常来说是2
materialName: props.name || Textures.value?.[0].name || '材质', materialName: props.name || Textures.value[0]?.name || '材质',
inputText: '', inputText: '',
}); });
watch(Textures, async (val) => { watch(Textures, async (val) => {
if (val.length == 0) return; if (val.length == 0 || props.ignoreTexture) return;
await scene.ChangeTextureFromUrlAsync(val[0].src); await scene.ChangeTextureFromUrlAsync(val[0].src);
}); });
watch(() => props.name, () => { watch(() => props.name, () => {
materialInfo.materialName = props.name || Textures.value?.[0].name || '材质'; materialInfo.materialName = props.name || Textures.value[0]?.name || '材质';
}); });
watch(textureAdjustment, async (val) => { watch(textureAdjustment, async (val) => {

View File

@@ -56,7 +56,7 @@ async function HandleUpdateConfig() {
editMode.value = true; editMode.value = true;
} }
else { editMode.value = false; } else { editMode.value = false; }
if (config.textures) { if (config.textures && config.textures.length > 0) {
textures.value = Array.from(config.textures); textures.value = Array.from(config.textures);
await scene.ChangeTextureFromUrlAsync(textures.value[0].src); // 这一行是保证首次Mount组件时纹理能够立刻刷新 await scene.ChangeTextureFromUrlAsync(textures.value[0].src); // 这一行是保证首次Mount组件时纹理能够立刻刷新
} }