From 7c173d8436d196e9d3076082a1b16249f94ac10d Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Wed, 27 Aug 2025 14:11:20 +0200 Subject: [PATCH] godot packager + open in godot-menu feature --- manyfold/README.md | 1 + manyfold/cli/manyfold.sh | 4 +-- .../inotify_MODIFY/package_godot_zip.sh | 6 +++-- manyfold/root/template_godot.zip | Bin 0 -> 1752 bytes .../src/app/app/components/dropdown_item.rb | 25 ++++++++++++++++++ .../usr/src/app/app/components/model_card.rb | 2 +- .../src/app/app/views/models/show.html.erb | 18 ++++++++----- 7 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 manyfold/root/template_godot.zip create mode 100644 manyfold/usr/src/app/app/components/dropdown_item.rb diff --git a/manyfold/README.md b/manyfold/README.md index 0b3a006..b192394 100644 --- a/manyfold/README.md +++ b/manyfold/README.md @@ -52,6 +52,7 @@ $ manyfold/cli/manyfold run -v ./experiences:/mnt/experiences | `HOMEPAGE` | `/models` | show '/models' URL as homepage (use `/` for manyfold default) | | `THEME` | `default` | bootstrap theme | | `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 | | `DEV` | `` | enable development mode (disables caching, sets `bin/dev` as entrypoint) | | `NO_PUBLIC_ONLY` | `` | disable public only models | diff --git a/manyfold/cli/manyfold.sh b/manyfold/cli/manyfold.sh index c045044..5987692 100755 --- a/manyfold/cli/manyfold.sh +++ b/manyfold/cli/manyfold.sh @@ -175,7 +175,7 @@ rename_app(){ sed -i 's|powered_by_html:.*|powered_by_html: Radically opensource-powered by XR Forge, Manyfold, XR Fragments and NIX|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|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(){ @@ -232,9 +232,9 @@ boot(){ set_upload_path force_public get_xrfragment_assets - scan_libraries & mount_dir start_hook_daemon + scan_libraries & hook boot # emit unixy hook-event (/root/hook.d/boot/* scripts) # enable development mode (disables template caching etc) diff --git a/manyfold/root/hook.d/inotify_MODIFY/package_godot_zip.sh b/manyfold/root/hook.d/inotify_MODIFY/package_godot_zip.sh index 52770e3..04ed957 100755 --- a/manyfold/root/hook.d/inotify_MODIFY/package_godot_zip.sh +++ b/manyfold/root/hook.d/inotify_MODIFY/package_godot_zip.sh @@ -4,6 +4,8 @@ dir=$(dirname $1) cd "$dir" 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 -cp ~/tpl_godot.zip package_godot.zip +# overwrite empty godot template project-zip with given URL +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 diff --git a/manyfold/root/template_godot.zip b/manyfold/root/template_godot.zip new file mode 100644 index 0000000000000000000000000000000000000000..4427be0c1ed91bf05d0073bbf7a4d374862705c0 GIT binary patch literal 1752 zcmWIWW@Zs#U|`??Vg?2&^`pxcFfuTBGXvQ`er~01K~a8IYI2EwW^#U>UU6BvUS@7V zeo@KVpwoTQiUNB+iwb_9``l_<*rO?bTlPi@W;vhd;pCC1lJQ^kr}{(R@v<<>XH71l zj-mG71Z7*+_ehG@sPr@m&&%vOA$gXO_5Y*Tju}F)wzp=)S~*9R}W}=j=1Js@B_1y}rIQbBcU-$*cLZs@Qk0v)ppE_^w&>-sZDqpLb?2th`sU z`&+;YnI_|Q7AcM+`p5hQ=fo`DTl4CGTFQRO+u1yt&;9GVxKh(~)_q$on=U21H`w#d zfB$W7cJNOyj@@&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wyfw>KLaShCZ48UN80^Ef+x;f~@ z1IPe~IX8e5k~t`a1-dEdr2)beeW0t6Oo5dR=mwxC4TJ&7EGPz`B$NPeRyL4I79bP_ KI(IEAhz9`Sbi#)K literal 0 HcmV?d00001 diff --git a/manyfold/usr/src/app/app/components/dropdown_item.rb b/manyfold/usr/src/app/app/components/dropdown_item.rb new file mode 100644 index 0000000..999e67e --- /dev/null +++ b/manyfold/usr/src/app/app/components/dropdown_item.rb @@ -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 diff --git a/manyfold/usr/src/app/app/components/model_card.rb b/manyfold/usr/src/app/app/components/model_card.rb index fd178aa..32eeb0d 100644 --- a/manyfold/usr/src/app/app/components/model_card.rb +++ b/manyfold/usr/src/app/app/components/model_card.rb @@ -112,7 +112,7 @@ class Components::ModelCard < Components::Base end div class: "col col-auto" 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: "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? diff --git a/manyfold/usr/src/app/app/views/models/show.html.erb b/manyfold/usr/src/app/app/views/models/show.html.erb index db0d207..8c4270a 100644 --- a/manyfold/usr/src/app/app/views/models/show.html.erb +++ b/manyfold/usr/src/app/app/views/models/show.html.erb @@ -68,12 +68,18 @@ <%= link_to @model.creator.name, @model.creator, itemprop: "author" %> <% end %> - - - - - <%= link_to @model.path+".zip", @model.path+".zip" %> - + + + + + <%= link_to "zip archive", "/"+@model.library.name+"/"+@model.path.gsub("#","%23")+".zip" %> + + + + + + <%= link_to "Godot project", "/"+@model.library.name+"/"+@model.path.gsub("#","%23")+"/package_godot.zip" %> + <% if @model.collection %> <%= icon "collection", Collection.model_name.human(count: 100) %>