Permalink
Browse files

qmlui: take into account head dimmer + master dimmer in previews

  • Loading branch information...
mcallegari committed Nov 20, 2018
1 parent b56ca25 commit 9d4dd10f5c1e0b411d31c2f40e085578a8ecd9b3
Showing with 24 additions and 12 deletions.
  1. +13 −7 qmlui/mainview2d.cpp
  2. +11 −5 qmlui/mainview3d.cpp
@@ -389,20 +389,26 @@ void MainView2D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16
return;
}
quint32 masterDimmerChannel = fixture->masterIntensityChannel();
qreal masterDimmerValue = qreal(fixture->channelValueAt(int(masterDimmerChannel))) / 255.0;
for (int headIdx = 0; headIdx < fixture->heads(); headIdx++)
{
quint32 headDimmerIndex = fixture->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, headIdx);
if (headDimmerIndex == QLCChannel::invalid())
headDimmerIndex = fixture->masterIntensityChannel();
quint32 headDimmerChannel = fixture->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, headIdx);
if (headDimmerChannel == QLCChannel::invalid())
headDimmerChannel = fixture->masterIntensityChannel();
//qDebug() << "Head" << headIdx << "dimmer channel:" << mdIndex;
qreal intValue = 1.0;
if (headDimmerIndex != QLCChannel::invalid())
intValue = (qreal)fixture->channelValueAt(headDimmerIndex) / 255;
qreal intensityValue = 1.0;
if (headDimmerChannel != QLCChannel::invalid())
intensityValue = (qreal)fixture->channelValueAt(headDimmerChannel) / 255;
if (headDimmerChannel != masterDimmerChannel)
intensityValue *= masterDimmerValue;
QMetaObject::invokeMethod(fxItem, "setHeadIntensity",
Q_ARG(QVariant, headIdx),
Q_ARG(QVariant, intValue));
Q_ARG(QVariant, intensityValue));
color = FixtureUtils::headColor(fixture, headIdx);
@@ -1094,15 +1094,21 @@ void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16
return;
}
quint32 masterDimmerChannel = fixture->masterIntensityChannel();
qreal masterDimmerValue = qreal(fixture->channelValueAt(int(masterDimmerChannel))) / 255.0;
for (int headIdx = 0; headIdx < fixture->heads(); headIdx++)
{
quint32 headDimmerIndex = fixture->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, headIdx);
if (headDimmerIndex == QLCChannel::invalid())
headDimmerIndex = fixture->masterIntensityChannel();
quint32 headDimmerChannel = fixture->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, headIdx);
if (headDimmerChannel == QLCChannel::invalid())
headDimmerChannel = masterDimmerChannel;
qreal intensityValue = 1.0;
if (headDimmerIndex != QLCChannel::invalid())
intensityValue = qreal(fixture->channelValueAt(int(headDimmerIndex))) / 255.0;
if (headDimmerChannel != QLCChannel::invalid())
intensityValue = qreal(fixture->channelValueAt(int(headDimmerChannel))) / 255.0;
if (headDimmerChannel != masterDimmerChannel)
intensityValue *= masterDimmerValue;
//qDebug() << "Head" << headIdx << "dimmer channel:" << headDimmerIndex << "intensity" << intensityValue;

0 comments on commit 9d4dd10

Please sign in to comment.