Update index.php

This commit is contained in:
FGHRSH 2020-03-10 03:11:42 +08:00 committed by GitHub
parent 6dee0e049b
commit 504d00f15c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,40 +26,20 @@ if (is_array($modelName)) {
} }
} }
$textures = $json['textures']; foreach ($json['textures'] as $k => $texture)
foreach ($textures as $key => $texture){ $json['textures'][$k] = '../model/' . $modelName . '/' . $texture;
$textures[$key] = '../model/' . $modelName . '/' . $texture;
}
$json['textures'] = $textures;
$json['model'] = '../model/'.$modelName.'/'.$json['model']; $json['model'] = '../model/'.$modelName.'/'.$json['model'];
if (isset($json['pose'])) $json['pose'] = '../model/'.$modelName.'/'.$json['pose']; if (isset($json['pose'])) $json['pose'] = '../model/'.$modelName.'/'.$json['pose'];
if (isset($json['physics'])) $json['physics'] = '../model/'.$modelName.'/'.$json['physics']; if (isset($json['physics'])) $json['physics'] = '../model/'.$modelName.'/'.$json['physics'];
if (isset($json['motions'])) { if (isset($json['motions']))
$motions = $json['motions']; foreach ($json['motions'] as $k => $v) foreach($v as $k2 => $v2) foreach ($v2 as $k3 => $motion)
foreach ($motions as $key1 => $motion){ if ($k3 == 'file') $json['motions'][$k][$k2][$k3] = '../model/' . $modelName . '/' . $motion;
foreach($motion as $key2 => $resource){
foreach ($resource as $key3 => $value)
if($key3 == 'file'){
$motions[$key1][$key2][$key3] = '../model/' . $modelName . '/' . $value;
}
}
}
$json['motions'] = $motions;
}
if (isset($json['expressions'])) { if (isset($json['expressions']))
$expressions = $json['expressions']; foreach ($json['expressions'] as $k => $v) foreach($v as $k2 => $expression)
foreach ($expressions as $key1 => $expression){ if ($k2 == 'file') $json['expressions'][$k][$k2] = '../model/' . $modelName . '/' . $expression;
foreach($expression as $key2 => $value){
if($key2 == 'file'){
$expressions[$key1][$key2] = '../model/' . $modelName . '/' . $value;
}
}
}
$json['expressions'] = $expressions;
}
header("Content-type: application/json"); header("Content-type: application/json");
echo $jsonCompatible->json_encode($json); echo $jsonCompatible->json_encode($json);