public void addRetained(EngineLayer retainedLayer) { D.assert(retainedLayer is _EngineLayerWrapper); D.assert(() => { _EngineLayerWrapper layer = retainedLayer as _EngineLayerWrapper; void recursivelyCheckChildrenUsedOnce(_EngineLayerWrapper parentLayer) { _debugCheckUsedOnce(parentLayer, "retained layer"); parentLayer._debugCheckNotUsedAsOldLayer(); if (parentLayer._debugChildren == null || parentLayer._debugChildren.isEmpty()) { return; } parentLayer._debugChildren.ForEach(recursivelyCheckChildrenUsedOnce); } recursivelyCheckChildrenUsedOnce(layer); return(true); }); _EngineLayerWrapper wrapper = retainedLayer as _EngineLayerWrapper; SceneBuilder_addRetained(_ptr, wrapper._ptr); }
bool _debugCheckUsedOnce(EngineLayer layer, string usage) { D.assert(() => { if (layer == null) { return(true); } D.assert( !_usedLayers.ContainsKey(layer), () => $"Layer {layer.GetType()} already used.\n" + $"The layer is already being used as {_usedLayers[layer]} in this scene.\n" + "A layer may only be used once in a given scene."); _usedLayers[layer] = usage; return(true); }); return(true); }
/// Add a retained engine layer subtree from previous frames. /// /// All the engine layers that are in the subtree of the retained layer will /// be automatically appended to the current engine layer tree. /// /// Therefore, when implementing a subclas of the [Layer] concept defined in /// the rendering layer of Flutter's framework, once this is called, there's /// no need to call [addToScene] for its children layers. public EngineLayer addRetained(EngineLayer retainedLayer) { // native 'SceneBuilder_addRetained'; return(null); // Tmp to resolve build }