Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
90 lines
2.5 KiB
Dart
90 lines
2.5 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:cutdex_core/editor.dart';
|
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
|
import 'package:cutdex_core/timeline/engine.dart';
|
|
import 'package:cutdex_core/timeline/model.dart';
|
|
|
|
import '../../workspace/timeline_session.dart';
|
|
|
|
/// Shared pause, stale-context checks and diagnostics for inspector edits.
|
|
class PropertyEditBoundary {
|
|
PropertyEditBoundary(this.session, this.sequence, this.clip);
|
|
|
|
final EditorTimelineSession session;
|
|
final SequenceId sequence;
|
|
final ElementId clip;
|
|
bool _disposed = false;
|
|
bool _busy = false;
|
|
|
|
void dispose() => _disposed = true;
|
|
|
|
bool canRun(PreviewController? preview) =>
|
|
!_disposed &&
|
|
!_busy &&
|
|
session.activeSequenceId == sequence &&
|
|
preview?.transforms.hasPending != true;
|
|
|
|
Future<bool> run(
|
|
PreviewController? preview,
|
|
FutureOr<bool> Function(PropertyEditContext) action, {
|
|
required String operation,
|
|
bool Function()? isCurrent,
|
|
bool seek = false,
|
|
void Function()? started,
|
|
}) async {
|
|
if (!canRun(preview) || isCurrent?.call() == false) return false;
|
|
final view = session.view(sequence);
|
|
final target = PropertyEditContext._(
|
|
tick: view.playheadTick,
|
|
version: view.version.kernelVersion,
|
|
current: () =>
|
|
!_disposed &&
|
|
isCurrent?.call() != false &&
|
|
session.activeSequenceId == sequence &&
|
|
preview?.transforms.hasPending != true,
|
|
view: view,
|
|
);
|
|
_busy = true;
|
|
try {
|
|
started?.call();
|
|
await preview?.pauseForCanvasInteraction();
|
|
if (!target.isCurrent) return false;
|
|
if (seek) return await action(target);
|
|
return await session.runEditAsync(
|
|
operation,
|
|
sequence,
|
|
() async => action(target),
|
|
context: {
|
|
'clipIds': [clip.value],
|
|
'entryPoint': 'property',
|
|
'playheadTick': target.tick,
|
|
},
|
|
);
|
|
} finally {
|
|
_busy = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
class PropertyEditContext {
|
|
PropertyEditContext._({
|
|
required this.tick,
|
|
required this._version,
|
|
required this._current,
|
|
required this._view,
|
|
});
|
|
|
|
final int tick;
|
|
final TimelineVersion _version;
|
|
final bool Function() _current;
|
|
final TimelineViewController _view;
|
|
|
|
/// Async operations check this again immediately before publication.
|
|
bool get isCurrent =>
|
|
_current() &&
|
|
_view.playheadTick == tick &&
|
|
identical(_view.version.kernelVersion, _version);
|
|
}
|