Mantis - Croquet
Viewing Issue Advanced Details
979 Any feature always 03-15-05 19:42 03-15-05 19:44
0000979: enhancement: a means to map over frames outside of rendering
The rendering code maps over the hierarchy of frames. As it recurses, it provides for "instancing" of frames, whereby the same frame instance can appear as children of multiple parents. For example, it sets the frameParent and the global position of the frame and its boundSphere.

However, it's dangerous to include application code within rendering, just for the purpose of having this stuff taken care of for us. An error during rendering produces nasty loops and is difficult to debug. Also, it is not easy to arrange for all such activity to be handled during rendering. Consider, for example, application code that needs to examine the frame hierarchy during an event handler.
The attached changeset provides a TFrame>>mapFrame:parent: that does the same traversal and setup as is done during rendering, and evaluates a given block for each frame. The changeset also has a #mapFrame:parent:postChildrenBlock:, whose extra argument is an additional block that can be used, for example, to pop something pushed during the block evaluated for the node itself.
 mapFrame.cs [^] (2,294 bytes) 03-15-05 19:42

03-15-05 19:44   
See also issue 978, which provides collision detection code that I used within a block that I gave to #mapFrame:parent:.