mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-22 02:31:37 +00:00
Added #2119 Bulk imported assets can also match filenames based on assigned classname, not just character id prefix
This commit is contained in:
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
|
||||
- [#2123] FLA export - show some progress info
|
||||
- Label that flex compiler is used (when it's enabled in settings)
|
||||
- [#2119] Option to export assets with names like their assigned classes via SymbolClass, without character id
|
||||
- [#2119] Bulk imported assets can also match filenames based on assigned classname, not just character id prefix
|
||||
|
||||
### Fixed
|
||||
- [#2021], [#2000] Caret position in editors when using tabs and / or unicode
|
||||
|
||||
@@ -235,15 +235,32 @@ public class ImageImporter extends TagImporter {
|
||||
}
|
||||
List<File> existingFilesForImageTag = new ArrayList<>();
|
||||
List<File> existingAlphaFilesForImageTag = new ArrayList<>();
|
||||
List<String> classNameExpectedFileNames = new ArrayList<>();
|
||||
for (String className : imageTag.getClassNames()) {
|
||||
classNameExpectedFileNames.add(Helper.makeFileName(className));
|
||||
}
|
||||
|
||||
for (File f : allFiles) {
|
||||
for (File f : allFiles) {
|
||||
if (f.getName().startsWith("" + characterId + ".") || f.getName().startsWith("" + characterId + "_")) {
|
||||
existingFilesForImageTag.add(f);
|
||||
} else {
|
||||
String nameNoExt = f.getName();
|
||||
if (nameNoExt.contains(".")) {
|
||||
nameNoExt = nameNoExt.substring(0, nameNoExt.lastIndexOf("."));
|
||||
}
|
||||
if (classNameExpectedFileNames.contains(nameNoExt)) {
|
||||
existingFilesForImageTag.add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (File f : alphaFiles) {
|
||||
if (f.getName().startsWith("" + characterId + ".") || f.getName().startsWith("" + characterId + "_")) {
|
||||
existingAlphaFilesForImageTag.add(f);
|
||||
} else {
|
||||
String nameNoExt = f.getName().substring(0, f.getName().length() - ".alpha.png".length());
|
||||
if (classNameExpectedFileNames.contains(nameNoExt)) {
|
||||
existingAlphaFilesForImageTag.add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
existingFilesForImageTag.sort(new Comparator<File>() {
|
||||
|
||||
@@ -77,9 +77,23 @@ public class MovieImporter {
|
||||
if (tag instanceof DefineVideoStreamTag) {
|
||||
DefineVideoStreamTag movieTag = (DefineVideoStreamTag) tag;
|
||||
List<File> existingFilesForMovieTag = new ArrayList<>();
|
||||
|
||||
List<String> classNameExpectedFileNames = new ArrayList<>();
|
||||
for (String className : movieTag.getClassNames()) {
|
||||
classNameExpectedFileNames.add(Helper.makeFileName(className));
|
||||
}
|
||||
|
||||
for (File f : allFiles) {
|
||||
if (f.getName().startsWith("" + characterId + ".") || f.getName().startsWith("" + characterId + "_")) {
|
||||
existingFilesForMovieTag.add(f);
|
||||
} else {
|
||||
String nameNoExt = f.getName();
|
||||
if (nameNoExt.contains(".")) {
|
||||
nameNoExt = nameNoExt.substring(0, nameNoExt.lastIndexOf("."));
|
||||
}
|
||||
if (classNameExpectedFileNames.contains(nameNoExt)) {
|
||||
existingFilesForMovieTag.add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
existingFilesForMovieTag.sort(new Comparator<File>() {
|
||||
|
||||
@@ -215,9 +215,23 @@ public class ShapeImporter {
|
||||
if (tag instanceof ShapeTag) {
|
||||
ShapeTag shapeTag = (ShapeTag) tag;
|
||||
List<File> existingFilesForShapeTag = new ArrayList<>();
|
||||
|
||||
List<String> classNameExpectedFileNames = new ArrayList<>();
|
||||
for (String className : shapeTag.getClassNames()) {
|
||||
classNameExpectedFileNames.add(Helper.makeFileName(className));
|
||||
}
|
||||
|
||||
for (File f : allFiles) {
|
||||
if (f.getName().startsWith("" + characterId + ".") || f.getName().startsWith("" + characterId + "_")) {
|
||||
existingFilesForShapeTag.add(f);
|
||||
} else {
|
||||
String nameNoExt = f.getName();
|
||||
if (nameNoExt.contains(".")) {
|
||||
nameNoExt = nameNoExt.substring(0, nameNoExt.lastIndexOf("."));
|
||||
}
|
||||
if (classNameExpectedFileNames.contains(nameNoExt)) {
|
||||
existingFilesForShapeTag.add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
existingFilesForShapeTag.sort(new Comparator<File>() {
|
||||
|
||||
@@ -515,9 +515,25 @@ public class SoundImporter {
|
||||
for (SoundTag tag : soundTags) {
|
||||
int characterId = tag.getCharacterId();
|
||||
List<File> existingFilesForSoundTag = new ArrayList<>();
|
||||
|
||||
List<String> classNameExpectedFileNames = new ArrayList<>();
|
||||
if (tag instanceof CharacterTag) {
|
||||
for (String className : ((CharacterTag) tag).getClassNames()) {
|
||||
classNameExpectedFileNames.add(Helper.makeFileName(className));
|
||||
}
|
||||
}
|
||||
|
||||
for (File f : allFiles) {
|
||||
if (f.getName().startsWith("" + characterId + ".") || f.getName().startsWith("" + characterId + "_")) {
|
||||
existingFilesForSoundTag.add(f);
|
||||
} else {
|
||||
String nameNoExt = f.getName();
|
||||
if (nameNoExt.contains(".")) {
|
||||
nameNoExt = nameNoExt.substring(0, nameNoExt.lastIndexOf("."));
|
||||
}
|
||||
if (classNameExpectedFileNames.contains(nameNoExt)) {
|
||||
existingFilesForSoundTag.add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
existingFilesForSoundTag.sort(new Comparator<File>() {
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
@@ -173,9 +174,23 @@ public class SpriteImporter {
|
||||
if (tag instanceof DefineSpriteTag) {
|
||||
DefineSpriteTag spriteTag = (DefineSpriteTag) tag;
|
||||
List<File> existingFilesForSpriteTag = new ArrayList<>();
|
||||
|
||||
List<String> classNameExpectedFileNames = new ArrayList<>();
|
||||
for (String className : spriteTag.getClassNames()) {
|
||||
classNameExpectedFileNames.add(Helper.makeFileName(className));
|
||||
}
|
||||
|
||||
for (File f : allFiles) {
|
||||
if (f.getName().startsWith("" + characterId + ".") || f.getName().startsWith("" + characterId + "_")) {
|
||||
existingFilesForSpriteTag.add(f);
|
||||
} else {
|
||||
String nameNoExt = f.getName();
|
||||
if (nameNoExt.contains(".")) {
|
||||
nameNoExt = nameNoExt.substring(0, nameNoExt.lastIndexOf("."));
|
||||
}
|
||||
if (classNameExpectedFileNames.contains(nameNoExt)) {
|
||||
existingFilesForSpriteTag.add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
existingFilesForSpriteTag.sort(new Comparator<File>() {
|
||||
|
||||
Reference in New Issue
Block a user