Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
3 changes: 3 additions & 0 deletions agave_app/AppearanceDockWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ QAppearanceWidget::QAppearanceWidget(QWidget* pParent,

QScrollArea* scrollArea = new QScrollArea();
scrollArea->setWidgetResizable(true);
// Make the inner appearance widget always shrink to the viewport's width;
// this prevents an expanded section from forcing a horizontal scrollbar.
m_AppearanceSettingsWidget.setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
scrollArea->setWidget(&m_AppearanceSettingsWidget);

m_MainLayout.addWidget(scrollArea, 1, 0);
Expand Down
302 changes: 207 additions & 95 deletions agave_app/AppearanceSettingsWidget.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion agave_app/AppearanceSettingsWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public slots:
private:
Scene* m_scene{ nullptr };

QFormLayout m_MainLayout;
QFormLayout* m_MainLayout;
QNumericSlider m_DensityScaleSlider;
QComboBox m_RendererType;
QComboBox m_ShadingType;
Expand Down
38 changes: 20 additions & 18 deletions agave_app/CameraWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,66 +11,68 @@ QCameraWidget::QCameraWidget(QWidget* pParent, QCamera* cam, RenderSettings* rs)
setLayout(&m_MainLayout);

// Exposure, controls how bright or dim overall scene is
m_ExposureSlider.setStatusTip(tr("Set Exposure"));
m_ExposureSlider.setToolTip(tr("Set camera exposure"));
m_ExposureSlider.setRange(0.0f, 1.0f);
m_ExposureSlider.setValue(cam->GetFilm().GetExposure());
m_ExposureSlider.setDecimals(2);
m_ExposureSlider.setSingleStep(0.01);

m_MainLayout.addRow("Exposure", &m_ExposureSlider);
Controls::addFormRow(&m_MainLayout, "Exposure", &m_ExposureSlider, tr("Set camera exposure"), tr("Set Exposure"));

connect(&m_ExposureSlider, &QNumericSlider::valueChanged, this, &QCameraWidget::SetExposure);

// Number of render iterations per viewport update
m_ExposureIterationsSpinner.setStatusTip(tr("Set Exposure Time"));
m_ExposureIterationsSpinner.setToolTip(tr("Set number of samples to accumulate per viewport update"));
m_ExposureIterationsSpinner.addItem("1", 1);
m_ExposureIterationsSpinner.addItem("2", 2);
m_ExposureIterationsSpinner.addItem("4", 4);
m_ExposureIterationsSpinner.addItem("8", 8);
m_ExposureIterationsSpinner.setCurrentIndex(
m_ExposureIterationsSpinner.findData(cam->GetFilm().GetExposureIterations()));
m_MainLayout.addRow("Exposure Time", &m_ExposureIterationsSpinner);
Controls::addFormRow(&m_MainLayout,
"Exposure Time",
&m_ExposureIterationsSpinner,
tr("Set number of samples to accumulate per viewport update"),
tr("Set Exposure Time"));
connect(&m_ExposureIterationsSpinner, &QComboBox::currentIndexChanged, this, &QCameraWidget::SetExposureIterations);

m_NoiseReduction.setStatusTip(tr("Enable denoising pass"));
m_NoiseReduction.setToolTip(tr("Enable denoising pass"));
m_NoiseReduction.setCheckState(rs->m_DenoiseParams.m_Enabled ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
m_MainLayout.addRow("Noise Reduction", &m_NoiseReduction);
Controls::addFormRow(
&m_MainLayout, "Noise Reduction", &m_NoiseReduction, tr("Enable denoising pass"), tr("Enable denoising pass"));

connect(&m_NoiseReduction, &QCheckBox::stateChanged, this, &QCameraWidget::OnNoiseReduction);

m_ApertureSizeSlider.setStatusTip(tr("Set camera aperture size"));
m_ApertureSizeSlider.setToolTip(tr("Set camera aperture size"));
m_ApertureSizeSlider.setRange(0.0, 0.1);
m_ApertureSizeSlider.setSuffix(" mm");
m_ApertureSizeSlider.setDecimals(2);
m_ApertureSizeSlider.setValue(0.0);
m_ApertureSizeSlider.setSingleStep(0.01);
m_MainLayout.addRow("Aperture Size", &m_ApertureSizeSlider);
Controls::addFormRow(&m_MainLayout,
"Aperture Size",
&m_ApertureSizeSlider,
tr("Set camera aperture size"),
tr("Set camera aperture size"));

connect(&m_ApertureSizeSlider, &QNumericSlider::valueChanged, this, &QCameraWidget::SetAperture);

m_FieldOfViewSlider.setStatusTip(tr("Set camera field of view angle"));
m_FieldOfViewSlider.setToolTip(tr("Set camera field of view angle"));
m_FieldOfViewSlider.setRange(10.0, 150.0);
m_FieldOfViewSlider.setDecimals(2);
m_FieldOfViewSlider.setValue(cam->GetProjection().GetFieldOfView());
m_FieldOfViewSlider.setSuffix(" deg.");
m_MainLayout.addRow("Field of view", &m_FieldOfViewSlider);
Controls::addFormRow(&m_MainLayout,
"Field of view",
&m_FieldOfViewSlider,
tr("Set camera field of view angle"),
tr("Set camera field of view angle"));

connect(&m_FieldOfViewSlider, &QNumericSlider::valueChanged, this, &QCameraWidget::SetFieldOfView);

// Focal distance
m_FocalDistanceSlider.setStatusTip(tr("Set focal distance"));
m_FocalDistanceSlider.setToolTip(tr("Set focal distance"));
m_FocalDistanceSlider.setRange(0.0, 15.0);
m_FocalDistanceSlider.setDecimals(2);
m_FocalDistanceSlider.setValue(0.0);
m_FocalDistanceSlider.setSuffix(" m");

m_MainLayout.addRow("Focal distance", &m_FocalDistanceSlider);
Controls::addFormRow(
&m_MainLayout, "Focal distance", &m_FocalDistanceSlider, tr("Set focal distance"), tr("Set focal distance"));

connect(&m_FocalDistanceSlider, &QNumericSlider::valueChanged, this, &QCameraWidget::SetFocalDistance);

Expand Down
73 changes: 73 additions & 0 deletions agave_app/Controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,8 @@ AgaveFormLayout::addRow(const QString& label, QWidget* widget)
int row = rowCount();
auto* labelWidget = new QLabel(label);
labelWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
labelWidget->setToolTip(widget->toolTip());
labelWidget->setStatusTip(widget->statusTip());
addWidget(labelWidget, row, 0, Qt::AlignLeft);
addWidget(widget, row, 1);
}
Expand All @@ -571,6 +573,13 @@ AgaveFormLayout::addRow(const QString& label, QLayout* layout)
addLayout(layout, row, 1);
}

