SDK :
- Used DDSPreview in material editor - Added support for texture3D and CubeMaps to material editor git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8015 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
e89d38df6f
commit
d591ae968e
@ -1,8 +1,8 @@
|
||||
build.xml.data.CRC32=6e7dc984
|
||||
build.xml.script.CRC32=f284e28d
|
||||
build.xml.stylesheet.CRC32=a56c6a5b@1.42.2
|
||||
build.xml.stylesheet.CRC32=a56c6a5b@2.45
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=6e7dc984
|
||||
nbproject/build-impl.xml.script.CRC32=56cee44d
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.42.2
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.45
|
||||
|
@ -27,6 +27,7 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import org.openide.loaders.DataObjectNotFoundException;
|
||||
@ -101,15 +102,10 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
|
||||
materialPreviewWidget1.showMaterial(manager, materialFileName);
|
||||
|
||||
relativeMaterialFileName = manager.getRelativeAssetPath(materialFileName);
|
||||
for (Iterator it = WindowManager.getDefault().getModes().iterator(); it.hasNext();) {
|
||||
Mode mode = (Mode) it.next();
|
||||
System.out.println(mode.getName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
@ -337,7 +333,6 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
|
||||
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
|
||||
saveImmediate = jCheckBox1.isSelected();
|
||||
}//GEN-LAST:event_jCheckBox1ActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JCheckBox jCheckBox1;
|
||||
private javax.swing.JComboBox jComboBox1;
|
||||
@ -416,8 +411,16 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
|
||||
@Override
|
||||
public void componentClosed() {
|
||||
materialPreviewWidget1.cleanUp();
|
||||
for (int i = 0; i < texturePanel.getComponentCount(); i++) {
|
||||
Component c = texturePanel.getComponent(i);
|
||||
if (c instanceof MaterialPropertyWidget) {
|
||||
((MaterialPropertyWidget) c).cleanUp();
|
||||
}
|
||||
}
|
||||
|
||||
clearMaterialChangeListeners();
|
||||
SceneExplorerTopComponent.getDefault().removeMaterialChangeProvider(this);
|
||||
|
||||
}
|
||||
|
||||
void writeProperties(java.util.Properties p) {
|
||||
@ -568,7 +571,7 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
|
||||
widget.registerChangeListener(this);
|
||||
if ("Boolean".equals(entry.getValue().getType())) {
|
||||
optionList.add(widget);
|
||||
} else if ("Texture2D".equals(entry.getValue().getType())) {
|
||||
} else if (entry.getValue().getType().indexOf("Texture") >= 0) {
|
||||
textureList.add(widget);
|
||||
} else if ("Color".equals(entry.getValue().getType())) {
|
||||
colorList.add(widget);
|
||||
|
@ -42,4 +42,8 @@ public abstract class MaterialPropertyWidget extends JPanel{
|
||||
|
||||
protected abstract void readProperty();
|
||||
|
||||
public void cleanUp(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,9 +75,9 @@
|
||||
</Group>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="41" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="78" max="32767" attributes="0"/>
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="24" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="61" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
@ -12,6 +12,7 @@ package com.jme3.gde.materials.multiview.widgets;
|
||||
|
||||
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||
import com.jme3.gde.core.properties.TexturePropertyEditor;
|
||||
import com.jme3.gde.core.properties.preview.DDSPreview;
|
||||
import com.jme3.gde.materials.MaterialProperty;
|
||||
import com.jme3.texture.Texture;
|
||||
import java.awt.Component;
|
||||
@ -32,6 +33,7 @@ public class TexturePanel extends MaterialPropertyWidget {
|
||||
private boolean flip = false;
|
||||
private boolean repeat = false;
|
||||
private String textureName = null;
|
||||
private DDSPreview ddsPreview;
|
||||
|
||||
/** Creates new form SelectionPanel */
|
||||
public TexturePanel(ProjectAssetManager manager) {
|
||||
@ -45,7 +47,10 @@ public class TexturePanel extends MaterialPropertyWidget {
|
||||
Texture tex = manager.loadTexture(textureName);
|
||||
Icon newicon = null;
|
||||
if (textureName.endsWith(".dds") || textureName.endsWith(".DDS")) {
|
||||
texturePreview.setIcon(null);
|
||||
if (ddsPreview == null) {
|
||||
ddsPreview = new DDSPreview(manager);
|
||||
}
|
||||
ddsPreview.requestPreview(textureName, "", 80, 80, texturePreview, null);
|
||||
} else {
|
||||
newicon = ImageUtilities.image2Icon(resizeImage(ImageToAwt.convert(tex.getImage(), false, true, 0)));
|
||||
}
|
||||
@ -80,8 +85,6 @@ public class TexturePanel extends MaterialPropertyWidget {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static BufferedImage resizeImage(BufferedImage originalImage) {
|
||||
int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType();
|
||||
float ratio = (float) originalImage.getWidth() / (float) originalImage.getHeight();
|
||||
@ -313,6 +316,13 @@ public class TexturePanel extends MaterialPropertyWidget {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanUp() {
|
||||
if (ddsPreview != null) {
|
||||
ddsPreview.cleanUp();
|
||||
}
|
||||
}
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton2;
|
||||
|
@ -18,7 +18,7 @@ public class WidgetFactory {
|
||||
|
||||
public static MaterialPropertyWidget getWidget(MaterialProperty prop, ProjectAssetManager manager){
|
||||
MaterialPropertyWidget widget;
|
||||
if("Texture2D".equals(prop.getType())){
|
||||
if(prop.getType().indexOf("Texture")>=0){
|
||||
widget=new TexturePanel(manager);
|
||||
widget.setProperty(prop);
|
||||
return widget;
|
||||
|
Loading…
x
Reference in New Issue
Block a user