Skip to content

Commit

Permalink
Blender LDraw Render - online version check #416
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorsandy committed May 8, 2023
1 parent 12852b9 commit 21f017b
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 62 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.3356
pkgver=2.4.6.3357
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.3356
pkgver=2.4.6.3357
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.3356) debian; urgency=medium
lpub3d (2.4.6.3357) debian; urgency=medium

* LPub3D version 2.4.6.245.3356_20230508 for Linux
* LPub3D version 2.4.6.246.3357_20230508 for Linux

-- Trevor SANDY <[email protected]> Mon, 08 May 2023 15:21:17 +0200
-- Trevor SANDY <[email protected]> Mon, 08 May 2023 15:21:45 +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.3356
Version: 2.4.6.3357
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.3356
Version: 2.4.6.3357
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
* Mon May 08 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3356
* Mon May 08 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3357
- 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.3356) debian; urgency=medium
lpub3d (2.4.6.3357) debian; urgency=medium

* LPub3D version 2.4.6.245.3356_20230508 for Linux
* LPub3D version 2.4.6.246.3357_20230508 for Linux

-- Trevor SANDY <[email protected]> Mon, 08 May 2023 15:21:19 +0200
-- Trevor SANDY <[email protected]> Mon, 08 May 2023 15:21:46 +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.3356
Version: 2.4.6.3357
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.3356
Version: 2.4.6.3357
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
* Mon May 08 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3356
* Mon May 08 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3357
- 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 245 3356 be53647c3
2 4 6 246 3357 12852b9b5
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 = 245
GIT_REVISION = 246
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 = 3356
GIT_COMMIT = 3357
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}.245.3356.be53647c3
GIT_VERSION = $${VERSION}.246.3357.12852b9b5
message("~~~ GIT_DIR [$$GIT_DIR_ENV, USING VERSION] $$GIT_VERSION ~~~")
GIT_VERSION ~= s/\./" "
}
Expand Down
78 changes: 47 additions & 31 deletions mainApp/blenderpreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ void BlenderPreferences::saveSettings()
: Preferences::blenderPreferencesFile;
else
value = Preferences::blenderLDrawConfigFile.isEmpty()
? QString("%1/%2").arg(Preferences::blenderConfigDir).arg(VER_BLENDER_RENDER_CONFIG_FILE)
? QString("%1/%2").arg(Preferences::blenderConfigDir).arg(VER_BLENDER_ADDON_CONFIG_FILE)
: Preferences::blenderLDrawConfigFile;
Preferences::setBlenderLDrawConfigPreference(value);

Expand Down Expand Up @@ -1866,7 +1866,7 @@ bool BlenderPreferences::extractBlenderAddon(const QString &blenderDir)

bool const addonExists = QFileInfo(blenderAddonFile).exists() && QFileInfo(blenderAddonFile).size();

if ((AddOnUpdate == ADD_ON_FAIL && !addonExists) || AddOnUpdate == ADD_ON_CANCEL)
if ((AddOnUpdate == BLENDER_ADDON_FAIL && !addonExists) || AddOnUpdate == BLENDER_ADDON_CANCEL)
return false;

