added terrain material params to terrain editor window

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8809 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
bre..ns 14 years ago
parent 9da184fcd7
commit 6ef11723a3
  1. 1
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/AddTerrainAction.java
  2. 5
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/Bundle.properties
  3. 103
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorController.java
  4. 131
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.form
  5. 146
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java
  6. 2
      sdk/nbproject/platform.properties

@ -152,6 +152,7 @@ public class AddTerrainAction extends AbstractNewSpatialWizardAction {
mat.setTexture("DiffuseMap", dirtTexture);
mat.setFloat("DiffuseMap_0_scale", TerrainEditorController.DEFAULT_TEXTURE_SCALE);
mat.setBoolean("WardIso", true);
mat.setFloat("Shininess", 0.01f);
((Node)terrain).setMaterial(mat);
((Node)terrain).setModelBound(new BoundingBox());

@ -105,3 +105,8 @@ TerrainEditorTopComponent.toolHint.none=
TerrainEditorTopComponent.toolHint.default=Switch between camera and tool controls by holding down SHIFT
TerrainEditorTopComponent.toolHint.level=Right click to set desired height value, left click to adjust height to that desired value.
TerrainEditorTopComponent.jPanel2.border.title=Material
TerrainEditorTopComponent.jLabel1.text=Shininess
TerrainEditorTopComponent.wardIsoCheckBox.text=WardIso
TerrainEditorTopComponent.shininessField.text=0.001
TerrainEditorTopComponent.shininessField.toolTipText=0 or greater

@ -53,6 +53,7 @@ import com.jme3.terrain.Terrain;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture.WrapMode;
import com.jme3.util.SkyFactory;
import com.sun.imageio.plugins.common.ImageUtil;
import java.awt.image.BufferedImage;
import java.beans.PropertyChangeEvent;
import java.io.File;
@ -1025,6 +1026,108 @@ public class TerrainEditorController implements NodeListener {
}
}
protected void setShininess(final float shininess) {
if (SceneApplication.getApplication().isOgl()) {
Terrain terrain = (Terrain) getTerrain(null);
if (terrain == null)
return;
terrain.getMaterial().setFloat("Shininess", shininess);
setNeedsSave(true);
} else {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
setShininess(shininess);
return null;
}
});
}
}
protected float getShininess() {
if (SceneApplication.getApplication().isOgl()) {
Terrain terrain = (Terrain) getTerrain(null);
if (terrain == null)
return 0;
MatParam param = terrain.getMaterial().getParam("Shininess");
if (param != null)
return (Float)param.getValue();
return 0;
} else {
try {
Float shininess = SceneApplication.getApplication().enqueue(new Callable<Float>() {
public Float call() throws Exception {
return getShininess();
}
}).get();
return shininess;
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) {
Exceptions.printStackTrace(ex);
}
return 0;
}
}
protected void setWardIsoEnabled(final boolean enabled) {
if (SceneApplication.getApplication().isOgl()) {
Terrain terrain = (Terrain) getTerrain(null);
if (terrain == null)
return;
terrain.getMaterial().setBoolean("WardIso", enabled);
setNeedsSave(true);
} else {
try {
SceneApplication.getApplication().enqueue(new Callable() {
public Object call() throws Exception {
setWardIsoEnabled(enabled);
return null;
}
}).get();
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) {
Exceptions.printStackTrace(ex);
}
}
}
protected boolean isWardIsoEnabled() {
if (SceneApplication.getApplication().isOgl()) {
Terrain terrain = (Terrain) getTerrain(null);
if (terrain == null)
return false;
MatParam param = terrain.getMaterial().getParam("WardIso");
if (param != null)
return (Boolean)param.getValue();
return false;
} else {
try {
Boolean isEnabled =
SceneApplication.getApplication().enqueue(new Callable<Boolean>() {
public Boolean call() throws Exception {
return isWardIsoEnabled();
}
}).get();
return isEnabled;
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) {
Exceptions.printStackTrace(ex);
}
return false;
}
}
public void propertyChange(PropertyChangeEvent ev) {
if (ev.getNewValue() == null && ev.getOldValue() != null) {
topComponent.clearTextureTable(); // terrain deleted

@ -13,7 +13,7 @@
<ResourceString bundle="com/jme3/gde/terraineditor/Bundle.properties" key="TerrainEditorTopComponent.textureFileChooser.approveButtonText_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="currentDirectory" type="java.io.File" editor="org.netbeans.beaninfo.editors.FileEditor">
<SerializedValue value="-84,-19,0,5,115,114,0,12,106,97,118,97,46,105,111,46,70,105,108,101,4,45,-92,69,14,13,-28,-1,3,0,1,76,0,4,112,97,116,104,116,0,18,76,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,59,120,112,116,0,16,47,65,115,115,101,116,115,47,84,101,120,116,117,114,101,115,119,2,0,47,120"/>
<SerializedValue value="-84,-19,0,5,115,114,0,12,106,97,118,97,46,105,111,46,70,105,108,101,4,45,-92,69,14,13,-28,-1,3,0,1,76,0,4,112,97,116,104,116,0,18,76,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,59,120,112,116,0,16,92,65,115,115,101,116,115,92,84,101,120,116,117,114,101,115,119,2,0,92,120"/>
</Property>
<Property name="dialogTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/terraineditor/Bundle.properties" key="TerrainEditorTopComponent.textureFileChooser.dialogTitle_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
@ -39,17 +39,29 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="jScrollPane3" alignment="1" pref="920" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="jScrollPane3" alignment="1" pref="253" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane3">
<Properties>
<Property name="verticalScrollBarPolicy" type="int" value="22"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[32767, 300]"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
@ -59,11 +71,14 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="paintingPanel" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="terrainOpsPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jPanel2" max="32767" attributes="1"/>
<Component id="terrainOpsPanel" alignment="0" max="32767" attributes="1"/>
</Group>
<EmptySpace pref="20" max="32767" attributes="0"/>
<Component id="hintPanel" max="32767" attributes="0"/>
</Group>
<Component id="jToolBar1" alignment="0" pref="891" max="32767" attributes="0"/>
<Component id="jToolBar1" alignment="0" pref="901" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@ -72,10 +87,14 @@
<Component id="jToolBar1" min="-2" pref="27" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="toolSettingsPanel" pref="186" max="32767" attributes="1"/>
<Component id="toolSettingsPanel" pref="218" max="32767" attributes="1"/>
<Component id="paintingPanel" max="32767" attributes="1"/>
<Component id="hintPanel" alignment="1" max="32767" attributes="1"/>
<Component id="terrainOpsPanel" alignment="1" max="32767" attributes="1"/>
<Group type="102" alignment="0" attributes="0">
<Component id="terrainOpsPanel" min="-2" max="-2" attributes="1"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel2" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
@ -96,12 +115,12 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="139" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="147" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="158" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="191" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
@ -203,7 +222,7 @@
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jScrollPane2" pref="291" max="32767" attributes="0"/>
<Component id="jScrollPane2" pref="303" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="removeTextureButton" min="0" pref="0" max="32767" attributes="1"/>
@ -214,7 +233,7 @@
<Component id="remainingTexTitleLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="remainingTexturesLabel" min="-2" pref="24" max="-2" attributes="0"/>
<EmptySpace pref="19" max="32767" attributes="0"/>
<EmptySpace pref="106" max="32767" attributes="0"/>
<Component id="triPlanarCheckBox" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
@ -231,7 +250,7 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="removeTextureButton" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane2" pref="131" max="32767" attributes="0"/>
<Component id="jScrollPane2" pref="166" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
@ -364,7 +383,7 @@
<Component id="genEntropiesButton" min="-2" max="-2" attributes="1"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="96" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -577,6 +596,90 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Material">
<ResourceString PropertyName="titleX" bundle="com/jme3/gde/terraineditor/Bundle.properties" key="TerrainEditorTopComponent.jPanel2.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</TitledBorder>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="shininessField" min="-2" pref="41" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" pref="60" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
<Component id="wardIsoCheckBox" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="51" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="wardIsoCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="shininessField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="43" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JCheckBox" name="wardIsoCheckBox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/terraineditor/Bundle.properties" key="TerrainEditorTopComponent.wardIsoCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="wardIsoCheckBoxActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="shininessField">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/terraineditor/Bundle.properties" key="TerrainEditorTopComponent.shininessField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/terraineditor/Bundle.properties" key="TerrainEditorTopComponent.shininessField.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="inputVerifier" type="javax.swing.InputVerifier" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new ShininessVerifier()" type="code"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="shininessFieldActionPerformed"/>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="shininessFieldKeyTyped"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/terraineditor/Bundle.properties" key="TerrainEditorTopComponent.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>

@ -64,6 +64,7 @@ import com.jme3.texture.Texture;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.io.File;
import java.io.IOException;
@ -75,7 +76,9 @@ import javax.swing.AbstractCellEditor;
import javax.swing.DefaultListSelectionModel;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.InputVerifier;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
@ -207,6 +210,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
terrainModButtonGroup = new ToggleButtonGroup();
textureFileChooser = new javax.swing.JFileChooser();
jScrollPane3 = new javax.swing.JScrollPane();
jPanel1 = new javax.swing.JPanel();
hintPanel = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
@ -238,12 +242,20 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
jSeparator2 = new javax.swing.JToolBar.Separator();
paintButton = new javax.swing.JToggleButton();
eraseButton = new javax.swing.JToggleButton();
jPanel2 = new javax.swing.JPanel();
wardIsoCheckBox = new javax.swing.JCheckBox();
shininessField = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
textureFileChooser.setApproveButtonText(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.textureFileChooser.approveButtonText_1")); // NOI18N
textureFileChooser.setCurrentDirectory(new java.io.File("/Assets/Textures"));
textureFileChooser.setCurrentDirectory(new java.io.File("C:\\Assets\\Textures"));
textureFileChooser.setDialogTitle(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.textureFileChooser.dialogTitle_1")); // NOI18N
textureFileChooser.setFileFilter(new ImageFilter());
jScrollPane3.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
jPanel1.setMaximumSize(new java.awt.Dimension(32767, 300));
hintPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.hintPanel.border.title"))); // NOI18N
hintTextArea.setColumns(20);
@ -260,11 +272,11 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
hintPanel.setLayout(hintPanelLayout);
hintPanelLayout.setHorizontalGroup(
hintPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE)
);
hintPanelLayout.setVerticalGroup(
hintPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
);
toolSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.toolSettingsPanel.border.title"))); // NOI18N
@ -348,7 +360,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
.addGroup(paintingPanelLayout.createSequentialGroup()
.addGroup(paintingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, paintingPanelLayout.createSequentialGroup()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(paintingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(removeTextureButton, 0, 0, Short.MAX_VALUE)
@ -357,7 +369,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
.addComponent(remainingTexTitleLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(remainingTexturesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 106, Short.MAX_VALUE)
.addComponent(triPlanarCheckBox)))
.addContainerGap())
);
@ -369,7 +381,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
.addComponent(addTextureButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(removeTextureButton))
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE))
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(paintingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(remainingTexTitleLabel)
@ -410,7 +422,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
.addComponent(genEntropiesButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addContainerGap(96, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jToolBar1.setFloatable(false);
@ -514,6 +526,58 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
});
jToolBar1.add(eraseButton);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.jPanel2.border.title"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(wardIsoCheckBox, org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.wardIsoCheckBox.text")); // NOI18N
wardIsoCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
wardIsoCheckBoxActionPerformed(evt);
}
});
shininessField.setText(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.shininessField.text")); // NOI18N
shininessField.setToolTipText(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.shininessField.toolTipText")); // NOI18N
shininessField.setInputVerifier(new ShininessVerifier());
shininessField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
shininessFieldActionPerformed(evt);
}
});
shininessField.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
shininessFieldKeyTyped(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.jLabel1.text")); // NOI18N
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(shininessField, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(wardIsoCheckBox)))
.addContainerGap(51, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(wardIsoCheckBox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(shininessField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addContainerGap(43, Short.MAX_VALUE))
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@ -523,10 +587,12 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(paintingPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(terrainOpsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(terrainOpsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
.addComponent(hintPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 891, Short.MAX_VALUE)
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 901, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -534,21 +600,26 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(toolSettingsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)
.addComponent(toolSettingsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE)
.addComponent(paintingPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(hintPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(terrainOpsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(terrainOpsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
jScrollPane3.setViewportView(jPanel1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 920, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
@ -695,6 +766,28 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
setHintText((TerrainTool) null);
}
}//GEN-LAST:event_smoothTerrainButtonActionPerformed
private void shininessFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shininessFieldActionPerformed
try {
Float f = new Float(shininessField.getText());
editorController.setShininess(Math.max(0, f));
} catch (Exception e) {
return;
}
}//GEN-LAST:event_shininessFieldActionPerformed
private void wardIsoCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_wardIsoCheckBoxActionPerformed
editorController.setWardIsoEnabled(wardIsoCheckBox.isSelected());
}//GEN-LAST:event_wardIsoCheckBoxActionPerformed
private void shininessFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_shininessFieldKeyTyped
if (KeyEvent.VK_ENTER == evt.getKeyCode() ||
KeyEvent.VK_TAB == evt.getKeyCode() ){
shininessFieldActionPerformed(null);
}
}//GEN-LAST:event_shininessFieldKeyTyped
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton addTextureButton;
private javax.swing.JButton createTerrainButton;
@ -705,9 +798,12 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
private javax.swing.JPanel hintPanel;
private javax.swing.JTextArea hintTextArea;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JToolBar.Separator jSeparator1;
private javax.swing.JToolBar.Separator jSeparator2;
private javax.swing.JToolBar jToolBar1;
@ -722,6 +818,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
private javax.swing.JLabel remainingTexturesLabel;
private javax.swing.JButton removeTextureButton;
private javax.swing.JToggleButton roughTerrainButton;
private javax.swing.JTextField shininessField;
private javax.swing.JToggleButton smoothTerrainButton;
private javax.swing.ButtonGroup terrainModButtonGroup;
private javax.swing.JPanel terrainOpsPanel;
@ -729,8 +826,27 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
private javax.swing.JTable textureTable;
private javax.swing.JPanel toolSettingsPanel;
private javax.swing.JCheckBox triPlanarCheckBox;
private javax.swing.JCheckBox wardIsoCheckBox;
// End of variables declaration//GEN-END:variables
private class ShininessVerifier extends InputVerifier {
@Override
public boolean verify(JComponent input) {
if (input instanceof javax.swing.JTextField) {
String text = ((javax.swing.JTextField)input).getText();
try {
Float f = new Float(text);
if (f > 0)
return true;
} catch (Exception e) {
return false;
}
}
return false;
}
}
/**
* Gets default instance. Do not use directly: reserved for *.settings files only,
* i.e. deserialization routines; otherwise you could get a non-deserialized instance.
@ -1147,6 +1263,8 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
editorController.enableTextureButtons();
triPlanarCheckBox.setSelected(editorController.isTriPlanarEnabled());
wardIsoCheckBox.setSelected(editorController.isWardIsoEnabled());
shininessField.setText(""+editorController.getShininess());
}
protected void clearTextureTable() {

@ -51,8 +51,6 @@ disabled.modules=\
org.netbeans.modules.jellytools,\
org.netbeans.modules.jellytools.ide,\
org.netbeans.modules.jellytools.java,\
org.netbeans.modules.jellytools.platform,\
org.netbeans.modules.jemmy,\
org.netbeans.modules.maven,\
org.netbeans.modules.maven.coverage,\
org.netbeans.modules.maven.embedder,\

Loading…
Cancel
Save