From b85bfecd883ebc2e32608840ada902a896c92be2 Mon Sep 17 00:00:00 2001 From: Massimo Callegari Date: Sat, 4 Jan 2025 13:09:37 +0100 Subject: [PATCH] ui: fix some more cross universe cases --- engine/src/doc.cpp | 3 +++ ui/src/fixturemanager.cpp | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/engine/src/doc.cpp b/engine/src/doc.cpp index 2e62dfe43..42bdad535 100644 --- a/engine/src/doc.cpp +++ b/engine/src/doc.cpp @@ -444,6 +444,9 @@ bool Doc::addFixture(Fixture* fixture, quint32 id, bool crossUniverse) m_addresses[i] = id; } + if (crossUniverse) + uni = floor((fixture->universeAddress() + fixture->channels()) / 512); + if (uni >= inputOutputMap()->universesCount()) { for (i = inputOutputMap()->universesCount(); i <= uni; i++) diff --git a/ui/src/fixturemanager.cpp b/ui/src/fixturemanager.cpp index 2221c6ffa..caceb7edf 100644 --- a/ui/src/fixturemanager.cpp +++ b/ui/src/fixturemanager.cpp @@ -1202,15 +1202,15 @@ void FixtureManager::slotAddRGBPanel() if (address + fxi->channels() > 512) { if (!rgb.crossUniverse()) - uniIndex++; - - if (m_doc->inputOutputMap()->getUniverseID(uniIndex) == m_doc->inputOutputMap()->invalidUniverse()) { - m_doc->inputOutputMap()->addUniverse(); - m_doc->inputOutputMap()->startUniverses(); - } - if (!rgb.crossUniverse()) + uniIndex++; address = 0; + } + } + if (m_doc->inputOutputMap()->getUniverseID(uniIndex) == m_doc->inputOutputMap()->invalidUniverse()) + { + m_doc->inputOutputMap()->addUniverse(); + m_doc->inputOutputMap()->startUniverses(); } fxi->setUniverse(m_doc->inputOutputMap()->getUniverseID(uniIndex)); @@ -1220,7 +1220,7 @@ void FixtureManager::slotAddRGBPanel() m_doc->addFixture(fxi, Fixture::invalidId(), rgb.crossUniverse()); address += fxi->channels(); - if (address > 512 && rgb.crossUniverse()) + if (address >= 512 && rgb.crossUniverse()) { address -= 512; uniIndex++;