godot packager + open in godot-menu feature

This commit is contained in:
Leon van Kammen 2025-08-27 14:11:20 +02:00
parent 62779a783d
commit 7c173d8436
7 changed files with 45 additions and 11 deletions

View file

@ -52,6 +52,7 @@ $ manyfold/cli/manyfold run -v ./experiences:/mnt/experiences
| `HOMEPAGE` | `/models` | show '/models' URL as homepage (use `/` for manyfold default) | | `HOMEPAGE` | `/models` | show '/models' URL as homepage (use `/` for manyfold default) |
| `THEME` | `default` | bootstrap theme | | `THEME` | `default` | bootstrap theme |
| `GODOT_VERSION` | `4.4.1-stable`| godot editor version | | `GODOT_VERSION` | `4.4.1-stable`| godot editor version |
| `GODOT_TEMPLATE_ZIP` | `` | godot template zip URL or file (default is empty godot project) |
| `RUNTESTS` | `0` | set to `1` to run XRForge related [/test](test) scripts | | `RUNTESTS` | `0` | set to `1` to run XRForge related [/test](test) scripts |
| `DEV` | `` | enable development mode (disables caching, sets `bin/dev` as entrypoint) | | `DEV` | `` | enable development mode (disables caching, sets `bin/dev` as entrypoint) |
| `NO_PUBLIC_ONLY` | `` | disable public only models | | `NO_PUBLIC_ONLY` | `` | disable public only models |

View file

@ -175,7 +175,7 @@ rename_app(){
sed -i 's|powered_by_html:.*|powered_by_html: Radically opensource-powered by <a href="https://forgejo.isvery.ninja/coderofsalvation/xrforge">XR Forge</a>, <a href="https://manifold.app" target="_blank">Manyfold</a>, <a href="https://xrfragment.org">XR Fragments</a> and <a href="https://nixos.org" target="_blank">NIX</a>|g' /usr/src/app/config/locales/*.yml sed -i 's|powered_by_html:.*|powered_by_html: Radically opensource-powered by <a href="https://forgejo.isvery.ninja/coderofsalvation/xrforge">XR Forge</a>, <a href="https://manifold.app" target="_blank">Manyfold</a>, <a href="https://xrfragment.org">XR Fragments</a> and <a href="https://nixos.org" target="_blank">NIX</a>|g' /usr/src/app/config/locales/*.yml
sed -i 's|Models|Experiences|g' /usr/src/app/config/locales/*.yml /usr/src/app/config/locales/*/*.yml sed -i 's|Models|Experiences|g' /usr/src/app/config/locales/*.yml /usr/src/app/config/locales/*/*.yml
sed -i 's|Model|Experience|g' /usr/src/app/config/locales/*.yml /usr/src/app/config/locales/*.yml sed -i 's|Model|Experience|g' /usr/src/app/config/locales/*.yml /usr/src/app/config/locales/*/*.yml
} }
start_syslog(){ start_syslog(){
@ -232,9 +232,9 @@ boot(){
set_upload_path set_upload_path
force_public force_public
get_xrfragment_assets get_xrfragment_assets
scan_libraries &
mount_dir mount_dir
start_hook_daemon start_hook_daemon
scan_libraries &
hook boot # emit unixy hook-event (/root/hook.d/boot/* scripts) hook boot # emit unixy hook-event (/root/hook.d/boot/* scripts)
# enable development mode (disables template caching etc) # enable development mode (disables template caching etc)

View file

@ -4,6 +4,8 @@ dir=$(dirname $1)
cd "$dir" cd "$dir"
echo "[package_experience.sh] zipping $dir.zip" echo "[package_experience.sh] zipping $dir.zip"
test -d ~/tpl_godot.zip || timeout 50 wget "https://codeberg.org/coderofsalvation/xrfragment-godot/archive/main.zip" -O ~/tpl_godot.zip # overwrite empty godot template project-zip with given URL
cp ~/tpl_godot.zip package_godot.zip test -n "$GODOT_TEMPLATE_ZIP" && timeout 50 wget "$GODOT_TEMPLATE_ZIP" -O ~/template_godot.zip
cp ~/template_godot.zip package_godot.zip
zip package_godot.zip *.glb *.usdz *.obj zip package_godot.zip *.glb *.usdz *.obj

Binary file not shown.

View file

@ -0,0 +1,25 @@
# frozen_string_literal: true
class Components::DropdownItem < Components::Base
include Phlex::Rails::Helpers::LinkTo
def initialize(icon:, label:, path:, method: nil, aria_label: nil, confirm: nil, target: nil)
@icon = icon
@label = label
@path = path
@method = method
@aria_label = aria_label
@confirm = confirm
@target = target
end
def view_template
li do
link_to @path, method: @method, class: "dropdown-item", aria: {label: @aria_label}, data: {confirm: @confirm}, target: @target do
Icon(icon: @icon, label: @label)
whitespace
span { @label }
end
end
end
end

View file

@ -112,7 +112,7 @@ class Components::ModelCard < Components::Base
end end
div class: "col col-auto" do div class: "col col-auto" do
BurgerMenu do BurgerMenu do
DropdownItem(icon: "app", label: "Open in Godot Web" , path: "/godot/?url="+"/"+@model.library.name+"/"+@model.path.gsub("#","%23")+"/package_godot.zip", aria_label: translate("components.model_card.edit_button.label", name: @model.name)) DropdownItem(icon: "app", label: "Open in Godot Web" , path: "/godot/?url="+"/"+@model.library.name+"/"+@model.path.gsub("#","%23")+"/package_godot.zip", aria_label: translate("components.model_card.edit_button.label", name: @model.name), target: "_blank" )
DropdownItem(icon: "pencil", label: t("components.model_card.edit_button.text"), path: model_path(@model), aria_label: translate("components.model_card.edit_button.label", name: @model.name)) DropdownItem(icon: "pencil", label: t("components.model_card.edit_button.text"), path: model_path(@model), aria_label: translate("components.model_card.edit_button.label", name: @model.name))
DropdownItem(icon: "trash", label: t("components.model_card.delete_button.text"), path: model_path(@model), method: :delete, aria_label: translate("components.model_card.delete_button.label", name: @model.name), confirm: translate("models.destroy.confirm")) if policy(@model).destroy? DropdownItem(icon: "trash", label: t("components.model_card.delete_button.text"), path: model_path(@model), method: :delete, aria_label: translate("components.model_card.delete_button.label", name: @model.name), confirm: translate("models.destroy.confirm")) if policy(@model).destroy?

View file

@ -68,12 +68,18 @@
<td><%= link_to @model.creator.name, @model.creator, itemprop: "author" %></td> <td><%= link_to @model.creator.name, @model.creator, itemprop: "author" %></td>
</tr> </tr>
<% end %> <% end %>
<tr> <tr>
<td> <td>
<i class="bi bi-file-zip" role="img"></i> <i class="bi bi-file-zip" role="img"></i>
</td> </td>
<td><%= link_to @model.path+".zip", @model.path+".zip" %></td> <td><%= link_to "zip archive", "/"+@model.library.name+"/"+@model.path.gsub("#","%23")+".zip" %></td>
</tr> </tr>
<tr>
<td>
<i class="bi bi-controller" role="img"></i>
</td>
<td><%= link_to "Godot project", "/"+@model.library.name+"/"+@model.path.gsub("#","%23")+"/package_godot.zip" %></td>
</tr>
<% if @model.collection %> <% if @model.collection %>
<tr> <tr>
<td><%= icon "collection", Collection.model_name.human(count: 100) %></td> <td><%= icon "collection", Collection.model_name.human(count: 100) %></td>