Skip to content

Commit

Permalink
Insert DISPLAY_MODEL as a step #415
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorsandy committed Sep 20, 2020
1 parent e542f6d commit d41d7b0
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 41 deletions.
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 23, 2019
# Copyright (c) 2017 - 2020 by Trevor SANDY
pkgname=lpub3d
pkgver=2.4.0.1745
pkgver=2.4.0.1746
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.0.1745) debian; urgency=medium
lpub3d (2.4.0.1746) debian; urgency=medium

* LPub3D version 2.4.0.1.1745_20200920 for Linux
* LPub3D version 2.4.0.1.1746_20200920 for Linux

-- Trevor SANDY <[email protected]> Sun, 20 Sep 2020 09:58:32 +0200
-- Trevor SANDY <[email protected]> Sun, 20 Sep 2020 09:59:13 +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.0.1745
Version: 2.4.0.1746
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 @@ -116,7 +116,7 @@ BuildRequires: fdupes
Summary: An LDraw Building Instruction Editor
Name: lpub3d
Icon: lpub3d.xpm
Version: 2.4.0.1745
Version: 2.4.0.1746
Release: <B_CNT>%{?dist}
URL: https://trevorsandy.github.io/lpub3d
Vendor: Trevor SANDY
Expand Down Expand Up @@ -728,5 +728,5 @@ update-mime-database /usr/share/mime >/dev/null || true
update-desktop-database || true
%endif

* Sun Sep 20 2020 - trevor.dot.sandy.at.gmail.dot.com 2.4.0.1745
* Sun Sep 20 2020 - trevor.dot.sandy.at.gmail.dot.com 2.4.0.1746
- LPub3D Linux package (rpm) release
Binary file modified builds/utilities/ci/secure/.secrets.tar.enc
Binary file not shown.
2 changes: 1 addition & 1 deletion builds/utilities/version.info
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2 4 0 1 1745 5544d94
2 4 0 1 1746 e542f6d
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.0.1.1745 (20 09 2020 09:58:32)
LPub3D 2.4.0.1.1746 (20 09 2020 09:59:13)

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 @@ -9,7 +9,7 @@
<table class="tg">
<tr>
<th class="tg-0pky">
<h4><a id="LPub3D_0"></a>LPub3D 2.4.0.1.1745 (20 09 2020 09:58:32)</h4>
<h4><a id="LPub3D_0"></a>LPub3D 2.4.0.1.1746 (20 09 2020 09:59:13)</h4>
<hr>
<p>
LPub3D Continuous release.<br>
Expand Down
1 change: 1 addition & 0 deletions mainApp/highlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ Highlighter::Highlighter(QTextDocument *parent)
<< "\\bCSI_ANNOTATION_PART\\b"
<< "\\bCUSTOM_LENGTH\\b"
<< "\\bDISPLAY\\b"
<< "\\bDISPLAY_MODEL\\b"
<< "\\bDISPLAY_PAGE_NUMBER\\b"
<< "\\bDIVIDER\\b"
<< "\\bDIVIDER_ITEM\\b"
Expand Down
2 changes: 2 additions & 0 deletions mainApp/meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2602,6 +2602,8 @@ Rc InsertMeta::parse(QStringList &argv, int index, Where &here)
return InsertPageRc;
} else if (argv[index] == "MODEL") {
return InsertFinalModelRc;
} else if (argv[index] == "DISPLAY_MODEL") {
return InsertDisplayModelRc;
} else if (argv[index] == "COVER_PAGE") {
return InsertCoverPageRc;
}
Expand Down
1 change: 1 addition & 0 deletions mainApp/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ enum Rc {

AssemAnnotationIconRc,
InsertFinalModelRc,
InsertDisplayModelRc,

SepRc,

Expand Down
41 changes: 25 additions & 16 deletions mainApp/metaitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3050,6 +3050,29 @@ int MetaItem::okToInsertFinalModel()
return -1;
}

