vsview-split-planes 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vsview_split_planes/__init__.py +246 -0
- vsview_split_planes/py.typed +0 -0
- vsview_split_planes-0.1.0.dist-info/METADATA +55 -0
- vsview_split_planes-0.1.0.dist-info/RECORD +7 -0
- vsview_split_planes-0.1.0.dist-info/WHEEL +4 -0
- vsview_split_planes-0.1.0.dist-info/entry_points.txt +2 -0
- vsview_split_planes-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
from math import copysign
|
|
2
|
+
from typing import Annotated, Any, Literal, assert_never
|
|
3
|
+
|
|
4
|
+
from jetpytools import fallback
|
|
5
|
+
from pydantic import BaseModel
|
|
6
|
+
from PySide6.QtWidgets import QBoxLayout, QDoubleSpinBox, QHBoxLayout, QLabel, QVBoxLayout, QWidget, QWidgetAction
|
|
7
|
+
from vapoursynth import VideoNode
|
|
8
|
+
from vstools import scale_mask, stack_planes
|
|
9
|
+
|
|
10
|
+
from vsview.api import (
|
|
11
|
+
Checkbox,
|
|
12
|
+
Dropdown,
|
|
13
|
+
LocalSettingsModel,
|
|
14
|
+
PluginAPI,
|
|
15
|
+
PluginGraphicsView,
|
|
16
|
+
PluginSettings,
|
|
17
|
+
SegmentedControl,
|
|
18
|
+
Spin,
|
|
19
|
+
WidgetPluginBase,
|
|
20
|
+
hookimpl,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class GlobalSettings(BaseModel):
|
|
25
|
+
autofit: Annotated[
|
|
26
|
+
bool,
|
|
27
|
+
Checkbox(
|
|
28
|
+
label="Auto fit",
|
|
29
|
+
text="Enable autofit by default",
|
|
30
|
+
tooltip="Enable autofit by default when opening the plugin tab",
|
|
31
|
+
),
|
|
32
|
+
] = False
|
|
33
|
+
|
|
34
|
+
shift_float_chroma: Annotated[
|
|
35
|
+
bool,
|
|
36
|
+
Checkbox(
|
|
37
|
+
label="Shift float chroma",
|
|
38
|
+
text="",
|
|
39
|
+
tooltip="If checked, shift U and V by +0.5 when working in float YUV formats",
|
|
40
|
+
),
|
|
41
|
+
] = True
|
|
42
|
+
offset_chroma: Annotated[
|
|
43
|
+
float | Literal["min", "max"],
|
|
44
|
+
Dropdown(
|
|
45
|
+
label="Offset chroma",
|
|
46
|
+
items=[("Fixed", 0.0), ("Min", "min"), ("Max", "max")],
|
|
47
|
+
tooltip="Apply chroma plane offseting\n"
|
|
48
|
+
'- "min": match luma minimum\n'
|
|
49
|
+
'- "max": match luma maximum\n'
|
|
50
|
+
"- Fixed: use a custom float value",
|
|
51
|
+
),
|
|
52
|
+
] = 0.0
|
|
53
|
+
mode: Annotated[
|
|
54
|
+
Literal["h", "v"],
|
|
55
|
+
Dropdown(
|
|
56
|
+
label="Mode",
|
|
57
|
+
items=[("Horizontal", "h"), ("Vertical", "v")],
|
|
58
|
+
tooltip="Stacking direction",
|
|
59
|
+
),
|
|
60
|
+
] = "h"
|
|
61
|
+
write_plane_name: Annotated[
|
|
62
|
+
bool,
|
|
63
|
+
Checkbox(
|
|
64
|
+
label="Write plane name",
|
|
65
|
+
text="",
|
|
66
|
+
tooltip='If checked, overlays the short plane name ("Y", "U", "V", "R", "G", ...) on each plane.',
|
|
67
|
+
),
|
|
68
|
+
] = True
|
|
69
|
+
alignment: Annotated[
|
|
70
|
+
int,
|
|
71
|
+
Spin(
|
|
72
|
+
label="Alignment",
|
|
73
|
+
min=1,
|
|
74
|
+
max=9,
|
|
75
|
+
tooltip='Text alignment for plane labels (only used if "Write plane name" is checked`).',
|
|
76
|
+
),
|
|
77
|
+
] = 7
|
|
78
|
+
scale: Annotated[
|
|
79
|
+
int,
|
|
80
|
+
Spin(
|
|
81
|
+
label="Scale",
|
|
82
|
+
min=1,
|
|
83
|
+
tooltip='Font scale for plane labels (only used if "Write plane name" is checked`).',
|
|
84
|
+
),
|
|
85
|
+
] = 1
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class LocalSettings(LocalSettingsModel):
|
|
89
|
+
autofit: bool | None = None
|
|
90
|
+
offset_chroma: float | Literal["min", "max"] | None = None
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class SplitPlanesPlugin(WidgetPluginBase[GlobalSettings, LocalSettings]):
|
|
94
|
+
identifier = "jet_vsview_split_planes"
|
|
95
|
+
display_name = "Split Planes"
|
|
96
|
+
|
|
97
|
+
def __init__(self, parent: QWidget, api: PluginAPI) -> None:
|
|
98
|
+
super().__init__(parent, api)
|
|
99
|
+
|
|
100
|
+
self.view = SplitPlanesView(self, self.api, self.settings)
|
|
101
|
+
self.current_layout = QHBoxLayout(self)
|
|
102
|
+
self.current_layout.setContentsMargins(0, 0, 0, 0)
|
|
103
|
+
self.current_layout.setSpacing(0)
|
|
104
|
+
self.current_layout.addWidget(self.view)
|
|
105
|
+
|
|
106
|
+
self.api.globalSettingsChanged.connect(self.on_settings_changed)
|
|
107
|
+
|
|
108
|
+
def on_settings_changed(self) -> None:
|
|
109
|
+
self.view.autofit = fallback(self.settings.local_.autofit, self.settings.global_.autofit)
|
|
110
|
+
self.view.refresh()
|
|
111
|
+
self.view.sync_offset_controls_from_settings()
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class SplitPlanesView(PluginGraphicsView):
|
|
115
|
+
def __init__(
|
|
116
|
+
self, parent: QWidget, api: PluginAPI, settings: PluginSettings[GlobalSettings, LocalSettings]
|
|
117
|
+
) -> None:
|
|
118
|
+
super().__init__(parent, api)
|
|
119
|
+
self.settings = settings
|
|
120
|
+
|
|
121
|
+
self.context_menu.addSeparator()
|
|
122
|
+
|
|
123
|
+
# Container widget for the offset chroma controls
|
|
124
|
+
self._offset_container = QWidget(self.context_menu)
|
|
125
|
+
layout = QVBoxLayout(self._offset_container)
|
|
126
|
+
layout.setContentsMargins(8, 4, 8, 4)
|
|
127
|
+
layout.setSpacing(4)
|
|
128
|
+
|
|
129
|
+
# Label
|
|
130
|
+
label = QLabel("Offset Chroma", self._offset_container)
|
|
131
|
+
layout.addWidget(label)
|
|
132
|
+
|
|
133
|
+
# Segmented control for Min/Max/Fixed
|
|
134
|
+
self.offset_segment = SegmentedControl(
|
|
135
|
+
["Fixed", "Min", "Max"],
|
|
136
|
+
self._offset_container,
|
|
137
|
+
QBoxLayout.Direction.LeftToRight,
|
|
138
|
+
)
|
|
139
|
+
layout.addWidget(self.offset_segment)
|
|
140
|
+
|
|
141
|
+
# Spinbox for "Fixed" mode
|
|
142
|
+
self.fixed_spinbox_container = QWidget(self._offset_container)
|
|
143
|
+
spinbox_layout = QHBoxLayout(self.fixed_spinbox_container)
|
|
144
|
+
spinbox_layout.setContentsMargins(0, 0, 0, 0)
|
|
145
|
+
spinbox_layout.setSpacing(4)
|
|
146
|
+
|
|
147
|
+
self.offset_spinbox = QDoubleSpinBox(self.fixed_spinbox_container)
|
|
148
|
+
self.offset_spinbox.setRange(-1.0, 1.0)
|
|
149
|
+
self.offset_spinbox.setSingleStep(0.1)
|
|
150
|
+
self.offset_spinbox.setDecimals(3)
|
|
151
|
+
self.offset_spinbox.setValue(0.0)
|
|
152
|
+
self.offset_spinbox.setToolTip("Fixed offset value for chroma planes")
|
|
153
|
+
spinbox_layout.addWidget(self.offset_spinbox)
|
|
154
|
+
|
|
155
|
+
layout.addWidget(self.fixed_spinbox_container)
|
|
156
|
+
|
|
157
|
+
# Add container to context menu via QWidgetAction
|
|
158
|
+
action = QWidgetAction(self.context_menu)
|
|
159
|
+
action.setDefaultWidget(self._offset_container)
|
|
160
|
+
self.context_menu.addAction(action)
|
|
161
|
+
|
|
162
|
+
# Connect signals
|
|
163
|
+
self.offset_segment.segmentChanged.connect(self.on_offset_segment_changed)
|
|
164
|
+
self.offset_spinbox.valueChanged.connect(self.on_offset_spinbox_changed)
|
|
165
|
+
|
|
166
|
+
# Set initial state from global settings
|
|
167
|
+
self.sync_offset_controls_from_settings()
|
|
168
|
+
|
|
169
|
+
if self.settings.local_.autofit:
|
|
170
|
+
self.autofit_action.trigger()
|
|
171
|
+
|
|
172
|
+
def parent(self) -> SplitPlanesPlugin:
|
|
173
|
+
if isinstance(parent := super().parent(), SplitPlanesPlugin):
|
|
174
|
+
return parent
|
|
175
|
+
|
|
176
|
+
raise NotImplementedError
|
|
177
|
+
|
|
178
|
+
def get_node(self, clip: VideoNode) -> VideoNode:
|
|
179
|
+
if (offset_chroma := self.settings.local_.offset_chroma) is None:
|
|
180
|
+
offset = False
|
|
181
|
+
elif isinstance(offset_chroma, (float, int)):
|
|
182
|
+
offset = scale_mask(abs(offset_chroma), 32, clip)
|
|
183
|
+
offset = copysign(offset, offset_chroma)
|
|
184
|
+
else:
|
|
185
|
+
offset = offset_chroma
|
|
186
|
+
|
|
187
|
+
return stack_planes(
|
|
188
|
+
clip,
|
|
189
|
+
self.settings.global_.shift_float_chroma,
|
|
190
|
+
offset,
|
|
191
|
+
self.settings.global_.mode,
|
|
192
|
+
self.settings.global_.write_plane_name,
|
|
193
|
+
self.settings.global_.alignment,
|
|
194
|
+
self.settings.global_.scale,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
def sync_offset_controls_from_settings(self) -> None:
|
|
198
|
+
match offset := self.settings.local_.offset_chroma:
|
|
199
|
+
case int() | float() | None:
|
|
200
|
+
self.offset_segment.index = 0
|
|
201
|
+
self.fixed_spinbox_container.setEnabled(True)
|
|
202
|
+
self.offset_spinbox.setValue(float(offset or 0))
|
|
203
|
+
case "min":
|
|
204
|
+
self.offset_segment.index = 1
|
|
205
|
+
self.fixed_spinbox_container.setEnabled(False)
|
|
206
|
+
case "max":
|
|
207
|
+
self.offset_segment.index = 2
|
|
208
|
+
self.fixed_spinbox_container.setEnabled(False)
|
|
209
|
+
case _:
|
|
210
|
+
assert_never(offset)
|
|
211
|
+
|
|
212
|
+
def on_offset_segment_changed(self, index: int) -> None:
|
|
213
|
+
self.fixed_spinbox_container.setEnabled(index == 0)
|
|
214
|
+
parent = self.parent()
|
|
215
|
+
|
|
216
|
+
match index:
|
|
217
|
+
case 0:
|
|
218
|
+
parent.update_local_settings(offset_chroma=self.offset_spinbox.value())
|
|
219
|
+
case 1:
|
|
220
|
+
parent.update_local_settings(offset_chroma="min")
|
|
221
|
+
case 2:
|
|
222
|
+
parent.update_local_settings(offset_chroma="max")
|
|
223
|
+
case _:
|
|
224
|
+
raise NotImplementedError
|
|
225
|
+
|
|
226
|
+
self.refresh()
|
|
227
|
+
|
|
228
|
+
def on_offset_spinbox_changed(self, value: float) -> None:
|
|
229
|
+
if self.offset_segment.index == 0:
|
|
230
|
+
self.parent().update_local_settings(offset_chroma=value)
|
|
231
|
+
self.refresh()
|
|
232
|
+
|
|
233
|
+
def _on_autofit_action(self) -> None:
|
|
234
|
+
super()._on_autofit_action()
|
|
235
|
+
|
|
236
|
+
self.parent().update_local_settings(autofit=self.autofit)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
@hookimpl
|
|
240
|
+
def vsview_register_toolpanel() -> type[WidgetPluginBase[Any, Any]]:
|
|
241
|
+
return SplitPlanesPlugin
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
@hookimpl
|
|
245
|
+
def vsview_register_tooldock() -> type[WidgetPluginBase[Any, Any]]:
|
|
246
|
+
return SplitPlanesPlugin
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vsview-split-planes
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A vsview plugin displaying video clips' constituent planes
|
|
5
|
+
Project-URL: Source Code, https://github.com/Jaded-Encoding-Thaumaturgy/vs-view/tree/main/src/plugins/split-planes
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/Jaded-Encoding-Thaumaturgy/vs-view/issues
|
|
7
|
+
Project-URL: Contact, https://discord.gg/XTpc6Fa9eB
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2025 Jaded Encoding Thaumaturgy
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Operating System :: OS Independent
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
36
|
+
Classifier: Typing :: Typed
|
|
37
|
+
Requires-Python: >=3.12
|
|
38
|
+
Requires-Dist: vsjetpack>=1.1.0
|
|
39
|
+
Requires-Dist: vsview
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# vsview-split-planes
|
|
43
|
+
|
|
44
|
+
A [vsview](https://github.com/Jaded-Encoding-Thaumaturgy/vs-view) plugin displaying video clips' constituent planes.
|
|
45
|
+
|
|
46
|
+
## Requirements
|
|
47
|
+
|
|
48
|
+
- [vsview](https://github.com/Jaded-Encoding-Thaumaturgy/vs-view)
|
|
49
|
+
- [vsjetpack](https://github.com/Jaded-Encoding-Thaumaturgy/vs-jetpack) 1.1.0 or later
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install vsview-split-planes
|
|
55
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
vsview_split_planes/__init__.py,sha256=8EU0mEwdFufA3FKX3j5So3a7U88hMS9ho1d3gjoBdGg,8202
|
|
2
|
+
vsview_split_planes/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
vsview_split_planes-0.1.0.dist-info/METADATA,sha256=EbgqUBxuAN990kyfUEfiVFnj-8-rRrFk96VqSIHCU_o,2478
|
|
4
|
+
vsview_split_planes-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
5
|
+
vsview_split_planes-0.1.0.dist-info/entry_points.txt,sha256=qWlj3bW9TnWhr1uXc_161QzkV6mpzgOhE-n3O9PGr7c,51
|
|
6
|
+
vsview_split_planes-0.1.0.dist-info/licenses/LICENSE,sha256=3iggbENgIBiFtkoc9zm-_9LdESmmm7xiNFeAwO__Z2M,1083
|
|
7
|
+
vsview_split_planes-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jaded Encoding Thaumaturgy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|