Skip to content

Commit

Permalink
Fade and highlight - convert GetLPubFade calls to bool #710
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorsandy committed May 8, 2023
1 parent 8e1aa25 commit d515755
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 37 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.3323
pkgver=2.4.6.3324
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.3323
pkgver=2.4.6.3324
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.3323) debian; urgency=medium
lpub3d (2.4.6.3324) debian; urgency=medium

* LPub3D version 2.4.6.212.3323_20230508 for Linux
* LPub3D version 2.4.6.213.3324_20230508 for Linux

-- Trevor SANDY <trevor.sandy@gmail.com> Mon, 08 May 2023 15:06:45 +0200
-- Trevor SANDY <trevor.sandy@gmail.com> Mon, 08 May 2023 15:07:09 +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.3323
Version: 2.4.6.3324
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.3323
Version: 2.4.6.3324
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.3323
* Mon May 08 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3324
- 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.3323) debian; urgency=medium
lpub3d (2.4.6.3324) debian; urgency=medium

* LPub3D version 2.4.6.212.3323_20230508 for Linux
* LPub3D version 2.4.6.213.3324_20230508 for Linux

-- Trevor SANDY <trevor.sandy@gmail.com> Mon, 08 May 2023 15:06:46 +0200
-- Trevor SANDY <trevor.sandy@gmail.com> Mon, 08 May 2023 15:07:10 +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.3323
Version: 2.4.6.3324
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.3323
Version: 2.4.6.3324
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.3323
* Mon May 08 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3324
- 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 212 3323 7c0becc72
2 4 6 213 3324 8e1aa2536
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 = 212
GIT_REVISION = 213
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 = 3323
GIT_COMMIT = 3324
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}.212.3323.7c0becc72
GIT_VERSION = $${VERSION}.213.3324.8e1aa2536
message("~~~ GIT_DIR [$$GIT_DIR_ENV, USING VERSION] $$GIT_VERSION ~~~")
GIT_VERSION ~= s/\./" "
}
Expand Down
29 changes: 23 additions & 6 deletions lclib/common/lc_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,14 +593,22 @@ void lcModel::LoadLDraw(QIODevice& Device, Project* Project)
/*** LPub3D Mod - lpub fade highlight ***/
else if (Token == QLatin1String("!FADE"))
{
mLPubFade = !mLPubFade;
if (gApplication->LPubFadeHighlight())
mLPubFade = !mLPubFade;
{
lcPreferences& Preferences = lcGetPreferences();
if (mLPubFade && Preferences.mFadeSteps)
Preferences.mFadeSteps = false;
}
}
else if (Token == QLatin1String("!SILHOUETTE"))
{
mLPubHighlight = !mLPubHighlight;
if (gApplication->LPubFadeHighlight())
{
mLPubHighlight = !mLPubHighlight;
lcPreferences& Preferences = lcGetPreferences();
if (mLPubHighlight && Preferences.mHighlightNewParts)
Preferences.mHighlightNewParts = false;
}
}
/*** LPub3D Mod end ***/
Expand Down Expand Up @@ -779,6 +787,7 @@ void lcModel::LoadLDraw(QIODevice& Device, Project* Project)
/*** LPub3D Mod end ***/
/*** LPub3D Mod - lpub fade highlight ***/
Piece->SetLPubFade(mLPubFade);
Piece->SetLPubHighlight(mLPubHighlight);
/*** LPub3D Mod end ***/
Piece->SetFileLine(mFileLines.size());
Piece->SetPieceInfo(Info, PartId, false);
Expand Down Expand Up @@ -1371,17 +1380,25 @@ void lcModel::GetScene(lcScene* Scene, const lcCamera* ViewCamera, bool AllowHig
{
if (Piece->IsVisible(mCurrentStep))
{
/*** LPub3D Mod - lpub fade highlight ***/
bool LPubFade = gApplication->LPubFadeHighlight();
/*** LPub3D Mod - export ***/
if (lcGetActiveProject()->IsExportingHTML())
{
const lcStep StepShow = Piece->GetStepShow();
AllowFade &= StepShow < mCurrentStep;
AllowHighlight &= StepShow == mCurrentStep;
AllowFade &= StepShow < mCurrentStep;
}
/*** LPub3D Mod end ***/
/*** LPub3D Mod - lpub fade highlight ***/
bool LPubFade = gApplication->LPubFadeHighlight();
LPubFade &= Piece->GetLPubFade();
else if (!LPubFade)
{
AllowFade &= Piece->GetLPubFade();
AllowHighlight &= Piece->GetLPubHighlight();
}
else
{
LPubFade &= Piece->GetLPubFade();
}
Piece->AddMainModelRenderMeshes(Scene, AllowHighlight, AllowFade, LPubFade);
/*** LPub3D Mod end ***/
}
Expand Down
10 changes: 5 additions & 5 deletions lclib/common/lc_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit, bool DrawF
if (LPubFadeArg)
{
// Enable BFC
Context->EnableCullFace(true, true);
Context->EnableCullFace(true, true);

// Disable color writes
if (LPubFadeArg == LC_DISABLE_COLOR_WRITES){
Expand Down Expand Up @@ -469,7 +469,7 @@ void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit, bool DrawF
/*** LPub3D Mod - lpub fade highlight ***/
if (LPubFadeArg)
{
Context->SetDepthWrite(true);
Context->SetDepthWrite(true);
Context->EnableColorBlend(false);

// Wrap up, Disable BFC
Expand Down Expand Up @@ -498,9 +498,9 @@ void lcScene::Draw(lcContext* Context) const
const bool DrawConditional = Preferences.mDrawConditionalLines && Preferences.mLineWidth > 0.0f;
/*** LPub3D Mod - lpub fade highlight ***/
// 03/22/2021 8039f5b Draw conditional lines on a separate pass.
const bool LPubFadeHighlight = gApplication->LPubFadeParts() && // turn off during HTML Steps export
Preferences.mLPubFadeHighlight &&
mHasLPubFadedParts &&
const bool LPubFadeHighlight = gApplication->LPubFadeParts() && // turn off during HTML Steps export
gApplication->LPubFadeHighlight() &&
mHasLPubFadedParts &&
!mTranslucentMeshes.IsEmpty();
/*** LPub3D Mod end ***/

Expand Down
4 changes: 2 additions & 2 deletions lclib/common/lc_scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/*** LPub3D Mod - lpub fade highlight ***/
enum lcFadeArgs
{
LC_NO_FADE,
LC_NO_LPUB_FADE,
LC_DISABLE_COLOR_WRITES,
LC_ENABLE_COLOR_WRITES,
LC_DISABLE_BFC
Expand Down Expand Up @@ -111,7 +111,7 @@ class lcScene
protected:
void DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTypes, bool DrawFaded, bool DrawNonFaded) const;
/*** LPub3D Mod - lpub fade highlight ***/
void DrawTranslucentMeshes(lcContext* Context, bool DrawLit, bool DrawFadePrepass, bool DrawFaded, bool DrawNonFaded, lcFadeArgs LPubFadeArg = LC_NO_FADE) const;
void DrawTranslucentMeshes(lcContext* Context, bool DrawLit, bool DrawFadePrepass, bool DrawFaded, bool DrawNonFaded, lcFadeArgs LPubFadeArg = LC_NO_LPUB_FADE) const;
/*** LPub3D Mod end ***/
void DrawDebugNormals(lcContext* Context, const lcMesh* Mesh) const;

Expand Down
15 changes: 13 additions & 2 deletions lclib/common/piece.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,20 @@ class lcPiece : public lcObject
mLPubFade = Faded;
}

int GetLPubFade() const
bool GetLPubFade() const
{
return mLPubFade;
}

void SetLPubHighlight(bool Highlighted)
{
mLPubHighlight = Highlighted;
}

bool GetLPubHighlight() const
{
return mLPubHighlight;
}
/*** LPub3D Mod end ***/

void RayTest(lcObjectRayTest& ObjectRayTest) const override;
Expand Down Expand Up @@ -397,7 +407,8 @@ class lcPiece : public lcObject
int mPieceModified;
/*** LPub3D Mod end ***/
/*** LPub3D Mod - lpub fade highlight ***/
int mLPubFade;
bool mLPubFade;
bool mLPubHighlight;
/*** LPub3D Mod end ***/
QString mID;

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.212.3323 (08 05 2023 15:06:46)
LPub3D 2.4.6.213.3324 (08 05 2023 15:07:10)

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.212.3323 (08 05 2023 15:06:46)</h4>
<h4><a id="LPub3D_0"></a>LPub3D 2.4.6.213.3324 (08 05 2023 15:07:10)</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.212.3323
;; Last Update.: Mon, 08 May 2023 15:06:46 +0200
;; Version.....: 2.4.6.213.3324
;; Last Update.: Mon, 08 May 2023 15:07:10 +0200
;; License.....: GPLv3
;; Homepage....: https://trevorsandy.github.io/lpub3d
;; Copyright (C) 2021 - 2023 by Trevor SANDY
Expand Down

0 comments on commit d515755

Please sign in to comment.