Skip to content

Commit

Permalink
Fix export bug when all are invisible
Browse files Browse the repository at this point in the history
  • Loading branch information
ruskakimov committed Aug 16, 2021
1 parent c6de091 commit f948666
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/common/data/project/composite_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ class CompositeImage with EquatableMixin {
}) : assert(layers
.every((image) => image.height == height && image.width == width));

CompositeImage.empty({
required this.width,
required this.height,
}) : layers = [];

final int width;
final int height;

Expand Down
12 changes: 10 additions & 2 deletions lib/common/data/project/scene.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class Scene extends TimeSpan {
Iterable<SceneLayer> get visibleLayers =>
layers.where((layer) => layer.visible);

int? get frameWidth => layers.first.frameSeq.current.image.width;
int? get frameHeight => layers.first.frameSeq.current.image.height;
int? get frameWidth => allFrames.first.image.width;
int? get frameHeight => allFrames.first.image.height;

/// Visible image at a given playhead position.
CompositeImage imageAt(Duration playhead) {
Expand All @@ -41,6 +41,14 @@ class Scene extends TimeSpan {

/// Frames for export video.
Iterable<CompositeFrame> getExportFrames() sync* {
if (visibleLayers.isEmpty) {
yield CompositeFrame(
CompositeImage.empty(width: frameWidth!, height: frameHeight!),
duration,
);
return;
}

final tracks =
visibleLayers.map((layer) => layer.getExportFrames(duration)).toList();

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.16.1
version: 1.16.2

environment:
sdk: '>=2.12.0 <3.0.0'
Expand Down

0 comments on commit f948666

Please sign in to comment.