Skip to content

Commit ec4fab6

Browse files
committed
refactor: Update sequence method calls for consistency across scripts
- Changed instances of `xf_runner.Sequence.new` to `xf_runner.sequence` in various Blender and Unreal render scripts, ensuring uniformity with the updated API. - Updated related test and tutorial files to reflect the new method name, enhancing clarity and consistency in documentation.
1 parent ebe529e commit ec4fab6

File tree

16 files changed

+28
-20
lines changed

16 files changed

+28
-20
lines changed

samples/blender/03_basic_render.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
This is a script to render a preset level in blender.
55
"""
6+
67
from pathlib import Path
78

89
import xrfeitoria as xf
@@ -49,7 +50,7 @@ def main(debug=False, background=False):
4950
)
5051

5152
# by creating a new `sequence`, XRFeitoria links a new collection named `{seq_name}` to the level.
52-
with xf_runner.Sequence.new(seq_name=seq_name, level='Scene') as seq:
53+
with xf_runner.sequence(seq_name=seq_name, level='Scene') as seq:
5354
# The cameras in the level will not be used for rendering by default,
5455
# but you can activate them by calling `seq.use_camera(camera)`.
5556
# There is a camera named `Camera` in the level, and we use it for rendering.

samples/blender/04_staticmesh_render.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
This is a script to render static meshes in blender.
55
"""
6+
67
import math
78
from pathlib import Path
89

@@ -64,7 +65,7 @@ def main(debug=False, background=False):
6465
##################################################
6566
#### Create a new sequence with default level ####
6667
##################################################
67-
with xf_runner.Sequence.new(seq_name=seq_1_name) as seq:
68+
with xf_runner.sequence(seq_name=seq_1_name) as seq:
6869
# use the `camera` in level to render
6970
seq.use_camera(camera=camera)
7071

@@ -85,7 +86,7 @@ def main(debug=False, background=False):
8586
########################################################
8687
#### Create another new sequence with default level ####
8788
########################################################
88-
with xf_runner.Sequence.new(seq_name=seq_2_name) as seq:
89+
with xf_runner.sequence(seq_name=seq_2_name) as seq:
8990
# import an actor to the sequence, and add transform keys to make it rotate around the bunny and grow bigger and bigger
9091
actor_kc = seq.import_actor(file_path=assets_path['koupen_chan'], stencil_value=255)
9192
actor_kc.set_origin_to_center()

samples/blender/05_skeletalmesh_render.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
This is a script to render skeletal meshes in blender.
55
"""
6+
67
from pathlib import Path
78

89
import xrfeitoria as xf
@@ -38,7 +39,7 @@ def main(debug=False, background=False):
3839
### Create a new sequence with the defined level ###
3940
####################################################
4041
seq_length = 200
41-
with xf_runner.Sequence.new(seq_name=seq_name, level='MyLevel', seq_length=seq_length) as seq:
42+
with xf_runner.sequence(seq_name=seq_name, level='MyLevel', seq_length=seq_length) as seq:
4243
# import an skeletal mesh and set an animation to it
4344
actor = seq.import_actor(file_path=assets_path['SMPL_XL'], stencil_value=128)
4445
actor.setup_animation(animation_path=assets_path['motion_2'])

samples/unreal/03_basic_render.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
This is a script to render a preset level in unreal.
55
"""
6+
67
from pathlib import Path
78

89
import xrfeitoria as xf
@@ -28,7 +29,7 @@ def main(debug=False, background=False):
2829

2930
# open a pre-made sequence, which has a corresponding level
3031
# the sequence data is under /Game/XRFeitoriaUnreal/Sequences/{seq_name}_data
31-
with xf_runner.Sequence.open(seq_name=seq_name) as seq:
32+
with xf_runner.sequence(seq_name=seq_name) as seq:
3233
# use the camera in the level to render
3334
camera = xf_runner.Camera('Camera')
3435
camera_name = camera.name

