Skip to content

Commit

Permalink
remove variationsEnabled check in addVariations()
Browse files Browse the repository at this point in the history
- there’s nothing wrong with a flag for this, but here is the wrong place
  • Loading branch information
Lorp committed Nov 8, 2024
1 parent df56989 commit cf1b4c0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/samsa-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2916,11 +2916,10 @@ class SamsaBuffer extends DataView {
// - adds the variation deltas to the operands
// - the arrow function keeps "this" (the buffer) in scope
const addVariations = (operands) => {
const variationsEnabled = true;
if (!variationsEnabled || paint.format % 2 == 0 || operands.length == 0) // variations enabled; only odd-numbered paint formats have variations; we need operands
if (paint.format % 2 === 0) // only odd-numbered paint formats have variations; we need operands
return;
const varIndexBase = this.u32; // we must read this even if we don’t have an instance, otherwise reading gets out of sync
if (varIndexBase == 0xffffffff || !context.instance) // no variations for this paint; we need an instance
if (operands.length === 0 || varIndexBase === 0xffffffff || !context.instance) // we need operands; no variations for this paint; we need an instance
return;
const deltas = context.instance.deltaSets["COLR"];
for (let i=0; i<operands.length; i++) {
Expand Down

0 comments on commit cf1b4c0

Please sign in to comment.