Forum

Is it possible to create new io boxes with SetPatch and XML?

hello.

im tired of creating ioboxes, give them standart names and adapt their look in inspektor each time i patch around.i want to create a patch that can create predefined ioboxes (and maybe even some connected structures which i need frequently) with a simple keyboard shortcut. is something like that possible with the setpatch node? createnode just can create modules and subpatches but no built in nodes am i right?

it would be also cool if that patch could be added in the args file so that its loaded when vvvv starts. but is it possible that this patch creates the new modes in just any active vvvv patchwindow?

yes it is.

<NODE nodename=“IOBox (String)” componentmode=“InABox” id=“0”>
<BOUNDS type=“Node” left=“5805” top=“4110” width=“0” height=“0”>
</BOUNDS>
<BOUNDS type=“Window” left=“10530” top=“7335” width=“215” height=“160”>
</BOUNDS>
<BOUNDS type=“Box” left=“5805” top=“4110” width=“7305” height=“5505”>
</BOUNDS>
<PIN pinname=“Input String” visible=“1”>
</PIN>
<PIN pinname=“Descriptive Name” slicecount=“1” values=“test”>
</PIN>
</NODE>

make sure, the id is not used (e.g. very high numbers). Within the bounds element you can place the node…

thanks for the quick answer. the newly created node exist only as long as its creating setpatch node is integrated right?

the newly created node exist only as long as its creating setpatch node is integrated right?

No, once created the node will stay until you delete it.

mh when i feed setpatch with your xml code i see nothing. maybe theire placed somewhere outside the window… are these values pixels: left=“5805” top=“4110” width=“0” height=“0”> ?
and where ist the origin?

ahem yes, sorry, you have to surround the whole thing with the element <PATCH> and take a HIGH id. not the zero i’ve posted. For each diplaymode there is one BOUNDS element which places the node on the patch or screen. Don’t ask for units? I never understood them. joreg, gregsn?

Also, every Subpatch has a hidden pin called “Patch” use this pin if you want to set nodes within a subpatch from outside.

the value is pixel*15 as far as i know…

but you can use kalles trick: place a number of IOBoxes in the default help patch you get if you press F1 while nothing selected and copy/paste from it…

with setpatch you can do almost everything what you can do while patching. it uses the same internal messages… the only restriction: you can’t delete nodes. adding and changing nodes is possible though. if you want to learn more about the DocumentType. Try to figure out what getPatch delivers and check the DTD in the BIN Folder.

ok thanks a lot for your help. kalles trick is really quick and easy. sometimes i think i just search for a reason to do complicated things :)

i think i play around further with that xml stuff because theres a lot of potential, and until i got a usable solution i use kalles trick.

ahem, yes, that helppatch thing, i remember.

starting from the thesis that you don’t need that helppatch anymore after about two weeks patching…

meanwhile i have a module called Clipboard (VVVV).
where i copy/paste all those often used things like labelled and preconfigured IOboxes or often used “patchlets” like Renderer,camera,group,Axis and Grid.

having that as module makes it easier to migrate between different vvvversions.
creating an empty node and starting to type “cli” is almost as fast as hitting F1.

do you have other good ideas to be contained in that clipboard?

Clipboard (VVVV).v4p (26.3 kB)

VVVVs xml file format uses a legacy unit called twips (twentieth of a point) for its pixel metrics. One twip is 1/1440 inch or 17.639 µm when derived from the PostScript point at 72 to the inch. The twip is some lovely ideosyncratic part of the windows API. As the native screen resolution on most windows machines is 96 dpi you will usually get 15 twips per pixel.

make sure, the id is not used (e.g. very high numbers).
@david; gregsn: but aren´t negative numbers as IDs in patch messages used to create unique new IDs?

when trying to create a node with a negativ id using SetPatch the node will be created, but i can’t delete it afterwards… this is weird. trying to connect the node to other ones causes vvvv to crash. gregsn, what is that thing with negativ id’s?

made a small modifictaion to kalles clipboard vvvv. now you can show/hide the cliboard window by just hitting f2.

but you have to open it with args in the beginning…
/o modules\kalle\Clipboard(VVVV).v4p

the problem now is that the empty patch window that shows up when starting vvvvv window open anymore… any ideas?

second problem is that args doenst handle patches with a space in their name…

Clipboard(VVVV).v4p (30.0 kB)

the empty patch only opens when there is no other window opened on startup.

patches with spaces in their name need to be enclosed in quotes like: “patch name.v4p”

btw.: update regarding the clipboard thing:

now i have a subfolder …/Clipboard in my modules folder
containing e.g.

IOBox (String Clipboard).v4p
RegExpr (String Clipboard).v4p
XPath (XML Clipboard).v4p

with preconfigured IOboxes , proved RegExpressions etc.

Advantage:
those “Clipboard.v4p’s” appear in the node list right next to the related nodes.
a single clipboard file is just not enough…