41 lines
1.7 KiB
Plaintext
41 lines
1.7 KiB
Plaintext
void dropEvent(DropEvent theDropEvent) {
|
|
if (theDropEvent.isFile()) {
|
|
File myFile = theDropEvent.file();
|
|
if (myFile.isDirectory()) {
|
|
File filesLevel0[];
|
|
filesLevel0 = theDropEvent.listFilesAsArray(myFile, 0);
|
|
boolean containsIdle = false;
|
|
boolean containsAction = false;
|
|
for (int i = 0; i < filesLevel0.length; i++) {
|
|
if (filesLevel0[i].getName().equals("action")) {
|
|
containsAction = true;
|
|
println("There is an \"action\"-folder. Assuming the idle animation to be interactive.");
|
|
}
|
|
if (filesLevel0[i].getName().equals("idle")) {
|
|
containsIdle = true;
|
|
println("There is an \"idle\"-folder. Treating this folder as image sequence container.");
|
|
}
|
|
}
|
|
if (containsIdle) {
|
|
File idleDir = new File(theDropEvent.filePath() + "/idle");
|
|
File[] idleFiles = idleDir.listFiles();
|
|
if (activeMarkers < 198) {
|
|
if (containsAction) {
|
|
File actionDir = new File(theDropEvent.filePath() + "/action");
|
|
File[] actionFiles = actionDir.listFiles();
|
|
marker[activeMarkers] = new Marker(activeMarkers, idleFiles, actionFiles, theDropEvent.x(), theDropEvent.y(),theDropEvent.filePath());
|
|
} else {
|
|
marker[activeMarkers] = new Marker(activeMarkers, idleFiles, theDropEvent.x(), theDropEvent.y(),theDropEvent.filePath());
|
|
}
|
|
activeMarkers++;
|
|
} else {
|
|
println("Maximum Amount of Animations reached.");
|
|
}
|
|
} else {
|
|
println("No \"idle\"-folder found. Breaking import...");
|
|
}
|
|
} else {
|
|
println("Drag and Drop a folder that contains at least an idle animation! That was not a folder!");
|
|
}
|
|
}
|
|
} |