29 vector<PrimitiveCategory> g_PrimitiveCategories; |
29 vector<PrimitiveCategory> g_PrimitiveCategories; |
30 static PrimitiveLister* g_activePrimLister = null; |
30 static PrimitiveLister* g_activePrimLister = null; |
31 static bool g_primListerMutex = false; |
31 static bool g_primListerMutex = false; |
32 vector<Primitive> g_primitives; |
32 vector<Primitive> g_primitives; |
33 |
33 |
|
34 static const str g_Other = QObject::tr( "Other" ); |
|
35 |
34 static void populateCategories (); |
36 static void populateCategories (); |
35 static void loadPrimitiveCatgories (); |
37 static void loadPrimitiveCatgories (); |
36 |
38 |
37 // ============================================================================= |
39 // ============================================================================= |
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
164 // ============================================================================= |
166 // ============================================================================= |
165 static void populateCategories () { |
167 static void populateCategories () { |
166 for (PrimitiveCategory& cat : g_PrimitiveCategories) |
168 for (PrimitiveCategory& cat : g_PrimitiveCategories) |
167 cat.prims.clear (); |
169 cat.prims.clear (); |
168 |
170 |
169 PrimitiveCategory* unmatched = findCategory ("Other"); |
171 PrimitiveCategory* unmatched = findCategory( g_Other ); |
170 |
172 |
171 if (!unmatched) { |
173 if (!unmatched) { |
172 // Shouldn't happen.. but catch it anyway. |
174 // Shouldn't happen.. but catch it anyway. |
173 print ("No `Other` category found! Creating one...\n"); |
|
174 PrimitiveCategory cat; |
175 PrimitiveCategory cat; |
175 cat.setName ("Other"); |
176 cat.setName( g_Other ); |
176 unmatched = &(g_PrimitiveCategories << cat); |
177 unmatched = &(g_PrimitiveCategories << cat); |
177 } |
178 } |
178 |
179 |
179 for (Primitive& prim : g_primitives) { |
180 for (Primitive& prim : g_primitives) { |
180 bool matched = false; |
181 bool matched = false; |
266 g_PrimitiveCategories << cat; |
267 g_PrimitiveCategories << cat; |
267 } |
268 } |
268 |
269 |
269 // Add a category for unmatched primitives |
270 // Add a category for unmatched primitives |
270 PrimitiveCategory cat; |
271 PrimitiveCategory cat; |
271 cat.setName ("Other"); |
272 cat.setName( g_Other ); |
272 g_PrimitiveCategories << cat; |
273 g_PrimitiveCategories << cat; |
273 } |
274 } |
274 |
275 |
275 // ============================================================================= |
276 // ============================================================================= |
276 bool primitiveLoaderBusy() |
277 bool primitiveLoaderBusy() |
396 return objs; |
397 return objs; |
397 } |
398 } |
398 |
399 |
399 str primitiveTypeName( PrimitiveType type ) |
400 str primitiveTypeName( PrimitiveType type ) |
400 { |
401 { |
|
402 // Not translated as primitives are in English. |
401 return type == Circle ? "Circle" : |
403 return type == Circle ? "Circle" : |
402 type == Cylinder ? "Cylinder" : |
404 type == Cylinder ? "Cylinder" : |
403 type == Disc ? "Disc" : |
405 type == Disc ? "Disc" : |
404 type == DiscNeg ? "Disc Negative" : |
406 type == DiscNeg ? "Disc Negative" : |
405 type == Ring ? "Ring" : |
407 type == Ring ? "Ring" : |