Skip to content

Commit abb9619

Browse files
committed
More API extensions for viewport and colour management access
1 parent c8721a9 commit abb9619

File tree

22 files changed

+300
-22765
lines changed

22 files changed

+300
-22765
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ project(${XSTUDIO_GLOBAL_NAME} VERSION ${XSTUDIO_GLOBAL_VERSION} LANGUAGES CXX)
1111
option(BUILD_TESTING "Build tests" OFF)
1212
option(INSTALL_PYTHON_MODULE "Install python module" ON)
1313
option(INSTALL_XSTUDIO "Install xstudio" ON)
14-
option(BUILD_DOCS "Build xStudio documentation" ON)
14+
option(BUILD_DOCS "Build xStudio documentation" OFF)
1515
option(ENABLE_CLANG_TIDY "Enable clang-tidy, ninja clang-tidy." OFF)
1616
option(ENABLE_CLANG_FORMAT "Enable clang format, ninja clangformat." OFF)
1717
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE)

docs/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# ones.
3232
extensions = [
3333
'breathe',
34+
'myst_parser',
3435
'sphinx.ext.autodoc',
3536
'sphinx.ext.intersphinx',
3637
# 'sphinx.ext.autosectionlabel',
@@ -75,9 +76,9 @@
7576
# built documents.
7677
#
7778
# The short X.Y version.
78-
version = '1.0.0'
79+
version = '0.0.0'
7980
# The full version, including alpha/beta/rc tags.
80-
release = '1.0.0'
81+
release = '0.0.0'
8182

8283
# The language for content autogenerated by Sphinx. Refer to documentation
8384
# for a list of supported languages.

docs/conf.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import shlex
3131
# ones.
3232
extensions = [
3333
'breathe',
34+
'myst_parser',
3435
'sphinx.ext.autodoc',
3536
'sphinx.ext.intersphinx',
3637
# 'sphinx.ext.autosectionlabel',

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Table of Contents
1818
self
1919
user_docs/index
2020
api/index
21+
build_guides/index
2122

2223
Indices and tables
2324
==================

python/src/xstudio/api/app.py

Lines changed: 36 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,81 +4,12 @@
44
from xstudio.core import viewport_playhead_atom, quickview_media_atom
55
from xstudio.core import UuidActorVec, UuidActor, viewport_atom
66
from xstudio.core import get_global_playhead_events_atom, set_clipboard_atom
7+
from xstudio.core import active_viewport_atom, name_atom
78
from xstudio.api.session import Session, Container
89
from xstudio.api.session.playhead import Playhead
910
from xstudio.api.module import ModuleBase
1011
from xstudio.api.auxiliary import ActorConnection
11-
12-
class Viewport(ModuleBase):
13-
"""Viewport object, represents a viewport in the UI or offscreen."""
14-
15-
def __init__(self, connection, viewport_name):
16-
"""Create Viewport object.
17-
18-
Args:
19-
connection(Connection): Connection object
20-
viewport_name(str): Name of viewport
21-
22-
Kwargs:
23-
uuid(Uuid): Uuid of remote actor.
24-
"""
25-
gphev = connection.request_receive(
26-
connection.remote(),
27-
get_global_playhead_events_atom())[0]
28-
29-
remote = connection.request_receive(
30-
gphev,
31-
viewport_atom(),
32-
viewport_name
33-
)[0]
34-
35-
ModuleBase.__init__(
36-
self,
37-
connection,
38-
remote
39-
)
40-
41-
@property
42-
def playhead(self):
43-
"""Access the Playhead object supplying images to the viewport
44-
"""
45-
return Playhead(self.connection, self.connection.request_receive(self.remote, viewport_playhead_atom())[0])
46-
47-
@playhead.setter
48-
def set_playhead(self, playhead):
49-
"""Set the playhead that is delivering frames to the viewport, i.e.
50-
the active playhead.
51-
52-
Args:
53-
playhead(Playhead): The playhead."""
54-
55-
self.connection.request_receive(self.remote, viewport_playhead_atom(), playhead.remote)
56-
57-
def quickview(self, media_items, compare_mode="Off", position=(100,100), size=(1280,720)):
58-
"""Connect this playhead to the viewport.
59-
60-
Args:
61-
media_items(list(Media)): A list of Media objects to be shown in quickview
62-
windows
63-
compare_mode(str): Remote actor object
64-
position(tuple(int,int)): X/Y Position of new window (default=(100,100))
65-
size(tuple(int,int)): X/Y Size of new window (default=(1280,720))
66-
67-
"""
68-
69-
media_actors = UuidActorVec()
70-
for m in media_items:
71-
media_actors.push_back(UuidActor(m.uuid, m.remote))
72-
73-
self.connection.request_receive(
74-
self.remote,
75-
quickview_media_atom(),
76-
media_actors,
77-
compare_mode,
78-
position[0],
79-
position[1],
80-
size[0],
81-
size[1])
12+
from xstudio.api.intrinsic import Viewport
8213

8314
class App(Container):
8415
"""App access. """
@@ -118,6 +49,40 @@ def viewport(self, name):
11849
viewport(ModuleBase): Viewport module."""
11950
return Viewport(self.connection, name)
12051

52+
def viewport_names(self):
53+
"""Get a list of the names of viewport instances that exist in the
54+
application. The viewport name can be used to access the viewport
55+
via the 'viewport' method on this App object.
56+
57+
Returns:
58+
list(str): A list of viewport names"""
59+
gphev = self.connection.request_receive(
60+
self.connection.remote(),
61+
get_global_playhead_events_atom())[0]
62+
63+
viewports = self.connection.request_receive(
64+
gphev,
65+
viewport_atom()
66+
)[0]
67+
68+
result = []
69+
for vp in viewports:
70+
result.append(
71+
self.connection.request_receive(
72+
vp,
73+
name_atom()
74+
)[0]
75+
)
76+
return result
77+
78+
@property
79+
def active_viewport(self):
80+
"""Access the current (active & visible) viewport in the xSTUDIO UI.
81+
82+
Returns:
83+
viewport(Viewport): Viewport module."""
84+
return Viewport(self.connection, active_viewport=True)
85+
12186
def set_viewport_playhead(self, viewport_name, playhead):
12287
"""Set's the named viewport to be driven by the given playhead
12388
Args:

python/src/xstudio/api/intrinsic/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
from xstudio.api.intrinsic.plugin_manager import PluginManager
66
from xstudio.api.intrinsic.history import History
77
from xstudio.api.intrinsic.scanner import Scanner
8+
from xstudio.api.intrinsic.viewport import Viewport
9+
from xstudio.api.intrinsic.colour_pipeline import ColourPipeline
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
from xstudio.api.module import ModuleBase
3+
4+
class ColourPipeline(ModuleBase):
5+
"""ColourPipeline object, represents the colour pipeline plugin
6+
instance that interacts with the viewport to provide colour management
7+
data for image display in the viewport."""
8+
9+
def __init__(self, connection, remote):
10+
"""Create Viewport object.
11+
12+
Args:
13+
connection(Connection): Connection object
14+
remote(Actor): The colour pipeline actor
15+
"""
16+
ModuleBase.__init__(
17+
self,
18+
connection,
19+
remote
20+
)
21+
22+
@property
23+
def view(self):
24+
"""Access the ModuleAttribute object that controls the OCIO View
25+
"""
26+
return self.get_attribute("View")
27+
28+
@property
29+
def display(self):
30+
"""Access the ModuleAttribute object that controls the OCIO Display
31+
"""
32+
return self.get_attribute("Display")
33+
34+
@property
35+
def exposure(self):
36+
"""Access the ModuleAttribute object that controls the viewer Exposure
37+
"""
38+
return self.get_attribute("Exposure (E)")
39+
40+
@property
41+
def gamma(self):
42+
"""Access the ModuleAttribute object that controls the viewer Gamma
43+
"""
44+
return self.get_attribute("Gamma")
45+
46+
@property
47+
def saturation(self):
48+
"""Access the ModuleAttribute object that controls the viewer Saturation
49+
"""
50+
return self.get_attribute("Saturation")
51+
52+
@property
53+
def channel(self):
54+
"""Access the ModuleAttribute object that controls the viewer Channel
55+
"""
56+
return self.get_attribute("Channel")
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
from xstudio.core import colour_pipeline_atom
3+
from xstudio.core import viewport_playhead_atom, quickview_media_atom
4+
from xstudio.core import UuidActorVec, UuidActor, viewport_atom
5+
from xstudio.core import get_global_playhead_events_atom, active_viewport_atom
6+
from xstudio.api.session.playhead import Playhead
7+
from xstudio.api.module import ModuleBase
8+
from xstudio.api.intrinsic.colour_pipeline import ColourPipeline
9+
10+
class Viewport(ModuleBase):
11+
"""Viewport object, represents a viewport in the UI or offscreen."""
12+
13+
def __init__(self, connection, viewport_name = "", active_viewport = False):
14+
"""Create Viewport object.
15+
16+
Args:
17+
connection(Connection): Connection object
18+
viewport_name(str): Name of viewport
19+
20+
Kwargs:
21+
uuid(Uuid): Uuid of remote actor.
22+
"""
23+
gphev = connection.request_receive(
24+
connection.remote(),
25+
get_global_playhead_events_atom())[0]
26+
27+
if active_viewport:
28+
remote = connection.request_receive(
29+
gphev,
30+
active_viewport_atom()
31+
)[0]
32+
if not remote:
33+
raise Exception("No visible viewports")
34+
else:
35+
remote = connection.request_receive(
36+
gphev,
37+
viewport_atom(),
38+
viewport_name
39+
)[0]
40+
41+
ModuleBase.__init__(
42+
self,
43+
connection,
44+
remote
45+
)
46+
47+
@property
48+
def playhead(self):
49+
"""Access the Playhead object supplying images to the viewport
50+
"""
51+
return Playhead(self.connection, self.connection.request_receive(self.remote, viewport_playhead_atom())[0])
52+
53+
@playhead.setter
54+
def set_playhead(self, playhead):
55+
"""Set the playhead that is delivering frames to the viewport, i.e.
56+
the active playhead.
57+
58+
Args:
59+
playhead(Playhead): The playhead."""
60+
61+
self.connection.request_receive(self.remote, viewport_playhead_atom(), playhead.remote)
62+
63+
@property
64+
def colour_pipeline(self):
65+
"""Access the ColourPipeline object that provides colour management
66+
data to the viewport
67+
"""
68+
return ColourPipeline(self.connection, self.connection.request_receive(self.remote, colour_pipeline_atom())[0])
69+
70+
def quickview(self, media_items, compare_mode="Off", position=(100,100), size=(1280,720)):
71+
"""Connect this playhead to the viewport.
72+
73+
Args:
74+
media_items(list(Media)): A list of Media objects to be shown in quickview
75+
windows
76+
compare_mode(str): Remote actor object
77+
position(tuple(int,int)): X/Y Position of new window (default=(100,100))
78+
size(tuple(int,int)): X/Y Size of new window (default=(1280,720))
79+
80+
"""
81+
82+
media_actors = UuidActorVec()
83+
for m in media_items:
84+
media_actors.push_back(UuidActor(m.uuid, m.remote))
85+
86+
self.connection.request_receive(
87+
self.remote,
88+
quickview_media_atom(),
89+
media_actors,
90+
compare_mode,
91+
position[0],
92+
position[1],
93+
size[0],
94+
size[1])

share/preference/ui_qml.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@
126126
"context": ["QML_UI"],
127127
"category": "Playback"
128128
},
129+
"stop_playing_when_not_visible": {
130+
"path": "/ui/qml/stop_playing_when_not_visible",
131+
"default_value": true,
132+
"description": "When xSTUDIO goes offscreen (either minimised or desktop changes) playback will automatically stop if this option is selected.",
133+
"value": true,
134+
"datatype": "bool",
135+
"context": ["QML_UI"],
136+
"category": "Playback",
137+
"display_name": "Stop Playback when xSTUDIO is Hidden"
138+
},
129139
"view_top_toolbar": {
130140
"path": "/ui/qml/view_top_toolbar",
131141
"default_value": true,

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ if (BUILD_MINIMAL_DEMO)
7272
endif ()
7373

7474
if (BUILD_PYSIDE_WIDGETS)
75+
76+
cmake_policy(SET CMP0148 OLD) # shiboken uses deprecated FindPythonInterp
7577
find_package(Shiboken6 QUIET)
7678
find_package(PySide6 QUIET)
7779

0 commit comments

Comments
 (0)