2018-03-03 01:39:22 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require '../tools/modelList.php';
|
|
|
|
require '../tools/modelTextures.php';
|
|
|
|
|
|
|
|
$modelList = new modelList();
|
|
|
|
$modelTextures = new modelTextures();
|
|
|
|
|
2019-02-09 15:17:15 +08:00
|
|
|
$modelList = $modelList->get_list();
|
|
|
|
$modelList = $modelList['models'];
|
2018-03-03 01:39:22 +08:00
|
|
|
|
|
|
|
foreach ($modelList as $modelName) {
|
2019-02-09 15:17:15 +08:00
|
|
|
if (!is_array($modelName) && file_exists('../model/'.$modelName.'/textures.cache')) {
|
2018-03-03 01:39:22 +08:00
|
|
|
|
|
|
|
$textures = $texturesNew = array();
|
2019-02-09 15:17:15 +08:00
|
|
|
$modelTexturesList = $modelTextures->get_list($modelName);
|
|
|
|
$modelNameTextures = $modelTextures->get_textures($modelName);
|
|
|
|
if (is_array($modelTexturesList)) foreach ($modelTexturesList['textures'] as $v) $textures[] = str_replace('\/', '/', json_encode($v));
|
|
|
|
if (is_array($modelNameTextures)) foreach ($modelNameTextures as $v) $texturesNew[] = str_replace('\/', '/', json_encode($v));
|
2018-03-03 01:39:22 +08:00
|
|
|
|
2019-02-09 15:17:15 +08:00
|
|
|
$texturesDiff = array_diff($texturesNew, $textures);
|
|
|
|
if (empty($textures)) continue; elseif (empty($texturesDiff)) {
|
2018-03-03 01:39:22 +08:00
|
|
|
echo '<p>'.$modelName.' / textures.cache / No Update.</p>';
|
|
|
|
} else {
|
|
|
|
foreach (array_values(array_unique(array_merge($textures, $texturesNew))) as $v) $texturesMerge[] = json_decode($v, 1);
|
2019-02-09 15:17:15 +08:00
|
|
|
file_put_contents('../model/'.$modelName.'/textures.cache', str_replace('\/', '/', json_encode($texturesMerge)));
|
2018-03-03 01:39:22 +08:00
|
|
|
echo '<p>'.$modelName.' / textures.cache / Updated.</p>';
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
elseif (is_array($modelName)) continue;
|
|
|
|
elseif ($modelTextures->get_list($modelName)) echo '<p>'.$modelName.' / textures.cache / Created.</p>';
|
|
|
|
}
|