Fixed crash loading a project from the command line.

This commit is contained in:
leo 2013-08-11 20:35:04 +00:00
parent 3b83a16aaa
commit 013e72b334
4 changed files with 18 additions and 13 deletions

View file

@ -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)
{
// System setup parameters.
char* LibPath = NULL;
char* GLPath = NULL;
// Image output options.
bool SaveImage = false;
@ -146,11 +144,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
if (Param[0] == '-')
{
if (strcmp(Param, "--libgl") == 0)
{
ParseStringArgument(&i, argc, argv, &GLPath);
}
else if ((strcmp(Param, "-l") == 0) || (strcmp(Param, "--libpath") == 0))
if ((strcmp(Param, "-l") == 0) || (strcmp(Param, "--libpath") == 0))
{
ParseStringArgument(&i, argc, argv, &LibPath);
}
@ -211,7 +205,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
return false;
}
else
console.PrintWarning("Unknown parameter: %s\n", Param);
printf("Unknown parameter: %s\n", Param);
}
else
{

View file

@ -90,11 +90,6 @@ of \fILeoCAD \fRuses /usr/share/leocad/ as the default.
.BI "\-\-convert "srcpath dstpath
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
``LEOCAD_LIB'' may be set to the path of the pieces library.

View file

@ -16,6 +16,9 @@ win32 {
QMAKE_LFLAGS += /INCREMENTAL
PRECOMPILED_SOURCE = common/lc_global.cpp
RC_FILE = qt/leocad.rc
QMAKE_CFLAGS_DEBUG += /O0
QMAKE_CFLAGS_RELEASE += /Zi
QMAKE_LFLAGS_RELEASE += /map /debug /opt:ref
} else {
LIBS += -lz
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter

View file

@ -50,6 +50,19 @@ lcQMainWindow::lcQMainWindow(QWidget *parent)
lcPiecesLibrary* Library = lcGetPiecesLibrary();
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)
Info = Library->mPieces[0];