一.ScoEditor下载霸王•吕布 / ScoEditor · GitCodehttps://gitcode.net/qq_35829452/scoeditor二.ScoEditor导出文件种类
mission_objects.json:场景物/出生点/通道等物体
layer_ground_elevation.pfm:场景terrain/ground地形增量,采用PFM深度图存储
ai_mesh.obj:AI网格静态模型,由点/线面构成
三.mission_objects.json
object_type = ['prop', 'entry', 'item', 'unused', 'plant', 'passage']
object = {
'type': object_type[type], 类型,场景物/出生点/通道
'id': id, ID.scene_props.py定义ID
'garbage': '%0#x' % garbage,
'rotation_matrix': [mtx_a, mtx_b, mtx_c], 旋转矩阵(右手坐标系,ZXY顺序旋转),转化后获得沿XYZ旋转角度
'pos': pos, 世界坐标系坐标
'str': str, spr_torch等标识
'entry_no': entry_no, (若为prop则prop_instance_get_variation_id获取)
'menu_entry_no': menu_item_no,(若为prop则prop_instance_get_variation_id_2获取)
'scale': scale, 伸缩变换比例
}
<1.旋转角度转化:euler_angle_to_rotation.bat/rotation_to_euler_angle.bat
将Blender旋转角度调整为ZXY模式,输入rotx,roty,rotz至 euler_angle_to_rotation.py中得到旋转矩阵,拷贝至mission_objects.json.
<2.blender python脚本实现导出mission_object.json
import bpy
import math
import json
# mission_obj data_format
# object_type = ['prop', 'entry', 'item', 'unused', 'plant', 'passage']
# object = {
# 'type': object_type[type], 类型,场景物/出生点/通道
# 'id': id, ID.scene_props.py定义ID
# 'garbage': '%0#x' % garbage,
# 'rotation_matrix': [mtx_a, mtx_b, mtx_c], 旋转矩阵(右手坐标系,ZXY顺序旋转),转化后获得沿XYZ旋转角度
# 'pos': pos, 世界坐标系坐标
# 'str': str, spr_torch等标识
# 'entry_no': entry_no, (若为prop则prop_instance_get_variation_id获取)
# 'menu_entry_no': menu_item_no,(若为prop则prop_instance_get_variation_id_2获取)
# 'scale': scale, 伸缩变换比例
#}
# 获取当前场景中所有的对象
objects = bpy.context.scene.objects
# 使用欧拉角创建一个旋转矩阵
rotation_matrix = objects['spr_inventory'].rotation_euler.to_matrix()
# 打印旋转矩阵
print(rotation_matrix)
mission_objects = []
for object in objects:
mission_obj = {}
mission_obj['type'] = 'prop'
mission_obj['id'] = object.get('id')
mission_obj['garbage'] = '0x317f2d8'
rot_matrix = object.rotation_euler.to_matrix()
print(object.rotation_euler.to_matrix()[0][1])
mission_obj['rotation_matrix'] = [
[rot_matrix[0][0], rot_matrix[0][1], rot_matrix[0][2]],
[rot_matrix[1][0], rot_matrix[1][1], rot_matrix[1][2]],
[rot_matrix[2][0], rot_matrix[2][1], rot_matrix[2][2]],
]
mission_obj['pos'] = [object.location.x, object.location.y, object.location.z]
mission_obj['str'] = object.name
mission_obj['entry_no'] = object.get('entry_no')
mission_obj['menu_entry_no'] = object.get('menu_entry_no')
mission_obj['scale'] = [object.scale.x, object.scale.y, object.scale.z]
mission_objects.append(mission_obj)
mission_objects_json = json.dumps(mission_objects, indent=4)
print(mission_objects_json)
# 打开文件进行写入,如果文件不存在则创建
with open('F:\mission_objects.json', 'w', encoding='utf-8') as file:
file.write(mission_objects_json) # 将字符串写入文件
四.ai_mesh.obj
五.layer_ground_elevation.pfm
六.解包sco文件
将拷贝sco文件至工具目录,运行unpack.bat进行解包.
七.封包sco文件
修改解包文件夹下的文件,运行repack.bat重新打包生成sco文件.