2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
title: Part dependencies
|
|
|
|
for: developers
|
|
|
|
about: Shows you how to create dependencies between pattern parts
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-08-25 16:16:51 +02:00
|
|
|
Part dependencies are set in the [pattern configuration](/reference/config), and
|
2021-08-25 16:09:31 +02:00
|
|
|
control the order in which parts are drawn. FreeSewing will make sure
|
|
|
|
that before drafting a part, it will first draft all its dependencies.
|
|
|
|
|
|
|
|
Let's look at an example:
|
|
|
|
|
|
|
|
```js
|
|
|
|
dependencies: {
|
|
|
|
front: "base",
|
|
|
|
back: "base",
|
|
|
|
sleeve: ["front", "back"]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-02-19 08:04:25 +01:00
|
|
|
This could be from a T-shirt pattern where the `front` and `back` patterns are very similar,
|
2021-08-25 16:09:31 +02:00
|
|
|
so they both are inheriting a `base` part.
|
|
|
|
In addition, the `sleeve` part needs to be drafted after the `front` and `back` part because
|
2021-08-25 16:16:51 +02:00
|
|
|
in `front` and `back` we store the length of the armhole seam in the [store](/reference/api/store) and
|
2021-08-25 16:09:31 +02:00
|
|
|
we need that info to fit the sleevecap to the armhole.
|
|
|
|
|
|
|
|
Now if a user requests to draft only the `sleeve` part, FreeSewing will still draft:
|
|
|
|
|
2022-02-19 08:04:25 +01:00
|
|
|
- First the `base` part
|
|
|
|
- Then the `front` and `back` parts
|
|
|
|
- Finally the `sleeve` part
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
but it will only render the `sleeve` part, as that's the only thing the user requested.
|
|
|
|
|
|
|
|
<Note>
|
|
|
|
|
2021-08-25 16:16:51 +02:00
|
|
|
For inheriting parts, please refer to [part inheritance](/howtos/code/inject/).
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
</Note>
|