mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Fixed crash loading a project from the command line.
This commit is contained in:
parent
3b83a16aaa
commit
013e72b334
4 changed files with 18 additions and 13 deletions
|
@ -121,9 +121,7 @@ void lcApplication::ParseStringArgument(int* CurArg, int argc, char* argv[], cha
|
||||||
|
|
||||||
bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstallPath, const char* LibraryCachePath)
|
bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstallPath, const char* LibraryCachePath)
|
||||||
{
|
{
|
||||||
// System setup parameters.
|
|
||||||
char* LibPath = NULL;
|
char* LibPath = NULL;
|
||||||
char* GLPath = NULL;
|
|
||||||
|
|
||||||
// Image output options.
|
// Image output options.
|
||||||
bool SaveImage = false;
|
bool SaveImage = false;
|
||||||
|
@ -146,11 +144,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
|
||||||
|
|
||||||
if (Param[0] == '-')
|
if (Param[0] == '-')
|
||||||
{
|
{
|
||||||
if (strcmp(Param, "--libgl") == 0)
|
if ((strcmp(Param, "-l") == 0) || (strcmp(Param, "--libpath") == 0))
|
||||||
{
|
|
||||||
ParseStringArgument(&i, argc, argv, &GLPath);
|
|
||||||
}
|
|
||||||
else if ((strcmp(Param, "-l") == 0) || (strcmp(Param, "--libpath") == 0))
|
|
||||||
{
|
{
|
||||||
ParseStringArgument(&i, argc, argv, &LibPath);
|
ParseStringArgument(&i, argc, argv, &LibPath);
|
||||||
}
|
}
|
||||||
|
@ -211,7 +205,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
console.PrintWarning("Unknown parameter: %s\n", Param);
|
printf("Unknown parameter: %s\n", Param);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,11 +90,6 @@ of \fILeoCAD \fRuses /usr/share/leocad/ as the default.
|
||||||
.BI "\-\-convert "srcpath dstpath
|
.BI "\-\-convert "srcpath dstpath
|
||||||
Reads LDraw parts from \fIsrcpath\fR and generates a new LeoCAD Pieces Library in \fIdstpath\fR.
|
Reads LDraw parts from \fIsrcpath\fR and generates a new LeoCAD Pieces Library in \fIdstpath\fR.
|
||||||
|
|
||||||
.TP
|
|
||||||
.BI "\-\-libgl "library
|
|
||||||
Sets the name of the OpenGL dynamic library used by the program to \fIlibrary\fR.
|
|
||||||
The default library names searched are libGL.so and libMesaGL.so.
|
|
||||||
|
|
||||||
.SH ENVIRONMENT
|
.SH ENVIRONMENT
|
||||||
``LEOCAD_LIB'' may be set to the path of the pieces library.
|
``LEOCAD_LIB'' may be set to the path of the pieces library.
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@ win32 {
|
||||||
QMAKE_LFLAGS += /INCREMENTAL
|
QMAKE_LFLAGS += /INCREMENTAL
|
||||||
PRECOMPILED_SOURCE = common/lc_global.cpp
|
PRECOMPILED_SOURCE = common/lc_global.cpp
|
||||||
RC_FILE = qt/leocad.rc
|
RC_FILE = qt/leocad.rc
|
||||||
|
QMAKE_CFLAGS_DEBUG += /O0
|
||||||
|
QMAKE_CFLAGS_RELEASE += /Zi
|
||||||
|
QMAKE_LFLAGS_RELEASE += /map /debug /opt:ref
|
||||||
} else {
|
} else {
|
||||||
LIBS += -lz
|
LIBS += -lz
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
|
||||||
|
|
|
@ -50,6 +50,19 @@ lcQMainWindow::lcQMainWindow(QWidget *parent)
|
||||||
lcPiecesLibrary* Library = lcGetPiecesLibrary();
|
lcPiecesLibrary* Library = lcGetPiecesLibrary();
|
||||||
PieceInfo* Info = Library->FindPiece("3005", false);
|
PieceInfo* Info = Library->FindPiece("3005", false);
|
||||||
|
|
||||||
|
GL_EnableVertexBufferObject();
|
||||||
|
|
||||||
|
if (lcGetActiveProject()->m_pPieces)
|
||||||
|
{
|
||||||
|
for (int PieceIdx = 0; PieceIdx < Library->mPieces.GetSize(); PieceIdx++)
|
||||||
|
{
|
||||||
|
lcMesh* Mesh = Library->mPieces[PieceIdx]->mMesh;
|
||||||
|
|
||||||
|
if (Mesh)
|
||||||
|
Mesh->UpdateBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!Info)
|
if (!Info)
|
||||||
Info = Library->mPieces[0];
|
Info = Library->mPieces[0];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue