Created
January 7, 2021 08:03
-
-
Save kezzardrix/5a19b7aa5769ef9d7248702279540945 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unreal | |
| import os | |
| import csv | |
| # シーケンサーを取得 | |
| LevelSequence = unreal.find_asset('/Game/Sequence/testSeq') | |
| csv_file = open("D:/UE4LandscapeProject/Me/Tutorial/Content/Python/hat.csv") | |
| data = csv.reader(csv_file) | |
| channalName = next(data) | |
| values = data | |
| # Camera Cuts等以外のトラックはbindingsと呼ばれる | |
| bindings = LevelSequence.get_bindings() | |
| frame_num = 0 | |
| for b in bindings: | |
| if b.get_display_name() == 'CubeTest': | |
| # bindingsの中のトラック。Transformとか | |
| tracks = b.get_tracks() | |
| for t in tracks: | |
| # 例 : Transformの中のメンバー | |
| sections = t.get_sections() | |
| for s in sections: | |
| # 例 : Transformの中のチャンネル。物によって型が違う | |
| channels = s.get_channels() | |
| for c in channels: | |
| keys = c.get_keys() | |
| for k in keys: | |
| c.remove_key(k) | |
| frame_num = 0 | |
| for d in data: | |
| FNumber = unreal.FrameNumber(frame_num) | |
| Event = unreal.MovieSceneEvent() | |
| #loc x にキーを追加 | |
| channels[0].add_key(FNumber, float(d[0])) | |
| frame_num = frame_num + 1 | |
| LevelSequence.set_work_range_end(frame_num/30.0) | |
| csv_file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment