SDK :
- Skybox wizard now supports dds file format - Terrain editor now supports loading of dds files - Optimized buttons creation in the terrain editor's texture list git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8017 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
2a7d6582ae
commit
fb6abf7e84
@ -42,6 +42,7 @@ import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial;
|
|||||||
import com.jme3.gde.core.sceneexplorer.nodes.JmeTerrainQuad;
|
import com.jme3.gde.core.sceneexplorer.nodes.JmeTerrainQuad;
|
||||||
import com.jme3.gde.core.sceneexplorer.nodes.NodeUtility;
|
import com.jme3.gde.core.sceneexplorer.nodes.NodeUtility;
|
||||||
import com.jme3.gde.core.properties.TexturePropertyEditor;
|
import com.jme3.gde.core.properties.TexturePropertyEditor;
|
||||||
|
import com.jme3.gde.core.properties.preview.DDSPreview;
|
||||||
import com.jme3.gde.core.util.DataObjectSaveNode;
|
import com.jme3.gde.core.util.DataObjectSaveNode;
|
||||||
import com.jme3.gde.core.util.ToggleButtonGroup;
|
import com.jme3.gde.core.util.ToggleButtonGroup;
|
||||||
import com.jme3.gde.terraineditor.sky.SkyboxWizardAction;
|
import com.jme3.gde.terraineditor.sky.SkyboxWizardAction;
|
||||||
@ -66,6 +67,8 @@ import java.beans.PropertyChangeEvent;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.swing.AbstractCellEditor;
|
import javax.swing.AbstractCellEditor;
|
||||||
import javax.swing.DefaultListSelectionModel;
|
import javax.swing.DefaultListSelectionModel;
|
||||||
@ -128,8 +131,9 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
private JmeSpatial selectedSpat;
|
private JmeSpatial selectedSpat;
|
||||||
private TerrainNodeListener terrainDeletedNodeListener;
|
private TerrainNodeListener terrainDeletedNodeListener;
|
||||||
private boolean availableNormalTextures;
|
private boolean availableNormalTextures;
|
||||||
|
|
||||||
private HelpCtx ctx = new HelpCtx("sdk.terrain_editor");
|
private HelpCtx ctx = new HelpCtx("sdk.terrain_editor");
|
||||||
|
private DDSPreview ddsPreview;
|
||||||
|
private Map<String, JButton> buttons = new HashMap<String, JButton>();
|
||||||
|
|
||||||
public TerrainEditorTopComponent() {
|
public TerrainEditorTopComponent() {
|
||||||
initComponents();
|
initComponents();
|
||||||
@ -140,7 +144,6 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
result = Utilities.actionsGlobalContext().lookupResult(JmeSpatial.class);
|
result = Utilities.actionsGlobalContext().lookupResult(JmeSpatial.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class EntropyCalcProgressMonitor implements ProgressMonitor {
|
class EntropyCalcProgressMonitor implements ProgressMonitor {
|
||||||
|
|
||||||
private ProgressHandle progressHandle;
|
private ProgressHandle progressHandle;
|
||||||
@ -178,7 +181,6 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setHintText(String text) {
|
private void setHintText(String text) {
|
||||||
@ -186,12 +188,12 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setHintText(TerrainTool tool) {
|
private void setHintText(TerrainTool tool) {
|
||||||
if (tool != null)
|
if (tool != null) {
|
||||||
hintTextArea.setText(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, tool.getToolHintTextKey()));
|
hintTextArea.setText(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, tool.getToolHintTextKey()));
|
||||||
else
|
} else {
|
||||||
hintTextArea.setText(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.toolHint.default"));
|
hintTextArea.setText(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.toolHint.default"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
* initialize the form.
|
* initialize the form.
|
||||||
@ -619,11 +621,12 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
}//GEN-LAST:event_paintButtonActionPerformed
|
}//GEN-LAST:event_paintButtonActionPerformed
|
||||||
|
|
||||||
private void addTextureButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTextureButtonActionPerformed
|
private void addTextureButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTextureButtonActionPerformed
|
||||||
if (editorController == null || editorController.getTerrain(null) == null)
|
if (editorController == null || editorController.getTerrain(null) == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int index = getTableModel().getRowCount(); // get the last row
|
int index = getTableModel().getRowCount(); // get the last row
|
||||||
addNewTextureLayer(index);
|
addNewTextureLayer(index);
|
||||||
editorController.enableTextureButtons();
|
// editorController.enableTextureButtons();
|
||||||
}//GEN-LAST:event_addTextureButtonActionPerformed
|
}//GEN-LAST:event_addTextureButtonActionPerformed
|
||||||
|
|
||||||
protected void enableAddTextureButton(boolean enabled) {
|
protected void enableAddTextureButton(boolean enabled) {
|
||||||
@ -643,12 +646,16 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeTextureButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeTextureButtonActionPerformed
|
private void removeTextureButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeTextureButtonActionPerformed
|
||||||
if (editorController == null || editorController.getTerrain(null) == null)
|
if (editorController == null || editorController.getTerrain(null) == null) {
|
||||||
return;
|
return;
|
||||||
if (getTableModel().getRowCount() == 0)
|
}
|
||||||
|
if (getTableModel().getRowCount() == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int index = getTableModel().getRowCount() - 1; // get the last row
|
int index = getTableModel().getRowCount() - 1; // get the last row
|
||||||
removeTextureLayer(index);
|
removeTextureLayer(index);
|
||||||
|
buttons.remove(index + "-" + 1);
|
||||||
|
buttons.remove(index + "-" + 2);
|
||||||
editorController.enableTextureButtons();
|
editorController.enableTextureButtons();
|
||||||
}//GEN-LAST:event_removeTextureButtonActionPerformed
|
}//GEN-LAST:event_removeTextureButtonActionPerformed
|
||||||
|
|
||||||
@ -666,8 +673,9 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
private void triPlanarCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_triPlanarCheckBoxActionPerformed
|
private void triPlanarCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_triPlanarCheckBoxActionPerformed
|
||||||
editorController.setTriPlanarEnabled(triPlanarCheckBox.isSelected());
|
editorController.setTriPlanarEnabled(triPlanarCheckBox.isSelected());
|
||||||
((TextureTableModel) textureTable.getModel()).updateScales();
|
((TextureTableModel) textureTable.getModel()).updateScales();
|
||||||
if ( triPlanarCheckBox.isSelected())
|
if (triPlanarCheckBox.isSelected()) {
|
||||||
setHintText("Make sure your scale is a power of 2, (1/2^n), when in tri-planar mode");
|
setHintText("Make sure your scale is a power of 2, (1/2^n), when in tri-planar mode");
|
||||||
|
}
|
||||||
}//GEN-LAST:event_triPlanarCheckBoxActionPerformed
|
}//GEN-LAST:event_triPlanarCheckBoxActionPerformed
|
||||||
|
|
||||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||||
@ -686,13 +694,15 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
}//GEN-LAST:event_levelTerrainButtonActionPerformed
|
}//GEN-LAST:event_levelTerrainButtonActionPerformed
|
||||||
|
|
||||||
private void radiusSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_radiusSliderStateChanged
|
private void radiusSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_radiusSliderStateChanged
|
||||||
if (toolController != null)
|
if (toolController != null) {
|
||||||
toolController.setHeightToolRadius((float) radiusSlider.getValue() / (float) radiusSlider.getMaximum());
|
toolController.setHeightToolRadius((float) radiusSlider.getValue() / (float) radiusSlider.getMaximum());
|
||||||
|
}
|
||||||
}//GEN-LAST:event_radiusSliderStateChanged
|
}//GEN-LAST:event_radiusSliderStateChanged
|
||||||
|
|
||||||
private void heightSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_heightSliderStateChanged
|
private void heightSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_heightSliderStateChanged
|
||||||
if (toolController != null)
|
if (toolController != null) {
|
||||||
toolController.setHeightToolHeight((float) heightSlider.getValue() / (float) heightSlider.getMaximum());
|
toolController.setHeightToolHeight((float) heightSlider.getValue() / (float) heightSlider.getMaximum());
|
||||||
|
}
|
||||||
}//GEN-LAST:event_heightSliderStateChanged
|
}//GEN-LAST:event_heightSliderStateChanged
|
||||||
|
|
||||||
private void smoothTerrainButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_smoothTerrainButtonActionPerformed
|
private void smoothTerrainButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_smoothTerrainButtonActionPerformed
|
||||||
@ -705,7 +715,6 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
setHintText((TerrainTool) null);
|
setHintText((TerrainTool) null);
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_smoothTerrainButtonActionPerformed
|
}//GEN-LAST:event_smoothTerrainButtonActionPerformed
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JButton addTextureButton;
|
private javax.swing.JButton addTextureButton;
|
||||||
private javax.swing.JButton createTerrainButton;
|
private javax.swing.JButton createTerrainButton;
|
||||||
@ -741,6 +750,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
private javax.swing.JPanel toolSettingsPanel;
|
private javax.swing.JPanel toolSettingsPanel;
|
||||||
private javax.swing.JCheckBox triPlanarCheckBox;
|
private javax.swing.JCheckBox triPlanarCheckBox;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets default instance. Do not use directly: reserved for *.settings files only,
|
* Gets default instance. Do not use directly: reserved for *.settings files only,
|
||||||
* i.e. deserialization routines; otherwise you could get a non-deserialized instance.
|
* i.e. deserialization routines; otherwise you could get a non-deserialized instance.
|
||||||
@ -753,7 +763,6 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addSpatial(final String name) {
|
public void addSpatial(final String name) {
|
||||||
if (selectedSpat == null) {
|
if (selectedSpat == null) {
|
||||||
|
|
||||||
@ -768,21 +777,21 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
final Spatial node = selectedSpat.getLookup().lookup(Spatial.class);
|
final Spatial node = selectedSpat.getLookup().lookup(Spatial.class);
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
if ("Terrain".equals(name)) {
|
if ("Terrain".equals(name)) {
|
||||||
if (terrainWizard == null)
|
if (terrainWizard == null) {
|
||||||
terrainWizard = new CreateTerrainWizardAction(this);
|
terrainWizard = new CreateTerrainWizardAction(this);
|
||||||
|
}
|
||||||
terrainWizard.performAction();
|
terrainWizard.performAction();
|
||||||
} else if ("Skybox".equals(name)) {
|
} else if ("Skybox".equals(name)) {
|
||||||
if (skyboxWizard == null)
|
if (skyboxWizard == null) {
|
||||||
skyboxWizard = new SkyboxWizardAction(this);
|
skyboxWizard = new SkyboxWizardAction(this);
|
||||||
|
}
|
||||||
skyboxWizard.performAction();
|
skyboxWizard.performAction();
|
||||||
} else if ("Ocean".equals(name)) {
|
} else if ("Ocean".equals(name)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void generateTerrain(final WizardDescriptor wizardDescriptor) {
|
protected void generateTerrain(final WizardDescriptor wizardDescriptor) {
|
||||||
final Spatial node = selectedSpat.getLookup().lookup(Spatial.class);
|
final Spatial node = selectedSpat.getLookup().lookup(Spatial.class);
|
||||||
|
|
||||||
@ -892,6 +901,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
* and reinitialize the texture table
|
* and reinitialize the texture table
|
||||||
*/
|
*/
|
||||||
private class TerrainNodeListener implements NodeListener {
|
private class TerrainNodeListener implements NodeListener {
|
||||||
|
|
||||||
public void childrenAdded(NodeMemberEvent nme) {
|
public void childrenAdded(NodeMemberEvent nme) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -908,13 +918,11 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
|
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the TerrainEditorTopComponent instance. Never call {@link #getDefault} directly!
|
* Obtain the TerrainEditorTopComponent instance. Never call {@link #getDefault} directly!
|
||||||
*/
|
*/
|
||||||
@ -1070,6 +1078,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
toolController.setHeightToolHeight((float) heightSlider.getValue() / (float) heightSlider.getMaximum());
|
toolController.setHeightToolHeight((float) heightSlider.getValue() / (float) heightSlider.getMaximum());
|
||||||
|
|
||||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
reinitTextureTable(); // update the UI
|
reinitTextureTable(); // update the UI
|
||||||
if (editorController.getTerrain(null) != null) {
|
if (editorController.getTerrain(null) != null) {
|
||||||
@ -1083,6 +1092,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
|
|
||||||
protected synchronized void addDataObject(final DataObjectSaveNode dataObject) {
|
protected synchronized void addDataObject(final DataObjectSaveNode dataObject) {
|
||||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
addSaveNode(dataObject);
|
addSaveNode(dataObject);
|
||||||
}
|
}
|
||||||
@ -1099,9 +1109,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
if (jmeNode != null) {
|
if (jmeNode != null) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!active) {
|
if (!active) {
|
||||||
@ -1135,8 +1143,6 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
public void previewRequested(PreviewRequest request) {
|
public void previewRequested(PreviewRequest request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void cleanupControllers() {
|
private void cleanupControllers() {
|
||||||
if (camController != null) {
|
if (camController != null) {
|
||||||
camController.disable();
|
camController.disable();
|
||||||
@ -1167,18 +1173,21 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
textureTable.getColumnModel().getColumn(2).setCellEditor(rendererNormal);
|
textureTable.getColumnModel().getColumn(2).setCellEditor(rendererNormal);
|
||||||
|
|
||||||
// empty out the table
|
// empty out the table
|
||||||
for (int i=0; i<textureTable.getModel().getRowCount(); i++)
|
for (int i = 0; i < textureTable.getModel().getRowCount(); i++) {
|
||||||
((TextureTableModel) textureTable.getModel()).removeRow(i);
|
((TextureTableModel) textureTable.getModel()).removeRow(i);
|
||||||
|
}
|
||||||
|
|
||||||
if (editorController.getTerrain(null) == null)
|
if (editorController.getTerrain(null) == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
getTableModel().initModel();
|
getTableModel().initModel();
|
||||||
|
|
||||||
if (textureTable.getRowCount() > 0)
|
if (textureTable.getRowCount() > 0) {
|
||||||
toolController.setSelectedTextureIndex(0); // select the first row by default
|
toolController.setSelectedTextureIndex(0); // select the first row by default
|
||||||
else
|
} else {
|
||||||
toolController.setSelectedTextureIndex(-1);
|
toolController.setSelectedTextureIndex(-1);
|
||||||
|
}
|
||||||
|
|
||||||
editorController.enableTextureButtons();
|
editorController.enableTextureButtons();
|
||||||
triPlanarCheckBox.setSelected(editorController.isTriPlanarEnabled());
|
triPlanarCheckBox.setSelected(editorController.isTriPlanarEnabled());
|
||||||
@ -1202,15 +1211,16 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
* @param selectedIndex
|
* @param selectedIndex
|
||||||
*/
|
*/
|
||||||
private void removeTextureLayer(int selectedIndex) {
|
private void removeTextureLayer(int selectedIndex) {
|
||||||
if (selectedIndex < 0)
|
if (selectedIndex < 0) {
|
||||||
return; // abort
|
return; // abort
|
||||||
|
}
|
||||||
getTableModel().removeTexture(selectedIndex);
|
getTableModel().removeTexture(selectedIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextureTableModel getTableModel() {
|
private TextureTableModel getTableModel() {
|
||||||
if (textureTable == null)
|
if (textureTable == null) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
return (TextureTableModel) textureTable.getModel();
|
return (TextureTableModel) textureTable.getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1228,17 +1238,20 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
public void initModel() {
|
public void initModel() {
|
||||||
|
|
||||||
// empty the table
|
// empty the table
|
||||||
while (getRowCount() > 0)
|
while (getRowCount() > 0) {
|
||||||
removeRow(0);
|
removeRow(0);
|
||||||
|
}
|
||||||
|
|
||||||
// fill the table with the proper data
|
// fill the table with the proper data
|
||||||
for (int i = 0; i < editorController.MAX_TEXTURES; i++) {
|
for (int i = 0; i < editorController.MAX_TEXTURES; i++) {
|
||||||
if (!editorController.hasTextureAt(i))
|
if (!editorController.hasTextureAt(i)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Float scale = editorController.getTextureScale(i);
|
Float scale = editorController.getTextureScale(i);
|
||||||
if (scale == null)
|
if (scale == null) {
|
||||||
scale = editorController.DEFAULT_TEXTURE_SCALE;
|
scale = editorController.DEFAULT_TEXTURE_SCALE;
|
||||||
|
}
|
||||||
addRow(new Object[]{"", i, i, scale});
|
addRow(new Object[]{"", i, i, scale});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1253,13 +1266,15 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
// it seems to keep the selection when we delete the row
|
// it seems to keep the selection when we delete the row
|
||||||
@Override
|
@Override
|
||||||
public void setValueAt(Object aValue, int row, int column) {
|
public void setValueAt(Object aValue, int row, int column) {
|
||||||
if (row < 0 || row > getRowCount()-1)
|
if (row < 0 || row > getRowCount() - 1) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
super.setValueAt(aValue, row, column);
|
super.setValueAt(aValue, row, column);
|
||||||
|
|
||||||
if (column == 3)
|
if (column == 3) {
|
||||||
setTextureScale(row, new Float((String) aValue));
|
setTextureScale(row, new Float((String) aValue));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void addNewTexture(int newIndex) {
|
protected void addNewTexture(int newIndex) {
|
||||||
float scale = editorController.DEFAULT_TEXTURE_SCALE;
|
float scale = editorController.DEFAULT_TEXTURE_SCALE;
|
||||||
@ -1304,7 +1319,6 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
editorController.removeTextureLayer(index);
|
editorController.removeTextureLayer(index);
|
||||||
editorController.enableTextureButtons();
|
editorController.enableTextureButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1316,10 +1330,12 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
super.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
super.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
|
|
||||||
addListSelectionListener(new ListSelectionListener() {
|
addListSelectionListener(new ListSelectionListener() {
|
||||||
|
|
||||||
public void valueChanged(ListSelectionEvent e) {
|
public void valueChanged(ListSelectionEvent e) {
|
||||||
if (toolController != null)
|
if (toolController != null) {
|
||||||
toolController.setSelectedTextureIndex(textureTable.getSelectedRow());
|
toolController.setSelectedTextureIndex(textureTable.getSelectedRow());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1351,49 +1367,80 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
|
|
||||||
private JButton getButton(Object value, final int row, final int column) {
|
private JButton getButton(Object value, final int row, final int column) {
|
||||||
|
|
||||||
|
JButton button = buttons.get(row + "-" + column);
|
||||||
|
if (button == null) {
|
||||||
final JButton lbl = new JButton();
|
final JButton lbl = new JButton();
|
||||||
|
buttons.put(row + "-" + column, lbl);
|
||||||
|
|
||||||
//TODO check if there is a normal or a texture here at this index
|
//TODO check if there is a normal or a texture here at this index
|
||||||
if (value == null)
|
if (value == null) {
|
||||||
value = getTableModel().getValueAt(row, column);
|
value = getTableModel().getValueAt(row, column);
|
||||||
|
}
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
// this is messy, fix it so we know what values are coming in from where:
|
// this is messy, fix it so we know what values are coming in from where:
|
||||||
if (value instanceof String)
|
if (value instanceof String) {
|
||||||
index = new Float((String) value).intValue();
|
index = new Float((String) value).intValue();
|
||||||
else if (value instanceof Float)
|
} else if (value instanceof Float) {
|
||||||
index = ((Float) value).intValue();
|
index = ((Float) value).intValue();
|
||||||
else if (value instanceof Integer)
|
} else if (value instanceof Integer) {
|
||||||
index = (Integer) value;
|
index = (Integer) value;
|
||||||
|
}
|
||||||
|
|
||||||
Texture tex = getTextureFromModel(index); // delegate to sub-class
|
Texture tex = getTextureFromModel(index); // delegate to sub-class
|
||||||
|
|
||||||
//Texture tex = SceneApplication.getApplication().getAssetManager().loadTexture((String)value);
|
//Texture tex = SceneApplication.getApplication().getAssetManager().loadTexture((String)value);
|
||||||
if (tex != null) {
|
if (tex != null) {
|
||||||
|
String selected = tex.getKey().getName();
|
||||||
|
|
||||||
|
if (selected.endsWith(".dds") || selected.endsWith(".DDS")) {
|
||||||
|
if (ddsPreview == null) {
|
||||||
|
ddsPreview = new DDSPreview((ProjectAssetManager) SceneApplication.getApplication().getAssetManager());
|
||||||
|
}
|
||||||
|
ddsPreview.requestPreview(selected, "", 80, 80, lbl, null);
|
||||||
|
|
||||||
|
} else {
|
||||||
Icon icon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
Icon icon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
||||||
lbl.setIcon(icon);
|
lbl.setIcon(icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
lbl.addActionListener(new ActionListener() {
|
lbl.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
||||||
if (alreadyChoosing)
|
if (alreadyChoosing) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
alreadyChoosing = true;
|
alreadyChoosing = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Texture selectedTex = getTextureFromModel(row); // delegates to sub class
|
Texture selectedTex = getTextureFromModel(row); // delegates to sub class
|
||||||
if (selectedTex == null && !availableNormalTextures) // bail if we are at our texture limit
|
if (selectedTex == null && !availableNormalTextures) // bail if we are at our texture limit
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
TexturePropertyEditor editor = new TexturePropertyEditor(selectedTex);
|
TexturePropertyEditor editor = new TexturePropertyEditor(selectedTex);
|
||||||
Component view = editor.getCustomEditor();
|
Component view = editor.getCustomEditor();
|
||||||
view.setVisible(true);
|
view.setVisible(true);
|
||||||
Texture tex = (Texture) editor.getValue();
|
Texture tex = (Texture) editor.getValue();
|
||||||
if (editor.getValue() != null) {
|
if (editor.getValue() != null) {
|
||||||
|
String selected = tex.getKey().getName();
|
||||||
|
|
||||||
|
if (selected.endsWith(".dds") || selected.endsWith(".DDS")) {
|
||||||
|
if (ddsPreview == null) {
|
||||||
|
ddsPreview = new DDSPreview((ProjectAssetManager) SceneApplication.getApplication().getAssetManager());
|
||||||
|
}
|
||||||
|
ddsPreview.requestPreview(selected, "", 80, 80, lbl, null);
|
||||||
|
|
||||||
|
} else {
|
||||||
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
||||||
lbl.setIcon(newicon);
|
lbl.setIcon(newicon);
|
||||||
|
}
|
||||||
} else if (supportsNullTexture()) {
|
} else if (supportsNullTexture()) {
|
||||||
lbl.setIcon(null);
|
lbl.setIcon(null);
|
||||||
}
|
}
|
||||||
@ -1403,30 +1450,37 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return lbl;
|
return lbl;
|
||||||
}
|
}
|
||||||
|
return button;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TextureCellRendererEditor extends CellRendererEditor {
|
public class TextureCellRendererEditor extends CellRendererEditor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getCellEditorValue() {
|
public Object getCellEditorValue() {
|
||||||
int row = textureTable.getSelectedRow();
|
int row = textureTable.getSelectedRow();
|
||||||
if (row < 0)
|
if (row < 0) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
return getTableModel().getValueAt(row, 1);
|
return getTableModel().getValueAt(row, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setTextureInModel(int row, String path) {
|
protected void setTextureInModel(int row, String path) {
|
||||||
if (path != null)
|
if (path != null) {
|
||||||
getTableModel().setTexture(row, path);
|
getTableModel().setTexture(row, path);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setTextureInModel(int row, Texture tex) {
|
protected void setTextureInModel(int row, Texture tex) {
|
||||||
if (tex != null)
|
if (tex != null) {
|
||||||
getTableModel().setTexture(row, tex);
|
getTableModel().setTexture(row, tex);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Texture getTextureFromModel(int index) {
|
protected Texture getTextureFromModel(int index) {
|
||||||
@ -1437,15 +1491,16 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
protected boolean supportsNullTexture() {
|
protected boolean supportsNullTexture() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NormalCellRendererEditor extends CellRendererEditor {
|
public class NormalCellRendererEditor extends CellRendererEditor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getCellEditorValue() {
|
public Object getCellEditorValue() {
|
||||||
int row = textureTable.getSelectedRow();
|
int row = textureTable.getSelectedRow();
|
||||||
if (row < 0)
|
if (row < 0) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
return getTableModel().getValueAt(row, 2);
|
return getTableModel().getValueAt(row, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1470,7 +1525,6 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A file filter to only show images
|
* A file filter to only show images
|
||||||
*/
|
*/
|
||||||
@ -1478,6 +1532,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
|
|
||||||
Utils utils = new Utils();
|
Utils utils = new Utils();
|
||||||
//Accept all directories and all gif, jpg, tiff, or png files.
|
//Accept all directories and all gif, jpg, tiff, or png files.
|
||||||
|
|
||||||
public boolean accept(File f) {
|
public boolean accept(File f) {
|
||||||
if (f.isDirectory()) {
|
if (f.isDirectory()) {
|
||||||
return true;
|
return true;
|
||||||
@ -1485,12 +1540,13 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
|
|
||||||
String extension = utils.getExtension(f);
|
String extension = utils.getExtension(f);
|
||||||
if (extension != null) {
|
if (extension != null) {
|
||||||
if (extension.equals(utils.tiff) ||
|
if (extension.equals(utils.tiff)
|
||||||
extension.equals(utils.tif) ||
|
|| extension.equals(utils.tif)
|
||||||
extension.equals(utils.gif) ||
|
|| extension.equals(utils.gif)
|
||||||
extension.equals(utils.jpeg) ||
|
|| extension.equals(utils.jpeg)
|
||||||
extension.equals(utils.jpg) ||
|
|| extension.equals(utils.jpg)
|
||||||
extension.equals(utils.png)) {
|
|| extension.equals(utils.png)
|
||||||
|
|| extension.equals(utils.dds)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -1509,50 +1565,44 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
/**
|
/**
|
||||||
* restricts the file chooser to a specified directory tree, such as the assets folder
|
* restricts the file chooser to a specified directory tree, such as the assets folder
|
||||||
*/
|
*/
|
||||||
class DirectoryRestrictedFileSystemView extends FileSystemView
|
class DirectoryRestrictedFileSystemView extends FileSystemView {
|
||||||
{
|
|
||||||
private final File[] rootDirectories;
|
private final File[] rootDirectories;
|
||||||
|
|
||||||
DirectoryRestrictedFileSystemView(File rootDirectory)
|
DirectoryRestrictedFileSystemView(File rootDirectory) {
|
||||||
{
|
|
||||||
this.rootDirectories = new File[]{rootDirectory};
|
this.rootDirectories = new File[]{rootDirectory};
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryRestrictedFileSystemView(File[] rootDirectories)
|
DirectoryRestrictedFileSystemView(File[] rootDirectories) {
|
||||||
{
|
|
||||||
this.rootDirectories = rootDirectories;
|
this.rootDirectories = rootDirectories;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean isTraversable(File f) {
|
public Boolean isTraversable(File f) {
|
||||||
if (f.getAbsolutePath().indexOf(rootDirectories[0].getAbsolutePath()) >= 0)
|
if (f.getAbsolutePath().indexOf(rootDirectories[0].getAbsolutePath()) >= 0) {
|
||||||
return Boolean.valueOf(f.isDirectory());
|
return Boolean.valueOf(f.isDirectory());
|
||||||
else
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getDefaultDirectory()
|
public File getDefaultDirectory() {
|
||||||
{
|
|
||||||
return rootDirectories[0];
|
return rootDirectories[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getHomeDirectory()
|
public File getHomeDirectory() {
|
||||||
{
|
|
||||||
return rootDirectories[0];
|
return rootDirectories[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File[] getRoots()
|
public File[] getRoots() {
|
||||||
{
|
|
||||||
return rootDirectories;
|
return rootDirectories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File createNewFolder(File containingDir) throws IOException
|
public File createNewFolder(File containingDir) throws IOException {
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException("Unable to create directory");
|
throw new UnsupportedOperationException("Unable to create directory");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -1575,12 +1625,14 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
public final String jpeg = "jpeg";
|
public final String jpeg = "jpeg";
|
||||||
public final String jpg = "jpg";
|
public final String jpg = "jpg";
|
||||||
public final String gif = "gif";
|
public final String gif = "gif";
|
||||||
public final String tiff = "tiff";
|
public final String tiff = "tiff";
|
||||||
public final String tif = "tif";
|
public final String tif = "tif";
|
||||||
public final String png = "png";
|
public final String png = "png";
|
||||||
|
public final String dds = "dds";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the extension of a file.
|
* Get the extension of a file.
|
||||||
|
@ -31,7 +31,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.jme3.gde.terraineditor.sky;
|
package com.jme3.gde.terraineditor.sky;
|
||||||
|
|
||||||
|
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||||
import com.jme3.gde.core.properties.TexturePropertyEditor;
|
import com.jme3.gde.core.properties.TexturePropertyEditor;
|
||||||
|
import com.jme3.gde.core.properties.preview.DDSPreview;
|
||||||
|
import com.jme3.gde.core.scene.SceneApplication;
|
||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
@ -43,6 +46,8 @@ import org.openide.util.ImageUtilities;
|
|||||||
|
|
||||||
public final class SkyboxVisualPanel2 extends JPanel {
|
public final class SkyboxVisualPanel2 extends JPanel {
|
||||||
|
|
||||||
|
private DDSPreview ddsPreview;
|
||||||
|
|
||||||
/** Creates new form SkyboxVisualPanel2 */
|
/** Creates new form SkyboxVisualPanel2 */
|
||||||
public SkyboxVisualPanel2() {
|
public SkyboxVisualPanel2() {
|
||||||
initComponents();
|
initComponents();
|
||||||
@ -60,7 +65,6 @@ public final class SkyboxVisualPanel2 extends JPanel {
|
|||||||
public JPanel getSingleTexturePanel() {
|
public JPanel getSingleTexturePanel() {
|
||||||
return singleTexturePanel;
|
return singleTexturePanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
TexturePropertyEditor editorNorth = new TexturePropertyEditor();
|
TexturePropertyEditor editorNorth = new TexturePropertyEditor();
|
||||||
TexturePropertyEditor editorSouth = new TexturePropertyEditor();
|
TexturePropertyEditor editorSouth = new TexturePropertyEditor();
|
||||||
TexturePropertyEditor editorEast = new TexturePropertyEditor();
|
TexturePropertyEditor editorEast = new TexturePropertyEditor();
|
||||||
@ -97,7 +101,6 @@ public final class SkyboxVisualPanel2 extends JPanel {
|
|||||||
return editorWest;
|
return editorWest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
* initialize the form.
|
* initialize the form.
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
* WARNING: Do NOT modify this code. The content of this method is
|
||||||
@ -420,9 +423,19 @@ public final class SkyboxVisualPanel2 extends JPanel {
|
|||||||
view.setVisible(true);
|
view.setVisible(true);
|
||||||
if (editorSouth.getValue() != null) {
|
if (editorSouth.getValue() != null) {
|
||||||
Texture tex = (Texture) editorSouth.getValue();
|
Texture tex = (Texture) editorSouth.getValue();
|
||||||
|
String selected = tex.getKey().getName();
|
||||||
|
|
||||||
|
if (selected.endsWith(".dds") || selected.endsWith(".DDS")) {
|
||||||
|
if (ddsPreview == null) {
|
||||||
|
ddsPreview = new DDSPreview((ProjectAssetManager) SceneApplication.getApplication().getAssetManager());
|
||||||
|
}
|
||||||
|
ddsPreview.requestPreview(selected, "", 80, 80, southPic, null);
|
||||||
|
|
||||||
|
} else {
|
||||||
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
||||||
southPic.setIcon(newicon);
|
southPic.setIcon(newicon);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}//GEN-LAST:event_multipleTexSouthLoadButtonActionPerformed
|
}//GEN-LAST:event_multipleTexSouthLoadButtonActionPerformed
|
||||||
|
|
||||||
private void multipleTexNorthLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multipleTexNorthLoadButtonActionPerformed
|
private void multipleTexNorthLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multipleTexNorthLoadButtonActionPerformed
|
||||||
@ -430,9 +443,19 @@ public final class SkyboxVisualPanel2 extends JPanel {
|
|||||||
view.setVisible(true);
|
view.setVisible(true);
|
||||||
if (editorNorth.getValue() != null) {
|
if (editorNorth.getValue() != null) {
|
||||||
Texture tex = (Texture) editorNorth.getValue();
|
Texture tex = (Texture) editorNorth.getValue();
|
||||||
|
String selected = tex.getKey().getName();
|
||||||
|
|
||||||
|
if (selected.endsWith(".dds") || selected.endsWith(".DDS")) {
|
||||||
|
if (ddsPreview == null) {
|
||||||
|
ddsPreview = new DDSPreview((ProjectAssetManager) SceneApplication.getApplication().getAssetManager());
|
||||||
|
}
|
||||||
|
ddsPreview.requestPreview(selected, "", 80, 80, northPic, null);
|
||||||
|
|
||||||
|
} else {
|
||||||
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
||||||
northPic.setIcon(newicon);
|
northPic.setIcon(newicon);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}//GEN-LAST:event_multipleTexNorthLoadButtonActionPerformed
|
}//GEN-LAST:event_multipleTexNorthLoadButtonActionPerformed
|
||||||
|
|
||||||
private void multipleTexEastLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multipleTexEastLoadButtonActionPerformed
|
private void multipleTexEastLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multipleTexEastLoadButtonActionPerformed
|
||||||
@ -440,9 +463,19 @@ public final class SkyboxVisualPanel2 extends JPanel {
|
|||||||
view.setVisible(true);
|
view.setVisible(true);
|
||||||
if (editorEast.getValue() != null) {
|
if (editorEast.getValue() != null) {
|
||||||
Texture tex = (Texture) editorEast.getValue();
|
Texture tex = (Texture) editorEast.getValue();
|
||||||
|
String selected = tex.getKey().getName();
|
||||||
|
|
||||||
|
if (selected.endsWith(".dds") || selected.endsWith(".DDS")) {
|
||||||
|
if (ddsPreview == null) {
|
||||||
|
ddsPreview = new DDSPreview((ProjectAssetManager) SceneApplication.getApplication().getAssetManager());
|
||||||
|
}
|
||||||
|
ddsPreview.requestPreview(selected, "", 80, 80, eastPic, null);
|
||||||
|
|
||||||
|
} else {
|
||||||
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
||||||
eastPic.setIcon(newicon);
|
eastPic.setIcon(newicon);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}//GEN-LAST:event_multipleTexEastLoadButtonActionPerformed
|
}//GEN-LAST:event_multipleTexEastLoadButtonActionPerformed
|
||||||
|
|
||||||
private void multipleTexWestLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multipleTexWestLoadButtonActionPerformed
|
private void multipleTexWestLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multipleTexWestLoadButtonActionPerformed
|
||||||
@ -450,9 +483,19 @@ public final class SkyboxVisualPanel2 extends JPanel {
|
|||||||
view.setVisible(true);
|
view.setVisible(true);
|
||||||
if (editorWest.getValue() != null) {
|
if (editorWest.getValue() != null) {
|
||||||
Texture tex = (Texture) editorWest.getValue();
|
Texture tex = (Texture) editorWest.getValue();
|
||||||
|
String selected = tex.getKey().getName();
|
||||||
|
|
||||||
|
if (selected.endsWith(".dds") || selected.endsWith(".DDS")) {
|
||||||
|
if (ddsPreview == null) {
|
||||||
|
ddsPreview = new DDSPreview((ProjectAssetManager) SceneApplication.getApplication().getAssetManager());
|
||||||
|
}
|
||||||
|
ddsPreview.requestPreview(selected, "", 80, 80, westPic, null);
|
||||||
|
|
||||||
|
} else {
|
||||||
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
||||||
westPic.setIcon(newicon);
|
westPic.setIcon(newicon);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}//GEN-LAST:event_multipleTexWestLoadButtonActionPerformed
|
}//GEN-LAST:event_multipleTexWestLoadButtonActionPerformed
|
||||||
|
|
||||||
private void multipleTexTopLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multipleTexTopLoadButtonActionPerformed
|
private void multipleTexTopLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multipleTexTopLoadButtonActionPerformed
|
||||||
@ -460,9 +503,19 @@ public final class SkyboxVisualPanel2 extends JPanel {
|
|||||||
view.setVisible(true);
|
view.setVisible(true);
|
||||||
if (editorTop.getValue() != null) {
|
if (editorTop.getValue() != null) {
|
||||||
Texture tex = (Texture) editorTop.getValue();
|
Texture tex = (Texture) editorTop.getValue();
|
||||||
|
String selected = tex.getKey().getName();
|
||||||
|
|
||||||
|
if (selected.endsWith(".dds") || selected.endsWith(".DDS")) {
|
||||||
|
if (ddsPreview == null) {
|
||||||
|
ddsPreview = new DDSPreview((ProjectAssetManager) SceneApplication.getApplication().getAssetManager());
|
||||||
|
}
|
||||||
|
ddsPreview.requestPreview(selected, "", 80, 80, topPic, null);
|
||||||
|
|
||||||
|
} else {
|
||||||
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
||||||
topPic.setIcon(newicon);
|
topPic.setIcon(newicon);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}//GEN-LAST:event_multipleTexTopLoadButtonActionPerformed
|
}//GEN-LAST:event_multipleTexTopLoadButtonActionPerformed
|
||||||
|
|
||||||
private void multipleTexBottomLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multipleTexBottomLoadButtonActionPerformed
|
private void multipleTexBottomLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multipleTexBottomLoadButtonActionPerformed
|
||||||
@ -470,9 +523,19 @@ public final class SkyboxVisualPanel2 extends JPanel {
|
|||||||
view.setVisible(true);
|
view.setVisible(true);
|
||||||
if (editorBottom.getValue() != null) {
|
if (editorBottom.getValue() != null) {
|
||||||
Texture tex = (Texture) editorBottom.getValue();
|
Texture tex = (Texture) editorBottom.getValue();
|
||||||
|
String selected = tex.getKey().getName();
|
||||||
|
|
||||||
|
if (selected.endsWith(".dds") || selected.endsWith(".DDS")) {
|
||||||
|
if (ddsPreview == null) {
|
||||||
|
ddsPreview = new DDSPreview((ProjectAssetManager) SceneApplication.getApplication().getAssetManager());
|
||||||
|
}
|
||||||
|
ddsPreview.requestPreview(selected, "", 80, 80, bottomPic, null);
|
||||||
|
|
||||||
|
} else {
|
||||||
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
||||||
bottomPic.setIcon(newicon);
|
bottomPic.setIcon(newicon);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}//GEN-LAST:event_multipleTexBottomLoadButtonActionPerformed
|
}//GEN-LAST:event_multipleTexBottomLoadButtonActionPerformed
|
||||||
|
|
||||||
private void singleTexLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_singleTexLoadButtonActionPerformed
|
private void singleTexLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_singleTexLoadButtonActionPerformed
|
||||||
@ -480,11 +543,21 @@ public final class SkyboxVisualPanel2 extends JPanel {
|
|||||||
view.setVisible(true);
|
view.setVisible(true);
|
||||||
if (editorSingle.getValue() != null) {
|
if (editorSingle.getValue() != null) {
|
||||||
Texture tex = (Texture) editorSingle.getValue();
|
Texture tex = (Texture) editorSingle.getValue();
|
||||||
|
String selected = tex.getKey().getName();
|
||||||
|
|
||||||
|
if (selected.endsWith(".dds") || selected.endsWith(".DDS")) {
|
||||||
|
if (ddsPreview == null) {
|
||||||
|
ddsPreview = new DDSPreview((ProjectAssetManager) SceneApplication.getApplication().getAssetManager());
|
||||||
|
}
|
||||||
|
ddsPreview.requestPreview(selected, "", 80, 80, singlePic, null);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
|
||||||
singlePic.setIcon(newicon);
|
singlePic.setIcon(newicon);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}//GEN-LAST:event_singleTexLoadButtonActionPerformed
|
}//GEN-LAST:event_singleTexLoadButtonActionPerformed
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JLabel bottomPic;
|
private javax.swing.JLabel bottomPic;
|
||||||
private javax.swing.JLabel eastPic;
|
private javax.swing.JLabel eastPic;
|
||||||
@ -548,6 +621,4 @@ public final class SkyboxVisualPanel2 extends JPanel {
|
|||||||
public JCheckBox getSpheremapCheckBox() {
|
public JCheckBox getSpheremapCheckBox() {
|
||||||
return spheremapCheckBox;
|
return spheremapCheckBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user