Export blocks with dependencies

This might be a big ask. Would it be possible to add to the "Export blocks" menu an additional option to export the selected blocks with their dependencies (i.e. recursively including any custom blocks the selected blocks use internally). For example, if I have custom blocks A, B, C, and D with the following definitions:

Definition of 'custom block A'; a single call to 'custom block B'

Definition of 'custom block B'; a single call to 'custom block C'

Definition of 'custom block C'; a single call to say [Hello])

Definition of 'custom block C'; a single call to say [Howdy]

exporting custom block A with dependencies would include blocks A, B, and C in the export.

Right now, I think this could be done in a roundabout way by duplicating/exporting the project, removing all blocks from the scripting area for every sprite, dragging in only the block(s) that should be exported with dependencies, removing unused blocks, and then exporting all blocks in the project. I would love if there was a more direct route to accomplish this!

There shouldn't be another option; plain old "Export blocks" should export the transitive closure of the blocks you select. That's pretty high on my list. Jens agrees in principle but doesn't see it as urgent; this is one of the things we argue about. (It's funny; we're the best of friends, but when we get together you'd think all we do is argue.)

Just adding to this request

I wanted to just add the deal APL libary block to a project without the rest of the lib but when I exported that block only and then imported it into my project it doesn't work because of missing blocks its depends on.

I have realised, as I'm typing this, that I may end up a lot of other APL blocks anyway due to the blocks the deal block depends on -and the ones they depend on etc etc :slight_smile:

In the current dev version, you can right-click on a block and ask to export it along with all its dependencies. But if you want two blocks and all their dependencies, you're out of luck. I don't understand at all why Jens is so adamant about this, and what's more he gets absolutely furious if I try to discuss it. I guess you can export them all separately and then load them all into a fresh project and then export all the blocks from that. :~(

P.S. Jens points out that there's another thing you can do: Load the library into an empty project, then drag the blocks you want to keep into the scripting area, then select "Unused blocks" from the file menu and you'll be left with the desired blocks and their transitive closure. But that isn't very discoverable.

1 Like