From 9bc429ff5e92677d10b0a76e457e0f5ce5ba028e Mon Sep 17 00:00:00 2001 From: RedEyedJealousy Date: Sat, 21 Jul 2018 18:19:09 +0200 Subject: [PATCH] - Added an Error Window when the user tries to edit a file with some invalid parameters - Added Preview button for Map Files - Re-group Parallax, Occlusion, Specular, Smoothness and Metalness Section - Fixed spelling mistakes - Fixed some parameters limitations --- .gitignore | 4 +- nbproject/private/private.xml | 9 +- src/mmd/AlbedoSection.form | 82 +- src/mmd/AlbedoSection.java | 384 +++-- src/mmd/AlphaSection.form | 38 +- src/mmd/AlphaSection.java | 217 ++- src/mmd/CustomEnableSection.form | 71 +- src/mmd/CustomEnableSection.java | 518 +++++-- src/mmd/EmissiveSection.form | 245 ++- src/mmd/EmissiveSection.java | 479 ++++-- src/mmd/MaterialMakerv2.java | 785 +++++----- ...llaxSection.form => MetalnessSection.form} | 201 +-- ...llaxSection.java => MetalnessSection.java} | 699 +++++---- src/mmd/NormalSection.form | 78 +- src/mmd/NormalSection.java | 322 +++- ...clusion.form => ParallaxAndOcclusion.form} | 208 +-- ...clusion.java => ParallaxAndOcclusion.java} | 850 ++++++----- ...alness.form => SpecularAndSmoothness.form} | 461 +++--- ...alness.java => SpecularAndSmoothness.java} | 1338 +++++++++++------ src/mmd/WindowFrame.form | 18 +- src/mmd/WindowFrame.java | 140 +- src/mmd/toRelative.java | 1 - 22 files changed, 4569 insertions(+), 2579 deletions(-) rename src/mmd/{ParallaxSection.form => MetalnessSection.form} (74%) rename src/mmd/{ParallaxSection.java => MetalnessSection.java} (66%) rename src/mmd/{SpecularAndOcclusion.form => ParallaxAndOcclusion.form} (85%) rename src/mmd/{SpecularAndOcclusion.java => ParallaxAndOcclusion.java} (81%) rename src/mmd/{SmoothnessAndMetalness.form => SpecularAndSmoothness.form} (68%) rename src/mmd/{SmoothnessAndMetalness.java => SpecularAndSmoothness.java} (70%) diff --git a/.gitignore b/.gitignore index f3d6549..489601b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -/build/ \ No newline at end of file +/build/ +/dist/ +/nbproject/ \ No newline at end of file diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 56a4384..e820b47 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -3,8 +3,15 @@ - file:/F:/ales/Documents/NetBeansProjects/RMT/src/mmd/MaterialMakerv2.java + file:/F:/ales/Documents/NetBeansProjects/RMT/src/mmd/CustomEnableSection.java + file:/F:/ales/Documents/NetBeansProjects/RMT/src/mmd/AlbedoSection.java + file:/F:/ales/Documents/NetBeansProjects/RMT/src/mmd/AlphaSection.java file:/F:/ales/Documents/NetBeansProjects/RMT/src/mmd/WindowFrame.java + file:/F:/ales/Documents/NetBeansProjects/RMT/src/mmd/EmissiveSection.java + file:/F:/ales/Documents/NetBeansProjects/RMT/src/mmd/NormalSection.java + file:/F:/ales/Documents/NetBeansProjects/RMT/src/mmd/ParallaxAndOcclusion.java + file:/F:/ales/Documents/NetBeansProjects/RMT/src/mmd/MetalnessSection.java + file:/F:/ales/Documents/NetBeansProjects/RMT/src/mmd/SpecularAndSmoothness.java diff --git a/src/mmd/AlbedoSection.form b/src/mmd/AlbedoSection.form index 21533c9..3eb7fc7 100644 --- a/src/mmd/AlbedoSection.form +++ b/src/mmd/AlbedoSection.form @@ -45,6 +45,8 @@ + + @@ -163,7 +165,11 @@ - + + + + + @@ -229,9 +235,13 @@ + - + + + + @@ -243,14 +253,14 @@ - + - + @@ -263,7 +273,7 @@ - + @@ -276,7 +286,7 @@ - + @@ -287,6 +297,7 @@ + @@ -340,6 +351,10 @@ + + + + @@ -348,7 +363,7 @@ - + @@ -365,12 +380,14 @@ + + - + @@ -386,12 +403,13 @@ + - + @@ -407,12 +425,13 @@ + - + @@ -427,6 +446,7 @@ + @@ -545,7 +565,7 @@ - + @@ -567,12 +587,13 @@ + - + @@ -590,12 +611,13 @@ + - + @@ -611,12 +633,13 @@ + - + @@ -632,6 +655,7 @@ + @@ -655,6 +679,10 @@ + + + + @@ -714,17 +742,27 @@ + + + + + + + + + + @@ -742,5 +780,21 @@ + + + + + + + + + + + + + + + + diff --git a/src/mmd/AlbedoSection.java b/src/mmd/AlbedoSection.java index 61f2182..b94ce0d 100644 --- a/src/mmd/AlbedoSection.java +++ b/src/mmd/AlbedoSection.java @@ -29,26 +29,31 @@ import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Dialog; import java.awt.Dimension; import java.awt.Font; -import java.awt.Toolkit; +import java.awt.Image; +import java.awt.Window; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.BufferedReader; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Paths; import java.text.DecimalFormat; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JColorChooser; +import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; @@ -90,6 +95,52 @@ public class AlbedoSection extends javax.swing.JFrame { private static String CatchalbedoSub; private static float CatchalbedoMapLoop; private static float CatchalbedoSubMapLoop; + public int errors = 0; + public String albedoMap; + JFrame ErrorWindow = new JFrame(); + + public void SomethingWentWrong() { + if (errors == 1) { + + JLabel ErrorWindowText = new JLabel(); + //ErrorWindowText. + ErrorWindowText.setText("
Something went wrong while trying to load Albedo Section...

" + + "Please make sure the file you are trying to open doesn't exceed the limit for each parameter, usually this happens when you are trying to open " + + "a .fx file where some of it's parameters has higher values than supposed to be

" + + "Limits:
" + + "
  • AlbedoMapFrom: 0 - 8
  • " + + "
  • AlbedoMapUVFlip: 0 - 3
  • " + + "
  • AlbedoMapApplyScale: 0 - 2
  • " + + "
  • AlbedoMapApplyDiffuse: 0 - 2
  • " + + "
  • AlbedoMapApplyMorphColor: 0 - 1
  • " + + "
    " + + "
Same for AlbedoSub
"); + ErrorWindow.setLayout(new BorderLayout()); + ErrorWindow.setSize(700, 350); + ErrorWindow.setLocationRelativeTo(this); + ErrorWindow.setResizable(true); + ErrorWindow.setAlwaysOnTop(true); + ErrorWindow.setVisible(true); + ErrorWindow.add(ErrorWindowText); + ErrorWindow.setName("help"); + ErrorWindow.setTitle("Something went wrong"); + ErrorWindow.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + ErrorWindow.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + ErrorWindow.dispose(); + } + }); + + try { + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + ErrorWindow.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + } + } public int getAlbedoSubEnable() { BufferedReader AlbedotoEdit_Br = null; @@ -101,7 +152,7 @@ public int getAlbedoSubEnable() { String s = ""; s = AlbedotoEdit_Br.readLine(); - + while (s != null) { if (s.contains("#define ALBEDO_SUB_ENABLE")) { @@ -111,15 +162,13 @@ public int getAlbedoSubEnable() { s = AlbedotoEdit_Br.readLine(); } - } catch (FileNotFoundException ex) { - Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); - } catch (IOException ex) { - Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); + } catch (Exception ex) { + SomethingWentWrong(); } finally { try { AlbedotoEdit_Br.close(); } catch (IOException ex) { - Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); + SomethingWentWrong(); } } return CatchAlbedoSubEnable; @@ -135,7 +184,7 @@ public int getAlbedoMapFrom() { String s = ""; s = AlbedotoEdit_Br.readLine(); - + while (s != null) { if (s.contains("#define ALBEDO_MAP_FROM")) { @@ -145,15 +194,13 @@ public int getAlbedoMapFrom() { s = AlbedotoEdit_Br.readLine(); } - } catch (FileNotFoundException ex) { - Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); - } catch (IOException ex) { - Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); + } catch (Exception e) { + SomethingWentWrong(); + } finally { try { AlbedotoEdit_Br.close(); } catch (IOException ex) { - Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); } } return CatchAlbedoMapFrom; @@ -169,7 +216,7 @@ public int getAlbedoSubMapUVFlip() { String s = ""; s = AlbedotoEdit_Br.readLine(); - + while (s != null) { if (s.contains("#define ALBEDO_SUB_MAP_UV_FLIP")) { @@ -203,7 +250,7 @@ public int getAlbedoSubMapFrom() { String s = ""; s = AlbedotoEdit_Br.readLine(); - + while (s != null) { if (s.contains("#define ALBEDO_SUB_MAP_FROM")) { @@ -237,7 +284,7 @@ public int getAlbedoSubMapApplyScale() { String s = ""; s = AlbedotoEdit_Br.readLine(); - + while (s != null) { if (s.contains("#define ALBEDO_SUB_MAP_APPLY_SCALE")) { @@ -851,6 +898,8 @@ private void initComponents() { AlbedoSubMapFile = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); albedoSubColorPick = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); jMenu1.setText("jMenu1"); @@ -863,7 +912,12 @@ private void initComponents() { jLabel1.setText("ALBEDO MAP FROM "); AlbedoMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8" })); - AlbedoMapFrom.setSelectedIndex(getAlbedoMapFrom()); + try{ + AlbedoMapFrom.setSelectedIndex(getAlbedoMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlbedoMapFrom.setToolTipText(""); AlbedoMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -900,8 +954,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel8.setText("ALBEDO"); - albedo.setText(String.valueOf(getalbedo()) - ); + try{ + albedo.setText(String.valueOf(getalbedo()) + ); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } albedo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { albedoActionPerformed(evt); @@ -924,7 +983,12 @@ public void keyTyped(java.awt.event.KeyEvent evt) { jLabel9.setText("ALBEDO MAP LOOP"); AlbedoMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - AlbedoMapUVFlip.setSelectedIndex(getAlbedoMapUVFlip()); + try{ + AlbedoMapUVFlip.setSelectedIndex(getAlbedoMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlbedoMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { AlbedoMapUVFlipItemStateChanged(evt); @@ -937,7 +1001,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); AlbedoApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); - AlbedoApplyScale.setSelectedIndex(getAlbedoApplyScale()); + try{ + AlbedoApplyScale.setSelectedIndex(getAlbedoApplyScale()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlbedoApplyScale.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { AlbedoApplyScaleItemStateChanged(evt); @@ -950,7 +1019,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); AlbedoApplyDiffuse.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); - AlbedoApplyDiffuse.setSelectedIndex(getAlbedoApplyDiffuse()); + try{ + AlbedoApplyDiffuse.setSelectedIndex(getAlbedoApplyDiffuse()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlbedoApplyDiffuse.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { AlbedoApplyDiffuseItemStateChanged(evt); @@ -963,7 +1037,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); AlbedoApplyMorphColor.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1" })); - AlbedoApplyMorphColor.setSelectedIndex(getAlbedoApplyMorphColor()); + try{ + AlbedoApplyMorphColor.setSelectedIndex(getAlbedoApplyMorphColor()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlbedoApplyMorphColor.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { AlbedoApplyMorphColorItemStateChanged(evt); @@ -1055,7 +1134,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel15.setText("ALBEDO SUB MAP LOOP"); AlbedoSubMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" })); - AlbedoSubMapFrom.setSelectedIndex(getAlbedoSubMapFrom()); + try{ + AlbedoSubMapFrom.setSelectedIndex(getAlbedoSubMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlbedoSubMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { AlbedoSubMapFromItemStateChanged(evt); @@ -1063,7 +1147,12 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) { }); AlbedoSubEnable.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5" })); - AlbedoSubEnable.setSelectedIndex(getAlbedoSubEnable()); + try{ + AlbedoSubEnable.setSelectedIndex(getAlbedoSubEnable()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlbedoSubEnable.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { AlbedoSubEnableItemStateChanged(evt); @@ -1071,7 +1160,12 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) { }); AlbedoSubMapApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - AlbedoSubMapApplyScale.setSelectedIndex(getAlbedoSubMapApplyScale()); + try{ + AlbedoSubMapApplyScale.setSelectedIndex(getAlbedoSubMapApplyScale()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlbedoSubMapApplyScale.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { AlbedoSubMapApplyScaleItemStateChanged(evt); @@ -1079,7 +1173,12 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) { }); AlbedoSubMapUVFlip1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - AlbedoSubMapUVFlip1.setSelectedIndex(getAlbedoSubMapUVFlip()); + try{ + AlbedoSubMapUVFlip1.setSelectedIndex(getAlbedoSubMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlbedoSubMapUVFlip1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { AlbedoSubMapUVFlip1ItemStateChanged(evt); @@ -1098,8 +1197,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - albedoSub.setText(String.valueOf(getalbedoSub()) - ); + try{ + albedoSub.setText(String.valueOf(getalbedoSub()) + ); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } albedoSub.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { albedoSubActionPerformed(evt); @@ -1163,9 +1267,21 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - AlbedoMapFile.setText(AlbedoMapFile1); + try{ + AlbedoMapFile.setEditable(false); + AlbedoMapFile.setText(AlbedoMapFile1); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } - AlbedoSubMapFile.setText(getAlbedoSubMapFile()); + try{ + AlbedoSubMapFile.setEditable(false); + AlbedoSubMapFile.setText(getAlbedoSubMapFile()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } jButton2.setText("Pick Colour"); jButton2.addActionListener(new java.awt.event.ActionListener() { @@ -1181,6 +1297,20 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); + jButton3.setText("Preview"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + jButton4.setText("Preview"); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -1190,6 +1320,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(AlbedoMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton3) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -1283,7 +1415,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(AlbedoMapLoopHelp1)) - .addComponent(AlbedoSubMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(AlbedoSubMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton4))) .addGap(0, 0, Short.MAX_VALUE)))))) ); layout.setVerticalGroup( @@ -1336,9 +1471,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(changeFile) .addComponent(AlbedoMapFileHelp) - .addComponent(AlbedoSubMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(AlbedoSubMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(AlbedoMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(AlbedoMapFile, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1349,13 +1487,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jButton2) .addComponent(albedoColorPick) .addComponent(albedoSubColorPick)) - .addGap(26, 26, 26) + .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapLoopHelp) .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapLoopHelp1)) - .addContainerGap(81, Short.MAX_VALUE)) + .addContainerGap(89, Short.MAX_VALUE)) ); pack(); @@ -1399,6 +1537,7 @@ private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI try { int selection = fileChooser.showOpenDialog(this); String filePath = fileChooser.getSelectedFile().getAbsolutePath(); + albedoMap = filePath; filePath = filePath.replace("\\", "/"); if (selection == 0) { @@ -1455,17 +1594,28 @@ private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private void changeFileStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_changeFileStateChanged }//GEN-LAST:event_changeFileStateChanged + private void closeAllDialogs() { + Window[] windows = AlbedoSection.getWindows(); - private void backActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backActionPerformed + for (Window window : windows) { + if (window.getName().equalsIgnoreCase("help")) { + window.dispose(); + } + } + } + private void backActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backActionPerformed + closeAllDialogs(); WindowFrame w = new WindowFrame(); w.setLocation(this.getLocation()); - + ErrorWindow.dispose(); this.dispose(); + w.setSize(960, 549); w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); w.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { + callMenu(); w.dispose(); } @@ -1481,10 +1631,9 @@ public void windowClosing(WindowEvent we) { }//GEN-LAST:event_backActionPerformed private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); + AlbedoMapHelp.setName("help"); //AlbedoMapHelpText. AlbedoMapHelpText.setText("
You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

" + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
" @@ -1502,8 +1651,8 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN + "
  • 8 : Params fetch from Specular Color from the pmx.

  • " + "
  • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular), doesn't work on Albedo


  • "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); @@ -1523,22 +1672,21 @@ public void windowClosing(WindowEvent we) { } catch (IOException ex) { Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); } - }//GEN-LAST:event_AlbedoMapHelpActionPerformed private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); //AlbedoMapHelpText. helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1555,17 +1703,17 @@ private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) private void AlbedoMapApplyScaleHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapApplyScaleHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); //AlbedoMapHelpText. helptext.setText("
    You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE


    " + "
    • 1 : map values * albedo;
    • " + "
    • 2 : map values ^ albedo;
    • " + "
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1583,15 +1731,14 @@ private void AlbedoMapApplyScaleHelpActionPerformed(java.awt.event.ActionEvent e private void AlbedoApplyDiffuseHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoApplyDiffuseHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - //AlbedoMapHelpText. + help.setName("help"); helptext.setText("
    Texture colors to multiply with diffuse from the PMX.
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); + help.setSize(400, 100); + help.setLocationRelativeTo(this); helptext.setBorder(new EmptyBorder(10, 30, 10, 10)); - help.setSize(500, 160); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1607,15 +1754,13 @@ private void AlbedoApplyDiffuseHelpActionPerformed(java.awt.event.ActionEvent ev }//GEN-LAST:event_AlbedoApplyDiffuseHelpActionPerformed private void AlbedoMorphColorHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMorphColorHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); //AlbedoMapHelpText. helptext.setText("Texture colors to multiply with color from the morph controller (R+/G+/B+)..."); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setResizable(true); help.setVisible(true); @@ -1632,10 +1777,9 @@ private void AlbedoMorphColorHelpActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_AlbedoMorphColorHelpActionPerformed private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); //AlbedoMapHelpText. helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " @@ -1649,8 +1793,8 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1668,9 +1812,9 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ private void albedoColorPickActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoColorPickActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); //AlbedoMapHelpText. helptext.setText("When the ALBEDO_MAP_FROM at 0 or ALBEDO_MAP_APPLY_SCALE at 1, you will need to set a color/rgb to albedo, and color range is between 0.0 and 1.0" + "like const float3 albedo = float3(r, g, b)


    " @@ -1685,8 +1829,8 @@ private void albedoColorPickActionPerformed(java.awt.event.ActionEvent evt) {//G + "https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch24.html
    " + "https://en.wikipedia.org/wiki/SRGB
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1705,14 +1849,13 @@ private void albedoColorPickActionPerformed(java.awt.event.ActionEvent evt) {//G }//GEN-LAST:event_albedoColorPickActionPerformed private void AlbedoMapLoopHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1803,9 +1946,9 @@ private void albedoSubActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); + AlbedoMapHelp.setName("help"); //AlbedoMapHelpText. AlbedoMapHelpText.setText("
    You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

    " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
    " @@ -1823,8 +1966,8 @@ private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GE + "
  • 8 : Params fetch from Specular Color from the pmx.

  • " + "
  • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for smoothness)


  • "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); @@ -1841,18 +1984,17 @@ private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GE }//GEN-LAST:event_AlbedoMapHelp1ActionPerformed private void AlbedoMapUVFlipHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); //AlbedoMapHelpText. helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1869,18 +2011,17 @@ private void AlbedoMapUVFlipHelp1ActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_AlbedoMapUVFlipHelp1ActionPerformed private void AlbedoMapApplyScaleHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapApplyScaleHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); //AlbedoMapHelpText. helptext.setText("
    You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE


    " + "
    • 1 : map values * albedo;
    • " + "
    • 2 : map values ^ albedo;
    • " + "
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1896,10 +2037,9 @@ private void AlbedoMapApplyScaleHelp1ActionPerformed(java.awt.event.ActionEvent }//GEN-LAST:event_AlbedoMapApplyScaleHelp1ActionPerformed private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); //AlbedoMapHelpText. helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " @@ -1913,8 +2053,8 @@ private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) { + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1932,15 +2072,14 @@ private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) { }//GEN-LAST:event_AlbedoMapFileHelp1ActionPerformed private void subHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); //AlbedoMapHelpText. helptext.setText("between 0 ~ 1"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 350); + help.setSize(300, 70); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1957,15 +2096,14 @@ private void subHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST }//GEN-LAST:event_subHelpActionPerformed private void AlbedoMapLoopHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); //AlbedoMapHelpText. helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1983,9 +2121,9 @@ private void AlbedoMapLoopHelp1ActionPerformed(java.awt.event.ActionEvent evt) { private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); //AlbedoMapHelpText. helptext.setText("You can apply second value for color of texture (albedo) change by change ALBEDO_SUB_ENABLE


    " + "
      " @@ -1997,8 +2135,8 @@ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS + "
    • 5 : Alpha Blend
    • " + "
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -2115,7 +2253,6 @@ private void albedoSubColorPickActionPerformed(java.awt.event.ActionEvent evt) { private void albedoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_albedoKeyTyped // TODO add your handling code here: - }//GEN-LAST:event_albedoKeyTyped private void albedoSubKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_albedoSubKeyTyped @@ -2471,6 +2608,83 @@ private void albedoSubKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:even } }//GEN-LAST:event_albedoSubKeyReleased + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + // TODO add your handling code here: + previewImg(AlbedoMapFile.getText()); + + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + // TODO add your handling code here: + previewImg(AlbedoSubMapFile.getText()); + }//GEN-LAST:event_jButton4ActionPerformed + public void previewImg(String path) { + File f = new File(path); + File a = new File(foo.getFilePath()); + File parentFolder = new File(a.getParent()); + File b = new File(parentFolder, path); + String absolute = ""; + try { + absolute = b.getCanonicalPath(); + f = new File(absolute); + } catch (Exception e) { + + } + if (f.exists()) { + JDialog jf = new JDialog(); + JLabel jl = new JLabel(); + jf.setName("help"); + jf.setTitle("Map Preview"); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jf.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + BufferedImage img = null; + try {//Map + img = ImageIO.read(new File(absolute)); + } catch (IOException e) { + e.printStackTrace(); + } + jf.setSize(600, 600); + jf.setResizable(false); + jf.setModal(true); + jf.setLocationRelativeTo(this); + jf.setAlwaysOnTop(true); + jf.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + Image dimg = img.getScaledInstance(jf.getWidth(), jf.getHeight(), + Image.SCALE_SMOOTH); + ImageIcon ii = new ImageIcon(dimg); + jl.setIcon(ii); + jf.add(jl); + jf.setVisible(true); + } else { + JDialog jd = new JDialog(); + JLabel jl = new JLabel(); + jl.setText("
    The Map file you are trying to preview doesn't exist.
    "); + jd.setName("help"); + jd.setTitle("No such Map File"); + jd.setSize(300, 100); + jd.setModal(true); + jd.setResizable(false); + jd.setLocationRelativeTo(this); + jd.setAlwaysOnTop(true); + jd.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jd.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + jd.add(jl); + jd.setVisible(true); + + } + } + /** * @param args the command line arguments */ @@ -2520,12 +2734,12 @@ public void run() { private javax.swing.JTextField AlbedoMapFile; private javax.swing.JButton AlbedoMapFileHelp; private javax.swing.JButton AlbedoMapFileHelp1; - private javax.swing.JComboBox AlbedoMapFrom; + public javax.swing.JComboBox AlbedoMapFrom; private javax.swing.JButton AlbedoMapHelp; private javax.swing.JButton AlbedoMapHelp1; private javax.swing.JButton AlbedoMapLoopHelp; private javax.swing.JButton AlbedoMapLoopHelp1; - private javax.swing.JComboBox AlbedoMapUVFlip; + public javax.swing.JComboBox AlbedoMapUVFlip; private javax.swing.JButton AlbedoMapUVFlipHelp; private javax.swing.JButton AlbedoMapUVFlipHelp1; private javax.swing.JButton AlbedoMorphColorHelp; @@ -2543,6 +2757,8 @@ public void run() { private javax.swing.JButton changeFileSub; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; diff --git a/src/mmd/AlphaSection.form b/src/mmd/AlphaSection.form index 4aa1af8..d02b70e 100644 --- a/src/mmd/AlphaSection.form +++ b/src/mmd/AlphaSection.form @@ -49,7 +49,11 @@ - + + + + + @@ -138,8 +142,11 @@ - - + + + + + @@ -150,7 +157,7 @@ - + @@ -163,7 +170,7 @@ - + @@ -176,7 +183,7 @@ - + @@ -236,7 +243,7 @@ - + @@ -253,12 +260,13 @@ + - + @@ -275,6 +283,7 @@ + @@ -342,10 +351,23 @@ + + + + + + + + + + + + + diff --git a/src/mmd/AlphaSection.java b/src/mmd/AlphaSection.java index 07370f6..957c1a8 100644 --- a/src/mmd/AlphaSection.java +++ b/src/mmd/AlphaSection.java @@ -28,15 +28,17 @@ package mmd; import java.awt.BorderLayout; -import java.awt.Dimension; +import java.awt.Dialog; import java.awt.Font; -import java.awt.Toolkit; +import java.awt.Image; +import java.awt.Window; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.BufferedReader; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; @@ -47,6 +49,7 @@ import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; +import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; @@ -76,6 +79,48 @@ public class AlphaSection extends javax.swing.JFrame { private static String CatchAlphaMapFile = null; private static String Catchalpha; private static float CatchalphaMapLoop; + public int errors = 0; + JFrame ErrorWindow = new JFrame(); + + public void SomethingWentWrong() { + if (errors == 1) { + JLabel ErrorWindowText = new JLabel(); + //ErrorWindowText. + ErrorWindowText.setText("
    Something went wrong while trying to load Alpha Section...

    " + + "Please make sure the file you are trying to open doesn't exceed the limit for each parameter, usually this happens when you are trying to open " + + "a .fx file where some of it's parameters has higher values than supposed to be

    " + + "Limits:
    " + + "
    • AlphaMapFrom: 0 - 8
    • " + + "
    • AlphaMapUVFlip: 0 - 3
    • " + + "
    • AlphaMapApplySwizzle: 0 - 3
    • " + + "
      " + + "
    "); + ErrorWindow.setLayout(new BorderLayout()); + ErrorWindow.setSize(700, 350); + ErrorWindow.setLocationRelativeTo(this); + ErrorWindow.setResizable(true); + ErrorWindow.setAlwaysOnTop(true); + ErrorWindow.setVisible(true); + ErrorWindow.setName("help"); + ErrorWindow.add(ErrorWindowText); + ErrorWindow.setTitle("Something went wrong"); + ErrorWindow.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + ErrorWindow.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + ErrorWindow.dispose(); + } + }); + + try { + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + ErrorWindow.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + } + } public int getAlphaMapFrom() { BufferedReader AlbedotoEdit_Br = null; @@ -460,6 +505,7 @@ private void initComponents() { albedoHelp = new javax.swing.JButton(); AlbedoMapLoopHelp = new javax.swing.JButton(); AlphaMapFile = new javax.swing.JTextField(); + jButton3 = new javax.swing.JButton(); jMenu1.setText("jMenu1"); @@ -472,7 +518,12 @@ private void initComponents() { jLabel1.setText("ALPHA MAP FROM"); AlphaMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8" })); - AlphaMapFrom.setSelectedIndex(getAlphaMapFrom()); + try{ + AlphaMapFrom.setSelectedIndex(getAlphaMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlphaMapFrom.setToolTipText(""); AlphaMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -521,7 +572,12 @@ public void keyReleased(java.awt.event.KeyEvent evt) { jLabel9.setText("ALPHA MAP LOOP"); AlphaMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - AlphaMapUVFlip.setSelectedIndex(getAlphaMapUVFlip()); + try{ + AlphaMapUVFlip.setSelectedIndex(getAlphaMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlphaMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { AlphaMapUVFlipItemStateChanged(evt); @@ -534,7 +590,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); AlphaMapSwizzle.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - AlphaMapSwizzle.setSelectedIndex(getAlbedoMapSwizzle()); + try{ + AlphaMapSwizzle.setSelectedIndex(getAlbedoMapSwizzle()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } AlphaMapSwizzle.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { AlphaMapSwizzleItemStateChanged(evt); @@ -597,7 +658,20 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - AlphaMapFile.setText(getAlphaMapFile()); + try{ + AlphaMapFile.setEditable(false); + AlphaMapFile.setText(getAlphaMapFile()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + + jButton3.setText("Preview"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); @@ -611,7 +685,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addGap(278, 278, 278) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(AlphaMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(AlphaMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jButton3)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) @@ -678,8 +755,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(changeFile) .addComponent(AlbedoMapFileHelp)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(AlphaMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(AlphaMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Alpha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -688,7 +767,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapLoopHelp)) - .addContainerGap(160, Short.MAX_VALUE)) + .addContainerGap(158, Short.MAX_VALUE)) ); pack(); @@ -700,7 +779,6 @@ private void AlphaMapFromActionPerformed(java.awt.event.ActionEvent evt) {//GEN- private void AlphaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlphaActionPerformed - }//GEN-LAST:event_AlphaActionPerformed private void AlphaMapUVFlipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlphaMapUVFlipActionPerformed @@ -786,11 +864,20 @@ private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private void changeFileStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_changeFileStateChanged }//GEN-LAST:event_changeFileStateChanged + private void closeAllDialogs() { + Window[] windows = AlbedoSection.getWindows(); + for (Window window : windows) { + if (window.getName().equalsIgnoreCase("help")) { + window.dispose(); + } + } + } private void backActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backActionPerformed - + closeAllDialogs(); WindowFrame w = new WindowFrame(); w.setLocation(this.getLocation()); + ErrorWindow.dispose(); this.dispose(); w.setSize(960, 549); w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); @@ -811,12 +898,12 @@ public void windowClosing(WindowEvent we) { }//GEN-LAST:event_backActionPerformed private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); + AlbedoMapHelp.setName("help"); - AlbedoMapHelpText.setText("
    You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

    " + AlbedoMapHelpText.setText("
    It has no effect on opaque objects

    " + + "You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

    " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
    " + "Tips 2 : Do not enter a path with HDR file, that will be ignore the HDR and linear color-space
    " + "Tips 3 : These files (bmp, png, jpg, tga, dds, gif, apng) must be working in a sRGB color-space
    " @@ -832,8 +919,8 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN + "
  • 8 : Params fetch from Specular Color from the pmx.

  • " + "
  • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular), doesn't work on Alpha


  • "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); @@ -851,17 +938,17 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -878,15 +965,14 @@ private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_AlbedoMapUVFlipHelpActionPerformed private void AlbedoMapApplyScaleHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapApplyScaleHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("The ordering of the data fetched from a texture from the code. (R = 0, G = 1, B = 2, A = 3)"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -902,11 +988,9 @@ private void AlbedoMapApplyScaleHelpActionPerformed(java.awt.event.ActionEvent e }//GEN-LAST:event_AlbedoMapApplyScaleHelpActionPerformed private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " + "For example :
    " @@ -919,8 +1003,8 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -938,14 +1022,13 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("between 0 ~ 1"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 350); + help.setSize(300, 70); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -963,14 +1046,13 @@ private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private void AlbedoMapLoopHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1138,6 +1220,76 @@ private void AlphaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_Al } } }//GEN-LAST:event_AlphaKeyReleased + public void previewImg(String path) { + File f = new File(path); + File a = new File(foo.getFilePath()); + File parentFolder = new File(a.getParent()); + File b = new File(parentFolder, path); + String absolute = ""; + try { + absolute = b.getCanonicalPath(); + f = new File(absolute); + } catch (Exception e) { + + } + if (f.exists()) { + JDialog jf = new JDialog(); + JLabel jl = new JLabel(); + jf.setName("help"); + jf.setTitle("Map Preview"); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jf.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + BufferedImage img = null; + try {//Map + img = ImageIO.read(new File(absolute)); + } catch (IOException e) { + e.printStackTrace(); + } + jf.setSize(600, 600); + jf.setResizable(false); + jf.setModal(true); + jf.setLocationRelativeTo(this); + jf.setAlwaysOnTop(true); + jf.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + Image dimg = img.getScaledInstance(jf.getWidth(), jf.getHeight(), + Image.SCALE_SMOOTH); + ImageIcon ii = new ImageIcon(dimg); + jl.setIcon(ii); + jf.add(jl); + jf.setVisible(true); + } else { + JDialog jd = new JDialog(); + JLabel jl = new JLabel(); + jl.setText("
    The Map file you are trying to preview doesn't exist.
    "); + jd.setName("help"); + jd.setTitle("No such Map File"); + jd.setSize(300, 100); + jd.setModal(true); + jd.setResizable(false); + jd.setLocationRelativeTo(this); + jd.setAlwaysOnTop(true); + jd.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jd.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + jd.add(jl); + jd.setVisible(true); + + } + } + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + // TODO add your handling code here: + previewImg(AlphaMapFile.getText()); + }//GEN-LAST:event_jButton3ActionPerformed /** * @param args the command line arguments @@ -1191,6 +1343,7 @@ public void run() { private javax.swing.JButton albedoHelp; private javax.swing.JButton back; private javax.swing.JButton changeFile; + private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; diff --git a/src/mmd/CustomEnableSection.form b/src/mmd/CustomEnableSection.form index e6320b7..64f3adb 100644 --- a/src/mmd/CustomEnableSection.form +++ b/src/mmd/CustomEnableSection.form @@ -45,6 +45,8 @@ + + @@ -133,6 +135,8 @@ + + @@ -145,7 +149,7 @@ - + @@ -195,6 +199,7 @@ + @@ -203,7 +208,10 @@ - + + + + @@ -227,7 +235,7 @@ - + @@ -240,7 +248,7 @@ - + @@ -284,7 +292,7 @@ - + @@ -301,6 +309,7 @@ + @@ -373,7 +382,7 @@ - + @@ -390,6 +399,7 @@ + @@ -400,7 +410,7 @@ - + @@ -417,6 +427,7 @@ + @@ -427,7 +438,7 @@ - + @@ -443,6 +454,7 @@ + @@ -453,7 +465,7 @@ - + @@ -465,7 +477,7 @@ - + @@ -509,7 +521,7 @@ - + @@ -526,12 +538,13 @@ + - + @@ -548,6 +561,7 @@ + @@ -582,7 +596,7 @@ - + @@ -595,7 +609,7 @@ - + @@ -634,7 +648,7 @@ - + @@ -650,22 +664,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mmd/CustomEnableSection.java b/src/mmd/CustomEnableSection.java index 29ae4a3..1a04a9d 100644 --- a/src/mmd/CustomEnableSection.java +++ b/src/mmd/CustomEnableSection.java @@ -29,9 +29,10 @@ import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Dimension; +import java.awt.Dialog; import java.awt.Font; -import java.awt.Toolkit; +import java.awt.Image; +import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -40,6 +41,7 @@ import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.BufferedReader; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; @@ -52,6 +54,7 @@ import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JColorChooser; +import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; @@ -100,6 +103,52 @@ public class CustomEnableSection extends javax.swing.JFrame { private static int CatchCustomBMapSwizzle; private static int CatchCustomBMapApplyScale; private static String CatchCustomBMapFile = null; + JFrame ErrorWindow = new JFrame(); + public int errors = 0; + + public void SomethingWentWrong() { + if (errors == 1) { + JLabel ErrorWindowText = new JLabel(); + //ErrorWindowText. + ErrorWindowText.setText("
    Something went wrong while trying to load Custom Section...

    " + + "Please make sure the file you are trying to open doesn't exceed the limit for each parameter, usually this happens when you are trying to open " + + "a .fx file where some of it's parameters has higher values than supposed to be

    " + + "Limits:
    " + + "
      " + + "
    • CustomEnable: 0 - 7
    • " + + "
    • CustomMapFrom: 0 - 8
    • " + + "
    • CustomMapUVFlip: 0 - 3
    • " + + "
    • CustomMapColorFlip: 0-3
    • " + + "
    • CustomMapSwizzle: 0-3
    • " + + "
    • CustomMapApplyScale: 0 - 2
    • " + + "
      " + + "
    Same for CustomA and B
    "); + ErrorWindow.setLayout(new BorderLayout()); + ErrorWindow.setSize(700, 350); + ErrorWindow.setLocationRelativeTo(this); + ErrorWindow.setResizable(true); + ErrorWindow.setAlwaysOnTop(true); + ErrorWindow.setVisible(true); + ErrorWindow.add(ErrorWindowText); + ErrorWindow.setName("help"); + ErrorWindow.setTitle("Something went wrong"); + ErrorWindow.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + ErrorWindow.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + ErrorWindow.dispose(); + } + }); + + try { + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + ErrorWindow.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + } + } /*CustomASubMap*/ public int getCustomAEnable() { @@ -731,6 +780,89 @@ public String getSSSkinTransmittance() { return CatchSkin; } + public String checkLoop() { + MaterialMakerv2 m = new MaterialMakerv2(); + BufferedReader br = null; + String check = ""; + try { + br = new BufferedReader(new FileReader(m.getFileToEdit())); + String line = br.readLine(); + + String catchOld = ""; + String catchNew = ""; + + while (line != null) { + if (line.contains("customBMapLoopNum =")) { + catchOld = line; //auxiliar line + String aux = ""; + for (int i = catchOld.indexOf('=') + 1; i < catchOld.length() - 1; i++) { + aux += catchOld.charAt(i); + } + catchOld = aux; + + if (!catchOld.equalsIgnoreCase(CustomBLoop)) { + CustomBLoop = CustomBLoop.replace(",", "."); + catchNew = CustomBLoop; //catchnewdigit + line = line.replaceAll("" + catchOld, " " + catchNew); //replace old for the new one + check = line; + } + } + + line = br.readLine(); + + } + + } catch (Exception ex) { + Logger.getLogger(AlbedoSection.class + .getName()).log(Level.SEVERE, null, ex); + } finally { + try { + br.close(); + } catch (Exception e) { + + } + } + return check; + } + + public String checkSkin() { + MaterialMakerv2 m = new MaterialMakerv2(); + BufferedReader br = null; + String check = ""; + try { + br = new BufferedReader(new FileReader(m.getFileToEdit())); + String line = br.readLine(); + + String catchOld = ""; + + while (line != null) { + if (line.contains("#define SSS_SKIN_TRANSMITTANCE")) { + catchOld = line; //auxiliar line + String aux = ""; + for (int i = catchOld.indexOf('('); i < catchOld.length(); i++) { + aux += catchOld.charAt(i); + } + check = aux; + } + + line = br.readLine(); + + } + + } catch (Exception ex) { + Logger.getLogger(AlbedoSection.class + .getName()).log(Level.SEVERE, null, ex); + } finally { + try { + br.close(); + } catch (Exception e) { + + } + } + return check; + + } + /** * Creates new form WindowFrame */ @@ -747,7 +879,6 @@ public CustomEnableSection() {//Constructor public void myInitComponents() { final DecimalFormat df = new DecimalFormat("0.####"); - //final JFrame frame = new JFrame(); final JTextField text = new JTextField(20); final DoubleJSlider slider = new DoubleJSlider(-6400, 6400, 0, 100); @@ -758,6 +889,7 @@ public void myInitComponents() { slider.setBounds(48, 417, 200, 30); slider.setPaintTicks(true); slider.setValue((int) catchvalue); + text.setBounds(258, 417, 50, 26); text.setFont(new Font("Arial", Font.PLAIN, 11)); text.setText(df.format(slider.getScaledValue())); @@ -832,89 +964,6 @@ public void keyReleased(KeyEvent ke) { } - public String checkLoop() { - MaterialMakerv2 m = new MaterialMakerv2(); - BufferedReader br = null; - String check = ""; - try { - br = new BufferedReader(new FileReader(m.getFileToEdit())); - String line = br.readLine(); - - String catchOld = ""; - String catchNew = ""; - - while (line != null) { - if (line.contains("customBMapLoopNum =")) { - catchOld = line; //auxiliar line - String aux = ""; - for (int i = catchOld.indexOf('=') + 1; i < catchOld.length() - 1; i++) { - aux += catchOld.charAt(i); - } - catchOld = aux; - - if (!catchOld.equalsIgnoreCase(CustomBLoop)) { - CustomBLoop = CustomBLoop.replace(",", "."); - catchNew = CustomBLoop; //catchnewdigit - line = line.replaceAll("" + catchOld, " " + catchNew); //replace old for the new one - check = line; - } - } - - line = br.readLine(); - - } - - } catch (Exception ex) { - Logger.getLogger(AlbedoSection.class - .getName()).log(Level.SEVERE, null, ex); - } finally { - try { - br.close(); - } catch (Exception e) { - - } - } - return check; - } - - public String checkSkin() { - MaterialMakerv2 m = new MaterialMakerv2(); - BufferedReader br = null; - String check = ""; - try { - br = new BufferedReader(new FileReader(m.getFileToEdit())); - String line = br.readLine(); - - String catchOld = ""; - - while (line != null) { - if (line.contains("#define SSS_SKIN_TRANSMITTANCE")) { - catchOld = line; //auxiliar line - String aux = ""; - for (int i = catchOld.indexOf('('); i < catchOld.length(); i++) { - aux += catchOld.charAt(i); - } - check = aux; - } - - line = br.readLine(); - - } - - } catch (Exception ex) { - Logger.getLogger(AlbedoSection.class - .getName()).log(Level.SEVERE, null, ex); - } finally { - try { - br.close(); - } catch (Exception e) { - - } - } - return check; - - } - public void myInitComponents2() { final DecimalFormat df = new DecimalFormat("0.####"); final JTextField text = new JTextField(20); @@ -926,14 +975,15 @@ public void myInitComponents2() { help.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); help.setLayout(new BorderLayout()); + help.setName("help"); + help.setSize(550, 80); help.setLocationRelativeTo(null); - help.setSize(600, 200); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -951,19 +1001,19 @@ public void actionPerformed(ActionEvent e) { } }); - - help.setBounds(623, 393, 53, 23); + int fix = -5; + help.setBounds(623, 393 + fix, 53, 23); help.setText("Help"); help.setVisible(true); label.setText("CUSTOM B MAP LOOP"); label.setVisible(true); - label.setBounds(505, 398, 117, 14); + label.setBounds(505, 398 + fix, 117, 14); slider.setPaintTrack(true); slider.setPaintLabels(true); slider.setBounds(499, 416, 200, 30); slider.setPaintTicks(true); slider.setValue((int) catchvalue); - text.setBounds(707, 416, 50, 26); + text.setBounds(707, 416 + fix, 50, 26); text.setFont(new Font("Arial", Font.PLAIN, 11)); text.setText(df.format(slider.getScaledValue())); if (!checkLoop().equalsIgnoreCase("")) { @@ -1127,10 +1177,10 @@ public void myInitComponents4() { final JButton pick = new JButton(); label.setText("CUSTOM B MAP SCALE"); - label.setBounds(502, 332, 135, 14); + label.setBounds(502, 332 - 3, 135, 14); label.setVisible(true); text.setText(getCustomB()); - text.setBounds(632, 330, 117, 20); + text.setBounds(632, 330 - 3, 117, 20); text.setFont(new Font("Arial", Font.PLAIN, 11)); text.addKeyListener(new KeyAdapter() { @Override @@ -1171,14 +1221,13 @@ public void keyReleased(KeyEvent ke) { help.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - helptext.setText("working in linear color-space, All between 0 ~ 1"); help.setLayout(new BorderLayout()); + help.setName("help"); + help.setSize(450, 80); help.setLocationRelativeTo(null); - help.setSize(600, 200); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1246,10 +1295,11 @@ public void actionPerformed(ActionEvent e) { } }); - pick.setBounds(752, 329, 90, 23); + pick.setBounds(752, 329 - 3, 90, 23); pick.setText("Pick Colour"); - help.setBounds(841, 329, 53, 23); + help.setBounds(841, 329 - 3, 53, 23); help.setText("Help"); + help.setName("help"); help.setVisible(true); add(pick); add(help); @@ -1383,6 +1433,8 @@ private void initComponents() { CustomBMapApplyScale = new javax.swing.JComboBox<>(); CustomAMapFile = new javax.swing.JTextField(); CustomBMapFile = new javax.swing.JTextField(); + jButton3 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); jMenu1.setText("jMenu1"); @@ -1395,7 +1447,12 @@ private void initComponents() { jLabel1.setText("CUSTOM A MAP FROM"); CustomAMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8" })); - CustomAMapFrom.setSelectedIndex(getCustomAMapFrom()); + try{ + CustomAMapFrom.setSelectedIndex(getCustomAMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } CustomAMapFrom.setToolTipText(""); CustomAMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -1429,7 +1486,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel9.setText("CUSTOM A MAP LOOP"); CustomAMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - CustomAMapUVFlip.setSelectedIndex(getCustomAMapUVFlip()); + try{ + CustomAMapUVFlip.setSelectedIndex(getCustomAMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } CustomAMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { CustomAMapUVFlipItemStateChanged(evt); @@ -1495,7 +1557,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel3.setText("CUSTOM A MAP COLOR FLIP"); CustomAMapColorFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - CustomAMapColorFlip.setSelectedIndex(getCustomAMapColorFlip()); + try{ + CustomAMapColorFlip.setSelectedIndex(getCustomAMapColorFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } CustomAMapColorFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { CustomAMapColorFlipItemStateChanged(evt); @@ -1510,7 +1577,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel4.setText("CUSTOM A MAP SWIZZLE"); CustomAMapSwizzle.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - CustomAMapSwizzle.setSelectedIndex(getCustomAMapSwizzle()); + try{ + CustomAMapSwizzle.setSelectedIndex(getCustomAMapSwizzle()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } CustomAMapSwizzle.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { CustomAMapSwizzleItemStateChanged(evt); @@ -1525,7 +1597,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel5.setText("CUSTOM A MAP APPLY SCALE"); CustomAMapApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); - CustomAMapApplyScale.setSelectedIndex(getCustomAMapApplyScale()); + try{ + CustomAMapApplyScale.setSelectedIndex(getCustomAMapApplyScale()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } CustomAMapApplyScale.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { CustomAMapApplyScaleItemStateChanged(evt); @@ -1540,7 +1617,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel7.setText("CUSTOM ENABLE"); CustomAEnable.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" })); - CustomAEnable.setSelectedIndex(getCustomAEnable()); + try{ + CustomAEnable.setSelectedIndex(getCustomAEnable()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } CustomAEnable.setToolTipText(""); CustomAEnable.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -1577,7 +1659,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel10.setText("CUSTOM B MAP COLOR FLIP"); CustomBMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - CustomBMapUVFlip.setSelectedIndex(getCustomBMapUVFlip()); + try{ + CustomBMapUVFlip.setSelectedIndex(getCustomBMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } CustomBMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { CustomBMapUVFlipItemStateChanged(evt); @@ -1590,7 +1677,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); CustomBMapColorFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - CustomBMapColorFlip.setSelectedIndex(getCustomBMapColorFlip()); + try{ + CustomBMapColorFlip.setSelectedIndex(getCustomBMapColorFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } CustomBMapColorFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { CustomBMapColorFlipItemStateChanged(evt); @@ -1626,7 +1718,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel12.setText("CUSTOM B MAP FROM"); CustomBMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8" })); - CustomBMapFrom.setSelectedIndex(getCustomBMapFrom()); + try{ + CustomBMapFrom.setSelectedIndex(getCustomBMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } CustomBMapFrom.setToolTipText(""); CustomBMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -1658,7 +1755,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel17.setText("CUSTOM B MAP APPLY SCALE"); CustomBMapApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); - CustomBMapApplyScale.setSelectedIndex(getCustomBMapApplyScale()); + try{ + CustomBMapApplyScale.setSelectedIndex(getCustomBMapApplyScale()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } CustomBMapApplyScale.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { CustomBMapApplyScaleItemStateChanged(evt); @@ -1670,9 +1772,35 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - CustomAMapFile.setText(getCustomAMapFile()); + try{ + CustomAMapFile.setEditable(false); + CustomAMapFile.setText(getCustomAMapFile()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } - CustomBMapFile.setText(getCustomBMapFile()); + try{ + CustomBMapFile.setEditable(false); + CustomBMapFile.setText(getCustomBMapFile()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + + jButton3.setText("Preview"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + jButton4.setText("Preview"); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); @@ -1683,6 +1811,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(CustomAMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton3) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -1754,13 +1884,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addContainerGap(92, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(CustomBMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton4) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(12, 12, 12) - .addComponent(back, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE) + .addComponent(back, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(34, 34, 34) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1804,14 +1936,17 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(CustomAMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapUVFlipHelp2) - .addComponent(CustomBMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(CustomBMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapFileHelp) .addComponent(changeFile)) .addGap(4, 4, 4) - .addComponent(CustomAMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(CustomAMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1905,11 +2040,20 @@ private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private void changeFileStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_changeFileStateChanged }//GEN-LAST:event_changeFileStateChanged + private void closeAllDialogs() { + Window[] windows = AlbedoSection.getWindows(); + for (Window window : windows) { + if (window.getName().equalsIgnoreCase("help")) { + window.dispose(); + } + } + } private void backActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backActionPerformed - + closeAllDialogs(); WindowFrame w = new WindowFrame(); w.setLocation(this.getLocation()); + ErrorWindow.dispose(); this.dispose(); w.setSize(960, 549); w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); @@ -1929,10 +2073,9 @@ public void windowClosing(WindowEvent we) { }//GEN-LAST:event_backActionPerformed private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); + AlbedoMapHelp.setName("help"); AlbedoMapHelpText.setText("
    You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

    " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
    " @@ -1950,8 +2093,8 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN + "
  • 8 : Params fetch from Specular Color from the pmx.

  • " + "
  • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular), doesn't work on Custom


  • "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); @@ -1968,17 +2111,17 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1994,11 +2137,9 @@ private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_AlbedoMapUVFlipHelpActionPerformed private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " + "For example :
    " @@ -2011,8 +2152,8 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -2029,14 +2170,15 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ }//GEN-LAST:event_AlbedoMapFileHelpActionPerformed private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("working in linear color-space, All between 0 ~ 1"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 350); + help.setSize(400, 70); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -2053,14 +2195,15 @@ private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI }//GEN-LAST:event_albedoHelpActionPerformed private void AlbedoMapLoopHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -2077,11 +2220,9 @@ private void AlbedoMapLoopHelpActionPerformed(java.awt.event.ActionEvent evt) {/ }//GEN-LAST:event_AlbedoMapLoopHelpActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("Shading Material ID
    " + "The curvature also called 'opacity'


    " + "" @@ -2100,8 +2241,8 @@ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS + "
    • 6 : Clear Coat customA = smoothness, customB = invalid;
    • " + "
    • 7 : Subsurface customA = curvature, customB = transmittance color;
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 387); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -2135,14 +2276,13 @@ private void CustomAEnableActionPerformed(java.awt.event.ActionEvent evt) {//GEN }//GEN-LAST:event_CustomAEnableActionPerformed private void AlbedoMapUVFlipHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("The ordering of the data fetched from a texture from the code. (R = 0, G = 1, B = 2, A = 3)"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 387); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -2160,18 +2300,17 @@ private void AlbedoMapUVFlipHelp1ActionPerformed(java.awt.event.ActionEvent evt) private void AlbedoMapUVFlipHelp2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp2ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("
    You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE


    " + "
    • 1 : map values * albedo;
    • " + "
    • 2 : map values ^ albedo;
    • " + "
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setSize(500, 160); + help.setLocationRelativeTo(this); + helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -2187,19 +2326,18 @@ private void AlbedoMapUVFlipHelp2ActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_AlbedoMapUVFlipHelp2ActionPerformed private void AlbedoMapUVFlipHelp4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp4ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("
    You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE


    " + "
    • 1 : map values * albedo;
    • " + "
    • 2 : map values ^ albedo;
    • " + "
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setSize(500, 160); + help.setLocationRelativeTo(this); + helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -2223,11 +2361,9 @@ private void CustomBMapColorFlipActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_CustomBMapColorFlipActionPerformed private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); - + AlbedoMapHelp.setName("help"); AlbedoMapHelpText.setText("
    You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

    " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
    " + "Tips 2 : Do not enter a path with HDR file, that will be ignore the HDR and linear color-space
    " @@ -2244,8 +2380,8 @@ private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GE + "
  • 8 : Params fetch from Specular Color from the pmx.

  • " + "
  • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular), doesn't work on Custom


  • "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); @@ -2262,17 +2398,17 @@ private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GE private void AlbedoMapUVFlipHelp6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp6ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -2288,11 +2424,9 @@ private void AlbedoMapUVFlipHelp6ActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_AlbedoMapUVFlipHelp6ActionPerformed private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " + "For example :
    " @@ -2305,8 +2439,8 @@ private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) { + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -2720,6 +2854,80 @@ private void CustomBMapApplyScaleItemStateChanged(java.awt.event.ItemEvent evt) } }//GEN-LAST:event_CustomBMapApplyScaleItemStateChanged + public void previewImg(String path) { + File f = new File(path); + File a = new File(foo.getFilePath()); + File parentFolder = new File(a.getParent()); + File b = new File(parentFolder, path); + String absolute = ""; + try { + absolute = b.getCanonicalPath(); + f = new File(absolute); + } catch (Exception e) { + + } + if (f.exists()) { + JDialog jf = new JDialog(); + JLabel jl = new JLabel(); + jf.setName("help"); + jf.setTitle("Map Preview"); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jf.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + BufferedImage img = null; + try {//Map + img = ImageIO.read(new File(absolute)); + } catch (IOException e) { + e.printStackTrace(); + } + jf.setSize(600, 600); + jf.setResizable(false); + jf.setModal(true); + jf.setLocationRelativeTo(this); + jf.setAlwaysOnTop(true); + jf.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + Image dimg = img.getScaledInstance(jf.getWidth(), jf.getHeight(), + Image.SCALE_SMOOTH); + ImageIcon ii = new ImageIcon(dimg); + jl.setIcon(ii); + jf.add(jl); + jf.setVisible(true); + } else { + JDialog jd = new JDialog(); + JLabel jl = new JLabel(); + jl.setText("
    The Map file you are trying to preview doesn't exist.
    "); + jd.setName("help"); + jd.setTitle("No such Map File"); + jd.setSize(300, 100); + jd.setModal(true); + jd.setResizable(false); + jd.setLocationRelativeTo(this); + jd.setAlwaysOnTop(true); + jd.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jd.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + jd.add(jl); + jd.setVisible(true); + + } + } + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + // TODO add your handling code here: + previewImg(CustomAMapFile.getText()); + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + previewImg(CustomBMapFile.getText()); + }//GEN-LAST:event_jButton4ActionPerformed /** * @param args the command line arguments @@ -2795,6 +3003,8 @@ public void run() { private javax.swing.JButton changeFile; private javax.swing.JButton changeFile1; private javax.swing.JButton jButton1; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel12; diff --git a/src/mmd/EmissiveSection.form b/src/mmd/EmissiveSection.form index 3c23cfa..16812e8 100644 --- a/src/mmd/EmissiveSection.form +++ b/src/mmd/EmissiveSection.form @@ -49,11 +49,11 @@ - - - + + + - + @@ -68,31 +68,22 @@ - - - - - - - - - - - + - - - - - - - - - - + + + + + + + + + + + @@ -115,9 +106,27 @@ + + + + + + + + + + + + + + + + + + @@ -138,7 +147,7 @@ - + @@ -153,21 +162,17 @@ - - - - - - + + - + @@ -175,104 +180,78 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - + + + - - - - - - - - - - - - - + + - - - - - - - - - - + + + + + - - - - - - - - + + + - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + - @@ -285,7 +264,7 @@ - + @@ -298,7 +277,7 @@ - + @@ -342,7 +321,7 @@ - + @@ -359,6 +338,7 @@ + @@ -409,13 +389,13 @@ - + - + @@ -493,7 +473,7 @@ - + @@ -510,6 +490,7 @@ + @@ -530,7 +511,7 @@ - + @@ -547,12 +528,13 @@ + - + @@ -569,12 +551,13 @@ + - + @@ -590,6 +573,7 @@ + @@ -619,10 +603,15 @@ + + + + + @@ -638,5 +627,13 @@ + + + + + + + + diff --git a/src/mmd/EmissiveSection.java b/src/mmd/EmissiveSection.java index 65d4b3e..95dd792 100644 --- a/src/mmd/EmissiveSection.java +++ b/src/mmd/EmissiveSection.java @@ -28,14 +28,18 @@ package mmd; import java.awt.BorderLayout; +import java.awt.Dialog; import java.awt.Dimension; +import java.awt.Image; import java.awt.Toolkit; +import java.awt.Window; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.BufferedReader; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; @@ -46,6 +50,7 @@ import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; +import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; @@ -87,6 +92,53 @@ public class EmissiveSection extends javax.swing.JFrame { private static float CatchEmissiveLoop; private static float CatchEmissiveBlink; private static float CatchEmissiveIntensity; + public int errors = 0; + JFrame ErrorWindow = new JFrame(); + + public void SomethingWentWrong() { + if (errors == 1) { + JLabel ErrorWindowText = new JLabel(); + //ErrorWindowText. + ErrorWindowText.setText("
    Something went wrong while trying to load Emissive Section...

    " + + "Please make sure the file you are trying to open doesn't exceed the limit for each parameter, usually this happens when you are trying to open " + + "a .fx file where some of it's parameters has higher values than supposed to be

    " + + "Limits:
    " + + "
      " + + "
    • EmissiveEnable: 0 - 1
    • " + + "
    • EmissiveMapFrom: 0 - 8
    • " + + "
    • EmissiveMapUVFlip: 0 - 3
    • " + + "
    • EmissiveMapApplyScale: 0 - 2
    • " + + "
    • EmissiveMapApplyIntensity: 0 - 3
    • " + + "
    • EmissiveMapApplyMorphColor: 0 - 3
    • " + + "
    • EmissiveMapApplyBlink: 0 - 2
    • " + + "
      " + + "
    "); + ErrorWindow.setLayout(new BorderLayout()); + ErrorWindow.setSize(700, 350); + ErrorWindow.setLocationRelativeTo(this); + ErrorWindow.setResizable(true); + ErrorWindow.setAlwaysOnTop(true); + ErrorWindow.setVisible(true); + ErrorWindow.add(ErrorWindowText); + ErrorWindow.setName("help"); + ErrorWindow.setTitle("Something went wrong"); + ErrorWindow.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + ErrorWindow.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + ErrorWindow.dispose(); + } + }); + + try { + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + ErrorWindow.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + } + } public int getEmissiveMapApplyBlink() { BufferedReader AlbedotoEdit_Br = null; @@ -526,7 +578,7 @@ public void myInitComponents() { final DecimalFormat df = new DecimalFormat("0.####"); final JTextField text = new JTextField(20); - final DoubleJSlider slider = new DoubleJSlider(-51200, 51200, 0, 100); + final DoubleJSlider slider = new DoubleJSlider(-10000, 10000, 0, 100); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { @@ -593,10 +645,10 @@ public void keyReleased(KeyEvent ke) { catchvalue = Float.parseFloat("" + getEmissiveLoop()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); - slider.setBounds(578, 327, 200, 30); + slider.setBounds(578, 332, 200, 30); slider.setPaintTicks(true); slider.setValue((int) catchvalue); - text.setBounds(788, 327, 50, 20); + text.setBounds(788, 332, 50, 20); add(text); add(slider); @@ -831,10 +883,10 @@ public void keyReleased(KeyEvent ke) { catchvalue = Float.parseFloat("" + getEmissiveIntensity()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); - slider.setBounds(578, 264, 200, 30); + slider.setBounds(578, 265, 200, 30); slider.setPaintTicks(true); slider.setValue((int) catchvalue); - text.setBounds(788, 264, 50, 20); + text.setBounds(788, 265, 50, 20); add(text); add(slider); @@ -899,6 +951,7 @@ private void initComponents() { AlbedoMapUVFlipHelp4 = new javax.swing.JButton(); EmissiveMapFile = new javax.swing.JTextField(); back1 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); jMenu1.setText("jMenu1"); @@ -911,7 +964,12 @@ private void initComponents() { jLabel1.setText("EMISSIVE MAP FROM"); EmissiveMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8" })); - EmissiveMapFrom.setSelectedIndex(getEmissiveMapFrom()); + try{ + EmissiveMapFrom.setSelectedIndex(getEmissiveMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } EmissiveMapFrom.setToolTipText(""); EmissiveMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -945,7 +1003,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel9.setText("EMISSIVE MAP LOOP"); EmissiveMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - EmissiveMapUVFlip.setSelectedIndex(getEmissiveMapUVFlip()); + try{ + EmissiveMapUVFlip.setSelectedIndex(getEmissiveMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } EmissiveMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { EmissiveMapUVFlipItemStateChanged(evt); @@ -995,7 +1058,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel3.setText("EMISSIVE MAP ENABLE"); EmissiveEnable.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1" })); - EmissiveEnable.setSelectedIndex(getEmissiveEnable()); + try{ + EmissiveEnable.setSelectedIndex(getEmissiveEnable()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } EmissiveEnable.setToolTipText(""); EmissiveEnable.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -1054,7 +1122,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); EmissiveMapApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - EmissiveMapApplyScale.setSelectedIndex(getEmissiveMapApplyScale()); + try{ + EmissiveMapApplyScale.setSelectedIndex(getEmissiveMapApplyScale()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } EmissiveMapApplyScale.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { EmissiveMapApplyScaleItemStateChanged(evt); @@ -1073,7 +1146,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel13.setText("EMISSIVE MAP APPLY BLINK"); EmissiveMapApplyMorphColor.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - EmissiveMapApplyMorphColor.setSelectedIndex(getEmissiveMapApplyMorphColor()); + try{ + EmissiveMapApplyMorphColor.setSelectedIndex(getEmissiveMapApplyMorphColor()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } EmissiveMapApplyMorphColor.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { EmissiveMapApplyMorphColorItemStateChanged(evt); @@ -1086,7 +1164,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); EmissiveMapApplyMorphIntensity.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - EmissiveMapApplyMorphIntensity.setSelectedIndex(getEmissiveMapApplyMorphIntensity()); + try{ + EmissiveMapApplyMorphIntensity.setSelectedIndex(getEmissiveMapApplyMorphIntensity()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } EmissiveMapApplyMorphIntensity.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { EmissiveMapApplyMorphIntensityItemStateChanged(evt); @@ -1099,7 +1182,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); EmissiveMapApplyBlink.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); - EmissiveMapApplyBlink.setSelectedIndex(getEmissiveMapApplyBlink()); + try{ + EmissiveMapApplyBlink.setSelectedIndex(getEmissiveMapApplyBlink()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } EmissiveMapApplyBlink.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { EmissiveMapApplyBlinkItemStateChanged(evt); @@ -1132,7 +1220,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - EmissiveMapFile.setText(getEmissiveMapFile()); + try{ + EmissiveMapFile.setEditable(false); + EmissiveMapFile.setText(getEmissiveMapFile()); + }catch(Exception e){ + + } back1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bg/back.png"))); // NOI18N back1.setBorder(null); @@ -1143,6 +1236,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); + jButton3.setText("Preview"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -1155,10 +1255,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(94, 94, 94) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1) + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(EmissiveMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1170,27 +1270,19 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(AlbedoMapHelp3)))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(EmissiveMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(31, 31, 31) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(changeFile, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(AlbedoMapFileHelp)) .addGroup(layout.createSequentialGroup() - .addComponent(EmissiveMapApplyBlink, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(EmissiveMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(AlbedoMapUVFlipHelp4) - .addGap(134, 134, 134) - .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(6, 6, 6) - .addComponent(AlbedoMapLoopHelp)) + .addComponent(jButton3) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE) + .addComponent(jLabel13) + .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(EmissiveMapApplyMorphIntensity, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -1208,9 +1300,22 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addComponent(EmissiveMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(AlbedoMapUVFlipHelp))) + .addComponent(AlbedoMapUVFlipHelp)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(EmissiveMapApplyBlink, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(changeFile, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(AlbedoMapFileHelp) + .addComponent(AlbedoMapUVFlipHelp4)))) .addGap(134, 134, 134) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(AlbedoMapLoopHelp)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -1223,7 +1328,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(albedoHelp))))))) - .addContainerGap(141, Short.MAX_VALUE)) + .addGap(141, 141, 141)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -1234,93 +1339,75 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGap(0, 0, Short.MAX_VALUE) .addComponent(back1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGap(9, 9, 9) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addGap(54, 54, 54) - .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createSequentialGroup() - .addGap(51, 51, 51) + .addGap(63, 63, 63) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(EmissiveEnable, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapHelp3))) + .addComponent(AlbedoMapHelp3) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() - .addGap(48, 48, 48) + .addGap(57, 57, 57) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(albedoHelp)))) .addGap(6, 6, 6) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(AlbedoMapHelp) + .addComponent(EmissiveMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(6, 6, 6) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(6, 6, 6) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(AlbedoMapHelp) - .addComponent(EmissiveMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(14, 14, 14) + .addComponent(EmissiveMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapUVFlipHelp) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(albedoHelp1))) + .addGap(2, 2, 2) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(AlbedoMapUVFlipHelp1) + .addComponent(EmissiveMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() - .addGap(9, 9, 9) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(AlbedoMapLoopHelp1) + .addGroup(layout.createSequentialGroup() + .addGap(6, 6, 6) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(43, 43, 43) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(EmissiveMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapUVFlipHelp))) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapLoopHelp)) + .addGap(161, 161, 161)) .addGroup(layout.createSequentialGroup() - .addGap(6, 6, 6) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(albedoHelp1)))) - .addGap(6, 6, 6) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(8, 8, 8) - .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(AlbedoMapUVFlipHelp1) - .addComponent(EmissiveMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(6, 6, 6) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(AlbedoMapUVFlipHelp2) - .addComponent(EmissiveMapApplyMorphColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(AlbedoMapLoopHelp1) - .addGroup(layout.createSequentialGroup() - .addGap(8, 8, 8) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) - .addGap(6, 6, 6) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(8, 8, 8) - .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(AlbedoMapUVFlipHelp3) - .addComponent(EmissiveMapApplyMorphIntensity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(6, 6, 6) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(AlbedoMapUVFlipHelp4) - .addComponent(EmissiveMapApplyBlink, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createSequentialGroup() - .addGap(8, 8, 8) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapLoopHelp))))) - .addGap(6, 6, 6) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(AlbedoMapFileHelp) - .addComponent(changeFile)) - .addGroup(layout.createSequentialGroup() - .addGap(8, 8, 8) - .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(EmissiveMapApplyMorphColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapUVFlipHelp2)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(EmissiveMapApplyMorphIntensity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapUVFlipHelp3)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(EmissiveMapApplyBlink, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapUVFlipHelp4) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(changeFile) + .addComponent(AlbedoMapFileHelp) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(EmissiveMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(100, 100, 100)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(EmissiveMapFile, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(119, 119, 119)))) ); pack(); @@ -1404,10 +1491,10 @@ private void changeFileStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI }//GEN-LAST:event_changeFileStateChanged private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); - + AlbedoMapHelp.setName("help"); AlbedoMapHelpText.setText("
    You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

    " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
    " + "Tips 2 : Do not enter a path with HDR file, that will be ignore the HDR and linear color-space
    " @@ -1424,8 +1511,8 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN + "
  • 8 : Params fetch from Specular Color from the pmx.

  • " + "
  • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular), doesn't work on Emissive


  • "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); @@ -1441,17 +1528,17 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN }//GEN-LAST:event_AlbedoMapHelpActionPerformed private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1467,10 +1554,10 @@ private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_AlbedoMapUVFlipHelpActionPerformed private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " + "For example :
    " @@ -1483,8 +1570,8 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1501,14 +1588,14 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ }//GEN-LAST:event_AlbedoMapFileHelpActionPerformed private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("between 0 ~ 1"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 350); + help.setSize(300, 70); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1525,14 +1612,15 @@ private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI }//GEN-LAST:event_albedoHelpActionPerformed private void AlbedoMapLoopHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1553,15 +1641,15 @@ private void EmissiveEnableActionPerformed(java.awt.event.ActionEvent evt) {//GE }//GEN-LAST:event_EmissiveEnableActionPerformed private void AlbedoMapHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp3ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("0 in order to Disable, 1 for Enabling "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); + help.setSize(400, 70); + help.setLocationRelativeTo(this); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); - help.setSize(700, 250); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1577,17 +1665,17 @@ private void AlbedoMapHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GE }//GEN-LAST:event_AlbedoMapHelp3ActionPerformed private void AlbedoMapUVFlipHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("
    You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE


    " + "
    • 1 : map values * albedo;
    • " + "
    • 2 : map values ^ albedo;
    • " + "
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1603,14 +1691,14 @@ private void AlbedoMapUVFlipHelp1ActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_AlbedoMapUVFlipHelp1ActionPerformed private void albedoHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("between 0 ~ 10"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 350); + help.setSize(300, 70); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1628,14 +1716,14 @@ private void albedoHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F }//GEN-LAST:event_albedoHelp1ActionPerformed private void AlbedoMapLoopHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("between 0 ~ 100"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 200); + help.setSize(300, 70); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1652,17 +1740,17 @@ private void AlbedoMapLoopHelp1ActionPerformed(java.awt.event.ActionEvent evt) { }//GEN-LAST:event_AlbedoMapLoopHelp1ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - helptext.setText("Tips : You can add a light source in MMD (PointLight or others)

    " + helptext.setText("Tips : You can add a light source in MMD (PointLight or others)

    " + "And key it as part of emissive of the model (In other words : set it to follow the bone of model)
    " + "And same color set it to your light source and emissive color
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setSize(700, 250); + help.setLocationRelativeTo(this); + helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1694,14 +1782,14 @@ private void EmissiveMapApplyBlinkActionPerformed(java.awt.event.ActionEvent evt }//GEN-LAST:event_EmissiveMapApplyBlinkActionPerformed private void AlbedoMapUVFlipHelp2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp2ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("Texture colors to multiply with color from the morph controller (R+/G+/B+)..."); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setResizable(true); help.setVisible(true); @@ -1718,14 +1806,14 @@ private void AlbedoMapUVFlipHelp2ActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_AlbedoMapUVFlipHelp2ActionPerformed private void AlbedoMapUVFlipHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp3ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("Texture colors to multiply with color from the morph controller (R+/G+/B+)..."); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setResizable(true); help.setVisible(true); @@ -1742,17 +1830,17 @@ private void AlbedoMapUVFlipHelp3ActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_AlbedoMapUVFlipHelp3ActionPerformed private void AlbedoMapUVFlipHelp4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp4ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("You can set the blink using the following code.

    " + "" + "
    • 1 : colors to multiply with frequency from emissiveBlink. like : const float3 emissiveBlink = float3(1.0, 2.0, 3.0);
    • " + "
    • 2 : colors to multiply with frequency from morph controller, see Blink morph inside PointLight.pmx
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setResizable(true); help.setVisible(true); @@ -1767,11 +1855,22 @@ private void AlbedoMapUVFlipHelp4ActionPerformed(java.awt.event.ActionEvent evt) System.out.println("" + ex); } }//GEN-LAST:event_AlbedoMapUVFlipHelp4ActionPerformed + private void closeAllDialogs() { + Window[] windows = AlbedoSection.getWindows(); + + for (Window window : windows) { + if (window.getName().equalsIgnoreCase("help")) { + window.dispose(); + } + } + } private void back1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back1ActionPerformed + closeAllDialogs(); WindowFrame w = new WindowFrame(); w.setLocation(this.getLocation()); + ErrorWindow.dispose(); this.dispose(); w.setSize(960, 549); w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); @@ -1801,10 +1900,10 @@ private void EmissiveEnableItemStateChanged(java.awt.event.ItemEvent evt) {//GEN String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define EMISSIVE_MAP_FROM")) { + if (line.contains("#define EMISSIVE_ENABLE")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = EmissiveMapFrom.getSelectedItem().toString(); //catchnewdigit + catchNew = EmissiveEnable.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -1821,6 +1920,7 @@ private void EmissiveEnableItemStateChanged(java.awt.event.ItemEvent evt) {//GEN } catch (Exception ex) { } + }//GEN-LAST:event_EmissiveEnableItemStateChanged private void EmissiveMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_EmissiveMapFromItemStateChanged @@ -1833,10 +1933,10 @@ private void EmissiveMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GE String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define EMISSIVE_ENABLE")) { + if (line.contains("#define EMISSIVE_MAP_FROM")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = EmissiveEnable.getSelectedItem().toString(); //catchnewdigit + catchNew = EmissiveMapFrom.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2014,6 +2114,76 @@ private void EmissiveMapApplyBlinkItemStateChanged(java.awt.event.ItemEvent evt) } }//GEN-LAST:event_EmissiveMapApplyBlinkItemStateChanged + public void previewImg(String path) { + File f = new File(path); + File a = new File(foo.getFilePath()); + File parentFolder = new File(a.getParent()); + File b = new File(parentFolder, path); + String absolute = ""; + try { + absolute = b.getCanonicalPath(); + f = new File(absolute); + } catch (Exception e) { + + } + if (f.exists()) { + JDialog jf = new JDialog(); + JLabel jl = new JLabel(); + jf.setName("help"); + jf.setTitle("Map Preview"); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jf.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + BufferedImage img = null; + try {//Map + img = ImageIO.read(new File(absolute)); + } catch (IOException e) { + e.printStackTrace(); + } + jf.setSize(600, 600); + jf.setResizable(false); + jf.setModal(true); + jf.setLocationRelativeTo(this); + jf.setAlwaysOnTop(true); + jf.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + Image dimg = img.getScaledInstance(jf.getWidth(), jf.getHeight(), + Image.SCALE_SMOOTH); + ImageIcon ii = new ImageIcon(dimg); + jl.setIcon(ii); + jf.add(jl); + jf.setVisible(true); + } else { + JDialog jd = new JDialog(); + JLabel jl = new JLabel(); + jl.setText("
    The Map file you are trying to preview doesn't exist.
    "); + jd.setName("help"); + jd.setTitle("No such Map File"); + jd.setSize(300, 100); + jd.setModal(true); + jd.setResizable(false); + jd.setLocationRelativeTo(this); + jd.setAlwaysOnTop(true); + jd.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jd.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + jd.add(jl); + jd.setVisible(true); + + } + } + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + // TODO add your handling code here: + previewImg(EmissiveMapFile.getText()); + }//GEN-LAST:event_jButton3ActionPerformed /** * @param args the command line arguments @@ -2077,6 +2247,7 @@ public void run() { private javax.swing.JButton back1; private javax.swing.JButton changeFile; private javax.swing.JButton jButton1; + private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; diff --git a/src/mmd/MaterialMakerv2.java b/src/mmd/MaterialMakerv2.java index 48912cf..dea6811 100644 --- a/src/mmd/MaterialMakerv2.java +++ b/src/mmd/MaterialMakerv2.java @@ -181,71 +181,115 @@ public static void FromExisting(Component a) { + "Note that If you click 'No' the new material will be created at the same folder as the selected one.", "Destination Folder", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, img); - if (input == 0) {//I would like to specify - JFileChooser chooser; - String choosertitle = null; - - chooser = new JFileChooser(); - chooser.setCurrentDirectory(new java.io.File("../../Materials")); - chooser.setDialogTitle(choosertitle); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - - chooser.setAcceptAllFileFilterUsed(false); - - if (chooser.showOpenDialog(a) == JFileChooser.APPROVE_OPTION) { - filePath = chooser.getSelectedFile().toString(); - fileOldPath = filePath; - filePath += "\\" + newName; - fileToEdit = new File(filePath); - Object[] options = {"Overwrite file", "Change name", "Go to menu"}; - if (fileToEdit.exists() && !fileToEdit.isDirectory()) { - - int whenExists = JOptionPane.showOptionDialog(a, "It looks like a material with that exact name (" + newName + "), already exists.

    " + "Would you like whether to overwrite the selected file or change the name of the material?", - "Material already exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, img, options, "Change name"); - if (whenExists == 0) {//Overwrite - FileWriter fw = new FileWriter(filePath); - - fw.write(catchContent); - fw.close(); - - try { - a.setVisible(false); - - WindowFrame w = new WindowFrame(); - w.setAlwaysOnTop(true); - w.setAlwaysOnTop(false); - w.setResizable(false); - w.setBounds(0, 0, 960, 549); - w.setLocationRelativeTo(null); - w.setLayout(new BorderLayout()); - w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - - w.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent we) { - callMenu(); - w.dispose(); + switch (input) { + case 0: + //I would like to specify + JFileChooser chooser; + String choosertitle = null; + chooser = new JFileChooser(); + chooser.setCurrentDirectory(new java.io.File("../../Materials")); + chooser.setDialogTitle(choosertitle); + chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + chooser.setAcceptAllFileFilterUsed(false); + if (chooser.showOpenDialog(a) == JFileChooser.APPROVE_OPTION) { + filePath = chooser.getSelectedFile().toString(); + fileOldPath = filePath; + filePath += "\\" + newName; + fileToEdit = new File(filePath); + Object[] options = {"Overwrite file", "Change name", "Go to menu"}; + if (fileToEdit.exists() && !fileToEdit.isDirectory()) { + int whenExists = JOptionPane.showOptionDialog(a, "It looks like a material with that exact name (" + newName + "), already exists.

    " + "Would you like whether to overwrite the selected file or change the name of the material?", + "Material already exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, img, options, "Change name"); + switch (whenExists) { + case 0: { + //Overwrite + File check = new File((fileToEdit.getParent() + "\\material_common_2.0.fxsub")); + if (!check.exists()) {//If materialcommon doesn't exist in the folder. + copyFile(new File("../../Materials/material_common_2.0.fxsub"), check); } - }); - ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); - w.setIconImage(imge.getImage()); - w.setVisible(true); - } catch (Exception e) { - - } - } else if (whenExists == 1) {//Change Name - do { - newName = (String) JOptionPane.showInputDialog(a, "New material name (WITHOUT EXTENSION)", "Create material from Default", EXIT_ON_CLOSE, img, null, null); - Pattern pattern = Pattern.compile("\\p{Alnum}+");//Only validates numbers and letters - matcher = pattern.matcher(newName); + FileWriter fw = new FileWriter(filePath); + fw.write(catchContent); + fw.close(); + try { + a.setVisible(false); + + WindowFrame w = new WindowFrame(); + w.setAlwaysOnTop(true); + w.setAlwaysOnTop(false); + w.setResizable(false); + w.setBounds(0, 0, 960, 549); + w.setLocationRelativeTo(null); + w.setLayout(new BorderLayout()); + w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + + w.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + callMenu(); + w.dispose(); + } + }); + ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); + w.setIconImage(imge.getImage()); + w.setVisible(true); + } catch (Exception e) { - filePath = fileOldPath + "\\" + newName + ".fx"; - fileToEdit = new File(filePath); - if (fileToEdit.exists()) { - newName = "fuck you.fx"; + } + break; } - } while (!matcher.matches() || (newName.contains(".fx") || (newName.equalsIgnoreCase("fx")))); + case 1: { + //Change Name + do { + newName = (String) JOptionPane.showInputDialog(a, "New material name (WITHOUT EXTENSION)", "Create material from Default", EXIT_ON_CLOSE, img, null, null); + Pattern pattern = Pattern.compile("\\p{Alnum}+");//Only validates numbers and letters + matcher = pattern.matcher(newName); + + filePath = fileOldPath + "\\" + newName + ".fx"; + fileToEdit = new File(filePath); + if (fileToEdit.exists()) { + newName = "fuck you.fx"; + } + } while (!matcher.matches() || (newName.contains(".fx") || (newName.equalsIgnoreCase("fx")))); + File check = new File((fileToEdit.getParent() + "\\material_common_2.0.fxsub")); + if (!check.exists()) {//If materialcommon doesn't exist in the folder. + copyFile(new File("../../Materials/material_common_2.0.fxsub"), check); + } + FileWriter fw = new FileWriter(filePath); + fw.write(catchContent); + fw.close(); + try { + a.setVisible(false); + WindowFrame w = new WindowFrame(); + w.setAlwaysOnTop(true); + w.setAlwaysOnTop(false); + w.setResizable(false); + w.setBounds(0, 0, 960, 549); + w.setLocationRelativeTo(null); + w.setLayout(new BorderLayout()); + w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + + w.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent we) { + callMenu(); + w.dispose(); + } + }); + ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); + w.setIconImage(imge.getImage()); + w.setVisible(true); + } catch (Exception e) { + } + break; + } + default: + break; + } + } else { + File check = new File((fileToEdit.getParent() + "\\material_common_2.0.fxsub")); + if (!check.exists()) {//If materialcommon doesn't exist in the folder. + copyFile(new File("../../Materials/material_common_2.0.fxsub"), check); + } FileWriter fw = new FileWriter(filePath); fw.write(catchContent); @@ -261,7 +305,6 @@ public void windowClosing(WindowEvent we) { w.setLocationRelativeTo(null); w.setLayout(new BorderLayout()); w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - w.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { callMenu(); @@ -274,100 +317,111 @@ public void windowClosing(WindowEvent we) { } catch (Exception e) { } - - } else { - } } else { - - FileWriter fw = new FileWriter(filePath); - - fw.write(catchContent); - fw.close(); - - try { - a.setVisible(false); - WindowFrame w = new WindowFrame(); - w.setAlwaysOnTop(true); - w.setAlwaysOnTop(false); - w.setResizable(false); - w.setBounds(0, 0, 960, 549); - w.setLocationRelativeTo(null); - w.setLayout(new BorderLayout()); - w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - w.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent we) { - callMenu(); - w.dispose(); - } - }); - ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); - w.setIconImage(imge.getImage()); - w.setVisible(true); - } catch (Exception e) { - - } } + break; + case 1: + //I would not like to specify - } else { - - } - - } else if (input == 1) {//I would not like to specify - - filePath = fileChooser.getSelectedFile().getParent(); - fileOldPath = filePath; - filePath += "\\" + newName; - fileToEdit = new File(filePath); - Object[] options = {"Overwrite file", "Change name", "Go to menu"}; - if (fileToEdit.exists() && !fileToEdit.isDirectory()) { - - int whenExists = JOptionPane.showOptionDialog(a, "It looks like a material with that exact name (" + newName + "), already exists.

    " + "Would you like whether to overwrite the selected file or change the name of the material?", - "Material already exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, img, options, "Change name"); - if (whenExists == 0) {//Overwrite - FileWriter fw = new FileWriter(filePath); - - fw.write(catchContent); - fw.close(); - - try { - a.setVisible(false); - - WindowFrame w = new WindowFrame(); - w.setAlwaysOnTop(true); - w.setAlwaysOnTop(false); - w.setResizable(false); - w.setBounds(0, 0, 960, 549); - w.setLocationRelativeTo(null); - w.setLayout(new BorderLayout()); - w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - - w.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent we) { - callMenu(); - w.dispose(); + filePath = fileChooser.getSelectedFile().getParent(); + fileOldPath = filePath; + filePath += "\\" + newName; + fileToEdit = new File(filePath); + Object[] options = {"Overwrite file", "Change name", "Go to menu"}; + if (fileToEdit.exists() && !fileToEdit.isDirectory()) { + int whenExists = JOptionPane.showOptionDialog(a, "It looks like a material with that exact name (" + newName + "), already exists.

    " + "Would you like whether to overwrite the selected file or change the name of the material?", + "Material already exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, img, options, "Change name"); + switch (whenExists) { + case 0: { + //Overwrite + File check = new File((fileToEdit.getParent() + "\\material_common_2.0.fxsub")); + if (!check.exists()) {//If materialcommon doesn't exist in the folder. + copyFile(new File("../../Materials/material_common_2.0.fxsub"), check); } - }); - ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); - w.setIconImage(imge.getImage()); - w.setVisible(true); - } catch (Exception e) { + FileWriter fw = new FileWriter(filePath); + fw.write(catchContent); + fw.close(); + try { + a.setVisible(false); + + WindowFrame w = new WindowFrame(); + w.setAlwaysOnTop(true); + w.setAlwaysOnTop(false); + w.setResizable(false); + w.setBounds(0, 0, 960, 549); + w.setLocationRelativeTo(null); + w.setLayout(new BorderLayout()); + w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + + w.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + callMenu(); + w.dispose(); + } + }); + ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); + w.setIconImage(imge.getImage()); + w.setVisible(true); + } catch (Exception e) { - } - } else if (whenExists == 1) {//Change Name - do { - newName = (String) JOptionPane.showInputDialog(a, "New material name (WITHOUT EXTENSION)", "Create material from Default", EXIT_ON_CLOSE, img, null, null); - Pattern pattern = Pattern.compile("\\p{Alnum}+"); - matcher = pattern.matcher(newName); - - filePath = fileOldPath + "\\" + newName + ".fx"; - fileToEdit = new File(filePath); - if (fileToEdit.exists()) { - newName = ".fx"; + } + break; } - } while (!matcher.matches() || (newName.contains(".fx") || (newName.equalsIgnoreCase("fx")))); + case 1: { + //Change Name + do { + newName = (String) JOptionPane.showInputDialog(a, "New material name (WITHOUT EXTENSION)", "Create material from Default", EXIT_ON_CLOSE, img, null, null); + Pattern pattern = Pattern.compile("\\p{Alnum}+"); + matcher = pattern.matcher(newName); + + filePath = fileOldPath + "\\" + newName + ".fx"; + fileToEdit = new File(filePath); + if (fileToEdit.exists()) { + newName = ".fx"; + } + } while (!matcher.matches() || (newName.contains(".fx") || (newName.equalsIgnoreCase("fx")))); + File check = new File((fileToEdit.getParent() + "\\material_common_2.0.fxsub")); + if (!check.exists()) {//If materialcommon doesn't exist in the folder. + copyFile(new File("../../Materials/material_common_2.0.fxsub"), check); + } + FileWriter fw = new FileWriter(filePath); + fw.write(catchContent); + fw.close(); + try { + a.setVisible(false); + WindowFrame w = new WindowFrame(); + w.setAlwaysOnTop(true); + w.setAlwaysOnTop(false); + w.setResizable(false); + w.setBounds(0, 0, 960, 549); + w.setLocationRelativeTo(null); + w.setLayout(new BorderLayout()); + w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + + w.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent we) { + callMenu(); + w.dispose(); + } + }); + ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); + w.setIconImage(imge.getImage()); + w.setVisible(true); + } catch (Exception e) { + } + break; + } + default: + break; + } + } else { + File check = new File((fileToEdit.getParent() + "\\material_common_2.0.fxsub")); + if (!check.exists()) {//If materialcommon doesn't exist in the folder. + copyFile(new File("../../Materials/material_common_2.0.fxsub"), check); + } FileWriter fw = new FileWriter(filePath); fw.write(catchContent); @@ -383,7 +437,6 @@ public void windowClosing(WindowEvent we) { w.setLocationRelativeTo(null); w.setLayout(new BorderLayout()); w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - w.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { callMenu(); @@ -396,42 +449,10 @@ public void windowClosing(WindowEvent we) { } catch (Exception e) { } - - } else { - - } - } else { - - FileWriter fw = new FileWriter(filePath); - - fw.write(catchContent); - fw.close(); - - try { - a.setVisible(false); - WindowFrame w = new WindowFrame(); - w.setAlwaysOnTop(true); - w.setAlwaysOnTop(false); - w.setResizable(false); - w.setBounds(0, 0, 960, 549); - w.setLocationRelativeTo(null); - w.setLayout(new BorderLayout()); - w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - w.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent we) { - callMenu(); - w.dispose(); - } - }); - ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); - w.setIconImage(imge.getImage()); - w.setVisible(true); - } catch (Exception e) { - } - } - } else { - + break; + default: + break; } } else { @@ -457,6 +478,23 @@ static boolean isImage(String image_path) { } } + private static void copyFile(File source, File dest) throws IOException { + InputStream is = null; + OutputStream os = null; + try { + is = new FileInputStream(source); + os = new FileOutputStream(dest); + byte[] buffer = new byte[1024]; + int length; + while ((length = is.read(buffer)) > 0) { + os.write(buffer, 0, length); + } + } finally { + is.close(); + os.close(); + } + } + public static void FromDefault(Component a) { try { @@ -492,74 +530,114 @@ public static void FromDefault(Component a) { + "Note that If you click 'No' the new material will be created at the /Materials folder.", "Destination Folder", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, img); - if (input == 0) { - - JFileChooser chooser; - String choosertitle = null; - - chooser = new JFileChooser(); - chooser.setCurrentDirectory(new java.io.File("../../Materials")); - chooser.setDialogTitle(choosertitle); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - - chooser.setAcceptAllFileFilterUsed(false); - - if (chooser.showOpenDialog(a) == JFileChooser.APPROVE_OPTION) { - - filePath = chooser.getSelectedFile().toString(); - fileOldPath = filePath; - filePath += "\\" + newName; - fileToEdit = new File(filePath); - - Object[] options = {"Overwrite file", "Change name", "Go to menu"}; - if (fileToEdit.exists() && !fileToEdit.isDirectory()) { - - int whenExists = JOptionPane.showOptionDialog(a, "It looks like a material with that exact name (" + newName + "), already exists.

    " + "Would you like whether to overwrite the selected file or change the name of the material?", - "Material already exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, img, options, "Change name"); - if (whenExists == 0) {//Overwrite - FileWriter fw = new FileWriter(filePath); - - fw.write(catchContent); - fw.close(); - - try { - a.setVisible(false); - - WindowFrame w = new WindowFrame(); - w.setAlwaysOnTop(true); - w.setAlwaysOnTop(false); - w.setResizable(false); - w.setBounds(0, 0, 960, 549); - w.setLocationRelativeTo(null); - w.setLayout(new BorderLayout()); - w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - - w.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent we) { - callMenu(); - w.dispose(); + switch (input) { + case 0: + JFileChooser chooser; + String choosertitle = null; + chooser = new JFileChooser(); + chooser.setCurrentDirectory(new java.io.File("../../Materials")); + chooser.setDialogTitle(choosertitle); + chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + chooser.setAcceptAllFileFilterUsed(false); + if (chooser.showOpenDialog(a) == JFileChooser.APPROVE_OPTION) { + filePath = chooser.getSelectedFile().toString(); + fileOldPath = filePath; + filePath += "\\" + newName; + fileToEdit = new File(filePath); + Object[] options = {"Overwrite file", "Change name", "Go to menu"}; + if (fileToEdit.exists() && !fileToEdit.isDirectory()) { + int whenExists = JOptionPane.showOptionDialog(a, "It looks like a material with that exact name (" + newName + "), already exists.

    " + "Would you like whether to overwrite the selected file or change the name of the material?", + "Material already exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, img, options, "Change name"); + switch (whenExists) { + case 0: { + //Overwrite + File check = new File((fileToEdit.getParent() + "\\material_common_2.0.fxsub")); + if (!check.exists()) {//If materialcommon doesn't exist in the folder. + copyFile(new File("../../Materials/material_common_2.0.fxsub"), check); } - }); - ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); - w.setIconImage(imge.getImage()); - w.setVisible(true); - } catch (Exception e) { + FileWriter fw = new FileWriter(filePath); + fw.write(catchContent); + fw.close(); + try { + a.setVisible(false); + + WindowFrame w = new WindowFrame(); + w.setAlwaysOnTop(true); + w.setAlwaysOnTop(false); + w.setResizable(false); + w.setBounds(0, 0, 960, 549); + w.setLocationRelativeTo(null); + w.setLayout(new BorderLayout()); + w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + + w.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + callMenu(); + w.dispose(); + } + }); + ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); + w.setIconImage(imge.getImage()); + w.setVisible(true); + } catch (Exception e) { - } - } else if (whenExists == 1) {//Change Name - do { - newName = (String) JOptionPane.showInputDialog(a, "New material name (WITHOUT EXTENSION)", "Create material from Default", EXIT_ON_CLOSE, img, null, null); - Pattern pattern = Pattern.compile("\\p{Alnum}+");//Only validates numbers and letters - matcher = pattern.matcher(newName); - - filePath = fileOldPath + "\\" + newName + ".fx"; - fileToEdit = new File(filePath); - if (fileToEdit.exists()) { - newName = ".fx"; + } + break; } - } while (!matcher.matches() || (newName.contains(".fx") || (newName.equalsIgnoreCase("fx")))); + case 1: { + //Change Name + do { + newName = (String) JOptionPane.showInputDialog(a, "New material name (WITHOUT EXTENSION)", "Create material from Default", EXIT_ON_CLOSE, img, null, null); + Pattern pattern = Pattern.compile("\\p{Alnum}+");//Only validates numbers and letters + matcher = pattern.matcher(newName); + + filePath = fileOldPath + "\\" + newName + ".fx"; + fileToEdit = new File(filePath); + if (fileToEdit.exists()) { + newName = ".fx"; + } + } while (!matcher.matches() || (newName.contains(".fx") || (newName.equalsIgnoreCase("fx")))); + File check = new File((fileToEdit.getParent() + "\\material_common_2.0.fxsub")); + if (!check.exists()) {//If materialcommon doesn't exist in the folder. + copyFile(new File("../../Materials/material_common_2.0.fxsub"), check); + } + FileWriter fw = new FileWriter(filePath); + fw.write(catchContent); + fw.close(); + try { + a.setVisible(false); + WindowFrame w = new WindowFrame(); + w.setAlwaysOnTop(true); + w.setAlwaysOnTop(false); + w.setResizable(false); + w.setBounds(0, 0, 960, 549); + w.setLocationRelativeTo(null); + w.setLayout(new BorderLayout()); + w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + + w.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent we) { + callMenu(); + w.dispose(); + } + }); + ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); + w.setIconImage(imge.getImage()); + w.setVisible(true); + } catch (Exception e) { + } + break; + } + default: + break; + } + } else { + File check = new File((fileToEdit.getParent() + "\\material_common_2.0.fxsub")); + if (!check.exists()) {//If materialcommon doesn't exist in the folder. + copyFile(new File("../../Materials/material_common_2.0.fxsub"), check); + } FileWriter fw = new FileWriter(filePath); fw.write(catchContent); @@ -588,105 +666,109 @@ public void windowClosing(WindowEvent we) { } catch (Exception e) { } - - } else { - } } else { - FileWriter fw = new FileWriter(filePath); - - fw.write(catchContent); - fw.close(); - - try { - a.setVisible(false); - WindowFrame w = new WindowFrame(); - w.setAlwaysOnTop(true); - w.setAlwaysOnTop(false); - w.setResizable(false); - w.setBounds(0, 0, 960, 549); - w.setLocationRelativeTo(null); - w.setLayout(new BorderLayout()); - w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - - w.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent we) { - callMenu(); - w.dispose(); - } - }); - ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); - w.setIconImage(imge.getImage()); - w.setVisible(true); - } catch (Exception e) { - - } } - } else { - - } + break; + case 1: + filePath = "../../Materials"; + filePath += "\\" + newName; + fileToEdit = new File(filePath); + Object[] options = {"Overwrite file", "Change name", "Go to menu"}; + if (fileToEdit.exists() && !fileToEdit.isDirectory()) { + int whenExists = JOptionPane.showOptionDialog(a, "It looks like a material with that exact name (" + newName + "), already exists.

    " + "Would you like whether to overwrite the selected file or change the name of the material?", + "Material already exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, img, options, "Change name"); + switch (whenExists) { + case 0: + //Overwrite - } else if (input == 1) { - filePath = "../../Materials"; - filePath += "\\" + newName; - fileToEdit = new File(filePath); + try { + File overwrite = fileToEdit; + FileWriter fw = new FileWriter(overwrite); + fw.write(catchContent); + fw.close(); - Object[] options = {"Overwrite file", "Change name", "Go to menu"}; + } catch (Exception e) { - if (fileToEdit.exists() && !fileToEdit.isDirectory()) { + } + try { - int whenExists = JOptionPane.showOptionDialog(a, "It looks like a material with that exact name (" + newName + "), already exists.

    " + "Would you like whether to overwrite the selected file or change the name of the material?", - "Material already exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, img, options, "Change name"); - if (whenExists == 0) {//Overwrite + WindowFrame wf = new WindowFrame(); - try { - File overwrite = fileToEdit; - FileWriter fw = new FileWriter(overwrite); - fw.write(catchContent); - fw.close(); + wf.setAlwaysOnTop(true); + wf.setAlwaysOnTop(false); + wf.setResizable(false); + wf.setBounds(0, 0, 960, 549); + wf.setLocationRelativeTo(null); + wf.setLayout(new BorderLayout()); + wf.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - } catch (Exception e) { + wf.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent we) { + callMenu(); + wf.dispose(); + } + }); + ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); + wf.setIconImage(imge.getImage()); + wf.setVisible(true); + } catch (Exception e) { - } - try { + } finally { + a.setVisible(false); + } + break; + case 1: + do { + newName = (String) JOptionPane.showInputDialog(a, "New material name (WITHOUT EXTENSION)", "Create material from Default", EXIT_ON_CLOSE, img, null, null); + Pattern pattern = Pattern.compile("\\p{Alnum}+");//Only validates numbers and letters + matcher = pattern.matcher(newName); - WindowFrame wf = new WindowFrame(); + filePath = "../../Materials" + "\\" + newName + ".fx"; + fileToEdit = new File(filePath); + if (fileToEdit.exists()) { + newName = "fuck you.fx"; + } + } while (!matcher.matches() || (newName.contains(".fx") || (newName.equalsIgnoreCase("fx")))); + File check = new File((fileToEdit.getParent() + "\\material_common_2.0.fxsub")); + if (!check.exists()) {//If materialcommon doesn't exist in the folder. + copyFile(new File("../../Materials/material_common_2.0.fxsub"), check); + } + FileWriter fw = new FileWriter(filePath); + fw.write(catchContent); + fw.close(); + try { + a.setVisible(false); + WindowFrame w = new WindowFrame(); + w.setAlwaysOnTop(true); + w.setAlwaysOnTop(false); + w.setResizable(false); + w.setBounds(0, 0, 960, 549); + w.setLocationRelativeTo(null); + w.setLayout(new BorderLayout()); + w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - wf.setAlwaysOnTop(true); - wf.setAlwaysOnTop(false); - wf.setResizable(false); - wf.setBounds(0, 0, 960, 549); - wf.setLocationRelativeTo(null); - wf.setLayout(new BorderLayout()); - wf.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + w.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent we) { + callMenu(); + w.dispose(); + } + }); + ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); + w.setIconImage(imge.getImage()); + w.setVisible(true); + } catch (Exception e) { - wf.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent we) { - callMenu(); - wf.dispose(); } - }); - ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); - wf.setIconImage(imge.getImage()); - wf.setVisible(true); - } catch (Exception e) { - - } finally { - a.setVisible(false); + break; + default: + break; + } + } else { + File check = new File((fileToEdit.getParent() + "\\material_common_2.0.fxsub")); + if (!check.exists()) {//If materialcommon doesn't exist in the folder. + copyFile(new File("../../Materials/material_common_2.0.fxsub"), check); } - } else if (whenExists == 1) { - do { - newName = (String) JOptionPane.showInputDialog(a, "New material name (WITHOUT EXTENSION)", "Create material from Default", EXIT_ON_CLOSE, img, null, null); - Pattern pattern = Pattern.compile("\\p{Alnum}+");//Only validates numbers and letters - matcher = pattern.matcher(newName); - - filePath = "../../Materials" + "\\" + newName + ".fx"; - fileToEdit = new File(filePath); - if (fileToEdit.exists()) { - newName = "fuck you.fx"; - } - } while (!matcher.matches() || (newName.contains(".fx") || (newName.equalsIgnoreCase("fx")))); - FileWriter fw = new FileWriter(filePath); fw.write(catchContent); @@ -704,6 +786,7 @@ public void windowClosing(WindowEvent we) { w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); w.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent we) { callMenu(); w.dispose(); @@ -715,42 +798,10 @@ public void windowClosing(WindowEvent we) { } catch (Exception e) { } - - } else { - } - } else { - FileWriter fw = new FileWriter(filePath); - - fw.write(catchContent); - fw.close(); - - try { - a.setVisible(false); - WindowFrame w = new WindowFrame(); - w.setAlwaysOnTop(true); - w.setAlwaysOnTop(false); - w.setResizable(false); - w.setBounds(0, 0, 960, 549); - w.setLocationRelativeTo(null); - w.setLayout(new BorderLayout()); - w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - - w.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent we) { - callMenu(); - w.dispose(); - } - }); - ImageIcon imge = new ImageIcon(MaterialMakerv2.class.getResource("/icon/ico.png")); - w.setIconImage(imge.getImage()); - w.setVisible(true); - } catch (Exception e) { - - } - } - } else { + break; + default: + break; } } else { diff --git a/src/mmd/ParallaxSection.form b/src/mmd/MetalnessSection.form similarity index 74% rename from src/mmd/ParallaxSection.form rename to src/mmd/MetalnessSection.form index 51e2b7c..3be7ef4 100644 --- a/src/mmd/ParallaxSection.form +++ b/src/mmd/MetalnessSection.form @@ -14,7 +14,7 @@ - + @@ -45,31 +45,40 @@ - - - - - - + + + + + - + + + + + + + + + + + - + - + @@ -77,9 +86,7 @@ - - - + @@ -88,6 +95,7 @@ + @@ -97,18 +105,9 @@ - - - - - - - - - - - - + + + @@ -124,36 +123,39 @@ - + - - - - - - - + - + - + + + + + + + - - + + + + + @@ -163,7 +165,7 @@ - + @@ -171,13 +173,13 @@ - + - + - - + + @@ -187,16 +189,17 @@ + - - + + - - + + @@ -204,17 +207,17 @@ - + - + - + @@ -228,17 +231,17 @@ - + - + - + - + @@ -247,20 +250,21 @@ - + - - + + + - + - + @@ -269,14 +273,15 @@ - + - - + + + @@ -328,67 +333,73 @@ - + - + + + + + + + + - + - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + - - - + + + - + - + - + - - - - - - - - - - - - - - + - + diff --git a/src/mmd/ParallaxSection.java b/src/mmd/MetalnessSection.java similarity index 66% rename from src/mmd/ParallaxSection.java rename to src/mmd/MetalnessSection.java index a40a141..9b35023 100644 --- a/src/mmd/ParallaxSection.java +++ b/src/mmd/MetalnessSection.java @@ -28,14 +28,16 @@ package mmd; import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; +import java.awt.Dialog; +import java.awt.Image; +import java.awt.Window; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.BufferedReader; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; @@ -46,6 +48,7 @@ import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; +import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; @@ -58,28 +61,73 @@ import javax.swing.filechooser.FileNameExtensionFilter; import static mmd.MaterialMakerv2.callMenu; -public class ParallaxSection extends javax.swing.JFrame { +public class MetalnessSection extends javax.swing.JFrame { public static MaterialMakerv2 foo = new MaterialMakerv2(); public static WindowFrame wf = new WindowFrame(); - String ParallaxLoop = String.valueOf(getParallaxMapLoop()); - String Parallax = getparallax(); + String MetalnessLoop = String.valueOf(getMetalnessMapLoop()); + String Metalness = getmetalness(); ///////////////////////////////////////////////////////////// - String lastParallaxLoop = String.valueOf(getParallaxMapLoop()); - String lastParallax = getparallax(); + String lastMetalnessLoop = String.valueOf(getMetalnessMapLoop()); + String lastMetalness = getmetalness(); /*AlbedoSection*/ - private static int CatchParallaxMapFrom; - private static int CatchParallaxMapType; - private static int CatchParallaxMapUVFlip; - private static int CatchParallaxMapSwizzle; + private static int CatchMetalnessMapFrom; + private static int CatchMetalnessMapType; + private static int CatchMetalnessMapUVFlip; + private static int CatchMetalnessMapSwizzle; + private static int CatchMetalnessMapApplyScale; + + private static String CatchMetalnessMapFile = null; + private static String Catchmetalness; + private static float CatchmetalnessMapLoop; + public int errors = 0; + JFrame ErrorWindow = new JFrame(); + + public void SomethingWentWrong() { + if (errors == 1) { + JLabel ErrorWindowText = new JLabel(); + //ErrorWindowText. + ErrorWindowText.setText("
    Something went wrong while trying to load Metalness Section...

    " + + "Please make sure the file you are trying to open doesn't exceed the limit for each parameter, usually this happens when you are trying to open " + + "a .fx file where some of it's parameters has higher values than supposed to be

    " + + "Limits:
    " + + "
      " + + "
    • MetalnessMapFrom: 0 - 9
    • " + + "
    • MetalnessMapUVFlip: 0 - 3
    • " + + "
    • MetalnessMapApplySwizzle: 0 - 3
    • " + + "
    • MetalnessMapApplyScale: 0 - 2
    • " + + "
      " + + "
    "); + ErrorWindow.setLayout(new BorderLayout()); + ErrorWindow.setSize(700, 350); + ErrorWindow.setLocationRelativeTo(this); + ErrorWindow.setResizable(true); + ErrorWindow.setAlwaysOnTop(true); + ErrorWindow.setVisible(true); + ErrorWindow.add(ErrorWindowText); + ErrorWindow.setName("help"); + ErrorWindow.setTitle("Something went wrong"); + ErrorWindow.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + ErrorWindow.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + ErrorWindow.dispose(); + } + }); - private static String CatchParallaxMapFile = null; - private static String Catchparallax; - private static float CatchparallaxMapLoop; + try { + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + ErrorWindow.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + } + } - public int getParallaxMapFrom() { + public int getMetalnessMapFrom() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -89,11 +137,11 @@ public int getParallaxMapFrom() { String s = ""; s = AlbedotoEdit_Br.readLine(); - + while (s != null) { - if (s.contains("#define PARALLAX_MAP_FROM")) { + if (s.contains("#define METALNESS_MAP_FROM")) { - CatchParallaxMapFrom = Integer.parseInt(s.replaceAll("[\\D]", "")); + CatchMetalnessMapFrom = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); @@ -110,10 +158,10 @@ public int getParallaxMapFrom() { Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); } } - return CatchParallaxMapFrom; + return CatchMetalnessMapFrom; } - public int getParallaxMapType() { + public int getMetalnessMapType() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -124,8 +172,8 @@ public int getParallaxMapType() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define PARALLAX_MAP_UV_FLIP")) { - CatchParallaxMapType = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define METALNESS_MAP_UV_FLIP")) { + CatchMetalnessMapType = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -140,10 +188,10 @@ public int getParallaxMapType() { } } - return CatchParallaxMapType; + return CatchMetalnessMapType; } - public int getParallaxMapUVFlip() { + public int getMetalnessMapUVFlip() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -154,8 +202,8 @@ public int getParallaxMapUVFlip() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define PARALLAX_MAP_UV_FLIP")) { - CatchParallaxMapUVFlip = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define METALNESS_MAP_UV_FLIP")) { + CatchMetalnessMapUVFlip = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -170,10 +218,42 @@ public int getParallaxMapUVFlip() { } } - return CatchParallaxMapUVFlip; + return CatchMetalnessMapUVFlip; + } + + public int getMetalnessMapSwizzle() { + BufferedReader AlbedotoEdit_Br = null; + try { + FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); + AlbedotoEdit_Br = new BufferedReader(AlbedotoEdit_fr); + + String s = ""; + + s = AlbedotoEdit_Br.readLine(); + + while (s != null) { + if (s.contains("#define METALNESS_MAP_SWIZZLE")) { + CatchMetalnessMapSwizzle = Integer.parseInt(s.replaceAll("[\\D]", "")); + + } + s = AlbedotoEdit_Br.readLine(); + } + + } catch (FileNotFoundException ex) { + Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); + } finally { + try { + AlbedotoEdit_Br.close(); + } catch (Exception e) { + + } + } + return CatchMetalnessMapSwizzle; } - public int getAlbedoMapSwizzle() { + public int getMetalnessMapApplyScale() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -184,8 +264,8 @@ public int getAlbedoMapSwizzle() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define PARALLAX_MAP_SWIZZLE")) { - CatchParallaxMapSwizzle = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define METALNESS_MAP_APPLY_SCALE")) { + CatchMetalnessMapApplyScale = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); @@ -202,10 +282,10 @@ public int getAlbedoMapSwizzle() { } } - return CatchParallaxMapSwizzle; + return CatchMetalnessMapApplyScale; } - public String getParallaxMapFile() { + public String getMetalnessMapFile() { BufferedReader AlbedotoEdit_Br = null; try { @@ -218,17 +298,17 @@ public String getParallaxMapFile() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define PARALLAX_MAP_FILE")) { - CatchParallaxMapFile = ""; + if (s.contains("#define METALNESS_MAP_FILE")) { + CatchMetalnessMapFile = ""; for (int i = s.indexOf('"') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';') { } else { - CatchParallaxMapFile += s.charAt(i); + CatchMetalnessMapFile += s.charAt(i); } } - CatchParallaxMapFile = CatchParallaxMapFile.replace("null", ""); + CatchMetalnessMapFile = CatchMetalnessMapFile.replace("null", ""); } s = AlbedotoEdit_Br.readLine(); @@ -245,10 +325,10 @@ public String getParallaxMapFile() { } } - return CatchParallaxMapFile; + return CatchMetalnessMapFile; } - public String getparallax() { + public String getmetalness() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -259,7 +339,7 @@ public String getparallax() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("parallaxMapScale =")) { + if (s.contains("metalness =")) { String txt = ""; for (int i = s.indexOf('=') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';' || s.charAt(i) == ' ') { @@ -268,7 +348,7 @@ public String getparallax() { txt += s.charAt(i); } } - Catchparallax = (txt); + Catchmetalness = (txt); } s = AlbedotoEdit_Br.readLine(); @@ -285,10 +365,10 @@ public String getparallax() { } } - return Catchparallax; + return Catchmetalness; } - public float getParallaxMapLoop() { + public float getMetalnessMapLoop() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -299,7 +379,7 @@ public float getParallaxMapLoop() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("parallaxMapLoopNum =")) { + if (s.contains("metalnessMapLoopNum =")) { String txt = ""; for (int i = s.indexOf('=') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';' || s.charAt(i) == ' ') { @@ -308,7 +388,7 @@ public float getParallaxMapLoop() { txt += s.charAt(i); } } - CatchparallaxMapLoop = Float.parseFloat(txt); + CatchmetalnessMapLoop = Float.parseFloat(txt); } s = AlbedotoEdit_Br.readLine(); } @@ -324,13 +404,13 @@ public float getParallaxMapLoop() { } } - return CatchparallaxMapLoop; + return CatchmetalnessMapLoop; } /** * Creates new form WindowFrame */ - public ParallaxSection() {//Constructor + public MetalnessSection() {//Constructor initComponents();//Generated by the GUI mostly myInitComponents(); @@ -348,9 +428,9 @@ public void myInitComponents() { public void stateChanged(ChangeEvent e) { try { text.setText(df.format(slider.getScaledValue())); - ParallaxLoop = text.getText(); - if (!slider.getValueIsAdjusting() && !ParallaxLoop.equalsIgnoreCase(lastParallaxLoop)) { - lastParallaxLoop = ParallaxLoop; + MetalnessLoop = text.getText(); + if (!slider.getValueIsAdjusting() && !MetalnessLoop.equalsIgnoreCase(lastMetalnessLoop)) { + lastMetalnessLoop = MetalnessLoop; BufferedReader br = null; try { br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -359,17 +439,17 @@ public void stateChanged(ChangeEvent e) { String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("parallaxMapLoopNum")) { + if (line.contains("metalnessMapLoopNum")) { catchOld = line; //auxiliar line String aux = ""; for (int i = catchOld.indexOf('=') + 1; i < catchOld.length() - 1; i++) { aux += catchOld.charAt(i); } catchOld = aux; - if (!catchOld.equalsIgnoreCase(ParallaxLoop)) { - ParallaxLoop = ParallaxLoop.replace(",", "."); - catchNew = ParallaxLoop; //catchnewdigit - line = "const float parallaxMapLoopNum = " + catchNew + ';'; + if (!catchOld.equalsIgnoreCase(MetalnessLoop)) { + MetalnessLoop = MetalnessLoop.replace(",", "."); + catchNew = MetalnessLoop; //catchnewdigit + line = "const float metalnessMapLoopNum = " + catchNew + ';'; } } @@ -401,17 +481,17 @@ public void keyReleased(KeyEvent ke) { } double value = Double.parseDouble(typed) * slider.scale; slider.setValue((int) value); - ParallaxLoop = text.getText(); + MetalnessLoop = text.getText(); } }); float catchvalue; - catchvalue = Float.parseFloat("" + getParallaxMapLoop()) * slider.scale; + catchvalue = Float.parseFloat("" + getMetalnessMapLoop()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); - slider.setBounds(277, 355, 200, 30); + slider.setBounds(274, 365, 200, 30); slider.setPaintTicks(true); slider.setValue((int) catchvalue); - text.setBounds(480, 355, 50, 20); + text.setBounds(477, 365, 50, 20); add(text); add(slider); @@ -422,15 +502,15 @@ public void myInitComponents2() { final DecimalFormat df = new DecimalFormat("0.####"); final JTextField text = new JTextField(20); - final DoubleJSlider slider = new DoubleJSlider(0, 10000, 0, 100); + final DoubleJSlider slider = new DoubleJSlider(0, 100, 0, 100); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { try { text.setText(df.format(slider.getScaledValue())); - Parallax = text.getText(); - if (!slider.getValueIsAdjusting() && !Parallax.equalsIgnoreCase(lastParallax)) { - lastParallax = Parallax; + Metalness = text.getText(); + if (!slider.getValueIsAdjusting() && !Metalness.equalsIgnoreCase(lastMetalness)) { + lastMetalness = Metalness; BufferedReader br = null; try { br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -439,17 +519,17 @@ public void stateChanged(ChangeEvent e) { String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("parallaxMapScale")) { + if (line.contains(" metalness =")) { catchOld = line; //auxiliar line String aux = ""; for (int i = catchOld.indexOf('=') + 1; i < catchOld.length() - 1; i++) { aux += catchOld.charAt(i); } catchOld = aux; - if (!catchOld.equalsIgnoreCase(Parallax)) { - Parallax = Parallax.replace(",", "."); - catchNew = Parallax; //catchnewdigit - line = "const float parallaxMapScale = " + catchNew + ';'; + if (!catchOld.equalsIgnoreCase(Metalness)) { + Metalness = Metalness.replace(",", "."); + catchNew = Metalness; //catchnewdigit + line = "const float metalness = " + catchNew + ';'; } } oldtext += line + "\r\n"; @@ -481,17 +561,17 @@ public void keyReleased(KeyEvent ke) { } double value = Double.parseDouble(typed) * slider.scale; slider.setValue((int) value); - Parallax = text.getText(); + Metalness = text.getText(); } }); float catchvalue; - catchvalue = Float.parseFloat("" + getparallax()) * slider.scale; + catchvalue = Float.parseFloat("" + getmetalness()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); - slider.setBounds(277, 297, 200, 30); + slider.setBounds(274, 303, 200, 30); slider.setPaintTicks(true); slider.setValue((int) catchvalue); - text.setBounds(480,297, 50, 20); + text.setBounds(477, 303, 50, 20); add(text); add(slider); @@ -522,56 +602,62 @@ private void initComponents() { jMenu1 = new javax.swing.JMenu(); jLabel1 = new javax.swing.JLabel(); - ParallaxMapFrom = new javax.swing.JComboBox<>(); + MetalnessMapFrom = new javax.swing.JComboBox<>(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); changeFile = new javax.swing.JButton(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); - ParallaxMapUVFlip = new javax.swing.JComboBox<>(); - ParallaxMapSwizzle = new javax.swing.JComboBox<>(); + MetalnessMapUVFlip = new javax.swing.JComboBox<>(); + MetalnessMapSwizzle = new javax.swing.JComboBox<>(); AlbedoMapHelp = new javax.swing.JButton(); AlbedoMapUVFlipHelp = new javax.swing.JButton(); AlbedoMapApplyScaleHelp = new javax.swing.JButton(); AlbedoMapFileHelp = new javax.swing.JButton(); albedoHelp = new javax.swing.JButton(); AlbedoMapLoopHelp = new javax.swing.JButton(); - jLabel4 = new javax.swing.JLabel(); - ParallaxMapType = new javax.swing.JComboBox<>(); - AlbedoMapHelp1 = new javax.swing.JButton(); - ParallaxMapFile = new javax.swing.JTextField(); + MetalnessMapFile = new javax.swing.JTextField(); back1 = new javax.swing.JButton(); + jLabel5 = new javax.swing.JLabel(); + MetalnessMapApplyScale = new javax.swing.JComboBox<>(); + AlbedoMapFileHelp1 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); jMenu1.setText("jMenu1"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setTitle("Edit Parallax"); + setTitle("Edit Metalness"); setAutoRequestFocus(false); setResizable(false); setSize(new java.awt.Dimension(960, 540)); - jLabel1.setText("PARALLAX MAP FROM"); + jLabel1.setText("METALNESS MAP FROM"); - ParallaxMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8" })); - ParallaxMapFrom.setSelectedIndex(getParallaxMapFrom()); - ParallaxMapFrom.setToolTipText(""); - ParallaxMapFrom.addItemListener(new java.awt.event.ItemListener() { + MetalnessMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" })); + try{ + MetalnessMapFrom.setSelectedIndex(getMetalnessMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + MetalnessMapFrom.setToolTipText(""); + MetalnessMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - ParallaxMapFromItemStateChanged(evt); + MetalnessMapFromItemStateChanged(evt); } }); - ParallaxMapFrom.addActionListener(new java.awt.event.ActionListener() { + MetalnessMapFrom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - ParallaxMapFromActionPerformed(evt); + MetalnessMapFromActionPerformed(evt); } }); - jLabel2.setText("PARALLAX MAP UV FLIP"); + jLabel2.setText("METALNESS MAP UV FLIP"); - jLabel3.setText("PARALLAX MAP APPLY SWIZZLE"); + jLabel3.setText("METALNESS MAP SWIZZLE"); - jLabel6.setText("PARALLAX MAP FILE"); + jLabel6.setText("METALNESS MAP FILE"); changeFile.setText("..."); changeFile.addChangeListener(new javax.swing.event.ChangeListener() { @@ -585,33 +671,43 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel8.setText("PARALLAX"); + jLabel8.setText("METALNESS"); - jLabel9.setText("PARALLAX MAP LOOP"); + jLabel9.setText("METALNESS MAP LOOP"); - ParallaxMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - ParallaxMapUVFlip.setSelectedIndex(getParallaxMapUVFlip()); - ParallaxMapUVFlip.addItemListener(new java.awt.event.ItemListener() { + MetalnessMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); + try{ + MetalnessMapUVFlip.setSelectedIndex(getMetalnessMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + MetalnessMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - ParallaxMapUVFlipItemStateChanged(evt); + MetalnessMapUVFlipItemStateChanged(evt); } }); - ParallaxMapUVFlip.addActionListener(new java.awt.event.ActionListener() { + MetalnessMapUVFlip.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - ParallaxMapUVFlipActionPerformed(evt); + MetalnessMapUVFlipActionPerformed(evt); } }); - ParallaxMapSwizzle.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - ParallaxMapSwizzle.setSelectedIndex(getAlbedoMapSwizzle()); - ParallaxMapSwizzle.addItemListener(new java.awt.event.ItemListener() { + MetalnessMapSwizzle.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); + try{ + MetalnessMapSwizzle.setSelectedIndex(getMetalnessMapSwizzle()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + MetalnessMapSwizzle.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - ParallaxMapSwizzleItemStateChanged(evt); + MetalnessMapSwizzleItemStateChanged(evt); } }); - ParallaxMapSwizzle.addActionListener(new java.awt.event.ActionListener() { + MetalnessMapSwizzle.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - ParallaxMapSwizzleActionPerformed(evt); + MetalnessMapSwizzleActionPerformed(evt); } }); @@ -657,37 +753,54 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel4.setText("PARALLAX MAP TYPE"); + try{ + MetalnessMapFile.setEditable(false); + MetalnessMapFile.setText(getMetalnessMapFile()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } - ParallaxMapType.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" })); - ParallaxMapType.setSelectedIndex(getParallaxMapType()); - ParallaxMapType.setToolTipText(""); - ParallaxMapType.addItemListener(new java.awt.event.ItemListener() { + back1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bg/back.png"))); // NOI18N + back1.setBorder(null); + back1.setContentAreaFilled(false); + back1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + back1ActionPerformed(evt); + } + }); + + jLabel5.setText("METALNESS MAP APPLY SCALE"); + + MetalnessMapApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); + try{ + MetalnessMapApplyScale.setSelectedIndex(getMetalnessMapApplyScale()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + MetalnessMapApplyScale.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - ParallaxMapTypeItemStateChanged(evt); + MetalnessMapApplyScaleItemStateChanged(evt); } }); - ParallaxMapType.addActionListener(new java.awt.event.ActionListener() { + MetalnessMapApplyScale.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - ParallaxMapTypeActionPerformed(evt); + MetalnessMapApplyScaleActionPerformed(evt); } }); - AlbedoMapHelp1.setText("Help"); - AlbedoMapHelp1.addActionListener(new java.awt.event.ActionListener() { + AlbedoMapFileHelp1.setText("Help"); + AlbedoMapFileHelp1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - AlbedoMapHelp1ActionPerformed(evt); + AlbedoMapFileHelp1ActionPerformed(evt); } }); - ParallaxMapFile.setText(getParallaxMapFile()); - - back1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bg/back.png"))); // NOI18N - back1.setBorder(null); - back1.setContentAreaFilled(false); - back1.addActionListener(new java.awt.event.ActionListener() { + jButton3.setText("Preview"); + jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - back1ActionPerformed(evt); + jButton3ActionPerformed(evt); } }); @@ -700,54 +813,54 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(AlbedoMapLoopHelp)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(albedoHelp) - .addGap(236, 236, 236))) + .addGap(236, 236, 236)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(AlbedoMapLoopHelp))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(MetalnessMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton3)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(MetalnessMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(ParallaxMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(MetalnessMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(128, 128, 128) - .addComponent(ParallaxMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(MetalnessMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(changeFile, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(ParallaxMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(AlbedoMapUVFlipHelp) .addComponent(AlbedoMapApplyScaleHelp) - .addComponent(AlbedoMapFileHelp))) + .addComponent(AlbedoMapFileHelp) + .addComponent(AlbedoMapFileHelp1))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(54, 54, 54) .addComponent(back1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(543, 543, 543) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(ParallaxMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(AlbedoMapHelp)) - .addGroup(layout.createSequentialGroup() - .addComponent(ParallaxMapType, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(AlbedoMapHelp1)))))) + .addComponent(MetalnessMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(AlbedoMapHelp)))) .addContainerGap(268, Short.MAX_VALUE)) ); layout.setVerticalGroup( @@ -758,31 +871,33 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGap(39, 39, 39) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(ParallaxMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(MetalnessMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapHelp)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(ParallaxMapType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapHelp1)) - .addGap(1, 1, 1) + .addGap(6, 6, 6) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(ParallaxMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(MetalnessMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapUVFlipHelp)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(ParallaxMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(MetalnessMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapApplyScaleHelp)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(MetalnessMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapFileHelp1)) + .addGap(6, 6, 6) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(changeFile) .addComponent(AlbedoMapFileHelp)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ParallaxMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(MetalnessMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton3)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(albedoHelp)) @@ -790,30 +905,30 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapLoopHelp)) - .addContainerGap(130, Short.MAX_VALUE)) + .addContainerGap(125, Short.MAX_VALUE)) ); pack(); }// //GEN-END:initComponents - private void ParallaxMapFromActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ParallaxMapFromActionPerformed + private void MetalnessMapFromActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MetalnessMapFromActionPerformed - }//GEN-LAST:event_ParallaxMapFromActionPerformed + }//GEN-LAST:event_MetalnessMapFromActionPerformed - private void ParallaxMapUVFlipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ParallaxMapUVFlipActionPerformed + private void MetalnessMapUVFlipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MetalnessMapUVFlipActionPerformed - }//GEN-LAST:event_ParallaxMapUVFlipActionPerformed + }//GEN-LAST:event_MetalnessMapUVFlipActionPerformed - private void ParallaxMapSwizzleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ParallaxMapSwizzleActionPerformed + private void MetalnessMapSwizzleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MetalnessMapSwizzleActionPerformed - }//GEN-LAST:event_ParallaxMapSwizzleActionPerformed + }//GEN-LAST:event_MetalnessMapSwizzleActionPerformed private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeFileActionPerformed JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new java.io.File("../../Materials"));//The directory we are looking for is the Materials folder from ray - fileChooser.setDialogTitle("Choose new Parallax Map File"); + fileChooser.setDialogTitle("Choose new Metalness Map File"); //Filtering by ImageFiles FileFilter imageFilter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "bmp", "tga", "targa", "dds", "tif", "tiff", "jpeg", "pcd"); fileChooser.setFileFilter(imageFilter); @@ -825,9 +940,9 @@ private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI if (selection == 0) { String relative = toRelative.convertToRelativePath(foo.getFileToEdit().getParent(), filePath); - ParallaxMapFile.setText(relative); - if (ParallaxMapFrom.getSelectedIndex() != 1) { - ParallaxMapFrom.setSelectedIndex(1); + MetalnessMapFile.setText(relative); + if (MetalnessMapFrom.getSelectedIndex() != 1) { + MetalnessMapFrom.setSelectedIndex(1); } BufferedReader br = null; @@ -838,16 +953,16 @@ private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define PARALLAX_MAP_FILE")) { + if (line.contains("#define METALNESS_MAP_FILE")) { catchOld = line; //auxiliar line String aux = ""; for (int i = catchOld.indexOf('"') + 1; i < line.length() - 1; i++) { aux += catchOld.charAt(i); } catchOld = aux; - if (!catchOld.equalsIgnoreCase(ParallaxMapFile.getText())) { - catchNew = ParallaxMapFile.getText(); //catchnewdigit - line = "#define PARALLAX_MAP_FILE " + '"' + catchNew + '"'; + if (!catchOld.equalsIgnoreCase(MetalnessMapFile.getText())) { + catchNew = MetalnessMapFile.getText(); //catchnewdigit + line = "#define METALNESS_MAP_FILE " + '"' + catchNew + '"'; } } oldtext += line + "\r\n"; @@ -874,11 +989,9 @@ private void changeFileStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI }//GEN-LAST:event_changeFileStateChanged private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); - + AlbedoMapHelp.setName("help"); AlbedoMapHelpText.setText("
    You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

    " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
    " + "Tips 2 : Do not enter a path with HDR file, that will be ignore the HDR and linear color-space
    " @@ -893,14 +1006,14 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN + "
  • 6 : Params fetch from avi/screen from the DummyScreen.x inside extension folder.

  • " + "
  • 7 : Params fetch from Ambient Color from the pmx.

  • " + "
  • 8 : Params fetch from Specular Color from the pmx.

  • " - + "
  • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular), doesn't work on Parallax


  • "); + + "
  • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular)


  • "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); - AlbedoMapHelp.setTitle("Parallax Map From Help"); + AlbedoMapHelp.setTitle("Metalness Map From Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -913,21 +1026,20 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); - help.setTitle("Parallax Map UV Flip Help"); + help.setTitle("Metalness Map UV Flip Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -940,18 +1052,17 @@ private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) private void AlbedoMapApplyScaleHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapApplyScaleHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("The ordering of the data fetched from a texture from the code. (R = 0, G = 1, B = 2, A = 3)"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); - help.setTitle("Parallax Map Apply Swizzle Help"); + help.setTitle("Metalness Map Apply Swizzle Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -964,10 +1075,9 @@ private void AlbedoMapApplyScaleHelpActionPerformed(java.awt.event.ActionEvent e private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " + "For example :
    " @@ -980,13 +1090,13 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Parallax Map File Help"); + help.setTitle("Metalness Map File Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -999,19 +1109,19 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - - helptext.setText("between 0 ~ inf"); + help.setName("help"); + helptext.setText("between 0 ~ 1"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 350); + help.setSize(300, 70); + help.setLocationRelativeTo(this); + help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Parallax Map Scale Help"); + help.setTitle("Metalness Map Scale Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1023,23 +1133,22 @@ private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI }//GEN-LAST:event_albedoHelpActionPerformed private void AlbedoMapLoopHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); - helptext.setText("Why increase number of parallaxMapLoopNum will increase the loops/tile/number of albedo, normals, etc
    " - + "Bacause parallax coordinates can be calculated from height map
    " + helptext.setText("Why increase number of metalnessMapLoopNum will increase the loops/tile/number of albedo, normals, etc
    " + + "Bacause metalness coordinates can be calculated from height map
    " + "That are then used to access textures with albedo, normals, smoothness, metalness, etc
    " - + "In other words like fetched data (albedo, normals, etc) from parallax coordinates * parallaxMapLoopNum * albedo/normal/MapLoopNum
    "); + + "In other words like fetched data (albedo, normals, etc) from metalness coordinates * metalnessMapLoopNum * albedo/normal/MapLoopNum
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(650, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Parallax Map Loop Help"); + help.setTitle("Metalness Map Loop Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1049,41 +1158,20 @@ private void AlbedoMapLoopHelpActionPerformed(java.awt.event.ActionEvent evt) {/ System.out.println("" + ex); } }//GEN-LAST:event_AlbedoMapLoopHelpActionPerformed + private void closeAllDialogs() { + Window[] windows = AlbedoSection.getWindows(); - private void ParallaxMapTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ParallaxMapTypeActionPerformed - - }//GEN-LAST:event_ParallaxMapTypeActionPerformed - - private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); - JFrame help = new JFrame(); - JLabel helptext = new JLabel(); - - helptext.setText("
    • 0 : calculate without transparency
    • " - + "
    • 1 : calculate parallax occlusion with transparency and best SSDO
    "); - help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 200); - help.setResizable(true); - helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); - help.setVisible(true); - help.add(helptext); - help.setTitle("Parallax Map Type Help"); - - try { - InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); - BufferedImage myImg = ImageIO.read(imgStream); - help.setIconImage(myImg); - } catch (IOException ex) { - System.out.println("" + ex); + for (Window window : windows) { + if (window.getName().equalsIgnoreCase("help")) { + window.dispose(); + } } - }//GEN-LAST:event_AlbedoMapHelp1ActionPerformed - + } private void back1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back1ActionPerformed - + closeAllDialogs(); WindowFrame w = new WindowFrame(); w.setLocation(this.getLocation()); + ErrorWindow.dispose(); this.dispose(); w.setSize(960, 549); w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); @@ -1102,7 +1190,7 @@ public void windowClosing(WindowEvent we) { w.setVisible(true); }//GEN-LAST:event_back1ActionPerformed - private void ParallaxMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ParallaxMapFromItemStateChanged + private void MetalnessMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_MetalnessMapFromItemStateChanged // TODO add your handling code here: BufferedReader br = null; @@ -1113,10 +1201,10 @@ private void ParallaxMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GE String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define PARALLAX_MAP_FROM")) { + if (line.contains("#define METALNESS_MAP_FROM")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = ParallaxMapFrom.getSelectedItem().toString(); //catchnewdigit + catchNew = MetalnessMapFrom.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -1138,9 +1226,10 @@ private void ParallaxMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GE } } - }//GEN-LAST:event_ParallaxMapFromItemStateChanged + }//GEN-LAST:event_MetalnessMapFromItemStateChanged - private void ParallaxMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ParallaxMapTypeItemStateChanged + private void MetalnessMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_MetalnessMapUVFlipItemStateChanged + // TODO add your handling code here: BufferedReader br = null; try { @@ -1150,10 +1239,10 @@ private void ParallaxMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GE String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define PARALLAX_MAP_TYPE")) { + if (line.contains("#define METALNESS_MAP_UV_FLIP")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = ParallaxMapType.getSelectedItem().toString(); //catchnewdigit + catchNew = MetalnessMapUVFlip.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -1170,9 +1259,9 @@ private void ParallaxMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GE } catch (Exception ex) { } - }//GEN-LAST:event_ParallaxMapTypeItemStateChanged + }//GEN-LAST:event_MetalnessMapUVFlipItemStateChanged - private void ParallaxMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ParallaxMapUVFlipItemStateChanged + private void MetalnessMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_MetalnessMapSwizzleItemStateChanged // TODO add your handling code here: BufferedReader br = null; @@ -1183,12 +1272,11 @@ private void ParallaxMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {// String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define PARALLAX_MAP_UV_FLIP")) { + if (line.contains("#define METALNESS_MAP_SWIZZLE")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = ParallaxMapUVFlip.getSelectedItem().toString(); //catchnewdigit - line = line.replaceAll(catchOld, catchNew); //replace old for the new one - + catchNew = MetalnessMapSwizzle.getSelectedItem().toString(); //catchnewdigit + line = line.replaceAll("" + catchOld, "" + catchNew); //replace old for the new one } oldtext += line + "\r\n"; @@ -1203,9 +1291,9 @@ private void ParallaxMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {// } catch (Exception ex) { } - }//GEN-LAST:event_ParallaxMapUVFlipItemStateChanged + }//GEN-LAST:event_MetalnessMapSwizzleItemStateChanged - private void ParallaxMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ParallaxMapSwizzleItemStateChanged + private void MetalnessMapApplyScaleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_MetalnessMapApplyScaleItemStateChanged // TODO add your handling code here: BufferedReader br = null; @@ -1216,10 +1304,10 @@ private void ParallaxMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {/ String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define PARALLAX_MAP_SWIZZLE")) { + if (line.contains("#define METALNESS_MAP_APPLY_SCALE")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = ParallaxMapSwizzle.getSelectedItem().toString(); //catchnewdigit + catchNew = MetalnessMapApplyScale.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll("" + catchOld, "" + catchNew); //replace old for the new one } oldtext += line + "\r\n"; @@ -1235,7 +1323,107 @@ private void ParallaxMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {/ } catch (Exception ex) { } - }//GEN-LAST:event_ParallaxMapSwizzleItemStateChanged + }//GEN-LAST:event_MetalnessMapApplyScaleItemStateChanged + + private void MetalnessMapApplyScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MetalnessMapApplyScaleActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_MetalnessMapApplyScaleActionPerformed + + private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelp1ActionPerformed + + JFrame help = new JFrame(); + JLabel helptext = new JLabel(); + help.setName("help"); + helptext.setText("
    You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE


    " + + "
    • 1 : map values * albedo;
    • " + + "
    • 2 : map values ^ albedo;
    • " + + "
    "); + help.setLayout(new BorderLayout()); + help.setSize(500, 160); + help.setLocationRelativeTo(this); + help.setResizable(true); + help.setVisible(true); + help.add(helptext); + help.setTitle("Metalness Map Apply Scale Help"); + + try { + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + help.setIconImage(myImg); + } catch (IOException ex) { + System.out.println("" + ex); + } + }//GEN-LAST:event_AlbedoMapFileHelp1ActionPerformed + public void previewImg(String path) { + File f = new File(path); + File a = new File(foo.getFilePath()); + File parentFolder = new File(a.getParent()); + File b = new File(parentFolder, path); + String absolute = ""; + try { + absolute = b.getCanonicalPath(); + f = new File(absolute); + } catch (Exception e) { + + } + if (f.exists()) { + JDialog jf = new JDialog(); + JLabel jl = new JLabel(); + jf.setName("help"); + jf.setTitle("Map Preview"); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jf.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + BufferedImage img = null; + try {//Map + img = ImageIO.read(new File(absolute)); + } catch (IOException e) { + e.printStackTrace(); + } + jf.setSize(600, 600); + jf.setResizable(false); + jf.setModal(true); + jf.setLocationRelativeTo(this); + jf.setAlwaysOnTop(true); + jf.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + Image dimg = img.getScaledInstance(jf.getWidth(), jf.getHeight(), + Image.SCALE_SMOOTH); + ImageIcon ii = new ImageIcon(dimg); + jl.setIcon(ii); + jf.add(jl); + jf.setVisible(true); + } else { + JDialog jd = new JDialog(); + JLabel jl = new JLabel(); + jl.setText("
    The Map file you are trying to preview doesn't exist.
    "); + jd.setName("help"); + jd.setTitle("No such Map File"); + jd.setSize(300, 100); + jd.setModal(true); + jd.setResizable(false); + jd.setLocationRelativeTo(this); + jd.setAlwaysOnTop(true); + jd.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jd.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + jd.add(jl); + jd.setVisible(true); + + } + } + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + // TODO add your handling code here: + previewImg(MetalnessMapFile.getText()); + }//GEN-LAST:event_jButton3ActionPerformed /** * @param args the command line arguments @@ -1278,22 +1466,23 @@ public void run() { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton AlbedoMapApplyScaleHelp; private javax.swing.JButton AlbedoMapFileHelp; + private javax.swing.JButton AlbedoMapFileHelp1; private javax.swing.JButton AlbedoMapHelp; - private javax.swing.JButton AlbedoMapHelp1; private javax.swing.JButton AlbedoMapLoopHelp; private javax.swing.JButton AlbedoMapUVFlipHelp; - private javax.swing.JTextField ParallaxMapFile; - private javax.swing.JComboBox ParallaxMapFrom; - private javax.swing.JComboBox ParallaxMapSwizzle; - private javax.swing.JComboBox ParallaxMapType; - private javax.swing.JComboBox ParallaxMapUVFlip; + private javax.swing.JComboBox MetalnessMapApplyScale; + private javax.swing.JTextField MetalnessMapFile; + private javax.swing.JComboBox MetalnessMapFrom; + private javax.swing.JComboBox MetalnessMapSwizzle; + private javax.swing.JComboBox MetalnessMapUVFlip; private javax.swing.JButton albedoHelp; private javax.swing.JButton back1; private javax.swing.JButton changeFile; + private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; diff --git a/src/mmd/NormalSection.form b/src/mmd/NormalSection.form index c9aadbc..78c1bdf 100644 --- a/src/mmd/NormalSection.form +++ b/src/mmd/NormalSection.form @@ -91,7 +91,11 @@ - + + + + + @@ -138,7 +142,11 @@ - + + + + + @@ -187,8 +195,11 @@ - - + + + + + @@ -228,15 +239,18 @@ - - + + + + + - + @@ -249,7 +263,7 @@ - + @@ -260,7 +274,7 @@ - + @@ -304,7 +318,7 @@ - + @@ -321,6 +335,7 @@ + @@ -371,7 +386,7 @@ - + @@ -379,7 +394,7 @@ - + @@ -407,7 +422,7 @@ - + @@ -418,7 +433,7 @@ - + @@ -467,7 +482,7 @@ - + @@ -481,7 +496,7 @@ - + @@ -489,7 +504,7 @@ - + @@ -514,7 +529,7 @@ - + @@ -531,6 +546,7 @@ + @@ -560,17 +576,27 @@ + + + + + + + + + + @@ -602,5 +628,21 @@ + + + + + + + + + + + + + + + + diff --git a/src/mmd/NormalSection.java b/src/mmd/NormalSection.java index a6441a7..63089b7 100644 --- a/src/mmd/NormalSection.java +++ b/src/mmd/NormalSection.java @@ -28,14 +28,16 @@ package mmd; import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; +import java.awt.Dialog; +import java.awt.Image; +import java.awt.Window; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.BufferedReader; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; @@ -46,6 +48,7 @@ import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; +import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; @@ -88,6 +91,49 @@ public class NormalSection extends javax.swing.JFrame { private static String CatchNormalSubMapFile = null; private static String CatchNormalSubScale; private static float CatchNormalSubLoop; + public int errors = 0; + JFrame ErrorWindow = new JFrame(); + + public void SomethingWentWrong() { + if (errors == 1) { + + JLabel ErrorWindowText = new JLabel(); + //ErrorWindowText. + ErrorWindowText.setText("
    Something went wrong while trying to load Normal Section...

    " + + "Please make sure the file you are trying to open doesn't exceed the limit for each parameter, usually this happens when you are trying to open " + + "a .fx file where some of it's parameters has higher values than supposed to be

    " + + "Limits:
    " + + "
    • NormalMapFrom: 0 - 8
    • " + + "
    • NormalMapType: 0 - 3
    • " + + "
    • NormalMapUVFlip: 0 - 3
    • " + + "
      " + + "
    Same for NormalSub
    "); + ErrorWindow.setLayout(new BorderLayout()); + ErrorWindow.setSize(700, 350); + ErrorWindow.setLocationRelativeTo(this); + ErrorWindow.setResizable(true); + ErrorWindow.setAlwaysOnTop(true); + ErrorWindow.setVisible(true); + ErrorWindow.add(ErrorWindowText); + ErrorWindow.setName("help"); + ErrorWindow.setTitle("Something went wrong"); + ErrorWindow.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + ErrorWindow.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + ErrorWindow.dispose(); + } + }); + + try { + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + ErrorWindow.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + } + } public int getNormalMapFrom() { BufferedReader AlbedotoEdit_Br = null; @@ -906,6 +952,8 @@ private void initComponents() { NormalSubMapFile = new javax.swing.JTextField(); back1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); jMenu1.setText("jMenu1"); @@ -918,7 +966,12 @@ private void initComponents() { jLabel1.setText("NORMAL MAP FROM"); NormalMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6" })); - NormalMapFrom.setSelectedIndex(getNormalMapFrom()); + try{ + NormalMapFrom.setSelectedIndex(getNormalMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } NormalMapFrom.setToolTipText(""); NormalMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -952,7 +1005,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel9.setText("NORMAL MAP LOOP"); NormalMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - NormalMapUVFlip.setSelectedIndex(getNormalMapUVFlip()); + try{ + NormalMapUVFlip.setSelectedIndex(getNormalMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } NormalMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { NormalMapUVFlipItemStateChanged(evt); @@ -1002,7 +1060,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel3.setText("NORMAL MAP TYPE"); NormalMapType.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - NormalMapType.setSelectedIndex(getNormalMapType()); + try{ + NormalMapType.setSelectedIndex(getNormalMapType()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } NormalMapType.setToolTipText(""); NormalMapType.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -1025,7 +1088,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel4.setText("NORMAL SUB MAP FROM "); NormalSubMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6" })); - NormalSubMapFrom.setSelectedIndex(getNormalSubMapFrom()); + try{ + NormalSubMapFrom.setSelectedIndex(getNormalSubMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } NormalSubMapFrom.setToolTipText(""); NormalSubMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -1063,7 +1131,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel7.setText("NORMAL SUB MAP TYPE"); - jLabel10.setText("NORMALSUB MAP FILE"); + jLabel10.setText("NORMAL SUB MAP FILE"); changeFile1.setText("..."); changeFile1.addChangeListener(new javax.swing.event.ChangeListener() { @@ -1078,7 +1146,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); NormalSubMapType.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - NormalSubMapType.setSelectedIndex(getNormalSubMapType()); + try{ + NormalSubMapType.setSelectedIndex(getNormalSubMapType()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } NormalSubMapType.setToolTipText(""); NormalSubMapType.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -1096,7 +1169,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel12.setText("NORMAL SUB MAP LOOP"); NormalSubMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - NormalSubMapUVFlip.setSelectedIndex(getNormalSubMapUVFlip()); + try{ + NormalSubMapUVFlip.setSelectedIndex(getNormalSubMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } NormalSubMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { NormalSubMapUVFlipItemStateChanged(evt); @@ -1129,9 +1207,21 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - NormalMapFile.setText(getNormalMapFile()); + try{ + NormalMapFile.setEditable(false); + NormalMapFile.setText(getNormalMapFile()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } - NormalSubMapFile.setText(getNormalSubMapFile()); + try{ + NormalSubMapFile.setEditable(false); + NormalSubMapFile.setText(getNormalSubMapFile()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } back1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bg/back.png"))); // NOI18N back1.setBorder(null); @@ -1153,6 +1243,20 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); + jButton3.setText("Preview"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + jButton4.setText("Preview"); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -1196,7 +1300,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(AlbedoMapUVFlipHelp) .addComponent(AlbedoMapFileHelp) .addComponent(AlbedoMapHelp3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - .addComponent(NormalMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(NormalMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton3))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 53, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() @@ -1231,7 +1338,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(AlbedoMapUVFlipHelp1) .addComponent(AlbedoMapFileHelp1) .addComponent(AlbedoMapHelp2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - .addComponent(NormalSubMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(NormalSubMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton4))) .addGap(54, 54, 54)) .addGroup(layout.createSequentialGroup() .addComponent(back1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1269,8 +1379,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(changeFile) .addComponent(AlbedoMapFileHelp)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(NormalMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(37, 37, 37) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(NormalMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton3)) + .addGap(33, 33, 33) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(albedoHelp)) @@ -1302,12 +1414,14 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(changeFile1) .addComponent(AlbedoMapFileHelp1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(NormalSubMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(37, 37, 37) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(NormalSubMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton4)) + .addGap(33, 33, 33) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(albedoHelp1)))) - .addContainerGap(154, Short.MAX_VALUE)) + .addContainerGap(150, Short.MAX_VALUE)) ); pack(); @@ -1386,11 +1500,9 @@ private void changeFileStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI }//GEN-LAST:event_changeFileStateChanged private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); - + AlbedoMapHelp.setName("help"); AlbedoMapHelpText.setText("
    You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

    " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
    " + "Tips 2 : Do not enter a path with HDR file, that will be ignore the HDR and linear color-space
    " @@ -1407,8 +1519,8 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN + "
  • 8 : Params fetch from Specular Color from the pmx. , doesn't work on NormalMap

  • " + "
  • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular), doesn't work on NormalMap


  • "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); @@ -1425,17 +1537,17 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1452,10 +1564,9 @@ private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " + "For example :
    " @@ -1468,8 +1579,8 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1487,14 +1598,13 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("between 0 ~ inf"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 350); + help.setSize(300, 70); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1512,14 +1622,14 @@ private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private void AlbedoMapLoopHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); + help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1540,18 +1650,16 @@ private void NormalMapTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN }//GEN-LAST:event_NormalMapTypeActionPerformed private void AlbedoMapUVFlipHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1571,11 +1679,9 @@ private void NormalSubMapFromActionPerformed(java.awt.event.ActionEvent evt) {// }//GEN-LAST:event_NormalSubMapFromActionPerformed private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " + "For example :
    " @@ -1588,8 +1694,8 @@ private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) { + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1607,14 +1713,13 @@ private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) { private void albedoHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("between 0 ~ inf"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 350); + help.setSize(300, 70); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1632,14 +1737,13 @@ private void albedoHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F private void AlbedoMapLoopHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1677,6 +1781,9 @@ private void changeFile1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F if (selection == 0) { String relative = toRelative.convertToRelativePath(foo.getFileToEdit().getParent().toString(), filePath); NormalSubMapFile.setText(relative); + if (NormalSubMapFrom.getSelectedIndex() != 1) { + NormalSubMapFrom.setSelectedIndex(1); + } try { BufferedReader br = null; @@ -1725,11 +1832,9 @@ private void NormalSubMapUVFlipActionPerformed(java.awt.event.ActionEvent evt) { }//GEN-LAST:event_NormalSubMapUVFlipActionPerformed private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); - + AlbedoMapHelp.setName("help"); AlbedoMapHelpText.setText("
    You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

    " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
    " + "Tips 2 : Do not enter a path with HDR file, that will be ignore the HDR and linear color-space
    " @@ -1746,8 +1851,8 @@ private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GE + "
  • 8 : Params fetch from Specular Color from the pmx. , doesn't work on NormalMap

  • " + "
  • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular), doesn't work on NormalMap


  • "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); @@ -1763,11 +1868,9 @@ private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GE }//GEN-LAST:event_AlbedoMapHelp1ActionPerformed private void AlbedoMapHelp2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp2ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("Other parameter types for tangent normal see UE4 docs for PerturbNormalLQ and PerturbNormalHQ." + "https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/BumpMappingWithoutTangentSpace/index.html


    " + "
      " @@ -1777,8 +1880,8 @@ private void AlbedoMapHelp2ActionPerformed(java.awt.event.ActionEvent evt) {//GE + "
    • 3 : Calculate world-space normal from Grayscale bump map by PerturbNormalHQ (High Quality).
    • " + "
        "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 200); + help.setSize(750, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1795,11 +1898,9 @@ private void AlbedoMapHelp2ActionPerformed(java.awt.event.ActionEvent evt) {//GE }//GEN-LAST:event_AlbedoMapHelp2ActionPerformed private void AlbedoMapHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp3ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("Other parameter types for tangent normal see UE4 docs for PerturbNormalLQ and PerturbNormalHQ." + "https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/BumpMappingWithoutTangentSpace/index.html


        " + "
          " @@ -1809,8 +1910,9 @@ private void AlbedoMapHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GE + "
        • 3 : Calculate world-space normal from Grayscale bump map by PerturbNormalHQ (High Quality).
        • " + "
            "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 200); + help.setSize(750, 200); + help.setLocationRelativeTo(this); + help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -1825,11 +1927,20 @@ private void AlbedoMapHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GE System.out.println("" + ex); } }//GEN-LAST:event_AlbedoMapHelp3ActionPerformed + private void closeAllDialogs() { + Window[] windows = AlbedoSection.getWindows(); + for (Window window : windows) { + if (window.getName().equalsIgnoreCase("help")) { + window.dispose(); + } + } + } private void back1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back1ActionPerformed - + closeAllDialogs(); WindowFrame w = new WindowFrame(); w.setLocation(this.getLocation()); + ErrorWindow.dispose(); this.dispose(); w.setSize(960, 549); w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); @@ -1849,16 +1960,16 @@ public void windowClosing(WindowEvent we) { }//GEN-LAST:event_back1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - helptext.setText("Tips : (NormalMap, SSAO, SSDO, etc) only support non-empty the normals else will result a white edge issue


            " + helptext.setText("Tips : ( NormalMap, SSAO, SSDO, etc ) only support non-empty the normals else will result a white edge issue


            " + "When you see some effect that looks like some white edges on your actor model, you can put the scene in the PMXEditor
            " + "and check the scene that all normals are not zero-length (XYZ are same equal to zero) to be used for model.
            "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -2054,6 +2165,81 @@ private void NormalSubMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {/ } catch (Exception e) { } }//GEN-LAST:event_NormalSubMapUVFlipItemStateChanged + public void previewImg(String path) { + File f = new File(path); + File a = new File(foo.getFilePath()); + File parentFolder = new File(a.getParent()); + File b = new File(parentFolder, path); + String absolute = ""; + try { + absolute = b.getCanonicalPath(); + f = new File(absolute); + } catch (Exception e) { + + } + if (f.exists()) { + JDialog jf = new JDialog(); + JLabel jl = new JLabel(); + jf.setName("help"); + jf.setTitle("Map Preview"); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jf.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + BufferedImage img = null; + try {//Map + img = ImageIO.read(new File(absolute)); + } catch (IOException e) { + e.printStackTrace(); + } + jf.setSize(600, 600); + jf.setResizable(false); + jf.setModal(true); + jf.setLocationRelativeTo(this); + jf.setAlwaysOnTop(true); + jf.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + Image dimg = img.getScaledInstance(jf.getWidth(), jf.getHeight(), + Image.SCALE_SMOOTH); + ImageIcon ii = new ImageIcon(dimg); + jl.setIcon(ii); + jf.add(jl); + jf.setVisible(true); + } else { + JDialog jd = new JDialog(); + JLabel jl = new JLabel(); + jl.setText("
            The Map file you are trying to preview doesn't exist.
            "); + jd.setName("help"); + jd.setTitle("No such Map File"); + jd.setSize(300, 100); + jd.setModal(true); + jd.setResizable(false); + jd.setLocationRelativeTo(this); + jd.setAlwaysOnTop(true); + jd.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jd.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + jd.add(jl); + jd.setVisible(true); + + } + } + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + // TODO add your handling code here: + previewImg(NormalMapFile.getText()); + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + // TODO add your handling code here: + previewImg(NormalMapFile.getText()); + }//GEN-LAST:event_jButton4ActionPerformed /** * @param args the command line arguments @@ -2118,6 +2304,8 @@ public void run() { private javax.swing.JButton changeFile; private javax.swing.JButton changeFile1; private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; diff --git a/src/mmd/SpecularAndOcclusion.form b/src/mmd/ParallaxAndOcclusion.form similarity index 85% rename from src/mmd/SpecularAndOcclusion.form rename to src/mmd/ParallaxAndOcclusion.form index 927f505..bc14d12 100644 --- a/src/mmd/SpecularAndOcclusion.form +++ b/src/mmd/ParallaxAndOcclusion.form @@ -14,7 +14,7 @@ - + @@ -63,10 +63,9 @@ - - + @@ -81,17 +80,24 @@ - - - - - + + + + - - - + + + + + + + + + + + @@ -101,7 +107,6 @@ - @@ -164,7 +169,11 @@ - + + + + + @@ -197,7 +206,7 @@ - + @@ -209,7 +218,7 @@ - + @@ -220,29 +229,26 @@ - + - + - - - - - - - + + + + @@ -269,10 +275,13 @@ - + + + + - + @@ -297,7 +306,7 @@ - + @@ -305,12 +314,12 @@ - + - + - + @@ -323,14 +332,14 @@ - - + + - - + + @@ -338,12 +347,12 @@ - + - + @@ -357,17 +366,17 @@ - + - + - + - + @@ -376,14 +385,15 @@ - + - - + + + @@ -429,28 +439,25 @@ - + - + - - + + - - - - - + + - - + + @@ -466,17 +473,12 @@ - - - - - - + - + - + @@ -485,25 +487,18 @@ - + - - + + + - - - - - - - - @@ -524,7 +519,7 @@ - + @@ -541,6 +536,7 @@ + @@ -591,7 +587,7 @@ - + @@ -604,7 +600,7 @@ - + @@ -648,7 +644,7 @@ - + @@ -665,6 +661,7 @@ + @@ -691,13 +688,13 @@ - + - + @@ -720,7 +717,7 @@ - + @@ -735,44 +732,33 @@ + - + - - - - - - - - - - + + + - - - - - + + - - - - - - - + + + + + @@ -804,5 +790,21 @@ + + + + + + + + + + + + + + + + diff --git a/src/mmd/SpecularAndOcclusion.java b/src/mmd/ParallaxAndOcclusion.java similarity index 81% rename from src/mmd/SpecularAndOcclusion.java rename to src/mmd/ParallaxAndOcclusion.java index c2723cd..badaf07 100644 --- a/src/mmd/SpecularAndOcclusion.java +++ b/src/mmd/ParallaxAndOcclusion.java @@ -29,14 +29,16 @@ import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Dimension; -import java.awt.Toolkit; +import java.awt.Dialog; +import java.awt.Image; +import java.awt.Window; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.BufferedReader; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; @@ -47,6 +49,7 @@ import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; +import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; @@ -59,32 +62,32 @@ import javax.swing.filechooser.FileNameExtensionFilter; import static mmd.MaterialMakerv2.callMenu; -public class SpecularAndOcclusion extends javax.swing.JFrame { +public class ParallaxAndOcclusion extends javax.swing.JFrame { public static MaterialMakerv2 foo = new MaterialMakerv2(); public static WindowFrame wf = new WindowFrame(); - String SpecularScale = getSpecular(); - String SpecularLoop = String.valueOf(getSpecularLoop()); + String ParallaxScale = getParallax(); + String ParallaxLoop = String.valueOf(getParallaxLoop()); String Occlusion = getOcclusion(); String OcclusionLoop = String.valueOf(getOcclusionLoop()); /////////////////////////////////////////////////////////// - String lastSpecularScale = getSpecular(); - String lastSpecularLoop = String.valueOf(getSpecularLoop()); + String lastParallaxScale = getParallax(); + String lastParallaxLoop = String.valueOf(getParallaxLoop()); String lastOcclusion = getOcclusion(); String lastOcclusionLoop = String.valueOf(getOcclusionLoop()); final static int Yaxis = 335; - /*Specular*/ - private static int CatchSpecularMapFrom; - private static int CatchSpecularMapType; - private static int CatchSpecularMapUVFlip; - private static int CatchSpecularMapSwizzle; - private static int CatchSpecularMapApplyScale; - private static String CatchSpecularMapFile = null; - private static String CatchSpecularScale; - private static float CatchSpecularLoop; + /*Parallax*/ + private static int CatchParallaxMapFrom; + private static int CatchParallaxMapType; + private static int CatchParallaxMapUVFlip; + private static int CatchParallaxMapSwizzle; + private static int CatchParallaxMapApplyScale; + private static String CatchParallaxMapFile = null; + private static String CatchParallaxScale; + private static float CatchParallaxLoop; /*Occlusion*/ private static int CatchOcclusionMapFrom; @@ -95,8 +98,62 @@ public class SpecularAndOcclusion extends javax.swing.JFrame { private static String CatchOcclusionMapFile = null; private static String CatchOcclusionScale; private static float CatchOcclusionLoop; + public int errors = 0; + JFrame ErrorWindow = new JFrame(); + + public void SomethingWentWrong() { + if (errors == 1) { + JLabel ErrorWindowText = new JLabel(); + //ErrorWindowText. + ErrorWindowText.setText("
            Something went wrong while trying to load ParallaxAndOcclussion Section...

            " + + "Please make sure the file you are trying to open doesn't exceed the limit for each parameter, usually this happens when you are trying to open " + + "a .fx file where some of it's parameters has higher values than supposed to be

            " + + "Limits for Parallax:
            " + + "
              " + + "
            • ParallaxMapFrom: 0 - 8
            • " + + "
            • ParallaxMapType: 0 - 1
            • " + + "
            • ParallaxMapUVFlip: 0 - 3
            • " + + "
            • ParallaxMapApplySwizzle: 0 - 3
            • " + + "
              " + + "
            " + + "Limits for Occlusion:" + + "
              " + + "
            • OcclusionMapFrom: 0 - 8
            • " + + "
            • OcclusionMapType: 0 - 1
            • " + + "
            • OcclusionMapUVFlip: 0 - 3
            • " + + "
            • OcclusionMapApplySwizzle: 0 - 3
            • " + + "
            • OcclusionMapApplyScale: 0 - 2
            • " + + "
              " + + "
            " + + "
            "); + ErrorWindow.setLayout(new BorderLayout()); + ErrorWindow.setSize(700, 350); + ErrorWindow.setLocationRelativeTo(this); + ErrorWindow.setResizable(true); + ErrorWindow.setAlwaysOnTop(true); + ErrorWindow.setVisible(true); + ErrorWindow.add(ErrorWindowText); + ErrorWindow.setName("help"); + ErrorWindow.setTitle("Something went wrong"); + ErrorWindow.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + ErrorWindow.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + ErrorWindow.dispose(); + } + }); + + try { + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + ErrorWindow.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + } + } - public int getSpecularMapFrom() { + public int getParallaxMapFrom() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -106,11 +163,11 @@ public int getSpecularMapFrom() { String s = ""; s = AlbedotoEdit_Br.readLine(); - + while (s != null) { - if (s.contains("#define SPECULAR_MAP_FROM")) { + if (s.contains("#define PARALLAX_MAP_FROM")) { - CatchSpecularMapFrom = Integer.parseInt(s.replaceAll("[\\D]", "")); + CatchParallaxMapFrom = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -126,10 +183,10 @@ public int getSpecularMapFrom() { Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); } } - return CatchSpecularMapFrom; + return CatchParallaxMapFrom; } - public int getSpecularMapType() { + public int getParallaxMapType() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -140,8 +197,8 @@ public int getSpecularMapType() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define SPECULAR_MAP_TYPE")) { - CatchSpecularMapType = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define PARALLAX_MAP_TYPE")) { + CatchParallaxMapType = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); @@ -158,10 +215,10 @@ public int getSpecularMapType() { } } - return CatchSpecularMapType; + return CatchParallaxMapType; } - public int getSpecularMapUVFlip() { + public int getParallaxMapUVFlip() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -172,8 +229,8 @@ public int getSpecularMapUVFlip() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define SPECULAR_MAP_UV_FLIP")) { - CatchSpecularMapUVFlip = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define PARALLAX_MAP_UV_FLIP")) { + CatchParallaxMapUVFlip = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -188,10 +245,10 @@ public int getSpecularMapUVFlip() { } } - return CatchSpecularMapUVFlip; + return CatchParallaxMapUVFlip; } - public int getSpecularMapSwizzle() { + public int getParallaxMapSwizzle() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -202,8 +259,8 @@ public int getSpecularMapSwizzle() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define SPECULAR_MAP_SWIZZLE")) { - CatchSpecularMapSwizzle = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define PARALLAX_MAP_SWIZZLE")) { + CatchParallaxMapSwizzle = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -218,10 +275,10 @@ public int getSpecularMapSwizzle() { } } - return CatchSpecularMapSwizzle; + return CatchParallaxMapSwizzle; } - public int getSpecularMapApplyScale() { + public int getParallaxMapApplyScale() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -232,8 +289,8 @@ public int getSpecularMapApplyScale() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define SPECULAR_MAP_APPLY_SCALE")) { - CatchSpecularMapApplyScale = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define PARALLAX_MAP_APPLY_SCALE")) { + CatchParallaxMapApplyScale = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -248,10 +305,10 @@ public int getSpecularMapApplyScale() { } } - return CatchSpecularMapApplyScale; + return CatchParallaxMapApplyScale; } - public String getSpecularMapFile() { + public String getParallaxMapFile() { BufferedReader AlbedotoEdit_Br = null; try { @@ -264,17 +321,17 @@ public String getSpecularMapFile() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define SPECULAR_MAP_FILE")) { - CatchSpecularMapFile = ""; + if (s.contains("#define PARALLAX_MAP_FILE")) { + CatchParallaxMapFile = ""; for (int i = s.indexOf('"') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';') { } else { - CatchSpecularMapFile += s.charAt(i); + CatchParallaxMapFile += s.charAt(i); } } - CatchSpecularMapFile = CatchSpecularMapFile.replace("null", ""); + CatchParallaxMapFile = CatchParallaxMapFile.replace("null", ""); } s = AlbedotoEdit_Br.readLine(); } @@ -290,10 +347,10 @@ public String getSpecularMapFile() { } } - return CatchSpecularMapFile; + return CatchParallaxMapFile; } - public String getSpecular() { + public String getParallax() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -304,7 +361,7 @@ public String getSpecular() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("specular ")) { + if (s.contains("parallaxMapScale")) { String txt = ""; for (int i = s.indexOf('=') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';' || s.charAt(i) == ' ') { @@ -313,7 +370,7 @@ public String getSpecular() { txt += s.charAt(i); } } - CatchSpecularScale = (txt); + CatchParallaxScale = (txt); } s = AlbedotoEdit_Br.readLine(); @@ -330,10 +387,10 @@ public String getSpecular() { } } - return CatchSpecularScale; + return CatchParallaxScale; } - public float getSpecularLoop() { + public float getParallaxLoop() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -344,7 +401,7 @@ public float getSpecularLoop() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains(" specularMapLoopNum")) { + if (s.contains(" parallaxMapLoopNum")) { String txt = ""; for (int i = s.indexOf('=') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';' || s.charAt(i) == ' ') { @@ -353,7 +410,7 @@ public float getSpecularLoop() { txt += s.charAt(i); } } - CatchSpecularLoop = Float.parseFloat(txt); + CatchParallaxLoop = Float.parseFloat(txt); } s = AlbedotoEdit_Br.readLine(); } @@ -369,7 +426,7 @@ public float getSpecularLoop() { } } - return CatchSpecularLoop; + return CatchParallaxLoop; } //Occlusion @@ -383,7 +440,7 @@ public int getOcclusionMapFrom() { String s = ""; s = AlbedotoEdit_Br.readLine(); - + while (s != null) { if (s.contains("#define OCCLUSION_MAP_FROM")) { @@ -651,12 +708,12 @@ public float getOcclusionLoop() { /** * Creates new form WindowFrame */ - public SpecularAndOcclusion() {//Constructor + public ParallaxAndOcclusion() {//Constructor initComponents();//Generated by the GUI mostly - myInitComponents(); //Specular Loop + myInitComponents(); //Parallax Loop myInitComponents2(); //Occlusion Loop - myInitComponents3(); //Specular Scale + myInitComponents3(); //Parallax Scale myInitComponents4(); //Occlusion Scale } @@ -672,9 +729,9 @@ public void stateChanged(ChangeEvent e) { try { text.setText(df.format(slider.getScaledValue())); - SpecularLoop = text.getText(); - if (!slider.getValueIsAdjusting() && !SpecularLoop.equalsIgnoreCase(lastSpecularLoop)) { - lastSpecularLoop = SpecularLoop; + ParallaxLoop = text.getText(); + if (!slider.getValueIsAdjusting() && !ParallaxLoop.equalsIgnoreCase(lastParallaxLoop)) { + lastParallaxLoop = ParallaxLoop; try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -683,17 +740,17 @@ public void stateChanged(ChangeEvent e) { String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("specularMapLoopNum")) { + if (line.contains("parallaxMapLoopNum")) { catchOld = line; //auxiliar line String aux = ""; for (int i = catchOld.indexOf('=') + 1; i < catchOld.length() - 1; i++) { aux += catchOld.charAt(i); } catchOld = aux; - if (!catchOld.equalsIgnoreCase(SpecularLoop)) { - SpecularLoop = SpecularLoop.replace(",", "."); - catchNew = SpecularLoop; //catchnewdigit - line = "const float2 specularMapLoopNum = " + catchNew + ';'; + if (!catchOld.equalsIgnoreCase(ParallaxLoop)) { + ParallaxLoop = ParallaxLoop.replace(",", "."); + catchNew = ParallaxLoop; //catchnewdigit + line = "const float parallaxMapLoopNum = " + catchNew + ';'; } } oldtext += line + "\r\n"; @@ -718,17 +775,17 @@ public void stateChanged(ChangeEvent e) { @Override public void keyReleased(KeyEvent ke) { String typed = text.getText(); - /* - if(!typed.matches("\\d+(\\.\\d*)?")) { + + if (!typed.matches("\\d+(\\.\\d*)?")) { return; - }*/ + } double value = Double.parseDouble(typed) * slider.scale; slider.setValue((int) value); - SpecularLoop = text.getText(); + ParallaxLoop = text.getText(); } }); float catchvalue; - catchvalue = Float.parseFloat("" + getSpecularLoop()) * slider.scale; + catchvalue = Float.parseFloat("" + getParallaxLoop()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); slider.setBounds(48, 399, 200, 30); @@ -811,10 +868,10 @@ public void keyReleased(KeyEvent ke) { catchvalue = Float.parseFloat("" + getOcclusionLoop()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); - slider.setBounds(502, 399, 200, 30); + slider.setBounds(505, 399, 200, 30); slider.setPaintTicks(true); slider.setValue((int) catchvalue); - text.setBounds(708, 399, 50, 20); + text.setBounds(711, 399, 50, 20); add(text); add(slider); @@ -825,16 +882,16 @@ public void myInitComponents3() { final DecimalFormat df = new DecimalFormat("0.####"); final JTextField text = new JTextField(20); - final DoubleJSlider slider = new DoubleJSlider(0, 100, 0, 100); + final DoubleJSlider slider = new DoubleJSlider(-10000, 10000, 0, 100); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { try { text.setText(df.format(slider.getScaledValue())); - SpecularScale = text.getText(); - if (!slider.getValueIsAdjusting() && !SpecularScale.equalsIgnoreCase(lastSpecularScale)) { - lastSpecularScale = SpecularScale; + ParallaxScale = text.getText(); + if (!slider.getValueIsAdjusting() && !ParallaxScale.equalsIgnoreCase(lastParallaxScale)) { + lastParallaxScale = ParallaxScale; try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -843,17 +900,17 @@ public void stateChanged(ChangeEvent e) { String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("specular ")) { + if (line.contains("parallaxMapScale")) { catchOld = line; //auxiliar line String aux = ""; for (int i = catchOld.indexOf('=') + 1; i < catchOld.length() - 1; i++) { aux += catchOld.charAt(i); } catchOld = aux; - if (!catchOld.equalsIgnoreCase(SpecularScale)) { - SpecularScale = SpecularScale.replace(",", "."); - catchNew = SpecularScale; //catchnewdigit - line = "const float3 specular = " + catchNew + ';'; + if (!catchOld.equalsIgnoreCase(ParallaxScale)) { + ParallaxScale = ParallaxScale.replace(",", "."); + catchNew = ParallaxScale; //catchnewdigit + line = "const float parallaxMapScale = " + catchNew + ';'; } } oldtext += line + "\r\n"; @@ -885,11 +942,11 @@ public void keyReleased(KeyEvent ke) { }*/ double value = Double.parseDouble(typed) * slider.scale; slider.setValue((int) value); - SpecularScale = text.getText(); + ParallaxScale = text.getText(); } }); float catchvalue; - catchvalue = Float.parseFloat("" + getSpecular()) * slider.scale; + catchvalue = Float.parseFloat("" + getParallax()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); slider.setBounds(48, Yaxis, 200, 30); @@ -973,10 +1030,10 @@ public void keyReleased(KeyEvent ke) { catchvalue = Float.parseFloat("" + getOcclusion()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); - slider.setBounds(502, Yaxis, 200, 30); + slider.setBounds(505, Yaxis, 200, 30); slider.setPaintTicks(true); slider.setValue((int) catchvalue); - text.setBounds(708, Yaxis, 50, 20); + text.setBounds(711, Yaxis, 50, 20); add(text); add(slider); @@ -1008,25 +1065,23 @@ private void initComponents() { jMenu1 = new javax.swing.JMenu(); jLabel1 = new javax.swing.JLabel(); - SpecularMapFrom = new javax.swing.JComboBox<>(); + ParallaxMapFrom = new javax.swing.JComboBox<>(); jLabel2 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); changeFile = new javax.swing.JButton(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); - SpecularMapUVFlip = new javax.swing.JComboBox<>(); + ParallaxMapUVFlip = new javax.swing.JComboBox<>(); AlbedoMapHelp = new javax.swing.JButton(); AlbedoMapUVFlipHelp = new javax.swing.JButton(); AlbedoMapFileHelp = new javax.swing.JButton(); albedoHelp = new javax.swing.JButton(); AlbedoMapLoopHelp = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); - SpecularMapType = new javax.swing.JComboBox<>(); + ParallaxMapType = new javax.swing.JComboBox<>(); AlbedoMapHelp3 = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); - jLabel5 = new javax.swing.JLabel(); - SpecularMapSwizzle = new javax.swing.JComboBox<>(); - AlbedoMapUVFlipHelp1 = new javax.swing.JButton(); + ParallaxMapSwizzle = new javax.swing.JComboBox<>(); AlbedoMapUVFlipHelp2 = new javax.swing.JButton(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); @@ -1050,39 +1105,45 @@ private void initComponents() { OcclusionMapType = new javax.swing.JComboBox<>(); AlbedoMapHelp4 = new javax.swing.JButton(); OcclusionMapApplyScale = new javax.swing.JComboBox<>(); - SpecularMapApplyScale = new javax.swing.JComboBox<>(); - SpecularMapFile = new javax.swing.JTextField(); + ParallaxMapFile = new javax.swing.JTextField(); OcclusionMapFile = new javax.swing.JTextField(); back1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); jMenu1.setText("jMenu1"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setTitle("Edit Specular and Occlusion"); + setTitle("Edit Parallax and Occlusion"); setAutoRequestFocus(false); setResizable(false); setSize(new java.awt.Dimension(960, 540)); - jLabel1.setText("SPECULAR MAP FROM"); + jLabel1.setText("PARALLAX MAP FROM"); - SpecularMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8" })); - SpecularMapFrom.setSelectedIndex(getSpecularMapFrom()); - SpecularMapFrom.setToolTipText(""); - SpecularMapFrom.addItemListener(new java.awt.event.ItemListener() { + ParallaxMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8" })); + try{ + ParallaxMapFrom.setSelectedIndex(getParallaxMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + ParallaxMapFrom.setToolTipText(""); + ParallaxMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - SpecularMapFromItemStateChanged(evt); + ParallaxMapFromItemStateChanged(evt); } }); - SpecularMapFrom.addActionListener(new java.awt.event.ActionListener() { + ParallaxMapFrom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - SpecularMapFromActionPerformed(evt); + ParallaxMapFromActionPerformed(evt); } }); - jLabel2.setText("SPECULAR MAP UV FLIP"); + jLabel2.setText("PARALLAX MAP UV FLIP"); - jLabel6.setText("SPECULAR MAP FILE"); + jLabel6.setText("PARALLAX MAP FILE"); changeFile.setText("..."); changeFile.addChangeListener(new javax.swing.event.ChangeListener() { @@ -1096,20 +1157,25 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel8.setText("SPECULAR MAP SCALE"); + jLabel8.setText("PARALLAX MAP SCALE"); - jLabel9.setText("SPECULAR MAP LOOP"); + jLabel9.setText("PARALLAX MAP LOOP"); - SpecularMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - SpecularMapUVFlip.setSelectedIndex(getSpecularMapUVFlip()); - SpecularMapUVFlip.addItemListener(new java.awt.event.ItemListener() { + ParallaxMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); + try{ + ParallaxMapUVFlip.setSelectedIndex(getParallaxMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + ParallaxMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - SpecularMapUVFlipItemStateChanged(evt); + ParallaxMapUVFlipItemStateChanged(evt); } }); - SpecularMapUVFlip.addActionListener(new java.awt.event.ActionListener() { + ParallaxMapUVFlip.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - SpecularMapUVFlipActionPerformed(evt); + ParallaxMapUVFlipActionPerformed(evt); } }); @@ -1148,19 +1214,24 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel3.setText("SPECULAR MAP TYPE"); + jLabel3.setText("PARALLAX MAP TYPE"); - SpecularMapType.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4" })); - SpecularMapType.setSelectedIndex(getSpecularMapType()); - SpecularMapType.setToolTipText(""); - SpecularMapType.addItemListener(new java.awt.event.ItemListener() { + ParallaxMapType.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1" })); + try{ + ParallaxMapType.setSelectedIndex(getParallaxMapType()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + ParallaxMapType.setToolTipText(""); + ParallaxMapType.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - SpecularMapTypeItemStateChanged(evt); + ParallaxMapTypeItemStateChanged(evt); } }); - SpecularMapType.addActionListener(new java.awt.event.ActionListener() { + ParallaxMapType.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - SpecularMapTypeActionPerformed(evt); + ParallaxMapTypeActionPerformed(evt); } }); @@ -1171,27 +1242,23 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel4.setText("SPECULAR MAP SWIZZLE"); - - jLabel5.setText("SPECULAR MAP APPLY SCALE"); + jLabel4.setText("PARALLAX MAP SWIZZLE"); - SpecularMapSwizzle.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - SpecularMapSwizzle.setSelectedIndex(getSpecularMapSwizzle()); - SpecularMapSwizzle.addItemListener(new java.awt.event.ItemListener() { + ParallaxMapSwizzle.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); + try{ + ParallaxMapSwizzle.setSelectedIndex(getParallaxMapSwizzle()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + ParallaxMapSwizzle.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - SpecularMapSwizzleItemStateChanged(evt); + ParallaxMapSwizzleItemStateChanged(evt); } }); - SpecularMapSwizzle.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - SpecularMapSwizzleActionPerformed(evt); - } - }); - - AlbedoMapUVFlipHelp1.setText("Help"); - AlbedoMapUVFlipHelp1.addActionListener(new java.awt.event.ActionListener() { + ParallaxMapSwizzle.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - AlbedoMapUVFlipHelp1ActionPerformed(evt); + ParallaxMapSwizzleActionPerformed(evt); } }); @@ -1207,7 +1274,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel11.setText("OCCLUSION MAP LOOP"); OcclusionMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - OcclusionMapUVFlip.setSelectedIndex(getOcclusionMapUVFlip()); + try{ + OcclusionMapUVFlip.setSelectedIndex(getOcclusionMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } OcclusionMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { OcclusionMapUVFlipItemStateChanged(evt); @@ -1257,7 +1329,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel12.setText("OCCLUSION MAP FROM"); OcclusionMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8" })); - OcclusionMapFrom.setSelectedIndex(getOcclusionMapFrom()); + try{ + OcclusionMapFrom.setSelectedIndex(getOcclusionMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } OcclusionMapFrom.setToolTipText(""); OcclusionMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -1291,7 +1368,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel16.setText("OCCLUSION MAP APPLY SCALE"); OcclusionMapSwizzle.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - OcclusionMapSwizzle.setSelectedIndex(getOcclusionMapSwizzle()); + try{ + OcclusionMapSwizzle.setSelectedIndex(getOcclusionMapSwizzle()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } OcclusionMapSwizzle.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { OcclusionMapSwizzleItemStateChanged(evt); @@ -1320,7 +1402,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel7.setText("OCCLUSION MAP TYPE"); OcclusionMapType.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1" })); - OcclusionMapType.setSelectedIndex(getOcclusionMapType()); + try{ + OcclusionMapType.setSelectedIndex(getOcclusionMapType()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } OcclusionMapType.setToolTipText(""); OcclusionMapType.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -1341,7 +1428,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); OcclusionMapApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1" })); - OcclusionMapApplyScale.setSelectedIndex(getOcclusionMapApplyScale()); + try{ + OcclusionMapApplyScale.setSelectedIndex(getOcclusionMapApplyScale()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } OcclusionMapApplyScale.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { OcclusionMapApplyScaleItemStateChanged(evt); @@ -1353,22 +1445,21 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - SpecularMapApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - SpecularMapApplyScale.setSelectedIndex(getSpecularMapApplyScale()); - SpecularMapApplyScale.addItemListener(new java.awt.event.ItemListener() { - public void itemStateChanged(java.awt.event.ItemEvent evt) { - SpecularMapApplyScaleItemStateChanged(evt); - } - }); - SpecularMapApplyScale.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - SpecularMapApplyScaleActionPerformed(evt); - } - }); - - SpecularMapFile.setText(getSpecularMapFile()); + try{ + ParallaxMapFile.setEditable(false); + ParallaxMapFile.setText(getParallaxMapFile()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } - OcclusionMapFile.setText(getOcclusionMapFile()); + try{ + OcclusionMapFile.setEditable(false); + OcclusionMapFile.setText(getOcclusionMapFile()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } back1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bg/back.png"))); // NOI18N back1.setBorder(null); @@ -1390,6 +1481,20 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); + jButton3.setText("Preview"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + jButton4.setText("Preview"); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -1414,9 +1519,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 286, Short.MAX_VALUE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 298, Short.MAX_VALUE))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() @@ -1428,15 +1532,19 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addGap(256, 256, 256) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(SpecularMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SpecularMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SpecularMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SpecularMapType, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SpecularMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(ParallaxMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ParallaxMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ParallaxMapType, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ParallaxMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(SpecularMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(changeFile, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(ParallaxMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(changeFile, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton3))))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(AlbedoMapFileHelp) @@ -1444,7 +1552,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(AlbedoMapHelp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(AlbedoMapUVFlipHelp) .addComponent(AlbedoMapHelp3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(AlbedoMapUVFlipHelp1) .addComponent(AlbedoMapUVFlipHelp2))))) .addGap(60, 60, 60))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) @@ -1488,7 +1595,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGap(54, 54, 54)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(OcclusionMapFile, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(OcclusionMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton4)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1512,7 +1622,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SpecularMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ParallaxMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapHelp) .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -1521,7 +1631,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SpecularMapType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ParallaxMapType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapHelp3) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(OcclusionMapType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1531,25 +1641,22 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SpecularMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ParallaxMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapUVFlipHelp)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SpecularMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ParallaxMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapUVFlipHelp2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapUVFlipHelp1) - .addComponent(SpecularMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(changeFile) .addComponent(AlbedoMapFileHelp)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(SpecularMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ParallaxMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton3))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1571,8 +1678,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(changeFile1) .addComponent(AlbedoMapFileHelp1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(OcclusionMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(OcclusionMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton4)))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -1590,26 +1699,26 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AlbedoMapLoopHelp1)))) - .addContainerGap(79, Short.MAX_VALUE)) + .addContainerGap(77, Short.MAX_VALUE)) ); pack(); }// //GEN-END:initComponents - private void SpecularMapFromActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SpecularMapFromActionPerformed + private void ParallaxMapFromActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ParallaxMapFromActionPerformed - }//GEN-LAST:event_SpecularMapFromActionPerformed + }//GEN-LAST:event_ParallaxMapFromActionPerformed - private void SpecularMapUVFlipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SpecularMapUVFlipActionPerformed + private void ParallaxMapUVFlipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ParallaxMapUVFlipActionPerformed - }//GEN-LAST:event_SpecularMapUVFlipActionPerformed + }//GEN-LAST:event_ParallaxMapUVFlipActionPerformed private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeFileActionPerformed JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new java.io.File("../../Materials"));//The directory we are looking for is the Materials folder from ray - fileChooser.setDialogTitle("Choose new Specular Map File"); + fileChooser.setDialogTitle("Choose new Parallax Map File"); //Filtering by ImageFiles FileFilter imageFilter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "bmp", "tga", "targa", "dds", "tif", "tiff", "jpeg", "pcd"); fileChooser.setFileFilter(imageFilter); @@ -1623,9 +1732,9 @@ private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI if (selection == 0) { String relative = toRelative.convertToRelativePath(foo.getFileToEdit().getParent(), filePath); - SpecularMapFile.setText(relative); - if (SpecularMapFrom.getSelectedIndex() != 1) { - SpecularMapFrom.setSelectedIndex(1); + ParallaxMapFile.setText(relative); + if (ParallaxMapFrom.getSelectedIndex() != 1) { + ParallaxMapFrom.setSelectedIndex(1); } try { BufferedReader br = null; @@ -1635,16 +1744,16 @@ private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define SPECULAR_MAP_FILE")) { + if (line.contains("#define PARALLAX_MAP_FILE")) { catchOld = line; //auxiliar line String aux = ""; for (int i = catchOld.indexOf('"') + 1; i < line.length() - 1; i++) { aux += catchOld.charAt(i); } catchOld = aux; - if (!catchOld.equalsIgnoreCase(SpecularMapFile.getText())) { - catchNew = SpecularMapFile.getText(); //catchnewdigit - line = "#define SPECULAR_MAP_FILE " + '"' + catchNew + '"'; + if (!catchOld.equalsIgnoreCase(ParallaxMapFile.getText())) { + catchNew = ParallaxMapFile.getText(); //catchnewdigit + line = "#define PARALLAX_MAP_FILE " + '"' + catchNew + '"'; } } oldtext += line + "\r\n"; @@ -1671,12 +1780,11 @@ private void changeFileStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI }//GEN-LAST:event_changeFileStateChanged private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); - - AlbedoMapHelpText.setText("
            You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

            " + AlbedoMapHelp.setName("help"); + AlbedoMapHelpText.setText("
            In the DX9, the parallax map does not work with vertex displacement


            " + + "You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

            " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
            " + "Tips 2 : Do not enter a path with HDR file, that will be ignore the HDR and linear color-space
            " + "Tips 3 : These files (bmp, png, jpg, tga, dds, gif, apng) must be working in a sRGB color-space
            " @@ -1689,15 +1797,15 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN + "
          • 5 : Params fetch from Toon map from the pmx.

          • " + "
          • 6 : Params fetch from avi/screen from the DummyScreen.x inside extension folder.

          • " + "
          • 7 : Params fetch from Ambient Color from the pmx.

          • " - + "
          • 8 : Params fetch from Specular Color from the pmx.

          • " - + "
          • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular), doesn't work on Specular


          "); + + "
        • 8 : Params fetch from Parallax Color from the pmx.

        • " + + "
        • 9 : Params fetch from Parallax Power from the pmx. (this option can only be used for parallax), doesn't work on Parallax


        "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); - AlbedoMapHelp.setTitle("Specular Map From Help"); + AlbedoMapHelp.setTitle("Parallax Map From Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1709,22 +1817,21 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN }//GEN-LAST:event_AlbedoMapHelpActionPerformed private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("
        You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


        " + "
        • 1 : Flip axis x
        • " + "
        • 2 : Flip axis y
        • " + "
        • 3 : Flip axis x & y
        "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); + help.setResizable(true); help.setVisible(true); help.add(helptext); - help.setTitle("Specular Map UV Flip Help"); + help.setTitle("Parallax Map UV Flip Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1737,9 +1844,9 @@ private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

        " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

        " @@ -1753,13 +1860,14 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ + "If the xxx.png is inside your desktop or other disk
        " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); + help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Specular Map File Help"); + help.setTitle("Parallax Map File Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1772,25 +1880,19 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); - helptext.setText("Default value is 0.5

        " - + "Notice : Anything less than 2% is physically impossible and is instead considered to be shadowing

        " - + "For example: The reflectance coefficient is equal to F(x) = (x - 1)^2 / (x + 1)^2
        " - + "Consider light that is incident upon a transparent medium with a refractive index of 1.5

        " - + "That result will be equal to (1.5 - 1)^2 / (1.5 + 1)^2 = 0.04 (or 4%).
        " - + "Specular to reflection coefficient is equal to F(x) = 0.08*x, if the x is equal to 0.5 the result will be 0.04.
        " - + "So default value is 0.5 for 0.04 coeff.
        "); + helptext.setText("between 0 ~ inf"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 350); + help.setSize(300, 70); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Specular Map Scale Help"); + help.setTitle("Parallax Map Scale Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1803,19 +1905,22 @@ private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private void AlbedoMapLoopHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); - helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); + helptext.setText("Why increase number of parallaxMapLoopNum will increase the loops/tile/number of albedo, normals, etc
        " + + "Bacause parallax coordinates can be calculated from height map
        " + + "That are then used to access textures with albedo, normals, smoothness, metalness, etc
        " + + "In other words like fetched data (albedo, normals, etc) from parallax coordinates * parallaxMapLoopNum * albedo/normal/MapLoopNum
        "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Specular Map Loop Help"); + help.setTitle("Parallax Map Loop Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1826,31 +1931,27 @@ private void AlbedoMapLoopHelpActionPerformed(java.awt.event.ActionEvent evt) {/ } }//GEN-LAST:event_AlbedoMapLoopHelpActionPerformed - private void SpecularMapTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SpecularMapTypeActionPerformed + private void ParallaxMapTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ParallaxMapTypeActionPerformed - }//GEN-LAST:event_SpecularMapTypeActionPerformed + }//GEN-LAST:event_ParallaxMapTypeActionPerformed private void AlbedoMapHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp3ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - - helptext.setText(" Other parameter types for Specular

        " - + "
          " - + "
        • 0 : Calculate reflection coefficient from specular color by F(x) = 0.08*(x ) (from UE4 textures)
        • " - + "
        • 1 : Calculate reflection coefficient from specular color by F(x) = 0.16*(x^2) (from Frostbite textures)
        • " - + "
        • 2 : Calculate reflection coefficient from specular grays by F(x) = 0.08*(x ) (from UE4 textures)
        • " - + "
        • 3 : Calculate reflection coefficient from specular grays by F(x) = 0.16*(x^2) (from Frostbite textures)
        • " - + "
        • 4 : Using reflection coefficient (0.04) instead of specular value (0.5), Available when SPECULAR_MAP_FROM at 0
        "); + help.setName("help"); + helptext.setText(" Other parameter types for Parallax

        " + + "
        • 0 : calculate without transparency
        • " + + "
        • 1 : calculate parallax occlusion with transparency and best SSDO
        "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setSize(700, 250); + help.setLocationRelativeTo(this); + helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); + help.setResizable(true); help.setVisible(true); help.add(helptext); - help.setTitle("Specular Map Type Help"); + help.setTitle("Parallax Map Type Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1861,52 +1962,25 @@ private void AlbedoMapHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GE } }//GEN-LAST:event_AlbedoMapHelp3ActionPerformed - private void SpecularMapSwizzleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SpecularMapSwizzleActionPerformed - - }//GEN-LAST:event_SpecularMapSwizzleActionPerformed - - private void AlbedoMapUVFlipHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp1ActionPerformed + private void ParallaxMapSwizzleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ParallaxMapSwizzleActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); - JFrame help = new JFrame(); - JLabel helptext = new JLabel(); - - helptext.setText("
        You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE


        " - + "
        • 1 : map values * albedo;
        • " - + "
        • 2 : map values ^ albedo;
        • " - + "
        "); - help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(500, 160); - help.setResizable(true); - help.setVisible(true); - help.add(helptext); - help.setTitle("Specular Map Apply Scale Help"); - - try { - InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); - BufferedImage myImg = ImageIO.read(imgStream); - help.setIconImage(myImg); - } catch (IOException ex) { - System.out.println("" + ex); - } - }//GEN-LAST:event_AlbedoMapUVFlipHelp1ActionPerformed + }//GEN-LAST:event_ParallaxMapSwizzleActionPerformed private void AlbedoMapUVFlipHelp2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp2ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("The ordering of the data fetched from a texture from the code. (R = 0, G = 1, B = 2, A = 3)"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); + help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Specular Map Swizzle Help"); + help.setTitle("Parallax Map Swizzle Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1922,10 +1996,9 @@ private void OcclusionMapUVFlipActionPerformed(java.awt.event.ActionEvent evt) { }//GEN-LAST:event_OcclusionMapUVFlipActionPerformed private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); + AlbedoMapHelp.setName("help"); AlbedoMapHelpText.setText("
        You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

        " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
        " @@ -1940,11 +2013,12 @@ private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GE + "
      • 5 : Params fetch from Toon map from the pmx.

      • " + "
      • 6 : Params fetch from avi/screen from the DummyScreen.x inside extension folder.

      • " + "
      • 7 : Params fetch from Ambient Color from the pmx.

      • " - + "
      • 8 : Params fetch from Specular Color from the pmx.

      • " - + "
      • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular), doesn't work on Occlusion


      "); + + "
    • 8 : Params fetch from Parallax Color from the pmx.

    • " + + "
    • 9 : Params fetch from Parallax Power from the pmx. (this option can only be used for parallax), doesn't work on Occlusion


    "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); + AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); @@ -1961,17 +2035,18 @@ private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GE private void AlbedoMapUVFlipHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp3ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); + help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -1988,9 +2063,9 @@ private void AlbedoMapUVFlipHelp3ActionPerformed(java.awt.event.ActionEvent evt) private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " @@ -2004,8 +2079,9 @@ private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) { + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); + help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -2023,14 +2099,14 @@ private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) { private void albedoHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("between 0 ~ 1"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 350); + help.setSize(300, 70); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -2049,14 +2125,14 @@ private void albedoHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F private void AlbedoMapLoopHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); @@ -2148,18 +2224,18 @@ private void OcclusionMapSwizzleActionPerformed(java.awt.event.ActionEvent evt) }//GEN-LAST:event_OcclusionMapSwizzleActionPerformed private void AlbedoMapUVFlipHelp4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp4ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("
    You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE


    " + "
    • 1 : map values * albedo;
    • " + "
    • 2 : map values ^ albedo;
    • " + "
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); + help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -2176,14 +2252,15 @@ private void AlbedoMapUVFlipHelp4ActionPerformed(java.awt.event.ActionEvent evt) private void AlbedoMapUVFlipHelp5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp5ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("The ordering of the data fetched from a texture from the code. (R = 0, G = 1, B = 2, A = 3)"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); + help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -2204,18 +2281,19 @@ private void OcclusionMapTypeActionPerformed(java.awt.event.ActionEvent evt) {// private void AlbedoMapHelp4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp4ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("Other parameter types for occlusion

    " + "
      " + "
    • 0 : Fetch ambient occlusion from linear color-space
    • " + "
    • 1 : Fetch ambient occlusion from sRGB color-space
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setSize(700, 250); + help.setLocationRelativeTo(this); + helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); + help.setResizable(true); help.setVisible(true); help.add(helptext); @@ -2233,16 +2311,20 @@ private void AlbedoMapHelp4ActionPerformed(java.awt.event.ActionEvent evt) {//GE private void OcclusionMapApplyScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OcclusionMapApplyScaleActionPerformed }//GEN-LAST:event_OcclusionMapApplyScaleActionPerformed + private void closeAllDialogs() { + Window[] windows = AlbedoSection.getWindows(); - private void SpecularMapApplyScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SpecularMapApplyScaleActionPerformed - - }//GEN-LAST:event_SpecularMapApplyScaleActionPerformed - + for (Window window : windows) { + if (window.getName().equalsIgnoreCase("help")) { + window.dispose(); + } + } + } private void back1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back1ActionPerformed - + closeAllDialogs(); WindowFrame w = new WindowFrame(); w.setLocation(this.getLocation()); - + ErrorWindow.dispose(); this.dispose(); w.setSize(960, 549); w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); @@ -2263,23 +2345,28 @@ public void windowClosing(WindowEvent we) { }//GEN-LAST:event_back1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + JFrame help = new JFrame(); JLabel helptext = new JLabel(); - helptext.setText("Tips : It has no effect on metalness > 0 and CUSTOM_ENABLE > 0.

    " - + "The specular maps are not HDR/environment maps, only modifies the color of basic reflection of the model
    " + helptext.setText("Parallax Tips : It has no effect on metalness > 0 and CUSTOM_ENABLE > 0.

    " + + "The parallax maps are not HDR/environment maps, only modifies the color of basic reflection of the model
    " + "Used to change the colors of the environment reflect.
    " - + "When the diffuse brighter than specular reflect,
    " + + "When the diffuse brighter than parallax reflect,
    " + "It will be only a very small contribution to change the colors of environment reflect.
    " - + "So you can set the zero to the 'const float3 specular = 0.0;', if you dot‘t want that model to reflect the specular color of environment.
    "); + + "So you can set the zero to the 'const float3 parallax = 0.0;', if you dot‘t want that model to reflect the parallax color of environment.


    " + + "" + + "Occlusion Tips : The ambient occlusion (AO) is an effect that approximates the attenuation of environment light due to occlusion.
    " + + "Bacause sky lighting from many directions, cannot simply to calculating shadows in the real-time.
    " + + "A simply way able to replaced by using occlusion map and SSAO.
    " + + "So you can set the zero to the 'const float occlusion = 0.0;', if you dot‘t want that model to calculating the diffuse & specular color of environment.
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setSize(700, 250); + help.setLocationRelativeTo(this); + helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setResizable(true); help.setVisible(true); help.add(helptext); - help.setTitle("Specular Map Tips"); + help.setTitle("Parallax & Occlusion Map Tips"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -2290,7 +2377,7 @@ private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS } }//GEN-LAST:event_jButton2ActionPerformed - private void SpecularMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SpecularMapFromItemStateChanged + private void ParallaxMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ParallaxMapFromItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2299,10 +2386,10 @@ private void SpecularMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GE String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define SPECULAR_MAP_FROM")) { + if (line.contains("#define PARALLAX_MAP_FROM")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = SpecularMapFrom.getSelectedItem().toString(); //catchnewdigit + catchNew = ParallaxMapFrom.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2319,9 +2406,9 @@ private void SpecularMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GE } catch (Exception e) { } - }//GEN-LAST:event_SpecularMapFromItemStateChanged + }//GEN-LAST:event_ParallaxMapFromItemStateChanged - private void SpecularMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SpecularMapTypeItemStateChanged + private void ParallaxMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ParallaxMapTypeItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2330,10 +2417,10 @@ private void SpecularMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GE String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define SPECULAR_MAP_TYPE")) { + if (line.contains("#define PARALLAX_MAP_TYPE")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = SpecularMapType.getSelectedItem().toString(); //catchnewdigit + catchNew = ParallaxMapType.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2350,9 +2437,9 @@ private void SpecularMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GE } catch (Exception e) { } - }//GEN-LAST:event_SpecularMapTypeItemStateChanged + }//GEN-LAST:event_ParallaxMapTypeItemStateChanged - private void SpecularMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SpecularMapUVFlipItemStateChanged + private void ParallaxMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ParallaxMapUVFlipItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2361,10 +2448,10 @@ private void SpecularMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {// String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define SPECULAR_MAP_UV_FLIP")) { + if (line.contains("#define PARALLAX_MAP_UV_FLIP")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = SpecularMapUVFlip.getSelectedItem().toString(); //catchnewdigit + catchNew = ParallaxMapUVFlip.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2381,9 +2468,9 @@ private void SpecularMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {// } catch (Exception e) { } - }//GEN-LAST:event_SpecularMapUVFlipItemStateChanged + }//GEN-LAST:event_ParallaxMapUVFlipItemStateChanged - private void SpecularMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SpecularMapSwizzleItemStateChanged + private void ParallaxMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ParallaxMapSwizzleItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2392,10 +2479,10 @@ private void SpecularMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {/ String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define SPECULAR_MAP_SWIZZLE")) { + if (line.contains("#define PARALLAX_MAP_SWIZZLE")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = SpecularMapSwizzle.getSelectedItem().toString(); //catchnewdigit + catchNew = ParallaxMapSwizzle.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2412,38 +2499,7 @@ private void SpecularMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {/ } catch (Exception e) { } - }//GEN-LAST:event_SpecularMapSwizzleItemStateChanged - - private void SpecularMapApplyScaleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SpecularMapApplyScaleItemStateChanged - try { - BufferedReader br = null; - br = new BufferedReader(new FileReader(foo.getFileToEdit())); - String oldtext = ""; - String line = br.readLine(); - String catchOld = ""; - String catchNew = ""; - while (line != null) { - if (line.contains("#define SPECULAR_MAP_APPLY_SCALE")) { - catchOld = line; //auxiliar line - catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = SpecularMapApplyScale.getSelectedItem().toString(); //catchnewdigit - line = line.replaceAll(catchOld, catchNew); //replace old for the new one - - } - oldtext += line + "\r\n"; - line = br.readLine(); - } - String newtext = oldtext; - - FileWriter writer = new FileWriter(foo.getFileToEdit()); - writer.write(newtext); - writer.close(); - - br.close(); - } catch (Exception e) { - - } - }//GEN-LAST:event_SpecularMapApplyScaleItemStateChanged + }//GEN-LAST:event_ParallaxMapSwizzleItemStateChanged private void OcclusionMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_OcclusionMapFromItemStateChanged try { @@ -2599,6 +2655,81 @@ private void OcclusionMapApplyScaleItemStateChanged(java.awt.event.ItemEvent evt } }//GEN-LAST:event_OcclusionMapApplyScaleItemStateChanged + public void previewImg(String path) { + File f = new File(path); + File a = new File(foo.getFilePath()); + File parentFolder = new File(a.getParent()); + File b = new File(parentFolder, path); + String absolute = ""; + try { + absolute = b.getCanonicalPath(); + f = new File(absolute); + } catch (Exception e) { + + } + if (f.exists()) { + JDialog jf = new JDialog(); + JLabel jl = new JLabel(); + jf.setName("help"); + jf.setTitle("Map Preview"); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jf.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + BufferedImage img = null; + try {//Map + img = ImageIO.read(new File(absolute)); + } catch (IOException e) { + e.printStackTrace(); + } + jf.setSize(600, 600); + jf.setResizable(false); + jf.setModal(true); + jf.setLocationRelativeTo(this); + jf.setAlwaysOnTop(true); + jf.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + Image dimg = img.getScaledInstance(jf.getWidth(), jf.getHeight(), + Image.SCALE_SMOOTH); + ImageIcon ii = new ImageIcon(dimg); + jl.setIcon(ii); + jf.add(jl); + jf.setVisible(true); + } else { + JDialog jd = new JDialog(); + JLabel jl = new JLabel(); + jl.setText("
    The Map file you are trying to preview doesn't exist.
    "); + jd.setName("help"); + jd.setTitle("No such Map File"); + jd.setSize(300, 100); + jd.setModal(true); + jd.setResizable(false); + jd.setLocationRelativeTo(this); + jd.setAlwaysOnTop(true); + jd.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jd.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + jd.add(jl); + jd.setVisible(true); + + } + } + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + // TODO add your handling code here: + previewImg(ParallaxMapFile.getText()); + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + // TODO add your handling code here: + previewImg(OcclusionMapFile.getText()); + }//GEN-LAST:event_jButton4ActionPerformed /** * @param args the command line arguments @@ -2648,7 +2779,6 @@ public void run() { private javax.swing.JButton AlbedoMapLoopHelp; private javax.swing.JButton AlbedoMapLoopHelp1; private javax.swing.JButton AlbedoMapUVFlipHelp; - private javax.swing.JButton AlbedoMapUVFlipHelp1; private javax.swing.JButton AlbedoMapUVFlipHelp2; private javax.swing.JButton AlbedoMapUVFlipHelp3; private javax.swing.JButton AlbedoMapUVFlipHelp4; @@ -2659,18 +2789,19 @@ public void run() { private javax.swing.JComboBox OcclusionMapSwizzle; private javax.swing.JComboBox OcclusionMapType; private javax.swing.JComboBox OcclusionMapUVFlip; - private javax.swing.JComboBox SpecularMapApplyScale; - private javax.swing.JTextField SpecularMapFile; - private javax.swing.JComboBox SpecularMapFrom; - private javax.swing.JComboBox SpecularMapSwizzle; - private javax.swing.JComboBox SpecularMapType; - private javax.swing.JComboBox SpecularMapUVFlip; + private javax.swing.JTextField ParallaxMapFile; + private javax.swing.JComboBox ParallaxMapFrom; + private javax.swing.JComboBox ParallaxMapSwizzle; + private javax.swing.JComboBox ParallaxMapType; + private javax.swing.JComboBox ParallaxMapUVFlip; private javax.swing.JButton albedoHelp; private javax.swing.JButton albedoHelp1; private javax.swing.JButton back1; private javax.swing.JButton changeFile; private javax.swing.JButton changeFile1; private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; @@ -2682,7 +2813,6 @@ public void run() { private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; - private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; diff --git a/src/mmd/SmoothnessAndMetalness.form b/src/mmd/SpecularAndSmoothness.form similarity index 68% rename from src/mmd/SmoothnessAndMetalness.form rename to src/mmd/SpecularAndSmoothness.form index 80d6e78..d8c56ff 100644 --- a/src/mmd/SmoothnessAndMetalness.form +++ b/src/mmd/SpecularAndSmoothness.form @@ -14,7 +14,7 @@ - + @@ -46,12 +46,9 @@ - - - - - - + + + @@ -65,11 +62,16 @@ + + + + + - + - + @@ -78,19 +80,23 @@ - + - + + + + + - - + + - - - + + + @@ -107,150 +113,165 @@ + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - + - - - + + + - + + + - - - + + + - - - + + + + + + - - - + + - + + + + + + + + + + + + + + + - + + + + - + + + + - + + + + + + + + + + + - - - + @@ -283,13 +304,13 @@ - + - + - - + + @@ -299,17 +320,16 @@ - - - + + - - + + @@ -317,12 +337,12 @@ - + - + @@ -336,17 +356,17 @@ - + - + - + - + @@ -355,14 +375,15 @@ - + - - + + + @@ -408,26 +429,28 @@ - + - + - - + + + + - - + + - - + + @@ -443,17 +466,17 @@ - + - + - + - + @@ -462,20 +485,21 @@ - + - - + + + - + - + @@ -483,14 +507,15 @@ - + - - + + + @@ -512,17 +537,17 @@ - + - + - + - + @@ -535,10 +560,11 @@ - - + + + @@ -584,12 +610,12 @@ - + - + - + @@ -603,14 +629,14 @@ - + - - + + @@ -618,12 +644,12 @@ - + - + @@ -637,17 +663,17 @@ - + - + - + - + @@ -660,16 +686,17 @@ - - + + + - + - + @@ -677,14 +704,15 @@ - + - - + + + @@ -704,19 +732,29 @@ - + + - + + + + + - + + - + + + + + @@ -732,5 +770,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mmd/SmoothnessAndMetalness.java b/src/mmd/SpecularAndSmoothness.java similarity index 70% rename from src/mmd/SmoothnessAndMetalness.java rename to src/mmd/SpecularAndSmoothness.java index f503814..9c4e044 100644 --- a/src/mmd/SmoothnessAndMetalness.java +++ b/src/mmd/SpecularAndSmoothness.java @@ -28,14 +28,20 @@ package mmd; import java.awt.BorderLayout; +import java.awt.Dialog; import java.awt.Dimension; +import java.awt.Image; +import java.awt.Point; +import java.awt.Rectangle; import java.awt.Toolkit; +import java.awt.Window; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.BufferedReader; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; @@ -46,6 +52,7 @@ import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; +import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; @@ -58,42 +65,97 @@ import javax.swing.filechooser.FileNameExtensionFilter; import static mmd.MaterialMakerv2.callMenu; -public class SmoothnessAndMetalness extends javax.swing.JFrame { +public class SpecularAndSmoothness extends javax.swing.JFrame { public static MaterialMakerv2 foo = new MaterialMakerv2(); public static WindowFrame wf = new WindowFrame(); + String SpecularScale = getSpecularScale(); String SmoothnessScale = getSmoothnessScale(); - String MetalnessScale = getMetalnessScale(); + String SpecularLoop = String.valueOf(getSpecularLoop()); String SmoothnessLoop = String.valueOf(getSmoothnessLoop()); - String MetalnessLoop = String.valueOf(getMetalnessLoop()); String AlbedoMapFile1; //////////////////////////////////////////////////////////////// - String lastMetalnessScale = getMetalnessScale(); - String lastMetalnessLoop = String.valueOf(getMetalnessLoop()); String lastSmoothnessScale = getSmoothnessScale(); String lastSmoothnessLoop = String.valueOf(getSmoothnessLoop()); + String lastSpecularScale = getSpecularScale(); + String lastSpecularLoop = String.valueOf(getSpecularLoop()); + + /*Specular*/ + private static int CatchSpecularMapFrom; + private static int CatchSpecularMapType; + private static int CatchSpecularMapUVFlip; + private static int CatchSpecularMapSwizzle; + private static int CatchSpecularMapApplyScale; + private static String CatchSpecularMapFile = null; + private static String CatchSpecularScale; + private static float CatchSpecularLoop; /*Smoothness*/ private static int CatchSmoothnessMapFrom; - private static int CatchSmoothnessMapType; private static int CatchSmoothnessMapUVFlip; private static int CatchSmoothnessMapSwizzle; private static int CatchSmoothnessMapApplyScale; private static String CatchSmoothnessMapFile = null; private static String CatchSmoothnessScale; private static float CatchSmoothnessLoop; + public int errors = 0; + JFrame ErrorWindow = new JFrame(); + + public void SomethingWentWrong() { + if (errors == 1) { + JLabel ErrorWindowText = new JLabel(); + //ErrorWindowText. + ErrorWindowText.setText("
    Something went wrong while trying to load SpecularAndOcclussion Section...

    " + + "Please make sure the file you are trying to open doesn't exceed the limit for each parameter, usually this happens when you are trying to open " + + "a .fx file where some of it's parameters has higher values than supposed to be

    " + + "Limits for Specular:
    " + + "
      " + + "
    • SpecularMapFrom: 0 - 8
    • " + + "
    • SpecularMapType: 0 - 1
    • " + + "
    • SpecularMapUVFlip: 0 - 3
    • " + + "
    • SpecularMapApplySwizzle: 0 - 3
    • " + + "
    • SpecularMapApplyScale: 0 - 2
    • " + + "
      " + + "
    " + + "Limits for Smoothness:" + + "
      " + + "
    • SmoothnessMapFrom: 0 - 8
    • " + + "
    • SmoothnessMapType: 0 - 1
    • " + + "
    • SmoothnessMapUVFlip: 0 - 3
    • " + + "
    • SmoothnessMapApplySwizzle: 0 - 3
    • " + + "
    • SmoothnessMapApplyScale: 0 - 2
    • " + + "
      " + + "
    " + + "
    "); + ErrorWindow.setLayout(new BorderLayout()); + ErrorWindow.setSize(700, 350); + ErrorWindow.setLocationRelativeTo(this); + ErrorWindow.setResizable(true); + ErrorWindow.setAlwaysOnTop(true); + ErrorWindow.setVisible(true); + ErrorWindow.add(ErrorWindowText); + ErrorWindow.setName("help"); + ErrorWindow.setTitle("Something went wrong"); + ErrorWindow.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + ErrorWindow.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + ErrorWindow.dispose(); + } + }); - /*Metalness*/ - private static int CatchMetalnessMapFrom; - private static int CatchMetalnessMapUVFlip; - private static int CatchMetalnessMapSwizzle; - private static int CatchMetalnessMapApplyScale; - private static String CatchMetalnessMapFile = null; - private static String CatchMetalnessScale; - private static float CatchMetalnessLoop; + try { + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + ErrorWindow.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + } + } - public int getSmoothnessMapFrom() { + public int getSpecularMapFrom() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -104,9 +166,9 @@ public int getSmoothnessMapFrom() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define SMOOTHNESS_MAP_FROM")) { + if (s.contains("#define SPECULAR_MAP_FROM")) { - CatchSmoothnessMapFrom = Integer.parseInt(s.replaceAll("[\\D]", "")); + CatchSpecularMapFrom = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); @@ -123,10 +185,10 @@ public int getSmoothnessMapFrom() { Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); } } - return CatchSmoothnessMapFrom; + return CatchSpecularMapFrom; } - public int getSmoothnessMapType() { + public int getSpecularMapType() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -137,8 +199,8 @@ public int getSmoothnessMapType() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define SMOOTHNESS_MAP_TYPE")) { - CatchSmoothnessMapType = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define SPECULAR_MAP_TYPE")) { + CatchSpecularMapType = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -154,10 +216,10 @@ public int getSmoothnessMapType() { } } - return CatchSmoothnessMapType; + return CatchSpecularMapType; } - public int getSmoothnessMapUVFlip() { + public int getSpecularMapUVFlip() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -168,8 +230,8 @@ public int getSmoothnessMapUVFlip() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define SMOOTHNESS_MAP_UV_FLIP")) { - CatchSmoothnessMapUVFlip = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define SPECULAR_MAP_UV_FLIP")) { + CatchSpecularMapUVFlip = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -184,10 +246,10 @@ public int getSmoothnessMapUVFlip() { } } - return CatchSmoothnessMapUVFlip; + return CatchSpecularMapUVFlip; } - public int getSmoothnessMapSwizzle() { + public int getSpecularMapSwizzle() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -198,8 +260,8 @@ public int getSmoothnessMapSwizzle() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define SMOOTHNESS_MAP_SWIZZLE")) { - CatchSmoothnessMapSwizzle = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define SPECULAR_MAP_SWIZZLE")) { + CatchSpecularMapSwizzle = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -214,10 +276,10 @@ public int getSmoothnessMapSwizzle() { } } - return CatchSmoothnessMapSwizzle; + return CatchSpecularMapSwizzle; } - public int getSmoothnessMapApplyScale() { + public int getSpecularMapApplyScale() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -228,8 +290,8 @@ public int getSmoothnessMapApplyScale() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define SMOOTHNESS_MAP_APPLY_SCALE")) { - CatchSmoothnessMapApplyScale = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define SPECULAR_MAP_APPLY_SCALE")) { + CatchSpecularMapApplyScale = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -244,10 +306,10 @@ public int getSmoothnessMapApplyScale() { } } - return CatchSmoothnessMapApplyScale; + return CatchSpecularMapApplyScale; } - public String getSmoothnessMapFile() { + public String getSpecularMapFile() { BufferedReader AlbedotoEdit_Br = null; try { @@ -260,17 +322,17 @@ public String getSmoothnessMapFile() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define SMOOTHNESS_MAP_FILE")) { - CatchSmoothnessMapFile = ""; + if (s.contains("#define SPECULAR_MAP_FILE")) { + CatchSpecularMapFile = ""; for (int i = s.indexOf('"') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';') { } else { - CatchSmoothnessMapFile += s.charAt(i); + CatchSpecularMapFile += s.charAt(i); } } - CatchSmoothnessMapFile = CatchSmoothnessMapFile.replace("null", ""); + CatchSpecularMapFile = CatchSpecularMapFile.replace("null", ""); } s = AlbedotoEdit_Br.readLine(); } @@ -286,10 +348,10 @@ public String getSmoothnessMapFile() { } } - return CatchSmoothnessMapFile; + return CatchSpecularMapFile; } - public String getSmoothnessScale() { + public String getSpecularScale() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -300,7 +362,7 @@ public String getSmoothnessScale() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("smoothness ")) { + if (s.contains("specular ")) { String txt = ""; for (int i = s.indexOf('=') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';' || s.charAt(i) == ' ') { @@ -309,7 +371,7 @@ public String getSmoothnessScale() { txt += s.charAt(i); } } - CatchSmoothnessScale = (txt); + CatchSpecularScale = (txt); } s = AlbedotoEdit_Br.readLine(); @@ -326,10 +388,10 @@ public String getSmoothnessScale() { } } - return CatchSmoothnessScale; + return CatchSpecularScale; } - public float getSmoothnessLoop() { + public float getSpecularLoop() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -340,7 +402,7 @@ public float getSmoothnessLoop() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("smoothnessMapLoopNum =")) { + if (s.contains("specularMapLoopNum =")) { String txt = ""; for (int i = s.indexOf('=') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';' || s.charAt(i) == ' ') { @@ -349,7 +411,7 @@ public float getSmoothnessLoop() { txt += s.charAt(i); } } - CatchSmoothnessLoop = Float.parseFloat(txt); + CatchSpecularLoop = Float.parseFloat(txt); } s = AlbedotoEdit_Br.readLine(); } @@ -365,11 +427,11 @@ public float getSmoothnessLoop() { } } - return CatchSmoothnessLoop; + return CatchSpecularLoop; } - //Metalness - public int getMetalnessMapFrom() { + //Smoothness + public int getSmoothnessMapFrom() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -380,9 +442,9 @@ public int getMetalnessMapFrom() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define METALNESS_MAP_FROM")) { + if (s.contains("#define SMOOTHNESS_MAP_FROM")) { - CatchMetalnessMapFrom = Integer.parseInt(s.replaceAll("[\\D]", "")); + CatchSmoothnessMapFrom = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -398,10 +460,41 @@ public int getMetalnessMapFrom() { Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); } } - return CatchMetalnessMapFrom; + return CatchSmoothnessMapFrom; + } + + public int getSmoothnessMapType() { + BufferedReader AlbedotoEdit_Br = null; + try { + FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); + AlbedotoEdit_Br = new BufferedReader(AlbedotoEdit_fr); + + String s = ""; + + s = AlbedotoEdit_Br.readLine(); + + while (s != null) { + if (s.contains("#define SMOOTHNESS_MAP_TYPE")) { + CatchSpecularMapType = Integer.parseInt(s.replaceAll("[\\D]", "")); + } + s = AlbedotoEdit_Br.readLine(); + } + + } catch (FileNotFoundException ex) { + Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(WindowFrame.class.getName()).log(Level.SEVERE, null, ex); + } finally { + try { + AlbedotoEdit_Br.close(); + } catch (Exception e) { + + } + } + return CatchSpecularMapType; } - public int getMetalnessMapUVFlip() { + public int getSmoothnessMapUVFlip() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -412,8 +505,8 @@ public int getMetalnessMapUVFlip() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define METALNESS_MAP_UV_FLIP")) { - CatchMetalnessMapUVFlip = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define SMOOTHNESS_MAP_UV_FLIP")) { + CatchSmoothnessMapUVFlip = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -428,10 +521,10 @@ public int getMetalnessMapUVFlip() { } } - return CatchMetalnessMapUVFlip; + return CatchSmoothnessMapUVFlip; } - public int getMetalnessMapSwizzle() { + public int getSmoothnessMapSwizzle() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -442,8 +535,8 @@ public int getMetalnessMapSwizzle() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define METALNESS_MAP_SWIZZLE")) { - CatchMetalnessMapSwizzle = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define SMOOTHNESS_MAP_SWIZZLE")) { + CatchSmoothnessMapSwizzle = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -458,10 +551,10 @@ public int getMetalnessMapSwizzle() { } } - return CatchMetalnessMapSwizzle; + return CatchSmoothnessMapSwizzle; } - public int getMetalnessMapApplyScale() { + public int getSmoothnessMapApplyScale() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -472,8 +565,8 @@ public int getMetalnessMapApplyScale() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define METALNESS_MAP_APPLY_SCALE")) { - CatchMetalnessMapApplyScale = Integer.parseInt(s.replaceAll("[\\D]", "")); + if (s.contains("#define SMOOTHNESS_MAP_APPLY_SCALE")) { + CatchSmoothnessMapApplyScale = Integer.parseInt(s.replaceAll("[\\D]", "")); } s = AlbedotoEdit_Br.readLine(); } @@ -488,10 +581,10 @@ public int getMetalnessMapApplyScale() { } } - return CatchMetalnessMapApplyScale; + return CatchSmoothnessMapApplyScale; } - public String getMetalnessMapFile() { + public String getSmoothnessMapFile() { BufferedReader AlbedotoEdit_Br = null; try { @@ -504,17 +597,17 @@ public String getMetalnessMapFile() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("#define METALNESS_MAP_FILE")) { - CatchMetalnessMapFile = ""; + if (s.contains("#define SMOOTHNESS_MAP_FILE")) { + CatchSmoothnessMapFile = ""; for (int i = s.indexOf('"') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';') { } else { - CatchMetalnessMapFile += s.charAt(i); + CatchSmoothnessMapFile += s.charAt(i); } } - CatchMetalnessMapFile = CatchMetalnessMapFile.replace("null", ""); + CatchSmoothnessMapFile = CatchSmoothnessMapFile.replace("null", ""); } s = AlbedotoEdit_Br.readLine(); } @@ -530,10 +623,10 @@ public String getMetalnessMapFile() { } } - return CatchMetalnessMapFile; + return CatchSmoothnessMapFile; } - public String getMetalnessScale() { + public String getSmoothnessScale() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -544,7 +637,7 @@ public String getMetalnessScale() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("metalness =")) { + if (s.contains("smoothness =")) { String txt = ""; for (int i = s.indexOf('=') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';' || s.charAt(i) == ' ') { @@ -553,7 +646,7 @@ public String getMetalnessScale() { txt += s.charAt(i); } } - CatchMetalnessScale = (txt); + CatchSmoothnessScale = (txt); } s = AlbedotoEdit_Br.readLine(); @@ -570,10 +663,10 @@ public String getMetalnessScale() { } } - return CatchMetalnessScale; + return CatchSmoothnessScale; } - public float getMetalnessLoop() { + public float getSmoothnessLoop() { BufferedReader AlbedotoEdit_Br = null; try { FileReader AlbedotoEdit_fr = new FileReader(foo.getFilePath()); @@ -584,7 +677,7 @@ public float getMetalnessLoop() { s = AlbedotoEdit_Br.readLine(); while (s != null) { - if (s.contains("metalnessMapLoopNum =")) { + if (s.contains("smoothnessMapLoopNum")) { String txt = ""; for (int i = s.indexOf('=') + 1; i < s.length() - 1; i++) { if (s.charAt(i) == '"' || s.charAt(i) == ';' || s.charAt(i) == ' ') { @@ -593,7 +686,7 @@ public float getMetalnessLoop() { txt += s.charAt(i); } } - CatchMetalnessLoop = Float.parseFloat(txt); + CatchSmoothnessLoop = Float.parseFloat(txt); } s = AlbedotoEdit_Br.readLine(); } @@ -609,19 +702,19 @@ public float getMetalnessLoop() { } } - return CatchMetalnessLoop; + return CatchSmoothnessLoop; } /** * Creates new form WindowFrame */ - public SmoothnessAndMetalness() {//Constructor + public SpecularAndSmoothness() {//Constructor initComponents();//Generated by the GUI mostly - myInitComponents(); //Smoothness Loop - myInitComponents2(); //Metalness Loop - myInitComponents3(); //Smoothness Scale - myInitComponents4(); //Metalness Scale + myInitComponents(); //Specular Loop + myInitComponents2(); //Smoothness Loop + myInitComponents3(); //Specular Scale + myInitComponents4(); //Smoothness Scale } public void myInitComponents() { @@ -634,9 +727,9 @@ public void stateChanged(ChangeEvent e) { try { text.setText(df.format(slider.getScaledValue())); - SmoothnessLoop = text.getText(); - if (!slider.getValueIsAdjusting() && !SmoothnessLoop.equalsIgnoreCase(lastSmoothnessLoop)) { - lastSmoothnessLoop = SmoothnessLoop; + SpecularLoop = text.getText(); + if (!slider.getValueIsAdjusting() && !SpecularLoop.equalsIgnoreCase(lastSpecularLoop)) { + lastSpecularLoop = SpecularLoop; try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -645,7 +738,7 @@ public void stateChanged(ChangeEvent e) { String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("smoothnessMapLoopNum")) { + if (line.contains("specularMapLoopNum")) { String old = line; catchOld = line; //auxiliar line String aux = ""; @@ -654,15 +747,15 @@ public void stateChanged(ChangeEvent e) { } catchOld = aux; - if (SmoothnessLoop == null) { - SmoothnessLoop = String.valueOf(getSmoothnessLoop()); + if (SpecularLoop == null) { + SpecularLoop = String.valueOf(getSpecularLoop()); } - if (catchOld.equalsIgnoreCase(SmoothnessLoop)) { + if (catchOld.equalsIgnoreCase(SpecularLoop)) { line = old; } else { - SmoothnessLoop = SmoothnessLoop.replace(",", "."); - catchNew = SmoothnessLoop; //catchnewdigit - line = "const float smoothnessMapLoopNum = " + catchNew + ';'; + SpecularLoop = SpecularLoop.replace(",", "."); + catchNew = SpecularLoop; //catchnewdigit + line = "const float2 specularMapLoopNum = " + catchNew + ';'; } } oldtext += line + "\r\n"; @@ -696,12 +789,12 @@ public void keyReleased(KeyEvent ke } double value = Double.parseDouble(typed) * slider.scale; slider.setValue((int) value); - SmoothnessLoop = text.getText(); + SpecularLoop = text.getText(); } } ); float catchvalue; - catchvalue = Float.parseFloat("" + getSmoothnessLoop()) * slider.scale; + catchvalue = Float.parseFloat("" + getSpecularLoop()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); @@ -722,7 +815,7 @@ public void myInitComponents2() { final DoubleJSlider slider = new DoubleJSlider(-6400, 6400, 0, 100); float catchvalue; - catchvalue = Float.parseFloat("" + getMetalnessLoop()) * slider.scale; + catchvalue = Float.parseFloat("" + getSmoothnessLoop()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); slider.setBounds(497, 390, 200, 30); @@ -738,9 +831,9 @@ public void stateChanged(ChangeEvent e) { try { text.setText(df.format(slider.getScaledValue())); - MetalnessLoop = text.getText(); - if (!slider.getValueIsAdjusting() && !MetalnessLoop.equalsIgnoreCase(lastMetalnessLoop)) { - lastMetalnessLoop = MetalnessLoop; + SmoothnessLoop = text.getText(); + if (!slider.getValueIsAdjusting() && !SmoothnessLoop.equalsIgnoreCase(lastSmoothnessLoop)) { + lastSmoothnessLoop = SmoothnessLoop; try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -749,7 +842,7 @@ public void stateChanged(ChangeEvent e) { String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("metalnessMapLoopNum")) { + if (line.contains("smoothnessMapLoopNum")) { String old = line; catchOld = line; //auxiliar line String aux = ""; @@ -758,15 +851,15 @@ public void stateChanged(ChangeEvent e) { } catchOld = aux; - if (MetalnessLoop == null) { - MetalnessLoop = String.valueOf(getMetalnessLoop()); + if (SmoothnessLoop == null) { + SmoothnessLoop = String.valueOf(getSmoothnessLoop()); } - if (catchOld.equalsIgnoreCase(MetalnessLoop)) { + if (catchOld.equalsIgnoreCase(SmoothnessLoop)) { line = old; } else { - MetalnessLoop = MetalnessLoop.replace(",", "."); - catchNew = MetalnessLoop; //catchnewdigit - line = "const float metalnessMapLoopNum = " + catchNew + ';'; + SmoothnessLoop = SmoothnessLoop.replace(",", "."); + catchNew = SmoothnessLoop; //catchnewdigit + line = "const float smoothnessMapLoopNum = " + catchNew + ';'; } } oldtext += line + "\r\n"; @@ -798,7 +891,7 @@ public void keyReleased(KeyEvent ke) { } double value = Double.parseDouble(typed) * slider.scale; slider.setValue((int) value); - MetalnessLoop = text.getText(); + SmoothnessLoop = text.getText(); } }); @@ -811,13 +904,13 @@ public void myInitComponents3() { final DoubleJSlider slider = new DoubleJSlider(0, 100, 0, 100); float catchvalue; - catchvalue = Float.parseFloat("" + getSmoothnessScale()) * slider.scale; + catchvalue = Float.parseFloat("" + getSpecularScale()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); - slider.setBounds(48, 328, 200, 30); + slider.setBounds(48, 326, 200, 30); slider.setPaintTicks(true); slider.setValue((int) catchvalue); - text.setBounds(256, 328, 50, 20); + text.setBounds(256, 326, 50, 20); add(text); add(slider); @@ -828,9 +921,9 @@ public void stateChanged(ChangeEvent e) { try { text.setText(df.format(slider.getScaledValue())); - SmoothnessScale = text.getText(); - if (!slider.getValueIsAdjusting() && !SmoothnessScale.equalsIgnoreCase(lastSmoothnessScale)) { - lastSmoothnessScale = SmoothnessScale; + SpecularScale = text.getText(); + if (!slider.getValueIsAdjusting() && !SpecularScale.equalsIgnoreCase(lastSpecularScale)) { + lastSpecularScale = SpecularScale; try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -839,7 +932,7 @@ public void stateChanged(ChangeEvent e) { String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("float smoothness ")) { + if (line.contains("float3 specular")) { String old = line; catchOld = line; //auxiliar line String aux = ""; @@ -848,15 +941,15 @@ public void stateChanged(ChangeEvent e) { } catchOld = aux; - if (SmoothnessScale == null) { - SmoothnessScale = getSmoothnessScale(); + if (SpecularScale == null) { + SpecularScale = getSpecularScale(); } - if (catchOld.equalsIgnoreCase(SmoothnessScale)) { + if (catchOld.equalsIgnoreCase(SpecularScale)) { line = old; } else { - SmoothnessScale = SmoothnessScale.replace(",", "."); - catchNew = SmoothnessScale; //catchnewdigit - line = "const float smoothness = " + catchNew + ';'; + SpecularScale = SpecularScale.replace(",", "."); + catchNew = SpecularScale; //catchnewdigit + line = "const float3 specular = " + catchNew + ';'; } } oldtext += line + "\r\n"; @@ -888,7 +981,7 @@ public void keyReleased(KeyEvent ke) { } double value = Double.parseDouble(typed) * slider.scale; slider.setValue((int) value); - SmoothnessScale = text.getText(); + SpecularScale = text.getText(); } }); @@ -901,10 +994,10 @@ public void myInitComponents4() { final DoubleJSlider slider = new DoubleJSlider(0, 100, 0, 100); float catchvalue; - catchvalue = Float.parseFloat("" + getMetalnessScale()) * slider.scale; + catchvalue = Float.parseFloat("" + getSmoothnessScale()) * slider.scale; slider.setPaintTrack(true); slider.setPaintLabels(true); - slider.setBounds(497,325, 200, 30); + slider.setBounds(497, 325, 200, 30); slider.setPaintTicks(true); slider.setValue((int) catchvalue); text.setBounds(703, 325, 50, 20); @@ -918,10 +1011,10 @@ public void stateChanged(ChangeEvent e) { try { text.setText(df.format(slider.getScaledValue())); - MetalnessScale = text.getText(); + SmoothnessScale = text.getText(); - if (!slider.getValueIsAdjusting() && !MetalnessScale.equalsIgnoreCase(lastMetalnessScale)) { - lastMetalnessScale = MetalnessScale; + if (!slider.getValueIsAdjusting() && !SmoothnessScale.equalsIgnoreCase(lastSmoothnessScale)) { + lastSmoothnessScale = SmoothnessScale; try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -930,7 +1023,7 @@ public void stateChanged(ChangeEvent e) { String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("metalness =")) { + if (line.contains("smoothness =")) { String old = line; catchOld = line; //auxiliar line String aux = ""; @@ -939,16 +1032,16 @@ public void stateChanged(ChangeEvent e) { } catchOld = aux; - if (MetalnessScale == null) { - MetalnessScale = getMetalnessScale(); + if (SmoothnessScale == null) { + SmoothnessScale = getSmoothnessScale(); } - if (catchOld.equalsIgnoreCase(MetalnessScale)) { + if (catchOld.equalsIgnoreCase(SmoothnessScale)) { line = old; } else { - MetalnessScale = MetalnessScale.replace(",", "."); - catchNew = MetalnessScale; //catchnewdigit - line = "const float metalness = " + catchNew + ';'; + SmoothnessScale = SmoothnessScale.replace(",", "."); + catchNew = SmoothnessScale; //catchnewdigit + line = "const float smoothness = " + catchNew + ';'; } } oldtext += line + "\r\n"; @@ -980,7 +1073,7 @@ public void keyReleased(KeyEvent ke) { } double value = Double.parseDouble(typed) * slider.scale; slider.setValue((int) value); - MetalnessScale = text.getText(); + SmoothnessScale = text.getText(); } }); @@ -1011,77 +1104,88 @@ private void initComponents() { jMenu1 = new javax.swing.JMenu(); jLabel1 = new javax.swing.JLabel(); - SmoothnessMapFrom = new javax.swing.JComboBox<>(); + SpecularMapFrom = new javax.swing.JComboBox<>(); jLabel2 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); changeFile = new javax.swing.JButton(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); - SmoothnessMapUVFlip = new javax.swing.JComboBox<>(); + SpecularMapUVFlip = new javax.swing.JComboBox<>(); AlbedoMapHelp = new javax.swing.JButton(); AlbedoMapUVFlipHelp = new javax.swing.JButton(); AlbedoMapFileHelp = new javax.swing.JButton(); albedoHelp = new javax.swing.JButton(); AlbedoMapLoopHelp = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); - SmoothnessMapType = new javax.swing.JComboBox<>(); + SpecularMapType = new javax.swing.JComboBox<>(); AlbedoMapHelp3 = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); - SmoothnessMapSwizzle = new javax.swing.JComboBox<>(); - SmoothnessMapApplyScale = new javax.swing.JComboBox<>(); + SpecularMapSwizzle = new javax.swing.JComboBox<>(); + SpecularMapApplyScale = new javax.swing.JComboBox<>(); AlbedoMapUVFlipHelp1 = new javax.swing.JButton(); AlbedoMapUVFlipHelp2 = new javax.swing.JButton(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); - MetalnessMapUVFlip = new javax.swing.JComboBox<>(); + SmoothnessMapUVFlip = new javax.swing.JComboBox<>(); AlbedoMapHelp1 = new javax.swing.JButton(); AlbedoMapUVFlipHelp3 = new javax.swing.JButton(); AlbedoMapFileHelp1 = new javax.swing.JButton(); albedoHelp1 = new javax.swing.JButton(); AlbedoMapLoopHelp1 = new javax.swing.JButton(); jLabel12 = new javax.swing.JLabel(); - MetalnessMapFrom = new javax.swing.JComboBox<>(); + SmoothnessMapFrom = new javax.swing.JComboBox<>(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); changeFile1 = new javax.swing.JButton(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); - MetalnessMapSwizzle = new javax.swing.JComboBox<>(); - MetalnessMapApplyScale = new javax.swing.JComboBox<>(); + SmoothnessMapSwizzle = new javax.swing.JComboBox<>(); + SmoothnessMapApplyScale = new javax.swing.JComboBox<>(); AlbedoMapUVFlipHelp4 = new javax.swing.JButton(); AlbedoMapUVFlipHelp5 = new javax.swing.JButton(); + SpecularMapFile = new javax.swing.JTextField(); SmoothnessMapFile = new javax.swing.JTextField(); - MetalnessMapFile = new javax.swing.JTextField(); back1 = new javax.swing.JButton(); + jLabel17 = new javax.swing.JLabel(); + SmoothnessMapType = new javax.swing.JComboBox<>(); + AlbedoMapHelp4 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); + jButton5 = new javax.swing.JButton(); jMenu1.setText("jMenu1"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setTitle("Edit Smoothness and Metalness"); + setTitle("Edit Specular and Smoothness"); setAutoRequestFocus(false); setResizable(false); setSize(new java.awt.Dimension(960, 540)); - jLabel1.setText("SMOOTHNESS MAP FROM"); + jLabel1.setText("SPECULAR MAP FROM"); - SmoothnessMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" })); - SmoothnessMapFrom.setSelectedIndex(getSmoothnessMapFrom()); - SmoothnessMapFrom.setToolTipText(""); - SmoothnessMapFrom.addItemListener(new java.awt.event.ItemListener() { + SpecularMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8" })); + try{ + SpecularMapFrom.setSelectedIndex(getSpecularMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + SpecularMapFrom.setToolTipText(""); + SpecularMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - SmoothnessMapFromItemStateChanged(evt); + SpecularMapFromItemStateChanged(evt); } }); - SmoothnessMapFrom.addActionListener(new java.awt.event.ActionListener() { + SpecularMapFrom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - SmoothnessMapFromActionPerformed(evt); + SpecularMapFromActionPerformed(evt); } }); - jLabel2.setText("SMOOTHNESS MAP UV FLIP"); + jLabel2.setText("SPECULAR MAP UV FLIP"); - jLabel6.setText("SMOOTHNESS MAP FILE"); + jLabel6.setText("SPECULAR MAP FILE"); changeFile.setText("..."); changeFile.addChangeListener(new javax.swing.event.ChangeListener() { @@ -1095,20 +1199,25 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel8.setText("SMOOTHNESS MAP SCALE"); + jLabel8.setText("SPECULAR MAP SCALE"); - jLabel9.setText("SMOOTHNESS MAP LOOP"); + jLabel9.setText("SPECULAR MAP LOOP"); - SmoothnessMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - SmoothnessMapUVFlip.setSelectedIndex(getSmoothnessMapUVFlip()); - SmoothnessMapUVFlip.addItemListener(new java.awt.event.ItemListener() { + SpecularMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); + try{ + SpecularMapUVFlip.setSelectedIndex(getSpecularMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + SpecularMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - SmoothnessMapUVFlipItemStateChanged(evt); + SpecularMapUVFlipItemStateChanged(evt); } }); - SmoothnessMapUVFlip.addActionListener(new java.awt.event.ActionListener() { + SpecularMapUVFlip.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - SmoothnessMapUVFlipActionPerformed(evt); + SpecularMapUVFlipActionPerformed(evt); } }); @@ -1147,19 +1256,24 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel3.setText("SMOOTHNESS MAP TYPE"); + jLabel3.setText("SPECULAR MAP TYPE"); - SmoothnessMapType.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); - SmoothnessMapType.setSelectedIndex(getSmoothnessMapType()); - SmoothnessMapType.setToolTipText(""); - SmoothnessMapType.addItemListener(new java.awt.event.ItemListener() { + SpecularMapType.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4" })); + try{ + SpecularMapType.setSelectedIndex(getSpecularMapType()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + SpecularMapType.setToolTipText(""); + SpecularMapType.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - SmoothnessMapTypeItemStateChanged(evt); + SpecularMapTypeItemStateChanged(evt); } }); - SmoothnessMapType.addActionListener(new java.awt.event.ActionListener() { + SpecularMapType.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - SmoothnessMapTypeActionPerformed(evt); + SpecularMapTypeActionPerformed(evt); } }); @@ -1170,33 +1284,43 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel4.setText("SMOOTHNESS MAP SWIZZLE"); + jLabel4.setText("SPECULAR MAP SWIZZLE"); - jLabel5.setText("SMOOTHNESS MAP APPLY SCALE"); + jLabel5.setText("SPECULAR MAP APPLY SCALE"); - SmoothnessMapSwizzle.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - SmoothnessMapSwizzle.setSelectedIndex(getSmoothnessMapSwizzle()); - SmoothnessMapSwizzle.addItemListener(new java.awt.event.ItemListener() { + SpecularMapSwizzle.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); + try{ + SpecularMapSwizzle.setSelectedIndex(getSpecularMapSwizzle()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + SpecularMapSwizzle.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - SmoothnessMapSwizzleItemStateChanged(evt); + SpecularMapSwizzleItemStateChanged(evt); } }); - SmoothnessMapSwizzle.addActionListener(new java.awt.event.ActionListener() { + SpecularMapSwizzle.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - SmoothnessMapSwizzleActionPerformed(evt); + SpecularMapSwizzleActionPerformed(evt); } }); - SmoothnessMapApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); - SmoothnessMapApplyScale.setSelectedIndex(getSmoothnessMapUVFlip()); - SmoothnessMapApplyScale.addItemListener(new java.awt.event.ItemListener() { + SpecularMapApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); + try{ + SpecularMapApplyScale.setSelectedIndex(getSpecularMapApplyScale()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + SpecularMapApplyScale.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - SmoothnessMapApplyScaleItemStateChanged(evt); + SpecularMapApplyScaleItemStateChanged(evt); } }); - SmoothnessMapApplyScale.addActionListener(new java.awt.event.ActionListener() { + SpecularMapApplyScale.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - SmoothnessMapApplyScaleActionPerformed(evt); + SpecularMapApplyScaleActionPerformed(evt); } }); @@ -1214,20 +1338,25 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel10.setText("METALNESS MAP SCALE"); + jLabel10.setText("SMOOTHNESS MAP SCALE"); - jLabel11.setText("METALNESS MAP LOOP"); + jLabel11.setText("SMOOTHNESS MAP LOOP"); - MetalnessMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - MetalnessMapUVFlip.setSelectedIndex(getSmoothnessMapUVFlip()); - MetalnessMapUVFlip.addItemListener(new java.awt.event.ItemListener() { + SmoothnessMapUVFlip.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); + try{ + SmoothnessMapUVFlip.setSelectedIndex(getSmoothnessMapUVFlip()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + SmoothnessMapUVFlip.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - MetalnessMapUVFlipItemStateChanged(evt); + SmoothnessMapUVFlipItemStateChanged(evt); } }); - MetalnessMapUVFlip.addActionListener(new java.awt.event.ActionListener() { + SmoothnessMapUVFlip.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MetalnessMapUVFlipActionPerformed(evt); + SmoothnessMapUVFlipActionPerformed(evt); } }); @@ -1266,25 +1395,30 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel12.setText("METALNESS MAP FROM"); + jLabel12.setText("SMOOTHNESS MAP FROM"); - MetalnessMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" })); - MetalnessMapFrom.setSelectedIndex(getSmoothnessMapFrom()); - MetalnessMapFrom.setToolTipText(""); - MetalnessMapFrom.addItemListener(new java.awt.event.ItemListener() { + SmoothnessMapFrom.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" })); + try{ + SmoothnessMapFrom.setSelectedIndex(getSmoothnessMapFrom()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + SmoothnessMapFrom.setToolTipText(""); + SmoothnessMapFrom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - MetalnessMapFromItemStateChanged(evt); + SmoothnessMapFromItemStateChanged(evt); } }); - MetalnessMapFrom.addActionListener(new java.awt.event.ActionListener() { + SmoothnessMapFrom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MetalnessMapFromActionPerformed(evt); + SmoothnessMapFromActionPerformed(evt); } }); - jLabel13.setText("METALNESS MAP UV FLIP"); + jLabel13.setText("SMOOTHNESS MAP UV FLIP"); - jLabel14.setText("METALNESS MAP FILE"); + jLabel14.setText("SMOOTHNESS MAP FILE"); changeFile1.setText("..."); changeFile1.addChangeListener(new javax.swing.event.ChangeListener() { @@ -1298,33 +1432,43 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel15.setText("METALNESS MAP SWIZZLE"); + jLabel15.setText("SMOOTHNESS MAP SWIZZLE"); - jLabel16.setText("METALNESS MAP APPLY SCALE"); + jLabel16.setText("SMOOTHNESS MAP APPLY SCALE"); - MetalnessMapSwizzle.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); - MetalnessMapSwizzle.setSelectedIndex(getSmoothnessMapSwizzle()); - MetalnessMapSwizzle.addItemListener(new java.awt.event.ItemListener() { + SmoothnessMapSwizzle.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3" })); + try{ + SmoothnessMapSwizzle.setSelectedIndex(getSmoothnessMapSwizzle()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + SmoothnessMapSwizzle.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - MetalnessMapSwizzleItemStateChanged(evt); + SmoothnessMapSwizzleItemStateChanged(evt); } }); - MetalnessMapSwizzle.addActionListener(new java.awt.event.ActionListener() { + SmoothnessMapSwizzle.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MetalnessMapSwizzleActionPerformed(evt); + SmoothnessMapSwizzleActionPerformed(evt); } }); - MetalnessMapApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); - MetalnessMapApplyScale.setSelectedIndex(getSmoothnessMapUVFlip()); - MetalnessMapApplyScale.addItemListener(new java.awt.event.ItemListener() { + SmoothnessMapApplyScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); + try{ + SmoothnessMapApplyScale.setSelectedIndex(getSmoothnessMapApplyScale()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + SmoothnessMapApplyScale.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - MetalnessMapApplyScaleItemStateChanged(evt); + SmoothnessMapApplyScaleItemStateChanged(evt); } }); - MetalnessMapApplyScale.addActionListener(new java.awt.event.ActionListener() { + SmoothnessMapApplyScale.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MetalnessMapApplyScaleActionPerformed(evt); + SmoothnessMapApplyScaleActionPerformed(evt); } }); @@ -1342,9 +1486,21 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - SmoothnessMapFile.setText(getSmoothnessMapFile()); + try{ + SpecularMapFile.setEditable(false); + SpecularMapFile.setText(getSpecularMapFile()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } - MetalnessMapFile.setText(getMetalnessMapFile()); + try{ + SmoothnessMapFile.setEditable(false); + SmoothnessMapFile.setText(getSmoothnessMapFile()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } back1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bg/back.png"))); // NOI18N back1.setBorder(null); @@ -1355,6 +1511,59 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); + jLabel17.setText("SMOOTHNESS MAP TYPE"); + + SmoothnessMapType.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2" })); + try{ + SmoothnessMapType.setSelectedIndex(getSmoothnessMapType()); + }catch(Exception e){ + errors+=1; + SomethingWentWrong(); + } + SmoothnessMapType.setToolTipText(""); + SmoothnessMapType.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent evt) { + SmoothnessMapTypeItemStateChanged(evt); + } + }); + SmoothnessMapType.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + SmoothnessMapTypeActionPerformed(evt); + } + }); + + AlbedoMapHelp4.setText("Help"); + AlbedoMapHelp4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + AlbedoMapHelp4ActionPerformed(evt); + } + }); + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bg/tip.png"))); // NOI18N + jButton2.setBorder(null); + jButton2.setBorderPainted(false); + jButton2.setContentAreaFilled(false); + jButton2.setDefaultCapable(false); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + jButton4.setText("Preview"); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); + + jButton5.setText("Preview"); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -1365,11 +1574,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SmoothnessMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 120, Short.MAX_VALUE) - .addComponent(changeFile, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 139, Short.MAX_VALUE) + .addComponent(changeFile, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() @@ -1379,8 +1586,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(albedoHelp))) - .addGap(0, 0, Short.MAX_VALUE))) + .addComponent(albedoHelp)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(SpecularMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton4))) + .addGap(0, 123, Short.MAX_VALUE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(AlbedoMapFileHelp)) .addGroup(layout.createSequentialGroup() @@ -1389,16 +1600,19 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(back1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(back1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(95, 95, 95) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(SmoothnessMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SmoothnessMapType, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addComponent(SmoothnessMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SmoothnessMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SmoothnessMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(SpecularMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(SpecularMapType, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(SpecularMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(SpecularMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(SpecularMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -1410,118 +1624,131 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(AlbedoMapUVFlipHelp2)))) .addGap(54, 54, 54) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(albedoHelp1) + .addGap(1, 1, 1)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(AlbedoMapLoopHelp1))) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(SmoothnessMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton5)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(SmoothnessMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() - .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(changeFile1, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(AlbedoMapFileHelp1)) + .addComponent(SmoothnessMapType, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(95, 95, 95) - .addComponent(MetalnessMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(MetalnessMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(MetalnessMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(MetalnessMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(AlbedoMapHelp1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(AlbedoMapUVFlipHelp3) - .addComponent(AlbedoMapUVFlipHelp4) - .addComponent(AlbedoMapUVFlipHelp5)))) - .addGap(53, 53, 53)) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(albedoHelp1) - .addGap(1, 1, 1)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(AlbedoMapLoopHelp1))) - .addComponent(MetalnessMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(SmoothnessMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(SmoothnessMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(changeFile1, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, Short.MAX_VALUE) + .addComponent(SmoothnessMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(AlbedoMapHelp1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(AlbedoMapUVFlipHelp3) + .addComponent(AlbedoMapUVFlipHelp4) + .addComponent(AlbedoMapUVFlipHelp5) + .addComponent(AlbedoMapFileHelp1) + .addComponent(AlbedoMapHelp4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addGap(53, 57, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addGap(12, 12, 12) - .addComponent(back1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(40, 40, 40) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SmoothnessMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapHelp) - .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(MetalnessMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapHelp1))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() + .addGap(12, 12, 12) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(back1, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE) + .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(31, 31, 31) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(MetalnessMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapUVFlipHelp3)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(MetalnessMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapUVFlipHelp5)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(SmoothnessMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapHelp1))) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(89, 89, 89) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(MetalnessMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapUVFlipHelp4)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(changeFile1) - .addComponent(AlbedoMapFileHelp1)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(MetalnessMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(SpecularMapFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapHelp) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addGap(6, 6, 6) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(SmoothnessMapType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapHelp3)) + .addComponent(SmoothnessMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton5))) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(SpecularMapType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapHelp3) + .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(SmoothnessMapType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapHelp4))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(SpecularMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapUVFlipHelp) .addComponent(SmoothnessMapUVFlip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapUVFlipHelp)) + .addComponent(AlbedoMapUVFlipHelp3) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(SpecularMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapUVFlipHelp2) .addComponent(SmoothnessMapSwizzle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapUVFlipHelp2)) + .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapUVFlipHelp5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(SpecularMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AlbedoMapUVFlipHelp1) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(SmoothnessMapApplyScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(AlbedoMapUVFlipHelp1)) + .addComponent(AlbedoMapUVFlipHelp4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(changeFile) - .addComponent(AlbedoMapFileHelp)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(SmoothnessMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(AlbedoMapFileHelp) + .addComponent(changeFile1) + .addComponent(AlbedoMapFileHelp1)) + .addGap(0, 0, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(SpecularMapFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton4)))) + .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -1545,20 +1772,20 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pack(); }// //GEN-END:initComponents - private void SmoothnessMapFromActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SmoothnessMapFromActionPerformed + private void SpecularMapFromActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SpecularMapFromActionPerformed - }//GEN-LAST:event_SmoothnessMapFromActionPerformed + }//GEN-LAST:event_SpecularMapFromActionPerformed - private void SmoothnessMapUVFlipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SmoothnessMapUVFlipActionPerformed + private void SpecularMapUVFlipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SpecularMapUVFlipActionPerformed - }//GEN-LAST:event_SmoothnessMapUVFlipActionPerformed + }//GEN-LAST:event_SpecularMapUVFlipActionPerformed private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeFileActionPerformed JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new java.io.File("../../Materials"));//The directory we are looking for is the Materials folder from ray - fileChooser.setDialogTitle("Choose new Smoothness Map File"); + fileChooser.setDialogTitle("Choose new Specular Map File"); //Filtering by ImageFiles FileFilter imageFilter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "bmp", "tga", "targa", "dds", "tif", "tiff", "jpeg", "pcd"); fileChooser.setFileFilter(imageFilter); @@ -1570,9 +1797,9 @@ private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI if (selection == 0) { String relative = toRelative.convertToRelativePath(foo.getFileToEdit().getParent(), filePath); - SmoothnessMapFile.setText(relative); - if (SmoothnessMapFrom.getSelectedIndex() != 1) { - SmoothnessMapFrom.setSelectedIndex(1); + SpecularMapFile.setText(relative); + if (SpecularMapFrom.getSelectedIndex() != 1) { + SpecularMapFrom.setSelectedIndex(1); } try { @@ -1583,16 +1810,16 @@ private void changeFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define SMOOTHNESS_MAP_FILE")) { + if (line.contains("#define SPECULAR_MAP_FILE")) { catchOld = line; //auxiliar line String aux = ""; for (int i = catchOld.indexOf('"') + 1; i < line.length() - 1; i++) { aux += catchOld.charAt(i); } catchOld = aux; - if (!catchOld.equalsIgnoreCase(SmoothnessMapFile.getText())) { - catchNew = SmoothnessMapFile.getText(); //catchnewdigit - line = "#define SMOOTHNESS_MAP_FILE " + '"' + catchNew + '"'; + if (!catchOld.equalsIgnoreCase(SpecularMapFile.getText())) { + catchNew = SpecularMapFile.getText(); //catchnewdigit + line = "#define SPECULAR_MAP_FILE " + '"' + catchNew + '"'; } } oldtext += line + "\r\n"; @@ -1620,10 +1847,9 @@ private void changeFileStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); - + AlbedoMapHelp.setName("help"); AlbedoMapHelpText.setText("
    You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

    " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
    " + "Tips 2 : Do not enter a path with HDR file, that will be ignore the HDR and linear color-space
    " @@ -1637,15 +1863,15 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN + "
  • 5 : Params fetch from Toon map from the pmx.

  • " + "
  • 6 : Params fetch from avi/screen from the DummyScreen.x inside extension folder.

  • " + "
  • 7 : Params fetch from Ambient Color from the pmx.

  • " - + "
  • 8 : Params fetch from Smoothness Color from the pmx.

  • " - + "
  • 9 : Params fetch from Smoothness Power from the pmx. (this option can only be used for smoothness)


  • "); + + "
  • 8 : Params fetch from Specular Color from the pmx.

  • " + + "
  • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular), doesn't work on Specular


  • "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); - AlbedoMapHelp.setTitle("Smoothness Map From Help"); + AlbedoMapHelp.setTitle("Specular Map From Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1658,21 +1884,20 @@ private void AlbedoMapHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); - help.setTitle("Smoothness Map UV Flip Help"); + help.setTitle("Specular Map UV Flip Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1685,10 +1910,9 @@ private void AlbedoMapUVFlipHelpActionPerformed(java.awt.event.ActionEvent evt) private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " + "For example :
    " @@ -1701,13 +1925,13 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Smoothness Map File Help"); + help.setTitle("Specular Map File Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1719,76 +1943,79 @@ private void AlbedoMapFileHelpActionPerformed(java.awt.event.ActionEvent evt) {/ }//GEN-LAST:event_AlbedoMapFileHelpActionPerformed private void albedoHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoHelpActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - - helptext.setText("between 0 ~ 1"); + help.setName("help"); + helptext.setText("Default value is 0.5

    " + + "Notice : Anything less than 2% is physically impossible and is instead considered to be shadowing

    " + + "For example: The reflectance coefficient is equal to F(x) = (x - 1)^2 / (x + 1)^2
    " + + "Consider light that is incident upon a transparent medium with a refractive index of 1.5

    " + + "That result will be equal to (1.5 - 1)^2 / (1.5 + 1)^2 = 0.04 (or 4%).
    " + + "Specular to reflection coefficient is equal to F(x) = 0.08*x, if the x is equal to 0.5 the result will be 0.04.
    " + + "So default value is 0.5 for 0.04 coeff.


    " + + "between 0 ~ 1"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Smoothness Map Scale Help"); + help.setTitle("Specular Map Scale Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); BufferedImage myImg = ImageIO.read(imgStream); help.setIconImage(myImg); } catch (IOException ex) { - System.out.println("" + ex); } }//GEN-LAST:event_albedoHelpActionPerformed private void AlbedoMapLoopHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelpActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Smoothness Map Loop Help"); + help.setTitle("Specular Map Loop Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); BufferedImage myImg = ImageIO.read(imgStream); help.setIconImage(myImg); } catch (IOException ex) { - System.out.println("" + ex); } }//GEN-LAST:event_AlbedoMapLoopHelpActionPerformed - private void SmoothnessMapTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SmoothnessMapTypeActionPerformed + private void SpecularMapTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SpecularMapTypeActionPerformed - }//GEN-LAST:event_SmoothnessMapTypeActionPerformed + }//GEN-LAST:event_SpecularMapTypeActionPerformed private void AlbedoMapHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp3ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - - helptext.setText("
    • 0 : Smoothness (from Frostbite / CE5 textures)
    • " - + "
    • 1 : Calculate smoothness from roughness by 1.0 - Roughness ^ 0.5 (from UE4/GGX/SubstancePainter2 textures)
    • " - + "
    • 2 : Calculate smoothness from roughness by 1.0 - Roughness (from UE4/GGX/SubstancePainter2 with roughness linear roughness)
    "); + help.setName("help"); + helptext.setText("
    • 0 : Calculate reflection coefficient from specular color by F(x) = 0.08*(x ) (from UE4 textures)
    • " + + "
    • 1 : Calculate reflection coefficient from specular color by F(x) = 0.16*(x^2) (from Frostbite textures)
    • " + + "
    • 2 : Calculate reflection coefficient from specular grays by F(x) = 0.08*(x ) (from UE4 textures)
    • " + + "
    • 3 : Calculate reflection coefficient from specular grays by F(x) = 0.16*(x^2) (from Frostbite textures)
    • " + + "
    • 4 : Using reflection coefficient (0.04) instead of specular value (0.5), Available when SPECULAR_MAP_FROM at 0
    • "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Smoothness Map Type Help"); + help.setTitle("Specular Map Type Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1799,31 +2026,30 @@ private void AlbedoMapHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GE } }//GEN-LAST:event_AlbedoMapHelp3ActionPerformed - private void SmoothnessMapSwizzleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SmoothnessMapSwizzleActionPerformed + private void SpecularMapSwizzleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SpecularMapSwizzleActionPerformed - }//GEN-LAST:event_SmoothnessMapSwizzleActionPerformed + }//GEN-LAST:event_SpecularMapSwizzleActionPerformed - private void SmoothnessMapApplyScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SmoothnessMapApplyScaleActionPerformed + private void SpecularMapApplyScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SpecularMapApplyScaleActionPerformed - }//GEN-LAST:event_SmoothnessMapApplyScaleActionPerformed + }//GEN-LAST:event_SpecularMapApplyScaleActionPerformed private void AlbedoMapUVFlipHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("
      You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE


      " - + "
      • 1 : map values * albedo;
      • " - + "
      • 2 : map values ^ albedo;
      • " + + "
        • 1 : map values * albedo;
        • " + + "
        • 2 : map values ^ albedo;
        • " + "
        "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); - help.setTitle("Smoothness Map Apply Scale Help"); + help.setTitle("Specular Map Apply Scale Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1836,19 +2062,18 @@ private void AlbedoMapUVFlipHelp1ActionPerformed(java.awt.event.ActionEvent evt) private void AlbedoMapUVFlipHelp2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp2ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("The ordering of the data fetched from a texture from the code. (R = 0, G = 1, B = 2, A = 3)"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Smoothness Map Swizzle Help"); + help.setTitle("Specular Map Swizzle Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1859,17 +2084,16 @@ private void AlbedoMapUVFlipHelp2ActionPerformed(java.awt.event.ActionEvent evt) } }//GEN-LAST:event_AlbedoMapUVFlipHelp2ActionPerformed - private void MetalnessMapUVFlipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MetalnessMapUVFlipActionPerformed + private void SmoothnessMapUVFlipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SmoothnessMapUVFlipActionPerformed - }//GEN-LAST:event_MetalnessMapUVFlipActionPerformed + }//GEN-LAST:event_SmoothnessMapUVFlipActionPerformed private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp1ActionPerformed - - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame AlbedoMapHelp = new JFrame(); JLabel AlbedoMapHelpText = new JLabel(); - - AlbedoMapHelpText.setText("
        You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

        " + AlbedoMapHelp.setName("help"); + AlbedoMapHelpText.setText("
        Default data will fetch params from the SpecularPower and convert the SpecularPower to smoothness." + + "


        You can use a color and texture to change colors in your model by set the code to the ALBEDO_MAP_FROM.

        " + "Tips 1 : The albedo is also called Base Color, default data will fetched params from texture from the pmx.
        " + "Tips 2 : Do not enter a path with HDR file, that will be ignore the HDR and linear color-space
        " + "Tips 3 : These files (bmp, png, jpg, tga, dds, gif, apng) must be working in a sRGB color-space
        " @@ -1882,15 +2106,15 @@ private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GE + "
      • 5 : Params fetch from Toon map from the pmx.

      • " + "
      • 6 : Params fetch from avi/screen from the DummyScreen.x inside extension folder.

      • " + "
      • 7 : Params fetch from Ambient Color from the pmx.

      • " - + "
      • 8 : Params fetch from Smoothness Color from the pmx.

      • " - + "
      • 9 : Params fetch from Smoothness Power from the pmx. (this option can only be used for smoothness)


      "); + + "
    • 8 : Params fetch from Specular Color from the pmx.

    • " + + "
    • 9 : Params fetch from Specular Power from the pmx. (this option can only be used for specular)


    "); AlbedoMapHelp.setLayout(new BorderLayout()); - AlbedoMapHelp.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); AlbedoMapHelp.setResizable(true); AlbedoMapHelp.setVisible(true); AlbedoMapHelp.add(AlbedoMapHelpText); - AlbedoMapHelp.setTitle("Metalness Map From Help"); + AlbedoMapHelp.setTitle("Smoothness Map From Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1903,21 +2127,21 @@ private void AlbedoMapHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GE private void AlbedoMapUVFlipHelp3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp3ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("
    You can flip your texture for the X and Y axis mirror by set code to the ALBEDO_MAP_UV_FLIP


    " + "
    • 1 : Flip axis x
    • " + "
    • 2 : Flip axis y
    • " + "
    • 3 : Flip axis x & y
    "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); + help.setResizable(true); help.setVisible(true); help.add(helptext); - help.setTitle("Metalness Map UV Flip Help"); + help.setTitle("Smoothness Map UV Flip Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1930,10 +2154,9 @@ private void AlbedoMapUVFlipHelp3ActionPerformed(java.awt.event.ActionEvent evt) private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapFileHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("If the ALBEDO_MAP_FROM is 1 or 2, you will need to enter the path to the texture resource.

    " + "Tips : parent folder ref is '../' (in other words, using '../' instead of parent folder), and change all '\\' to '/'.

    " + "For example :
    " @@ -1946,13 +2169,13 @@ private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) { + "If the xxx.png is inside your desktop or other disk
    " + "You can set the xxx.png to the ALBEDO_MAP_FILE like : #define ALBEDO_MAP_FILE 'C:/Users/User Name/Desktop/xxx.png'"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 350); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Metalness Map File Help"); + help.setTitle("Smoothness Map File Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1965,19 +2188,18 @@ private void AlbedoMapFileHelp1ActionPerformed(java.awt.event.ActionEvent evt) { private void albedoHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albedoHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("between 0 ~ 1"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); - help.setSize(600, 350); + help.setSize(300, 70); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Metalness Map Scale Help"); + help.setTitle("Smoothness Map Scale Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -1991,19 +2213,19 @@ private void albedoHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F private void AlbedoMapLoopHelp1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapLoopHelp1ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); + help.setName("help"); helptext.setText("You can tile your texture for the X and Y axis separately by change albedoMapLoopNum = float2(x, y) between float2(0, 0) ~ float2(inf, inf) "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(600, 200); + help.setLocationRelativeTo(this); help.setResizable(true); helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); help.setVisible(true); help.add(helptext); - help.setTitle("Metalness Map Loop Help"); + help.setTitle("Smoothness Map Loop Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -2014,9 +2236,9 @@ private void AlbedoMapLoopHelp1ActionPerformed(java.awt.event.ActionEvent evt) { } }//GEN-LAST:event_AlbedoMapLoopHelp1ActionPerformed - private void MetalnessMapFromActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MetalnessMapFromActionPerformed + private void SmoothnessMapFromActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SmoothnessMapFromActionPerformed - }//GEN-LAST:event_MetalnessMapFromActionPerformed + }//GEN-LAST:event_SmoothnessMapFromActionPerformed private void changeFile1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_changeFile1StateChanged @@ -2027,7 +2249,7 @@ private void changeFile1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new java.io.File("../../Materials"));//The directory we are looking for is the Materials folder from ray - fileChooser.setDialogTitle("Choose new Metalness Map File"); + fileChooser.setDialogTitle("Choose new Smoothness Map File"); //Filtering by ImageFiles FileFilter imageFilter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "bmp", "tga", "targa", "dds", "tif", "tiff", "jpeg", "pcd"); fileChooser.setFileFilter(imageFilter); @@ -2039,9 +2261,9 @@ private void changeFile1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F if (selection == 0) { String relative = toRelative.convertToRelativePath(foo.getFileToEdit().getParent(), filePath); - MetalnessMapFile.setText(relative); - if (MetalnessMapFrom.getSelectedIndex() != 1) { - MetalnessMapFrom.setSelectedIndex(1); + SmoothnessMapFile.setText(relative); + if (SmoothnessMapFrom.getSelectedIndex() != 1) { + SmoothnessMapFrom.setSelectedIndex(1); } try { @@ -2052,16 +2274,16 @@ private void changeFile1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define METALNESS_MAP_FILE")) { + if (line.contains("#define SMOOTHNESS_MAP_FILE")) { catchOld = line; //auxiliar line String aux = ""; for (int i = catchOld.indexOf('"') + 1; i < line.length() - 1; i++) { aux += catchOld.charAt(i); } catchOld = aux; - if (!catchOld.equalsIgnoreCase(MetalnessMapFile.getText())) { - catchNew = MetalnessMapFile.getText(); //catchnewdigit - line = "#define METALNESS_MAP_FILE " + '"' + catchNew + '"'; + if (!catchOld.equalsIgnoreCase(SmoothnessMapFile.getText())) { + catchNew = SmoothnessMapFile.getText(); //catchnewdigit + line = "#define SMOOTHNESS_MAP_FILE " + '"' + catchNew + '"'; } } oldtext += line + "\r\n"; @@ -2083,31 +2305,31 @@ private void changeFile1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F } }//GEN-LAST:event_changeFile1ActionPerformed - private void MetalnessMapSwizzleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MetalnessMapSwizzleActionPerformed + private void SmoothnessMapSwizzleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SmoothnessMapSwizzleActionPerformed - }//GEN-LAST:event_MetalnessMapSwizzleActionPerformed + }//GEN-LAST:event_SmoothnessMapSwizzleActionPerformed - private void MetalnessMapApplyScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MetalnessMapApplyScaleActionPerformed + private void SmoothnessMapApplyScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SmoothnessMapApplyScaleActionPerformed - }//GEN-LAST:event_MetalnessMapApplyScaleActionPerformed + }//GEN-LAST:event_SmoothnessMapApplyScaleActionPerformed private void AlbedoMapUVFlipHelp4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp4ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("
    You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE


    " - + "
    • 1 : map values * albedo;
    • " - + "
    • 2 : map values ^ albedo;
    • " + + "
      • 1 : map values * albedo;
      • " + + "
      • 2 : map values ^ albedo;
      • " + "
      "); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); + help.setResizable(true); help.setVisible(true); help.add(helptext); - help.setTitle("Metalness Map Apply Scale Help"); + help.setTitle("Smoothness Map Apply Scale Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -2121,18 +2343,17 @@ private void AlbedoMapUVFlipHelp4ActionPerformed(java.awt.event.ActionEvent evt) private void AlbedoMapUVFlipHelp5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapUVFlipHelp5ActionPerformed - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JFrame help = new JFrame(); JLabel helptext = new JLabel(); - + help.setName("help"); helptext.setText("The ordering of the data fetched from a texture from the code. (R = 0, G = 1, B = 2, A = 3)"); help.setLayout(new BorderLayout()); - help.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2); help.setSize(500, 160); + help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); - help.setTitle("Metalness Map Swizzle Help"); + help.setTitle("Smoothness Map Swizzle Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); @@ -2142,12 +2363,21 @@ private void AlbedoMapUVFlipHelp5ActionPerformed(java.awt.event.ActionEvent evt) System.out.println("" + ex); } }//GEN-LAST:event_AlbedoMapUVFlipHelp5ActionPerformed + private void closeAllDialogs() { + Window[] windows = AlbedoSection.getWindows(); - private void back1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back1ActionPerformed + for (Window window : windows) { + if (window.getName().equalsIgnoreCase("help")) { + window.dispose(); + } + } + } + private void back1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back1ActionPerformed + closeAllDialogs(); WindowFrame w = new WindowFrame(); w.setLocation(this.getLocation()); - + ErrorWindow.dispose(); this.dispose(); w.setSize(960, 549); w.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); @@ -2167,7 +2397,7 @@ public void windowClosing(WindowEvent we) { w.setVisible(true); }//GEN-LAST:event_back1ActionPerformed - private void SmoothnessMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SmoothnessMapFromItemStateChanged + private void SpecularMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SpecularMapFromItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2176,10 +2406,10 @@ private void SmoothnessMapFromItemStateChanged(java.awt.event.ItemEvent evt) {// String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define SMOOTHNESS_MAP_FROM")) { + if (line.contains("#define SPECULAR_MAP_FROM")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = SmoothnessMapFrom.getSelectedItem().toString(); //catchnewdigit + catchNew = SpecularMapFrom.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2196,9 +2426,9 @@ private void SmoothnessMapFromItemStateChanged(java.awt.event.ItemEvent evt) {// } catch (Exception e) { } - }//GEN-LAST:event_SmoothnessMapFromItemStateChanged + }//GEN-LAST:event_SpecularMapFromItemStateChanged - private void SmoothnessMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SmoothnessMapTypeItemStateChanged + private void SpecularMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SpecularMapTypeItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2207,10 +2437,10 @@ private void SmoothnessMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {// String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define SMOOTHNESS_MAP_TYPE")) { + if (line.contains("#define SPECULAR_MAP_TYPE")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = SmoothnessMapType.getSelectedItem().toString(); //catchnewdigit + catchNew = SpecularMapType.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2227,9 +2457,9 @@ private void SmoothnessMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {// } catch (Exception e) { } - }//GEN-LAST:event_SmoothnessMapTypeItemStateChanged + }//GEN-LAST:event_SpecularMapTypeItemStateChanged - private void SmoothnessMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SmoothnessMapUVFlipItemStateChanged + private void SpecularMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SpecularMapUVFlipItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2238,10 +2468,10 @@ private void SmoothnessMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) { String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define SMOOTHNESS_MAP_UV_FLIP")) { + if (line.contains("#define SPECULAR_MAP_UV_FLIP")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = SmoothnessMapUVFlip.getSelectedItem().toString(); //catchnewdigit + catchNew = SpecularMapUVFlip.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2258,9 +2488,9 @@ private void SmoothnessMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) { } catch (Exception e) { } - }//GEN-LAST:event_SmoothnessMapUVFlipItemStateChanged + }//GEN-LAST:event_SpecularMapUVFlipItemStateChanged - private void SmoothnessMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SmoothnessMapSwizzleItemStateChanged + private void SpecularMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SpecularMapSwizzleItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2269,10 +2499,10 @@ private void SmoothnessMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define SMOOTHNESS_MAP_SWIZZLE")) { + if (line.contains("#define SPECULAR_MAP_SWIZZLE")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = SmoothnessMapSwizzle.getSelectedItem().toString(); //catchnewdigit + catchNew = SpecularMapSwizzle.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2289,9 +2519,9 @@ private void SmoothnessMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) } catch (Exception e) { } - }//GEN-LAST:event_SmoothnessMapSwizzleItemStateChanged + }//GEN-LAST:event_SpecularMapSwizzleItemStateChanged - private void SmoothnessMapApplyScaleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SmoothnessMapApplyScaleItemStateChanged + private void SpecularMapApplyScaleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SpecularMapApplyScaleItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2300,10 +2530,10 @@ private void SmoothnessMapApplyScaleItemStateChanged(java.awt.event.ItemEvent ev String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define SMOOTHNESS_MAP_APPLY_SCALE")) { + if (line.contains("#define SPECULAR_MAP_APPLY_SCALE")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = SmoothnessMapApplyScale.getSelectedItem().toString(); //catchnewdigit + catchNew = SpecularMapApplyScale.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2320,9 +2550,9 @@ private void SmoothnessMapApplyScaleItemStateChanged(java.awt.event.ItemEvent ev } catch (Exception e) { } - }//GEN-LAST:event_SmoothnessMapApplyScaleItemStateChanged + }//GEN-LAST:event_SpecularMapApplyScaleItemStateChanged - private void MetalnessMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_MetalnessMapFromItemStateChanged + private void SmoothnessMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SmoothnessMapFromItemStateChanged // TODO add your handling code here: try { BufferedReader br = null; @@ -2332,10 +2562,10 @@ private void MetalnessMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//G String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define METALNESS_MAP_FROM")) { + if (line.contains("#define SMOOTHNESS_MAP_FROM")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = MetalnessMapFrom.getSelectedItem().toString(); //catchnewdigit + catchNew = SmoothnessMapFrom.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2352,9 +2582,9 @@ private void MetalnessMapFromItemStateChanged(java.awt.event.ItemEvent evt) {//G } catch (Exception e) { } - }//GEN-LAST:event_MetalnessMapFromItemStateChanged + }//GEN-LAST:event_SmoothnessMapFromItemStateChanged - private void MetalnessMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_MetalnessMapUVFlipItemStateChanged + private void SmoothnessMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SmoothnessMapUVFlipItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2363,10 +2593,10 @@ private void MetalnessMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {/ String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define METALNESS_MAP_UV_FLIP")) { + if (line.contains("#define SMOOTHNESS_MAP_UV_FLIP")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = MetalnessMapUVFlip.getSelectedItem().toString(); //catchnewdigit + catchNew = SmoothnessMapUVFlip.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } oldtext += line + "\r\n"; @@ -2382,9 +2612,9 @@ private void MetalnessMapUVFlipItemStateChanged(java.awt.event.ItemEvent evt) {/ } catch (Exception e) { } - }//GEN-LAST:event_MetalnessMapUVFlipItemStateChanged + }//GEN-LAST:event_SmoothnessMapUVFlipItemStateChanged - private void MetalnessMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_MetalnessMapSwizzleItemStateChanged + private void SmoothnessMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SmoothnessMapSwizzleItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2393,10 +2623,10 @@ private void MetalnessMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) { String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define METALNESS_MAP_SWIZZLE")) { + if (line.contains("#define SMOOTHNESS_MAP_SWIZZLE")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = MetalnessMapSwizzle.getSelectedItem().toString(); //catchnewdigit + catchNew = SmoothnessMapSwizzle.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2413,9 +2643,9 @@ private void MetalnessMapSwizzleItemStateChanged(java.awt.event.ItemEvent evt) { } catch (Exception e) { } - }//GEN-LAST:event_MetalnessMapSwizzleItemStateChanged + }//GEN-LAST:event_SmoothnessMapSwizzleItemStateChanged - private void MetalnessMapApplyScaleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_MetalnessMapApplyScaleItemStateChanged + private void SmoothnessMapApplyScaleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SmoothnessMapApplyScaleItemStateChanged try { BufferedReader br = null; br = new BufferedReader(new FileReader(foo.getFileToEdit())); @@ -2424,10 +2654,10 @@ private void MetalnessMapApplyScaleItemStateChanged(java.awt.event.ItemEvent evt String catchOld = ""; String catchNew = ""; while (line != null) { - if (line.contains("#define METALNESS_MAP_APPLY_SCALE")) { + if (line.contains("#define SMOOTHNESS_MAP_APPLY_SCALE")) { catchOld = line; //auxiliar line catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit - catchNew = MetalnessMapApplyScale.getSelectedItem().toString(); //catchnewdigit + catchNew = SmoothnessMapApplyScale.getSelectedItem().toString(); //catchnewdigit line = line.replaceAll(catchOld, catchNew); //replace old for the new one } @@ -2444,7 +2674,169 @@ private void MetalnessMapApplyScaleItemStateChanged(java.awt.event.ItemEvent evt } catch (Exception e) { } // TODO add your handling code here: - }//GEN-LAST:event_MetalnessMapApplyScaleItemStateChanged + }//GEN-LAST:event_SmoothnessMapApplyScaleItemStateChanged + + private void SmoothnessMapTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SmoothnessMapTypeItemStateChanged + try { + BufferedReader br = null; + br = new BufferedReader(new FileReader(foo.getFileToEdit())); + String oldtext = ""; + String line = br.readLine(); + String catchOld = ""; + String catchNew = ""; + while (line != null) { + if (line.contains("#define SMOOTHNESS_MAP_TYPE")) { + catchOld = line; //auxiliar line + catchOld = catchOld.replaceAll("\\D+", ""); //extract old digit + catchNew = SmoothnessMapType.getSelectedItem().toString(); //catchnewdigit + line = line.replaceAll(catchOld, catchNew); //replace old for the new one + + } + oldtext += line + "\r\n"; + line = br.readLine(); + } + String newtext = oldtext; + + FileWriter writer = new FileWriter(foo.getFileToEdit()); + writer.write(newtext); + writer.close(); + + br.close(); + } catch (Exception e) { + + } + }//GEN-LAST:event_SmoothnessMapTypeItemStateChanged + + private void SmoothnessMapTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SmoothnessMapTypeActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_SmoothnessMapTypeActionPerformed + + private void AlbedoMapHelp4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AlbedoMapHelp4ActionPerformed + + JFrame AlbedoMapHelp = new JFrame(); + JLabel AlbedoMapHelpText = new JLabel(); + AlbedoMapHelp.setName("help"); + AlbedoMapHelpText.setText("
      • 0 : Smoothness (from Frostbite / CE5 textures)
      • " + + "
      • 1 : Calculate Smoothness from roughness by 1.0 - Roughness ^ 0.5 (from UE4/GGX/SubstancePainter2 textures)
      • " + + "
      • 2 : Calculate Smoothness from roughness by 1.0 - Roughness (from UE4/GGX/SubstancePainter2 with roughness linear roughness)
      "); + AlbedoMapHelp.setLayout(new BorderLayout()); + AlbedoMapHelp.setSize(700, 550); + AlbedoMapHelp.setLocationRelativeTo(this); + + AlbedoMapHelp.setResizable(true); + AlbedoMapHelp.setVisible(true); + AlbedoMapHelp.add(AlbedoMapHelpText); + AlbedoMapHelp.setTitle("Smoothness Map From Help"); + + try { + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + AlbedoMapHelp.setIconImage(myImg); + } catch (IOException ex) { + System.out.println("" + ex); + } + }//GEN-LAST:event_AlbedoMapHelp4ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + + JFrame help = new JFrame(); + JLabel helptext = new JLabel(); + helptext.setText("Tips : It has no effect on metalness > 0 and CUSTOM_ENABLE > 0.

      " + + "The specular maps are not HDR/environment maps, only modifies the color of basic reflection of the model
      " + + "Used to change the colors of the environment reflect.
      " + + "When the diffuse brighter than specular reflect,
      " + + "It will be only a very small contribution to change the colors of environment reflect.
      " + + "So you can set the zero to the 'const float3 specular = 0.0;', if you dot‘t want that model to reflect the specular color of environment.
      "); + help.setLayout(new BorderLayout()); + help.setSize(700, 250); + help.setLocationRelativeTo(this); + helptext.setBorder(new EmptyBorder(10, 20, 10, 10)); + help.setResizable(true); + help.setVisible(true); + help.add(helptext); + help.setTitle("Specular Map Tips"); + + try { + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + help.setIconImage(myImg); + } catch (IOException ex) { + System.out.println("" + ex); + } + }//GEN-LAST:event_jButton2ActionPerformed + public void previewImg(String path) { + File f = new File(path); + File a = new File(foo.getFilePath()); + File parentFolder = new File(a.getParent()); + File b = new File(parentFolder, path); + String absolute = ""; + try { + absolute = b.getCanonicalPath(); + f = new File(absolute); + } catch (Exception e) { + + } + if (f.exists()) { + JDialog jf = new JDialog(); + JLabel jl = new JLabel(); + jf.setName("help"); + jf.setTitle("Map Preview"); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jf.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + BufferedImage img = null; + try {//Map + img = ImageIO.read(new File(absolute)); + } catch (IOException e) { + e.printStackTrace(); + } + jf.setSize(600, 600); + jf.setResizable(false); + jf.setModal(true); + jf.setLocationRelativeTo(this); + jf.setAlwaysOnTop(true); + jf.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + Image dimg = img.getScaledInstance(jf.getWidth(), jf.getHeight(), + Image.SCALE_SMOOTH); + ImageIcon ii = new ImageIcon(dimg); + jl.setIcon(ii); + jf.add(jl); + jf.setVisible(true); + } else { + JDialog jd = new JDialog(); + JLabel jl = new JLabel(); + jl.setText("
      The Map file you are trying to preview doesn't exist.
      "); + jd.setName("help"); + jd.setTitle("No such Map File"); + jd.setSize(300, 100); + jd.setModal(true); + jd.setResizable(false); + jd.setLocationRelativeTo(this); + jd.setAlwaysOnTop(true); + jd.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + try {//Icon + InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); + BufferedImage myImg = ImageIO.read(imgStream); + jd.setIconImage(myImg); + } catch (IOException ex) { + Logger.getLogger(AlbedoSection.class.getName()).log(Level.SEVERE, null, ex); + } + jd.add(jl); + jd.setVisible(true); + + } + } + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + previewImg(SpecularMapFile.getText()); + }//GEN-LAST:event_jButton4ActionPerformed + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + previewImg(SmoothnessMapFile.getText()); + }//GEN-LAST:event_jButton5ActionPerformed /** * @param args the command line arguments @@ -2490,6 +2882,7 @@ public void run() { private javax.swing.JButton AlbedoMapHelp; private javax.swing.JButton AlbedoMapHelp1; private javax.swing.JButton AlbedoMapHelp3; + private javax.swing.JButton AlbedoMapHelp4; private javax.swing.JButton AlbedoMapLoopHelp; private javax.swing.JButton AlbedoMapLoopHelp1; private javax.swing.JButton AlbedoMapUVFlipHelp; @@ -2498,22 +2891,26 @@ public void run() { private javax.swing.JButton AlbedoMapUVFlipHelp3; private javax.swing.JButton AlbedoMapUVFlipHelp4; private javax.swing.JButton AlbedoMapUVFlipHelp5; - private javax.swing.JComboBox MetalnessMapApplyScale; - private javax.swing.JTextField MetalnessMapFile; - private javax.swing.JComboBox MetalnessMapFrom; - private javax.swing.JComboBox MetalnessMapSwizzle; - private javax.swing.JComboBox MetalnessMapUVFlip; private javax.swing.JComboBox SmoothnessMapApplyScale; private javax.swing.JTextField SmoothnessMapFile; private javax.swing.JComboBox SmoothnessMapFrom; private javax.swing.JComboBox SmoothnessMapSwizzle; private javax.swing.JComboBox SmoothnessMapType; private javax.swing.JComboBox SmoothnessMapUVFlip; + private javax.swing.JComboBox SpecularMapApplyScale; + private javax.swing.JTextField SpecularMapFile; + private javax.swing.JComboBox SpecularMapFrom; + private javax.swing.JComboBox SpecularMapSwizzle; + private javax.swing.JComboBox SpecularMapType; + private javax.swing.JComboBox SpecularMapUVFlip; private javax.swing.JButton albedoHelp; private javax.swing.JButton albedoHelp1; private javax.swing.JButton back1; private javax.swing.JButton changeFile; private javax.swing.JButton changeFile1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; @@ -2522,6 +2919,7 @@ public void run() { private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; diff --git a/src/mmd/WindowFrame.form b/src/mmd/WindowFrame.form index bacd7e5..50e864f 100644 --- a/src/mmd/WindowFrame.form +++ b/src/mmd/WindowFrame.form @@ -75,9 +75,9 @@ - + - + @@ -90,7 +90,7 @@ - + @@ -98,9 +98,9 @@ - + - + @@ -113,7 +113,7 @@ - + @@ -121,9 +121,9 @@ - + - + @@ -136,7 +136,7 @@ - + diff --git a/src/mmd/WindowFrame.java b/src/mmd/WindowFrame.java index 27d23ee..607d026 100644 --- a/src/mmd/WindowFrame.java +++ b/src/mmd/WindowFrame.java @@ -30,6 +30,7 @@ import java.awt.BorderLayout; import java.awt.Desktop; import java.awt.Point; +import java.awt.Window; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; @@ -58,9 +59,9 @@ private void initComponents() { jMenu1 = new javax.swing.JMenu(); back1 = new javax.swing.JButton(); gotofolder = new javax.swing.JButton(); - PARALLAX = new javax.swing.JButton(); - SMOOTHNESSMETALNESS = new javax.swing.JButton(); - SPECULARANDOCCLUSION = new javax.swing.JButton(); + METALNESS = new javax.swing.JButton(); + SPECULARANDSMOOTHNESS = new javax.swing.JButton(); + PARALLAXANDOCCLUSION = new javax.swing.JButton(); ALPHA = new javax.swing.JButton(); CUSTOMENABLE = new javax.swing.JButton(); EMISSIVE = new javax.swing.JButton(); @@ -100,44 +101,44 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { getContentPane().add(gotofolder); gotofolder.setBounds(670, 20, 140, 32); - PARALLAX.setText("PARALLAX"); - PARALLAX.setMaximumSize(new java.awt.Dimension(172, 30)); - PARALLAX.setMinimumSize(new java.awt.Dimension(172, 30)); - PARALLAX.setOpaque(false); - PARALLAX.setPreferredSize(new java.awt.Dimension(172, 30)); - PARALLAX.addActionListener(new java.awt.event.ActionListener() { + METALNESS.setText("METALNESS"); + METALNESS.setMaximumSize(new java.awt.Dimension(172, 30)); + METALNESS.setMinimumSize(new java.awt.Dimension(172, 30)); + METALNESS.setOpaque(false); + METALNESS.setPreferredSize(new java.awt.Dimension(172, 30)); + METALNESS.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - PARALLAXActionPerformed(evt); + METALNESSActionPerformed(evt); } }); - getContentPane().add(PARALLAX); - PARALLAX.setBounds(386, 382, 172, 45); - - SMOOTHNESSMETALNESS.setText("SMOOTHNESS & METALNESS"); - SMOOTHNESSMETALNESS.setMaximumSize(new java.awt.Dimension(172, 30)); - SMOOTHNESSMETALNESS.setMinimumSize(new java.awt.Dimension(172, 30)); - SMOOTHNESSMETALNESS.setOpaque(false); - SMOOTHNESSMETALNESS.setPreferredSize(new java.awt.Dimension(172, 30)); - SMOOTHNESSMETALNESS.addActionListener(new java.awt.event.ActionListener() { + getContentPane().add(METALNESS); + METALNESS.setBounds(386, 382, 172, 45); + + SPECULARANDSMOOTHNESS.setText("SPECULAR & SMOOTHNESS"); + SPECULARANDSMOOTHNESS.setMaximumSize(new java.awt.Dimension(172, 30)); + SPECULARANDSMOOTHNESS.setMinimumSize(new java.awt.Dimension(172, 30)); + SPECULARANDSMOOTHNESS.setOpaque(false); + SPECULARANDSMOOTHNESS.setPreferredSize(new java.awt.Dimension(172, 30)); + SPECULARANDSMOOTHNESS.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - SMOOTHNESSMETALNESSActionPerformed(evt); + SPECULARANDSMOOTHNESSActionPerformed(evt); } }); - getContentPane().add(SMOOTHNESSMETALNESS); - SMOOTHNESSMETALNESS.setBounds(386, 120, 172, 45); - - SPECULARANDOCCLUSION.setText("SPECULAR & OCCLUSION"); - SPECULARANDOCCLUSION.setMaximumSize(new java.awt.Dimension(172, 35)); - SPECULARANDOCCLUSION.setMinimumSize(new java.awt.Dimension(172, 35)); - SPECULARANDOCCLUSION.setOpaque(false); - SPECULARANDOCCLUSION.setPreferredSize(new java.awt.Dimension(172, 35)); - SPECULARANDOCCLUSION.addActionListener(new java.awt.event.ActionListener() { + getContentPane().add(SPECULARANDSMOOTHNESS); + SPECULARANDSMOOTHNESS.setBounds(386, 120, 172, 45); + + PARALLAXANDOCCLUSION.setText("PARALLAX & OCCLUSION"); + PARALLAXANDOCCLUSION.setMaximumSize(new java.awt.Dimension(172, 35)); + PARALLAXANDOCCLUSION.setMinimumSize(new java.awt.Dimension(172, 35)); + PARALLAXANDOCCLUSION.setOpaque(false); + PARALLAXANDOCCLUSION.setPreferredSize(new java.awt.Dimension(172, 35)); + PARALLAXANDOCCLUSION.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - SPECULARANDOCCLUSIONActionPerformed(evt); + PARALLAXANDOCCLUSIONActionPerformed(evt); } }); - getContentPane().add(SPECULARANDOCCLUSION); - SPECULARANDOCCLUSION.setBounds(386, 249, 172, 45); + getContentPane().add(PARALLAXANDOCCLUSION); + PARALLAXANDOCCLUSION.setBounds(386, 249, 172, 45); ALPHA.setText("ALPHA"); ALPHA.setMaximumSize(new java.awt.Dimension(172, 30)); @@ -285,54 +286,54 @@ static boolean bgExists(String image_path) { return false; } } - private void PARALLAXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PARALLAXActionPerformed + private void METALNESSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_METALNESSActionPerformed - ParallaxSection ps = new ParallaxSection(); - ps.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - ps.addWindowListener(new WindowAdapter() { + MetalnessSection ms = new MetalnessSection(); + ms.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + ms.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { - Point pos = ps.getLocation(); + Point pos = ms.getLocation(); callWindow(pos); - ps.dispose(); + ms.dispose(); } }); - ps.setSize(960, 549); - ps.setLayout(new AbsoluteLayout()); - ps.setLocationRelativeTo(this); + ms.setSize(960, 549); + ms.setLayout(new AbsoluteLayout()); + ms.setLocationRelativeTo(this); this.dispose(); - ps.setAlwaysOnTop(true); - ps.setAlwaysOnTop(false); - ps.setVisible(true); + ms.setAlwaysOnTop(true); + ms.setAlwaysOnTop(false); + ms.setVisible(true); ImageIcon img = new ImageIcon(getClass().getResource("/icon/ico.png")); - ps.setIconImage(img.getImage()); - }//GEN-LAST:event_PARALLAXActionPerformed + ms.setIconImage(img.getImage()); + }//GEN-LAST:event_METALNESSActionPerformed - private void SMOOTHNESSMETALNESSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SMOOTHNESSMETALNESSActionPerformed + private void SPECULARANDSMOOTHNESSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SPECULARANDSMOOTHNESSActionPerformed - SmoothnessAndMetalness sm = new SmoothnessAndMetalness(); - sm.setLocationRelativeTo(this); - sm.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - sm.addWindowListener(new WindowAdapter() { + SpecularAndSmoothness ss = new SpecularAndSmoothness(); + ss.setLocationRelativeTo(this); + ss.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + ss.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { - Point pos = sm.getLocation(); + Point pos = ss.getLocation(); callWindow(pos); - sm.dispose(); + ss.dispose(); } }); this.dispose(); - sm.setAlwaysOnTop(true); - sm.setAlwaysOnTop(false); - sm.setVisible(true); + ss.setAlwaysOnTop(true); + ss.setAlwaysOnTop(false); + ss.setVisible(true); ImageIcon img = new ImageIcon(getClass().getResource("/icon/ico.png")); - sm.setIconImage(img.getImage()); - sm.AlbedoMapFile1 = ""; - }//GEN-LAST:event_SMOOTHNESSMETALNESSActionPerformed + ss.setIconImage(img.getImage()); + ss.AlbedoMapFile1 = ""; + }//GEN-LAST:event_SPECULARANDSMOOTHNESSActionPerformed - private void SPECULARANDOCCLUSIONActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SPECULARANDOCCLUSIONActionPerformed + private void PARALLAXANDOCCLUSIONActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PARALLAXANDOCCLUSIONActionPerformed - SpecularAndOcclusion sao = new SpecularAndOcclusion(); + ParallaxAndOcclusion sao = new ParallaxAndOcclusion(); sao.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); sao.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { @@ -351,7 +352,7 @@ public void windowClosing(WindowEvent we) { ImageIcon img = new ImageIcon(getClass().getResource("/icon/ico.png")); sao.setIconImage(img.getImage()); - }//GEN-LAST:event_SPECULARANDOCCLUSIONActionPerformed + }//GEN-LAST:event_PARALLAXANDOCCLUSIONActionPerformed private void ALPHAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ALPHAActionPerformed @@ -425,7 +426,6 @@ public void windowClosing(WindowEvent we) { }//GEN-LAST:event_EMISSIVEActionPerformed private void ALBEDOActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ALBEDOActionPerformed - AlbedoSection ab = new AlbedoSection(); ab.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); ab.addWindowListener(new WindowAdapter() { @@ -440,6 +440,7 @@ public void windowClosing(WindowEvent we) { ab.setAlwaysOnTop(true); ab.setAlwaysOnTop(false); ab.setLocationRelativeTo(this); + ab.setLayout(new AbsoluteLayout()); this.dispose(); ImageIcon img = new ImageIcon(getClass().getResource("/icon/ico.png")); @@ -472,6 +473,7 @@ public void windowClosing(WindowEvent we) { }//GEN-LAST:event_NORMALMAPActionPerformed private void FINISHEDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FINISHEDActionPerformed + this.dispose(); ImageIcon ico = new ImageIcon(getClass().getResource("/icon/ico.png")); @@ -591,11 +593,11 @@ public JButton getNORMALMAP() { } public JButton getOCCLUISON() { - return this.SPECULARANDOCCLUSION; + return this.PARALLAXANDOCCLUSION; } public JButton getPARALLAX() { - return this.PARALLAX; + return this.METALNESS; } public JButton getSAVE() { @@ -607,7 +609,7 @@ public JButton getSMOOTHNESSMATALNESS() { } public JButton getSPECULAR() { - return this.SMOOTHNESSMETALNESS; + return this.SPECULARANDSMOOTHNESS; } // Variables declaration - do not modify//GEN-BEGIN:variables @@ -616,10 +618,10 @@ public JButton getSPECULAR() { private javax.swing.JButton CUSTOMENABLE; private javax.swing.JButton EMISSIVE; private javax.swing.JButton FINISHED; + private javax.swing.JButton METALNESS; private javax.swing.JButton NORMALMAP; - private javax.swing.JButton PARALLAX; - private javax.swing.JButton SMOOTHNESSMETALNESS; - private javax.swing.JButton SPECULARANDOCCLUSION; + private javax.swing.JButton PARALLAXANDOCCLUSION; + private javax.swing.JButton SPECULARANDSMOOTHNESS; private javax.swing.JButton back1; private javax.swing.JButton gotofolder; private javax.swing.JButton gotofolder1; diff --git a/src/mmd/toRelative.java b/src/mmd/toRelative.java index 17e2f60..9bd40fe 100644 --- a/src/mmd/toRelative.java +++ b/src/mmd/toRelative.java @@ -34,7 +34,6 @@ public static String convertToRelativePath(String absolutePath, String relativeT // Thanks to: // http://mrpmorris.blogspot.com/2007/05/convert-absolute-path-to-toRelative-path.html - absolutePath = absolutePath.replaceAll("\\\\", "/"); relativeTo = relativeTo.replaceAll("\\\\", "/");