Browse code

Only `append` for non-zero `angle`s

Robert Cranston authored on 28/12/2024 22:58:43
Showing 1 changed files

... ...
@@ -50,16 +50,19 @@ end
50 50
 
51 51
 local function append(angle)
52 52
     state.angle = angle % 360
53
-    local shader = os.tmpname()
54
-    mp.msg.debug("Writing", shader)
55
-    local file = io.open(shader, "w")
56
-    file:write(table.concat({
57
-        SHADER_META,
58
-        shader_define(),
59
-        SHADER_HOOK,
60
-    }, "\n"))
61
-    file:close()
62
-    mp.commandv("change-list", "glsl-shaders", "append", shader)
53
+    local shader = nil
54
+    if state.angle ~= 0 then
55
+        shader = os.tmpname()
56
+        mp.msg.debug("Writing", shader)
57
+        local file = io.open(shader, "w")
58
+        file:write(table.concat({
59
+            SHADER_META,
60
+            shader_define(),
61
+            SHADER_HOOK,
62
+        }, "\n"))
63
+        file:close()
64
+        mp.commandv("change-list", "glsl-shaders", "append", shader)
65
+    end
63 66
     remove()
64 67
     state.shader = shader
65 68
 end