- sanitize geometry name when creating j3m file
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8583 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
f15dfe3011
commit
b27a0ae7fb
@ -109,11 +109,11 @@ public class MaterialPropertyEditor implements PropertyEditor, SceneExplorerProp
|
||||
FileObject currentFolder = currentFile.getParent();
|
||||
|
||||
int i = 0;
|
||||
String newFileName = currentFile.getName() + "-" + geom.getName();
|
||||
String newFileName = currentFile.getName() + "-" + sanitizeFileName(geom.getName());
|
||||
FileObject newFile = currentFolder.getFileObject(newFileName, "j3m");
|
||||
while (newFile != null) {
|
||||
i++;
|
||||
newFileName = currentFile.getName() + "-" + geom.getName() + "-" + i;
|
||||
newFileName = currentFile.getName() + "-" + sanitizeFileName(geom.getName()) + "-" + i;
|
||||
newFile = currentFolder.getFileObject(newFileName, "j3m");
|
||||
}
|
||||
newFile = currentFolder.createData(newFileName, "j3m");
|
||||
@ -132,6 +132,10 @@ public class MaterialPropertyEditor implements PropertyEditor, SceneExplorerProp
|
||||
}
|
||||
}
|
||||
|
||||
private String sanitizeFileName(String input){
|
||||
return input.replaceAll("[^A-Za-z0-9 ]", "_");
|
||||
}
|
||||
|
||||
private void applyMaterial(final String text) {
|
||||
try {
|
||||
Material old = material;
|
||||
|
Loading…
x
Reference in New Issue
Block a user