Fork RGBMatrix into HUEMatrix and restore RGBMatrix to upstream - #5
Merged
Merged
Conversation
- Updated multiple RGB scripts to replace HSV color handling with direct RGB values. - Modified functions to create and manipulate pixel maps using RGB arrays. - Removed unnecessary HSV color conversions and streamlined color handling. - Adjusted color initialization and merging logic to accommodate RGB format. - Cleaned up code for better readability and maintainability. - Removed RGBW color mode references from the RGBMatrixEditor UI and logic. Signed-off-by: Andre Bossard <anbossar@microsoft.com>
- Introduced a new QML component `HUEMatrixEditor.qml` for editing hue matrix functions, featuring various UI elements for configuration. - Created a new CMakeLists.txt file for managing hue script resources, ensuring scripts are copied to the appropriate directory when building for Android. - Added a new SVG icon `huematrix.svg` to visually represent the hue matrix in the application. Signed-off-by: Andre Bossard <anbossar@microsoft.com>
Resolves engine/src/rgbmatrix.cpp to upstream/master content. Both sides carried upstream commit e671868 ("expose RGBMatrix Script parameters as attributes"): the base picked it up as 896bf2a, this branch integrated it via the byte-restore. The conflict was the fork divergence that this branch removes by design, so the resolution keeps rgbmatrix.cpp byte-identical to upstream and the fork behaviour stays in HUEMatrix. 896bf2a was the only new base commit touching rgbmatrix.cpp; no unique base work is lost. Verified: git diff upstream/master -- engine/src/rgbmatrix.cpp is empty; build clean with -Werror -Wextra -Wall; huematrix 42, rgbmatrix 9, rgbscript 14, function 37, mcp_rgb_transform 15, all 0 failed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: fc4ab017-05b4-4630-9c37-972e85838621
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary of Changes:
This fork had diverged
RGBMatrixheavily (+1185 lines inrgbmatrix.cpp, +478 inrgbscriptv4.cpp, 39 stock scripts rewritten,RGBAudiodeleted), which made every upstream merge painful and meant fork-only behavior could not be turned off. This PR splits that divergence in two:RGBMatrixgoes back to pristine upstream, and all fork behavior moves to a newHUEMatrixfunction type that inherits from it. Users pick between them side by side.The split is cheap because of one non-obvious property: the fork's HSV contract lives entirely inside
RGBScript.RGBMapwas always packed RGB (hsvToRgb()packs before the map leaves the script class), sorgbmatrix.cppnever referenced hue at all. That let the divergence be cut at the algorithm boundary rather than threaded through the matrix.Approach:
engine/src/rgbmatrix.cpp,rgbalgorithm.cpp,rgbscriptv4.cpp,rgbaudio.{h,cpp}and the 39 stock scripts are restored byte-identical toupstream/master.git diff upstream/masteron those paths returns 0 lines. This also integrates upstreame671868c6(script parameters as attributes), which the fork had never picked up.virtual, removal offinal, two additiveControlModeenumerators, andfriend class HUEMatrix;/friend class HUEScript;.friendwas chosen over widening members toprotected:because it is strictly narrower.HUEMatrix : public RGBMatrixandHUEScript : public RGBScriptcarry rotation, mirror + blend, beat transforms, brightness, RGBW control modes, the pixel plan, and async precompute.hsvutil.jsmoved toresources/huescripts/via pure renames (allR100, zero content edits) behind a separate cache.RGBMatrixsees only upstream stock scripts;HUEMatrixsees both, sinceHUEScriptsupports the HSV Float32Array contract and the upstream packed-uint contract.Related Issues:
N/A
Checklist
{on a new line for functions and class definitions.Note: verified on macOS only. Not built or run on Linux or Windows.
Testing
Test Cases:
huematrix_test(42 cases, new): HSV Float32Array contract across all 41 audio scripts, the upstream packed-uint contract on the same class, algorithm-list separation in both directions, fork properties in memory and through XML round-trip, enumerated icon sites, built-in reachability, bounded destructor drain, async precompute generation checks, per-tick recompute for audio algorithms, and the unavailable-algorithm andAudioProfileIDload warnings.rgbmatrix_test(9) andrgbscript_test(14): upstream's own suites, unmodified. These are the real proof of the restore.mcp_rgb_transform_test(15): re-pointed atHUEMatrix, keeping spatial coverage of rotation/mirror/beat rather than degrading to property get/set.Test Results:
Full sweep of every project test binary, each run from its own directory since resource paths are cwd-relative:
The single failure is pre-existing and unrelated:
git diff upstream/master -- plugins/velleman/is empty and nothing in this branch touches that plugin.Key results:
Additional Notes
Please review these areas carefully:
Breaking change for existing workspaces. Because the audio scripts moved directories, pre-existing
RGBMatrixfunctions that referenced them no longer resolve: 56 functions across three real workspaces. A warning naming both the script and the function now fires on load. Separately, the fork-only<AudioProfileID>tag is dropped by restored-upstreamloadXML(5 functions), with upstream'sUnknown RGB matrix tagwarning. This is intentional; there is no automatic migration. Affected effects should be recreated asHUEMatrixfunctions. Both cases are documented in README Known Issues and MANUAL_REVIEW section 23.4.Deliberate duplication.
HUEMatrix::write()fully overrides without calling the base, duplicating roughly 200 lines. The alternative was extracting virtual seams into upstream'swrite(), which was rejected: it would permanently diverge the method upstream touches most. Keepingrgbmatrix.cppbyte-identical was judged worth the duplication.Known coverage gaps, not papered over:
HUEMatrixEditor::algorithms()has no test.qmluibuilds an executable rather than a library andFunctionEditordepends onTardis, so editors cannot be constructed in a unit test. The delegation is proven only at the cache boundary; MANUAL_REVIEW 23.1 covers it by hand.m_precomputedAlgorithm == m_runAlgorithmcheck inconsumePrecomputedMap, and the pre-compute generation re-check inkickAsyncRgbMap. Deleting either fails no test.HUEMatrixcan be assigned to a VC Animation widget (it IS-ARGBMatrix), but that widget's icon is unconditionally the RGB Matrix icon. Cosmetic.resources/rgbscripts/audiospectrum.jswas renamed to "Audio Spectrum Bars" because it shadowed the built-inRGBAudioalgorithm and made it unreachable by name. Workspaces storing the old name will not resolve it; verified this adds no new breakage beyond the relocation loss already described.