Skip to content

Commit

Permalink
Fade and highlight - transfer settings to native renderer #710
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorsandy committed May 8, 2023
1 parent ffce367 commit 989cd60
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 33 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.3331
pkgver=2.4.6.3332
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.3331
pkgver=2.4.6.3332
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.3331) debian; urgency=medium
lpub3d (2.4.6.3332) debian; urgency=medium

* LPub3D version 2.4.6.220.3331_20230508 for Linux
* LPub3D version 2.4.6.221.3332_20230508 for Linux

-- Trevor SANDY <[email protected]> Mon, 08 May 2023 15:10:32 +0200
-- Trevor SANDY <[email protected]> Mon, 08 May 2023 15:10:57 +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.3331
Version: 2.4.6.3332
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.3331
Version: 2.4.6.3332
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.3331
* Mon May 08 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3332
- 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.3331) debian; urgency=medium
lpub3d (2.4.6.3332) debian; urgency=medium

* LPub3D version 2.4.6.220.3331_20230508 for Linux
* LPub3D version 2.4.6.221.3332_20230508 for Linux

-- Trevor SANDY <[email protected]> Mon, 08 May 2023 15:10:33 +0200
-- Trevor SANDY <[email protected]> Mon, 08 May 2023 15:10:59 +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.3331
Version: 2.4.6.3332
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.3331
Version: 2.4.6.3332
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.3331
* Mon May 08 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3332
- 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 220 3331 7bc8d69f8
2 4 6 221 3332 ffce367ef
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 = 220
GIT_REVISION = 221
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 = 3331
GIT_COMMIT = 3332
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}.220.3331.7bc8d69f8
GIT_VERSION = $${VERSION}.221.3332.ffce367ef
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.220.3331 (08 05 2023 15:10:33)
LPub3D 2.4.6.221.3332 (08 05 2023 15:10:59)

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.220.3331 (08 05 2023 15:10:33)</h4>
<h4><a id="LPub3D_0"></a>LPub3D 2.4.6.221.3332 (08 05 2023 15:10:59)</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.220.3331
;; Last Update.: Mon, 08 May 2023 15:10:33 +0200
;; Version.....: 2.4.6.221.3332
;; Last Update.: Mon, 08 May 2023 15:10:59 +0200
;; License.....: GPLv3
;; Homepage....: https://trevorsandy.github.io/lpub3d
;; Copyright (C) 2021 - 2023 by Trevor SANDY
Expand Down
14 changes: 13 additions & 1 deletion mainApp/lpub_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,19 +322,31 @@ bool LPub::OpenProject(const NativeOptions* Options, int Type/*NATIVE_VIEW*/, bo

if (Options->FadeParts)
{
QColor FC;
if (Preferences::fadeStepsUseColour)
{
QColor FC = LDrawColor::color(Preferences::validFadeStepsColour);
FC = LDrawColor::color(Preferences::validFadeStepsColour);
if (FC.isValid())
Preferences.mFadeStepsColor = LC_RGBA(FC.red(), FC.green(), FC.blue(), FC.alpha());
}

quint32* C = &Preferences.mFadeStepsColor;
FC = QColor(LC_RGBA_RED(*C), LC_RGBA_GREEN(*C), LC_RGBA_BLUE(*C), LC_RGBA_ALPHA(*C));

if (FC.isValid()) {
FC.setAlpha(LPUB3D_OPACITY_TO_ALPHA(Preferences::fadeStepsOpacity, 255));
Preferences.mFadeStepsColor = LC_RGBA(FC.red(), FC.green(), FC.blue(), FC.alpha());
}
}

if (Options->HighlightParts)
{
QColor HC = QColor(Preferences::highlightStepColour);
if (HC.isValid())
Preferences.mHighlightNewPartsColor = LC_RGBA(HC.red(), HC.green(), HC.blue(), HC.alpha());

if (Preferences.mLineWidth != Preferences::highlightStepLineWidth)
Preferences.mLineWidth = Preferences::highlightStepLineWidth;
}
}

