summaryrefslogtreecommitdiff
path: root/common/library.cpp
diff options
context:
space:
mode:
authorleo2002-12-21 05:05:30 +0000
committerleo2002-12-21 05:05:30 +0000
commit168c7cc98f87aa9e37553cbaf580743aabb6f2a5 (patch)
tree7102968552f22d160982b60153d119c1bd444188 /common/library.cpp
parenta3f30483bd20556a1e01e718950ba3989df8862b (diff)
More PLM cross platform improvements
git-svn-id: http://svn.leocad.org/trunk@321 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/library.cpp')
-rwxr-xr-xcommon/library.cpp34
1 files changed, 31 insertions, 3 deletions
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;
+}