setzer22 / blackjack

A procedural, node-based modelling tool, made in rust 🦀
Mozilla Public License 2.0
1.42k stars 64 forks source link

"Import Jack" node #53

Open novhack opened 2 years ago

novhack commented 2 years ago

I really love the latest work that has been done on Blackjack. I think it's currently missing an ability to import one blackjack project as a node to a different blackjack project. I think the most straightforward approach would be to use Jack files and expose their promoted parameters as inputs.

Since it introduces dependencies it would be cool if it was then possible to export Jack files which would bundle in all other Jack files which were imported. Or maybe include relative paths to those Jack files.

setzer22 commented 2 years ago

I agree that Blackjack currently lacks a mechanism for modularity, this has been on my radar for quite a while now. What you are describing is similar to the role HDAs play in Houdini. There are other related features that I'd like to be part of this:

I need to think about the best way to tackle this, but I think it is one of the major topics I could prioritize after I finish with the next big update (gizmos).

An "Import jack" node would, as of today, be a bit of a hack. I'm not against adding it, but only as a temporary solution: Jack files only contain compiled code, so I wouldn't be able to implement the other features I'm describing on top of that node.

novhack commented 2 years ago

I agree with any kind of modularity. Would it be possible to save encapsulated nodes as a separate project? Or import a project into another project as a node/group of nodes? I proposed to use Jack format mainly because inputs are clearly defined in it but if it was possible to import .blj projects and use promoted parameters as inputs as well I would like that too.

setzer22 commented 2 years ago

Would it be possible to save encapsulated nodes as a separate project?

With the rework I have in mind, that would be equivalent to saving a game asset: I need to give this a bit more thought, but I'm currently leaning towards unifying the blj file format and the current bga (blackjack game asset). The separation is not very useful in practice, and this would allow engine integrations to offer more features.

So, we'll add the ability to encapsulate nodes as an embedded subgraph, or splitting them out in multiple files. The former is better for when you just want modularity / composability, and the latter would be for when you want to reuse a jack across multiple projects.

I proposed to use Jack format mainly because inputs are clearly defined in it but if it was possible to import .blj projects and use promoted parameters as inputs as well I would like that too.

Yeah, the two file formats are currently serving two slightly different purposes. I still do not have a serious solution for serialization in blackjack. I've been mainly relying on dumping struct information via serde, but that makes having a proper data migration system very difficult. So my plan is to create a new file format, one that is a bit more hand-crafted and built with forward & backward compatibility in mind. This will replace the existing blj and double-up as the way to export Jacks to game engines.

Unlike other proprietary 3d applications, Blackjack has nothing to hide, :slightly_smiling_face: so there's no need to store obscured compiled outputs and split project and export files in different file formats.

setzer22 commented 2 years ago

After the merge in #62, there is now a single serialization format .bjk just as I described above :+1: