use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.
the class DanceFlameTransformer method createTransformedFlame.
public Flame createTransformedFlame(DancingFlame pFlame, short[] pFFTData, long pTime, int pFPS) {
Flame res = pFlame.getFlame().makeCopy();
List<Motion> motions = project.getMotions(res);
Flame refFlame = res.makeCopy();
for (FlamePreprocessor preprocessor : project.getPreprocessors()) {
if (preprocessor.isActive(pTime, pFPS)) {
res = preprocessor.preprocessFlame(project, res).makeCopy();
if (preprocessor instanceof FlameMotionPreprocessor) {
motions = ((FlameMotionPreprocessor) preprocessor).preprocessMotions(project, motions);
refFlame = res.makeCopy();
}
}
}
for (Motion motion : motions) {
if (motion.getParent() == null && motion.isActive(pTime, pFPS)) {
double value = 0.0;
int iter = 0;
Motion currMotion = motion;
while (currMotion != null) {
value += currMotion.computeValue(pFFTData, pTime, pFPS);
Motion refMotion = currMotion;
currMotion = null;
for (Motion nextMotion : motions) {
if (nextMotion.isActive(pTime, pFPS) && nextMotion.getParent() == refMotion) {
currMotion = nextMotion;
break;
}
}
iter++;
if (iter > 100) {
throw new RuntimeException("Probably endless loop detected");
}
}
for (MotionLink link : motion.getMotionLinks()) {
if (link.getProperyPath().getFlame().isEqual(refFlame)) {
AnimationModelService.setFlameProperty(res, link.getProperyPath(), value);
}
}
}
}
return res;
}
use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.
the class EnvelopeDialog method getFlame.
@Override
public Flame getFlame() {
if (flameToPreview != null) {
Flame res = flameToPreview.makeCopy();
res.setFrame(frameToPreview);
switch(flamePreviewType) {
case MOTION_CURVE:
if (curveToPreviewPropertyPath != null) {
MotionCurve curve = getMotionCurve(res, curveToPreviewPropertyPath);
if (curve != null) {
curve.setPoints(new int[] { frameToPreview }, new double[] { curveValueToPreview });
curve.setInterpolation(Interpolation.LINEAR);
curve.setEnabled(true);
}
}
break;
case COLOR_CURVE:
if (curveToPreviewPropertyPath != null) {
MotionCurve curve = getMotionCurve(res, curveToPreviewPropertyPath);
if (curve != null) {
curve.assignFromEnvelope(ctrl.getCurrEnvelope());
}
}
break;
default:
// nothing to do
break;
}
return res;
}
return null;
}
use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.
the class ChannelMixerControlsDelegate method resetBtn_clicked.
public void resetBtn_clicked() {
Flame flame = owner.getCurrFlame();
if (useUndoManager) {
owner.undoManager.saveUndoPoint(flame);
}
flame.resetMixerCurves();
refreshValues(false);
owner.refreshFlameImage(true, false, 1, true, true);
}
use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.
the class ChannelMixerPanelDelegate method notifyChange.
private void notifyChange(int pSelectedPoint, int pX, double pY) {
Flame flame = owner.getOwner().getCurrFlame();
if (owner.isUseUndoManager()) {
owner.getOwner().undoManager.saveUndoPoint(flame);
}
MotionCurve curve = getCurve(flame);
curve.assignFromEnvelope(ctrl.getCurrEnvelope());
owner.getOwner().refreshFlameImage(true, false, 1, true, true);
}
use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.
the class FlameControlsDelegate method postNoiseFilterCheckBox_changed.
public void postNoiseFilterCheckBox_changed() {
if (!isNoRefresh()) {
Flame flame = getCurrFlame();
if (flame != null) {
owner.saveUndoPoint();
flame.setPostNoiseFilter(data.tinaPostNoiseFilterCheckBox.isSelected());
enableControls();
}
}
}
Aggregations