mira-flatten
Mira Flatten was made to workaround a longstanding limitation for users of Mira, a technology which helps bridge Max applications with touchscreen devices like iPads.
miraflatten.js makes it simple to instantly create a "flattened" version of a Max user interface that includes bpatchers (nested subviews). This "flattened" proxy UI can then be used in Mira as though it had been originally programmed with no bpatchers.
Mira Flatten is distributed here as a Package for Max. It basically just contains miraflatten.js and an example file. You can also access the code directly on GitHub.
Usage
Add a [js miraflatten.js] to your patch.
Add a panel that represents the desired Mira.frame in presentation mode.
Give the panel a varname, and set the framepanelvarname attribute of the [js miraflatten.js] to match.
Send a bang to the right inlet of [js miraflatten.js].
-> A new Proxy patcher with a mira.frame and flattened view hierarchy has been created, and all it's objects are bound to your original objects.
On future patch loads, send a bang to the left inlet to initialize the same bindings (without creating any objects).
Creates a "Proxy Patcher" which can be used in Mira based on a "Source Patcher" which may include bpatchers.
To help address this: https://cycling74.com/forums/bpatcher-needed-in-mira
Based on the presentation_rect of a "frame" object (most likely a Panel) in the Source Patcher, miraflatten.js creates a new Proxy Patcher which clones objects within the frame, including those nested in bpatchers. The clone objects are then bound to the original objects using MaxobjListeners, and a mira.frame object is created behind them. Thus, Max patchers designed with bpatchers can be presented on a Mira control surface.
ATTRIBUTES
framepanelvarname
The scripting name of a Panel object in the same patcher as miraflatten.js. This is used to determine the frame.
The "Proxy Patcher" will be created with the name <framepanelvarname>-proxy.
REQUIREMENTS
1) All objects -- including bpatchers -- to be included in the Proxy patch must have their Scripting Name (varname) set.
2) Multiple [js miraflatten.js] can be used in the same Source Patcher. If you are doing this, make sure each instance of miraflatten.js is set with a different framepanelvarname.
SETUP
On first usage send a BANG to the RIGHT inlet
After saving/re-opening your patcher, you can send a BANG to the LEFT inlet.
LIMITATIONS
1) Usage of the "offset" attribute of bpatchers is not currently supported.
2) An object (including bpatcher) must be fully within the "frame" in the Source Patcher.
3) It is not possible to set the text of "comment" and "live.comment" objects programatically. So right now they are copied into the proxy interface with their respective object names and they can be edited and saved.
4) In the Proxy patch, objects are given varnames which encode the bpatcher view hierarchy. These cannot be changed, otherwise the bindings will not work when the patch is reloaded.
5) When you make changes to the Source Patcher (e.g. changing object contents, changing Scripting Names) you will need to recreate the Proxy patch (bang in the RIGHT inlet).
1 Package for Max