From 1f7312b30f62faea1f1d865286747e1ae600df0d Mon Sep 17 00:00:00 2001 From: wangfanzhou Date: Fri, 29 Dec 2023 21:43:54 +0800 Subject: [PATCH] pre-commit --- samples/blender/04_staticmesh_render.py | 2 +- samples/unreal/04_staticmesh_render.py | 2 +- src/XRFeitoriaBpy/core/factory.py | 20 ++++++++++++++------ src/XRFeitoriaBpy/properties.py | 4 +++- xrfeitoria/sequence/sequence_blender.py | 2 +- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/samples/blender/04_staticmesh_render.py b/samples/blender/04_staticmesh_render.py index 864ae0e4..f491b947 100644 --- a/samples/blender/04_staticmesh_render.py +++ b/samples/blender/04_staticmesh_render.py @@ -11,8 +11,8 @@ from xrfeitoria.data_structure.models import SequenceTransformKey as SeqTransKey from xrfeitoria.utils import setup_logger -from ..utils import visualize_vertices from ..config import assets_path, blender_exec +from ..utils import visualize_vertices root = Path(__file__).parents[2].resolve() # output_path = '~/xrfeitoria/output/samples/blender/{file_name}' diff --git a/samples/unreal/04_staticmesh_render.py b/samples/unreal/04_staticmesh_render.py index 313ef3b0..9d3d7130 100644 --- a/samples/unreal/04_staticmesh_render.py +++ b/samples/unreal/04_staticmesh_render.py @@ -11,8 +11,8 @@ from xrfeitoria.data_structure.models import SequenceTransformKey as SeqTransKey from xrfeitoria.utils import setup_logger -from ..utils import visualize_vertices from ..config import assets_path, unreal_exec, unreal_project +from ..utils import visualize_vertices root = Path(__file__).parents[2].resolve() # output_path = '~/xrfeitoria/output/samples/unreal/{file_name}' diff --git a/src/XRFeitoriaBpy/core/factory.py b/src/XRFeitoriaBpy/core/factory.py index 88558832..058d3bca 100644 --- a/src/XRFeitoriaBpy/core/factory.py +++ b/src/XRFeitoriaBpy/core/factory.py @@ -124,7 +124,7 @@ def set_sequence_properties( frame_end: int, frame_current: int, resolution_x: int, - resolution_y: int + resolution_y: int, ) -> None: """Set the sequence properties. @@ -146,7 +146,9 @@ def set_sequence_properties( collection.sequence_properties.resolution_x = resolution_x collection.sequence_properties.resolution_y = resolution_y - def get_sequence_properties(collection: 'bpy.types.Collection') -> 'Tuple[bpy.types.Scene, int, int, int, int, int, int]': + def get_sequence_properties( + collection: 'bpy.types.Collection', + ) -> 'Tuple[bpy.types.Scene, int, int, int, int, int, int]': """Get the sequence properties. Args: @@ -176,9 +178,15 @@ def open_sequence(seq_name: str) -> 'bpy.types.Scene': # get sequence collection seq_collection = XRFeitoriaBlenderFactory.get_collection(seq_name) # get sequence properties - level_scene, fps, frame_start, frame_end, frame_current, resolution_x, resolution_y = XRFeitoriaBlenderFactory.get_sequence_properties( - collection=seq_collection - ) + ( + level_scene, + fps, + frame_start, + frame_end, + frame_current, + resolution_x, + resolution_y, + ) = XRFeitoriaBlenderFactory.get_sequence_properties(collection=seq_collection) # deactivate all cameras in this level for obj in level_scene.objects: if obj.type == 'CAMERA': @@ -250,7 +258,7 @@ def close_sequence() -> None: frame_end=level_scene.frame_end, frame_current=level_scene.frame_current, resolution_x=level_scene.render.resolution_x, - resolution_y=level_scene.render.resolution_y + resolution_y=level_scene.render.resolution_y, ) # unlink the sequence from the level XRFeitoriaBlenderFactory.unlink_collection_from_scene(collection=collection, scene=level_scene) diff --git a/src/XRFeitoriaBpy/properties.py b/src/XRFeitoriaBpy/properties.py index cddf8acf..719b0493 100644 --- a/src/XRFeitoriaBpy/properties.py +++ b/src/XRFeitoriaBpy/properties.py @@ -46,7 +46,9 @@ def active_sequence_update(self, context): if self.active_sequence is None: XRFeitoriaBlenderFactory.close_sequence() elif XRFeitoriaBlenderFactory.is_sequence_collecion(self.active_sequence): - level_scene, _, _, _, _, _, _ = XRFeitoriaBlenderFactory.get_sequence_properties(collection=self.active_sequence) + level_scene, _, _, _, _, _, _ = XRFeitoriaBlenderFactory.get_sequence_properties( + collection=self.active_sequence + ) if self.active_sequence.name not in level_scene.collection.children: XRFeitoriaBlenderFactory.open_sequence(self.active_sequence.name) else: diff --git a/xrfeitoria/sequence/sequence_blender.py b/xrfeitoria/sequence/sequence_blender.py index 23c3727c..20c22b10 100644 --- a/xrfeitoria/sequence/sequence_blender.py +++ b/xrfeitoria/sequence/sequence_blender.py @@ -97,7 +97,7 @@ def _new_seq_in_engine( frame_end=seq_length - 1, frame_current=0, resolution_x=level_scene.render.resolution_x, - resolution_y=level_scene.render.resolution_y + resolution_y=level_scene.render.resolution_y, ) level_scene.frame_start = 0 level_scene.frame_end = seq_length - 1