Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ New:
- Translate MapMap into Arabic, laid out from right to left with numbers written with the digits 0 to 9, into Hindi and into Russian: choose them in Preferences > Interface > Language, or with `--lang ar`, `hi` or `ru`. No speaker of these languages has read them yet.
- See the scene from the projector, with a camera placed next to it: Tools > Auto-Mapping covers the screen of the projector with the output, projects a countdown, then black and white stripes that the camera films, about 15 seconds in all. The scene seen from the projector then shows under the shapes of the output editor, with in red what the camera did not see, to place the shapes on it by hand. Tools > Show Auto-Mapping Image hides it, Tools > Clear Auto-Mapping Image forgets it; it is never saved, and goes with the project. No image of the camera is written to the disk, unless asked with `--auto-mapping-save-images <folder>`. `--auto-mapping-simulation` films a computed scene instead, to try it without a camera or a projector. Placing shapes on the flat faces found comes in a later version.
- Put layers in groups, which fold in the list of layers and show, hide, lock, put in solo or fade their layers together. Edit > Group (Ctrl+G, Cmd+G on macOS) puts the selected layers in a new group named after them, Ungroup (Ctrl+Shift+G) takes them out, and New Group adds an empty one. Drag a layer onto a group to put it in, or between two rows to place it there; drag a group to move it with its layers. The eye, solo, lock and opacity of a group add to those of its layers, and can be linked to a key or a MIDI control. Deleting a group asks first, then deletes its layers. Each of these is one step to undo. The project keeps the groups and their fold; a project without groups is written as before. OSC reaches groups at `/mapmap/group/...` and puts a layer in one with `/mapmap/layer/group`; the MCP tools `list_groups`, `create_group` and `delete_group` manage them.
- Play a show without moving its shapes by mistake: View > Performance Mode (Ctrl+Shift+L, Cmd+Shift+L on macOS), the red button of the toolbar, or a key, a pad or a button learned on it, switch between edit mode and performance mode, without asking. In performance mode, a red banner, the status bar and the title of the window say so; the vertices are drawn small and red, as on a locked layer, and the shapes cannot be moved, turned or reshaped with the mouse, the keyboard or MIDI controls; adding and deleting layers and sources, dropping media, Create Shapes of the automatic mapping, the output resolution, Undo and Redo are greyed, and their tooltip says why. Showing, hiding, solo, opacity, playback, cues, effects and saving still work, and OSC and MCP can still change everything. The project keeps its mode (the key `performance`, see `docs/project-format.md`); `--performance` starts in performance mode whatever the project says. OSC sets it at `/mapmap/project/performance`, MCP with the kind `project`.

Improvements:

- The solo button of the list of layers shows an "S", as on a mixing desk.
- Two quick clicks on the eye, the solo or the lock of a layer switch it twice: the second click was lost, taken for a double click.
- The settings panel shows values in pixels without their unit, and numbers without thousands separators: 1024, not 1,024 px.
- A bottom section under the editor, hidden at first, holds tabs; Window > Editor, Bottom Section, and Editor and Bottom Section (Ctrl+Alt+1, 2 and 3; Cmd+Option on macOS), two buttons beside its tabs and the OSC address `/mapmap/view/panels` show one, the other or both, and MapMap remembers the choice.
- The frames per second in the status bar keep the same width as they change: the other boxes of the status bar no longer move each second.
Expand All @@ -82,6 +85,7 @@ Improvements:

Changes:

- The lock of a layer now also keeps its shapes from the keys and MIDI controls linked to its vertices, and from the arrow keys, which moved the selected vertex of a locked layer. OSC and MCP still move them.
- Clicking again on the selected layer no longer switches to scaling or rotating, and the M key does nothing. Use the handle of the layer instead: R, S and T choose what it does.
- The two meshes of a layer always keep the same grid.
- Dragging the center point of an ellipse in perspective moves it inside the outline, which stays in place: the image tilts and the four other points slide along the outline. It no longer moves the whole ellipse; drag the inside of the ellipse for that. Without perspective, the center point still moves the ellipse.
Expand Down
14 changes: 14 additions & 0 deletions OSC
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,20 @@ Examples::
/mapmap/layer/vertex/source/xy ,iiff 0 2 320.0 240.0


Project
-------

::

/mapmap/project/<path> <value> Write a setting of the project itself, which has no id.
/mapmap/project/performance ,i 0|1 Go into performance mode (1), or back to edit mode (0).

In performance mode the shapes of the layers cannot be moved or changed from
the interface, the keys or controllers, and nothing can be added or deleted.
OSC and MCP still move them, so that a control desk or a script keeps its
hand during a show.


