roblox / tarmac Goto Github PK
View Code? Open in Web Editor NEWCommand line tool to manage Roblox assets
License: MIT License
Command line tool to manage Roblox assets
License: MIT License
The support I landed for alpha bleeding only applies to spritesheets since we don't make any attempts to decode single images.
We should apply this transform to individual images as well.
It would be useful to have a flag that tries to run a sync operation and fails if anything needs to be synced. This would be used in CI environments to ensure users have deployed any assets that have changed.
We're going to support high DPI images for users that manually import them for sure at first. It'll look like this:
local logo = require(Assets.logo)
local logo2x = require(Assets["logo@2x"])
if isHighDpi then
label.Image = logo2x
else
label.Image = logo
end
It's then up to the user to pick the correct asset for the current resolution scale. That isn't very fun, and I think Tarmac is in a good position to help.
One approach would be to write a new codegen mode that returns images as a thunk taking the DPI scale, used something like this:
local logo = require(Assets.logo)
-- This isn't a real property yet, but core scripts have access to something similar
label.Image = logo(screenGui.ResolutionScale)
Currently, Tarmac is pretty unstable.
Once it's more stable, we should build a documentation site for it to help users adopt it.
Instead of having images scattered among developer's accounts, it would be useful to require that all images are uploaded to a given group. This makes it easier to take inventory of them, protect them from moderation actions, and monitor them for problems.
We use Sheep for packing spritesheets right now, and as such hit a bug with their maxrects packer.
We should consider one of:
We have tarmac upload-image
right now. As a holdover for other tools, it might be useful to introduce tarmac upload-model
to upload models.
Currently, if I include two projects that both have assets/foo.png
in them, one of them will overwrite the other. Tarmac assumes that AssetName
is unique across an entire project, but does not correctly prefix paths from other projects currently.
Some file types can be uploaded to multiple different kinds of asset.
Model files, for example, have the rbxm
extension and can represent models, plugins, packages, animations, and probably more. In order for Tarmac to upload these asset types correctly, we'll need to explicitly tell it what a group of models represent.
Repro: Upload a file named Panda Fox.png, with
tarmac upload-image images/image.png -- name "Panda Fox.png" -vvv
You will get an output similar to this:
Roblox is responding by telling Tarmac that the name is inappropriate, however, tarmac will immediately error, thus cancelling any work it has done
This is problematic as
Currently, Tarmac supports uploading to Roblox.com only. For fast local iteration, it would be useful for Tarmac to copy your assets into your local Roblox Studio content folder temporarily.
To do that, we could introduce a new value for --target
named something like local-studio
:
tarmac sync --target local-studio
This command would:
roblox-install
$INSTALL/content/.tarmac/<hash>
.rbxasset://.tarmac/<hash>
for any assets that have no asset ID.The Roblox upload endpoint will rate-limit, which can cause problems when running Tarmac on large sets of assets. This can be especially troublesome when integrating with CI.
The upload API returns a 429 error when rate limiting occurs, and the budget is per-minute. We should be able to provide Tarmac an optional retry count, so that when it receives a 429 it will wait for one minute, then retry with the last file it was attempting to upload.
This might be out of scope for Tarmac, but there's never a case where I want an image with transparency uploaded but not alpha bled.
@Quenty released an article titled "Fixing images in Roblox UI". In this article, he explains how due to a bug, images with transparency form ugly pixels around them. The solution is to change the RGB values of the alpha to coincide with the border.
XAXA released a tool for this that I use regularly. It would be very useful if Tarmac could automate this process.
Tarmac is a great tool for any Roblox developer, it's a shame that the "official" version doesn't work. For anyone who's looking for a working version of tarmac, you can find a working fork at https://github.com/rojo-rbx/tarmac, it's even in the rojo-rbx organization, which was the original organization that started tarmac.
This issue should probably be pinned unless work is done to fix tarmac, or the repository may as well just be archived and the fork advertised in the README. Otherwise I'm sure a lot of people will end up not using tarmac due to it seeming completely broken.
Right now, the plan is to imitate the semantics that tools in the JS ecosystem have for dealing with assets, where we can pretend to import asset files like they're modules:
local CancelIcon = require(Assets.CancelIcon)
local ConfirmIcon = require(Assets.ConfirmIcon)
cancelBox.Texture = CancelIcon
confirmBox.Texture = ConfirmIcon
We do this by generating Lua files next to each asset that we want to be able to import:
Assets/
├─ CancelIcon.png
├─ CancelIcon.lua
├─ ConfirmIcon.png
└─ ConfirmIcon.lua
Another approach would might want to support is grouping together the generated code into one or more batches of files containing assets keyed by name:
local Assets = require(Assets)
cancelBox.Texture = Assets.CancelIcon
confirmBox.Texture = Assets.ConfirmIcon
With a corresponding directory structure:
Assets/
├─ CancelIcon.png
├─ ConfirmIcon.png
└─ init.lua
The configuration for a project like this might include this bit in its tarmac.toml
:
[[inputs]]
glob = "Assets/**/*.png"
codegen = { type = "batch-asset-url", output = "Assets/init.lua" }
It would be useful as a developer who uses roblox-ts if the generated .lua files had an associated .d.ts file with it too.
For the files that are just return "rbxassetid://?????"
, this should be as easy as export = string
or something.
There's a few ways this could be done nicely. For example, the current message could be changed like this:
Old: [INFO] Uploading {} to Roblox
New: [INFO] Uploading {} to Roblox (5/250)
Or, we could use a terminal progress bar, like any of the ones from here
I'm happy to submit a PR for this myself. Just waiting for approval from a maintainer so I don't do useless work.
#31 was a partial solution to the high DPI problem, and provided new a new code generation style for assets that have high DPI variants available (foo.png
, [email protected]
, etc). However, for images where packable
is not set, each high DPI variant still generates code independently.
Tarmac should merge these inputs and generate one file containing all of the high DPI variants.
It's common to use 9-slice images when building Roblox UI. Slice coordinates need to be scaled to account for DPI.
It'd be neat to be able to associate some metadata with each image about whether they're intended to be sliced and how, and have Tarmac automatically scale up and encode that data into the generated code.
Once we have a workflow for local development, allowing Tarmac to watch for files to be changed, added, or deleted would be useful when paired with Rojo.
I propose:
tarmac sync --target local-studio --watch
tarmac sync
is very complex. It's effectively the only command in Tarmac.
It would be useful to create smaller commands that contain each auxiliary piece of functionality, which should help us manage complexity.
tarmac sync
will just sync assets to the Roblox cloud
--target
parameter should be removed.tarmac dev
will just sync assets to a local installation to work on in development modetarmac generate-cache
, pitched in #15, will generate a cache from the current statetarmac create-path-map
(#38) will write a map of all assets managed by Tarmactarmac verify-synced
will validate that the project is in sync with the Roblox cloud
In order to improve behavior of images when they're resized, we should run an alpha bleed step on all images.
Some consumers of Tarmac, like Roblox, want to have local copies of each uploaded asset, indexed by asset ID.
Tarmac should support an additional flag or separate command to create an output cache out of whatever the current state is by downloading images from Roblox:
# As a flag
tarmac sync --target roblox --cache-dir my-cache/
# As a separate command
tarmac sync --target roblox
tarmac make-cache my-cache/
Due to the way that Tarmac constructs the AssetName
type, the folder containing tarmac.toml
must be an ancestor of any included inputs.
Currently, Tarmac will error when it hits a 429 error response from Roblox with the following error:
thread 'main' panicked at 'not yet implemented: Handle bad responses', src\roblox_web_api.rs:75:13
This is not preferred as it causes tarmac to immediately exit and not create the manifest / cache previous images it has uploaded (so the user can wait and reupload at a later point)
Additional debug with headers responded:
429-tarmac.txt
When testing Tarmac against UIBlox, an internal Roblox project, it seems Tarmac always thinks it needs to reupload the generated spritesheets.
We have a clear plan for how to handle assets that are used programmatically, but that's only a small fraction of the way that assets are used in Roblox.
It would be a good idea to build a tool that can traverse models and places to update their asset references when they need to be updated. This might not fit into Tarmac, but Tarmac should be able to produce the data needed to build a tool that can do this.
Currently, all spritesheets get uploaded as spritesheet.png
. We should include a descriptive name, like from the project name or a name added to the input group. We could also include information like the DPI scale of the input group.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.