Forums > Javascript

Request: direct access to patcher arguments/attributes

April 19, 2007 | 10:20 pm

Sure, I know we can connect a patcherargs object and bang it, but that requires that the js is actually IN the patcher we’re interested in, and if the patcherargs gets banged very early in the instantiation process it will only output the "done" attribute, so we can’t know if there are any attributes or not.

What I’m thinking of is a patcher.arguments property, which is null (and thus testable) until the arguments are available.

When the arguments are available, patcher.arguments.main (or such) is an array of the normal args (similar to patcherargs left outlet, and attributes are presented as individual properties, ie @test 5 would become patcher.arguments.test = 5.

so [obj 4 6 test @att1 7 8 @att2 "my attribute"]

becomes

patcher.arguments.main = [4, 6, test]
patcher.arguments.att1 = [7, 8]
patcher.arguments.att2 = "my attribute"

And (just a thought here) it might be nice if those properties were get/set, to allow the visual representation of the patcher/abstraction to be updated? Probably not a good idea?


April 20, 2007 | 8:19 am

Very good idea.

http://www.cycling74.com/forums/index.php?t=msg&goto=88718&rid=3579&S=7dfd4d68a48d0dfb262b530af90d49c

;)

Mattijs

Quote: johnpitcairn wrote on Fri, 20 April 2007 00:20
—————————————————-
> Sure, I know we can connect a patcherargs object and bang it, but that requires that the js is actually IN the patcher we’re interested in, and if the patcherargs gets banged very early in the instantiation process it will only output the "done" attribute, so we can’t know if there are any attributes or not.
>
> What I’m thinking of is a patcher.arguments property, which is null (and thus testable) until the arguments are available.
>
> When the arguments are available, patcher.arguments.main (or such) is an array of the normal args (similar to patcherargs left outlet, and attributes are presented as individual properties, ie @test 5 would become patcher.arguments.test = 5.
>
> so [obj 4 6 test @att1 7 8 @att2 "my attribute"]
>
> becomes
>
> patcher.arguments.main = [4, 6, test]
> patcher.arguments.att1 = [7, 8]
> patcher.arguments.att2 = "my attribute"
>
> And (just a thought here) it might be nice if those properties were get/set, to allow the visual representation of the patcher/abstraction to be updated? Probably not a good idea?
>
—————————————————-


Viewing 2 posts - 1 through 2 (of 2 total)