wip: iconbuttons + better navigation

This commit is contained in:
Leon van Kammen 2026-10-05 12:46:45 +02:00
parent 5ad22ade88
commit 6fabe4aab7
23 changed files with 240 additions and 70 deletions

View file

@ -89,11 +89,11 @@ app.plugin.clouddrive = app.addPlugin('plugin/clouddrive')
app.plugin.markdown = app.addPlugin('plugin/markdown')
app.plugin.rssatom = app.addPlugin('plugin/rssatom')
app.plugin.federation = app.addPlugin('plugin/federation')
app.plugin.manyfold = app.addPlugin('plugin/manyfold')
app.plugin.peertube = app.addPlugin('plugin/peertube')
app.plugin.git = app.addPlugin('plugin/git')
app.plugin.webhook = app.addPlugin('plugin/webhook')
app.plugin.archive = app.addPlugin('plugin/archive')
app.plugin.manyfold = app.addPlugin('plugin/manyfold')
app.plugin.openbrush = app.addPlugin('plugin/openbrush')
app.plugin.scheduler = app.addPlugin('plugin/scheduler') -- should always be second last
app.plugin.staticwebgen = app.addPlugin('plugin/staticwebgen') -- should always be last
@ -108,6 +108,7 @@ print = function(...) Log(kLogInfo, ... or "''") end -- nice redbean lo
app.url['^/data'] = '/data.lua' -- setup custom file endpoint
app.use( app.plugin.global.middleware.homepage_2D_or_3D )
app.use( app.plugin.global.middleware.force_listing )
app.get('^/design[/]?$', util.pagerender('page/design.html'))
app.get('^/about[/]?$', util.pagerender('page/about.html'))

View file

