Add hue cycle and rotation buttons
[SugarCubes.git] / DanUtil.pde
index 859b5187b709c80858fabd34b6bb51a2ac3aadfc..6f4b0008485891d1a75ddbb05170d6c4e99cbc64 100644 (file)
@@ -227,7 +227,8 @@ public class DPat extends SCPattern
        void            StartRun(double deltaMs)                        {                                                               }
        color           CalcPoint(xyz p)                                        { return lx.hsb(0,0,0);                         }
        boolean         IsActive()                                                      { return this == DG.CurPat;                                                                                             }
-       boolean         IsFocused()                                                     { return this == midiEngine.getFocusedDeck().getActivePattern();                }
+       boolean         IsFocused()                                                     { return midiEngine != null && midiEngine.getFocusedDeck() != null &&
+                                                                                                                        this == midiEngine.getFocusedDeck().getActivePattern();                }
        void            onInactive()                                            { UpdateState(); }
        void            onActive  ()                                            { UpdateState(); StartPattern(); }
        void            UpdateState()                                           { if (IsFocused() != IsActive()) { if (IsFocused()) DG.Activate(this); else DG.Deactivate(this); } }
@@ -430,6 +431,7 @@ class dLattice {
                        s.v1 = new dVertex(s,strip.points.get(15));
                        s.v0.setOpp(s.v1); s.v1.setOpp(s.v0);
                        if (col < NumBackTowers) DQ[col][row] = 16*floor((iTowerStrips-1)/16);
+                       else s.row=-1;
                }
 
                for (int j=0; j<iTowerStrips; j++) { for (int k=j+1; k<iTowerStrips; k++) {