diff --git a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/Bundle.properties b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/Bundle.properties
index 94d602cd7..3fe1dc2d9 100644
--- a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/Bundle.properties
+++ b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/Bundle.properties
@@ -3,16 +3,31 @@ OpenIDE-Module-Display-Category=jMonkeyEngine
OpenIDE-Module-Long-Description=\
This plugin allows importing models to a project using a Wizard.
OpenIDE-Module-Name=Model Import Tool
-ModelImporterVisualPanel2.jLabel1.text=Import to path:
-ModelImporterVisualPanel2.jTextField1.text=/Models/MyModel
-ModelImporterVisualPanel2.jCheckBox1.text=copy original model file(s) to project folder
ModelImporterVisualPanel1.jTextField1.text=
-ModelImporterVisualPanel1.jButton1.text=+
-ModelImporterVisualPanel1.jButton2.text=-
-ModelImporterVisualPanel1.jButton3.text=<
-ModelImporterVisualPanel1.jButton4.text=>
ModelImporterVisualPanel1.jButton5.text=open model..
ModelImporterVisualPanel1.jLabel1.text=Imported Model Path:
-ModelImporterVisualPanel2.jTextArea1.text=The model will be converted to j3o binary format and copied \nto the project folder including associated texture etc. files.\nThe given path will be used as the root folder for the model.\n\nIf you copy the original model files to the project folder you can re-convert the model at any time by double-clicking it.
OpenIDE-Module-Short-Description=Allows importing models to a project using a Wizard
-ModelImporterVisualPanel1.jButton6.text=reload with these settings
+ModelImporterVisualPanel3.jTextArea1.text=The model will be converted to j3o binary format and copied \nto the project folder including associated texture etc. files.\nThe given path will be used as the root folder for the model.\n\nIf you copy the original model files to the project folder you can re-convert the model at any time by double-clicking it.
+ModelImporterVisualPanel3.jLabel1.text=Import to path:
+ModelImporterVisualPanel3.jTextField1.text=/Models/MyModel
+ModelImporterVisualPanel3.jCheckBox1.text=copy original model file(s) to project folder
+ModelImporterVisualPanel4.jLabel1.text=Import to path:
+ModelImporterVisualPanel4.jTextField1.text=/Models/MyModel
+ModelImporterVisualPanel4.jCheckBox1.text=copy original model file(s) to project folder
+ModelImporterVisualPanel4.jTextArea1.text=The model will be converted to j3o binary format and copied \nto the project folder including associated texture etc. files.\nThe given path will be used as the root folder for the model.\n\nNote that the texture paths stored in the j3o file will be absolute! To have e.g. your textures in the Textures folder, import the model to the Textures folder and then move the j3o to the Models folder after the import.\n\nIf you copy the original model files to the project folder you can re-convert the model at any time by double-clicking it.
+ModelImporterVisualPanel3.jButton3.text=<
+ModelImporterVisualPanel3.jButton4.text=>
+ModelImporterVisualPanel3.jButton2.text=-
+ModelImporterVisualPanel3.jButton1.text=+
+ModelImporterVisualPanel2.jTextField1.text=/Models/MyModel
+ModelImporterVisualPanel2.jCheckBox1.text=copy original model file(s) to project folder
+ModelImporterVisualPanel2.jLabel1.text=Import to path:
+ModelImporterVisualPanel2.jTextArea1.text=The model will be converted to j3o binary format and copied \nto the project folder including associated texture etc. files.\nThe given path will be used as the root folder for the model.\n\nIf you copy the original model files to the project folder you can re-convert the model at any time by double-clicking it.
+ModelImporterVisualPanel1.jTextArea1.text=Note that the following requirements have to be met for a successful import:\n\n* The model format has to be supported, currently OBJ, OgreXML and Blender formats are supported\n\n* The model textures have to be in the same folder as the model or a subfolder\n\n* The textures have to be UV mapped textures\n\n* Only diffuse, normal, specular, parallax and light maps will be imported\n\n* No extended material settings will be imported\n\n* For animations be sure to have a single root bone
+ModelImporterVisualPanel2.jLabel1.text_1=Asset List
+ModelImporterVisualPanel2.jLabel2.text=Assets failed to load
+ModelImporterVisualPanel2.statusLabel.text=jLabel3
+ModelImporterVisualPanel3.jLabel2.text=Assets failed to load
+ModelImporterVisualPanel3.jLabel1.text_1=Asset List
+ModelImporterVisualPanel3.statusLabel.text=jLabel3
+ModelImporterVisualPanel3.infoTextArea.text_1=Check if the model looks as expected, if some textures fail to load, make sure they are in the same folder or a subfolder of the model. If no textures can be found the model will be displayed in red. With the buttons above you can move the camera.
diff --git a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ImportModel.java b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ImportModel.java
index f26b92e15..07f39c615 100644
--- a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ImportModel.java
+++ b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ImportModel.java
@@ -25,6 +25,7 @@ import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory;
import org.netbeans.api.project.Project;
import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
import org.openide.WizardDescriptor;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
@@ -51,10 +52,9 @@ public final class ImportModel implements ActionListener {
dialog.setVisible(true);
dialog.toFront();
boolean cancelled = wiz.getValue() != WizardDescriptor.FINISH_OPTION;
- ((ModelImporterWizardPanel1) panels[0]).cleanup();
+ ((ModelImporterWizardPanel3) panels[1]).cleanup();
if (!cancelled) {
new Thread(new Runnable() {
-
public void run() {
ProgressHandle handle = ProgressHandleFactory.createHandle("Importing Model..");
handle.start();
@@ -89,8 +89,22 @@ public final class ImportModel implements ActionListener {
destFolder.mkdirs();
FileObject dest = FileUtil.toFileObject(destFolder);
try {
- FileObject fileObj = source.copy(dest, source.getName(), source.getExt());
- if (!(assetKey instanceof TextureKey)) {
+ FileObject fileObj = dest.getFileObject(source.getName(), source.getExt());
+ if (fileObj != null) {
+ NotifyDescriptor.Confirmation msg = new NotifyDescriptor.Confirmation(
+ "File "+source.getNameExt()+" exists, overwrite?",
+ NotifyDescriptor.YES_NO_OPTION,
+ NotifyDescriptor.WARNING_MESSAGE);
+ Object result = DialogDisplayer.getDefault().notify(msg);
+ if (NotifyDescriptor.YES_OPTION.equals(result)) {
+ fileObj.delete();
+ fileObj = source.copy(dest, source.getName(), source.getExt());
+ } else {
+ }
+ } else {
+ fileObj = source.copy(dest, source.getName(), source.getExt());
+ }
+ if (!(assetKey instanceof TextureKey) && fileObj != null) {
deleteList.add(fileObj);
}
} catch (Exception ex) {
@@ -137,14 +151,15 @@ public final class ImportModel implements ActionListener {
}
/**
- * Initialize panels representing individual wizard's steps and sets
- * various properties for them influencing wizard appearance.
+ * 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 ModelImporterWizardPanel1(),
- new ModelImporterWizardPanel2()
+ new ModelImporterWizardPanel3(),
+ new ModelImporterWizardPanel4()
};
String[] steps = new String[panels.length];
for (int i = 0; i < panels.length; i++) {
diff --git a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.form b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.form
index a032c04bf..3c6a14d39 100644
--- a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.form
+++ b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.form
@@ -1,4 +1,4 @@
-
+
diff --git a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel2.java b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel4.java
similarity index 63%
rename from sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel2.java
rename to sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel4.java
index fb0e72737..4db191308 100644
--- a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel2.java
+++ b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel4.java
@@ -4,26 +4,23 @@
*/
package com.jme3.gde.modelimporter;
-import com.jme3.asset.AssetKey;
-import java.util.List;
import javax.swing.JPanel;
import org.openide.WizardDescriptor;
-public final class ModelImporterVisualPanel2 extends JPanel {
+public final class ModelImporterVisualPanel4 extends JPanel {
/** Creates new form ModelImporterVisualPanel2 */
- public ModelImporterVisualPanel2() {
+ public ModelImporterVisualPanel4() {
initComponents();
}
@Override
public String getName() {
- return "Import Options";
+ return "Project Destination";
}
public void loadSettings(WizardDescriptor wiz) {
jTextField1.setText((String)wiz.getProperty("destpath"));
- jList1.setListData(((List)wiz.getProperty("assetlist")).toArray());
}
public void applySettings(WizardDescriptor wiz) {
@@ -44,43 +41,31 @@ public final class ModelImporterVisualPanel2 extends JPanel {
jCheckBox1 = new javax.swing.JCheckBox();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
- jScrollPane2 = new javax.swing.JScrollPane();
- jList1 = new javax.swing.JList();
- org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ModelImporterVisualPanel2.class, "ModelImporterVisualPanel2.jLabel1.text")); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ModelImporterVisualPanel4.class, "ModelImporterVisualPanel4.jLabel1.text")); // NOI18N
- jTextField1.setText(org.openide.util.NbBundle.getMessage(ModelImporterVisualPanel2.class, "ModelImporterVisualPanel2.jTextField1.text")); // NOI18N
+ jTextField1.setText(org.openide.util.NbBundle.getMessage(ModelImporterVisualPanel4.class, "ModelImporterVisualPanel4.jTextField1.text")); // NOI18N
- org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1, org.openide.util.NbBundle.getMessage(ModelImporterVisualPanel2.class, "ModelImporterVisualPanel2.jCheckBox1.text")); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1, org.openide.util.NbBundle.getMessage(ModelImporterVisualPanel4.class, "ModelImporterVisualPanel4.jCheckBox1.text")); // NOI18N
jTextArea1.setColumns(20);
jTextArea1.setEditable(false);
jTextArea1.setLineWrap(true);
jTextArea1.setRows(5);
- jTextArea1.setText(org.openide.util.NbBundle.getMessage(ModelImporterVisualPanel2.class, "ModelImporterVisualPanel2.jTextArea1.text")); // NOI18N
+ jTextArea1.setText(org.openide.util.NbBundle.getMessage(ModelImporterVisualPanel4.class, "ModelImporterVisualPanel4.jTextArea1.text")); // NOI18N
jTextArea1.setWrapStyleWord(true);
jScrollPane1.setViewportView(jTextArea1);
- jList1.setModel(new javax.swing.AbstractListModel() {
- String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
- public int getSize() { return strings.length; }
- public Object getElementAt(int i) { return strings[i]; }
- });
- jScrollPane2.setViewportView(jList1);
-
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
- .addContainerGap(323, Short.MAX_VALUE))
- .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE)
- .addComponent(jCheckBox1, javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(303, Short.MAX_VALUE))
+ .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
+ .addComponent(jCheckBox1, javax.swing.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -90,18 +75,14 @@ public final class ModelImporterVisualPanel2 extends JPanel {
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox1)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE))
);
}// //GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JLabel jLabel1;
- private javax.swing.JList jList1;
private javax.swing.JScrollPane jScrollPane1;
- private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
// End of variables declaration//GEN-END:variables
diff --git a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel1.java b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel1.java
index 83c259238..eb4c382be 100644
--- a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel1.java
+++ b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel1.java
@@ -5,6 +5,10 @@
package com.jme3.gde.modelimporter;
import java.awt.Component;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.openide.WizardDescriptor;
import org.openide.util.HelpCtx;
@@ -23,7 +27,7 @@ public class ModelImporterWizardPanel1 implements WizardDescriptor.Panel {
// create only those which really need to be visible.
public Component getComponent() {
if (component == null) {
- component = new ModelImporterVisualPanel1();
+ component = new ModelImporterVisualPanel1(this);
}
return component;
}
@@ -37,55 +41,43 @@ public class ModelImporterWizardPanel1 implements WizardDescriptor.Panel {
public boolean isValid() {
// If it is always OK to press Next or Finish, then:
- return true;
- // If it depends on some condition (form filled out...), then:
- // return someCondition();
- // and when this condition changes (last form field filled in...) then:
- // fireChangeEvent();
- // and uncomment the complicated stuff below.
+ return component.checkValid();
}
+
+ private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0
public final void addChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.add(l);
+ }
}
public final void removeChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
}
- /*
- private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0
- public final void addChangeListener(ChangeListener l) {
- synchronized (listeners) {
- listeners.add(l);
- }
- }
- public final void removeChangeListener(ChangeListener l) {
- synchronized (listeners) {
- listeners.remove(l);
- }
- }
+
protected final void fireChangeEvent() {
- Iterator it;
- synchronized (listeners) {
- it = new HashSet(listeners).iterator();
- }
- ChangeEvent ev = new ChangeEvent(this);
- while (it.hasNext()) {
- it.next().stateChanged(ev);
- }
+ Iterator it;
+ synchronized (listeners) {
+ it = new HashSet(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ it.next().stateChanged(ev);
+ }
}
- */
// You can use a settings object to keep track of state. Normally the
// settings object will be the WizardDescriptor, so you can use
// WizardDescriptor.getProperty & putProperty to store information entered
// by the user.
public void readSettings(Object settings) {
- component.loadSettings((WizardDescriptor)settings);
+ component.loadSettings((WizardDescriptor) settings);
}
public void storeSettings(Object settings) {
- component.applySettings((WizardDescriptor)settings);
- }
- public void cleanup(){
- component.cleanup();
+ component.applySettings((WizardDescriptor) settings);
}
}
diff --git a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel3.java b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel3.java
new file mode 100644
index 000000000..a3f73affe
--- /dev/null
+++ b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel3.java
@@ -0,0 +1,91 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.jme3.gde.modelimporter;
+
+import java.awt.Component;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.openide.WizardDescriptor;
+import org.openide.util.HelpCtx;
+
+public class ModelImporterWizardPanel3 implements WizardDescriptor.Panel {
+
+ /**
+ * The visual component that displays this panel. If you need to access the
+ * component from this class, just use getComponent().
+ */
+ private ModelImporterVisualPanel3 component;
+
+ // Get the visual component for the panel. In this template, the component
+ // is kept separate. This can be more efficient: if the wizard is created
+ // but never displayed, or not all panels are displayed, it is better to
+ // create only those which really need to be visible.
+ public Component getComponent() {
+ if (component == null) {
+ component = new ModelImporterVisualPanel3(this);
+ }
+ return component;
+ }
+
+ public HelpCtx getHelp() {
+ // Show no Help button for this panel:
+ return new HelpCtx("sdk.model_loader_and_viewer");
+ // If you have context help:
+ // return new HelpCtx(SampleWizardPanel1.class);
+ }
+
+ public boolean isValid() {
+ // If it is always OK to press Next or Finish, then:
+ return component.checkValid();
+ // If it depends on some condition (form filled out...), then:
+ // return someCondition();
+ // and when this condition changes (last form field filled in...) then:
+ // fireChangeEvent();
+ // and uncomment the complicated stuff below.
+ }
+ private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0
+
+ public final void addChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.add(l);
+ }
+ }
+
+ public final void removeChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
+ }
+
+ protected final void fireChangeEvent() {
+ Iterator it;
+ synchronized (listeners) {
+ it = new HashSet(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ it.next().stateChanged(ev);
+ }
+ }
+
+ // You can use a settings object to keep track of state. Normally the
+ // settings object will be the WizardDescriptor, so you can use
+ // WizardDescriptor.getProperty & putProperty to store information entered
+ // by the user.
+ public void readSettings(Object settings) {
+ component.loadSettings((WizardDescriptor) settings);
+ }
+
+ public void storeSettings(Object settings) {
+ component.applySettings((WizardDescriptor) settings);
+ }
+
+ public void cleanup() {
+ component.cleanup();
+ }
+}
diff --git a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel2.java b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel4.java
similarity index 94%
rename from sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel2.java
rename to sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel4.java
index b31e0ff40..49fba54dd 100644
--- a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel2.java
+++ b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterWizardPanel4.java
@@ -9,13 +9,13 @@ import javax.swing.event.ChangeListener;
import org.openide.WizardDescriptor;
import org.openide.util.HelpCtx;
-public class ModelImporterWizardPanel2 implements WizardDescriptor.Panel {
+public class ModelImporterWizardPanel4 implements WizardDescriptor.Panel {
/**
* The visual component that displays this panel. If you need to access the
* component from this class, just use getComponent().
*/
- private ModelImporterVisualPanel2 component;
+ private ModelImporterVisualPanel4 component;
// Get the visual component for the panel. In this template, the component
// is kept separate. This can be more efficient: if the wizard is created
@@ -23,7 +23,7 @@ public class ModelImporterWizardPanel2 implements WizardDescriptor.Panel {
// create only those which really need to be visible.
public Component getComponent() {
if (component == null) {
- component = new ModelImporterVisualPanel2();
+ component = new ModelImporterVisualPanel4();
}
return component;
}