void MetaItem::insertDisplayModel(Where &here, bool finalModel)
{
bool atStep = (QString(gui->readLine(here))
.contains(QRegExp("^0 STEP$")));

QString modelMeta = finalModel ? QString("0 !LPUB INSERT MODEL") :
QString("0 !LPUB INSERT DISPLAY_MODEL");
QString pageMeta = QString("0 !LPUB INSERT PAGE");

beginMacro("insertFinalModel");

if (atStep) {
appendMeta(here,modelMeta);
appendMeta(++here,pageMeta);
appendMeta(++here,step);
} else {
appendMeta(here,step);
appendMeta(++here,modelMeta);
appendMeta(++here,pageMeta);
}

endMacro();
}

void MetaItem::insertFinalModel(int atLine)
{
Expand All @@ -3060,24 +3083,10 @@ void MetaItem::insertFinalModel(int atLine)

// grab the passed in line
Where here(gui->topLevelFile(),atLine);
bool atStep = (QString(gui->readLine(here))
.contains(QRegExp("^0 STEP$")));

QString modelMeta = QString("0 !LPUB INSERT MODEL");
QString pageMeta = QString("0 !LPUB INSERT PAGE");

beginMacro("insertFinalModel");
if (atStep) {
appendMeta(here,modelMeta);
appendMeta(++here,pageMeta);
appendMeta(++here,step);
} else {
appendMeta(here,step);
appendMeta(++here,modelMeta);
appendMeta(++here,pageMeta);
}
// insert final model
insertDisplayModel(here, true /*Final Model*/);
emit gui->messageSig(LOG_INFO, QString("Final model inserted at lines: %1 to %2").arg(atLine+1).arg(here.lineNumber+1));
endMacro();
}

