- Material Editor now shows all j3md files on the classpath (thanks to @H)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9832 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent f5622ffc1e
commit 6bf538d87b
  1. 47
      sdk/jme3-core/src/com/jme3/gde/core/assets/ProjectAssetManager.java
  2. 6
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.form
  3. 14
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialEditorTopComponent.java
  4. 4
      sdk/jme3-model-importer/nbproject/genfiles.properties

@ -85,7 +85,6 @@ public class ProjectAssetManager extends DesktopAssetManager {
}
addFolderLocator(folderName);
ProjectManager.mutex().postWriteRequest(new Runnable() {
public void run() {
updateClassLoader();
}
@ -144,7 +143,6 @@ public class ProjectAssetManager extends DesktopAssetManager {
for (FileObject fileObject : roots) {
if (!fileObject.equals(getAssetFolder())) {
FileChangeListener listener = new FileChangeListener() {
public void fileFolderCreated(FileEvent fe) {
// notifyClassPathListeners();
}
@ -200,7 +198,6 @@ public class ProjectAssetManager extends DesktopAssetManager {
private void prepAssetEventListeners() {
super.setAssetEventListener(new AssetEventListener() {
public void assetLoaded(AssetKey ak) {
synchronized (assetEventListeners) {
for (AssetEventListener assetEventListener : assetEventListeners) {
@ -312,18 +309,45 @@ public class ProjectAssetManager extends DesktopAssetManager {
}
public String[] getMatDefs() {
return collectFilesWithSuffix("j3md");
}
/**
* Collects files over the asset folder(s) and classpath
* @param suffix
* @return
*/
private String[] collectFilesWithSuffix(String suffix) {
ArrayList<String> list = new ArrayList<String>();
FileObject assetsFolder = getAssetFolder();
if (assetsFolder == null) {
return new String[]{};
if (assetsFolder != null) {
Enumeration<FileObject> assets = (Enumeration<FileObject>) assetsFolder.getChildren(true);
while (assets.hasMoreElements()) {
FileObject asset = assets.nextElement();
if (asset.getExt().equalsIgnoreCase(suffix)) {
list.add(getRelativeAssetPath(asset.getPath()));
}
}
}
Enumeration<FileObject> assets = (Enumeration<FileObject>) assetsFolder.getChildren(true);
ArrayList<String> list = new ArrayList<String>();
while (assets.hasMoreElements()) {
FileObject asset = assets.nextElement();
if (asset.getExt().equalsIgnoreCase("j3md")) {
list.add(getRelativeAssetPath(asset.getPath()));
if (classPathItems != null) {
// TODO I need to find out if classPathItems contains all jars added to a project
Iterator<ClassPathItem> classPathItemsIter = classPathItems.iterator();
while (classPathItemsIter.hasNext()) {
ClassPathItem classPathItem = classPathItemsIter.next();
FileObject jarFile = classPathItem.object;
Enumeration<FileObject> jarEntry = (Enumeration<FileObject>) jarFile.getChildren(true);
while (jarEntry.hasMoreElements()) {
FileObject jarEntryAsset = jarEntry.nextElement();
if (jarEntryAsset.getExt().equalsIgnoreCase(suffix)) {
list.add(jarEntryAsset.getPath());
}
}
}
}
return list.toArray(new String[list.size()]);
}
@ -400,7 +424,6 @@ public class ProjectAssetManager extends DesktopAssetManager {
updateClassLoader();
final ProjectAssetManager pm = this;
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
synchronized (classPathListeners) {
for (ClassPathChangeListener classPathChangeListener : classPathListeners) {

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.4" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@ -120,7 +120,7 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jTabbedPane2" pref="326" max="32767" attributes="0"/>
<Component id="jTabbedPane2" pref="320" max="32767" attributes="0"/>
<Component id="jTabbedPane3" pref="326" max="32767" attributes="0"/>
</Group>
</Group>
@ -276,7 +276,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="157" max="32767" attributes="0"/>
<EmptySpace min="0" pref="131" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">

@ -534,13 +534,13 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
jComboBox1.addItem(string);
}
jComboBox1.addItem("Common/MatDefs/Light/Lighting.j3md");
jComboBox1.addItem("Common/MatDefs/Misc/Unshaded.j3md");
jComboBox1.addItem("Common/MatDefs/Misc/Particle.j3md");
jComboBox1.addItem("Common/MatDefs/Misc/Sky.j3md");
jComboBox1.addItem("Common/MatDefs/Gui/Gui.j3md");
jComboBox1.addItem("Common/MatDefs/Terrain/TerrainLighting.j3md");
jComboBox1.addItem("Common/MatDefs/Terrain/Terrain.j3md");
// jComboBox1.addItem("Common/MatDefs/Light/Lighting.j3md");
// jComboBox1.addItem("Common/MatDefs/Misc/Unshaded.j3md");
// jComboBox1.addItem("Common/MatDefs/Misc/Particle.j3md");
// jComboBox1.addItem("Common/MatDefs/Misc/Sky.j3md");
// jComboBox1.addItem("Common/MatDefs/Gui/Gui.j3md");
// jComboBox1.addItem("Common/MatDefs/Terrain/TerrainLighting.j3md");
// jComboBox1.addItem("Common/MatDefs/Terrain/Terrain.j3md");
// jComboBox1.addItem("Common/MatDefs/Misc/ShowNormals.j3md");
jComboBox1.setSelectedItem(selected);
materialFile = prop;

@ -1,8 +1,8 @@
build.xml.data.CRC32=ae2392d0
build.xml.data.CRC32=35b10250
build.xml.script.CRC32=b6310686
build.xml.stylesheet.CRC32=a56c6a5b@2.50.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=ae2392d0
nbproject/build-impl.xml.data.CRC32=35b10250
nbproject/build-impl.xml.script.CRC32=4db64ed5
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.50.1

Loading…
Cancel
Save