boom: Breaking changes to config format for freesewing v0.22
This commit is contained in:
parent
018fe170a6
commit
248572a0d7
3 changed files with 22 additions and 33 deletions
|
@ -11,6 +11,21 @@ export default {
|
|||
"shoulderToWrist",
|
||||
"wristCircumference"
|
||||
],
|
||||
dependencies: {
|
||||
back: "base",
|
||||
front: "back",
|
||||
sleevecap: "front",
|
||||
sleeve: "sleevecap"
|
||||
},
|
||||
inject: {
|
||||
back: "base",
|
||||
front: "back",
|
||||
sleeve: "sleevecap"
|
||||
},
|
||||
hide: [
|
||||
"base",
|
||||
"sleevecap"
|
||||
],
|
||||
options: {
|
||||
// Constants
|
||||
brianFitSleeve: true,
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
<script type="text/javascript" src="node_modules/@freesewing/models/dist/browser.js"></script>
|
||||
<script type="text/javascript" src="node_modules/@freesewing/antman/dist/browser.js"></script>
|
||||
<script>
|
||||
console.log('adding hooks to pattern');
|
||||
//console.log('adding hooks to pattern');
|
||||
var pattern = new freesewing.patterns.brian();
|
||||
console.log('pattern', pattern);
|
||||
//console.log('pattern', pattern);
|
||||
pattern.with(freesewing.plugins.debug)
|
||||
//pattern.with(freesewing.plugins.validate)
|
||||
// pattern.with(freesewing.plugins.theme)
|
||||
//pattern.with(freesewing.plugins.designer)
|
||||
//pattern.with(freesewing.plugins.i18n)
|
||||
console.log('pattern after', pattern);
|
||||
// console.log('pattern after', pattern);
|
||||
|
||||
//pattern.on('postSample', function(next) {
|
||||
// console.log('postSample hook');
|
||||
|
@ -69,8 +69,8 @@ console.log('adding hooks to pattern');
|
|||
// focus: 'manSize34',
|
||||
// models: freesewing.models.men
|
||||
//}
|
||||
//pattern.settings.nly= ['base'];
|
||||
pattern.options.lengthBonus = 0.15;
|
||||
//pattern.settings.only= 'sleeve';
|
||||
//pattern.options.lengthBonus = 0.15;
|
||||
//pattern.options.brianFitCollar = false;
|
||||
//pattern.sampleOption('shoulderSlopeReduction');
|
||||
//pattern.sampleMeasurement('shoulderSlope');
|
||||
|
|
|
@ -8,45 +8,19 @@ import front from "./front";
|
|||
import sleevecap from "./sleevecap";
|
||||
import sleeve from "./sleeve";
|
||||
|
||||
// Constructor boilerplate
|
||||
const Brian = function(settings = false) {
|
||||
// Make this a new freesewing.Pattern instance
|
||||
freesewing.Pattern.call(this, { version: version, ...config });
|
||||
// Load plugins
|
||||
this.with(pluginBundle);
|
||||
// Merge settings passed to the constructor
|
||||
if (settings !== false) this.mergeSettings(settings);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// Setup inheritance
|
||||
// Inheritance boilerplate
|
||||
Brian.prototype = Object.create(freesewing.Pattern.prototype);
|
||||
Brian.prototype.constructor = Brian;
|
||||
|
||||
// Draft method
|
||||
Brian.prototype._draft = function() {
|
||||
this.parts.base = this.draftBase(this.createPart());
|
||||
if (!this.needs("base", true)) this.parts.base.render = false;
|
||||
if (this.needs(["back", "front", "sleeve", "sleevecap"])) {
|
||||
this.parts.back = this.draftBack(this.createPart().copy(this.parts.base));
|
||||
}
|
||||
if (this.needs(["front", "sleeve", "sleevecap"])) {
|
||||
this.parts.front = this.draftFront(this.createPart().copy(this.parts.back));
|
||||
}
|
||||
if (this.needs(["sleeve", "sleevecap"])) {
|
||||
this.parts.sleevecap = this.draftSleevecap(this.createPart());
|
||||
// Don't render sleevecap unless specifically requested
|
||||
if (!this.needs("sleevecap", true)) this.parts.sleevecap.render = false;
|
||||
}
|
||||
if (this.needs("sleeve")) {
|
||||
this.parts.sleeve = this.draftSleeve(
|
||||
this.createPart().copy(this.parts.sleevecap)
|
||||
);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// Per-part draft methods
|
||||
Brian.prototype.draftBase = function(part) {
|
||||
return base.draft(part);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue