Browse Source

Merge origin/master

Conflicts:
	jme3-materialeditor/src/com/jme3/gde/materialdefinition/EditableMatDefFile.java
rickard 3 years ago
parent
commit
601de21f66

+ 8 - 1
jme3-core/src/com/jme3/gde/core/editor/nodes/Diagram.java

@@ -62,6 +62,7 @@ import javax.swing.border.TitledBorder;
 /**
  * The Diagram is the main canvas where all nodes {@link NodePanel} and
  * their connections {@link ConnectionEndpoint} {@link Connection} are added onto.
+ * 
  * @author Nehon
  */
 public abstract class Diagram extends JPanel implements MouseListener, 
@@ -272,7 +273,7 @@ public abstract class Diagram extends JPanel implements MouseListener,
         repaint();
         parent.notifyRemoveNode(node);
     }
-
+    
     public List<Selectable> getSelectedItems() {
         return selectedItems;
     }
@@ -558,6 +559,12 @@ public abstract class Diagram extends JPanel implements MouseListener,
      */
     public abstract void autoLayout();
     
+    /**
+     * This toggles continuous updates for material previews
+     * @param on
+     */
+    public abstract void toggleUpdateThread(boolean on);
+    
     @Override
     public void componentResized(ComponentEvent e) {
         minWidth = e.getComponent().getWidth() - 2;

+ 4 - 10
jme3-materialeditor/src/com/jme3/gde/materialdefinition/EditableMatDefFile.java

@@ -43,7 +43,6 @@ import com.jme3.gde.materialdefinition.fileStructure.leaves.LeafStatement;
 import com.jme3.gde.materialdefinition.fileStructure.leaves.MatParamBlock;
 import com.jme3.gde.materialdefinition.fileStructure.leaves.OutputMappingBlock;
 import com.jme3.gde.materialdefinition.navigator.node.MatDefNode;
-import com.jme3.material.MatParam;
 import com.jme3.material.Material;
 import com.jme3.material.MaterialDef;
 import com.jme3.material.TechniqueDef;
@@ -78,7 +77,9 @@ import org.openide.util.Lookup;
 import org.openide.util.WeakListeners;
 
 /**
- *
+ * This is the MatDef representation in the editor. It will update the file with
+ * any changes.
+ * 
  * @author Nehon
  */
 public class EditableMatDefFile {
@@ -254,14 +255,6 @@ public class EditableMatDefFile {
         try {
             //material.selectTechnique("Default", SceneApplication.getApplication().getRenderManager());
             if (matToRemove != null) {
-                for (MatParam matParam : matToRemove.getParams()) {
-                    try {
-                        material.setParam(matParam.getName(), matParam.getVarType(), matParam.getValue());
-                    } catch (IllegalArgumentException ie) {
-                        matToRemove.clearParam(matParam.getName());
-                    }
-
-                }
                 obj.getLookupContents().remove(matToRemove);
                 matToRemove = null;
             }
@@ -405,4 +398,5 @@ public class EditableMatDefFile {
         setCurrentTechnique(null);
         setLoaded(false);
     }
+    
 }

+ 9 - 0
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/BackdropPanel.java

@@ -528,5 +528,14 @@ public class BackdropPanel extends JPanel implements MouseListener, ChangeListen
             ((MouseMotionListener) c).mouseMoved(SwingUtilities.convertMouseEvent(this, e, c));
         }
     }
+    
+    public MaterialPreviewRenderer getRenderer(){
+        return renderer;
+    }
 
+    public void refreshOnly() {
+        if (mat != null) {
+            renderer.refreshOnly();
+        }
+    }
 }

+ 3 - 0
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Bundle.properties

@@ -19,3 +19,6 @@ ShaderNodeToolBar.codeButton.toolTipText=Display code
 NodeToolBar.deleteButton.toolTipText=Delete node
 NodeToolBar.deleteButton.text=
 NodeToolBar.codeButton.toolTipText=Display code
+MatDefEditorToolBar.toggleLiveUpdates.actionCommand=toggleLiveUpdates
+MatDefEditorToolBar.toggleLiveUpdates.toolTipText=Toggle Live Backpanel Updates
+MatDefEditorToolBar.toggleLiveUpdates.text=

+ 39 - 1
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorToolBar.form

@@ -31,7 +31,9 @@
               <Component id="jButton1" min="-2" pref="53" max="-2" attributes="0"/>
               <EmptySpace max="-2" attributes="0"/>
               <Component id="jButton2" min="-2" max="-2" attributes="0"/>
-              <EmptySpace min="0" pref="103" max="32767" attributes="0"/>
+              <EmptySpace max="32767" attributes="0"/>
+              <Component id="jToggleButton2" min="-2" max="-2" attributes="0"/>
+              <EmptySpace min="-2" pref="99" max="-2" attributes="0"/>
           </Group>
       </Group>
     </DimensionLayout>
@@ -42,6 +44,7 @@
               <Component id="techniqueComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
               <Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
               <Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
+              <Component id="jToggleButton2" alignment="3" min="-2" max="-2" attributes="0"/>
           </Group>
           <Component id="jSeparator1" alignment="0" max="32767" attributes="0"/>
       </Group>
@@ -106,5 +109,40 @@
         <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
       </Events>
     </Component>
+    <Component class="javax.swing.JToggleButton" name="jToggleButton2">
+      <Properties>
+        <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
+          <Image iconType="3" name="/com/jme3/gde/core/editor/icons/repeat.png"/>
+        </Property>
+        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="MatDefEditorToolBar.toggleLiveUpdates.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+        </Property>
+        <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="MatDefEditorToolBar.toggleLiveUpdates.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+        </Property>
+        <Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="MatDefEditorToolBar.toggleLiveUpdates.actionCommand" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+        </Property>
+        <Property name="horizontalAlignment" type="int" value="11"/>
+        <Property name="horizontalTextPosition" type="int" value="0"/>
+        <Property name="iconTextGap" type="int" value="0"/>
+        <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
+          <Insets value="[2, 14, 2, 18]"/>
+        </Property>
+        <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+          <Dimension value="[25, 24]"/>
+        </Property>
+        <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+          <Dimension value="[25, 24]"/>
+        </Property>
+        <Property name="name" type="java.lang.String" value="toggleLiveUpdates" noResource="true"/>
+        <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+          <Dimension value="[25, 24]"/>
+        </Property>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jToggleButton2ActionPerformed"/>
+      </Events>
+    </Component>
   </SubComponents>
 </Form>

+ 37 - 2
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorToolBar.java

@@ -42,6 +42,7 @@ import javax.swing.JLabel;
 import javax.swing.JList;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
+import javax.swing.JToggleButton;
 import javax.swing.ListCellRenderer;
 
 /**
@@ -101,6 +102,7 @@ public class MatDefEditorToolBar extends JPanel {
         jButton1 = new javax.swing.JButton();
         jSeparator1 = new javax.swing.JSeparator();
         jButton2 = new javax.swing.JButton();
+        jToggleButton2 = new javax.swing.JToggleButton();
 
         setPreferredSize(new java.awt.Dimension(474, 20));
 
@@ -133,6 +135,24 @@ public class MatDefEditorToolBar extends JPanel {
             }
         });
 
+        jToggleButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/core/editor/icons/repeat.png"))); // NOI18N
+        org.openide.awt.Mnemonics.setLocalizedText(jToggleButton2, org.openide.util.NbBundle.getMessage(MatDefEditorToolBar.class, "MatDefEditorToolBar.toggleLiveUpdates.text")); // NOI18N
+        jToggleButton2.setToolTipText(org.openide.util.NbBundle.getMessage(MatDefEditorToolBar.class, "MatDefEditorToolBar.toggleLiveUpdates.toolTipText")); // NOI18N
+        jToggleButton2.setActionCommand(org.openide.util.NbBundle.getMessage(MatDefEditorToolBar.class, "MatDefEditorToolBar.toggleLiveUpdates.actionCommand")); // NOI18N
+        jToggleButton2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+        jToggleButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+        jToggleButton2.setIconTextGap(0);
+        jToggleButton2.setMargin(new java.awt.Insets(2, 14, 2, 18));
+        jToggleButton2.setMaximumSize(new java.awt.Dimension(25, 24));
+        jToggleButton2.setMinimumSize(new java.awt.Dimension(25, 24));
+        jToggleButton2.setName("toggleLiveUpdates"); // NOI18N
+        jToggleButton2.setPreferredSize(new java.awt.Dimension(25, 24));
+        jToggleButton2.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                jToggleButton2ActionPerformed(evt);
+            }
+        });
+
         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
         this.setLayout(layout);
         layout.setHorizontalGroup(
@@ -147,7 +167,9 @@ public class MatDefEditorToolBar extends JPanel {
                 .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(jButton2)
-                .addGap(0, 103, Short.MAX_VALUE))
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                .addComponent(jToggleButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addGap(99, 99, 99))
         );
         layout.setVerticalGroup(
             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -155,7 +177,8 @@ public class MatDefEditorToolBar extends JPanel {
                 .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                 .addComponent(techniqueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                 .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addComponent(jButton2))
+                .addComponent(jButton2)
+                .addComponent(jToggleButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
             .addComponent(jSeparator1)
         );
     }// </editor-fold>//GEN-END:initComponents
@@ -187,16 +210,28 @@ public class MatDefEditorToolBar extends JPanel {
         }
     }//GEN-LAST:event_jButton1ActionPerformed
 
+    /**
+     * Autolayout button
+     * @param evt 
+     */
     private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        parent.getDiagram().autoLayout();
     }//GEN-LAST:event_jButton2ActionPerformed
 
