From 168c7cc98f87aa9e37553cbaf580743aabb6f2a5 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 21 Dec 2002 05:05:30 +0000 Subject: More PLM cross platform improvements git-svn-id: http://svn.leocad.org/trunk@321 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- common/library.cpp | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'common/library.cpp') diff --git a/common/library.cpp b/common/library.cpp index 6f9db2c..6fd8181 100755 --- a/common/library.cpp +++ b/common/library.cpp @@ -45,10 +45,13 @@ void PiecesLibrary::CheckReload () strcpy (LibraryPath, m_LibraryPath); - // FIXME: project will crash if we don't update the pieceinfos + if (m_bNeedsReload) + { + // FIXME: project will crash if we don't update the pieceinfos - Unload (); - Load (LibraryPath); + Unload (); + Load (LibraryPath); + } } void PiecesLibrary::Unload () @@ -1103,8 +1106,33 @@ bool PiecesLibrary::ImportTexture (const char* Name) } // ============================================================================= +// LDraw support + +bool PiecesLibrary::ImportLDrawPiece (const char* Filename) +{ + LC_LDRAW_PIECE piece; + + SystemDoWaitCursor(1); + + if (ReadLDrawPiece (Filename, &piece)) + { +// if (FindPieceInfo (piece.name) != NULL) +// Sys_MessageBox ("Piece already exists in the library !"); + if (SaveLDrawPiece (&piece)) + Sys_MessageBox ("Piece successfully imported."); + else + Sys_MessageBox ("Error saving library."); + } + else + Sys_MessageBox ("Error reading file."); + + FreeLDrawPiece(&piece); + SystemDoWaitCursor(-1); + + return true; +} -- cgit v1.2.3