Normand Briere
2019-07-01 9079880942d022ee32fd3a543843e132e52deb1a
GroupEditor.java
....@@ -150,6 +150,8 @@
150150
151151 void SetupMenu2(GroupEditor oe)
152152 {
153
+ oe.jTree = new cTree();
154
+
153155 Menu menu;
154156 oe.menuBar.add(menu = new Menu("Edit"));
155157 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +162,7 @@
160162 // redoItem = menu.add(new MenuItem("Redo"));
161163 // redoItem.addActionListener(this);
162164 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164166 duplicateItem.addActionListener(this);
165167 cloneItem = menu.add(new MenuItem("Clone"));
166168 cloneItem.addActionListener(this);
....@@ -176,7 +178,6 @@
176178 copyItem.addActionListener(this);
177179 pasteItem = menu.add(new MenuItem("Paste"));
178180 pasteItem.addActionListener(this);
179
- menu.add("-");
180181
181182 menu.add("-");
182183 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -203,23 +204,23 @@
203204 //zBufferItem.addActionListener(this);
204205 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205206 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
207
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
208
+ restoreCameraItem.addActionListener(this);
208209
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- cameraMenu.add("-");
210
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
+// toggleFullScreenItem.addItemListener(this);
212
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
+// cameraMenu.add("-");
214
+//
215
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
216
+// toggleTextureItem.addItemListener(this);
217
+// toggleTextureItem.setState(CameraPane.textureon);
218
+//
219
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
220
+// toggleSwitchItem.addItemListener(this);
221
+// toggleSwitchItem.setState(CameraPane.SWITCH);
213222
214
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
- toggleTextureItem.addItemListener(this);
216
- toggleTextureItem.setState(CameraPane.textureon);
217
-
218
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
- toggleSwitchItem.addItemListener(this);
220
- toggleSwitchItem.setState(CameraPane.SWITCH);
221
-
222
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223224 toggleHandleItem.addItemListener(this);
224225 toggleHandleItem.setState(CameraPane.HANDLES);
225226
....@@ -246,7 +247,7 @@
246247
247248 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248249 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
250
+ toggleDebugItem.setState(Globals.DEBUG);
250251
251252 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252253 toggleFrustumItem.addItemListener(this);
....@@ -274,7 +275,7 @@
274275 {
275276 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276277 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
278
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278279 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279280 oe.cameraMenu.add("-");
280281 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +283,7 @@
282283 editLeafItem.addActionListener(this);
283284 lookAtItem.addActionListener(this);
284285 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
286
+ //switchViewItem.addActionListener(this);
286287 }
287288
288289 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +328,29 @@
327328 }
328329
329330 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
332333 backItem = menu.add(new MenuItem("Back"));
333334 backItem.addActionListener(this);
334335 frontItem = menu.add(new MenuItem("Front"));
335336 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
338342 hideItem = menu.add(new MenuItem("Hidden Group"));
339343 hideItem.addActionListener(this);
344
+ }
340345 ungroupItem = menu.add(new MenuItem("Ungroup"));
341346 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- randomItem.addActionListener(this);
347
+
348
+// menu.add("-");
349
+//
350
+// switchItem = menu.add(new MenuItem("Switch node"));
351
+// switchItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
345354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346355 switchGeoItem.addActionListener(this);
347356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +358,6 @@
349358 morphItem = menu.add(new MenuItem("Morph Group"));
350359 morphItem.addActionListener(this);
351360
352
- if (Globals.ADVANCED)
353
- {
354361 menu.add("-");
355362 physicsItem = menu.add(new MenuItem("Physics"));
356363 physicsItem.addActionListener(this);
....@@ -358,22 +365,20 @@
358365 frameselectorItem.addActionListener(this);
359366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360367 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363368 }
364369
365370 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
368373 billboardItem = menu.add(new MenuItem("Billboard"));
369374 billboardItem.addActionListener(this);
370375 csgItem = menu.add(new MenuItem("CSG"));
371376 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
377
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373378 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
379
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375380 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
381
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377382 shadowZItem.addActionListener(this);
378383 if (Globals.ADVANCED)
379384 {
....@@ -470,6 +475,14 @@
470475 markleavesItem.addActionListener(this);
471476 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472477 unmarkleavesItem.addActionListener(this);
478
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
479
+ rewindleavesItem.addActionListener(this);
480
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
481
+ unrewindleavesItem.addActionListener(this);
482
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
483
+ randomleavesItem.addActionListener(this);
484
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
485
+ unrandomleavesItem.addActionListener(this);
473486 menu.add("-");
474487 flipVItem = menu.add(new MenuItem("Flip V"));
475488 flipVItem.addActionListener(this);
....@@ -527,6 +540,18 @@
527540
528541 void SetupUI2(ObjEditor oe)
529542 {
543
+ // June 2019
544
+ if (oe == null)
545
+ {
546
+ //super.SetupUI2(this);
547
+ //return;
548
+ }
549
+
550
+ if (copy != group)
551
+ {
552
+ //super.SetupUI2(this);
553
+ }
554
+
530555 //new Exception().printStackTrace();
531556
532557 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -555,39 +580,66 @@
555580 oe.radioPanel.add(dummyButton);
556581 oe.buttonGroup.add(dummyButton);
557582 */
583
+ cGridBag copyOptionsPanel = new cGridBag();
584
+
585
+ copyOptionsPanel.preferredHeight = 1;
586
+
558587 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559588
560
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
+ //minButton.setToolTipText("Minimize window");
591
+ //minButton.addActionListener(this);
592
+
593
+ if (Globals.ADVANCED)
594
+ {
595
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ maxButton.setToolTipText("Maximize window");
597
+ maxButton.addActionListener(this);
598
+ }
599
+
600
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601
+ fullButton.setToolTipText("Full-screen window");
602
+ fullButton.addActionListener(this);
603
+
604
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605
+ restoreCameraButton.setToolTipText("Restore viewpoint");
606
+ restoreCameraButton.addActionListener(this);
607
+
608
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561609 undoButton.setToolTipText("Undo changes");
562610 undoButton.addActionListener(this);
611
+ undoButton.setEnabled(false);
563612
564
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
613
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565614 redoButton.setToolTipText("Redo changes");
566615 redoButton.addActionListener(this);
616
+ redoButton.setEnabled(false);
567617
568
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569619 saveButton.setToolTipText("Save changes");
570620 saveButton.addActionListener(this);
571621
572
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
622
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
573623 liveCB.setToolTipText("Enable animation");
574624 liveCB.addItemListener(this);
575625
576
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577627 oneStepButton.setToolTipText("Animate one step forward");
578628 oneStepButton.addActionListener(this);
579629
580
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
630
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
581631 fastCB.setToolTipText("Fast mode");
582632 fastCB.addItemListener(this);
583633
584
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
585
- trackCB.setToolTipText("Enable tracking");
586
- trackCB.addItemListener(this);
587
-
588
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ //oe.toolboxPanel.Return();
635
+
636
+ copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589637 screenfitButton.setToolTipText("Screen fit");
590638 screenfitButton.addActionListener(this);
639
+
640
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
641
+// trackCB.setToolTipText("Enable tracking");
642
+// trackCB.addItemListener(this);
591643
592644 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
593645 // screenfitpointButton.addActionListener(this);
....@@ -599,65 +651,145 @@
599651 snapobjectButton.setToolTipText("Snap Object");
600652 }
601653
602
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- flashSelectionButton.setToolTipText("Show selection");
604
- flashSelectionButton.addActionListener(this);
654
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
605655
606
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
607
-
608
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609657 twoButton.setToolTipText("Show center view only");
610658 twoButton.addActionListener(this);
611
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
659
+ this.fullscreenLayout = twoButton;
660
+
661
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612662 fourButton.addActionListener(this);
613663 fourButton.setToolTipText("Show left panel only");
614
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615665 sixButton.setToolTipText("2-column layout left");
616666 sixButton.addActionListener(this);
617
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618668 threeButton.setToolTipText("2-column layout right");
619669 threeButton.addActionListener(this);
620
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621671 sevenButton.setToolTipText("3-column layout");
622672 sevenButton.addActionListener(this);
623673 //
624674
625
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
675
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626676 rootButton.setToolTipText("Edit selection in new tab");
627677 rootButton.addActionListener(this);
628678
629
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630680 closeButton.setToolTipText("Close tab");
631681 closeButton.addActionListener(this);
632682 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
633683 //clearButton.addActionListener(this);
634
-
635
- cGridBag commandsPanel = new cGridBag();
684
+
685
+ // INSERT
686
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
687
+ gridButton.setToolTipText("Create grid");
688
+ gridButton.addActionListener(this);
689
+
690
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
691
+ boxButton.setToolTipText("Create box");
692
+ boxButton.addActionListener(this);
693
+
694
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ sphereButton.setToolTipText("Create sphere");
696
+ sphereButton.addActionListener(this);
697
+
698
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
699
+ coneButton.setToolTipText("Create cone");
700
+ coneButton.addActionListener(this);
701
+
702
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+ torusButton.setToolTipText("Create torus");
704
+ torusButton.addActionListener(this);
705
+
706
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ superButton.setToolTipText("Create superellipsoid");
708
+ superButton.addActionListener(this);
709
+
710
+ if (Globals.ADVANCED)
711
+ {
712
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ kleinButton.setToolTipText("Create Klein bottle");
714
+ kleinButton.addActionListener(this);
715
+ }
636716
637
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
- editButton.setToolTipText("Edit selection");
717
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
718
+ particlesButton.setToolTipText("Create particle system");
719
+ particlesButton.addActionListener(this);
720
+
721
+ oe.toolboxPanel.Return();
722
+
723
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ groupButton.setToolTipText("Create group");
725
+ groupButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ compositeButton.setToolTipText("Create composite");
729
+ compositeButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ switchButton.setToolTipText("Create item switcher");
733
+ switchButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ loopButton.setToolTipText("Create loop");
737
+ loopButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ textureButton.setToolTipText("Create texture");
741
+ textureButton.addActionListener(this);
742
+
743
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ overlayButton.setToolTipText("Create overlay");
745
+ overlayButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ lightButton.setToolTipText("Create light");
749
+ lightButton.addActionListener(this);
750
+
751
+ for (int i=6; --i>=0;)
752
+ {
753
+ oe.toolboxPanel.Return();
754
+ oe.toolboxPanel.add(new cGridBag());
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ oe.toolboxPanel.add(new cGridBag());
759
+ oe.toolboxPanel.add(new cGridBag());
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ }
762
+
763
+ // EDIT panel
764
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ editButton.setToolTipText("Pin selection controls");
639766 editButton.addActionListener(this);
640767
641
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
- uneditButton.setToolTipText("Unedit selection");
768
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ uneditButton.setToolTipText("Remove selection controls");
643770 uneditButton.addActionListener(this);
644771
645
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
646
- allParamsButton.setToolTipText("Edit all params");
772
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
773
+ allParamsButton.setToolTipText("Show all controle");
647774 allParamsButton.addActionListener(this);
648775
649
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650777 clearPanelButton.setToolTipText("Clear edit panel");
651778 clearPanelButton.addActionListener(this);
652779
653
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654781 unselectButton.setToolTipText("Unselect");
655782 unselectButton.addActionListener(this);
656783
657
- commandsPanel.preferredHeight = 1;
784
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ flashSelectionButton.setToolTipText("Highlight selection");
786
+ flashSelectionButton.addActionListener(this);
658787
659
- oe.treePanel.add(commandsPanel);
660
- oe.treePanel.Return();
788
+ editCommandsPanel.preferredHeight = 1;
789
+
790
+ SetPinStates(false);
791
+// oe.treePanel.add(commandsPanel);
792
+// oe.treePanel.Return();
661793
662794 // oe.aConstraints.gridx += 1;
663795 // oe.aConstraints.weighty = 0;
....@@ -674,27 +806,12 @@
674806
675807 JScrollPane jSP;
676808 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
677
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
809
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
678810 ResetModel();
679811
680812 oe.treePanel.add(jSPPanel);
681813 oe.treePanel.Return();
682814
683
- cGridBag copyOptionsPanel = new cGridBag();
684
-
685
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
686
- colorCB.setToolTipText("Copy color when dropped");
687
- colorCB.addItemListener(this);
688
-
689
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
690
- materialCB.setToolTipText("Copy material when dropped");
691
- materialCB.addItemListener(this);
692
-
693
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
694
- textureCB.setToolTipText("Copy texture when dropped");
695
- textureCB.addItemListener(this);
696
-
697
- copyOptionsPanel.preferredHeight = 1;
698815 oe.treePanel.add(copyOptionsPanel);
699816 oe.treePanel.Return();
700817
....@@ -725,23 +842,43 @@
725842
726843 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
727844 {
845
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
846
+ colorCB.setToolTipText("Copy color when dropped");
847
+ colorCB.addItemListener(this);
848
+
849
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
850
+ materialCB.setToolTipText("Copy material when dropped");
851
+ materialCB.addItemListener(this);
852
+
853
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
854
+ textureCB.setToolTipText("Copy texture when dropped");
855
+ textureCB.addItemListener(this);
856
+
857
+ panel.Return();
858
+
728859 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
729860 boxCB.setToolTipText("Display bounding boxes");
730861 boxCB.addItemListener(this);
731862
732863 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
733
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
864
+ zoomBoxCB.setToolTipText("Display only for wheel");
734865 zoomBoxCB.addItemListener(this);
735866
736867 if (true) // Globals.ADVANCED)
737868 {
738
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
739
- supportCB.setToolTipText("Enable rigging");
740
- supportCB.addItemListener(this);
869
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
870
+// supportCB.setToolTipText("Enable rigging");
871
+// supportCB.addItemListener(this);
872
+
873
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
874
+ freezeCB.setToolTipText("Fast moving camera");
875
+ freezeCB.addItemListener(this);
741876
742877 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
743878 // localCB.addItemListener(this);
744879
880
+ panel.Return();
881
+
745882 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
746883 crowdCB.setToolTipText("Used for crowds");
747884 crowdCB.addItemListener(this);
....@@ -758,6 +895,8 @@
758895 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
759896 // speakerMocapCB.addItemListener(this);
760897
898
+ panel.Return();
899
+
761900 if (false)
762901 {
763902 // handled in scripts
....@@ -772,32 +911,72 @@
772911 //constraints.gridy += 1;
773912 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
774913 smoothfocusCB.addItemListener(this);
914
+ panel.Return();
775915 }
776916
777917 //constraints.gridx += 1;
778918 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
779919 // debugCB.addItemListener(this);
780920
921
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
922
+ trackCB.setToolTipText("Enable tracking target");
923
+ trackCB.addItemListener(this);
924
+
781925 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
926
+ oeilCB.setToolTipText("Move camera when tracking");
782927 oeilCB.addItemListener(this);
783928
929
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
930
+ shadowCB.setToolTipText("When live compute shadows");
931
+ shadowCB.addItemListener(this);
932
+
933
+ panel.Return();
934
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
935
+ toggleTextureCB.setToolTipText("Load textures");
936
+ toggleTextureCB.addItemListener(this);
937
+
938
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
939
+ toggleSwitchCB.setToolTipText("Choose a single item");
940
+ toggleSwitchCB.addItemListener(this);
941
+
942
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
943
+ autosaveCB.setToolTipText("On structure change");
944
+ autosaveCB.addItemListener(this);
945
+
946
+ panel.Return();
947
+ if (Globals.ADVANCED)
948
+ {
784949 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
785950 lookAtCB.setToolTipText("Look-at target");
786951 lookAtCB.addItemListener(this);
952
+ }
787953
788954 }
789955
790956 cGridBag fill = new cGridBag();
791
-
792957 fill.preferredHeight = 200;
958
+ cGridBag fill2 = new cGridBag();
959
+ fill2.preferredHeight = 200;
960
+ cGridBag fill3 = new cGridBag();
961
+ fill3.preferredHeight = 200;
793962
794963 panel.add(fill);
964
+ panel.add(fill2);
965
+ panel.add(fill3);
795966
796967 }
797968
798969 void EditObject(Object3D obj)
799970 {
800971 cRadio radioButton = new cRadio(obj.name);
972
+
973
+ // Patch to avoid bug with transparency.
974
+ radioButton.hadMaterial = obj.material != null;
975
+ if (!radioButton.hadMaterial)
976
+ {
977
+ obj.material = new cMaterial();
978
+ }
979
+
801980 radioButton.SetObject(obj);
802981 radioButton.layout = sevenButton;
803982 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -809,6 +988,8 @@
809988
810989 void SetupViews(ObjEditor oe)
811990 {
991
+ theFrame = this;
992
+
812993 oe.SetupViews();
813994
814995 System.out.println("SetupViews");
....@@ -817,23 +998,28 @@
817998 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
818999 }
8191000
820
- JCheckBox liveCB;
821
- JCheckBox supportCB;
822
- JCheckBox localCB;
823
- JCheckBox crowdCB;
824
- JCheckBox smoothCB;
825
- JCheckBox fastCB;
826
- JCheckBox slowCB;
827
- JCheckBox boxCB;
828
- JCheckBox zoomBoxCB;
829
- JCheckBox trackCB;
830
- JCheckBox smoothfocusCB;
1001
+ cToggleButton liveCB;
1002
+ cCheckBox supportCB;
1003
+ cCheckBox localCB;
1004
+ cCheckBox crowdCB;
1005
+ cCheckBox smoothCB;
1006
+ cToggleButton fastCB;
1007
+ cCheckBox slowCB;
1008
+ cCheckBox boxCB;
1009
+ cCheckBox zoomBoxCB;
1010
+ cCheckBox freezeCB;
1011
+ //cToggleButton trackCB;
1012
+ cCheckBox trackCB;
1013
+ cCheckBox smoothfocusCB;
8311014 // JCheckBox speakerMocapCB;
832
- JCheckBox speakerCameraCB;
833
- JCheckBox speakerFocusCB;
834
- JCheckBox debugCB;
835
- JCheckBox oeilCB;
836
- JCheckBox lookAtCB;
1015
+ cCheckBox speakerCameraCB;
1016
+ cCheckBox speakerFocusCB;
1017
+ cCheckBox debugCB;
1018
+
1019
+ cCheckBox oeilCB;
1020
+ cCheckBox shadowCB;
1021
+ cCheckBox autosaveCB;
1022
+ cCheckBox lookAtCB;
8371023
8381024 // static int COLOR = 1;
8391025 // static int MATERIAL = 2;
....@@ -841,9 +1027,9 @@
8411027
8421028 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8431029
844
- JCheckBox colorCB;
845
- JCheckBox materialCB;
846
- JCheckBox textureCB;
1030
+ cCheckBox colorCB;
1031
+ cCheckBox materialCB;
1032
+ cCheckBox textureCB;
8471033
8481034 public void itemStateChanged(ItemEvent e)
8491035 {
....@@ -936,6 +1122,18 @@
9361122 {
9371123 cameraView.ToggleOeil();
9381124 }
1125
+ else if(e.getSource() == shadowCB)
1126
+ {
1127
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1128
+ }
1129
+ else if(e.getSource() == freezeCB)
1130
+ {
1131
+ Globals.FREEZEONMOVE ^= true;
1132
+ }
1133
+ else if(e.getSource() == autosaveCB)
1134
+ {
1135
+ Globals.SAVEONMAKE ^= true;
1136
+ }
9391137 else if(e.getSource() == lookAtCB)
9401138 {
9411139 cameraView.ToggleLookAt();
....@@ -952,7 +1150,8 @@
9521150
9531151 /**/
9541152 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
955
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1153
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1154
+ TreePath path = objEditor.jTree.getSelectionPath();
9561155 if ((path == null) || (path.getPathCount() <= 1)) {
9571156 // We can't move the root node or an empty selection
9581157 return;
....@@ -1069,23 +1268,33 @@
10691268
10701269 assert target == objEditor.jTree;
10711270 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1271
+ Object3D destinationLeaf;
10721272 try {
1073
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1273
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10741274 } catch (Exception e) {
10751275 System.out.println("destinationPath : " + destinationPath);
10761276 return;
10771277 }
10781278
1079
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1279
+ for (int i=group.selection.size(); --i>=0;)
10801280 {
1281
+ Object3D child = (Object3D)group.selection.elementAt(i);
1282
+
1283
+ // Cannot move into itself
1284
+ if (child == destinationLeaf)
1285
+ return;
1286
+ }
1287
+
1288
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1289
+// {
10811290 loadClipboard(true);
10821291 objEditor.jTree.setSelectionPath(destinationPath);
10831292 pasteInto(false, false);
1084
- } else {
1085
- loadClipboard(false);
1086
- objEditor.jTree.setSelectionPath(destinationPath);
1087
- pasteInto(false, false); // true); // ???
1088
- }
1293
+// } else {
1294
+// loadClipboard(false);
1295
+// objEditor.jTree.setSelectionPath(destinationPath);
1296
+// pasteInto(false, false); // true); // ???
1297
+// }
10891298 }
10901299 public void dropActionChanged(DropTargetDragEvent dtde)
10911300 // Called if the user has modified the current drop gesture
....@@ -1190,22 +1399,30 @@
11901399 {
11911400 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11921401 //heightFieldItem.addActionListener(this);
1193
- gridItem = menu.add(new MenuItem("Grid"));
1194
- gridItem.addActionListener(this);
1195
- rectoidItem = menu.add(new MenuItem("Box"));
1196
- rectoidItem.addActionListener(this);
1197
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1198
- ellipsoidItem.addActionListener(this);
1199
- coneItem = menu.add(new MenuItem("Cone"));
1200
- coneItem.addActionListener(this);
1201
- torusItem = menu.add(new MenuItem("Torus"));
1202
- torusItem.addActionListener(this);
1203
- superItem = menu.add(new MenuItem("Superellipsoid"));
1204
- superItem.addActionListener(this);
1402
+// gridItem = menu.add(new MenuItem("Grid"));
1403
+// gridItem.addActionListener(this);
1404
+// rectoidItem = menu.add(new MenuItem("Box"));
1405
+// rectoidItem.addActionListener(this);
1406
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1407
+// ellipsoidItem.addActionListener(this);
1408
+// coneItem = menu.add(new MenuItem("Cone"));
1409
+// coneItem.addActionListener(this);
1410
+// torusItem = menu.add(new MenuItem("Torus"));
1411
+// torusItem.addActionListener(this);
1412
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1413
+// superItem.addActionListener(this);
1414
+
1415
+ cameraItem = menu.add(new MenuItem("Camera"));
1416
+ cameraItem.addActionListener(this);
1417
+
1418
+ if (!Globals.ADVANCED)
1419
+ {
12051420 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12061421 kleinItem.addActionListener(this);
1207
- particleItem = menu.add(new MenuItem("Particle system"));
1208
- particleItem.addActionListener(this);
1422
+ }
1423
+
1424
+// particleItem = menu.add(new MenuItem("Particle system"));
1425
+// particleItem.addActionListener(this);
12091426 if (Globals.ADVANCED)
12101427 {
12111428 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1231,15 +1448,15 @@
12311448 }
12321449 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12331450 bezierItem.addActionListener(this);
1234
- overlayItem = menu.add(new MenuItem("Overlay"));
1235
- overlayItem.addActionListener(this);
1236
- lightItem = menu.add(new MenuItem("Light"));
1237
- lightItem.addActionListener(this);
1451
+// overlayItem = menu.add(new MenuItem("Overlay"));
1452
+// overlayItem.addActionListener(this);
1453
+// lightItem = menu.add(new MenuItem("Light"));
1454
+// lightItem.addActionListener(this);
12381455 menu.add("-");
12391456 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12401457 //superLoopItem.addActionListener(this);
1241
- loopItem = menu.add(new MenuItem("Loop"));
1242
- loopItem.addActionListener(this);
1458
+// loopItem = menu.add(new MenuItem("Loop"));
1459
+// loopItem.addActionListener(this);
12431460 doubleItem = menu.add(new MenuItem("Fork"));
12441461 doubleItem.addActionListener(this);
12451462 if (Globals.ADVANCED)
....@@ -1254,6 +1471,9 @@
12541471 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
12551472 animationItem.addItemListener(this);
12561473 animationItem.setState(Globals.ANIMATION);
1474
+
1475
+ menu.add(archiveItem = new CheckboxMenuItem("Archive3D..."));
1476
+ archiveItem.addItemListener(this);
12571477
12581478 menu.add("-");
12591479 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
....@@ -1420,9 +1640,24 @@
14201640 shadow.material = new cMaterial(obj.material);
14211641 shadow.material.diffuse = 0.0001f;
14221642 shadow.material.specular = 0.0001f;
1643
+ //shadow.projectedVertices[1].x = 300;
14231644
14241645 makeSomething(shadow);
14251646 }
1647
+
1648
+ private void ClearUnpinned()
1649
+ {
1650
+ //for (Object3D obj : listUI)
1651
+ for (int i=listUI.size(); --i>=0;)
1652
+ {
1653
+ Object3D obj = listUI.elementAt(i);
1654
+ if (!obj.pinned)
1655
+ {
1656
+ obj.CloseUI();
1657
+ listUI.remove(i);
1658
+ }
1659
+ }
1660
+ }
14261661
14271662 /**
14281663 * applyExample
....@@ -1667,7 +1902,7 @@
16671902 {
16681903 ScreenFit();
16691904 } else
1670
- if (source == switchItem)
1905
+ if (source == switchViewItem)
16711906 {
16721907 cVector v1 = new cVector();
16731908 cVector v2 = new cVector();
....@@ -1676,11 +1911,11 @@
16761911 objEditor.cameraView.renderCamera.setAim(v2, v1);
16771912 objEditor.cameraView.repaint();
16781913 } else
1679
- if (source == rectoidItem)
1914
+ if (source == rectoidItem || source == boxButton)
16801915 {
16811916 makeSomething(new Box());
16821917 } else
1683
- if (source == particleItem)
1918
+ if (source == particleItem || source == particlesButton)
16841919 {
16851920 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16861921 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1759,27 +1994,27 @@
17591994
17601995 makeSomething(obj);
17611996 } else
1762
- if (source == gridItem)
1997
+ if (source == gridItem || source == gridButton)
17631998 {
17641999 makeSomething(new Grid());
17652000 } else
1766
- if (source == ellipsoidItem)
2001
+ if (source == ellipsoidItem || source == sphereButton)
17672002 {
17682003 makeSomething(new Sphere());
17692004 } else
1770
- if (source == coneItem)
2005
+ if (source == coneItem || source == coneButton)
17712006 {
17722007 makeSomething(new Cone());
17732008 } else
1774
- if (source == torusItem)
2009
+ if (source == torusItem || source == torusButton)
17752010 {
17762011 makeSomething(new Torus());
17772012 } else
1778
- if (source == superItem)
2013
+ if (source == superItem || source == superButton)
17792014 {
17802015 makeSomething(new Superellipsoid());
17812016 } else
1782
- if (source == kleinItem)
2017
+ if (source == kleinItem || source == kleinButton)
17832018 {
17842019 makeSomething(new Klein());
17852020 } else
....@@ -1799,7 +2034,7 @@
17992034 {
18002035 makeSomething(new BezierSurface());
18012036 } else
1802
- if (source == overlayItem)
2037
+ if (source == overlayItem || source == overlayButton)
18032038 {
18042039 /*
18052040 Object3D obj = new BezierSurface(5,8);
....@@ -1847,7 +2082,7 @@
18472082 s.setup();
18482083 makeSomething(s);
18492084 } else
1850
- if (source == lightItem)
2085
+ if (source == lightItem || source == lightButton)
18512086 {
18522087 makeSomething(new Light());
18532088 } else
....@@ -1897,30 +2132,30 @@
18972132
18982133 group(g);
18992134 } else
1900
- if (source == loopItem)
2135
+ if (source == loopItem || source == loopButton)
19012136 {
19022137 Composite csg = new GroupLeaf();
19032138 csg.count = 5;
19042139 group(csg);
1905
- Composite child = new cGroup();
2140
+ Composite child = new cGroup("Branch");
19062141 csg.addChild(child);
19072142 child.addChild(csg);
19082143 } else
19092144 if (source == doubleItem)
19102145 {
1911
- Composite csg = new GroupLeaf();
2146
+ Composite csg = new GroupLeaf("Fork");
19122147 csg.count = 5;
19132148 group(csg);
1914
- Composite child = new cGroup();
2149
+ Composite child = new cGroup("Branch A");
19152150 csg.addChild(child);
19162151 child.addChild(csg);
1917
- child = new cGroup();
2152
+ child = new cGroup("Branch B");
19182153 csg.addChild(child);
19192154 child.addChild(csg);
19202155 } else
19212156 if (source == tripleItem)
19222157 {
1923
- Composite csg = new GroupLeaf();
2158
+ Composite csg = new GroupLeaf("Trident");
19242159 csg.count = 4;
19252160 group(csg);
19262161 Composite child = new cGroup();
....@@ -1969,6 +2204,18 @@
19692204 if (source == dumpItem)
19702205 {
19712206 DumpObject();
2207
+ } else
2208
+ if (source == minButton)
2209
+ {
2210
+ Minimize();
2211
+ } else
2212
+ if (source == maxButton)
2213
+ {
2214
+ Maximize();
2215
+ } else
2216
+ if (source == fullButton)
2217
+ {
2218
+ ToggleFullScreen();
19722219 } else
19732220 if (source == undoButton)
19742221 {
....@@ -2375,9 +2622,9 @@
23752622 {
23762623 ClearSelection(true);
23772624 } else
2378
- if (source == grabItem)
2625
+ if (source == grabItem || source == groupButton)
23792626 {
2380
- group(new cGroup(), true);
2627
+ group(new cGroup(), false); // true);
23812628 } else
23822629 if (source == hideItem)
23832630 {
....@@ -2395,11 +2642,11 @@
23952642 {
23962643 makeSomething(new Camera());
23972644 } else
2398
- if (source == compositeItem)
2645
+ if (source == compositeItem || source == compositeButton)
23992646 {
24002647 group(new Composite());
24012648 } else
2402
- if (source == randomItem)
2649
+ if (source == switchItem || source == switchButton)
24032650 {
24042651 RandomNode random = new RandomNode();
24052652 group(random);
....@@ -2501,7 +2748,7 @@
25012748 {
25022749 group(new cLinker());
25032750 } else
2504
- if (source == textureItem)
2751
+ if (source == textureItem || source == textureButton)
25052752 {
25062753 group(new TextureNode());
25072754 } else
....@@ -2521,17 +2768,30 @@
25212768 {
25222769 CastShadow(2);
25232770 } else
2524
- if (source == ungroupItem)
2771
+ if (source == ungroupItem || source == ungroupButton)
25252772 {
2526
- //ungroup();
2773
+ boolean hasRoot = false;
2774
+
25272775 for (int i=0; i<group.selection.size(); i++)
25282776 {
2529
- Ungroup(group.selection.get(i));
2777
+ if (group.selection.get(i) == group)
2778
+ {
2779
+ hasRoot = true;
2780
+ break;
2781
+ }
25302782 }
25312783
2532
- ClearSelection(false);
2533
-
2534
- refreshContents();
2784
+ if (!hasRoot)
2785
+ {
2786
+ for (int i=0; i<group.selection.size(); i++)
2787
+ {
2788
+ Ungroup(group.selection.get(i));
2789
+ }
2790
+
2791
+ ClearSelection(false);
2792
+
2793
+ refreshContents();
2794
+ }
25352795 } else
25362796 if (source == genUVItem)
25372797 {
....@@ -2608,6 +2868,22 @@
26082868 if (source == unmarkleavesItem)
26092869 {
26102870 MarkLeaves(false);
2871
+ } else
2872
+ if (source == rewindleavesItem)
2873
+ {
2874
+ RewindLeaves(true);
2875
+ } else
2876
+ if (source == unrewindleavesItem)
2877
+ {
2878
+ RewindLeaves(false);
2879
+ } else
2880
+ if (source == randomleavesItem)
2881
+ {
2882
+ RandomLeaves(true);
2883
+ } else
2884
+ if (source == unrandomleavesItem)
2885
+ {
2886
+ RandomLeaves(false);
26112887 } else
26122888 if (source == flipVItem)
26132889 {
....@@ -2843,6 +3119,10 @@
28433119 if (source == twoButton)
28443120 {
28453121 radio.layout = twoButton;
3122
+
3123
+ if (CameraPane.FULLSCREEN)
3124
+ fullscreenLayout = radio.layout;
3125
+
28463126 // bug
28473127 //gridPanel.setDividerLocation(1.0);
28483128 //bigPanel.setDividerLocation(0.0);
....@@ -2875,10 +3155,31 @@
28753155 bigThree.ClearUI();
28763156 bigThree.add(centralPanel);
28773157 bigThree.FlushUI();
3158
+
3159
+ cameraView.requestFocusInWindow();
3160
+
3161
+// refreshContents(true);
3162
+//
3163
+// try
3164
+// {
3165
+// java.awt.Robot bot = new java.awt.Robot();
3166
+// int mask = InputEvent.BUTTON1_MASK;
3167
+// bot.mouseMove(100, 100);
3168
+// bot.mousePress(mask);
3169
+// bot.mouseRelease(mask);
3170
+// }
3171
+// catch (Exception e)
3172
+// {
3173
+//
3174
+// }
3175
+
28783176 } else
28793177 if (source == threeButton)
28803178 {
28813179 radio.layout = threeButton;
3180
+
3181
+ if (CameraPane.FULLSCREEN)
3182
+ fullscreenLayout = radio.layout;
28823183
28833184 // bigThree.remove(scenePanel);
28843185 // bigThree.remove(centralPanel);
....@@ -2911,10 +3212,15 @@
29113212 bigThree.add(centralPanel);
29123213 bigThree.add(XYZPanel);
29133214 bigThree.FlushUI();
3215
+
3216
+ cameraView.requestFocusInWindow();
29143217 } else
29153218 if (source == fourButton)
29163219 {
29173220 radio.layout = fourButton;
3221
+
3222
+ if (CameraPane.FULLSCREEN)
3223
+ fullscreenLayout = radio.layout;
29183224
29193225 // bigThree.remove(scenePanel);
29203226 // bigThree.remove(centralPanel);
....@@ -2946,10 +3252,15 @@
29463252 bigThree.ClearUI();
29473253 bigThree.add(scenePanel);
29483254 bigThree.FlushUI();
3255
+
3256
+ cameraView.requestFocusInWindow();
29493257 } else
29503258 if (source == sixButton)
29513259 {
29523260 radio.layout = sixButton;
3261
+
3262
+ if (CameraPane.FULLSCREEN)
3263
+ fullscreenLayout = radio.layout;
29533264
29543265 // bigThree.remove(scenePanel);
29553266 // bigThree.remove(centralPanel);
....@@ -2982,10 +3293,15 @@
29823293 bigThree.add(scenePanel);
29833294 bigThree.add(centralPanel);
29843295 bigThree.FlushUI();
3296
+
3297
+ cameraView.requestFocusInWindow();
29853298 } else
29863299 if (source == sevenButton)
29873300 {
29883301 radio.layout = sevenButton;
3302
+
3303
+ if (CameraPane.FULLSCREEN)
3304
+ fullscreenLayout = radio.layout;
29893305
29903306 // bigThree.remove(scenePanel);
29913307 // bigThree.remove(centralPanel);
....@@ -3019,6 +3335,8 @@
30193335 bigThree.add(centralPanel);
30203336 bigThree.add(XYZPanel);
30213337 bigThree.FlushUI();
3338
+
3339
+ cameraView.requestFocusInWindow();
30223340 } else
30233341 if (source == rootButton)
30243342 {
....@@ -3030,6 +3348,7 @@
30303348 EditObject(obj);
30313349 }
30323350
3351
+ cameraView.requestFocusInWindow();
30333352 refreshContents(true);
30343353 } else
30353354 if (source == closeButton)
....@@ -3039,22 +3358,37 @@
30393358 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30403359 {
30413360 ab = (cRadio)e.nextElement();
3042
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3361
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30433362 {
3363
+ // Patch to avoid bug with transparency.
3364
+ if (!ab.hadMaterial)
3365
+ {
3366
+ ab.object.material = null;
3367
+ }
3368
+
30443369 buttonGroup.remove(ab);
30453370 radioPanel.remove(ab);
30463371
3047
- ab.GetObject().editWindow = null;
3372
+ //ab.GetObject().editWindow = null;
3373
+ ab.GetObject().manipWindow = null;
30483374 // ab.GetObject().objectUI = null; // ?????????
30493375
30503376 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30513377 break;
30523378 }
30533379 }
3380
+
3381
+ cameraView.requestFocusInWindow();
30543382 refreshContents(true);
30553383 } else
30563384 if (source == editItem || source == editButton)
30573385 {
3386
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3387
+ {
3388
+ Object3D child = (Object3D)e.nextElement();
3389
+ child.pinned = true;
3390
+ }
3391
+
30583392 EditSelection(false);
30593393 } else
30603394 if (source == uneditButton)
....@@ -3064,6 +3398,7 @@
30643398 Object3D child = (Object3D)e.nextElement();
30653399 if(child.editWindow != null)
30663400 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3401
+ child.pinned = false;
30673402 child.CloseUI();
30683403 listUI.remove(child);
30693404
....@@ -3080,6 +3415,7 @@
30803415 //copy.ClearUI();
30813416 for (Object3D obj : listUI)
30823417 {
3418
+ obj.pinned = false;
30833419 obj.CloseUI();
30843420 }
30853421 listUI.clear();
....@@ -3089,7 +3425,7 @@
30893425 {
30903426 assert(copy == group);
30913427
3092
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3428
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30933429
30943430 for (Object3D obj : listUI)
30953431 {
....@@ -3155,7 +3491,8 @@
31553491 }
31563492
31573493 // fix "+" issue
3158
- group.editWindow = this;
3494
+ //group.editWindow = this;
3495
+ group.manipWindow = this;
31593496
31603497 /*
31613498 currentLayout = radio.layout;
....@@ -3163,18 +3500,25 @@
31633500 currentLayout = sevenButton;
31643501 */
31653502 radio.layout.doClick();
3503
+
3504
+ ClearUnpinned();
3505
+ SetPinStates(group.selection.size() > 0);
3506
+ if (group.selection.size() == 1)
3507
+ EditSelection(false);
31663508 keepparent = group.parent;
31673509 // PARENT = NULL or not???
31683510 //group.parent = null; // ROOT
31693511 //group.attributes = -1;
31703512 ResetModel();
3513
+
3514
+ cameraView.requestFocusInWindow();
31713515 refreshContents(true);
31723516 } else if (event.getSource() == editCameraItem)
31733517 {
31743518 cameraView.ProtectCamera();
31753519 cameraView.repaint();
31763520 return;
3177
- } else if (event.getSource() == revertCameraItem)
3521
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31783522 {
31793523 cameraView.RevertCamera();
31803524 cameraView.repaint();
....@@ -3191,7 +3535,6 @@
31913535 }
31923536
31933537 boolean useclient = false;
3194
- cRadio radio;
31953538
31963539 void ToggleRoot()
31973540 {
....@@ -4146,6 +4489,18 @@
41464489 refreshContents();
41474490 }
41484491
4492
+ void RewindLeaves(boolean hide)
4493
+ {
4494
+ group.selection.RewindLeaves(hide);
4495
+ refreshContents();
4496
+ }
4497
+
4498
+ void RandomLeaves(boolean hide)
4499
+ {
4500
+ group.selection.RandomLeaves(hide);
4501
+ refreshContents();
4502
+ }
4503
+
41494504 void SetTexRes(int tr)
41504505 {
41514506 group.selection.SetTexRes(tr);
....@@ -4217,10 +4572,6 @@
42174572 // }
42184573 // }
42194574
4220
- static boolean allparams = true;
4221
-
4222
- static Vector<Object3D> listUI = new Vector<Object3D>();
4223
-
42244575 void EditSelection(boolean newWindow)
42254576 {
42264577 // aConstraints.gridy = 0;
....@@ -4228,7 +4579,7 @@
42284579 {
42294580 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42304581 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4231
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4582
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42324583
42334584 Object3D elem = (Object3D)group.selection.elementAt(i);
42344585 if(elem != group || !newWindow)
....@@ -4313,7 +4664,8 @@
43134664 //new Exception().printStackTrace();
43144665
43154666 freezemodel = true;
4316
-
4667
+ ClearUnpinned();
4668
+
43174669 /**/
43184670 //switch (event.id)
43194671 {
....@@ -4329,6 +4681,7 @@
43294681
43304682 //if (child.parent != null)
43314683 //child.parent.addSelectee(child);
4684
+ objEditor.SetMaterial(child);
43324685 group.addSelectee(child);
43334686 }
43344687 }
....@@ -4345,7 +4698,7 @@
43454698 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43464699 // a camera
43474700 {
4348
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4701
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43494702 {
43504703 CameraPane.camerachangeframe = 0; // don't refuse it
43514704 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4354,6 +4707,13 @@
43544707 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43554708 }
43564709
4710
+ if (tps != null && tps.length == 1)
4711
+ {
4712
+ EditSelection(false);
4713
+ }
4714
+
4715
+ SetPinStates(tps != null && tps.length > 0);
4716
+
43574717 refreshContents();
43584718 //return true;
43594719 }
....@@ -4363,21 +4723,27 @@
43634723 freezemodel = false;
43644724 }
43654725
4726
+ void SetPinStates(boolean enabled)
4727
+ {
4728
+ editButton.setEnabled(enabled);
4729
+ uneditButton.setEnabled(enabled);
4730
+ unselectButton.setEnabled(enabled);
4731
+ flashSelectionButton.setEnabled(enabled);
4732
+ }
4733
+
43664734 void refreshContents(boolean cp)
43674735 {
4368
- if (!Globals.MOUSEDRAGGED)
4736
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4737
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
43694738 {
43704739 objEditor.ClearInfo(); // .GetMaterial());
43714740
4372
- for (int i=0; i < group.selection.size(); i++)
4741
+ for (int i=0; i < group.selection.Size(); i++)
43734742 {
4374
- Object3D child = (Object3D) group.selection.reserve(i);
4743
+ Object3D child = (Object3D) group.selection.get(i);
43754744
4376
- objEditor.SetMaterial(child);
43774745 objEditor.AddInfo(child, this, true);
43784746 System.err.println("info : " + child.GetPath());
4379
-
4380
- group.selection.release(i);
43814747 }
43824748
43834749 objEditor.SetText(); // jan 2014
....@@ -4467,6 +4833,7 @@
44674833
44684834 if (cut)
44694835 {
4836
+ if (Globals.SAVEONMAKE)
44704837 Save();
44714838 //int indices[] = jList.getSelectedIndices();
44724839 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -5185,10 +5552,28 @@
51855552 cButton clearpanelButton;
51865553 cButton unselectButton;
51875554
5555
+ cButton restoreCameraButton;
5556
+
51885557 cButton saveButton;
5189
- cButton undoButton;
5190
- cButton redoButton;
51915558 cButton oneStepButton;
5559
+
5560
+ cButton groupButton;
5561
+ cButton ungroupButton;
5562
+ cButton compositeButton;
5563
+ cButton switchButton;
5564
+ cButton loopButton;
5565
+ cButton textureButton;
5566
+
5567
+ cButton gridButton;
5568
+ cButton boxButton;
5569
+ cButton sphereButton;
5570
+ cButton coneButton;
5571
+ cButton torusButton;
5572
+ cButton superButton;
5573
+ cButton kleinButton;
5574
+ cButton particlesButton;
5575
+ cButton overlayButton;
5576
+ cButton lightButton;
51925577
51935578 cButton screenfitButton;
51945579 cButton screenfitpointButton;
....@@ -5201,14 +5586,6 @@
52015586
52025587 cButton setsupportButton;
52035588
5204
- cButton twoButton;
5205
- cButton sixButton;
5206
- cButton threeButton;
5207
- cButton sevenButton;
5208
- cButton fourButton; // full panel
5209
- cButton oneButton; // full XYZ
5210
- //cButton currentLayout;
5211
-
52125589 //
52135590 //Composite
52145591 Object3D // to do !!
....@@ -5218,11 +5595,11 @@
52185595 //JTree jTree;
52195596 private MenuItem lookAtItem;
52205597 private MenuItem lookFromItem;
5221
- private MenuItem switchItem;
5598
+ private MenuItem switchViewItem;
52225599 private MenuItem cutItem;
52235600 private MenuItem undoItem;
52245601 private MenuItem redoItem;
5225
- private MenuItem duplicateItem;
5602
+ private JMenuItem duplicateItem;
52265603 private MenuItem cloneItem;
52275604 private MenuItem cloneSupportItem;
52285605 private MenuItem overwriteGeoItem;
....@@ -5285,6 +5662,10 @@
52855662 private MenuItem showleavesItem;
52865663 private MenuItem markleavesItem;
52875664 private MenuItem unmarkleavesItem;
5665
+ private MenuItem rewindleavesItem;
5666
+ private MenuItem unrewindleavesItem;
5667
+ private MenuItem randomleavesItem;
5668
+ private MenuItem unrandomleavesItem;
52885669
52895670 private MenuItem flipVItem;
52905671 private MenuItem unflipVItem;
....@@ -5306,7 +5687,7 @@
53065687 private MenuItem frontItem;
53075688 private MenuItem cameraItem;
53085689 private MenuItem compositeItem;
5309
- private MenuItem randomItem;
5690
+ private MenuItem switchItem;
53105691 private MenuItem physicsItem;
53115692 private MenuItem frameselectorItem;
53125693 private MenuItem scriptNodeItem;
....@@ -5380,5 +5761,5 @@
53805761
53815762 Menu cameraMenu;
53825763 MenuItem editCameraItem;
5383
- MenuItem revertCameraItem;
5764
+ MenuItem restoreCameraItem;
53845765 }