Output window
-------------

Expand Down
1 change: 1 addition & 0 deletions docs/informations/mapmap-keyboard-shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
| <kbd>Ctrl</kbd> + <kbd>F</kbd> | Output fills a screen, or back to how it was shown |
| <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>F</kbd> | Output in a window |
| <kbd>Escape</kbd> | Bring MapMap back from the screen covered by the output |
| <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>L</kbd> | Performance mode: lock the shapes for the show, or back to edit mode |
| <kbd>Alt</kbd> + <kbd>T</kbd> | Show/Hide test signal |
| <kbd>Alt</kbd> + <kbd>C</kbd> | Show/Hide controls |
| <kbd>Alt</kbd> + <kbd>U</kbd> | Show/Hide undo history |
Expand Down
9 changes: 9 additions & 0 deletions docs/informations/osc.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ Play: `/mapmap/play`
Rewind/reset: `/mapmap/rewind`
Quit: `/mapmap/quit`

## Project

The settings of the project itself have no id: `/mapmap/project/<path> <value>`.

Go into performance mode, where the shapes of the layers cannot be moved or changed from the interface, the keys or controllers, and nothing can be added or deleted: `/mapmap/project/performance ,i 1`
Back to edit mode: `/mapmap/project/performance ,i 0`

OSC and MCP still move the shapes in performance mode, so that a control desk or a script keeps its hand during a show.

## Output window

