- add DDS support to texture browser (thanks to @destroflyer!)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@6992 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent 13cb24081f
commit ba4265b77a
  1. 4
      sdk/jme3-core/nbproject/project.xml
  2. BIN
      sdk/jme3-core/release/modules/ext/DDSUtils.jar
  3. 21
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/TextureBrowser.java

@ -258,6 +258,10 @@
<package>com.jme3.gde.core.undoredo</package>
<package>com.jme3.gde.core.util</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/DDSUtils.jar</runtime-relative-path>
<binary-origin>release/modules/ext/DDSUtils.jar</binary-origin>
</class-path-extension>
</data>
</configuration>
</project>

@ -31,12 +31,19 @@
*/
package com.jme3.gde.core.sceneexplorer.nodes.properties;
import Model.DDSImageFile;
import com.jme3.gde.core.assets.ProjectAssetManager;
import com.jme3.texture.Texture;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
import javax.swing.DefaultListSelectionModel;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import jme3tools.converters.ImageToAwt;
import org.openide.filesystems.FileUtil;
import org.openide.util.Exceptions;
import org.openide.util.ImageUtilities;
/**
@ -199,7 +206,19 @@ public class TextureBrowser extends javax.swing.JDialog {
if (textureList.getSelectedIndex() > -1) {
String selected = (String) textureList.getSelectedValue();
Texture tex = assetManager.loadTexture(selected);
Icon newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
Icon newicon = null;
if(selected.endsWith(".dds")||selected.endsWith(".DDS")){
try {
File file = FileUtil.toFile(assetManager.getAssetFolder().getFileObject(selected));
DDSImageFile ddsImageFile = new DDSImageFile(file);
BufferedImage bufferedImage = ddsImageFile.getData();
newicon = new ImageIcon(bufferedImage);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}else{
newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
}
imagePreviewLabel.setIcon(newicon);
} else {
imagePreviewLabel.setIcon(null);

Loading…
Cancel
Save