Acts as a container for the root of the Box graph. Declares Dict.Prop that pertain to the graph as a whole. Provides an entry point for the Runloop into the graph for animation updates.
| 21 | * Acts as a container for the root of the Box graph. Declares Dict.Prop that pertain to the graph as a whole. Provides an entry point for the Runloop into the graph for animation updates. |
| 22 | */ |
| 23 | public class Boxes { |
| 24 | |
| 25 | static public final Dict.Prop<Box> root = new Dict.Prop<>("root").type() |
| 26 | .toCanon() |
| 27 | .doc("the root of the box graph") |
| 28 | .set(Dict.readOnly, true); |
| 29 | static public final Dict.Prop<FieldBoxWindow> window = new Dict.Prop<>("window") |
| 30 | .doc("the FieldBoxWindow that this graph is currently in") |
| 31 | .set(Dict.readOnly, true); |
| 32 | static public final Dict.Prop<Map<String, Supplier<Boolean>>> insideRunLoop = |
| 33 | new Dict.Prop<>("_insideRunLoop").set(Dict.readOnly).autoConstructs(() -> new IdempotencyMap<Supplier<Boolean>>(Supplier.class)); |
| 34 | |
| 35 | static public final Dict.Prop<Boolean> dontSave = new Dict.Prop<>("dontSave").type() |
| 36 | .toCanon() |
| 37 | .doc("set this to true to cause this box to not be saved with the box graph"); |
| 38 | static public final Dict.Prop<String> tag = new Dict.Prop<>("tag").type() |
| 39 | .toCanon() |
| 40 | .doc("Facilitates box creation in an idempotent style'internal name' for boxes. <code>new _('tag', {})</code> will either create a box with tag <code>'tag'</code> (as a child of " + |
| 41 | "<code>_</code> or return an existing box with this tag "); |
| 42 | |
| 43 | static { |
| 44 | IO.persist(tag); |
| 45 | } |
| 46 | |
| 47 | |
| 48 | Box origin; |
| 49 | |
| 50 | public Boxes() { |
| 51 | origin = new Box(); |
| 52 | origin.properties.put(root, origin); |
| 53 | origin.properties.put(Box.name, "<<root>>"); |
| 54 | |
| 55 | origin.properties.put(Planes.plane, "__root__"); |
| 56 | |
| 57 | InverseDebugMapping.defaultRoot = origin; |
| 58 | |
| 59 | // set these up so that they will appear in autocomplete |
| 60 | |
| 61 | origin.properties.getOrConstruct(Callbacks.onDelete); |
| 62 | origin.properties.getOrConstruct(Callbacks.onLoad); |
| 63 | origin.properties.getOrConstruct(Callbacks.onFrameChanged); |
| 64 | |
| 65 | origin.properties.getOrConstruct(Commands.command); |
| 66 | origin.properties.getOrConstruct(Commands.commandDoc); |
| 67 | } |
| 68 | |
| 69 | protected Set<Box> population = Collections.emptySet(); |
| 70 | |
| 71 | |
| 72 | protected Scene.Perform updater = new Scene.Perform() { |
| 73 | @Override |
| 74 | public boolean perform(int pass) { |
| 75 | |
| 76 | origin.forEach( |
| 77 | // turns out, this is something on the order of 20mb a second of garbage at full framerate. |
| 78 | // origin.find(insideRunLoop, origin.both()) |
| 79 | // .forEach( |
| 80 | y -> { |