aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2025-03-23 21:39:32 +0000
committers-ol <s+removethis@s-ol.nu>2025-03-23 21:39:40 +0000
commit487398ab6f3047af4720ea0153fec69bb6f36bd2 (patch)
treeb0f284b987e67f176302a9250f7fd31250de1b48
parentbuiltins: add normalized switch-1 (diff)
downloadalive-487398ab6f3047af4720ea0153fec69bb6f36bd2.tar.gz
alive-487398ab6f3047af4720ea0153fec69bb6f36bd2.zip
glsl-view: resolve relative paths for video
-rw-r--r--alv-lib/glsl-view.moon10
-rw-r--r--alv/copilot/base.moon2
2 files changed, 8 insertions, 4 deletions
diff --git a/alv-lib/glsl-view.moon b/alv-lib/glsl-view.moon
index 4c27be0..c2d57ee 100644
--- a/alv-lib/glsl-view.moon
+++ b/alv-lib/glsl-view.moon
@@ -58,11 +58,13 @@ video = Constant.meta
setup: (inputs, scope) =>
{ socket, name, filename, type } = pattern\match inputs
+ @prefix = COPILOT.active_module.file\match'(.*/)[^/]*$'
+
super
socket: Input.hot socket or scope\get '*oscout*'
- name: Input.hot name
- filename: Input.hot filename
- type: Input.hot type or Constant.str "2D"
+ name: Input.cold name
+ filename: Input.cold filename
+ type: Input.cold type or Constant.str "2D"
samplertype = assert GLSL_SAMPLER_TYPES[@inputs.type!]
@setup_out '=', (Struct type: T.str, val: T.str), type: samplertype, val: @inputs.name!
@@ -71,6 +73,8 @@ video = Constant.meta
{ :socket, :name, :type, :filename } = @unwrap_all!
with @inputs.socket!
+ if @prefix and not (filename\match '^/') or (filename\match '^%w:\\')
+ filename = @prefix .. filename
\send Message.pack { address: "/texture/#{name}/video", types: "ss", "TEXTURE_#{type}", filename }
-- destroy: =>
diff --git a/alv/copilot/base.moon b/alv/copilot/base.moon
index b7823e6..cb82689 100644
--- a/alv/copilot/base.moon
+++ b/alv/copilot/base.moon
@@ -84,7 +84,7 @@ class Copilot
mod.root\make_ref!
else
last = @active_module
- prefix = if b = last.file\match'(.*)/[^/]*$' then b .. '/' else ''
+ prefix = if b = last.file\match'(.*/)[^/]*$' then b else ''
mod = @last_modules[name] or FSModule "#{prefix}#{name}.alv"
L\trace "entering module #{mod}"
@modules[name] = mod