Cloud spawning: Difference between revisions

From Resonite Wiki
m Clarifying what "getting" the resdb link means, since someone may not realize what actually happens when you press this button.
m I'm struggle
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{unsupported way}}
{{unsupported way}}
{{Note|Cloud Spawning is part of the [[Things to Avoid]] list. It may break in the future without warning.|warning}}
{{Note|Cloud Spawning is part of the [[Things to Avoid]] list.|warning}}


'''Cloud Spawning''' is the unofficial term used to describe the action of spawning an item from a [[User|user's]] [[Inventory]] programmatically. It is currently unsupported officially.  
'''Cloud Spawning''' is the unofficial term used to describe the action of spawning an item from a [[User|user's]] [[Inventory|inventory]] programmatically. It is currently unsupported officially.  


== Methods ==
== Methods ==
Line 10: Line 10:
=== Copy & Paste ===
=== Copy & Paste ===


This method allows you to spawn an item by pressing a button with a [[Component:ButtonClipboardCopyText]] and [[Component:VirtualMultiKey|VirtualMultiKey]] components. To set this up simply attach both components to a slot which has a button, setup the [[Component:ButtonClipboardCopyText]] component to copy the link to the asset you want to cloud spawn and set the [[Component:VirtualMultiKey|VirtualMultiKey]] to "LeftControl" and "V". Clicking the button will then spawn the asset. The benefit of this method is that it supports all links you can normally paste into resonite, such as resrec, resdb and http. A disadvantage is that it can only be triggered by pressing a button, there is no way to use this method without user interaction. [[RedX]] uses something similar to this method to spawn out items.
This method allows you to spawn an item by pressing a button, which will:
 
# Copy the [[Resonite_database_link|resdb link]] to the clipboard with a [[Component:ButtonClipboardCopyText|ButtonClipboardCopyText]] component.
# Simulate keyboard inputs to paste it with the [[Component:VirtualMultiKey|VirtualMultiKey]] component, spawning the item.  
 
The benefit of this method is that it supports all links which may normally be spawned into Resonite (such as resrec, resdb and http).  
 
This is at the disadvantage of only being triggerable by pressing a button. This means there is no way to use this method without user interaction.  
 
[[RedX]] uses a similar method to spawn out items.
 
==== Setup ====
 
# Attach both components to a slot which has a [[Type:IButton|button component]].
# Attach the '''ButtonClipboardCopyText''' component.
# Set the '''ButtonCliboardCopyTest''' component to copy the link to the asset you want to cloud spawn. <!-- TODO: How exactly do you set this? the component page just shows a source, which requires a IField`1<String> instead of a String. -->
# Attach the '''VirtualMultiKey''' component.
# Set the '''VirtualMultiKey''' component to  the <code>LeftControl</code> and <code>V</code> keys.
# Activate the button to spawn the asset.


=== Components and Method Proxies ===
=== Components and Method Proxies ===
Line 20: Line 38:
* One [[Slot]] to hold components.
* One [[Slot]] to hold components.
* Components [[Component:StaticBinary|StaticBinary]] & [[Component:FileMetadata|FileMetadata]].
* Components [[Component:StaticBinary|StaticBinary]] & [[Component:FileMetadata|FileMetadata]].
* The target item you want to spawn from the [[Inventory]].
* The target item you want to spawn from an [[Inventory|inventory]].


==== Item Setup ====
==== Item Setup ====
Line 26: Line 44:
[[File:Get Item Link Buttons.png|alt=The get item link buttons.|thumb|The get item link buttons (with the cheese button being active).]]
[[File:Get Item Link Buttons.png|alt=The get item link buttons.|thumb|The get item link buttons (with the cheese button being active).]]


# Open the [[Inventory]] tab on the [[Dash]].
# Open the '''Inventory''' tab on the [[Dash]].
# Navigate to the item you wish to cloud spawn.
# Navigate to the item you wish to cloud spawn.
# Press the <strong>"cheese" button</strong> from the <strong>Get Item Link</strong> mod to copy the [[Resonite_database_link|resdb link]] to the clipboard.
# Press the <strong>"cheese" button</strong> from the <strong>Get Item Link</strong> mod to copy the [[Resonite_database_link|resdb link]] to the clipboard.
Line 36: Line 54:
# Create an empty slot using the [[Dev Tool]].
# Create an empty slot using the [[Dev Tool]].
# Attach the [[Component:StaticBinary|StaticBinary]] component.
# Attach the [[Component:StaticBinary|StaticBinary]] component.
## For the <code>URL</code>, place your item's resdb link here.
# Place your item's resdb in the the <code>URL</code> field.
# Attach the [[Component:FileMetadata|FileMetadata]] component.
# Attach the [[Component:FileMetadata|FileMetadata]] component.
## For the <code>Filename</code>, you can use any name here, but it must have the <code>.brson</code>, <code>.7zbson</code>, or <code>.lz4bson</code> file extension at the end of the name. (Filling in <code>MIME</code> is not required.)
# Within the <code>Filename</code> field, fill in any name ending with one of the following file extensions. Filling in <code>MIME</code> is not required.
# Add a [[Component:Button|button component]] onto the slot or parent slot, and trigger it to spawn the item.
#* <code>.brson</code>
# (Alternatively) Open the [[Component:FileMetadata|FileMetadata]] Sync Methods using the Show Delegates mod, and with the [[ProtoFlux Tool]], grab and hold the <code>OnImportFile</code> method. Then open the context menu while still holding it, select <code>Proxy</code>.
#* <code>.7zbson</code>
#* <code>.lz4bson</code>
# <p>Attach a [[Component:Button|button component]] to the slot or the parent slot, then trigger it to spawn the item.</p><p><em><strong>Alternatively</strong>, open the [[Component:FileMetadata|FileMetadata]] Sync Methods using the Show Delegates mod, and with the [[ProtoFlux Tool]], grab and hold the <code>OnImportFile</code> method. Open the context menu while still holding it and select <code>Proxy</code>.</em></p>


==== ProtoFlux Setup ====
==== ProtoFlux Setup ====
Line 46: Line 66:
[[File:Code To Cloud Spawn.png|alt=An example of how to use ProtoFlux to cloud spawn.|thumb|An example of how to use [[ProtoFlux]] to [[Cloud Spawning|cloud spawn]].]]
[[File:Code To Cloud Spawn.png|alt=An example of how to use ProtoFlux to cloud spawn.|thumb|An example of how to use [[ProtoFlux]] to [[Cloud Spawning|cloud spawn]].]]


# With the [[ProtoFlux:Method Proxy|method proxy]], connect it to anything that can send a pulse to it (the example shows a [[ProtoFlux:Call Input|Call]] node doing this).
With the [[ProtoFlux:Method Proxy|Method Proxy]] node, connect the <code>OnImportFile</code> method to anything that can send an [[Impulses|impulse]]. The example shows a [[ProtoFlux:Call Input|Call]] node doing this.
 
== Official Support ==
You can track the current status on the official version of Cloud Spawning in this [https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/313 GitHub issue].


[[Category:Tutorial]]
[[Category:Tutorial]]
[[Category:Technical article]]
[[Category:Technical article]]
== Official Support ==
You can track the work on an official version of Cloud Spawning in this [https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/313 GitHub Issue].

Latest revision as of 19:08, 11 August 2025

This method is not supported by the developers of Resonite and may break at any time!
Cloud Spawning is part of the Things to Avoid list.

Cloud Spawning is the unofficial term used to describe the action of spawning an item from a user's inventory programmatically. It is currently unsupported officially.

Methods

Although cloud spawning is not officially supported, several methods have been developed by the community to achieve it.

Copy & Paste

This method allows you to spawn an item by pressing a button, which will:

  1. Copy the resdb link to the clipboard with a ButtonClipboardCopyText component.
  2. Simulate keyboard inputs to paste it with the VirtualMultiKey component, spawning the item.

The benefit of this method is that it supports all links which may normally be spawned into Resonite (such as resrec, resdb and http).

This is at the disadvantage of only being triggerable by pressing a button. This means there is no way to use this method without user interaction.

RedX uses a similar method to spawn out items.

Setup

  1. Attach both components to a slot which has a button component.
  2. Attach the ButtonClipboardCopyText component.
  3. Set the ButtonCliboardCopyTest component to copy the link to the asset you want to cloud spawn.
  4. Attach the VirtualMultiKey component.
  5. Set the VirtualMultiKey component to the LeftControl and V keys.
  6. Activate the button to spawn the asset.

Components and Method Proxies

This method allows for full control of how an item is spawned out from an inventory. This requires a mod to show sync delegates and to get the Method Proxy nodes which, once called, will spawn the item.

What You Need

Item Setup

The get item link buttons.
The get item link buttons (with the cheese button being active).
  1. Open the Inventory tab on the Dash.
  2. Navigate to the item you wish to cloud spawn.
  3. Press the "cheese" button from the Get Item Link mod to copy the resdb link to the clipboard.

Slot Setup

An inspector showing the components needed to make cloud spawning work.
An inspector showing the components needed to make cloud spawning work.
  1. Create an empty slot using the Dev Tool.
  2. Attach the StaticBinary component.
  3. Place your item's resdb in the the URL field.
  4. Attach the FileMetadata component.
  5. Within the Filename field, fill in any name ending with one of the following file extensions. Filling in MIME is not required.
    • .brson
    • .7zbson
    • .lz4bson
  6. Attach a button component to the slot or the parent slot, then trigger it to spawn the item.

    Alternatively, open the FileMetadata Sync Methods using the Show Delegates mod, and with the ProtoFlux Tool, grab and hold the OnImportFile method. Open the context menu while still holding it and select Proxy.

ProtoFlux Setup

An example of how to use ProtoFlux to cloud spawn.
An example of how to use ProtoFlux to cloud spawn.

With the Method Proxy node, connect the OnImportFile method to anything that can send an impulse. The example shows a Call node doing this.

Official Support

You can track the current status on the official version of Cloud Spawning in this GitHub issue.