Skip to content

Commit

Permalink
remove dirty flag
Browse files Browse the repository at this point in the history
  • Loading branch information
yanOO1497 committed Sep 6, 2023
1 parent 0d9fed3 commit bc898f3
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions editor/inspector/assets/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,27 +286,22 @@ exports.methods = {
},

changeMipFilter(targetSubMetaKey) {
let dirty = false;
if (this.originImageType === 'sprite-frame') {
// spriteFrame -> any
this.metaList.forEach((meta) => {
if (meta.subMetas[targetSubMetaKey].mipfilter !== 'none') {
meta.subMetas[targetSubMetaKey].userData.mipfilter = 'nearest';
dirty = true;
}
});
} else if (this.meta.type === 'sprite-frame') {
// any -> sprite,disabled mipmaps
this.metaList.forEach((meta) => {
meta.subMetas[targetSubMetaKey].userData.mipfilter = 'none';
dirty = true;
});
}
return dirty;
},

async changeSubMetaWithType() {
let dirty = false;
// any -> texture : texture.wrapMode -> Repeat
// any -> sprite : texture.wrapMode -> Clamp
if (['sprite-frame', 'texture'].includes(this.meta.userData.type)) {
Expand All @@ -320,7 +315,6 @@ exports.methods = {
// use default wrapMode if not changed
const wrapModeName = this.meta.userData.type === 'texture' ? 'Repeat' : 'Clamp';
this.metaList.forEach((meta) => {
dirty = true;
const data = ModeMap.wrap[wrapModeName];
if (!meta.subMetas[textureKey]) {
meta.subMetas[textureKey] = {
Expand All @@ -336,9 +330,8 @@ exports.methods = {
if (this.originImageType === 'sprite-frame' || this.meta.type === 'sprite-frame') {
const targetSubMetaKey = Object.keys(this.meta.subMetas).find((key) => this.meta.subMetas[key].importer === imageTypeToImporter[this.meta.userData.type])
// sprite -> any : mipfilter = 'nearest'
dirty = dirty || this.changeMipFilter(targetSubMetaKey);
this.changeMipFilter(targetSubMetaKey);
}
return dirty;
}
};

Expand Down

0 comments on commit bc898f3

Please sign in to comment.