How to get rid rid of {EXP::...}
-
@UrsBollhalder
I can't test right now, but try this:inline function loadSampleFromViewport(component, value) { for (n in name) n.replace("{EXP::LIGHTER}", ""); ViewportsExp[1].set("items", name.join("\n")); } ViewportsExp[0].setControlCallback(loadSampleFromViewport);
-
@ustk Awesome! Thanks so much. I’ll give it a go and can do some more digging if necessary!!
🥳
-
How are you populating the array initially?
-
@d-healey said in How to get rid rid of {EXP::...}:
How are you populating the array initially?
for(e in expHandler.getExpansionList()){ expansionNames.push(e.getProperties().Name); expSampleMaps.push(e.getSampleMapList()); }
Like this.
-
@UrsBollhalder Good :)
-
@d-healey said in How to get rid rid of {EXP::...}:
@UrsBollhalder Good :)
:grinning_face_with_sweat:
-
@d-healey @ustk Maybe not the most elegant, but it works... couldn't make the replace function working! So I split....
const var ViewportsExp = [Content.getComponent("vwpExp"), Content.getComponent("vwpSampleMaps")]; ViewportsExp[0].set("useList", true); ViewportsExp[1].set("useList", true); ViewportsExp[0].set("items", expansionNames.join("\n")); const var namesExp = []; inline function loadSampleFromViewport(component, value) { namesExp.clear(); var name = expSampleMaps[value]; for (n in name){ var sp = n.split("}"); namesExp.push(sp[1]); } ViewportsExp[1].set("items", namesExp.join("\n")); } ViewportsExp[0].setControlCallback(loadSampleFromViewport);
-
@UrsBollhalder Yeah replace won't work unless all of the sample maps are from the same expansion. You could also use substring().
-
@d-healey @UrsBollhalder I don't know very much expansions, but I thought there was a way to get the expansion name like:
n.replace("{EXP::" + getExpansionName() + "}", "");
-
@ustk That looks rather solid as well tbh!