- add DDS support to texture browser (thanks to @destroflyer!)
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@6992 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
13cb24081f
commit
ba4265b77a
@ -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>
|
||||
|
BIN
sdk/jme3-core/release/modules/ext/DDSUtils.jar
Normal file
BIN
sdk/jme3-core/release/modules/ext/DDSUtils.jar
Normal file
Binary file not shown.
@ -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…
x
Reference in New Issue
Block a user