+static unsigned int max_object_size( const string_list& materials )
+{
+ unsigned int max_size = 0;
+
+ for (unsigned int start=0; start < materials.size();) {
+ string m = materials[start];
+ unsigned int end = start + 1;
+ // find range of objects with identical material, calc its size
+ for (; (end < materials.size()) && (m == materials[end]); ++end) {}
+
+ unsigned int cur_size = end - start;
+ max_size = std::max(max_size, cur_size);
+ start = end;
+ }
+
+ return max_size;
+}
+
+const unsigned int VERSION_7_MATERIAL_LIMIT = 0x7fff;
+