Browse Source

Merge branch 'master' into snapping

rickard 3 years ago
parent
commit
a80030d6ed

+ 2 - 8
.github/workflows/gradle.yml

@@ -17,14 +17,8 @@ jobs:
       with:
         java-version: 11
 
-    - name: Grant execute permission for the scripts
-      run: chmod +x gradlew *.sh
-      
-    - name: Download and build the Engine
-      run: ./build_engine.sh
-      
-    - name: Fix the Engine
-      run: ./fix_engine.sh
+    - name: Grant execute permission for gradle
+      run: chmod +x gradlew
       
     - name: Build the SDK
       run: ./gradlew buildSdk

+ 0 - 0
BasicGameTemplate/assets/Filters/.keep


+ 26 - 84
build.gradle

@@ -14,63 +14,17 @@ if (!hasProperty('mainClass')) {
 }
 
 repositories {
-    mavenLocal()
-    jcenter {
-        url "https://jcenter.bintray.com/"
-    }
-    mavenCentral()
-    maven {
-        url "http://updates.jmonkeyengine.org/maven/"
-    }
     maven {
         url "http://nifty-gui.sourceforge.net/nifty-maven-repo/"
     }
     maven { url "https://jitpack.io" }
-
-    // See Engine Commit caf91c47df2e5687b3e9ecf2009ee22014bf4ac1
-    flatDir {
-        dirs rootProject.file('lib')
+    maven {
+        url "https://maven.google.com/"
     }
+    mavenCentral()
+    jcenter() // because of 'com.simsilica:sim-math:1.4.1'
 }
 
-/*if (System.getenv('TRAVIS') != null) {
-    if (System.env.TRAVIS_TAG != null && System.env.TRAVIS_TAG != "") { // Strangely it has to be both, because it's sometimes set as TRAVIS_TAG="" when we're in travis but no tag is set
-        // v3.3.0-stable-sdk1 becomes 3.3.0-stable
-        // Intentionally not using lastIndexOf here, we want the second "-".
-        ext.jmeEngineVersion = System.env.TRAVIS_TAG.substring(1, System.env.TRAVIS_TAG.indexOf("-", System.env.TRAVIS_TAG.indexOf("-") + 1));
-    } else {
-        if (System.env.TRAVIS_PULL_REQUEST == null || System.env.TRAVIS_PULL_REQUEST == "" || System.env.TRAVIS_PULL_REQUEST == "false") {
-			if (System.env.TRAVIS_BRANCH == "master") {
-				ext.jmeEngineVersion = "3.3.0-SNAPSHOT" // Manually update
-			} else {
-				ext.jmeEngineVersion = "3.3.0-" + System.env.TRAVIS_BRANCH + "-SNAPSHOT" // Manually update
-			}
-        } else {
-            ext.jmeEngineVersion = "3.3.0-" + System.env.TRAVIS_PULL_REQUEST_BRANCH + "-pr-" + System.env.TRAVIS_PULL_REQUEST + "-SNAPSHOT"
-        }
-    }
-} else {
-	new ByteArrayOutputStream().withStream { os ->
-		def result = exec {
-			executable = 'git'
-			args = ['rev-parse', '--abbrev-ref', 'HEAD'];
-			standardOutput = os
-		}
-		ext.branch = os.toString().trim()
-	}
-	
-	// If the Branch isn't master, specify the branch name.
-	// @TODO: One could use the same technique like the engine (grgit?)
-	if (ext.branch == "master") {
-		ext.branchSpec = ""
-	} else {
-		ext.branchSpec = "-" + ext.branch;
-	}
-	
-	// This is the engine version that will be used per default on every regular commit
-	ext.jmeEngineVersion = "3.3.0" + ext.branchSpec + "-SNAPSHOT"
-}*/
-
 configurations {
     corelibs
     optlibs
@@ -84,50 +38,38 @@ dependencies {
     corelibs dep("com.badlogicgames.gdx:gdx-ai:1.8.1", true, true)
     corelibs dep("javax.help:javahelp:2.0.05", false, false)
 
-    corelibs dep("org.jmonkeyengine:jme3-core", false, false)
-    corelibs dep("org.jmonkeyengine:jme3-desktop", false, false)
-    corelibs dep("org.jmonkeyengine:jme3-lwjgl", false, false)
-    corelibs dep("org.jmonkeyengine:jme3-effects", false, false)
-    corelibs dep("org.jmonkeyengine:jme3-blender", false, false)
-
-    corelibs dep("org.jmonkeyengine:jme3-bullet", false, false)
-    corelibs dep("org.jmonkeyengine:jme3-bullet-native", false, false)
+    corelibs dep("org.jmonkeyengine:jme3-core:3.4.0-stable", false, false)
+    corelibs dep("org.jmonkeyengine:jme3-desktop:3.4.0-stable", false, false)
+    corelibs dep("org.jmonkeyengine:jme3-lwjgl:3.4.0-stable", false, false)
+    corelibs dep("org.jmonkeyengine:jme3-effects:3.4.0-stable", false, false)
+    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:4.6.0", false, false) // replacement for bullet-native
     corelibs dep(fileTree("lib"), false, false)
-    corelibs dep("org.jmonkeyengine:jme3-jogg", false, false)
-
-    corelibs dep("org.jmonkeyengine:jme3-networking", false, false)
-    corelibs dep("org.jmonkeyengine:jme3-niftygui", false, false)
-    corelibs dep("org.jmonkeyengine:jme3-plugins", false, false)
-    corelibs dep("org.jmonkeyengine:jme3-terrain", false, false)
-
-    optlibs dep("org.jmonkeyengine:jme3-jbullet", false, false)
-    optlibs dep("org.jmonkeyengine:jme3-android", false, false)
-    optlibs dep("org.jmonkeyengine:jme3-ios", false, false)
-    optlibs dep("org.jmonkeyengine:jme3-android-native", false, false)
-    optlibs dep("org.jmonkeyengine:jme3-lwjgl3", false, false)
-    optlibs dep("com.github.stephengold:Heart:6.0.0", false, false)
-    optlibs dep("com.github.stephengold:Minie:3.0.0", false, false)
-    optlibs dep("com.github.stephengold:Wes:0.6.0", false, false)
-    testdatalibs dep("org.jmonkeyengine:jme3-testdata", false, false)
-
-    examplelibs dep("org.jmonkeyengine:jme3-examples", false, false)
-
+    corelibs dep("org.jmonkeyengine:jme3-jogg:3.4.0-stable", true, true)
+
+    corelibs dep("org.jmonkeyengine:jme3-networking:3.4.0-stable", false, false)
+    corelibs dep("org.jmonkeyengine:jme3-niftygui:3.4.0-stable", false, false)
+    corelibs dep("org.jmonkeyengine:jme3-plugins:3.4.0-stable", false, false)
+    corelibs dep("org.jmonkeyengine:jme3-terrain:3.4.0-stable", false, false)
+
+    optlibs dep("org.jmonkeyengine:jme3-jbullet:3.4.0-stable", false, false)
+    optlibs dep("org.jmonkeyengine:jme3-android:3.4.0-stable", false, false)
+    optlibs dep("org.jmonkeyengine:jme3-ios:3.4.0-stable", false, false)
+    optlibs dep("org.jmonkeyengine:jme3-android-native:3.4.0-stable", false, false)
+    optlibs dep("org.jmonkeyengine:jme3-lwjgl3:3.4.0-stable", false, false)
+    optlibs dep("com.github.stephengold:Heart:7.1.0", false, false)
+    optlibs dep("com.github.stephengold:Wes:0.6.7", false, false)
+    testdatalibs dep("org.jmonkeyengine:jme3-testdata:3.4.0-stable", false, false)
+    examplelibs dep("org.jmonkeyengine:jme3-examples:3.4.0-stable", false, false)
 }
 
 def dep(coords, javadoc = false, sources = false) {
-
     def result = [dependencies.create(coords)]
-
     if (javadoc) result << dependencies.create("$coords:javadoc")
-
     if (sources) result << dependencies.create("$coords:sources")
-
     result
-
 }
 
-
-
 artifacts {
     //    jar null
 }

+ 0 - 35
build_engine.sh

@@ -1,35 +0,0 @@
-#!/bin/sh
-# This Shell Script will build and use the latest jMonkeyEngine git version, so there might be some undiscovered engine bugs, watch out!
-# Also if you want to revert to releases and bintray builds, you need to uninstall them from your local maven repo...
-
-if [ ! -d "engine" ]; then
-    echo "Downloading the Engine, this may take some time"
-    if [ "x$TRAVIS" != "x" ] && [ "x$TRAVIS_TAG" != "x" ]; then
-        # Extract the engine version from the sdk branch tag.
-        git clone -b $(echo "$TRAVIS_TAG" | sed -n 's/\(v.\+\)-sdk.\+/\1/p') --single-branch --depth 10 https://github.com/jMonkeyEngine/jMonkeyEngine/ engine # single-branch requires git > 1.7.10, if you see an error, just leave it out.
-    else
-        git clone -b master --single-branch --depth 10 https://github.com/jMonkeyEngine/jMonkeyEngine/ engine # single-branch requires git > 1.7.10, if you see an error, just leave it out.
-    fi
-    cd engine
-else
-    echo "Engine already cloned, pulling updates."
-    cd engine
-    git pull
-fi
-# git checkout tags/v3.1.0-beta2 # To use this, leave out depth and change -b to a branch.
-
-#echo "Patching the Engine...."
-#patch -s -N -p 1 < ../patches/FixHWSkinningSerialization.diff
-
-# Remark: We don't build the engine from here anymore but instead use https://docs.gradle.org/current/userguide/composite_builds.html,
-# that way we don't have to care about versioning and don't spam the user's mavenLocal Repo. Also you only need this script really to
-# download the engine. Nothing a windows user couldn't do by hand.
-
-# Until https://github.com/jMonkeyEngine/jmonkeyengine/issues/1260 is solved, prebuild the engine manually
-echo "Prebuilding the engine to ensure native libraries are unzipped"
-./gradlew -PbuildJavaDoc=true build assemble
-
-#echo "Building the Engine and installing them to your local maven repo...."
-# ./gradlew -PbuildJavaDoc=true install # Depends on jarJavadoc, jarSourcecode, assemble, dist etc.
-
-cd ../

+ 0 - 21
fix_engine.sh

@@ -1,21 +0,0 @@
-#!/bin/bash
-sdk=`pwd`
-
-#echo "Patching the jme3-jbullet POM file"
-#pushd ~/.m2/repository/org/jmonkeyengine/jme3-jbullet/ > /dev/null
-#for d in *; do
-#  if [ -d "$d" ]; then
-#    pushd $d > /dev/null
-#    mv jme3-jbullet-$d.pom jbullet.pom
-#    patch < "$sdk/patches/jbullet_dependencies_version_missing.diff"
-#    mv jbullet.pom jme3-jbullet-$d.pom
-#    popd > /dev/null
-#  fi
-#done
-#popd > /dev/null
-
-echo "Installing our local jbullet.jar and stack-alloc.jar into the maven local repository"
-pushd lib > /dev/null
-mvn install:install-file -Dfile=jbullet.jar -DgroupId=jbullet -DartifactId=jbullet -Dversion=0.0.1 -Dpackaging=jar
-mvn install:install-file -Dfile=stack-alloc.jar -DgroupId=stack-alloc -DartifactId=stack-alloc -Dversion=0.0.1 -Dpackaging=jar
-popd > /dev/null

+ 1 - 1
jme3-blender/src/com/jme3/gde/blender/GLTFDataObject.java

@@ -58,7 +58,7 @@ import org.openide.util.NbBundle.Messages;
 )
 @DataObject.Registration(
     mimeType = "model/gltf+json", 
-    iconBase = "com/jme3/gde/blender/blender.png",
+    iconBase = "com/jme3/gde/blender/glTF.png",
     //iconBase = "com/jme3/gde/blender/glTF_100px_June16.png",
     displayName="#LBL_GLTF_LOADER",
     position=300

BIN
jme3-blender/src/com/jme3/gde/blender/glTF.png


BIN
jme3-blender/src/com/jme3/gde/blender/glTF24.png


BIN
jme3-blender/src/com/jme3/gde/blender/glTF48.png


+ 1 - 1
jme3-codepalette/src/com/jme3/gde/codepalette/layer.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
+<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
 <filesystem>
     <folder name="JavaPalette">
         <folder name="JME Material">

+ 2 - 0
jme3-core/src/com/jme3/gde/core/assets/ExternalChangeScanner.java

@@ -128,7 +128,9 @@ public class ExternalChangeScanner implements AssetDataPropertyChangeListener, F
         try {
             Spatial original = loadOriginalSpatial();
             Spatial spat = (Spatial) assetDataObject.loadAsset();
+
             SpatialUtil.updateMeshDataFromOriginal(spat, original);
+            SpatialUtil.updateMaterialDataFromOriginal(spat, original);
             if (SpatialUtil.hasAnimations(original)) {
                 NotifyDescriptor.Confirmation mesg = new NotifyDescriptor.Confirmation("Model appears to have animations, try to import as well?\nCurrently this will unlink attachment Nodes and clear\nadded effects tracks.",
                         "Animations Available",

+ 30 - 0
jme3-core/src/com/jme3/gde/core/util/SpatialUtil.java

@@ -220,6 +220,32 @@ public class SpatialUtil {
         });
     }
 
+    /**
+     * Updates material of existing objects from an original file.
+     *
+     * @param root
+     * @param original
+     */
+    public static void updateMaterialDataFromOriginal(final Spatial root,
+                                                      final Spatial original) {
+        //loop through original to also find new geometry
+        original.depthFirstTraversal(new SceneGraphVisitorAdapter() {
+            @Override
+            public void visit(Geometry geom) {
+                //will always return same class type as 2nd param, so casting is safe
+                Geometry spat = (Geometry) findTaggedSpatial(root, geom);
+                if (spat != null && spat.getMaterial() != null
+                        && geom.getMaterial() != null
+                        && !spat.getMaterial().equals(geom.getMaterial())) {
+                    spat.setMaterial(geom.getMaterial().clone());
+                    logger.log(LogLevel.USERINFO,
+                            "Updated material for Geometry {0}", geom.getName()
+                    );
+                }
+            }
+        });
+    }
+
     /**
      * Adds a leaf to a spatial, including all nonexisting parents.
      *
@@ -241,6 +267,10 @@ public class SpatialUtil {
                 logger.log(Level.INFO, "Attaching {0} to {1} in root {2} to add leaf {3}", new Object[]{s, other, root, leaf});
                 //set original path data to leaf and new parents
                 for (Spatial spt = leaf; spt != parent; spt = spt.getParent()) {
+                    if (spt == null) {
+                        // this is to avoid a crash when changing mesh names
+                        return;
+                    }
                     spt.setUserData(ORIGINAL_NAME, spt.getName());
                     spt.setUserData(ORIGINAL_PATH, getSpatialPath(spt));
                     spt = spt.getParent();

+ 19 - 16
jme3-core/src/com/jme3/gde/core/util/notify/NotifyUtil.java

@@ -1,22 +1,22 @@
 /*
  * Copyright (c) 2003-2012 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
@@ -35,17 +35,24 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import javax.swing.Timer;
 import org.openide.DialogDisplayer;
 import org.openide.NotifyDescriptor;
 import org.openide.awt.Notification;
 import org.openide.awt.NotificationDisplayer;
+import org.openide.util.RequestProcessor;
 
 /**
  *
  * @author qbeukes.blogspot.com, used by metalklesk
  */
 public class NotifyUtil {
+    
+    /**
+     * Own request processor (thread pool) for NotifyUtil handling
+     * background tasks
+     */
+    private static final RequestProcessor REQUEST_PROCESSOR =
+            new RequestProcessor("Notification processor", 1);
 
     private NotifyUtil() {
     }
@@ -60,19 +67,15 @@ public class NotifyUtil {
         if (title == null) {
             title = "null";
         }
-        final Notification n = (Notification) NotificationDisplayer.getDefault().notify(title, type.getIcon(), message, actionListener);
+        final Notification n = NotificationDisplayer.getDefault().
+                notify(title, type.getIcon(), message, actionListener);
         if (timeout > 0) {
-            java.awt.EventQueue.invokeLater(new Runnable() {
+            REQUEST_PROCESSOR.post(new Runnable() {
+                @Override
                 public void run() {
-                    Timer timer = new Timer(timeout, new ActionListener() {
-                        public void actionPerformed(ActionEvent e) {
-                            n.clear();
-                        }
-                    });
-                    timer.setRepeats(false);
-                    timer.start();
+                    n.clear();
                 }
-            });
+            }, timeout);
         }
         return n;
     }

+ 1 - 1
jme3-scenecomposer/src/com/jme3/gde/scenecomposer/gizmo/light/DirectionalLightGizmo.java

@@ -76,7 +76,7 @@ public class DirectionalLightGizmo extends NodeCallback implements DirectionalLi
 
     @Override
     public void onRotation(Quaternion oldRotation, Quaternion newRotation) {
-        light.setDirection(newRotation.mult(initialDirection));
+        light.setDirection(newRotation.mult(Vector3f.UNIT_Y, initialDirection));
         jmeLight.setValue("direction", light.getDirection());
     }
     

+ 0 - 16
patches/jbullet_dependencies_version_missing.diff

@@ -1,16 +0,0 @@
---- jbullet.pom.old 2017-12-25 11:09:55.814731762 +0000
-+++ jbullet.pom     2017-12-25 11:09:27.535527327 +0000
-@@ -37,11 +37,13 @@
-     <dependency>
-       <groupId>jbullet</groupId>
-       <artifactId>jbullet</artifactId>
-+      <version>0.0.1</version>
-       <scope>compile</scope>
-     </dependency>
-     <dependency>
-       <groupId>stack-alloc</groupId>
-       <artifactId>stack-alloc</artifactId>
-+      <version>0.0.1</version>
-       <scope>compile</scope>
-     </dependency>
-     <dependency> 

+ 0 - 1
settings.gradle

@@ -1,2 +1 @@
 rootProject.name = 'sdk'
-includeBuild './engine'