1 Star 0 Fork 1

shiyuanGame/FixSpineForUnity

forked from 猿菠萝/FixSpineForUnity 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
s2u.py 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
猿菠萝 提交于 2018-07-29 15:19 . 添加主脚本。
# Copyright (c) 2018 CodBo.All rights reserved.
# Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
# http://opensource.org/licenses/MIT
import os, shutil,json
def rename():
work_dir = './'
for parent, dirnames, filenames in os.walk(work_dir):
for filename in filenames:
if filename.endswith(".atlas"):
file_path = os.path.join(parent, filename)
os.rename(file_path, file_path + ".txt")
print(file_path)
def fixJson():
work_dir = './'
for parent, dirnames, filenames in os.walk(work_dir):
for filename in filenames:
if filename.endswith(".json"):
file_path = os.path.join(parent, filename)
json1 = open(file_path,'r',encoding='utf-8').read()
if "bones" in json1 and not "skeleton" in json1:
print(file_path)
json1 = json1[0:2] + '"skeleton": { "hash": "0C6whivVQVuD/woFtbJBZAqNHq4", "spine": "3.5.03-beta", "width": 519.09, "height": 542.36, "fps": 30, "images": "" },\n' + json1[2:];
open(file_path,'w',encoding='utf-8').write(json1)
print("--------rename...--------\n")
rename()
print("--------fix json...------\n")
fixJson()
print("--------All done.--------\n")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/shiyuanGame/FixSpineForUnity.git
git@gitee.com:shiyuanGame/FixSpineForUnity.git
shiyuanGame
FixSpineForUnity
FixSpineForUnity
master

搜索帮助