1
0
Fork 0

wip(core/brian/aaron): Support for 2022 style part inheritance

This is very rough around the edges, but it's kinda working, so
I'm committing this now.

What this enabled is the ability to extend a part by importing
only that part and then just saying you want a part `from` the
imported one.

The imported part comes with all options, it does not currently
come with all measurements.

This also *follows* dependencies. For example in Brian, we never
explicitly add the base and sleevecap parts, they are simply
added automatically because other parts are buily *from* them.

Best to look at the source code of designs/brian and designs/aaron
to understand what's going on and how it is different.
This commit is contained in:
joostdecock 2022-08-09 20:17:35 +02:00
parent ac9b616b99
commit 70bd946bdc
18 changed files with 1306 additions and 1109 deletions

View file

@ -384,3 +384,7 @@ export const generatePartTransform = (x, y, rotate, flipX, flipY, part) => {
}
}
/*
* Makes sure an object passed to be attached as a part it not merely a method
*/
export const decoratePartDependency = (obj, name) => (typeof obj === 'function') ? { draft: obj, name } : obj