die cpID wurde umbenannt.
This commit is contained in:
+6
-3
@@ -87,24 +87,27 @@ def process_files(json_file_path, txt_files_dir):
|
||||
json_cp = json_item["connectionPoints"][i]
|
||||
|
||||
# 记录旧值
|
||||
old_id = cp["id"]
|
||||
old_x = cp["x"]
|
||||
old_y = cp["y"]
|
||||
old_dir = cp["direction"]
|
||||
|
||||
# 更新为新值
|
||||
cp["id"] = json_cp["id"]
|
||||
cp["x"] = json_cp["x"]
|
||||
cp["y"] = json_cp["y"]
|
||||
if json_cp["direction"]==360:
|
||||
if json_cp["direction"] == 360:
|
||||
cp["direction"] = 0
|
||||
else:
|
||||
cp["direction"] = json_cp["direction"]
|
||||
|
||||
# 记录变更
|
||||
cp_changes.append({
|
||||
"id": cp["id"],
|
||||
"id": (old_id, cp["id"]),
|
||||
"x": (old_x, cp["x"]),
|
||||
"y": (old_y, cp["y"]),
|
||||
"direction": (old_dir, cp["direction"])
|
||||
})
|
||||
})
|
||||
# Write back to TXT file
|
||||
with open(txt_file_path, 'w', encoding='utf-8') as f:
|
||||
json.dump(txt_content, f, indent=2, ensure_ascii=False)
|
||||
|
||||
Reference in New Issue
Block a user