- add undoObject to AbstractToolAction

- add Optimize Geometry tool
- fix Tool list generation

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7113 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent 64f3a1005d
commit 8348011344
  1. 218
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/build_jme3_sources_with_netbeans.html
  2. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/file_types.html
  3. 9
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AbstractToolAction.java
  4. 2
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/UseToolAction.java
  5. 4
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/GenerateTangentsTool.java
  6. 69
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/OptimizeGeometry.java

@ -1,15 +1,10 @@
<h1><a>Setting up JME3 in Netbeans 6.x</a></h1>
<h1><a>Setting up a svn checkout of the jME3 Engine</a></h1>
<div>
<p>
You are welcome to try out the new jME3, and contribute patches and features! This document shows how to download, set up, build, and run the latest development version from the sources. (As of Early 2010, we are in pre-alpha.)
</p>
<p>
<br/>
You are welcome to try out the new jME3, and contribute patches and features! This document shows how to download, set up, build, and run the latest development version from the sources.
</p>
<p>
@ -23,11 +18,10 @@ Note: In the following, always replace ”~” with the path to your home direct
<p>
Check out the sources form the repository. (The following NetBeans instructions are equivalent to executing <code>cd ~/NetBeansProjects; svn checkout <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.googlecode.com/svn/branches/jme3"><param name="text" value="<html><u>http://jmonkeyengine.googlecode.com/svn/branches/jme3</u></html>"><param name="textColor" value="blue"></object></code> on the commandline.)
Check out the sources from the repository.
</p>
<ol>
<li><div> In NetBeans go to Team &gt; Subversion &gt; Checkout</div>
<li><div> In jMonkeyPlatform go to Team &gt; Subversion &gt; Checkout</div>
<ol>
<li><div> Repository <acronym title="Uniform Resource Locator">URL</acronym>: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://jmonkeyengine.googlecode.com/svn"><param name="text" value="<html><u>https://jmonkeyengine.googlecode.com/svn</u></html>"><param name="textColor" value="blue"></object></div>
</li>
@ -37,9 +31,9 @@ Check out the sources form the repository. (The following NetBeans instructions
</li>
<li><div> Click Next</div>
<ol>
<li><div> Repository Folders: “branches/jme3</div>
<li><div> Repository Folders: “trunk/engine</div>
</li>
<li><div> Local Folder: ~/NetBeansProjects</div>
<li><div> Local Folder: ~/jMonkeyProjects</div>
</li>
</ol>
</li>
@ -49,96 +43,8 @@ Check out the sources form the repository. (The following NetBeans instructions
<p>
The jme3 project opens in the Project window.
</p>
<p>
Look into the Libraries node and confirm that the project depends on the following libraries in the classpath:
</p>
<pre>
jME3-natives-joal.jar lwjgl.jar gluegen-rt.jar
jME3-jogl-natives.jar jbullet.jar stack-alloc.jar
jME3-lwjgl-natives.jar jinput.jar swing-layout-1.0.4.jar
j-ogg-oggd.jar joal.jar vecmath.jar
j-ogg-vorbisd.jar jogl.jar asm-all-3.1.jar
</pre>
<p>
If you should see any red exclamation marks on packages, look at the Troubleshooting section below.
</p>
</div>
<h3><a>Optional: Setting up JOAL and JOGL</a></h3>
<div>
<p>
This steps configures two optional libraries: JOAL for Audio, and JOGL as back-up option for older GPUs. (This step is recommended, but you can skip it if you know what are are doing.)
</p>
<ol>
<li><div> Open the jme3&#039;s project properties from the Projects window, and go to the Run category.</div>
</li>
<li><div> Under VM Options, enter the following, depending on your operating system. <em>(Replace 32 with 64 if applicable.)</em></div>
<ul>
<li><div> Windows: <code>-Djava.library.path=“lib/jogl/win32/:lib/joal/win32/”</code> </div>
</li>
<li><div> Linux: <code>-Djava.library.path=“lib/jogl/linux32/:lib/joal/linux32/”</code> </div>
</li>
<li><div> Mac <acronym title="Operating System">OS</acronym>: <code>-Djava.library.path=“lib/jogl/macosx_universal/:lib/joal/macosx/”</code></div>
</li>
</ul>
</li>
</ol>
<p>
It is possible to configure one univerversal java library path - this is useful if you ever need to build a platform-independent JAR of your project:
</p>
<ul>
<li><div> <code>-Djava.library.path=“lib/jogl/win32/:lib/joal/win32/:lib/jogl/linux32/:lib/joal/linux32/:lib/jogl/macosx_universal/:lib/joal/macosx/”</code></div>
</li>
<li><div> <code>-Djava.library.path=“lib/jogl/win64/:lib/joal/win64/:lib/jogl/linux64/:lib/joal/linux64/:lib/jogl/macosx_universal/:lib/joal/macosx/”</code></div>
</li>
</ul>
<p>
<strong>Important</strong>: When copying from the wiki, make certain to use normal quotation marks, not the curly ones.
The jme3 project opens in the Project window.
</p>
</div>
<h3><a>Optional: Setting up Android Support</a></h3>
<div>
<p>
Work in progress …
</p>
<p>
A jme3 application can either be deployed to the desktop (as Java Swing application) and web browser (as JNLP/WebStart or Applet), or to an Android phone. While the former is the default, switching to Android deployment can be done in a few steps.
</p>
<ol>
<li><div> Open Project Properties, go to Sources category.</div>
</li>
<li><div> At Source Packages Folders, click “Add Folder”. </div>
<ul>
<li><div> Add <code>src/jme3_android</code></div>
</li>
<li><div> Remove <code>src/jme3_desktop</code></div>
</li>
<li><div> Remove <code>src/jme3_desktop_fx</code></div>
</li>
</ul>
</li>
<li><div> build.xml…</div>
</li>
</ol>
</div>
<h2><a>Build and Run</a></h2>
@ -146,7 +52,7 @@ A jme3 application can either be deployed to the desktop (as Java Swing applicat
<p>
That&#039;s it!
That&#039;s it!
</p>
<ol>
<li><div> Right-click the jme3 project node and “Clean and Build” the project.</div>
@ -163,113 +69,5 @@ That&#039;s it!
</li>
</ol>
<p>
Sample code for cool features is in the <code>src/jme3_test</code> folder. A sample game can be found in <code>jme3_games/jme3game/cubefield/CubeField.java</code>.
</p>
<p>
Tips:
</p>
<ul>
<li><div> To run runnable classes from the Projects window, right-click and choose Run.</div>
</li>
<li><div> To run any runnable class that is open in the editor, press shift-F6.</div>
</li>
</ul>
</div>
<h2><a>Optional: Javadoc Popups and Source Navigation in NetBeans</a></h2>
<div>
<p>
If you are working on the jme3 sources:
</p>
<ol>
<li><div> In the Projects window, right-click the jme3 project and choose Generate Javadoc. Wait.</div>
</li>
<li><div> Confirm in the Files window that the javadoc has been created in <code>~/NetBeansProjects/jme3/dist/javadoc</code></div>
</li>
<li><div> In the editor, place the caret in a jme class and press ctrl-space to view javadoc.</div>
</li>
</ol>
<p>
If you are working on a game project that depends on jme3:
</p>
<ol>
<li><div> First follow the previous tip. (In the future, we may offer jme javadoc as download instead.)</div>
</li>
<li><div> In your game project, right-click the Libraries node and choose “Properties”.</div>
</li>
<li><div> In the Library properties, select jme3.jar and click the Edit button.</div>
<ol>
<li><div> For the Javadoc field, browse to <code>~/NetBeansProjects/jme3/dist/javadoc</code>. Check “as relative path” and click select.</div>
</li>
<li><div> For the Sources field, browse to <code>~/NetBeansProjects/jme3/src</code>. Check “as relative path” and click select.</div>
</li>
<li><div> Click OK.</div>
</li>
</ol>
</li>
<li><div> In the editor, place the caret in a jme class and press ctrl-space to view javadoc. Ctrl-click any jme3 method to jump to its definition in the sources. </div>
</li>
</ol>
<p>
This tip works for any third-party JAR library that you use. (You may have to download the javadoc/sources from their home page separately).
</p>
</div>
<h2><a>Troubleshooting</a></h2>
<div>
<p>
<strong>Cannot Find Symbol SwingWorker </strong> compile errors, and red exclamation marks on some package icons? SwingWorker is part of JDK6 but not JDK5. If you get this error, you have two options to fix it:
</p>
<ul>
<li><div> Make sure you have JDK6 installed, and switch the jme3 project to JDK6. </div>
<ol>
<li><div> In NetBeans, register the JDK6 in the “Tools &gt; Java Platform” manager.</div>
</li>
<li><div> Open the jme3 Project Properties, and switch the <acronym title="Java Development Kit">JDK</acronym> settings in the “Sources” and “Libraries” sections to JDK6.</div>
</li>
<li><div> Clean and Build.</div>
</li>
</ol>
</li>
<li><div> Alternatively, if you must stay with JDK5:</div>
<ol>
<li><div> Temporarily remove the directory <code>jme3_tools/deploy</code>. </div>
</li>
<li><div> Clean and Build.</div>
</li>
</ol>
</li>
</ul>
<p>
<br/>
</p>
<hr />
<p>
<br/>
</p>
<p>
Sources used: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/wiki/BuildJme3"><param name="text" value="<html><u>BuildJme3</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/forum/index.php?topic=13108.0"><param name="text" value="<html><u>netbeans tutorial from forum</u></html>"><param name="textColor" value="blue"></object>
</p>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:build_jme3_sources_with_netbeans?do=export_xhtmlbody">view online version</a></em></p>

@ -42,7 +42,7 @@
<td>.DDS, .HDR, .PFM, .TGA</td><td>Textures</td>
</tr>
<tr>
<td>.font</td><td>Bitmap fonts</td>
<td>.fnt</td><td>Bitmap fonts</td>
</tr>
<tr>
<td>.WAV, .OGG</td><td>Wave and OGG Vorbis audio</td>

@ -59,12 +59,13 @@ public abstract class AbstractToolAction implements ToolAction {
SceneApplication.getApplication().enqueue(new Callable<Void>() {
public Void call() throws Exception {
if (doApplyTool(rootNode)) {
final Object object = doApplyTool(rootNode);
if (object!=null) {
Lookup.getDefault().lookup(SceneUndoRedoManager.class).addEdit(this, new AbstractUndoableSceneEdit() {
@Override
public void sceneUndo() throws CannotUndoException {
doUndoTool(rootNode);
doUndoTool(rootNode,object);
setModified();
}
@ -105,9 +106,9 @@ public abstract class AbstractToolAction implements ToolAction {
};
}
protected abstract boolean doApplyTool(AbstractSceneExplorerNode rootNode);
protected abstract Object doApplyTool(AbstractSceneExplorerNode rootNode);
protected abstract void doUndoTool(AbstractSceneExplorerNode rootNode);
protected abstract void doUndoTool(AbstractSceneExplorerNode rootNode, Object undoObject);
// protected abstract void doAwtUndo();
// protected abstract void doAwtRedo();

@ -61,7 +61,7 @@ public class UseToolAction extends AbstractAction implements Presenter.Popup {
public JMenuItem getPopupPresenter() {
JMenu result = new JMenu("Tools..");
for (ToolAction di : Lookup.getDefault().lookupAll(ToolAction.class)) {
if(exNode.getClass().isAssignableFrom(di.getNodeClass())){
if(di.getNodeClass().isAssignableFrom(exNode.getClass())){
result.add(new JMenuItem(di.getAction(exNode, dataObject)));
}
}

@ -52,7 +52,7 @@ public class GenerateTangentsTool extends AbstractToolAction {
}
@Override
protected boolean doApplyTool(AbstractSceneExplorerNode rootNode) {
protected Object doApplyTool(AbstractSceneExplorerNode rootNode) {
Geometry geom = rootNode.getLookup().lookup(Geometry.class);
Mesh mesh = geom.getMesh();
if (mesh != null) {
@ -62,7 +62,7 @@ public class GenerateTangentsTool extends AbstractToolAction {
}
@Override
protected void doUndoTool(AbstractSceneExplorerNode rootNode) {
protected void doUndoTool(AbstractSceneExplorerNode rootNode, Object undoObject) {
Geometry geom = rootNode.getLookup().lookup(Geometry.class);
Mesh mesh = geom.getMesh();
if (mesh != null) {

@ -0,0 +1,69 @@
/*
* Copyright (c) 2009-2010 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.gde.core.sceneexplorer.nodes.actions.impl;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractToolAction;
import com.jme3.gde.core.sceneexplorer.nodes.actions.ToolAction;
import com.jme3.scene.Spatial;
import jme3tools.optimize.GeometryBatchFactory;
/**
*
* @author normenhansen
*/
@org.openide.util.lookup.ServiceProvider(service = ToolAction.class)
public class OptimizeGeometry extends AbstractToolAction {
public OptimizeGeometry() {
name = "Optimize Geometry";
}
@Override
protected Object doApplyTool(AbstractSceneExplorerNode rootNode) {
Spatial geom = rootNode.getLookup().lookup(Spatial.class);
GeometryBatchFactory.optimize(geom);
return true;
}
@Override
protected void doUndoTool(AbstractSceneExplorerNode rootNode, Object undoObject) {
// Spatial geom = rootNode.getLookup().lookup(Spatial.class);
// geom.removeFromParent();
}
public Class<?> getNodeClass() {
return JmeSpatial.class;
}
}
Loading…
Cancel
Save