Skip to content

Commit 0efb95c

Browse files
authored
Update __formSettings.js
1 parent 173eff4 commit 0efb95c

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/Workspace/Resources/__formSettings.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@ const { Workspace } = require('../index.js');
44
Workspace.newF("__formSettings", function(cl, settings) {
55
let fixSettings = Soup.from(settings);
66

7-
fixSettings = fixSettings.mapKeys( (k, v) => {
8-
let fixed = k.replace("m_", "");
9-
fixed = fixed.split("");
10-
if (fixed[1].toUpperCase() != fixed[1]) fixed[0] = fixed[0].toLowerCase();
11-
return fixed.join("");
12-
});
7+
// translate something like m_OcclusionBakeSettings to occlusionBakeSettings
8+
fixSettings = fixSettings.mapKeys( (k, v) => {
9+
let fixed = k.replace("m_", ""); // remove the m_
10+
fixed = fixed.split(""); // split it up
11+
if (fixed[1].toUpperCase() != fixed[1]) fixed[0] = fixed[0].toLowerCase(); // if the 2nd character isn't capital turn the first to lowercase
12+
return fixed.join("");
13+
});
1314

14-
fixSettings.map( (k, v, i) => {
15-
return new cl.parent.UnityscriptObject(k, v);
16-
});
15+
// turn everything into unityscript objects
16+
fixSettings.map( (k, v, i) => {
17+
return new cl.parent.UnityscriptObject(k, v);
18+
});
1719

18-
Object.assign(cl, fixSettings.pour());
19-
return fixSettings;
20+
// assign them to the class
21+
Object.assign(cl, fixSettings.pour());
22+
return fixSettings;
2023
});

0 commit comments

Comments
 (0)