Search in sources :

Example 1 with MessagingService

use of com.helospark.tactview.core.util.messaging.MessagingService in project tactview by helospark.

the class GraphSetterChainItem method handle.

@Override
protected EffectLine handle(GraphProvider graphingProvider, ValueProviderDescriptor descriptor) {
    Button button = new Button("Open graph window", new Glyph("FontAwesome", FontAwesome.Glyph.DIAMOND));
    GraphingComponent graphingComponent = new GraphingComponent(250, 100, effectGraphAccessor, messagingService, menuItemFactories, commandInterpreter, stylesheetAdderService, nameToIdRepository);
    graphingComponent.setGraphProvider(graphingProvider);
    graphingComponent.setZoom(0.4);
    graphingComponent.setParent(scene.getWindow());
    graphingComponent.redrawGraphProvider();
    VBox vbox = new VBox(button, graphingComponent);
    PrimitiveEffectLine result = PrimitiveEffectLine.builder().withCurrentValueProvider(() -> effectParametersRepository.getValueAtAsObject(graphingProvider.getId(), uiTimelineManager.getCurrentPosition())).withVisibleNode(vbox).withDescriptorId(graphingProvider.getId()).withEffectParametersRepository(effectParametersRepository).withCommandInterpreter(commandInterpreter).withDescriptor(descriptor).withUpdateFunction(position -> {
        graphingComponent.redrawGraphProvider();
    }).withUpdateFromValue(value -> {
    }).build();
    button.setOnMouseClicked(event -> {
        dockableTabRepository.openTab(graphingDialog);
        graphingDialog.showProvider(graphingProvider);
    });
    return result;
}
Also used : Button(javafx.scene.control.Button) Component(com.helospark.lightdi.annotation.Component) ValueProviderDescriptor(com.helospark.tactview.core.timeline.effect.interpolation.ValueProviderDescriptor) Scene(javafx.scene.Scene) UiCommandInterpreterService(com.helospark.tactview.ui.javafx.UiCommandInterpreterService) GraphingComponentFactory(com.helospark.tactview.ui.javafx.uicomponents.propertyvalue.graph.factory.GraphingComponentFactory) NameToIdRepository(com.helospark.tactview.ui.javafx.repository.NameToIdRepository) GraphingDialog(com.helospark.tactview.ui.javafx.uicomponents.propertyvalue.graph.GraphingDialog) EffectParametersRepository(com.helospark.tactview.core.timeline.effect.EffectParametersRepository) DockableTabRepository(com.helospark.tactview.ui.javafx.tabs.dockabletab.DockableTabRepository) VBox(javafx.scene.layout.VBox) MessagingService(com.helospark.tactview.core.util.messaging.MessagingService) List(java.util.List) EffectGraphAccessor(com.helospark.tactview.core.timeline.effect.interpolation.graph.EffectGraphAccessor) ScenePostProcessor(com.helospark.tactview.ui.javafx.scenepostprocessor.ScenePostProcessor) Glyph(org.controlsfx.glyphfont.Glyph) GraphProvider(com.helospark.tactview.core.timeline.effect.interpolation.provider.GraphProvider) StylesheetAdderService(com.helospark.tactview.ui.javafx.stylesheet.StylesheetAdderService) FontAwesome(org.controlsfx.glyphfont.FontAwesome) GraphingComponent(com.helospark.tactview.ui.javafx.uicomponents.propertyvalue.graph.GraphingComponent) UiTimelineManager(com.helospark.tactview.ui.javafx.UiTimelineManager) Button(javafx.scene.control.Button) Glyph(org.controlsfx.glyphfont.Glyph) VBox(javafx.scene.layout.VBox) GraphingComponent(com.helospark.tactview.ui.javafx.uicomponents.propertyvalue.graph.GraphingComponent)

Example 2 with MessagingService

