Scripting error?



3

I’m not a programmer, I usually use patches to build effects. But I need to add this script to effect. I found it on Github with the help of the group. But there is an annoying error that I can not solve, can you help?

Can you link to the filter settings script?

In any case, my guess is that you just need to use await to wait for the textures to come from Tex.findFirst. Something like this:

async function init(){
  FilterSettings.configure({
    contrast: {
      icon: await Tex.findFirst('1')
    }
  })
}
init()

check the project file please

Sorry but I don’t really understand what that script is trying to do. Why do you need script for your picker/slider? Can’t you use the patches?

this simple presistence script to adjust color settings if you can solve it using patch please do
or tell how :pleading_face:

I’m not sure where you got the original script from, but maybe you can suggest this update. The problem was that the configure function wasn’t waiting for the textures to resolve before initializing the picker UI.

I changed this key map so it will wait for all of the image textures before proceeding

await Promise.all(
	this.keys.map((key) => {
		if (this[key]) {
			throw `${key} is a reserved value.`;
		}

		// Set default value or fall back to 0
		this[key] = settings[key].default || 0;
		return settings[key].icon.then((icon) => {
			// Add icon to picker.
			this.pickerConfig.items.push({
				image_texture: icon
			});
			settings[key].icon = icon;
		});
	})
)

sparkARFilterSettings.arexport (131.3 KB)

1 Like

working thank you sir :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes:

1 Like


After testing the effect . it doesn’t save the new values of sliders
also I found no persistence in capabilities .
Mr @josh_beckwith
can you take a look on the export file again ?

You will need to click on that + button to find it in the capabilities list.

I think that there is no persistence in the script this is the reason. Another thing is that the pictures of the picker ui appear on some phones and others not.

There is a bug with the picker UI where it doesn’t show up on some devices. You can report the issue to the spark team, which helps them prioritize bug fixes.

If you want to implement the persistence, you can store the values from the slider/picker combinations and then retrieve them when the effect starts up.

1 Like