Skip to content

Commit

Permalink
Refactor Blender integration - LPub3D LDraw addon version update #416
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorsandy committed Jan 26, 2023
1 parent 2fe8641 commit f9549e9
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 54 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.3127
pkgver=2.4.6.3128
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.3127
pkgver=2.4.6.3128
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.3127) debian; urgency=medium
lpub3d (2.4.6.3128) debian; urgency=medium

* LPub3D version 2.4.6.16.3127_20230126 for Linux
* LPub3D version 2.4.6.17.3128_20230126 for Linux

-- Trevor SANDY <trevor.sandy@gmail.com> Thu, 26 Jan 2023 03:23:42 +0100
-- Trevor SANDY <trevor.sandy@gmail.com> Thu, 26 Jan 2023 03:25:16 +0100
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.3127
Version: 2.4.6.3128
Maintainer: Trevor SANDY <trevor.sandy@gmail.com>
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.3127
Version: 2.4.6.3128
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
* Thu Jan 26 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3127
* Thu Jan 26 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3128
- 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.3127) debian; urgency=medium
lpub3d (2.4.6.3128) debian; urgency=medium

* LPub3D version 2.4.6.16.3127_20230126 for Linux
* LPub3D version 2.4.6.17.3128_20230126 for Linux

-- Trevor SANDY <trevor.sandy@gmail.com> Thu, 26 Jan 2023 03:23:43 +0100
-- Trevor SANDY <trevor.sandy@gmail.com> Thu, 26 Jan 2023 03:25:17 +0100
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.3127
Version: 2.4.6.3128
Maintainer: Trevor SANDY <trevor.sandy@gmail.com>
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.3127
Version: 2.4.6.3128
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
* Thu Jan 26 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3127
* Thu Jan 26 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3128
- 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 16 3127 60f0d825f
2 4 6 17 3128 2fe86412b
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 = 16
GIT_REVISION = 17
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 = 3127
GIT_COMMIT = 3128
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}.16.3127.60f0d825f
GIT_VERSION = $${VERSION}.17.3128.2fe86412b
message("~~~ GIT_DIR [$$GIT_DIR_ENV, USING VERSION] $$GIT_VERSION ~~~")
GIT_VERSION ~= s/\./" "
}
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.16.3127 (26 01 2023 03:23:43)
LPub3D 2.4.6.17.3128 (26 01 2023 03:25:17)

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 @@ -17,7 +17,7 @@
<table class="tg">
<tr>
<th class="tg-0pky">
<h4><a id="LPub3D_0"></a>LPub3D 2.4.6.16.3127 (26 01 2023 03:23:43)</h4>
<h4><a id="LPub3D_0"></a>LPub3D 2.4.6.17.3128 (26 01 2023 03:25:17)</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.16.3127
;; Last Update.: Thu, 26 Jan 2023 03:23:43 +0100
;; Version.....: 2.4.6.17.3128
;; Last Update.: Thu, 26 Jan 2023 03:25:17 +0100
;; License.....: GPLv3
;; Homepage....: https://trevorsandy.github.io/lpub3d
;; Copyright (C) 2021 - 2023 by Trevor SANDY
Expand Down
79 changes: 49 additions & 30 deletions mainApp/metagui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8758,6 +8758,7 @@ void POVRayRenderDialogGui::textChanged(const QString &value)
**********************************************************************/
bool BlenderRenderDialogGui::documentRender = false;
QString BlenderRenderDialogGui::blenderVersion;
QString BlenderRenderDialogGui::blenderAddOnVersion;
QString BlenderRenderDialogGui::searchDirectoriesKey = QString("additionalSearchDirectories");
QString BlenderRenderDialogGui::parameterFileKey = QString("parameterFile");

