Sketch not working after upgrade to High Sierra

I have a sketch that I use for mapping urban space, which shows in the background some photos named C_0001, C_0002, and so on. It is setup to show the images in the normal order (1,2,3,4 etc.) It was working just fine until I upgraded my mac to High Sierra. Now the sketch is showing them in a random sequence. (C_039, C_123, C_004, etc) Can anybody help me with this issue?

So it is true you didn’t change the code at all?

Is this code self-contained or is it interacting with other software or even accessing resources wireless? (synchronization issues)

It is hard to imagine an upgrade like this could create the effect you are describing. I have been proving wrong before. You can use the debugger to track the problem. Or you can share relevant code or it is better if you can provide a minimal running example demonstrating the problem.

Kf

No change at all, I can asure that. It is self contained it reaches some images and data .csv files from a folder located in the same main folder.

48%20PM

Here is the code:

//DATA GATHERING MKIV
//Sketch by Eduardo Gorozpe & Cesar Saldivar
//180327

//------------------------------
//INSTRUCTIONS
//Mind the data format! (C_####.JPG)
//NEVER delete or change the folder tree within the sketch’s folder… NEVER
//Use RIGHT and LEFT arrows to navigate through images
//Use MOUSE WHEEL or type ‘+’ or ‘-’ to zoom in or out respectively
//Use LEFT mouse button to add person
//Use RIGHT mouse button to remove person
//Type ‘A’ or ‘a’ to assign “Romance” activity
//Type ‘B’ or ‘b’ to assign “Bicicleta o patinar” activity
//Type ‘C’ or ‘c’ to assign “Comer” activity
//Type ‘D’ or ‘d’ to assign “Documentar” activity
//Type ‘E’ or ‘e’ to assign “Estancia” activity
//Type ‘J’ or ‘j’ to assign “Jugar” activity
//Type ‘L’ or ‘l’ to assign “Leer” activity
//Type ‘P’ or ‘p’ to assign “Platicar” activity
//Type ‘R’ or ‘r’ to assign “Reunirse” activity
//Type ‘T’ or ‘t’ to assign “Transitar” activity
//Type ‘V’ or ‘v’ to assign “Vender” activity
//Tyoe ‘0’ to return to first frame

//WORKFLOW:
//[0] Configure inferface: Define canvas and camera attributes. Adjust dataG_focalLengthTolerance.
//[1] Run sketch
//[2] Add new person name (If required). Mind the format! (Genre_Age_number)
//[3] For Genre: H stands for men, M stands for women. For Age: N stands for child, J stands for youngster, A stands for adult and M stands for elderly.
//[4] Select current person from dropdown
//[5] Add new group name (If required).
//[6] Select current group from dropdown
//[7] Set coordinate using mouse LEFT button
//[8] Type the corresponding activity
//[9] If activity omitted (By clicking again), activity will be set blank
//[10] If corrections needed, select the person to correct from dropdown and repeat steps [7] through [9]
//[11] To delete a person, RIGHT click on it
//[12] Click on the “SAVE DATA” button to save all the info in their corresponding csv files

//------------------------------
//LIBRARIES
import java.io.File;
import controlP5.*;

//------------------------------
//CONTROL PANEL
//Canvas
int dataG_screenWidth = 1244;
int dataG_screenHeight = 700;

//Camera
float dataG_focalLengthTolerance = 14.00; //Factor de corrección de perspectiva
float dataG_xSizeMultiplier = 1.325; //Correccion de margen de error en X
float dataG_ySizeMultiplier = 1.245; //Correccion de margen de error en Y
float dataG_distanceToFocalCentre = 35.00;
float dataG_cameraHeight = 56.00;
float dataG_cameraFocalLength = 35.00+dataG_focalLengthTolerance;
float dataG_sensorSizeX = 22.40;
float dataG_sensorSizeY = 15.00;

//Pics
String dataG_folderLocation = “/Users/egorozpe/Desktop/sketch_180327_EG_dataG_MKIV”;
File dataG_imgsLocation = new File(dataG_folderLocation+"/sitePics");
File[] dataG_images = dataG_imgsLocation.listFiles();
int dataG_fontSize = 14;
color dataG_imgLabelColour = color(0, 0, 0);

//GUI vars
float dataG_peopleStrokeWeight = 10;
int dataG_infoFontSize = 12;
String dataG_currentPerson = “Default”, dataG_currentGroup = “Default”;

//Data
File dataG_dataLocation = new File(dataG_folderLocation+"/data/porPersona");
File dataG_dataFrameLocation = new File(dataG_folderLocation+"/data/porCuadro");
File dataG_dataGenderLocation = new File(dataG_folderLocation+"/data/porGenero");
File dataG_dataGroupLocation = new File(dataG_folderLocation+"/data/porGrupo");
File[] dataG_data = dataG_dataLocation.listFiles();
File[] dataG_groupData = dataG_dataGroupLocation.listFiles();

//------------------------------
//GLOBAL VARIABLES
//Pics
PImage dataG_currentImg;
PFont dataG_font;
int dataG_navCounter = 0;
int dataG_imgIndex = 0;
String[] dataG_dataList = dataG_imgsLocation.list();

