feat(tools): 命令行白模构建——build_level.bat 一键生成UE5关卡
This commit is contained in:
@@ -21,14 +21,15 @@ try:
|
||||
except ImportError:
|
||||
HAS_UNREAL = False
|
||||
|
||||
# 将项目根目录加入 sys.path 以支持 config 导入
|
||||
_SCRIPT_DIR = Path(__file__).resolve().parent
|
||||
_TOOLS_DIR = _SCRIPT_DIR.parent.parent.parent
|
||||
if str(_TOOLS_DIR) not in sys.path:
|
||||
sys.path.insert(0, str(_TOOLS_DIR))
|
||||
# 将 level-builder 根目录加入 sys.path 以支持 config 导入
|
||||
# 注意: 目录名含连字符 (level-builder),不能用 tools.level_builder 形式导入
|
||||
_SCRIPT_DIR = Path(__file__).resolve().parent # builder/
|
||||
_LB_DIR = _SCRIPT_DIR.parent # tools/level-builder/
|
||||
if str(_LB_DIR) not in sys.path:
|
||||
sys.path.insert(0, str(_LB_DIR))
|
||||
|
||||
from tools.level_builder.config.asset_mapping import MESH_ASSETS
|
||||
from tools.level_builder.config.material_mapping import MATERIAL_PATHS
|
||||
from config.asset_mapping import MESH_ASSETS
|
||||
from config.material_mapping import MATERIAL_PATHS
|
||||
|
||||
logger = logging.getLogger("level_builder.builder")
|
||||
|
||||
@@ -168,7 +169,7 @@ def _spawn_mesh_actor(editor_subsystem, actor_def: dict):
|
||||
|
||||
# 设置 Transform
|
||||
rot = actor_def.get("rotation", [0, 0, 0])
|
||||
actor.set_actor_rotation(unreal.Rotator(rot[0], rot[1], rot[2]))
|
||||
actor.set_actor_rotation(unreal.Rotator(rot[0], rot[1], rot[2]), False)
|
||||
|
||||
scale = actor_def.get("scale", [1, 1, 1])
|
||||
actor.set_actor_scale3d(unreal.Vector(scale[0], scale[1], scale[2]))
|
||||
@@ -201,7 +202,7 @@ def _spawn_player_start(editor_subsystem, actor_def: dict):
|
||||
)
|
||||
if actor:
|
||||
rot = actor_def.get("rotation", [0, 0, 0])
|
||||
actor.set_actor_rotation(unreal.Rotator(rot[0], rot[1], rot[2]))
|
||||
actor.set_actor_rotation(unreal.Rotator(rot[0], rot[1], rot[2]), False)
|
||||
actor.set_actor_label(actor_def["actor_name"])
|
||||
folder = actor_def.get("folder", "")
|
||||
if folder:
|
||||
@@ -218,7 +219,7 @@ def _spawn_directional_light(editor_subsystem, actor_def: dict):
|
||||
)
|
||||
if actor:
|
||||
rot = actor_def.get("rotation", [-45, 315, 0])
|
||||
actor.set_actor_rotation(unreal.Rotator(rot[0], rot[1], rot[2]))
|
||||
actor.set_actor_rotation(unreal.Rotator(rot[0], rot[1], rot[2]), False)
|
||||
actor.set_actor_label(actor_def["actor_name"])
|
||||
folder = actor_def.get("folder", "")
|
||||
if folder:
|
||||
|
||||
Reference in New Issue
Block a user