Python を活用した Unreal Engine のエディタ スクリプティング | Course
def getAssetClass(classType):
EAL = unreal.EditorAssetLibrary
assetPaths = EAL.list_assets('/Game')
assets = []
for assetPath in assetPaths:
assetData = EAL.find_asset_data(assetPath)
assetClass = assetData.asset_class
if assetClass == classType:
assets.append(assetData.get_asset())
for asset in assets:
print(asset)
return assets
getAssetClass("LevelSequence")
import unreal
def listAssetPaths():
EAL = unreal.EditorAssetLibrary
assetPaths = EAL.list_assets('/Game')
for assetPath in assetPaths:
print(assetPath)
listAssetPaths()
import unreal
def getSelectionContentBrowser():
EUL = unreal.EditorUtilityLibrary
selectedAssets = EUL.get_selected_assets()
for selectedAsset in selectedAssets:
print(selectedAsset)
getSelectionContentBrowser()
import unreal
def getAllActors():
EAS = unreal.EditorActorSubsystem()
# クラスのメソッドを呼び出し「メソッドに引数が必要である」
# というエラーが発生した場合はドキュメントで引数なしとされていた場合でも
# EditorActorSubsystemを関数として呼び出す("()"を付ける)
# 又は
# EAS = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
actors = EAS.get_all_level_actors()
for actor in actors:
print(actor)
getAllActors()
import unreal
def getSelectedActors():
EAS = unreal.EditorActorSubsystem()
selectedActors = EAS.get_selected_level_actors()
for selectedActor in selectedActors:
print(selectedActor)
getSelectedActors()