//GUI
ControlP5 dataG_cp5;
Accordion dataG_acc;
ControlGroup dataG_ctrl;
//Controllers
Slider dataG_peopleStrokeWeight_Slider;
Slider dataG_infoFontSize_Slider;
Textfield dataG_newPerson_Textfield;
Bang dataG_addPerson_Bang;
ScrollableList dataG_people_ScrollabeList;
Textfield dataG_newGroup_Textfield;
Bang dataG_addGroup_Bang;
ScrollableList dataG_peopleGroups_ScrollabeList;
Button dataG_saveData_Button;
//Positions
int dataG_cp5Len = 200;
int dataG_yStep = 15;
float currentPosA, currentPosB, currentPosC, currentPosD;

//Interaction vars
float dataG_zoom = 1.00;
ArrayList dataG_people = new ArrayList();
ArrayList dataG_peopleGroups = new ArrayList();
ArrayList<float[]> dataG_personX = new ArrayList<float[]>();
ArrayList<float[]> dataG_personY = new ArrayList<float[]>();
ArrayList<String[]> dataG_personGroup = new ArrayList<String[]>();
ArrayList<String[]> dataG_personActivity = new ArrayList<String[]>();
int dataG_currentPersonIndex, dataG_currentGroupIndex;
boolean dataG_addData = false, dataG_removeData = false;
int dataG_addDataCounter = 0;
int dataG_saveDataCounter = 0;
float dataG_activeAlpha = 0.0;

//dataG_PointPerson
ArrayList dataG_myPeople = new ArrayList();

//------------------------------
//MAIN
//settings()
void settings() {
size(dataG_screenWidth, dataG_screenHeight);
smooth();
}

//------------------------------
//setup()
void setup() {
//Create font
dataG_font = createFont(dataG_folderLocation+"/fonts/arial.ttf", dataG_fontSize);

//Initialise GUI
dataG_initialiseLists();
dataG_setupGUI();
}

//------------------------------
//draw()
void draw() {
//Cursor display
if (!dataG_cp5.isMouseOver()) cursor(CROSS);
else cursor(ARROW);

//Update people
dataG_updatePeople();

//Display, zoom and pan bg img
pushMatrix();
dataG_zoomAndPan();
dataG_imgDisplay();

//Display people
dataG_displayPeopleInfo();
dataG_displayTrails();
dataG_displayPeople();

popMatrix();

//Display img label
dataG_imgLabelDisplay();

//Run GUI
dataG_runGUI();

//Save data
dataG_writeCsvs();

//Global counters
dataG_addDataCounter++;
dataG_saveDataCounter++;
}

//------------------------------
//keyPressed()
void keyPressed() {
if (key== CODED) {
if (keyCode == RIGHT && !dataG_newPerson_Textfield.isActive()) {
dataG_imgIndex++;
dataG_navCounter = 0;
}
if ( keyCode == LEFT && !dataG_newPerson_Textfield.isActive()) {
dataG_imgIndex–;
dataG_navCounter = 0;
}
}

//Zoom
if (key==’+’) dataG_zoom+=.5;
if (key==’-’) dataG_zoom-=.5;

//Assign activitys
//Transitar
if ((key==‘t’ || key==‘T’) &&!dataG_newPerson_Textfield.isActive() && dataG_addData) {
String[] tempActivity = dataG_personActivity.get(dataG_currentPersonIndex);
tempActivity[dataG_imgIndex] = “Transitar”;
dataG_addData = false;
}

//Dirigir
if ((key==‘d’ || key==‘D’) &&!dataG_newPerson_Textfield.isActive() && dataG_addData) {
String[] tempActivity = dataG_personActivity.get(dataG_currentPersonIndex);
tempActivity[dataG_imgIndex] = “Dirigir”;
dataG_addData = false;
}

//Esperar
if ((key==‘e’ || key==‘E’) &&!dataG_newPerson_Textfield.isActive() && dataG_addData) {
String[] tempActivity = dataG_personActivity.get(dataG_currentPersonIndex);
tempActivity[dataG_imgIndex] = “Esperar”;
dataG_addData = false;
}

//Return to first frame
if (key==‘0’) dataG_imgIndex = 0;
}

//------------------------------
//mousePressed()
void mousePressed() {
if (mouseButton == LEFT && !dataG_cp5.isMouseOver()) {
if (dataG_addData) {
String[] tempActivity = dataG_personActivity.get(dataG_currentPersonIndex);
tempActivity[dataG_imgIndex] = “”;
}
dataG_addData = !dataG_addData;
dataG_removeData = false;
dataG_addDataCounter = 0;
}
if (mouseButton == RIGHT && !dataG_cp5.isMouseOver()) {
dataG_removeData = !dataG_removeData;
dataG_addData = false;
}
if (mouseButton == LEFT && dataG_cp5.isMouseOver()) dataG_saveDataCounter = 0;
}

void mouseWheel(MouseEvent activity) {
if (!dataG_cp5.isMouseOver()) {
float z = activity.getCount();
z *= -.5;
dataG_zoom+=z;
}
}

The listFiles method, with or without a filter does not guarantee any order.

You could use .sort() to sort the files:

Without sort, maybe it was working right by chance, but after the OS update, the it’s no longer the case.

1 Like