diff --git a/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryWireBoxAction.java b/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryWireBoxAction.java new file mode 100644 index 00000000..233fe750 --- /dev/null +++ b/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryWireBoxAction.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2009-2024 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.gde.core.sceneexplorer.nodes.actions.AbstractNewSpatialAction; +import com.jme3.gde.core.sceneexplorer.nodes.actions.NewGeometryAction; +import com.jme3.gde.core.sceneexplorer.nodes.primitives.CreateBoxPanel; +import com.jme3.math.Vector3f; +import com.jme3.scene.Geometry; +import com.jme3.scene.Node; +import com.jme3.scene.Spatial; +import com.jme3.scene.debug.WireBox; +import org.openide.DialogDescriptor; +import org.openide.DialogDisplayer; +import org.openide.NotifyDescriptor; + +/** + * Action to create a new primitive (WireBox) + * + * @author MeFisto94 + * @author david.bernard.31 + */ +@org.openide.util.lookup.ServiceProvider(service = NewGeometryAction.class) +public class NewGeometryWireBoxAction extends AbstractNewSpatialAction implements NewGeometryAction { + + CreateBoxPanel form; + + public NewGeometryWireBoxAction() { + name = "WireBox"; + form = new CreateBoxPanel(); + } + + @Override + protected boolean prepareCreateSpatial() { + String msg = "Create new WireBox"; + Object result = DialogDisplayer.getDefault().notify( + new DialogDescriptor(form, msg)); + return (result == NotifyDescriptor.OK_OPTION); + } + + @Override + protected Spatial doCreateSpatial(Node parent) { + Vector3f ext = form.getBoxExtents(); + Geometry geom = form.getNewGeomPanel().handleGeometry( + pm, new WireBox(ext.x, ext.y, ext.z)); + return geom; + } +} diff --git a/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryWireSphereAction.java b/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryWireSphereAction.java new file mode 100644 index 00000000..c99c9c28 --- /dev/null +++ b/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/NewGeometryWireSphereAction.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2009-2024 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.gde.core.sceneexplorer.nodes.actions.AbstractNewSpatialAction; +import com.jme3.gde.core.sceneexplorer.nodes.actions.NewGeometryAction; +import com.jme3.gde.core.sceneexplorer.nodes.primitives.CreateWireSpherePanel; +import com.jme3.scene.Geometry; +import com.jme3.scene.Node; +import com.jme3.scene.Spatial; +import com.jme3.scene.debug.WireSphere; +import org.openide.DialogDescriptor; +import org.openide.DialogDisplayer; +import org.openide.NotifyDescriptor; + +/** + * Action to create a new primitive (WireSphere) + * + * @author MeFisto94 + * @author david.bernard.31 + */ +@org.openide.util.lookup.ServiceProvider(service = NewGeometryAction.class) +public class NewGeometryWireSphereAction extends AbstractNewSpatialAction implements NewGeometryAction { + + CreateWireSpherePanel form; + + public NewGeometryWireSphereAction() { + name = "WireSphere"; + form = new CreateWireSpherePanel(); + } + + @Override + protected Spatial doCreateSpatial(Node parent) { + Geometry geom = form.getNewGeomPanel().handleGeometry( + pm, new WireSphere(form.getRadius())); + return geom; + } + + @Override + protected boolean prepareCreateSpatial() { + String msg = "Create new WireSphere"; + Object result = DialogDisplayer.getDefault().notify( + new DialogDescriptor(form, msg)); + return (result == NotifyDescriptor.OK_OPTION); + } +} diff --git a/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/primitives/CreateWireSpherePanel.form b/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/primitives/CreateWireSpherePanel.form new file mode 100644 index 00000000..15b570c8 --- /dev/null +++ b/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/primitives/CreateWireSpherePanel.form @@ -0,0 +1,110 @@ + + +
diff --git a/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/primitives/CreateWireSpherePanel.java b/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/primitives/CreateWireSpherePanel.java new file mode 100644 index 00000000..9a258fa8 --- /dev/null +++ b/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/primitives/CreateWireSpherePanel.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2019- 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.primitives; + +import com.jme3.gde.core.sceneexplorer.nodes.actions.impl.AbstractNewGeometryPanel; + +/** + * This is the Panel which creates a new Primitive (Sphere) + * + * @author MeFisto94 + */ +public class CreateWireSpherePanel extends javax.swing.JPanel { + + /** + * Creates new form CreateBoxPanel + */ + public CreateWireSpherePanel() { + initComponents(); + } + + public AbstractNewGeometryPanel getNewGeomPanel() { + return abstractNewGeometryPanel1; + } + + public float getRadius() { + return (float) spinnerRadius.getValue(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + //