Skip to content

Commit

Permalink
Blender LDraw Render - reset to last or default settings #416
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorsandy committed May 12, 2023
1 parent 4e198d1 commit 7f518f7
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 44 deletions.
2 changes: 1 addition & 1 deletion builds/linux/obs/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Last Update: July 19, 2020
# Copyright (C) 2017 - 2023 by Trevor SANDY
pkgname=lpub3d
pkgver=2.4.6.3374
pkgver=2.4.6.3375
pkgrel=1
pkgdesc="An LDraw Building Instruction Editor"
url="https://github.com/trevorsandy/lpub3d.git"
Expand Down
2 changes: 1 addition & 1 deletion builds/linux/obs/alldeps/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Last Update: July 19, 2020
# Copyright (C) 2017 - 2023 by Trevor SANDY
pkgname=lpub3d
pkgver=2.4.6.3374
pkgver=2.4.6.3375
pkgrel=1
pkgdesc="An LDraw Building Instruction Editor"
url="https://github.com/trevorsandy/lpub3d.git"
Expand Down
6 changes: 3 additions & 3 deletions builds/linux/obs/alldeps/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lpub3d (2.4.6.3374) debian; urgency=medium
lpub3d (2.4.6.3375) debian; urgency=medium

* LPub3D version 2.4.6.263.3374_20230512 for Linux
* LPub3D version 2.4.6.264.3375_20230512 for Linux

-- Trevor SANDY <[email protected]> Fri, 12 May 2023 06:02:38 +0200
-- Trevor SANDY <[email protected]> Fri, 12 May 2023 06:03:07 +0200
2 changes: 1 addition & 1 deletion builds/linux/obs/alldeps/debian/lpub3d.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Format: 1.0
Source: lpub3d
Binary: lpub3d
Architecture: any
Version: 2.4.6.3374
Version: 2.4.6.3375
Maintainer: Trevor SANDY <[email protected]>
Homepage: https://trevorsandy.github.io/lpub3d/
Standards-Version: 3.9.7
Expand Down
4 changes: 2 additions & 2 deletions builds/linux/obs/alldeps/lpub3d.spec
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ BuildRequires: fdupes
Summary: An LDraw Building Instruction Editor
Name: lpub3d
Icon: lpub3d.xpm
Version: 2.4.6.3374
Version: 2.4.6.3375
Release: <B_CNT>%{?dist}
URL: https://trevorsandy.github.io/lpub3d
Vendor: Trevor SANDY
Expand Down Expand Up @@ -797,7 +797,7 @@ update-desktop-database || true
%endif

%changelog
* Fri May 12 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3374
* Fri May 12 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3375
- LPub3D 2.4.4 enhancements and fixes - see RELEASE_NOTES for details

* Tue May 31 2022 - trevor dot sandy at gmail dot com 2.4.4.2670
Expand Down
6 changes: 3 additions & 3 deletions builds/linux/obs/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lpub3d (2.4.6.3374) debian; urgency=medium
lpub3d (2.4.6.3375) debian; urgency=medium

* LPub3D version 2.4.6.263.3374_20230512 for Linux
* LPub3D version 2.4.6.264.3375_20230512 for Linux

-- Trevor SANDY <[email protected]> Fri, 12 May 2023 06:02:39 +0200
-- Trevor SANDY <[email protected]> Fri, 12 May 2023 06:03:09 +0200
2 changes: 1 addition & 1 deletion builds/linux/obs/debian/lpub3d.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Format: 1.0
Source: lpub3d
Binary: lpub3d
Architecture: any
Version: 2.4.6.3374
Version: 2.4.6.3375
Maintainer: Trevor SANDY <[email protected]>
Homepage: https://trevorsandy.github.io/lpub3d/
Standards-Version: 3.9.7
Expand Down
4 changes: 2 additions & 2 deletions builds/linux/obs/lpub3d.spec
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ BuildRequires: fdupes
Summary: An LDraw Building Instruction Editor
Name: lpub3d
Icon: lpub3d.xpm
Version: 2.4.6.3374
Version: 2.4.6.3375
Release: 1%{?dist}
URL: https://trevorsandy.github.io/lpub3d
Vendor: Trevor SANDY
Expand Down Expand Up @@ -313,7 +313,7 @@ update-desktop-database || true
%endif

