diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometry.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometry.java deleted file mode 100644 index 1160cda82..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometry.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2009-2010 jMonkeyEngine - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'jMonkeyEngine' nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package com.jme3.gde.core.sceneexplorer.nodes.actions.impl; - -import com.jme3.asset.AssetManager; -import com.jme3.material.Material; -import com.jme3.math.ColorRGBA; -import com.jme3.math.Quaternion; -import com.jme3.scene.Geometry; -import com.jme3.scene.shape.Box; -import com.jme3.scene.shape.Line; -import com.jme3.scene.shape.Quad; -import com.jme3.scene.shape.Sphere; - -/** - * - * @author david.bernard.31 - */ -public class NewGeometry { - - public static Material material(AssetManager assetManaget, NewGeometrySettings cfg) { - Material mat = new Material(assetManaget, "Common/MatDefs/Misc/Unshaded.j3md"); - ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor(); - mat.setColor("Color", c); - return mat; - } - - public static Geometry box(AssetManager assetManager) { - NewGeometrySettings cfg = new NewGeometrySettings(); - Box b = new Box(cfg.getBoxX(), cfg.getBoxY(), cfg.getBoxZ()); - b.setMode(cfg.getBoxMode()); - Geometry geom = new Geometry(cfg.getBoxName(), b); - geom.setMaterial(material(assetManager, cfg)); - return geom; - } - - public static Geometry sphere(AssetManager assetManager) { - NewGeometrySettings cfg = new NewGeometrySettings(); - Sphere b = new Sphere( - cfg.getSphereZSamples() - , cfg.getSpherRadialSamples() - , cfg.getSphereRadius() - , cfg.getSphereUseEvenSlices() - , cfg.getSphereInterior() - ); - b.setMode(cfg.getSphereMode()); - Geometry geom = new Geometry(cfg.getSphereName(), b); - geom.setMaterial(material(assetManager, cfg)); - return geom; - } - - public static Geometry line(AssetManager assetManager) { - NewGeometrySettings cfg = new NewGeometrySettings(); - Line b = new Line(cfg.getLineStart(), cfg.getLineEnd()); - b.setMode(cfg.getLineMode()); - Geometry geom = new Geometry(cfg.getLineName(), b); - geom.setMaterial(material(assetManager, cfg)); - return geom; - } - - public static Geometry quad(AssetManager assetManager) { - NewGeometrySettings cfg = new NewGeometrySettings(); - Quad b = new Quad(cfg.getQuadWidth(), cfg.getQuadHeight(), cfg.getQuadFlipCoords()); - b.setMode(cfg.getQuadMode()); - Geometry geom = new Geometry(cfg.getQuadName(), b); - switch(cfg.getQuadPlan()) { - case XZ: { - Quaternion q = new Quaternion(); - q.fromAngles((float)Math.PI/-2f, 0.0f, 0.0f); - geom.setLocalRotation(q); - break; - } - case YZ: { - Quaternion q = new Quaternion(); - q.fromAngles(0.0f, (float)Math.PI/-2f, 0.0f); - geom.setLocalRotation(q); - break; - } - } - geom.setMaterial(material(assetManager, cfg)); - return geom; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryBoxAction.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryBoxAction.java index 680e0ca35..960a03da1 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryBoxAction.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryBoxAction.java @@ -31,11 +31,15 @@ */ package com.jme3.gde.core.sceneexplorer.nodes.actions.impl; +import com.jme3.asset.AssetManager; import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractNewSpatialAction; import com.jme3.gde.core.sceneexplorer.nodes.actions.NewGeometryAction; +import com.jme3.material.Material; +import com.jme3.math.ColorRGBA; import com.jme3.scene.Geometry; import com.jme3.scene.Node; import com.jme3.scene.Spatial; +import com.jme3.scene.shape.Box; /** * @@ -50,8 +54,24 @@ public class NewGeometryBoxAction extends AbstractNewSpatialAction implements Ne @Override protected Spatial doCreateSpatial(Node parent) { - Geometry geom = NewGeometry.box(pm); + Geometry geom = box(pm); parent.attachChild(geom); return geom; } + + static Material material(AssetManager assetManaget, NewGeometrySettings cfg) { + Material mat = new Material(assetManaget, "Common/MatDefs/Misc/Unshaded.j3md"); + ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor(); + mat.setColor("Color", c); + return mat; + } + + static Geometry box(AssetManager assetManager) { + NewGeometrySettings cfg = new NewGeometrySettings(); + Box b = new Box(cfg.getBoxX(), cfg.getBoxY(), cfg.getBoxZ()); + b.setMode(cfg.getBoxMode()); + Geometry geom = new Geometry(cfg.getBoxName(), b); + geom.setMaterial(material(assetManager, cfg)); + return geom; + } } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryLineAction.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryLineAction.java index 5da424f86..124968444 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryLineAction.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryLineAction.java @@ -31,11 +31,15 @@ */ package com.jme3.gde.core.sceneexplorer.nodes.actions.impl; +import com.jme3.asset.AssetManager; import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractNewSpatialAction; import com.jme3.gde.core.sceneexplorer.nodes.actions.NewGeometryAction; +import com.jme3.material.Material; +import com.jme3.math.ColorRGBA; import com.jme3.scene.Geometry; import com.jme3.scene.Node; import com.jme3.scene.Spatial; +import com.jme3.scene.shape.Line; /** * @@ -50,8 +54,25 @@ public class NewGeometryLineAction extends AbstractNewSpatialAction implements N @Override protected Spatial doCreateSpatial(Node parent) { - Geometry geom = NewGeometry.line(pm); + Geometry geom = line(pm); parent.attachChild(geom); return geom; } + + static Material material(AssetManager assetManaget, NewGeometrySettings cfg) { + Material mat = new Material(assetManaget, "Common/MatDefs/Misc/Unshaded.j3md"); + ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor(); + mat.setColor("Color", c); + return mat; + } + + static Geometry line(AssetManager assetManager) { + NewGeometrySettings cfg = new NewGeometrySettings(); + Line b = new Line(cfg.getLineStart(), cfg.getLineEnd()); + b.setMode(cfg.getLineMode()); + Geometry geom = new Geometry(cfg.getLineName(), b); + geom.setMaterial(material(assetManager, cfg)); + return geom; + } + } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryQuadAction.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryQuadAction.java index 581ea5a43..00634edac 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryQuadAction.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryQuadAction.java @@ -31,11 +31,16 @@ */ package com.jme3.gde.core.sceneexplorer.nodes.actions.impl; +import com.jme3.asset.AssetManager; import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractNewSpatialAction; import com.jme3.gde.core.sceneexplorer.nodes.actions.NewGeometryAction; +import com.jme3.material.Material; +import com.jme3.math.ColorRGBA; +import com.jme3.math.Quaternion; import com.jme3.scene.Geometry; import com.jme3.scene.Node; import com.jme3.scene.Spatial; +import com.jme3.scene.shape.Quad; /** * @@ -50,8 +55,38 @@ public class NewGeometryQuadAction extends AbstractNewSpatialAction implements N @Override protected Spatial doCreateSpatial(Node parent) { - Geometry geom = NewGeometry.quad(pm); + Geometry geom = quad(pm); parent.attachChild(geom); return geom; } + + static Material material(AssetManager assetManaget, NewGeometrySettings cfg) { + Material mat = new Material(assetManaget, "Common/MatDefs/Misc/Unshaded.j3md"); + ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor(); + mat.setColor("Color", c); + return mat; + } + + static Geometry quad(AssetManager assetManager) { + NewGeometrySettings cfg = new NewGeometrySettings(); + Quad b = new Quad(cfg.getQuadWidth(), cfg.getQuadHeight(), cfg.getQuadFlipCoords()); + b.setMode(cfg.getQuadMode()); + Geometry geom = new Geometry(cfg.getQuadName(), b); + switch(cfg.getQuadPlan()) { + case XZ: { + Quaternion q = new Quaternion(); + q.fromAngles((float)Math.PI/-2f, 0.0f, 0.0f); + geom.setLocalRotation(q); + break; + } + case YZ: { + Quaternion q = new Quaternion(); + q.fromAngles(0.0f, (float)Math.PI/-2f, 0.0f); + geom.setLocalRotation(q); + break; + } + } + geom.setMaterial(material(assetManager, cfg)); + return geom; + } } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettings.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettings.java index e4220512d..accd1e623 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettings.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettings.java @@ -355,7 +355,7 @@ public class NewGeometrySettings implements Serializable, PreferenceChangeListen } protected Mode getMode(String baseName) { - return Mode.values()[pref.getInt(baseName, Mode.Lines.ordinal())]; + return Mode.values()[pref.getInt(baseName, Mode.Triangles.ordinal())]; } public void putMode(String baseName, Mode value) { diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettingsTopComponent.form b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettingsTopComponent.form index 5f14c1f25..c9a58f597 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettingsTopComponent.form +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettingsTopComponent.form @@ -54,23 +54,22 @@ - + - - + + + - - - - - + - - - + + + + + @@ -80,20 +79,25 @@ - - - - + + + - + + + + - + + + + - + @@ -185,48 +189,32 @@ - + - - + + + + + + + + + + - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + - @@ -236,35 +224,36 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - + + - - - + + + - + @@ -382,32 +371,25 @@ - - + + + + + - + + - + - - - - - - + + - + - - - - - - - - + + - @@ -418,24 +400,27 @@ - - - - + + + + + + + + - - + @@ -527,23 +512,20 @@ - + - + + - - - + + + + - - - - - - + @@ -554,18 +536,20 @@ - - - - - + + + + + + + - + diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettingsTopComponent.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettingsTopComponent.java index ab35e434c..8c97e171e 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettingsTopComponent.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySettingsTopComponent.java @@ -53,7 +53,7 @@ import org.openide.windows.TopComponent; //iconBase="SET/PATH/TO/ICON/HERE", persistenceType = TopComponent.PERSISTENCE_ALWAYS ) -@TopComponent.Registration(mode = "output", openAtStartup = false) +@TopComponent.Registration(mode = "commonpalette", openAtStartup = false) @ActionID(category = "Window", id = "com.jme3.gde.core.sceneexplorer.nodes.actions.impl.NewGeometrySettingsTopComponent") @ActionReference(path = "Menu/Window" /*, position = 333 */) @TopComponent.OpenActionRegistration( @@ -62,7 +62,7 @@ import org.openide.windows.TopComponent; ) @Messages({ "CTL_NewGeometrySettingsAction=NewGeometrySettings", - "CTL_NewGeometrySettingsTopComponent=NewGeometrySettings Window", + "CTL_NewGeometrySettingsTopComponent=NewGeometrySettings", "HINT_NewGeometrySettingsTopComponent=This is a NewGeometrySettings window" }) public final class NewGeometrySettingsTopComponent extends TopComponent { @@ -176,39 +176,41 @@ public final class NewGeometrySettingsTopComponent extends TopComponent { .addContainerGap() .addGroup(boxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(boxPanelLayout.createSequentialGroup() - .addComponent(boxXLabel) + .addComponent(boxZLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(boxXSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(26, 26, 26) + .addComponent(boxZSpinner)) + .addGroup(boxPanelLayout.createSequentialGroup() .addComponent(boxYLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(boxYSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(28, 28, 28) - .addComponent(boxZLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(boxZSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(boxYSpinner)) .addGroup(boxPanelLayout.createSequentialGroup() - .addComponent(boxNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE) + .addComponent(boxXLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(boxModeComboBox, 0, 133, Short.MAX_VALUE))) + .addComponent(boxXSpinner)) + .addComponent(boxModeComboBox, 0, 224, Short.MAX_VALUE) + .addComponent(boxNameTextField, javax.swing.GroupLayout.Alignment.TRAILING)) .addContainerGap()) ); boxPanelLayout.setVerticalGroup( boxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, boxPanelLayout.createSequentialGroup() .addContainerGap() - .addGroup(boxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) - .addComponent(boxNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(boxModeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(boxNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(boxModeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(5, 5, 5) .addGroup(boxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(boxXSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(boxXLabel) + .addComponent(boxXSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(boxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(boxYLabel) - .addComponent(boxYSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(boxZSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(boxZLabel)) - .addContainerGap(197, Short.MAX_VALUE)) + .addComponent(boxYSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(boxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(boxZLabel) + .addComponent(boxZSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(233, Short.MAX_VALUE)) ); jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(NewGeometrySettingsTopComponent.class, "NewGeometrySettingsTopComponent.boxPanel.TabConstraints.tabTitle"), boxPanel); // NOI18N @@ -262,63 +264,55 @@ public final class NewGeometrySettingsTopComponent extends TopComponent { .addGroup(spherePanelLayout.createSequentialGroup() .addContainerGap() .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(spherePanelLayout.createSequentialGroup() - .addComponent(sphereNameTextField) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(sphereModeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(sphereNameTextField) + .addComponent(sphereRadiusLabel) + .addComponent(sphereModeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(spherePanelLayout.createSequentialGroup() .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(sphereRadialSamplesLabel) .addComponent(sphereZSamplesLabel) + .addComponent(sphereUseEvenSlicesLabel) + .addComponent(sphereInteriorLabel)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(sphereZSamplesSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE) + .addComponent(sphereRadialSamplesSpinner) + .addComponent(sphereRadiusSpinner) .addGroup(spherePanelLayout.createSequentialGroup() .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(sphereRadialSamplesLabel) - .addComponent(sphereRadiusLabel)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(sphereRadiusSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(spherePanelLayout.createSequentialGroup() - .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addGroup(spherePanelLayout.createSequentialGroup() - .addComponent(sphereRadialSamplesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(sphereUseEvenSlicesLabel)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, spherePanelLayout.createSequentialGroup() - .addComponent(sphereZSamplesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(144, 144, 144) - .addComponent(sphereInteriorLabel))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(sphereInteriorCheckBox) - .addComponent(sphereUseEvenSlicesCheckBox)))))) - .addGap(0, 164, Short.MAX_VALUE))) + .addComponent(sphereInteriorCheckBox) + .addComponent(sphereUseEvenSlicesCheckBox)) + .addGap(0, 0, Short.MAX_VALUE))))) .addContainerGap()) ); spherePanelLayout.setVerticalGroup( spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(spherePanelLayout.createSequentialGroup() - .addGap(18, 18, 18) - .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(spherePanelLayout.createSequentialGroup() - .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(sphereNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(sphereModeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(4, 4, 4) - .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(sphereRadialSamplesLabel) - .addComponent(sphereRadialSamplesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(sphereUseEvenSlicesLabel))) - .addComponent(sphereUseEvenSlicesCheckBox)) + .addContainerGap() + .addComponent(sphereNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(3, 3, 3) + .addComponent(sphereModeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(sphereRadialSamplesLabel) + .addComponent(sphereRadialSamplesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(5, 5, 5) + .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(sphereZSamplesLabel) + .addComponent(sphereZSamplesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(8, 8, 8) + .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(sphereRadiusLabel) + .addComponent(sphereRadiusSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(sphereZSamplesLabel, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(sphereZSamplesSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(sphereInteriorLabel, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(sphereInteriorCheckBox, javax.swing.GroupLayout.Alignment.TRAILING)) + .addComponent(sphereUseEvenSlicesLabel) + .addComponent(sphereUseEvenSlicesCheckBox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(sphereRadiusSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(sphereRadiusLabel)) - .addContainerGap(147, Short.MAX_VALUE)) + .addGroup(spherePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(sphereInteriorLabel) + .addComponent(sphereInteriorCheckBox)) + .addContainerGap(184, Short.MAX_VALUE)) ); jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(NewGeometrySettingsTopComponent.class, "NewGeometrySettingsTopComponent.spherePanel.TabConstraints.tabTitle"), spherePanel); // NOI18N @@ -366,48 +360,46 @@ public final class NewGeometrySettingsTopComponent extends TopComponent { .addGroup(quadPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(quadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(quadModeComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(quadNameTextField) + .addComponent(jComboBox2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(quadPanelLayout.createSequentialGroup() - .addComponent(quadNameTextField) + .addComponent(quadFlipCoordLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(quadModeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(quadFlipCoordCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 39, Short.MAX_VALUE)) .addGroup(quadPanelLayout.createSequentialGroup() .addGroup(quadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(quadFlipCoordLabel) - .addGroup(quadPanelLayout.createSequentialGroup() - .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(quadWidthLabel))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(quadWidthLabel) + .addComponent(quadHeightLabel)) + .addGap(38, 38, 38) .addGroup(quadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(quadFlipCoordCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(quadPanelLayout.createSequentialGroup() - .addComponent(quadWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(quadHeightLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(quadHeightSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(0, 176, Short.MAX_VALUE))) + .addComponent(quadHeightSpinner) + .addComponent(quadWidthSpinner)))) .addContainerGap()) ); quadPanelLayout.setVerticalGroup( quadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(quadPanelLayout.createSequentialGroup() .addContainerGap() - .addGroup(quadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(quadNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(quadModeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(quadNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(4, 4, 4) + .addComponent(quadModeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(8, 8, 8) .addGroup(quadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(quadWidthLabel) - .addComponent(quadWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(quadWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(quadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(quadHeightLabel) - .addComponent(quadHeightSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(quadHeightSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(quadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(quadFlipCoordLabel) .addComponent(quadFlipCoordCheckBox)) - .addContainerGap(166, Short.MAX_VALUE)) + .addContainerGap(201, Short.MAX_VALUE)) ); jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(NewGeometrySettingsTopComponent.class, "NewGeometrySettingsTopComponent.quadPanel.TabConstraints.tabTitle"), quadPanel); // NOI18N @@ -437,38 +429,37 @@ public final class NewGeometrySettingsTopComponent extends TopComponent { linePanel.setLayout(linePanelLayout); linePanelLayout.setHorizontalGroup( linePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(linePanelLayout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, linePanelLayout.createSequentialGroup() .addContainerGap() - .addGroup(linePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(linePanelLayout.createSequentialGroup() - .addComponent(lineNameTextField) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(linePanelLayout.createSequentialGroup() - .addComponent(lineStartLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lineStartTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(78, 78, 78) + .addGroup(linePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(lineNameTextField) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, linePanelLayout.createSequentialGroup() .addComponent(lineEndLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(lineEndTextField)) + .addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, linePanelLayout.createSequentialGroup() + .addComponent(lineStartLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lineEndTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 169, Short.MAX_VALUE))) + .addComponent(lineStartTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 177, Short.MAX_VALUE))) .addContainerGap()) ); linePanelLayout.setVerticalGroup( linePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(linePanelLayout.createSequentialGroup() .addContainerGap() - .addGroup(linePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(lineNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(1, 1, 1) + .addComponent(lineNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(5, 5, 5) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(linePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lineStartLabel) - .addComponent(lineStartTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lineStartTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(8, 8, 8) + .addGroup(linePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lineEndLabel) .addComponent(lineEndTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(203, Short.MAX_VALUE)) + .addContainerGap(259, Short.MAX_VALUE)) ); jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(NewGeometrySettingsTopComponent.class, "NewGeometrySettingsTopComponent.linePanel.TabConstraints.tabTitle"), linePanel); // NOI18N diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySphereAction.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySphereAction.java index 0c67ce760..842442ffd 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySphereAction.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometrySphereAction.java @@ -31,11 +31,15 @@ */ package com.jme3.gde.core.sceneexplorer.nodes.actions.impl; +import com.jme3.asset.AssetManager; import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractNewSpatialAction; import com.jme3.gde.core.sceneexplorer.nodes.actions.NewGeometryAction; +import com.jme3.material.Material; +import com.jme3.math.ColorRGBA; import com.jme3.scene.Geometry; import com.jme3.scene.Node; import com.jme3.scene.Spatial; +import com.jme3.scene.shape.Sphere; /** * @@ -50,8 +54,31 @@ public class NewGeometrySphereAction extends AbstractNewSpatialAction implements @Override protected Spatial doCreateSpatial(Node parent) { - Geometry geom = NewGeometry.sphere(pm); + Geometry geom = sphere(pm); parent.attachChild(geom); return geom; } + + static Material material(AssetManager assetManaget, NewGeometrySettings cfg) { + Material mat = new Material(assetManaget, "Common/MatDefs/Misc/Unshaded.j3md"); + ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor(); + mat.setColor("Color", c); + return mat; + } + + static Geometry sphere(AssetManager assetManager) { + NewGeometrySettings cfg = new NewGeometrySettings(); + Sphere b = new Sphere( + cfg.getSphereZSamples() + , cfg.getSpherRadialSamples() + , cfg.getSphereRadius() + , cfg.getSphereUseEvenSlices() + , cfg.getSphereInterior() + ); + b.setMode(cfg.getSphereMode()); + Geometry geom = new Geometry(cfg.getSphereName(), b); + geom.setMaterial(material(assetManager, cfg)); + return geom; + } + }