[Advanced] Dynamic Patching in Pure Data Vanilla

Поділитися
Вставка
  • Опубліковано 22 вер 2017
  • UPDATE: I've found a way to delete specific objects. You can use the internal message "pd-name-of-subpatch mouse x y 0 0" to click on parts of the patch, then use "pd-name-of-subpatch cut" to delete the object. This is ever better than "click" because it doesn't focus the window while it's happening.
    Download the patches in this video: github.com/megalon/DynamicPat...
    PD Internal Messages list: puredata.info/docs/tutorials/...

КОМЕНТАРІ • 19

  • @matthieupernaudmusic
    @matthieupernaudmusic 2 роки тому +5

    this is GOLD 😍. thanks ! that's more than useful

  • @patrickmanion8736
    @patrickmanion8736 4 роки тому +2

    Thank you for this. I wanted to be able to break a connection between two objects dynamically. After a bit of experimentation I started pd up on the command line (Mac OS X) with a high debug value such as "./pd -d 10". This displays all the mouse coordinates as you move around. I hovered over the connection I wanted to delete and got the coordinates. In my case x and y were 13 and 39 respectively. In the parent patch I executed the following commands:
    1) [editmode 1(
    2) [mouse 13 39 0 0(
    3) [cut(
    4) [editmode 0(
    Oh, btw, this was done using vanilla 0.50-2
    Here is my simple patch "dynamic_patching_with_connection_deletion.pd
    #N canvas 868 182 622 648 12;
    #N canvas 1542 274 433 300 test 1;
    #X msg 10 10 hello;
    #X obj 10 50 print;
    #X restore 27 152 pd test;
    #X obj 26 602 s pd-test;
    #X msg 26 183 msg 10 10 hello;
    #X msg 41 210 obj 10 50 print;
    #X msg 56 240 connect 0 0 1 0;
    #X msg 68 266 clear;
    #X msg 122 447 cut;
    #X msg 78 291 selectall;
    #X msg 92 314 tidy;
    #X text 15 25 This shows how to dynamically add and delete objects
    ;
    #X text 138 182 do these first;
    #X msg 122 425 mouse 13 39 0 0;
    #X text 16 50 In order to break a connection run pd from the command
    line with a high debug number "pd -d 10" worked for me. Hover over
    the exact connection you want to break and get the mouse coordinates.
    Put these in a mouse command(see below). Then \, send a cut command.
    ;
    #X msg 122 403 editmode 1;
    #X msg 122 469 editmode 0;
    #X text 205 402 turn on editmode;
    #X text 200 469 turn off editmode;
    #X connect 2 0 1 0;
    #X connect 3 0 1 0;
    #X connect 4 0 1 0;
    #X connect 5 0 1 0;
    #X connect 6 0 1 0;
    #X connect 7 0 1 0;
    #X connect 8 0 1 0;
    #X connect 11 0 1 0;
    #X connect 13 0 1 0;
    #X connect 14 0 1 0;

  • @thulsadum
    @thulsadum 3 місяці тому

    For deleting a specific object or atom, you could use the [ delete ( message of the pointer object, if you manage to get hold of an pointer to that object (which is not that apparent to me atm, tbh).

  • @harmonoman7642
    @harmonoman7642 6 років тому

    great work!!!

  • @plasticdub1477
    @plasticdub1477 Рік тому

    thank you for this - and particularly for making it clear how "connect" objects work - the only thing i would add is that the indices for "connect" seem to restart from zero inside each sub-patch - i have been trying to dynamically create an array of float atoms (number boxes) plus a couple toggles - dynamically setting "send" and "receive" works for the float atoms but not for the toggles - so i need to use "connect" messages to get around this - so long as i create the the toggles first inside an empty sub-patch then i can rely on them being indexed 0, 1, etc. and it's easy to connect them - btw the other method i found for doing a dynamic "receive" is to use a parallel "value" object - e.g. if i have [send foo] and [value foo] then whatever goes into my "send" ends up in the "value" object and i can get it by banging the left input - the reason this solves the problem is that you can use the right input of the "value" object to tell it what to output (just like we wish we could do with "receive") - i actually prefer this to using "receive" because it requires that you bang the left input of the "value" object so everything inherently stays in sync...

  • @uoailewa
    @uoailewa 5 місяців тому

    Cool

  • @sinewave440hertz
    @sinewave440hertz 6 років тому +1

    Thanks very much for this! Just getting into dynamic patching and this helps me no end. I'm curious to know if you've used dynamic patching to help in building abstractions. Currently experimenting as it seems to be a good way to create (sub)patches on the fly based on the arguments of an abstraction.

    • @megalonpuredata3204
      @megalonpuredata3204  6 років тому +1

      Thanks!
      I haven't used it for that purpose, but I am using it regularly to dynamically create receive objects, since you can't normally redefine their names once they have been placed

  • @harmonoman7642
    @harmonoman7642 6 років тому

    I ran into some very helpful links here: forum.pdpatchrepo.info/topic/10813/collection-of-pd-internal-messages-dynamic-patching

  • @wurnotantmlb
    @wurnotantmlb 6 років тому

    common!!

  • @gabrieldecarvalhoeoliveira5618

    great video! is there a way to click with "Command"?

  • @MarioMey
    @MarioMey 3 роки тому

    Hi, man. How should I create objects in the same patch, not subpatch?

  • @joshuanewton1016
    @joshuanewton1016 4 роки тому

    Can you elaborate on how you managed to delete specific objects?

    • @megalonpuredata3204
      @megalonpuredata3204  4 роки тому +2

      Sure. I made this video several years ago, but I just made a quick test patch and it still works.
      pastebin.com/raw/RbhGRHWf
      The "mouse" event simulates a fake mouse click on the canvas (without actually focusing the window or taking mouse control from the user).
      You then "cut" the object that you want to delete.
      I didn't include in the description, but you can also give a "mouseup" message to release the mouse at a different position, and thus simulate clicking and dragging.
      I think it'd be best to just look at the source and see how these work. I'm not too familiar with the source, but it looks like this is the relevant line
      github.com/pure-data/pure-data/blob/c180bc44ab722cee728174847cf30730e44f245b/src/g_editor.c#L4834