Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d71d15c8f4 | |||
| 6c98714971 | |||
| dabb81f8e4 | |||
| 1897983305 | |||
| 26e7fd1ca4 | |||
| 5eaa9ca63d | |||
| 1b84b07e22 |
@@ -128,6 +128,10 @@
|
||||
<digest>Automatic writeagain</digest>
|
||||
<description>When set to 1, the jsui will automatically send a "writeagain" message to its linked pattrstorage anytime a preset have been stored, moved, renamed, (un)locked or deleted, saving any change into the preset file immediately.</description>
|
||||
</attribute>
|
||||
<attribute name='autoname' get='1' set='1' type='bool' size='1' >
|
||||
<digest>Autoname new presets</digest>
|
||||
<description>When enabled, presets stored in an empty slot get attributed a name starting with "Preset" followed by the slot number.</description>
|
||||
</attribute>
|
||||
<attribute name='bgcolor' get='1' set='1' type='list' size='4' >
|
||||
<digest>Background color</digest>
|
||||
<description>Sets the background color of the object in RGBA format</description>
|
||||
@@ -143,7 +147,7 @@
|
||||
In mode 2, stored preset colors can be freely set to one of the six colors of the color wheel.
|
||||
In mode 3, stored preset color can be set to any color in RGBA format.
|
||||
To define colors of the color wheel for modes 1 and 2, see color_1 to color_6 as well as the color_wheel message.
|
||||
To define preset color as in mode 2 or 3, see the setcolor message. Modes 2 and 3 require a pattr object named 'preset_color' to be at the same patcher level as the tc.preset object.
|
||||
To define preset color as in mode 2 or 3, see the setcolor message. Modes 2 and 3 require a [pattr preset_metadata] in the same patcher as [tc.preset]
|
||||
</description>
|
||||
</attribute>
|
||||
<attribute name='color_1' get='1' set='1' type='list' size='4' >
|
||||
@@ -230,6 +234,12 @@
|
||||
You need to double-click on a stored preset to recall it. If set to 0, stored presets are recalled by a single click (default preset object behavior).
|
||||
</description>
|
||||
</attribute>
|
||||
<attribute name='send_name' get='1' set='1' type='symbol' size='1' >
|
||||
<digest>Send dictionary to </digest>
|
||||
<description>
|
||||
Sets the name of the receive objects to which send the presets dictionary (the same as the one output from the objects rightmost outlet). If no name is set, the dictionary will still be sent to receives named <pattrstorage_name>_presets_dict
|
||||
</description>
|
||||
</attribute>
|
||||
<attribute name='slot_round' get='1' set='1' type='float' size='1' >
|
||||
<digest>Slot corner rounding</digest>
|
||||
<description>Defines the rounding of the slots corners. A value of zero means square corners. A value equal or superior to half the bubblesize makes the slots as a circle.
|
||||
@@ -244,6 +254,10 @@
|
||||
<digest>Stored slot color</digest>
|
||||
<description>Sets the stored preset color of the object in RGBA format</description>
|
||||
</attribute>
|
||||
<attribute name='timestamp' get='1' set='1' type='bool' size='1' >
|
||||
<digest>Generate timestamp metadata</digest>
|
||||
<description>When enabled, a 'created' and 'modified' timestamp will be stored for each new preset stored in an empty slot. Overwritten presets will only have their 'modified' timestamp updated. Requires a [pattr preset_metadata] in the same patcher as [tc.preset]</description>
|
||||
</attribute>
|
||||
<attribute name='ui_rename' get='1' set='1' type='bool' size='1' >
|
||||
<digest>Rename slots in UI</digest>
|
||||
<description>Use the attached textedit, if any, to edit slot names directly in the JSUI frame when clicking a slot while holding the control key. When disabled, the textedit remains untouched but gets focused when clicking a slot while holding the control key.</description>
|
||||
@@ -254,7 +268,7 @@
|
||||
</attribute>
|
||||
<attribute name='use_uid' get='1' set='1' type='bool' size='1' >
|
||||
<digest>Generate unique identifiers for each stored preset</digest>
|
||||
<description>When enabled, each stored preset gets a unique identifier, following the preset when it gets renamed, moved and overwritten. Requires a [pattr preset_metadata] at the same patcher of [tc.preset]. This can be useful when doing some complex preset management.</description>
|
||||
<description>When enabled, each stored preset gets a unique identifier, following the preset when it gets renamed, moved and overwritten. Requires a [pattr preset_metadata] in the same patcher as [tc.preset]. This can be useful when doing some complex preset management.</description>
|
||||
</attribute>
|
||||
</attributelist>
|
||||
|
||||
|
||||
@@ -61,9 +61,8 @@
|
||||
"border": 0,
|
||||
"embedstate": [
|
||||
[ "bgcolor", 0.125, 0.125, 0.125, 1.0 ],
|
||||
[ "fontsize", 14 ],
|
||||
[ "fontsize", 13 ],
|
||||
[ "menu_mode", 0 ],
|
||||
[ "text_bg_color", 1, 1, 1, 0.5 ],
|
||||
[ "autowriteagain", 0 ],
|
||||
[ "color_4", 0.367, 0.542, 0.712, 1 ],
|
||||
[ "empty_slot_color", 0.221327066888467, 0.221327006361825, 0.221327022178404, 1.0 ],
|
||||
@@ -150,9 +149,8 @@
|
||||
"border": 0,
|
||||
"embedstate": [
|
||||
[ "bgcolor", 0.125, 0.125, 0.125, 1.0 ],
|
||||
[ "fontsize", 14 ],
|
||||
[ "fontsize", 13 ],
|
||||
[ "menu_mode", 0 ],
|
||||
[ "text_bg_color", 1, 1, 1, 0.5 ],
|
||||
[ "autowriteagain", 0 ],
|
||||
[ "color_4", 0.367, 0.542, 0.712, 1 ],
|
||||
[ "empty_slot_color", 0.221327066888467, 0.221327006361825, 0.221327022178404, 1.0 ],
|
||||
|
||||
150
help/colors.json
150
help/colors.json
@@ -4,242 +4,212 @@
|
||||
"slots": {
|
||||
"1": {
|
||||
"id": 1,
|
||||
"name": "Preset 1",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"a322b36b-1aba-415c-9083-d8df678268b7\"}" ],
|
||||
"u099005226": [ -0.23, -0.5700000000000001, 0.26, 0.02, 0.72, -0.18, -0.46, 0.4, 0.16, -0.92, 0.77, 0.9500000000000001, -0.37, 0.25, -0.07, -0.38 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lahwiegt\",\"created\":\"2026-06-30T13:17:24.810Z\",\"modified\":\"2026-06-30T13:17:24.810Z\"}" ],
|
||||
"u099005226": [ -0.31, 0.15, 0.08, -0.77, 0.62, 0.19, -0.35000000000000003, 0.9, 0.87, 0.92, -0.16, -0.7000000000000001, 0.11, 0.31, -0.09, -0.77 ]
|
||||
}
|
||||
},
|
||||
"2": {
|
||||
"id": 2,
|
||||
"name": "Preset 2",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"416cad49-d949-4d13-ad8b-4c8d16422e95\"}" ],
|
||||
"u099005226": [ -0.64, 0.47000000000000003, -0.3, -0.7000000000000001, 0.55, 0.59, -0.38, 0.28, 0.9, 0.19, -0.8, 0.66, -0.2, -0.1, -0.65, -0.8300000000000001 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8laknhj5c\",\"created\":\"2026-06-30T13:17:24.812Z\",\"modified\":\"2026-06-30T13:17:24.812Z\"}" ],
|
||||
"u099005226": [ 0.32, -0.33, -0.6, 0.27, -0.87, 0.62, 0.12, -0.36, 0.97, -0.9, -0.15, -0.53, 0.39, 0.88, 0.52, -0.85 ]
|
||||
}
|
||||
},
|
||||
"3": {
|
||||
"id": 3,
|
||||
"name": "Preset 3",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"a5ea784b-e1d8-45af-9415-ae4ee863ee15\"}" ],
|
||||
"u099005226": [ -0.02, 0.65, -0.24, 0.6900000000000001, -0.21, -0.34, 0.63, 0.93, 0.48, 0.32, 0.28, 0.11, -0.52, -0.08, -0.63, -0.85 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lamttkyr\",\"created\":\"2026-06-30T13:17:24.814Z\",\"modified\":\"2026-06-30T13:17:24.814Z\"}" ],
|
||||
"u099005226": [ 0.93, -0.81, 0.8300000000000001, 0.85, -0.02, 0.17, 0.15, -0.52, -0.58, -0.54, -0.52, -0.62, -0.41000000000000003, 0.47000000000000003, -0.04, -0.79 ]
|
||||
}
|
||||
},
|
||||
"4": {
|
||||
"id": 4,
|
||||
"name": "Preset 4",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"e6da1028-1f9d-46b2-9317-df7336e277da\"}" ],
|
||||
"u099005226": [ 0.62, -0.84, -0.89, 0.8200000000000001, -0.19, -0.96, -0.92, -0.92, 0.37, -0.3, 0.91, 0.78, -0.75, 0.64, 0.96, -0.45 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lan7pxl7\",\"created\":\"2026-06-30T13:17:24.815Z\",\"modified\":\"2026-06-30T13:17:24.815Z\"}" ],
|
||||
"u099005226": [ -0.55, -0.8, -0.5700000000000001, 0.54, 0.17, 0.68, -0.47000000000000003, 0.46, -0.09, -0.88, 0.14, 0.85, 0.33, -0.8, 0.58, -0.7000000000000001 ]
|
||||
}
|
||||
},
|
||||
"5": {
|
||||
"id": 5,
|
||||
"name": "Preset 5",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"c6499b4a-1dcf-4b1e-a4fc-a546020b26d9\"}" ],
|
||||
"u099005226": [ 0.84, 0.31, 0.14, -0.26, -0.92, 0.79, -0.59, -0.77, -0.88, -0.35000000000000003, 0.87, -0.8, -0.96, -0.87, -0.86, -0.38 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lasza0vr\",\"created\":\"2026-06-30T13:17:24.820Z\",\"modified\":\"2026-06-30T13:17:24.820Z\"}" ],
|
||||
"u099005226": [ 0.14, 0.73, -0.85, 0.84, 0.01, -0.8300000000000001, 0.47000000000000003, 0.39, 0.01, -0.02, 0.11, 0.42, -0.19, -0.13, -0.53, -0.26 ]
|
||||
}
|
||||
},
|
||||
"6": {
|
||||
"id": 6,
|
||||
"name": "Preset 6",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"47896b3c-65df-4c56-a8eb-c2fe0553472a\"}" ],
|
||||
"u099005226": [ 0.22, -0.6900000000000001, -0.06, -0.8, -0.47000000000000003, 0.16, 0.61, -0.75, 0.98, -0.12, -0.3, 0.11, -0.02, -0.2, 0.6, -0.5700000000000001 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8latoznsz\",\"created\":\"2026-06-30T13:17:24.821Z\",\"modified\":\"2026-06-30T13:17:24.821Z\"}" ],
|
||||
"u099005226": [ -0.72, -0.93, 0.03, -0.25, -1.0, -0.6900000000000001, 0.14, 0.73, 0.38, 0.96, -0.93, -0.14, -0.59, -0.56, -0.14, -0.58 ]
|
||||
}
|
||||
},
|
||||
"7": {
|
||||
"id": 7,
|
||||
"name": "Preset 7",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"2f1aaecc-cd1e-4a81-82d2-d46c9136cfa5\"}" ],
|
||||
"u099005226": [ 0.9400000000000001, 0.3, -0.37, -0.37, -0.43, 0.31, 0.89, -0.43, -0.12, 0.11, -0.33, -0.19, 0.02, 0.32, 0.45, -0.8200000000000001 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lauuhens\",\"created\":\"2026-06-30T13:17:24.822Z\",\"modified\":\"2026-06-30T13:17:24.822Z\"}" ],
|
||||
"u099005226": [ -0.71, -0.66, -0.79, -0.46, -0.74, -0.84, -0.5, -0.89, -0.32, -0.65, 0.01, 0.05, -0.98, -0.44, -0.31, 0.51 ]
|
||||
}
|
||||
},
|
||||
"8": {
|
||||
"id": 8,
|
||||
"name": "Preset 8",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"9f47c706-f761-4c58-afdf-28c65ade9cb3\"}" ],
|
||||
"u099005226": [ -0.88, 0.42, -0.45, 0.11, -0.6900000000000001, -0.09, -0.9400000000000001, 0.08, -0.63, 0.5, -0.22, 0.87, -0.38, 0.37, -0.33, -0.52 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lavt3tyx\",\"created\":\"2026-06-30T13:17:24.823Z\",\"modified\":\"2026-06-30T13:17:24.823Z\"}" ],
|
||||
"u099005226": [ 0.2, -0.51, 0.64, -0.42, -0.21, -0.24, -0.17, -0.07, -0.58, -0.71, 0.87, -0.53, 0.3, 0.5700000000000001, -0.15, 0.5 ]
|
||||
}
|
||||
},
|
||||
"9": {
|
||||
"id": 9,
|
||||
"name": "Preset 9",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"d1be0a1d-7a3b-4613-80e4-0b0efa3ab660\"}" ],
|
||||
"u099005226": [ -0.29, 0.63, -0.6900000000000001, 0.53, 0.8, 0.04, -0.98, -0.03, -0.61, 0.05, -0.5, 0.02, -0.71, 0.67, -0.97, 0.58 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8laxxhs9v\",\"created\":\"2026-06-30T13:17:24.825Z\",\"modified\":\"2026-06-30T13:17:24.825Z\"}" ],
|
||||
"u099005226": [ -0.42, -0.8200000000000001, -0.28, -0.49, -0.9500000000000001, 0.96, 0.4, 0.2, -0.16, 0.37, -0.5700000000000001, -0.75, -0.23, 0.41000000000000003, -0.41000000000000003, -0.62 ]
|
||||
}
|
||||
},
|
||||
"10": {
|
||||
"id": 10,
|
||||
"name": "Preset 10",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"26cc337d-6bcf-43ab-908b-1f7eb276388c\"}" ],
|
||||
"u099005226": [ 0.01, 0.39, -0.99, -0.93, 0.62, -0.76, 0.97, 0.44, -0.54, -0.72, -0.18, -0.04, -0.28, 0.42, 0.9, -0.71 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lay08zct\",\"created\":\"2026-06-30T13:17:24.826Z\",\"modified\":\"2026-06-30T13:17:24.826Z\"}" ],
|
||||
"u099005226": [ -0.38, 0.08, 0.46, -0.36, 0.37, 0.26, 0.18, -0.15, -0.27, -0.88, 0.47000000000000003, 0.16, 0.12, -0.07, -0.61, -0.8200000000000001 ]
|
||||
}
|
||||
},
|
||||
"11": {
|
||||
"id": 11,
|
||||
"name": "Preset 11",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"8485a630-8039-487c-8bc3-9aa9b7775009\"}" ],
|
||||
"u099005226": [ -0.34, 0.41000000000000003, 0.15, 0.79, 0.98, 0.97, 0.03, 0.74, -0.43, -0.9, -0.79, 0.65, -0.81, 0.0, 0.87, 0.18 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lb1vk3x4\",\"created\":\"2026-06-30T13:17:24.829Z\",\"modified\":\"2026-06-30T13:17:24.829Z\"}" ],
|
||||
"u099005226": [ -0.93, 0.99, -0.25, 0.35000000000000003, -0.72, 0.6, 0.14, -0.25, 0.21, 0.59, -0.32, -0.74, 0.87, 0.11, 0.33, 0.96 ]
|
||||
}
|
||||
},
|
||||
"12": {
|
||||
"id": 12,
|
||||
"name": "Preset 12",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"47516903-29a3-489f-8ac1-3719e4a8b1f4\"}" ],
|
||||
"u099005226": [ 0.17, 0.27, -0.16, -0.39, -0.88, -0.56, 0.9500000000000001, -0.92, 0.6900000000000001, 0.63, 0.38, 0.04, -0.1, -0.72, -0.33, -0.37 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lb32xuzz\",\"created\":\"2026-06-30T13:17:24.831Z\",\"modified\":\"2026-06-30T13:17:24.831Z\"}" ],
|
||||
"u099005226": [ 0.14, -0.77, -0.8300000000000001, -0.53, 0.1, -0.89, -0.38, -0.89, -0.77, -0.03, 0.34, 0.29, 0.97, 0.13, 0.1, -0.88 ]
|
||||
}
|
||||
},
|
||||
"13": {
|
||||
"id": 13,
|
||||
"name": "Preset 13",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"c41a028f-0eb6-4e7c-9b77-175ef06a865a\"}" ],
|
||||
"u099005226": [ -0.92, 0.78, 0.42, -0.32, 0.26, -0.7000000000000001, -0.81, -0.2, 0.06, -0.39, -0.17, 0.39, 0.22, 0.75, -0.1, -0.42 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lb44hcln\",\"created\":\"2026-06-30T13:17:24.832Z\",\"modified\":\"2026-06-30T13:17:24.832Z\"}" ],
|
||||
"u099005226": [ 0.8, -0.54, -0.31, 0.01, -0.73, 0.81, -0.43, 0.35000000000000003, 0.29, 0.19, 0.08, -0.13, -0.02, 0.15, -0.93, 0.63 ]
|
||||
}
|
||||
},
|
||||
"14": {
|
||||
"id": 14,
|
||||
"name": "Preset 14",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"543722ae-5744-44d8-881f-b7922c4c345c\"}" ],
|
||||
"u099005226": [ -0.37, 0.19, -0.54, -0.25, -0.6900000000000001, -0.32, -0.13, -0.03, 0.05, -0.42, -0.08, 0.72, 0.48, 0.15, 0.48, -0.56 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lb7qi25j\",\"created\":\"2026-06-30T13:17:24.835Z\",\"modified\":\"2026-06-30T13:17:24.835Z\"}" ],
|
||||
"u099005226": [ -0.5, 0.36, -0.11, -0.36, 0.74, -0.44, 0.35000000000000003, 0.48, 0.54, 0.43, -0.21, -0.72, 0.17, 0.6, -0.21, -0.05 ]
|
||||
}
|
||||
},
|
||||
"15": {
|
||||
"id": 15,
|
||||
"name": "Preset 15",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"b7f4a192-656d-4b7c-a81e-94dac376c7c4\"}" ],
|
||||
"u099005226": [ -0.18, -0.99, -0.29, 0.89, 0.26, -0.14, 0.28, -0.34, 0.1, 0.7000000000000001, 0.6, -0.74, -0.87, 0.67, 0.9, 0.03 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lb9vm196\",\"created\":\"2026-06-30T13:17:24.837Z\",\"modified\":\"2026-06-30T13:17:24.837Z\"}" ],
|
||||
"u099005226": [ -0.47000000000000003, 0.68, 0.31, -0.01, -0.93, -0.18, -0.36, -0.59, -0.46, -0.52, -0.98, 0.55, 0.13, 0.91, -0.78, -0.44 ]
|
||||
}
|
||||
},
|
||||
"16": {
|
||||
"id": 16,
|
||||
"name": "Preset 16",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"30425c06-ee40-4cb5-8ceb-87354fc78627\"}" ],
|
||||
"u099005226": [ 0.5700000000000001, 0.13, -0.42, -1.0, -0.73, 0.64, -0.64, 0.84, -0.06, -0.68, -0.51, -0.9400000000000001, 0.02, -0.31, 0.87, -0.85 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbazx2fg\",\"created\":\"2026-06-30T13:17:24.838Z\",\"modified\":\"2026-06-30T13:17:24.838Z\"}" ],
|
||||
"u099005226": [ 0.81, -0.91, 0.61, -0.24, 0.84, -0.99, 0.1, -0.24, -0.55, 0.9400000000000001, -0.42, -0.9, 0.65, -0.81, -0.05, -0.36 ]
|
||||
}
|
||||
},
|
||||
"17": {
|
||||
"id": 17,
|
||||
"name": "Preset 17",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"8ffd1cfb-81b9-4520-83e9-457a7575f8e1\"}" ],
|
||||
"u099005226": [ 0.7000000000000001, -0.67, -0.33, -0.58, -0.26, -0.8, 0.3, 0.6900000000000001, 0.18, -0.65, 0.39, -0.5700000000000001, 0.11, 0.98, 0.77, 0.59 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbdtcvnl\",\"created\":\"2026-06-30T13:17:24.841Z\",\"modified\":\"2026-06-30T13:17:24.841Z\"}" ],
|
||||
"u099005226": [ 0.21, 0.66, 0.76, -0.93, 0.89, 0.29, 0.86, -0.8200000000000001, 0.04, -0.3, -0.61, -0.17, 0.5, -0.27, 0.39, 0.54 ]
|
||||
}
|
||||
},
|
||||
"18": {
|
||||
"id": 18,
|
||||
"name": "Preset 18",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"f623fb60-d94e-49ec-b63f-d677f50cb1e0\"}" ],
|
||||
"u099005226": [ 0.0, 0.34, 0.72, 0.01, -0.9400000000000001, -0.24, -0.25, -0.67, 0.77, -0.63, -0.06, 0.54, -0.81, 0.19, 0.91, -0.64 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbelv51z\",\"created\":\"2026-06-30T13:17:24.842Z\",\"modified\":\"2026-06-30T13:17:24.842Z\"}" ],
|
||||
"u099005226": [ -0.88, 0.37, -0.07, 0.4, 0.4, 0.19, 0.36, -0.9400000000000001, -0.48, -0.9500000000000001, -0.98, -0.51, 0.53, 0.55, 0.38, -0.08 ]
|
||||
}
|
||||
},
|
||||
"19": {
|
||||
"id": 19,
|
||||
"name": "Preset 19",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"639f7725-654b-4177-bbc2-606c24f7e689\"}" ],
|
||||
"u099005226": [ -0.7000000000000001, -0.56, -0.12, 0.3, 0.5, 0.91, 0.51, -0.66, 0.04, -0.07, 0.33, -0.93, 0.19, 0.58, -0.48, -0.39 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbgfkj48\",\"created\":\"2026-06-30T13:17:24.844Z\",\"modified\":\"2026-06-30T13:17:24.844Z\"}" ],
|
||||
"u099005226": [ -0.9500000000000001, 0.16, -0.5700000000000001, -0.55, -0.11, -0.67, -0.38, 0.49, 0.71, -0.84, -0.84, -0.1, 0.28, 0.39, -0.77, 0.25 ]
|
||||
}
|
||||
},
|
||||
"20": {
|
||||
"id": 20,
|
||||
"name": "Preset 20",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"8e3bc022-ffdd-4154-86c3-b6f527974335\"}" ],
|
||||
"u099005226": [ -0.12, 0.68, -0.97, 0.78, 0.24, -0.76, -0.66, -0.68, 0.87, -0.8200000000000001, 0.52, -0.99, 0.44, 0.72, 0.97, -0.8 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbjga56o\",\"created\":\"2026-06-30T13:17:24.847Z\",\"modified\":\"2026-06-30T13:17:24.847Z\"}" ],
|
||||
"u099005226": [ -0.75, 0.89, 0.22, -0.52, -0.36, 0.8, -0.56, -0.68, 0.72, -0.7000000000000001, 0.41000000000000003, 0.33, 0.01, -0.11, -0.9, 0.45 ]
|
||||
}
|
||||
},
|
||||
"21": {
|
||||
"id": 21,
|
||||
"name": "Preset 21",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"bb57651d-1aa5-42a5-8fd4-9df051e6f87d\"}" ],
|
||||
"u099005226": [ -0.11, 0.92, 0.92, 0.98, -0.42, 0.14, -0.92, -0.52, 0.15, -0.55, -0.54, -0.99, 0.1, -0.2, -0.33, -0.09 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbkpf6w0\",\"created\":\"2026-06-30T13:17:24.848Z\",\"modified\":\"2026-06-30T13:17:24.848Z\"}" ],
|
||||
"u099005226": [ -0.8, -0.81, -0.47000000000000003, 0.9, -0.33, 0.36, 0.66, 0.65, 0.29, -0.21, -0.85, 0.8300000000000001, -0.86, 0.1, 0.02, 0.54 ]
|
||||
}
|
||||
},
|
||||
"22": {
|
||||
"id": 22,
|
||||
"name": "Preset 22",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"9a340fc0-3b57-4a20-a9aa-e1d4139683fe\"}" ],
|
||||
"u099005226": [ 0.36, -0.59, 0.92, 0.32, -0.1, 0.09, -0.02, -0.43, 0.38, -0.44, 0.47000000000000003, -0.43, -0.6, 0.43, -0.5, 0.45 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbn1gk3i\",\"created\":\"2026-06-30T13:17:24.851Z\",\"modified\":\"2026-06-30T13:17:24.851Z\"}" ],
|
||||
"u099005226": [ -0.1, -0.68, 0.71, 0.5700000000000001, -0.6, 0.99, 0.6, 0.8300000000000001, -0.5, 0.51, 0.24, 0.62, 0.51, 0.11, 0.09, -0.87 ]
|
||||
}
|
||||
},
|
||||
"23": {
|
||||
"id": 23,
|
||||
"name": "Preset 23",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"9d2f72e5-8ef4-425c-abe6-daefae9d2864\"}" ],
|
||||
"u099005226": [ -0.34, -0.44, -0.28, -0.26, 0.68, 0.93, 0.22, 0.46, -0.26, 0.41000000000000003, 0.25, 0.26, 0.86, 0.52, 0.08, -0.45 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbpurgts\",\"created\":\"2026-06-30T13:17:24.853Z\",\"modified\":\"2026-06-30T13:17:24.853Z\"}" ],
|
||||
"u099005226": [ 0.85, 0.54, -0.59, 0.53, 0.92, -0.52, -0.2, -0.74, -1.0, 0.16, 0.68, 0.99, 0.63, -0.25, 0.01, -0.9 ]
|
||||
}
|
||||
},
|
||||
"24": {
|
||||
"id": 24,
|
||||
"name": "Preset 24",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"b6e243d0-0095-4034-b89b-18386d1d7cbb\"}" ],
|
||||
"u099005226": [ 0.19, -0.6, -0.04, 0.11, -0.17, -0.3, 0.14, 0.99, -0.41000000000000003, 0.58, -0.03, 0.36, 0.91, 0.7000000000000001, -0.04, -0.73 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbsyijm9\",\"created\":\"2026-06-30T13:17:24.856Z\",\"modified\":\"2026-06-30T13:17:24.856Z\"}" ],
|
||||
"u099005226": [ 0.52, -0.49, -0.79, -0.49, -0.91, -0.39, -0.18, 0.34, -0.03, 0.97, -0.73, 0.21, 0.26, -0.97, 0.92, -0.43 ]
|
||||
}
|
||||
},
|
||||
"25": {
|
||||
"id": 25,
|
||||
"name": "Preset 25",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"a09d3a53-0216-4fe9-bdf4-c1c56fb8951b\"}" ],
|
||||
"u099005226": [ 0.7000000000000001, -0.58, -0.9, 0.32, 0.22, -0.3, 0.28, -0.96, -0.03, -0.93, 0.8, 0.36, -0.99, -0.84, 0.25, -0.81 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbt7brd7\",\"created\":\"2026-06-30T13:17:24.857Z\",\"modified\":\"2026-06-30T13:17:24.857Z\"}" ],
|
||||
"u099005226": [ 0.08, 0.41000000000000003, 0.76, -0.86, -0.99, 0.35000000000000003, 0.73, -0.96, 0.32, 0.56, -0.8, 0.58, 0.2, 0.42, 0.99, 0.03 ]
|
||||
}
|
||||
},
|
||||
"26": {
|
||||
"id": 26,
|
||||
"name": "Preset 26",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"6395b36f-d5de-461e-9d17-3efe8db6f7a7\"}" ],
|
||||
"u099005226": [ -0.23, -0.1, 0.29, -0.16, -0.88, 0.63, 0.08, 0.6, 0.31, -0.61, -0.68, -0.52, 0.08, -0.05, -0.6, -0.64 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbw682ln\",\"created\":\"2026-06-30T13:17:24.860Z\",\"modified\":\"2026-06-30T13:17:24.860Z\"}" ],
|
||||
"u099005226": [ -0.01, -0.74, 0.68, -0.52, 0.75, 0.36, -0.8200000000000001, 0.33, -0.63, -0.34, 0.56, 0.96, 0.9500000000000001, -0.35000000000000003, 0.08, 0.45 ]
|
||||
}
|
||||
},
|
||||
"34": {
|
||||
"id": 34,
|
||||
"name": "Preset 34",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"f30716a0-acde-4451-9f3e-a6c1ad65f546\"}" ],
|
||||
"u099005226": [ 0.86, 0.97, 0.74, -0.62, 0.4, -0.35000000000000003, 0.65, -0.81, 0.67, -0.48, -0.34, 0.77, 0.38, 0.91, 0.9, -0.7000000000000001 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lbygdnmz\",\"created\":\"2026-06-30T13:17:24.862Z\",\"modified\":\"2026-06-30T13:17:24.862Z\"}" ],
|
||||
"u099005226": [ 0.64, -0.17, 0.73, -0.14, -0.22, -0.45, 0.77, -0.61, -0.34, -0.73, -0.99, -0.27, -0.87, 0.02, -0.21, 0.61 ]
|
||||
}
|
||||
},
|
||||
"44": {
|
||||
"id": 44,
|
||||
"name": "Preset 44",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"1fbb9408-f660-4735-9984-f9111b77fda9\"}" ],
|
||||
"u099005226": [ -0.9400000000000001, -0.78, -0.36, -0.5, -0.16, 0.79, 0.85, 0.56, 0.14, -0.34, -0.89, 0.47000000000000003, -0.77, -0.96, -0.86, 0.49 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lc13ij04\",\"created\":\"2026-06-30T13:17:24.865Z\",\"modified\":\"2026-06-30T13:17:24.865Z\"}" ],
|
||||
"u099005226": [ 0.25, -0.21, -0.42, -0.8200000000000001, -0.86, 0.47000000000000003, 0.5700000000000001, -0.05, -0.67, 0.09, -0.06, -0.59, 0.55, 0.28, -0.13, -0.12 ]
|
||||
}
|
||||
},
|
||||
"56": {
|
||||
"id": 56,
|
||||
"name": "Preset 56",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"8c5b437e-7f0c-4e97-8a2a-70acda0f17d6\"}" ],
|
||||
"u099005226": [ -0.16, -0.01, -0.55, -0.6, 0.08, 0.98, 0.77, -0.6, 0.64, 0.6900000000000001, -0.79, -0.81, -0.28, -0.76, 0.15, 0.81 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lc3838tj\",\"created\":\"2026-06-30T13:17:24.867Z\",\"modified\":\"2026-06-30T13:17:24.867Z\"}" ],
|
||||
"u099005226": [ -0.96, -0.62, -0.5700000000000001, 0.21, -0.23, 0.96, -0.77, -0.21, 0.41000000000000003, -0.43, 0.07, 0.81, -0.5, -0.8, 0.92, -0.41000000000000003 ]
|
||||
}
|
||||
},
|
||||
"65": {
|
||||
"id": 65,
|
||||
"name": "Preset 65",
|
||||
"data": {
|
||||
"preset_metadata": [ "{\"color\":[0,0.502,0.502,0.502,1],\"uid\":\"44918fd8-bfef-42ee-87ed-13929dc21d32\"}" ],
|
||||
"u099005226": [ 0.63, 0.64, -0.14, 0.5700000000000001, -0.32, -0.78, 0.87, -0.36, -0.14, -0.85, -0.3, -0.51, 0.8200000000000001, -0.02, -0.02, 0.78 ]
|
||||
"preset_metadata": [ "{\"uid\":\"mr0o8lc56u8go\",\"created\":\"2026-06-30T13:17:24.869Z\",\"modified\":\"2026-06-30T13:17:24.869Z\"}" ],
|
||||
"u099005226": [ 0.22, -0.58, 0.8300000000000001, -0.33, -0.75, 0.54, 0.01, 0.92, -0.6, 0.16, -0.9500000000000001, -0.48, -0.78, -0.05, 0.8200000000000001, 0.45 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
This js file is meant to be used in Cycling'74 Max for the [jsui] object.
|
||||
It is designed to mimic [preset], but better.
|
||||
|
||||
Copyright (C) 2024 Théophile Clet <contact@tflcl.xyz> - https://tflcl.xyz.
|
||||
Copyright (C) 2026 Théophile Clet <contact@tflcl.xyz> - https://tflcl.xyz.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -24,7 +24,7 @@ autowatch = 0;
|
||||
// A "loadbang, pattrstorage test" message does the trick.
|
||||
|
||||
inlets = 1
|
||||
setinletassist(0, "Connect to the linked pattrstorage");
|
||||
setinletassist(0, "Connect to pattrstorage");
|
||||
|
||||
outlets = 5;
|
||||
setoutletassist(0, "Outputs last triggered action");
|
||||
@@ -46,7 +46,7 @@ var slot_round_ratio = 0;
|
||||
var margin = 4;
|
||||
var spacing = 4;
|
||||
|
||||
var font_size = 14;
|
||||
var font_size = 13;
|
||||
var font_name = "Arial";
|
||||
|
||||
var background_color = max.getcolor("theme_bgcolor"); //[0.2, 0.2, 0.2, 1];
|
||||
@@ -55,8 +55,8 @@ var active_slot_color = max.getcolor("theme_color"); //[0.808, 0.898, 0.910, 1];
|
||||
var stored_slot_color = max.getcolor("theme_accentcolor"); //[0.502, 0.502, 0.502, 1];
|
||||
var interp_slot_color = [1.0, 1.0, 1.0, 0.8];
|
||||
var border_color = [1.0, 1.0, 1.0, 0.85];
|
||||
var text_bg_color = [0.5,0.5,0.5, 0.5];
|
||||
var text_color = max.getcolor("theme_textcolor"); //[0.129, 0.129, 0.129, 1];
|
||||
var text_bg_color = set_text_bg_color();
|
||||
var edited_color = [1, 0.49, 0.263, 1];
|
||||
|
||||
var color_1 = [0.743, 0.41, 0.501, 1]; // Color set for the filled slots. I don't like how this is declared. More info in color_wheel() declaration
|
||||
@@ -81,7 +81,9 @@ var color_mode = 0; // Change the way the filled slots (stored presets)
|
||||
var select_mode = 0; // 0: single click to select and recall the slot. 1: single click to select the slot, double click to recall it.
|
||||
var send_name = "none"; // The global name to send presets dict name to (received by the [receive] object)
|
||||
var unique_names = false; // When enabled, force names to be unique when renaming slots by appending "bis" to them. Gets applied only to subsequently renamed presets.
|
||||
var autoname = false; // Automatically name new presets when created as "Preset" followed by the slot id
|
||||
var use_uid = 0; // Generating UID for each presets when enabled. Requires a [pattr preset_metadata]
|
||||
var timestamp = false; // Generates a `created` and `modified` timestamp for each preset. Requires use_uid enabled
|
||||
var recall_passthrough = true; // By default (true), clicking a slot sends a recall message directly to [pattrstorage], and the jsui left outlet outputs a recall message once the recall is done. When disabled, clicking a slot will send a recall message straight from the jsui left outlet, so it's up to the user to forward the message to pattrstorage. It can be usefull for triggering interpolations with custom logic.
|
||||
var ui_rename = false; // Use the attached textedit, if any, to edit slot names directly in the JSUI frame when clicking a slot while holding the control key. When disabled, the textedit remains untouched but gets focused when clicking a slot while holding the control key.
|
||||
var poll_edited = 0; // If >0, check if current preset is edited every X seconds defined by the variable value.
|
||||
@@ -105,8 +107,8 @@ var previous_active_slot = 0; //Previously recalled slot
|
||||
var previous_target = 0; //Here to deal with ongoing interpolations
|
||||
var selected_slot = 0; //Last selected slot. Relevant especially when select_mode = 1. Otherwise it is the same as active_slot
|
||||
|
||||
var mess_with_presets = ['insert', 'lockall', 'read', 'readagain', 'remove', 'renumber']; // Received messages that can mess with presets and thus requiring a resync
|
||||
var to_ignore = ['active', 'alias', 'current', 'dump', 'edited', 'interp', 'priority', 'subscription', 'resolvealias']; // Messages that can come from psto and should be ignored to avoid feedback loops
|
||||
var mess_with_presets = ['insert', 'lockall', 'read', 'readagain', 'remove', 'renumber', 'storenext']; // Received messages that can mess with presets and thus requiring a resync
|
||||
var to_ignore = ['active', 'alias', 'current', 'dump', 'edited', 'interp', 'priority', 'subscription']; // Messages that can come from psto and should be ignored to avoid feedback loops
|
||||
var to_passthrough = ['clear', 'client_close', 'client_window', 'fade', 'fillempty', 'getactive', 'getalias', 'getclientlist', 'getcurrent', 'getedited', 'getinterp', 'getlockedslots', 'getpriority', 'getslotlist', 'getslotnamelist', 'getstoredvalue', 'getsubscriptionlist', 'grab', 'locate', 'purge', 'readagain', 'setall', 'setstoredvalue', 'storage_close', 'storagewindow', 'storeagain', 'subscribe', 'unsubscribe', 'writeagain', 'writejson', 'writexml']; // Messages that can be passed to psto
|
||||
|
||||
var ui_width = box.rect[2] - box.rect[0];
|
||||
@@ -137,6 +139,7 @@ var requested_slot = -1; // Which slot we're waiting a value for (used in get_al
|
||||
var color_mode_candidate = 0; // Which color mode we're aiming
|
||||
var is_listening_to_subscriptionlist = 0; //Filters out received subscriptionlist messages when not updating slot color values
|
||||
var is_listening_to_clientlist = 0; //Filters out received clientlist messages when not updating slot color values
|
||||
var waiting_for_alias = null; // Flag when waiting for a specific alias
|
||||
var metadata_pattr = null;
|
||||
var metadata_pattr_address;
|
||||
var metadata_updated = false; // Flag to write presets file after filling possible empty preset_metadata
|
||||
@@ -152,36 +155,25 @@ var poll_edited_task = new Task(do_poll_edited, this);
|
||||
|
||||
var has_loaded = false;
|
||||
|
||||
if (jsarguments.length>1) { // Depreciated, use "pattrstorage" attribute instead of jsarguments.
|
||||
if (jsarguments.length>1) { // Depreciated, use "pattrstorage" attribute instead of jsarguments, or directly connect tc.preset to pattrstorage after its creation.
|
||||
setpattrstorage(jsarguments[1]);
|
||||
}
|
||||
|
||||
// FUNCTIONS
|
||||
function slot(left, top, right, bottom, name, lock, interp, color_index, color_custom, uid, filled) {
|
||||
this.left = left;
|
||||
this.top = top;
|
||||
this.right = right;
|
||||
this.bottom = bottom;
|
||||
this.name = name;
|
||||
this.lock = lock;
|
||||
this.interp = interp;
|
||||
this.color_index = color_index;
|
||||
this.color_custom = color_custom;
|
||||
this.uid = uid;
|
||||
this.filled = filled;
|
||||
|
||||
this.init = function() {
|
||||
this.left = 0;
|
||||
this.top = 0;
|
||||
this.right = 0;
|
||||
this.bottom = 0;
|
||||
this.name = null;
|
||||
this.lock = 0;
|
||||
this.interp = -1;
|
||||
this.init_color();
|
||||
this.uid = 0;
|
||||
this.filled = false;
|
||||
}
|
||||
function slot(left, top, right, bottom) {
|
||||
this.left = left ? left : 0;
|
||||
this.top = top ? top : 0;
|
||||
this.right = right ? right : 0;
|
||||
this.bottom = bottom ? bottom : 0;
|
||||
this.name = null;
|
||||
this.lock = 0;
|
||||
this.interp = -1;
|
||||
this.color_index = 0;
|
||||
this.color_custom = stored_slot_color;
|
||||
this.uid = 0;
|
||||
this.filled = false;
|
||||
this.created = null;
|
||||
this.modified = null;
|
||||
|
||||
this.init_color = function() {
|
||||
this.color_index = 0;
|
||||
@@ -196,8 +188,33 @@ function slot(left, top, right, bottom, name, lock, interp, color_index, color_c
|
||||
this.color_custom = stored_slot_color;
|
||||
this.uid = 0;
|
||||
this.filled = false;
|
||||
this.created = null;
|
||||
this.modified = null;
|
||||
}
|
||||
|
||||
this.set_geom = function(left, top, right, bottom) {
|
||||
this.left = left;
|
||||
this.top = top;
|
||||
this.right = right;
|
||||
this.bottom = bottom;
|
||||
}
|
||||
|
||||
this.export_metadata = function () {
|
||||
var meta_dict = {};
|
||||
if (color_mode > 1) {
|
||||
var cstm = this.color_custom;
|
||||
var color_val = [this.color_index, cstm[0], cstm[1], cstm[2], cstm[3]];
|
||||
meta_dict['color']= color_val;
|
||||
}
|
||||
if (use_uid) meta_dict['uid'] = this.uid;
|
||||
if (timestamp) {
|
||||
meta_dict['created'] = this.created;
|
||||
meta_dict['modified'] = this.modified;
|
||||
}
|
||||
return JSON.stringify(meta_dict);
|
||||
}
|
||||
}
|
||||
slot.local = 1;
|
||||
|
||||
function loadbang() {
|
||||
// post("loadbang\n");
|
||||
@@ -208,7 +225,6 @@ function loadbang() {
|
||||
psto_auto_link_task.repeat();
|
||||
}
|
||||
calc_rows_columns();
|
||||
|
||||
find_textedit();
|
||||
}
|
||||
|
||||
@@ -241,13 +257,16 @@ function psto_auto_link() {
|
||||
}
|
||||
}
|
||||
|
||||
function calc_rows_columns() {
|
||||
function calc_rows_columns(src) {
|
||||
half_margin = margin / 2;
|
||||
half_spacing = spacing / 2;
|
||||
half_slot_size = slot_size / 2;
|
||||
half_slot_size = slot_size / 2;
|
||||
|
||||
var previous_rows = rows;
|
||||
var previous_columns = columns;
|
||||
|
||||
slots[0] = new slot(0, 0, 0, 0, "(tmp)", 0, -1, 0, stored_slot_color); // Slot 0 is valid, but not represented in the GUI (and never saved by pattrstorage)
|
||||
|
||||
|
||||
var minus_slots_carry = 0;
|
||||
if (layout == 0) {
|
||||
columns = Math.floor((ui_width - margin + spacing) / (slot_size + spacing));
|
||||
@@ -273,9 +292,10 @@ function calc_rows_columns() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (scrollable && nbslot_edit) {
|
||||
|
||||
}
|
||||
|
||||
// Preventing useless redraws when resizing
|
||||
if (src === "resize" && previous_rows === rows && previous_columns === columns) return false;
|
||||
|
||||
true_slots_count_display = columns * rows - minus_slots_carry;
|
||||
slots_count_display = scrollable && nbslot_edit ? true_slots_count_display - 2 : true_slots_count_display;
|
||||
|
||||
@@ -287,22 +307,24 @@ function calc_rows_columns() {
|
||||
var right = left + slot_size;
|
||||
var cur = 1 + i * columns + j;
|
||||
|
||||
var prev_state = new slot();
|
||||
prev_state.init();
|
||||
if (typeof slots[cur] !== 'undefined') {
|
||||
prev_state = slots[cur];
|
||||
if (slots[cur]) {
|
||||
// Filled slot, we only update geometry
|
||||
slots[cur].set_geom(left, top, right, bottom);
|
||||
} else {
|
||||
// Empty slot, possibly not initialized (if above slots_highest)
|
||||
slots[cur] = new slot(left, top, right, bottom);
|
||||
}
|
||||
slots[cur] = new slot(left, top, right, bottom, prev_state.name, prev_state.lock, prev_state.interp, prev_state.color_index, prev_state.color_custom, prev_state.uid, prev_state.filled);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (slots_count_display < slots_highest) {
|
||||
for (var i = slots_count_display + 1; i <= slots_highest; i++) {
|
||||
slots[i] = new slot();
|
||||
slots[i].init();
|
||||
}
|
||||
}
|
||||
paint_base();
|
||||
paint_base();
|
||||
return true
|
||||
}
|
||||
calc_rows_columns.local = 1;
|
||||
|
||||
@@ -311,24 +333,24 @@ function draw_slot(id, scale, cont) {
|
||||
cont = typeof cont !== 'undefined' ? cont : mgraphics; // Sets drawing context to mgraphics by default if not passed as argument
|
||||
|
||||
var offset = slot_size * (1 - scale);
|
||||
|
||||
var slot = slots[id];
|
||||
|
||||
if(is_painting_base) {
|
||||
draw_slot_bubble(slots[id].left * scale, slots[id].top *scale, slot_size * scale, slot_size * scale, cont);
|
||||
draw_slot_bubble(slot.left * scale, slot.top *scale, slot_size * scale, slot_size * scale, cont);
|
||||
|
||||
} else {
|
||||
draw_slot_bubble(slots[id].left + offset, slots[id].top + offset, slot_size * scale, slot_size * scale, cont);
|
||||
draw_slot_bubble(slot.left + offset, slot.top + offset, slot_size * scale, slot_size * scale, cont);
|
||||
}
|
||||
cont.fill();
|
||||
|
||||
if (layout == 1) {
|
||||
// slot text background
|
||||
var bg_txt_pos_x = margin + slot_size + spacing;
|
||||
var bg_txt_pos_y = slots[id].top;
|
||||
var bg_txt_pos_y = slot.top;
|
||||
var bg_txt_dim_w = ui_width - (2*margin + slot_size + spacing);
|
||||
var bg_txt_dim_h = slot_size;
|
||||
|
||||
if (slots[id].filled) {
|
||||
if (slot.filled) {
|
||||
cont.set_source_rgba(stored_slot_color);
|
||||
} else {
|
||||
cont.set_source_rgba(empty_slot_color);
|
||||
@@ -359,12 +381,12 @@ function draw_slot(id, scale, cont) {
|
||||
cont.set_line_width(Math.floor(slot_size * 0.3));
|
||||
if (id > true_slots_count_display - 2) {
|
||||
cont.set_source_rgba(stored_slot_color);
|
||||
cont.move_to((slots[id].left + slot_size * 0.1) * scale, (slots[id].top + half_slot_size) * scale);
|
||||
cont.move_to((slot.left + slot_size * 0.1) * scale, (slot.top + half_slot_size) * scale);
|
||||
cont.rel_line_to(slot_size * 0.8 * scale, 0);
|
||||
cont.stroke();
|
||||
}
|
||||
if (id > true_slots_count_display - 1) {
|
||||
cont.move_to((slots[id].left + half_slot_size) * scale, (slots[id].top + slot_size * 0.1) * scale);
|
||||
cont.move_to((slot.left + half_slot_size) * scale, (slot.top + slot_size * 0.1) * scale);
|
||||
cont.rel_line_to(0, slot_size * 0.8 * scale);
|
||||
cont.stroke();
|
||||
}
|
||||
@@ -403,13 +425,14 @@ draw_text_bubble.local = 1;
|
||||
|
||||
function format_slot_name(id) {
|
||||
var text = id;
|
||||
var slot = slots[id];
|
||||
// If slot is locked, add brackets around its number
|
||||
if (slots[id].lock == 1) {
|
||||
if (slot.lock == 1) {
|
||||
text = '[' + text + ']';
|
||||
}
|
||||
// If slot has a name, append it to the preset name
|
||||
if ([null, '<(unnamed)>'].indexOf(slots[id].name) < 0 ) {
|
||||
text += ': ' + slots[id].name;
|
||||
if ([null, '<(unnamed)>'].indexOf(slot.name) < 0 ) {
|
||||
text += ': ' + slot.name;
|
||||
}
|
||||
text = text.toString();
|
||||
return text;
|
||||
@@ -423,7 +446,7 @@ function paint_base() {
|
||||
// Background
|
||||
bg_width = layout == 0 ? columns * (slot_size + spacing) - spacing + 2 * margin : ui_width;
|
||||
bg_height = rows * (slot_size + spacing) - spacing + 2 * margin;
|
||||
mg = new MGraphics(ui_width*2, bg_height*2);
|
||||
mg = new MGraphics(bg_width*2, bg_height*2);
|
||||
mg.set_source_rgba(background_color);
|
||||
mg.rectangle(0, 0, bg_width*2, bg_height*2);
|
||||
mg.fill();
|
||||
@@ -434,13 +457,14 @@ function paint_base() {
|
||||
// All slots
|
||||
for (var i = 1; i <= true_slots_count_display; i++) {
|
||||
if (i != drag_slot) { //We mask the slot that is currently dragged as it is drawn at the mouse position already
|
||||
if (slots[i].filled == true) {
|
||||
var slot = slots[i];
|
||||
if (slot.filled == true) {
|
||||
if (color_mode == 1) {
|
||||
mg.set_source_rgba(color_wheel_custom[i % color_wheel_size]);
|
||||
} else if (color_mode == 2) {
|
||||
mg.set_source_rgba(color_wheel_custom[Math.abs(slots[i].color_index) % color_wheel_size]);
|
||||
mg.set_source_rgba(color_wheel_custom[Math.abs(slot.color_index) % color_wheel_size]);
|
||||
} else if (color_mode == 3) {
|
||||
mg.set_source_rgba(slots[i].color_custom);
|
||||
mg.set_source_rgba(slot.color_custom);
|
||||
} else {
|
||||
mg.set_source_rgba(stored_slot_color);
|
||||
}
|
||||
@@ -523,12 +547,13 @@ function paint()
|
||||
if (is_dragging == 0 && display_interp && is_interpolating) {
|
||||
|
||||
for (var i = 1; i <= slots_count_display; i++) {
|
||||
var interp = slots[i].interp;
|
||||
var slot = slots[i];
|
||||
var interp = slot.interp;
|
||||
if (interp >= 0) {
|
||||
mgraphics.set_source_rgba(interp_slot_color);
|
||||
draw_slot_bubble(slots[i].left, slots[i].top, slot_size, slot_size);
|
||||
draw_slot_bubble(slot.left, slot.top, slot_size, slot_size);
|
||||
mgraphics.stroke();
|
||||
draw_slot_bubble(slots[i].left, slots[i].top + slot_size * (1-interp), slot_size, slot_size * interp);
|
||||
draw_slot_bubble(slot.left, slot.top + slot_size * (1-interp), slot_size, slot_size * interp);
|
||||
mgraphics.fill();
|
||||
}
|
||||
}
|
||||
@@ -553,19 +578,21 @@ function paint()
|
||||
|
||||
// Slot border
|
||||
if (slots[last_hovered].filled == false || (slots[last_hovered].filled == true && !control_hold)) {
|
||||
mgraphics.set_source_rgba(border_color[0], border_color[1], border_color[2], 0.8 * border_color[3]);
|
||||
mgraphics.set_source_rgba(text_color[0], text_color[1], text_color[2], 0.8 * text_color[3]);
|
||||
mgraphics.set_line_width(1);
|
||||
draw_slot_bubble(slots[last_hovered].left, slots[last_hovered].top, slot_size, slot_size);
|
||||
mgraphics.stroke();
|
||||
}
|
||||
|
||||
if (last_hovered_is_preset_slot) {
|
||||
var stroke_width = Math.round(1 + slot_size / 10);
|
||||
stroke_width = Math.max(2, stroke_width);
|
||||
if (shift_hold) {
|
||||
if (control_hold && slots[last_hovered].filled == true) {
|
||||
// About to lock/unlock
|
||||
var bracket_size = slot_size * 0.2;
|
||||
mgraphics.set_source_rgba(border_color);
|
||||
mgraphics.set_line_width(2);
|
||||
mgraphics.set_source_rgba(text_color);
|
||||
mgraphics.set_line_width(stroke_width);
|
||||
mgraphics.move_to(slots[last_hovered].left + bracket_size, slots[last_hovered].top);
|
||||
mgraphics.rel_line_to(-bracket_size, 0);
|
||||
mgraphics.rel_line_to(0, slot_size);
|
||||
@@ -577,7 +604,7 @@ function paint()
|
||||
mgraphics.stroke();
|
||||
} else if (option_hold && !control_hold && slots[last_hovered].filled == true) {
|
||||
// About to delete
|
||||
mgraphics.set_source_rgba(empty_slot_color[0], empty_slot_color[1], empty_slot_color[2], 0.6);
|
||||
mgraphics.set_source_rgba(0, 0, 0, 0.5);
|
||||
draw_slot_bubble(slots[last_hovered].left + 1, slots[last_hovered].top + 1, slot_size-2, slot_size-2);
|
||||
mgraphics.fill();
|
||||
} else if (!control_hold && !option_hold){
|
||||
@@ -586,10 +613,10 @@ function paint()
|
||||
draw_slot_bubble(slots[last_hovered].left + 1, slots[last_hovered].top + 1, slot_size-2, slot_size-2);
|
||||
mgraphics.fill();
|
||||
}
|
||||
} else if (control_hold) {
|
||||
} else if (control_hold && slots[last_hovered].filled == true) {
|
||||
// About to rename
|
||||
mgraphics.set_source_rgba(border_color);
|
||||
mgraphics.set_line_width(2);
|
||||
mgraphics.set_source_rgba(text_color);
|
||||
mgraphics.set_line_width(stroke_width);
|
||||
mgraphics.move_to(slots[last_hovered].left - 1, slots[last_hovered].top);
|
||||
mgraphics.rel_line_to(slot_size + 2, 0);
|
||||
mgraphics.move_to(slots[last_hovered].left - 1, slots[last_hovered].bottom);
|
||||
@@ -792,22 +819,27 @@ function connect_to_metadata_pattr() {
|
||||
return false;
|
||||
} else {
|
||||
metadata_pattr = obj;
|
||||
get_metadata_pattr_address();
|
||||
resolve_metadata_pattr_alias();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
connect_to_metadata_pattr.local = 1;
|
||||
|
||||
function resolve_metadata_pattr_alias() {
|
||||
waiting_for_alias = 'preset_metadata';
|
||||
to_pattrstorage('resolvealias', 'preset_metadata');
|
||||
// See function resolvealias for next step
|
||||
}
|
||||
resolve_metadata_pattr_alias.local = 1;
|
||||
|
||||
function get_metadata_pattr_address() {
|
||||
is_listening_to_clientlist = is_listening_to_clientlist == 2 ? 2 : 1; // 2 if setting color mode, 1 otherwise
|
||||
is_listening_to_clientlist = is_listening_to_clientlist > 1 ? is_listening_to_clientlist : 1; // 3 if setting timestamp, 2 if setting color mode, 1 otherwise
|
||||
to_pattrstorage("getclientlist");
|
||||
}
|
||||
get_metadata_pattr_address.local = 1;
|
||||
|
||||
function update_preset_metadata_pattr(s) {
|
||||
var cstm = slots[s].color_custom;
|
||||
var color_val = [slots[s].color_index, cstm[0], cstm[1], cstm[2], cstm[3]];
|
||||
to_pattrstorage("setstoredvalue", "preset_metadata", s, JSON.stringify({color: color_val, uid: slots[s].uid}));
|
||||
to_pattrstorage("setstoredvalue", "preset_metadata", s, slots[s].export_metadata());
|
||||
}
|
||||
update_preset_metadata_pattr.local = 1;
|
||||
|
||||
@@ -850,6 +882,7 @@ function get_preset_metadata(s) {
|
||||
get_preset_metadata.local = 1;
|
||||
|
||||
function preset_metadata(v) {
|
||||
// Parsing received data from preset_metadata pattr
|
||||
var meta_dict = {};
|
||||
if (requested_slot > -1 && v) {
|
||||
meta_dict = JSON.parse(v);
|
||||
@@ -868,9 +901,13 @@ function preset_metadata(v) {
|
||||
slots[requested_slot].color_custom = stored_slot_color;
|
||||
}
|
||||
}
|
||||
if (use_uid && meta_dict.hasOwnProperty('uid') && meta_dict.uid) {
|
||||
if (meta_dict.hasOwnProperty('uid') && meta_dict.uid) {
|
||||
slots[requested_slot].uid = meta_dict.uid;
|
||||
}
|
||||
if (meta_dict.hasOwnProperty('created')) {
|
||||
slots[requested_slot].created = meta_dict.created;
|
||||
slots[requested_slot].modified = meta_dict.modified;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -890,6 +927,7 @@ function anything() {
|
||||
slots[v].filled = 0;
|
||||
if (active_slot == v) {
|
||||
active_slot = 0;
|
||||
selected_slot = 0;
|
||||
}
|
||||
if (previous_active_slot == v) {
|
||||
previous_active_slot = 0;
|
||||
@@ -898,8 +936,8 @@ function anything() {
|
||||
if (is_dragging == 0 && is_moving == 0) {
|
||||
to_pattrstorage("delete", v);
|
||||
to_pattrstorage("getslotlist");
|
||||
paint_base();
|
||||
set_active_slot(active_slot);
|
||||
paint_base();
|
||||
if (!is_dragging) {
|
||||
outlet(0, "delete", v);
|
||||
if (selected_slot == v) {
|
||||
@@ -961,11 +999,9 @@ function slotlist() {
|
||||
if (slots_count_display < slots_highest) {
|
||||
for (var i = slots_count_display + 1; i <= slots_highest; i++) {
|
||||
slots[i] = new slot();
|
||||
slots[i].init();
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < filled_slots.length; i++) {
|
||||
// to_pattrstorage("getslotname", filled_slots[i]);
|
||||
slots[filled_slots[i]].filled = true;
|
||||
}
|
||||
is_updating_names = 1;
|
||||
@@ -984,7 +1020,7 @@ function slotname() {
|
||||
return;
|
||||
}
|
||||
if (slot > 0 && name != "(undefined)") {
|
||||
if (is_updating_names == 1 && slots[slot].filled == false) {
|
||||
if (is_updating_names == 1 && slots[slot].filled == false && name !== "<(unnamed)>") {
|
||||
// Removing parenthesis automatically added by pattrstorage if the preset has a name but isn't filled
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
@@ -1015,6 +1051,7 @@ function setslotname() {
|
||||
}
|
||||
|
||||
function format_slotname(name) {
|
||||
if (name === "<(unnamed)>") return name;
|
||||
return unique_names ? make_slotname_unique(name) : name;
|
||||
}
|
||||
format_slotname.local = 1;
|
||||
@@ -1023,7 +1060,7 @@ function make_slotname_unique(name) {
|
||||
// Leftover from before using an uid. Found the bis bis bis presets funny (rather than bunch of (undefined) so I left this here
|
||||
var current_name = name;
|
||||
for (var i = 0; i < filled_slots.length; i++) {
|
||||
if (slots[filled_slots[i]].name == current_name && filled_slots[i] != selected_slot) {
|
||||
if (slots[filled_slots[i]].name === current_name && filled_slots[i] !== selected_slot) {
|
||||
return make_slotname_unique(name + ' bis');
|
||||
}
|
||||
}
|
||||
@@ -1149,54 +1186,67 @@ function recallmulti() {
|
||||
|
||||
function store(v) {
|
||||
v = Math.floor(v);
|
||||
if (v >= 0) {
|
||||
if (slots[v] && slots[v].lock > 0) {
|
||||
error('cannot overwrite locked slot ' + v + '\n');
|
||||
} else {
|
||||
var recalc_rows_flag = scrollable && v > slots_highest;
|
||||
if (v < 0) return;
|
||||
if (slots[v] && slots[v].lock > 0) {
|
||||
error('cannot overwrite locked slot ' + v + '\n');
|
||||
} else {
|
||||
var recalc_rows_flag = scrollable && v > slots_highest;
|
||||
|
||||
if (metadata_pattr) {
|
||||
if (filled_slots.indexOf(v) == -1) {
|
||||
// If storing preset in empty slot
|
||||
// Generating name and uid
|
||||
if (use_uid) {
|
||||
slots[v].uid = generateUID();
|
||||
}
|
||||
slots[v].init_color();
|
||||
|
||||
var preset_name = format_slotname('Preset ' + v);
|
||||
slotname(v, preset_name);
|
||||
to_pattrstorage("slotname", v, preset_name);
|
||||
selected_slot = v; // We set selected_slot without calling set_active_slot because the preset might not still exist, but its id is required by make_slotname_unique()
|
||||
|
||||
var was_slot_empty = filled_slots.indexOf(v) == -1;
|
||||
if (autoname && was_slot_empty && slots[v].name === null) {
|
||||
// If storing preset in empty slot
|
||||
// Generating name
|
||||
var preset_name = format_slotname('Preset ' + v);
|
||||
slotname(v, preset_name);
|
||||
to_pattrstorage("slotname", v, preset_name);
|
||||
}
|
||||
|
||||
if (metadata_pattr) {
|
||||
if (was_slot_empty) {
|
||||
// If storing preset in empty slot
|
||||
// Generating uid
|
||||
if (use_uid) {
|
||||
slots[v].uid = generateUID();
|
||||
}
|
||||
slots[v].init_color();
|
||||
if (timestamp) {
|
||||
var date = new Date().toISOString();
|
||||
slots[v].created = date;
|
||||
slots[v].modified = date;
|
||||
}
|
||||
|
||||
// Updating metadata in pattr object before storing in pattrstorage
|
||||
var cstm = slots[v].color_custom;
|
||||
var color_val = [slots[v].color_index, cstm[0], cstm[1], cstm[2], cstm[3]];
|
||||
var meta_dict = {color: color_val, uid: slots[v].uid};
|
||||
metadata_pattr.message(JSON.stringify(meta_dict));
|
||||
}
|
||||
|
||||
to_pattrstorage("store", v);
|
||||
to_pattrstorage("getslotlist");
|
||||
|
||||
active_slot_edited = 0;
|
||||
run_edited_poll_task();
|
||||
|
||||
if (recalc_rows_flag) {
|
||||
calc_rows_columns();
|
||||
} else {
|
||||
paint_base();
|
||||
}
|
||||
|
||||
if (!(ignore_slot_zero && v == 0)) {
|
||||
set_active_slot(v);
|
||||
}
|
||||
|
||||
outlet(0, "store", v);
|
||||
if (v) {
|
||||
// We writagain only if stored preset is > 0
|
||||
trigger_writeagain();
|
||||
if (timestamp) {
|
||||
var date = new Date().toISOString();
|
||||
slots[v].modified = date;
|
||||
}
|
||||
}
|
||||
|
||||
// Updating metadata in pattr object before storing in pattrstorage
|
||||
metadata_pattr.message(slots[v].export_metadata());
|
||||
}
|
||||
|
||||
to_pattrstorage("store", v);
|
||||
to_pattrstorage("getslotlist");
|
||||
|
||||
active_slot_edited = 0;
|
||||
run_edited_poll_task();
|
||||
|
||||
if (recalc_rows_flag) {
|
||||
calc_rows_columns();
|
||||
} else {
|
||||
paint_base();
|
||||
}
|
||||
|
||||
if (!(ignore_slot_zero && v === 0)) {
|
||||
set_active_slot(v);
|
||||
}
|
||||
|
||||
outlet(0, "store", v);
|
||||
if (v) {
|
||||
// We writagain only if stored preset is > 0
|
||||
trigger_writeagain();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1354,6 +1404,21 @@ function readfile(f, s) {
|
||||
read(f, s);
|
||||
}
|
||||
|
||||
function resolvealias(alias, client) {
|
||||
if (alias === waiting_for_alias) {
|
||||
if (waiting_for_alias === 'preset_metadata') {
|
||||
if (client) {
|
||||
// All good, alias already set
|
||||
is_listening_to_clientlist = 0;
|
||||
return
|
||||
} else {
|
||||
// No alias defined yet, we need to query the entire clientlist to get the correct address
|
||||
get_metadata_pattr_address();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clientlist() {
|
||||
var client = arrayfromargs(arguments)[0];
|
||||
if (is_listening_to_clientlist > 0) {
|
||||
@@ -1438,7 +1503,7 @@ function select(v) {
|
||||
}
|
||||
|
||||
function slots_clear() {
|
||||
slots[0].init();
|
||||
slots[0].clear();
|
||||
slots[0].name = "(tmp)";
|
||||
for (var i = 1; i < slots.length; i++) {
|
||||
slots[i].clear();
|
||||
@@ -1448,13 +1513,14 @@ slots_clear.local = 1;
|
||||
|
||||
function get_slot_index(x, y) {
|
||||
// Returns which slot is hovered by the mouse
|
||||
for (var i = 1; i <= true_slots_count_display; i++) {
|
||||
for (var i = 1; i <= true_slots_count_display; i++) {
|
||||
var slot = slots[i];
|
||||
if (layout === 0) {
|
||||
if (y > (slots[i].top - half_spacing) && y < (slots[i].bottom + half_spacing) && x > (slots[i].left - half_spacing) && x < (slots[i].right + half_spacing)) {
|
||||
if (y > (slot.top - half_spacing) && y < (slot.bottom + half_spacing) && x > (slot.left - half_spacing) && x < (slot.right + half_spacing)) {
|
||||
return i;
|
||||
}
|
||||
} else if (layout === 1) {
|
||||
if (y > (slots[i].top - half_spacing) && y < (slots[i].bottom + half_spacing)) {
|
||||
if (y > (slot.top - half_spacing) && y < (slot.bottom + half_spacing)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -1509,18 +1575,25 @@ function update_filled_slots_dict() {
|
||||
var by_uid = {};
|
||||
for (var i = 0; i < filled_slots.length; i++) {
|
||||
var slot_index = filled_slots[i];
|
||||
var slot = slots[slot_index];
|
||||
var tmp_dict = {
|
||||
index: slot_index, // Preset slot number (unique, non-persistent)
|
||||
name: slots[slot_index].name, // Preset name (non unique, non-persistent)
|
||||
uid: slots[slot_index].uid, // Preset uid (unique and persistent across preset renaming, overwriting and moving) Useful for keeping track of preset across changes
|
||||
u_name: slot_index + ' | ' + slots[slot_index].name, // '3 | Third preset': (unique, non-persistent) Useful for easy preset listing and retrieving
|
||||
lock: slots[slot_index].lock, // Preset lock state
|
||||
color_index: slots[slot_index].color_index, // Preset color index (when color_mode = 2)
|
||||
color_custom: slots[slot_index].color_custom, // Preset color (when color_mode = 3)
|
||||
name: slot.name, // Preset name (non unique, non-persistent)
|
||||
u_name: slot_index + ' | ' + slot.name, // '3 | Third preset': (unique, non-persistent) Useful for easy preset listing and retrieving
|
||||
lock: slot.lock, // Preset lock state
|
||||
};
|
||||
// post('updating by_uid', slots[slot_index].uid, '\n');
|
||||
if (color_mode > 1) {
|
||||
tmp_dict['color_index'] = slot.color_index; // Preset color index (when color_mode = 2)
|
||||
tmp_dict['color_custom'] = slot.color_custom; // Preset color (when color_mode = 3)
|
||||
}
|
||||
if (use_uid) tmp_dict['uid'] = slot.uid; // Preset uid (unique and persistent across preset renaming, overwriting and moving) Useful for keeping track of preset across changes
|
||||
// post('updating by_uid', slot.uid, '\n');
|
||||
if (timestamp) {
|
||||
tmp_dict['created'] = slot.created;
|
||||
tmp_dict['modified'] = slot.modified;
|
||||
}
|
||||
by_slot[slot_index] = tmp_dict;
|
||||
if (use_uid) by_uid[slots[slot_index].uid] = tmp_dict;
|
||||
if (use_uid) by_uid[slot.uid] = tmp_dict;
|
||||
}
|
||||
filled_slots_dict.setparse('by_slot', JSON.stringify(by_slot));
|
||||
if (use_uid) filled_slots_dict.setparse('by_uid', JSON.stringify(by_uid));
|
||||
@@ -1528,7 +1601,6 @@ function update_filled_slots_dict() {
|
||||
var tmp_send_name = send_name == "none" ? pattrstorage_name + '_presets_dict' : send_name;
|
||||
outlet(4, 'dictionary', filled_slots_dict.name);
|
||||
messnamed(tmp_send_name, 'dictionary', filled_slots_dict.name);
|
||||
|
||||
}
|
||||
update_filled_slots_dict.local = 1;
|
||||
|
||||
@@ -1608,6 +1680,7 @@ function set_textedit(s) {
|
||||
}
|
||||
textedit_obj.setattr('presentation', this.patcher.getattr("presentation"));
|
||||
textedit_obj.setattr('hidden', 0);
|
||||
this.patcher.bringtofront(textedit_obj);
|
||||
}
|
||||
textedit_obj.message("select");
|
||||
is_typing_name = s;
|
||||
@@ -1716,15 +1789,17 @@ function onclick(x,y,but,cmd,shift,capslock,option,ctrl)
|
||||
if (select_mode) {
|
||||
output = "select";
|
||||
}
|
||||
if (shift) {
|
||||
output = "store";
|
||||
if (option) {
|
||||
if (shift) {
|
||||
if (!option && !ctrl) {
|
||||
output = "store";
|
||||
}
|
||||
if (option && slots[last_hovered].filled) {
|
||||
output = "delete";
|
||||
}
|
||||
if (ctrl) {
|
||||
if (ctrl && slots[last_hovered].filled) {
|
||||
output = "lock";
|
||||
}
|
||||
} else if (ctrl) {
|
||||
} else if (ctrl && slots[last_hovered].filled) {
|
||||
output = "rename";
|
||||
} else if (slots[last_hovered].filled == false) {
|
||||
return;
|
||||
@@ -1847,9 +1922,11 @@ function onresize(w,h)
|
||||
{
|
||||
ui_width = w;
|
||||
ui_height = h;
|
||||
calc_rows_columns();
|
||||
to_pattrstorage("getslotlist");
|
||||
paint_base();
|
||||
var changed = calc_rows_columns("resize");
|
||||
if (changed) {
|
||||
to_pattrstorage("getslotlist");
|
||||
paint_base();
|
||||
}
|
||||
}
|
||||
onresize.local = 1;
|
||||
|
||||
@@ -2054,24 +2131,6 @@ function setinterpslotcolor(){
|
||||
}
|
||||
setinterpslotcolor.local = 1;
|
||||
|
||||
declareattribute("text_bg_color", "gettextbgcolor", "settextbgcolor", 1, {style: "rgba", label: "Text Background Color", category: "Appearance"});
|
||||
function gettextbgcolor() {
|
||||
return text_bg_color;
|
||||
}
|
||||
gettextbgcolor.local = 1;
|
||||
|
||||
function settextbgcolor(){
|
||||
if (arguments.length == 4) {
|
||||
text_bg_color = [arguments[0], arguments[1], arguments[2], arguments[3]];
|
||||
} else if (arguments.length == 0) {
|
||||
text_bg_color = [1,1,1, 0.5];
|
||||
} else {
|
||||
error('text_bg_color: wrong number of arguments\n');
|
||||
}
|
||||
mgraphics.redraw();
|
||||
}
|
||||
settextbgcolor.local = 1;
|
||||
|
||||
declareattribute("text_color", "gettextcolor", "settextcolor", 1, {style: "rgba", label: "Text Color", category: "Appearance"});
|
||||
function gettextcolor() {
|
||||
return text_color;
|
||||
@@ -2085,10 +2144,21 @@ function settextcolor(){
|
||||
} else {
|
||||
error('text_color: wrong number of arguments\n');
|
||||
}
|
||||
set_text_bg_color();
|
||||
mgraphics.redraw();
|
||||
}
|
||||
settextcolor.local = 1;
|
||||
|
||||
function set_text_bg_color() {
|
||||
text_bg_color = is_dark_color(text_color) ? [1, 1, 1, 0.5] : [0, 0, 0, 0.5];
|
||||
}
|
||||
set_text_bg_color.local = 1;
|
||||
|
||||
function is_dark_color(color) {
|
||||
return (0.299 * color[0] + 0.587 * color[1] + 0.114 * color[2]) < 0.5;
|
||||
}
|
||||
is_dark_color.local = 1;
|
||||
|
||||
declareattribute("fontsize", "getfontsize", "setfontsize", 1, {type: "float", label: "Font Size", category: "Appearance"});
|
||||
function getfontsize() {
|
||||
return font_size;
|
||||
@@ -2278,7 +2348,7 @@ function setcolor_mode(v){
|
||||
color_mode = v;
|
||||
paint_base();
|
||||
} else {
|
||||
error("Connection with [pattr preset_metadata lost\n");
|
||||
error("Connection with [pattr preset_metadata] lost\n");
|
||||
metadata_pattr = null;
|
||||
}
|
||||
} else {
|
||||
@@ -2416,6 +2486,8 @@ function setunique_names(v){
|
||||
}
|
||||
setunique_names.local = 1;
|
||||
|
||||
declareattribute("autoname", null, null, 1, { style: "onoff", label: "Autoname new presets" });
|
||||
|
||||
declareattribute("use_uid", "getuse_uid", "setuse_uid", 1, {style: "onoff", label: "Use UID"});
|
||||
function getuse_uid() {
|
||||
return use_uid;
|
||||
@@ -2433,6 +2505,23 @@ function setuse_uid(v){
|
||||
}
|
||||
setuse_uid.local = 1;
|
||||
|
||||
declareattribute("timestamp", null, "settimestamp", 1, {style: "onoff", label: "Generate timestamp metadata"});
|
||||
function settimestamp(v){
|
||||
var new_val = v === 1;
|
||||
if (new_val) {
|
||||
if (metadata_pattr == null) {
|
||||
is_listening_to_clientlist = 3;
|
||||
connect_to_metadata_pattr();
|
||||
} else if (!metadata_pattr.valid) {
|
||||
error("Connection with [pattr preset_metadata] lost\n");
|
||||
metadata_pattr = null;
|
||||
new_val = 0;
|
||||
}
|
||||
}
|
||||
timestamp = new_val;
|
||||
}
|
||||
settimestamp.local = 1;
|
||||
|
||||
declareattribute("recall_passthrough", "getrecall_passthrough", "setrecall_passthrough", 1, {style: "onoff", label: "Recall Passthrough"});
|
||||
function getrecall_passthrough() {
|
||||
return recall_passthrough;
|
||||
@@ -2539,19 +2628,9 @@ function post_keys(obj) {
|
||||
post('\n');
|
||||
}
|
||||
|
||||
// Generating (fast but not compliant but more than enough for us) UID without crypto.randomUUID()
|
||||
// https://stackoverflow.com/a/21963136
|
||||
var lut = new Array(256);
|
||||
for (var i=0; i<256; i++) { lut[i] = (i<16?'0':'')+(i).toString(16); }
|
||||
// Generating a hash/UID
|
||||
function generateUID()
|
||||
{
|
||||
var d0 = Math.random()*0xffffffff>>>0;
|
||||
var d1 = Math.random()*0xffffffff>>>0;
|
||||
var d2 = Math.random()*0xffffffff>>>0;
|
||||
var d3 = Math.random()*0xffffffff>>>0;
|
||||
return lut[d0&0xff]+lut[d0>>8&0xff]+lut[d0>>16&0xff]+lut[d0>>24&0xff]+'-'+
|
||||
lut[d1&0xff]+lut[d1>>8&0xff]+'-'+lut[d1>>16&0x0f|0x40]+lut[d1>>24&0xff]+'-'+
|
||||
lut[d2&0x3f|0x80]+lut[d2>>8&0xff]+'-'+lut[d2>>16&0xff]+lut[d2>>24&0xff]+
|
||||
lut[d3&0xff]+lut[d3>>8&0xff]+lut[d3>>16&0xff]+lut[d3>>24&0xff];
|
||||
return Date.now().toString(36) + Math.random().toString(36).slice(2, 7);
|
||||
}
|
||||
generateUID.local = 1;
|
||||
generateUID.local = 1;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name" : "tc.preset",
|
||||
"displayname" : "",
|
||||
"version" : "1.2.0",
|
||||
"version" : "1.3.0",
|
||||
"author" : "Théophile Clet",
|
||||
"authors" : [ ],
|
||||
"description" : "A jsui replacement for the preset object",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name" : "tc.preset",
|
||||
"displayname" : "",
|
||||
"version" : "1.2.0",
|
||||
"version" : "1.3.0",
|
||||
"author" : "Théophile Clet",
|
||||
"authors" : [ ],
|
||||
"description" : "A v8ui replacement for the preset object",
|
||||
|
||||
Reference in New Issue
Block a user