use of com.helospark.tactview.core.timeline.effect.interpolation.graph.EffectGraph in project tactview by helospark.
the class GraphProceduralClip method createProceduralFrame.
@Override
public ReadOnlyClipImage createProceduralFrame(GetFrameRequest request, TimelinePosition relativePosition) {
EffectGraph effectGraph = graphProvider.getValueAt(relativePosition);
EffectGraphInputRequest egr = EffectGraphInputRequest.builder().withApplyEffects(true).withExpectedWidth(request.getExpectedWidth()).withExpectedHeight(request.getExpectedHeight()).withInput(null).withLowResolutionPreview(false).withPosition(request.getGlobalPosition()).withRelativePosition(relativePosition).withScale(request.getScale()).withUseApproximatePosition(false).build();
return effectGraph.evaluate(egr);
}
use of com.helospark.tactview.core.timeline.effect.interpolation.graph.EffectGraph in project tactview by helospark.
the class GraphProviderFactory method deserialize.
@Override
public GraphProvider deserialize(JsonNode data, SavedContentAddable<?> currentFieldValue, LoadMetadata loadMetadata) {
ObjectMapper mapper = loadMetadata.getObjectMapperUsed();
Map<ConnectionIndex, List<ConnectionIndex>> connections = mapper.convertValue(data.get("connections"), new TypeReference<Map<ConnectionIndex, List<ConnectionIndex>>>() {
});
List<GraphElementFactory> factories = loadMetadata.getLightDiContext().getListOfBeans(GraphElementFactory.class);
Map<GraphIndex, GraphElement> graph = new LinkedHashMap<>();
for (var element : data.get("graph")) {
String factoryId = element.get("factoryId").asText();
GraphElement restoredElement = factories.stream().filter(a -> a.getId().equals(factoryId)).findFirst().get().restoreElement(element.get("object"), loadMetadata);
GraphIndex id = new GraphIndex(element.get("id").asText());
graph.put(id, restoredElement);
}
return new GraphProvider(new EffectGraph(graph, connections));
}
use of com.helospark.tactview.core.timeline.effect.interpolation.graph.EffectGraph in project tactview by helospark.
the class GraphProceduralClip method getDescriptorsInternal.
@Override
public List<ValueProviderDescriptor> getDescriptorsInternal() {
List<ValueProviderDescriptor> result = super.getDescriptorsInternal();
// if is there to distinguish between load and new init
if (graphProvider == null) {
EffectGraph effectGraph = defaultGraphArrangementFactory.createEffectGraphProviderWithOutput();
graphProvider = new GraphProvider(effectGraph);
}
graphProvider.setContainingIntervalAware(this);
graphProvider.setContainingElementId(this.getId());
// TODO: this is not a pretty solution, but current arch does not provider better, must think of different way
effectGraphAccessor.sendProviderMessageFor(graphProvider);
ValueProviderDescriptor graphDescriptor = ValueProviderDescriptor.builder().withKeyframeableEffect(graphProvider).withName("Graph").build();
result.add(graphDescriptor);
return result;
}
use of com.helospark.tactview.core.timeline.effect.interpolation.graph.EffectGraph in project tactview by helospark.
the class DefaultGraphArrangementFactory method createEffectGraphProviderWithOutput.
public EffectGraph createEffectGraphProviderWithOutput() {
EffectGraph effectGraph = new EffectGraph();
OutputElement outputElement = (OutputElement) outputElementFactory.createElement(new GraphCreatorRequest(null, "output"));
effectGraph.getGraphElements().put(GraphIndex.random(), outputElement);
effectGraph.autoArrangeUi();
return effectGraph;
}
use of com.helospark.tactview.core.timeline.effect.interpolation.graph.EffectGraph in project tactview by helospark.
the class DefaultGraphArrangementFactory method createEffectGraphProviderWithInputAndOutput.
public EffectGraph createEffectGraphProviderWithInputAndOutput() {
EffectGraph effectGraph = new EffectGraph();
InputElement inputElement = (InputElement) inputElementFactory.createElement(new GraphCreatorRequest(null, "input"));
OutputElement outputElement = (OutputElement) outputElementFactory.createElement(new GraphCreatorRequest(null, "output"));
effectGraph.getGraphElements().put(GraphIndex.random(), inputElement);
effectGraph.getGraphElements().put(GraphIndex.random(), outputElement);
effectGraph.getConnections().put(inputElement.getOutputIndex(), new ArrayList<>(List.of(outputElement.getInputIndex())));
effectGraph.autoArrangeUi();
return effectGraph;
}
Aggregations