use of org.jwildfire.create.tina.base.solidrender.SolidRenderSettings in project JWildfire by thargor6.
the class AnimationService method _evalMotionCurves.
private static void _evalMotionCurves(Object pObject, double pFrame) throws IllegalAccessException {
Class<?> cls = pObject.getClass();
for (Field field : cls.getDeclaredFields()) {
field.setAccessible(true);
if (field.getType() == MotionCurve.class && field.getName().endsWith(Tools.CURVE_POSTFIX)) {
MotionCurve curve = (MotionCurve) field.get(pObject);
if (curve.isEnabled()) {
double value = evalCurve(pFrame, curve);
String propName = field.getName().substring(0, field.getName().length() - Tools.CURVE_POSTFIX.length());
curve.getChangeHandler().processValueChange(pObject, propName, value);
if (pObject instanceof RGBPalette) {
curve.getChangeHandler().processValueChange(pObject, "modified", 1.0);
}
// setPropertyValue(pObject, propName, value);
// System.out.println(propName + " " + value);
}
} else if (field.getType().isAssignableFrom(ArrayList.class)) {
List<?> childs = (List<?>) field.get(pObject);
for (Object child : childs) {
_evalMotionCurves(child, pFrame);
}
} else if (field.getType().isAssignableFrom(RGBPalette.class)) {
RGBPalette gradient = (RGBPalette) field.get(pObject);
_evalMotionCurves(gradient, pFrame);
} else if (field.getType().isAssignableFrom(SolidRenderSettings.class)) {
SolidRenderSettings settings = (SolidRenderSettings) field.get(pObject);
_evalMotionCurves(settings, pFrame);
}
}
if (pObject instanceof Variation) {
Variation var = (Variation) pObject;
VariationFunc func = var.getFunc();
for (String name : func.getParameterNames()) {
MotionCurve curve = var.getMotionCurve(name);
if (curve != null && curve.isEnabled()) {
double value = evalCurve(pFrame, curve);
try {
func.setParameter(name, value);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
}
use of org.jwildfire.create.tina.base.solidrender.SolidRenderSettings in project JWildfire by thargor6.
the class EnvelopeDialog method findProperty.
private String findProperty(Object pObject, Object pProperty, String pPath) {
if (pObject == pProperty) {
return pPath;
}
Class<?> cls = pObject.getClass();
for (Field field : cls.getDeclaredFields()) {
field.setAccessible(true);
Object fieldValue;
try {
fieldValue = field.get(pObject);
} catch (Exception ex) {
fieldValue = null;
}
if (fieldValue != null) {
if (fieldValue == pProperty) {
String pathExt = field.getName();
return pPath == null ? pathExt : pPath + PATH_SEPARATOR + pathExt;
}
if (fieldValue instanceof List) {
List<?> list = (List<?>) fieldValue;
for (int i = 0; i < list.size(); i++) {
String pathExt = field.getName() + "[" + i + "]";
String subPath = pPath == null ? pathExt : pPath + PATH_SEPARATOR + pathExt;
String subResult = findProperty(list.get(i), pProperty, subPath);
if (subResult != null) {
return subResult;
}
}
} else if (fieldValue instanceof Map) {
Map<?, ?> map = (Map<?, ?>) fieldValue;
Set<?> entrySet = map.entrySet();
for (Object obj : entrySet) {
Entry<?, ?> entry = (Entry<?, ?>) obj;
String pathExt = field.getName() + "[" + entry.getKey().toString() + "]";
String subPath = pPath == null ? pathExt : pPath + PATH_SEPARATOR + pathExt;
String subResult = findProperty(entry.getValue(), pProperty, subPath);
if (subResult != null) {
return subResult;
}
}
} else if (fieldValue instanceof RGBPalette) {
RGBPalette palette = (RGBPalette) fieldValue;
String pathExt = field.getName();
String subPath = pPath == null ? pathExt : pPath + PATH_SEPARATOR + pathExt;
String subResult = findProperty(palette, pProperty, subPath);
if (subResult != null) {
return subResult;
}
} else if (fieldValue instanceof SolidRenderSettings) {
SolidRenderSettings settings = (SolidRenderSettings) fieldValue;
String pathExt = field.getName();
String subPath = pPath == null ? pathExt : pPath + PATH_SEPARATOR + pathExt;
String subResult = findProperty(settings, pProperty, subPath);
if (subResult != null) {
return subResult;
}
}
}
}
return null;
}
use of org.jwildfire.create.tina.base.solidrender.SolidRenderSettings in project JWildfire by thargor6.
the class FlameControlsDelegate method getSolidRenderingSelectedLight.
private DistantLight getSolidRenderingSelectedLight() {
Flame flame = getCurrFlame();
if (flame != null) {
SolidRenderSettings settings = flame.getSolidRenderSettings();
int idx = getSolidRenderingSelectedLightIndex();
if (idx >= 0 && idx < settings.getLights().size()) {
return settings.getLights().get(idx);
}
}
return null;
}
use of org.jwildfire.create.tina.base.solidrender.SolidRenderSettings in project JWildfire by thargor6.
the class FlameControlsDelegate method refreshSolidRenderingGlobals.
private void refreshSolidRenderingGlobals() {
enableBokehPanels();
SolidRenderSettings settings = getCurrFlame().getSolidRenderSettings();
data.solidRenderingToggleBtn.setSelected(settings.isSolidRenderingEnabled());
data.tinaSolidRenderingEnableAOCBx.setSelected(settings.isAoEnabled());
data.tinaSolidRenderingAOIntensityREd.setText(Tools.doubleToString(settings.getAoIntensity()));
data.tinaSolidRenderingAOIntensitySlider.setValue(Tools.FTOI(settings.getAoIntensity() * TinaController.SLIDER_SCALE_CENTRE));
data.tinaSolidRenderingAOSearchRadiusREd.setText(Tools.doubleToString(settings.getAoSearchRadius()));
data.tinaSolidRenderingAOSearchRadiusSlider.setValue(Tools.FTOI(settings.getAoSearchRadius() * TinaController.SLIDER_SCALE_CENTRE));
data.tinaSolidRenderingAOBlurRadiusREd.setText(Tools.doubleToString(settings.getAoBlurRadius()));
data.tinaSolidRenderingAOBlurRadiusSlider.setValue(Tools.FTOI(settings.getAoBlurRadius() * TinaController.SLIDER_SCALE_CENTRE));
data.tinaSolidRenderingAOFalloffREd.setText(Tools.doubleToString(settings.getAoFalloff()));
data.tinaSolidRenderingAOFalloffSlider.setValue(Tools.FTOI(settings.getAoFalloff() * TinaController.SLIDER_SCALE_CENTRE));
data.tinaSolidRenderingAORadiusSamplesREd.setText(Tools.doubleToString(settings.getAoRadiusSamples()));
data.tinaSolidRenderingAORadiusSamplesSlider.setValue(Tools.FTOI(settings.getAoRadiusSamples()));
data.tinaSolidRenderingAOAzimuthSamplesREd.setText(Tools.doubleToString(settings.getAoAzimuthSamples()));
data.tinaSolidRenderingAOAzimuthSamplesSlider.setValue(Tools.FTOI(settings.getAoAzimuthSamples()));
data.tinaSolidRenderingAOAffectDiffuseREd.setText(Tools.doubleToString(settings.getAoAffectDiffuse()));
data.tinaSolidRenderingAOAffectDiffuseSlider.setValue(Tools.FTOI(settings.getAoAffectDiffuse() * TinaController.SLIDER_SCALE_CENTRE));
data.tinaSolidRenderingShadowTypeCmb.setSelectedItem(settings.getShadowType());
data.tinaSolidRenderingShadowmapSizeCmb.setSelectedItem(String.valueOf(settings.getShadowmapSize()));
if (data.tinaSolidRenderingShadowmapSizeCmb.getSelectedIndex() < 0) {
data.tinaSolidRenderingShadowmapSizeCmb.setSelectedIndex(0);
}
data.tinaSolidRenderingShadowSmoothRadiusREd.setText(Tools.doubleToString(settings.getShadowSmoothRadius()));
data.tinaSolidRenderingShadowSmoothRadiusSlider.setValue(Tools.FTOI(settings.getShadowSmoothRadius() * TinaController.SLIDER_SCALE_CENTRE));
data.tinaSolidRenderingShadowmapBiasREd.setText(Tools.doubleToString(settings.getShadowmapBias()));
data.tinaSolidRenderingShadowmapBiasSlider.setValue(Tools.FTOI(settings.getShadowmapBias() * TinaController.SLIDER_SCALE_CENTRE));
data.postBokehIntensityREd.setText(Tools.doubleToString(settings.getPostBokehIntensity()));
data.postBokehIntensitySlider.setValue(Tools.FTOI(settings.getPostBokehIntensity() * TinaController.SLIDER_SCALE_CENTRE));
data.postBokehBrightnessREd.setText(Tools.doubleToString(settings.getPostBokehBrightness()));
data.postBokehBrightnessSlider.setValue(Tools.FTOI(settings.getPostBokehBrightness() * TinaController.SLIDER_SCALE_CENTRE));
data.postBokehSizeREd.setText(Tools.doubleToString(settings.getPostBokehSize()));
data.postBokehSizeSlider.setValue(Tools.FTOI(settings.getPostBokehSize() * TinaController.SLIDER_SCALE_CENTRE));
data.postBokehActivationREd.setText(Tools.doubleToString(settings.getPostBokehActivation()));
data.postBokehActivationSlider.setValue(Tools.FTOI(settings.getPostBokehActivation() * TinaController.SLIDER_SCALE_CENTRE));
data.postBokehFilterKernelCmb.setSelectedItem(settings.getPostBokehFilterKernel());
}
use of org.jwildfire.create.tina.base.solidrender.SolidRenderSettings in project JWildfire by thargor6.
the class FlameControlsDelegate method solidRenderingShadowTypeCmb_changed.
public void solidRenderingShadowTypeCmb_changed() {
if (!isNoRefresh()) {
Flame flame = getCurrFlame();
if (flame != null) {
SolidRenderSettings settings = flame.getSolidRenderSettings();
owner.saveUndoPoint();
settings.setShadowType((ShadowType) data.tinaSolidRenderingShadowTypeCmb.getSelectedItem());
enableControls();
owner.refreshFlameImage(true, false, 1, true, false);
}
}
}
Aggregations