+    /**
+     * Toggle continuous updates thread 
+     * @param evt 
+     */
+    private void jToggleButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton2ActionPerformed
+        parent.getDiagram().toggleUpdateThread(((JToggleButton)evt.getSource()).isSelected());
+    }//GEN-LAST:event_jToggleButton2ActionPerformed
 
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private javax.swing.JButton jButton1;
     private javax.swing.JButton jButton2;
     private javax.swing.JLabel jLabel1;
     private javax.swing.JSeparator jSeparator1;
+    private javax.swing.JToggleButton jToggleButton2;
     private javax.swing.JComboBox<TechniqueBlock> techniqueComboBox;
     // End of variables declaration//GEN-END:variables
 }

+ 7 - 10
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java

@@ -39,6 +39,7 @@ import com.jme3.gde.core.editor.nodes.NodePanel;
 import com.jme3.gde.core.editor.nodes.Selectable;
 import com.jme3.asset.ShaderNodeDefinitionKey;
 import com.jme3.gde.core.assets.ProjectAssetManager;
+import com.jme3.gde.core.errorreport.ExceptionPanel;
 import com.jme3.gde.materialdefinition.EditableMatDefFile;
 import com.jme3.gde.materialdefinition.MatDefDataObject;
 import com.jme3.gde.materialdefinition.MatDefMetaData;
@@ -81,6 +82,8 @@ import org.netbeans.core.spi.multiview.CloseOperationState;
 import org.netbeans.core.spi.multiview.MultiViewElement;
 import org.netbeans.core.spi.multiview.MultiViewElementCallback;
 import org.netbeans.core.spi.multiview.text.MultiViewEditorElement;
+import org.openide.DialogDescriptor;
+import org.openide.DialogDisplayer;
 import org.openide.awt.UndoRedo;
 import org.openide.cookies.EditorCookie;
 import org.openide.filesystems.FileObject;
@@ -133,7 +136,6 @@ public final class MatDefEditorlElement extends JPanel implements
         if (!file.isLoaded()) {
             throw new IllegalArgumentException("Cannot build MatDefEditorlElement: Failed at loading the EditableMatDefFile");
         }
-        
         reload(file, lkp);        
         toolbar.setParent(this);
         toolbar.addTechnique(lkp.lookup(MatDefBlock.class).getTechniques());
