YamlObject FromPreCompLayer(PreCompLayer layer, YamlMap superclassContent)
        {
            var result = superclassContent;

            result.Add("Width", layer.Width);
            result.Add("Height", layer.Height);
            result.Add("RefId", layer.RefId);
            return(result);
        }
예제 #2
0
        // Constructs a context for the given layer.
        internal TranslationContext(TranslationContext context, PreCompLayer layer, LayerCollection layers)
        {
            Layer = layer;

            // Precomps define a new temporal and spatial space.
            Width     = layer.Width;
            Height    = layer.Height;
            StartTime = context.StartTime - layer.StartTime;

            ContainingContext = context;
            Layers            = layers;
            DurationInFrames  = context.DurationInFrames;
        }
예제 #3
0
        internal PreCompLayerContext(CompositionContext compositionContext, PreCompLayer layer)
            : base(compositionContext, layer)
        {
            Layer = layer;

            var referencedLayers = GetLayerCollectionByAssetId(this, layer.RefId);

            // Precomps define a new temporal and spatial space for their child layers.
            ChildrenCompositionContext = new CompositionContext(
                compositionContext,
                referencedLayers,
                size: new Sn.Vector2((float)layer.Width, (float)layer.Height),
                startTime: compositionContext.StartTime - layer.StartTime,
                durationInFrames: compositionContext.DurationInFrames);
        }
예제 #4
0
        XElement FromPreCompLayer(PreCompLayer layer)
        {
            return(new XElement("PreComp", GetContents()));

            IEnumerable <XObject> GetContents()
            {
                foreach (var item in GetLayerContents(layer))
                {
                    yield return(item);
                }

                yield return(new XAttribute(nameof(layer.Width), layer.Width));

                yield return(new XAttribute(nameof(layer.Height), layer.Height));

                if (!string.IsNullOrWhiteSpace(layer.RefId))
                {
                    yield return(new XAttribute(nameof(layer.RefId), layer.RefId));
                }
            }
        }
예제 #5
0
 public PreCompLayerContext CreateLayerContext(PreCompLayer layer) => new PreCompLayerContext(this, layer);