import unreal
#Blueprint指定
actor_path = "/Game/test/Scene_Blueprint"
#ActorをGET
blueprint = unreal.load_asset(actor_path)
#subsystemでroot data handleをGetする: これ以下一文は定型
subsystem = unreal.get_engine_subsystem(unreal.SubobjectDataSubsystem)
#for i in dir(subsystem):print(i)add_new_subobject
#SubobjectDataBlueprintLibraryを取得
blueprint_library = unreal.SubobjectDataBlueprintFunctionLibrary()
#Blueprintを取得
sub_handles = subsystem.k2_gather_subobject_data_for_blueprint(blueprint)
#ActorSequenceを指定
actorSequence = "ActorSequence"
StaticMesh = "StaticMesh"
#ActorSequenceを見つける
for sub_handle in sub_handles:
sub_data = blueprint_library.get_data(sub_handle)
#ActorSequenceのみ操作する
if actorSequence == str(blueprint_library.get_variable_name(sub_data)):
#componentを取得する
sub_object_component = blueprint_library.get_object(sub_data)
#autoplayとloopを設定
sub_object_component.set_editor_property('playback_settings', unreal.MovieSceneSequencePlaybackSettings(auto_play=True, loop_count=[-1], play_rate=1.0, start_time=0.0, random_start_time=False, restore_state=False, disable_movement_input=False, disable_look_at_input=False, hide_player=False, hide_hud=False, disable_camera_cuts=False, pause_at_end=False))
actorSeq = sub_object_component.get_editor_property("Sequence")
if StaticMesh in str(blueprint_library.get_variable_name(sub_data):
#StaticMeshComponentをSequenceの所有に追加する
compbp = blueprint_library.get_object(sub_data)
addtrack = actorSeq.add_possessable(compbp)
このような感じでActorSequenceComponentにStaticMeshComponentを追加できるかと思ったのですが追加できませんし。エラーも出ません。
解決方法がわかる方おりましたらご教授お願いできませんでしょうか。
なお、レベルシーケンスではレベルパスでStaticMeshのActorをadd_possessable()で追加できるのは確認しています。
actor_system = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
actor = actor_system.get_selected_level_actors()[0]
LevelSequence = unreal.load_asset(‘/Game/glb/Crossing’, unreal.LevelSequence)
print(“levelsequence :”+str(LevelSequence.add_possessable(actor)))
LogPython: levelsequence :<Struct ‘MovieSceneBindingProxy’ (0x00000AA272EC3E00) {binding_id: {}, sequence: /Script/LevelSequence.LevelSequence’“/Game/glb/Crossing.Crossing”'}>
LevelSequenceに追加できたStaticMeshのreturn print
compbp = blueprint_library.get_object(sub_data)
addtrack = actorSeq.add_possessable(compbp)
print(“addtrack :”+str(addtrack))
LogPython: addtrack :<Struct ‘MovieSceneBindingProxy’ (0x00000AA26C86D710) {binding_id: {}, sequence: /Script/ActorSequence.ActorSequence’“/Game/glb/Scene_Blueprint0.Scene_Blueprint0_C:ActorSequence_GEN_VARIABLE.Sequence”'}>
追加できたっぽいが追加されないreturn print
同様にMovieSceneBindingProxyが返されているので所有しているっぽい戻り値です
##add_possessables時のログ:possessablesの名前と構造体
LogPython: Crossing_Signal_1_005_StaticMeshComponent0
LogPython: addtrack :<Struct 'MovieSceneBindingProxy' (0x000008AAF278FAE0) {binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint1.Scene_Blueprint1_C:ActorSequence_GEN_VARIABLE.Sequence"'}>
LogPython: Empty_DefaultSceneRoot
LogPython: addtrack :<Struct 'MovieSceneBindingProxy' (0x000008AAF278E340) {binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint1.Scene_Blueprint1_C:ActorSequence_GEN_VARIABLE.Sequence"'}>
LogPython: Curve_020_StaticMeshComponent0
LogPython: addtrack :<Struct 'MovieSceneBindingProxy' (0x000008AAF278A4C0) {binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint1.Scene_Blueprint1_C:ActorSequence_GEN_VARIABLE.Sequence"'}>
LogPython: Curve_019_StaticMeshComponent0
LogPython: addtrack :<Struct 'MovieSceneBindingProxy' (0x000008AAF2788820) {binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint1.Scene_Blueprint1_C:ActorSequence_GEN_VARIABLE.Sequence"'}>
LogPython: Curve_021_StaticMeshComponent0
LogPython: addtrack :<Struct 'MovieSceneBindingProxy' (0x000008AAF2784860) {binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint1.Scene_Blueprint1_C:ActorSequence_GEN_VARIABLE.Sequence"'}>
LogPython: Curve_022_StaticMeshComponent0
LogPython: addtrack :<Struct 'MovieSceneBindingProxy' (0x000008AAF278E180) {binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint1.Scene_Blueprint1_C:ActorSequence_GEN_VARIABLE.Sequence"'}>
LogPython: Crossing_Signal_1_007_StaticMeshComponent0
LogPython: addtrack :<Struct 'MovieSceneBindingProxy' (0x000008AAF27830A0) {binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint1.Scene_Blueprint1_C:ActorSequence_GEN_VARIABLE.Sequence"'}>
LogPython: Cube_008_StaticMeshComponent0
LogPython: addtrack :<Struct 'MovieSceneBindingProxy' (0x000008AAF2783EA0) {binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint1.Scene_Blueprint1_C:ActorSequence_GEN_VARIABLE.Sequence"'}>
##確認では所有していない
LogPython: print(actorSeq.get_possessables())
LogPython: [{binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint1.Scene_Blueprint1_C:ActorSequence_GEN_VARIABLE.Sequence"'}]
##手動追加後の確認
LogPython: print(actorSeq.get_possessables())
LogPython: [{binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint.Scene_Blueprint_C:ActorSequence_GEN_VARIABLE.Sequence"'},
{binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint.Scene_Blueprint_C:ActorSequence_GEN_VARIABLE.Sequence"'},
{binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint.Scene_Blueprint_C:ActorSequence_GEN_VARIABLE.Sequence"'},
{binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint.Scene_Blueprint_C:ActorSequence_GEN_VARIABLE.Sequence"'},
{binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint.Scene_Blueprint_C:ActorSequence_GEN_VARIABLE.Sequence"'},
{binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint.Scene_Blueprint_C:ActorSequence_GEN_VARIABLE.Sequence"'},
{binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint.Scene_Blueprint_C:ActorSequence_GEN_VARIABLE.Sequence"'},
{binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint.Scene_Blueprint_C:ActorSequence_GEN_VARIABLE.Sequence"'},
{binding_id: {}, sequence: /Script/ActorSequence.ActorSequence'"/Game/glb/Scene_Blueprint.Scene_Blueprint_C:ActorSequence_GEN_VARIABLE.Sequence"'}]
Remember, contributions to this repository should follow our GitHub Community Guidelines.
Labels
None yet
Notifications
Customize
You’re receiving notifications because you authored the thread.
0 participants
Lock conversation
kiruru002
(kiruru002)
4
1 Like