-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsview.lua
53 lines (45 loc) · 1.23 KB
/
sview.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- A simple script to show multiple shaders running, in a clean list. Also hides osd messages of shader changes.
-- 显示着色器列表,隐藏着色器更改的osd消息
-- 修复新版本mpv异常,去除清除着色器的函数
sview_ov = mp.create_osd_overlay("ass-events")
shader_t = false
function slist(input)
local fileNames = {}
local paths = {}
if input ~= '' then
for path in input:gmatch("[^;]+") do
table.insert(paths, path)
end
for _, path in ipairs(paths) do
local fileName = path:match(".+/(.+)$") or path:match(".+\\(.+)$")
if fileName then
table.insert(fileNames, fileName)
end
end
local listString = "{\\b1}Shaders loaded:{\\b0}"
for i, fileName in ipairs(fileNames) do
listString = listString .. "\n" .. i .. ") " .. fileName
end
sview_ov.data = listString
else
sview_ov.data = "{\\b1}No shaders loaded.{\\b0}"
end
sview_ov:update()
end
function toggle_sview()
if shader_t then
shader_t = false
sview_ov:remove()
else
shader_t = true
update_list()
end
end
function update_list()
mp.osd_message('')
if shader_t then
slist(mp.get_property('glsl-shaders'))
end
end
mp.add_key_binding(nil, 'shader-view', toggle_sview)
mp.observe_property('glsl-shaders', nil, update_list)