Normand Briere
2019-07-07 46dbce888e7c3eff8969f1ddbe22e144410b67f4
GroupEditor.java
....@@ -150,16 +150,19 @@
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"));
156158 //editItem.addActionListener(this);
157
- undoItem = menu.add(new MenuItem("Undo"));
158
- undoItem.addActionListener(this);
159
- redoItem = menu.add(new MenuItem("Redo"));
160
- redoItem.addActionListener(this);
161
- menu.add("-");
162
- duplicateItem = menu.add(new MenuItem("Duplicate"));
159
+
160
+// undoItem = menu.add(new MenuItem("Undo"));
161
+// undoItem.addActionListener(this);
162
+// redoItem = menu.add(new MenuItem("Redo"));
163
+// redoItem.addActionListener(this);
164
+// menu.add("-");
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
163166 duplicateItem.addActionListener(this);
164167 cloneItem = menu.add(new MenuItem("Clone"));
165168 cloneItem.addActionListener(this);
....@@ -175,7 +178,6 @@
175178 copyItem.addActionListener(this);
176179 pasteItem = menu.add(new MenuItem("Paste"));
177180 pasteItem.addActionListener(this);
178
- menu.add("-");
179181
180182 menu.add("-");
181183 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -202,23 +204,23 @@
202204 //zBufferItem.addActionListener(this);
203205 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204206 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Camera"));
206
- revertCameraItem.addActionListener(this);
207
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
208
+ restoreCameraItem.addActionListener(this);
207209
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- 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);
212222
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- toggleSwitchItem.setState(CameraPane.SWITCH);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222224 toggleHandleItem.addItemListener(this);
223225 toggleHandleItem.setState(CameraPane.HANDLES);
224226
....@@ -245,7 +247,7 @@
245247
246248 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247249 toggleDebugItem.addItemListener(this);
248
- toggleDebugItem.setState(CameraPane.DEBUG);
250
+ toggleDebugItem.setState(Globals.DEBUG);
249251
250252 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251253 toggleFrustumItem.addItemListener(this);
....@@ -266,14 +268,14 @@
266268 // animationItem.addItemListener(this);
267269 // animationItem.setState(CameraPane.ANIMATION);
268270 cameraMenu.add("-");
269
- cameraMenu.add(editCameraItem = new MenuItem("Save Camera"));
271
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270272 editCameraItem.addActionListener(this);
271273
272274 if (Globals.ADVANCED)
273275 {
274276 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275277 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
278
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277279 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278280 oe.cameraMenu.add("-");
279281 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +283,7 @@
281283 editLeafItem.addActionListener(this);
282284 lookAtItem.addActionListener(this);
283285 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
286
+ //switchViewItem.addActionListener(this);
285287 }
286288
287289 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +328,29 @@
326328 }
327329
328330 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
331333 backItem = menu.add(new MenuItem("Back"));
332334 backItem.addActionListener(this);
333335 frontItem = menu.add(new MenuItem("Front"));
334336 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
337342 hideItem = menu.add(new MenuItem("Hidden Group"));
338343 hideItem.addActionListener(this);
344
+ }
339345 ungroupItem = menu.add(new MenuItem("Ungroup"));
340346 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- 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
+ {
344354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345355 switchGeoItem.addActionListener(this);
346356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +358,6 @@
348358 morphItem = menu.add(new MenuItem("Morph Group"));
349359 morphItem.addActionListener(this);
350360
351
- if (Globals.ADVANCED)
352
- {
353361 menu.add("-");
354362 physicsItem = menu.add(new MenuItem("Physics"));
355363 physicsItem.addActionListener(this);
....@@ -357,23 +365,22 @@
357365 frameselectorItem.addActionListener(this);
358366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359367 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362368 }
363369
364370 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
367373 billboardItem = menu.add(new MenuItem("Billboard"));
368374 billboardItem.addActionListener(this);
369375 csgItem = menu.add(new MenuItem("CSG"));
370376 csgItem.addActionListener(this);
371
- shadowXItem = menu.add(new MenuItem("Shadow X"));
377
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
372378 shadowXItem.addActionListener(this);
373
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
379
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
374380 shadowYItem.addActionListener(this);
375
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
381
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376382 shadowZItem.addActionListener(this);
383
+
377384 if (Globals.ADVANCED)
378385 {
379386 menu.add("-");
....@@ -469,6 +476,14 @@
469476 markleavesItem.addActionListener(this);
470477 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
471478 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);
472487 menu.add("-");
473488 flipVItem = menu.add(new MenuItem("Flip V"));
474489 flipVItem.addActionListener(this);
....@@ -526,6 +541,18 @@
526541
527542 void SetupUI2(ObjEditor oe)
528543 {
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
+
529556 //new Exception().printStackTrace();
530557
531558 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -554,27 +581,66 @@
554581 oe.radioPanel.add(dummyButton);
555582 oe.buttonGroup.add(dummyButton);
556583 */
584
+ cGridBag copyOptionsPanel = new cGridBag();
585
+
586
+ copyOptionsPanel.preferredHeight = 1;
587
+
557588 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
558589
559
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, 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);
614
+ undoButton.setToolTipText("Undo changes");
615
+ undoButton.addActionListener(this);
616
+ undoButton.setEnabled(false);
617
+
618
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ redoButton.setToolTipText("Redo changes");
620
+ redoButton.addActionListener(this);
621
+ redoButton.setEnabled(false);
622
+
623
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ saveButton.setToolTipText("Save changes");
625
+ saveButton.addActionListener(this);
626
+
627
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
560628 liveCB.setToolTipText("Enable animation");
561629 liveCB.addItemListener(this);
562630
563
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
631
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
564632 oneStepButton.setToolTipText("Animate one step forward");
565633 oneStepButton.addActionListener(this);
566634
567
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
635
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
568636 fastCB.setToolTipText("Fast mode");
569637 fastCB.addItemListener(this);
570638
571
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
572
- trackCB.setToolTipText("Enable tracking");
573
- trackCB.addItemListener(this);
574
-
575
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
576
- screenfitButton.setToolTipText("Screen fit");
577
- 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);
578644
579645 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
580646 // screenfitpointButton.addActionListener(this);
....@@ -586,65 +652,145 @@
586652 snapobjectButton.setToolTipText("Snap Object");
587653 }
588654
589
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
- flashSelectionButton.setToolTipText("Show selection");
591
- flashSelectionButton.addActionListener(this);
655
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
592656
593
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
594
-
595
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596658 twoButton.setToolTipText("Show center view only");
597659 twoButton.addActionListener(this);
598
- 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);
599663 fourButton.addActionListener(this);
600664 fourButton.setToolTipText("Show left panel only");
601
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602666 sixButton.setToolTipText("2-column layout left");
603667 sixButton.addActionListener(this);
604
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605669 threeButton.setToolTipText("2-column layout right");
606670 threeButton.addActionListener(this);
607
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608672 sevenButton.setToolTipText("3-column layout");
609673 sevenButton.addActionListener(this);
610674 //
611675
612
- 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);
613677 rootButton.setToolTipText("Edit selection in new tab");
614678 rootButton.addActionListener(this);
615679
616
- 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);
617681 closeButton.setToolTipText("Close tab");
618682 closeButton.addActionListener(this);
619683 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
620684 //clearButton.addActionListener(this);
621
-
622
- 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
+ }
623717
624
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
625
- 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");
626767 editButton.addActionListener(this);
627768
628
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
- uneditButton.setToolTipText("Unedit selection");
769
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
770
+ uneditButton.setToolTipText("Remove selection controls");
630771 uneditButton.addActionListener(this);
631772
632
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
633
- allParamsButton.setToolTipText("Edit all params");
773
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
774
+ allParamsButton.setToolTipText("Show all controle");
634775 allParamsButton.addActionListener(this);
635776
636
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637778 clearPanelButton.setToolTipText("Clear edit panel");
638779 clearPanelButton.addActionListener(this);
639780
640
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641782 unselectButton.setToolTipText("Unselect");
642783 unselectButton.addActionListener(this);
643784
644
- 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);
645788
646
- oe.treePanel.add(commandsPanel);
647
- oe.treePanel.Return();
789
+ editCommandsPanel.preferredHeight = 1;
790
+
791
+ SetPinStates(false);
792
+// oe.treePanel.add(commandsPanel);
793
+// oe.treePanel.Return();
648794
649795 // oe.aConstraints.gridx += 1;
650796 // oe.aConstraints.weighty = 0;
....@@ -661,27 +807,12 @@
661807
662808 JScrollPane jSP;
663809 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
664
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
810
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
665811 ResetModel();
666812
667813 oe.treePanel.add(jSPPanel);
668814 oe.treePanel.Return();
669815
670
- cGridBag copyOptionsPanel = new cGridBag();
671
-
672
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
673
- colorCB.setToolTipText("Copy color when dropped");
674
- colorCB.addItemListener(this);
675
-
676
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
677
- materialCB.setToolTipText("Copy material when dropped");
678
- materialCB.addItemListener(this);
679
-
680
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
681
- textureCB.setToolTipText("Copy texture when dropped");
682
- textureCB.addItemListener(this);
683
-
684
- copyOptionsPanel.preferredHeight = 1;
685816 oe.treePanel.add(copyOptionsPanel);
686817 oe.treePanel.Return();
687818
....@@ -712,23 +843,43 @@
712843
713844 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
714845 {
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
+
715860 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
716861 boxCB.setToolTipText("Display bounding boxes");
717862 boxCB.addItemListener(this);
718863
719864 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
720
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
865
+ zoomBoxCB.setToolTipText("Display only for wheel");
721866 zoomBoxCB.addItemListener(this);
722867
723868 if (true) // Globals.ADVANCED)
724869 {
725
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
726
- supportCB.setToolTipText("Enable rigging");
727
- 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);
728877
729878 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
730879 // localCB.addItemListener(this);
731880
881
+ panel.Return();
882
+
732883 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
733884 crowdCB.setToolTipText("Used for crowds");
734885 crowdCB.addItemListener(this);
....@@ -745,6 +896,8 @@
745896 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
746897 // speakerMocapCB.addItemListener(this);
747898
899
+ panel.Return();
900
+
748901 if (false)
749902 {
750903 // handled in scripts
....@@ -759,32 +912,72 @@
759912 //constraints.gridy += 1;
760913 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
761914 smoothfocusCB.addItemListener(this);
915
+ panel.Return();
762916 }
763917
764918 //constraints.gridx += 1;
765919 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
766920 // debugCB.addItemListener(this);
767921
922
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
923
+ trackCB.setToolTipText("Enable tracking target");
924
+ trackCB.addItemListener(this);
925
+
768926 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
927
+ oeilCB.setToolTipText("Move camera when tracking");
769928 oeilCB.addItemListener(this);
770929
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
+ {
771950 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
772951 lookAtCB.setToolTipText("Look-at target");
773952 lookAtCB.addItemListener(this);
953
+ }
774954
775955 }
776956
777957 cGridBag fill = new cGridBag();
778
-
779958 fill.preferredHeight = 200;
959
+ cGridBag fill2 = new cGridBag();
960
+ fill2.preferredHeight = 200;
961
+ cGridBag fill3 = new cGridBag();
962
+ fill3.preferredHeight = 200;
780963
781964 panel.add(fill);
965
+ panel.add(fill2);
966
+ panel.add(fill3);
782967
783968 }
784969
785970 void EditObject(Object3D obj)
786971 {
787972 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
+
788981 radioButton.SetObject(obj);
789982 radioButton.layout = sevenButton;
790983 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -796,6 +989,8 @@
796989
797990 void SetupViews(ObjEditor oe)
798991 {
992
+ theFrame = this;
993
+
799994 oe.SetupViews();
800995
801996 System.out.println("SetupViews");
....@@ -804,23 +999,28 @@
804999 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8051000 }
8061001
807
- JCheckBox liveCB;
808
- JCheckBox supportCB;
809
- JCheckBox localCB;
810
- JCheckBox crowdCB;
811
- JCheckBox smoothCB;
812
- JCheckBox fastCB;
813
- JCheckBox slowCB;
814
- JCheckBox boxCB;
815
- JCheckBox zoomBoxCB;
816
- JCheckBox trackCB;
817
- 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;
8181015 // JCheckBox speakerMocapCB;
819
- JCheckBox speakerCameraCB;
820
- JCheckBox speakerFocusCB;
821
- JCheckBox debugCB;
822
- JCheckBox oeilCB;
823
- JCheckBox lookAtCB;
1016
+ cCheckBox speakerCameraCB;
1017
+ cCheckBox speakerFocusCB;
1018
+ cCheckBox debugCB;
1019
+
1020
+ cCheckBox oeilCB;
1021
+ cCheckBox shadowCB;
1022
+ cCheckBox autosaveCB;
1023
+ cCheckBox lookAtCB;
8241024
8251025 // static int COLOR = 1;
8261026 // static int MATERIAL = 2;
....@@ -828,9 +1028,9 @@
8281028
8291029 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8301030
831
- JCheckBox colorCB;
832
- JCheckBox materialCB;
833
- JCheckBox textureCB;
1031
+ cCheckBox colorCB;
1032
+ cCheckBox materialCB;
1033
+ cCheckBox textureCB;
8341034
8351035 public void itemStateChanged(ItemEvent e)
8361036 {
....@@ -858,6 +1058,7 @@
8581058 } else if(e.getSource() == liveCB)
8591059 {
8601060 cameraView.ToggleLive();
1061
+ refreshContents(false);
8611062 }
8621063 else if(e.getSource() == supportCB)
8631064 {
....@@ -922,6 +1123,18 @@
9221123 {
9231124 cameraView.ToggleOeil();
9241125 }
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
+ }
9251138 else if(e.getSource() == lookAtCB)
9261139 {
9271140 cameraView.ToggleLookAt();
....@@ -938,7 +1151,8 @@
9381151
9391152 /**/
9401153 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
941
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1154
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1155
+ TreePath path = objEditor.jTree.getSelectionPath();
9421156 if ((path == null) || (path.getPathCount() <= 1)) {
9431157 // We can't move the root node or an empty selection
9441158 return;
....@@ -1001,8 +1215,6 @@
10011215 }
10021216 }
10031217
1004
- String string = (String) object;
1005
-
10061218 System.out.println("Transfer = " + object + "; drop : " + target);
10071219 // if( object instanceof java.io.File[])
10081220 // {
....@@ -1010,6 +1222,8 @@
10101222 // objEditor.DropFile((java.io.File[]) object, true);
10111223 // return;
10121224 // }
1225
+
1226
+ String string = (String) object;
10131227
10141228 // File path for Mac and Windows
10151229 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1055,23 +1269,33 @@
10551269
10561270 assert target == objEditor.jTree;
10571271 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1272
+ Object3D destinationLeaf;
10581273 try {
1059
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1274
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10601275 } catch (Exception e) {
10611276 System.out.println("destinationPath : " + destinationPath);
10621277 return;
10631278 }
10641279
1065
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1280
+ for (int i=group.selection.size(); --i>=0;)
10661281 {
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
+// {
10671291 loadClipboard(true);
10681292 objEditor.jTree.setSelectionPath(destinationPath);
10691293 pasteInto(false, false);
1070
- } else {
1071
- loadClipboard(false);
1072
- objEditor.jTree.setSelectionPath(destinationPath);
1073
- pasteInto(false, false); // true); // ???
1074
- }
1294
+// } else {
1295
+// loadClipboard(false);
1296
+// objEditor.jTree.setSelectionPath(destinationPath);
1297
+// pasteInto(false, false); // true); // ???
1298
+// }
10751299 }
10761300 public void dropActionChanged(DropTargetDragEvent dtde)
10771301 // Called if the user has modified the current drop gesture
....@@ -1176,22 +1400,30 @@
11761400 {
11771401 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11781402 //heightFieldItem.addActionListener(this);
1179
- gridItem = menu.add(new MenuItem("Grid"));
1180
- gridItem.addActionListener(this);
1181
- rectoidItem = menu.add(new MenuItem("Box"));
1182
- rectoidItem.addActionListener(this);
1183
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1184
- ellipsoidItem.addActionListener(this);
1185
- coneItem = menu.add(new MenuItem("Cone"));
1186
- coneItem.addActionListener(this);
1187
- torusItem = menu.add(new MenuItem("Torus"));
1188
- torusItem.addActionListener(this);
1189
- superItem = menu.add(new MenuItem("Superellipsoid"));
1190
- 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
+ {
11911421 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11921422 kleinItem.addActionListener(this);
1193
- particleItem = menu.add(new MenuItem("Particle system"));
1194
- particleItem.addActionListener(this);
1423
+ }
1424
+
1425
+// particleItem = menu.add(new MenuItem("Particle system"));
1426
+// particleItem.addActionListener(this);
11951427 if (Globals.ADVANCED)
11961428 {
11971429 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1217,15 +1449,15 @@
12171449 }
12181450 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12191451 bezierItem.addActionListener(this);
1220
- overlayItem = menu.add(new MenuItem("Overlay"));
1221
- overlayItem.addActionListener(this);
1222
- lightItem = menu.add(new MenuItem("Light"));
1223
- 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);
12241456 menu.add("-");
12251457 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12261458 //superLoopItem.addActionListener(this);
1227
- loopItem = menu.add(new MenuItem("Loop"));
1228
- loopItem.addActionListener(this);
1459
+// loopItem = menu.add(new MenuItem("Loop"));
1460
+// loopItem.addActionListener(this);
12291461 doubleItem = menu.add(new MenuItem("Fork"));
12301462 doubleItem.addActionListener(this);
12311463 if (Globals.ADVANCED)
....@@ -1240,6 +1472,9 @@
12401472 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
12411473 animationItem.addItemListener(this);
12421474 animationItem.setState(Globals.ANIMATION);
1475
+
1476
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1477
+ archiveItem.addActionListener(this);
12431478
12441479 menu.add("-");
12451480 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
....@@ -1265,7 +1500,7 @@
12651500 memoryItem.addActionListener(this);
12661501 menu.add(analyzeItem = new MenuItem("Analyze"));
12671502 analyzeItem.addActionListener(this);
1268
- menu.add(dumpItem = new MenuItem("Dump"));
1503
+ menu.add(dumpItem = new MenuItem("Print"));
12691504 dumpItem.addActionListener(this);
12701505 // menu.add(pathItem = new MenuItem("From-to path"));
12711506 // pathItem.addActionListener(this);
....@@ -1406,9 +1641,24 @@
14061641 shadow.material = new cMaterial(obj.material);
14071642 shadow.material.diffuse = 0.0001f;
14081643 shadow.material.specular = 0.0001f;
1644
+ //shadow.projectedVertices[1].x = 300;
14091645
14101646 makeSomething(shadow);
14111647 }
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
+ }
14121662
14131663 /**
14141664 * applyExample
....@@ -1653,7 +1903,7 @@
16531903 {
16541904 ScreenFit();
16551905 } else
1656
- if (source == switchItem)
1906
+ if (source == switchViewItem)
16571907 {
16581908 cVector v1 = new cVector();
16591909 cVector v2 = new cVector();
....@@ -1662,11 +1912,11 @@
16621912 objEditor.cameraView.renderCamera.setAim(v2, v1);
16631913 objEditor.cameraView.repaint();
16641914 } else
1665
- if (source == rectoidItem)
1915
+ if (source == rectoidItem || source == boxButton)
16661916 {
16671917 makeSomething(new Box());
16681918 } else
1669
- if (source == particleItem)
1919
+ if (source == particleItem || source == particlesButton)
16701920 {
16711921 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16721922 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1745,27 +1995,27 @@
17451995
17461996 makeSomething(obj);
17471997 } else
1748
- if (source == gridItem)
1998
+ if (source == gridItem || source == gridButton)
17491999 {
17502000 makeSomething(new Grid());
17512001 } else
1752
- if (source == ellipsoidItem)
2002
+ if (source == ellipsoidItem || source == sphereButton)
17532003 {
17542004 makeSomething(new Sphere());
17552005 } else
1756
- if (source == coneItem)
2006
+ if (source == coneItem || source == coneButton)
17572007 {
17582008 makeSomething(new Cone());
17592009 } else
1760
- if (source == torusItem)
2010
+ if (source == torusItem || source == torusButton)
17612011 {
17622012 makeSomething(new Torus());
17632013 } else
1764
- if (source == superItem)
2014
+ if (source == superItem || source == superButton)
17652015 {
17662016 makeSomething(new Superellipsoid());
17672017 } else
1768
- if (source == kleinItem)
2018
+ if (source == kleinItem || source == kleinButton)
17692019 {
17702020 makeSomething(new Klein());
17712021 } else
....@@ -1785,7 +2035,7 @@
17852035 {
17862036 makeSomething(new BezierSurface());
17872037 } else
1788
- if (source == overlayItem)
2038
+ if (source == overlayItem || source == overlayButton)
17892039 {
17902040 /*
17912041 Object3D obj = new BezierSurface(5,8);
....@@ -1833,7 +2083,7 @@
18332083 s.setup();
18342084 makeSomething(s);
18352085 } else
1836
- if (source == lightItem)
2086
+ if (source == lightItem || source == lightButton)
18372087 {
18382088 makeSomething(new Light());
18392089 } else
....@@ -1883,30 +2133,30 @@
18832133
18842134 group(g);
18852135 } else
1886
- if (source == loopItem)
2136
+ if (source == loopItem || source == loopButton)
18872137 {
18882138 Composite csg = new GroupLeaf();
18892139 csg.count = 5;
18902140 group(csg);
1891
- Composite child = new cGroup();
2141
+ Composite child = new cGroup("Branch");
18922142 csg.addChild(child);
18932143 child.addChild(csg);
18942144 } else
18952145 if (source == doubleItem)
18962146 {
1897
- Composite csg = new GroupLeaf();
2147
+ Composite csg = new GroupLeaf("Fork");
18982148 csg.count = 5;
18992149 group(csg);
1900
- Composite child = new cGroup();
2150
+ Composite child = new cGroup("Branch A");
19012151 csg.addChild(child);
19022152 child.addChild(csg);
1903
- child = new cGroup();
2153
+ child = new cGroup("Branch B");
19042154 csg.addChild(child);
19052155 child.addChild(csg);
19062156 } else
19072157 if (source == tripleItem)
19082158 {
1909
- Composite csg = new GroupLeaf();
2159
+ Composite csg = new GroupLeaf("Trident");
19102160 csg.count = 4;
19112161 group(csg);
19122162 Composite child = new cGroup();
....@@ -1956,6 +2206,32 @@
19562206 {
19572207 DumpObject();
19582208 } 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
2221
+ if (source == undoButton)
2222
+ {
2223
+ if (!Undo())
2224
+ java.awt.Toolkit.getDefaultToolkit().beep();
2225
+ } else
2226
+ if (source == redoButton)
2227
+ {
2228
+ Redo();
2229
+ } else
2230
+ if (source == saveButton)
2231
+ {
2232
+ if (!Save(true))
2233
+ java.awt.Toolkit.getDefaultToolkit().beep();
2234
+ } else
19592235 if (source == oneStepButton)
19602236 {
19612237 Globals.ONESTEP = true;
....@@ -1963,17 +2239,14 @@
19632239 } else
19642240 if (source == screenfitButton)
19652241 {
1966
- //Reload(lastConverter, lastFilename, true);
19672242 ScreenFit();
19682243 } else
19692244 if (source == screenfitpointButton)
19702245 {
1971
- //Reload(lastConverter, lastFilename, true);
19722246 ScreenFitPoint();
19732247 } else
19742248 if (source == snapobjectButton)
19752249 {
1976
- //Reload(lastConverter, lastFilename, true);
19772250 SnapObject();
19782251 } else
19792252 // if (event.getSource() == recompileButton)
....@@ -2349,9 +2622,9 @@
23492622 {
23502623 ClearSelection(true);
23512624 } else
2352
- if (source == grabItem)
2625
+ if (source == grabItem || source == groupButton)
23532626 {
2354
- group(new cGroup(), true);
2627
+ group(new cGroup(), false); // true);
23552628 } else
23562629 if (source == hideItem)
23572630 {
....@@ -2369,11 +2642,11 @@
23692642 {
23702643 makeSomething(new Camera());
23712644 } else
2372
- if (source == compositeItem)
2645
+ if (source == compositeItem || source == compositeButton)
23732646 {
23742647 group(new Composite());
23752648 } else
2376
- if (source == randomItem)
2649
+ if (source == switchItem || source == switchButton)
23772650 {
23782651 RandomNode random = new RandomNode();
23792652 group(random);
....@@ -2475,7 +2748,7 @@
24752748 {
24762749 group(new cLinker());
24772750 } else
2478
- if (source == textureItem)
2751
+ if (source == textureItem || source == textureButton)
24792752 {
24802753 group(new TextureNode());
24812754 } else
....@@ -2495,17 +2768,30 @@
24952768 {
24962769 CastShadow(2);
24972770 } else
2498
- if (source == ungroupItem)
2771
+ if (source == ungroupItem || source == ungroupButton)
24992772 {
2500
- //ungroup();
2773
+ boolean hasRoot = false;
2774
+
25012775 for (int i=0; i<group.selection.size(); i++)
25022776 {
2503
- Ungroup(group.selection.get(i));
2777
+ if (group.selection.get(i) == group)
2778
+ {
2779
+ hasRoot = true;
2780
+ break;
2781
+ }
25042782 }
25052783
2506
- ClearSelection(false);
2507
-
2508
- 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
+ }
25092795 } else
25102796 if (source == genUVItem)
25112797 {
....@@ -2517,7 +2803,7 @@
25172803 } else
25182804 if (source == genNormalsMESHItem)
25192805 {
2520
- GenNormals(true); // TODO
2806
+ GenNormalsMESH();
25212807 } else
25222808 if (source == genNormalsORGANItem)
25232809 {
....@@ -2582,6 +2868,22 @@
25822868 if (source == unmarkleavesItem)
25832869 {
25842870 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);
25852887 } else
25862888 if (source == flipVItem)
25872889 {
....@@ -2817,6 +3119,10 @@
28173119 if (source == twoButton)
28183120 {
28193121 radio.layout = twoButton;
3122
+
3123
+ if (CameraPane.FULLSCREEN)
3124
+ fullscreenLayout = radio.layout;
3125
+
28203126 // bug
28213127 //gridPanel.setDividerLocation(1.0);
28223128 //bigPanel.setDividerLocation(0.0);
....@@ -2849,10 +3155,31 @@
28493155 bigThree.ClearUI();
28503156 bigThree.add(centralPanel);
28513157 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
+
28523176 } else
28533177 if (source == threeButton)
28543178 {
28553179 radio.layout = threeButton;
3180
+
3181
+ if (CameraPane.FULLSCREEN)
3182
+ fullscreenLayout = radio.layout;
28563183
28573184 // bigThree.remove(scenePanel);
28583185 // bigThree.remove(centralPanel);
....@@ -2885,10 +3212,15 @@
28853212 bigThree.add(centralPanel);
28863213 bigThree.add(XYZPanel);
28873214 bigThree.FlushUI();
3215
+
3216
+ cameraView.requestFocusInWindow();
28883217 } else
28893218 if (source == fourButton)
28903219 {
28913220 radio.layout = fourButton;
3221
+
3222
+ if (CameraPane.FULLSCREEN)
3223
+ fullscreenLayout = radio.layout;
28923224
28933225 // bigThree.remove(scenePanel);
28943226 // bigThree.remove(centralPanel);
....@@ -2920,10 +3252,15 @@
29203252 bigThree.ClearUI();
29213253 bigThree.add(scenePanel);
29223254 bigThree.FlushUI();
3255
+
3256
+ cameraView.requestFocusInWindow();
29233257 } else
29243258 if (source == sixButton)
29253259 {
29263260 radio.layout = sixButton;
3261
+
3262
+ if (CameraPane.FULLSCREEN)
3263
+ fullscreenLayout = radio.layout;
29273264
29283265 // bigThree.remove(scenePanel);
29293266 // bigThree.remove(centralPanel);
....@@ -2956,10 +3293,15 @@
29563293 bigThree.add(scenePanel);
29573294 bigThree.add(centralPanel);
29583295 bigThree.FlushUI();
3296
+
3297
+ cameraView.requestFocusInWindow();
29593298 } else
29603299 if (source == sevenButton)
29613300 {
29623301 radio.layout = sevenButton;
3302
+
3303
+ if (CameraPane.FULLSCREEN)
3304
+ fullscreenLayout = radio.layout;
29633305
29643306 // bigThree.remove(scenePanel);
29653307 // bigThree.remove(centralPanel);
....@@ -2993,6 +3335,8 @@
29933335 bigThree.add(centralPanel);
29943336 bigThree.add(XYZPanel);
29953337 bigThree.FlushUI();
3338
+
3339
+ cameraView.requestFocusInWindow();
29963340 } else
29973341 if (source == rootButton)
29983342 {
....@@ -3004,6 +3348,7 @@
30043348 EditObject(obj);
30053349 }
30063350
3351
+ cameraView.requestFocusInWindow();
30073352 refreshContents(true);
30083353 } else
30093354 if (source == closeButton)
....@@ -3013,22 +3358,37 @@
30133358 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30143359 {
30153360 ab = (cRadio)e.nextElement();
3016
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3361
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30173362 {
3363
+ // Patch to avoid bug with transparency.
3364
+ if (!ab.hadMaterial)
3365
+ {
3366
+ ab.object.material = null;
3367
+ }
3368
+
30183369 buttonGroup.remove(ab);
30193370 radioPanel.remove(ab);
30203371
3021
- ab.GetObject().editWindow = null;
3372
+ //ab.GetObject().editWindow = null;
3373
+ ab.GetObject().manipWindow = null;
30223374 // ab.GetObject().objectUI = null; // ?????????
30233375
30243376 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30253377 break;
30263378 }
30273379 }
3380
+
3381
+ cameraView.requestFocusInWindow();
30283382 refreshContents(true);
30293383 } else
30303384 if (source == editItem || source == editButton)
30313385 {
3386
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3387
+ {
3388
+ Object3D child = (Object3D)e.nextElement();
3389
+ child.pinned = true;
3390
+ }
3391
+
30323392 EditSelection(false);
30333393 } else
30343394 if (source == uneditButton)
....@@ -3038,6 +3398,7 @@
30383398 Object3D child = (Object3D)e.nextElement();
30393399 if(child.editWindow != null)
30403400 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3401
+ child.pinned = false;
30413402 child.CloseUI();
30423403 listUI.remove(child);
30433404
....@@ -3054,6 +3415,7 @@
30543415 //copy.ClearUI();
30553416 for (Object3D obj : listUI)
30563417 {
3418
+ obj.pinned = false;
30573419 obj.CloseUI();
30583420 }
30593421 listUI.clear();
....@@ -3063,7 +3425,7 @@
30633425 {
30643426 assert(copy == group);
30653427
3066
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3428
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30673429
30683430 for (Object3D obj : listUI)
30693431 {
....@@ -3128,7 +3490,9 @@
31283490 sideView.object = group;
31293491 }
31303492
3131
-// fix "+" issue group.editWindow = this;
3493
+// fix "+" issue
3494
+ //group.editWindow = this;
3495
+ group.manipWindow = this;
31323496
31333497 /*
31343498 currentLayout = radio.layout;
....@@ -3136,18 +3500,25 @@
31363500 currentLayout = sevenButton;
31373501 */
31383502 radio.layout.doClick();
3503
+
3504
+ ClearUnpinned();
3505
+ SetPinStates(group.selection.size() > 0);
3506
+ if (group.selection.size() == 1)
3507
+ EditSelection(false);
31393508 keepparent = group.parent;
31403509 // PARENT = NULL or not???
31413510 //group.parent = null; // ROOT
31423511 //group.attributes = -1;
31433512 ResetModel();
3513
+
3514
+ cameraView.requestFocusInWindow();
31443515 refreshContents(true);
31453516 } else if (event.getSource() == editCameraItem)
31463517 {
31473518 cameraView.ProtectCamera();
31483519 cameraView.repaint();
31493520 return;
3150
- } else if (event.getSource() == revertCameraItem)
3521
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31513522 {
31523523 cameraView.RevertCamera();
31533524 cameraView.repaint();
....@@ -3164,7 +3535,6 @@
31643535 }
31653536
31663537 boolean useclient = false;
3167
- cRadio radio;
31683538
31693539 void ToggleRoot()
31703540 {
....@@ -3403,7 +3773,8 @@
34033773
34043774 int size = obj.MemorySize();
34053775
3406
- System.err.println((size/1024) + " KB is the size of " + obj);
3776
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3777
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
34073778 }
34083779 }
34093780 catch (Exception e)
....@@ -3484,6 +3855,13 @@
34843855 void GenNormals(boolean crease)
34853856 {
34863857 group.GenNormalsS(crease);
3858
+
3859
+ refreshContents();
3860
+ }
3861
+
3862
+ void GenNormalsMESH()
3863
+ {
3864
+ group.GenNormalsMeshS();
34873865
34883866 refreshContents();
34893867 }
....@@ -4111,6 +4489,18 @@
41114489 refreshContents();
41124490 }
41134491
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
+
41144504 void SetTexRes(int tr)
41154505 {
41164506 group.selection.SetTexRes(tr);
....@@ -4182,10 +4572,6 @@
41824572 // }
41834573 // }
41844574
4185
- static boolean allparams = true;
4186
-
4187
- static Vector<Object3D> listUI = new Vector<Object3D>();
4188
-
41894575 void EditSelection(boolean newWindow)
41904576 {
41914577 // aConstraints.gridy = 0;
....@@ -4193,7 +4579,7 @@
41934579 {
41944580 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41954581 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4196
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4582
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41974583
41984584 Object3D elem = (Object3D)group.selection.elementAt(i);
41994585 if(elem != group || !newWindow)
....@@ -4278,7 +4664,8 @@
42784664 //new Exception().printStackTrace();
42794665
42804666 freezemodel = true;
4281
-
4667
+ ClearUnpinned();
4668
+
42824669 /**/
42834670 //switch (event.id)
42844671 {
....@@ -4286,7 +4673,6 @@
42864673 //case 702: // Event.LIST_DESELECT
42874674 group.deselectAll();
42884675 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4289
- objEditor.ClearInfo(); // .GetMaterial());
42904676 if (tps != null)
42914677 {
42924678 for (int i=0; i < tps.length; i++)
....@@ -4295,10 +4681,8 @@
42954681
42964682 //if (child.parent != null)
42974683 //child.parent.addSelectee(child);
4684
+ objEditor.SetMaterial(child);
42984685 group.addSelectee(child);
4299
- objEditor.SetMaterial(child); // .GetMaterial());
4300
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4301
- System.err.println("info : " + child.GetPath());
43024686 }
43034687 }
43044688 // else
....@@ -4308,15 +4692,13 @@
43084692 // System.err.println("info : " + group.GetPath());
43094693 // }
43104694
4311
- objEditor.SetText(); // jan 2014
4312
-
43134695 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43144696 CameraPane.flash = true;
43154697
43164698 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43174699 // a camera
43184700 {
4319
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4701
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43204702 {
43214703 CameraPane.camerachangeframe = 0; // don't refuse it
43224704 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4325,6 +4707,13 @@
43254707 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43264708 }
43274709
4710
+ if (tps != null && tps.length == 1)
4711
+ {
4712
+ EditSelection(false);
4713
+ }
4714
+
4715
+ SetPinStates(tps != null && tps.length > 0);
4716
+
43284717 refreshContents();
43294718 //return true;
43304719 }
....@@ -4333,6 +4722,35 @@
43334722
43344723 freezemodel = false;
43354724 }
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
+ }
43364754
43374755 void linkSomething(Object3D thing)
43384756 {
....@@ -4404,6 +4822,7 @@
44044822 {
44054823 if (group.selection.isEmpty())
44064824 return;
4825
+
44074826 Grafreed.clipboardIsTempGroup = false;
44084827 Composite tGroup = null;
44094828 if (group.selection.size() > 0) // 1)
....@@ -4414,6 +4833,8 @@
44144833
44154834 if (cut)
44164835 {
4836
+ if (Globals.SAVEONMAKE)
4837
+ Save();
44174838 //int indices[] = jList.getSelectedIndices();
44184839 //for (int i = indices.length - 1; i >= 0; i--)
44194840 //jList.remove(indices[i]);
....@@ -4503,8 +4924,10 @@
45034924 }
45044925
45054926 }
4927
+
45064928 if (Grafreed.clipboardIsTempGroup)
45074929 Grafreed.clipboard = tGroup;
4930
+
45084931 if (cut)
45094932 {
45104933 ResetModel();
....@@ -5129,7 +5552,28 @@
51295552 cButton clearpanelButton;
51305553 cButton unselectButton;
51315554
5555
+ cButton restoreCameraButton;
5556
+
5557
+ cButton saveButton;
51325558 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;
51335577
51345578 cButton screenfitButton;
51355579 cButton screenfitpointButton;
....@@ -5142,14 +5586,6 @@
51425586
51435587 cButton setsupportButton;
51445588
5145
- cButton twoButton;
5146
- cButton sixButton;
5147
- cButton threeButton;
5148
- cButton sevenButton;
5149
- cButton fourButton; // full panel
5150
- cButton oneButton; // full XYZ
5151
- //cButton currentLayout;
5152
-
51535589 //
51545590 //Composite
51555591 Object3D // to do !!
....@@ -5159,11 +5595,11 @@
51595595 //JTree jTree;
51605596 private MenuItem lookAtItem;
51615597 private MenuItem lookFromItem;
5162
- private MenuItem switchItem;
5598
+ private MenuItem switchViewItem;
51635599 private MenuItem cutItem;
51645600 private MenuItem undoItem;
51655601 private MenuItem redoItem;
5166
- private MenuItem duplicateItem;
5602
+ private JMenuItem duplicateItem;
51675603 private MenuItem cloneItem;
51685604 private MenuItem cloneSupportItem;
51695605 private MenuItem overwriteGeoItem;
....@@ -5226,6 +5662,10 @@
52265662 private MenuItem showleavesItem;
52275663 private MenuItem markleavesItem;
52285664 private MenuItem unmarkleavesItem;
5665
+ private MenuItem rewindleavesItem;
5666
+ private MenuItem unrewindleavesItem;
5667
+ private MenuItem randomleavesItem;
5668
+ private MenuItem unrandomleavesItem;
52295669
52305670 private MenuItem flipVItem;
52315671 private MenuItem unflipVItem;
....@@ -5247,7 +5687,7 @@
52475687 private MenuItem frontItem;
52485688 private MenuItem cameraItem;
52495689 private MenuItem compositeItem;
5250
- private MenuItem randomItem;
5690
+ private MenuItem switchItem;
52515691 private MenuItem physicsItem;
52525692 private MenuItem frameselectorItem;
52535693 private MenuItem scriptNodeItem;
....@@ -5321,5 +5761,5 @@
53215761
53225762 Menu cameraMenu;
53235763 MenuItem editCameraItem;
5324
- MenuItem revertCameraItem;
5764
+ MenuItem restoreCameraItem;
53255765 }