From 7184601bc0dfb58ec927ac399c11b92aa44f1d04 Mon Sep 17 00:00:00 2001 From: Trevor SANDY Date: Sat, 22 Apr 2023 03:45:54 +0200 Subject: [PATCH] Insert display model - count instances #704 --- builds/linux/obs/PKGBUILD | 2 +- builds/linux/obs/alldeps/PKGBUILD | 2 +- builds/linux/obs/alldeps/debian/changelog | 6 +++--- builds/linux/obs/alldeps/debian/lpub3d.dsc | 2 +- builds/linux/obs/alldeps/lpub3d.spec | 4 ++-- builds/linux/obs/debian/changelog | 6 +++--- builds/linux/obs/debian/lpub3d.dsc | 2 +- builds/linux/obs/lpub3d.spec | 4 ++-- builds/utilities/version.info | 2 +- gitversion.pri | 6 +++--- mainApp/docs/README.txt | 2 +- mainApp/docs/RELEASE_NOTES.html | 2 +- mainApp/extras/LPub3D_Npp_UDL.xml | 4 ++-- mainApp/ldrawfiles.cpp | 20 +++++++++++++------- mainApp/metaitem.cpp | 19 +++++++++++-------- mainApp/traverse.cpp | 10 +++++----- 16 files changed, 51 insertions(+), 42 deletions(-) diff --git a/builds/linux/obs/PKGBUILD b/builds/linux/obs/PKGBUILD index ba333627c..9e0774c9a 100755 --- a/builds/linux/obs/PKGBUILD +++ b/builds/linux/obs/PKGBUILD @@ -2,7 +2,7 @@ # Last Update: July 19, 2020 # Copyright (C) 2017 - 2023 by Trevor SANDY pkgname=lpub3d -pkgver=2.4.6.3276 +pkgver=2.4.6.3277 pkgrel=1 pkgdesc="An LDraw Building Instruction Editor" url="https://github.com/trevorsandy/lpub3d.git" diff --git a/builds/linux/obs/alldeps/PKGBUILD b/builds/linux/obs/alldeps/PKGBUILD index d3c60954d..39125e394 100644 --- a/builds/linux/obs/alldeps/PKGBUILD +++ b/builds/linux/obs/alldeps/PKGBUILD @@ -2,7 +2,7 @@ # Last Update: July 19, 2020 # Copyright (C) 2017 - 2023 by Trevor SANDY pkgname=lpub3d -pkgver=2.4.6.3276 +pkgver=2.4.6.3277 pkgrel=1 pkgdesc="An LDraw Building Instruction Editor" url="https://github.com/trevorsandy/lpub3d.git" diff --git a/builds/linux/obs/alldeps/debian/changelog b/builds/linux/obs/alldeps/debian/changelog index ecc6698a1..7821f8e95 100644 --- a/builds/linux/obs/alldeps/debian/changelog +++ b/builds/linux/obs/alldeps/debian/changelog @@ -1,5 +1,5 @@ -lpub3d (2.4.6.3276) debian; urgency=medium +lpub3d (2.4.6.3277) debian; urgency=medium - * LPub3D version 2.4.6.165.3276_20230422 for Linux + * LPub3D version 2.4.6.166.3277_20230422 for Linux - -- Trevor SANDY Sat, 22 Apr 2023 03:45:32 +0200 + -- Trevor SANDY Sat, 22 Apr 2023 03:45:54 +0200 diff --git a/builds/linux/obs/alldeps/debian/lpub3d.dsc b/builds/linux/obs/alldeps/debian/lpub3d.dsc index 1aa42c0b9..57fd82427 100644 --- a/builds/linux/obs/alldeps/debian/lpub3d.dsc +++ b/builds/linux/obs/alldeps/debian/lpub3d.dsc @@ -2,7 +2,7 @@ Format: 1.0 Source: lpub3d Binary: lpub3d Architecture: any -Version: 2.4.6.3276 +Version: 2.4.6.3277 Maintainer: Trevor SANDY Homepage: https://trevorsandy.github.io/lpub3d/ Standards-Version: 3.9.7 diff --git a/builds/linux/obs/alldeps/lpub3d.spec b/builds/linux/obs/alldeps/lpub3d.spec index 68c51ea87..d0dad4599 100644 --- a/builds/linux/obs/alldeps/lpub3d.spec +++ b/builds/linux/obs/alldeps/lpub3d.spec @@ -120,7 +120,7 @@ BuildRequires: fdupes Summary: An LDraw Building Instruction Editor Name: lpub3d Icon: lpub3d.xpm -Version: 2.4.6.3276 +Version: 2.4.6.3277 Release: %{?dist} URL: https://trevorsandy.github.io/lpub3d Vendor: Trevor SANDY @@ -797,7 +797,7 @@ update-desktop-database || true %endif %changelog -* Sat Apr 22 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3276 +* Sat Apr 22 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3277 - 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 diff --git a/builds/linux/obs/debian/changelog b/builds/linux/obs/debian/changelog index d3925c597..51706505d 100644 --- a/builds/linux/obs/debian/changelog +++ b/builds/linux/obs/debian/changelog @@ -1,5 +1,5 @@ -lpub3d (2.4.6.3276) debian; urgency=medium +lpub3d (2.4.6.3277) debian; urgency=medium - * LPub3D version 2.4.6.165.3276_20230422 for Linux + * LPub3D version 2.4.6.166.3277_20230422 for Linux - -- Trevor SANDY Sat, 22 Apr 2023 03:45:34 +0200 + -- Trevor SANDY Sat, 22 Apr 2023 03:45:56 +0200 diff --git a/builds/linux/obs/debian/lpub3d.dsc b/builds/linux/obs/debian/lpub3d.dsc index 6e9603a09..1ddc88cdd 100755 --- a/builds/linux/obs/debian/lpub3d.dsc +++ b/builds/linux/obs/debian/lpub3d.dsc @@ -2,7 +2,7 @@ Format: 1.0 Source: lpub3d Binary: lpub3d Architecture: any -Version: 2.4.6.3276 +Version: 2.4.6.3277 Maintainer: Trevor SANDY Homepage: https://trevorsandy.github.io/lpub3d/ Standards-Version: 3.9.7 diff --git a/builds/linux/obs/lpub3d.spec b/builds/linux/obs/lpub3d.spec index 23ae4c16c..144695e23 100755 --- a/builds/linux/obs/lpub3d.spec +++ b/builds/linux/obs/lpub3d.spec @@ -82,7 +82,7 @@ BuildRequires: fdupes Summary: An LDraw Building Instruction Editor Name: lpub3d Icon: lpub3d.xpm -Version: 2.4.6.3276 +Version: 2.4.6.3277 Release: 1%{?dist} URL: https://trevorsandy.github.io/lpub3d Vendor: Trevor SANDY @@ -313,7 +313,7 @@ update-desktop-database || true %endif %changelog -* Sat Apr 22 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3276 +* Sat Apr 22 2023 - trevor.dot.sandy.at.gmail.dot.com 2.4.6.3277 - 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 diff --git a/builds/utilities/version.info b/builds/utilities/version.info index b5f51c7fd..e54d66f1f 100755 --- a/builds/utilities/version.info +++ b/builds/utilities/version.info @@ -1 +1 @@ -2 4 6 165 3276 52e719d7a +2 4 6 166 3277 224db2114 diff --git a/gitversion.pri b/gitversion.pri index 36211f593..737883a7b 100644 --- a/gitversion.pri +++ b/gitversion.pri @@ -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 = 165 + GIT_REVISION = 166 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} @@ -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 = 3276 + GIT_COMMIT = 3277 message("~~~ ERROR! GIT_COMMIT NOT DEFINED, USING $$GIT_COMMIT ~~~") } @@ -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}.165.3276.52e719d7a + GIT_VERSION = $${VERSION}.166.3277.224db2114 message("~~~ GIT_DIR [$$GIT_DIR_ENV, USING VERSION] $$GIT_VERSION ~~~") GIT_VERSION ~= s/\./" " } diff --git a/mainApp/docs/README.txt b/mainApp/docs/README.txt index 8bb68a91a..de9ac75ea 100755 --- a/mainApp/docs/README.txt +++ b/mainApp/docs/README.txt @@ -1,4 +1,4 @@ -LPub3D 2.4.6.165.3276 (22 04 2023 03:45:34) +LPub3D 2.4.6.166.3277 (22 04 2023 03:45:56) Features, enhancements, fixes and changes ------------ diff --git a/mainApp/docs/RELEASE_NOTES.html b/mainApp/docs/RELEASE_NOTES.html index b742d891f..69f553489 100644 --- a/mainApp/docs/RELEASE_NOTES.html +++ b/mainApp/docs/RELEASE_NOTES.html @@ -18,7 +18,7 @@
-

