@@ -62,7 +62,7 @@ private protected Layer(in LayerArgs args)
6262 /// <summary>
6363 /// Gets the list of masks appplied to the layer.
6464 /// </summary>
65- public IReadOnlyList < Mask > Masks { get ; set ; }
65+ public IReadOnlyList < Mask > Masks { get ; }
6666
6767 /// <summary>
6868 /// Gets the frame at which this <see cref="Layer"/> becomes invisible. <see cref="OutPoint"/>.
@@ -123,6 +123,46 @@ public ref struct LayerArgs
123123 public MatteType LayerMatteType { get ; set ; }
124124 }
125125
126+ public LayerArgs CopyArgs ( )
127+ {
128+ return new LayerArgs
129+ {
130+ Name = Name ,
131+ Index = Index ,
132+ Parent = Parent ,
133+ IsHidden = IsHidden ,
134+ Transform = Transform ,
135+ TimeStretch = TimeStretch ,
136+ StartFrame = InPoint ,
137+ InFrame = InPoint ,
138+ OutFrame = OutPoint ,
139+ BlendMode = BlendMode ,
140+ Is3d = Is3d ,
141+ AutoOrient = AutoOrient ,
142+ LayerMatteType = LayerMatteType ,
143+ Effects = Effects ,
144+ Masks = Masks ,
145+ } ;
146+ }
147+
148+ protected LayerArgs GetArgsWithIndicesChanged ( int index , int ? parentIndex )
149+ {
150+ var args = CopyArgs ( ) ;
151+ args . Index = index ;
152+ args . Parent = parentIndex ;
153+ return args ;
154+ }
155+
156+ protected LayerArgs GetArgsWithTimeOffset ( double shiftValue )
157+ {
158+ var args = CopyArgs ( ) ;
159+ args . Transform = ( Transform ) args . Transform . WithTimeOffset ( shiftValue ) ;
160+ args . StartFrame += shiftValue ;
161+ args . InFrame += shiftValue ;
162+ args . OutFrame += shiftValue ;
163+ return args ;
164+ }
165+
126166 public enum LayerType
127167 {
128168 PreComp ,
@@ -139,5 +179,20 @@ public enum MatteType
139179 Add ,
140180 Invert ,
141181 }
182+
183+ /// <summary>
184+ /// Make a copy of the layer and change its index and parent index.
185+ /// </summary>
186+ /// <param name="index">Index to be set.</param>
187+ /// <param name="parentIndex">Parent index to be set.</param>
188+ /// <returns>Layer copy with changed indices.</returns>
189+ public abstract Layer WithIndicesChanged ( int index , int ? parentIndex ) ;
190+
191+ /// <summary>
192+ /// Make a copy of the layer and offset all frames by some value.
193+ /// </summary>
194+ /// <param name="offset">Offset value.</param>
195+ /// <returns>Layer copy with offsetted frames.</returns>
196+ public abstract Layer WithTimeOffset ( double offset ) ;
142197 }
143198}
0 commit comments