From bc6ced1ed4cd9124b240d0dc5ce0e7a2859ef0ef Mon Sep 17 00:00:00 2001 From: Dokthar Date: Tue, 23 Feb 2016 13:51:36 +0100 Subject: [PATCH 01/19] sdk filters : replaced all Jme*Filter by a unique JmeFilter --- .../gde/core/filters/impl/JmeBloomFilter.java | 87 ------------------ .../filters/impl/JmeCartoonEdgeFilter.java | 89 ------------------- .../filters/impl/JmeColorOverlayFilter.java | 83 ----------------- .../filters/impl/JmeCrossHatchFilter.java | 89 ------------------- .../filters/impl/JmeDepthOfFieldFilter.java | 85 ------------------ .../gde/core/filters/impl/JmeFXAAFilter.java | 86 ------------------ .../{JmeSSAOFilter.java => JmeFilter.java} | 31 +++---- .../gde/core/filters/impl/JmeFogFilter.java | 85 ------------------ .../impl/JmeLightScatteringFilter.java | 88 ------------------ .../filters/impl/JmePosterizationFilter.java | 85 ------------------ .../gde/core/filters/impl/JmeWaterFilter.java | 86 ------------------ 11 files changed, 16 insertions(+), 878 deletions(-) delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeBloomFilter.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeCartoonEdgeFilter.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeColorOverlayFilter.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeCrossHatchFilter.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeDepthOfFieldFilter.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeFXAAFilter.java rename sdk/jme3-core/src/com/jme3/gde/core/filters/impl/{JmeSSAOFilter.java => JmeFilter.java} (81%) delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeFogFilter.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeLightScatteringFilter.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmePosterizationFilter.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeWaterFilter.java diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeBloomFilter.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeBloomFilter.java deleted file mode 100644 index 43c14f10f..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeBloomFilter.java +++ /dev/null @@ -1,87 +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.filters.impl; - -import com.jme3.gde.core.filters.AbstractFilterNode; -import com.jme3.gde.core.filters.FilterNode; -import com.jme3.post.filters.BloomFilter; -import org.openide.loaders.DataObject; -import org.openide.nodes.Node; -import org.openide.nodes.Sheet; - -/** - * - * @author normenhansen - */ -@org.openide.util.lookup.ServiceProvider(service = FilterNode.class) -public class JmeBloomFilter extends AbstractFilterNode { - - public JmeBloomFilter() { - } - - public JmeBloomFilter(BloomFilter filter, DataObject object, boolean readOnly) { - super(filter); - this.dataObject = object; - this.readOnly = readOnly; - } - - @Override - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("Bloom"); - set.setName(Node.class.getName()); - BloomFilter obj = (BloomFilter) filter; - if (obj == null) { - return sheet; - } -// set.put(makeProperty(obj, float.class, "getBloomIntensity", "setBloomIntensity", "Intensity")); -// set.put(makeProperty(obj, float.class, "getBlurScale", "setBlurScale", "Blur Scale")); -// set.put(makeProperty(obj, float.class, "getDownSamplingFactor", "setDownSamplingFactor", "Downsampling Factor")); -// set.put(makeProperty(obj, float.class, "getExposureCutOff", "setExposureCutOff", "Exposure Cutoff")); -// set.put(makeProperty(obj, float.class, "getExposurePower", "setExposurePower", "Exposure Power")); - createFields(BloomFilter.class, set, obj); - sheet.put(set); - return sheet; - - } - - @Override - public Class getExplorerObjectClass() { - return BloomFilter.class; - } - - @Override - public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) { - return new Node[]{new JmeBloomFilter((BloomFilter) key, dataObject, readOnly)}; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeCartoonEdgeFilter.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeCartoonEdgeFilter.java deleted file mode 100644 index 7d88fc174..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeCartoonEdgeFilter.java +++ /dev/null @@ -1,89 +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.filters.impl; - -import com.jme3.gde.core.filters.AbstractFilterNode; -import com.jme3.gde.core.filters.FilterNode; -import com.jme3.post.filters.CartoonEdgeFilter; -import org.openide.loaders.DataObject; -import org.openide.nodes.Node; -import org.openide.nodes.Sheet; - -/** - * - * @author normenhansen - */ -@org.openide.util.lookup.ServiceProvider(service = FilterNode.class) -public class JmeCartoonEdgeFilter extends AbstractFilterNode { - - public JmeCartoonEdgeFilter() { - } - - public JmeCartoonEdgeFilter(CartoonEdgeFilter filter, DataObject object, boolean readOnly) { - super(filter); - this.dataObject = object; - this.readOnly = readOnly; - } - - @Override - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("CartoonEdge"); - set.setName(Node.class.getName()); - CartoonEdgeFilter obj = (CartoonEdgeFilter) filter; - if (obj == null) { - return sheet; - } -// set.put(makeProperty(obj, float.class, "getDepthSensitivity", "setDepthSensitivity", "Depth Sensitivity")); -// set.put(makeProperty(obj, float.class, "getDepthThreshold", "setDepthThreshold", "Depth Threshold")); -// set.put(makeProperty(obj, ColorRGBA.class, "getEdgeColor", "setEdgeColor", "Edge Color")); -// set.put(makeProperty(obj, float.class, "getEdgeIntensity", "setEdgeIntensity", "Edge Intensity")); -// set.put(makeProperty(obj, float.class, "getEdgeWidth", "setEdgeWidth", "Edge Width")); -// set.put(makeProperty(obj, float.class, "getNormalSensitivity", "setNormalSensitivity", "Normal Sensitivity")); -// set.put(makeProperty(obj, float.class, "getNormalThreshold", "setNormalThreshold", "Normal Threshold")); - createFields(CartoonEdgeFilter.class, set, obj); - sheet.put(set); - return sheet; - - } - - @Override - public Class getExplorerObjectClass() { - return CartoonEdgeFilter.class; - } - - @Override - public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) { - return new Node[]{new JmeCartoonEdgeFilter((CartoonEdgeFilter) key, dataObject, readOnly)}; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeColorOverlayFilter.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeColorOverlayFilter.java deleted file mode 100644 index b8582e587..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeColorOverlayFilter.java +++ /dev/null @@ -1,83 +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.filters.impl; - -import com.jme3.gde.core.filters.AbstractFilterNode; -import com.jme3.gde.core.filters.FilterNode; -import com.jme3.post.filters.ColorOverlayFilter; -import org.openide.loaders.DataObject; -import org.openide.nodes.Node; -import org.openide.nodes.Sheet; - -/** - * - * @author normenhansen - */ -@org.openide.util.lookup.ServiceProvider(service = FilterNode.class) -public class JmeColorOverlayFilter extends AbstractFilterNode { - - public JmeColorOverlayFilter() { - } - - public JmeColorOverlayFilter(ColorOverlayFilter filter, DataObject object, boolean readOnly) { - super(filter); - this.dataObject = object; - this.readOnly = readOnly; - } - - @Override - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("ColorOverlay"); - set.setName(Node.class.getName()); - ColorOverlayFilter obj = (ColorOverlayFilter) filter; - if (obj == null) { - return sheet; - } - //set.put(makeProperty(obj, ColorRGBA.class, "getColor", "setColor", "Color")); - createFields(ColorOverlayFilter.class, set, obj); - sheet.put(set); - return sheet; - - } - - @Override - public Class getExplorerObjectClass() { - return ColorOverlayFilter.class; - } - - @Override - public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) { - return new Node[]{new JmeColorOverlayFilter((ColorOverlayFilter) key, dataObject, readOnly)}; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeCrossHatchFilter.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeCrossHatchFilter.java deleted file mode 100644 index 3ed9d4978..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeCrossHatchFilter.java +++ /dev/null @@ -1,89 +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.filters.impl; - -import com.jme3.gde.core.filters.AbstractFilterNode; -import com.jme3.gde.core.filters.FilterNode; -import com.jme3.post.filters.CrossHatchFilter; -import org.openide.loaders.DataObject; -import org.openide.nodes.Node; -import org.openide.nodes.Sheet; - -/** - * - * @author normenhansen - */ -@org.openide.util.lookup.ServiceProvider(service = FilterNode.class) -public class JmeCrossHatchFilter extends AbstractFilterNode { - - public JmeCrossHatchFilter() { - } - - public JmeCrossHatchFilter(CrossHatchFilter filter, DataObject object, boolean readOnly) { - super(filter); - this.dataObject = object; - this.readOnly = readOnly; - } - - @Override - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("CrossHatch"); - set.setName(Node.class.getName()); - CrossHatchFilter obj = (CrossHatchFilter) filter; - if (obj == null) { - return sheet; - } -// set.put(makeProperty(obj, float.class, "getColorInfluenceLine", "setColorInfluenceLine", "Color Influence Line")); -// set.put(makeProperty(obj, float.class, "getColorInfluencePaper", "setColorInfluencePaper", "Color Influence Paper")); -// set.put(makeProperty(obj, float.class, "getFillValue", "setFillValue", "Fill Value")); -// set.put(makeProperty(obj, ColorRGBA.class, "getPaperColor", "setPaperColor", "Paper Color")); -// set.put(makeProperty(obj, ColorRGBA.class, "getLineColor", "setLineColor", "Line Color")); -// set.put(makeProperty(obj, float.class, "getLineDistance", "setLineDistance", "Line Distance")); -// set.put(makeProperty(obj, float.class, "getLineThickness", "setLineThickness", "Line Thickness")); - createFields(CrossHatchFilter.class, set, obj); - sheet.put(set); - return sheet; - - } - - @Override - public Class getExplorerObjectClass() { - return CrossHatchFilter.class; - } - - @Override - public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) { - return new Node[]{new JmeCrossHatchFilter((CrossHatchFilter) key, dataObject, readOnly)}; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeDepthOfFieldFilter.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeDepthOfFieldFilter.java deleted file mode 100644 index f11c0481e..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeDepthOfFieldFilter.java +++ /dev/null @@ -1,85 +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.filters.impl; - -import com.jme3.gde.core.filters.AbstractFilterNode; -import com.jme3.gde.core.filters.FilterNode; -import com.jme3.post.filters.DepthOfFieldFilter; -import org.openide.loaders.DataObject; -import org.openide.nodes.Node; -import org.openide.nodes.Sheet; - -/** - * - * @author normenhansen - */ -@org.openide.util.lookup.ServiceProvider(service = FilterNode.class) -public class JmeDepthOfFieldFilter extends AbstractFilterNode { - - public JmeDepthOfFieldFilter() { - } - - public JmeDepthOfFieldFilter(DepthOfFieldFilter filter, DataObject object, boolean readOnly) { - super(filter); - this.dataObject = object; - this.readOnly = readOnly; - } - - @Override - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("DepthOfField"); - set.setName(Node.class.getName()); - DepthOfFieldFilter obj = (DepthOfFieldFilter) filter; - if (obj == null) { - return sheet; - } -// set.put(makeProperty(obj, float.class, "getBlurScale", "setBlurScale", "Blur Scale")); -// set.put(makeProperty(obj, float.class, "getFocusDistance", "setFocusDistance", "Focus Distance")); -// set.put(makeProperty(obj, float.class, "getFocusRange", "setFocusRange", "Focus Range")); - createFields(DepthOfFieldFilter.class, set, obj); - sheet.put(set); - return sheet; - - } - - @Override - public Class getExplorerObjectClass() { - return DepthOfFieldFilter.class; - } - - @Override - public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) { - return new Node[]{new JmeDepthOfFieldFilter((DepthOfFieldFilter) key, dataObject, readOnly)}; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeFXAAFilter.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeFXAAFilter.java deleted file mode 100644 index 9dcc5c9f1..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeFXAAFilter.java +++ /dev/null @@ -1,86 +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.filters.impl; - -import com.jme3.gde.core.filters.AbstractFilterNode; -import com.jme3.gde.core.filters.FilterNode; -import com.jme3.post.filters.FXAAFilter; -import org.openide.loaders.DataObject; -import org.openide.nodes.Node; -import org.openide.nodes.Sheet; - -/** - * - * @author Rémy Bouquet - */ -@org.openide.util.lookup.ServiceProvider(service = FilterNode.class) -public class JmeFXAAFilter extends AbstractFilterNode { - - public JmeFXAAFilter() { - } - - public JmeFXAAFilter(FXAAFilter filter, DataObject object, boolean readOnly) { - super(filter); - this.dataObject = object; - this.readOnly = readOnly; - } - - @Override - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("FXAA"); - set.setName("FXAA"); - FXAAFilter obj = (FXAAFilter) filter; - - if (obj == null) { - return sheet; - } - - createFields(FXAAFilter.class, set, obj); - - sheet.put(set); - return sheet; - - } - - @Override - public Class getExplorerObjectClass() { - return FXAAFilter.class; - } - - @Override - public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) { - return new Node[]{new JmeFXAAFilter((FXAAFilter) key, dataObject, readOnly)}; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeSSAOFilter.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeFilter.java similarity index 81% rename from sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeSSAOFilter.java rename to sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeFilter.java index 3d5149833..7bdb31cbb 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeSSAOFilter.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine + * Copyright (c) 2009-2016 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,22 +33,24 @@ package com.jme3.gde.core.filters.impl; import com.jme3.gde.core.filters.AbstractFilterNode; import com.jme3.gde.core.filters.FilterNode; -import com.jme3.post.ssao.SSAOFilter; +import com.jme3.post.Filter; import org.openide.loaders.DataObject; import org.openide.nodes.Node; import org.openide.nodes.Sheet; + /** * - * @author Rémy Bouquet + * @author dokthar */ @org.openide.util.lookup.ServiceProvider(service = FilterNode.class) -public class JmeSSAOFilter extends AbstractFilterNode { +public class JmeFilter extends AbstractFilterNode { - public JmeSSAOFilter() { + + public JmeFilter() { } - public JmeSSAOFilter(SSAOFilter filter, DataObject object, boolean readOnly) { + public JmeFilter(Filter filter, DataObject object, boolean readOnly) { super(filter); this.dataObject = object; this.readOnly = readOnly; @@ -57,18 +59,16 @@ public class JmeSSAOFilter extends AbstractFilterNode { @Override protected Sheet createSheet() { Sheet sheet = super.createSheet(); - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("SSAO"); - set.setName("SSAO"); - SSAOFilter obj = (SSAOFilter) filter; - + set.setDisplayName(filter.getName()); + set.setName(Node.class.getName()); + + Filter obj = filter; if (obj == null) { return sheet; } - createFields(SSAOFilter.class, set, obj); - + createFields(filter.getClass(), set, obj); sheet.put(set); return sheet; @@ -76,11 +76,12 @@ public class JmeSSAOFilter extends AbstractFilterNode { @Override public Class getExplorerObjectClass() { - return SSAOFilter.class; + return filter.getClass(); } @Override public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) { - return new Node[]{new JmeSSAOFilter((SSAOFilter) key, dataObject, readOnly)}; + return new Node[]{new JmeFilter((Filter) key, dataObject, readOnly)}; } + } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeFogFilter.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeFogFilter.java deleted file mode 100644 index dd24f2a36..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeFogFilter.java +++ /dev/null @@ -1,85 +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.filters.impl; - -import com.jme3.gde.core.filters.AbstractFilterNode; -import com.jme3.gde.core.filters.FilterNode; -import com.jme3.post.filters.FogFilter; -import org.openide.loaders.DataObject; -import org.openide.nodes.Node; -import org.openide.nodes.Sheet; - -/** - * - * @author normenhansen - */ -@org.openide.util.lookup.ServiceProvider(service = FilterNode.class) -public class JmeFogFilter extends AbstractFilterNode { - - public JmeFogFilter() { - } - - public JmeFogFilter(FogFilter filter, DataObject object, boolean readOnly) { - super(filter); - this.dataObject = object; - this.readOnly = readOnly; - } - - @Override - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("Fog"); - set.setName(Node.class.getName()); - FogFilter obj = (FogFilter) filter; - if (obj == null) { - return sheet; - } -// set.put(makeProperty(obj, float.class, "getFogDistance", "setFogDistance", "Distance")); -// set.put(makeProperty(obj, float.class, "getFogDensity", "setFogDensity", "Density")); -// set.put(makeProperty(obj, ColorRGBA.class, "getFogColor", "setFogColor", "Color")); - createFields(FogFilter.class, set, obj); - sheet.put(set); - return sheet; - - } - - @Override - public Class getExplorerObjectClass() { - return FogFilter.class; - } - - @Override - public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) { - return new Node[]{new JmeFogFilter((FogFilter) key, dataObject, readOnly)}; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeLightScatteringFilter.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeLightScatteringFilter.java deleted file mode 100644 index 3f9253f5e..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeLightScatteringFilter.java +++ /dev/null @@ -1,88 +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.filters.impl; - -import com.jme3.gde.core.filters.AbstractFilterNode; -import com.jme3.gde.core.filters.FilterNode; -import com.jme3.post.filters.LightScatteringFilter; -import org.openide.loaders.DataObject; -import org.openide.nodes.Node; -import org.openide.nodes.Sheet; - -/** - * - * @author normenhansen - */ -@org.openide.util.lookup.ServiceProvider(service = FilterNode.class) -public class JmeLightScatteringFilter extends AbstractFilterNode { - - public JmeLightScatteringFilter() { - } - - public JmeLightScatteringFilter(LightScatteringFilter filter, DataObject object, boolean readOnly) { - super(filter); - this.dataObject = object; - this.readOnly = readOnly; - } - - @Override - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("Blur"); - set.setName(Node.class.getName()); - LightScatteringFilter obj = (LightScatteringFilter) filter; - if (obj == null) { - return sheet; - } -// set.put(makeProperty(obj, float.class, "getBlurStart", "setBlurStart", "Blur Start")); -// set.put(makeProperty(obj, float.class, "getBlurWidth", "setBlurWidth", "Blur Width")); -// set.put(makeProperty(obj, float.class, "getLightDensity", "setLightDensity", "Light Density")); -// set.put(makeProperty(obj, Vector3f.class, "getLightPosition", "setLightPosition", "Light Position")); -// set.put(makeProperty(obj, int.class, "getNbSamples", "setNbSamples", "Sample Number")); - - createFields(LightScatteringFilter.class, set, obj); - sheet.put(set); - return sheet; - - } - - @Override - public Class getExplorerObjectClass() { - return LightScatteringFilter.class; - } - - @Override - public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) { - return new Node[]{new JmeLightScatteringFilter((LightScatteringFilter) key, dataObject, readOnly)}; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmePosterizationFilter.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmePosterizationFilter.java deleted file mode 100644 index b5c8c6ff8..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmePosterizationFilter.java +++ /dev/null @@ -1,85 +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.filters.impl; - -import com.jme3.gde.core.filters.AbstractFilterNode; -import com.jme3.gde.core.filters.FilterNode; -import com.jme3.post.filters.PosterizationFilter; -import org.openide.loaders.DataObject; -import org.openide.nodes.Node; -import org.openide.nodes.Sheet; - -/** - * - * @author normenhansen - */ -@org.openide.util.lookup.ServiceProvider(service = FilterNode.class) -public class JmePosterizationFilter extends AbstractFilterNode { - - public JmePosterizationFilter() { - } - - public JmePosterizationFilter(PosterizationFilter filter, DataObject object, boolean readOnly) { - super(filter); - this.dataObject = object; - this.readOnly = readOnly; - } - - @Override - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("Posterization"); - set.setName(Node.class.getName()); - PosterizationFilter obj = (PosterizationFilter) filter; - if (obj == null) { - return sheet; - } -// set.put(makeProperty(obj, float.class, "getGamma", "setGamma", "Gamma")); -// set.put(makeProperty(obj, int.class, "getNumColors", "setNumColors", "Color Number")); -// set.put(makeProperty(obj, float.class, "getStrength", "setStrength", "Strength")); - createFields(PosterizationFilter.class, set, obj); - sheet.put(set); - return sheet; - - } - - @Override - public Class getExplorerObjectClass() { - return PosterizationFilter.class; - } - - @Override - public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) { - return new Node[]{new JmePosterizationFilter((PosterizationFilter) key, dataObject, readOnly)}; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeWaterFilter.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeWaterFilter.java deleted file mode 100644 index 7b01ee50d..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/impl/JmeWaterFilter.java +++ /dev/null @@ -1,86 +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.filters.impl; - -import com.jme3.gde.core.filters.AbstractFilterNode; -import com.jme3.gde.core.filters.FilterNode; -import com.jme3.water.WaterFilter; -import org.openide.loaders.DataObject; -import org.openide.nodes.Node; -import org.openide.nodes.Sheet; - -/** - * - * @author Rémy Bouquet - */ -@org.openide.util.lookup.ServiceProvider(service = FilterNode.class) -public class JmeWaterFilter extends AbstractFilterNode { - - public JmeWaterFilter() { - } - - public JmeWaterFilter(WaterFilter filter, DataObject object, boolean readOnly) { - super(filter); - this.dataObject = object; - this.readOnly = readOnly; - } - - @Override - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("Water"); - set.setName("Water"); - WaterFilter obj = (WaterFilter) filter; - - if (obj == null) { - return sheet; - } - - createFields(WaterFilter.class, set, obj); - - sheet.put(set); - return sheet; - - } - - @Override - public Class getExplorerObjectClass() { - return WaterFilter.class; - } - - @Override - public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) { - return new Node[]{new JmeWaterFilter((WaterFilter) key, dataObject, readOnly)}; - } -} From 01a6a0e8a00acf302a48851d7e92e9018fd406e9 Mon Sep 17 00:00:00 2001 From: Dokthar Date: Tue, 23 Feb 2016 13:57:06 +0100 Subject: [PATCH 02/19] sdk filters : modification of the lookup for JmeFilter --- .../core/filters/FilterPostProcessorNode.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/FilterPostProcessorNode.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/FilterPostProcessorNode.java index 76c9c7e78..56c137905 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/FilterPostProcessorNode.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/filters/FilterPostProcessorNode.java @@ -75,8 +75,6 @@ public class FilterPostProcessorNode extends AbstractNode { getLookup().lookup(FilterIndexSupport.class).setFilterPostProcessorNode(this); ((FilterChildren) getChildren()).setFilterPostProcessorNode(this); - - } @Override @@ -165,8 +163,8 @@ public class FilterPostProcessorNode extends AbstractNode { public Action[] getActions(boolean context) { // return super.getActions(context); return new Action[]{ - new NewFilterPopup(this) - }; + new NewFilterPopup(this) + }; } public static class FilterChildren extends Children.Keys { @@ -221,15 +219,10 @@ public class FilterPostProcessorNode extends AbstractNode { @Override protected Node[] createNodes(Object t) { Filter filter = (Filter) t; - for (FilterNode di : Lookup.getDefault().lookupAll(FilterNode.class)) { - if (di.getExplorerObjectClass().getName().equals(filter.getClass().getName())) { - Node[] ret = di.createNodes(filter, dataObject, readOnly); - if (ret != null) { - return ret; - } - } - } - return new Node[]{}; + //get JmeFilter, the only FilterNode spi + FilterNode di = Lookup.getDefault().lookup(FilterNode.class); + Node[] ret = di.createNodes(filter, dataObject, readOnly); + return ret; } } } From 03b351f26c686f2be3cd06aa14ae8cb75bf0d268 Mon Sep 17 00:00:00 2001 From: Alrik Date: Tue, 1 Mar 2016 22:58:43 +0100 Subject: [PATCH 03/19] - fix Bone constructor doesn't clone the given Bone object parameter --- jme3-core/src/main/java/com/jme3/animation/Bone.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/animation/Bone.java b/jme3-core/src/main/java/com/jme3/animation/Bone.java index 29c0f38e9..80d03b374 100644 --- a/jme3-core/src/main/java/com/jme3/animation/Bone.java +++ b/jme3-core/src/main/java/com/jme3/animation/Bone.java @@ -155,13 +155,13 @@ public final class Bone implements Savable { userControl = source.userControl; - bindPos = source.bindPos; - bindRot = source.bindRot; - bindScale = source.bindScale; + bindPos = source.bindPos.clone(); + bindRot = source.bindRot.clone(); + bindScale = source.bindScale.clone(); - modelBindInversePos = source.modelBindInversePos; - modelBindInverseRot = source.modelBindInverseRot; - modelBindInverseScale = source.modelBindInverseScale; + modelBindInversePos = source.modelBindInversePos.clone(); + modelBindInverseRot = source.modelBindInverseRot.clone(); + modelBindInverseScale = source.modelBindInverseScale.clone(); // parent and children will be assigned manually.. } From 2297520cf75aa757503776294074cac2299dc407 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Tue, 1 Mar 2016 23:46:06 +0100 Subject: [PATCH 04/19] Fixed the Issue where removing a Control didn't set the dirty flag (made the Model Savable) --- .../core/sceneexplorer/nodes/JmeAnimControl.java | 10 ++++++++++ .../sceneexplorer/nodes/JmeCharacterControl.java | 15 ++++++++++++--- .../sceneexplorer/nodes/JmeGenericControl.java | 12 +++++++++++- .../core/sceneexplorer/nodes/JmeGhostControl.java | 11 +++++++++++ .../sceneexplorer/nodes/JmeRigidBodyControl.java | 11 +++++++++++ .../sceneexplorer/nodes/JmeSkeletonControl.java | 12 +++++++++++- .../sceneexplorer/nodes/JmeTerrainLodControl.java | 10 ++++++++++ .../sceneexplorer/nodes/JmeVehicleControl.java | 10 ++++++++++ 8 files changed, 86 insertions(+), 5 deletions(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java index f76c24c87..ca3ccf9e1 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java @@ -129,6 +129,15 @@ public class JmeAnimControl extends AbstractSceneExplorerNode { }; } + @Override + protected void fireSave(boolean modified) { + Node parent = getParentNode(); + if (parent instanceof AbstractSceneExplorerNode) { + AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; + par.fireSave(modified); + } + } + @Override public boolean canDestroy() { return !readOnly; @@ -139,6 +148,7 @@ public class JmeAnimControl extends AbstractSceneExplorerNode { super.destroy(); final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); try { + fireSave(true); SceneApplication.getApplication().enqueue(new Callable() { public Void call() throws Exception { diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java index 302e76cce..8c294de82 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java @@ -42,12 +42,11 @@ import java.io.IOException; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import javax.swing.Action; -import javax.swing.ImageIcon; import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; +import org.openide.nodes.Node; import org.openide.nodes.Sheet; import org.openide.util.Exceptions; -import org.openide.util.ImageUtilities; import org.openide.util.actions.SystemAction; /** @@ -91,17 +90,27 @@ public class JmeCharacterControl extends AbstractSceneExplorerNode { SystemAction.get(DeleteAction.class) }; } + + @Override + protected void fireSave(boolean modified) { + Node parent = getParentNode(); + if (parent instanceof AbstractSceneExplorerNode) { + AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; + par.fireSave(modified); + } + } @Override public boolean canDestroy() { return !readOnly; } - + @Override public void destroy() throws IOException { super.destroy(); final Spatial spat=getParentNode().getLookup().lookup(Spatial.class); try { + fireSave(true); SceneApplication.getApplication().enqueue(new Callable() { public Void call() throws Exception { diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java index 382c31e78..139870c3c 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java @@ -32,7 +32,6 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.gde.core.icons.IconList; -import com.jme3.gde.core.properties.ScenePropertyChangeListener; import com.jme3.gde.core.scene.SceneApplication; import com.jme3.scene.Spatial; import com.jme3.scene.control.Control; @@ -43,6 +42,7 @@ import java.util.concurrent.ExecutionException; import javax.swing.Action; import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; +import org.openide.nodes.Node; import org.openide.nodes.Sheet; import org.openide.util.Exceptions; import org.openide.util.actions.SystemAction; @@ -121,6 +121,15 @@ public class JmeGenericControl extends AbstractSceneExplorerNode { }; } + @Override + protected void fireSave(boolean modified) { + Node parent = getParentNode(); + if (parent instanceof AbstractSceneExplorerNode) { + AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; + par.fireSave(modified); + } + } + @Override public boolean canDestroy() { return true; @@ -131,6 +140,7 @@ public class JmeGenericControl extends AbstractSceneExplorerNode { super.destroy(); final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); try { + fireSave(true); SceneApplication.getApplication().enqueue(new Callable() { public Void call() throws Exception { spat.removeControl(control); diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java index 51707730b..69c17e015 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java @@ -45,6 +45,7 @@ import java.util.concurrent.ExecutionException; import javax.swing.Action; import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; +import org.openide.nodes.Node; import org.openide.nodes.Sheet; import org.openide.util.Exceptions; import org.openide.util.actions.SystemAction; @@ -91,6 +92,15 @@ public class JmeGhostControl extends AbstractSceneExplorerNode { }; } + @Override + protected void fireSave(boolean modified) { + Node parent = getParentNode(); + if (parent instanceof AbstractSceneExplorerNode) { + AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; + par.fireSave(modified); + } + } + @Override public boolean canDestroy() { return !readOnly; @@ -101,6 +111,7 @@ public class JmeGhostControl extends AbstractSceneExplorerNode { super.destroy(); final Spatial spat=getParentNode().getLookup().lookup(Spatial.class); try { + fireSave(true); SceneApplication.getApplication().enqueue(new Callable() { public Void call() throws Exception { diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java index 3a6b03f6d..c380388f0 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java @@ -45,6 +45,7 @@ import java.util.concurrent.ExecutionException; import javax.swing.Action; import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; +import org.openide.nodes.Node; import org.openide.nodes.Sheet; import org.openide.util.Exceptions; import org.openide.util.actions.SystemAction; @@ -90,6 +91,15 @@ public class JmeRigidBodyControl extends AbstractSceneExplorerNode { SystemAction.get(DeleteAction.class) }; } + + @Override + protected void fireSave(boolean modified) { + Node parent = getParentNode(); + if (parent instanceof AbstractSceneExplorerNode) { + AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; + par.fireSave(modified); + } + } @Override public boolean canDestroy() { @@ -101,6 +111,7 @@ public class JmeRigidBodyControl extends AbstractSceneExplorerNode { super.destroy(); final Spatial spat=getParentNode().getLookup().lookup(Spatial.class); try { + fireSave(true); SceneApplication.getApplication().enqueue(new Callable() { public Void call() throws Exception { diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSkeletonControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSkeletonControl.java index 53a40f106..01c592209 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSkeletonControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSkeletonControl.java @@ -107,7 +107,16 @@ public class JmeSkeletonControl extends AbstractSceneExplorerNode { SystemAction.get(DeleteAction.class) }; } - + + @Override + protected void fireSave(boolean modified) { + Node parent = getParentNode(); + if (parent instanceof AbstractSceneExplorerNode) { + AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; + par.fireSave(modified); + } + } + @Override public boolean canDestroy() { return !readOnly; @@ -118,6 +127,7 @@ public class JmeSkeletonControl extends AbstractSceneExplorerNode { super.destroy(); final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); try { + fireSave(true); SceneApplication.getApplication().enqueue(new Callable() { public Void call() throws Exception { diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainLodControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainLodControl.java index 86fb9432a..50f3342d7 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainLodControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainLodControl.java @@ -93,6 +93,15 @@ public class JmeTerrainLodControl extends AbstractSceneExplorerNode { //SystemAction.get(DeleteAction.class) }; } + + @Override + protected void fireSave(boolean modified) { + Node parent = getParentNode(); + if (parent instanceof AbstractSceneExplorerNode) { + AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; + par.fireSave(modified); + } + } @Override public boolean canDestroy() { @@ -104,6 +113,7 @@ public class JmeTerrainLodControl extends AbstractSceneExplorerNode { super.destroy(); final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); try { + fireSave(true); SceneApplication.getApplication().enqueue(new Callable() { public Void call() throws Exception { diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java index 75531d7ce..eda238351 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java @@ -95,6 +95,15 @@ public class JmeVehicleControl extends AbstractSceneExplorerNode { SystemAction.get(DeleteAction.class) }; } + + @Override + protected void fireSave(boolean modified) { + Node parent = getParentNode(); + if (parent instanceof AbstractSceneExplorerNode) { + AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; + par.fireSave(modified); + } + } @Override public boolean canDestroy() { @@ -106,6 +115,7 @@ public class JmeVehicleControl extends AbstractSceneExplorerNode { super.destroy(); final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); try { + fireSave(true); SceneApplication.getApplication().enqueue(new Callable() { public Void call() throws Exception { From e33e226959ae3f1345a7771d3c46a656398dbf7f Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Wed, 2 Mar 2016 14:11:35 +0100 Subject: [PATCH 05/19] Removed duplicate code and placed it into JmeControl instead --- .../sceneexplorer/nodes/JmeAnimControl.java | 45 +------ .../nodes/JmeCharacterControl.java | 61 +-------- .../core/sceneexplorer/nodes/JmeControl.java | 123 ++++++++++++++++++ .../nodes/JmeGenericControl.java | 56 +------- .../sceneexplorer/nodes/JmeGhostControl.java | 61 +-------- .../nodes/JmeRigidBodyControl.java | 61 +-------- .../nodes/JmeSkeletonControl.java | 58 +-------- .../nodes/JmeTerrainLodControl.java | 43 +----- .../nodes/JmeVehicleControl.java | 53 +------- 9 files changed, 153 insertions(+), 408 deletions(-) create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeControl.java diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java index ca3ccf9e1..e01ad860e 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine + * Copyright (c) 2009-2016 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,19 +34,13 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.animation.AnimControl; import com.jme3.gde.core.icons.IconList; import com.jme3.gde.core.properties.AnimationProperty; -import com.jme3.gde.core.scene.SceneApplication; import com.jme3.gde.core.sceneexplorer.nodes.actions.TrackVisibilityPopup; -import com.jme3.scene.Spatial; import java.awt.Image; -import java.io.IOException; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; import javax.swing.Action; import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; import org.openide.nodes.Node; import org.openide.nodes.Sheet; -import org.openide.util.Exceptions; import org.openide.util.HelpCtx; import org.openide.util.actions.BooleanStateAction; import org.openide.util.actions.SystemAction; @@ -57,7 +51,7 @@ import org.openide.util.actions.SystemAction; */ @org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class) @SuppressWarnings({"unchecked", "rawtypes"}) -public class JmeAnimControl extends AbstractSceneExplorerNode { +public class JmeAnimControl extends JmeControl { private AnimControl animControl; private JmeAnimation playingAnimation = null; @@ -78,6 +72,7 @@ public class JmeAnimControl extends AbstractSceneExplorerNode { lookupContents.add(animControl); setName("AnimControl"); children.setAnimControl(this); + control = animControl; } @Override @@ -130,40 +125,6 @@ public class JmeAnimControl extends AbstractSceneExplorerNode { } @Override - protected void fireSave(boolean modified) { - Node parent = getParentNode(); - if (parent instanceof AbstractSceneExplorerNode) { - AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; - par.fireSave(modified); - } - } - - @Override - public boolean canDestroy() { - return !readOnly; - } - - @Override - public void destroy() throws IOException { - super.destroy(); - final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); - try { - fireSave(true); - SceneApplication.getApplication().enqueue(new Callable() { - - public Void call() throws Exception { - spat.removeControl(animControl); - return null; - } - }).get(); - ((AbstractSceneExplorerNode) getParentNode()).refresh(true); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } - public Class getExplorerObjectClass() { return AnimControl.class; } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java index 8c294de82..2c5a0cfa6 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine + * Copyright (c) 2009-2016 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,20 +34,10 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.bullet.collision.shapes.CollisionShape; import com.jme3.bullet.control.CharacterControl; import com.jme3.gde.core.icons.IconList; -import com.jme3.gde.core.scene.SceneApplication; import com.jme3.math.Vector3f; -import com.jme3.scene.Spatial; import java.awt.Image; -import java.io.IOException; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import javax.swing.Action; -import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; -import org.openide.nodes.Node; import org.openide.nodes.Sheet; -import org.openide.util.Exceptions; -import org.openide.util.actions.SystemAction; /** * @@ -55,7 +45,7 @@ import org.openide.util.actions.SystemAction; */ @org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class) @SuppressWarnings({"unchecked", "rawtypes"}) -public class JmeCharacterControl extends AbstractSceneExplorerNode { +public class JmeCharacterControl extends JmeControl { private static Image smallImage = IconList.player.getImage(); private CharacterControl geom; @@ -68,6 +58,7 @@ public class JmeCharacterControl extends AbstractSceneExplorerNode { getLookupContents().add(this); getLookupContents().add(spatial); this.geom = spatial; + control = spatial; setName("CharacterControl"); } @@ -81,51 +72,6 @@ public class JmeCharacterControl extends AbstractSceneExplorerNode { return smallImage; } - @Override - public Action[] getActions(boolean context) { - return new SystemAction[]{ - // SystemAction.get(CopyAction.class), - // SystemAction.get(CutAction.class), - // SystemAction.get(PasteAction.class), - SystemAction.get(DeleteAction.class) - }; - } - - @Override - protected void fireSave(boolean modified) { - Node parent = getParentNode(); - if (parent instanceof AbstractSceneExplorerNode) { - AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; - par.fireSave(modified); - } - } - - @Override - public boolean canDestroy() { - return !readOnly; - } - - @Override - public void destroy() throws IOException { - super.destroy(); - final Spatial spat=getParentNode().getLookup().lookup(Spatial.class); - try { - fireSave(true); - SceneApplication.getApplication().enqueue(new Callable() { - - public Void call() throws Exception { - spat.removeControl(geom); - return null; - } - }).get(); - ((AbstractSceneExplorerNode)getParentNode()).refresh(true); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } - @Override protected Sheet createSheet() { Sheet sheet = super.createSheet(); @@ -154,6 +100,7 @@ public class JmeCharacterControl extends AbstractSceneExplorerNode { } + @Override public Class getExplorerObjectClass() { return CharacterControl.class; } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeControl.java new file mode 100644 index 000000000..cd876a211 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeControl.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2009-2016 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; + +import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.scene.Spatial; +import com.jme3.scene.control.Control; +import java.io.IOException; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import javax.swing.Action; +import org.openide.actions.DeleteAction; +import org.openide.loaders.DataObject; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.actions.SystemAction; + +/** + * The JmeControl implements the Base Behavior of each Control-Node + * @author MeFisto94 + */ + + +public abstract class JmeControl extends AbstractSceneExplorerNode { + + protected Control control; + public JmeControl() { + super(); + } + + public JmeControl(Children children, DataObject dataObject) { + super(children, dataObject); + } + + public JmeControl(DataObject dataObject) { + super(dataObject); + } + + public JmeControl(Children children) { + super(children); + } + + @Override + public Action[] getActions(boolean context) { + return new SystemAction[]{ + // SystemAction.get(CopyAction.class), + // SystemAction.get(CutAction.class), + // SystemAction.get(PasteAction.class), + SystemAction.get(DeleteAction.class) + }; + } + + @Override + public boolean canDestroy() { + return !readOnly; + } + + @Override + public void destroy() throws IOException { + super.destroy(); + + if (control == null) + return; + + final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); + try { + fireSave(true); + SceneApplication.getApplication().enqueue(new Callable() { + + public Void call() throws Exception { + spat.removeControl(control); + return null; + } + }).get(); + ((AbstractSceneExplorerNode) getParentNode()).refresh(true); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); + } + } + + /* Controls have a parental node containing them */ + @Override + protected void fireSave(boolean modified) { + super.fireSave(true); + Node parent = getParentNode(); + if (parent instanceof AbstractSceneExplorerNode) { + AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; + par.fireSave(modified); + } + } +} \ No newline at end of file diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java index 139870c3c..c49106d9b 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine + * Copyright (c) 2009-2016 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,29 +32,18 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.gde.core.icons.IconList; -import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.scene.Spatial; import com.jme3.scene.control.Control; import java.awt.Image; -import java.io.IOException; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import javax.swing.Action; -import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; -import org.openide.nodes.Node; import org.openide.nodes.Sheet; -import org.openide.util.Exceptions; -import org.openide.util.actions.SystemAction; /** * * @author normenhansen */ @SuppressWarnings({"unchecked", "rawtypes"}) -public class JmeGenericControl extends AbstractSceneExplorerNode { +public class JmeGenericControl extends JmeControl { - private final Control control; private static final Image smallImage = IconList.wheel.getImage(); public JmeGenericControl(Control control, DataObject dataObject) { @@ -63,6 +52,7 @@ public class JmeGenericControl extends AbstractSceneExplorerNode { this.control = control; addToLookup(this); addToLookup(control); + this.control = control; setName(control.getClass().getSimpleName()); } @@ -111,50 +101,12 @@ public class JmeGenericControl extends AbstractSceneExplorerNode { sheet.put(set); } - @Override - public Action[] getActions(boolean context) { - return new SystemAction[]{ - // SystemAction.get(CopyAction.class), - // SystemAction.get(CutAction.class), - // SystemAction.get(PasteAction.class), - SystemAction.get(DeleteAction.class) - }; - } - - @Override - protected void fireSave(boolean modified) { - Node parent = getParentNode(); - if (parent instanceof AbstractSceneExplorerNode) { - AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; - par.fireSave(modified); - } - } - @Override public boolean canDestroy() { return true; } - + @Override - public void destroy() throws IOException { - super.destroy(); - final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); - try { - fireSave(true); - SceneApplication.getApplication().enqueue(new Callable() { - public Void call() throws Exception { - spat.removeControl(control); - return null; - } - }).get(); - ((AbstractSceneExplorerNode) getParentNode()).refresh(true); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } - public Class getExplorerObjectClass() { return control.getClass(); } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java index 69c17e015..5e36618e8 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine + * Copyright (c) 2009-2016 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,21 +34,11 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.bullet.collision.shapes.CollisionShape; import com.jme3.bullet.control.GhostControl; import com.jme3.gde.core.icons.IconList; -import com.jme3.gde.core.scene.SceneApplication; import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; -import com.jme3.scene.Spatial; import java.awt.Image; -import java.io.IOException; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import javax.swing.Action; -import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; -import org.openide.nodes.Node; import org.openide.nodes.Sheet; -import org.openide.util.Exceptions; -import org.openide.util.actions.SystemAction; /** * @@ -56,7 +46,7 @@ import org.openide.util.actions.SystemAction; */ @org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class) @SuppressWarnings({"unchecked", "rawtypes"}) -public class JmeGhostControl extends AbstractSceneExplorerNode { +public class JmeGhostControl extends JmeControl { private static Image smallImage = IconList.ghostControl.getImage(); private GhostControl geom; @@ -69,6 +59,7 @@ public class JmeGhostControl extends AbstractSceneExplorerNode { getLookupContents().add(this); getLookupContents().add(spatial); this.geom = spatial; + control = spatial; setName("GhostControl"); } @@ -82,51 +73,6 @@ public class JmeGhostControl extends AbstractSceneExplorerNode { return smallImage; } - @Override - public Action[] getActions(boolean context) { - return new SystemAction[]{ - // SystemAction.get(CopyAction.class), - // SystemAction.get(CutAction.class), - // SystemAction.get(PasteAction.class), - SystemAction.get(DeleteAction.class) - }; - } - - @Override - protected void fireSave(boolean modified) { - Node parent = getParentNode(); - if (parent instanceof AbstractSceneExplorerNode) { - AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; - par.fireSave(modified); - } - } - - @Override - public boolean canDestroy() { - return !readOnly; - } - - @Override - public void destroy() throws IOException { - super.destroy(); - final Spatial spat=getParentNode().getLookup().lookup(Spatial.class); - try { - fireSave(true); - SceneApplication.getApplication().enqueue(new Callable() { - - public Void call() throws Exception { - spat.removeControl(geom); - return null; - } - }).get(); - ((AbstractSceneExplorerNode)getParentNode()).refresh(true); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } - @Override protected Sheet createSheet() { Sheet sheet = super.createSheet(); @@ -150,6 +96,7 @@ public class JmeGhostControl extends AbstractSceneExplorerNode { } + @Override public Class getExplorerObjectClass() { return GhostControl.class; } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java index c380388f0..cfaf55d63 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine + * Copyright (c) 2009-2016 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,21 +34,11 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.bullet.collision.shapes.CollisionShape; import com.jme3.bullet.control.RigidBodyControl; import com.jme3.gde.core.icons.IconList; -import com.jme3.gde.core.scene.SceneApplication; import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; -import com.jme3.scene.Spatial; import java.awt.Image; -import java.io.IOException; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import javax.swing.Action; -import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; -import org.openide.nodes.Node; import org.openide.nodes.Sheet; -import org.openide.util.Exceptions; -import org.openide.util.actions.SystemAction; /** * @@ -56,7 +46,7 @@ import org.openide.util.actions.SystemAction; */ @org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class) @SuppressWarnings({"unchecked", "rawtypes"}) -public class JmeRigidBodyControl extends AbstractSceneExplorerNode { +public class JmeRigidBodyControl extends JmeControl { private static Image smallImage = IconList.physicsControl.getImage(); private RigidBodyControl geom; @@ -69,6 +59,7 @@ public class JmeRigidBodyControl extends AbstractSceneExplorerNode { getLookupContents().add(spatial); getLookupContents().add(this); this.geom = spatial; + control = spatial; setName("PhysicsControl"); } @@ -82,51 +73,6 @@ public class JmeRigidBodyControl extends AbstractSceneExplorerNode { return smallImage; } - @Override - public Action[] getActions(boolean context) { - return new SystemAction[]{ - // SystemAction.get(CopyAction.class), - // SystemAction.get(CutAction.class), - // SystemAction.get(PasteAction.class), - SystemAction.get(DeleteAction.class) - }; - } - - @Override - protected void fireSave(boolean modified) { - Node parent = getParentNode(); - if (parent instanceof AbstractSceneExplorerNode) { - AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; - par.fireSave(modified); - } - } - - @Override - public boolean canDestroy() { - return !readOnly; - } - - @Override - public void destroy() throws IOException { - super.destroy(); - final Spatial spat=getParentNode().getLookup().lookup(Spatial.class); - try { - fireSave(true); - SceneApplication.getApplication().enqueue(new Callable() { - - public Void call() throws Exception { - spat.removeControl(geom); - return null; - } - }).get(); - ((AbstractSceneExplorerNode)getParentNode()).refresh(true); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } - @Override protected Sheet createSheet() { Sheet sheet = super.createSheet(); @@ -161,6 +107,7 @@ public class JmeRigidBodyControl extends AbstractSceneExplorerNode { } + @Override public Class getExplorerObjectClass() { return RigidBodyControl.class; } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSkeletonControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSkeletonControl.java index 01c592209..8d7771732 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSkeletonControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSkeletonControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine + * Copyright (c) 2009-2016 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,19 +33,10 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.animation.SkeletonControl; import com.jme3.gde.core.icons.IconList; -import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.scene.Spatial; import java.awt.Image; -import java.io.IOException; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import javax.swing.Action; -import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; import org.openide.nodes.Node; import org.openide.nodes.Sheet; -import org.openide.util.Exceptions; -import org.openide.util.actions.SystemAction; /** * @@ -53,7 +44,7 @@ import org.openide.util.actions.SystemAction; */ @org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class) @SuppressWarnings({"unchecked", "rawtypes"}) -public class JmeSkeletonControl extends AbstractSceneExplorerNode { +public class JmeSkeletonControl extends JmeControl { private SkeletonControl skeletonControl; private static Image smallImage = IconList.skeletonControl.getImage(); @@ -64,6 +55,7 @@ public class JmeSkeletonControl extends AbstractSceneExplorerNode { public JmeSkeletonControl(SkeletonControl skeletonControl, JmeBoneChildren children) { super(children); this.skeletonControl = skeletonControl; + control = skeletonControl; lookupContents.add(this); lookupContents.add(skeletonControl); setName("SkeletonControl"); @@ -99,50 +91,6 @@ public class JmeSkeletonControl extends AbstractSceneExplorerNode { } @Override - public Action[] getActions(boolean context) { - return new SystemAction[]{ - // SystemAction.get(CopyAction.class), - // SystemAction.get(CutAction.class), - // SystemAction.get(PasteAction.class), - SystemAction.get(DeleteAction.class) - }; - } - - @Override - protected void fireSave(boolean modified) { - Node parent = getParentNode(); - if (parent instanceof AbstractSceneExplorerNode) { - AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; - par.fireSave(modified); - } - } - - @Override - public boolean canDestroy() { - return !readOnly; - } - - @Override - public void destroy() throws IOException { - super.destroy(); - final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); - try { - fireSave(true); - SceneApplication.getApplication().enqueue(new Callable() { - - public Void call() throws Exception { - spat.removeControl(skeletonControl); - return null; - } - }).get(); - ((AbstractSceneExplorerNode) getParentNode()).refresh(true); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } - public Class getExplorerObjectClass() { return SkeletonControl.class; } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainLodControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainLodControl.java index 50f3342d7..c369fd954 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainLodControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainLodControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine + * Copyright (c) 2009-2016 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,12 +34,10 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.gde.core.icons.IconList; import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.scene.Spatial; import com.jme3.terrain.geomipmap.TerrainLodControl; import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator; import com.jme3.terrain.geomipmap.lodcalc.PerspectiveLodCalculator; import java.awt.Image; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; @@ -58,7 +56,7 @@ import org.openide.util.actions.SystemAction; */ @org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class) @SuppressWarnings({"unchecked", "rawtypes"}) -public class JmeTerrainLodControl extends AbstractSceneExplorerNode { +public class JmeTerrainLodControl extends JmeControl { private static Image smallImage = IconList.wheel.getImage(); private TerrainLodControl terrainLodControl; @@ -71,6 +69,7 @@ public class JmeTerrainLodControl extends AbstractSceneExplorerNode { getLookupContents().add(control); getLookupContents().add(this); this.terrainLodControl = control; + this.control = control; setName("TerrainLodControl"); } @@ -93,41 +92,6 @@ public class JmeTerrainLodControl extends AbstractSceneExplorerNode { //SystemAction.get(DeleteAction.class) }; } - - @Override - protected void fireSave(boolean modified) { - Node parent = getParentNode(); - if (parent instanceof AbstractSceneExplorerNode) { - AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; - par.fireSave(modified); - } - } - - @Override - public boolean canDestroy() { - return !readOnly; - } - - @Override - public void destroy() throws IOException { - super.destroy(); - final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); - try { - fireSave(true); - SceneApplication.getApplication().enqueue(new Callable() { - - public Void call() throws Exception { - spat.removeControl(terrainLodControl); - return null; - } - }).get(); - ((AbstractSceneExplorerNode) getParentNode()).refresh(true); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } @Override protected Sheet createSheet() { @@ -147,6 +111,7 @@ public class JmeTerrainLodControl extends AbstractSceneExplorerNode { } + @Override public Class getExplorerObjectClass() { return TerrainLodControl.class; } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java index eda238351..ec2a5e465 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine + * Copyright (c) 2009-2016 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,9 +38,7 @@ import com.jme3.gde.core.icons.IconList; import com.jme3.gde.core.scene.SceneApplication; import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; -import com.jme3.scene.Spatial; import java.awt.Image; -import java.io.IOException; import java.util.LinkedList; import java.util.List; import java.util.concurrent.Callable; @@ -60,7 +58,7 @@ import org.openide.util.actions.SystemAction; */ @org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class) @SuppressWarnings({"unchecked", "rawtypes"}) -public class JmeVehicleControl extends AbstractSceneExplorerNode { +public class JmeVehicleControl extends JmeControl { private static Image smallImage = IconList.vehicle.getImage(); private VehicleControl vehicle; @@ -73,6 +71,7 @@ public class JmeVehicleControl extends AbstractSceneExplorerNode { getLookupContents().add(vehicle); getLookupContents().add(this); this.vehicle = vehicle; + control = vehicle; setName("VehicleControl"); } @@ -86,51 +85,6 @@ public class JmeVehicleControl extends AbstractSceneExplorerNode { return smallImage; } - @Override - public Action[] getActions(boolean context) { - return new SystemAction[]{ - // SystemAction.get(CopyAction.class), - // SystemAction.get(CutAction.class), - // SystemAction.get(PasteAction.class), - SystemAction.get(DeleteAction.class) - }; - } - - @Override - protected void fireSave(boolean modified) { - Node parent = getParentNode(); - if (parent instanceof AbstractSceneExplorerNode) { - AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent; - par.fireSave(modified); - } - } - - @Override - public boolean canDestroy() { - return !readOnly; - } - - @Override - public void destroy() throws IOException { - super.destroy(); - final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); - try { - fireSave(true); - SceneApplication.getApplication().enqueue(new Callable() { - - public Void call() throws Exception { - spat.removeControl(vehicle); - return null; - } - }).get(); - ((AbstractSceneExplorerNode) getParentNode()).refresh(true); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } - @Override protected Sheet createSheet() { Sheet sheet = super.createSheet(); @@ -172,6 +126,7 @@ public class JmeVehicleControl extends AbstractSceneExplorerNode { } + @Override public Class getExplorerObjectClass() { return VehicleControl.class; } From 449bc443b3891901fcc23e5024ed8b6ac1efe89d Mon Sep 17 00:00:00 2001 From: TehLeo Date: Wed, 2 Mar 2016 16:05:14 +0100 Subject: [PATCH 06/19] Update BufferUtils.java Fixes #395 --- .../main/java/com/jme3/util/BufferUtils.java | 42 +++++++------------ 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/util/BufferUtils.java b/jme3-core/src/main/java/com/jme3/util/BufferUtils.java index 24af81bf6..feb3ff8cd 100644 --- a/jme3-core/src/main/java/com/jme3/util/BufferUtils.java +++ b/jme3-core/src/main/java/com/jme3/util/BufferUtils.java @@ -51,7 +51,6 @@ import java.nio.IntBuffer; import java.nio.LongBuffer; import java.nio.ShortBuffer; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; import java.util.logging.Logger; @@ -1268,7 +1267,6 @@ public final class BufferUtils { System.out.println(store.toString()); } } - private static final AtomicBoolean loadedMethods = new AtomicBoolean(false); private static Method cleanerMethod = null; private static Method cleanMethod = null; private static Method viewedBufferMethod = null; @@ -1288,31 +1286,23 @@ public final class BufferUtils { } } - private static void loadCleanerMethods() { - // If its already true, exit, if not, set it to true. - if (BufferUtils.loadedMethods.getAndSet(true)) { - return; + static { + // Oracle JRE / OpenJDK + cleanerMethod = loadMethod("sun.nio.ch.DirectBuffer", "cleaner"); + cleanMethod = loadMethod("sun.misc.Cleaner", "clean"); + viewedBufferMethod = loadMethod("sun.nio.ch.DirectBuffer", "viewedBuffer"); + if (viewedBufferMethod == null) { + // They changed the name in Java 7 (???) + viewedBufferMethod = loadMethod("sun.nio.ch.DirectBuffer", "attachment"); } - // This could potentially be called many times if used from multiple - // threads - synchronized (BufferUtils.loadedMethods) { - // Oracle JRE / OpenJDK - cleanerMethod = loadMethod("sun.nio.ch.DirectBuffer", "cleaner"); - cleanMethod = loadMethod("sun.misc.Cleaner", "clean"); - viewedBufferMethod = loadMethod("sun.nio.ch.DirectBuffer", "viewedBuffer"); - if (viewedBufferMethod == null) { - // They changed the name in Java 7 (???) - viewedBufferMethod = loadMethod("sun.nio.ch.DirectBuffer", "attachment"); - } - // Apache Harmony - ByteBuffer bb = BufferUtils.createByteBuffer(1); - Class clazz = bb.getClass(); - try { - freeMethod = clazz.getMethod("free"); - } catch (NoSuchMethodException ex) { - } catch (SecurityException ex) { - } + // Apache Harmony + ByteBuffer bb = BufferUtils.createByteBuffer(1); + Class clazz = bb.getClass(); + try { + freeMethod = clazz.getMethod("free"); + } catch (NoSuchMethodException ex) { + } catch (SecurityException ex) { } } @@ -1333,8 +1323,6 @@ public final class BufferUtils { return; } - BufferUtils.loadCleanerMethods(); - try { if (freeMethod != null) { freeMethod.invoke(toBeDestroyed); From 91974a68000ffab22f6fea88004eb7f3c646441a Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Wed, 2 Mar 2016 13:45:50 -0500 Subject: [PATCH 07/19] lwjgl3: use lwjgl's native loader --- .../com/jme3/system/lwjgl/LwjglContext.java | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java index a74b19cdb..20532df36 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java @@ -99,24 +99,6 @@ public abstract class LwjglContext implements JmeContext { return Integer.MAX_VALUE; } - protected void loadNatives() { - if (JmeSystem.isLowPermissions()) { - return; - } - - if ("LWJGL".equals(settings.getAudioRenderer())) { - NativeLibraryLoader.loadNativeLibrary("openal-lwjgl3", true); - } - - if (NativeLibraryLoader.isUsingNativeBullet()) { - NativeLibraryLoader.loadNativeLibrary("bulletjme", true); - } - - NativeLibraryLoader.loadNativeLibrary("glfw-lwjgl3", true); - NativeLibraryLoader.loadNativeLibrary("jemalloc-lwjgl3", true); - NativeLibraryLoader.loadNativeLibrary("lwjgl3", true); - } - protected int getNumSamplesToUse() { int samples = 0; if (settings.getSamples() > 1) { From c77905a4a32fd3c8553768f320bd7e92183ba6fd Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Wed, 2 Mar 2016 13:47:17 -0500 Subject: [PATCH 08/19] lwjgl3: fix syntax error --- jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java | 1 - 1 file changed, 1 deletion(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index 48cdd1cab..3dba24028 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -440,7 +440,6 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { + "Must set with JmeContext.setSystemListener()."); } - loadNatives(); LOGGER.log(Level.FINE, "Using LWJGL {0}", Version.getVersion()); if (!initInThread()) { From e541a5a147e0dc8acefee694fce4d7f8a616a5be Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Wed, 2 Mar 2016 13:49:28 -0500 Subject: [PATCH 09/19] lwjgl3: start jME3 on main thread (needed for mac) --- jme3-examples/build.gradle | 14 +++++++---- .../com/jme3/system/lwjgl/LwjglWindow.java | 23 +++++++++++-------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/jme3-examples/build.gradle b/jme3-examples/build.gradle index 09e71997e..371a7aaab 100644 --- a/jme3-examples/build.gradle +++ b/jme3-examples/build.gradle @@ -5,11 +5,15 @@ if (!hasProperty('mainClass')) { } task run(dependsOn: 'build', type:JavaExec) { - main = mainClass - classpath = sourceSets.main.runtimeClasspath - if( assertions == "true" ){ - enableAssertions = true; - } + main = mainClass + classpath = sourceSets.main.runtimeClasspath + if (System.properties['os.name'].toLowerCase().contains('mac')) { + jvmArgs "-XstartOnFirstThread" + jvmArgs "-Djava.awt.headless=true" + } + if( assertions == "true" ){ + enableAssertions = true; + } } dependencies { diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index 3dba24028..cac8ecdd1 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -81,6 +81,8 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { private GLFWWindowSizeCallback windowSizeCallback; private GLFWWindowFocusCallback windowFocusCallback; + private Thread mainThread; + public LwjglWindow(final JmeContext.Type type) { if (!JmeContext.Type.Display.equals(type) && !JmeContext.Type.OffscreenSurface.equals(type) && !JmeContext.Type.Canvas.equals(type)) { throw new IllegalArgumentException("Unsupported type '" + type.name() + "' provided"); @@ -210,7 +212,6 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { @Override public void invoke(final long window, final int focused) { final boolean focus = (focused == GL_TRUE); - if (wasActive != focus) { if (!wasActive) { listener.gainFocus(); @@ -241,10 +242,6 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { glfwSwapInterval(0); } - // Make the window visible - if (Type.Display.equals(type)) { - glfwShowWindow(window); - } glfwShowWindow(window); @@ -286,17 +283,16 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { } } + @Override public void create(boolean waitFor) { if (created.get()) { LOGGER.warning("create() called when display is already created!"); return; } - new Thread(this, THREAD_NAME).start(); - - if (waitFor) { - waitFor(true); - } + // NOTE: this is required for Mac OS X! + mainThread = Thread.currentThread(); + run(); } /** @@ -307,6 +303,7 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { if (!JmeSystem.isLowPermissions()) { // Enable uncaught exception handler only for current thread Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + @Override public void uncaughtException(Thread thread, Throwable thrown) { listener.handleError("Uncaught exception thrown in " + thread.toString(), thrown); if (needClose.get()) { @@ -434,6 +431,7 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { LOGGER.fine("Display destroyed."); } + @Override public void run() { if (listener == null) { throw new IllegalStateException("SystemListener is not set on context!" @@ -496,6 +494,11 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { public void destroy(boolean waitFor) { needClose.set(true); + if (mainThread == Thread.currentThread()) { + // Ignore waitFor. + return; + } + if (waitFor) { waitFor(false); } From 54d563dde23f41c21f4bcd252357996bbea99470 Mon Sep 17 00:00:00 2001 From: Alrik Date: Wed, 2 Mar 2016 21:32:04 +0100 Subject: [PATCH 10/19] - remove unnecessary comment --- jme3-core/src/main/java/com/jme3/animation/Bone.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/animation/Bone.java b/jme3-core/src/main/java/com/jme3/animation/Bone.java index 80d03b374..37a95ed5c 100644 --- a/jme3-core/src/main/java/com/jme3/animation/Bone.java +++ b/jme3-core/src/main/java/com/jme3/animation/Bone.java @@ -141,10 +141,6 @@ public final class Bone implements Savable { *

* Only copies the name and bind pose from the original. *

- * WARNING: Local bind pose and world inverse bind pose transforms shallow - * copied. Modifying that data on the original bone will cause it to - * be recomputed on any cloned bones. - *

* The rest of the data is NOT copied, as it will be * generated automatically when the bone is animated. * From 546850130d6b08084f4836da8f70981b8bd5df03 Mon Sep 17 00:00:00 2001 From: Alrik Date: Wed, 2 Mar 2016 21:43:45 +0100 Subject: [PATCH 11/19] - make the comment more precise because user control and world inverse / local bind pose transforms are also copied --- jme3-core/src/main/java/com/jme3/animation/Bone.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jme3-core/src/main/java/com/jme3/animation/Bone.java b/jme3-core/src/main/java/com/jme3/animation/Bone.java index 37a95ed5c..55cd8fccd 100644 --- a/jme3-core/src/main/java/com/jme3/animation/Bone.java +++ b/jme3-core/src/main/java/com/jme3/animation/Bone.java @@ -139,7 +139,7 @@ public final class Bone implements Savable { /** * Special-purpose copy constructor. *

- * Only copies the name and bind pose from the original. + * Only copies the name, user control state and world inverse / local bind pose transforms from the original. *

* The rest of the data is NOT copied, as it will be * generated automatically when the bone is animated. From f925e3eb81b1c9d6cc4f884e5fdb27c72b6b1457 Mon Sep 17 00:00:00 2001 From: Alrik Date: Wed, 2 Mar 2016 21:44:51 +0100 Subject: [PATCH 12/19] - revert mistake --- jme3-core/src/main/java/com/jme3/animation/Bone.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jme3-core/src/main/java/com/jme3/animation/Bone.java b/jme3-core/src/main/java/com/jme3/animation/Bone.java index 55cd8fccd..fcbacb337 100644 --- a/jme3-core/src/main/java/com/jme3/animation/Bone.java +++ b/jme3-core/src/main/java/com/jme3/animation/Bone.java @@ -139,7 +139,7 @@ public final class Bone implements Savable { /** * Special-purpose copy constructor. *

- * Only copies the name, user control state and world inverse / local bind pose transforms from the original. + * Only copies the name, user control state and bind pose transforms from the original. *

* The rest of the data is NOT copied, as it will be * generated automatically when the bone is animated. From eada244b343bea8d4a79d49c7892ca0adeb9f54c Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Wed, 2 Mar 2016 16:36:12 -0500 Subject: [PATCH 13/19] lwjgl3: re-enable native loading for native bullet --- .../main/java/com/jme3/system/lwjgl/LwjglContext.java | 11 +++++++++++ .../main/java/com/jme3/system/lwjgl/LwjglWindow.java | 2 ++ 2 files changed, 13 insertions(+) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java index 20532df36..0fe8a7b23 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java @@ -116,6 +116,17 @@ public abstract class LwjglContext implements JmeContext { return samples; } + protected void loadNatives() { + if (JmeSystem.isLowPermissions()) { + return; + } + + if (NativeLibraryLoader.isUsingNativeBullet()) { + NativeLibraryLoader.loadNativeLibrary("bulletjme", true); + } + } + + protected void initContextFirstTime() { final GLCapabilities capabilities = createCapabilities(settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)); diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index cac8ecdd1..aaa24ce42 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -315,6 +315,8 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { }); } + loadNatives(); + timer = new NanoTimer(); // For canvas, this will create a pbuffer, From 5468a48050d2cac1a31ce0085995d200b538049c Mon Sep 17 00:00:00 2001 From: Teencrusher Date: Thu, 3 Mar 2016 13:23:04 -0500 Subject: [PATCH 14/19] Removed the modification of the input parameter that lead to a wrong axisSamples member then the cylinder was closed --- jme3-core/src/main/java/com/jme3/scene/shape/Cylinder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jme3-core/src/main/java/com/jme3/scene/shape/Cylinder.java b/jme3-core/src/main/java/com/jme3/scene/shape/Cylinder.java index 1d215eb6b..6fde33c0e 100644 --- a/jme3-core/src/main/java/com/jme3/scene/shape/Cylinder.java +++ b/jme3-core/src/main/java/com/jme3/scene/shape/Cylinder.java @@ -211,7 +211,7 @@ public class Cylinder extends Mesh { */ public void updateGeometry(int axisSamples, int radialSamples, float radius, float radius2, float height, boolean closed, boolean inverted) { - this.axisSamples = axisSamples + (closed ? 2 : 0); + this.axisSamples = axisSamples; this.radialSamples = radialSamples; this.radius = radius; this.radius2 = radius2; From a22f6772e695b22a8320c49f6c130cc416af3bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bouquet?= Date: Sat, 18 Jul 2015 21:49:27 +0200 Subject: [PATCH 15/19] fixed a NPE in the shader node editor when the navigator panel is collapsed --- .../gde/materialdefinition/editor/MatDefEditorlElement.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java index 762b24ef5..42fbba18b 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java @@ -272,6 +272,11 @@ public final class MatDefEditorlElement extends JPanel implements MultiViewEleme protected void selectionChanged(Selectable selectable) { MatDefNavigatorPanel nav = obj.getLookup().lookup(MatDefNavigatorPanel.class); + //It's possible that the navigator is null if it's collapsed in the ui. + //In that case we early return to avoid further issues + if(nav == null){ + return; + } try { Node n = findNode(nav.getExplorerManager().getRootContext(), selectable.getKey()); if (n == null) { From 6c9cd46e11bca85c20a074f12a42661dffb96316 Mon Sep 17 00:00:00 2001 From: InShadow Date: Thu, 3 Mar 2016 21:57:19 -0800 Subject: [PATCH 16/19] Corrected spelling mistake. --- jme3-core/src/main/java/com/jme3/scene/BatchNode.java | 2 +- jme3-core/src/main/java/com/jme3/scene/Geometry.java | 2 +- jme3-core/src/main/java/com/jme3/scene/GeometryGroupNode.java | 2 +- .../src/main/java/com/jme3/scene/instancing/InstancedNode.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/scene/BatchNode.java b/jme3-core/src/main/java/com/jme3/scene/BatchNode.java index e1d4cce7f..26d944b88 100644 --- a/jme3-core/src/main/java/com/jme3/scene/BatchNode.java +++ b/jme3-core/src/main/java/com/jme3/scene/BatchNode.java @@ -116,7 +116,7 @@ public class BatchNode extends GeometryGroupNode { } @Override - public void onGeoemtryUnassociated(Geometry geom) { + public void onGeometryUnassociated(Geometry geom) { setNeedsFullRebatch(true); } diff --git a/jme3-core/src/main/java/com/jme3/scene/Geometry.java b/jme3-core/src/main/java/com/jme3/scene/Geometry.java index 89f37ec9d..4c394101a 100644 --- a/jme3-core/src/main/java/com/jme3/scene/Geometry.java +++ b/jme3-core/src/main/java/com/jme3/scene/Geometry.java @@ -344,7 +344,7 @@ public class Geometry extends Spatial { if (groupNode != null) { // Once the geometry is removed // from the parent, the group node needs to be updated. - groupNode.onGeoemtryUnassociated(this); + groupNode.onGeometryUnassociated(this); groupNode = null; // change the default to -1 to make error detection easier diff --git a/jme3-core/src/main/java/com/jme3/scene/GeometryGroupNode.java b/jme3-core/src/main/java/com/jme3/scene/GeometryGroupNode.java index 2665f768e..3a99759d1 100644 --- a/jme3-core/src/main/java/com/jme3/scene/GeometryGroupNode.java +++ b/jme3-core/src/main/java/com/jme3/scene/GeometryGroupNode.java @@ -83,5 +83,5 @@ public abstract class GeometryGroupNode extends Node { * * @param geom The Geometry which is being unassociated. */ - public abstract void onGeoemtryUnassociated(Geometry geom); + public abstract void onGeometryUnassociated(Geometry geom); } diff --git a/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedNode.java b/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedNode.java index 554b8606a..61ec61956 100644 --- a/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedNode.java +++ b/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedNode.java @@ -329,7 +329,7 @@ public class InstancedNode extends GeometryGroupNode { } @Override - public void onGeoemtryUnassociated(Geometry geom) { + public void onGeometryUnassociated(Geometry geom) { removeFromInstancedGeometry(geom); } } From ab3ee87b173202738dfe469e50c4162eb76e9d94 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Fri, 4 Mar 2016 12:16:49 +0100 Subject: [PATCH 17/19] WelcomeScreen sometimes didn't appear due to a fault --- .../src/com/jme3/gde/welcome/WelcomeScreenTopComponent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/jme3-welcome-screen/src/com/jme3/gde/welcome/WelcomeScreenTopComponent.java b/sdk/jme3-welcome-screen/src/com/jme3/gde/welcome/WelcomeScreenTopComponent.java index 123a77972..9815b445d 100644 --- a/sdk/jme3-welcome-screen/src/com/jme3/gde/welcome/WelcomeScreenTopComponent.java +++ b/sdk/jme3-welcome-screen/src/com/jme3/gde/welcome/WelcomeScreenTopComponent.java @@ -38,7 +38,7 @@ persistenceType = TopComponent.PERSISTENCE_ALWAYS) @ActionID(category = "Window", id = "com.jme3.gde.welcome.WelcomeScreenTopComponent") @ActionReference(path = "Menu/Window" /*, position = 333 */) @TopComponent.OpenActionRegistration( - displayName = "#CTL_WelcomeScreenAction", + displayName = "CTL_WelcomeScreenAction", /* No # since it's not part of the Bundles.properties. See http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/openide/awt/ActionRegistration.html#displayName-- */ preferredID = "WelcomeScreenTopComponent") @Messages({ "CTL_WelcomeScreenAction=Info Screen", From b746c71441b0b9846ec08bd00c32d4aee68de097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=CC=81my=20Bouquet?= Date: Fri, 4 Mar 2016 14:12:33 +0100 Subject: [PATCH 18/19] Used the instancing transformation method for the normal pass in SSAO as it was producing a crash when instancing was enabled. --- jme3-effects/src/main/resources/Common/MatDefs/SSAO/normal.vert | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jme3-effects/src/main/resources/Common/MatDefs/SSAO/normal.vert b/jme3-effects/src/main/resources/Common/MatDefs/SSAO/normal.vert index 82a08f392..00aa103ff 100644 --- a/jme3-effects/src/main/resources/Common/MatDefs/SSAO/normal.vert +++ b/jme3-effects/src/main/resources/Common/MatDefs/SSAO/normal.vert @@ -19,6 +19,6 @@ void main(void) #ifdef NUM_BONES Skinning_Compute(modelSpacePos,modelSpaceNormals); #endif - normal = normalize(g_NormalMatrix * modelSpaceNormals); + normal = normalize(TransformNormal(modelSpaceNormals)); gl_Position = g_WorldViewProjectionMatrix * modelSpacePos; } \ No newline at end of file From b431d16981980ea8d9dd78e1e03ebe0559eca008 Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Fri, 4 Mar 2016 19:51:18 -0500 Subject: [PATCH 19/19] Cylinder: fix incorrect axis samples for closed --- jme3-core/src/main/java/com/jme3/scene/shape/Cylinder.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jme3-core/src/main/java/com/jme3/scene/shape/Cylinder.java b/jme3-core/src/main/java/com/jme3/scene/shape/Cylinder.java index 6fde33c0e..1e0b1cae2 100644 --- a/jme3-core/src/main/java/com/jme3/scene/shape/Cylinder.java +++ b/jme3-core/src/main/java/com/jme3/scene/shape/Cylinder.java @@ -222,6 +222,7 @@ public class Cylinder extends Mesh { // VertexBuffer pvb = getBuffer(Type.Position); // VertexBuffer nvb = getBuffer(Type.Normal); // VertexBuffer tvb = getBuffer(Type.TexCoord); + axisSamples += (closed ? 2 : 0); // Vertices int vertCount = axisSamples * (radialSamples + 1) + (closed ? 2 : 0);