void
AgaveFormLayout::addRow(QWidget* section)
{
int row = rowCount();
addWidget(section, row, 0, 1, 2);
}

QFormLayout*
Controls::createFormLayout(QWidget* parent)
{
Expand All @@ -597,3 +606,67 @@ Controls::createAgaveFormLayout(QWidget* parent)
layout->setColumnStretch(1, 100);
return layout;
}

static void
applyTipsToWidget(QWidget* w, const QString& toolTip, const QString& statusTip)
{
if (!w) {
return;
}
if (!toolTip.isEmpty()) {
w->setToolTip(toolTip);
}
if (!statusTip.isEmpty()) {
w->setStatusTip(statusTip);
}
}

void
Controls::addFormRow(QFormLayout* layout,
const QString& labelText,
QWidget* field,
const QString& toolTip,
const QString& statusTip)
{
layout->addRow(labelText, field);
applyTipsToWidget(field, toolTip, statusTip);
applyTipsToWidget(layout->labelForField(field), toolTip, statusTip);
}

void
Controls::addFormRow(QFormLayout* layout,
const QString& labelText,
QLayout* fieldLayout,
const QString& toolTip,
const QString& statusTip)
{
layout->addRow(labelText, fieldLayout);
applyTipsToWidget(layout->labelForField(fieldLayout), toolTip, statusTip);
}

void
Controls::addFormRow(AgaveFormLayout* layout,
const QString& labelText,
QWidget* field,
const QString& toolTip,
const QString& statusTip)
{
// Apply to the field first so AgaveFormLayout::addRow's existing tooltip-copy
// logic also picks it up, then explicitly apply to the label as well.
applyTipsToWidget(field, toolTip, statusTip);
layout->addRow(labelText, field);
QLayoutItem* item = layout->itemAtPosition(layout->rowCount() - 1, 0);
applyTipsToWidget(item ? item->widget() : nullptr, toolTip, statusTip);
}

void
Controls::addFormRow(AgaveFormLayout* layout,
const QString& labelText,
QLayout* fieldLayout,
const QString& toolTip,
const QString& statusTip)
{
layout->addRow(labelText, fieldLayout);
QLayoutItem* item = layout->itemAtPosition(layout->rowCount() - 1, 0);
applyTipsToWidget(item ? item->widget() : nullptr, toolTip, statusTip);
}
28 changes: 28 additions & 0 deletions agave_app/Controls.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ class AgaveFormLayout : public QGridLayout
}
void addRow(const QString& label, QWidget* widget);
void addRow(const QString& label, QLayout* layout);
void addRow(QWidget* section);
};

class Controls
Expand All @@ -265,6 +266,33 @@ class Controls
static void initFormLayout(QFormLayout& layout);

