godot packager + open in godot-menu feature
This commit is contained in:
		
							parent
							
								
									62779a783d
								
							
						
					
					
						commit
						7c173d8436
					
				
					 7 changed files with 45 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -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 |
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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|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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										
											BIN
										
									
								
								manyfold/root/template_godot.zip
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								manyfold/root/template_godot.zip
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										25
									
								
								manyfold/usr/src/app/app/components/dropdown_item.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								manyfold/usr/src/app/app/components/dropdown_item.rb
									
										
									
									
									
										Normal 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
 | 
			
		||||
| 
						 | 
				
			
			@ -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?
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,12 +68,18 @@
 | 
			
		|||
              <td><%= link_to @model.creator.name, @model.creator, itemprop: "author" %></td>
 | 
			
		||||
            </tr>
 | 
			
		||||
          <% end %>
 | 
			
		||||
            <tr>
 | 
			
		||||
              <td>
 | 
			
		||||
                <i class="bi bi-file-zip" role="img"></i>
 | 
			
		||||
	      </td>
 | 
			
		||||
              <td><%= link_to @model.path+".zip", @model.path+".zip" %></td>
 | 
			
		||||
	    </tr>
 | 
			
		||||
          <tr>
 | 
			
		||||
            <td>
 | 
			
		||||
              <i class="bi bi-file-zip" role="img"></i>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td><%= link_to "zip archive", "/"+@model.library.name+"/"+@model.path.gsub("#","%23")+".zip" %></td>
 | 
			
		||||
          </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 %>
 | 
			
		||||
            <tr>
 | 
			
		||||
              <td><%= icon "collection", Collection.model_name.human(count: 100) %></td>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue