Skip to content

Commit

Permalink
Fade and highlight - add LPubFadeHighlight to visual editor #710
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorsandy committed May 8, 2023
1 parent 5a4444d commit e5d4dc6
Show file tree
Hide file tree
Showing 22 changed files with 105 additions and 108 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.3319
pkgver=2.4.6.3320
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.3319
pkgver=2.4.6.3320
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.3319) debian; urgency=medium
lpub3d (2.4.6.3320) debian; urgency=medium

* LPub3D version 2.4.6.208.3319_20230508 for Linux
* LPub3D version 2.4.6.209.3320_20230508 for Linux

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

* LPub3D version 2.4.6.208.3319_20230508 for Linux
* LPub3D version 2.4.6.209.3320_20230508 for Linux

-- Trevor SANDY <trevor.sandy@gmail.com> Mon, 08 May 2023 15:05:10 +0200
-- Trevor SANDY <trevor.sandy@gmail.com> Mon, 08 May 2023 15:05:34 +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.3319
Version: 2.4.6.3320
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.3319
Version: 2.4.6.3320
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.3319
* Mon May 08 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3320
- 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 208 3319 7aed90eec
2 4 6 209 3320 5a4444dff
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 = 208
GIT_REVISION = 209
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 = 3319
GIT_COMMIT = 3320
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}.208.3319.7aed90eec
GIT_VERSION = $${VERSION}.209.3320.5a4444dff
message("~~~ GIT_DIR [$$GIT_DIR_ENV, USING VERSION] $$GIT_VERSION ~~~")
GIT_VERSION ~= s/\./" "
}
Expand Down
28 changes: 17 additions & 11 deletions lclib/common/lc_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,31 +337,37 @@ lcApplication::lcApplication(const lcCommandLineOptions &Options)
/*** LPub3D Mod - load color entry ***/
bool lcApplication::LPubHighlightParts()
{
if (mProject)
return mProject->mLPubHighlightParts;
else
return Preferences::enableHighlightStep;
return mPreferences.mHighlightNewParts;
}
/*** LPub3D Mod end ***/
/*** LPub3D Mod - lpub fade highlight ***/
// used by lcScene::Draw
bool lcApplication::LPubFadeParts()
{
if (mProject)
return mProject->mLPubFadeParts;
else
return Preferences::enableFadeSteps;
// called by lcScene::Draw
return mPreferences.mFadeSteps;
}

bool lcApplication::LPubFadeHighlight()
{
// called by lcModel::LoadLDraw, lcModel::GetScene
return mPreferences.mLPubFadeHighlight;
}

bool lcApplication::LPubDisplayModelStep()
{
// called by lcModel::GetScene
return lpub->CurrentStepIsDisplayModel();
}

// used by lcTimeLineWidget::Update
bool lcApplication::UseLPubFadeColour()
{
// called by lcTimeLineWidget::Update
return Preferences::fadeStepsUseColour;
}

// used by lcTimeLineWidget::Update
QString lcApplication::LPubFadeColour()
{
// called by lcTimeLineWidget::Update
return LDrawColor::code(Preferences::validFadeStepsColour);
}
/*** LPub3D Mod end ***/
Expand Down
3 changes: 3 additions & 0 deletions lclib/common/lc_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ class lcApplication : public QObject
/*** LPub3D Mod end ***/
/*** LPub3D Mod - lpub fade highlight ***/
bool LPubFadeParts();
bool LPubFadeHighlight();
bool LPubDisplayModelStep();
bool UseLPubFadeColour();

QString LPubFadeColour();
/*** LPub3D Mod end ***/

