Browse Source

Merge branch 'master' into Issue#534-SceneComposer_panels_scrolls_with_mouse_movements

rickard 1 year ago
parent
commit
8dd6c967ec

+ 11 - 5
build.gradle

@@ -44,7 +44,7 @@ dependencies {
     corelibs dep("org.jmonkeyengine:jme3-lwjgl:$jmeVersion-$jmeVersionTag", true, true)
     corelibs dep("org.jmonkeyengine:jme3-effects:$jmeVersion-$jmeVersionTag", true, true)
     corelibs dep("org.jmonkeyengine:jme3-blender:3.3.2-stable", false, false) // Pin Pointed until jme3-blender has a dedicated release or support is phased out.
-    optlibs dep("com.github.stephengold:Minie:7.1.0", false, false) // replacement for bullet-native
+    optlibs dep("com.github.stephengold:Minie:7.7.0", false, false) // replacement for bullet-native
     corelibs dep(fileTree("lib"), false, false)
     corelibs dep("org.jmonkeyengine:jme3-jogg:$jmeVersion-$jmeVersionTag", true, true)
 
@@ -53,13 +53,19 @@ dependencies {
     corelibs dep("org.jmonkeyengine:jme3-plugins:$jmeVersion-$jmeVersionTag", true, true)
     corelibs dep("org.jmonkeyengine:jme3-terrain:$jmeVersion-$jmeVersionTag", true, true)
 
+    optlibs dep("com.simsilica:lemur:1.16.0", true, true)
+    optlibs dep("com.simsilica:lemur-props:1.2.0", true, true)
+    optlibs dep("com.simsilica:sio2:1.8.0", true, true)
+    optlibs dep("com.simsilica:sim-math:1.6.0", true, true)
+    optlibs dep("com.simsilica:zay-es:1.5.0", true, true)
+
     optlibs dep("org.jmonkeyengine:jme3-jbullet:$jmeVersion-$jmeVersionTag", true, true)
     optlibs dep("org.jmonkeyengine:jme3-android:$jmeVersion-$jmeVersionTag", true, true)
     optlibs dep("org.jmonkeyengine:jme3-ios:$jmeVersion-$jmeVersionTag", true, true)
     optlibs dep("org.jmonkeyengine:jme3-android-native:$jmeVersion-$jmeVersionTag", true, true)
     optlibs dep("org.jmonkeyengine:jme3-lwjgl3:$jmeVersion-$jmeVersionTag", true, true)
-    optlibs dep("com.github.stephengold:Heart:8.2.0", true, true)
-    optlibs dep("com.github.stephengold:Wes:0.7.2", true, true)
+    optlibs dep("com.github.stephengold:Heart:8.7.0", true, true)
+    optlibs dep("com.github.stephengold:Wes:0.7.5", true, true)
     testdatalibs dep("org.jmonkeyengine:jme3-testdata:$jmeVersion-$jmeVersionTag", false, false)
     examplelibs dep("org.jmonkeyengine:jme3-examples:$jmeVersion-$jmeVersionTag", false, true)
 }
@@ -609,14 +615,14 @@ task cleanSdk() {
 task extractPlatformIndependent(type: Copy) {
     from zipTree('dist/jmonkeyplatform.zip')
     into "dist/temp/"
-    
+
     exclude("jmonkeyplatform/etc/jmonkeyplatform.conf")
 }
 
 task patchPlatformIndependent(type: Copy, dependsOn: extractPlatformIndependent) {
     from zipTree('dist/jmonkeyplatform.zip')
     into "dist/temp/"
-    
+
     include("jmonkeyplatform/etc/jmonkeyplatform.conf")
 
     filter { String line ->

+ 9 - 0
jme3-materialeditor/nbproject/project.xml

@@ -225,6 +225,15 @@
                     </run-dependency>
                 </dependency>
             </module-dependencies>
+            <test-dependencies>
+                <test-type>
+                    <name>unit</name>
+                    <test-dependency>
+                        <code-name-base>org.netbeans.libs.junit5</code-name-base>
+                        <compile-dependency/>
+                    </test-dependency>
+                </test-type>
+            </test-dependencies>
             <public-packages>
                 <package>com.jme3.gde.materials</package>
                 <package>com.jme3.gde.materials.multiview</package>

+ 7 - 7
jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.form

@@ -87,15 +87,15 @@
                       <Group type="102" attributes="0">
                           <Group type="103" groupAlignment="0" attributes="0">
                               <Component id="materialPreviewWidget1" min="-2" pref="255" max="-2" attributes="0"/>
-                              <Component id="jTabbedPane3" max="32767" attributes="0"/>
+                              <Component id="optionsPane" max="32767" attributes="0"/>
                           </Group>
                           <EmptySpace max="-2" attributes="0"/>
                           <Group type="103" groupAlignment="0" attributes="0">
                               <Group type="102" alignment="0" attributes="0">
-                                  <Component id="texturesAndColorsPane" pref="496" max="32767" attributes="0"/>
+                                  <Component id="texturesAndColorsPane" max="32767" attributes="0"/>
                                   <EmptySpace max="-2" attributes="0"/>
-                                  <Component id="additionalRenderStatePane" pref="329" max="32767" attributes="0"/>
-                                  <EmptySpace pref="12" max="32767" attributes="0"/>
+                                  <Component id="additionalRenderStatePane" pref="331" max="32767" attributes="0"/>
+                                  <EmptySpace pref="16" max="32767" attributes="0"/>
                               </Group>
                               <Group type="102" alignment="0" attributes="0">
                                   <Group type="103" groupAlignment="0" attributes="0">
@@ -127,7 +127,7 @@
                           </Group>
                           <EmptySpace max="-2" attributes="0"/>
                           <Group type="103" groupAlignment="0" attributes="0">
-                              <Component id="jTabbedPane3" alignment="1" max="32767" attributes="0"/>
+                              <Component id="optionsPane" alignment="1" max="32767" attributes="0"/>
                               <Component id="texturesAndColorsPane" alignment="1" max="32767" attributes="0"/>
                               <Component id="additionalRenderStatePane" alignment="0" max="32767" attributes="0"/>
                           </Group>
@@ -180,11 +180,11 @@
                     </Container>
                   </SubComponents>
                 </Container>
-                <Container class="javax.swing.JTabbedPane" name="jTabbedPane3">
+                <Container class="javax.swing.JTabbedPane" name="optionsPane">
                   <Properties>
                     <Property name="tabLayoutPolicy" type="int" value="1"/>
                     <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
-                      <Dimension value="[380, 355]"/>
+                      <Dimension value="[200, 355]"/>
                     </Property>
                     <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
                       <Dimension value="[500, 355]"/>

+ 36 - 11
jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java

@@ -17,6 +17,9 @@ import com.jme3.gde.materials.multiview.widgets.MaterialWidgetListener;
 import com.jme3.gde.materials.multiview.widgets.WidgetFactory;
 import com.jme3.material.Material;
 import java.awt.Component;
+import java.awt.GridLayout;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -83,6 +86,28 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
 
     private void initWindow() {
         initComponents();
+        optionsPane.addComponentListener(new ComponentListener() {
+            @Override
+            public void componentResized(ComponentEvent e) {
+                if(optionsPane.getWidth() > 400) {
+                    ((GridLayout)optionsPanel.getLayout()).setColumns(2);
+                } else {
+                    ((GridLayout)optionsPanel.getLayout()).setColumns(1);
+                }
+            }
+
+            @Override
+            public void componentMoved(ComponentEvent e) {
+            }
+
+            @Override
+            public void componentShown(ComponentEvent e) {
+            }
+
+            @Override
+            public void componentHidden(ComponentEvent e) {
+            }
+        });
         setName(NbBundle.getMessage(MaterialEditorTopComponent.class, "CTL_MaterialEditorTopComponent"));
         setToolTipText(NbBundle.getMessage(MaterialEditorTopComponent.class, "HINT_MaterialEditorTopComponent"));
         setActivatedNodes(new Node[]{dataObject.getNodeDelegate()});
@@ -119,7 +144,7 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
         texturesAndColorsPane = new javax.swing.JTabbedPane();
         jScrollPane3 = new javax.swing.JScrollPane();
         texturePanel = new javax.swing.JPanel();
-        jTabbedPane3 = new javax.swing.JTabbedPane();
+        optionsPane = new javax.swing.JTabbedPane();
         jScrollPane2 = new javax.swing.JScrollPane();
         optionsPanel = new javax.swing.JPanel();
         jToolBar2 = new javax.swing.JToolBar();
@@ -169,9 +194,9 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
 
         texturesAndColorsPane.addTab(org.openide.util.NbBundle.getMessage(MaterialEditorTopComponent.class, "MaterialEditorTopComponent.jScrollPane3.TabConstraints.tabTitle"), jScrollPane3); // NOI18N
 
-        jTabbedPane3.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
-        jTabbedPane3.setMinimumSize(new java.awt.Dimension(380, 355));
-        jTabbedPane3.setPreferredSize(new java.awt.Dimension(500, 355));
+        optionsPane.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
+        optionsPane.setMinimumSize(new java.awt.Dimension(200, 355));
+        optionsPane.setPreferredSize(new java.awt.Dimension(500, 355));
 
         jScrollPane2.setBorder(null);
         jScrollPane2.setMinimumSize(new java.awt.Dimension(220, 0));
@@ -179,7 +204,7 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
         optionsPanel.setLayout(new java.awt.GridLayout(0, 2));
         jScrollPane2.setViewportView(optionsPanel);
 
-        jTabbedPane3.addTab(org.openide.util.NbBundle.getMessage(MaterialEditorTopComponent.class, "MaterialEditorTopComponent.jScrollPane2.TabConstraints.tabTitle_1"), jScrollPane2); // NOI18N
+        optionsPane.addTab(org.openide.util.NbBundle.getMessage(MaterialEditorTopComponent.class, "MaterialEditorTopComponent.jScrollPane2.TabConstraints.tabTitle_1"), jScrollPane2); // NOI18N
 
         jToolBar2.setRollover(true);
 
@@ -274,14 +299,14 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
             .addGroup(editorPanelLayout.createSequentialGroup()
                 .addGroup(editorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addComponent(materialPreviewWidget1, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addComponent(jTabbedPane3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+                    .addComponent(optionsPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addGroup(editorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addGroup(editorPanelLayout.createSequentialGroup()
-                        .addComponent(texturesAndColorsPane, javax.swing.GroupLayout.DEFAULT_SIZE, 496, Short.MAX_VALUE)
+                        .addComponent(texturesAndColorsPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(additionalRenderStatePane, javax.swing.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)
-                        .addContainerGap(12, Short.MAX_VALUE))
+                        .addComponent(additionalRenderStatePane, javax.swing.GroupLayout.DEFAULT_SIZE, 331, Short.MAX_VALUE)
+                        .addContainerGap(16, Short.MAX_VALUE))
                     .addGroup(editorPanelLayout.createSequentialGroup()
                         .addGroup(editorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                             .addComponent(jToolBar3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
@@ -304,7 +329,7 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
                     .addComponent(materialPreviewWidget1, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addGroup(editorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                    .addComponent(jTabbedPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                    .addComponent(optionsPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                     .addComponent(texturesAndColorsPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                     .addComponent(additionalRenderStatePane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
         );
@@ -368,12 +393,12 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
     private javax.swing.JScrollPane jScrollPane3;
     private javax.swing.JScrollPane jScrollPane4;
     private javax.swing.JTabbedPane jTabbedPane1;
-    private javax.swing.JTabbedPane jTabbedPane3;
     private javax.swing.JTextArea jTextArea1;
     private javax.swing.JTextField jTextField1;
     private javax.swing.JToolBar jToolBar2;
     private javax.swing.JToolBar jToolBar3;
     private com.jme3.gde.materials.multiview.widgets.MaterialPreviewWidget materialPreviewWidget1;
+    private javax.swing.JTabbedPane optionsPane;
     private javax.swing.JPanel optionsPanel;
     private javax.swing.JPanel statesPanel;
     private javax.swing.JPanel texturePanel;

+ 2 - 1
jme3-materialeditor/src/com/jme3/gde/shadernodedefinition/wizard/SNDefVisualPanel2.java

@@ -46,7 +46,8 @@ public final class SNDefVisualPanel2 extends JPanel {
     private final Object[] emptyObj = {"float", "", ""};
     private final String type;
     private final String[] varTypes = new String[]{"bool", "int", "float", "vec2", 
-        "vec3", "vec4", "sampler", "sampler2D", "sampler3D", "mat3", "mat4"};
+        "vec3", "vec4", "sampler", "sampler2D", "sampler3D", "mat3", "mat4",
+        "samplerCube", "sampler2DArray"};
 
     /**
      * Creates new form SNDefVisualPanel2

+ 67 - 0
jme3-materialeditor/test/unit/src/com/jme3/gde/materials/multiview/widgets/TexturePanelTest.java

@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2009-2023 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.materials.multiview.widgets;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
+
+
+/**
+ *
+ * @author rickard
+ */
+public class TexturePanelTest {
+    
+    public TexturePanelTest() {
+    }
+
+    @Test
+    public void testExtractTextureName() {
+        TexturePanel texturePanel = new TexturePanel();
+        String textureName = "\"simple_name.jpg\"";
+        String extractedName = texturePanel.extractTextureName(textureName);
+        assertEquals("simple_name.jpg", extractedName);
+        
+        String textureNameWithModifier = "Flip Repeat \"simple_name.jpg\"";
+        extractedName = texturePanel.extractTextureName(textureNameWithModifier);
+        assertEquals("simple_name.jpg", extractedName);
+        
+        String textureNameWithSpaces = "\"texture name with spaces.jpg\"";
+        extractedName = texturePanel.extractTextureName(textureNameWithSpaces);
+        assertEquals("texture name with spaces.jpg", extractedName);
+        
+        String textureNameWithSpaceAndModifier = "Flip Repeat \"texture name with spaces.jpg\"";
+        extractedName = texturePanel.extractTextureName(textureNameWithSpaceAndModifier);
+        assertEquals("texture name with spaces.jpg", extractedName);
+    }
+
+}

BIN
jme3-templates/src/com/jme3/gde/templates/GradleDesktopGameProject.zip


+ 14 - 5
jme3-templates/src/com/jme3/gde/templates/files/freemarker/build.gradle.ftl

@@ -7,11 +7,17 @@ plugins {
 group 'com.mygame'
 version '1.0'
 
-mainClassName = "com.mygame.Main"
+application {
+    applicationName = '${name}'
+    mainClass = 'com.mygame.Main'
+    // Mac OS with LWJGL 3 needs to be started with this JVM argument
+    if (System.getProperty("os.name").toLowerCase().contains("mac")) {
+        applicationDefaultJvmArgs = ['-XstartOnFirstThread']
+    }
+}
 
 repositories {
     mavenCentral()
-    jcenter()
     maven { url 'https://jitpack.io' }
 }
 
@@ -45,7 +51,10 @@ dependencies {
   implementation "org.jmonkeyengine:jme3-core:$jmeVer"
   implementation "org.jmonkeyengine:jme3-desktop:$jmeVer"
   <#if jmeVersion.versionInfo.major gt 3 || (jmeVersion.versionInfo.major == 3 && jmeVersion.versionInfo.minor gte 6 )>
-  implementation "org.jmonkeyengine:jme3-awt-dialogs:$jmeVer"
+  // Mac OS with LWJGL 3 doesn't allow AWT/Swing
+  if (!System.getProperty("os.name").toLowerCase().contains("mac")) {
+    implementation "org.jmonkeyengine:jme3-awt-dialogs:$jmeVer"
+  }
   </#if>
   <#if lwjglLibrary.isCoreJmeLibrary == true>
   implementation "${lwjglLibrary.groupId}:${lwjglLibrary.artifactId}:$jmeVer"
@@ -99,7 +108,7 @@ dependencies {
 
 jar {
     manifest {
-        attributes 'Main-Class': "$mainClassName"
+        attributes 'Main-Class': application.mainClass
     }
 }
 
@@ -110,5 +119,5 @@ java {
 }
 
 wrapper {
-    gradleVersion = '7.6'
+    gradleVersion = '8.4'
 }

+ 1 - 0
jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameWizardIterator.java

@@ -132,6 +132,7 @@ public class GradleDesktopGameWizardIterator implements WizardDescriptor./*Progr
         // Create build.gradle from template
         File gradleBuildFile = new File(dirF, "build.gradle");
         Map<String, Object> buildFileBindings = new HashMap<>();
+        buildFileBindings.put("name", wiz.getProperty("name"));
         buildFileBindings.put("jmeVersion", wiz.getProperty("jmeVersion"));
         buildFileBindings.put("lwjglLibrary", wiz.getProperty("lwjglLibrary"));
         buildFileBindings.put("guiLibrary", wiz.getProperty("guiLibrary"));

+ 1 - 1
jme3-templates/src/com/jme3/gde/templates/gradledesktop/options/AdditionalLibrary.java

@@ -99,7 +99,7 @@ public enum AdditionalLibrary implements TemplateLibrary {
     SHADERBLOW_EX("ShaderBlowEx", NbBundle.getMessage(AdditionalLibrary.class,
             "additionalLibrary.shaderblowex.description"),
             "com.github.polincdev", "ShaderBlowEx",
-            "master-SNAPSHOT", false),
+            "-SNAPSHOT", false),
     SIO2("SiO2", NbBundle.getMessage(AdditionalLibrary.class,
             "additionalLibrary.sio2.description"),
             "com.simsilica", "sio2",