67 lines
2.3 KiB
Python
67 lines
2.3 KiB
Python
import unreal
|
|
|
|
|
|
CHARACTER_BLUEPRINT_PATH = "/Game/Agrarian/Blueprints/Characters/BP_AgrarianPlayerCharacter"
|
|
CONTROLLER_BLUEPRINT_PATH = "/Game/Agrarian/Blueprints/Characters/BP_AgrarianPlayerController"
|
|
GAME_MODE_BLUEPRINT_PATH = "/Game/Agrarian/Blueprints/Characters/BP_AgrarianGameMode"
|
|
|
|
|
|
def class_path(value):
|
|
if not value:
|
|
return ""
|
|
return value.get_path_name().split(".")[0]
|
|
|
|
|
|
def load_blueprint_class(path):
|
|
generated_class = unreal.EditorAssetLibrary.load_blueprint_class(path)
|
|
if not generated_class:
|
|
raise RuntimeError(f"Could not load generated Blueprint class: {path}")
|
|
return generated_class
|
|
|
|
|
|
def main():
|
|
failures = []
|
|
|
|
for path in [CHARACTER_BLUEPRINT_PATH, CONTROLLER_BLUEPRINT_PATH, GAME_MODE_BLUEPRINT_PATH]:
|
|
if not unreal.EditorAssetLibrary.does_asset_exist(path):
|
|
failures.append(f"{path} missing")
|
|
|
|
character_class = load_blueprint_class(CHARACTER_BLUEPRINT_PATH)
|
|
controller_class = load_blueprint_class(CONTROLLER_BLUEPRINT_PATH)
|
|
game_mode_class = load_blueprint_class(GAME_MODE_BLUEPRINT_PATH)
|
|
game_mode_cdo = unreal.get_default_object(game_mode_class)
|
|
|
|
default_pawn_path = class_path(game_mode_cdo.get_editor_property("default_pawn_class"))
|
|
player_controller_path = class_path(game_mode_cdo.get_editor_property("player_controller_class"))
|
|
|
|
if default_pawn_path != CHARACTER_BLUEPRINT_PATH:
|
|
failures.append(
|
|
f"Game mode default pawn expected {CHARACTER_BLUEPRINT_PATH}, got {default_pawn_path}"
|
|
)
|
|
|
|
if player_controller_path != CONTROLLER_BLUEPRINT_PATH:
|
|
failures.append(
|
|
"Game mode player controller expected "
|
|
f"{CONTROLLER_BLUEPRINT_PATH}, got {player_controller_path}"
|
|
)
|
|
|
|
character_cdo = unreal.get_default_object(character_class)
|
|
if not character_cdo:
|
|
failures.append(f"{CHARACTER_BLUEPRINT_PATH} CDO missing")
|
|
|
|
controller_cdo = unreal.get_default_object(controller_class)
|
|
if not controller_cdo:
|
|
failures.append(f"{CONTROLLER_BLUEPRINT_PATH} CDO missing")
|
|
|
|
if failures:
|
|
raise RuntimeError("Agrarian player Blueprint verification failed: " + "; ".join(failures))
|
|
|
|
unreal.log(
|
|
"Agrarian player Blueprint verification complete: "
|
|
"native Agrarian character, controller, and game mode asset paths load correctly."
|
|
)
|
|
|
|
|
|
main()
|
|
|