%changelog
* Fri May 12 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3374
* Fri May 12 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3375
- LPub3D 2.4.4 enhancements and fixes - see RELEASE_NOTES for details

* Tue May 31 2022 - trevor dot sandy at gmail dot com 2.4.4.2670
Expand Down
2 changes: 1 addition & 1 deletion builds/utilities/version.info
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2 4 6 263 3374 90611a0b9
2 4 6 264 3375 4e198d1ac
6 changes: 3 additions & 3 deletions gitversion.pri
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ equals(GIT_DIR, undefined) {

# Check if we do not have a valid version number (i.e. no version tag found)
isEmpty(GIT_VERSION) {
GIT_REVISION = 263
GIT_REVISION = 264
GIT_SHA = $$system($$GIT_BASE_COMMAND rev-parse --short HEAD 2> $$NULL_DEVICE)
GIT_COMMIT = $$system($$GIT_BASE_COMMAND rev-list --count HEAD 2> $$NULL_DEVICE)
GIT_VERSION = v$${VERSION}-$${GIT_REVISION}-$${GIT_SHA}
Expand Down Expand Up @@ -69,7 +69,7 @@ equals(GIT_DIR, undefined) {
# Get commit count
GIT_COMMIT = $$system($$GIT_BASE_COMMAND rev-list --count HEAD 2> $$NULL_DEVICE)
isEmpty(GIT_COMMIT) {
GIT_COMMIT = 3374
GIT_COMMIT = 3375
message("~~~ ERROR! GIT_COMMIT NOT DEFINED, USING $$GIT_COMMIT ~~~")
}

Expand Down Expand Up @@ -117,7 +117,7 @@ if (equals(USE_GIT_VER_FILE, true)|equals(USE_VERSION_INFO_VAR, true)) {
GIT_VERSION = $$cat($$GIT_VER_FILE, lines)
} else {
message("~~~ ERROR! $$GIT_DIR_ENV VERSION_INFO FILE $$GIT_VER_FILE NOT FOUND ~~~")
GIT_VERSION = $${VERSION}.263.3374.90611a0b9
GIT_VERSION = $${VERSION}.264.3375.4e198d1ac
message("~~~ GIT_DIR [$$GIT_DIR_ENV, USING VERSION] $$GIT_VERSION ~~~")
GIT_VERSION ~= s/\./" "
}
Expand Down
73 changes: 54 additions & 19 deletions mainApp/blenderpreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ BlenderPreferencesDialog::BlenderPreferencesDialog(

mResetButton = new QPushButton(tr("Reset"), buttonBox);
mResetButton->setEnabled(false);
mResetButton->setToolTip(tr("Reset addon paths and settings preferences to system defaults"));
mResetButton->setToolTip(tr("Reset addon paths and settings preferences"));
buttonBox->addButton(mResetButton,QDialogButtonBox::ActionRole);
connect(mResetButton,SIGNAL(clicked()),this,SLOT(resetSettings()));

Expand Down Expand Up @@ -2069,6 +2069,41 @@ bool BlenderPreferences::settingsModified(bool update, const QString &module)

void BlenderPreferences::resetSettings()
{
BlenderPaths const *paths = mBlenderPaths;
BlenderSettings const *settings = mBlenderSettings;
BlenderSettings const *settingsMM = mBlenderSettingsMM;

QDialog *dlg = new QDialog(this);
dlg->setWindowTitle(tr("Addon Reset"));
dlg->setWhatsThis(tr("Select how to reset settings. Choice is since last apply or system default."));
QVBoxLayout *layout = new QVBoxLayout(dlg);
QGroupBox *dlgGroup = new QGroupBox(dlg);
QHBoxLayout *dlgLayout = new QHBoxLayout(dlgGroup);
QRadioButton *lastBtn = new QRadioButton(tr("Last Apply"));
dlgLayout->addWidget(lastBtn);
QRadioButton *defaultBtn = new QRadioButton(tr("System Default"));
dlgLayout->addWidget(defaultBtn);
dlgGroup->setLayout(dlgLayout);
layout->addWidget(dlgGroup);
dlg->setLayout(layout);

lastBtn->setChecked(true);

QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, dlg);
layout->addWidget(&buttonBox);
connect(&buttonBox, SIGNAL(accepted()), dlg, SLOT(accept()));
connect(&buttonBox, SIGNAL(rejected()), dlg, SLOT(reject()));

if (dlg->exec() == QDialog::Accepted) {
if (defaultBtn->isChecked()) {
qInfo() << "DEBUG : Default Button Selected";
paths = mDefaultPaths;
settings = mDefaultSettings;
settingsMM = mDefaultSettingsMM;
}
}

mConfigured = !Preferences::blenderImportModule.isEmpty();

mBlenderPaths[LBL_BLENDER_PATH].value = Preferences::blenderExe;
Expand All @@ -2081,13 +2116,13 @@ void BlenderPreferences::resetSettings()
if (mImportActBox->isChecked()) {
disconnect(mLineEditList[IMAGE_HEIGHT_EDIT],SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));
disconnect(mLineEditList[IMAGE_WIDTH_EDIT],SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));
disconnect(mLineEditList[IMAGE_WIDTH_EDIT], SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));

for(int i = 0; i < numSettings(); i++) {
if (i < LBL_BEVEL_WIDTH) {
for(int j = 0; j < mCheckBoxList.size(); j++) {
mCheckBoxList[j]->setChecked(mBlenderSettings[i].value.toInt());
mCheckBoxList[j]->setChecked(settings[i].value.toInt());
if (i < LBL_VERBOSE)
i++;
}
Expand All @@ -2100,39 +2135,39 @@ void BlenderPreferences::resetSettings()
else if (j == RENDER_PERCENTAGE_EDIT)
mLineEditList[j]->setText(QString::number(mRenderPercentage * 100));
else if (j == DEFAULT_COLOUR_EDIT)
setDefaultColor(lcGetColorIndex(mBlenderSettings[LBL_DEFAULT_COLOUR].value.toInt()));
setDefaultColor(lcGetColorIndex(settings[LBL_DEFAULT_COLOUR].value.toInt()));
else
mLineEditList[j]->setText(mBlenderSettings[i].value);
mLineEditList[j]->setText(settings[i].value);
if (i < LBL_RENDER_PERCENTAGE)
i++;
}
} else {
for(int j = 0; j < mComboBoxList.size(); j++) {
mComboBoxList[j]->setCurrentIndex(int(mComboBoxList[j]->findData(QVariant::fromValue(mBlenderSettings[i].value))));
mComboBoxList[j]->setCurrentIndex(int(mComboBoxList[j]->findData(QVariant::fromValue(settings[i].value))));
i++;
}
}
}
for (int i = 0; i < numPaths(); i++) {
mPathLineEditList[i]->setText(mBlenderPaths[i].value);
mPathLineEditList[i]->setText(paths[i].value);
}

connect(mLineEditList[IMAGE_HEIGHT_EDIT],SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));
connect(mLineEditList[IMAGE_WIDTH_EDIT],SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));
connect(mLineEditList[IMAGE_WIDTH_EDIT], SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));

} else if (mImportMMActBox->isChecked()) {

disconnect(mLineEditList[RESOLUTION_HEIGHT_EDIT],SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));
disconnect(mLineEditList[RESOLUTION_WIDTH_EDIT],SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));
disconnect(mLineEditList[RESOLUTION_WIDTH_EDIT], SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));

