fix(instrument_drop): narrow FX hotspot to tcp.fx/mcp.fx, not bare tcp/mcp (S-VIEW-BUG-1)
This commit is contained in:
@@ -40,11 +40,15 @@ std::string buildInstrumentDropChunk(const std::string& sampleId) {
|
||||
}
|
||||
|
||||
bool infoNamesFxHotspot(const std::string& info) {
|
||||
// See the header contract. The FX-chain / floating-FX windows report "fx_*"; the track /
|
||||
// mixer panel that carries the FX button reports "tcp*" / "mcp*". Prefix-match all three —
|
||||
// the TCP/MCP surfaces are the fix for S-VIEW-BUG-1 (the "fx_"-only predicate missed them).
|
||||
// See the header contract. Two documented FX-bearing surfaces (SDK §GetThingFromPoint):
|
||||
// "fx_chain" / "fx_N" — the FX-chain and floating-FX windows.
|
||||
// "tcp.fx" / "mcp.fx" — the TCP / MCP FX button specifically.
|
||||
// Bare "tcp" / "mcp" and any other "tcp.*" / "mcp.*" sub-element (e.g. "tcp.mute",
|
||||
// "tcp.vol") are track-panel hits that are NOT on the FX button — those must not trigger
|
||||
// an instrument drop. Exact-string match for the two .fx tokens; prefix-match for fx_.
|
||||
if (info == "tcp.fx" || info == "mcp.fx") return true;
|
||||
auto startsWith = [&info](const char* p) { return info.rfind(p, 0) == 0; };
|
||||
return startsWith("fx_") || startsWith("tcp") || startsWith("mcp");
|
||||
return startsWith("fx_");
|
||||
}
|
||||
|
||||
std::string encodeBase64(const std::vector<std::uint8_t>& bytes) {
|
||||
|
||||
+10
-9
@@ -58,15 +58,16 @@ std::string buildInstrumentDropChunk(const std::string& sampleId);
|
||||
//
|
||||
// THE BUG (S-VIEW-BUG-1): the original shell predicate matched ONLY "fx_" — but per the SDK
|
||||
// (reaper_plugin_functions.h §GetThingFromPoint) "fx_chain"/"fx_N" are the FX-CHAIN and
|
||||
// FLOATING-FX windows; a hit on the TRACK PANEL (where the TCP/MCP FX button actually lives —
|
||||
// the intuitive "drop onto the track's FX chain" target) reports a string that BEGINS WITH
|
||||
// "tcp" or "mcp" (e.g. "tcp.fx"). So dropping on the TCP FX button never armed the drop; the
|
||||
// gesture fell through and the file dropped to arrange as audio. The drop target is therefore
|
||||
// EITHER of the SDK's two documented FX-bearing surfaces:
|
||||
// * the FX chain / floating FX window -> info begins with "fx_" ("fx_chain", "fx_0", ...)
|
||||
// * the track/mixer panel that hosts the FX button -> info begins with "tcp" or "mcp"
|
||||
// A single-capture drag released over any of these, on a resolved track, is an instrument drop.
|
||||
// Any other info ("arrange", "spacer_0", "", ...) is not an FX hotspot.
|
||||
// FLOATING-FX windows; a hit on the TCP/MCP FX button (where the intuitive "drop onto the
|
||||
// track's FX chain" gesture lands) reports a string in the "tcp.*"/"mcp.*" family —
|
||||
// specifically "tcp.fx" / "mcp.fx". So dropping on the TCP FX button never armed the drop;
|
||||
// the gesture fell through and the file dropped to arrange as audio.
|
||||
//
|
||||
// The fix: two documented FX-bearing surfaces are hotspots (SDK §GetThingFromPoint):
|
||||
// * "fx_chain" / "fx_N" — the FX-chain and floating-FX windows (prefix "fx_")
|
||||
// * "tcp.fx" / "mcp.fx" — the TCP / MCP FX button (exact token)
|
||||
// Bare "tcp"/"mcp" and any other "tcp.*"/"mcp.*" sub-element (e.g. "tcp.mute") are track-panel
|
||||
// hits on non-FX surfaces — they must NOT trigger an instrument drop. Only the FX button does.
|
||||
bool infoNamesFxHotspot(const std::string& info);
|
||||
|
||||
// The raw (pre-base64) component-state bytes — exposed so the round-trip test can decode them
|
||||
|
||||
@@ -33,14 +33,14 @@ struct FxDropTarget {
|
||||
};
|
||||
|
||||
// Hit-test a screen point (REAPER screen coords) to an FX drop target. Wraps
|
||||
// GetThingFromPoint, whose info string tells us what was hit ("tcp"/"mcp" for a track panel,
|
||||
// "fx_chain"/"fx_N" for the FX area/button). `overReaperUi` is the shell-supplied predicate
|
||||
// the pure drag_out::decideGesture consumes (true when the point is over REAPER's own UI —
|
||||
// i.e. GetThingFromPoint returned a track OR a recognizable non-track thing, false when the
|
||||
// pointer has left REAPER entirely). `overFxHotspot` is true when the info string names the
|
||||
// FX region specifically — the S17 "FX-button hotspot vs. whole TCP" question is resolved to
|
||||
// the FX hotspot (the discoverable, unambiguous target), decided here from the SDK's own
|
||||
// hit-test string rather than a home-grown geometry guess.
|
||||
// GetThingFromPoint, whose info string tells us what was hit ("tcp.fx"/"mcp.fx" for the TCP/MCP
|
||||
// FX button; "fx_chain"/"fx_N" for the FX-chain and floating-FX windows; bare "tcp"/"mcp" or
|
||||
// other "tcp.*"/"mcp.*" tokens for non-FX track-panel regions). `overReaperUi` is the
|
||||
// shell-supplied predicate the pure drag_out::decideGesture consumes (true when the point is
|
||||
// over REAPER's own UI — i.e. GetThingFromPoint returned a track OR a recognizable non-track
|
||||
// thing, false when the pointer has left REAPER entirely). `overFxHotspot` is true only when
|
||||
// the info string names a genuine FX-bearing surface ("tcp.fx", "mcp.fx", or "fx_*") —
|
||||
// decided by instrument_drop::infoNamesFxHotspot from the SDK's own hit-test string.
|
||||
FxDropTarget resolveFxDropTarget(int screenX, int screenY);
|
||||
|
||||
// Perform the drop on `track`: add a fresh ReaSampler 9000 instance and inject `chunkBase64`
|
||||
|
||||
Reference in New Issue
Block a user