vocksel / prefabs Goto Github PK
View Code? Open in Web Editor NEWRoblox plugin for making reuseable assets and keeping them in sync across your game
License: MIT License
Roblox plugin for making reuseable assets and keeping them in sync across your game
License: MIT License
This would allow us to take an existing prefab and modify it to create a variant of the base prefab.
We can technically do this right now, but having a feature to group a variant with the base would be good, as well as having a method for easily swapping between variants.
See: rojo-rbx/rojo#20
Because src points to Prefabs
and our modules all point to Prefabs.lib
, sometimes Rojo nukes lib
and we don't get our modules loaded.
This is a slightly intrusive behavior. Whether or not you have the Tag Editor installed, this plugin will create the folders TagList
and TagGroupList
under ServerStorage
. TagList
is then propagates with the corresponding tag for each added/updated prefab.
It would be nice to add this as a checkbox in the options menu detailed in #52, so that the user can choose to opt out of this behavior.
(Also later on down the line we should add support for cleaning up all the prefab tags, and adding them back in if the user opts in again)
We have APIs for registering, updating, and renaming, but not to remove a prefab.
Removal of a prefab can be done manually by deleting it from the folder in ServerStorage, but if any tags were picked up by the tag editor (which we'll be handling automatically in the future, see: #16), this can leave some garbage behind.
A simple delete(prefab)
and deleteSelection()
API would take care of both removing the prefab model and the tag associated with it.
A deleteClones()
API (or similar) would also be good to have. This would take care of deleting any copies of the prefab from the Workspace, as well as ServerStorage.
Using GetInstanceRemovedSignal we can listen for a prefab being removed. When all prefabs of the same type are removed we can remove the tag as well.
Right now we have a manual clean
function in the API that will remove the tag on all prefabs of the same type. This is a use case we don't really need. I can't see the user wanting to unlink all of one prefab.
Should start writing some unit tests
Just a small addition. It would be nice to have a way to keep all PrimaryParts a single consistent color, as I always make them a hot pink so they're clearly visible. Having an option to make it the same color every time (instead of "eh close enough") would just be a nice little change I want to see
This would be a simple API that allows you to take an existing prefab and reassign its tag.
Usage:
_G.prefabs.rename("existing", "new-name")
Where every prefab that was registered with the name existing
will then be changed to new-name
. This change will also be applied to all prefabs with the same name.
Specifically with the Tag Editor plugin. Now that we have support for registering tags with it, we need a way to remove those tags when a prefab is renamed and its tag changes. This will likely be able to use the same functionality as #29
The terrain editor has a nice "pop" effect when you delete/paste. Having a similar effect when a prefab is updated/deleted could add some nice flair to the plugin
The plugin hosted on Roblox isn't up to date currently. Just give it a publish later: https://www.roblox.com/library/2163148532/Prefabs
Currently when you create a new model you have to manually tag it and add it to the folder where all your prefabs are.
This should be streamlined to allow the user to press a key or use a plugin button to quickly register the prefab. Registering would be a simple TextBox prompt to give it a name for the tag, and off it goes.
Just a simple plugin button that wraps registerSelection
We can simply make use of the Model icon and add a + for registering and a "sync" icon for update.
Currently, it's impossible to use prefabs inside of each other. The best you have is to copy/paste an existing prefab into a larger one, but that defeats the purpose of the reusability this plugin brings.
Allowing small compositional prefabs (trees, lamps, benches) to be used in larger models would be a welcome addition
The development flow should be the same as the UnicodeVisualizerPlugin:
The only thing we're missing is hot reloading, which would make development a much less painful experience. Our current workflow involves syncing in once, saving and exiting the place, and reloading the place for Local Plugins to reload everything.
Currently the user has no way to configure anything about how the plugin behaves.
What we release now is hands off enough where this is okay, but if we are to reintroduce the now removed functionality of making PrimaryParts invisible and disabling collisions on them, we would need an options menu.
It just needs to be a simple list, similar to Studio's settings menu with a name field and check box on the right. I think that'd be plenty for us for right now
Back when the prefab system was changed to use models instead of placeholder parts+models, I had to remove the option to modify an individual prefab (just in the form of changing its scale)
This was due to not having a way of associating configurable values with the cloned in prefabs, since the clone just erases the one that was there.
Adding back scale isn't much of a priority, but we do need a solution for being able to modify individual prefabs, especially if we want more per-prefab features in the.
Something like adding a Configuration
instance to a prefab in the workspace would be good. But making sure that doesn't get erased will be a little tricky, since right now we just clone a new copy of the source prefab each time an update occurs.
This is a matter of portability and instrusivness:
Some creators may have existing models they wish to convert to prefabs. These models may have a crucial visible PrimaryPart already defined in their model. Instead of encouraging wrapping these models with an ancestor Model, it would be nice if the Transparency + CanCollide off behavior was a configuration set by the developer.
Instead of giving Rename its own dedicated button, merge its functionality into Update so that when you change the name of a prefab, pressing Update will replicate that change.
These have been problematic since I started the plugin. They have a lot of issues currently, most notably #11. They also don't provide you any visuals unless you're viewing all your prefabs.
I think it would be much less problematic and overall a better experience if the placeholder parts were removed in favor of just copy/pasting prefabs around the map. When needed, these prefabs can then be swapped out for updated ones from a single source, like we're doing now (just without the placeholders).
A NumberValue could be added to any placeholder for a prefab. The value would determine how much the prefab gets scaled up/down when it's added to the workspace.
This would remove a lot of the uniformity with the current implementation, as all your models won't be the same size when added in.
It uses the value as a percentage of how much to change the scale, and will expand/contract away from or towards the placeholder, respectively (i.e. it won't scale towards the center, which would mess with the offset of its placement)
Currently, prefabs have to be stored in the Workspace to easily edit them. But this also means you have to fly all the way over to where your prefabs are, which is a major time sink.
The ideal setup is having your prefabs folder under ServerStorage and being able to quickly load a prefab at your camera to edit. After editing, you can choose to save or cancel your changes. Afterwards, if there were any saved changes, the prefab overrides the existing one in ServerStorage.
Mostly a reminder for myself so I actually write up some docs later
Right now you have to copy/paste prefabs around the map manually, either by finding an existing on in the workspace or using the base prefab in ServerStorage.
It would be a lot more convenient if you could insert a new copy of the prefab and have it follow the mouse to choose where you place it.
Currently the user has no feedback (other than some prints) when the action they performed succeeds.
It would be helpful to display a notification when an action is successfully completed, such as registering or updating a prefab.
Will this finally be the introduction of Roact?
When you have a part selected inside of a prefab and then update, if that prefab is a descendant of another, the ancestor prefab is the one that gets picked out and updated.
update
and updateWithSelection
are new additions which allow you to update a prefab (and all the existing clones) with a new model. Prior to this we've been using the toggle button (which should have been renamed to "refresh" a while back) which updates all prefab clones with the ones in ServerStorage.
This causes a massive slowdown in larger maps with lots of prefabs, as it has to update everything at once. The new update functions only update the single model, which is almost always more desirable.
#9 introduced a bug where placeholders can be deleted with no way to get them back. I'm not sure on the specifics of this yet but I'm thinking it's something to do with the the prefab-to-placeholder link getting broken in some way, leading to the plugin removing placeholders when it shouldn't.
For the time being I think it's safest to disable any deletion of placeholders, especially until we have ChangeHistoryService integration.
We now have support for creating the tags and tag groups for the Tag Editor plugin, but we don't have a method of cleaning that up yet.
Tack on support for deleting the TagList entries in the delete
APIs so that there's no tags lingering around when a prefab is removed.
There are times where you want to make variants of your prefabs. To do this currently you have to manually remove the existing prefab tag before you can register the prefab as a new one.
Stripping the tag would make it quick and easy to edit and register a variant of a prefab.
This will allow users to bind each button to a key combo, instead of having to click a button each time.
This will create an interface for the prefabs.insert
function.
It's very painful to insert a prefab as you have to know the name off hand, or you have to dig through ServerStorage to find the prefab you're looking for.
Needed features:
For later:
Right now you have to refresh every prefab in the entire game to get your changes synced.
Instead we should have a way to edit a prefab, and then update all prefabs of the same type with those changes.
The flow should be:
Expected result:
Actual result:
There's some internally that's wrong. We should be stripping any existing prefab tag and re-registering the model when the name doesn't match one with the same name.
Small quality of life change: being able to update all prefabs of the same type by selecting a descendant of the prefab you want to update.
Right now you have to make sure you select the prefab model when you update, otherwise it won't go through. While editing a model, you don't have the model itself selected. Being able to edit a prefab and update it without having to change selections would be a nice tedium fix
When you refresh prefabs and undo, all the existing prefabs are permanently destroyed and cannot be retrieved unless you have a backup.
We need a system in place to gracefully handle undoing changes to prefabs. Hopefully ChangeHistoryService will do the job on its own
This will give a proper interface to the prefabs.updateWithSelection
function.
It will essentially be the same thing as running the command, but you'll be able to press a button instead.
The Tag Editor is the defacto tool for dealing with CollectionService tags.
It exposes folders in ServerStorage where it keeps all of the tags it has access to. If the user has the plugin installed, we can retroactively add created prefab tags to this folder when registering new prefabs.
We can also create a group for the created tags so they don't clutter the user's existing tags.
When prefabs are shown, each one is cloned inside of the placeholder part that represents the prefab.
This is a bad practice for a number of reasons. The biggest problem is Roblox's default grabber tools in Studio can overlook the part and move only the model inside. This ends up repositioning the model, but the placeholder is still in its last position. When you toggle your prefabs, the one you moved ends up at its previous position unexpectedly.
Overall it's a hacky implementation and we can do better. The new proposed implementation will involve moving the placeholders out of the workspace, and using ObjectValues to map a prefab to its associated placeholder.
A problem with this implementation is we won't get movement for free. Moving a model while its shown will now always move it back to the placeholder position. You'll be forced to move the placeholder itself. This will need a separate issue to sync the model with the placeholder.
Showing:
Hiding:
Set the CFrame of each placeholder to the PrimaryPart CFrame of its associated model.
Clean up all the garbage from showing the prefabs.
If the ObjectValue's Value
is missing, delete the placeholder.
Remove the addition of changing CanCollide on placeholder parts (db4cbd5). Since they no longer exist in the workspace there's no need to mess around with their collisions.
This could come in the form of a bounding box above the placeholder that shows the size of the Model it represents.
Really anything to give a quick visual representation of what the placeholder is going to take up when switching to the prefab view.
I'm getting the following error when attempting to update a prefab with a descendant selected:
The prefab can be found here.
This might have to do with the sounds not being loaded initially, so when it goes to play them they may not load right away (especially on bad internet connections (like mine at home,,,,))
This can be remedied with the animation editor's code for inserting rigs:
function getCameraLookat(maxRange)
if maxRange == nil then maxRange = 10 end
local cam = game.Workspace:findFirstChild("Camera")
if cam then
local ray = Ray.new(cam.CFrame.p, cam.CFrame.lookVector * maxRange)
local hit, pos = game.Workspace:FindPartOnRay(ray)
cam.Focus = CFrame.new(pos)
return pos
else
--Default position if they did weird stuff
print("Unable to find default camera.")
return Vector3.new(0,5.2,0)
end
end
And using it like:
rig:MoveTo(getCameraLookat(10))
Where rig
would just be the prefab.
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.