Search in sources :

Example 1 with ProceduralClipFactoryChainItem

use of com.helospark.tactview.core.timeline.proceduralclip.ProceduralClipFactoryChainItem in project tactview by helospark.

the class ProceduralClipFactory method createClip.

@Override
public TimelineClip createClip(AddClipRequest request) {
    ProceduralClipFactoryChainItem proceduralFactory = factories.stream().filter(factory -> factory.doesSupport(request)).findFirst().orElseThrow(() -> new IllegalArgumentException("Nothing can handle " + request));
    ProceduralVisualClip proceduralTimelineClip = proceduralFactory.create(request);
    proceduralTimelineClip.setProceduralFactoryId(proceduralFactory.getId());
    proceduralTimelineClip.setCreatorFactoryId(getId());
    return proceduralTimelineClip;
}
Also used : ProceduralVisualClip(com.helospark.tactview.core.timeline.proceduralclip.ProceduralVisualClip) ProceduralClipFactoryChainItem(com.helospark.tactview.core.timeline.proceduralclip.ProceduralClipFactoryChainItem)

Example 2 with ProceduralClipFactoryChainItem

use of com.helospark.tactview.core.timeline.proceduralclip.ProceduralClipFactoryChainItem in project tactview by helospark.

the class ProceduralClipFactory method restoreClip.

@Override
public TimelineClip restoreClip(JsonNode savedClip, LoadMetadata metadata) {
    String proceduralFactoryId = savedClip.get("proceduralFactoryId").asText();
    ProceduralClipFactoryChainItem proceduralFactory = factories.stream().filter(factory -> factory.getProceduralClipId().equals(proceduralFactoryId)).findFirst().orElseThrow(() -> new IllegalArgumentException("Nothing can handle " + proceduralFactoryId));
    ProceduralVisualClip result = proceduralFactory.restoreClip(savedClip, metadata);
    result.setProceduralFactoryId(proceduralFactoryId);
    return result;
}
Also used : ProceduralVisualClip(com.helospark.tactview.core.timeline.proceduralclip.ProceduralVisualClip) ProceduralClipFactoryChainItem(com.helospark.tactview.core.timeline.proceduralclip.ProceduralClipFactoryChainItem)

Aggregations

ProceduralClipFactoryChainItem (com.helospark.tactview.core.timeline.proceduralclip.ProceduralClipFactoryChainItem)2 ProceduralVisualClip (com.helospark.tactview.core.timeline.proceduralclip.ProceduralVisualClip)2