for(int i = 0; i < numSettingsMM(); i++) {
if (i < LBL_CAMERA_BORDER_PERCENT_MM) {
for(int j = 0; j < mCheckBoxList.size(); j++) {
mCheckBoxList[j]->setChecked(mBlenderSettingsMM[i].value.toInt());
mCheckBoxList[j]->setChecked(settingsMM[i].value.toInt());
if (i < LBL_VERBOSE_MM)
i++;
}
Expand All @@ -2145,28 +2180,28 @@ void BlenderPreferences::resetSettings()
else if (j == RENDER_PERCENTAGE_EDIT_MM)
mLineEditList[j]->setText(QString::number(mRenderPercentage * 100));
else
mLineEditList[j]->setText(mBlenderSettingsMM[i].value);
mLineEditList[j]->setText(settingsMM[i].value);
if (i < LBL_STARTING_STEP_FRAME)
i++;
}
} else {
for(int j = 0; j < mComboBoxList.size(); j++) {
mComboBoxList[j]->setCurrentIndex(int(mComboBoxList[j]->findData(QVariant::fromValue(mBlenderSettingsMM[i].value))));
mComboBoxList[j]->setCurrentIndex(int(mComboBoxList[j]->findData(QVariant::fromValue(settingsMM[i].value))));
i++;
}
}
}
for (int i = 0; i < numPaths(); i++) {
mPathLineEditList[i]->setText(mBlenderPaths[i].value);
mPathLineEditList[i]->setText(paths[i].value);
}