static AgaveFormLayout* createAgaveFormLayout(QWidget* parent = nullptr);

// Add a row to a QFormLayout and apply the given toolTip/statusTip to BOTH the
// field widget and the auto-created label. Empty strings are skipped so existing
// tooltips/statusTips on the widget are not erased.
static void addFormRow(QFormLayout* layout,
const QString& labelText,
QWidget* field,
const QString& toolTip,
const QString& statusTip = QString());
static void addFormRow(QFormLayout* layout,
const QString& labelText,
QLayout* fieldLayout,
const QString& toolTip,
const QString& statusTip = QString());

// Same as above but for AgaveFormLayout. The label is located at column 0 of
// the just-added row.
static void addFormRow(AgaveFormLayout* layout,
const QString& labelText,
QWidget* field,
const QString& toolTip,
const QString& statusTip = QString());
static void addFormRow(AgaveFormLayout* layout,
const QString& labelText,
QLayout* fieldLayout,
const QString& toolTip,
const QString& statusTip = QString());
};

/**
Expand Down
39 changes: 15 additions & 24 deletions agave_app/tfeditor/gradients.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@ GradientWidget::GradientWidget(const Histogram& histogram, GradientData* dataObj
btnGroup->addButton(customButton, CUSTOM_BTNID);
QHBoxLayout* hbox = new QHBoxLayout();
hbox->setSpacing(0);
hbox->setContentsMargins(0, 0, 0, 0);

int initialButtonId = WINDOW_LEVEL_BTNID;
GradientEditMode m = m_gradientData->m_activeMode;
Expand All @@ -910,22 +911,27 @@ GradientWidget::GradientWidget(const Histogram& histogram, GradientData* dataObj

QWidget* firstPageWidget = new QWidget;
auto* section0Layout = Controls::createAgaveFormLayout();
section0Layout->setContentsMargins(0, 0, 0, 0);
firstPageWidget->setLayout(section0Layout);

QWidget* secondPageWidget = new QWidget;
auto* section1Layout = Controls::createAgaveFormLayout();
section1Layout->setContentsMargins(0, 0, 0, 0);
secondPageWidget->setLayout(section1Layout);

QWidget* thirdPageWidget = new QWidget;
auto* section2Layout = Controls::createAgaveFormLayout();
section2Layout->setContentsMargins(0, 0, 0, 0);
thirdPageWidget->setLayout(section2Layout);

QWidget* fourthPageWidget = new QWidget;
auto* section3Layout = Controls::createAgaveFormLayout();
section3Layout->setContentsMargins(0, 0, 0, 0);
fourthPageWidget->setLayout(section3Layout);

QWidget* fifthPageWidget = new QWidget;
auto* section4Layout = Controls::createAgaveFormLayout();
section4Layout->setContentsMargins(0, 0, 0, 0);
fifthPageWidget->setLayout(section4Layout);

QStackedLayout* stackedLayout = new QStackedLayout(mainGroupLayout);
Expand Down Expand Up @@ -963,19 +969,15 @@ GradientWidget::GradientWidget(const Histogram& histogram, GradientData* dataObj
});

minu16Slider = new QIntSlider();
minu16Slider->setStatusTip(tr("Minimum u16 value"));
minu16Slider->setToolTip(tr("Set minimum u16 value"));
minu16Slider->setRange(m_histogram.getDataMin(), m_histogram.getDataMax());
minu16Slider->setSingleStep(1);
minu16Slider->setValue(m_gradientData->m_minu16);
section0Layout->addRow("Min u16", minu16Slider);
Controls::addFormRow(section0Layout, "Min u16", minu16Slider, tr("Set minimum u16 value"), tr("Minimum u16 value"));
maxu16Slider = new QIntSlider();
maxu16Slider->setStatusTip(tr("Maximum u16 value"));
maxu16Slider->setToolTip(tr("Set maximum u16 value"));
maxu16Slider->setRange(m_histogram.getDataMin(), m_histogram.getDataMax());
maxu16Slider->setSingleStep(1);
maxu16Slider->setValue(m_gradientData->m_maxu16);
section0Layout->addRow("Max u16", maxu16Slider);
Controls::addFormRow(section0Layout, "Max u16", maxu16Slider, tr("Set maximum u16 value"), tr("Maximum u16 value"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these use facing messages? if so "Set maximum u16 value" seems opaque

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, good point. Will fix.

connect(minu16Slider, &QIntSlider::valueChanged, [this](int i) {
this->m_gradientData->m_minu16 = i;
this->onSetMinMax(i, this->m_gradientData->m_maxu16);
Expand All @@ -986,21 +988,17 @@ GradientWidget::GradientWidget(const Histogram& histogram, GradientData* dataObj
});

windowSlider = new QNumericSlider();
windowSlider->setStatusTip(tr("Window"));
windowSlider->setToolTip(tr("Set size of range of intensities"));
windowSlider->setRange(0.0, 1.0);
windowSlider->setSingleStep(0.01);
windowSlider->setDecimals(3);
windowSlider->setValue(m_gradientData->m_window);
section1Layout->addRow("Window", windowSlider);
Controls::addFormRow(section1Layout, "Window", windowSlider, tr("Set size of range of intensities"), tr("Window"));
levelSlider = new QNumericSlider();
levelSlider->setStatusTip(tr("Level"));
levelSlider->setToolTip(tr("Set level of mid intensity"));
levelSlider->setRange(0.0, 1.0);
levelSlider->setSingleStep(0.01);
levelSlider->setDecimals(3);
levelSlider->setValue(m_gradientData->m_level);
section1Layout->addRow("Level", levelSlider);
Controls::addFormRow(section1Layout, "Level", levelSlider, tr("Set level of mid intensity"), tr("Level"));
connect(windowSlider, &QNumericSlider::valueChanged, [this](double d) {
this->m_gradientData->m_window = d;
this->onSetWindowLevel(d, levelSlider->value());
Expand All @@ -1011,21 +1009,18 @@ GradientWidget::GradientWidget(const Histogram& histogram, GradientData* dataObj
});

isovalueSlider = new QNumericSlider();
isovalueSlider->setStatusTip(tr("Isovalue"));
isovalueSlider->setToolTip(tr("Set Isovalue"));
isovalueSlider->setRange(0.0, 1.0);
isovalueSlider->setSingleStep(0.01);
isovalueSlider->setDecimals(3);
isovalueSlider->setValue(m_gradientData->m_isovalue);
section2Layout->addRow("Isovalue", isovalueSlider);
Controls::addFormRow(section2Layout, "Isovalue", isovalueSlider, tr("Set Isovalue"), tr("Isovalue"));
isorangeSlider = new QNumericSlider();
isorangeSlider->setStatusTip(tr("Isovalue range"));
isorangeSlider->setToolTip(tr("Set range above and below isovalue"));
isorangeSlider->setRange(0.0, 1.0);
isorangeSlider->setSingleStep(0.01);
isorangeSlider->setDecimals(3);
isorangeSlider->setValue(m_gradientData->m_isorange);
section2Layout->addRow("Iso-range", isorangeSlider);
Controls::addFormRow(
section2Layout, "Iso-range", isorangeSlider, tr("Set range above and below isovalue"), tr("Isovalue range"));
connect(isovalueSlider, &QNumericSlider::valueChanged, [this](double d) {
this->m_gradientData->m_isovalue = d;
this->onSetIsovalue(d, isorangeSlider->value());
Expand All @@ -1036,21 +1031,17 @@ GradientWidget::GradientWidget(const Histogram& histogram, GradientData* dataObj
});

pctLowSlider = new QNumericSlider();
pctLowSlider->setStatusTip(tr("Low percentile"));
pctLowSlider->setToolTip(tr("Set bottom percentile"));
pctLowSlider->setRange(0.0, 1.0);
pctLowSlider->setSingleStep(0.01);
pctLowSlider->setDecimals(4);
pctLowSlider->setValue(m_gradientData->m_pctLow);
section3Layout->addRow("Pct Min", pctLowSlider);
Controls::addFormRow(section3Layout, "Pct Min", pctLowSlider, tr("Set bottom percentile"), tr("Low percentile"));
pctHighSlider = new QNumericSlider();
pctHighSlider->setStatusTip(tr("High percentile"));
pctHighSlider->setToolTip(tr("Set top percentile"));
pctHighSlider->setRange(0.0, 1.0);
pctHighSlider->setSingleStep(0.01);
pctHighSlider->setDecimals(4);
pctHighSlider->setValue(m_gradientData->m_pctHigh);
section3Layout->addRow("Pct Max", pctHighSlider);
Controls::addFormRow(section3Layout, "Pct Max", pctHighSlider, tr("Set top percentile"), tr("High percentile"));
connect(pctLowSlider, &QNumericSlider::valueChanged, [this](double d) {
this->m_gradientData->m_pctLow = d;
this->onSetHistogramPercentiles(d, pctHighSlider->value());
Expand Down
2 changes: 1 addition & 1 deletion renderlib/Lighting.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Lighting
size_t m_NoLights{ 0 };
SceneLight* m_sceneLights[MAX_NO_LIGHTS]{ nullptr, nullptr, nullptr, nullptr };

bool lockToCamera = false;
bool lockToCamera = true;
glm::mat3 m_capturedRelativeBasis[MAX_NO_LIGHTS] = { glm::mat3(1.0f),
glm::mat3(1.0f),
glm::mat3(1.0f),
Expand Down
Loading