c6fbedc507
Observed AE layer parenting semantics: * layers are flagged as either 2D or 3D * camera applies to 3D layers, but not to 2D layers * parented 3D layers treat their ancestor transform chain as 3D (SkMatrix44) * parented 2D layers treat their ancestor transform chain as 2D (SkMatrix, ignoring 3D components) This means that for a given layer, we may need to build two distinct transform chains - depending on the type of descendant layer being considered. Furthermore, transforms are animatable and their animators are scoped to a layer controller. Since we're potentially building two version of the transform node, we need to ensure all animators for both of them are transferred to controller object (we still want to only instantiate a single layer controller and render tree to avoid duplication). IOW, all dependent layer transforms need to be considered before "sealing off" a given layer controller. In order to avoid a layer dependency/topological sort, we can split off the transform tree construction into a separate pass. High-level changes: -- replace existing LayerAttachContext with CompositionBuilder (holds LayerBuilders and other Composition-wide state) -- replace LayerRec with LayerBuilder (holds Layer-wide state and also caches transform nodes) -- pass 1: for each LayerBuilder, transitively build and cache a transform chain of a type (2d/3d) determined by the leaf (entry point) layer -- pass 2: for each LayerBuilder, build the actual layer content render tree and instantiate the layer controller objects Bug: skia:8914 Change-Id: I9f7efcf4819424282fd3dda98f5621ba12fd001b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251001 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
1 line
5.6 KiB
JSON
1 line
5.6 KiB
JSON
{"v":"5.5.5","fr":60,"ip":0,"op":301,"w":500,"h":500,"nm":"3d parenting","ddd":1,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,250,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"sr","sy":1,"d":1,"pt":{"a":0,"k":9,"ix":3},"p":{"a":0,"k":[0,0],"ix":4},"r":{"a":0,"k":0,"ix":5},"ir":{"a":0,"k":50,"ix":6},"is":{"a":0,"k":0,"ix":8},"or":{"a":0,"k":15,"ix":7},"os":{"a":0,"k":0,"ix":9},"ix":1,"nm":"Polystar Path 1","mn":"ADBE Vector Shape - Star","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.872441768646,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":300,"s":[360]}],"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[100,150],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"st","c":{"a":0,"k":[0.480912983418,0.342815577984,0.959742665291,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":5,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.581096827984,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":301,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":13,"nm":"Camera 1","sr":1,"pe":{"a":0,"k":1066.667,"ix":1},"ks":{"a":{"a":0,"k":[250,250,0],"ix":1},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":0,"s":[250,250,-1066.667],"to":[-41.667,83.333,61.111],"ti":[-41.667,-83.333,-61.111]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":90,"s":[0,750,-700],"to":[41.667,83.333,61.111],"ti":[-41.667,83.333,61.111]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":210,"s":[500,750,-700],"to":[41.667,-83.333,-61.111],"ti":[41.667,83.333,61.111]},{"t":300,"s":[250,250,-1066.667]}],"ix":2},"or":{"a":0,"k":[0,0,0],"ix":7},"rx":{"a":0,"k":0,"ix":8},"ry":{"a":0,"k":0,"ix":9},"rz":{"a":0,"k":0,"ix":10}},"ip":0,"op":301,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":0,"nm":"2d -> no parent","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[100,150,0],"ix":2},"a":{"a":0,"k":[250,250,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":500,"h":500,"ip":0,"op":301,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":3,"nm":"3d null","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,250,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"ip":0,"op":301,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":0,"nm":"2d -> 3d null","parent":3,"refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,-100,0],"ix":2},"a":{"a":0,"k":[250,250,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":500,"h":500,"ip":0,"op":301,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":0,"nm":"2d -> 3d layer","parent":6,"refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[550,50,0],"ix":2},"a":{"a":0,"k":[250,250,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":500,"h":500,"ip":0,"op":301,"st":0,"bm":0},{"ddd":1,"ind":6,"ty":0,"nm":"3d -> no parent","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"rx":{"a":0,"k":0,"ix":8},"ry":{"a":0,"k":0,"ix":9},"rz":{"a":0,"k":0,"ix":10},"or":{"a":0,"k":[0,0,0],"ix":7},"p":{"a":0,"k":[100,350,0],"ix":2},"a":{"a":0,"k":[250,250,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":500,"h":500,"ip":0,"op":301,"st":0,"bm":0},{"ddd":0,"ind":7,"ty":3,"nm":"2d null","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,250,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"ip":0,"op":301,"st":0,"bm":0},{"ddd":1,"ind":8,"ty":0,"nm":"3d -> 2d null","parent":7,"refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"rx":{"a":0,"k":0,"ix":8},"ry":{"a":0,"k":0,"ix":9},"rz":{"a":0,"k":0,"ix":10},"or":{"a":0,"k":[0,0,0],"ix":7},"p":{"a":0,"k":[0,100,0],"ix":2},"a":{"a":0,"k":[250,250,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":500,"h":500,"ip":0,"op":301,"st":0,"bm":0},{"ddd":1,"ind":9,"ty":0,"nm":"3d -> 2d layer","parent":2,"refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"rx":{"a":0,"k":0,"ix":8},"ry":{"a":0,"k":0,"ix":9},"rz":{"a":0,"k":0,"ix":10},"or":{"a":0,"k":[0,0,0],"ix":7},"p":{"a":0,"k":[550,450,0],"ix":2},"a":{"a":0,"k":[250,250,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":500,"h":500,"ip":0,"op":301,"st":0,"bm":0},{"ddd":0,"ind":10,"ty":1,"nm":"Light Gray Solid 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,250,0],"ix":2},"a":{"a":0,"k":[250,250,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"sw":500,"sh":500,"sc":"#c8c8c8","ip":0,"op":301,"st":0,"bm":0}],"markers":[]} |