connect(mLineEditList[RESOLUTION_HEIGHT_EDIT],SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));
connect(mLineEditList[RESOLUTION_WIDTH_EDIT],SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));
connect(mLineEditList[RESOLUTION_WIDTH_EDIT], SIGNAL(textChanged(const QString &)),
this, SLOT (sizeChanged(const QString &)));
}

emit settingChangedSig(false/*change*/);
emit settingChangedSig(true/*change*/);
}

void BlenderPreferences::loadSettings()
Expand Down
5 changes: 3 additions & 2 deletions mainApp/commonmenus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4115,8 +4115,9 @@ void CommonMenus::setWhatsThis()
" - Apply: apply the addon path and setting preferences.\n"
" - Show/Hide Paths: show or hide the addon paths\n"
" display box.\n"
" - Reset: reset the addon path and setting preferences\n"
" to the system defult values.\n\n"
" - Reset: reset the addon path and setting preferences.\n"
" You can select how to reset addon settings.\n"
" The choice is since last apply or system default.\n\n"
" You can see the specific description of each setting\n"
" if you hover over the setting to display its tooltip.\n"
" Use the dialogue window scroll bar to access the\n"
Expand Down
2 changes: 1 addition & 1 deletion mainApp/docs/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LPub3D 2.4.6.263.3374 (12 05 2023 06:02:39)
LPub3D 2.4.6.264.3375 (12 05 2023 06:03:09)

Features, enhancements, fixes and changes
------------
Expand Down
2 changes: 1 addition & 1 deletion mainApp/docs/RELEASE_NOTES.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<table class="tg">
<tr>
<th class="tg-0pky">
<h4><a id="LPub3D_0"></a>LPub3D 2.4.6.263.3374 (12 05 2023 06:02:39)</h4>
<h4><a id="LPub3D_0"></a>LPub3D 2.4.6.264.3375 (12 05 2023 06:03:09)</h4>
<hr>
<p>
<span class="tg-1pky">LPub3D Official release.</span><br>
Expand Down
4 changes: 2 additions & 2 deletions mainApp/extras/LPub3D_Npp_UDL.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
;;
;; Author......: Trevor SANDY
;; Name........: LPub3D_Npp_UDL.xml
;; Version.....: 2.4.6.263.3374
;; Last Update.: Fri, 12 May 2023 06:02:39 +0200
;; Version.....: 2.4.6.264.3375
;; Last Update.: Fri, 12 May 2023 06:03:09 +0200
;; License.....: GPLv3
;; Homepage....: https://trevorsandy.github.io/lpub3d
;; Copyright (C) 2021 - 2023 by Trevor SANDY
Expand Down
2 changes: 1 addition & 1 deletion mainApp/preferencesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ void PreferencesDialog::setBlenderAddonPreferences()
connect(blenderAddonPathsButton,SIGNAL(clicked()),this,SLOT(showBlenderAddonPaths()));

blenderAddonResetButton = new QPushButton(tr("Reset"), buttonBox);
blenderAddonResetButton->setToolTip(tr("Reset addon paths and settings preferences to system defaults"));
blenderAddonResetButton->setToolTip(tr("Reset addon paths and settings preferences"));
blenderAddonResetButton->setEnabled(false);
buttonBox->addButton(blenderAddonResetButton,QDialogButtonBox::ActionRole);
connect(blenderAddonResetButton,SIGNAL(clicked()),this,SLOT(resetBlenderAddonPreferences()));
Expand Down

0 comments on commit 7f518f7

Please sign in to comment.