@ -25,6 +25,7 @@ body.script .script{ visibility: visible !important; }
.margin1L{ margin: 0px 20px 10px 0px;}
.margin1{ margin: 10px 20px; }
.padding1{ padding: 10px 20px 10px 20px; }
.nopadding{ padding:0px;}
.content{
font-family: sans-serif;
@ -102,6 +103,20 @@ input[type=submit] {
background:#112;
}
.iconbtn{
float: right;
border: 1px solid #8880 !important;
border-spacing: 10px 10px 10px 10px;
padding: 0px 5px;
border-radius: 4px;
background: #2230;
transition: border 0.4s;
}
.iconbtn:hover{
border: 1px solid #888 !important;
background: #223;
}
.btn a:hover,
input[type=submit] {
color:#F7F;
@ -253,7 +268,7 @@ ul{
.grid .tile{ border-radius:5px; }
.grid .tile .text{ padding:3px 0px; }
.grid .tile .img{
border-radius:20px;
border-radius:13px;
visibility: hidden;
}

View file

@ -62,7 +62,7 @@ body{
}
.grid .tile .text{
padding: 10px 20px 10px 15px !important;
padding: 10px !important;
font-size:14px;
}
@ -83,9 +83,13 @@ img.icon.list-tree{
filter: invert(1);
}
img.icon.download,
img.icon.play,{
img.icon.play{
transform: translate(0,-1px);
}
img.icon.folder,
img.icon.file-document{
transform: translate(0,-2px);
}
img.icon.share{
opacity:0.66;

17
src/img/file-document.svg Normal file
View file

@ -0,0 +1,17 @@
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M7 18H17V16H7V18Z" fill="currentColor" />
<path d="M17 14H7V12H17V14Z" fill="currentColor" />
<path d="M7 10H11V8H7V10Z" fill="currentColor" />
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M6 2C4.34315 2 3 3.34315 3 5V19C3 20.6569 4.34315 22 6 22H18C19.6569 22 21 20.6569 21 19V9C21 5.13401 17.866 2 14 2H6ZM6 4H13V9H19V19C19 19.5523 18.5523 20 18 20H6C5.44772 20 5 19.5523 5 19V5C5 4.44772 5.44772 4 6 4ZM15 4.10002C16.6113 4.4271 17.9413 5.52906 18.584 7H15V4.10002Z"
fill="currentColor"
/>
</svg>

After

Width:  |  Height:  |  Size: 645 B

View file

@ -9,6 +9,6 @@
fill-rule="evenodd"
clip-rule="evenodd"
d="M4 1.5C2.89543 1.5 2 2.39543 2 3.5V4.5C2 4.55666 2.00236 4.61278 2.00698 4.66825C0.838141 5.07811 0 6.19118 0 7.5V19.5C0 21.1569 1.34315 22.5 3 22.5H21C22.6569 22.5 24 21.1569 24 19.5V7.5C24 5.84315 22.6569 4.5 21 4.5H11.874C11.4299 2.77477 9.86384 1.5 8 1.5H4ZM9.73244 4.5C9.38663 3.9022 8.74028 3.5 8 3.5H4V4.5H9.73244ZM3 6.5C2.44772 6.5 2 6.94772 2 7.5V19.5C2 20.0523 2.44772 20.5 3 20.5H21C21.5523 20.5 22 20.0523 22 19.5V7.5C22 6.94772 21.5523 6.5 21 6.5H3Z"
fill="#557"
fill="currentColor"
/>
</svg>
</svg>

Before

Width:  |  Height:  |  Size: 662 B

After

Width:  |  Height:  |  Size: 669 B

3
src/img/info.svg Normal file
View file

@ -0,0 +1,3 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="8 10 20.396395760613586 20" width="37.396395760613586" height="40"><!-- svg-source:excalidraw --><metadata></metadata><defs></defs><g stroke-linecap="round" transform="translate(10 11.351351351351354) rotate(0 8.698197880306793 8.783783783783804)"><path d="M4.35 0 C6.69 0, 9.02 0, 13.05 0 M4.35 0 C7.1 0, 9.86 0, 13.05 0 M13.05 0 C15.95 0, 17.4 1.45, 17.4 4.35 M13.05 0 C15.95 0, 17.4 1.45, 17.4 4.35 M17.4 4.35 C17.4 6.35, 17.4 8.35, 17.4 13.22 M17.4 4.35 C17.4 7.54, 17.4 10.73, 17.4 13.22 M17.4 13.22 C17.4 16.12, 15.95 17.57, 13.05 17.57 M17.4 13.22 C17.4 16.12, 15.95 17.57, 13.05 17.57 M13.05 17.57 C9.81 17.57, 6.58 17.57, 4.35 17.57 M13.05 17.57 C10.88 17.57, 8.71 17.57, 4.35 17.57 M4.35 17.57 C1.45 17.57, 0 16.12, 0 13.22 M4.35 17.57 C1.45 17.57, 0 16.12, 0 13.22 M0 13.22 C0 11.05, 0 8.88, 0 4.35 M0 13.22 C0 10.68, 0 8.15, 0 4.35 M0 4.35 C0 1.45, 1.45 0, 4.35 0 M0 4.35 C0 1.45, 1.45 0, 4.35 0" stroke="#1e1e1e" stroke-width="2" fill="none"></path></g><g transform="translate(16.756756756756772 10) rotate(0 1.899999976158142 10)"><text x="0" y="16.264000000000001" font-family="Nunito, sans-serif, Segoe UI Emoji" font-size="14px" fill="#1e1e1e" text-anchor="start" style="font-weight:bold;white-space: pre;" direction="ltr" dominant-baseline="alphabetic">i</text></g></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

43
src/img/playcover.svg Normal file
View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="-25 -20 100 100" style="enable-background:new 0 0 58.752 58.752;" xml:space="preserve">
<g>
<path stroke="#CCC5" stroke-opacity="0.5" fill="#CCC5" d="M52.524,23.925L12.507,0.824c-1.907-1.1-4.376-1.097-6.276,0C4.293,1.94,3.088,4.025,3.088,6.264v46.205
c0,2.24,1.204,4.325,3.131,5.435c0.953,0.555,2.042,0.848,3.149,0.848c1.104,0,2.192-0.292,3.141-0.843l40.017-23.103
c1.936-1.119,3.138-3.203,3.138-5.439C55.663,27.134,54.462,25.05,52.524,23.925z M49.524,29.612L9.504,52.716
c-0.082,0.047-0.18,0.052-0.279-0.005c-0.084-0.049-0.137-0.142-0.137-0.242V6.263c0-0.1,0.052-0.192,0.14-0.243
c0.042-0.025,0.09-0.038,0.139-0.038c0.051,0,0.099,0.013,0.142,0.038l40.01,23.098c0.089,0.052,0.145,0.147,0.145,0.249
C49.663,29.47,49.611,29.561,49.524,29.612z"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View file

@ -0,0 +1,5 @@
# ARwindow
This is an AR-experience which demonstrates a 'hidden' plane (with cutout),<br>
which creates the illusion of a VR-in-AR.<br>
A great usecase is displaying VR (glTF) animations with variable immersion.

View file

@ -95,7 +95,7 @@ div#xrecosystem{
<h3>What is it</h3>
An open, seamless XR web built from simple URLs and directories, without gatekeepers.<br>
XRForge transforms standard local or remote file directories into interconnected 3D spaces. Users can seamlessly "surf" spatial webs (plural!), turning everyday directories into 3D portals.<br>
XRForge transforms standard local or remote file directories into interconnected 3D spaces. Users can seamlessly "surf" spatial webs (plural!), turning everyday directories and URLs into 3D portals.<br>
<!--
Supported fileformats:
@ -117,9 +117,8 @@ div#xrecosystem{
<div>
In short: scalable <b>spatial blog/wiki's</b> (using plain web URLs) interconnected via <b>3D portals</b>; bringing <b>existing 2D ecosystems into XR.</b><br>
How? Well it's backed by <a href="https://coderofsalvation.github.io/janus-guide/" target="_blank">JanusXR-</a> and <a href="https://xrfragment.org" target="_blank">XR Fragment- URLs</a>.<br>
The metaverse has shown: people <b>like 3D</b> but certain <b>existing</b> 2D ecosystems are king.<br>
They're just more cost-efficient to use.<br>
Hence, XRForge promotes <b>projecting these ecosystems</b> as virtual <b>hyperlinked</b> worlds, via <a href="https://coderofsalvation.github.io/janus-guide/" target="_blank">JanusXR</a> translators, tapping into various
The metaverse hype has shown: people <b>like 3D</b> but certain <b>existing</b> 2D ecosystems are king.<br>
XRForge makes things more cost-efficient by <b>projecting existing 2D ecosystems</b> as virtual <b>hyperlinked</b> worlds, via <a href="https://coderofsalvation.github.io/janus-guide/" target="_blank">JanusXR</a> translators, tapping into various
<u tabindex="0">datastores
<span>
<br>
@ -225,9 +224,9 @@ div#xrecosystem{
<div>
<h3 id="autocompose">Auto-compose virtual worlds</h3>
Instead of manually composing virtual worlds from multiple assets, XRForge's philosophy is <b>auto-layout</b> and <b>interoperability</b>.<br>
This means that existing RSS/Atom-feeds (from blogs) and partial content from websites can be projected into virtual worlds, <b>via URLs</b>.<br/>
But also assets produced elsewhere, in <a href="https://openblocks.app" target="_blank">OpenBlocks</a> or <a href="https://openbrush.app" target="_blank">OpenBrush</a> are synchronized (via online 3D stores like <a href="https://icosa.gallery" target="_blank">icosa.gallery-</a> and <a href="https://manyfold.app" target="_blank">manyfold.app</a>).<br>
Instead of manually composing virtual worlds from multiple assets, XRForge's allows mixing 3D content via <b>auto-layout</b>, <b>symbolic/online links</b>, and <b>interoperability</b>.<br>
This means that existing RSS/Atom-feeds (from blogs), partial content from websites, and 3D scenes can be projected as virtual worlds.<br/>
But also assets produced elsewhere, 3D scenes in <a href="https://openblocks.app" target="_blank">OpenBlocks</a> or <a href="https://openbrush.app" target="_blank">OpenBrush</a> are synchronized (via online 3D stores like <a href="https://icosa.gallery" target="_blank">icosa.gallery-</a> and <a href="https://manyfold.app" target="_blank">manyfold.app</a>).<br>
This allows for infinitely scalable virtual worlds, yet completely downloadable and portable.<br>
XRForge features <b>layout-engines</b> which allows <b>crowdsourcing virtual worlds</b> via assets using various apps/platforms:<br>
<br>

View file

@ -11,7 +11,7 @@ ${header}
]])
if opts.plugin_rssatom_mastodonshare == 'enabled' then
print([[
<a class="script" onclick="alert('To start receiving the (RSS) feed (of this page),\nwe will guide you to create an activation-post'); document.location.href = 'https://' + prompt('Your mastodon instance:', 'mastodon.social') + '/share?text=follow+this+XRForge+instance+]] .. util.getURL('/') .. [[index.rss+via+@birb@rss-parrot.net'"><img src="img/mastodon.svg" class="icon mastodon"/></a>
<a class="script" onclick="alert('To start receiving the (RSS) feed (of this page) in mastodon,\nwe will guide you to create an activation-post'); let instance = prompt('Your mastodon instance:', 'mastodon.social'); if( instance ){ document.location.href = 'https://' + instance + '/share?text=follow+this+XRForge+instance+]] .. util.getURL('/') .. [[index.rss+via+@birb@rss-parrot.net' } "><img src="img/mastodon.svg" class="icon mastodon"/></a>
]])
end
print([[
@ -34,6 +34,14 @@ end}
]])
end
print('</h2>')
if parent.info then
print(parent.info .. [[
<br/>
<h2><span class="col1">//</span> assets</h2>
<br/>
]])
end
end}
<div class="grid">
@ -53,30 +61,48 @@ end}
local item = items[i]
local visible = item.view2D == nil or (item.view2D ~= nil and item.view2D ~= false)
if visible then
local icon = 'list-tree'
local url = item.url
local thumbnail = ''
local childrenAsDir = false
local playable = false
local icon = false
local url = item.markup and item.parent.url or item.url
local thumbnail = item.markup and (item.parent.thumbnail or '') or ''
if #item.thumbnail > 0 then thumbnail = 'style="background-image: url(' .. EscapeFragment( util.stripPath(item.thumbnail) ) .. ');"' end
if (item.view3D or item.portal3D == false)
if item.view3D
or (item.janusxr and item.janusxr.room)
or (item.xrfragment and item.xrfragment.href)
or (item.redirect)
then
playable = true
url = url .. '?view=3D'
icon = 'play'
if #item.thumbnail > 0 then
thumbnail = 'style="background-image: url(./img/playcover.svg), url(' .. EscapeFragment( util.stripPath(item.thumbnail) ) .. ');"'
else
thumbnail = 'style="background-image: url(./img/playcover.svg);"'
end
end
print([[
<div class="tile">
<a href="]] .. getURL(url) .. [[">
<div class="img" ]] .. util.stripPath(thumbnail) .. [[></div>
<div class="text">
<img src="img/]] .. icon .. [[.svg" class="icon ]] .. icon .. [["/>&nbsp;<a href="]] .. getURL(item.url) .. [[">]] .. item.title .. [[</a>
]] .. (
item.janusxr and item.janusxr.room and [[
<a href="]] .. getURL(item.url) .. [[" style="float:right">
<img src="img/list-tree.svg" class="icon tree"/>
</a>
]] .. ( icon and '<img src="img/' .. icon .. '.svg" class="icon ' .. icon .. '"/>' or '') .. [[<a href="]] .. getURL(item.url) .. [[">]] .. item.title .. [[</a>
]]
..
( (not playable or (playable and #item.children > 1)) and
[[
<span class="col3" style="float:right">[]] .. #item.children .. [[]</span>
]] or ''
) .. [[
)
..
( (item.info or (playable and #item.children > 1 and (item.janusxr and item.janusxr.layout))) and
[[
<a href="]] .. getURL(item.url) .. '/dir' .. [[" class="iconbtn">
<img src="img/file-document.svg" class="icon file-document nopadding"/>
</a>
]] or ''
)
..
[[
</div>
</a>
</div>
@ -90,13 +116,13 @@ end}
local icon = 'link'
local thumbnail = ''
if #item.thumbnail > 0 then thumbnail = 'style="background-image: url(' .. EscapeFragment( util.stripPath(item.thumbnail) ) .. ');"' end
if item.view3D or item.portal3D == false then icon = 'play' end
if item.view3D then icon = 'play' end
print([[
<div class="tile">
<a href="]] .. getURL(item.url) .. [[">
<div class="img" ]] .. util.stripPath(thumbnail) .. [[></div>
<div class="text">
<img src="img/]] .. icon .. [[.svg" class="icon ]] .. icon .. [["/>&nbsp;<a href="]] .. getURL(item.url) .. [[">]] .. util.truncate(item.title) .. [[</a>
<img src="img/]] .. icon .. [[.svg" class="icon ]] .. icon .. [["/><a href="]] .. getURL(item.url) .. [[">]] .. util.truncate(item.title) .. [[</a>
</div>
</a>
</div>

View file

@ -82,7 +82,7 @@ return {
-- add extra metadata for janusxr JML (janusxr.html and dir.html)
table.insert(data.items, util.merge({x = i*2, i = i},v) )
i=i+1
if v.view3D then
if v.view3D and req.param.view ~= '2D' then
local isMarkupExperience = function(v)
v = v or {}
return v.janusxr and v.janusxr.wrap

View file

@ -63,10 +63,12 @@
-- janusweb workaround (it does not support '/' url somehow)
urlpath = urlpath .. app.opts.plugin_diskscan_dirname
end
if app.arg[1] == "generate" then
print([[<div class="btn XR"><a class="border secondary" href="janusweb/#janus.url=]] .. urlpath .. [[&janus.referrer=${referrer}">3D</a></div>&nbsp;]])
else
print([[<div class="btn XR"><a class="border secondary" href="${urlpath}?view=3D">3D</a></div>&nbsp;]])
if not urlpath:match('/dir$') then
if app.arg[1] == "generate" then
print([[<div class="btn XR"><a class="border secondary" href="janusweb/#janus.url=]] .. urlpath .. [[&janus.referrer=${referrer}">XR</a></div>&nbsp;]])
else
print([[<div class="btn XR"><a class="border secondary" href="${urlpath}?view=3D">XR</a></div>&nbsp;]])
end
end
end}
{if template == "page/index.html" or defined(item) then

View file

@ -14,14 +14,14 @@ else
end}
<div id="popup" class="content">
<div class="spectrum span" style="top:-1px">
<div></div>
</div>
<noscript>
<img src="${item.parent.thumbnail}" width="100%"/>
</noscript>
<img src="img/close.svg" width="20" class="icon close" onclick="document.querySelector('#popup').style.display = 'none'"/>
${description}
<div class="spectrum span" style="top:-1px">
<div></div>
</div>
<noscript>
<img src="${item.parent.thumbnail}" width="100%"/>
</noscript>
<img src="img/close.svg" width="20" class="icon close" onclick="document.querySelector('#popup').style.display = 'none'"/>
${description}
</div>
<script>

View file

@ -57,7 +57,7 @@ end}
initRoom(item or {})
initRoom(itemdir or {})
if (hasWrapperfile == true) or (defined(item) and item.tag.xrfragments and item.tag.xrfragments.href) then
if (hasWrapperfile == true) or (defined(item) and item.xrfragments and item.xrfragments.href) then
room = '' -- xrfragments 3D files dont need to be wrapped with room
end
print(' <room skybox="true" pos="' .. pos .. '" showavatar="false" use_local_asset="' .. room .. '">')
@ -73,10 +73,10 @@ end}
<text js_id="location" pos="0 6 -5" billboard="y" col="#BBFFFF" scale="10 10 1" text="${url}" emissive="0 0 0" roughness="0.3" metalness="0" />
{if not defined(item) and defined(items) and #items > 0 then
local layout = (itemdir.janusxr and itemdir.janusxr.layout) or ''
if #layout > 0 and app.plugin.janusxr.layout[ layout ] then
print( app.plugin.janusxr.layout[ layout ].render(items) )
if #layout > 0 and app.plugin.global.layout[ layout ] then
print( app.plugin.global.layout[ layout ].lib.render(items) )
else
print( app.plugin.janusxr.layout.portals.render(items) )
print( app.plugin.global.layout.portals.lib.render(items) )
end
end}
{if not defined(item) and defined(itemsremote) and #itemsremote > 0 then

View file

@ -79,6 +79,8 @@ return {
v.file.state = nil
end
end)
-- make sure to attach children-array to parents
me.addChildren()
-- sort & apply dirs to plugin options
table.sort( app.cache.dirs)
@ -137,7 +139,6 @@ return {
then
print("✅ ".. fullpath )
experience.dir = true
experience.portal3D = true -- can be viewed as 3d portal
app.pub("scan_experience", nil, experience)
app.addExperience(experience,ino)
-- check for directory thumbnail sidecarfile
@ -174,5 +175,16 @@ return {
dref, derr = dir.foreach( scandir, scanFile )
if not derr then dref:close() end
end,
addChildren = function()
-- .children is a convenient
foreach( app.cache.items, function(k,exp)
exp.children = exp.children or {}
if exp.parent then
exp.parent.children = exp.parent.children or {}
table.insert(exp.parent.children, exp.id)
end
end)
end
}

View file

@ -48,6 +48,14 @@ local plugin = {
name = "Global settings",
info = '',
ext = {"mp3","wav","ogg","mp4","vtt","md","html","jml","jpg","png","svg"},
layouts = {},
getLayouts = function()
local layouts = {}
foreach( app.plugin.global.layout, function(k,v)
layouts[k] = v.label
end)
return layouts
end,
opts = {
{
key='app.opts.admin_user',
@ -224,6 +232,7 @@ You've got this!
}
},
middleware = {
homepage_2D_or_3D = function(req,res,next)
if ( (req.url == '/' or req.url == '/index.html') and app.opts.plugin_global_homepage == '3D') or (req.param.view == '3D') or (req.param.url) then
res.template = 'page/index.html'
@ -231,6 +240,15 @@ You've got this!
res.template = 'page/dir.html'
end
next()
end,
force_listing = function(req,res,next)
if req.url:match('/dir$') then
req.url = req.url:gsub('/dir','')
req.param.view = '2D'
res.template = 'page/dir.html'
end
next()
end
}
}

View file

@ -30,8 +30,9 @@ app.on('scan_experience_file', function(exp)
if title then
exp.title = title:gsub("<.*","")
end
exp.markup = true
exp.janusxr = exp.janusxr or {}
exp.janusxr.wrap = nil -- erase previous 3D models
exp.janusxr.wrap = nil -- erase previous 3D models
print("✅ └─ plugin/janusxr: " .. exp.file.name)
if data:match(pattern_aframe) and app.opts.plugin_janusxr_wrap_aframe ~= '' then
--if not data:match("<a-sky") then
@ -56,7 +57,7 @@ app.on('scan_experience_file', function(exp)
end
if exp.parent.redirect == nil and app.opts.plugin_janusxr_wrap_3dfile ~= "disabled"
and not (exp.tag.xrfragments and exp.tag.xrfragments.qualify) then -- dont wrap xrfragments experience
and not (exp.xrfragments and exp.xrfragments.qualify) then -- dont wrap xrfragments experience
foreach( me.ext.object, function(k,ext)
if exp.path:lower():match("."..ext.."$") then
wrap = ext
@ -80,12 +81,26 @@ app.on('set', function(k,v) end)
-- this registers the plugin UI
local rooms = { [""]="empty",empty_plane="empty (+floorcollider)",random="random room",randomurl="random room (URL-deterministic)",room_plane="wirefloor",room1="room1",room2="room2",room3="room3",room4="room4",room5="room5",room6="room6",room7="room7"}
-- layouts
app.plugin.global.layout = {
portals = {
lib = require('plugin/janusxr/layout/portals'),
label = 'As portals'
},
grid = {
lib = require('plugin/janusxr/layout/grid'),
label = 'As grid'
}
}
local plugin = {
name = "JanusXR",
info = '<a href="https://coderofsalvation.github.io/janus-guide" target="_blank">JanusXR</a> connects XR experiences via XML portals (+AFRAME (geometry)markup also supported).',
ext = {
object = {'glb', 'gltf', 'obj', 'fbx', 'ply', 'stl', 'wrl', 'gltf', 'glb', 'bvh' }
},
opts = {
{
key='app.opts.plugin_janusxr_janusweb_endpoint',
@ -191,11 +206,6 @@ local plugin = {
}
},
layout = {
portals = require('plugin/janusxr/layout/portals'),
grid = require('plugin/janusxr/layout/grid')
},
addPortal = function(id,x,v,url,i,z,thumb,rotation,scale)
local title = v.title
local jml = ''
@ -300,6 +310,15 @@ local plugin = {
index.color = (index.color + 1 ) % #colors
end
return JML
end,
setLayout = function(exp, layout, opts)
opts = opts or {}
if not exp.janusxr then
exp.janusxr = {}
end
exp.janusxr.layout = layout
foreach( opts, function(k,v) exp.janusxr[k] = v end)
end
}

View file

@ -3,8 +3,9 @@ local portals = {
local jml = ''
for i,v in pairs(items) do
local url = v.url
local width = util.pluck('parent.janusxr.portal_width', v, false) or app.opts.plugin_global_portal_width
width = tonumber(width)
--TODO
--local width = util.pluck('parent.janusxr.portal_width', v, false) or app.opts.plugin_global_portal_width
local width = tonumber(app.opts.plugin_global_portal_width)
local thumb = ' shader_id="defaultportal"'
if #v.thumbnail > 0 then
thumb = ' thumb_id="img' .. i .. '" '

View file

@ -69,7 +69,7 @@ local plugin = {
title='Layout assets',
info='NOTE: use #overlay in asset-title to skip layout (sky/floor/e.g.)',
default="grid",
values={portals="As portals", grid="As grid"}
values=app.plugin.global.getLayouts()
},
{
key='app.opts.plugin_manyfold_layout_grid_size',

View file

@ -16,13 +16,11 @@ local function scanForOpenBrush(exp,opts)
foreach( tags, function(k,tag)
tag = tag:gsub("#","")
if exp.url:match( app.plugin.openbrush.pattern.collection(tag) ) then -- collection
if not exp.janusxr then
exp.janusxr = {}
end
exp.janusxr.layout = app.opts.plugin_openbrush_layout
exp.janusxr.room = app.opts[ "plugin_openbrush_wrap_room_" .. app.opts.plugin_openbrush_layout ] or 'empty'
exp.janusxr.portal_width = tonumber( app.opts.plugin_openbrush_portal_width )
exp.janusxr.grid_size = tonumber( app.opts.plugin_openbrush_grid_size )
app.plugin.janusxr.setLayout( exp, app.opts.plugin_openbrush_layout, {
room = app.opts[ "plugin_openbrush_wrap_room_" .. app.opts.plugin_openbrush_layout ] or 'empty',
portal_width = tonumber( app.opts.plugin_openbrush_portal_width ),
grid_size = tonumber( app.opts.plugin_openbrush_grid_size )
})
end
end)
scanTiltFile(exp)
@ -35,7 +33,10 @@ app.on('scan_experience_janusxr', function(opts)
local tags = app.plugin.openbrush.getTags()
foreach( tags, function(k,tag)
tag = tag:gsub("#","")
if exp.url:match( app.plugin.openbrush.pattern.asset(tag) ) then -- asset
if exp.url:match( app.plugin.openbrush.pattern.assetdir(tag) ) then -- assetdir
app.markViewable(exp)
end
if exp.url:match( app.plugin.openbrush.pattern.assetfile(tag) ) then -- assetfile
-- disable janusxr room wrapping (if any)
exp.janusxr = nil
-- also for the parent, and redirect to indirect child asset
@ -73,7 +74,7 @@ local plugin = {
title='Layout assets',
info='NOTE: use #overlay in asset-title to skip layout (sky/floor/e.g.)',
default="grid",
values={portals="As portals", grid="As grid"}
values=app.plugin.global.getLayouts()
},
{
key='app.opts.plugin_openbrush_wrap_room_portals',
@ -217,7 +218,8 @@ local plugin = {
pattern = {
collection = function(tag) return '/' .. tag:gsub("-","%%-") .. '$' end,
asset = function(tag) return '/' .. tag:gsub("-","%%-") .. '/' end,
assetfile = function(tag) return '/' .. tag:gsub("-","%%-") .. '/' end,
assetdir = function(tag) return '/' .. tag:gsub("-","%%-") .. '/.*[^/]$' end,
},
getTags = function()

View file

@ -81,6 +81,10 @@ local plugin = {
table.insert(urls, v.url )
urlLast = v.url
end
if #v.children > 1 then
table.insert(urls, v.url .. "/assets" )
urlLast = v.url
end
end)
app.on('response', function(opts)

View file

@ -28,7 +28,6 @@ app.on('scan_experience_file', function(exp)
local sfile = exp.path:gsub("."..ext.."$", "."..sidecarExt)
if util.fileExist( sfile ) then
exp.sidecarfile[ sidecarExt ] = "/" .. util.stripPath(sfile)
exp.parent.portal3D = false
end
end)
-- set thumbnail if any
@ -40,15 +39,15 @@ app.on('scan_experience_file', function(exp)
if util.fileExist( jsonfile ) then
exp.sidecarfile.JSONXRF = me.detectHrefInStruct( json.decode( util.readfile(jsonfile) ) )
end
exp.tag.xrfragments = {
exp.xrfragments = {
qualify = (hasHref or exp.sidecarfile.png or exp.sidecarfile.vtt or exp.sidecarfile.ogg or exp.sidecarfile.json) and true or false,
href = hasHref
}
if exp.tag.xrfragments.qualify then
if exp.xrfragments.qualify then
app.markViewable(exp, 100)
print("✅ └─ plugin/xrfragments: detected xrfragments experience")
end
if exp.tag.xrfragments.href then
if exp.xrfragments.href then
exp.parent.redirect = exp.url -- mark parent to redirect to this standalone url instead
end
foreach(exp.sidecarfile, function(ext,v)