Pictures in a 3d rendering context are re-parented during flattening, to ensure correct ordering during plane splitting when un-transformed content is present. Previously, we determined the spatial node index based on the re-parented hierarchy, and this complicated local rect calculation for items inside a 3d rendering context. For these, we needed to retain the original spatial node index and do extra calculations. Now, we determine the correct spatial node index during flattening, and store it inside each primitive directly (rather than via the primitive runs inside a picture). This greatly simplifies the process of accumulating a local rect for a picture as we recurse through the picture tree - allowing pictures inside a 3d context to be processed just as any normal primitives are. This simplifies some upcoming work to rasterize pictures in local space, and is also a small optimization that reduces the number of local rects we need to build and transform.