move animate button generation to the right spot

This commit is contained in:
Stewart Allen 2022-02-14 16:00:17 -05:00
commit 214fcec348

View file

@ -140,15 +140,13 @@
api.event.on("preview.end", () => {
isParsed = false;
if (isCamMode && camStock) {
STACKS.getStack("bounds").button("animate", animate);
}
});
api.event.on("code.loaded", (info) => {
if (isCamMode && camStock) {
isParsed = true;
STACKS.getStack("parse", SPACE.world).button("animate", animate);
let parse = STACKS.getStack("parse", SPACE.world);
if (parse) parse.button("animate", animate);
}
});
@ -1255,6 +1253,9 @@
if (x && y && z && !STACKS.getStack('bounds')) {
const render = new KIRI.Layers().setLayer('bounds', { face: 0xaaaaaa, line: 0xaaaaaa });
const stack = STACKS.setFreeMem(false).create('bounds', SPACE.world);
if (isCamMode && camStock) {
stack.button("animate", animate);
}
stack.add(render.addPolys([
newPolygon().centerRectangle({x:csox, y:csoy, z:0}, x, y),
newPolygon().centerRectangle({x:csox, y:csoy, z}, x, y)