@@ -769,15 +771,10 @@ public final class MatDefEditorlElement extends JPanel implements
             }
         } else {
             diagram1.clear();
-            JLabel error = new JLabel("<html><center>Cannot load material definition.<br>Please see the error log and fix it in the text editor</center></html>");
-            error.setForeground(Color.ORANGE);
-            error.setFont(new Font("Arial", Font.BOLD, 24));
-            error.setBounds(0, 0, 400, 100);
-            jScrollPane1.getHorizontalScrollBar().setValue(0);
-            error.setLocation(jScrollPane1.getViewport().getWidth() / 2 - 200, jScrollPane1.getViewport().getHeight() / 2 - 50);
-            diagram1.add(error);
-            diagram1.repaint();
-
+            ExceptionPanel ep = new ExceptionPanel("Please see the error log and fix it in the text editor", false);
+            DialogDescriptor d = new DialogDescriptor(ep, "Cannot load material definition", true, new Object[] { DialogDescriptor.OK_OPTION }, DialogDescriptor.DEFAULT_OPTION, DialogDescriptor.DEFAULT_ALIGN, null, null);
+            DialogDisplayer.getDefault().notifyLater(d);
+            
         }
     }
 }

+ 57 - 4
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ShaderNodeDiagram.java

@@ -44,10 +44,10 @@ import com.jme3.gde.materialdefinition.editor.ShaderNodePanel.NodeType;
 import com.jme3.gde.materialdefinition.fileStructure.ShaderNodeBlock;
 import com.jme3.gde.materialdefinition.fileStructure.leaves.MappingBlock;
 import com.jme3.gde.core.editor.icons.Icons;
+import com.jme3.gde.core.errorreport.ExceptionUtils;
 import com.jme3.gde.materialdefinition.utils.MaterialUtils;
 import com.jme3.material.Material;
 import com.jme3.shader.Shader;
-//import static com.jme3.gde.materialdefinition.editor.ShaderNodePanel.NodeType;
 import com.jme3.shader.ShaderNodeDefinition;
 import com.jme3.shader.ShaderNodeVariable;
 import com.jme3.shader.UniformBinding;
@@ -58,9 +58,10 @@ import java.awt.event.ActionListener;
 import java.awt.event.ComponentEvent;
 import java.awt.event.ComponentListener;
 import java.awt.event.MouseEvent;
-import java.awt.event.MouseMotionListener;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import javax.swing.JMenuItem;
 import javax.swing.JViewport;
 import javax.swing.SwingUtilities;
