feat: Add texture management features and update UI components
This commit is contained in:
@@ -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对象
|
||||
|
||||
Reference in New Issue
Block a user