Skip to content

Commit

Permalink
Switch to ngl.{scene,SceneCfg}
Browse files Browse the repository at this point in the history
  • Loading branch information
ubitux committed Oct 2, 2023
1 parent 6cc4ced commit 03ef5bb
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions demos.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from textwrap import dedent

import pynopegl as ngl
from pynopegl_utils.misc import MediaInfo, SceneCfg, scene
from pynopegl_utils.misc import MediaInfo
from pynopegl_utils.toolbox.colors import COLORS
from pynopegl_utils.toolbox.grid import autogrid_simple

Expand All @@ -21,8 +21,8 @@
_FONT_UBUNTU = (_ASSETS_DIR / "Ubuntu-Light.ttf").as_posix()


@scene(compat_specs="~=0.9")
def audiotex(cfg: SceneCfg):
@ngl.scene(compat_specs="~=0.9")
def audiotex(cfg: ngl.SceneCfg):
media = MediaInfo.from_filename(_VID_ROYAUME)
cfg.duration = media.duration
cfg.aspect_ratio = (media.width, media.height)
Expand Down Expand Up @@ -104,8 +104,8 @@ def audiotex(cfg: SceneCfg):
return render


@scene(compat_specs="~=0.9")
def compositing(cfg: SceneCfg):
@ngl.scene(compat_specs="~=0.9")
def compositing(cfg: ngl.SceneCfg):
cfg.aspect_ratio = (1, 1)
cfg.duration = 6

Expand Down Expand Up @@ -194,8 +194,8 @@ def compositing(cfg: SceneCfg):
return autogrid_simple(scenes)


@scene(compat_specs="~=0.9", controls=dict(dim=scene.Range(range=[1, 50])))
def cropboard(cfg: SceneCfg, dim=32):
@ngl.scene(compat_specs="~=0.9", controls=dict(dim=ngl.scene.Range(range=[1, 50])))
def cropboard(cfg: ngl.SceneCfg, dim=32):
m0 = MediaInfo.from_filename(_VID_BBB)
cfg.duration = 10
cfg.aspect_ratio = (m0.width, m0.height)
Expand Down Expand Up @@ -267,8 +267,8 @@ def cropboard(cfg: SceneCfg, dim=32):
return render


@scene(compat_specs="~=0.9", controls=dict(n=scene.Range(range=[2, 10])))
def fibo(cfg: SceneCfg, n=8):
@ngl.scene(compat_specs="~=0.9", controls=dict(n=ngl.scene.Range(range=[2, 10])))
def fibo(cfg: ngl.SceneCfg, n=8):
cfg.duration = 5.0
cfg.aspect_ratio = (1, 1)

Expand Down Expand Up @@ -309,7 +309,7 @@ def fibo(cfg: SceneCfg, n=8):
return root


@scene(compat_specs="~=0.9")
@ngl.scene(compat_specs="~=0.9")
def japanese_haiku(cfg):
m0 = MediaInfo.from_filename(_IMG_TORII)
cfg.duration = 9.0
Expand Down Expand Up @@ -373,7 +373,7 @@ def japanese_haiku(cfg):
return ngl.Group(children=(bg, bg_filter, text))


@scene(compat_specs="~=0.9", controls=dict(bg_file=scene.File()))
@ngl.scene(compat_specs="~=0.9", controls=dict(bg_file=ngl.scene.File()))
def prototype(cfg, bg_file=_IMG_CITY):
m0 = MediaInfo.from_filename(bg_file)
cfg.aspect_ratio = (m0.width, m0.height)
Expand Down Expand Up @@ -447,7 +447,7 @@ def prototype(cfg, bg_file=_IMG_CITY):
return ngl.Group(children=(bg, text))


@scene(compat_specs="~=0.9", controls=dict(source=scene.File()))
@ngl.scene(compat_specs="~=0.9", controls=dict(source=ngl.scene.File()))
def scopes(cfg, source=_VID_PIPER):
# FIXME this check is not sufficient when cross-building a scene
if platform.system() == "Darwin" and cfg.backend == "opengl":
Expand Down

0 comments on commit 03ef5bb

Please sign in to comment.