[obsolete] Plugin to Collapse/Expand all folds in Explorer [warning: use at own risk!]

Update:


I’ve made a plugin that you can use to collapse/expand all Explorer widget folds in Studio, until they add this functionality to Studio by default.

Plugin

Features

  • Collapse:
    • If you have nothing selected, it will close all Explorer folds in the entire game (excluding Service folds).
    • If you have something selected, it will close all folds at/underneath those selected objects.
  • Expand:
    • If you have nothing selected, it will open all Explorer folds in the entire game.
    • If you have something selected, it will only open folds at/underneath those selected objects.


It also has shortcuts you can configure: (via File > Advanced > Customize Shortcuts…)

(Please note that this plugin banks on some hacks explained further down below and may break at any time.)

I hate that it has a toolbar, it takes up space…

Ok, you can disable the toolbar by dumping this in the Command Bar in Studio: (and then restart Studio)

game:GetService("CollectionService"):AddTag(
	Instance.new("BoolValue", game),
	"EXPLORER_FOLDS_TOOLBAR_OFF"
)

To re-enable: (no need to restart afterwards)

game:GetService("CollectionService"):AddTag(
	Instance.new("BoolValue", game),
	"EXPLORER_FOLDS_TOOLBAR_ON"
)

How does it work

The Explorer doesn’t have any sort of API attached to it, so we have to get a little creative.

To collapse hierarchies, we take advantage of the fact that the Explorer doesn’t remember the state of folds when you unparent the object from DataModel and then parent it back. (i.e. parent to nil and back) This is what the Collapse action uses. Unfortunately we cannot reparent Services, so we can only collapse folds within services.

To expand hierarchies, we abuse the fact that the Explorer automatically unfolds hierarchies up to the point of an instance you select. So to expand something, we search through the entire tree from that instance down, and we select (at least) 1 inner child of each branch of the hierarchy. Unfortunately the Explorer doesn’t update this immediately, so we need to wait some undetermined amount of time (I’ve made it 0.5 seconds, it’s possible that this can be tighter) before restoring the original selection that the user had before the operation. This means the expanding operation can unfortunately not be quite as instant as collapsing.

For expanding, I do some smart selection of objects to make sure that it selects the minimal amount of objects needed to fully expand a hierarchy, rather than selecting literally everything (this helps with performance due to the otherwise very high number of selection boxes and the large size of the selection).

Caveats (please read before using)

  • Expanding takes an extra brief moment of time (~0.5-1 second) and temporarily adds a lot of objects to your selection (it will restore your original selection right after)
  • Cannot collapse Services themselves if they have children that can’t be unparented (i.e. can collapse everything in Workspace, but cannot collapse Workspace itself, because Workspace always has a Terrain in it that can’t be unparented)
  • May cause a flicker of game window when collapsing
  • May cause a short freeze / cpu spike when using collapse or expand for large places
  • May interfere with plugins that do not expect certain game elements to be parented in/out of the DataModel
  • Explorer view may shift up/down erratically when using collapse or expand
  • May not work great in team create when multiple people are active at the same time [needs testing]
    • Collapse will affect all collaborators
    • Expand will temporarily cause a lot of instances to be selected which other collaborators can see too through your selection boxes
    • Collapse may cause replication issues in team create (because it reparents potentially a lot of stuff)
    • Collapse and expand may impact performance and briefly lag/freeze yourself and other collaborators (same as above)
    • When other collaborators are interacting with certain objects (dragging builds, writing scripts) collapsing may kick them out of that interaction and cause other weird effects, because of the instances being reparented

Use at your own risk! (in sessions where only 1 developer is active most/all of the time, this should be pretty safe)

Dear god what were you thinking

I’m sorry it had to be done (because I could)

For any staff members reading this

Please add built-in hotkeys / context menu items for mass-collapsing/expanding Explorer hierarchies!

Relevant feature request you can refer to: Ability to collapse all folds in explorer


Enjoy!

126 Likes

I’ve definitely been waiting for something like this, for awhile. Thank you!

3 Likes

Thank god for this, I’ve always had an issue with expanding folds and then not collapsing them again and then it becomes really messy. This plugin will be really helpful, thanks for this!

8 Likes

OwO, I feel the expanding feature is honestly not going to be used by me at least, but collapsing is golden given at the moment the only method I know of to collapse is restarting studio.

6 Likes

so… there are 3 ways of collapsing in explorer now?

  1. click whole day
  2. restart studio
  3. use this amazing plugin

I’m really thankful for this, you did a great job although just like @LuaBearyGood said, I don’t think expand is gonna be used that much, either way, this is a great plugin that will be used until roblox hopefully decides to add this as a feature and maybe after that too, thank you! :smiley:

8 Likes

I really hope this becomes a proper studio feature as it will greatly improve my studio experience and I am sure many other developers.

In the mean time though I will definitely be using this plugin as it will speed up my workflow because I wont have to waste time collapsing folds. Thank you for spending time making this plugin @buildthomas.

8 Likes

I’ve used that plugin hack and other uglier hacks, don’t worry :slight_smile:

4 Likes

Why this isn’t built in I don’t know; this might just be the single most useful plugin I ever get. Nice hack plugin!

3 Likes

omg don’t tell the roblox engineers about the noob explorer for not saving it’s current state in the history service

Great plugin, would of found use for this a while ago. Maybe in the future though!

Suggestion: make a toggle for it to just be local, it can get annoying if a team create where devs are changing properties in descendants and I just pull out this.

also can i steal your knowledge of studio

That’s impossible, it’s part of how this hack works. (see description of implementation) :slightly_smiling_face:

2 Likes

This plugin doesn’t seem to work for me. I see the shortcuts for it but it doesn’t appear in the plugins tab. Is it no longer supported?

Can’t reproduce, working in Studio currently and I can use it fine. Try reinstalling the plugin / restarting the place file or Studio.

If you’ve accidentally hidden the toolbar with the instructions in the first post, there are also instructions to undo it.

I was working as usual for a while, forgetting i had this plugin, and when I used it, everything indlucidng services desecentdants are gone. I couldn’t undo it also.

1 Like

For your place file, you can probably restore it from a previous version. I’m somewhat doubtful this plugin on its own was the cause of what you are describing, but happy to take a look if you have a clear repro case. Feel free to reply with one.

(Just fyi, this is labeled as “Use at your own risk!” and [hack] in the title)

It’s amazing, time-saving, and incredibly beneficial. Thank you very much.

I wish this were a feature, but I’ll use this amazing plugin until then. Thanks for the hack!

RTFM :slightly_smiling_face:

The post clearly states “use at your own risk”. Take it as a lesson that you should actually read posts before using the tools. The fault is entirely on yourself if you didn’t make a backup before using this, despite the warning and the “[hack]” in the title.

(For what it’s worth btw, I’ve never heard anyone else about any such major issues while using this tool.)

6 Likes

it’s clearly the post over me saying they lost all their stuff too

Read my previous response.

If you want better support, I recommend not burning bridges by starting your conversation with “screw you and your [creation I provided to you entirely for free]” next time. Tough luck.

2 Likes

This is amazing. I’ve been looking for something like this for a LONG time! Thank you for making this!