samples/unreal/04_staticmesh_render.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
This is a script to render static meshes in unreal.
55
"""
6+
67
import math
78
from pathlib import Path
89

@@ -62,7 +63,7 @@ def main(debug=False, background=False):
6263
####################################################
6364
######## Create a new sequence with level ########
6465
####################################################
65-
with xf_runner.Sequence.new(level=dst_level_path, seq_name=seq_1_name, replace=True) as seq:
66+
with xf_runner.sequence(level=dst_level_path, seq_name=seq_1_name, replace=True) as seq:
6667
# show the sequence in unreal editor
6768
seq.show()
6869
# use the `camera` in level to render
@@ -86,7 +87,7 @@ def main(debug=False, background=False):
8687
####################################################
8788
##### Create another new sequence with level #####
8889
####################################################
89-
with xf_runner.Sequence.new(level=dst_level_path, seq_name=seq_2_name, seq_length=6, replace=True) as seq:
90+
with xf_runner.sequence(level=dst_level_path, seq_name=seq_2_name, seq_length=6, replace=True) as seq:
9091
# show the sequence in unreal editor
9192
seq.show()
9293

samples/unreal/05_skeletalmesh_render.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
This is a script to render skeletal meshes in unreal.
55
"""
6+
67
from pathlib import Path
78

89
import xrfeitoria as xf
@@ -30,7 +31,7 @@ def main(debug=False, background=False):
3031
path=assets_path['motion_1'], skeleton_path=f'{SMPL_XL_path}_Skeleton'
3132
)[0]
3233

33-
with xf_runner.Sequence.new(seq_name=seq_name, level=level_path, seq_length=200, replace=True) as seq:
34+
with xf_runner.sequence(seq_name=seq_name, level=level_path, seq_length=200, replace=True) as seq:
3435
seq.show()
3536

3637
# add a camera in sequence to render

tests/blender/level.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
>>> python -m tests.blender.level
33
"""
4+
45
from pathlib import Path
56

67
import xrfeitoria as xf
@@ -23,7 +24,7 @@
2324

2425

2526
def seq_simple(xf_runner: XRFeitoriaBlender, seq_name: str = 'seq_simple'):
26-
with xf_runner.Sequence.new(seq_name=seq_name, level='Scene', seq_length=1) as seq:
27+
with xf_runner.sequence(seq_name=seq_name, level='Scene', seq_length=1) as seq:
2728
camera = xf_runner.Camera('Camera')
2829
seq.use_camera(camera)
2930

tests/blender/sequence.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
>>> python -m tests.blender.sequence
33
"""
4+
45
from pathlib import Path
56

67
import numpy as np
@@ -31,7 +32,7 @@ def seq_actor(xf_runner: XRFeitoriaBlender, seq_name: str = 'seq_actor'):
3132
camera_level = xf_runner.Camera.spawn(location=(0, 10, 0))
3233
camera_level.look_at(target=(0, 0, 0))
3334

34-
with xf_runner.Sequence.new(seq_name=seq_name, seq_length=2) as seq:
35+
with xf_runner.sequence(seq_name=seq_name, seq_length=2) as seq:
3536
seq.use_camera(camera_level)
3637
camera = seq.spawn_camera(camera_name='camera', location=(-10, 0, 0), rotation=(90, 0, -90), fov=39.6)
3738

@@ -85,7 +86,7 @@ def seq_actor(xf_runner: XRFeitoriaBlender, seq_name: str = 'seq_actor'):
8586

8687

8788
def seq_shape(xf_runner: XRFeitoriaBlender, seq_name='seq_shape'):
88-
with xf_runner.Sequence.new(seq_name=seq_name, seq_length=6) as seq:
89+
with xf_runner.sequence(seq_name=seq_name, seq_length=6) as seq:
8990
camera = seq.spawn_camera(location=(-10, 0, 0), rotation=(90, 0, -90), fov=39.6)
9091

9192
xf_runner.utils.set_frame_current(frame=3)

tutorials/01_get_started.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
"\n",
199199
"# Use `with` statement to create a sequence, and it will be automatically close the sequence after the code block is executed.\n",
200200
"sequence_name = 'MySequence'\n",
201-
"with xf_runner.Sequence.new(seq_name=sequence_name, replace=True) as seq:\n",
201+
"with xf_runner.sequence(seq_name=sequence_name, replace=True) as seq:\n",
202202
"\n",
203203
" # Add a camera and make it look at the koupen-chan\n",
204204
" camera_location = (0.0, -0.8, 0.0)\n",

tutorials/02_randomization.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
"# Use the `with` statement to create a sequence, and it will be automatically close the sequence after the code block is executed.\n",
312312
"# The argument `seq_length` controls the number of frames to be rendered. \n",
313313
"sequence_name = 'MySequence'\n",
314-
"with xf_runner.Sequence.new(seq_name=sequence_name, seq_length=frame_num, replace=True) as seq:\n",
314+
"with xf_runner.sequence(seq_name=sequence_name, seq_length=frame_num, replace=True) as seq:\n",
315315
" ##############################\n",
316316
" ##### Add transform keys #####\n",
317317
" ##############################\n",

0 commit comments

Comments
 (0)