Search in sources :

Example 1 with Motion

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();
    }
}
Also used : Motion(org.jwildfire.create.tina.dance.motion.Motion)

Example 2 with Motion

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);
}
Also used : Motion(org.jwildfire.create.tina.dance.motion.Motion) FlamePropertyPath(org.jwildfire.create.tina.dance.model.FlamePropertyPath)

Example 3 with Motion

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);
}
Also used : Motion(org.jwildfire.create.tina.dance.motion.Motion) DefaultTableModel(javax.swing.table.DefaultTableModel)

Example 4 with Motion

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();
        }
    }
}
Also used : Motion(org.jwildfire.create.tina.dance.motion.Motion) MotionLink(org.jwildfire.create.tina.dance.motion.MotionLink) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 5 with Motion

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();
    }
}
Also used : Motion(org.jwildfire.create.tina.dance.motion.Motion) MotionLink(org.jwildfire.create.tina.dance.motion.MotionLink) FlamePropertyPath(org.jwildfire.create.tina.dance.model.FlamePropertyPath)

Aggregations

Motion (org.jwildfire.create.tina.dance.motion.Motion)11 MotionLink (org.jwildfire.create.tina.dance.motion.MotionLink)4 DefaultTableModel (javax.swing.table.DefaultTableModel)2 Flame (org.jwildfire.create.tina.base.Flame)2 FlamePropertyPath (org.jwildfire.create.tina.dance.model.FlamePropertyPath)2 ComboBoxPropertyEditor (com.l2fprod.common.beans.editor.ComboBoxPropertyEditor)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 PropertyEditor (java.beans.PropertyEditor)1 BufferedInputStream (java.io.BufferedInputStream)1 FileInputStream (java.io.FileInputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 RecordedFFT (org.jwildfire.create.tina.audio.RecordedFFT)1 DancingFlameProject (org.jwildfire.create.tina.dance.DancingFlameProject)1 MotionType (org.jwildfire.create.tina.dance.motion.MotionType)1 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)1 PropertyPanel (org.jwildfire.swing.PropertyPanel)1