修复纹理调节项不生效的问题

This commit is contained in:
2026-04-28 13:41:17 +08:00
parent 9045cb79c2
commit 7e4b09133d
4 changed files with 15 additions and 8 deletions

View File

@@ -0,0 +1,7 @@
{
"permissions": {
"allow": [
"mcp__ide__getDiagnostics"
]
}
}

View File

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

View File

@@ -214,7 +214,7 @@ watch(() => props.name, () => {
}); });
watch(textureAdjustment, async (val) => { watch(textureAdjustment, async (val) => {
scene.UpdateTexture(); scene.UpdateTexture(val);
}, { deep: true }); }, { deep: true });
// 监听纹理更新 // 监听纹理更新

View File

@@ -85,15 +85,15 @@ const sceneSetup = () => {
/** 这是自定义材质更新方法WebCAD库中的TextureTableRecord.TextureUpdate方法在导出的时候被删除了所以需要自己实现 */ /** 这是自定义材质更新方法WebCAD库中的TextureTableRecord.TextureUpdate方法在导出的时候被删除了所以需要自己实现 */
function UpdateTexture() { function UpdateTexture(adjustment?: Partial<TextureAdjustment>) {
const record = _currTexture.value; const record = _currTexture.value;
const texture = record['texture'] as Texture; const texture = record['texture'] as Texture;
texture.wrapS = record.WrapS; texture.wrapS = adjustment?.wrapS ?? record.WrapS;
texture.wrapT = record.WrapT; texture.wrapT = adjustment?.wrapT ?? record.WrapT;
texture.anisotropy = 16; texture.anisotropy = 16;
texture.rotation = record.rotation; texture.rotation = adjustment?.rotation ?? record.rotation;
texture.repeat.set(record.repeatX, record.repeatY); texture.repeat.set(adjustment?.repeatX ?? record.repeatX, adjustment?.repeatY ?? record.repeatY);
texture.offset.set(record.moveX, record.moveY); texture.offset.set(adjustment?.moveX ?? record.moveX, adjustment?.moveY ?? record.moveY);
texture.needsUpdate = true; texture.needsUpdate = true;
Update(); Update();
} }