// Extract Blender addon
Expand All @@ -1893,35 +1893,51 @@ int BlenderPreferences::getBlenderAddon(const QString &blenderDir)
{
QString const blenderAddonDir = QDir::toNativeSeparators(QString("%1/addons").arg(blenderDir));
QString const blenderAddonFile = QDir::toNativeSeparators(QString("%1/%2").arg(blenderDir).arg(VER_BLENDER_ADDON_FILE));
BlenderAddOnUpdate AddOnUpdate = ADD_ON_DOWNLOAD;
BlenderAddOnUpdate AddOnUpdate = BLENDER_ADDON_DOWNLOAD;

if (QFileInfo(blenderAddonFile).exists()) {
if (Preferences::modeGUI) {
QPixmap _icon = QPixmap(":/icons/lpub96.png");
if (_icon.isNull())
_icon = QPixmap (":/icons/update.png");
QMessageBox box;
box.setWindowIcon(QIcon());
box.setIconPixmap (_icon);
box.setTextFormat (Qt::RichText);
box.setWindowTitle(tr ("%1 Blender LDraw Addon").arg(VER_PRODUCTNAME_STR));
box.setWindowFlags (Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
QString title = tr ("An existing %1 Blender LDraw addon archive file was detected.").arg(VER_PRODUCTNAME_STR);
box.setText (title);
QString text = tr ("Do you want to download the latest addon archive file ?");
box.setInformativeText (text);
box.setStandardButtons (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
box.setDefaultButton (QMessageBox::Yes);
int execReturn = box.exec();
if (execReturn == QMessageBox::Cancel) {
blenderPreferences->mDialogCancelled = true;
blenderPreferences->statusUpdate(true, tr("Cancelled"));
return static_cast<int>(ADD_ON_CANCEL);
} else if (execReturn == QMessageBox::No) {
auto getBlenderAddonVersion = [&] ()
{
lpub->downloadFile(VER_BLENDER_ADDON_LATEST_URL, tr("Latest Addon"),false/*promptRedirect*/,false/*showProgress*/);
QByteArray response_data = lpub->getDownloadedFile();
if (!response_data.isEmpty()) {
QJsonDocument json = QJsonDocument::fromJson(response_data);
return json[0]["tag_name"].toString();
}
return QString("");
};

if (Preferences::modeGUI) {
if (QFileInfo(blenderAddonFile).exists()) {
if (getBlenderAddonVersion() == Preferences::blenderAddonVersion) {
blenderPreferences->statusUpdate(true, tr("Installing Blender addon..."));
AddOnUpdate = ADD_ON_RELOAD;
AddOnUpdate = BLENDER_ADDON_RELOAD;
} else {
blenderPreferences->statusUpdate(true, tr("Downloading Blender addon..."));
QPixmap _icon = QPixmap(":/icons/lpub96.png");
if (_icon.isNull())
_icon = QPixmap (":/icons/update.png");
QMessageBox box;
box.setWindowIcon(QIcon());
box.setIconPixmap (_icon);
box.setTextFormat (Qt::RichText);
box.setWindowTitle(tr ("%1 Blender LDraw Addon").arg(VER_PRODUCTNAME_STR));
box.setWindowFlags (Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
QString title = tr ("An existing %1 Blender LDraw addon archive file was detected.").arg(VER_PRODUCTNAME_STR);
box.setText (title);
QString text = tr ("Do you want to download the latest addon archive file ?");
box.setInformativeText (text);
box.setStandardButtons (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
box.setDefaultButton (QMessageBox::Yes);
int execReturn = box.exec();
if (execReturn == QMessageBox::Cancel) {
blenderPreferences->mDialogCancelled = true;
blenderPreferences->statusUpdate(true, tr("Cancelled"));
return static_cast<int>(BLENDER_ADDON_CANCEL);
} else if (execReturn == QMessageBox::No) {
blenderPreferences->statusUpdate(true, tr("Installing Blender addon..."));
AddOnUpdate = BLENDER_ADDON_RELOAD;
} else {
blenderPreferences->statusUpdate(true, tr("Downloading Blender addon..."));
}
}
}
}
Expand Down Expand Up @@ -1952,8 +1968,8 @@ int BlenderPreferences::getBlenderAddon(const QString &blenderDir)
}

// Download Blender addon
if (AddOnUpdate == ADD_ON_DOWNLOAD) {
lpub->downloadFile(VER_BLENDER_RENDER_ADDONS_URL, tr("Blender Addon"),false/*promptRedirect*/,false/*showProgress*/);
if (AddOnUpdate == BLENDER_ADDON_DOWNLOAD) {
lpub->downloadFile(VER_BLENDER_ADDON_URL, tr("Blender Addon"),false/*promptRedirect*/,false/*showProgress*/);
QByteArray Buffer = lpub->getDownloadedFile();
if (!Buffer.isEmpty()) {
if (QFileInfo(blenderAddonFile).exists()) {
Expand All @@ -1969,7 +1985,7 @@ int BlenderPreferences::getBlenderAddon(const QString &blenderDir)
.arg(file.errorString()));
if (blenderPreferences->progressBar)
blenderPreferences->progressBar->close();
return static_cast<int>(ADD_ON_FAIL);
return static_cast<int>(BLENDER_ADDON_FAIL);
}
file.write(Buffer);
file.close();
Expand Down
8 changes: 4 additions & 4 deletions mainApp/blenderpreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ public slots:

enum BlenderAddOnUpdate
{
ADD_ON_FAIL = -1,
ADD_ON_DOWNLOAD,
ADD_ON_RELOAD,
ADD_ON_CANCEL
BLENDER_ADDON_FAIL = -1,
BLENDER_ADDON_DOWNLOAD,
BLENDER_ADDON_RELOAD,
BLENDER_ADDON_CANCEL
};

struct BlenderSettings
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.245.3356 (08 05 2023 15:21:19)
LPub3D 2.4.6.246.3357 (08 05 2023 15:21:47)

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.245.3356 (08 05 2023 15:21:19)</h4>
<h4><a id="LPub3D_0"></a>LPub3D 2.4.6.246.3357 (08 05 2023 15:21:47)</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.245.3356
;; Last Update.: Mon, 08 May 2023 15:21:19 +0200
;; Version.....: 2.4.6.246.3357
;; Last Update.: Mon, 08 May 2023 15:21:46 +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/lpub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2803,7 +2803,7 @@ void Gui::editBlenderParameters()
blenderConfigFile = QString("%1/%2").arg(Preferences::blenderConfigDir).arg(VER_BLENDER_LDRAW_PARAMS_FILE);
} else if (blenderPreferences) {
titleLabel = tr("Import and Render Preferences");
blenderConfigFile = QString("%1/%2").arg(Preferences::blenderConfigDir).arg(VER_BLENDER_RENDER_CONFIG_FILE);
blenderConfigFile = QString("%1/%2").arg(Preferences::blenderConfigDir).arg(VER_BLENDER_ADDON_CONFIG_FILE);
}

QFileInfo fileInfo(blenderConfigFile);
Expand Down
2 changes: 1 addition & 1 deletion mainApp/lpub_preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2812,7 +2812,7 @@ void Preferences::rendererPreferences()
// Blender LDraw config file
QString const blenderLDrawConfigFileKey("BlenderLDrawConfigFile");
if ( ! Settings.contains(QString("%1/%2").arg(SETTINGS,blenderLDrawConfigFileKey))) {
blenderLDrawConfigFile = QDir::toNativeSeparators(QString("%1/%2").arg(blenderConfigDir,VER_BLENDER_RENDER_CONFIG_FILE));
blenderLDrawConfigFile = QDir::toNativeSeparators(QString("%1/%2").arg(blenderConfigDir,VER_BLENDER_ADDON_CONFIG_FILE));
if (QFileInfo(blenderLDrawConfigFile).exists())
Settings.setValue(QString("%1/%2").arg(SETTINGS,blenderLDrawConfigFileKey),QVariant(blenderLDrawConfigFile));
else
Expand Down
9 changes: 6 additions & 3 deletions mainApp/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define VER_LEGALTRADEMARKS2_STR VER_LEGALTRADEMARKS1_STR
#define VER_PUBLISHER_STR "Trevor SANDY"
#define VER_GITHUB_USER_STR "https://github.com/trevorsandy"
#define VER_GITHUB_API_STR "https://api.github.com/repos/trevorsandy"
#define VER_FILEVERSION_STR STRING(VER_MAJOR) "." STRING(VER_MINOR) "." STRING(VER_PATCH) "." VER_REVISION_STR "." VER_COMMIT_STR
#define VER_PUBLISHER_SUPPORT_STR "https://github.com/trevorsandy/lpub3d/issues"
#define VER_LICENSE_INFO_STR "http://www.gnu.org/licenses/gpl-3.0.html"
Expand Down Expand Up @@ -173,7 +174,7 @@
#define VER_BLENDER_DEFAULT_BLEND_FILE "lpub3d.blend"
#define VER_BLENDER_ADDON_FILE "LDrawBlenderRenderAddons.zip"
#define VER_BLENDER_ADDON_INSTALL_FILE "install_blender_ldraw_addons.py"
#define VER_BLENDER_RENDER_CONFIG_FILE "LDrawRendererPreferences.ini"
#define VER_BLENDER_ADDON_CONFIG_FILE "LDrawRendererPreferences.ini"
#define VER_BLENDER_DOCUMENT_CONFIG_FILE "PreferredRendererPreferences.ini"
#define VER_BLENDER_LDRAW_PARAMS_FILE "BlenderLDrawParameters.lst"

Expand All @@ -182,7 +183,8 @@

#define VER_HOMEPAGE_GITHUB_STR "https://trevorsandy.github.io/lpub3d/"
#define VER_SOURCE_GITHUB_STR VER_GITHUB_USER_STR "/lpub3d/"
#define VER_BLENDER_RENDER_STR VER_GITHUB_USER_STR "/blenderldrawrender/"
#define VER_BLENDER_ADDON_STR VER_GITHUB_USER_STR "/blenderldrawrender/"
#define VER_BLENDER_ADDON_API_STR VER_GITHUB_API_STR "/blenderldrawrender/"

#define VER_SOURCEFORGE_STR "https://lpub3d.sourceforge.io/"

Expand All @@ -203,7 +205,8 @@
#define VER_REBRICKABLE_KEYS_JSON_URL VER_HOMEPAGE_GITHUB_STR "assets/resources/rebrickablekeys.json"
#define VER_LPUB3D_BLCODES_DOWNLOAD_URL VER_HOMEPAGE_GITHUB_STR "assets/resources/codes.txt"
#define VER_LPUB3D_IMAGE_NOT_FOUND_URL VER_HOMEPAGE_GITHUB_STR "assets/resources/missingimage.png"
#define VER_BLENDER_RENDER_ADDONS_URL VER_BLENDER_RENDER_STR "releases/latest/download/" VER_BLENDER_ADDON_FILE
#define VER_BLENDER_ADDON_URL VER_BLENDER_ADDON_STR "releases/latest/download/" VER_BLENDER_ADDON_FILE
#define VER_BLENDER_ADDON_LATEST_URL VER_BLENDER_ADDON_API_STR "releases/latest"

// ~~~~~~ Build Parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //

Expand Down

0 comments on commit 21f017b

Please sign in to comment.