use of org.jwildfire.create.tina.animate.FlameMoviePart in project JWildfire by thargor6.
the class JWFMovieFilePreview method createThumbnail.
public void createThumbnail() {
if (currFile == null) {
currThumbnail = null;
return;
}
try {
if (currFile.exists()) {
FlameMovie movie = new FlameMovieReader(prefs).readMovie(currFile.getAbsolutePath());
Flame flame = null;
if (movie != null) {
for (FlameMoviePart part : movie.getParts()) {
if (part.getFlame() != null) {
flame = part.getFlame();
break;
}
}
}
if (flame != null) {
int imgWidth = this.getPreferredSize().width;
int imgHeight = this.getPreferredSize().height;
double wScl = (double) imgWidth / (double) flame.getWidth();
double hScl = (double) imgHeight / (double) flame.getHeight();
flame.setPixelsPerUnit((wScl + hScl) * 0.5 * flame.getPixelsPerUnit());
flame.setWidth(imgWidth);
flame.setHeight(imgHeight);
FlameRenderer renderer = new FlameRenderer(flame, prefs, false, true);
renderer.setProgressUpdater(null);
flame.setSampleDensity(50);
flame.setSpatialFilterRadius(0.0);
RenderInfo info = new RenderInfo(imgWidth, imgHeight, RenderMode.PREVIEW);
RenderedFlame res = renderer.renderFlame(info);
currThumbnail = new ImageIcon(res.getImage().getBufferedImg());
}
}
} catch (Exception ex) {
currThumbnail = null;
if (ex.getCause() != null) {
ex.getCause().printStackTrace();
} else {
ex.printStackTrace();
}
}
}
use of org.jwildfire.create.tina.animate.FlameMoviePart in project JWildfire by thargor6.
the class TinaSWFAnimatorController method refreshControls.
protected void refreshControls() {
noRefresh = true;
try {
swfAnimatorFramesPerSecondREd.setValue(currMovie.getFramesPerSecond());
for (int i = 0; i < globalScripts.size(); i++) {
ScriptContainer container = globalScripts.get(i);
setGlobalScriptToUI(currMovie.getGlobalScripts()[i], container.getScriptCmb(), container.getScriptREd());
}
for (int i = 0; i < xFormScripts.size(); i++) {
ScriptContainer container = xFormScripts.get(i);
setXFormScriptToUI(currMovie.getxFormScripts()[i], container.getScriptCmb(), container.getScriptREd());
}
{
ResolutionProfile fittingProfile = null;
ResolutionProfile doubleProfile = null;
for (int i = 0; i < swfAnimatorResolutionProfileCmb.getItemCount(); i++) {
ResolutionProfile profile = (ResolutionProfile) swfAnimatorResolutionProfileCmb.getItemAt(i);
if (profile.getWidth() == currMovie.getFrameWidth() && profile.getHeight() == currMovie.getFrameHeight()) {
fittingProfile = profile;
break;
} else if ((profile.getWidth() / 2) == currMovie.getFrameWidth() && (profile.getHeight() / 2) == currMovie.getFrameHeight()) {
doubleProfile = profile;
}
}
if (fittingProfile != null) {
swfAnimatorResolutionProfileCmb.setSelectedItem(fittingProfile);
} else if (doubleProfile != null) {
swfAnimatorResolutionProfileCmb.setSelectedItem(doubleProfile);
}
}
{
QualityProfile qualityProfile = null;
for (int i = 0; i < swfAnimatorQualityProfileCmb.getItemCount(); i++) {
QualityProfile profile = (QualityProfile) swfAnimatorQualityProfileCmb.getItemAt(i);
if (qualityProfile == null) {
qualityProfile = profile;
} else if (profile.getQuality() == currMovie.getQuality()) {
qualityProfile = profile;
break;
}
}
if (qualityProfile != null) {
swfAnimatorQualityProfileCmb.setSelectedItem(qualityProfile);
}
}
swfAnimatorOutputTypeCmb.setSelectedItem(currMovie.getSequenceOutputType());
for (JPanel panel : flamePartPanelList) {
swfAnimatorFlamesPanel.remove(panel);
}
flamePartPanelList.clear();
for (AbstractButton btn : flamePartRadioButtonList) {
swfAnimatorFlamesButtonGroup.remove(btn);
}
flamePartRadioButtonList.clear();
swfAnimatorFlamesPanel.getParent().validate();
swfAnimatorFrameSlider.setValue(1);
swfAnimatorFrameSlider.setMaximum(currMovie.getFrameCount());
int frameCount = currMovie.getFrameCount();
swfAnimatorFramesREd.setValue(frameCount);
swfAnimatorFrameREd.setValue(1);
swfAnimatorFrameREd.setMaxValue(frameCount);
swfAnimatorMotionBlurLengthREd.setValue(currMovie.getMotionBlurLength());
swfAnimatorMotionBlurTimeStepREd.setValue(currMovie.getMotionBlurTimeStep());
for (FlameMoviePart part : currMovie.getParts()) {
addFlameToFlamePanel(part);
}
enableControls();
} finally {
noRefresh = false;
}
}
use of org.jwildfire.create.tina.animate.FlameMoviePart in project JWildfire by thargor6.
the class TinaSWFAnimatorController method addFlame.
private void addFlame(Flame pFlame) {
boolean firstPart = currMovie.getParts().size() == 0;
int frameCount, frameMorphCount;
if (firstPart) {
if (pFlame.getMotionBlurLength() > 0) {
swfAnimatorMotionBlurLengthREd.setValue(pFlame.getMotionBlurLength());
swfAnimatorMotionBlurTimeStepREd.setValue(pFlame.getMotionBlurTimeStep());
}
frameCount = 120;
frameMorphCount = 60;
} else {
FlameMoviePart prevPart = currMovie.getParts().get(currMovie.getParts().size() - 1);
frameCount = prevPart.getFrameCount();
frameMorphCount = prevPart.getFrameMorphCount();
}
FlameMoviePart part = new FlameMoviePart();
part.setFlame(pFlame);
part.setFrameCount(frameCount);
part.setFrameMorphCount(frameMorphCount);
addFlameToFlamePanel(part);
currMovie.addPart(part);
refreshFrameCount();
previewFlameImage();
clearCurrentPreview();
updateThumbnails();
}
use of org.jwildfire.create.tina.animate.FlameMoviePart in project JWildfire by thargor6.
the class TinaSWFAnimatorController method swapFlameMoviePart.
private void swapFlameMoviePart(int pFrom, int pTo) {
FlameMoviePart part1 = currMovie.getParts().get(pFrom);
FlameMoviePart part2 = currMovie.getParts().get(pTo);
JPanel panel1 = flamePartPanelList.get(pFrom);
JPanel panel2 = flamePartPanelList.get(pTo);
JRadioButton radio1Btn = flamePartRadioButtonList.get(pFrom);
JRadioButton radio2Btn = flamePartRadioButtonList.get(pTo);
for (JPanel panel : flamePartPanelList) {
swfAnimatorFlamesPanel.remove(panel);
}
currMovie.getParts().set(pFrom, part2);
currMovie.getParts().set(pTo, part1);
flamePartPanelList.set(pFrom, panel2);
flamePartPanelList.set(pTo, panel1);
flamePartRadioButtonList.set(pFrom, radio2Btn);
flamePartRadioButtonList.set(pTo, radio1Btn);
for (JPanel panel : flamePartPanelList) {
swfAnimatorFlamesPanel.add(panel);
}
swfAnimatorFlamesPanel.getParent().validate();
clearCurrentPreview();
updateThumbnails();
}
Aggregations