@@ -68,6 +69,7 @@ import javax.swing.SwingUtilities;
 /**
  * The Diagram is the main canvas where all nodes {@link DraggablePanel} and
  * their connections {@link ConnectionEndpoint} {@link Connection} are added onto.
+ * 
  * @author Nehon
  */
 public class ShaderNodeDiagram extends Diagram implements ComponentListener {
@@ -75,7 +77,8 @@ public class ShaderNodeDiagram extends Diagram implements ComponentListener {
     protected List<ShaderOutBusPanel> outBuses = new ArrayList<ShaderOutBusPanel>();
     private String currentTechniqueName;
     private final BackdropPanel backDrop = new BackdropPanel();
-    private final Point pp = new Point();
+    private Thread backgroundThread;
+    private UpdateBackgroundRunnable backgroundUpdate = new UpdateBackgroundRunnable();
 
     @SuppressWarnings("LeakingThisInConstructor")
     public ShaderNodeDiagram() {
@@ -107,7 +110,6 @@ public class ShaderNodeDiagram extends Diagram implements ComponentListener {
                     return;
                 }
             }
-
             dispatchToOutBuses(e);
         } else {
             super.mouseReleased(e); // Handle all the UI Stuff
@@ -320,6 +322,7 @@ public class ShaderNodeDiagram extends Diagram implements ComponentListener {
     public void clear() {
         super.clear();
         outBuses.clear();
+        backgroundUpdate.setRunning(false);
     }
 
     @Override
@@ -489,4 +492,54 @@ public class ShaderNodeDiagram extends Diagram implements ComponentListener {
         return 0;
 
     }
+
+    @Override
+    public void toggleUpdateThread(boolean on) {
+        if (on && !backgroundUpdate.isRunning()) {
+            backgroundUpdate.setRunning(true);
+            backgroundThread = new Thread(backgroundUpdate);
+            backgroundThread.setDaemon(true);
+            backgroundThread.start();
+        } else if (!on && backgroundUpdate.isRunning()) {
+            try {
+                backgroundUpdate.setRunning(false);
+                backgroundThread.join();
+            } catch (InterruptedException ex) {
+                Thread.currentThread().interrupt();
+            }
+        }
+    }
+
+    private final class UpdateBackgroundRunnable implements Runnable {
+
+        private boolean running;
+
+        @Override
+        public void run() {
+            while (running) {
+                if (backDrop.isVisible() && !backDrop.getRenderer().isPreviewRequested()) {
+                    backDrop.refreshOnly();
+                }
+                try {
+                    Thread.sleep(20);
+                } catch (InterruptedException ex) {
+                    running = false;
+                    ExceptionUtils.caughtException(ex, "Material update thread caught an exception and shut down.");
+                }
+                if (!ShaderNodeDiagram.this.isShowing()) {
+                    running = false;
+                }
+            }
+            Logger.getLogger(ShaderNodeDiagram.class.getName()).log(Level.INFO, "UpdateThread stopped");
+        }
+
+        public boolean isRunning() {
+            return running;
+        }
+
+        public void setRunning(boolean on) {
+            this.running = on;
+        }
+    }
+    
 }

+ 2 - 2
jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ShaderNodePanel.java

@@ -109,9 +109,9 @@ public class ShaderNodePanel extends NodePanel implements InOut,
     public ShaderNodePanel(ShaderNodeVariable singleOut, NodeType type) {
         super();
         this.type = type;
-        List<ShaderNodeVariable> outputs = new ArrayList<ShaderNodeVariable>();
+        List<ShaderNodeVariable> outputs = new ArrayList<>();
         outputs.add(singleOut);
-        init(new ArrayList<ShaderNodeVariable>(), outputs);
+        init(new ArrayList<>(), outputs);
         setToolbar(new ShaderNodeToolBar(this));
     }
     

+ 26 - 5
jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java

@@ -31,7 +31,8 @@ import javax.swing.ImageIcon;
 import javax.swing.JLabel;
 
 /**
- *
+ * Handles rendering of materials in preview widgets of Material and Shader Node editor.
+ * 
  * @author Nehon
  */
 public class MaterialPreviewRenderer implements SceneListener {
@@ -42,8 +43,9 @@ public class MaterialPreviewRenderer implements SceneListener {
     private Geometry currentGeom;
     private Material currentMaterial;
     private boolean init = false;
-    private final JLabel label;
+    final JLabel label;
     private final ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(5);
+    private boolean previewRequested;
 
     public enum DisplayType {
 
@@ -58,9 +60,9 @@ public class MaterialPreviewRenderer implements SceneListener {
 
     private void init() {
         SceneApplication.getApplication().addSceneListener(this);
-        Sphere sphMesh = new Sphere(32, 32, 2.5f);
-        sphMesh.setTextureMode(Sphere.TextureMode.Projected);
-        sphMesh.updateGeometry(32, 32, 2.5f, false, false);
+        Sphere sphMesh = new Sphere(64, 64, 2.5f);
+        sphMesh.setTextureMode(Sphere.TextureMode.Polar);
+        sphMesh.updateGeometry(64, 64, 2.5f, false, false);
         Logger log = Logger.getLogger(TangentBinormalGenerator.class.getName());
         log.setLevel(Level.SEVERE);
         TangentBinormalGenerator.generate(sphMesh);
@@ -246,6 +248,7 @@ public class MaterialPreviewRenderer implements SceneListener {
                     label.setIcon(icon);
                 }
             });
+            previewRequested = false;
         }
     }
 
@@ -253,4 +256,22 @@ public class MaterialPreviewRenderer implements SceneListener {
         SceneApplication.getApplication().removeSceneListener(this);
         exec.shutdownNow();
     }
+    
+    public boolean isPreviewRequested(){
+        return previewRequested;
+    }
+    
+    public void refreshOnly(){
+        previewRequested = true;
+        SceneApplication.getApplication().enqueue((Callable<Object>) () -> {
+            if (currentGeom.getMaterial() != null) {
+                PreviewRequest request = new PreviewRequest(MaterialPreviewRenderer.this, currentGeom, label.getWidth(), label.getHeight());
+                request.getCameraRequest().setLocation(new Vector3f(0, 0, 7));
+                request.getCameraRequest().setLookAt(new Vector3f(0, 0, 0), Vector3f.UNIT_Y);
+                SceneApplication.getApplication().createPreview(request);
+            }
+            return null;
+        });
+    }
+    
 }