Added nesting to Merge/Fork/Subsection

This commit is contained in:
n1073645 2022-06-17 09:17:28 +01:00
parent 54fdc05e3a
commit fc91469807
6 changed files with 146 additions and 8 deletions

View file

@ -65,12 +65,21 @@ class Fork extends Operation {
if (input)
inputs = input.split(splitDelim);
// Set to 1 as if we are here, then there is one, the current one.
let numOp = 1;
// Create subOpList for each tranche to operate on
// (all remaining operations unless we encounter a Merge)
// all remaining operations unless we encounter a Merge
for (i = state.progress + 1; i < opList.length; i++) {
if (opList[i].name === "Merge" && !opList[i].disabled) {
break;
numOp--;
if (numOp === 0 || opList[i].ingValues[0])
break;
else
// Not this Fork's Merge.
subOpList.push(opList[i]);
} else {
if (opList[i].name === "Fork" || opList[i].name === "Subsection")
numOp++;
subOpList.push(opList[i]);
}
}

View file

@ -20,10 +20,16 @@ class Merge extends Operation {
this.name = "Merge";
this.flowControl = true;
this.module = "Default";
this.description = "Consolidate all branches back into a single trunk. The opposite of Fork.";
this.description = "Consolidate all branches back into a single trunk. The opposite of Fork. Unticking the Merge All checkbox will only consolidate all branches up to the nearest Fork/Subsection.";
this.inputType = "string";
this.outputType = "string";
this.args = [];
this.args = [
{
name: "Merge All",
type: "boolean",
value: true,
}
];
}
/**

View file

@ -67,12 +67,21 @@ class Subsection extends Operation {
subOpList = [];
if (input && section !== "") {
// Set to 1 as if we are here, then there is one, the current one.
let numOp = 1;
// Create subOpList for each tranche to operate on
// all remaining operations unless we encounter a Merge
for (let i = state.progress + 1; i < opList.length; i++) {
if (opList[i].name === "Merge" && !opList[i].disabled) {
break;
numOp--;
if (numOp === 0 || opList[i].ingValues[0])
break;
else
// Not this subsection's Merge.
subOpList.push(opList[i]);
} else {
if (opList[i].name === "Fork" || opList[i].name === "Subsection")
numOp++;
subOpList.push(opList[i]);
}
}