use of com.helospark.tactview.core.timeline.message.ClipDescriptorsAdded in project tactview by helospark.
the class StandardGraphElementFactoryConfiguration method fileClipGraphElementFactory.
@Bean
public GraphElementFactory fileClipGraphElementFactory(List<ClipFactory> clipFactories, ClipFactoryChain clipFactoryChain, MessagingService messagingService) {
return StandardGraphElementFactory.builder().withId("file").withDoesSupport(uri -> uri.startsWith("file://")).withName("File").withCategory(GraphCategory.INPUT).withNeedsInputParam(true).withCreator(graphRequest -> {
AddClipRequest request = AddClipRequest.builder().withAddClipRequestMetadataKey(Map.of()).withPosition(TimelinePosition.ofZero()).withFilePath(graphRequest.uri.replaceFirst("file://", "")).build();
VisualTimelineClip clip = (VisualTimelineClip) clipFactoryChain.createClips(request).get(0);
clip.setInterval(INTERVAL);
messagingService.sendAsyncMessage(new ClipDescriptorsAdded(clip.getId(), clip.getDescriptors(), clip));
return new VisualTimelineClipElement(clip);
}).withRestorer((node, metadata) -> {
node.get("creatorFactoryId").asText();
return new VisualTimelineClipElement(node, metadata, (VisualTimelineClip) clipFactoryChain.restoreClip(node.get("clip"), metadata));
}).build();
}
use of com.helospark.tactview.core.timeline.message.ClipDescriptorsAdded in project tactview by helospark.
the class TimelineManagerAccessor method sendClipAndEffectMessages.
private void sendClipAndEffectMessages(TimelineChannel channelToAddResourceTo, TimelineClip clip) {
// must call before sending clip added message to initialize descriptors
List<ValueProviderDescriptor> descriptors = clip.getDescriptors();
messagingService.sendMessage(new ClipAddedMessage(clip.getId(), channelToAddResourceTo.getId(), clip.getInterval().getStartPosition(), clip, clip.isResizable(), clip.interval));
messagingService.sendMessage(new ClipDescriptorsAdded(clip.getId(), descriptors, clip));
for (var effect : clip.getEffects()) {
messagingService.sendAsyncMessage(new EffectDescriptorsAdded(effect.getId(), effect.getValueProviders(), effect));
int channelIndex = clip.getEffectWithIndex(effect);
messagingService.sendMessage(new EffectAddedMessage(effect.getId(), clip.getId(), effect.interval.getStartPosition(), effect, channelIndex, effect.getGlobalInterval()));
}
}
Aggregations