mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-05-16 22:40:23 +01:00
scene-item transform added
minor bump
This commit is contained in:
parent
6a8e7afc1d
commit
756bbbe331
13
README.md
13
README.md
@ -141,6 +141,19 @@ obsws-cli scene-item toggle --parent=test_group START "Colour Source 3"
|
|||||||
obsws-cli scene-item visible --parent=test_group START "Colour Source 4"
|
obsws-cli scene-item visible --parent=test_group START "Colour Source 4"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- transform: Set the transform of an item in a scene.
|
||||||
|
- flags:
|
||||||
|
|
||||||
|
*optional*
|
||||||
|
- --position-x: X position of the item in the scene
|
||||||
|
- --position-y: Y position of the item in the scene
|
||||||
|
- --scale-x: X scale of the item in the scene
|
||||||
|
- --scale-y: Y scale of the item in the scene
|
||||||
|
|
||||||
|
```console
|
||||||
|
obsws-cli scene-item transform --position-x=556.0 --scale-x=0.7946954965591431 --scale-y=0.7948529124259949 LIVE "Window Capture"
|
||||||
|
```
|
||||||
|
|
||||||
#### Scene Collections
|
#### Scene Collections
|
||||||
|
|
||||||
- list: List all scene collections.
|
- list: List all scene collections.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
|
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
__version__ = "0.7.0"
|
__version__ = "0.8.0"
|
||||||
|
@ -203,3 +203,70 @@ def visible(
|
|||||||
typer.echo(
|
typer.echo(
|
||||||
f"Item '{item_name}' in scene '{scene_name}' is currently {'visible' if enabled.scene_item_enabled else 'hidden'}."
|
f"Item '{item_name}' in scene '{scene_name}' is currently {'visible' if enabled.scene_item_enabled else 'hidden'}."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@_validate_scene_name_and_item_name
|
||||||
|
@app.command()
|
||||||
|
def transform(
|
||||||
|
ctx: typer.Context,
|
||||||
|
scene_name: str,
|
||||||
|
item_name: str,
|
||||||
|
parent: Annotated[str, typer.Option(help='Parent group name')] = None,
|
||||||
|
position_x: Annotated[
|
||||||
|
float, typer.Option(help='X position of the item in the scene')
|
||||||
|
] = None,
|
||||||
|
position_y: Annotated[
|
||||||
|
float, typer.Option(help='Y position of the item in the scene')
|
||||||
|
] = None,
|
||||||
|
scale_x: Annotated[
|
||||||
|
float, typer.Option(help='X scale of the item in the scene')
|
||||||
|
] = None,
|
||||||
|
scale_y: Annotated[
|
||||||
|
float, typer.Option(help='Y scale of the item in the scene')
|
||||||
|
] = None,
|
||||||
|
):
|
||||||
|
"""Set the transform of an item in a scene."""
|
||||||
|
if parent:
|
||||||
|
if not validate.item_in_scene_item_list(ctx, scene_name, parent):
|
||||||
|
typer.echo(f"Parent group '{parent}' not found in scene '{scene_name}'.")
|
||||||
|
raise typer.Exit(code=1)
|
||||||
|
else:
|
||||||
|
if not validate.item_in_scene_item_list(ctx, scene_name, item_name):
|
||||||
|
typer.echo(f"Item '{item_name}' not found in scene '{scene_name}'.")
|
||||||
|
raise typer.Exit(code=1)
|
||||||
|
|
||||||
|
old_scene_name = scene_name
|
||||||
|
scene_name, scene_item_id = _get_scene_name_and_item_id(
|
||||||
|
ctx, scene_name, item_name, parent
|
||||||
|
)
|
||||||
|
|
||||||
|
transform = {}
|
||||||
|
if position_x is not None:
|
||||||
|
transform['positionX'] = position_x
|
||||||
|
if position_y is not None:
|
||||||
|
transform['positionY'] = position_y
|
||||||
|
if scale_x is not None:
|
||||||
|
transform['scaleX'] = scale_x
|
||||||
|
if scale_y is not None:
|
||||||
|
transform['scaleY'] = scale_y
|
||||||
|
|
||||||
|
if not transform:
|
||||||
|
typer.echo('No transform options provided.')
|
||||||
|
raise typer.Exit(code=1)
|
||||||
|
|
||||||
|
transform = ctx.obj.set_scene_item_transform(
|
||||||
|
scene_name=scene_name,
|
||||||
|
item_id=int(scene_item_id),
|
||||||
|
transform=transform,
|
||||||
|
)
|
||||||
|
|
||||||
|
if parent:
|
||||||
|
typer.echo(
|
||||||
|
f"Item '{item_name}' in group '{parent}' in scene '{old_scene_name}' has been transformed."
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# If not in a parent group, just show the scene name
|
||||||
|
# This is to avoid confusion with the parent group name
|
||||||
|
# which is not the same as the scene name
|
||||||
|
# and is not needed in this case
|
||||||
|
typer.echo(f"Item '{item_name}' in scene '{scene_name}' has been transformed.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user