Skip to content

Commit

Permalink
Merge pull request SCIInstitute#2004 from SCIInstitute/studio_fix
Browse files Browse the repository at this point in the history
Studio fixes
  • Loading branch information
akenmorris authored Feb 15, 2023
2 parents 5d2036e + edfaf5d commit a9f6733
Show file tree
Hide file tree
Showing 22 changed files with 231 additions and 92 deletions.
9 changes: 9 additions & 0 deletions Libs/Common/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,13 @@ class Logging {
//! Close session macro
#define SW_CLOSE_LOG() shapeworks::Logging::Instance().close_log();

//! Log once macro, will only log the message once
#define SW_LOG_ONCE(message, ...) \
{ \
static bool logged = false; \
if (!logged) { \
SW_LOG(message, ##__VA_ARGS__); \
logged = true; \
} \
}
} // namespace shapeworks
1 change: 0 additions & 1 deletion Libs/Optimize/Constraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,6 @@ bool Constraints::hasConstraints() {
return true;
}

SW_LOG("no constraints");
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion Libs/Project/ProjectUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ StringList ProjectUtils::get_values(StringList prefixes, StringList domain_names
for (auto& [key, value] : key_map) {
for (const auto& prefix : prefixes) {
if (key == prefix + domain) {
values.push_back(value);
values.push_back(StringUtils::replace_string(value, "\\", "/"));
}
}
}
Expand Down
18 changes: 10 additions & 8 deletions Studio/Analysis/AnalysisTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,17 +920,19 @@ void AnalysisTool::enable_actions(bool newly_enabled) {
update_domain_alignment_box();
}

auto domain_types = session_->get_groomed_domain_types();
bool image_domain = domain_types.size() > 0 && domain_types[0] == DomainType::Image;
ui_->distance_transfom_radio_button->setEnabled(session_->particles_present() && session_->get_groomed_present() &&
image_domain);
if (session_->particles_present()) {
auto domain_types = session_->get_groomed_domain_types();
bool image_domain = domain_types.size() > 0 && domain_types[0] == DomainType::Image;
ui_->distance_transfom_radio_button->setEnabled(session_->particles_present() && session_->get_groomed_present() &&
image_domain);

ui_->mesh_warping_radio_button->setEnabled(session_->particles_present() && session_->get_groomed_present());
ui_->mesh_warping_radio_button->setEnabled(session_->particles_present() && session_->get_groomed_present());

if (!ui_->mesh_warping_radio_button->isEnabled()) {
ui_->legacy_radio_button->setChecked(true);
if (!ui_->mesh_warping_radio_button->isEnabled()) {
ui_->legacy_radio_button->setChecked(true);
}
reconstruction_method_changed();
}
reconstruction_method_changed();

update_group_boxes();
ui_->sampleSpinBox->setMaximum(session_->get_num_shapes() - 1);
Expand Down
17 changes: 8 additions & 9 deletions Studio/Analysis/AnalysisTool.ui
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ QWidget#particles_panel {
<item row="3" column="0" colspan="2">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="mean_tab">
<attribute name="title">
Expand Down Expand Up @@ -603,7 +603,7 @@ QWidget#particles_panel {
</widget>
</item>
<item row="2" column="1">
<widget class="QSlider" name="group_slider">
<widget class="CustomSlider" name="group_slider">
<property name="toolTip">
<string>Group slider</string>
</property>
Expand Down Expand Up @@ -1059,16 +1059,10 @@ QWidget#particles_panel {
</widget>
</item>
<item row="0" column="1">
<widget class="QSlider" name="pcaSlider">
<widget class="CustomSlider" name="pcaSlider">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Standard deviation slider</string>
</property>
Expand Down Expand Up @@ -2190,6 +2184,11 @@ Reference Domain</string>
<header>jkqtplotter/jkqtplotter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>CustomSlider</class>
<extends>QSlider</extends>
<header>Interface/CustomSlider.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../Resources/ShapeWorksStudio.qrc"/>
Expand Down
2 changes: 2 additions & 0 deletions Studio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ SET(STUDIO_UTILS_MOC_HDRS

SET(STUDIO_INTERFACE_SRCS
Interface/CompareWidget.cpp
Interface/CustomSlider.cpp
Interface/ExportImageDialog.cpp
Interface/KeyboardShortcuts.cpp
Interface/LogWindow.cpp
Expand All @@ -182,6 +183,7 @@ SET(STUDIO_INTERFACE_SRCS
)
SET(STUDIO_INTERFACE_MOC_HDRS
Interface/CompareWidget.h
Interface/CustomSlider.h
Interface/ExportImageDialog.h
Interface/KeyboardShortcuts.h
Interface/LogWindow.h
Expand Down
2 changes: 1 addition & 1 deletion Studio/Data/DataTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void DataTool::set_session(QSharedPointer<Session> session) {
connect(session.data(), &Session::ffc_changed, this, &DataTool::update_ffc_table);
landmark_table_model_->set_session(session);

connect(ui_->ffc_brush_size_, &QSlider::valueChanged, session.data(), &Session::set_ffc_paint_size);
connect(ui_->ffc_brush_size_, &CustomSlider::valueChanged, session.data(), &Session::set_ffc_paint_size);
connect(ui_->ffc_included_mode_, &QRadioButton::toggled, session.data(), &Session::set_ffc_paint_mode_inclusive);
connect(ui_->ffc_active_, &QCheckBox::toggled, session.data(), &Session::set_ffc_paint_active);

Expand Down
22 changes: 18 additions & 4 deletions Studio/Data/DataTool.ui
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ QWidget#specificity_panel {
<rect>
<x>0</x>
<y>0</y>
<width>470</width>
<height>340</height>
<width>464</width>
<height>330</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
Expand Down Expand Up @@ -848,7 +848,7 @@ QWidget#specificity_panel {
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QSlider" name="ffc_brush_size_">
<widget class="CustomSlider" name="ffc_brush_size_">
<property name="minimum">
<number>5</number>
</property>
Expand Down Expand Up @@ -1053,7 +1053,14 @@ QWidget#specificity_panel {
</size>
</property>
<property name="html">
<string></string>
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;meta charset=&quot;utf-8&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
hr { height: 1px; border-width: 0; }
li.unchecked::marker { content: &quot;\2610&quot;; }
li.checked::marker { content: &quot;\2612&quot;; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
Expand All @@ -1078,6 +1085,13 @@ QWidget#specificity_panel {
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>CustomSlider</class>
<extends>QSlider</extends>
<header>Interface/CustomSlider.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../Resources/ShapeWorksStudio.qrc"/>
</resources>
Expand Down
2 changes: 1 addition & 1 deletion Studio/Data/PreferencesWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ PreferencesWindow::PreferencesWindow(QWidget* parent, Preferences& prefs) : pref
&PreferencesWindow::save_to_preferences);
connect(ui_->orientation_marker_corner, qOverload<int>(&QComboBox::currentIndexChanged), this,
&PreferencesWindow::save_to_preferences);
connect(ui_->geodesic_cache_multiplier, &QSlider::valueChanged, this, &PreferencesWindow::save_to_preferences);
connect(ui_->geodesic_cache_multiplier, &CustomSlider::valueChanged, this, &PreferencesWindow::save_to_preferences);
connect(ui_->color_map, qOverload<int>(&QComboBox::currentIndexChanged), this,
&PreferencesWindow::save_to_preferences);
connect(ui_->particle_colors, qOverload<int>(&QComboBox::currentIndexChanged), this,
Expand Down
13 changes: 10 additions & 3 deletions Studio/Data/PreferencesWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QSlider" name="geodesic_cache_multiplier">
<widget class="CustomSlider" name="geodesic_cache_multiplier">
<property name="minimum">
<number>0</number>
</property>
Expand Down Expand Up @@ -200,7 +200,7 @@
</widget>
</item>
<item row="1" column="2">
<widget class="QSlider" name="mesh_cache_memory">
<widget class="CustomSlider" name="mesh_cache_memory">
<property name="maximum">
<number>100</number>
</property>
Expand Down Expand Up @@ -240,7 +240,7 @@
</widget>
</item>
<item row="4" column="2">
<widget class="QSlider" name="num_threads">
<widget class="CustomSlider" name="num_threads">
<property name="minimum">
<number>1</number>
</property>
Expand Down Expand Up @@ -587,6 +587,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>CustomSlider</class>
<extends>QSlider</extends>
<header>Interface/CustomSlider.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>pca_range</tabstop>
<tabstop>pca_steps</tabstop>
Expand Down
4 changes: 2 additions & 2 deletions Studio/Data/Telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ void Telemetry::record_event(const QString& name, const QVariantMap& params) {
QString api_secret{GA_API_SECRET};

if (measurement_id.isEmpty() || api_secret.isEmpty()) {
SW_LOG("Telemetry disabled, no measurement id or api secret");
SW_LOG_ONCE("Telemetry disabled, no measurement id or api secret");
return;
}

if (!prefs_.get_telemetry_enabled()) {
SW_LOG("Telemetry disabled by preferences");
SW_LOG_ONCE("Telemetry disabled by preferences");
return;
}

Expand Down
4 changes: 2 additions & 2 deletions Studio/Groom/GroomTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ GroomTool::GroomTool(Preferences& prefs, Telemetry& telemetry) : preferences_(pr
"Set the adaptivity of remeshing, higher will allocate more triangles around areas of high curvature.");

// connect percent controls
connect(ui_->remesh_percent_slider, &QSlider::valueChanged, this,
connect(ui_->remesh_percent_slider, &CustomSlider::valueChanged, this,
[this](int value) { ui_->remesh_percent_spinbox->setValue(value); });
connect(ui_->remesh_percent_spinbox, qOverload<double>(&QDoubleSpinBox::valueChanged), this,
[=](double value) { ui_->remesh_percent_slider->setValue(static_cast<int>(value)); });

// connect gradation controls
connect(ui_->remesh_gradation_slider, &QSlider::valueChanged, this,
connect(ui_->remesh_gradation_slider, &CustomSlider::valueChanged, this,
[=](int value) { ui_->remesh_gradation_spinbox->setValue(value / 50.0); });
connect(ui_->remesh_gradation_spinbox, qOverload<double>(&QDoubleSpinBox::valueChanged), this,
[=](double value) { ui_->remesh_gradation_slider->setValue(static_cast<int>(value * 50.0)); });
Expand Down
11 changes: 9 additions & 2 deletions Studio/Groom/GroomTool.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ QWidget#domain_panel {
</widget>
</item>
<item row="3" column="1">
<widget class="QSlider" name="remesh_gradation_slider">
<widget class="CustomSlider" name="remesh_gradation_slider">
<property name="maximum">
<number>100</number>
</property>
Expand All @@ -1620,7 +1620,7 @@ QWidget#domain_panel {
</widget>
</item>
<item row="1" column="1">
<widget class="QSlider" name="remesh_percent_slider">
<widget class="CustomSlider" name="remesh_percent_slider">
<property name="maximum">
<number>100</number>
</property>
Expand Down Expand Up @@ -2013,6 +2013,13 @@ QWidget#domain_panel {
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>CustomSlider</class>
<extends>QSlider</extends>
<header>Interface/CustomSlider.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mesh_fill_holes</tabstop>
<tabstop>mesh_smooth</tabstop>
Expand Down
2 changes: 1 addition & 1 deletion Studio/Interface/CompareWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CompareWidget::CompareWidget(QWidget *parent) : QWidget(parent), ui_(new Ui::Com
connect(ui_->original, &QCheckBox::toggled, this, &CompareWidget::settings_changed);
connect(ui_->groomed, &QCheckBox::toggled, this, &CompareWidget::settings_changed);
connect(ui_->reconstructed, &QCheckBox::toggled, this, &CompareWidget::settings_changed);
connect(ui_->opacity, &QSlider::valueChanged, this, &CompareWidget::settings_changed);
connect(ui_->opacity, &CustomSlider::valueChanged, this, &CompareWidget::settings_changed);
connect(ui_->mean_shape, &QCheckBox::toggled, this, &CompareWidget::settings_changed);
}

Expand Down
11 changes: 9 additions & 2 deletions Studio/Interface/CompareWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<x>0</x>
<y>0</y>
<width>470</width>
<height>159</height>
<height>172</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="8" column="1">
<widget class="QSlider" name="opacity">
<widget class="CustomSlider" name="opacity">
<property name="maximum">
<number>100</number>
</property>
Expand Down Expand Up @@ -74,6 +74,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>CustomSlider</class>
<extends>QSlider</extends>
<header>Interface/CustomSlider.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Loading

0 comments on commit a9f6733

Please sign in to comment.