I wonder if there's any way to get the unique value or symbol that can be used in each subpatch.
Something like $0 but that is unique in each subpatch.
Is there any external that does a similar thing?
Thanks!
-
Getting the unique value for each subpatch.
-
@cuinjune No, because a sub-patch is really just a hidden window in the patch that contains it, and it inherits all of the same attributes. It is in fact a canvas....... https://puredata.info/docs/developer/PdFileFormat
But you can "name" it with [namecanvas] and so send messages to it like this...... example.zip and of course use unique [send] and [receive] messages.
As a sub-patch is saved with the patch it cannot be saved separately. However, you can have many sub-patches with the same name, and changing the contents of one of them does not affect the contents of the others (unlike abstractions). You need to choose "sub-patch" or "abstraction" according to your requirements.
David. -
why would you need unique names for sub-patches? If two sub-patches are identical, then they should be used as abstractions instead. That's what an abstraction is for, re-use of code.
-
In Purr Data
[name(---[canvasinfo]
will output the unique symbol receiver for the canvas in which it appears, including subpatches. Also, if you type<ctrl-m>
to send a message to Pd in Purr Data, the text entry begins with that same symbol receiver highlighted so that you can send a message directly to that canvas if you want. However, those symbols are essentially randomly chosen hex strings which will be different if you restart Pd.But those are both there mostly for debugging purposes.
There is also
[ggee/receivelocal]
and[ggee/sendlocal]
which are local to a particular canvas or subpatch. When you instantiate them a warning is printed saying that they are deprecated by "send/receive $0-foo". But dollarsign zero isn't local to subpatches so I don't understand the warning.Edit: clarification
-
@jancsika Hi, that was exactly what I wanted to know. Thank you so much!