use of com.helospark.tactview.core.util.messaging.MessagingService 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();
}
Also used : TimelineClipType(com.helospark.tactview.core.timeline.TimelineClipType) TactviewPlatform(com.helospark.tactview.core.util.conditional.TactviewPlatform) ConditionalOnPlatform(com.helospark.tactview.core.util.conditional.ConditionalOnPlatform) ClipFactory(com.helospark.tactview.core.timeline.ClipFactory) StatelessVideoEffect(com.helospark.tactview.core.timeline.StatelessVideoEffect) EffectParametersRepository(com.helospark.tactview.core.timeline.effect.EffectParametersRepository) Configuration(com.helospark.lightdi.annotation.Configuration) CreateEffectRequest(com.helospark.tactview.core.timeline.effect.CreateEffectRequest) KeyframeSuccesfullyAddedMessage(com.helospark.tactview.core.timeline.message.KeyframeSuccesfullyAddedMessage) ConditionalOnProperty(com.helospark.lightdi.annotation.ConditionalOnProperty) AddClipRequest(com.helospark.tactview.core.timeline.AddClipRequest) EffectFactory(com.helospark.tactview.core.timeline.effect.EffectFactory) GraphProvider(com.helospark.tactview.core.timeline.effect.interpolation.provider.GraphProvider) Map(java.util.Map) Bean(com.helospark.lightdi.annotation.Bean) CameraOutputToV4L2LoopbackElement(com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.realtime.CameraOutputToV4L2LoopbackElement) ProceduralClipFactoryChainItem(com.helospark.tactview.core.timeline.proceduralclip.ProceduralClipFactoryChainItem) GraphCategory(com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.GraphElementFactory.GraphCategory) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) OpencvL4V2LoopbackImplementation(com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.realtime.camera.OpencvL4V2LoopbackImplementation) ClipDescriptorsAdded(com.helospark.tactview.core.timeline.message.ClipDescriptorsAdded) Collectors(java.util.stream.Collectors) TimelineLength(com.helospark.tactview.core.timeline.TimelineLength) MessagingService(com.helospark.tactview.core.util.messaging.MessagingService) TimelineInterval(com.helospark.tactview.core.timeline.TimelineInterval) VisualTimelineClip(com.helospark.tactview.core.timeline.VisualTimelineClip) List(java.util.List) Optional(java.util.Optional) ClipFactoryChain(com.helospark.tactview.core.timeline.ClipFactoryChain) ProceduralVisualClip(com.helospark.tactview.core.timeline.proceduralclip.ProceduralVisualClip) AddClipRequest(com.helospark.tactview.core.timeline.AddClipRequest) ClipDescriptorsAdded(com.helospark.tactview.core.timeline.message.ClipDescriptorsAdded) VisualTimelineClip(com.helospark.tactview.core.timeline.VisualTimelineClip) Bean(com.helospark.lightdi.annotation.Bean)

Aggregations

EffectParametersRepository (com.helospark.tactview.core.timeline.effect.EffectParametersRepository)2 GraphProvider (com.helospark.tactview.core.timeline.effect.interpolation.provider.GraphProvider)2 MessagingService (com.helospark.tactview.core.util.messaging.MessagingService)2 List (java.util.List)2 Bean (com.helospark.lightdi.annotation.Bean)1 Component (com.helospark.lightdi.annotation.Component)1 ConditionalOnProperty (com.helospark.lightdi.annotation.ConditionalOnProperty)1 Configuration (com.helospark.lightdi.annotation.Configuration)1 AddClipRequest (com.helospark.tactview.core.timeline.AddClipRequest)1 ClipFactory (com.helospark.tactview.core.timeline.ClipFactory)1 ClipFactoryChain (com.helospark.tactview.core.timeline.ClipFactoryChain)1 StatelessVideoEffect (com.helospark.tactview.core.timeline.StatelessVideoEffect)1 TimelineClipType (com.helospark.tactview.core.timeline.TimelineClipType)1 TimelineInterval (com.helospark.tactview.core.timeline.TimelineInterval)1 TimelineLength (com.helospark.tactview.core.timeline.TimelineLength)1 TimelinePosition (com.helospark.tactview.core.timeline.TimelinePosition)1 VisualTimelineClip (com.helospark.tactview.core.timeline.VisualTimelineClip)1 CreateEffectRequest (com.helospark.tactview.core.timeline.effect.CreateEffectRequest)1 EffectFactory (com.helospark.tactview.core.timeline.effect.EffectFactory)1 ValueProviderDescriptor (com.helospark.tactview.core.timeline.effect.interpolation.ValueProviderDescriptor)1