Skip to content

Instantly share code, notes, and snippets.

@lassemt
Last active April 20, 2022 22:06
Show Gist options
  • Save lassemt/7b6833cfa2dc0bb0e643c52cb7d6b5a2 to your computer and use it in GitHub Desktop.
Save lassemt/7b6833cfa2dc0bb0e643c52cb7d6b5a2 to your computer and use it in GitHub Desktop.
const Scene = require('Scene');
//
// Old way
//
const obj = Scene.root.find('2dText0');
// Do stuff to the object in global scope
//
// New way
//
Scene.root.findFirst('2dText0').then(obj => {
// Object is ready
// you can update the object signals etc here.
});
const D = require('Diagnostics');
const Patches = require('Patches');
//
// RECVIEVING SIGNALS FROM PATCHES
//
//
// Old way
//
const onTap = Patches.getPulseValue('tap');
onTap.subscribe(evt => {
D.log('tap')
});
//
// New way
//
Patches.outputs.getPulse('tap').then(signal => {
signal.subscribe(evt => {
D.log('tap');
});
});
//
// SENDING SIGNALS TO PATCHES
//
//
// Old way
//
Patches.setStringValue('timeNow', new Date().toString());
//
// New way
//
// Note how the new method returns a promise. Not sure what
// it can be used for though,
Patches.inputs.setString('timeNow', new Date().toString()).then(() => {
D.log('Signal is set?');
});
// So this could be enough for this
Patches.inputs.setString('timeNow', new Date().toString());
@Demien2020
Copy link

Hi,How can I update the new code of my filter?
Now I've solved it with a tap but I'd like to change the text for each picker again.
I had linked a different dynamic text for each picker of the native ui with code old.
I have problems with canvas and rectangles.
Do you have any feedback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment