diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/core-toc.xml b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/core-toc.xml index cabeed099..0aad433fe 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/core-toc.xml +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/core-toc.xml @@ -61,7 +61,7 @@ - + diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/custom_meshes.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/custom_meshes.html index d10279a14..698f8a9d6 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/custom_meshes.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/custom_meshes.html @@ -126,10 +126,13 @@ The Mesh data is stored in a buffer.
  • The third parameter describes the number of components of the values. Vertex postions are 3 float values, texture coordinates are 2 float values, and the indices are single ints.
  • +
  • In order for JMonkey to correctly show the mesh in the scene, it needs to know the bounds of our new mesh. This can easily be achieved by calling the updateBound() method on it.
    +
  • m.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices));
     m.setBuffer(Type.TexCoord, 2, BufferUtils.createFloatBuffer(texCoord));
    -m.setBuffer(Type.Index,    1, BufferUtils.createIntBuffer(indexes));
    +m.setBuffer(Type.Index, 1, BufferUtils.createIntBuffer(indexes)); +m.updateBound();

    Our Mesh is ready! Now we want to see it.

    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multithreading.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multithreading.html index 01e192371..dbe6a090b 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multithreading.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multithreading.html @@ -8,15 +8,15 @@ First, make sure you know what , I will give just a short introduction. +The java.util.concurrent package provides a good foundation for multithreading and dividing work into tasks that can be executed concurrently (hence the name). The three basic components are the Executor, Callable Objects (the tasks), and Future Objects. You can , I will give just a short introduction.

    +Served from: jmonkeyengine.org @ 2011-04-05 22:34:18 -->

    view online version

    \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html index 0708c3d14..7b175c998 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html @@ -21,12 +21,17 @@ public class HelloWorld extends SimpleApplication {   @Override public void simpleInitApp() { - /* Initialize your game scene here */ + /* Initialize the game scene here */ }   @Override public void simpleUpdate(float tpf) { - /* Interact with game events here in the main loop */ + /* (optional) Interact with game events in the main loop */ + } +  + @Override + public void simpleRender(RenderManager rm) { + /* (optional) Make advanced modifications to frameBuffer and scene graph. */ } }

    @@ -262,6 +267,18 @@ If useInput() is true, the default Flyby Cam is active. Then the following so-ca Rotate dragHold left mouse button and move +

    view online version

    \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/application_deployment.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/application_deployment.html index 99ef1b3c1..fa5db39ce 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/application_deployment.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/application_deployment.html @@ -298,7 +298,7 @@ To remove unused libraries:
  • Press the “Add Library” button
  • -
  • Select the “jme3-libraries-lwjgl-minimum” or “jme3-libraries-jogl-minimum” library (depening on which renderer you use).
    +
  • Select the “jme3-libraries-lwjgl-minimum” library
  • Add other jME3 libraries in the same way depending which features you use (jme3-libraries-gui, jme3-libraries-physics, jme3-libraries-video etc.)
  • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development.html new file mode 100644 index 000000000..fcbb07f1e --- /dev/null +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development.html @@ -0,0 +1,89 @@ + +

    Developing for jMonkeyPlatform

    +
    + +

    + +Note that all info is subject to change while jMP is still in alpha! +

    + +

    +In general, developing plugins for jMonkeyPlatform is not much different than creating plugins for the NetBeans Platform which in turn is not much different than creating Swing applications. You can use jMonkeyPlatform to develop plugins, be it for personal use or to contribute to the community. +

    + +

    +If you feel like you want to make an addition to jMonkeyPlatform dont hesitate to contact the jme team regardless of your knowledge in NetBeans platform development. For new plugins, the basic project creation and layout of the plugin can always be handled by a core developer and you can go on from there fleshing out the plugin. +

    + +

    +By using the Platform functions, your plugin feels more like a Platform application (global save button, file type support etc.). +

    + +
    + +

    Creating plugins and components

    + + +

    Extending jMonkeyPlatform

    + + +

    Recipes

    + + +

    General Notes

    +
    +
      +
    • Although the scene can be accessed at any time via SceneApplication.getApplication() it is not recommended to modify the scene like that. Other plugins might be accessing the scene and updates will not be properly recognized.
      +
    • +
    • Remember the scene runs on the render thread and most everything you do in the plugin (button events etc.) runs on the AWT thread, always encapsulate calls to either side correctly via Callables/Runnables or register as an AppState to the SceneApplication to have an update() call by the render thread.
      +
    • +
    • It became a standard in jMP to start the name of methods that execute directly on the OpenGL thread with “do” e.g “doMoveSpatial”, this makes identifying threading issues easier.
      +
    • +
    • The AssetManager of jme3 is threadsafe and can be used from any thread to load assets
      +
    • +
    • You can get access to the ProjectAssetManager via the Lookup of a JmeSpatial and other objects
      +
    • +
    • Use org.openide.filesystems.FileObject instead of java.io.File for file access, it always uses system-independent ”/” path separators and has some more advanced functions that make file handling easier. + * You can get a file from a string using Repository.getDefault().getDefaultFileSystem().getRoot().getFileObject(“aaa/bbb/ccc/whatever”);
      +
    • +
    • You can convert a regular java File to a FileObject and vice versa using org.openide.filesystems.FileUtil
      +
    • +
    • If you have problems with unresolved classes, check if all needed Libraries are registered in the settings of your Project. To find out which library contains a certain class, just enter the name in the library search field.
      +
    • +
    + +

    + +Learn more about NetBeans Plugin Development at .
    + +Also check out this Essential NetBeans Platform Refcard: +

    + +
    +

    view online version

    \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/projects_assets.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/projects_assets.html new file mode 100644 index 000000000..5151d1e79 --- /dev/null +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/projects_assets.html @@ -0,0 +1,44 @@ + +

    Projects and Assets

    +
    + +

    +The SDK heavily uses the systems provided by the base platform for the handling of assets and projects and extends the system with jME3 specific features. +

    + +
    + +

    AssetDataObject

    +
    + +

    +Most “files” that you encounter in the SDK come in the form of AssetDataObjects. All Nodes that you encounter contain the AssetDataObject they were loaded from. It provides not just access to the FileObject of the specific file but also an AssetData object that allows access to jME specific properties and data. The AssetData object also allows loading the object via the jME3 assetManager. It is accessible via the lookup of the Node or AssetDataObject: + +

    +
    assetDataObject.getLookup().lookup(AssetData.class)
    +
    + +

    ProjectAssetManager

    +
    + +

    +All AssetDataObjects and SceneExplorerNodes allow access to the ProjectAssetManager of the project they were loaded from. + +

    +
    ProjectAssetManager pm = node.getLookup().lookup(ProjectAssetManager.class)
    +

    +The ProjectAssetManager is basically a normal DesktopAssetManager for each project with some added functionality: +

    +
      +
    • Access to the FileObject of the assets folder of the project to load and save data
      +
    • +
    • Convert absolute file paths to relative asset paths and vice versa
      +
    • +
    • Get lists of all textures, materials etc. in the project
      +
    • +
    • more convenient stuff.. :)
      +
    • +
    + +
    +

    view online version

    \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/scene.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/scene.html index 082b47d4f..561c5e0a8 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/scene.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/scene.html @@ -31,23 +31,6 @@ There are several ways for your plugin to interact with the Scene: -
    Notes
    -
    -
      -
    • Although the scene can be accessed at any time via SceneApplication.getApplication() it is not recommended to modify the scene like that. Other plugins might be accessing the scene and updates will not be properly recognized.
      -
    • -
    • Remember the scene runs on the render thread and most everything you do in the plugin (button events etc.) runs on the AWT thread, always encapsulate calls to either side correctly via Callables/Runnables or register as an AppState to the SceneApplication to have an update() call by the render thread.
      -
    • -
    • It became a standard in jMP to start the name of methods that execute directly on the OpenGL thread with “do” e.g “doMoveSpatial”, this makes identifying threading issues easier.
      -
    • -
    • The AssetManager of jme3 is threadsafe and can be used from any thread to load assets
      -
    • -
    • Use org.openide.filesystems.FileObject instead of java.io.File for file access, it always uses system-independent ”/” path separators and has some more advanced functions that make file handling easier. You can get a file from a string using Repository.getDefault().getDefaultFileSystem().getRoot().getFileObject(“aaa/bbb/ccc/whatever”);
      -
    • -
    - -
    -

    Listening for Node selection

    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/sceneexplorer.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/sceneexplorer.html index 3196cbc48..9dfe955f2 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/sceneexplorer.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/sceneexplorer.html @@ -15,19 +15,24 @@ If your plugin brings in its own SceneGraph objects you can still have them work

    You will have to create your own class that extends org.openide.nodes.Node and implement the interface com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode. Then you register that class by adding

    -
    @org.openide.util.lookup.ServiceProvider(service=com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode.class)
    +
    @org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)

    - above the “public class MyClass” line in your class. Thats all, your Spatial type will automatically be used and displayed in the SceneExplorer. Make sure you register a jar with the used classes in the plugin preferences under “wrapped libraries”, otherwise the IDE cannot access those classes. + above the body of your class. Thats all, your Spatial type will automatically be used and displayed in the SceneExplorer. Make sure you register a jar with the used classes in the plugin preferences under “wrapped libraries”, otherwise the IDE cannot access those classes.

    -Theres also AbstractSceneExplorerNode which brings some other useful features you might want to include like automatic creation of properly threaded properties etc. JmeSpatial for example bases on it. A simple SceneExplorerNode example for an object extending Spatial would be JmeGeometry (see below). +Theres also AbstractSceneExplorerNode which brings some other useful features you might want to include like automatic creation of properly threaded properties etc. JmeSpatial for example bases on it. A simple SceneExplorerNode example for an object extending Spatial would be JmeGeometry (see below). Editors for special variable types can be added using the SceneExplorerPropertyEditor interface, which can be registered as a ServiceProvider as well.

    The SceneExplorerNode can be used for Spatial and Control type objects. +

    +
      +
    • Add the “Nodes API” and “Lookup API” libraries to your project when you want to use this
      +
    • +
    @@ -201,7 +206,7 @@ public class JmeGhostControl extends AbstractSceneExplorerNode {

    -For adding Spatials, Contols and for general tools theres premade abstract classes that you can use to extend the options. Undo/Redo is handled by the abstract class. +For adding Spatials, Contols and for general tools theres premade abstract classes that you can use to extend the options. Undo/Redo is handled by the abstract class. AbstractNewSpatialWizardAction allows you to show an AWT wizard before creating the Spatial. You can also just implement the base ServiceProvider class and return any kind of action (such as a wizard), in this case you have to handle the threading yourself!

    @@ -286,5 +291,110 @@ public class NewRigidBodyAction extends AbstractNewControlAction { return control; } } +

    + +

    Adding using a Wizard

    +
    + +

    +You can create a new wizard using the wizard template in the SDK. The Action the wizard creates can easily be changed to a Wizard for adding a Control or Spatial or for applying a Tool. Note that we extend AbstractNewSpatialWizardAction here. +

    + +

    +A good example is the “Add SkyBox” Wizard: + +

    +
    @org.openide.util.lookup.ServiceProvider(service = NewSpatialAction.class)
    +public class AddSkyboxAction extends AbstractNewSpatialWizardAction {
    + 
    +    private WizardDescriptor.Panel[] panels;
    + 
    +    public AddSkyboxAction() {
    +        name = "Skybox..";
    +    }
    + 
    +    @Override
    +    protected Object showWizard(org.openide.nodes.Node node) {
    +        WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    +        wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    +        wizardDescriptor.setTitle("Skybox Wizard");
    +        Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    +        dialog.setVisible(true);
    +        dialog.toFront();
    +        boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    +        if (!cancelled) {
    +            return wizardDescriptor;
    +        }
    +        return null;
    +    }
    + 
    +    @Override
    +    protected Spatial doCreateSpatial(Node parent, Object properties) {
    +        if (properties != null) {
    +            return generateSkybox((WizardDescriptor) properties);
    +        }
    +        return null;
    +    }
    + 
    +    private Spatial generateSkybox(WizardDescriptor wiz) {
    +        if ((Boolean) wiz.getProperty("multipleTextures")) {
    +            Texture south = (Texture) wiz.getProperty("textureSouth");
    +            Texture north = (Texture) wiz.getProperty("textureNorth");
    +            Texture east = (Texture) wiz.getProperty("textureEast");
    +            Texture west = (Texture) wiz.getProperty("textureWest");
    +            Texture top = (Texture) wiz.getProperty("textureTop");
    +            Texture bottom = (Texture) wiz.getProperty("textureBottom");
    +            Vector3f normalScale = (Vector3f) wiz.getProperty("normalScale");
    +            return SkyFactory.createSky(pm, west, east, north, south, top, bottom, normalScale);
    +        } else {
    +            Texture textureSingle = (Texture) wiz.getProperty("textureSingle");
    +            Vector3f normalScale = (Vector3f) wiz.getProperty("normalScale");
    +            boolean useSpheremap = (Boolean) wiz.getProperty("useSpheremap");
    +            return SkyFactory.createSky(pm, textureSingle, normalScale, useSpheremap);
    +        }
    +    }
    + 
    +    /**
    +     * Initialize panels representing individual wizard's steps and sets
    +     * various properties for them influencing wizard appearance.
    +     */
    +    private WizardDescriptor.Panel[] getPanels() {
    +        if (panels == null) {
    +            panels = new WizardDescriptor.Panel[]{
    +                        new SkyboxWizardPanel1(),
    +                        new SkyboxWizardPanel2()
    +                    };
    +            String[panels.length];
    +            for (int i = 0; i < panels.length; i++) {
    +                Component c = panels[i].getComponent();
    +                // Default step name to component name of panel. Mainly useful
    +                // for getting the name of the target chooser to appear in the
    +                // list of steps.
    +                steps[i] = c.getName();
    +                if (c instanceof JComponent) { // assume Swing components
    +                    JComponent) c;
    +                    // Sets step number of a component
    +                    // TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_*:
    +                    jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
    +                    // Sets steps names for a panel
    +                    jc.putClientProperty("WizardPanel_contentData", steps);
    +                    // Turn on subtitle creation on each step
    +                    jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
    +                    // Show steps on the left side with the image on the background
    +                    jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
    +                    // Turn on numbering of all steps
    +                    jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
    +                }
    +            }
    +        }
    +        return panels;
    +    }
    +}
    +

    + +The + +

    +

    view online version

    \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/setup.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/setup.html index 18b46f15f..db4676db9 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/setup.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/setup.html @@ -98,7 +98,7 @@ To add your plugin to the repository, do the following:
  • Enter in the URL field
  • -
  • Enter your googlecode username and password and press “Next”
    +
  • Enter your googlecode username and commit password (different than login pass!) and press “Next”
  • Check that the “Repository Folder” is trunk/mypluginfolder and enter an import message
  • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/material_editing.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/material_editing.html index cbcaae7e0..919094dcd 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/material_editing.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/material_editing.html @@ -68,9 +68,9 @@ When the material is ready and saved into your projects assets directory, you ca In the jMonkeyPlatform

      -
    1. Open the SceneExplorer window
      +
    2. Right-click the j3o file and select “Edit in SceneComposer”
    3. -
    4. Select the .j3o file in the Project window to view it in the SceneExplorer
      +
    5. Open the SceneExplorer window
    6. In the SceneExplorer, click the geometry to which you want to assign the material.
    7. diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/wiki-map.xml b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/wiki-map.xml index 432ca9f07..52281b874 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/wiki-map.xml +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/wiki-map.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/wiki_help.properties b/sdk/jme3-core/javahelp/wiki_help.properties index c363a0d31..92563dcbb 100644 --- a/sdk/jme3-core/javahelp/wiki_help.properties +++ b/sdk/jme3-core/javahelp/wiki_help.properties @@ -16,9 +16,11 @@ sdk:troubleshooting,\ sdk:use_own_jme,\ sdk:vehicle_creator,\ sdk:version_control,\ +sdk:development,\ sdk:development:extension_library,\ sdk:development:general,\ sdk:development:model_loader,\ +sdk:development:projects_assets,\ sdk:development:scene,\ sdk:development:sceneexplorer,\ sdk:development:setup,\ diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialProperties.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/EditableMaterialFile.java similarity index 98% rename from sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialProperties.java rename to sdk/jme3-materialeditor/src/com/jme3/gde/materials/EditableMaterialFile.java index fedd1de2b..20d0c6d3b 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialProperties.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/EditableMaterialFile.java @@ -31,7 +31,7 @@ import org.openide.util.Exceptions; * Provides an editable j3m file * @author normenhansen */ -public class MaterialProperties { +public class EditableMaterialFile { private String name; private String matDefName; @@ -44,7 +44,7 @@ public class MaterialProperties { private FileSystem fs; public static final String[] variableTypes = new String[]{"Int", "Boolean", "Float", "Vector2", "Vector3", "Vector4", "Color", "Texture2D", "TextureCubeMap"}; - public MaterialProperties(FileObject material, ProjectAssetManager manager) { + public EditableMaterialFile(FileObject material, ProjectAssetManager manager) { this.material = material; this.manager = manager; } @@ -236,7 +236,7 @@ public class MaterialProperties { Exceptions.printStackTrace(ex); } } else { - Logger.getLogger(MaterialProperties.class.getName()).log(Level.WARNING, "Could not read MaterialDef!"); + Logger.getLogger(EditableMaterialFile.class.getName()).log(Level.WARNING, "Could not read MaterialDef!"); } for (Iterator> it = materialParameters.entrySet().iterator(); it.hasNext();) { Map.Entry entry = it.next(); diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPropertyEditor.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPropertyEditor.java index cbe948b1b..16deedf3c 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPropertyEditor.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPropertyEditor.java @@ -114,7 +114,7 @@ public class MaterialPropertyEditor implements PropertyEditor, SceneExplorerProp newFile = currentFolder.getFileObject(currentFile.getName() + "_" + i, "j3m"); } newFile = currentFolder.createData(currentFile.getName() + "_" + i, "j3m"); - MaterialProperties properties = new MaterialProperties(newFile, pm); + EditableMaterialFile properties = new EditableMaterialFile(newFile, pm); material.setAssetName(pm.getRelativeAssetPath(newFile.getPath())); properties.setAsMaterial(material); currentFolder.refresh(); diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java index fd39a4d30..b6ec38564 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java @@ -12,7 +12,7 @@ import com.jme3.gde.core.scene.PreviewRequest; import com.jme3.gde.core.scene.SceneApplication; import com.jme3.gde.core.scene.SceneListener; import com.jme3.gde.core.scene.SceneRequest; -import com.jme3.gde.materials.MaterialProperties; +import com.jme3.gde.materials.EditableMaterialFile; import com.jme3.gde.materials.MaterialProperty; import com.jme3.gde.materials.multiview.widgets.MaterialPropertyWidget; import com.jme3.gde.materials.multiview.widgets.MaterialWidgetListener; @@ -65,7 +65,7 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl private final InstanceContent lookupContents = new InstanceContent(); // private SaveNode saveNode; private DataObject dataObject; - private MaterialProperties properties; + private EditableMaterialFile materialFile; private String materialFileName; private ProjectAssetManager manager; private Sphere sphMesh; @@ -89,9 +89,9 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl setActivatedNodes(new Node[]{dataObject.getNodeDelegate()}); ((AssetDataObject) dataObject).setSaveCookie(saveCookie); manager = dataObject.getLookup().lookup(ProjectAssetManager.class); - properties = new MaterialProperties(dataObject.getPrimaryFile(), dataObject.getLookup().lookup(ProjectAssetManager.class)); - properties.read(); - setMatDefList(manager.getMatDefs(), properties.getMatDefName()); + materialFile = new EditableMaterialFile(dataObject.getPrimaryFile(), dataObject.getLookup().lookup(ProjectAssetManager.class)); + materialFile.read(); + setMatDefList(manager.getMatDefs(), materialFile.getMatDefName()); try { jTextArea1.setText(dataObject.getPrimaryFile().asText()); } catch (IOException ex) { @@ -331,10 +331,10 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl }// //GEN-END:initComponents private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed - if (properties != null) { + if (materialFile != null) { updateProperties = true; - properties.setMatDefName((String) jComboBox1.getSelectedItem()); - String string = properties.getUpdatedContent(); + materialFile.setMatDefName((String) jComboBox1.getSelectedItem()); + String string = materialFile.getUpdatedContent(); jTextArea1.setText(string); } }//GEN-LAST:event_jComboBox1ActionPerformed @@ -344,9 +344,9 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl }//GEN-LAST:event_reloadPreview private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed - if (properties != null) { - properties.setName(jTextField1.getText()); - String string = properties.getUpdatedContent(); + if (materialFile != null) { + materialFile.setName(jTextField1.getText()); + String string = materialFile.getUpdatedContent(); jTextArea1.setText(string); } }//GEN-LAST:event_jTextField1ActionPerformed @@ -508,15 +508,15 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl public void save() throws IOException { String text = jTextArea1.getText(); - properties.setAsText(text); + materialFile.setAsText(text); dataObject.setModified(false); showMaterial(); } } public void setMatDefList(final String[] strings, String selected) { - MaterialProperties prop = properties; - properties = null; + EditableMaterialFile prop = materialFile; + materialFile = null; jComboBox1.removeAllItems(); jComboBox1.addItem(""); @@ -533,7 +533,7 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl jComboBox1.addItem("Common/MatDefs/Terrain/Terrain.j3md"); // jComboBox1.addItem("Common/MatDefs/Misc/ShowNormals.j3md"); jComboBox1.setSelectedItem(selected); - properties = prop; + materialFile = prop; } private void updateProperties() { @@ -556,7 +556,7 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl List valueList = new LinkedList(); List textureList = new LinkedList(); List otherList = new LinkedList(); - for (Iterator> it = properties.getParameterMap().entrySet().iterator(); it.hasNext();) { + for (Iterator> it = materialFile.getParameterMap().entrySet().iterator(); it.hasNext();) { Entry entry = it.next(); MaterialPropertyWidget widget = WidgetFactory.getWidget(entry.getValue(), manager); widget.registerChangeListener(this); @@ -596,11 +596,11 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl } jScrollPane2.repaint(); jScrollPane3.repaint(); - setDisplayName(properties.getName() + " - " + properties.getMaterialPath()); - MaterialProperties prop = properties; - properties = null; + setDisplayName(materialFile.getName() + " - " + materialFile.getMaterialPath()); + EditableMaterialFile prop = materialFile; + materialFile = null; jTextField1.setText(prop.getName()); - properties = prop; + materialFile = prop; updateStates(); } @@ -612,7 +612,7 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl } } statesPanel.removeAll(); - for (Iterator> it = properties.getStateMap().entrySet().iterator(); it.hasNext();) { + for (Iterator> it = materialFile.getStateMap().entrySet().iterator(); it.hasNext();) { Entry entry = it.next(); MaterialPropertyWidget widget = WidgetFactory.getWidget(entry.getValue(), manager); widget.registerChangeListener(this); @@ -654,7 +654,7 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl } public void propertyChanged(MaterialProperty property) { - String string = properties.getUpdatedContent(); + String string = materialFile.getUpdatedContent(); jTextArea1.setText(string); } } diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/MaterialPropertyWidget.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/MaterialPropertyWidget.java index c8c95e666..0bbcf5518 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/MaterialPropertyWidget.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/MaterialPropertyWidget.java @@ -5,7 +5,6 @@ package com.jme3.gde.materials.multiview.widgets; -import com.jme3.gde.materials.MaterialProperties; import com.jme3.gde.materials.MaterialProperty; import javax.swing.JPanel;