Expand Down
23 changes: 13 additions & 10 deletions lclib/common/lc_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ void lcModel::LoadLDraw(QIODevice& Device, Project* Project)
/*** LPub3D Mod end ***/
/*** LPub3D Mod - lpub fade highlight ***/
mLPubFade = false;
mLPubHighlight = false;
/*** LPub3D Mod end ***/
/*** LPub3D Mod - preview widget ***/
bool IsUnofficialPart = mIsPreview && mProperties.mUnoffPartColorCode != LDRAW_MATERIAL_COLOUR;
Expand Down Expand Up @@ -592,7 +593,15 @@ void lcModel::LoadLDraw(QIODevice& Device, Project* Project)
/*** LPub3D Mod - lpub fade highlight ***/
else if (Token == QLatin1String("!FADE"))
{
mLPubFade = !mLPubFade;
if (gApplication->LPubFadeHighlight())
mLPubFade = !mLPubFade;
}
else if (Token == QLatin1String("!SILHOUETTE"))
{
if (gApplication->LPubFadeHighlight())
{
mLPubHighlight = !mLPubHighlight;
}
}
/*** LPub3D Mod end ***/
else if (Token == QLatin1String("FILE"))
Expand Down Expand Up @@ -626,9 +635,6 @@ void lcModel::LoadLDraw(QIODevice& Device, Project* Project)
delete Piece;
Piece = nullptr;
CurrentStep++;
/*** LPub3D Mod - lpub fade highlight ***/
mLPubFade = false;
/*** LPub3D Mod end ***/
mFileLines.append(OriginalLine);
continue;
}
Expand Down Expand Up @@ -1361,22 +1367,19 @@ void lcModel::GetScene(lcScene* Scene, const lcCamera* ViewCamera, bool AllowHig
if (mPieceInfo)
mPieceInfo->AddRenderMesh(*Scene);

/*** LPub3D Mod - lpub fade highlight ***/
lcPreferences& Preferences = lcGetPreferences();
/*** LPub3D Mod end ***/

for (const lcPiece* Piece : mPieces)
{
if (Piece->IsVisible(mCurrentStep))
{
const lcStep StepShow = Piece->GetStepShow();
/*** LPub3D Mod - lpub fade highlight ***/
bool LPubFade = false;
if (Preferences.mLPubFadeHighlight)
if (gApplication->LPubFadeHighlight())
LPubFade = Piece->GetLPubFade();
if (false /*For future use - Visual Editor Edit Mode*/)
{
AllowHighlight &= StepShow == mCurrentStep;
AllowFade &= StepShow < mCurrentStep;
LPubFade = Piece->GetLPubFade();
}
Piece->AddMainModelRenderMeshes(Scene, AllowHighlight, AllowFade, LPubFade);
/*** LPub3D Mod end ***/
Expand Down
1 change: 1 addition & 0 deletions lclib/common/lc_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ class lcModel
/*** LPub3D Mod end ***/
/*** LPub3D Mod - lpub fade highlight ***/
bool mLPubFade;
bool mLPubHighlight;
/*** LPub3D Mod end ***/

void SelectGroup(lcGroup* TopGroup, bool Select);
Expand Down
12 changes: 2 additions & 10 deletions lclib/common/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Project::Project(bool IsPreview, bool IsRenderImage)
/*** LPub3D Mod - lpub fade highlight ***/
mLPubFadeParts = false;
mLPubHighlightParts = false;
mLPubFadeHighlight = gApplication->mPreferences.mLPubFadeHighlight;
/*** LPub3D Mod end ***/
if (!mIsPreview && gMainWindow)
QObject::connect(&mFileWatcher, SIGNAL(fileChanged(const QString&)), gMainWindow, SLOT(ProjectFileChanged(const QString&)));
Expand All @@ -122,12 +123,7 @@ void Project::SetRenderAttributes(
const int PageWidth,
const int PageHeight,
const QString FileName,
const float Resolution,
/*** LPub3D Mod - lpub fade highlight ***/
const bool LPubFadeHighlight,
const bool FadeParts,
const bool HighlightParts)
/*** LPub3D Mod end ***/
const float Resolution)
{
mRenderer = Renderer;
mImageType = ImageType;
Expand All @@ -138,10 +134,6 @@ void Project::SetRenderAttributes(
lcSetProfileInt(LC_PROFILE_IMAGE_WIDTH,ImageWidth);
lcSetProfileInt(LC_PROFILE_IMAGE_HEIGHT,ImageHeight);
mViewerLoaded = true;
/*** LPub3D Mod - lpub fade highlight ***/
mLPubFadeParts = LPubFadeHighlight ? FadeParts : false;
mLPubHighlightParts = LPubFadeHighlight ? HighlightParts : false;
/*** LPub3D Mod end ***/
}
void Project::SetImageSize(
const int ImageWidth,
Expand Down
13 changes: 1 addition & 12 deletions lclib/common/project.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,7 @@ class Project
const int PageWidth,
const int PageHeight,
const QString FileName,
const float Resolution,
/*** LPub3D Mod - lpub fade highlight ***/
const bool LPubFadeHighlight,
const bool FadeParts,
const bool HighlightParts);
/*** LPub3D Mod end ***/
const float Resolution);
void SetImageSize(
const int ImageWidth,
const int ImageHeight);
Expand Down Expand Up @@ -230,12 +225,6 @@ class Project
/*** LPub3D Mod - set Timeline top item ***/
QString mTimelineTopItem;
/*** LPub3D Mod end ***/
/*** LPub3D Mod - lpub fade highlight ***/
bool mLPubFadeParts;
bool mLPubHighlightParts;
friend class lcApplication;
/*** LPub3D Mod end ***/

};

inline lcModel* lcGetActiveModel()
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.208.3319 (08 05 2023 15:05:10)
LPub3D 2.4.6.209.3320 (08 05 2023 15:05:35)

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.208.3319 (08 05 2023 15:05:10)</h4>
<h4><a id="LPub3D_0"></a>LPub3D 2.4.6.209.3320 (08 05 2023 15:05:35)</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.208.3319
;; Last Update.: Mon, 08 May 2023 15:05:10 +0200
;; Version.....: 2.4.6.209.3320
;; Last Update.: Mon, 08 May 2023 15:05:34 +0200
;; License.....: GPLv3
;; Homepage....: https://trevorsandy.github.io/lpub3d
;; Copyright (C) 2021 - 2023 by Trevor SANDY
Expand Down
41 changes: 41 additions & 0 deletions mainApp/lpub_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,40 @@ bool LPub::OpenProject(const NativeOptions* Options, int Type/*NATIVE_VIEW*/, bo

Project* Loader = nullptr;

lcPreferences& Preferences = lcGetPreferences();

Preferences.mFadeStepsColor = lcGetProfileInt(LC_PROFILE_FADE_STEPS_COLOR);
Preferences.mHighlightNewPartsColor = lcGetProfileInt(LC_PROFILE_HIGHLIGHT_NEW_PARTS_COLOR);

if (Options->LPubFadeHighlight)
{
Preferences.mFadeSteps = lcGetProfileInt(LC_PROFILE_FADE_STEPS);
Preferences.mHighlightNewParts = lcGetProfileInt(LC_PROFILE_HIGHLIGHT_NEW_PARTS);
}
else
{
Preferences.mFadeSteps = Options->FadeParts;
Preferences.mHighlightNewParts = Options->HighlightParts;
Preferences.mLPubFadeHighlight = Options->LPubFadeHighlight;

if (Options->FadeParts)
{
if (Preferences::fadeStepsUseColour)
{
QColor FC = LDrawColor::color(Preferences::validFadeStepsColour);
if (FC.isValid())
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 (Type != NATIVE_VIEW) // NATIVE_IMAGE or NATIVE_EXPORT
{
if (Type == NATIVE_IMAGE)
Expand Down Expand Up @@ -1712,6 +1746,13 @@ QString LPub::elapsedTime(const qint64 &duration) {

}

bool LPub::CurrentStepIsDisplayModel()
{
if (currentStep)
return currentStep->displayStep;
return false;
}

void LPub::SetShadingMode(lcShadingMode ShadingMode)
{
if (gMainWindow)
Expand Down
Loading

0 comments on commit e5d4dc6

Please sign in to comment.