void MetaItem::deleteFinalModel(){
Expand Down
1 change: 1 addition & 0 deletions mainApp/metaitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ class MetaItem
void insertPage(QString &meta);
void appendPage(QString &meta);
void insertFinalModel(int atLine);
void insertDisplayModel(Where &here, bool = false);
void deleteFinalModel();

void insertPicture();
Expand Down
4 changes: 2 additions & 2 deletions mainApp/nativeviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ void Gui::removeBuildModification()
QStringList Gui::getViewerStepKeys(bool modelName, bool pliPart)
{
// viewerStepKey - 3 elements:
// CSI: 0=modelNameIndex, 1=lineNumber, 2=stepNumber [_fm (finalModel)]
// CSI: 0=modelNameIndex, 1=lineNumber, 2=stepNumber [_dm (displayModel)]
// SMP: 0=modelNameIndex, 1=lineNumber, 2=stepNumber [_Preview (Submodel Preview)]
// PLI: 0=partNameString, 1=colourNumber, 2=stepNumber
QStringList keys = viewerStepKey.split(";");
Expand Down Expand Up @@ -1412,7 +1412,7 @@ QStringList Gui::getViewerStepKeys(bool modelName, bool pliPart)

bool Gui::extractStepKey(Where &here, int &stepNumber)
{
// viewerStepKey elements CSI: 0=modelName, 1=lineNumber, 2=stepNumber [,3=_fm (finalModel)]
// viewerStepKey elements CSI: 0=modelName, 1=lineNumber, 2=stepNumber [,3=_dm (displayModel)]
QStringList keyArgs = getViewerStepKeys();

if (!keyArgs.size())
Expand Down
2 changes: 1 addition & 1 deletion mainApp/org.trevorsandy.lpub3d.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<binary>lpub3d24</binary>
​</provides>
<releases>
<release version="2.4.0.1745" date="2020-09-20">
<release version="2.4.0.1746" date="2020-09-20">
<description>
<p>LPub3D Linux AppImage package</p>
</description>
Expand Down
2 changes: 1 addition & 1 deletion mainApp/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3043,7 +3043,7 @@ bool Render::LoadStepProject(Project* StepProject, const QString& viewerStepKey)

#ifdef QT_DEBUG_MODE
// viewerStepKey - 3 elements:
// CSI: 0=modelName, 1=lineNumber, 2=stepNumber [_fm (finalModel)]
// CSI: 0=modelName, 1=lineNumber, 2=stepNumber [_dm (displayModel)]
// SMP: 0=modelName, 1=lineNumber, 2=stepNumber [_Preview (Submodel Preview)]
// PLI: 0=partName, 1=colourNumber, 2=stepNumber
QFileInfo outFileInfo(FileName);
Expand Down
1 change: 1 addition & 0 deletions mainApp/resources/autocomplete.lst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ CSI_ANNOTATION_PART
CUSTOM
CUSTOM_LENGTH
DISPLAY
DISPLAY_MODEL
DISPLAY_PAGE_NUMBER
DIVIDER
DIVIDER_ITEM
Expand Down
6 changes: 3 additions & 3 deletions mainApp/step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ int Step::createCsi(
if (nativeRenderer) {
nType = calledOut ? NTypeCalledOut : multiStep ? NTypeMultiStep : NTypeDefault;
}
QString csi_Name = modelDisplayOnlyStep ? csiName()+"_fm" : bfxLoad ? csiName()+"_bfx" : csiName();
QString csi_Name = modelDisplayOnlyStep ? csiName()+"_dm" : bfxLoad ? csiName()+"_bfx" : csiName();
bool invalidIMStep = ((modelDisplayOnlyStep) || (stepNumber.number == 1));
bool absRotstep = meta.rotStep.value().type == "ABS";
bool useImageSize = csiStepMeta.imageSize.value(0) > 0;
Expand Down Expand Up @@ -352,12 +352,12 @@ int Step::createCsi(
.arg(gui->getSubmodelIndex(top.modelName))
.arg(top.lineNumber)
.arg(stepNumber.number)
.arg(modelDisplayOnlyStep ? "_fm" : "");
.arg(modelDisplayOnlyStep ? "_dm" : "");

if (Preferences::debugLogging)
emit gui->messageSig(LOG_DEBUG,
QString("DEBUG - CSI ViewerStepKey Attributes "
"Key(modelNameIndex;lineNumber;stepNumber[_fm]) [%1], "
"Key(modelNameIndex;lineNumber;stepNumber[_dm]) [%1], "
"modelName [%2], "
"top lineNumber [%3], "
"step type [%4], "
Expand Down
21 changes: 13 additions & 8 deletions mainApp/traverse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,18 +1101,23 @@ int Gui::drawPage(
break;

case InsertFinalModelRc:
case InsertDisplayModelRc:
{
if (curMeta.LPub.fadeStep.fadeStep.value() || curMeta.LPub.highlightStep.highlightStep.value()){
// this is not a step but it's necessary to use the step object to place the model
// increment the step number down - so basically use previous number for step
// do this before creating the step so we can use in the file name during
// csi generation to indicate this step file is not an actual step - just a model display
// this is not a step but it's necessary to use the step object to place the model
// increment the step number down - so basically use the previous step number for this step.
// Do this before creating the step so we can use in the file name during
// csi generation to indicate this step file is not an actual step - just a model display
bool proceed = true;
if (rc == InsertFinalModelRc) {
proceed = curMeta.LPub.fadeStep.fadeStep.value() || curMeta.LPub.highlightStep.highlightStep.value();
}
if (proceed) {
opts.stepNum--;
if (step == nullptr) {
if (range == nullptr) {
range = newRange(steps,opts.calledOut);
steps->append(range);
}
}
step = new Step(topOfStep,
range,
opts.stepNum,
Expand All @@ -1123,8 +1128,8 @@ int Gui::drawPage(
step->modelDisplayOnlyStep = true;

range->append(step);
}
}
}
}
}
break;

Expand Down

0 comments on commit d41d7b0

Please sign in to comment.