@@ -84,13 +84,14 @@ public class MainController implements ICaDoodleStateUpdate, ICameraChangeListen
84
84
private ActiveProject ap = new ActiveProject ();
85
85
private SelectionBox selectionBox = null ;
86
86
private RulerManager ruler = new RulerManager (ap );
87
- private TimelineManager tm = new TimelineManager (ap );
87
+ private TimelineManager timelineManager = new TimelineManager (ap );
88
88
/**
89
89
* CaDoodle Model Classes
90
90
*/
91
91
private BowlerStudio3dEngine navigationCube ;
92
92
private BowlerStudio3dEngine engine ;
93
-
93
+ @ FXML // fx:id="Button"
94
+ private Button timelineButton ;
94
95
@ FXML // fx:id="stackPane"
95
96
private StackPane stackPane ; // Value injected by FXMLLoader
96
97
@ FXML // fx:id="allignButton"
@@ -280,23 +281,25 @@ public class MainController implements ICaDoodleStateUpdate, ICameraChangeListen
280
281
@ FXML // fx:id="zoomInButton"
281
282
private Button dropToWorkplane ;
282
283
private ICaDoodleOpperation source ;
283
-
284
+
284
285
private boolean resetArmed ;
285
286
private long timeOfClick ;
286
287
private MeshView ground ;
287
288
private int lastFrame = 0 ;
288
289
private File currentFile = null ;
289
290
private boolean timelineOpen = true ;
290
-
291
+
291
292
@ FXML
292
293
void onDropToWorkplane (ActionEvent e ) {
293
294
session .onDrop ();
294
295
}
295
- //onObjectWorkplane
296
+
297
+ // onObjectWorkplane
296
298
@ FXML
297
299
void onObjectWorkplane (ActionEvent e ) {
298
300
session .objectWorkplane ();
299
301
}
302
+
300
303
@ FXML
301
304
void onSearch (ActionEvent event ) {
302
305
if (pallet == null )
@@ -375,22 +378,28 @@ void onCruse(ActionEvent event) {
375
378
@ FXML
376
379
void timelineDrawerEvent (ActionEvent e ) {
377
380
try {
378
- timelineOpen = !timelineOpen ;
379
- if (timelineOpen ) {
380
- timelineImage .setImage (new Image (MainController .class .getResourceAsStream ("drawerClose.png" )));
381
- timelineHolder .getChildren ().add (timelineScroll );
382
- } else {
383
- timelineImage .setImage (new Image (MainController .class .getResourceAsStream ("drawerOpen.png" )));
384
- timelineHolder .getChildren ().remove (timelineScroll );
385
- }
386
- tm .setOpenState (timelineOpen );
381
+ setTimelineOpenState (!timelineOpen );
387
382
ConfigurationDatabase .put ("CaDoodle" , "CaDoodleTimelineShow" , timelineOpen );
388
383
} catch (Throwable t ) {
389
384
t .printStackTrace ();
390
385
}
391
386
session .setKeyBindingFocus ();
392
387
}
393
388
389
+ private void setTimelineOpenState (boolean tm ) {
390
+ if (tm ==timelineOpen )
391
+ return ;
392
+ if (tm ) {
393
+ timelineImage .setImage (new Image (MainController .class .getResourceAsStream ("drawerClose.png" )));
394
+ timelineHolder .getChildren ().add (timelineScroll );
395
+ } else {
396
+ timelineImage .setImage (new Image (MainController .class .getResourceAsStream ("drawerOpen.png" )));
397
+ timelineHolder .getChildren ().remove (timelineScroll );
398
+ }
399
+ timelineOpen = tm ;
400
+ timelineManager .setOpenState (tm );
401
+ }
402
+
394
403
@ FXML
395
404
void onDrawer (ActionEvent event ) {
396
405
drawerOpen = !drawerOpen ;
@@ -485,16 +494,16 @@ void onHoleButton(ActionEvent event) {
485
494
void onHome (ActionEvent event ) {
486
495
com .neuronrobotics .sdk .common .Log .error ("Open the Project Select UI" );
487
496
// session.setKeyBindingFocus();
488
- if (holeButton != null )
497
+ if (holeButton != null )
489
498
homeButton .setDisable (true );
490
499
Runnable onFinish = () -> {
491
- if (session != null )
492
- session .setKeyBindingFocus ();
500
+ if (session != null )
501
+ session .setKeyBindingFocus ();
493
502
com .neuronrobotics .sdk .common .Log .error ("ProjectManager Close" );
494
503
BowlerStudio .runLater (() -> homeButton .setDisable (false ));
495
504
};
496
505
Runnable onClear = () -> {
497
- if (session == null )
506
+ if (session == null )
498
507
return ;
499
508
session .clearScreen ();
500
509
session .clearSelection ();
@@ -513,7 +522,7 @@ void onImport(ActionEvent event) {
513
522
com .neuronrobotics .sdk .common .Log .error ("On Import" );
514
523
new Thread (() -> {
515
524
516
- ArrayList <String > extentions =getExtention ();
525
+ ArrayList <String > extentions = getExtention ();
517
526
ExtensionFilter stl = new ExtensionFilter ("CaDoodle Compatible" , extentions );
518
527
if (currentFile == null )
519
528
currentFile = new File (System .getProperty ("user.home" ) + "/Desktop/" );
@@ -522,7 +531,8 @@ void onImport(ActionEvent event) {
522
531
session .setKeyBindingFocus ();
523
532
}).start ();
524
533
}
525
- private ArrayList <String > getExtention ( ) {
534
+
535
+ private ArrayList <String > getExtention () {
526
536
ArrayList <String > extentions = new ArrayList <>();
527
537
528
538
// extentions.add("*");
@@ -543,16 +553,17 @@ private ArrayList<String> getExtention( ) {
543
553
extentions .add ("*.zip" );
544
554
return extentions ;
545
555
}
556
+
546
557
private Thread importAFile (File last ) {
547
558
String lowerCase = last .getName ().toLowerCase ();
548
- if (lowerCase .endsWith (".zip" )) {
559
+ if (lowerCase .endsWith (".zip" )) {
549
560
ap .loadFromZip (last );
550
- }else {
561
+ } else {
551
562
boolean check = false ;
552
563
ArrayList <String > extention = getExtention ();
553
- for (String s : extention ) {
554
- if (lowerCase .endsWith (s .substring (1 ).toLowerCase ())) {
555
- check = true ;
564
+ for (String s : extention ) {
565
+ if (lowerCase .endsWith (s .substring (1 ).toLowerCase ())) {
566
+ check = true ;
556
567
break ;
557
568
}
558
569
}
@@ -768,7 +779,7 @@ void initialize() {
768
779
: "fx:id=\" zoomInButton\" was not injected: check your FXML file 'MainWindow.fxml'." ;
769
780
assert zoomOutButton != null
770
781
: "fx:id=\" zoomOutButton\" was not injected: check your FXML file 'MainWindow.fxml'." ;
771
-
782
+ assert timelineButton != null : "Timeline button failed" ;
772
783
engine = new BowlerStudio3dEngine ("CAD window" );
773
784
engine .rebuild (true );
774
785
ap .addListener (this );
@@ -783,10 +794,11 @@ void initialize() {
783
794
setUpNavigationCube ();
784
795
setUp3dEngine ();
785
796
setUpColorPicker ();
786
- tm .set (timelineScroll ,timeline ,session ,engine );
797
+ timelineManager .set (timelineScroll , timeline , session , engine );
787
798
788
799
session .set (shapeConfiguration , shapeConfigurationBox , shapeConfigurationHolder , configurationGrid , null ,
789
- engine , colorPicker , snapGrid , parametrics , lockButton , lockImage , advancedGroupMenu ,tm ,objectWorkplane ,dropToWorkplane );
800
+ engine , colorPicker , snapGrid , parametrics , lockButton , lockImage , advancedGroupMenu , timelineManager ,
801
+ objectWorkplane , dropToWorkplane );
790
802
session .setButtons (copyButton , deleteButton , pasteButton , hideSHow , mirronButton , cruseButton );
791
803
session .setGroup (groupButton );
792
804
session .setUngroup (ungroupButton );
@@ -810,13 +822,14 @@ void initialize() {
810
822
});
811
823
setupCSGEngine ();
812
824
SplashManager .setClosePreventer (() -> ap .get ().getPercentInitialized () < 0.99 );
813
- timelineOpen = (boolean )ConfigurationDatabase .get ("CaDoodle" , "CaDoodleTimelineShow" , false );
825
+ timelineOpen = (boolean ) ConfigurationDatabase .get ("CaDoodle" , "CaDoodleTimelineShow" , false );
814
826
timeline .getChildren ().clear ();
815
- if (!timelineOpen ) {
827
+ if (!timelineOpen ) {
816
828
timelineHolder .getChildren ().remove (timelineScroll );
817
829
timelineImage .setImage (new Image (MainController .class .getResourceAsStream ("drawerOpen.png" )));
818
830
}
819
- boolean advanced = Boolean .parseBoolean (ConfigurationDatabase .get ("CaDoodle" , "CaDoodleAdvancedMode" , "" +true ).toString ());
831
+ boolean advanced = Boolean
832
+ .parseBoolean (ConfigurationDatabase .get ("CaDoodle" , "CaDoodleAdvancedMode" , "" + false ).toString ());
820
833
setAdvancedMode (advanced );
821
834
}
822
835
@@ -981,20 +994,19 @@ public boolean isMove(MouseEvent me) {
981
994
Dragboard db = event .getDragboard ();
982
995
if (db .hasFiles ()) {
983
996
List <File > files = db .getFiles ();
984
- new Thread (()-> {
997
+ new Thread (() -> {
985
998
for (File file : files ) {
986
999
System .out .println ("File dropped: " + file .getAbsolutePath ());
987
1000
// Process the file as needed
988
-
989
- Thread t = importAFile (file );
990
- if ( t != null )
1001
+
1002
+ Thread t = importAFile (file );
1003
+ if ( t != null )
991
1004
try {
992
1005
t .join ();
993
1006
} catch (InterruptedException e ) {
994
- // TODO Auto-generated catch block
995
1007
e .printStackTrace ();
996
1008
}
997
-
1009
+
998
1010
}
999
1011
}).start ();
1000
1012
}
@@ -1138,9 +1150,9 @@ private void setupEngineControls() {
1138
1150
1139
1151
if (event .getCode () == KeyCode .UP || event .getCode () == KeyCode .DOWN || event .getCode () == KeyCode .LEFT
1140
1152
|| event .getCode () == KeyCode .RIGHT || event .getCode () == KeyCode .TAB ) {
1141
- double dist = 1 ;
1142
- if (event .isShiftDown ())
1143
- dist = 3 ;
1153
+ double dist = 1 ;
1154
+ if (event .isShiftDown ())
1155
+ dist = 3 ;
1144
1156
switch (event .getCode ()) {
1145
1157
case UP :
1146
1158
if (event .isControlDown ()) {
@@ -1373,9 +1385,17 @@ public void onRegenerateStart() {
1373
1385
@ Override
1374
1386
public void onTimelineUpdate (int num ) {
1375
1387
// TODO Auto-generated method stub
1376
-
1388
+
1377
1389
}
1390
+
1378
1391
public void setAdvancedMode (boolean advanced ) {
1379
- System .out .println ("Advanced mode: " +advanced );
1392
+ System .out .println ("Advanced mode: " + advanced );
1393
+ setTimelineOpenState (advanced );
1394
+ session .setAdvancedMode (advanced );
1395
+ BowlerStudio .runLater (()->{
1396
+ timelineButton .setDisable (!advanced );
1397
+ advancedGroupMenu .setDisable (!advanced );
1398
+ });
1399
+
1380
1400
}
1381
1401
}
0 commit comments