use of org.jwildfire.create.tina.dance.motion.Motion in project JWildfire by thargor6.
the class DancingFractalsController method unlinkMotionBtn_clicked.
public void unlinkMotionBtn_clicked() {
Motion selMotion = getSelectedMotion();
int row = motionLinksTable.getSelectedRow();
if (selMotion != null && row >= 0 && row <= selMotion.getMotionLinks().size()) {
int selRow = motionLinksTable.getSelectedRow();
selMotion.getMotionLinks().remove(row);
motionTableClicked();
if (selRow >= selMotion.getMotionLinks().size()) {
selRow--;
}
motionLinksTable.getSelectionModel().setSelectionInterval(selRow, selRow);
enableControls();
}
}
use of org.jwildfire.create.tina.dance.motion.Motion in project JWildfire by thargor6.
the class DancingFractalsController method enableControls.
private void enableControls() {
loadSoundBtn.setEnabled(!running);
addFromClipboardBtn.setEnabled(!running);
addFromEditorBtn.setEnabled(!running);
addFromDiscBtn.setEnabled(!running);
randomCountIEd.setEnabled(!running);
genRandFlamesBtn.setEnabled(!running);
randomGenCmb.setEnabled(!running);
boolean flameSelected = poolFlameHolder.getFlame() != null;
flameToEditorBtn.setEnabled(flameSelected);
deleteFlameBtn.setEnabled(flameSelected);
renameFlameBtn.setEnabled(flameSelected);
replaceFlameFromEditorBtn.setEnabled(flameSelected);
framesPerSecondIEd.setEnabled(!running);
borderSizeSlider.setEnabled(true);
morphFrameCountIEd.setEnabled(true);
startShowButton.setEnabled(!running && project.getFlames().size() > 0);
stopShowButton.setEnabled(running);
doRecordCBx.setEnabled(!running);
motionTable.setEnabled(!running);
addMotionCmb.setEnabled(!running);
addMotionBtn.setEnabled(!running);
Motion selMotion = getSelectedMotion();
deleteMotionBtn.setEnabled(!running && selMotion != null);
renameMotionBtn.setEnabled(deleteMotionBtn.isEnabled());
boolean plainPropertySelected = flamePropertiesTreeService.isPlainPropertySelected(flamePropertiesTree);
{
boolean linkMotionEnabled = false;
if (!running && selMotion != null && selMotion.getParent() == null) {
if (plainPropertySelected) {
FlamePropertyPath selPath = flamePropertiesTreeService.getSelectedPropertyPath(flamePropertiesTree);
linkMotionEnabled = !selMotion.hasLink(selPath);
}
}
linkMotionBtn.setEnabled(linkMotionEnabled);
unlinkMotionBtn.setEnabled(selMotion != null && motionLinksTable.getSelectedRow() >= 0 && motionLinksTable.getSelectedRow() < selMotion.getMotionLinks().size());
}
createMotionsCmb.setEnabled(!running);
clearMotionsBtn.setEnabled(!running && project.getMotions().size() > 0);
loadProjectBtn.setEnabled(!running);
saveProjectBtn.setEnabled(!running);
}
use of org.jwildfire.create.tina.dance.motion.Motion in project JWildfire by thargor6.
the class DancingFractalsController method refreshMotionTable.
private void refreshMotionTable() {
final int COL_MOTION = 0;
final int COL_START_FRAME = 1;
final int COL_END_FRAME = 2;
motionTable.setModel(new DefaultTableModel() {
private static final long serialVersionUID = 1L;
@Override
public int getRowCount() {
return project.getMotions().size();
}
@Override
public int getColumnCount() {
return 3;
}
@Override
public String getColumnName(int columnIndex) {
switch(columnIndex) {
case COL_MOTION:
return "Motion";
case COL_START_FRAME:
return "Start";
case COL_END_FRAME:
return "End";
}
return null;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Motion motion = rowIndex < project.getMotions().size() ? project.getMotions().get(rowIndex) : null;
if (motion != null) {
switch(columnIndex) {
case COL_MOTION:
return motion.getDisplayLabel();
case COL_START_FRAME:
return (motion.getStartFrame() != null) ? String.valueOf(motion.getStartFrame()) : "";
case COL_END_FRAME:
return (motion.getEndFrame() != null) ? String.valueOf(motion.getEndFrame()) : "";
}
}
return null;
}
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
});
motionTable.getTableHeader().setFont(motionTable.getFont());
motionTable.getColumnModel().getColumn(COL_MOTION).setWidth(120);
motionTable.getColumnModel().getColumn(COL_START_FRAME).setPreferredWidth(10);
motionTable.getColumnModel().getColumn(COL_END_FRAME).setWidth(10);
}
use of org.jwildfire.create.tina.dance.motion.Motion in project JWildfire by thargor6.
the class DancingFractalsController method replaceFlameFromEditorBtn_clicked.
public void replaceFlameFromEditorBtn_clicked(Flame pFlame) {
if (pFlame != null) {
Flame flame = poolFlameHolder.getFlame();
if (flame != null) {
int idx = flamePropertiesTree.getSelectionRows()[0];
// cant remove the flame by object reference because its a clone
Flame newFlame = validateDancingFlame(pFlame.makeCopy());
Flame oldFlame = project.getFlames().get(idx);
for (Motion motion : project.getMotions()) {
for (MotionLink link : motion.getMotionLinks()) {
if (link.getProperyPath().getFlame().isEqual(oldFlame)) {
link.getProperyPath().setFlame(newFlame);
}
}
}
project.getFlames().set(idx, newFlame);
refreshProjectFlames();
if (project.getFlames().size() == 0) {
flamePropertiesTree_changed(null);
} else {
try {
flamePropertiesTree.setSelectionRow(idx);
} catch (Exception ex) {
}
}
enableControls();
}
}
}
use of org.jwildfire.create.tina.dance.motion.Motion in project JWildfire by thargor6.
the class DancingFractalsController method linkMotionBtn_clicked.
public void linkMotionBtn_clicked() {
Motion currMotion = getSelectedMotion();
if (currMotion != null && flamePropertiesTreeService.isPlainPropertySelected(flamePropertiesTree)) {
FlamePropertyPath propertyPath = flamePropertiesTreeService.getSelectedPropertyPath(flamePropertiesTree);
currMotion.getMotionLinks().add(new MotionLink(propertyPath));
refreshMotionLinksTable();
int selectRow = currMotion.getMotionLinks().size() - 1;
motionLinksTable.getSelectionModel().setSelectionInterval(selectRow, selectRow);
enableControls();
}
}
Aggregations