LPub3D 2.4.6.165.3276 (22 04 2023 03:45:34)

+

LPub3D 2.4.6.166.3277 (22 04 2023 03:45:56)


LPub3D Official release.
diff --git a/mainApp/extras/LPub3D_Npp_UDL.xml b/mainApp/extras/LPub3D_Npp_UDL.xml index ffb2e789d..b18270b00 100644 --- a/mainApp/extras/LPub3D_Npp_UDL.xml +++ b/mainApp/extras/LPub3D_Npp_UDL.xml @@ -14,8 +14,8 @@ ;; ;; Author......: Trevor SANDY ;; Name........: LPub3D_Npp_UDL.xml -;; Version.....: 2.4.6.165.3276 -;; Last Update.: Sat, 22 Apr 2023 03:45:34 +0200 +;; Version.....: 2.4.6.166.3277 +;; Last Update.: Sat, 22 Apr 2023 03:45:56 +0200 ;; License.....: GPLv3 ;; Homepage....: https://trevorsandy.github.io/lpub3d ;; Copyright (C) 2021 - 2023 by Trevor SANDY diff --git a/mainApp/ldrawfiles.cpp b/mainApp/ldrawfiles.cpp index b59c4884e..8a1e7389a 100644 --- a/mainApp/ldrawfiles.cpp +++ b/mainApp/ldrawfiles.cpp @@ -3002,6 +3002,8 @@ void LDrawFile::countInstances( //lpub3d ignore part - so set ignore step if (tokens.size() > 1 && tokens[0] == "0") { + if (!displayModel) + displayModel = line.contains(_fileRegExp[DMS_RX]); if (tokens[1] == "!LPUB" || tokens[1] == "LPUB") { // pli part meta commands if (tokens.size() == 5) { @@ -3011,7 +3013,7 @@ void LDrawFile::countInstances( stepIgnore = true; } // build modification - commands - else if (tokens[2] == "BUILD_MOD") { + else if (!displayModel && tokens[2] == "BUILD_MOD") { if (tokens[3] == "BEGIN") { if (! Preferences::buildModEnabled) { buildModIgnore = true; @@ -3070,8 +3072,8 @@ void LDrawFile::countInstances( } } else if (tokens.size() == 4 && tokens[0] == "0" && (tokens[1] == "!LPUB" || tokens[1] == "LPUB") && - tokens[2] == "CALLOUT" && - tokens[3] == "END") { + tokens[2] == "CALLOUT" && + tokens[3] == "END") { callout = false; break; } @@ -3105,10 +3107,12 @@ void LDrawFile::countInstances( // no step } else if (tokens.size() == 3 && (tokens[2] == "NOSTEP" || tokens[2] == "NOFILE")) { - noStep = true; + noStep = true; + displayModel = false; // LDraw step or rotstep - so check if parts added } else if (tokens.size() >= 2 && (tokens[1] == "STEP" || tokens[1] == "ROTSTEP")) { + displayModel = false; if (! noStep) { if (partsAdded) { // parts added - increment step @@ -3143,7 +3147,7 @@ void LDrawFile::countInstances( } // step or rotstep // check if subfile and process } else if (tokens.size() == 15 && tokens[0] >= "1" && tokens[0] <= "5") { - if (! stepIgnore && ! buildModIgnore) { + if (! displayModel && ! stepIgnore && ! buildModIgnore) { buildModPartCount++; if (contains(tokens[14],false/*searchAll*/)) { // add contains 'child' index to parent list @@ -3181,6 +3185,8 @@ void LDrawFile::countInstances( ++f->_instances; } } // callout + + displayModel = false; } // subfile end f->_beenCounted = true; @@ -5749,8 +5755,8 @@ LDrawFile::LDrawFile() : ldrawMutex(QMutex::Recursive) << QRegExp("^0\\s+!?LDCAD\\s+GROUP_DEF.*\\s+\\[LID=(\\d+)\\]\\s+\\[GID=([\\d\\w]+)\\]\\s+\\[name=(.[^\\]]+)\\].*$",Qt::CaseInsensitive) // LDG_RX - LDCad Group << QRegExp("^0\\s+!?LDCAD\\s+(CONTENT|PATH_POINT|PATH_SKIN|GENERATED)[^\n]*") // LDC_RX - LDCad Generated Content << QRegExp("^0\\s+!?(?:LPUB)*\\s?(STEP|ROTSTEP|MULTI_STEP BEGIN|CALLOUT BEGIN|BUILD_MOD BEGIN|0 ROTATION)[^\n]*") // EOH_RX - End of Header - << QRegExp("^0\\s+!?(?:LPUB)*\\s?(INSERT DISPLAY_MODEL)[^\n]*") // DMS_RX - Display Model Step - << QRegExp("^0\\s+!?(?:LPUB)*\\s?(STEP|ROTSTEP)[^\n]*") // LDS_RX - LDraw Step + << QRegExp("^0\\s+!?(?:LPUB)*\\s?(INSERT DISPLAY_MODEL)[^\n]*") // DMS_RX - Display Model Step + << QRegExp("^0\\s+!?(?:LPUB)*\\s?(STEP|ROTSTEP|NOSTEP|NOFILE)[^\n]*") // LDS_RX - LDraw Step boundry ; } diff --git a/mainApp/metaitem.cpp b/mainApp/metaitem.cpp index 1e8cb3c9e..1f8c13654 100644 --- a/mainApp/metaitem.cpp +++ b/mainApp/metaitem.cpp @@ -430,17 +430,20 @@ int MetaItem::countInstancesInStep(Meta *meta, const QString &modelName){ return instanceCount; } -int MetaItem::countInstancesInModel(Meta *meta, const QString &modelName){ +int MetaItem::countInstancesInModel(Meta *meta, const QString &modelName) { - int numLines; - Where walk(modelName,1); + if (lpub->ldrawFile.isDisplayModel(modelName)) + return 0; - /* submodelStack tells us where this submodel is referenced in the - parent file so we use it to target the correct SUBMODEL*/ + int numLines; + Where walk(modelName,1); - SubmodelStack tos = meta->submodelStack[meta->submodelStack.size() - 1]; - Where subModel(tos.modelName,0); - lpub->ldrawFile.skipHeader(subModel.modelName,subModel.lineNumber); + /* submodelStack tells us where this submodel is referenced in the + parent file so we use it to target the correct SUBMODEL*/ + + SubmodelStack tos = meta->submodelStack[meta->submodelStack.size() - 1]; + Where subModel(tos.modelName,0); + lpub->ldrawFile.skipHeader(subModel.modelName,subModel.lineNumber); /* Scan the lines following this line, to see if there is another * submodel just like this one that needs to be added as multiplier. diff --git a/mainApp/traverse.cpp b/mainApp/traverse.cpp index 56bff0960..07ab2144d 100644 --- a/mainApp/traverse.cpp +++ b/mainApp/traverse.cpp @@ -1813,14 +1813,14 @@ int Gui::drawPage( // get the default number of submodel instances in the model file instances = lpub->ldrawFile.instances(opts.current.modelName, opts.isMirrored); - if (countInstances) + if (!opts.displayModel && countInstances) displayInstanceCount = instances > 1 || steps->meta.LPub.page.countInstanceOverride.value() > 1; // count the instances - use steps->meta (vs. steps->groupStepMeta) to access current submodelStack // // lpub->ldrawFile.instances() configuration is CountAtTop - the historic LPub count scheme. However, // the updated countInstances routine's configuration is CountAtModel - this is the default options set // and configurable in Project globals - if (displayInstanceCount) { + if (!opts.displayModel && displayInstanceCount) { // manually override the count instance value using 0 !LPUB SUBMODEL_INSTANCE_COUNT_OVERRIDE if (steps->groupStepMeta.LPub.page.countInstanceOverride.value()) instances = steps->groupStepMeta.LPub.page.countInstanceOverride.value(); @@ -2564,12 +2564,12 @@ int Gui::drawPage( // get the number of submodel instances in the model file int instances = lpub->ldrawFile.instances(opts.current.modelName, opts.isMirrored); - if (countInstances) + if (!opts.displayModel && countInstances) displayInstanceCount = instances > 1 || steps->meta.LPub.page.countInstanceOverride.value() > 1; // lpub->ldrawFile.instances() configuration is CountAtTop - the historic LPub count scheme. However, // the updated countInstances routine's configuration is CountAtModel - this is the default options set // and configurable in Project globals - if (displayInstanceCount) { + if (!opts.displayModel && displayInstanceCount) { // manually override the count instance value using 0 !LPUB SUBMODEL_INSTANCE_COUNT_OVERRIDE if (steps->meta.LPub.page.countInstanceOverride.value()) instances = steps->meta.LPub.page.countInstanceOverride.value(); @@ -2582,7 +2582,7 @@ int Gui::drawPage( } // update the page if submodel instances greater than 1 - if (instances > 1) { + if (!opts.displayModel && instances > 1) { Page *page = dynamic_cast(steps); if (page) { page->instances = instances;