Tiny 2D-animation-sprite composer for placing animation loops and making them interactive
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Drop.pde 1.7KB

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. }