feat: Add texture management features and update UI components

This commit is contained in:
bighuixiang
2025-06-26 23:26:50 +08:00
parent fd05c70937
commit fd9b1721c1
9 changed files with 337 additions and 173 deletions

View File

@@ -72,6 +72,9 @@ const state = reactive({
},
],
// 上传的纹理缓存列表
uploadedTextures: [],
// 最近使用的颜色
recentColors: ["#000000", "#ffffff", "#ff0000", "#00ff00", "#0000ff"],
@@ -559,6 +562,35 @@ const actions = {
}
});
},
/**
* 清空上传的纹理缓存
*/
clearUploadedTextures() {
state.uploadedTextures = [];
},
/**
* 添加纹理到缓存
* @param {String} textureId 材质ID
*/
cacheUploadedTexture(textureId) {
const texture = texturePresetManager.getTextureById(textureId);
if (texture && !state.uploadedTextures.includes(textureId)) {
state.uploadedTextures.push(textureId);
}
},
/**
* 从缓存中移除纹理
* @param {String} textureId 材质ID
*/
removeCachedTexture(textureId) {
const index = state.uploadedTextures.indexOf(textureId);
if (index !== -1) {
state.uploadedTextures.splice(index, 1);
}
},
};
// 暴露给组件使用的Store对象