Skip to content

Commit ebfe32b

Browse files
authored
Update translate.js
1 parent 143f1b2 commit ebfe32b

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/Typings/Scene/Resources/translate.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,26 @@ Scene.newF("translate", function(data, meta) {
4444
ids.shift(); ids.shift(); ids.shift(); ids.shift();
4545

4646

47+
// removes more whitespace :skull:
48+
stuff = stuff.map( s => s.filter( miniStuff => {
49+
return miniStuff.replace(/(\r\n|\n|\r)/gm, "").replace(/\s/, "").length > 1
50+
}));
51+
52+
4753
// nvm more messy
4854
stuff.forEach( (s, i) => {
4955
let name = s[0].replace(":", ""); // removes the : from the name of the property
5056
let { fileID } = ids[i]; // gets the file id
5157
if (this.parent[name]) {
52-
try {
53-
let obj = this.__createChild(name, stuff); // creates a new child obj
54-
55-
// this part is mostly just for like making sure that objects get put in Scene.objects and UnityscriptWorkspace.objects
56-
if (obj instanceof this.parent.GameObject) { this.objects.push(fileID, obj); this.parent.objects.push(fileID, obj); }
57-
if (obj instanceof this.parent.Light) { this.lights.push(fileID, obj); }
58-
if (obj instanceof this.parent.Camera) { this.cameras.push(fileID, obj); }
59-
60-
// finally adds it to the children
61-
this.children.push(fileID, obj);
62-
} catch(e) {}
58+
let obj = this.__createChild(name, stuff); // creates a new child obj
59+
60+
// this part is mostly just for like making sure that objects get put in Scene.objects and UnityscriptWorkspace.objects
61+
if (obj instanceof this.parent.GameObject) { this.objects.push(fileID, obj); this.parent.objects.push(fileID, obj); }
62+
if (obj instanceof this.parent.Light) { this.lights.push(fileID, obj); }
63+
if (obj instanceof this.parent.Camera) { this.cameras.push(fileID, obj); }
64+
65+
// finally adds it to the children
66+
this.children.push(fileID, obj);
6367
}
6468
});
6569
})

0 commit comments

Comments
 (0)