Skip to content

Commit

Permalink
[Version] Bump version to v0.6.3 (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
HaiyiMei and github-actions[bot] authored Aug 5, 2024
1 parent ff8c22b commit 1ea3c85
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 14 deletions.
16 changes: 16 additions & 0 deletions .circleci/Start-CircleCIRunner.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# choco install -y git gzip tar

$installDirPath = "D:\Program Files\CircleCI"
$agentPath = Join-Path -Path $installDirPath -ChildPath "circleci-runner.exe"
$configPath = Join-Path -Path $installDirPath -ChildPath "runner-agent-config.yaml"

echo "Constantly running CircleCI Runner Agent"
while ($true) {
echo "--- Restarting CircleCI Runner Agent ---"
try {
& $agentPath machine --config $configPath
} catch {
echo "Error: $_"
}
Start-Sleep 1
}
34 changes: 26 additions & 8 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ jobs:
- when:
condition: << pipeline.parameters.build-unreal-plugin >> || << pipeline.parameters.run-unreal-test >>
steps:
- checkout
# - checkout
- run:
name: Clone GitHub repository
command: |
git clone << pipeline.project.git_url >> --branch << pipeline.git.branch >> .
- run:
name: "Build Plugins & Run Tests"
shell: powershell.exe
Expand All @@ -41,26 +45,40 @@ jobs:
RUN_TEST: << pipeline.parameters.run-unreal-test >>
PYTHONIOENCODING: "utf-8"
command: |
echo "#### Get Unreal Engine ####"
$UE_51 = if (Test-Path $env:UE_51) { $env:UE_51 } else {
"C:/Program Files/Epic Games/UE_5.1/Engine/Binaries/Win64/UnrealEditor-Cmd.exe"
}
$UE_52 = if (Test-Path $env:UE_52) { $env:UE_52 } else {
"C:/Program Files/Epic Games/UE_5.2/Engine/Binaries/Win64/UnrealEditor-Cmd.exe"
}
$UE_53 = if (Test-Path $env:UE_53) { $env:UE_53 } else {
"C:/Program Files/Epic Games/UE_5.3/Engine/Binaries/Win64/UnrealEditor-Cmd.exe"
}
echo "#### Install XRFeitoria Package ####"
conda activate xrfeitoria
python -m pip install .
mkdir src/dist -ErrorAction SilentlyContinue -Force
if ($env:BUILD_UNREAL_PLUGIN -eq 1) {
echo "#### Building Unreal Plugin ####"
python -m xrfeitoria.utils.publish_plugins build-unreal `
-u "C:/Program Files/Epic Games/UE_5.1/Engine/Binaries/Win64/UnrealEditor-Cmd.exe" `
-u "C:/Program Files/Epic Games/UE_5.2/Engine/Binaries/Win64/UnrealEditor-Cmd.exe" `
-u "C:/Program Files/Epic Games/UE_5.3/Engine/Binaries/Win64/UnrealEditor-Cmd.exe"
-u $UE_51 `
-u $UE_52 `
-u $UE_53
$env:XRFEITORIA__VERSION=$(python -c "import xrfeitoria; print(xrfeitoria.__version__)")
$env:XRFEITORIA__DIST_ROOT="$PWD/src"
}
if ($env:RUN_TEST -eq 1) {
echo "#### Running Tests ####"
python -m tests.setup_ci -u "C:/Program Files/Epic Games/UE_5.1/Engine/Binaries/Win64/UnrealEditor-Cmd.exe"
echo "#### Running Tests For UE 5.1 ####"
python -m tests.setup_ci -u $UE_51
python -m tests.unreal.main
python -m tests.setup_ci -u "C:/Program Files/Epic Games/UE_5.2/Engine/Binaries/Win64/UnrealEditor-Cmd.exe"
echo "#### Running Tests For UE 5.2 ####"
python -m tests.setup_ci -u $UE_52
python -m tests.unreal.main
python -m tests.setup_ci -u "C:/Program Files/Epic Games/UE_5.3/Engine/Binaries/Win64/UnrealEditor-Cmd.exe"
echo "#### Running Tests For UE 5.3 ####"
python -m tests.setup_ci -u $UE_53
python -m tests.unreal.main
}
- when:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- 'src/XRFeitoriaUnreal/*'
- name: Determine next version
if: ${{ !steps.bumpr.outputs.skip }}
if: ${{ !steps.bumpr.outputs.skip }} && ${{ steps.bumpr.outputs.next_version != '' }}
run: |
# Get the next version from the previous step
echo "::group::Get the next version from the previous step"
Expand Down Expand Up @@ -104,5 +104,5 @@ jobs:
echo "::endgroup::"
# - name: suggester / Leave comments on PRs
# if: ${{ !steps.bumpr.outputs.skip }}
# if: ${{ !steps.bumpr.outputs.skip }} && ${{ steps.bumpr.outputs.next_version != '' }}
# uses: reviewdog/action-suggester@v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ Thumbs.db

# Plugins
src/*.zip
src/XRFeitoriaUnreal-*/
src/XRFeitoriaUnreal/Binaries/

# Configs
Expand Down
8 changes: 5 additions & 3 deletions samples/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ def get_exec(engine: Literal['blender', 'unreal'], exec_from_config: Optional[Pa
return path.as_posix()


def ask_unreal_project() -> str:
def ask_unreal_project(unreal_project: Optional[str] = None) -> str:
"""Ask for unreal project path."""
txt = 'Please input the path to the unreal project, or press [bold]enter[/bold] to download a sample project\n\[Enter]'
unreal_project = Prompt.ask(txt, default=None)
txt = 'Please input the path to the unreal project'
if unreal_project is None:
txt += ', or press [bold]enter[/bold] to download a sample project\n' '\[Enter]'
unreal_project = Prompt.ask(txt, default=unreal_project)
return get_unreal_project(unreal_project)


Expand Down
18 changes: 18 additions & 0 deletions src/XRFeitoriaUnreal/Content/Python/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ def add_camera_to_sequence(
camera: unreal.CameraActor,
camera_transform_keys: Optional[Union[SequenceTransformKey, List[SequenceTransformKey]]] = None,
camera_fov: float = 90.0,
camera_aspect_ratio: float = 16.0 / 9.0,
seq_length: Optional[int] = None,
) -> unreal.CameraActor:
if seq_length is None:
Expand All @@ -618,6 +619,11 @@ def add_camera_to_sequence(
# set the camera FOV
fov_track, fov_section = add_property_float_track_to_binding(camera_component_binding, 'FieldOfView', camera_fov)

# set the camera aspect ratio
aspect_ratio_track, aspect_ratio_section = add_property_float_track_to_binding(
camera_component_binding, 'AspectRatio', camera_aspect_ratio
)

# ------- add master track ------- #
camera_cut_track: unreal.MovieSceneCameraCutTrack = sequence.add_master_track(unreal.MovieSceneCameraCutTrack) # type: ignore

Expand Down Expand Up @@ -647,6 +653,7 @@ def add_camera_to_sequence(
'self': camera.camera_component,
},
'fov': {'track': fov_track, 'section': fov_section},
'aspect_ratio': {'track': aspect_ratio_track, 'section': aspect_ratio_section},
'transform': {'track': transform_track, 'section': transform_section},
}

Expand All @@ -657,6 +664,7 @@ def add_spawnable_camera_to_sequence(
camera_transform_keys: Optional[Union[SequenceTransformKey, List[SequenceTransformKey]]] = None,
camera_class: Type[unreal.CameraActor] = unreal.CameraActor,
camera_fov: float = 90.0,
camera_aspect_ratio: float = 16.0 / 9.0,
seq_length: Optional[int] = None,
) -> unreal.CameraActor:
"""Add a camera actor to the sequence.
Expand All @@ -667,6 +675,7 @@ def add_spawnable_camera_to_sequence(
camera_transform_keys (Optional[Union[SequenceTransformKey, List[SequenceTransformKey]]], optional): transform keys of the camera actor. Defaults to None.
camera_class (Type[unreal.CameraActor], optional): the camera actor class to spawn. Defaults to unreal.CameraActor.
camera_fov (float, optional): Filed of view of the camera. Defaults to 90.0.
camera_aspect_ratio (float, optional): Aspect ratio of the camera. Defaults to 16.0 / 9.0.
seq_length (Optional[int], optional): Sequence length. Defaults to None.
Returns:
Expand All @@ -688,6 +697,11 @@ def add_spawnable_camera_to_sequence(
# set the camera FOV
fov_track, fov_section = add_property_float_track_to_binding(camera_component_binding, 'FieldOfView', camera_fov)

# set the camera aspect ratio
aspect_ratio_track, aspect_ratio_section = add_property_float_track_to_binding(
camera_component_binding, 'AspectRatio', camera_aspect_ratio
)

# ------- add master track ------- #
# add master track (camera) to sequence
# camera_cut_track = sequence.add_track(unreal.MovieSceneCameraCutTrack)
Expand Down Expand Up @@ -726,6 +740,7 @@ def add_spawnable_camera_to_sequence(
'self': camera_actor.camera_component,
},
'fov': {'track': fov_track, 'section': fov_section},
'aspect_ratio': {'track': aspect_ratio_track, 'section': aspect_ratio_section},
'transform': {'track': transform_track, 'section': transform_section},
}

Expand Down Expand Up @@ -1174,6 +1189,7 @@ def add_camera(
camera_name: str,
transform_keys: 'Optional[TransformKeys]' = None,
fov: float = 90.0,
aspect_ratio: float = 16.0 / 9.0,
spawnable: bool = False,
):
"""Spawn a camera in sequence.
Expand All @@ -1190,6 +1206,7 @@ def add_camera(
camera_name=camera_name,
camera_transform_keys=transform_keys,
camera_fov=fov,
camera_aspect_ratio=aspect_ratio,
)
cls.bindings[camera_name] = bindings
else:
Expand All @@ -1199,6 +1216,7 @@ def add_camera(
camera=camera,
camera_transform_keys=transform_keys,
camera_fov=fov,
camera_aspect_ratio=aspect_ratio,
)
cls.bindings[camera_name] = bindings

Expand Down
21 changes: 21 additions & 0 deletions xrfeitoria/camera/camera_unreal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from ..data_structure.constants import Vector
from ..object.object_utils import ObjectUtilsUnreal
from ..rpc import remote_unreal
from ..utils import Validator
from .camera_base import CameraBase

try:
Expand All @@ -16,6 +17,16 @@ class CameraUnreal(CameraBase):

_object_utils = ObjectUtilsUnreal

@property
def aspect_ratio(self) -> float:
"""Aspect of ratio, Width / Height."""
return self._get_aspect_ratio_in_engine(self._name)

@aspect_ratio.setter
def aspect_ratio(self, value: float):
Validator.validate_argument_type(value, [float, int])
self._set_aspect_ratio_in_engine(self._name, value)

def look_at(self, target: Vector) -> None:
"""Set the camera to look at the target.
Expand All @@ -36,6 +47,11 @@ def _get_fov_in_engine(name):
camera: unreal.CameraActor = XRFeitoriaUnrealFactory.utils_actor.get_actor_by_name(name)
return camera.camera_component.field_of_view

@staticmethod
def _get_aspect_ratio_in_engine(name: str) -> float:
camera: unreal.CameraActor = XRFeitoriaUnrealFactory.utils_actor.get_actor_by_name(name)
return camera.camera_component.aspect_ratio

# ----- Setter ----- #

@staticmethod
Expand All @@ -47,6 +63,11 @@ def _set_camera_fov_in_engine(name, fov):
camera: unreal.CameraActor = XRFeitoriaUnrealFactory.utils_actor.get_actor_by_name(name)
camera.camera_component.field_of_view = fov

@staticmethod
def _set_aspect_ratio_in_engine(name: str, ratio: float):
camera: unreal.CameraActor = XRFeitoriaUnrealFactory.utils_actor.get_actor_by_name(name)
camera.camera_component.aspect_ratio = ratio

@staticmethod
def _spawn_in_engine(
camera_name,
Expand Down
13 changes: 13 additions & 0 deletions xrfeitoria/sequence/sequence_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def spawn_camera(
location: 'Vector' = None,
rotation: 'Vector' = None,
fov: float = 90.0,
aspect_ratio: float = 16.0 / 9.0,
camera_name: Optional[str] = None,
) -> CameraBase:
"""Spawn a new camera in the sequence.
Expand All @@ -140,6 +141,7 @@ def spawn_camera(
location (Vector): Location of the camera.
rotation (Vector): Rotation of the camera.
fov (float in (0.0, 180.0), optional): Field of view of the camera len. Defaults to 90.0. (unit: degrees)
aspect_ratio (float, optional): Aspect ratio of the camera. Defaults to 16.0 / 9.0.
camera_name (str, optional): Name of the camera. Defaults to None.
"""
if camera_name is None:
Expand All @@ -148,6 +150,7 @@ def spawn_camera(
cls._spawn_camera_in_engine(
transform_keys=transform_keys.model_dump(),
fov=fov,
aspect_ratio=aspect_ratio,
camera_name=camera_name,
)
logger.info(f'[cyan]Spawned[/cyan] camera "{camera_name}" in sequence "{cls.name}"')
Expand All @@ -158,13 +161,15 @@ def spawn_camera_with_keys(
cls,
transform_keys: 'TransformKeys',
fov: float = 90.0,
aspect_ratio: float = 16.0 / 9.0,
camera_name: str = None,
) -> CameraBase:
"""Spawn a new camera with keyframes in the sequence.
Args:
transform_keys (TransformKeys): Keyframes of transform (location, rotation, and scale).
fov (float in (0.0, 180.0), optional): Field of view of the camera len. Defaults to 90.0. (unit: degrees)
aspect_ratio (float, optional): Aspect ratio of the camera. Defaults to 16.0 / 9.0.
camera_name (str, optional): Name of the camera. Defaults to 'Camera'.
"""
if not isinstance(transform_keys, list):
Expand All @@ -175,6 +180,7 @@ def spawn_camera_with_keys(
cls._spawn_camera_in_engine(
transform_keys=transform_keys,
fov=fov,
aspect_ratio=aspect_ratio,
camera_name=camera_name,
)
logger.info(
Expand Down Expand Up @@ -269,6 +275,7 @@ def use_camera(
location: 'Optional[Vector]' = None,
rotation: 'Optional[Vector]' = None,
fov: float = None,
aspect_ratio: float = 16.0 / 9.0,
) -> None:
"""Use the specified level camera in the sequence. The location, rotation and
fov set in this method are only used in the sequence. The location, rotation and
Expand All @@ -279,6 +286,7 @@ def use_camera(
location (Optional[Vector], optional): The location of the camera. Defaults to None. unit: meter.
rotation (Optional[Vector], optional): The rotation of the camera. Defaults to None. unit: degree.
fov (float, optional): The field of view of the camera. Defaults to None. unit: degree.
aspect_ratio (float, optional): The aspect ratio of the camera. Defaults to None.
"""
camera_name = camera.name
location = camera.location if location is None else location
Expand All @@ -289,6 +297,7 @@ def use_camera(
cls._use_camera_in_engine(
transform_keys=transform_keys.model_dump(),
fov=fov,
aspect_ratio=aspect_ratio,
camera_name=camera_name,
)
logger.info(f'[cyan]Used[/cyan] camera "{camera_name}" in sequence "{cls.name}"')
Expand All @@ -299,6 +308,7 @@ def use_camera_with_keys(
camera: _camera,
transform_keys: 'TransformKeys',
fov: float = None,
aspect_ratio: float = 16.0 / 9.0,
) -> None:
"""Use the specified level camera in the sequence. The transform_keys and fov
set in this method are only used in the sequence. The location, rotation and fov
Expand All @@ -308,6 +318,7 @@ def use_camera_with_keys(
camera (CameraUnreal or CameraBlender): The camera to use.
transform_keys (TransformKeys): The transform keys to use.
fov (float, optional): The field of view to use. Defaults to None. unit: degree.
aspect_ratio (float, optional): The aspect ratio of the camera. Defaults to None.
"""
camera_name = camera.name
if not isinstance(transform_keys, list):
Expand All @@ -317,6 +328,7 @@ def use_camera_with_keys(
cls._use_camera_in_engine(
transform_keys=transform_keys,
fov=fov,
aspect_ratio=aspect_ratio,
camera_name=camera_name,
)
logger.info(
Expand Down Expand Up @@ -453,6 +465,7 @@ def _import_actor_in_engine(
def _spawn_camera_in_engine(
transform_keys: 'Union[List[Dict], Dict]',
fov: float = 90.0,
aspect_ratio: float = 16.0 / 9.0,
camera_name: str = 'Camera',
) -> None:
pass
Expand Down
10 changes: 9 additions & 1 deletion xrfeitoria/sequence/sequence_base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ class SequenceBase(ABC):
) -> ActorBase: ...
@classmethod
def spawn_camera(
cls, location: Vector = None, rotation: Vector = None, fov: float = 90.0, camera_name: Optional[str] = None
cls,
location: Vector = None,
rotation: Vector = None,
fov: float = 90.0,
aspect_ratio: float = 16.0 / 9.0,
camera_name: Optional[str] = None,
) -> CameraBase: ...
@classmethod
def spawn_camera_with_keys(
cls,
transform_keys: TransformKeys,
fov: float = 90.0,
camera_name: str = None,
aspect_ratio: float = 16.0 / 9.0,
) -> CameraBase: ...
@classmethod
def use_camera(
Expand All @@ -51,13 +57,15 @@ class SequenceBase(ABC):
location: Optional[Vector] = None,
rotation: Optional[Vector] = None,
fov: float = None,
aspect_ratio: float = 16.0 / 9.0,
) -> None: ...
@classmethod
def use_camera_with_keys(
cls,
camera: CameraBase,
transform_keys: TransformKeys,
fov: float = None,
aspect_ratio: float = 16.0 / 9.0,
) -> None: ...
@classmethod
def use_actor(
Expand Down
Loading

0 comments on commit 1ea3c85

Please sign in to comment.