21 |
23 |
22 return NULL; |
24 return NULL; |
23 } |
25 } |
24 |
26 |
25 // ============================================================================= |
27 // ============================================================================= |
26 // IO_ParseLDFile (str) |
28 // IO_OpenLDrawFile (str) |
27 // |
29 // |
28 // Opens the given file and parses the LDraw code within. |
30 // Opens the given file and parses the LDraw code within. |
29 // ============================================================================= |
31 // ============================================================================= |
30 OpenFile* IO_ParseLDFile (str path) { |
32 OpenFile* IO_OpenLDrawFile (str path) { |
31 FILE* fp = fopen (path.chars (), "r"); |
33 FILE* fp = fopen (path.chars (), "r"); |
32 |
34 |
33 if (!fp) { |
35 if (!fp) { |
34 printf ("Couldn't open %s!\n", path.chars ()); |
36 printf ("Couldn't open %s!\n", path.chars ()); |
35 return NULL; |
37 return NULL; |
56 |
58 |
57 for (ulong i = 0; i < lines.size(); ++i) |
59 for (ulong i = 0; i < lines.size(); ++i) |
58 load->objects.push_back (ParseLine (lines[i])); |
60 load->objects.push_back (ParseLine (lines[i])); |
59 |
61 |
60 g_LoadedFiles.push_back (load); |
62 g_LoadedFiles.push_back (load); |
61 return g_LoadedFiles[g_LoadedFiles.size() - 1]; |
63 g_CurrentFile = g_LoadedFiles[g_LoadedFiles.size() - 1]; |
|
64 |
|
65 // Recalculate the bounding box |
|
66 g_BBox.calculate(); |
|
67 |
|
68 // Rebuild the object tree view now. |
|
69 g_qWindow->buildObjList (); |
|
70 |
|
71 return g_CurrentFile; |
62 } |
72 } |
63 |
73 |
64 // ============================================================================= |
74 // ============================================================================= |
65 // ParseLine (str) |
75 // ParseLine (str) |
66 // |
76 // |