use of org.jwildfire.create.tina.variation.Variation in project JWildfire by thargor6.
the class XForm method createTransformations.
private void createTransformations() {
t = new ArrayList<TransformationStep>();
t.add(new TransformationInitStep(this));
if (!isHasXYCoeffs() && !isHasYZCoeffs() && !isHasZXCoeffs()) {
t.add(new TransformationAffineNoneStep(this));
} else if (isHasXYCoeffs() && !isHasYZCoeffs() && !isHasZXCoeffs()) {
t.add(new TransformationAffineFlatStep(this));
} else {
t.add(new TransformationAffineFullStep(this));
}
t.add(new TransformationPreparePreVariationsStep(this));
for (Variation variation : variations) {
if (variation.getPriority() < 0 || variation.getPriority() == 2) {
if (variation.getFunc().getPriority() == 2) {
t.add(new PreInvVariationTransformationStep(this, variation));
} else if (variation.getFunc().getPriority() < 0) {
t.add(new PreVariationTransformationStep(this, variation));
} else {
t.add(new EnforcedPreVariationTransformationStep(this, variation));
}
}
}
t.add(new TransformationPrepareVariationsStep(this));
for (Variation variation : variations) {
if (variation.getPriority() == 0) {
if (variation.getFunc().getPriority() == 0) {
t.add(new VariationTransformationStep(this, variation));
} else {
t.add(new EnforcedVariationTransformationStep(this, variation));
}
}
}
for (Variation variation : variations) {
if (variation.getPriority() > 0 || variation.getPriority() == -2) {
if (variation.getFunc().getPriority() == -2) {
t.add(new PostInvVariationTransformationStep(this, variation));
} else if (variation.getFunc().getPriority() > 0) {
t.add(new PostVariationTransformationStep(this, variation));
} else {
t.add(new EnforcedPostVariationTransformationStep(this, variation));
}
}
}
t.add(new TransformationPreparePostAffineStep(this));
if (!isHasXYPostCoeffs() && !isHasYZPostCoeffs() && !isHasZXPostCoeffs()) {
t.add(new TransformationPostAffineNoneStep(this));
} else if (isHasXYPostCoeffs() && !isHasYZPostCoeffs() && !isHasZXPostCoeffs()) {
t.add(new TransformationPostAffineFlatStep(this));
} else {
t.add(new TransformationPostAffineStep(this));
}
}
use of org.jwildfire.create.tina.variation.Variation in project JWildfire by thargor6.
the class XForm method addVariation.
public Variation addVariation(double pAmount, VariationFunc pVariationFunc) {
Variation variation = new Variation();
variation.setAmount(pAmount);
variation.setFunc(pVariationFunc);
variation.setPriority(pVariationFunc.getPriority());
variations.add(variation);
return variation;
}
use of org.jwildfire.create.tina.variation.Variation in project JWildfire by thargor6.
the class VariationControlsDelegate method getCurveToEdit.
@Override
public MotionCurve getCurveToEdit(String pPropName) {
XForm xForm = owner.getCurrXForm();
Variation var = xForm.getVariation(variationIndex);
return AnimationService.getPropertyCurve(var, pPropName);
}
use of org.jwildfire.create.tina.variation.Variation in project JWildfire by thargor6.
the class TinaController method nonlinearParamsEditMotionCurve.
public void nonlinearParamsEditMotionCurve(int pIdx) {
String propertyname = (String) data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsCmb().getSelectedItem();
XForm xForm = getCurrXForm();
if (xForm != null && propertyname != null && propertyname.length() > 0) {
if (pIdx < xForm.getVariationCount()) {
Variation var = xForm.getVariation(pIdx);
if (var.getFunc().getParameterIndex(propertyname) >= 0) {
double initialValue;
try {
String valStr = data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().getText();
if (valStr == null || valStr.length() == 0) {
valStr = "0";
}
initialValue = Double.parseDouble(valStr);
} catch (Exception ex) {
initialValue = 0.0;
}
MotionCurve curve = var.getMotionCurve(propertyname);
if (curve == null) {
curve = var.createMotionCurve(propertyname);
}
variationControlsDelegates[pIdx].editMotionCurve(curve, initialValue, propertyname, "variation property \"" + propertyname + "\"");
// Doesnt work after changing parameter -> now enable it always
// variationControlsDelegates[pIdx].enableControl(data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd(), curve, false);
refreshFlameImage(true, false, 1, true, false);
}
}
}
}
use of org.jwildfire.create.tina.variation.Variation in project JWildfire by thargor6.
the class TinaController method propertyPnlValueChanged.
public void propertyPnlValueChanged(int pIdx, String pPropertyName, double pPropertyValue, boolean pIsAdjusting) {
if (cmbRefreshing) {
return;
}
cmbRefreshing = true;
try {
XForm xForm = getCurrXForm();
if (xForm != null) {
if (pIdx < xForm.getVariationCount()) {
Variation var = xForm.getVariation(pIdx);
var.getFunc().setParameter(pPropertyName, pPropertyValue);
if (!pIsAdjusting && var.getFunc().dynamicParameterExpansion(pPropertyName)) {
// if setting the parameter can change the total number of parameters,
// then refresh parameter UI
this.refreshParamControls(data.TinaNonlinearControlsRows[pIdx], xForm, var, true);
}
refreshFlameImage(true, false, 1, true, false);
}
}
} finally {
cmbRefreshing = false;
}
}
Aggregations