Normand Briere
2019-07-07 46dbce888e7c3eff8969f1ddbe22e144410b67f4
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,23 +365,22 @@
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);
383
+
378384 if (Globals.ADVANCED)
379385 {
380386 menu.add("-");
....@@ -470,6 +476,14 @@
470476 markleavesItem.addActionListener(this);
471477 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472478 unmarkleavesItem.addActionListener(this);
479
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
480
+ rewindleavesItem.addActionListener(this);
481
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
482
+ unrewindleavesItem.addActionListener(this);
483
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
484
+ randomleavesItem.addActionListener(this);
485
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
486
+ unrandomleavesItem.addActionListener(this);
473487 menu.add("-");
474488 flipVItem = menu.add(new MenuItem("Flip V"));
475489 flipVItem.addActionListener(this);
....@@ -527,6 +541,18 @@
527541
528542 void SetupUI2(ObjEditor oe)
529543 {
544
+ // June 2019
545
+ if (oe == null)
546
+ {
547
+ //super.SetupUI2(this);
548
+ //return;
549
+ }
550
+
551
+ if (copy != group)
552
+ {
553
+ //super.SetupUI2(this);
554
+ }
555
+
530556 //new Exception().printStackTrace();
531557
532558 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -555,39 +581,66 @@
555581 oe.radioPanel.add(dummyButton);
556582 oe.buttonGroup.add(dummyButton);
557583 */
584
+ cGridBag copyOptionsPanel = new cGridBag();
585
+
586
+ copyOptionsPanel.preferredHeight = 1;
587
+
558588 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559589
560
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591
+ //minButton.setToolTipText("Minimize window");
592
+ //minButton.addActionListener(this);
593
+
594
+ if (Globals.ADVANCED)
595
+ {
596
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ maxButton.setToolTipText("Maximize window");
598
+ maxButton.addActionListener(this);
599
+ }
600
+
601
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ fullButton.setToolTipText("Full-screen window");
603
+ fullButton.addActionListener(this);
604
+
605
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
+ screenfitButton.setToolTipText("Screen fit");
607
+ screenfitButton.addActionListener(this);
608
+
609
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610
+ restoreCameraButton.setToolTipText("Restore viewpoint");
611
+ restoreCameraButton.addActionListener(this);
612
+
613
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561614 undoButton.setToolTipText("Undo changes");
562615 undoButton.addActionListener(this);
616
+ undoButton.setEnabled(false);
563617
564
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565619 redoButton.setToolTipText("Redo changes");
566620 redoButton.addActionListener(this);
621
+ redoButton.setEnabled(false);
567622
568
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569624 saveButton.setToolTipText("Save changes");
570625 saveButton.addActionListener(this);
571626
572
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
627
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
573628 liveCB.setToolTipText("Enable animation");
574629 liveCB.addItemListener(this);
575630
576
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
631
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577632 oneStepButton.setToolTipText("Animate one step forward");
578633 oneStepButton.addActionListener(this);
579634
580
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
635
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
581636 fastCB.setToolTipText("Fast mode");
582637 fastCB.addItemListener(this);
583638
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);
589
- screenfitButton.setToolTipText("Screen fit");
590
- screenfitButton.addActionListener(this);
639
+ //oe.toolboxPanel.Return();
640
+
641
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
642
+// trackCB.setToolTipText("Enable tracking");
643
+// trackCB.addItemListener(this);
591644
592645 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
593646 // screenfitpointButton.addActionListener(this);
....@@ -599,65 +652,145 @@
599652 snapobjectButton.setToolTipText("Snap Object");
600653 }
601654
602
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- flashSelectionButton.setToolTipText("Show selection");
604
- flashSelectionButton.addActionListener(this);
655
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
605656
606
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
607
-
608
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609658 twoButton.setToolTipText("Show center view only");
610659 twoButton.addActionListener(this);
611
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
660
+ this.fullscreenLayout = twoButton;
661
+
662
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612663 fourButton.addActionListener(this);
613664 fourButton.setToolTipText("Show left panel only");
614
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615666 sixButton.setToolTipText("2-column layout left");
616667 sixButton.addActionListener(this);
617
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618669 threeButton.setToolTipText("2-column layout right");
619670 threeButton.addActionListener(this);
620
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621672 sevenButton.setToolTipText("3-column layout");
622673 sevenButton.addActionListener(this);
623674 //
624675
625
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626677 rootButton.setToolTipText("Edit selection in new tab");
627678 rootButton.addActionListener(this);
628679
629
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
680
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630681 closeButton.setToolTipText("Close tab");
631682 closeButton.addActionListener(this);
632683 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
633684 //clearButton.addActionListener(this);
634
-
635
- cGridBag commandsPanel = new cGridBag();
685
+
686
+ // INSERT
687
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ gridButton.setToolTipText("Create grid");
689
+ gridButton.addActionListener(this);
690
+
691
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
692
+ boxButton.setToolTipText("Create box");
693
+ boxButton.addActionListener(this);
694
+
695
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ sphereButton.setToolTipText("Create sphere");
697
+ sphereButton.addActionListener(this);
698
+
699
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ coneButton.setToolTipText("Create cone");
701
+ coneButton.addActionListener(this);
702
+
703
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+ torusButton.setToolTipText("Create torus");
705
+ torusButton.addActionListener(this);
706
+
707
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ superButton.setToolTipText("Create superellipsoid");
709
+ superButton.addActionListener(this);
710
+
711
+ if (Globals.ADVANCED)
712
+ {
713
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
714
+ kleinButton.setToolTipText("Create Klein bottle");
715
+ kleinButton.addActionListener(this);
716
+ }
636717
637
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
- editButton.setToolTipText("Edit selection");
718
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ particlesButton.setToolTipText("Create particle system");
720
+ particlesButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.Return();
723
+
724
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ groupButton.setToolTipText("Create group");
726
+ groupButton.addActionListener(this);
727
+
728
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ compositeButton.setToolTipText("Create composite");
730
+ compositeButton.addActionListener(this);
731
+
732
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ switchButton.setToolTipText("Create item switcher");
734
+ switchButton.addActionListener(this);
735
+
736
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737
+ loopButton.setToolTipText("Create loop");
738
+ loopButton.addActionListener(this);
739
+
740
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ textureButton.setToolTipText("Create texture");
742
+ textureButton.addActionListener(this);
743
+
744
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ overlayButton.setToolTipText("Create overlay");
746
+ overlayButton.addActionListener(this);
747
+
748
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
749
+ lightButton.setToolTipText("Create light");
750
+ lightButton.addActionListener(this);
751
+
752
+ for (int i=6; --i>=0;)
753
+ {
754
+ oe.toolboxPanel.Return();
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
+ oe.toolboxPanel.add(new cGridBag());
762
+ }
763
+
764
+ // EDIT panel
765
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ editButton.setToolTipText("Pin selection controls");
639767 editButton.addActionListener(this);
640768
641
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
- uneditButton.setToolTipText("Unedit selection");
769
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
770
+ uneditButton.setToolTipText("Remove selection controls");
643771 uneditButton.addActionListener(this);
644772
645
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
646
- allParamsButton.setToolTipText("Edit all params");
773
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
774
+ allParamsButton.setToolTipText("Show all controle");
647775 allParamsButton.addActionListener(this);
648776
649
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650778 clearPanelButton.setToolTipText("Clear edit panel");
651779 clearPanelButton.addActionListener(this);
652780
653
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654782 unselectButton.setToolTipText("Unselect");
655783 unselectButton.addActionListener(this);
656784
657
- commandsPanel.preferredHeight = 1;
785
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
786
+ flashSelectionButton.setToolTipText("Highlight selection");
787
+ flashSelectionButton.addActionListener(this);
658788
659
- oe.treePanel.add(commandsPanel);
660
- oe.treePanel.Return();
789
+ editCommandsPanel.preferredHeight = 1;
790
+
791
+ SetPinStates(false);
792
+// oe.treePanel.add(commandsPanel);
793
+// oe.treePanel.Return();
661794
662795 // oe.aConstraints.gridx += 1;
663796 // oe.aConstraints.weighty = 0;
....@@ -674,27 +807,12 @@
674807
675808 JScrollPane jSP;
676809 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
677
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
810
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
678811 ResetModel();
679812
680813 oe.treePanel.add(jSPPanel);
681814 oe.treePanel.Return();
682815
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;
698816 oe.treePanel.add(copyOptionsPanel);
699817 oe.treePanel.Return();
700818
....@@ -725,23 +843,43 @@
725843
726844 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
727845 {
846
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
847
+ colorCB.setToolTipText("Copy color when dropped");
848
+ colorCB.addItemListener(this);
849
+
850
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
851
+ materialCB.setToolTipText("Copy material when dropped");
852
+ materialCB.addItemListener(this);
853
+
854
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
855
+ textureCB.setToolTipText("Copy texture when dropped");
856
+ textureCB.addItemListener(this);
857
+
858
+ panel.Return();
859
+
728860 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
729861 boxCB.setToolTipText("Display bounding boxes");
730862 boxCB.addItemListener(this);
731863
732864 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
733
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
865
+ zoomBoxCB.setToolTipText("Display only for wheel");
734866 zoomBoxCB.addItemListener(this);
735867
736868 if (true) // Globals.ADVANCED)
737869 {
738
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
739
- supportCB.setToolTipText("Enable rigging");
740
- supportCB.addItemListener(this);
870
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
871
+// supportCB.setToolTipText("Enable rigging");
872
+// supportCB.addItemListener(this);
873
+
874
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
875
+ freezeCB.setToolTipText("Fast moving camera");
876
+ freezeCB.addItemListener(this);
741877
742878 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
743879 // localCB.addItemListener(this);
744880
881
+ panel.Return();
882
+
745883 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
746884 crowdCB.setToolTipText("Used for crowds");
747885 crowdCB.addItemListener(this);
....@@ -758,6 +896,8 @@
758896 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
759897 // speakerMocapCB.addItemListener(this);
760898
899
+ panel.Return();
900
+
761901 if (false)
762902 {
763903 // handled in scripts
....@@ -772,32 +912,72 @@
772912 //constraints.gridy += 1;
773913 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
774914 smoothfocusCB.addItemListener(this);
915
+ panel.Return();
775916 }
776917
777918 //constraints.gridx += 1;
778919 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
779920 // debugCB.addItemListener(this);
780921
922
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
923
+ trackCB.setToolTipText("Enable tracking target");
924
+ trackCB.addItemListener(this);
925
+
781926 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
927
+ oeilCB.setToolTipText("Move camera when tracking");
782928 oeilCB.addItemListener(this);
783929
930
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
931
+ shadowCB.setToolTipText("When live compute shadows");
932
+ shadowCB.addItemListener(this);
933
+
934
+ panel.Return();
935
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
936
+ toggleTextureCB.setToolTipText("Load textures");
937
+ toggleTextureCB.addItemListener(this);
938
+
939
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
940
+ toggleSwitchCB.setToolTipText("Choose a single item");
941
+ toggleSwitchCB.addItemListener(this);
942
+
943
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
944
+ autosaveCB.setToolTipText("On structure change");
945
+ autosaveCB.addItemListener(this);
946
+
947
+ panel.Return();
948
+ if (Globals.ADVANCED)
949
+ {
784950 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
785951 lookAtCB.setToolTipText("Look-at target");
786952 lookAtCB.addItemListener(this);
953
+ }
787954
788955 }
789956
790957 cGridBag fill = new cGridBag();
791
-
792958 fill.preferredHeight = 200;
959
+ cGridBag fill2 = new cGridBag();
960
+ fill2.preferredHeight = 200;
961
+ cGridBag fill3 = new cGridBag();
962
+ fill3.preferredHeight = 200;
793963
794964 panel.add(fill);
965
+ panel.add(fill2);
966
+ panel.add(fill3);
795967
796968 }
797969
798970 void EditObject(Object3D obj)
799971 {
800972 cRadio radioButton = new cRadio(obj.name);
973
+
974
+ // Patch to avoid bug with transparency.
975
+ radioButton.hadMaterial = obj.material != null;
976
+ if (!radioButton.hadMaterial)
977
+ {
978
+ obj.material = new cMaterial();
979
+ }
980
+
801981 radioButton.SetObject(obj);
802982 radioButton.layout = sevenButton;
803983 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -809,6 +989,8 @@
809989
810990 void SetupViews(ObjEditor oe)
811991 {
992
+ theFrame = this;
993
+
812994 oe.SetupViews();
813995
814996 System.out.println("SetupViews");
....@@ -817,23 +999,28 @@
817999 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8181000 }
8191001
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;
1002
+ cToggleButton liveCB;
1003
+ cCheckBox supportCB;
1004
+ cCheckBox localCB;
1005
+ cCheckBox crowdCB;
1006
+ cCheckBox smoothCB;
1007
+ cToggleButton fastCB;
1008
+ cCheckBox slowCB;
1009
+ cCheckBox boxCB;
1010
+ cCheckBox zoomBoxCB;
1011
+ cCheckBox freezeCB;
1012
+ //cToggleButton trackCB;
1013
+ cCheckBox trackCB;
1014
+ cCheckBox smoothfocusCB;
8311015 // JCheckBox speakerMocapCB;
832
- JCheckBox speakerCameraCB;
833
- JCheckBox speakerFocusCB;
834
- JCheckBox debugCB;
835
- JCheckBox oeilCB;
836
- JCheckBox lookAtCB;
1016
+ cCheckBox speakerCameraCB;
1017
+ cCheckBox speakerFocusCB;
1018
+ cCheckBox debugCB;
1019
+
1020
+ cCheckBox oeilCB;
1021
+ cCheckBox shadowCB;
1022
+ cCheckBox autosaveCB;
1023
+ cCheckBox lookAtCB;
8371024
8381025 // static int COLOR = 1;
8391026 // static int MATERIAL = 2;
....@@ -841,9 +1028,9 @@
8411028
8421029 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8431030
844
- JCheckBox colorCB;
845
- JCheckBox materialCB;
846
- JCheckBox textureCB;
1031
+ cCheckBox colorCB;
1032
+ cCheckBox materialCB;
1033
+ cCheckBox textureCB;
8471034
8481035 public void itemStateChanged(ItemEvent e)
8491036 {
....@@ -871,6 +1058,7 @@
8711058 } else if(e.getSource() == liveCB)
8721059 {
8731060 cameraView.ToggleLive();
1061
+ refreshContents(false);
8741062 }
8751063 else if(e.getSource() == supportCB)
8761064 {
....@@ -935,6 +1123,18 @@
9351123 {
9361124 cameraView.ToggleOeil();
9371125 }
1126
+ else if(e.getSource() == shadowCB)
1127
+ {
1128
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1129
+ }
1130
+ else if(e.getSource() == freezeCB)
1131
+ {
1132
+ Globals.FREEZEONMOVE ^= true;
1133
+ }
1134
+ else if(e.getSource() == autosaveCB)
1135
+ {
1136
+ Globals.SAVEONMAKE ^= true;
1137
+ }
9381138 else if(e.getSource() == lookAtCB)
9391139 {
9401140 cameraView.ToggleLookAt();
....@@ -951,7 +1151,8 @@
9511151
9521152 /**/
9531153 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
954
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1154
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1155
+ TreePath path = objEditor.jTree.getSelectionPath();
9551156 if ((path == null) || (path.getPathCount() <= 1)) {
9561157 // We can't move the root node or an empty selection
9571158 return;
....@@ -1014,8 +1215,6 @@
10141215 }
10151216 }
10161217
1017
- String string = (String) object;
1018
-
10191218 System.out.println("Transfer = " + object + "; drop : " + target);
10201219 // if( object instanceof java.io.File[])
10211220 // {
....@@ -1023,6 +1222,8 @@
10231222 // objEditor.DropFile((java.io.File[]) object, true);
10241223 // return;
10251224 // }
1225
+
1226
+ String string = (String) object;
10261227
10271228 // File path for Mac and Windows
10281229 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1068,23 +1269,33 @@
10681269
10691270 assert target == objEditor.jTree;
10701271 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1272
+ Object3D destinationLeaf;
10711273 try {
1072
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1274
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10731275 } catch (Exception e) {
10741276 System.out.println("destinationPath : " + destinationPath);
10751277 return;
10761278 }
10771279
1078
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1280
+ for (int i=group.selection.size(); --i>=0;)
10791281 {
1282
+ Object3D child = (Object3D)group.selection.elementAt(i);
1283
+
1284
+ // Cannot move into itself
1285
+ if (child == destinationLeaf)
1286
+ return;
1287
+ }
1288
+
1289
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1290
+// {
10801291 loadClipboard(true);
10811292 objEditor.jTree.setSelectionPath(destinationPath);
10821293 pasteInto(false, false);
1083
- } else {
1084
- loadClipboard(false);
1085
- objEditor.jTree.setSelectionPath(destinationPath);
1086
- pasteInto(false, false); // true); // ???
1087
- }
1294
+// } else {
1295
+// loadClipboard(false);
1296
+// objEditor.jTree.setSelectionPath(destinationPath);
1297
+// pasteInto(false, false); // true); // ???
1298
+// }
10881299 }
10891300 public void dropActionChanged(DropTargetDragEvent dtde)
10901301 // Called if the user has modified the current drop gesture
....@@ -1189,22 +1400,30 @@
11891400 {
11901401 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11911402 //heightFieldItem.addActionListener(this);
1192
- gridItem = menu.add(new MenuItem("Grid"));
1193
- gridItem.addActionListener(this);
1194
- rectoidItem = menu.add(new MenuItem("Box"));
1195
- rectoidItem.addActionListener(this);
1196
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1197
- ellipsoidItem.addActionListener(this);
1198
- coneItem = menu.add(new MenuItem("Cone"));
1199
- coneItem.addActionListener(this);
1200
- torusItem = menu.add(new MenuItem("Torus"));
1201
- torusItem.addActionListener(this);
1202
- superItem = menu.add(new MenuItem("Superellipsoid"));
1203
- superItem.addActionListener(this);
1403
+// gridItem = menu.add(new MenuItem("Grid"));
1404
+// gridItem.addActionListener(this);
1405
+// rectoidItem = menu.add(new MenuItem("Box"));
1406
+// rectoidItem.addActionListener(this);
1407
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1408
+// ellipsoidItem.addActionListener(this);
1409
+// coneItem = menu.add(new MenuItem("Cone"));
1410
+// coneItem.addActionListener(this);
1411
+// torusItem = menu.add(new MenuItem("Torus"));
1412
+// torusItem.addActionListener(this);
1413
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1414
+// superItem.addActionListener(this);
1415
+
1416
+ cameraItem = menu.add(new MenuItem("Camera"));
1417
+ cameraItem.addActionListener(this);
1418
+
1419
+ if (!Globals.ADVANCED)
1420
+ {
12041421 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12051422 kleinItem.addActionListener(this);
1206
- particleItem = menu.add(new MenuItem("Particle system"));
1207
- particleItem.addActionListener(this);
1423
+ }
1424
+
1425
+// particleItem = menu.add(new MenuItem("Particle system"));
1426
+// particleItem.addActionListener(this);
12081427 if (Globals.ADVANCED)
12091428 {
12101429 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1230,15 +1449,15 @@
12301449 }
12311450 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12321451 bezierItem.addActionListener(this);
1233
- overlayItem = menu.add(new MenuItem("Overlay"));
1234
- overlayItem.addActionListener(this);
1235
- lightItem = menu.add(new MenuItem("Light"));
1236
- lightItem.addActionListener(this);
1452
+// overlayItem = menu.add(new MenuItem("Overlay"));
1453
+// overlayItem.addActionListener(this);
1454
+// lightItem = menu.add(new MenuItem("Light"));
1455
+// lightItem.addActionListener(this);
12371456 menu.add("-");
12381457 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12391458 //superLoopItem.addActionListener(this);
1240
- loopItem = menu.add(new MenuItem("Loop"));
1241
- loopItem.addActionListener(this);
1459
+// loopItem = menu.add(new MenuItem("Loop"));
1460
+// loopItem.addActionListener(this);
12421461 doubleItem = menu.add(new MenuItem("Fork"));
12431462 doubleItem.addActionListener(this);
12441463 if (Globals.ADVANCED)
....@@ -1253,6 +1472,9 @@
12531472 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
12541473 animationItem.addItemListener(this);
12551474 animationItem.setState(Globals.ANIMATION);
1475
+
1476
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1477
+ archiveItem.addActionListener(this);
12561478
12571479 menu.add("-");
12581480 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
....@@ -1278,7 +1500,7 @@
12781500 memoryItem.addActionListener(this);
12791501 menu.add(analyzeItem = new MenuItem("Analyze"));
12801502 analyzeItem.addActionListener(this);
1281
- menu.add(dumpItem = new MenuItem("Dump"));
1503
+ menu.add(dumpItem = new MenuItem("Print"));
12821504 dumpItem.addActionListener(this);
12831505 // menu.add(pathItem = new MenuItem("From-to path"));
12841506 // pathItem.addActionListener(this);
....@@ -1419,9 +1641,24 @@
14191641 shadow.material = new cMaterial(obj.material);
14201642 shadow.material.diffuse = 0.0001f;
14211643 shadow.material.specular = 0.0001f;
1644
+ //shadow.projectedVertices[1].x = 300;
14221645
14231646 makeSomething(shadow);
14241647 }
1648
+
1649
+ private void ClearUnpinned()
1650
+ {
1651
+ //for (Object3D obj : listUI)
1652
+ for (int i=listUI.size(); --i>=0;)
1653
+ {
1654
+ Object3D obj = listUI.elementAt(i);
1655
+ if (!obj.pinned)
1656
+ {
1657
+ obj.CloseUI();
1658
+ listUI.remove(i);
1659
+ }
1660
+ }
1661
+ }
14251662
14261663 /**
14271664 * applyExample
....@@ -1666,7 +1903,7 @@
16661903 {
16671904 ScreenFit();
16681905 } else
1669
- if (source == switchItem)
1906
+ if (source == switchViewItem)
16701907 {
16711908 cVector v1 = new cVector();
16721909 cVector v2 = new cVector();
....@@ -1675,11 +1912,11 @@
16751912 objEditor.cameraView.renderCamera.setAim(v2, v1);
16761913 objEditor.cameraView.repaint();
16771914 } else
1678
- if (source == rectoidItem)
1915
+ if (source == rectoidItem || source == boxButton)
16791916 {
16801917 makeSomething(new Box());
16811918 } else
1682
- if (source == particleItem)
1919
+ if (source == particleItem || source == particlesButton)
16831920 {
16841921 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16851922 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1758,27 +1995,27 @@
17581995
17591996 makeSomething(obj);
17601997 } else
1761
- if (source == gridItem)
1998
+ if (source == gridItem || source == gridButton)
17621999 {
17632000 makeSomething(new Grid());
17642001 } else
1765
- if (source == ellipsoidItem)
2002
+ if (source == ellipsoidItem || source == sphereButton)
17662003 {
17672004 makeSomething(new Sphere());
17682005 } else
1769
- if (source == coneItem)
2006
+ if (source == coneItem || source == coneButton)
17702007 {
17712008 makeSomething(new Cone());
17722009 } else
1773
- if (source == torusItem)
2010
+ if (source == torusItem || source == torusButton)
17742011 {
17752012 makeSomething(new Torus());
17762013 } else
1777
- if (source == superItem)
2014
+ if (source == superItem || source == superButton)
17782015 {
17792016 makeSomething(new Superellipsoid());
17802017 } else
1781
- if (source == kleinItem)
2018
+ if (source == kleinItem || source == kleinButton)
17822019 {
17832020 makeSomething(new Klein());
17842021 } else
....@@ -1798,7 +2035,7 @@
17982035 {
17992036 makeSomething(new BezierSurface());
18002037 } else
1801
- if (source == overlayItem)
2038
+ if (source == overlayItem || source == overlayButton)
18022039 {
18032040 /*
18042041 Object3D obj = new BezierSurface(5,8);
....@@ -1846,7 +2083,7 @@
18462083 s.setup();
18472084 makeSomething(s);
18482085 } else
1849
- if (source == lightItem)
2086
+ if (source == lightItem || source == lightButton)
18502087 {
18512088 makeSomething(new Light());
18522089 } else
....@@ -1896,30 +2133,30 @@
18962133
18972134 group(g);
18982135 } else
1899
- if (source == loopItem)
2136
+ if (source == loopItem || source == loopButton)
19002137 {
19012138 Composite csg = new GroupLeaf();
19022139 csg.count = 5;
19032140 group(csg);
1904
- Composite child = new cGroup();
2141
+ Composite child = new cGroup("Branch");
19052142 csg.addChild(child);
19062143 child.addChild(csg);
19072144 } else
19082145 if (source == doubleItem)
19092146 {
1910
- Composite csg = new GroupLeaf();
2147
+ Composite csg = new GroupLeaf("Fork");
19112148 csg.count = 5;
19122149 group(csg);
1913
- Composite child = new cGroup();
2150
+ Composite child = new cGroup("Branch A");
19142151 csg.addChild(child);
19152152 child.addChild(csg);
1916
- child = new cGroup();
2153
+ child = new cGroup("Branch B");
19172154 csg.addChild(child);
19182155 child.addChild(csg);
19192156 } else
19202157 if (source == tripleItem)
19212158 {
1922
- Composite csg = new GroupLeaf();
2159
+ Composite csg = new GroupLeaf("Trident");
19232160 csg.count = 4;
19242161 group(csg);
19252162 Composite child = new cGroup();
....@@ -1969,9 +2206,22 @@
19692206 {
19702207 DumpObject();
19712208 } else
2209
+ if (source == minButton)
2210
+ {
2211
+ Minimize();
2212
+ } else
2213
+ if (source == maxButton)
2214
+ {
2215
+ Maximize();
2216
+ } else
2217
+ if (source == fullButton)
2218
+ {
2219
+ ToggleFullScreen();
2220
+ } else
19722221 if (source == undoButton)
19732222 {
1974
- Undo();
2223
+ if (!Undo())
2224
+ java.awt.Toolkit.getDefaultToolkit().beep();
19752225 } else
19762226 if (source == redoButton)
19772227 {
....@@ -1979,7 +2229,8 @@
19792229 } else
19802230 if (source == saveButton)
19812231 {
1982
- Save();
2232
+ if (!Save(true))
2233
+ java.awt.Toolkit.getDefaultToolkit().beep();
19832234 } else
19842235 if (source == oneStepButton)
19852236 {
....@@ -1988,17 +2239,14 @@
19882239 } else
19892240 if (source == screenfitButton)
19902241 {
1991
- //Reload(lastConverter, lastFilename, true);
19922242 ScreenFit();
19932243 } else
19942244 if (source == screenfitpointButton)
19952245 {
1996
- //Reload(lastConverter, lastFilename, true);
19972246 ScreenFitPoint();
19982247 } else
19992248 if (source == snapobjectButton)
20002249 {
2001
- //Reload(lastConverter, lastFilename, true);
20022250 SnapObject();
20032251 } else
20042252 // if (event.getSource() == recompileButton)
....@@ -2374,9 +2622,9 @@
23742622 {
23752623 ClearSelection(true);
23762624 } else
2377
- if (source == grabItem)
2625
+ if (source == grabItem || source == groupButton)
23782626 {
2379
- group(new cGroup(), true);
2627
+ group(new cGroup(), false); // true);
23802628 } else
23812629 if (source == hideItem)
23822630 {
....@@ -2394,11 +2642,11 @@
23942642 {
23952643 makeSomething(new Camera());
23962644 } else
2397
- if (source == compositeItem)
2645
+ if (source == compositeItem || source == compositeButton)
23982646 {
23992647 group(new Composite());
24002648 } else
2401
- if (source == randomItem)
2649
+ if (source == switchItem || source == switchButton)
24022650 {
24032651 RandomNode random = new RandomNode();
24042652 group(random);
....@@ -2500,7 +2748,7 @@
25002748 {
25012749 group(new cLinker());
25022750 } else
2503
- if (source == textureItem)
2751
+ if (source == textureItem || source == textureButton)
25042752 {
25052753 group(new TextureNode());
25062754 } else
....@@ -2520,17 +2768,30 @@
25202768 {
25212769 CastShadow(2);
25222770 } else
2523
- if (source == ungroupItem)
2771
+ if (source == ungroupItem || source == ungroupButton)
25242772 {
2525
- //ungroup();
2773
+ boolean hasRoot = false;
2774
+
25262775 for (int i=0; i<group.selection.size(); i++)
25272776 {
2528
- Ungroup(group.selection.get(i));
2777
+ if (group.selection.get(i) == group)
2778
+ {
2779
+ hasRoot = true;
2780
+ break;
2781
+ }
25292782 }
25302783
2531
- ClearSelection(false);
2532
-
2533
- 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
+ }
25342795 } else
25352796 if (source == genUVItem)
25362797 {
....@@ -2607,6 +2868,22 @@
26072868 if (source == unmarkleavesItem)
26082869 {
26092870 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);
26102887 } else
26112888 if (source == flipVItem)
26122889 {
....@@ -2842,6 +3119,10 @@
28423119 if (source == twoButton)
28433120 {
28443121 radio.layout = twoButton;
3122
+
3123
+ if (CameraPane.FULLSCREEN)
3124
+ fullscreenLayout = radio.layout;
3125
+
28453126 // bug
28463127 //gridPanel.setDividerLocation(1.0);
28473128 //bigPanel.setDividerLocation(0.0);
....@@ -2874,10 +3155,31 @@
28743155 bigThree.ClearUI();
28753156 bigThree.add(centralPanel);
28763157 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
+
28773176 } else
28783177 if (source == threeButton)
28793178 {
28803179 radio.layout = threeButton;
3180
+
3181
+ if (CameraPane.FULLSCREEN)
3182
+ fullscreenLayout = radio.layout;
28813183
28823184 // bigThree.remove(scenePanel);
28833185 // bigThree.remove(centralPanel);
....@@ -2910,10 +3212,15 @@
29103212 bigThree.add(centralPanel);
29113213 bigThree.add(XYZPanel);
29123214 bigThree.FlushUI();
3215
+
3216
+ cameraView.requestFocusInWindow();
29133217 } else
29143218 if (source == fourButton)
29153219 {
29163220 radio.layout = fourButton;
3221
+
3222
+ if (CameraPane.FULLSCREEN)
3223
+ fullscreenLayout = radio.layout;
29173224
29183225 // bigThree.remove(scenePanel);
29193226 // bigThree.remove(centralPanel);
....@@ -2945,10 +3252,15 @@
29453252 bigThree.ClearUI();
29463253 bigThree.add(scenePanel);
29473254 bigThree.FlushUI();
3255
+
3256
+ cameraView.requestFocusInWindow();
29483257 } else
29493258 if (source == sixButton)
29503259 {
29513260 radio.layout = sixButton;
3261
+
3262
+ if (CameraPane.FULLSCREEN)
3263
+ fullscreenLayout = radio.layout;
29523264
29533265 // bigThree.remove(scenePanel);
29543266 // bigThree.remove(centralPanel);
....@@ -2981,10 +3293,15 @@
29813293 bigThree.add(scenePanel);
29823294 bigThree.add(centralPanel);
29833295 bigThree.FlushUI();
3296
+
3297
+ cameraView.requestFocusInWindow();
29843298 } else
29853299 if (source == sevenButton)
29863300 {
29873301 radio.layout = sevenButton;
3302
+
3303
+ if (CameraPane.FULLSCREEN)
3304
+ fullscreenLayout = radio.layout;
29883305
29893306 // bigThree.remove(scenePanel);
29903307 // bigThree.remove(centralPanel);
....@@ -3018,6 +3335,8 @@
30183335 bigThree.add(centralPanel);
30193336 bigThree.add(XYZPanel);
30203337 bigThree.FlushUI();
3338
+
3339
+ cameraView.requestFocusInWindow();
30213340 } else
30223341 if (source == rootButton)
30233342 {
....@@ -3029,6 +3348,7 @@
30293348 EditObject(obj);
30303349 }
30313350
3351
+ cameraView.requestFocusInWindow();
30323352 refreshContents(true);
30333353 } else
30343354 if (source == closeButton)
....@@ -3038,22 +3358,37 @@
30383358 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30393359 {
30403360 ab = (cRadio)e.nextElement();
3041
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3361
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30423362 {
3363
+ // Patch to avoid bug with transparency.
3364
+ if (!ab.hadMaterial)
3365
+ {
3366
+ ab.object.material = null;
3367
+ }
3368
+
30433369 buttonGroup.remove(ab);
30443370 radioPanel.remove(ab);
30453371
3046
- ab.GetObject().editWindow = null;
3372
+ //ab.GetObject().editWindow = null;
3373
+ ab.GetObject().manipWindow = null;
30473374 // ab.GetObject().objectUI = null; // ?????????
30483375
30493376 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30503377 break;
30513378 }
30523379 }
3380
+
3381
+ cameraView.requestFocusInWindow();
30533382 refreshContents(true);
30543383 } else
30553384 if (source == editItem || source == editButton)
30563385 {
3386
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3387
+ {
3388
+ Object3D child = (Object3D)e.nextElement();
3389
+ child.pinned = true;
3390
+ }
3391
+
30573392 EditSelection(false);
30583393 } else
30593394 if (source == uneditButton)
....@@ -3063,6 +3398,7 @@
30633398 Object3D child = (Object3D)e.nextElement();
30643399 if(child.editWindow != null)
30653400 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3401
+ child.pinned = false;
30663402 child.CloseUI();
30673403 listUI.remove(child);
30683404
....@@ -3079,6 +3415,7 @@
30793415 //copy.ClearUI();
30803416 for (Object3D obj : listUI)
30813417 {
3418
+ obj.pinned = false;
30823419 obj.CloseUI();
30833420 }
30843421 listUI.clear();
....@@ -3088,7 +3425,7 @@
30883425 {
30893426 assert(copy == group);
30903427
3091
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3428
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30923429
30933430 for (Object3D obj : listUI)
30943431 {
....@@ -3154,7 +3491,8 @@
31543491 }
31553492
31563493 // fix "+" issue
3157
- group.editWindow = this;
3494
+ //group.editWindow = this;
3495
+ group.manipWindow = this;
31583496
31593497 /*
31603498 currentLayout = radio.layout;
....@@ -3162,18 +3500,25 @@
31623500 currentLayout = sevenButton;
31633501 */
31643502 radio.layout.doClick();
3503
+
3504
+ ClearUnpinned();
3505
+ SetPinStates(group.selection.size() > 0);
3506
+ if (group.selection.size() == 1)
3507
+ EditSelection(false);
31653508 keepparent = group.parent;
31663509 // PARENT = NULL or not???
31673510 //group.parent = null; // ROOT
31683511 //group.attributes = -1;
31693512 ResetModel();
3513
+
3514
+ cameraView.requestFocusInWindow();
31703515 refreshContents(true);
31713516 } else if (event.getSource() == editCameraItem)
31723517 {
31733518 cameraView.ProtectCamera();
31743519 cameraView.repaint();
31753520 return;
3176
- } else if (event.getSource() == revertCameraItem)
3521
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31773522 {
31783523 cameraView.RevertCamera();
31793524 cameraView.repaint();
....@@ -3190,7 +3535,6 @@
31903535 }
31913536
31923537 boolean useclient = false;
3193
- cRadio radio;
31943538
31953539 void ToggleRoot()
31963540 {
....@@ -4145,6 +4489,18 @@
41454489 refreshContents();
41464490 }
41474491
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
+
41484504 void SetTexRes(int tr)
41494505 {
41504506 group.selection.SetTexRes(tr);
....@@ -4216,10 +4572,6 @@
42164572 // }
42174573 // }
42184574
4219
- static boolean allparams = true;
4220
-
4221
- static Vector<Object3D> listUI = new Vector<Object3D>();
4222
-
42234575 void EditSelection(boolean newWindow)
42244576 {
42254577 // aConstraints.gridy = 0;
....@@ -4227,7 +4579,7 @@
42274579 {
42284580 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42294581 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4230
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4582
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42314583
42324584 Object3D elem = (Object3D)group.selection.elementAt(i);
42334585 if(elem != group || !newWindow)
....@@ -4312,7 +4664,8 @@
43124664 //new Exception().printStackTrace();
43134665
43144666 freezemodel = true;
4315
-
4667
+ ClearUnpinned();
4668
+
43164669 /**/
43174670 //switch (event.id)
43184671 {
....@@ -4320,7 +4673,6 @@
43204673 //case 702: // Event.LIST_DESELECT
43214674 group.deselectAll();
43224675 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4323
- objEditor.ClearInfo(); // .GetMaterial());
43244676 if (tps != null)
43254677 {
43264678 for (int i=0; i < tps.length; i++)
....@@ -4329,10 +4681,8 @@
43294681
43304682 //if (child.parent != null)
43314683 //child.parent.addSelectee(child);
4684
+ objEditor.SetMaterial(child);
43324685 group.addSelectee(child);
4333
- objEditor.SetMaterial(child); // .GetMaterial());
4334
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4335
- System.err.println("info : " + child.GetPath());
43364686 }
43374687 }
43384688 // else
....@@ -4342,15 +4692,13 @@
43424692 // System.err.println("info : " + group.GetPath());
43434693 // }
43444694
4345
- objEditor.SetText(); // jan 2014
4346
-
43474695 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43484696 CameraPane.flash = true;
43494697
43504698 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43514699 // a camera
43524700 {
4353
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4701
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43544702 {
43554703 CameraPane.camerachangeframe = 0; // don't refuse it
43564704 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4359,6 +4707,13 @@
43594707 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43604708 }
43614709
4710
+ if (tps != null && tps.length == 1)
4711
+ {
4712
+ EditSelection(false);
4713
+ }
4714
+
4715
+ SetPinStates(tps != null && tps.length > 0);
4716
+
43624717 refreshContents();
43634718 //return true;
43644719 }
....@@ -4367,6 +4722,35 @@
43674722
43684723 freezemodel = false;
43694724 }
4725
+
4726
+ void SetPinStates(boolean enabled)
4727
+ {
4728
+ editButton.setEnabled(enabled);
4729
+ uneditButton.setEnabled(enabled);
4730
+ unselectButton.setEnabled(enabled);
4731
+ flashSelectionButton.setEnabled(enabled);
4732
+ }
4733
+
4734
+ void refreshContents(boolean cp)
4735
+ {
4736
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4737
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4738
+ {
4739
+ objEditor.ClearInfo(); // .GetMaterial());
4740
+
4741
+ for (int i=0; i < group.selection.Size(); i++)
4742
+ {
4743
+ Object3D child = (Object3D) group.selection.get(i);
4744
+
4745
+ objEditor.AddInfo(child, this, true);
4746
+ System.err.println("info : " + child.GetPath());
4747
+ }
4748
+
4749
+ objEditor.SetText(); // jan 2014
4750
+ }
4751
+
4752
+ super.refreshContents(cp);
4753
+ }
43704754
43714755 void linkSomething(Object3D thing)
43724756 {
....@@ -4449,6 +4833,7 @@
44494833
44504834 if (cut)
44514835 {
4836
+ if (Globals.SAVEONMAKE)
44524837 Save();
44534838 //int indices[] = jList.getSelectedIndices();
44544839 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -5167,10 +5552,28 @@
51675552 cButton clearpanelButton;
51685553 cButton unselectButton;
51695554
5555
+ cButton restoreCameraButton;
5556
+
51705557 cButton saveButton;
5171
- cButton undoButton;
5172
- cButton redoButton;
51735558 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;
51745577
51755578 cButton screenfitButton;
51765579 cButton screenfitpointButton;
....@@ -5183,14 +5586,6 @@
51835586
51845587 cButton setsupportButton;
51855588
5186
- cButton twoButton;
5187
- cButton sixButton;
5188
- cButton threeButton;
5189
- cButton sevenButton;
5190
- cButton fourButton; // full panel
5191
- cButton oneButton; // full XYZ
5192
- //cButton currentLayout;
5193
-
51945589 //
51955590 //Composite
51965591 Object3D // to do !!
....@@ -5200,11 +5595,11 @@
52005595 //JTree jTree;
52015596 private MenuItem lookAtItem;
52025597 private MenuItem lookFromItem;
5203
- private MenuItem switchItem;
5598
+ private MenuItem switchViewItem;
52045599 private MenuItem cutItem;
52055600 private MenuItem undoItem;
52065601 private MenuItem redoItem;
5207
- private MenuItem duplicateItem;
5602
+ private JMenuItem duplicateItem;
52085603 private MenuItem cloneItem;
52095604 private MenuItem cloneSupportItem;
52105605 private MenuItem overwriteGeoItem;
....@@ -5267,6 +5662,10 @@
52675662 private MenuItem showleavesItem;
52685663 private MenuItem markleavesItem;
52695664 private MenuItem unmarkleavesItem;
5665
+ private MenuItem rewindleavesItem;
5666
+ private MenuItem unrewindleavesItem;
5667
+ private MenuItem randomleavesItem;
5668
+ private MenuItem unrandomleavesItem;
52705669
52715670 private MenuItem flipVItem;
52725671 private MenuItem unflipVItem;
....@@ -5288,7 +5687,7 @@
52885687 private MenuItem frontItem;
52895688 private MenuItem cameraItem;
52905689 private MenuItem compositeItem;
5291
- private MenuItem randomItem;
5690
+ private MenuItem switchItem;
52925691 private MenuItem physicsItem;
52935692 private MenuItem frameselectorItem;
52945693 private MenuItem scriptNodeItem;
....@@ -5362,5 +5761,5 @@
53625761
53635762 Menu cameraMenu;
53645763 MenuItem editCameraItem;
5365
- MenuItem revertCameraItem;
5764
+ MenuItem restoreCameraItem;
53665765 }