diff --git a/sdk/jme3-materialeditor/build.xml b/sdk/jme3-materialeditor/build.xml index c2947deab..dfada4e51 100644 --- a/sdk/jme3-materialeditor/build.xml +++ b/sdk/jme3-materialeditor/build.xml @@ -1,8 +1,8 @@ - - - - - - Builds, tests, and runs the project com.jme3.gde.materials. - - + + + + + + Builds, tests, and runs the project com.jme3.gde.materials. + + diff --git a/sdk/jme3-materialeditor/manifest.mf b/sdk/jme3-materialeditor/manifest.mf index a3b0fb009..d87779cbc 100644 --- a/sdk/jme3-materialeditor/manifest.mf +++ b/sdk/jme3-materialeditor/manifest.mf @@ -1,6 +1,6 @@ -Manifest-Version: 1.0 -OpenIDE-Module: com.jme3.gde.materials/1 -OpenIDE-Module-Implementation-Version: 0 -OpenIDE-Module-Layer: com/jme3/gde/materials/layer.xml -OpenIDE-Module-Localizing-Bundle: com/jme3/gde/materials/Bundle.properties - +Manifest-Version: 1.0 +OpenIDE-Module: com.jme3.gde.materials/1 +OpenIDE-Module-Implementation-Version: 0 +OpenIDE-Module-Layer: com/jme3/gde/materials/layer.xml +OpenIDE-Module-Localizing-Bundle: com/jme3/gde/materials/Bundle.properties + diff --git a/sdk/jme3-materialeditor/nbproject/build-impl.xml b/sdk/jme3-materialeditor/nbproject/build-impl.xml index 3d3016e62..ffa7a6f1d 100644 --- a/sdk/jme3-materialeditor/nbproject/build-impl.xml +++ b/sdk/jme3-materialeditor/nbproject/build-impl.xml @@ -1,45 +1,45 @@ - - - - - - - - - - - - - You must set 'suite.dir' to point to your containing module suite - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + You must set 'suite.dir' to point to your containing module suite + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdk/jme3-materialeditor/nbproject/genfiles.properties b/sdk/jme3-materialeditor/nbproject/genfiles.properties index e60ea2516..c7e417d2d 100644 --- a/sdk/jme3-materialeditor/nbproject/genfiles.properties +++ b/sdk/jme3-materialeditor/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=6e7dc984 -build.xml.script.CRC32=f284e28d -build.xml.stylesheet.CRC32=a56c6a5b@1.42.2 -# 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 +build.xml.data.CRC32=6e7dc984 +build.xml.script.CRC32=f284e28d +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@2.45 diff --git a/sdk/jme3-materialeditor/nbproject/project.xml b/sdk/jme3-materialeditor/nbproject/project.xml index 162fc8622..c17524c74 100644 --- a/sdk/jme3-materialeditor/nbproject/project.xml +++ b/sdk/jme3-materialeditor/nbproject/project.xml @@ -1,140 +1,140 @@ - - - org.netbeans.modules.apisupport.project - - - com.jme3.gde.materials - - - - com.jme3.gde.core - - - - 1 - 0.12.1 - - - - com.jme3.gde.core.baselibs - - - - 1 - 0.5 - - - - com.jme3.gde.core.libraries - - - - 1 - 0.5 - - - - org.netbeans.core.multiview - - - - 1 - 1.16.1 - - - - org.netbeans.modules.settings - - - - 1 - 1.22.1.1 - - - - org.openide.actions - - - - 6.12.1.1 - - - - org.openide.awt - - - - 7.19.1.1 - - - - org.openide.dialogs - - - - 7.13.1 - - - - org.openide.filesystems - - - - 7.32.1.1.1 - - - - org.openide.loaders - - - - 7.10.1 - - - - org.openide.nodes - - - - 7.12.1.1 - - - - org.openide.text - - - - 6.27.1 - - - - org.openide.util - - - - 7.31.2.1 - - - - org.openide.util.lookup - - - - 8.3.1 - - - - org.openide.windows - - - - 6.30.1 - - - - - com.jme3.gde.materials - - - - + + + org.netbeans.modules.apisupport.project + + + com.jme3.gde.materials + + + + com.jme3.gde.core + + + + 1 + 0.12.1 + + + + com.jme3.gde.core.baselibs + + + + 1 + 0.5 + + + + com.jme3.gde.core.libraries + + + + 1 + 0.5 + + + + org.netbeans.core.multiview + + + + 1 + 1.16.1 + + + + org.netbeans.modules.settings + + + + 1 + 1.22.1.1 + + + + org.openide.actions + + + + 6.12.1.1 + + + + org.openide.awt + + + + 7.19.1.1 + + + + org.openide.dialogs + + + + 7.13.1 + + + + org.openide.filesystems + + + + 7.32.1.1.1 + + + + org.openide.loaders + + + + 7.10.1 + + + + org.openide.nodes + + + + 7.12.1.1 + + + + org.openide.text + + + + 6.27.1 + + + + org.openide.util + + + + 7.31.2.1 + + + + org.openide.util.lookup + + + + 8.3.1 + + + + org.openide.windows + + + + 6.30.1 + + + + + com.jme3.gde.materials + + + + diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java index 1d54f82a7..1f99d6e74 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java @@ -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); diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/MaterialPropertyWidget.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/MaterialPropertyWidget.java index 0bbcf5518..3dfddf9ab 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/MaterialPropertyWidget.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/MaterialPropertyWidget.java @@ -41,5 +41,9 @@ public abstract class MaterialPropertyWidget extends JPanel{ } protected abstract void readProperty(); + + public void cleanUp(){ + + } } diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.form b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.form index 439c71541..ad636bd27 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.form +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.form @@ -75,9 +75,9 @@ - + - + diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java index 662d087ff..e0f5fc06d 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java @@ -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(); @@ -251,7 +254,7 @@ public class TexturePanel extends MaterialPropertyWidget { view.setVisible(true); if (editor.getValue() != null) { textureName = editor.getAsText(); - displayPreview(); + displayPreview(); updateFlipRepeat(); fireChanged(); } @@ -259,7 +262,7 @@ public class TexturePanel extends MaterialPropertyWidget { private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed textureName = ""; - texturePreview.setIcon(null); + texturePreview.setIcon(null); texturePreview.setToolTipText(""); property.setValue(""); fireChanged(); @@ -303,7 +306,7 @@ public class TexturePanel extends MaterialPropertyWidget { } jLabel1.setText(property.getName()); jLabel1.setToolTipText(property.getName()); - displayPreview(); + displayPreview(); texturePreview.setToolTipText(property.getValue()); MaterialProperty prop = property; property = null; @@ -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; diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/WidgetFactory.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/WidgetFactory.java index 157d3a9b7..507fe5314 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/WidgetFactory.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/WidgetFactory.java @@ -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;