Fixed some issues with SDK lodGenerator wizard

- setting 10 lod levels was not working
- generating lod levels didn't mark the file as modified if there was no lod levels before.
experimental
Nehon 11 years ago
parent 388ad9157f
commit 65aad55b10
  1. 12
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/Bundle.properties
  2. 12
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/GenerateLODTool.java
  3. 72
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/GenerateLODVisualPanel1.form
  4. 81
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/GenerateLODVisualPanel1.java
  5. 13
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/GenerateLODWizardPanel1.java

@ -15,17 +15,17 @@ GenerateLODVisualPanel1.labelLevel3.text=Level 3
GenerateLODVisualPanel1.valueLevel3.text=
GenerateLODVisualPanel1.valueLevel4.text=
GenerateLODVisualPanel1.labelLevel4.text=Level 4
GenerateLODVisualPanel1.labelLevel5.text=Level 4
GenerateLODVisualPanel1.labelLevel5.text=Level 5
GenerateLODVisualPanel1.valueLevel5.text=
GenerateLODVisualPanel1.labelLevel6.text=Level 5
GenerateLODVisualPanel1.labelLevel6.text=Level 6
GenerateLODVisualPanel1.valueLevel6.text=
GenerateLODVisualPanel1.valueLevel7.text=
GenerateLODVisualPanel1.labelLevel7.text=Level 6
GenerateLODVisualPanel1.labelLevel8.text=Level 7
GenerateLODVisualPanel1.labelLevel7.text=Level 7
GenerateLODVisualPanel1.labelLevel8.text=Level 8
GenerateLODVisualPanel1.valueLevel8.text=
GenerateLODVisualPanel1.valueLevel9.text=
GenerateLODVisualPanel1.labelLevel9.text=Level 8
GenerateLODVisualPanel1.labelLevel10.text=Level 9
GenerateLODVisualPanel1.labelLevel9.text=Level 9
GenerateLODVisualPanel1.labelLevel10.text=Level 10
GenerateLODVisualPanel1.valueLevel10.text=
GenerateLODVisualPanel1.labelLevel5.toolTipText=
GenerateLODVisualPanel1.estLabel1.text=

@ -65,7 +65,12 @@ public class GenerateLODTool extends AbstractToolWizardAction {
Geometry geom = rootNode.getLookup().lookup(Geometry.class);
Mesh mesh = geom.getMesh();
if (mesh != null) {
mesh.setLodLevels((VertexBuffer[]) undoObject);
VertexBuffer[] vbs = (VertexBuffer[]) undoObject;
if (vbs.length>0){
mesh.setLodLevels((VertexBuffer[]) undoObject);
}else{
mesh.setLodLevels(null);
}
}
}
@ -133,9 +138,12 @@ public class GenerateLODTool extends AbstractToolWizardAction {
}
}
if(lods == null){
return new VertexBuffer[0];
}
return lods;
}
return null;
}
}
}

@ -246,58 +246,76 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="estLabel1" alignment="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="estLabel2" alignment="1" min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="estLabel3" alignment="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="estLabel4" alignment="1" min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="estLabel5" alignment="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel5" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="estLabel6" alignment="1" min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel6" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="estLabel7" alignment="1" min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel7" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="estLabel8" alignment="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel8" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel9" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel9" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="estLabel9" alignment="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLevel9" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLevel9" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">

@ -369,50 +369,59 @@ public final class GenerateLODVisualPanel1 extends JPanel {
valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(valuePanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel1)
.addComponent(valueLevel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(estLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(estLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel1)
.addComponent(valueLevel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel2)
.addComponent(valueLevel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(estLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(estLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel2)
.addComponent(valueLevel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel3)
.addComponent(valueLevel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(estLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(estLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel3)
.addComponent(valueLevel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel4)
.addComponent(valueLevel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(estLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(estLabel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel4)
.addComponent(valueLevel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel5)
.addComponent(valueLevel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(estLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(estLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel5)
.addComponent(valueLevel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel6)
.addComponent(valueLevel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(estLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(estLabel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel6)
.addComponent(valueLevel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel7)
.addComponent(valueLevel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(estLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(estLabel7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel7)
.addComponent(valueLevel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel8)
.addComponent(valueLevel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(estLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(estLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel8)
.addComponent(valueLevel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel9)
.addComponent(valueLevel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(estLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(estLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel9)
.addComponent(valueLevel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(valuePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLevel10)

@ -101,12 +101,13 @@ public class GenerateLODWizardPanel1 implements WizardDescriptor.ValidatingPanel
float[] vals = new float[component.getValuesFields().size()];
int nbValues = 0;
for (int i = 0; i < component.getValuesFields().size(); i++) {
try {
String text = component.getValuesFields().get(i).getText();
if(!text.trim().equals("")){
vals[i] = Float.parseFloat(text);
nbValues++;
}else{
if (i == 0) {
if (JOptionPane.showConfirmDialog(getComponent(),
@ -116,16 +117,14 @@ public class GenerateLODWizardPanel1 implements WizardDescriptor.ValidatingPanel
} else {
throw new WizardValidationException(null, "No reduction value set", null);
}
}else{
values = new float[i];
System.arraycopy(vals, 0, values, 0, i);
}
return;
}
}
} catch (NumberFormatException e) {
throw new WizardValidationException( component.getValuesFields().get(i), "Invalid value for level "+(i+1), null);
}
}
values = new float[nbValues];
System.arraycopy(vals, 0, values, 0, nbValues);
}
}

Loading…
Cancel
Save