Skip to content

Commit

Permalink
Merge pull request #42 from Ableton/mkp-show-bpatcher-embed
Browse files Browse the repository at this point in the history
maxdiff: in the parameter overview, show when a parameter is in an embedded bpatcher
  • Loading branch information
MattijsKneppers authored Jul 12, 2024
2 parents 69ceaf0 + 96a3741 commit 3a2659c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
5 changes: 4 additions & 1 deletion maxdiff/patch_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ def get_object_names_from_ids_recursive(
for box in boxes:
if "id" in box:
if id_to_check == box["id"]:
name = f"[{get_box_text(box)}]"
name = get_box_text(box)
if "embed" in box and box["embed"] == 1:
name += " <embedded>"
name = f"[{name}]"

if isinstance(id_hierarchy, list) and len(id_hierarchy) > 1:
id_hierarchy.pop(0)
Expand Down
21 changes: 14 additions & 7 deletions maxdiff/tests/test_baselines/Test.amxd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ parameters:
[AbstractionWithParameter]/[obj-1]: ['MyParameter[1]', 'MyParameter', 0] > override > ['MyParameter[1]', '-', '-']
[bpatcher ParamAbstraction.maxpat]/[obj-1]: ['OverruledParamLongName', 'OverruledParamShortName', 0] > override > ['OverruledParamLongName', 'OverruledParamShortName', '-']
[live.tab]: ['Time Mode', 'Time Mode', 0]
[bpatcher ThisWasAnAbstractionBeforeEmbeddingIt.maxpat <embedded>]/[live.numbox]: ['EmbeddedParam', 'Embedded', 0]
[live.dial]: ['live.dial', 'live.dial', 0]
[live.dial]: ['live.dial[1]', 'live.dial', 0]
inherited_shortname: 1
Expand All @@ -28,8 +29,14 @@ project:
collContent.txt

----------- patcher -----------
rect: [65, 399, 927, 289] | openrect: [0, 0, 0, 169] | default_fontsize: 10.0 | default_fontname: Arial Bold | gridsize: [8, 8] | boxanimatetime: 500 | latency: 0 | is_mpe: 0 | platform_compatibility: 0 | autosave: 0
appversion: 8.6.2-x64-1 | rect: [65, 399, 927, 289] | openrect: [0, 0, 0, 169] | default_fontsize: 10.0 | default_fontname: Arial Bold | gridsize: [8, 8] | boxanimatetime: 500 | latency: 0 | is_mpe: 0 | platform_compatibility: 0 | autosave: 0
----------- objects -----------
[bpatcher ThisWasAnAbstractionBeforeEmbeddingIt.maxpat] embed: 1
----------- patcher -----------
appversion: 8.6.2-x64-1 | rect: [927, 431, 640, 480]
----------- objects -----------
[live.comment Embedded]
[live.numbox] parameter: <longname: EmbeddedParam | modmode: 3 | shortname: Embedded | type: 0 | unitstyle: 0>
[message 😋] fontsize: 20.0
[AbstractionWithParameter]
[AbstractionWithParameter]
Expand All @@ -40,7 +47,7 @@ rect: [65, 399, 927, 289] | openrect: [0, 0, 0, 169] | default_fontsize: 10.0 |
[button]
[gen @t exponent]
----------- patcher -----------
classnamespace: dsp.gen | rect: [84, 144, 653, 641]
appversion: 8.6.2-x64-1 | classnamespace: dsp.gen | rect: [84, 144, 653, 641]
----------- objects -----------
[codebox]
//============================================================
Expand Down Expand Up @@ -83,20 +90,20 @@ rect: [65, 399, 927, 289] | openrect: [0, 0, 0, 169] | default_fontsize: 10.0 |
[coll @embed 1] coll_data: {'count': 2, 'data': [{'key': 0, 'value': ['test']}, {'key': 1, 'value': ['another', 'test']}]} | embed: 1 | precision: 6
[p MySubpatcher]
----------- patcher -----------
rect: [805, 282, 271, 250]
appversion: 8.6.2-x64-1 | rect: [805, 282, 271, 250]
----------- objects -----------
[live.dial] parameter: <longname: In a subpatcher | shortname: live.dial | type: 0 | unitstyle: 0>
[live.dial] parameter: <longname: In a subpatcher | modmode: 0 | shortname: live.dial | type: 0 | unitstyle: 0>
[t b b]
[loadbang]
[message read collContent.txt]
[coll]
[fpic] pic: fpic.png
[live.tab] annotation: Toggles between Beat Sync and Free running (Hz). | annotation_name: Time Mode | fontsize: 9.0 | livemode: 1 | num_lines_patching: 2 | num_lines_presentation: 2 | pictures: [hz-icon.svg, beat-icon.svg] | remapsvgcolors: 1 | parameter: <annotation_name: Time Mode | enum: [Free, Sync] | invisible: 2 | linknames: 1 | longname: Time Mode | mmax: 1 | shortname: Time Mode | type: 2 | unitstyle: 9> | usepicture: 1 | usesvgviewbox: 1 | varname: Time Mode
[live.tab] annotation: Toggles between Beat Sync and Free running (Hz). | annotation_name: Time Mode | fontsize: 9.0 | livemode: 1 | num_lines_patching: 2 | num_lines_presentation: 2 | pictures: [hz-icon.svg, beat-icon.svg] | remapsvgcolors: 1 | parameter: <annotation_name: Time Mode | enum: [Free, Sync] | invisible: 2 | linknames: 1 | longname: Time Mode | mmax: 1 | modmode: 0 | shortname: Time Mode | type: 2 | unitstyle: 9> | usepicture: 1 | usesvgviewbox: 1 | varname: Time Mode
[live.banks]
[bpatcher ParamAbstraction.maxpat] offset: [-73, -62]
[bpatcher ParamAbstraction.maxpat] offset: [-73, -62]
[live.dial] activefgdialcolor: live_display_handle_two | parameter: <longname: live.dial[1] | shortname: live.dial | type: 0 | unitstyle: 0> | varname: live.dial[1]
[live.dial]
[live.dial] activefgdialcolor: live_display_handle_two | parameter: <longname: live.dial[1] | modmode: 0 | shortname: live.dial | type: 0 | unitstyle: 0> | varname: live.dial[1]
[live.dial] parameter: <longname: live.dial | modmode: 0 | shortname: live.dial | type: 0 | unitstyle: 0>
[button] presentation: 1 | presentation_rect: [265, 26, 24, 24]
[bpatcher MyAbstraction.maxpat] offset: [-4, -12]
[comment A comment]
Expand Down
Binary file modified maxdiff/tests/test_files/Test.amxd
Binary file not shown.

0 comments on commit 3a2659c

Please sign in to comment.