Expand Down Expand Up @@ -8881,27 +8882,36 @@ void BlenderRenderDialogGui::getRenderSettings(
QGroupBox *blenderVersionBox = new QGroupBox(QString(),blenderContent);
blenderForm->addRow(blenderVersionBox);

blenderVersionHLayout = new QHBoxLayout(blenderVersionBox);
blenderVersionBox->setLayout(blenderVersionHLayout);
blenderVersionGridLayout = new QGridLayout(blenderVersionBox);
blenderVersionBox->setLayout(blenderVersionGridLayout);

blenderLabel = new QLabel(blenderContent);
blenderVersionHLayout->addWidget(blenderLabel);
blenderVersionLabel = new QLabel(blenderContent);
blenderVersionGridLayout->addWidget(blenderVersionLabel,0,0);

blenderVersionEdit = new QLineEdit(blenderContent);
blenderVersionEdit->setPalette(ReadOnlyPalette);
blenderVersionEdit->setReadOnly(true);
blenderVersionHLayout->addWidget(blenderVersionEdit);
blenderVersionGridLayout->addWidget(blenderVersionEdit,0,1);
blenderAddOnVersionLabel = new QLabel(tr("%1 AddOn Version").arg(VER_PRODUCTNAME_STR), blenderContent);
blenderVersionGridLayout->addWidget(blenderAddOnVersionLabel,1,0);
blenderAddOnVersionEdit = new QLineEdit(blenderContent);
blenderAddOnVersionEdit->setPalette(ReadOnlyPalette);
blenderAddOnVersionEdit->setReadOnly(true);
blenderVersionGridLayout->addWidget(blenderAddOnVersionEdit,1,1);

if (mBlenderConfigured){
blenderLabel->setText(tr("Blender Version"));
blenderVersionEdit->setText(Preferences::blenderVersion);
blenderVersionLabel->setText(tr("Blender Version"));
blenderVersionEdit->setText(blenderVersion);
if (!blenderAddOnVersion.isEmpty())
blenderAddOnVersionEdit->setText(blenderAddOnVersion);
} else {
if (Preferences::displayTheme == THEME_DARK) {
const QString themeColor = Preferences::themeColors[THEME_DARK_DECORATE_LPUB3D_QUOTED_TEXT];
blenderLabel->setStyleSheet("QLabel { color : " + themeColor + "; }");
blenderVersionLabel->setStyleSheet("QLabel { color : " + themeColor + "; }");
} else {
blenderLabel->setStyleSheet("QLabel { color : blue; }");
blenderVersionLabel->setStyleSheet("QLabel { color : blue; }");
}
blenderLabel->setText(tr("Blender not configured"));
blenderVersionLabel->setText(tr("Blender not configured"));
blenderVersionEdit->setVisible(mBlenderConfigured);
}

Expand Down Expand Up @@ -9169,10 +9179,13 @@ bool BlenderRenderDialogGui::settingsModified(int &width, int &height, double &s

void BlenderRenderDialogGui::resetSettings()
{
blenderVersion = Preferences::blenderVersion;
blenderPaths[LBL_BLENDER_PATH].value = Preferences::blenderExe;
const QStringList versionItems = Preferences::blenderVersion.split("|");
blenderVersion = versionItems.first();
blenderAddOnVersion = versionItems.size() == 2 ? versionItems.last() : QString();

blenderVersionEdit->setText(blenderVersion);
blenderAddOnVersionEdit->setText(blenderAddOnVersion);

mBlenderConfigured = !Preferences::blenderExe.isEmpty() && !Preferences::blenderRenderConfigFile.isEmpty();;

Expand Down Expand Up @@ -9286,22 +9299,24 @@ void BlenderRenderDialogGui::loadSettings(){
}
}

blenderVersion = Preferences::blenderVersion;
blenderPaths[LBL_BLENDER_PATH].value = Preferences::blenderExe;
const QStringList versionItems = Preferences::blenderVersion.split("|");
blenderVersion = versionItems.first();
blenderAddOnVersion = versionItems.size() == 2 ? versionItems.last() : QString();
}

void BlenderRenderDialogGui::saveSettings()
{
if (!numSettings())
loadSettings();

QString label;
// QString label;
// label = blenderPaths[LBL_BLENDER_PATH].label;
QString value = blenderPaths[LBL_BLENDER_PATH].value;
Preferences::setBlenderExePathPreference(value);

// label = "Blender Version";
value = blenderVersion;
value = QString("%1|%2").arg(blenderVersion).arg(blenderAddOnVersion);
Preferences::setBlenderVersionPreference(value);

QString blenderConfigFile;
Expand Down Expand Up @@ -9593,8 +9608,8 @@ void BlenderRenderDialogGui::configureBlender()
if (blenderFile.isEmpty()) {
blenderVersion.clear();
mBlenderConfigured = false;
blenderLabel->setStyleSheet("QLabel { color : blue; }");
blenderLabel->setText(tr("Blender not configured"));
blenderVersionLabel->setStyleSheet("QLabel { color : blue; }");
blenderVersionLabel->setText(tr("Blender not configured"));
blenderVersionEdit->setVisible(mBlenderConfigured);
blenderPathEditAction->setEnabled(mBlenderConfigured);
blenderPathsBox->setEnabled(mBlenderConfigured);
Expand Down Expand Up @@ -9626,17 +9641,19 @@ void BlenderRenderDialogGui::configureBlender()
// Download and extract blender addon
if (!extractBlenderAddon(blenderDir)) {
if (mBlenderAddonUpdate) {
blenderVersionHLayout->replaceWidget(progressBar, blenderVersionEdit);
blenderVersionGridLayout->replaceWidget(progressBar, blenderVersionEdit);
mBlenderConfigured = true;
mBlenderAddonUpdate = !mBlenderConfigured;
blenderLabel->setText(tr("Blender Version"));
blenderVersionLabel->setText(tr("Blender Version"));
if (Preferences::displayTheme == THEME_DARK)
blenderLabel->setStyleSheet("QLabel { color : white ; }");
blenderVersionLabel->setStyleSheet("QLabel { color : white ; }");
else
blenderLabel->setStyleSheet("QLabel { color : black; }");
blenderVersionEdit->setText(Preferences::blenderVersion);
blenderVersionLabel->setStyleSheet("QLabel { color : black; }");
blenderVersionEdit->setText(blenderVersion);
blenderVersionEdit->setToolTip(tr("Display the Blender and %1 Render addon version").arg(VER_PRODUCTNAME_STR));
blenderVersionEdit->setVisible(mBlenderConfigured);
if (!blenderAddOnVersion.isEmpty())
blenderAddOnVersionEdit->setText(blenderAddOnVersion);
blenderPathEditAction->setEnabled(mBlenderConfigured);
} else {
statusUpdate();
Expand Down Expand Up @@ -9712,15 +9729,15 @@ void BlenderRenderDialogGui::statusUpdate(bool ok, const QString &message)
colour = "black";
} else {
if (progressBar) {
blenderVersionHLayout->replaceWidget(progressBar, blenderVersionEdit);
blenderVersionGridLayout->replaceWidget(progressBar, blenderVersionEdit);
progressBar->close();
}
pathLineEditList[LBL_BLENDER_PATH]->text() = QString();
label = ! message.isEmpty() ? message : tr("Blender not configured");
colour = message.startsWith("Error:", Qt::CaseInsensitive) ? "red" : "blue";
}
blenderLabel->setText(label);
blenderLabel->setStyleSheet(QString("QLabel { color : %1; }").arg(colour));
blenderVersionLabel->setText(label);
blenderVersionLabel->setStyleSheet(QString("QLabel { color : %1; }").arg(colour));
}

void BlenderRenderDialogGui::update()
Expand Down Expand Up @@ -9805,7 +9822,7 @@ void BlenderRenderDialogGui::readStdOut()
} else if (stdOutLine.contains(rxAddonVersion)) {
// Get Addon version
items = stdOutLine.split(":");
blenderVersion.append(", LDraw Addon v"+items.at(1).trimmed()); // 1 addon version
blenderAddOnVersion = tr("LDraw Addon v%1").arg(items.at(1).trimmed()); // 1 addon version
}
}
}
Expand Down Expand Up @@ -9900,18 +9917,20 @@ void BlenderRenderDialogGui::showResult()
statusUpdate(false, tr("%1: Addon install failed.").arg("Error"));
showMessage(StdErrLog);
} else {
blenderVersionHLayout->replaceWidget(progressBar, blenderVersionEdit);
blenderVersionGridLayout->replaceWidget(progressBar, blenderVersionEdit);
message = tr("Blender version %1").arg(blenderVersion);
mBlenderConfigured = true;
mBlenderAddonUpdate = !mBlenderConfigured;
blenderLabel->setText(tr("Blender Version"));
blenderVersionLabel->setText(tr("Blender Version"));
if (Preferences::displayTheme == THEME_DARK)
blenderLabel->setStyleSheet("QLabel { color : white ; }");
blenderVersionLabel->setStyleSheet("QLabel { color : white ; }");
else
blenderLabel->setStyleSheet("QLabel { color : black; }");
blenderVersionLabel->setStyleSheet("QLabel { color : black; }");
blenderVersionEdit->setText(blenderVersion);
blenderVersionEdit->setToolTip(tr("Display the Blender and %1 Render addon version").arg(VER_PRODUCTNAME_STR));
blenderVersionEdit->setVisible(mBlenderConfigured);
if (!blenderAddOnVersion.isEmpty())
blenderAddOnVersionEdit->setText(blenderAddOnVersion);
blenderPathEditAction->setEnabled(mBlenderConfigured);
blenderPathsBox->setEnabled(mBlenderConfigured);
blenderSettingsBox->setEnabled(mBlenderConfigured);
Expand Down Expand Up @@ -9985,7 +10004,7 @@ int BlenderRenderDialogGui::getBlenderAddon(const QString &blenderDir)
}
}

