diff --git a/max/scripts/init_clip.js b/max/scripts/init_clip.js new file mode 100644 index 0000000..36b7353 --- /dev/null +++ b/max/scripts/init_clip.js @@ -0,0 +1,29 @@ +/* global post, messagename, outlet, LiveAPI, jsarguments */ + +inlets = 1 +outlets = 1 +autowatch = 1 + +var path = jsarguments[1] + +function anything () { + 'use strict' + + if (messagename === 'bang') { + initializeClip() + } +} + +function initializeClip () { + 'use strict' + + var apiObject = new LiveAPI(path.split('/').join(' ')) + var clipName = '' + apiObject.get('name')[0] + var clipColor = apiObject.get('color')[0] + var clipObject = this.patcher.getnamed('clip_ui') + + clipObject.message('text', clipName.substring(0, 25)) + clipObject.message('bgcolor', [(clipColor >> 16 & 255) / 255, (clipColor >> 8 & 255) / 255, (clipColor & 255) / 255, 1.0]) + + outlet(0, 'id ' + apiObject.id) +} diff --git a/test/touchdesigner.toe b/test/touchdesigner.toe index e730191..81174fb 100644 Binary files a/test/touchdesigner.toe and b/test/touchdesigner.toe differ