Hide the output, show it in a window, or cover the output screen: `/mapmap/output/mode ,s <hidden|window|screen>`
Expand Down
6 changes: 5 additions & 1 deletion docs/project-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ The keys of earlier versions in camelCase or PascalCase (`className`, `sourceId`

A MapMap project is a JSON object. The writer emits `sources` and `layers` arrays, including when they are empty. A layer refers to its source by a numeric ID. Array order matters: the first layer is at the top of the stack. Mesh vertices are in row-major order. An older project may omit `output_resolution`, which earlier versions wrote `outputResolution`: read it when `output_resolution` is absent, and write only `output_resolution`.

The settings of the project itself are keys of this object, written only when they differ from their default, so that a project that does not use them keeps the same bytes:

- `performance`, `true` when the project was saved in performance mode: the shapes cannot be changed with the mouse, the keyboard or controllers, and no layer or source can be added or deleted. Without it, the project opens in edit mode. Its address is `/mapmap/project/performance` by OSC, the kind `project` by MCP, and the element `project` by links.

The current development reader accepts earlier setting names such as `sourceId` and `nColumns`. When both spellings occur, the current spelling takes precedence. IDs and coordinates are already JSON numbers. Beta.1 stores many settings as strings. Beta.2 reads those projects directly. Saving a project writes the beta.2 format, with native numbers and booleans. Use Save As to keep a copy that beta.1 can read.

## Beta.2 file format
Expand Down Expand Up @@ -172,7 +176,7 @@ Each link has a `trigger`, a `target` and an `action`:

- `trigger.kind` is `key` for a key of the computer keyboard. `trigger.key` is the key and its modifiers in the portable text of `QKeySequence`, such as `M` or `Shift+M`: the same in every language of the system.
- `trigger.kind` is `midi` for a MIDI device: `trigger.message` is `control` (a control change: a knob, a fader, some buttons) or `note` (a key, a pad), `trigger.channel` the channel, from 1 to 16, and `trigger.number` the number of the control or of the note, from 0 to 127. The port is not written: a device plugged into another port, or replaced by another one, keeps its links.
- `target.element` is `source` or `layer`, `target.id` the id of the element, `target.setting` the path of the setting, as in OSC. `target.component`, `x` or `y`, makes the link drive one coordinate of a point, such as a vertex (`output/vertices/2`); without it, the link drives the whole value.
- `target.element` is `source`, `layer` or `group`, `target.id` the id of the element, `target.setting` the path of the setting, as in OSC. `target.element` is `project` for a setting of the project itself, such as `performance`, without `target.id`. `target.component`, `x` or `y`, makes the link drive one coordinate of a point, such as a vertex (`output/vertices/2`); without it, the link drives the whole value.
- `action` is `toggle`, `on`, `off`, `follow`, `increase`, `decrease` or `relative`. A link without an action toggles. `follow`, which sets the setting at the position of the control, and `relative`, which moves it as much as the control turned since its previous message, are only for a MIDI `control`. `increase` and `decrease` move a number by a hundredth of its range, or a coordinate by a pixel. A coordinate only takes `increase`, `decrease` and `relative`.

```json
Expand Down
10 changes: 10 additions & 0 deletions resources/images/icons/performance_w.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/interface.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<file alias="add-video">images/icons/add_movie_w.png</file>
<file alias="add-camera">images/icons/add_camera_w.png</file>
<file alias="add-generator">images/icons/add_generator_w.png</file>
<file alias="performance">images/icons/performance_w.svg</file>
<file alias="add-syphon">images/icons/syphon-white.png</file>
<file alias="add-mesh">images/shapes/add_quad.png</file>
<file alias="add-triangle">images/shapes/add_triangle.png</file>
Expand Down
10 changes: 10 additions & 0 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ int main(int argc, char *argv[])
"Cover the output screen with the output, without asking (see --output-screen).");
parser.addOption(fullscreenOption);

// --performance option
QCommandLineOption performanceOption("performance",
"Start in performance mode, even if the project was saved in edit mode: the shapes are locked against "
"the mouse, the keyboard and controllers, and nothing can be added or deleted.");
parser.addOption(performanceOption);

// --output-screen option
QCommandLineOption outputScreenOption("output-screen",
"Show the output on <screen> for this session: its name, as --list-screens writes it, or its number in that list.",
Expand Down Expand Up @@ -370,6 +376,10 @@ int main(int argc, char *argv[])
win->loadFile(projectFileValue);
}

// After the project, which may have been saved in edit mode.
if (parser.isSet(performanceOption))
win->getMappingManager().setPerformanceMode(true);

QString oscPortValue = parser.value("osc-port");
if (oscPortValue != "")
win->setOscPort(oscPortValue);
Expand Down
44 changes: 25 additions & 19 deletions src/control/McpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,17 +441,20 @@ QJsonObject McpServer::handleToolsCall(const QJsonObject& params)
const QString property = args.value("property").toString();
const QVariant value = args.value("value").toVariant();

// The project itself has settings too, such as "performance", and no id.
const bool project = kind == "project";
QSharedPointer<Element> element;
if (kind == "source") element = mm.getSourceById(id);
else if (kind == "layer") element = mm.getLayerById(id);
else if (kind == "group") element = mm.getGroupById(id);
else return textResult("'kind' must be \"source\", \"layer\" or \"group\".", true);
else if (!project) return textResult("'kind' must be \"source\", \"layer\", \"group\" or \"project\".", true);

if (element.isNull()) return textResult(QString("No %1 with id %2.").arg(kind).arg(id), true);
if (!project && element.isNull()) return textResult(QString("No %1 with id %2.").arg(kind).arg(id), true);
if (property.isEmpty()) return textResult("Missing required argument 'property'.", true);

SettingNode* node = element->settings()->findNode(property);
if (!node) return textResult(QString("No setting '%1' on %2 %3.").arg(property, kind).arg(id), true);
const QString owner = project ? kind : QString("%1 %2").arg(kind).arg(id);
SettingNode* node = (project ? mm.settings() : element->settings())->findNode(property);
if (!node) return textResult(QString("No setting '%1' on %2.").arg(property, owner), true);
if (node->kind() != SettingNode::SettingKind)
return textResult(QString("'%1' is a %2, not a setting: use list_settings to find the settings below it.")
.arg(property, node->kind() == SettingNode::GroupKind ? "group" : "list"), true);
Expand All @@ -462,10 +465,12 @@ QJsonObject McpServer::handleToolsCall(const QJsonObject& params)
// A point or a range is given as an array of two numbers; anything else as one value.
const QVariantList arguments = (value.typeId() == QMetaType::QVariantList) ? value.toList() : QVariantList { value };

if (!writeRemoteSetting(*element, setting, arguments, sameMediaSourceAllowed()))
return textResult(QString("Could not set '%1' on %2 %3: value refused.").arg(property, kind).arg(id), true);
const bool written = project ? setting->setFromArguments(arguments)
: writeRemoteSetting(*element, setting, arguments, sameMediaSourceAllowed());
if (!written)
return textResult(QString("Could not set '%1' on %2: value refused.").arg(property, owner), true);
_mainWindow->updateCanvases();
return textResult(QString("Set %1 %2 property '%3'.").arg(kind).arg(id).arg(property));
return textResult(QString("Set %1 property '%2'.").arg(owner, property));
}

// ---- Effects ----
Expand Down Expand Up @@ -527,6 +532,7 @@ QJsonObject McpServer::handleToolsCall(const QJsonObject& params)
state["nSources"] = mm.nSources();
state["nLayers"] = mm.nLayers();
state["nGroups"] = mm.nGroups();
state["performance"] = mm.isPerformanceMode();
state["currentSourceId"] = static_cast<qint64>(_mainWindow->getCurrentSourceId());
state["currentLayerId"] = static_cast<qint64>(_mainWindow->getCurrentLayerId());
return jsonResult(state);
Expand Down Expand Up @@ -570,10 +576,10 @@ QJsonObject McpServer::handleToolsCall(const QJsonObject& params)
if (kind == "source") element = mm.getSourceById(id);
else if (kind == "layer") element = mm.getLayerById(id);
else if (kind == "group") element = mm.getGroupById(id);
else return textResult("'kind' must be \"source\", \"layer\" or \"group\".", true);
if (element.isNull()) return textResult(QString("No %1 with id %2.").arg(kind).arg(id), true);
else if (kind != "project") return textResult("'kind' must be \"source\", \"layer\", \"group\" or \"project\".", true);
if (kind != "project" && element.isNull()) return textResult(QString("No %1 with id %2.").arg(kind).arg(id), true);
QJsonObject result;
result["settings"] = describeSettings(element->settings());
result["settings"] = describeSettings(kind == "project" ? mm.settings() : element->settings());
return jsonResult(result);
}
if (name == "get_layer")
Expand Down Expand Up @@ -800,14 +806,14 @@ QJsonArray McpServer::toolDefinitions() const
},
QJsonArray{"id", "vertices"}));
tools.append(tool("set_property",
"Set a setting of a source, a layer or a group (e.g. name, opacity, color, uri, group_id, or a path such as output/vertices/0; see list_settings). A point or a range takes an array of two numbers.",
"Set a setting of a source, a layer, a group or the project itself (e.g. name, opacity, color, uri, group_id, or a path such as output/vertices/0; see list_settings). A point or a range takes an array of two numbers. The project has no id; its setting performance (true or false) puts it in performance mode, where the shapes cannot be moved from the interface, the keys or controllers, but still can be by MCP and OSC.",
QJsonObject{
{"kind", prop("string", "\"source\", \"layer\" or \"group\".")},
{"id", prop("integer", "Element id.")},
{"kind", prop("string", "\"source\", \"layer\", \"group\" or \"project\".")},
{"id", prop("integer", "Element id; ignored for the project.")},
{"property", prop("string", "Setting name or path.")},
{"value", QJsonObject{{"description", "Property value (type depends on the property)."}}}
},
QJsonArray{"kind", "id", "property", "value"}));
QJsonArray{"kind", "property", "value"}));

tools.append(tool("list_effect_types",
"List the kinds of effects that can be put on a source or a layer, with the category each is "
Expand All @@ -833,7 +839,7 @@ QJsonArray McpServer::toolDefinitions() const
QJsonArray{"kind", "id", "effect_id"}));

tools.append(tool("get_state",
"Get overall state: playing, fps, counts and current selection.",
"Get overall state: playing, fps, counts, current selection, and performance (true in performance mode).",
QJsonObject(), QJsonArray()));
tools.append(tool("list_sources", "List all sources with their summary fields: id, name, opacity, locked, "
"type (as in project files, such as \"mapmap:video\" or \"mapmap.shaders:checker.fs\") and "
Expand All @@ -843,14 +849,14 @@ QJsonArray McpServer::toolDefinitions() const
"group_id: the id of its group, or 0.",
QJsonObject(), QJsonArray()));
tools.append(tool("list_settings",
"List every setting of a source, a layer or a group with its path, type, value, bounds, unit and options. "
"List every setting of a source, a layer, a group or the project itself with its path, type, value, bounds, unit and options. "
"Values and bounds are in the stored range, which set_property takes: an opacity goes from 0 to 1. "
"displayScale, when given, is the factor to the number shown to the user (100 for a percentage).",
QJsonObject{
{"kind", prop("string", "\"source\", \"layer\" or \"group\".")},
{"id", prop("integer", "Element id.")}
{"kind", prop("string", "\"source\", \"layer\", \"group\" or \"project\".")},
{"id", prop("integer", "Element id; ignored for the project.")}
},
QJsonArray{"kind", "id"}));
QJsonArray{"kind"}));
tools.append(tool("get_source", "Get all properties of a source, and its effects.",
QJsonObject{{"id", prop("integer", "Source id.")}}, QJsonArray{"id"}));
tools.append(tool("get_layer", "Get all properties of a layer, and its effects.",
Expand Down
Loading
Loading