Two simple questions:
- Is there an easy way to find out the id of the last object created in a patch?
- Can I stop subpatches from opening on creation? If so, how do you do that?
Object ID and Hiding Subpatches when using Broadcast Messages
Two simple questions:
Is there a broadcast message for removing an object from a patch?
Haha, don't think so. This is a serious limitation. The closest thing is the [clear( message, but that destroys everything. It's conceivable that you could direct it towards a specific subpatch and then rebuild the whole thing up until the object you want removed, but this would be tedious.
@ricky said
Is there a broadcast message for removing an object from a patch?
I'm non-dynamic. However, I'm pretty sure you can benefit from...
[cut(
Read the file 3.2.cut_paste.pd
Have a nice day!
I live and love in Argentina
Lovely! Thanks.
@ricky Here's a patch I made that will do this. Give it the name of your patch and it will give you the ID of each object, which you can use to connect/disconnect them:
@ricky And there is a technique you can use for deleting objects in a patch, but it's kind of hacky. You can use [find <object_identifier> 1, cut( if the object has something in its name that is guaranteed to be unique. This usually isn't the case, but you can design your dynamic patch with this in mind.
Here's an example where I do this:
Thanks, Chris. Nice approach.
...I see you're at Tufts (I know Paul) :o)
I've been bumming around in the iemguts library, and it looks like there are some really useful objects there for this kind of dynamic patching, including [canvasdelete]. I don't understand them well yet, but there are several other objects here which might be what you're looking for.
@ricky said:
- Is there an easy way to find out the id of the last object created in a patch?
You can use [iemguts/canvasindex] - its right outlet outputs total number of objects in the patch (so subtract 1 to get last object's index, because indices are zero-based).
_xb
@ricky Cool! Small world I guess. I'm working with him right now on using Pd for a Music Apps for the iPad course — it's really fun.
Oops! Looks like something went wrong!