- 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
3.0
rem..om 13 years ago
parent e89d38df6f
commit d591ae968e
  1. 16
      sdk/jme3-materialeditor/build.xml
  2. 12
      sdk/jme3-materialeditor/manifest.mf
  3. 90
      sdk/jme3-materialeditor/nbproject/build-impl.xml
  4. 16
      sdk/jme3-materialeditor/nbproject/genfiles.properties
  5. 280
      sdk/jme3-materialeditor/nbproject/project.xml
  6. 17
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java
  7. 4
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/MaterialPropertyWidget.java
  8. 4
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.form
  9. 22
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java
  10. 2
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/WidgetFactory.java

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="com.jme3.gde.materials" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project com.jme3.gde.materials.</description>
<import file="nbproject/build-impl.xml"/>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="com.jme3.gde.materials" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project com.jme3.gde.materials.</description>
<import file="nbproject/build-impl.xml"/>
</project>

@ -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

@ -1,45 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="com.jme3.gde.materials-impl" basedir="..">
<fail message="Please build using Ant 1.7.1 or higher.">
<condition>
<not>
<antversion atleast="1.7.1"/>
</not>
</condition>
</fail>
<property file="nbproject/private/suite-private.properties"/>
<property file="nbproject/suite.properties"/>
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
<property file="${suite.dir}/nbproject/private/platform-private.properties"/>
<property file="${suite.dir}/nbproject/platform.properties"/>
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
<macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="property"/>
<attribute name="value"/>
<sequential>
<property name="@{property}" value="@{value}"/>
</sequential>
</macrodef>
<property file="${user.properties.file}"/>
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
<condition>
<not>
<contains string="${cluster.path.evaluated}" substring="platform"/>
</not>
</condition>
</fail>
<import file="${harness.dir}/build.xml"/>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="com.jme3.gde.materials-impl" basedir="..">
<fail message="Please build using Ant 1.7.1 or higher.">
<condition>
<not>
<antversion atleast="1.7.1"/>
</not>
</condition>
</fail>
<property file="nbproject/private/suite-private.properties"/>
<property file="nbproject/suite.properties"/>
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
<property file="${suite.dir}/nbproject/private/platform-private.properties"/>
<property file="${suite.dir}/nbproject/platform.properties"/>
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
<macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="property"/>
<attribute name="value"/>
<sequential>
<property name="@{property}" value="@{value}"/>
</sequential>
</macrodef>
<property file="${user.properties.file}"/>
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
<condition>
<not>
<contains string="${cluster.path.evaluated}" substring="platform"/>
</not>
</condition>
</fail>
<import file="${harness.dir}/build.xml"/>
</project>

@ -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

@ -1,140 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
<code-name-base>com.jme3.gde.materials</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
<code-name-base>com.jme3.gde.core</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>0.12.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>com.jme3.gde.core.baselibs</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>0.5</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>com.jme3.gde.core.libraries</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>0.5</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.core.multiview</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.16.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.modules.settings</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.22.1.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.actions</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.12.1.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.awt</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.19.1.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.dialogs</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.13.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.filesystems</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.32.1.1.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.loaders</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.10.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.nodes</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.12.1.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.text</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.27.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.31.2.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util.lookup</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>8.3.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.windows</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.30.1</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
<public-packages>
<package>com.jme3.gde.materials</package>
</public-packages>
</data>
</configuration>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
<code-name-base>com.jme3.gde.materials</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
<code-name-base>com.jme3.gde.core</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>0.12.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>com.jme3.gde.core.baselibs</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>0.5</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>com.jme3.gde.core.libraries</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>0.5</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.core.multiview</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.16.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.modules.settings</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.22.1.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.actions</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.12.1.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.awt</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.19.1.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.dialogs</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.13.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.filesystems</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.32.1.1.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.loaders</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.10.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.nodes</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.12.1.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.text</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.27.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.31.2.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util.lookup</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>8.3.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.windows</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.30.1</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
<public-packages>
<package>com.jme3.gde.materials</package>
</public-packages>
</data>
</configuration>
</project>

@ -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);

@ -41,5 +41,9 @@ 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();
@ -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;

@ -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…
Cancel
Save