Browse Source

Warning clean up in DDSPreview, TexturePanel and WidgetFactory before making an actual change

Nehon 10 years ago
parent
commit
a2102acb53

+ 7 - 7
jme3-core/src/com/jme3/gde/core/properties/preview/DDSPreview.java

@@ -56,12 +56,12 @@ import javax.swing.JLabel;
  */
  */
 public class DDSPreview implements SceneListener {
 public class DDSPreview implements SceneListener {
 
 
-    private ProjectAssetManager assetManager;
+    private final ProjectAssetManager assetManager;
     private JComponent picPreview;
     private JComponent picPreview;
-    private Geometry quad;
-    private Geometry quad3D;
-    private Material material;
-    private Material material3D;
+    private final Geometry quad;
+    private final Geometry quad3D;
+    private final Material material;
+    private final Material material3D;
 
 
     public DDSPreview(ProjectAssetManager assetManager) {
     public DDSPreview(ProjectAssetManager assetManager) {
         this.assetManager = assetManager;
         this.assetManager = assetManager;
@@ -95,7 +95,7 @@ public class DDSPreview implements SceneListener {
         } else if (key.getTextureTypeHint() == Texture.Type.ThreeDimensional) {
         } else if (key.getTextureTypeHint() == Texture.Type.ThreeDimensional) {
             geom = quad3D;
             geom = quad3D;
             assetManager.deleteFromCache(key);
             assetManager.deleteFromCache(key);
-            key.setAsTexture3D(true);
+            key.setTextureTypeHint(Texture.Type.ThreeDimensional);
             t = assetManager.loadTexture(key);
             t = assetManager.loadTexture(key);
             material3D.setTexture("Texture", t);
             material3D.setTexture("Texture", t);
             geom.setMaterial(material3D);
             geom.setMaterial(material3D);
@@ -104,7 +104,7 @@ public class DDSPreview implements SceneListener {
             }
             }
         } else if (key.getTextureTypeHint() == Texture.Type.CubeMap) {
         } else if (key.getTextureTypeHint() == Texture.Type.CubeMap) {
             assetManager.deleteFromCache(key);
             assetManager.deleteFromCache(key);
-            geom = SkyFactory.createSky(assetManager, textureName, false);
+            geom = SkyFactory.createSky(assetManager, textureName, SkyFactory.EnvMapType.CubeMap);
             if (infoLabel != null) {
             if (infoLabel != null) {
                 infoLabel.setText(" " + displayName + " (CubeMap)    w : " + t.getImage().getWidth() + "    h : " + t.getImage().getHeight());
                 infoLabel.setText(" " + displayName + " (CubeMap)    w : " + t.getImage().getWidth() + "    h : " + t.getImage().getHeight());
             }
             }

+ 2 - 13
jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java

@@ -28,8 +28,8 @@ import org.openide.util.ImageUtilities;
  */
  */
 public class TexturePanel extends MaterialPropertyWidget {
 public class TexturePanel extends MaterialPropertyWidget {
 
 
-    private TexturePropertyEditor editor;
-    private ProjectAssetManager manager;
+    private final TexturePropertyEditor editor;
+    private final ProjectAssetManager manager;
     private boolean flip = false;
     private boolean flip = false;
     private boolean repeat = false;
     private boolean repeat = false;
     private String textureName = null;
     private String textureName = null;
@@ -58,17 +58,6 @@ public class TexturePanel extends MaterialPropertyWidget {
         }
         }
     }
     }
 
 
-    private String getName(String path) {
-        int idx = path.lastIndexOf("/");
-        if (idx != -1 && path.length() > idx + 1) {
-            path = path.substring(idx + 1, path.length());
-        }
-        if (path.length() > 15) {
-            path = path.substring(0, 15) + "..";
-        }
-        return path;
-    }
-
     private void updateFlipRepeat() {
     private void updateFlipRepeat() {
         if (flip && repeat) {
         if (flip && repeat) {
             property.setValue("Flip Repeat " + textureName);
             property.setValue("Flip Repeat " + textureName);

+ 1 - 1
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){      
     public static MaterialPropertyWidget getWidget(MaterialProperty prop, ProjectAssetManager manager){      
         MaterialPropertyWidget widget;
         MaterialPropertyWidget widget;
-        if(prop.getType().indexOf("Texture")>=0){
+        if(prop.getType().contains("Texture")){
             widget=new TexturePanel(manager);
             widget=new TexturePanel(manager);
             widget.setProperty(prop);
             widget.setProperty(prop);
             return widget;
             return widget;