Skip to content

Commit dcbfb2f

Browse files
committed
clean up the regeneration pathway
1 parent bf850a3 commit dcbfb2f

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public void initializeUI(BowlerAbstractDevice pm) {
7878

7979
disable();
8080
autoRegen.setOnAction(event -> {
81+
baseManager.setAutoRegen(autoRegen.isSelected());
8182
//BowlerStudio.runLater(() -> {
8283
regenFromUiEvent();
8384
//});
@@ -138,9 +139,6 @@ private void regenFromUiEvent() {
138139
BowlerStudio.runLater(() -> {
139140
if (autoRegen.isSelected()) {
140141
disable();
141-
}
142-
baseManager.setAutoRegen(autoRegen.isSelected());
143-
if (autoRegen.isSelected()) {
144142
generateCad();
145143
}
146144
});
@@ -287,19 +285,19 @@ public void run() {
287285
setCadMode(true);// start the UI in config mode
288286
generateCad();
289287

290-
pi.progressProperty().addListener((observable, oldValue, newValue)-> {
291-
//System.out.println("Progress listener " + newValue);
292-
if (newValue.doubleValue() > 0.99) {
293-
BowlerStudio.runLater(() -> {
294-
enable();
295-
});
296-
}else {
297-
BowlerStudio.runLater(() -> {
298-
disable();
299-
});
300-
}
301-
302-
});
288+
// pi.progressProperty().addListener((observable, oldValue, newValue)-> {
289+
// //System.out.println("Progress listener " + newValue);
290+
// if (newValue.doubleValue() > 0.99) {
291+
// BowlerStudio.runLater(() -> {
292+
// enable();
293+
// });
294+
// }else {
295+
// BowlerStudio.runLater(() -> {
296+
// disable();
297+
// });
298+
// }
299+
//
300+
// });
303301
}
304302
private void enable() {
305303
autoRegen.setDisable(false);
@@ -320,8 +318,14 @@ private void setCadMode(boolean mode) {
320318
}
321319

322320
public void generateCad() {
323-
// new Exception().printStackTrace();
324-
baseManager.generateCad();
321+
BowlerStudio.runLater(()->{
322+
disable();
323+
});
324+
baseManager.generateCadWithEnd(()->{
325+
BowlerStudio.runLater(()->{
326+
enable();
327+
});
328+
});
325329
}
326330

327331
@Override

0 commit comments

Comments
 (0)