blenderRenderDialog->blenderVersionHLayout->replaceWidget(blenderRenderDialog->blenderVersionEdit, blenderRenderDialog->progressBar);
blenderRenderDialog->blenderVersionGridLayout->replaceWidget(blenderRenderDialog->blenderVersionEdit, blenderRenderDialog->progressBar);
blenderRenderDialog->progressBar->show();

QDir dir(blenderAddonDir);
Expand Down
7 changes: 5 additions & 2 deletions mainApp/metagui.h
Original file line number Diff line number Diff line change
Expand Up @@ -2354,12 +2354,14 @@ public slots:
private:
QFormLayout *blenderForm;
QWidget *blenderContent;
QHBoxLayout *blenderVersionHLayout;
QGridLayout *blenderVersionGridLayout;

QGroupBox *blenderPathsBox;
QGroupBox *blenderSettingsBox;
QLineEdit *blenderVersionEdit;
QLabel *blenderLabel;
QLabel *blenderVersionLabel;
QLabel *blenderAddOnVersionLabel;
QLineEdit *blenderAddOnVersionEdit;

QDialog *dialog;
QProgressBar *progressBar;
Expand Down Expand Up @@ -2513,6 +2515,7 @@ public slots:

static bool documentRender;
static QString blenderVersion;
static QString blenderAddOnVersion;
static QString searchDirectoriesKey;
static QString parameterFileKey;

Expand Down

0 comments on commit f9549e9

Please sign in to comment.