VSCode extension to send scripts to Cavalry.
Install Stallion from the marketplace or look for "Stallion" in the VSCode extension tab and click the install
button.
To send scripts to Cavalry the Stallion script needs to be open in Cavalry. After the extension is installed, the Stallion script should be available in Cavalry via Scripts > Stallion
.
The VSCode extension exposes the following commands to the Command Palette (View > Command Palette
).
This will send the text from the active editor to Cavalry as a script. It doesn't have to be a saved file. Focus the Cavalry window and check the Log Window for any errors.
If it was sucessful the Log Window will show:
[Info]
JavaScript: Stallion: Script successfully executed
This will send the text from the active editor as an expression to Cavalry. It will apply the expression to the selected layers of the chosen type. If there is no selection it will create a layer of the chosen type.
Choose to send it as:
This will enable auto-complete for Cavalry's scripting API. It inserts a comment at the top of the open editor which references the latest cavalry-types.
127.0.0.1:8080
). Make sure nothing else is using this port.ui.scriptLocation
returns a temporary path if the document in VSCode hasn't been saved.While Stallion is open, send a POST
request to http://127.0.0.1:8080/post
with the following JSON
{
"type": "",
"code": "",
"path": ""
}
type
String. The type of code that's sent. Typically one of the following:
script
javaScriptShape
javaScript
(Utility)javaScriptModifier
javaScriptDeformer
javaScriptEmitter
skslShader
code
String. Required when type
is a JavaScript layer or SkSL Shader.
The expression that should be applied to a layer or the code that should be executed when type
is script
.
[!IMPORTANT] Sending UI scripts through
code
will result in the UI being appended to the Stallion UI. Usepath
instead.
path
String. Required when sending UI scripts.
The absolute path to a script. Mainly used for UI scripts so they're opened in their own window.
Huge thanks to Cavalry for sponsoring this project! Interested in sponsoring? Send us a message.
The icon is Horse by Buztas Linggar from Noun Project