Normand Briere
2019-06-25 d2f456cf5280f59425084532bd2397ec625f7577
GroupEditor.java
....@@ -150,11 +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
- 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"));
158166 duplicateItem.addActionListener(this);
159167 cloneItem = menu.add(new MenuItem("Clone"));
160168 cloneItem.addActionListener(this);
....@@ -170,7 +178,6 @@
170178 copyItem.addActionListener(this);
171179 pasteItem = menu.add(new MenuItem("Paste"));
172180 pasteItem.addActionListener(this);
173
- menu.add("-");
174181
175182 menu.add("-");
176183 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,21 +204,21 @@
197204 //zBufferItem.addActionListener(this);
198205 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
199206 //normalLensItem.addActionListener(this);
200
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
201
- revertCameraItem.addActionListener(this);
207
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
208
+ restoreCameraItem.addActionListener(this);
202209
203
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
204
- toggleFullScreenItem.addItemListener(this);
205
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
206
- cameraMenu.add("-");
207
-
208
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
209
- toggleTextureItem.addItemListener(this);
210
- toggleTextureItem.setState(CameraPane.textureon);
211
-
212
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
213
- toggleSwitchItem.addItemListener(this);
214
- toggleSwitchItem.setState(CameraPane.SWITCH);
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);
215222
216223 cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
217224 toggleHandleItem.addItemListener(this);
....@@ -240,7 +247,7 @@
240247
241248 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
242249 toggleDebugItem.addItemListener(this);
243
- toggleDebugItem.setState(CameraPane.DEBUG);
250
+ toggleDebugItem.setState(Globals.DEBUG);
244251
245252 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
246253 toggleFrustumItem.addItemListener(this);
....@@ -261,14 +268,14 @@
261268 // animationItem.addItemListener(this);
262269 // animationItem.setState(CameraPane.ANIMATION);
263270 cameraMenu.add("-");
264
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
271
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
265272 editCameraItem.addActionListener(this);
266273
267274 if (Globals.ADVANCED)
268275 {
269276 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
270277 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
271
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
278
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
272279 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
273280 oe.cameraMenu.add("-");
274281 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -276,7 +283,7 @@
276283 editLeafItem.addActionListener(this);
277284 lookAtItem.addActionListener(this);
278285 //lookFromItem.addActinoListener(this);
279
- //switchItem.addActionListener(this);
286
+ //switchViewItem.addActionListener(this);
280287 }
281288
282289 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -321,21 +328,29 @@
321328 }
322329
323330 oe.menuBar.add(menu = new Menu("Group"));
324
- grabItem = menu.add(new MenuItem("Grab"));
325
- grabItem.addActionListener(this);
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
326333 backItem = menu.add(new MenuItem("Back"));
327334 backItem.addActionListener(this);
328335 frontItem = menu.add(new MenuItem("Front"));
329336 frontItem.addActionListener(this);
330
- compositeItem = menu.add(new MenuItem("Composite"));
331
- compositeItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
332342 hideItem = menu.add(new MenuItem("Hidden Group"));
333343 hideItem.addActionListener(this);
344
+ }
334345 ungroupItem = menu.add(new MenuItem("Ungroup"));
335346 ungroupItem.addActionListener(this);
336
- menu.add("-");
337
- randomItem = menu.add(new MenuItem("Switch node"));
338
- 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
+ {
339354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
340355 switchGeoItem.addActionListener(this);
341356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -343,8 +358,6 @@
343358 morphItem = menu.add(new MenuItem("Morph Group"));
344359 morphItem.addActionListener(this);
345360
346
- if (Globals.ADVANCED)
347
- {
348361 menu.add("-");
349362 physicsItem = menu.add(new MenuItem("Physics"));
350363 physicsItem.addActionListener(this);
....@@ -352,22 +365,20 @@
352365 frameselectorItem.addActionListener(this);
353366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
354367 scriptNodeItem.addActionListener(this);
355
- cameraItem = menu.add(new MenuItem("Camera"));
356
- cameraItem.addActionListener(this);
357368 }
358369
359370 oe.menuBar.add(menu = new Menu("Object"));
360
- textureItem = menu.add(new MenuItem("Texture"));
361
- textureItem.addActionListener(this);
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
362373 billboardItem = menu.add(new MenuItem("Billboard"));
363374 billboardItem.addActionListener(this);
364375 csgItem = menu.add(new MenuItem("CSG"));
365376 csgItem.addActionListener(this);
366
- shadowXItem = menu.add(new MenuItem("Shadow X"));
377
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
367378 shadowXItem.addActionListener(this);
368
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
379
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
369380 shadowYItem.addActionListener(this);
370
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
381
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
371382 shadowZItem.addActionListener(this);
372383 if (Globals.ADVANCED)
373384 {
....@@ -464,6 +475,14 @@
464475 markleavesItem.addActionListener(this);
465476 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
466477 unmarkleavesItem.addActionListener(this);
478
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
479
+ rewindleavesItem.addActionListener(this);
480
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
481
+ unrewindleavesItem.addActionListener(this);
482
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
483
+ randomleavesItem.addActionListener(this);
484
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
485
+ unrandomleavesItem.addActionListener(this);
467486 menu.add("-");
468487 flipVItem = menu.add(new MenuItem("Flip V"));
469488 flipVItem.addActionListener(this);
....@@ -521,6 +540,18 @@
521540
522541 void SetupUI2(ObjEditor oe)
523542 {
543
+ // June 2019
544
+ if (oe == null)
545
+ {
546
+ //super.SetupUI2(this);
547
+ //return;
548
+ }
549
+
550
+ if (copy != group)
551
+ {
552
+ //super.SetupUI2(this);
553
+ }
554
+
524555 //new Exception().printStackTrace();
525556
526557 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -549,27 +580,61 @@
549580 oe.radioPanel.add(dummyButton);
550581 oe.buttonGroup.add(dummyButton);
551582 */
583
+ cGridBag copyOptionsPanel = new cGridBag();
584
+
585
+ copyOptionsPanel.preferredHeight = 2;
586
+
552587 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
553588
554
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
589
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
+ //minButton.setToolTipText("Minimize window");
591
+ //minButton.addActionListener(this);
592
+
593
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
+ maxButton.setToolTipText("Maximize window");
595
+ maxButton.addActionListener(this);
596
+
597
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598
+ fullButton.setToolTipText("Full-screen window");
599
+ fullButton.addActionListener(this);
600
+
601
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ restoreCameraButton.setToolTipText("Restore viewpoint");
603
+ restoreCameraButton.addActionListener(this);
604
+
605
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
+ undoButton.setToolTipText("Undo changes");
607
+ undoButton.addActionListener(this);
608
+
609
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610
+ redoButton.setToolTipText("Redo changes");
611
+ redoButton.addActionListener(this);
612
+
613
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614
+ saveButton.setToolTipText("Save changes");
615
+ saveButton.addActionListener(this);
616
+
617
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
555618 liveCB.setToolTipText("Enable animation");
556619 liveCB.addItemListener(this);
557620
558
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
559622 oneStepButton.setToolTipText("Animate one step forward");
560623 oneStepButton.addActionListener(this);
561624
562
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
625
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
563626 fastCB.setToolTipText("Fast mode");
564627 fastCB.addItemListener(this);
565628
566
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
567
- trackCB.setToolTipText("Enable tracking");
568
- trackCB.addItemListener(this);
569
-
570
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ //oe.toolboxPanel.Return();
630
+
631
+ copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
571632 screenfitButton.setToolTipText("Screen fit");
572633 screenfitButton.addActionListener(this);
634
+
635
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
636
+// trackCB.setToolTipText("Enable tracking");
637
+// trackCB.addItemListener(this);
573638
574639 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
575640 // screenfitpointButton.addActionListener(this);
....@@ -581,65 +646,132 @@
581646 snapobjectButton.setToolTipText("Snap Object");
582647 }
583648
584
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- flashSelectionButton.setToolTipText("Show selection");
586
- flashSelectionButton.addActionListener(this);
649
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
587650
588
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
589
-
590
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591652 twoButton.setToolTipText("Show center view only");
592653 twoButton.addActionListener(this);
593
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ this.fullscreenLayout = twoButton;
655
+
656
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594657 fourButton.addActionListener(this);
595658 fourButton.setToolTipText("Show left panel only");
596
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
659
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597660 sixButton.setToolTipText("2-column layout left");
598661 sixButton.addActionListener(this);
599
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600663 threeButton.setToolTipText("2-column layout right");
601664 threeButton.addActionListener(this);
602
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603666 sevenButton.setToolTipText("3-column layout");
604667 sevenButton.addActionListener(this);
605668 //
606669
607
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608671 rootButton.setToolTipText("Edit selection in new tab");
609672 rootButton.addActionListener(this);
610673
611
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612675 closeButton.setToolTipText("Close tab");
613676 closeButton.addActionListener(this);
614677 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
615678 //clearButton.addActionListener(this);
616
-
617
- cGridBag commandsPanel = new cGridBag();
679
+
680
+ // INSERT
681
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ gridButton.setToolTipText("Create grid");
683
+ gridButton.addActionListener(this);
684
+
685
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686
+ boxButton.setToolTipText("Create box");
687
+ boxButton.addActionListener(this);
688
+
689
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
690
+ sphereButton.setToolTipText("Create sphere");
691
+ sphereButton.addActionListener(this);
692
+
693
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ coneButton.setToolTipText("Create cone");
695
+ coneButton.addActionListener(this);
696
+
697
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ torusButton.setToolTipText("Create torus");
699
+ torusButton.addActionListener(this);
700
+
701
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
702
+ superButton.setToolTipText("Create superellipsoid");
703
+ superButton.addActionListener(this);
704
+
705
+ if (Globals.ADVANCED)
706
+ {
707
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ kleinButton.setToolTipText("Create Klein bottle");
709
+ kleinButton.addActionListener(this);
710
+ }
618711
619
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
712
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ particlesButton.setToolTipText("Create particle system");
714
+ particlesButton.addActionListener(this);
715
+
716
+ oe.toolboxPanel.Return();
717
+
718
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ groupButton.setToolTipText("Create group");
720
+ groupButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ compositeButton.setToolTipText("Create composite");
724
+ compositeButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ switchButton.setToolTipText("Create switch");
728
+ switchButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ loopButton.setToolTipText("Create loop");
732
+ loopButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ textureButton.setToolTipText("Create texture");
736
+ textureButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ overlayButton.setToolTipText("Create overlay");
740
+ overlayButton.addActionListener(this);
741
+
742
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
743
+ lightButton.setToolTipText("Create light");
744
+ lightButton.addActionListener(this);
745
+
746
+ // EDIT panel
747
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620748 editButton.setToolTipText("Edit selection");
621749 editButton.addActionListener(this);
622750
623
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624752 uneditButton.setToolTipText("Unedit selection");
625753 uneditButton.addActionListener(this);
626754
627
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
755
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
628756 allParamsButton.setToolTipText("Edit all params");
629757 allParamsButton.addActionListener(this);
630758
631
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
759
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632760 clearPanelButton.setToolTipText("Clear edit panel");
633761 clearPanelButton.addActionListener(this);
634762
635
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
763
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636764 unselectButton.setToolTipText("Unselect");
637765 unselectButton.addActionListener(this);
638766
639
- commandsPanel.preferredHeight = 1;
767
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ flashSelectionButton.setToolTipText("Highlight selection");
769
+ flashSelectionButton.addActionListener(this);
640770
641
- oe.treePanel.add(commandsPanel);
642
- oe.treePanel.Return();
771
+ editCommandsPanel.preferredHeight = 1;
772
+
773
+// oe.treePanel.add(commandsPanel);
774
+// oe.treePanel.Return();
643775
644776 // oe.aConstraints.gridx += 1;
645777 // oe.aConstraints.weighty = 0;
....@@ -656,27 +788,12 @@
656788
657789 JScrollPane jSP;
658790 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
659
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
791
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
660792 ResetModel();
661793
662794 oe.treePanel.add(jSPPanel);
663795 oe.treePanel.Return();
664796
665
- cGridBag copyOptionsPanel = new cGridBag();
666
-
667
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
668
- colorCB.setToolTipText("Copy color when dropped");
669
- colorCB.addItemListener(this);
670
-
671
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
672
- materialCB.setToolTipText("Copy material when dropped");
673
- materialCB.addItemListener(this);
674
-
675
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
676
- textureCB.setToolTipText("Copy texture when dropped");
677
- textureCB.addItemListener(this);
678
-
679
- copyOptionsPanel.preferredHeight = 1;
680797 oe.treePanel.add(copyOptionsPanel);
681798 oe.treePanel.Return();
682799
....@@ -707,6 +824,20 @@
707824
708825 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
709826 {
827
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
828
+ colorCB.setToolTipText("Copy color when dropped");
829
+ colorCB.addItemListener(this);
830
+
831
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
832
+ materialCB.setToolTipText("Copy material when dropped");
833
+ materialCB.addItemListener(this);
834
+
835
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
836
+ textureCB.setToolTipText("Copy texture when dropped");
837
+ textureCB.addItemListener(this);
838
+
839
+ panel.Return();
840
+
710841 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
711842 boxCB.setToolTipText("Display bounding boxes");
712843 boxCB.addItemListener(this);
....@@ -724,6 +855,8 @@
724855 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
725856 // localCB.addItemListener(this);
726857
858
+ panel.Return();
859
+
727860 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
728861 crowdCB.setToolTipText("Used for crowds");
729862 crowdCB.addItemListener(this);
....@@ -740,6 +873,8 @@
740873 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
741874 // speakerMocapCB.addItemListener(this);
742875
876
+ panel.Return();
877
+
743878 if (false)
744879 {
745880 // handled in scripts
....@@ -754,32 +889,72 @@
754889 //constraints.gridy += 1;
755890 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
756891 smoothfocusCB.addItemListener(this);
892
+ panel.Return();
757893 }
758894
759895 //constraints.gridx += 1;
760896 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
761897 // debugCB.addItemListener(this);
762898
899
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
900
+ trackCB.setToolTipText("Enable tracking target");
901
+ trackCB.addItemListener(this);
902
+
763903 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
904
+ oeilCB.setToolTipText("Move camera when tracking");
764905 oeilCB.addItemListener(this);
765906
907
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
908
+ shadowCB.setToolTipText("Compute shadows when live");
909
+ shadowCB.addItemListener(this);
910
+
911
+ panel.Return();
912
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
913
+ toggleTextureCB.setToolTipText("Load textures");
914
+ toggleTextureCB.addItemListener(this);
915
+
916
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
917
+ toggleSwitchCB.setToolTipText("Use switch");
918
+ toggleSwitchCB.addItemListener(this);
919
+
920
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
921
+ autosaveCB.setToolTipText("Auto-save on structure change");
922
+ autosaveCB.addItemListener(this);
923
+
924
+ panel.Return();
925
+ if (Globals.ADVANCED)
926
+ {
766927 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
767928 lookAtCB.setToolTipText("Look-at target");
768929 lookAtCB.addItemListener(this);
930
+ }
769931
770932 }
771933
772934 cGridBag fill = new cGridBag();
773
-
774935 fill.preferredHeight = 200;
936
+ cGridBag fill2 = new cGridBag();
937
+ fill2.preferredHeight = 200;
938
+ cGridBag fill3 = new cGridBag();
939
+ fill3.preferredHeight = 200;
775940
776941 panel.add(fill);
942
+ panel.add(fill2);
943
+ panel.add(fill3);
777944
778945 }
779946
780947 void EditObject(Object3D obj)
781948 {
782949 cRadio radioButton = new cRadio(obj.name);
950
+
951
+ // Patch to avoid bug with transparency.
952
+ radioButton.hadMaterial = obj.material != null;
953
+ if (!radioButton.hadMaterial)
954
+ {
955
+ obj.material = new cMaterial();
956
+ }
957
+
783958 radioButton.SetObject(obj);
784959 radioButton.layout = sevenButton;
785960 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -791,6 +966,8 @@
791966
792967 void SetupViews(ObjEditor oe)
793968 {
969
+ theFrame = this;
970
+
794971 oe.SetupViews();
795972
796973 System.out.println("SetupViews");
....@@ -799,23 +976,27 @@
799976 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
800977 }
801978
802
- JCheckBox liveCB;
803
- JCheckBox supportCB;
804
- JCheckBox localCB;
805
- JCheckBox crowdCB;
806
- JCheckBox smoothCB;
807
- JCheckBox fastCB;
808
- JCheckBox slowCB;
809
- JCheckBox boxCB;
810
- JCheckBox zoomBoxCB;
811
- JCheckBox trackCB;
812
- JCheckBox smoothfocusCB;
979
+ cToggleButton liveCB;
980
+ cCheckBox supportCB;
981
+ cCheckBox localCB;
982
+ cCheckBox crowdCB;
983
+ cCheckBox smoothCB;
984
+ cToggleButton fastCB;
985
+ cCheckBox slowCB;
986
+ cCheckBox boxCB;
987
+ cCheckBox zoomBoxCB;
988
+ //cToggleButton trackCB;
989
+ cCheckBox trackCB;
990
+ cCheckBox smoothfocusCB;
813991 // JCheckBox speakerMocapCB;
814
- JCheckBox speakerCameraCB;
815
- JCheckBox speakerFocusCB;
816
- JCheckBox debugCB;
817
- JCheckBox oeilCB;
818
- JCheckBox lookAtCB;
992
+ cCheckBox speakerCameraCB;
993
+ cCheckBox speakerFocusCB;
994
+ cCheckBox debugCB;
995
+
996
+ cCheckBox oeilCB;
997
+ cCheckBox shadowCB;
998
+ cCheckBox autosaveCB;
999
+ cCheckBox lookAtCB;
8191000
8201001 // static int COLOR = 1;
8211002 // static int MATERIAL = 2;
....@@ -823,9 +1004,9 @@
8231004
8241005 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8251006
826
- JCheckBox colorCB;
827
- JCheckBox materialCB;
828
- JCheckBox textureCB;
1007
+ cCheckBox colorCB;
1008
+ cCheckBox materialCB;
1009
+ cCheckBox textureCB;
8291010
8301011 public void itemStateChanged(ItemEvent e)
8311012 {
....@@ -853,6 +1034,7 @@
8531034 } else if(e.getSource() == liveCB)
8541035 {
8551036 cameraView.ToggleLive();
1037
+ refreshContents(false);
8561038 }
8571039 else if(e.getSource() == supportCB)
8581040 {
....@@ -917,6 +1099,14 @@
9171099 {
9181100 cameraView.ToggleOeil();
9191101 }
1102
+ else if(e.getSource() == shadowCB)
1103
+ {
1104
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1105
+ }
1106
+ else if(e.getSource() == autosaveCB)
1107
+ {
1108
+ Globals.SAVEONMAKE ^= true;
1109
+ }
9201110 else if(e.getSource() == lookAtCB)
9211111 {
9221112 cameraView.ToggleLookAt();
....@@ -933,7 +1123,8 @@
9331123
9341124 /**/
9351125 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
936
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1126
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1127
+ TreePath path = objEditor.jTree.getSelectionPath();
9371128 if ((path == null) || (path.getPathCount() <= 1)) {
9381129 // We can't move the root node or an empty selection
9391130 return;
....@@ -1050,23 +1241,33 @@
10501241
10511242 assert target == objEditor.jTree;
10521243 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1244
+ Object3D destinationLeaf;
10531245 try {
1054
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1246
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10551247 } catch (Exception e) {
10561248 System.out.println("destinationPath : " + destinationPath);
10571249 return;
10581250 }
10591251
1060
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1252
+ for (int i=group.selection.size(); --i>=0;)
10611253 {
1254
+ Object3D child = (Object3D)group.selection.elementAt(i);
1255
+
1256
+ // Cannot move into itself
1257
+ if (child == destinationLeaf)
1258
+ return;
1259
+ }
1260
+
1261
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1262
+// {
10621263 loadClipboard(true);
10631264 objEditor.jTree.setSelectionPath(destinationPath);
10641265 pasteInto(false, false);
1065
- } else {
1066
- loadClipboard(false);
1067
- objEditor.jTree.setSelectionPath(destinationPath);
1068
- pasteInto(false, false); // true); // ???
1069
- }
1266
+// } else {
1267
+// loadClipboard(false);
1268
+// objEditor.jTree.setSelectionPath(destinationPath);
1269
+// pasteInto(false, false); // true); // ???
1270
+// }
10701271 }
10711272 public void dropActionChanged(DropTargetDragEvent dtde)
10721273 // Called if the user has modified the current drop gesture
....@@ -1171,22 +1372,30 @@
11711372 {
11721373 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11731374 //heightFieldItem.addActionListener(this);
1174
- gridItem = menu.add(new MenuItem("Grid"));
1175
- gridItem.addActionListener(this);
1176
- rectoidItem = menu.add(new MenuItem("Box"));
1177
- rectoidItem.addActionListener(this);
1178
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1179
- ellipsoidItem.addActionListener(this);
1180
- coneItem = menu.add(new MenuItem("Cone"));
1181
- coneItem.addActionListener(this);
1182
- torusItem = menu.add(new MenuItem("Torus"));
1183
- torusItem.addActionListener(this);
1184
- superItem = menu.add(new MenuItem("Superellipsoid"));
1185
- superItem.addActionListener(this);
1375
+// gridItem = menu.add(new MenuItem("Grid"));
1376
+// gridItem.addActionListener(this);
1377
+// rectoidItem = menu.add(new MenuItem("Box"));
1378
+// rectoidItem.addActionListener(this);
1379
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1380
+// ellipsoidItem.addActionListener(this);
1381
+// coneItem = menu.add(new MenuItem("Cone"));
1382
+// coneItem.addActionListener(this);
1383
+// torusItem = menu.add(new MenuItem("Torus"));
1384
+// torusItem.addActionListener(this);
1385
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1386
+// superItem.addActionListener(this);
1387
+
1388
+ cameraItem = menu.add(new MenuItem("Camera"));
1389
+ cameraItem.addActionListener(this);
1390
+
1391
+ if (!Globals.ADVANCED)
1392
+ {
11861393 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11871394 kleinItem.addActionListener(this);
1188
- particleItem = menu.add(new MenuItem("Particle system"));
1189
- particleItem.addActionListener(this);
1395
+ }
1396
+
1397
+// particleItem = menu.add(new MenuItem("Particle system"));
1398
+// particleItem.addActionListener(this);
11901399 if (Globals.ADVANCED)
11911400 {
11921401 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1212,15 +1421,15 @@
12121421 }
12131422 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12141423 bezierItem.addActionListener(this);
1215
- overlayItem = menu.add(new MenuItem("Overlay"));
1216
- overlayItem.addActionListener(this);
1217
- lightItem = menu.add(new MenuItem("Light"));
1218
- lightItem.addActionListener(this);
1424
+// overlayItem = menu.add(new MenuItem("Overlay"));
1425
+// overlayItem.addActionListener(this);
1426
+// lightItem = menu.add(new MenuItem("Light"));
1427
+// lightItem.addActionListener(this);
12191428 menu.add("-");
12201429 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12211430 //superLoopItem.addActionListener(this);
1222
- loopItem = menu.add(new MenuItem("Loop"));
1223
- loopItem.addActionListener(this);
1431
+// loopItem = menu.add(new MenuItem("Loop"));
1432
+// loopItem.addActionListener(this);
12241433 doubleItem = menu.add(new MenuItem("Fork"));
12251434 doubleItem.addActionListener(this);
12261435 if (Globals.ADVANCED)
....@@ -1260,7 +1469,7 @@
12601469 memoryItem.addActionListener(this);
12611470 menu.add(analyzeItem = new MenuItem("Analyze"));
12621471 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1472
+ menu.add(dumpItem = new MenuItem("Print"));
12641473 dumpItem.addActionListener(this);
12651474 // menu.add(pathItem = new MenuItem("From-to path"));
12661475 // pathItem.addActionListener(this);
....@@ -1401,6 +1610,7 @@
14011610 shadow.material = new cMaterial(obj.material);
14021611 shadow.material.diffuse = 0.0001f;
14031612 shadow.material.specular = 0.0001f;
1613
+ //shadow.projectedVertices[1].x = 300;
14041614
14051615 makeSomething(shadow);
14061616 }
....@@ -1648,7 +1858,7 @@
16481858 {
16491859 ScreenFit();
16501860 } else
1651
- if (source == switchItem)
1861
+ if (source == switchViewItem)
16521862 {
16531863 cVector v1 = new cVector();
16541864 cVector v2 = new cVector();
....@@ -1657,11 +1867,11 @@
16571867 objEditor.cameraView.renderCamera.setAim(v2, v1);
16581868 objEditor.cameraView.repaint();
16591869 } else
1660
- if (source == rectoidItem)
1870
+ if (source == rectoidItem || source == boxButton)
16611871 {
16621872 makeSomething(new Box());
16631873 } else
1664
- if (source == particleItem)
1874
+ if (source == particleItem || source == particlesButton)
16651875 {
16661876 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16671877 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1740,27 +1950,27 @@
17401950
17411951 makeSomething(obj);
17421952 } else
1743
- if (source == gridItem)
1953
+ if (source == gridItem || source == gridButton)
17441954 {
17451955 makeSomething(new Grid());
17461956 } else
1747
- if (source == ellipsoidItem)
1957
+ if (source == ellipsoidItem || source == sphereButton)
17481958 {
17491959 makeSomething(new Sphere());
17501960 } else
1751
- if (source == coneItem)
1961
+ if (source == coneItem || source == coneButton)
17521962 {
17531963 makeSomething(new Cone());
17541964 } else
1755
- if (source == torusItem)
1965
+ if (source == torusItem || source == torusButton)
17561966 {
17571967 makeSomething(new Torus());
17581968 } else
1759
- if (source == superItem)
1969
+ if (source == superItem || source == superButton)
17601970 {
17611971 makeSomething(new Superellipsoid());
17621972 } else
1763
- if (source == kleinItem)
1973
+ if (source == kleinItem || source == kleinButton)
17641974 {
17651975 makeSomething(new Klein());
17661976 } else
....@@ -1780,7 +1990,7 @@
17801990 {
17811991 makeSomething(new BezierSurface());
17821992 } else
1783
- if (source == overlayItem)
1993
+ if (source == overlayItem || source == overlayButton)
17841994 {
17851995 /*
17861996 Object3D obj = new BezierSurface(5,8);
....@@ -1828,7 +2038,7 @@
18282038 s.setup();
18292039 makeSomething(s);
18302040 } else
1831
- if (source == lightItem)
2041
+ if (source == lightItem || source == lightButton)
18322042 {
18332043 makeSomething(new Light());
18342044 } else
....@@ -1878,7 +2088,7 @@
18782088
18792089 group(g);
18802090 } else
1881
- if (source == loopItem)
2091
+ if (source == loopItem || source == loopButton)
18822092 {
18832093 Composite csg = new GroupLeaf();
18842094 csg.count = 5;
....@@ -1951,6 +2161,30 @@
19512161 {
19522162 DumpObject();
19532163 } else
2164
+ if (source == minButton)
2165
+ {
2166
+ Minimize();
2167
+ } else
2168
+ if (source == maxButton)
2169
+ {
2170
+ Maximize();
2171
+ } else
2172
+ if (source == fullButton)
2173
+ {
2174
+ ToggleFullScreen();
2175
+ } else
2176
+ if (source == undoButton)
2177
+ {
2178
+ Undo();
2179
+ } else
2180
+ if (source == redoButton)
2181
+ {
2182
+ Redo();
2183
+ } else
2184
+ if (source == saveButton)
2185
+ {
2186
+ Save();
2187
+ } else
19542188 if (source == oneStepButton)
19552189 {
19562190 Globals.ONESTEP = true;
....@@ -2004,6 +2238,14 @@
20042238 if (source == cutItem || source == clearButton)
20052239 {
20062240 loadClipboard(true);
2241
+ } else
2242
+ if (source == undoItem)
2243
+ {
2244
+ Undo();
2245
+ } else
2246
+ if (source == redoItem)
2247
+ {
2248
+ Redo();
20072249 } else
20082250 if (source == duplicateItem)
20092251 {
....@@ -2336,9 +2578,9 @@
23362578 {
23372579 ClearSelection(true);
23382580 } else
2339
- if (source == grabItem)
2581
+ if (source == grabItem || source == groupButton)
23402582 {
2341
- group(new cGroup(), true);
2583
+ group(new cGroup(), false); // true);
23422584 } else
23432585 if (source == hideItem)
23442586 {
....@@ -2356,11 +2598,11 @@
23562598 {
23572599 makeSomething(new Camera());
23582600 } else
2359
- if (source == compositeItem)
2601
+ if (source == compositeItem || source == compositeButton)
23602602 {
23612603 group(new Composite());
23622604 } else
2363
- if (source == randomItem)
2605
+ if (source == switchItem || source == switchButton)
23642606 {
23652607 RandomNode random = new RandomNode();
23662608 group(random);
....@@ -2462,7 +2704,7 @@
24622704 {
24632705 group(new cLinker());
24642706 } else
2465
- if (source == textureItem)
2707
+ if (source == textureItem || source == textureButton)
24662708 {
24672709 group(new TextureNode());
24682710 } else
....@@ -2482,7 +2724,7 @@
24822724 {
24832725 CastShadow(2);
24842726 } else
2485
- if (source == ungroupItem)
2727
+ if (source == ungroupItem || source == ungroupButton)
24862728 {
24872729 //ungroup();
24882730 for (int i=0; i<group.selection.size(); i++)
....@@ -2504,7 +2746,7 @@
25042746 } else
25052747 if (source == genNormalsMESHItem)
25062748 {
2507
- GenNormals(true); // TODO
2749
+ GenNormalsMESH();
25082750 } else
25092751 if (source == genNormalsORGANItem)
25102752 {
....@@ -2569,6 +2811,22 @@
25692811 if (source == unmarkleavesItem)
25702812 {
25712813 MarkLeaves(false);
2814
+ } else
2815
+ if (source == rewindleavesItem)
2816
+ {
2817
+ RewindLeaves(true);
2818
+ } else
2819
+ if (source == unrewindleavesItem)
2820
+ {
2821
+ RewindLeaves(false);
2822
+ } else
2823
+ if (source == randomleavesItem)
2824
+ {
2825
+ RandomLeaves(true);
2826
+ } else
2827
+ if (source == unrandomleavesItem)
2828
+ {
2829
+ RandomLeaves(false);
25722830 } else
25732831 if (source == flipVItem)
25742832 {
....@@ -2804,6 +3062,10 @@
28043062 if (source == twoButton)
28053063 {
28063064 radio.layout = twoButton;
3065
+
3066
+ if (CameraPane.FULLSCREEN)
3067
+ fullscreenLayout = radio.layout;
3068
+
28073069 // bug
28083070 //gridPanel.setDividerLocation(1.0);
28093071 //bigPanel.setDividerLocation(0.0);
....@@ -2836,10 +3098,31 @@
28363098 bigThree.ClearUI();
28373099 bigThree.add(centralPanel);
28383100 bigThree.FlushUI();
3101
+
3102
+ cameraView.requestFocusInWindow();
3103
+
3104
+// refreshContents(true);
3105
+//
3106
+// try
3107
+// {
3108
+// java.awt.Robot bot = new java.awt.Robot();
3109
+// int mask = InputEvent.BUTTON1_MASK;
3110
+// bot.mouseMove(100, 100);
3111
+// bot.mousePress(mask);
3112
+// bot.mouseRelease(mask);
3113
+// }
3114
+// catch (Exception e)
3115
+// {
3116
+//
3117
+// }
3118
+
28393119 } else
28403120 if (source == threeButton)
28413121 {
28423122 radio.layout = threeButton;
3123
+
3124
+ if (CameraPane.FULLSCREEN)
3125
+ fullscreenLayout = radio.layout;
28433126
28443127 // bigThree.remove(scenePanel);
28453128 // bigThree.remove(centralPanel);
....@@ -2872,10 +3155,15 @@
28723155 bigThree.add(centralPanel);
28733156 bigThree.add(XYZPanel);
28743157 bigThree.FlushUI();
3158
+
3159
+ cameraView.requestFocusInWindow();
28753160 } else
28763161 if (source == fourButton)
28773162 {
28783163 radio.layout = fourButton;
3164
+
3165
+ if (CameraPane.FULLSCREEN)
3166
+ fullscreenLayout = radio.layout;
28793167
28803168 // bigThree.remove(scenePanel);
28813169 // bigThree.remove(centralPanel);
....@@ -2907,10 +3195,15 @@
29073195 bigThree.ClearUI();
29083196 bigThree.add(scenePanel);
29093197 bigThree.FlushUI();
3198
+
3199
+ cameraView.requestFocusInWindow();
29103200 } else
29113201 if (source == sixButton)
29123202 {
29133203 radio.layout = sixButton;
3204
+
3205
+ if (CameraPane.FULLSCREEN)
3206
+ fullscreenLayout = radio.layout;
29143207
29153208 // bigThree.remove(scenePanel);
29163209 // bigThree.remove(centralPanel);
....@@ -2943,10 +3236,15 @@
29433236 bigThree.add(scenePanel);
29443237 bigThree.add(centralPanel);
29453238 bigThree.FlushUI();
3239
+
3240
+ cameraView.requestFocusInWindow();
29463241 } else
29473242 if (source == sevenButton)
29483243 {
29493244 radio.layout = sevenButton;
3245
+
3246
+ if (CameraPane.FULLSCREEN)
3247
+ fullscreenLayout = radio.layout;
29503248
29513249 // bigThree.remove(scenePanel);
29523250 // bigThree.remove(centralPanel);
....@@ -2980,6 +3278,8 @@
29803278 bigThree.add(centralPanel);
29813279 bigThree.add(XYZPanel);
29823280 bigThree.FlushUI();
3281
+
3282
+ cameraView.requestFocusInWindow();
29833283 } else
29843284 if (source == rootButton)
29853285 {
....@@ -2991,6 +3291,7 @@
29913291 EditObject(obj);
29923292 }
29933293
3294
+ cameraView.requestFocusInWindow();
29943295 refreshContents(true);
29953296 } else
29963297 if (source == closeButton)
....@@ -3000,18 +3301,27 @@
30003301 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30013302 {
30023303 ab = (cRadio)e.nextElement();
3003
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3304
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30043305 {
3306
+ // Patch to avoid bug with transparency.
3307
+ if (!ab.hadMaterial)
3308
+ {
3309
+ ab.object.material = null;
3310
+ }
3311
+
30053312 buttonGroup.remove(ab);
30063313 radioPanel.remove(ab);
30073314
3008
- ab.GetObject().editWindow = null;
3315
+ //ab.GetObject().editWindow = null;
3316
+ ab.GetObject().manipWindow = null;
30093317 // ab.GetObject().objectUI = null; // ?????????
30103318
30113319 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30123320 break;
30133321 }
30143322 }
3323
+
3324
+ cameraView.requestFocusInWindow();
30153325 refreshContents(true);
30163326 } else
30173327 if (source == editItem || source == editButton)
....@@ -3028,7 +3338,7 @@
30283338 child.CloseUI();
30293339 listUI.remove(child);
30303340
3031
- child.editWindow = null; // ???????????
3341
+ //child.editWindow = null; // ???????????
30323342 }
30333343 objEditor.ctrlPanel.FlushUI();
30343344 //objEditor.jTree.clearSelection();
....@@ -3115,7 +3425,9 @@
31153425 sideView.object = group;
31163426 }
31173427
3118
-// fix "+" issue group.editWindow = this;
3428
+// fix "+" issue
3429
+ //group.editWindow = this;
3430
+ group.manipWindow = this;
31193431
31203432 /*
31213433 currentLayout = radio.layout;
....@@ -3128,13 +3440,15 @@
31283440 //group.parent = null; // ROOT
31293441 //group.attributes = -1;
31303442 ResetModel();
3443
+
3444
+ cameraView.requestFocusInWindow();
31313445 refreshContents(true);
31323446 } else if (event.getSource() == editCameraItem)
31333447 {
31343448 cameraView.ProtectCamera();
31353449 cameraView.repaint();
31363450 return;
3137
- } else if (event.getSource() == revertCameraItem)
3451
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31383452 {
31393453 cameraView.RevertCamera();
31403454 cameraView.repaint();
....@@ -3151,7 +3465,6 @@
31513465 }
31523466
31533467 boolean useclient = false;
3154
- cRadio radio;
31553468
31563469 void ToggleRoot()
31573470 {
....@@ -3390,7 +3703,8 @@
33903703
33913704 int size = obj.MemorySize();
33923705
3393
- System.err.println((size/1024) + " KB is the size of " + obj);
3706
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3707
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33943708 }
33953709 }
33963710 catch (Exception e)
....@@ -3471,6 +3785,13 @@
34713785 void GenNormals(boolean crease)
34723786 {
34733787 group.GenNormalsS(crease);
3788
+
3789
+ refreshContents();
3790
+ }
3791
+
3792
+ void GenNormalsMESH()
3793
+ {
3794
+ group.GenNormalsMeshS();
34743795
34753796 refreshContents();
34763797 }
....@@ -4098,6 +4419,18 @@
40984419 refreshContents();
40994420 }
41004421
4422
+ void RewindLeaves(boolean hide)
4423
+ {
4424
+ group.selection.RewindLeaves(hide);
4425
+ refreshContents();
4426
+ }
4427
+
4428
+ void RandomLeaves(boolean hide)
4429
+ {
4430
+ group.selection.RandomLeaves(hide);
4431
+ refreshContents();
4432
+ }
4433
+
41014434 void SetTexRes(int tr)
41024435 {
41034436 group.selection.SetTexRes(tr);
....@@ -4180,7 +4513,7 @@
41804513 {
41814514 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41824515 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4516
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41844517
41854518 Object3D elem = (Object3D)group.selection.elementAt(i);
41864519 if(elem != group || !newWindow)
....@@ -4273,7 +4606,6 @@
42734606 //case 702: // Event.LIST_DESELECT
42744607 group.deselectAll();
42754608 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774609 if (tps != null)
42784610 {
42794611 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4614,8 @@
42824614
42834615 //if (child.parent != null)
42844616 //child.parent.addSelectee(child);
4617
+ objEditor.SetMaterial(child);
42854618 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894619 }
42904620 }
42914621 // else
....@@ -4295,16 +4625,17 @@
42954625 // System.err.println("info : " + group.GetPath());
42964626 // }
42974627
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4628
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014629 CameraPane.flash = true;
43024630
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4631
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044632 // a camera
43054633 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4634
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4635
+ {
4636
+ CameraPane.camerachangeframe = 0; // don't refuse it
4637
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4638
+ }
43084639 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094640 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104641 }
....@@ -4317,6 +4648,27 @@
43174648
43184649 freezemodel = false;
43194650 }
4651
+
4652
+ void refreshContents(boolean cp)
4653
+ {
4654
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4655
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4656
+ {
4657
+ objEditor.ClearInfo(); // .GetMaterial());
4658
+
4659
+ for (int i=0; i < group.selection.Size(); i++)
4660
+ {
4661
+ Object3D child = (Object3D) group.selection.get(i);
4662
+
4663
+ objEditor.AddInfo(child, this, true);
4664
+ System.err.println("info : " + child.GetPath());
4665
+ }
4666
+
4667
+ objEditor.SetText(); // jan 2014
4668
+ }
4669
+
4670
+ super.refreshContents(cp);
4671
+ }
43204672
43214673 void linkSomething(Object3D thing)
43224674 {
....@@ -4388,6 +4740,7 @@
43884740 {
43894741 if (group.selection.isEmpty())
43904742 return;
4743
+
43914744 Grafreed.clipboardIsTempGroup = false;
43924745 Composite tGroup = null;
43934746 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4751,8 @@
43984751
43994752 if (cut)
44004753 {
4754
+ if (Globals.SAVEONMAKE)
4755
+ Save();
44014756 //int indices[] = jList.getSelectedIndices();
44024757 //for (int i = indices.length - 1; i >= 0; i--)
44034758 //jList.remove(indices[i]);
....@@ -4487,8 +4842,10 @@
44874842 }
44884843
44894844 }
4845
+
44904846 if (Grafreed.clipboardIsTempGroup)
44914847 Grafreed.clipboard = tGroup;
4848
+
44924849 if (cut)
44934850 {
44944851 ResetModel();
....@@ -5113,7 +5470,33 @@
51135470 cButton clearpanelButton;
51145471 cButton unselectButton;
51155472
5473
+ cButton restoreCameraButton;
5474
+
5475
+ cButton minButton;
5476
+ cButton maxButton;
5477
+ cButton fullButton;
5478
+ cButton undoButton;
5479
+ cButton redoButton;
5480
+ cButton saveButton;
51165481 cButton oneStepButton;
5482
+
5483
+ cButton groupButton;
5484
+ cButton ungroupButton;
5485
+ cButton compositeButton;
5486
+ cButton switchButton;
5487
+ cButton loopButton;
5488
+ cButton textureButton;
5489
+
5490
+ cButton gridButton;
5491
+ cButton boxButton;
5492
+ cButton sphereButton;
5493
+ cButton coneButton;
5494
+ cButton torusButton;
5495
+ cButton superButton;
5496
+ cButton kleinButton;
5497
+ cButton particlesButton;
5498
+ cButton overlayButton;
5499
+ cButton lightButton;
51175500
51185501 cButton screenfitButton;
51195502 cButton screenfitpointButton;
....@@ -5126,14 +5509,6 @@
51265509
51275510 cButton setsupportButton;
51285511
5129
- cButton twoButton;
5130
- cButton sixButton;
5131
- cButton threeButton;
5132
- cButton sevenButton;
5133
- cButton fourButton; // full panel
5134
- cButton oneButton; // full XYZ
5135
- //cButton currentLayout;
5136
-
51375512 //
51385513 //Composite
51395514 Object3D // to do !!
....@@ -5143,9 +5518,11 @@
51435518 //JTree jTree;
51445519 private MenuItem lookAtItem;
51455520 private MenuItem lookFromItem;
5146
- private MenuItem switchItem;
5521
+ private MenuItem switchViewItem;
51475522 private MenuItem cutItem;
5148
- private MenuItem duplicateItem;
5523
+ private MenuItem undoItem;
5524
+ private MenuItem redoItem;
5525
+ private JMenuItem duplicateItem;
51495526 private MenuItem cloneItem;
51505527 private MenuItem cloneSupportItem;
51515528 private MenuItem overwriteGeoItem;
....@@ -5208,6 +5585,10 @@
52085585 private MenuItem showleavesItem;
52095586 private MenuItem markleavesItem;
52105587 private MenuItem unmarkleavesItem;
5588
+ private MenuItem rewindleavesItem;
5589
+ private MenuItem unrewindleavesItem;
5590
+ private MenuItem randomleavesItem;
5591
+ private MenuItem unrandomleavesItem;
52115592
52125593 private MenuItem flipVItem;
52135594 private MenuItem unflipVItem;
....@@ -5229,7 +5610,7 @@
52295610 private MenuItem frontItem;
52305611 private MenuItem cameraItem;
52315612 private MenuItem compositeItem;
5232
- private MenuItem randomItem;
5613
+ private MenuItem switchItem;
52335614 private MenuItem physicsItem;
52345615 private MenuItem frameselectorItem;
52355616 private MenuItem scriptNodeItem;
....@@ -5303,5 +5684,5 @@
53035684
53045685 Menu cameraMenu;
53055686 MenuItem editCameraItem;
5306
- MenuItem revertCameraItem;
5687
+ MenuItem restoreCameraItem;
53075688 }