Skip to content

Commit

Permalink
Explicitly use typer.Option
Browse files Browse the repository at this point in the history
  • Loading branch information
Tremeschin committed Aug 21, 2024
1 parent 63ba93c commit 4d49965
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions DepthFlow/State.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
from typing import Annotated, Iterable, Tuple

import typer
from pydantic import BaseModel, Field, PrivateAttr
from ShaderFlow.Variable import ShaderVariable
from typer import Option


class DepthState(BaseModel):
"""Set effect parameters, animations might override them!"""

height: Annotated[float, Option("--height", "-h", min=0, max=1,
height: Annotated[float, typer.Option("--height", "-h", min=0, max=1,
help="[bold red](πŸ”΄ Basic )[/red bold] Depthmap's peak value, the effect [bold cyan]intensity[/cyan bold] [medium_purple3](The camera is 1 distance away from depth=0 at the z=1 plane)[/medium_purple3]")] = \
Field(default=0.25)

static: Annotated[float, Option("--static", "-s", min=0, max=1,
static: Annotated[float, typer.Option("--static", "-s", min=0, max=1,
help="[bold red](πŸ”΄ Basic )[/red bold] Focal depth plane of [bold cyan]offsets[/cyan bold] [medium_purple3](A value of 0 makes the background stationary; and 1 for the foreground)[/medium_purple3]")] = \
Field(default=0.0)

focus: Annotated[float, Option("--focus", "-f", min=0, max=1,
focus: Annotated[float, typer.Option("--focus", "-f", min=0, max=1,
help="[bold red](πŸ”΄ Basic )[/red bold] Focal depth plane of [bold cyan]perspective[/cyan bold] [medium_purple3](A value of 0 makes the background stationary; and 1 for the foreground)[/medium_purple3]")] = \
Field(default=0.0)

zoom: Annotated[float, Option("--zoom", "-z", min=0,
zoom: Annotated[float, typer.Option("--zoom", "-z", min=0,
help="[bold red](πŸ”΄ Basic )[/red bold] Camera [bold cyan]zoom factor[/cyan bold] [medium_purple3](2 means a quarter of the image is visible)[/medium_purple3]")] = \
Field(default=1.0)

isometric: Annotated[float, Option("--isometric", "-iso", min=0, max=1,
isometric: Annotated[float, typer.Option("--isometric", "-iso", min=0, max=1,
help="[bold yellow](🟑 Medium )[/yellow bold] Isometric factor of [bold cyan]camera projections[/cyan bold] [medium_purple3](Zero is fully perspective, 1 is orthographic)[/medium_purple3]")] = \
Field(default=0.0)

dolly: Annotated[float, Option("--dolly", "-d", min=0, max=1,
dolly: Annotated[float, typer.Option("--dolly", "-d", min=0, max=1,
help="[bold yellow](🟑 Medium )[/yellow bold] Same effect as --isometric, dolly zoom [medium_purple3](Move back ray projection origins by this amount)[/medium_purple3]")] = \
Field(default=0.0)

invert: Annotated[float, Option("--invert", "-inv", min=0, max=1,
invert: Annotated[float, typer.Option("--invert", "-inv", min=0, max=1,
help="[bold yellow](🟑 Medium )[/yellow bold] Interpolate depth values between (0=far, 1=near) and vice-versa, as in [bold cyan]mix(height, 1-height, invert)[/bold cyan]")] = \
Field(default=0.0)

mirror: Annotated[bool, Option("--mirror", "-m", " /-n",
mirror: Annotated[bool, typer.Option("--mirror", "-m", " /-n",
help="[bold yellow](🟑 Medium )[/yellow bold] Apply [bold cyan]GL_MIRRORED_REPEAT[/cyan bold] to the image [medium_purple3](The image is mirrored out of bounds on the respective edge)[/medium_purple3]")] = \
Field(default=True)

# # Center

center_x: Annotated[float, Option("--center-x", "-cex", min=0, max=1,
center_x: Annotated[float, typer.Option("--center-x", "-cex", min=0, max=1,
help="[bold green](🟒 Advanced)[/bold green] Horizontal 'true' offset of the camera [medium_purple3](The camera *is* above this point)[/medium_purple3]")] = \
Field(default=0)

center_y: Annotated[float, Option("--center-y", "-cey", min=0, max=1,
center_y: Annotated[float, typer.Option("--center-y", "-cey", min=0, max=1,
help="[bold green](🟒 Advanced)[/bold green] Vertical 'true' offset of the camera [medium_purple3](The camera *is* above this point)[/medium_purple3]")] = \
Field(default=0)

Expand All @@ -64,11 +64,11 @@ def center(self, value: Tuple[float, float]):
origin_x: float = Field(default=0)
"""Hozirontal focal point of the offsets, *as if* the camera was above this point"""

origin_x: Annotated[float, Option("--origin-x", "-orx",
origin_x: Annotated[float, typer.Option("--origin-x", "-orx",
help="[bold green](🟒 Advanced)[/bold green] Horizontal focal point of the offsets [medium_purple3](*As if* the camera was above this point)[/medium_purple3]")] = \
Field(default=0)

origin_y: Annotated[float, Option("--origin-y", "-ory", min=0, max=1,
origin_y: Annotated[float, typer.Option("--origin-y", "-ory", min=0, max=1,
help="[bold green](🟒 Advanced)[/bold green] Vertical focal point of the offsets [medium_purple3](*As if* the camera was above this point)[/medium_purple3]")] = \
Field(default=0)

Expand All @@ -83,11 +83,11 @@ def origin(self, value: Tuple[float, float]):

# # Parallax

offset_x: Annotated[float, Option("--offset-x", "-ofx",
offset_x: Annotated[float, typer.Option("--offset-x", "-ofx",
help="[bold green](🟒 Advanced)[/bold green] Horizontal parallax displacement [medium_purple3](Change this over time for the 3D effect)[/medium_purple3]")] = \
Field(default=0)

offset_y: Annotated[float, Option("--offset-y", "-ofy",
offset_y: Annotated[float, typer.Option("--offset-y", "-ofy",
help="[bold green](🟒 Advanced)[/bold green] Vertical parallax displacement [medium_purple3](Change this over time for the 3D effect)[/medium_purple3]")] = \
Field(default=0)

Expand All @@ -108,51 +108,51 @@ def reset(self) -> None:

# ---------------------------------------------------------------------------------------------|

vignette_enable: Annotated[bool, Option("--vig-enable", "-ve",
vignette_enable: Annotated[bool, typer.Option("--vig-enable", "-ve",
help="[bold blue](πŸ”΅ Vignette)[/blue bold] Enable a Vignette effect [green](Darken the corners of the image)[/green]")] = \
Field(default=False)

vignette_intensity: Annotated[float, Option("--vig-intensity", "-vi", min=0, max=100,
vignette_intensity: Annotated[float, typer.Option("--vig-intensity", "-vi", min=0, max=100,
help="[bold blue](πŸ”΅ Vignette)[/blue bold] β€’ Intensity of the Vignette effect")] = \
Field(default=30)

vignette_decay: Annotated[float, Option("--vig-decay", "-vd", min=0, max=1,
vignette_decay: Annotated[float, typer.Option("--vig-decay", "-vd", min=0, max=1,
help="[bold blue](πŸ”΅ Vignette)[/blue bold] β€’ Decay of the Vignette effect")] = \
Field(default=0.1)

# ---------------------------------------------------------------------------------------------|

dof_enable: Annotated[bool, Option("--dof-enable", "-de",
dof_enable: Annotated[bool, typer.Option("--dof-enable", "-de",
help="[bold blue](πŸ”΅ DoField )[/blue bold] Enable a Depth of field effect [green](Blur the image based on depth)[/green]")] = \
Field(default=False)

dof_start: Annotated[float, Option("--dof-start", "-da",
dof_start: Annotated[float, typer.Option("--dof-start", "-da",
help="[bold blue](πŸ”΅ DoField )[/blue bold] β€’ Blur starts at this depth value")] = \
Field(default=0.6)

dof_end: Annotated[float, Option("--dof-end", "-db",
dof_end: Annotated[float, typer.Option("--dof-end", "-db",
help="[bold blue](πŸ”΅ DoField )[/blue bold] β€’ Blur ends at this depth value")] = \
Field(default=1.0)

dof_exponent: Annotated[float, Option("--dof-exponent", "-dx", min=-10, max=10,
dof_exponent: Annotated[float, typer.Option("--dof-exponent", "-dx", min=-10, max=10,
help="[bold blue](πŸ”΅ DoField )[/blue bold] β€’ Shaping exponent")] = \
Field(default=2.0)

dof_intensity: Annotated[float, Option("--dof-intensity", "-di", min=0, max=2,
dof_intensity: Annotated[float, typer.Option("--dof-intensity", "-di", min=0, max=2,
help="[bold blue](πŸ”΅ DoField )[/blue bold] β€’ Blur intensity (radius)")] = \
Field(default=1.0)

dof_quality: Annotated[int, Option("--dof-quality", "-dq", min=1, max=16,
dof_quality: Annotated[int, typer.Option("--dof-quality", "-dq", min=1, max=16,
help="[bold blue](πŸ”΅ DoField )[/blue bold] β€’ Blur quality (radial steps)")] = \
Field(default=4)

dof_directions: Annotated[int, Option("--dof-directions", "-dd", min=1, max=32,
dof_directions: Annotated[int, typer.Option("--dof-directions", "-dd", min=1, max=32,
help="[bold blue](πŸ”΅ DoField )[/blue bold] β€’ Blur quality (directions)")] = \
Field(default=16)

# ---------------------------------------------------------------------------------------------|

saturation: Annotated[float, Option("--saturation", "-sat", min=0, max=400,
saturation: Annotated[float, typer.Option("--saturation", "-sat", min=0, max=400,
help="[bold blue](πŸ”΅ Saturate)[/bold blue] Saturation of the image [medium_purple3](0 is grayscale, 100 is full color)[/medium_purple3]")] = \
Field(default=100)

Expand Down

0 comments on commit 4d49965

Please sign in to comment.