Expand Down
4 changes: 2 additions & 2 deletions mainApp/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -3134,7 +3134,7 @@ class FadeStepsMeta : public BranchMeta
BoolMeta setup;
FadeColorMeta color;
IntMeta opacity;
void setPreferences(bool = false);
void setPreferences(bool reset = false);
FadeStepsMeta();
FadeStepsMeta(const FadeStepsMeta &rhs) : BranchMeta(rhs)
{
Expand All @@ -3158,7 +3158,7 @@ class HighlightStepMeta : public BranchMeta
BoolMeta setup;
StringMeta color;
IntMeta lineWidth;
void setPreferences(bool = false);
void setPreferences(bool reset = false);
HighlightStepMeta();
HighlightStepMeta(const HighlightStepMeta &rhs) : BranchMeta(rhs)
{
Expand Down
41 changes: 33 additions & 8 deletions mainApp/step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,8 @@ int Step::createCsi(
// rotate parts and create the CSI file for LDView single call and Native renderering
if (renderer->useLDViewSCall() || nativeRenderer) {

if (nativeRenderer) {
if (nativeRenderer)
ldrName = csiLdrFile;
// update fade and highlight Preferences for rotateParts routine.
meta.LPub.fadeSteps.setPreferences();
meta.LPub.highlightStep.setPreferences();
}

// set rotated parts
QFuture<int> RenderFuture = QtConcurrent::run([&] () {
Expand Down Expand Up @@ -775,7 +771,7 @@ QStringList Step::configureModelStep(const QStringList &csiParts, Where &current
if (prevStepPosition == 0 && Gui::savePrevStepPosition > 0)
prevStepPosition = Gui::savePrevStepPosition;
}
//*
/*
#ifdef QT_DEBUG_MODE
emit lpub->messageSig(LOG_DEBUG, QString("\nConfigure Model Step:"
"\nStepNum....................%1"
Expand Down Expand Up @@ -832,10 +828,10 @@ QStringList Step::configureModelStep(const QStringList &csiParts, Where &current
// parse displayModel step
if (displayStep) {
if (argv.size() >= 2 && argv[0] == "0") {
bool ok;
bool ok, update = false;
if (enableFadeSteps && argv[1] == QStringLiteral("!FADE")) {
if (argv.size() == 2) {
doFadeStep = !doFadeStep;
doFadeStep = !doFadeStep;
} else if (argv.size() >= 3) {
doFadeStep = true;
if (argv.size() == 3) {
Expand All @@ -860,6 +856,23 @@ QStringList Step::configureModelStep(const QStringList &csiParts, Where &current
}
}
}

FadeColorData data = csiStepMeta.fadeSteps.color.value();
if (fadeColour != LDrawColor::code(data.color) || fadeStepsUseColour != data.useColor) {
data.color = fadeColour;
data.useColor = fadeStepsUseColour;
csiStepMeta.fadeSteps.color.setValue(data);
update = true;
}
if (fadeStepsOpacity != csiStepMeta.fadeSteps.opacity.value()) {
csiStepMeta.fadeSteps.opacity.setValue(fadeStepsOpacity);
if (!update)
update = true;
}
if (update) {
csiStepMeta.fadeSteps.setPreferences();
update = false;
}
}
}

Expand All @@ -885,6 +898,18 @@ QStringList Step::configureModelStep(const QStringList &csiParts, Where &current
else
emit lpub->messageSig(LOG_WARNING, QObject::tr("Specified highlight colour is invalid [%1] ").arg(argv[3]));
}
if (highlightColour != csiStepMeta.highlightStep.color.value()) {
update = true;
csiStepMeta.highlightStep.color.setValue(highlightColour);
}
if (highlightStepLineWidth != csiStepMeta.highlightStep.lineWidth.value()) {
update = true;
csiStepMeta.highlightStep.lineWidth.setValue(highlightStepLineWidth);
}
if (update) {
csiStepMeta.highlightStep.setPreferences();
update = false;
}
}
}
}
Expand Down

0 comments on commit 989cd60

Please sign in to comment.