mirror of
https://github.com/leozide/leocad
synced 2025-01-29 20:34:50 +01:00
Merge branch 'master' into feature-train-track-system-wizard
This commit is contained in:
commit
3c3da579c5
18 changed files with 554 additions and 182 deletions
|
@ -50,6 +50,7 @@ const QLatin1String LineEnding("\r\n");
|
||||||
#define LC_BLENDER_ADDON_API_STR LC_BLENDER_ADDON_REPO_API_STR "/blenderldrawrender/"
|
#define LC_BLENDER_ADDON_API_STR LC_BLENDER_ADDON_REPO_API_STR "/blenderldrawrender/"
|
||||||
#define LC_BLENDER_ADDON_LATEST_URL LC_BLENDER_ADDON_API_STR "releases/latest"
|
#define LC_BLENDER_ADDON_LATEST_URL LC_BLENDER_ADDON_API_STR "releases/latest"
|
||||||
#define LC_BLENDER_ADDON_URL LC_BLENDER_ADDON_STR "releases/latest/download/" LC_BLENDER_ADDON_FILE
|
#define LC_BLENDER_ADDON_URL LC_BLENDER_ADDON_STR "releases/latest/download/" LC_BLENDER_ADDON_FILE
|
||||||
|
#define LC_BLENDER_ADDON_SHA_HASH_URL LC_BLENDER_ADDON_URL ".sha256"
|
||||||
|
|
||||||
#define LC_THEME_DARK_PALETTE_MIDLIGHT "#3E3E3E" // 62, 62, 62, 255
|
#define LC_THEME_DARK_PALETTE_MIDLIGHT "#3E3E3E" // 62, 62, 62, 255
|
||||||
#define LC_THEME_DEFAULT_PALETTE_LIGHT "#AEADAC" // 174, 173, 172, 255
|
#define LC_THEME_DEFAULT_PALETTE_LIGHT "#AEADAC" // 174, 173, 172, 255
|
||||||
|
@ -106,12 +107,13 @@ lcBlenderPreferences::BlenderPaths lcBlenderPreferences::mDefaultPaths [NUM_PAT
|
||||||
/* Key: MM Key: Value: Label: Tooltip (Description):*/
|
/* Key: MM Key: Value: Label: Tooltip (Description):*/
|
||||||
/* 0 PATH_BLENDER */ {"blenderpath", "blenderpath", "", QObject::tr("Blender Path"), QObject::tr("Full file path to Blender application executable")},
|
/* 0 PATH_BLENDER */ {"blenderpath", "blenderpath", "", QObject::tr("Blender Path"), QObject::tr("Full file path to Blender application executable")},
|
||||||
/* 1 PATH_BLENDFILE */ {"blendfile", "blendfile", "", QObject::tr("Blendfile Path"), QObject::tr("Full file path to a supplement .blend file - specify to append additional settings")},
|
/* 1 PATH_BLENDFILE */ {"blendfile", "blendfile", "", QObject::tr("Blendfile Path"), QObject::tr("Full file path to a supplement .blend file - specify to append additional settings")},
|
||||||
/* 2. PATH_ENVIRONMENT */ {"environmentfile", "environmentfile", "", QObject::tr("Environment Texture Path"), QObject::tr("Full file path to .exr environment texture file - specify if not using default bundled in addon")},
|
/* 2 PATH_ENVIRONMENT */ {"environmentfile", "environmentfile", "", QObject::tr("Environment Texture Path"), QObject::tr("Full file path to .exr environment texture file - specify if not using default bundled in addon")},
|
||||||
/* 3 PATH_LDCONFIG */ {"customldconfigfile", "customldconfigfile", "", QObject::tr("Custom LDConfig Path"), QObject::tr("Full file path to custom LDConfig file - specify if not %1 alternate LDConfig file").arg(LC_PRODUCTNAME_STR)},
|
/* 3 PATH_LDCONFIG */ {"customldconfigfile", "customldconfigfile", "", QObject::tr("Custom LDConfig Path"), QObject::tr("Full file path to custom LDConfig file - specify if not %1 alternate LDConfig file").arg(LC_PRODUCTNAME_STR)},
|
||||||
/* 4 PATH_LDRAW */ {"ldrawdirectory", "ldrawpath", "", QObject::tr("LDraw Directory"), QObject::tr("Full directory path to the LDraw parts library (download from https://library.ldraw.org)")},
|
/* 4 PATH_LDRAW */ {"ldrawdirectory", "ldrawpath", "", QObject::tr("LDraw Directory"), QObject::tr("Full directory path to the LDraw parts library (download from https://library.ldraw.org)")},
|
||||||
/* 5 PATH_LSYNTH */ {"lsynthdirectory", "", "", QObject::tr("LSynth Directory"), QObject::tr("Full directory path to LSynth primitives - specify if not using default bundled in addon")},
|
/* 5 PATH_LSYNTH */ {"lsynthdirectory", "", "", QObject::tr("LSynth Directory"), QObject::tr("Full directory path to LSynth primitives - specify if not using default bundled in addon")},
|
||||||
/* 6 PATH_STUD_LOGO */ {"studlogodirectory", "", "", QObject::tr("Stud Logo Directory"), QObject::tr("Full directory path to stud logo primitives - if stud logo enabled, specify if unofficial parts not used or not using default bundled in addon")},
|
/* 6 PATH_STUD_LOGO */ {"studlogodirectory", "", "", QObject::tr("Stud Logo Directory"), QObject::tr("Full directory path to stud logo primitives - if stud logo enabled, specify if unofficial parts not used or not using default bundled in addon")},
|
||||||
/* 7 PATH_STUDIO_LDRAW */ {"", "studioldrawpath", "", QObject::tr("Stud.io LDraw Path"), QObject::tr("Full filepath to the Stud.io LDraw Parts Library (download from https://www.bricklink.com/v3/studio/download.page)")}
|
/* 7 PATH_STUDIO_LDRAW */ {"", "studioldrawpath", "", QObject::tr("Stud.io LDraw Path"), QObject::tr("Full filepath to the Stud.io LDraw Parts Library (download from https://www.bricklink.com/v3/studio/download.page)")},
|
||||||
|
/* 8 PATH_STUDIO_CUSTOM_PARTS */ {"", "studiocustompartspath", "", QObject::tr("Stud.io Custom Parts Path"),QObject::tr("Full filepath to the Stud.io LDraw Custom Parts")}
|
||||||
};
|
};
|
||||||
|
|
||||||
lcBlenderPreferences::BlenderSettings lcBlenderPreferences::mBlenderSettings [NUM_SETTINGS];
|
lcBlenderPreferences::BlenderSettings lcBlenderPreferences::mBlenderSettings [NUM_SETTINGS];
|
||||||
|
@ -212,7 +214,7 @@ lcBlenderPreferences::BlenderSettings lcBlenderPreferences::mDefaultSettingsMM
|
||||||
/* 25 LBL_PREFER_UNOFFICIAL */ {"preferunofficial", "0", QObject::tr("Prefer Unofficial Parts"), QObject::tr("Search for unofficial parts first")},
|
/* 25 LBL_PREFER_UNOFFICIAL */ {"preferunofficial", "0", QObject::tr("Prefer Unofficial Parts"), QObject::tr("Search for unofficial parts first")},
|
||||||
/* 26 LBL_PROFILE */ {"profile", "0", QObject::tr("Profile"), QObject::tr("Profile import performance")},
|
/* 26 LBL_PROFILE */ {"profile", "0", QObject::tr("Profile"), QObject::tr("Profile import performance")},
|
||||||
/* 27 LBL_RECALCULATE_NORMALS */ {"recalculatenormals", "0", QObject::tr("Recalculate Normals"), QObject::tr("Recalculate normals. Not recommended if BFC processing is active")},
|
/* 27 LBL_RECALCULATE_NORMALS */ {"recalculatenormals", "0", QObject::tr("Recalculate Normals"), QObject::tr("Recalculate normals. Not recommended if BFC processing is active")},
|
||||||
/* 28 LBL_REMOVE_DOUBLES_MM */ {"removedoubles", "1", QObject::tr("No Duplicate Vertices"), QObject::tr("Merge vertices that are within a certain distance.")},
|
/* 28 LBL_REMOVE_DOUBLES_MM */ {"removedoubles", "0", QObject::tr("No Duplicate Vertices"), QObject::tr("Merge vertices that are within a certain distance.")},
|
||||||
/* 29 LBL_RENDER_WINDOW_MM */ {"renderwindow", "1", QObject::tr("Display Render Window"), QObject::tr("Specify whether to display the render window during Blender user interface image file render")},
|
/* 29 LBL_RENDER_WINDOW_MM */ {"renderwindow", "1", QObject::tr("Display Render Window"), QObject::tr("Specify whether to display the render window during Blender user interface image file render")},
|
||||||
/* 30 LBL_SEARCH_ADDL_PATHS_MM */ {"searchadditionalpaths", "0", QObject::tr("Search Additional Paths"), QObject::tr("Specify whether to search additional LDraw paths")},
|
/* 30 LBL_SEARCH_ADDL_PATHS_MM */ {"searchadditionalpaths", "0", QObject::tr("Search Additional Paths"), QObject::tr("Specify whether to search additional LDraw paths")},
|
||||||
/* 31 LBL_SETEND_FRAME */ {"setendframe", "1", QObject::tr("Set Step End Frame"), QObject::tr("Set the end frame to the last step")},
|
/* 31 LBL_SETEND_FRAME */ {"setendframe", "1", QObject::tr("Set Step End Frame"), QObject::tr("Set the end frame to the last step")},
|
||||||
|
@ -240,8 +242,8 @@ lcBlenderPreferences::BlenderSettings lcBlenderPreferences::mDefaultSettingsMM
|
||||||
|
|
||||||
/* 52/00 LBL_CHOSEN_LOGO */ {"chosenlogo", "logo3", QObject::tr("Chosen Logo"), QObject::tr("Which logo to display. logo and logo2 aren't used and are only included for completeness")},
|
/* 52/00 LBL_CHOSEN_LOGO */ {"chosenlogo", "logo3", QObject::tr("Chosen Logo"), QObject::tr("Which logo to display. logo and logo2 aren't used and are only included for completeness")},
|
||||||
/* 53/01 LBL_COLOUR_SCHEME_MM */ {"usecolourscheme", "lgeo", QObject::tr("Colour Scheme"), QObject::tr("Colour scheme options - Realistic (lgeo), Original (LDConfig), Alternate (LDCfgalt), Custom (User Defined)")},
|
/* 53/01 LBL_COLOUR_SCHEME_MM */ {"usecolourscheme", "lgeo", QObject::tr("Colour Scheme"), QObject::tr("Colour scheme options - Realistic (lgeo), Original (LDConfig), Alternate (LDCfgalt), Custom (User Defined)")},
|
||||||
/* 54/02 LBL_COLOUR_STRATEGY */ {"colorstrategy", "material", QObject::tr("How To Color Parts"), QObject::tr("Colour strategy options - Material (Default - use if exporting), Vertex colors (slightly quicker to import)")},
|
/* 54/02 LBL_RESOLUTION_MM */ {"resolution", "Standard", QObject::tr("Resolution"), QObject::tr("Resolution of part primitives, ie. how much geometry they have")},
|
||||||
/* 55/03 LBL_RESOLUTION_MM */ {"resolution", "Standard", QObject::tr("Resolution"), QObject::tr("Resolution of part primitives, ie. how much geometry they have")},
|
/* 55/03 LBL_SCALE_STRATEGY */ {"scalestrategy", "mesh", QObject::tr("How To Scale Parts"), QObject::tr("Apply import scaling to mesh - Recommended for rendering, Apply import scaling to object - Recommended for part editing")},
|
||||||
/* 56/04 LBL_SMOOTH_TYPE */ {"smoothtype", "edge_split", QObject::tr("Smooth Type"), QObject::tr("Use either autosmooth or an edge split modifier to smooth part faces")}
|
/* 56/04 LBL_SMOOTH_TYPE */ {"smoothtype", "edge_split", QObject::tr("Smooth Type"), QObject::tr("Use either autosmooth or an edge split modifier to smooth part faces")}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -250,13 +252,22 @@ lcBlenderPreferences::ComboItems lcBlenderPreferences::mComboItemsMM [NUM_COMBO
|
||||||
/* FIRST item set as default Data Item: */
|
/* FIRST item set as default Data Item: */
|
||||||
/* 00 LBL_CHOSEN_LOGO */ {"logo3|logo4|logo5", QObject::tr("Raised flattened logo geometry(3)|Raised rounded logo geometry(4)|Subtle rounded logo geometry(5)")},
|
/* 00 LBL_CHOSEN_LOGO */ {"logo3|logo4|logo5", QObject::tr("Raised flattened logo geometry(3)|Raised rounded logo geometry(4)|Subtle rounded logo geometry(5)")},
|
||||||
/* 01 LBL_COLOUR_SCHEME_MM */ {"lgeo|ldraw|alt|custom", QObject::tr("Realistic Colours|Original LDraw Colours|Alternate LDraw Colours|Custom Colours")},
|
/* 01 LBL_COLOUR_SCHEME_MM */ {"lgeo|ldraw|alt|custom", QObject::tr("Realistic Colours|Original LDraw Colours|Alternate LDraw Colours|Custom Colours")},
|
||||||
/* 02 LBL_COLOUR_STRATEGY */ {"material|vertex_colors", QObject::tr("Material|Vertex Colors")},
|
/* 02 LBL_RESOLUTION_MM */ {"Low|Standard|High", QObject::tr("Low Resolution Primitives|Standard Primitives|High Resolution Primitives")},
|
||||||
/* 03 LBL_RESOLUTION_MM */ {"Low|Standard|High", QObject::tr("Low Resolution Primitives|Standard Primitives|High Resolution Primitives")},
|
/* 03 LBL_SCALE_STRATEGY */ {"mesh|object", QObject::tr("Scale Mesh|Scale Object")},
|
||||||
/* 04 LBL_SMOOTH_TYPE */ {"edge_split|auto_smooth|bmesh_split", QObject::tr("Smooth part faces with edge split modifier|Auto-smooth part faces|Split during initial mesh processing")}
|
/* 04 LBL_SMOOTH_TYPE */ {"edge_split|auto_smooth|bmesh_split", QObject::tr("Smooth part faces with edge split modifier|Auto-smooth part faces|Split during initial mesh processing")}
|
||||||
};
|
};
|
||||||
|
|
||||||
lcBlenderPreferences* gAddonPreferences;
|
lcBlenderPreferences* gAddonPreferences;
|
||||||
|
|
||||||
|
enum AddonEnc
|
||||||
|
{
|
||||||
|
ADDON_EXTRACT,
|
||||||
|
ADDON_DOWNLOAD,
|
||||||
|
ADDON_NO_ACTION,
|
||||||
|
ADDON_CANCELED,
|
||||||
|
ADDON_FAIL
|
||||||
|
};
|
||||||
|
|
||||||
lcBlenderPreferencesDialog::lcBlenderPreferencesDialog(int Width, int Height, double Scale, QWidget* Parent)
|
lcBlenderPreferencesDialog::lcBlenderPreferencesDialog(int Width, int Height, double Scale, QWidget* Parent)
|
||||||
: QDialog(Parent)
|
: QDialog(Parent)
|
||||||
{
|
{
|
||||||
|
@ -1056,6 +1067,7 @@ void lcBlenderPreferences::ConfigureBlenderAddon(bool TestBlender, bool AddonUpd
|
||||||
mProgressBar->setValue(1);
|
mProgressBar->setValue(1);
|
||||||
|
|
||||||
TestBlender |= sender() == mPathLineEditList[PATH_BLENDER];
|
TestBlender |= sender() == mPathLineEditList[PATH_BLENDER];
|
||||||
|
mAddonVersionLabel->setText(tr("Installing..."));
|
||||||
if (TestBlender)
|
if (TestBlender)
|
||||||
{
|
{
|
||||||
mExeGridLayout->replaceWidget(mBlenderVersionEdit, mProgressBar);
|
mExeGridLayout->replaceWidget(mBlenderVersionEdit, mProgressBar);
|
||||||
|
@ -1156,6 +1168,7 @@ void lcBlenderPreferences::ConfigureBlenderAddon(bool TestBlender, bool AddonUpd
|
||||||
mProgressBar->setMinimum(0);
|
mProgressBar->setMinimum(0);
|
||||||
mProgressBar->setValue(1);
|
mProgressBar->setValue(1);
|
||||||
mAddonGridLayout->replaceWidget(mAddonVersionEdit, mProgressBar);
|
mAddonGridLayout->replaceWidget(mAddonVersionEdit, mProgressBar);
|
||||||
|
mAddonVersionLabel->setText(tr("Downloading..."));
|
||||||
mProgressBar->show();
|
mProgressBar->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1177,7 +1190,8 @@ void lcBlenderPreferences::ConfigureBlenderAddon(bool TestBlender, bool AddonUpd
|
||||||
mAddonUpdateButton->setEnabled(mConfigured);
|
mAddonUpdateButton->setEnabled(mConfigured);
|
||||||
if (mProgressBar)
|
if (mProgressBar)
|
||||||
{
|
{
|
||||||
mExeGridLayout->replaceWidget(mProgressBar, mAddonVersionEdit);
|
mAddonGridLayout->replaceWidget(mProgressBar, mAddonVersionEdit);
|
||||||
|
mAddonVersionLabel->setText(tr("Blender Addon"));
|
||||||
mProgressBar->close();
|
mProgressBar->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1187,11 +1201,11 @@ void lcBlenderPreferences::ConfigureBlenderAddon(bool TestBlender, bool AddonUpd
|
||||||
if (!QFileInfo(BlenderInstallFile).exists())
|
if (!QFileInfo(BlenderInstallFile).exists())
|
||||||
{
|
{
|
||||||
ShowMessage(tr ("Could not find addon install file: %1").arg(BlenderInstallFile));
|
ShowMessage(tr ("Could not find addon install file: %1").arg(BlenderInstallFile));
|
||||||
StatusUpdate(true, true, tr("Addon file not found."));
|
StatusUpdate(true, true, tr("Not found."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusUpdate(true, false, tr("Install addon..."));
|
StatusUpdate(true, false, tr("Installing..."));
|
||||||
|
|
||||||
QDir ConfigDir(BlenderConfigDir);
|
QDir ConfigDir(BlenderConfigDir);
|
||||||
if(!QDir(ConfigDir).exists())
|
if(!QDir(ConfigDir).exists())
|
||||||
|
@ -1271,7 +1285,7 @@ void lcBlenderPreferences::ConfigureBlenderAddon(bool TestBlender, bool AddonUpd
|
||||||
Result = ProcessCommand(PR_INSTALL);
|
Result = ProcessCommand(PR_INSTALL);
|
||||||
|
|
||||||
if (Result != PR_OK)
|
if (Result != PR_OK)
|
||||||
StatusUpdate(true, true, tr("Addon install failed."));
|
StatusUpdate(true, true, tr("Install failed."));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ShowMessage(tr("Blender executable not found at [%1]").arg(BlenderExe), tr("Addon install failed."));
|
ShowMessage(tr("Blender executable not found at [%1]").arg(BlenderExe), tr("Addon install failed."));
|
||||||
|
@ -1279,57 +1293,41 @@ void lcBlenderPreferences::ConfigureBlenderAddon(bool TestBlender, bool AddonUpd
|
||||||
|
|
||||||
bool lcBlenderPreferences::ExtractBlenderAddon(const QString& BlenderDir)
|
bool lcBlenderPreferences::ExtractBlenderAddon(const QString& BlenderDir)
|
||||||
{
|
{
|
||||||
bool Proceed = true;
|
bool Extracted = false;
|
||||||
|
|
||||||
QDir Dir(BlenderDir);
|
QDir Dir(BlenderDir);
|
||||||
if (!Dir.exists())
|
if (!Dir.exists())
|
||||||
Dir.mkdir(BlenderDir);
|
Dir.mkdir(BlenderDir);
|
||||||
|
|
||||||
if (GetBlenderAddon(BlenderDir))
|
AddonEnc AddonAction = AddonEnc(GetBlenderAddon(BlenderDir));
|
||||||
|
if (AddonAction == ADDON_EXTRACT)
|
||||||
{
|
{
|
||||||
gAddonPreferences->StatusUpdate(true, false, tr("Extract addon..."));
|
gAddonPreferences->StatusUpdate(true, false, tr("Extracting..."));
|
||||||
const QString BlenderAddonFile = QDir::toNativeSeparators(QString("%1/%2").arg(BlenderDir).arg(LC_BLENDER_ADDON_FILE));
|
const QString BlenderAddonFile = QDir::toNativeSeparators(QString("%1/%2").arg(BlenderDir).arg(LC_BLENDER_ADDON_FILE));
|
||||||
|
|
||||||
QString Result;
|
QString Result;
|
||||||
bool Success = gAddonPreferences->ExtractAddon(BlenderAddonFile, Result);
|
Extracted = gAddonPreferences->ExtractAddon(BlenderAddonFile, Result);
|
||||||
|
|
||||||
if (!Success)
|
if (!Extracted)
|
||||||
{
|
{
|
||||||
QString Message = tr("Failed to extract %1 to %2").arg(LC_BLENDER_ADDON_FILE).arg(BlenderDir);
|
QString Message = tr("Failed to extract %1 to %2").arg(LC_BLENDER_ADDON_FILE).arg(BlenderDir);
|
||||||
if (Result.size())
|
if (Result.size())
|
||||||
Message.append(" "+Result);
|
Message.append(" "+Result);
|
||||||
|
|
||||||
ShowMessage(Message, tr("Extract addon"));
|
ShowMessage(Message, tr("Extract addon"));
|
||||||
|
|
||||||
Proceed = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Proceed)
|
return Extracted;
|
||||||
gAddonPreferences->StatusUpdate(true, true,tr("Extract addon failed."));
|
|
||||||
|
|
||||||
return Proceed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lcBlenderPreferences::GetBlenderAddon(const QString& BlenderDir)
|
int lcBlenderPreferences::GetBlenderAddon(const QString& BlenderDir)
|
||||||
{
|
{
|
||||||
enum AddonEnc
|
|
||||||
{
|
|
||||||
ADDON_FAIL = -1,
|
|
||||||
ADDON_NOT_FOUND,
|
|
||||||
ADDON_DOWNLOAD = ADDON_NOT_FOUND,
|
|
||||||
ADDON_ARCHIVE,
|
|
||||||
ADDON_EXTRACTED,
|
|
||||||
ADDON_RELOAD,
|
|
||||||
ADDON_CANCEL
|
|
||||||
};
|
|
||||||
|
|
||||||
const QString BlenderAddonDir = QDir::toNativeSeparators(QString("%1/addons").arg(BlenderDir));
|
const QString BlenderAddonDir = QDir::toNativeSeparators(QString("%1/addons").arg(BlenderDir));
|
||||||
const QString BlenderAddonFile = QDir::toNativeSeparators(QString("%1/%2").arg(BlenderDir).arg(LC_BLENDER_ADDON_FILE));
|
const QString BlenderAddonFile = QDir::toNativeSeparators(QString("%1/%2").arg(BlenderDir).arg(LC_BLENDER_ADDON_FILE));
|
||||||
const QString AddonVersionFile = QDir::toNativeSeparators(QString("%1/%2/__version__.py").arg(BlenderAddonDir).arg(LC_BLENDER_ADDON_FOLDER_STR));
|
const QString AddonVersionFile = QDir::toNativeSeparators(QString("%1/%2/__version__.py").arg(BlenderAddonDir).arg(LC_BLENDER_ADDON_FOLDER_STR));
|
||||||
bool ExtractedAddon = QFileInfo(AddonVersionFile).isReadable();
|
bool ExtractedAddon = QFileInfo(AddonVersionFile).isReadable();
|
||||||
bool BlenderAddonExists = ExtractedAddon || QFileInfo(BlenderAddonFile).isReadable();
|
bool BlenderAddonValidated = ExtractedAddon || QFileInfo(BlenderAddonFile).isReadable();
|
||||||
QString AddonStatus = tr("Installing Blender addon...");
|
|
||||||
AddonEnc AddonAction = ADDON_DOWNLOAD;
|
AddonEnc AddonAction = ADDON_DOWNLOAD;
|
||||||
QString LocalVersion, OnlineVersion;
|
QString LocalVersion, OnlineVersion;
|
||||||
|
|
||||||
|
@ -1442,11 +1440,11 @@ bool lcBlenderPreferences::GetBlenderAddon(const QString& BlenderDir)
|
||||||
return true; // Reload existing archive
|
return true; // Reload existing archive
|
||||||
};
|
};
|
||||||
|
|
||||||
if (BlenderAddonExists)
|
if (BlenderAddonValidated)
|
||||||
{
|
{
|
||||||
if (GetBlenderAddonVersionMatch())
|
if (GetBlenderAddonVersionMatch())
|
||||||
{
|
{
|
||||||
AddonAction = ADDON_RELOAD;
|
AddonAction = ADDON_NO_ACTION;
|
||||||
}
|
}
|
||||||
else if (gMainWindow)
|
else if (gMainWindow)
|
||||||
{
|
{
|
||||||
|
@ -1460,32 +1458,22 @@ bool lcBlenderPreferences::GetBlenderAddon(const QString& BlenderDir)
|
||||||
int Exec = ShowMessage(Header, Title, Body, QString(), MBB_YES, QMessageBox::NoIcon);
|
int Exec = ShowMessage(Header, Title, Body, QString(), MBB_YES, QMessageBox::NoIcon);
|
||||||
if (Exec == QMessageBox::Cancel)
|
if (Exec == QMessageBox::Cancel)
|
||||||
{
|
{
|
||||||
AddonStatus = tr("Blender addon setup cancelled");
|
AddonAction = ADDON_CANCELED;
|
||||||
AddonAction = ADDON_CANCEL;
|
gAddonPreferences->mDialogCancelled = true;
|
||||||
}
|
}
|
||||||
else if (Exec == QMessageBox::No)
|
else if (Exec == QMessageBox::No)
|
||||||
{
|
AddonAction = ADDON_NO_ACTION;
|
||||||
AddonAction = ADDON_RELOAD;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
AddonAction = ADDON_NO_ACTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AddonAction != ADDON_DOWNLOAD)
|
||||||
|
return AddonAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto RemoveOldBlenderAddon = [&] (const QString& OldBlenderAddonFile)
|
||||||
{
|
{
|
||||||
AddonAction = ADDON_RELOAD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AddonAction == ADDON_DOWNLOAD)
|
|
||||||
AddonStatus = tr("Download addon...");
|
|
||||||
|
|
||||||
gAddonPreferences->StatusUpdate(true, false, AddonStatus);
|
|
||||||
|
|
||||||
if (AddonAction == ADDON_CANCEL)
|
|
||||||
{
|
|
||||||
gAddonPreferences->mDialogCancelled = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (QFileInfo(BlenderAddonDir).exists())
|
if (QFileInfo(BlenderAddonDir).exists())
|
||||||
{
|
{
|
||||||
bool Result = true;
|
bool Result = true;
|
||||||
|
@ -1498,14 +1486,16 @@ bool lcBlenderPreferences::GetBlenderAddon(const QString& BlenderDir)
|
||||||
Result &= QFile::remove(FileInfo.absoluteFilePath());
|
Result &= QFile::remove(FileInfo.absoluteFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (QFileInfo(OldBlenderAddonFile).exists())
|
||||||
|
Result &= QFile::remove(OldBlenderAddonFile);
|
||||||
|
|
||||||
Result &= Dir.rmdir(BlenderAddonDir);
|
Result &= Dir.rmdir(BlenderAddonDir);
|
||||||
if (!Result)
|
if (!Result)
|
||||||
ShowMessage(tr("Failed to remove Blender addon: %1").arg(BlenderAddonDir), tr("Remove Existing Addon"), QString(), QString(), MBB_OK, QMessageBox::Warning);
|
ShowMessage(tr("Failed to properly remove Blender addon: %1").arg(BlenderAddonDir), tr("Remove Existing Addon"), QString(), QString(), MBB_OK, QMessageBox::Warning);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (AddonAction == ADDON_DOWNLOAD)
|
BlenderAddonValidated = false;
|
||||||
{
|
|
||||||
BlenderAddonExists = false;
|
|
||||||
lcHttpManager* HttpManager = new lcHttpManager(gAddonPreferences);
|
lcHttpManager* HttpManager = new lcHttpManager(gAddonPreferences);
|
||||||
connect(HttpManager, SIGNAL(DownloadFinished(lcHttpReply*)), gAddonPreferences, SLOT(DownloadFinished(lcHttpReply*)));
|
connect(HttpManager, SIGNAL(DownloadFinished(lcHttpReply*)), gAddonPreferences, SLOT(DownloadFinished(lcHttpReply*)));
|
||||||
gAddonPreferences->mHttpReply = HttpManager->DownloadFile(QLatin1String(LC_BLENDER_ADDON_URL));
|
gAddonPreferences->mHttpReply = HttpManager->DownloadFile(QLatin1String(LC_BLENDER_ADDON_URL));
|
||||||
|
@ -1513,36 +1503,91 @@ bool lcBlenderPreferences::GetBlenderAddon(const QString& BlenderDir)
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
if (!gAddonPreferences->mData.isEmpty())
|
if (!gAddonPreferences->mData.isEmpty())
|
||||||
{
|
{
|
||||||
|
const QString OldBlenderAddonFile = QString("%1.hold").arg(BlenderAddonFile);
|
||||||
if (QFileInfo(BlenderAddonFile).exists())
|
if (QFileInfo(BlenderAddonFile).exists())
|
||||||
{
|
{
|
||||||
QDir Dir(BlenderDir);
|
if (!QFile::rename(BlenderAddonFile, OldBlenderAddonFile))
|
||||||
if (!Dir.remove(BlenderAddonFile))
|
ShowMessage(tr("Failed to rename existing Blender addon archive %1.").arg(BlenderAddonFile));
|
||||||
ShowMessage(tr("Failed to remove Blender addon archive:<br>%1").arg(BlenderAddonFile));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ArchiveFileName, OldArchiveFileName = QFileInfo(OldBlenderAddonFile).fileName();
|
||||||
QFile File(BlenderAddonFile);
|
QFile File(BlenderAddonFile);
|
||||||
if (File.open(QIODevice::WriteOnly))
|
if (File.open(QIODevice::WriteOnly))
|
||||||
{
|
{
|
||||||
File.write(gAddonPreferences->mData);
|
File.write(gAddonPreferences->mData);
|
||||||
File.close();
|
File.close();
|
||||||
BlenderAddonExists = true;
|
if (File.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
|
QCryptographicHash Sha256Hash(QCryptographicHash::Sha256);
|
||||||
|
qint64 DataSize = File.size();
|
||||||
|
const qint64 BufferSize = Q_INT64_C(1000);
|
||||||
|
char Buf[BufferSize];
|
||||||
|
int BytesRead;
|
||||||
|
int ReadSize = qMin(DataSize, BufferSize);
|
||||||
|
while (ReadSize > 0 && (BytesRead = File.read(Buf, ReadSize)) > 0)
|
||||||
|
{
|
||||||
|
DataSize -= BytesRead;
|
||||||
|
Sha256Hash.addData(Buf, BytesRead);
|
||||||
|
ReadSize = qMin(DataSize, BufferSize);
|
||||||
|
}
|
||||||
|
File.close();
|
||||||
|
const QString ShaCalculated = Sha256Hash.result().toHex();
|
||||||
|
|
||||||
|
gAddonPreferences->mData.clear();
|
||||||
|
gAddonPreferences->mHttpReply = HttpManager->DownloadFile(QLatin1String(LC_BLENDER_ADDON_SHA_HASH_URL));
|
||||||
|
while (gAddonPreferences->mHttpReply)
|
||||||
|
QApplication::processEvents();
|
||||||
|
if (!gAddonPreferences->mData.isEmpty())
|
||||||
|
{
|
||||||
|
const QStringList ShaReceived = QString(gAddonPreferences->mData).trimmed().split(" ", SkipEmptyParts);
|
||||||
|
if (ShaReceived.first() == ShaCalculated)
|
||||||
|
{
|
||||||
|
ArchiveFileName = QFileInfo(BlenderAddonFile).fileName();
|
||||||
|
if (ArchiveFileName == ShaReceived.last())
|
||||||
|
{
|
||||||
|
RemoveOldBlenderAddon(OldBlenderAddonFile);
|
||||||
|
BlenderAddonValidated = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ShowMessage(tr("Failed to validate Blender addon file name<br>Downloaded:%1<br>Received:%2").arg(ArchiveFileName, ShaReceived.last()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ShowMessage(tr("Failed to validate Blender addon SHA hash <br>Calculated:%1<br>Received:%2").arg(ShaCalculated, ShaReceived.first()));
|
||||||
gAddonPreferences->mData.clear();
|
gAddonPreferences->mData.clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ShowMessage(tr("Failed to open Blender addon file:<br>%1:<br>%2").arg(BlenderAddonFile).arg(File.errorString()));
|
ShowMessage(tr("Failed to receive SHA hash for Blender addon %1.sha256").arg(LC_BLENDER_ADDON_FILE));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ShowMessage(tr("Failed to download Blender addon archive:<br>%1").arg(BlenderAddonFile));
|
ShowMessage(tr("Failed to read Blender addon archive:<br>%1:<br>%2").arg(BlenderAddonFile).arg(File.errorString()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ShowMessage(tr("Failed to write Blender addon archive:<br>%1:<br>%2").arg(BlenderAddonFile).arg(File.errorString()));
|
||||||
|
|
||||||
if (!BlenderAddonExists)
|
if (!BlenderAddonValidated)
|
||||||
{
|
{
|
||||||
AddonStatus = tr("Download addon failed.");
|
if (QFileInfo(BlenderAddonFile).exists())
|
||||||
gAddonPreferences->StatusUpdate(true, true, AddonStatus);
|
if (!QFile::remove(BlenderAddonFile))
|
||||||
|
ShowMessage(tr("Failed to remove invalid Blender addon archive:<br>%1").arg(BlenderAddonFile));
|
||||||
|
if (QFileInfo(OldBlenderAddonFile).exists())
|
||||||
|
if (!QFile::rename(OldBlenderAddonFile, BlenderAddonFile))
|
||||||
|
ShowMessage(tr("Failed to restore Blender addon archive:<br>%1 from %2").arg(ArchiveFileName, OldArchiveFileName));
|
||||||
|
AddonAction = ADDON_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!BlenderAddonExists)
|
else
|
||||||
ShowMessage(tr("Blender addon archive %1 was not found").arg(BlenderAddonFile));
|
{
|
||||||
|
ShowMessage(tr("Failed to download Blender addon archive:<br>%1").arg(BlenderAddonFile));
|
||||||
|
AddonAction = ADDON_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
return BlenderAddonExists;
|
if (!BlenderAddonValidated)
|
||||||
|
gAddonPreferences->StatusUpdate(true, true, tr("Download failed."));
|
||||||
|
|
||||||
|
if (!QDir(BlenderAddonDir).exists() && QFileInfo(BlenderAddonFile).exists())
|
||||||
|
AddonAction = ADDON_EXTRACT;
|
||||||
|
|
||||||
|
return AddonAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcBlenderPreferences::StatusUpdate(bool Addon, bool Error, const QString& Message)
|
void lcBlenderPreferences::StatusUpdate(bool Addon, bool Error, const QString& Message)
|
||||||
|
@ -1560,6 +1605,8 @@ void lcBlenderPreferences::StatusUpdate(bool Addon, bool Error, const QString& M
|
||||||
mExeGridLayout->replaceWidget(mProgressBar, mBlenderVersionEdit);
|
mExeGridLayout->replaceWidget(mProgressBar, mBlenderVersionEdit);
|
||||||
mProgressBar->hide();
|
mProgressBar->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mAddonVersionLabel->setText(Which);
|
||||||
}
|
}
|
||||||
if (Error)
|
if (Error)
|
||||||
{
|
{
|
||||||
|
@ -1575,6 +1622,7 @@ void lcBlenderPreferences::StatusUpdate(bool Addon, bool Error, const QString& M
|
||||||
: Preferences.mColorTheme == lcColorTheme::Dark
|
: Preferences.mColorTheme == lcColorTheme::Dark
|
||||||
? QLatin1String(LC_THEME_DARK_DECORATE_QUOTED_TEXT)
|
? QLatin1String(LC_THEME_DARK_DECORATE_QUOTED_TEXT)
|
||||||
: QLatin1String("blue");
|
: QLatin1String("blue");
|
||||||
|
|
||||||
mDialogCancelled = true;
|
mDialogCancelled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1612,7 +1660,7 @@ void lcBlenderPreferences::ShowResult()
|
||||||
{
|
{
|
||||||
const QString BlenderDir = QString("%1/Blender").arg(mDataDir);
|
const QString BlenderDir = QString("%1/Blender").arg(mDataDir);
|
||||||
Message = tr("Addon install failed. See %1/stderr-blender-addon-install for details.").arg(BlenderDir);
|
Message = tr("Addon install failed. See %1/stderr-blender-addon-install for details.").arg(BlenderDir);
|
||||||
StatusUpdate(true, true,tr("%1: Addon install failed.").arg("Error"));
|
StatusUpdate(true, true,tr("Error: Install failed."));
|
||||||
mConfigured = false;
|
mConfigured = false;
|
||||||
|
|
||||||
const QString& Title = tr ("%1 Blender Addon Install").arg(LC_PRODUCTNAME_STR);
|
const QString& Title = tr ("%1 Blender Addon Install").arg(LC_PRODUCTNAME_STR);
|
||||||
|
@ -2419,14 +2467,15 @@ void lcBlenderPreferences::LoadSettings()
|
||||||
const QString DefaultBlendFile = QString("%1/Blender/config/%2").arg(gAddonPreferences->mDataDir).arg(LC_BLENDER_ADDON_BLEND_FILE);
|
const QString DefaultBlendFile = QString("%1/Blender/config/%2").arg(gAddonPreferences->mDataDir).arg(LC_BLENDER_ADDON_BLEND_FILE);
|
||||||
|
|
||||||
QStringList const AddonPaths = QStringList()
|
QStringList const AddonPaths = QStringList()
|
||||||
/* PATH_BLENDER */ << lcGetProfileString(LC_PROFILE_BLENDER_PATH)
|
/* 0 PATH_BLENDER */ << lcGetProfileString(LC_PROFILE_BLENDER_PATH)
|
||||||
/* PATH_BLENDFILE */ << (QFileInfo(DefaultBlendFile).exists() ? DefaultBlendFile : QString())
|
/* 1 PATH_BLENDFILE */ << (QFileInfo(DefaultBlendFile).exists() ? DefaultBlendFile : QString())
|
||||||
/* PATH_ENVIRONMENT */ << QString()
|
/* 2 PATH_ENVIRONMENT */ << QString()
|
||||||
/* PATH_LDCONFIG */ << lcGetProfileString(LC_PROFILE_COLOR_CONFIG)
|
/* 3 PATH_LDCONFIG */ << lcGetProfileString(LC_PROFILE_COLOR_CONFIG)
|
||||||
/* PATH_LDRAW */ << QFileInfo(lcGetProfileString(LC_PROFILE_PARTS_LIBRARY)).absolutePath()
|
/* 4 PATH_LDRAW */ << QFileInfo(lcGetProfileString(LC_PROFILE_PARTS_LIBRARY)).absolutePath()
|
||||||
/* PATH_LSYNTH */ << QString()
|
/* 5 PATH_LSYNTH */ << QString()
|
||||||
/* PATH_STUD_LOGO */ << QString()
|
/* 6 PATH_STUD_LOGO */ << QString()
|
||||||
/* PATH_STUDIO_LDRAW */ << QString();
|
/* 7 PATH_STUDIO_LDRAW */ << QString()
|
||||||
|
/* 8 PATH_STUDIO_CUSTOM_PARTS */ << QString();
|
||||||
for (int LblIdx = 0; LblIdx < NumPaths(DEFAULT_SETTINGS); LblIdx++)
|
for (int LblIdx = 0; LblIdx < NumPaths(DEFAULT_SETTINGS); LblIdx++)
|
||||||
{
|
{
|
||||||
mBlenderPaths[LblIdx] =
|
mBlenderPaths[LblIdx] =
|
||||||
|
@ -2478,7 +2527,7 @@ void lcBlenderPreferences::LoadSettings()
|
||||||
|
|
||||||
for (int LblIdx = 1/*skip blender executable*/; LblIdx < NumPaths(); LblIdx++)
|
for (int LblIdx = 1/*skip blender executable*/; LblIdx < NumPaths(); LblIdx++)
|
||||||
{
|
{
|
||||||
if (LblIdx == PATH_STUDIO_LDRAW)
|
if (LblIdx >= PATH_STUDIO_LDRAW)
|
||||||
continue;
|
continue;
|
||||||
const QString& Key = QString("%1/%2").arg(LC_BLENDER_ADDON, mBlenderPaths[LblIdx].key);
|
const QString& Key = QString("%1/%2").arg(LC_BLENDER_ADDON, mBlenderPaths[LblIdx].key);
|
||||||
const QString& Value = Settings.value(Key, QString()).toString();
|
const QString& Value = Settings.value(Key, QString()).toString();
|
||||||
|
@ -2614,12 +2663,12 @@ void lcBlenderPreferences::SaveSettings()
|
||||||
|
|
||||||
for (int LblIdx = 1/*skip blender executable*/; LblIdx < NumPaths(); LblIdx++)
|
for (int LblIdx = 1/*skip blender executable*/; LblIdx < NumPaths(); LblIdx++)
|
||||||
{
|
{
|
||||||
if (LblIdx == PATH_STUDIO_LDRAW)
|
if (LblIdx >= PATH_STUDIO_LDRAW)
|
||||||
continue;
|
continue;
|
||||||
Key = mBlenderPaths[LblIdx].key;
|
Key = mBlenderPaths[LblIdx].key;
|
||||||
Value = QDir::toNativeSeparators(mBlenderPaths[LblIdx].value);
|
Value = QDir::toNativeSeparators(mBlenderPaths[LblIdx].value);
|
||||||
|
|
||||||
if (Settings.contains(Key))
|
if (!Key.isEmpty())
|
||||||
Settings.setValue(Key, QVariant(Value));
|
Settings.setValue(Key, QVariant(Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2643,7 +2692,7 @@ void lcBlenderPreferences::SaveSettings()
|
||||||
|
|
||||||
Key = mBlenderSettings[LblIdx].key;
|
Key = mBlenderSettings[LblIdx].key;
|
||||||
|
|
||||||
if (Settings.contains(Key))
|
if (!Key.isEmpty())
|
||||||
Settings.setValue(Key, QVariant(Value));
|
Settings.setValue(Key, QVariant(Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2662,7 +2711,7 @@ void lcBlenderPreferences::SaveSettings()
|
||||||
Key = mBlenderPaths[LblIdx].key_mm;
|
Key = mBlenderPaths[LblIdx].key_mm;
|
||||||
Value = QDir::toNativeSeparators(mBlenderPaths[LblIdx].value);
|
Value = QDir::toNativeSeparators(mBlenderPaths[LblIdx].value);
|
||||||
|
|
||||||
if (Settings.contains(Key))
|
if (!Key.isEmpty())
|
||||||
Settings.setValue(Key, QVariant(Value));
|
Settings.setValue(Key, QVariant(Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2683,7 +2732,7 @@ void lcBlenderPreferences::SaveSettings()
|
||||||
|
|
||||||
Key = mBlenderSettingsMM[LblIdx].key;
|
Key = mBlenderSettingsMM[LblIdx].key;
|
||||||
|
|
||||||
if (Settings.contains(Key))
|
if (!Key.isEmpty())
|
||||||
Settings.setValue(Key, QVariant(Value));
|
Settings.setValue(Key, QVariant(Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ protected:
|
||||||
static int NumPaths(bool DefaultSettings = false);
|
static int NumPaths(bool DefaultSettings = false);
|
||||||
static int NumSettings(bool DefaultSettings = false);
|
static int NumSettings(bool DefaultSettings = false);
|
||||||
static int NumSettingsMM(bool DefaultSettings = false);
|
static int NumSettingsMM(bool DefaultSettings = false);
|
||||||
static bool GetBlenderAddon(const QString& BlenderDir);
|
static int GetBlenderAddon(const QString& BlenderDir);
|
||||||
static bool ExtractBlenderAddon(const QString& BlenderDir);
|
static bool ExtractBlenderAddon(const QString& BlenderDir);
|
||||||
static void LoadDefaultParameters(QByteArray& Buffer, int Which);
|
static void LoadDefaultParameters(QByteArray& Buffer, int Which);
|
||||||
static bool OverwriteFile(const QString& File);
|
static bool OverwriteFile(const QString& File);
|
||||||
|
@ -129,6 +129,7 @@ private:
|
||||||
PATH_LSYNTH, // 5 QLineEdit/QPushButton
|
PATH_LSYNTH, // 5 QLineEdit/QPushButton
|
||||||
PATH_STUD_LOGO, // 6 QLineEdit/QPushButton
|
PATH_STUD_LOGO, // 6 QLineEdit/QPushButton
|
||||||
PATH_STUDIO_LDRAW, // 7 QLineEdit/QPushButton
|
PATH_STUDIO_LDRAW, // 7 QLineEdit/QPushButton
|
||||||
|
PATH_STUDIO_CUSTOM_PARTS, // 8 QLineEdit/QPushButton
|
||||||
|
|
||||||
NUM_PATHS
|
NUM_PATHS
|
||||||
};
|
};
|
||||||
|
@ -239,10 +240,10 @@ private:
|
||||||
LBL_BLEND_FILE_TRUSTED_MM, // 2 QCheckBox
|
LBL_BLEND_FILE_TRUSTED_MM, // 2 QCheckBox
|
||||||
LBL_CASE_SENSITIVE_FILESYSTEM, // 3 QCheckBox
|
LBL_CASE_SENSITIVE_FILESYSTEM, // 3 QCheckBox
|
||||||
LBL_CROP_IMAGE_MM, // 4 QCheckBox
|
LBL_CROP_IMAGE_MM, // 4 QCheckBox
|
||||||
LBL_DISPLAY_LOGO, // 5 QCheckBox
|
NUM_COMBO_ITEMS_MM, // 5
|
||||||
|
LBL_DISPLAY_LOGO = NUM_COMBO_ITEMS_MM, // 5 QCheckBox
|
||||||
LBL_IMPORT_CAMERAS_MM, // 6 QCheckBox
|
LBL_IMPORT_CAMERAS_MM, // 6 QCheckBox
|
||||||
NUM_COMBO_ITEMS_MM, // 7
|
LBL_IMPORT_EDGES, // 7 QCheckBox
|
||||||
LBL_IMPORT_EDGES = NUM_COMBO_ITEMS_MM, // 7 QCheckBox
|
|
||||||
LBL_IMPORT_LIGHTS_MM, // 8 QCheckBox
|
LBL_IMPORT_LIGHTS_MM, // 8 QCheckBox
|
||||||
LBL_KEEP_ASPECT_RATIO_MM, // 9 QCheckBox
|
LBL_KEEP_ASPECT_RATIO_MM, // 9 QCheckBox
|
||||||
LBL_MAKE_GAPS, // 10 QCheckBox
|
LBL_MAKE_GAPS, // 10 QCheckBox
|
||||||
|
@ -291,8 +292,8 @@ private:
|
||||||
|
|
||||||
LBL_CHOSEN_LOGO, // 52/ 0 QComboBox
|
LBL_CHOSEN_LOGO, // 52/ 0 QComboBox
|
||||||
LBL_COLOUR_SCHEME_MM, // 53/ 1 QComboBox
|
LBL_COLOUR_SCHEME_MM, // 53/ 1 QComboBox
|
||||||
LBL_COLOUR_STRATEGY, // 54/ 2 QComboBox
|
LBL_RESOLUTION_MM, // 54/ 2 QComboBox
|
||||||
LBL_RESOLUTION_MM, // 55/ 3 QComboBox
|
LBL_SCALE_STRATEGY, // 55/ 3 QComboBox
|
||||||
LBL_SMOOTH_TYPE, // 56/ 4 QComboBox
|
LBL_SMOOTH_TYPE, // 56/ 4 QComboBox
|
||||||
|
|
||||||
NUM_SETTINGS_MM
|
NUM_SETTINGS_MM
|
||||||
|
@ -309,10 +310,10 @@ private:
|
||||||
CTL_COLOUR_SCHEME_COMBO_MM = CTL_BEVEL_EDGES_BOX_MM, // 1
|
CTL_COLOUR_SCHEME_COMBO_MM = CTL_BEVEL_EDGES_BOX_MM, // 1
|
||||||
CTL_BLEND_FILE_TRUSTED_BOX_MM, // 2
|
CTL_BLEND_FILE_TRUSTED_BOX_MM, // 2
|
||||||
CTL_BEVEL_WIDTH_EDIT_MM = CTL_BLEND_FILE_TRUSTED_BOX_MM,// 2
|
CTL_BEVEL_WIDTH_EDIT_MM = CTL_BLEND_FILE_TRUSTED_BOX_MM,// 2
|
||||||
CTL_COLOUR_STRATEGY_COMBO = CTL_BLEND_FILE_TRUSTED_BOX_MM,// 2
|
|
||||||
CTL_CASE_SENSITIVE_FILESYSTEM_BOX, // 3
|
CTL_CASE_SENSITIVE_FILESYSTEM_BOX, // 3
|
||||||
CTL_CAMERA_BORDER_PERCENT_EDIT_MM = CTL_CASE_SENSITIVE_FILESYSTEM_BOX,// 3
|
CTL_CAMERA_BORDER_PERCENT_EDIT_MM = CTL_CASE_SENSITIVE_FILESYSTEM_BOX,// 3
|
||||||
CTL_RESOLUTION_COMBO_MM = CTL_CASE_SENSITIVE_FILESYSTEM_BOX,// 3
|
CTL_RESOLUTION_COMBO_MM = CTL_CASE_SENSITIVE_FILESYSTEM_BOX,// 3
|
||||||
|
CTL_SCALE_STRATEGY_COMBO = CTL_CASE_SENSITIVE_FILESYSTEM_BOX,// 3
|
||||||
CTL_CROP_IMAGE_BOX_MM, // 4
|
CTL_CROP_IMAGE_BOX_MM, // 4
|
||||||
CTL_FRAMES_PER_STEP_EDIT = CTL_CROP_IMAGE_BOX_MM, // 4
|
CTL_FRAMES_PER_STEP_EDIT = CTL_CROP_IMAGE_BOX_MM, // 4
|
||||||
CTL_SMOOTH_TYPE_COMBO = CTL_CROP_IMAGE_BOX_MM, // 4
|
CTL_SMOOTH_TYPE_COMBO = CTL_CROP_IMAGE_BOX_MM, // 4
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "lc_context.h"
|
#include "lc_context.h"
|
||||||
#include "lc_glextensions.h"
|
#include "lc_glextensions.h"
|
||||||
#include "lc_synth.h"
|
#include "lc_synth.h"
|
||||||
|
#include "lc_traintrack.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "lc_profile.h"
|
#include "lc_profile.h"
|
||||||
#include "lc_meshloader.h"
|
#include "lc_meshloader.h"
|
||||||
|
@ -277,6 +278,7 @@ bool lcPiecesLibrary::Load(const QString& LibraryPath, bool ShowProgress)
|
||||||
UpdateStudStyleSource();
|
UpdateStudStyleSource();
|
||||||
lcLoadDefaultCategories();
|
lcLoadDefaultCategories();
|
||||||
lcSynthInit();
|
lcSynthInit();
|
||||||
|
lcTrainTrackInit(this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1870,6 +1872,7 @@ bool lcPiecesLibrary::LoadBuiltinPieces()
|
||||||
lcLoadDefaultColors(lcStudStyle::Plain);
|
lcLoadDefaultColors(lcStudStyle::Plain);
|
||||||
lcLoadDefaultCategories(true);
|
lcLoadDefaultCategories(true);
|
||||||
lcSynthInit();
|
lcSynthInit();
|
||||||
|
lcTrainTrackInit(this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1907,9 +1907,12 @@ void lcMainWindow::ResetViews()
|
||||||
void lcMainWindow::ToggleDockWidget(QWidget* DockWidget)
|
void lcMainWindow::ToggleDockWidget(QWidget* DockWidget)
|
||||||
{
|
{
|
||||||
if (DockWidget->isHidden())
|
if (DockWidget->isHidden())
|
||||||
|
{
|
||||||
DockWidget->show();
|
DockWidget->show();
|
||||||
|
DockWidget->raise();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
DockWidget->hide();
|
DockWidget->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMainWindow::TogglePrintPreview()
|
void lcMainWindow::TogglePrintPreview()
|
||||||
|
@ -2813,6 +2816,8 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
||||||
|
|
||||||
case LC_VIEW_TOOLBAR_PARTS:
|
case LC_VIEW_TOOLBAR_PARTS:
|
||||||
ToggleDockWidget(mPartsToolBar);
|
ToggleDockWidget(mPartsToolBar);
|
||||||
|
if (mPartsToolBar->isVisible())
|
||||||
|
mPartSelectionWidget->FocusPartFilterWidget();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_VIEW_TOOLBAR_COLORS:
|
case LC_VIEW_TOOLBAR_COLORS:
|
||||||
|
|
|
@ -4235,9 +4235,9 @@ void lcModel::EndMouseTool(lcTool Tool, bool Accept)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcModel::InsertPieceToolClicked(const lcMatrix44& WorldMatrix)
|
void lcModel::InsertPieceToolClicked(PieceInfo* Info, const lcMatrix44& WorldMatrix)
|
||||||
{
|
{
|
||||||
lcPiece* Piece = new lcPiece(gMainWindow->GetCurrentPieceInfo());
|
lcPiece* Piece = new lcPiece(Info);
|
||||||
Piece->Initialize(WorldMatrix, mCurrentStep);
|
Piece->Initialize(WorldMatrix, mCurrentStep);
|
||||||
Piece->SetColorIndex(gMainWindow->mColorIndex);
|
Piece->SetColorIndex(gMainWindow->mColorIndex);
|
||||||
Piece->UpdatePosition(mCurrentStep);
|
Piece->UpdatePosition(mCurrentStep);
|
||||||
|
|
|
@ -329,7 +329,7 @@ public:
|
||||||
|
|
||||||
void BeginMouseTool();
|
void BeginMouseTool();
|
||||||
void EndMouseTool(lcTool Tool, bool Accept);
|
void EndMouseTool(lcTool Tool, bool Accept);
|
||||||
void InsertPieceToolClicked(const lcMatrix44& WorldMatrix);
|
void InsertPieceToolClicked(PieceInfo* Info, const lcMatrix44& WorldMatrix);
|
||||||
void InsertLightToolClicked(const lcVector3& Position, lcLightType LightType);
|
void InsertLightToolClicked(const lcVector3& Position, lcLightType LightType);
|
||||||
void BeginCameraTool(const lcVector3& Position, const lcVector3& Target);
|
void BeginCameraTool(const lcVector3& Position, const lcVector3& Target);
|
||||||
void UpdateCameraTool(const lcVector3& Position);
|
void UpdateCameraTool(const lcVector3& Position);
|
||||||
|
|
|
@ -701,7 +701,7 @@ lcPartSelectionWidget::lcPartSelectionWidget(QWidget* Parent)
|
||||||
PartsLayout->addLayout(SearchLayout);
|
PartsLayout->addLayout(SearchLayout);
|
||||||
|
|
||||||
mFilterWidget = new QLineEdit(PartsGroupWidget);
|
mFilterWidget = new QLineEdit(PartsGroupWidget);
|
||||||
mFilterWidget->setPlaceholderText(tr("Search Parts"));
|
mFilterWidget->setPlaceholderText(tr("Filter Parts"));
|
||||||
SearchLayout->addWidget(mFilterWidget);
|
SearchLayout->addWidget(mFilterWidget);
|
||||||
|
|
||||||
QToolButton* OptionsButton = new QToolButton();
|
QToolButton* OptionsButton = new QToolButton();
|
||||||
|
|
|
@ -241,6 +241,12 @@ public:
|
||||||
return mPartsWidget->GetCurrentPart();
|
return mPartsWidget->GetCurrentPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FocusPartFilterWidget() const
|
||||||
|
{
|
||||||
|
mFilterWidget->setFocus();
|
||||||
|
mFilterWidget->selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void PartPicked(PieceInfo* Info);
|
void PartPicked(PieceInfo* Info);
|
||||||
void CurrentPartChanged(PieceInfo* Info);
|
void CurrentPartChanged(PieceInfo* Info);
|
||||||
|
|
113
common/lc_traintrack.cpp
Normal file
113
common/lc_traintrack.cpp
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
#include "lc_global.h"
|
||||||
|
#include "lc_traintrack.h"
|
||||||
|
#include "lc_library.h"
|
||||||
|
#include "pieceinf.h"
|
||||||
|
#include "piece.h"
|
||||||
|
#include "lc_application.h"
|
||||||
|
|
||||||
|
// todo:
|
||||||
|
// add cross 32087.dat and auto replace when going over a straight section
|
||||||
|
// draw icon on thumbnails
|
||||||
|
// detect existing connections
|
||||||
|
// new gizmo mesh
|
||||||
|
// move config to json
|
||||||
|
// add other track types
|
||||||
|
|
||||||
|
std::pair<PieceInfo*, lcMatrix44> lcTrainTrackInfo::GetPieceInsertPosition(lcPiece* Piece, quint32 ConnectionIndex, lcTrainTrackType TrainTrackType) const
|
||||||
|
{
|
||||||
|
if (ConnectionIndex >= mConnections.size())
|
||||||
|
return { nullptr, lcMatrix44Identity() };
|
||||||
|
|
||||||
|
const char* PieceNames[] =
|
||||||
|
{
|
||||||
|
"74746.dat",
|
||||||
|
"74747.dat",
|
||||||
|
"74747.dat",
|
||||||
|
"2861c04.dat",
|
||||||
|
"2859c04.dat"
|
||||||
|
};
|
||||||
|
|
||||||
|
PieceInfo* Info = lcGetPiecesLibrary()->FindPiece(PieceNames[static_cast<int>(TrainTrackType)], nullptr, false, false);
|
||||||
|
|
||||||
|
if (!Info)
|
||||||
|
return { nullptr, lcMatrix44Identity() };
|
||||||
|
|
||||||
|
lcTrainTrackInfo* TrainTrackInfo = Info->GetTrainTrackInfo();
|
||||||
|
|
||||||
|
if (!TrainTrackInfo || TrainTrackInfo->mConnections.empty())
|
||||||
|
return { nullptr, lcMatrix44Identity() };
|
||||||
|
|
||||||
|
lcMatrix44 Transform;
|
||||||
|
|
||||||
|
if (TrainTrackType != lcTrainTrackType::Left)
|
||||||
|
Transform = TrainTrackInfo->mConnections[0].Transform;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Transform = lcMatrix44AffineInverse(TrainTrackInfo->mConnections[0].Transform);
|
||||||
|
Transform = lcMul(Transform, lcMatrix44RotationZ(LC_PI));
|
||||||
|
}
|
||||||
|
|
||||||
|
Transform = lcMul(Transform, mConnections[ConnectionIndex].Transform);
|
||||||
|
Transform = lcMul(Transform, Piece->mModelWorld);
|
||||||
|
|
||||||
|
return { Info, Transform };
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcTrainTrackInit(lcPiecesLibrary* Library)
|
||||||
|
{
|
||||||
|
PieceInfo* Info = Library->FindPiece("74746.dat", nullptr, false, false);
|
||||||
|
|
||||||
|
if (Info)
|
||||||
|
{
|
||||||
|
lcTrainTrackInfo* TrainTrackInfo = new lcTrainTrackInfo();
|
||||||
|
|
||||||
|
TrainTrackInfo->AddConnection({lcMatrix44Translation(lcVector3(160.0f, 0.0f, 0.0f))});
|
||||||
|
TrainTrackInfo->AddConnection({lcMatrix44(lcMatrix33RotationZ(LC_PI), lcVector3(-160.0f, 0.0f, 0.0f))});
|
||||||
|
|
||||||
|
Info->SetTrainTrackInfo(TrainTrackInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info = Library->FindPiece("74747.dat", nullptr, false, false);
|
||||||
|
|
||||||
|
if (Info)
|
||||||
|
{
|
||||||
|
lcTrainTrackInfo* TrainTrackInfo = new lcTrainTrackInfo();
|
||||||
|
|
||||||
|
const float CurveX = sinf(LC_DTOR * 11.25f) * 800.0f;
|
||||||
|
const float CurveY = (cosf(LC_DTOR * 11.25f) * 800.0f) - 800.0f;
|
||||||
|
|
||||||
|
TrainTrackInfo->AddConnection({lcMatrix44(lcMatrix33RotationZ(-11.25f * LC_DTOR), lcVector3(CurveX, CurveY, 0.0f))});
|
||||||
|
TrainTrackInfo->AddConnection({lcMatrix44(lcMatrix33RotationZ(-168.75f * LC_DTOR), lcVector3(-CurveX, CurveY, 0.0f))});
|
||||||
|
|
||||||
|
Info->SetTrainTrackInfo(TrainTrackInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
const float BranchX = 320.0f + 320.0f + (-(sinf(LC_DTOR * 22.5f) * 800.0f));
|
||||||
|
const float BranchY = 320.0f + ((cosf(LC_DTOR * 22.5f) * 800.0f) - 800.0f);
|
||||||
|
|
||||||
|
Info = Library->FindPiece("2861c04.dat", nullptr, false, false);
|
||||||
|
|
||||||
|
if (Info)
|
||||||
|
{
|
||||||
|
lcTrainTrackInfo* TrainTrackInfo = new lcTrainTrackInfo();
|
||||||
|
|
||||||
|
TrainTrackInfo->AddConnection({lcMatrix44Translation(lcVector3(320.0f, 0.0f, 0.0f))});
|
||||||
|
TrainTrackInfo->AddConnection({lcMatrix44(lcMatrix33RotationZ(22.5f * LC_DTOR), lcVector3(BranchX, BranchY, 0.0f))});
|
||||||
|
TrainTrackInfo->AddConnection({lcMatrix44(lcMatrix33RotationZ(LC_PI), lcVector3(-320.0f, 0.0f, 0.0f))});
|
||||||
|
|
||||||
|
Info->SetTrainTrackInfo(TrainTrackInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info = Library->FindPiece("2859c04.dat", nullptr, false, false);
|
||||||
|
|
||||||
|
if (Info)
|
||||||
|
{
|
||||||
|
lcTrainTrackInfo* TrainTrackInfo = new lcTrainTrackInfo();
|
||||||
|
|
||||||
|
TrainTrackInfo->AddConnection({lcMatrix44Translation(lcVector3(320.0f, 0.0f, 0.0f))});
|
||||||
|
TrainTrackInfo->AddConnection({lcMatrix44(lcMatrix33RotationZ(-22.5f * LC_DTOR), lcVector3(BranchX, -BranchY, 0.0f))});
|
||||||
|
TrainTrackInfo->AddConnection({lcMatrix44(lcMatrix33RotationZ(LC_PI), lcVector3(-320.0f, 0.0f, 0.0f))});
|
||||||
|
|
||||||
|
Info->SetTrainTrackInfo(TrainTrackInfo);
|
||||||
|
}
|
||||||
|
}
|
44
common/lc_traintrack.h
Normal file
44
common/lc_traintrack.h
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "lc_math.h"
|
||||||
|
|
||||||
|
class lcPiece;
|
||||||
|
class lcPiecesLibrary;
|
||||||
|
|
||||||
|
struct lcTrainTrackConnection
|
||||||
|
{
|
||||||
|
lcMatrix44 Transform;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class lcTrainTrackType
|
||||||
|
{
|
||||||
|
Straight,
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
BranchLeft,
|
||||||
|
BranchRight,
|
||||||
|
Count
|
||||||
|
};
|
||||||
|
|
||||||
|
class lcTrainTrackInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
lcTrainTrackInfo() = default;
|
||||||
|
|
||||||
|
std::pair<PieceInfo*, lcMatrix44> GetPieceInsertPosition(lcPiece* Piece, quint32 ConnectionIndex, lcTrainTrackType TrainTrackType) const;
|
||||||
|
|
||||||
|
void AddConnection(const lcTrainTrackConnection& TrainTrackConnection)
|
||||||
|
{
|
||||||
|
mConnections.emplace_back(TrainTrackConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<lcTrainTrackConnection>& GetConnections() const
|
||||||
|
{
|
||||||
|
return mConnections;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<lcTrainTrackConnection> mConnections;
|
||||||
|
};
|
||||||
|
|
||||||
|
void lcTrainTrackInit(lcPiecesLibrary* Library);
|
|
@ -10,11 +10,13 @@
|
||||||
#include "piece.h"
|
#include "piece.h"
|
||||||
#include "pieceinf.h"
|
#include "pieceinf.h"
|
||||||
#include "lc_synth.h"
|
#include "lc_synth.h"
|
||||||
|
#include "lc_traintrack.h"
|
||||||
#include "lc_scene.h"
|
#include "lc_scene.h"
|
||||||
#include "lc_context.h"
|
#include "lc_context.h"
|
||||||
#include "lc_viewmanipulator.h"
|
#include "lc_viewmanipulator.h"
|
||||||
#include "lc_viewsphere.h"
|
#include "lc_viewsphere.h"
|
||||||
#include "lc_findreplacewidget.h"
|
#include "lc_findreplacewidget.h"
|
||||||
|
#include "lc_library.h"
|
||||||
|
|
||||||
lcFindReplaceParams lcView::mFindReplaceParams;
|
lcFindReplaceParams lcView::mFindReplaceParams;
|
||||||
QPointer<lcFindReplaceWidget> lcView::mFindWidget;
|
QPointer<lcFindReplaceWidget> lcView::mFindWidget;
|
||||||
|
@ -48,6 +50,13 @@ lcView::lcView(lcViewType ViewType, lcModel* Model)
|
||||||
|
|
||||||
lcView::~lcView()
|
lcView::~lcView()
|
||||||
{
|
{
|
||||||
|
if (mPiecePreviewInfo)
|
||||||
|
{
|
||||||
|
lcPiecesLibrary* Library = lcGetPiecesLibrary();
|
||||||
|
Library->ReleasePieceInfo(mPiecePreviewInfo);
|
||||||
|
mPiecePreviewInfo = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
mContext->DestroyVertexBuffer(mGridBuffer);
|
mContext->DestroyVertexBuffer(mGridBuffer);
|
||||||
|
|
||||||
if (gMainWindow && mViewType == lcViewType::View)
|
if (gMainWindow && mViewType == lcViewType::View)
|
||||||
|
@ -410,6 +419,55 @@ lcVector3 lcView::GetMoveDirection(const lcVector3& Direction) const
|
||||||
return axis;
|
return axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcView::UpdatePiecePreview()
|
||||||
|
{
|
||||||
|
lcModel* ActiveModel = GetActiveModel();
|
||||||
|
lcObject* Focus = ActiveModel->GetFocusObject();
|
||||||
|
PieceInfo* PreviewInfo = nullptr;
|
||||||
|
lcMatrix44 PreviewTransform;
|
||||||
|
|
||||||
|
if (Focus && Focus->IsPiece())
|
||||||
|
{
|
||||||
|
lcPiece* Piece = (lcPiece*)Focus;
|
||||||
|
|
||||||
|
const lcTrainTrackInfo* TrainTrackInfo = Piece->mPieceInfo->GetTrainTrackInfo();
|
||||||
|
|
||||||
|
if (TrainTrackInfo)
|
||||||
|
{
|
||||||
|
quint32 ConnectionIndex = mTrackToolSection & 0xff;
|
||||||
|
lcTrainTrackType TrainTrackType = static_cast<lcTrainTrackType>((mTrackToolSection >> 8) & 0xff);
|
||||||
|
|
||||||
|
std::tie(PreviewInfo, mPiecePreviewTransform) = TrainTrackInfo->GetPieceInsertPosition(Piece, ConnectionIndex, TrainTrackType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PreviewInfo)
|
||||||
|
{
|
||||||
|
PreviewInfo = gMainWindow->GetCurrentPieceInfo();
|
||||||
|
|
||||||
|
if (PreviewInfo)
|
||||||
|
{
|
||||||
|
mPiecePreviewTransform = GetPieceInsertPosition(false, PreviewInfo);
|
||||||
|
|
||||||
|
if (GetActiveModel() != mModel)
|
||||||
|
mPiecePreviewTransform = lcMul(mPiecePreviewTransform, mActiveSubmodelTransform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PreviewInfo != mPiecePreviewInfo)
|
||||||
|
{
|
||||||
|
lcPiecesLibrary* Library = lcGetPiecesLibrary();
|
||||||
|
|
||||||
|
if (mPiecePreviewInfo)
|
||||||
|
Library->ReleasePieceInfo(mPiecePreviewInfo);
|
||||||
|
|
||||||
|
mPiecePreviewInfo = PreviewInfo;
|
||||||
|
|
||||||
|
if (mPiecePreviewInfo)
|
||||||
|
Library->LoadPieceInfo(mPiecePreviewInfo, true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lcMatrix44 lcView::GetPieceInsertPosition(bool IgnoreSelected, PieceInfo* Info) const
|
lcMatrix44 lcView::GetPieceInsertPosition(bool IgnoreSelected, PieceInfo* Info) const
|
||||||
{
|
{
|
||||||
lcModel* ActiveModel = GetActiveModel();
|
lcModel* ActiveModel = GetActiveModel();
|
||||||
|
@ -812,16 +870,11 @@ void lcView::OnDraw()
|
||||||
|
|
||||||
if (DrawInterface && mTrackTool == lcTrackTool::Insert)
|
if (DrawInterface && mTrackTool == lcTrackTool::Insert)
|
||||||
{
|
{
|
||||||
PieceInfo* Info = gMainWindow->GetCurrentPieceInfo();
|
UpdatePiecePreview();
|
||||||
|
|
||||||
if (Info)
|
if (mPiecePreviewInfo)
|
||||||
{
|
{
|
||||||
lcMatrix44 WorldMatrix = GetPieceInsertPosition(false, Info);
|
mPiecePreviewInfo->AddRenderMeshes(mScene.get(), mPiecePreviewTransform, gMainWindow->mColorIndex, lcRenderMeshState::Focused, false);
|
||||||
|
|
||||||
if (GetActiveModel() != mModel)
|
|
||||||
WorldMatrix = lcMul(WorldMatrix, mActiveSubmodelTransform);
|
|
||||||
|
|
||||||
Info->AddRenderMeshes(mScene.get(), WorldMatrix, gMainWindow->mColorIndex, lcRenderMeshState::Focused, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1389,18 +1442,14 @@ void lcView::DrawGrid()
|
||||||
|
|
||||||
if (mTrackTool == lcTrackTool::Insert)
|
if (mTrackTool == lcTrackTool::Insert)
|
||||||
{
|
{
|
||||||
PieceInfo* CurPiece = gMainWindow->GetCurrentPieceInfo();
|
if (mPiecePreviewInfo)
|
||||||
|
|
||||||
if (CurPiece)
|
|
||||||
{
|
{
|
||||||
lcVector3 Points[8];
|
lcVector3 Points[8];
|
||||||
lcGetBoxCorners(CurPiece->GetBoundingBox(), Points);
|
lcGetBoxCorners(mPiecePreviewInfo->GetBoundingBox(), Points);
|
||||||
|
|
||||||
lcMatrix44 WorldMatrix = GetPieceInsertPosition(false, CurPiece);
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
lcVector3 Point = lcMul31(Points[i], WorldMatrix);
|
lcVector3 Point = lcMul31(Points[i], mPiecePreviewTransform);
|
||||||
|
|
||||||
Min = lcMin(Point, Min);
|
Min = lcMin(Point, Min);
|
||||||
Max = lcMax(Point, Max);
|
Max = lcMax(Point, Max);
|
||||||
|
@ -1654,8 +1703,9 @@ void lcView::EndDrag(bool Accept)
|
||||||
case lcDragState::Piece:
|
case lcDragState::Piece:
|
||||||
{
|
{
|
||||||
PieceInfo* Info = gMainWindow->GetCurrentPieceInfo();
|
PieceInfo* Info = gMainWindow->GetCurrentPieceInfo();
|
||||||
|
|
||||||
if (Info)
|
if (Info)
|
||||||
ActiveModel->InsertPieceToolClicked(GetPieceInsertPosition(false, Info));
|
ActiveModel->InsertPieceToolClicked(Info, GetPieceInsertPosition(false, Info));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case lcDragState::Color:
|
case lcDragState::Color:
|
||||||
|
@ -2012,6 +2062,7 @@ void lcView::UpdateTrackTool()
|
||||||
|
|
||||||
lcTool CurrentTool = gMainWindow->GetTool();
|
lcTool CurrentTool = gMainWindow->GetTool();
|
||||||
lcTrackTool NewTrackTool = mTrackTool;
|
lcTrackTool NewTrackTool = mTrackTool;
|
||||||
|
quint32 NewTrackSection = ~0U;
|
||||||
int x = mMouseX;
|
int x = mMouseX;
|
||||||
int y = mMouseY;
|
int y = mMouseY;
|
||||||
bool Redraw = false;
|
bool Redraw = false;
|
||||||
|
@ -2048,9 +2099,10 @@ void lcView::UpdateTrackTool()
|
||||||
case lcTool::Move:
|
case lcTool::Move:
|
||||||
{
|
{
|
||||||
mMouseDownPiece = nullptr;
|
mMouseDownPiece = nullptr;
|
||||||
NewTrackTool = mViewManipulator->UpdateSelectMove();
|
std::tie(NewTrackTool, NewTrackSection) = mViewManipulator->UpdateSelectMove();
|
||||||
mTrackToolFromOverlay = NewTrackTool != lcTrackTool::MoveXYZ && NewTrackTool != lcTrackTool::Select;
|
mTrackToolFromOverlay = NewTrackTool != lcTrackTool::MoveXYZ && NewTrackTool != lcTrackTool::Select;
|
||||||
Redraw = NewTrackTool != mTrackTool;
|
Redraw = NewTrackTool != mTrackTool || NewTrackSection != mTrackToolSection;
|
||||||
|
mTrackToolSection = NewTrackSection;
|
||||||
|
|
||||||
if (CurrentTool == lcTool::Select && NewTrackTool == lcTrackTool::Select && mMouseModifiers == Qt::NoModifier)
|
if (CurrentTool == lcTool::Select && NewTrackTool == lcTrackTool::Select && mMouseModifiers == Qt::NoModifier)
|
||||||
{
|
{
|
||||||
|
@ -2433,12 +2485,12 @@ void lcView::OnButtonDown(lcTrackButton TrackButton)
|
||||||
|
|
||||||
case lcTrackTool::Insert:
|
case lcTrackTool::Insert:
|
||||||
{
|
{
|
||||||
PieceInfo* CurPiece = gMainWindow->GetCurrentPieceInfo();
|
UpdatePiecePreview();
|
||||||
|
|
||||||
if (!CurPiece)
|
if (!mPiecePreviewInfo)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ActiveModel->InsertPieceToolClicked(GetPieceInsertPosition(false, gMainWindow->GetCurrentPieceInfo()));
|
ActiveModel->InsertPieceToolClicked(mPiecePreviewInfo, mPiecePreviewTransform);
|
||||||
|
|
||||||
if ((mMouseModifiers & Qt::ControlModifier) == 0)
|
if ((mMouseModifiers & Qt::ControlModifier) == 0)
|
||||||
gMainWindow->SetTool(lcTool::Select);
|
gMainWindow->SetTool(lcTool::Select);
|
||||||
|
|
|
@ -259,6 +259,7 @@ public:
|
||||||
|
|
||||||
float GetOverlayScale() const;
|
float GetOverlayScale() const;
|
||||||
lcVector3 GetMoveDirection(const lcVector3& Direction) const;
|
lcVector3 GetMoveDirection(const lcVector3& Direction) const;
|
||||||
|
void UpdatePiecePreview();
|
||||||
lcMatrix44 GetPieceInsertPosition(bool IgnoreSelected, PieceInfo* Info) const;
|
lcMatrix44 GetPieceInsertPosition(bool IgnoreSelected, PieceInfo* Info) const;
|
||||||
lcVector3 GetCameraLightInsertPosition() const;
|
lcVector3 GetCameraLightInsertPosition() const;
|
||||||
void GetRayUnderPointer(lcVector3& Start, lcVector3& End) const;
|
void GetRayUnderPointer(lcVector3& Start, lcVector3& End) const;
|
||||||
|
@ -327,6 +328,7 @@ protected:
|
||||||
|
|
||||||
lcDragState mDragState;
|
lcDragState mDragState;
|
||||||
bool mTrackToolFromOverlay;
|
bool mTrackToolFromOverlay;
|
||||||
|
quint32 mTrackToolSection = ~0U;
|
||||||
lcVector3 mMouseDownPosition;
|
lcVector3 mMouseDownPosition;
|
||||||
PieceInfo* mMouseDownPiece;
|
PieceInfo* mMouseDownPiece;
|
||||||
int mPanX = 0;
|
int mPanX = 0;
|
||||||
|
@ -347,6 +349,9 @@ protected:
|
||||||
|
|
||||||
lcCamera* mCamera = nullptr;
|
lcCamera* mCamera = nullptr;
|
||||||
|
|
||||||
|
PieceInfo* mPiecePreviewInfo = nullptr;
|
||||||
|
lcMatrix44 mPiecePreviewTransform;
|
||||||
|
|
||||||
lcVertexBuffer mGridBuffer;
|
lcVertexBuffer mGridBuffer;
|
||||||
int mGridSettings[7];
|
int mGridSettings[7];
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "pieceinf.h"
|
#include "pieceinf.h"
|
||||||
#include "lc_synth.h"
|
#include "lc_synth.h"
|
||||||
|
#include "lc_traintrack.h"
|
||||||
#include "lc_mainwindow.h"
|
#include "lc_mainwindow.h"
|
||||||
#include "texfont.h"
|
#include "texfont.h"
|
||||||
|
|
||||||
|
@ -358,11 +359,49 @@ void lcViewManipulator::DrawSelectMove(lcTrackButton TrackButton, lcTrackTool Tr
|
||||||
Context->DrawPrimitives(GL_TRIANGLE_STRIP, 2, 18);
|
Context->DrawPrimitives(GL_TRIANGLE_STRIP, 2, 18);
|
||||||
Context->DrawPrimitives(GL_TRIANGLE_STRIP, 20, 18);
|
Context->DrawPrimitives(GL_TRIANGLE_STRIP, 20, 18);
|
||||||
}
|
}
|
||||||
|
else if (Piece->mPieceInfo->GetTrainTrackInfo())
|
||||||
|
{
|
||||||
|
DrawTrainTrack(Piece, Context, OverlayScale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Context->EnableDepthTest(true);
|
Context->EnableDepthTest(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcViewManipulator::DrawTrainTrack(lcPiece* Piece, lcContext* Context, float OverlayScale)
|
||||||
|
{
|
||||||
|
const lcTrainTrackInfo* TrainTrackInfo = Piece->mPieceInfo->GetTrainTrackInfo();
|
||||||
|
|
||||||
|
for (const lcTrainTrackConnection& TrainTrackConnection : TrainTrackInfo->GetConnections())
|
||||||
|
{
|
||||||
|
lcVector3 Verts[static_cast<int>(lcTrainTrackType::Count) * 2];
|
||||||
|
int NumVerts = 0;
|
||||||
|
|
||||||
|
Verts[NumVerts++] = TrainTrackConnection.Transform.GetTranslation() / OverlayScale;
|
||||||
|
Verts[NumVerts++] = (TrainTrackConnection.Transform.GetTranslation() + lcVector3(TrainTrackConnection.Transform[0]) * 100) / OverlayScale;
|
||||||
|
|
||||||
|
Verts[NumVerts++] = TrainTrackConnection.Transform.GetTranslation() / OverlayScale;
|
||||||
|
Verts[NumVerts++] = (TrainTrackConnection.Transform.GetTranslation() + lcMul31(lcVector3(TrainTrackConnection.Transform[0]), lcMatrix44RotationZ(LC_DTOR * 60)) * 100) / OverlayScale;
|
||||||
|
|
||||||
|
Verts[NumVerts++] = TrainTrackConnection.Transform.GetTranslation() / OverlayScale;
|
||||||
|
Verts[NumVerts++] = (TrainTrackConnection.Transform.GetTranslation() + lcMul31(lcVector3(TrainTrackConnection.Transform[0]), lcMatrix44RotationZ(LC_DTOR * -60)) * 100) / OverlayScale;
|
||||||
|
|
||||||
|
Verts[NumVerts++] = TrainTrackConnection.Transform.GetTranslation() / OverlayScale;
|
||||||
|
Verts[NumVerts++] = (TrainTrackConnection.Transform.GetTranslation() + lcMul31(lcVector3(TrainTrackConnection.Transform[0]), lcMatrix44RotationZ(LC_DTOR * 30)) * 100) / OverlayScale;
|
||||||
|
|
||||||
|
Verts[NumVerts++] = TrainTrackConnection.Transform.GetTranslation() / OverlayScale;
|
||||||
|
Verts[NumVerts++] = (TrainTrackConnection.Transform.GetTranslation() + lcMul31(lcVector3(TrainTrackConnection.Transform[0]), lcMatrix44RotationZ(LC_DTOR * -30)) * 100) / OverlayScale;
|
||||||
|
|
||||||
|
Context->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
|
Context->SetVertexBufferPointer(Verts);
|
||||||
|
Context->ClearIndexBuffer();
|
||||||
|
Context->SetVertexFormatPosition(3);
|
||||||
|
|
||||||
|
Context->DrawPrimitives(GL_LINES, 0, NumVerts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void lcViewManipulator::DrawRotate(lcTrackButton TrackButton, lcTrackTool TrackTool)
|
void lcViewManipulator::DrawRotate(lcTrackButton TrackButton, lcTrackTool TrackTool)
|
||||||
{
|
{
|
||||||
const lcCamera* Camera = mView->GetCamera();
|
const lcCamera* Camera = mView->GetCamera();
|
||||||
|
@ -740,7 +779,7 @@ bool lcViewManipulator::IsTrackToolAllowed(lcTrackTool TrackTool, quint32 Allowe
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcTrackTool lcViewManipulator::UpdateSelectMove()
|
std::pair<lcTrackTool, quint32> lcViewManipulator::UpdateSelectMove()
|
||||||
{
|
{
|
||||||
lcModel* ActiveModel = mView->GetActiveModel();
|
lcModel* ActiveModel = mView->GetActiveModel();
|
||||||
const float OverlayScale = mView->GetOverlayScale();
|
const float OverlayScale = mView->GetOverlayScale();
|
||||||
|
@ -753,12 +792,13 @@ lcTrackTool lcViewManipulator::UpdateSelectMove()
|
||||||
|
|
||||||
lcTool CurrentTool = gMainWindow->GetTool();
|
lcTool CurrentTool = gMainWindow->GetTool();
|
||||||
lcTrackTool NewTrackTool = (CurrentTool == lcTool::Move) ? lcTrackTool::MoveXYZ : lcTrackTool::Select;
|
lcTrackTool NewTrackTool = (CurrentTool == lcTool::Move) ? lcTrackTool::MoveXYZ : lcTrackTool::Select;
|
||||||
|
quint32 NewTrackSection = ~0U;
|
||||||
|
|
||||||
lcVector3 OverlayCenter;
|
lcVector3 OverlayCenter;
|
||||||
lcMatrix33 RelativeRotation;
|
lcMatrix33 RelativeRotation;
|
||||||
|
|
||||||
if (!ActiveModel->GetMoveRotateTransform(OverlayCenter, RelativeRotation))
|
if (!ActiveModel->GetMoveRotateTransform(OverlayCenter, RelativeRotation))
|
||||||
return NewTrackTool;
|
return { NewTrackTool, NewTrackSection };
|
||||||
|
|
||||||
lcMatrix44 WorldMatrix = lcMatrix44(RelativeRotation, OverlayCenter);
|
lcMatrix44 WorldMatrix = lcMatrix44(RelativeRotation, OverlayCenter);
|
||||||
|
|
||||||
|
@ -786,6 +826,7 @@ lcTrackTool lcViewManipulator::UpdateSelectMove()
|
||||||
|
|
||||||
lcObject* Focus = ActiveModel->GetFocusObject();
|
lcObject* Focus = ActiveModel->GetFocusObject();
|
||||||
int ControlPointIndex = -1;
|
int ControlPointIndex = -1;
|
||||||
|
|
||||||
if (Focus && Focus->IsPiece())
|
if (Focus && Focus->IsPiece())
|
||||||
{
|
{
|
||||||
lcPiece* Piece = (lcPiece*)Focus;
|
lcPiece* Piece = (lcPiece*)Focus;
|
||||||
|
@ -908,7 +949,46 @@ lcTrackTool lcViewManipulator::UpdateSelectMove()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewTrackTool;
|
if (Focus && Focus->IsPiece())
|
||||||
|
{
|
||||||
|
const lcPiece* Piece = (lcPiece*)Focus;
|
||||||
|
const lcTrainTrackInfo* TrainTrackInfo = Piece->mPieceInfo->GetTrainTrackInfo();
|
||||||
|
|
||||||
|
if (TrainTrackInfo)
|
||||||
|
{
|
||||||
|
for (quint32 Section = 0; Section < TrainTrackInfo->GetConnections().size(); Section++)
|
||||||
|
{
|
||||||
|
const lcTrainTrackConnection& TrainTrackConnection = TrainTrackInfo->GetConnections()[Section];
|
||||||
|
lcVector3 Verts[static_cast<int>(lcTrainTrackType::Count)];
|
||||||
|
int NumVerts = 0;
|
||||||
|
|
||||||
|
Verts[NumVerts++] = (TrainTrackConnection.Transform.GetTranslation() + lcVector3(TrainTrackConnection.Transform[0]) * 100) / 1;
|
||||||
|
Verts[NumVerts++] = (TrainTrackConnection.Transform.GetTranslation() + lcMul31(lcVector3(TrainTrackConnection.Transform[0]), lcMatrix44RotationZ(LC_DTOR * 60)) * 100) / 1;
|
||||||
|
Verts[NumVerts++] = (TrainTrackConnection.Transform.GetTranslation() + lcMul31(lcVector3(TrainTrackConnection.Transform[0]), lcMatrix44RotationZ(LC_DTOR * -60)) * 100) / 1;
|
||||||
|
Verts[NumVerts++] = (TrainTrackConnection.Transform.GetTranslation() + lcMul31(lcVector3(TrainTrackConnection.Transform[0]), lcMatrix44RotationZ(LC_DTOR * 30)) * 100) / 1;
|
||||||
|
Verts[NumVerts++] = (TrainTrackConnection.Transform.GetTranslation() + lcMul31(lcVector3(TrainTrackConnection.Transform[0]), lcMatrix44RotationZ(LC_DTOR * -30)) * 100) / 1;
|
||||||
|
|
||||||
|
for (int VertexIndex = 0; VertexIndex < NumVerts; VertexIndex++)
|
||||||
|
{
|
||||||
|
Verts[VertexIndex] = lcMul31(Verts[VertexIndex], WorldMatrix);
|
||||||
|
|
||||||
|
float IntersectionDistance = lcRayPointDistance(Verts[VertexIndex], Start, End);
|
||||||
|
|
||||||
|
if (IntersectionDistance < 40)
|
||||||
|
{
|
||||||
|
if (IntersectionDistance > ClosestIntersectionDistance)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
NewTrackTool = lcTrackTool::Insert;
|
||||||
|
ClosestIntersectionDistance = IntersectionDistance;
|
||||||
|
NewTrackSection = Section | (VertexIndex << 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { NewTrackTool, NewTrackSection };
|
||||||
}
|
}
|
||||||
|
|
||||||
lcTrackTool lcViewManipulator::UpdateRotate()
|
lcTrackTool lcViewManipulator::UpdateRotate()
|
||||||
|
|
|
@ -10,13 +10,15 @@ public:
|
||||||
void DrawSelectMove(lcTrackButton TrackButton, lcTrackTool TrackTool);
|
void DrawSelectMove(lcTrackButton TrackButton, lcTrackTool TrackTool);
|
||||||
void DrawRotate(lcTrackButton TrackButton, lcTrackTool TrackTool);
|
void DrawRotate(lcTrackButton TrackButton, lcTrackTool TrackTool);
|
||||||
|
|
||||||
lcTrackTool UpdateSelectMove();
|
std::pair<lcTrackTool, quint32> UpdateSelectMove();
|
||||||
lcTrackTool UpdateRotate();
|
lcTrackTool UpdateRotate();
|
||||||
|
|
||||||
static void CreateResources(lcContext* Context);
|
static void CreateResources(lcContext* Context);
|
||||||
static void DestroyResources(lcContext* Context);
|
static void DestroyResources(lcContext* Context);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void DrawTrainTrack(lcPiece* Piece, lcContext* Context, float OverlayScale);
|
||||||
|
|
||||||
static bool IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms);
|
static bool IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms);
|
||||||
|
|
||||||
lcView* mView = nullptr;
|
lcView* mView = nullptr;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "lc_scene.h"
|
#include "lc_scene.h"
|
||||||
#include "lc_synth.h"
|
#include "lc_synth.h"
|
||||||
|
#include "lc_traintrack.h"
|
||||||
#include "lc_file.h"
|
#include "lc_file.h"
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
|
@ -21,12 +22,6 @@ PieceInfo::PieceInfo()
|
||||||
mFolderType = -1;
|
mFolderType = -1;
|
||||||
mFolderIndex = -1;
|
mFolderIndex = -1;
|
||||||
mState = lcPieceInfoState::Unloaded;
|
mState = lcPieceInfoState::Unloaded;
|
||||||
mRefCount = 0;
|
|
||||||
mType = lcPieceInfoType::Part;
|
|
||||||
mMesh = nullptr;
|
|
||||||
mModel = nullptr;
|
|
||||||
mProject = nullptr;
|
|
||||||
mSynthInfo = nullptr;
|
|
||||||
mFileName[0] = 0;
|
mFileName[0] = 0;
|
||||||
m_strDescription[0] = 0;
|
m_strDescription[0] = 0;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +29,7 @@ PieceInfo::PieceInfo()
|
||||||
PieceInfo::~PieceInfo()
|
PieceInfo::~PieceInfo()
|
||||||
{
|
{
|
||||||
delete mSynthInfo;
|
delete mSynthInfo;
|
||||||
|
delete mTrainTrackInfo;
|
||||||
|
|
||||||
if (mState == lcPieceInfoState::Loaded)
|
if (mState == lcPieceInfoState::Loaded)
|
||||||
Unload();
|
Unload();
|
||||||
|
|
|
@ -29,6 +29,7 @@ struct lcModelPartsEntry
|
||||||
};
|
};
|
||||||
|
|
||||||
class lcSynthInfo;
|
class lcSynthInfo;
|
||||||
|
class lcTrainTrackInfo;
|
||||||
enum class lcZipFileType;
|
enum class lcZipFileType;
|
||||||
|
|
||||||
class PieceInfo
|
class PieceInfo
|
||||||
|
@ -63,6 +64,16 @@ public:
|
||||||
mSynthInfo = SynthInfo;
|
mSynthInfo = SynthInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lcTrainTrackInfo* GetTrainTrackInfo() const
|
||||||
|
{
|
||||||
|
return mTrainTrackInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetTrainTrackInfo(lcTrainTrackInfo* TrainTrackInfo)
|
||||||
|
{
|
||||||
|
mTrainTrackInfo = TrainTrackInfo;
|
||||||
|
}
|
||||||
|
|
||||||
lcMesh* GetMesh() const
|
lcMesh* GetMesh() const
|
||||||
{
|
{
|
||||||
return mMesh;
|
return mMesh;
|
||||||
|
@ -192,12 +203,13 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void ReleaseMesh();
|
void ReleaseMesh();
|
||||||
|
|
||||||
int mRefCount;
|
int mRefCount = 0;
|
||||||
lcPieceInfoType mType;
|
lcPieceInfoType mType = lcPieceInfoType::Part;
|
||||||
lcModel* mModel;
|
lcModel* mModel = nullptr;
|
||||||
Project* mProject;
|
Project* mProject = nullptr;
|
||||||
lcMesh* mMesh;
|
lcMesh* mMesh = nullptr;
|
||||||
lcBoundingBox mBoundingBox;
|
lcBoundingBox mBoundingBox;
|
||||||
lcSynthInfo* mSynthInfo;
|
lcSynthInfo* mSynthInfo = nullptr;
|
||||||
|
lcTrainTrackInfo* mTrainTrackInfo = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -221,6 +221,7 @@ SOURCES += \
|
||||||
common/lc_texture.cpp \
|
common/lc_texture.cpp \
|
||||||
common/lc_thumbnailmanager.cpp \
|
common/lc_thumbnailmanager.cpp \
|
||||||
common/lc_timelinewidget.cpp \
|
common/lc_timelinewidget.cpp \
|
||||||
|
common/lc_traintrack.cpp \
|
||||||
common/lc_view.cpp \
|
common/lc_view.cpp \
|
||||||
common/lc_viewmanipulator.cpp \
|
common/lc_viewmanipulator.cpp \
|
||||||
common/lc_viewsphere.cpp \
|
common/lc_viewsphere.cpp \
|
||||||
|
@ -296,6 +297,7 @@ HEADERS += \
|
||||||
common/lc_texture.h \
|
common/lc_texture.h \
|
||||||
common/lc_thumbnailmanager.h \
|
common/lc_thumbnailmanager.h \
|
||||||
common/lc_timelinewidget.h \
|
common/lc_timelinewidget.h \
|
||||||
|
common/lc_traintrack.h \
|
||||||
common/lc_view.h \
|
common/lc_view.h \
|
||||||
common/lc_viewmanipulator.h \
|
common/lc_viewmanipulator.h \
|
||||||
common/lc_viewsphere.h \
|
common/lc_viewsphere.h \
|
||||||
|
|
|
@ -196,6 +196,8 @@ void lcPieceIdPickerPopup::showEvent(QShowEvent* ShowEvent)
|
||||||
|
|
||||||
mPartSelectionWidget->SetOrientation(Qt::Horizontal);
|
mPartSelectionWidget->SetOrientation(Qt::Horizontal);
|
||||||
mPartSelectionWidget->SetCurrentPart(mInitialPart);
|
mPartSelectionWidget->SetCurrentPart(mInitialPart);
|
||||||
|
|
||||||
|
mPartSelectionWidget->FocusPartFilterWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPieceIdPickerPopup::Accept()
|
void lcPieceIdPickerPopup::Accept()
|
||||||
|
|
Loading…
Add table
Reference in a new issue