Tiny 2D-animation-sprite composer for placing animation loops and making them interactive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Drop.pde 1.7KB

5 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. void dropEvent(DropEvent theDropEvent) {
  2. if (theDropEvent.isFile()) {
  3. File myFile = theDropEvent.file();
  4. if (myFile.isDirectory()) {
  5. File filesLevel0[];
  6. filesLevel0 = theDropEvent.listFilesAsArray(myFile, 0);
  7. boolean containsIdle = false;
  8. boolean containsAction = false;
  9. for (int i = 0; i < filesLevel0.length; i++) {
  10. if (filesLevel0[i].getName().equals("action")) {
  11. containsAction = true;
  12. println("There is an \"action\"-folder. Assuming the idle animation to be interactive.");
  13. }
  14. if (filesLevel0[i].getName().equals("idle")) {
  15. containsIdle = true;
  16. println("There is an \"idle\"-folder. Treating this folder as image sequence container.");
  17. }
  18. }
  19. if (containsIdle) {
  20. File idleDir = new File(theDropEvent.filePath() + "/idle");
  21. File[] idleFiles = idleDir.listFiles();
  22. if (activeMarkers < 198) {
  23. if (containsAction) {
  24. File actionDir = new File(theDropEvent.filePath() + "/action");
  25. File[] actionFiles = actionDir.listFiles();
  26. marker[activeMarkers] = new Marker(activeMarkers, idleFiles, actionFiles, theDropEvent.x(), theDropEvent.y(),theDropEvent.filePath());
  27. } else {
  28. marker[activeMarkers] = new Marker(activeMarkers, idleFiles, theDropEvent.x(), theDropEvent.y(),theDropEvent.filePath());
  29. }
  30. activeMarkers++;
  31. } else {
  32. println("Maximum Amount of Animations reached.");
  33. }
  34. } else {
  35. println("No \"idle\"-folder found. Breaking import...");
  36. }
  37. } else {
  38. println("Drag and Drop a folder that contains at least an idle animation! That was not a folder!");
  39. }
  40. }
  41. }