Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3238 from simonebarbieri/bugfix/ue5-fix_camera
Browse files Browse the repository at this point in the history
Unreal: Fixed Camera loading in UE5
  • Loading branch information
antirotor authored May 26, 2022
2 parents 9a5dce4 + 0e0bbd5 commit d0bcfe2
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions openpype/hosts/unreal/plugins/load/load_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,33 @@ def _set_sequence_hierarchy(
min_frame_j,
max_frame_j + 1)

def _import_camera(
self, world, sequence, bindings, import_fbx_settings, import_filename
):
ue_version = unreal.SystemLibrary.get_engine_version().split('.')
ue_major = int(ue_version[0])
ue_minor = int(ue_version[1])

if ue_major == 4 and ue_minor <= 26:
unreal.SequencerTools.import_fbx(
world,
sequence,
bindings,
import_fbx_settings,
import_filename
)
elif (ue_major == 4 and ue_minor >= 27) or ue_major == 5:
unreal.SequencerTools.import_level_sequence_fbx(
world,
sequence,
bindings,
import_fbx_settings,
import_filename
)
else:
raise NotImplementedError(
f"Unreal version {ue_major} not supported")

def load(self, context, name, namespace, data):
"""
Load and containerise representation into Content Browser.
Expand Down Expand Up @@ -228,7 +255,7 @@ def load(self, context, name, namespace, data):
settings.set_editor_property('reduce_keys', False)

if cam_seq:
unreal.SequencerTools.import_fbx(
self._import_camera(
EditorLevelLibrary.get_editor_world(),
cam_seq,
cam_seq.get_bindings(),
Expand Down Expand Up @@ -388,7 +415,7 @@ def update(self, container, representation):

sub_scene.set_sequence(new_sequence)

unreal.SequencerTools.import_fbx(
self._import_camera(
EditorLevelLibrary.get_editor_world(),
new_sequence,
new_sequence.get_bindings(),
Expand Down

0 comments on commit d0bcfe2

Please sign in to comment.