动画修复

This commit is contained in:
Rowland 2025-12-12 14:53:40 +08:00
parent 79e21d572d
commit 7a3fbfeb91

View File

@ -9205,24 +9205,34 @@ class PropertyPanelManager:
import platform import platform
# 策略1: 处理Linux风格路径在Windows上的问题 # 策略1: 处理Linux风格路径在Windows上的问题
if platform.system() == "Windows" and filepath.startswith('/') and ':' not in filepath: if filepath.startswith('/') and platform.system() == "Windows":
print("[路径转换] 尝试处理Linux风格路径:", filepath)
path_parts = filepath.split('/') path_parts = filepath.split('/')
if len(path_parts) > 2 and len(path_parts[1]) == 1: print(platform.system())
drive_letter = path_parts[1].upper() + ':' if len(path_parts) > 1:
drive_letter = path_parts[1].upper() + ':\\' # 添加反斜杠确保正确路径格式
remaining_path = '\\'.join(path_parts[2:]) if len(path_parts) > 2 else '' remaining_path = '\\'.join(path_parts[2:]) if len(path_parts) > 2 else ''
potential_path = os.path.join(drive_letter, remaining_path) potential_path = os.path.join(drive_letter, remaining_path)
print(f"[路径转换] 构造的潜在路径: {potential_path}")
if os.path.exists(potential_path): if os.path.exists(potential_path):
filepath = potential_path filepath = potential_path
fixed = True fixed = True
print(f"[路径转换] {original_filepath} -> {filepath}") print(f"[路径转换] 成功: {original_filepath} -> {filepath}")
else:
print(f"[路径转换] 文件不存在: {potential_path}")
# 策略2: 处理路径分隔符问题 # 策略2: 处理路径分隔符问题
if not fixed: if not fixed:
# 尝试规范化路径 # 尝试规范化路径
normalized_path = os.path.normpath(filepath) normalized_path = os.path.normpath(filepath)
print(f"[路径规范化] 尝试规范化路径: {filepath} -> {normalized_path}")
if os.path.exists(normalized_path): if os.path.exists(normalized_path):
filepath = normalized_path filepath = normalized_path
fixed = True fixed = True
print(f"[路径规范化] 成功: {filepath}")
else:
print(f"[路径规范化] 文件不存在: {normalized_path}")
# 策略3: 在Resources目录中查找 # 策略3: 在Resources目录中查找
if not fixed: if not fixed:
@ -9230,9 +9240,13 @@ class PropertyPanelManager:
resources_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "Resources") resources_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "Resources")
filename = os.path.basename(filepath) filename = os.path.basename(filepath)
potential_path = os.path.join(resources_path, filename) potential_path = os.path.join(resources_path, filename)
print(f"[Resources查找] 尝试在Resources目录查找: {potential_path}")
if os.path.exists(potential_path): if os.path.exists(potential_path):
filepath = potential_path filepath = potential_path
fixed = True fixed = True
print(f"[Resources查找] 成功: {filepath}")
else:
print(f"[Resources查找] 文件不存在: {potential_path}")
if fixed: if fixed:
print(f"路径修复: {original_filepath} -> {filepath}") print(f"路径修复: {original_filepath} -> {filepath}")