Normand Briere
2019-06-26 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1
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,63 @@
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
+ undoButton.setEnabled(false);
609
+
610
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ redoButton.setToolTipText("Redo changes");
612
+ redoButton.addActionListener(this);
613
+ redoButton.setEnabled(false);
614
+
615
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ saveButton.setToolTipText("Save changes");
617
+ saveButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
555620 liveCB.setToolTipText("Enable animation");
556621 liveCB.addItemListener(this);
557622
558
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
559624 oneStepButton.setToolTipText("Animate one step forward");
560625 oneStepButton.addActionListener(this);
561626
562
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
627
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
563628 fastCB.setToolTipText("Fast mode");
564629 fastCB.addItemListener(this);
565630
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);
631
+ //oe.toolboxPanel.Return();
632
+
633
+ copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
571634 screenfitButton.setToolTipText("Screen fit");
572635 screenfitButton.addActionListener(this);
636
+
637
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
638
+// trackCB.setToolTipText("Enable tracking");
639
+// trackCB.addItemListener(this);
573640
574641 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
575642 // screenfitpointButton.addActionListener(this);
....@@ -581,65 +648,144 @@
581648 snapobjectButton.setToolTipText("Snap Object");
582649 }
583650
584
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- flashSelectionButton.setToolTipText("Show selection");
586
- flashSelectionButton.addActionListener(this);
651
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
587652
588
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
589
-
590
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591654 twoButton.setToolTipText("Show center view only");
592655 twoButton.addActionListener(this);
593
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ this.fullscreenLayout = twoButton;
657
+
658
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594659 fourButton.addActionListener(this);
595660 fourButton.setToolTipText("Show left panel only");
596
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597662 sixButton.setToolTipText("2-column layout left");
598663 sixButton.addActionListener(this);
599
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600665 threeButton.setToolTipText("2-column layout right");
601666 threeButton.addActionListener(this);
602
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603668 sevenButton.setToolTipText("3-column layout");
604669 sevenButton.addActionListener(this);
605670 //
606671
607
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
672
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608673 rootButton.setToolTipText("Edit selection in new tab");
609674 rootButton.addActionListener(this);
610675
611
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612677 closeButton.setToolTipText("Close tab");
613678 closeButton.addActionListener(this);
614679 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
615680 //clearButton.addActionListener(this);
616
-
617
- cGridBag commandsPanel = new cGridBag();
681
+
682
+ // INSERT
683
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ gridButton.setToolTipText("Create grid");
685
+ gridButton.addActionListener(this);
686
+
687
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ boxButton.setToolTipText("Create box");
689
+ boxButton.addActionListener(this);
690
+
691
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
692
+ sphereButton.setToolTipText("Create sphere");
693
+ sphereButton.addActionListener(this);
694
+
695
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ coneButton.setToolTipText("Create cone");
697
+ coneButton.addActionListener(this);
698
+
699
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ torusButton.setToolTipText("Create torus");
701
+ torusButton.addActionListener(this);
702
+
703
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+ superButton.setToolTipText("Create superellipsoid");
705
+ superButton.addActionListener(this);
706
+
707
+ if (Globals.ADVANCED)
708
+ {
709
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
710
+ kleinButton.setToolTipText("Create Klein bottle");
711
+ kleinButton.addActionListener(this);
712
+ }
618713
619
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
714
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ particlesButton.setToolTipText("Create particle system");
716
+ particlesButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.Return();
719
+
720
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721
+ groupButton.setToolTipText("Create group");
722
+ groupButton.addActionListener(this);
723
+
724
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ compositeButton.setToolTipText("Create composite");
726
+ compositeButton.addActionListener(this);
727
+
728
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ switchButton.setToolTipText("Create switch");
730
+ switchButton.addActionListener(this);
731
+
732
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ loopButton.setToolTipText("Create loop");
734
+ loopButton.addActionListener(this);
735
+
736
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737
+ textureButton.setToolTipText("Create texture");
738
+ textureButton.addActionListener(this);
739
+
740
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ overlayButton.setToolTipText("Create overlay");
742
+ overlayButton.addActionListener(this);
743
+
744
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ lightButton.setToolTipText("Create light");
746
+ lightButton.addActionListener(this);
747
+
748
+ for (int i=6; --i>=0;)
749
+ {
750
+ oe.toolboxPanel.Return();
751
+ oe.toolboxPanel.add(new cGridBag());
752
+ oe.toolboxPanel.add(new cGridBag());
753
+ oe.toolboxPanel.add(new cGridBag());
754
+ oe.toolboxPanel.add(new cGridBag());
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ }
759
+
760
+ // EDIT panel
761
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620762 editButton.setToolTipText("Edit selection");
621763 editButton.addActionListener(this);
622764
623
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624766 uneditButton.setToolTipText("Unedit selection");
625767 uneditButton.addActionListener(this);
626768
627
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
769
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
628770 allParamsButton.setToolTipText("Edit all params");
629771 allParamsButton.addActionListener(this);
630772
631
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632774 clearPanelButton.setToolTipText("Clear edit panel");
633775 clearPanelButton.addActionListener(this);
634776
635
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636778 unselectButton.setToolTipText("Unselect");
637779 unselectButton.addActionListener(this);
638780
639
- commandsPanel.preferredHeight = 1;
781
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
782
+ flashSelectionButton.setToolTipText("Highlight selection");
783
+ flashSelectionButton.addActionListener(this);
640784
641
- oe.treePanel.add(commandsPanel);
642
- oe.treePanel.Return();
785
+ editCommandsPanel.preferredHeight = 1;
786
+
787
+// oe.treePanel.add(commandsPanel);
788
+// oe.treePanel.Return();
643789
644790 // oe.aConstraints.gridx += 1;
645791 // oe.aConstraints.weighty = 0;
....@@ -656,27 +802,12 @@
656802
657803 JScrollPane jSP;
658804 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
659
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
805
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
660806 ResetModel();
661807
662808 oe.treePanel.add(jSPPanel);
663809 oe.treePanel.Return();
664810
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;
680811 oe.treePanel.add(copyOptionsPanel);
681812 oe.treePanel.Return();
682813
....@@ -707,6 +838,20 @@
707838
708839 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
709840 {
841
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
842
+ colorCB.setToolTipText("Copy color when dropped");
843
+ colorCB.addItemListener(this);
844
+
845
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
846
+ materialCB.setToolTipText("Copy material when dropped");
847
+ materialCB.addItemListener(this);
848
+
849
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
850
+ textureCB.setToolTipText("Copy texture when dropped");
851
+ textureCB.addItemListener(this);
852
+
853
+ panel.Return();
854
+
710855 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
711856 boxCB.setToolTipText("Display bounding boxes");
712857 boxCB.addItemListener(this);
....@@ -724,6 +869,8 @@
724869 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
725870 // localCB.addItemListener(this);
726871
872
+ panel.Return();
873
+
727874 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
728875 crowdCB.setToolTipText("Used for crowds");
729876 crowdCB.addItemListener(this);
....@@ -740,6 +887,8 @@
740887 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
741888 // speakerMocapCB.addItemListener(this);
742889
890
+ panel.Return();
891
+
743892 if (false)
744893 {
745894 // handled in scripts
....@@ -754,32 +903,72 @@
754903 //constraints.gridy += 1;
755904 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
756905 smoothfocusCB.addItemListener(this);
906
+ panel.Return();
757907 }
758908
759909 //constraints.gridx += 1;
760910 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
761911 // debugCB.addItemListener(this);
762912
913
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
914
+ trackCB.setToolTipText("Enable tracking target");
915
+ trackCB.addItemListener(this);
916
+
763917 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
918
+ oeilCB.setToolTipText("Move camera when tracking");
764919 oeilCB.addItemListener(this);
765920
921
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
922
+ shadowCB.setToolTipText("Compute shadows when live");
923
+ shadowCB.addItemListener(this);
924
+
925
+ panel.Return();
926
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
927
+ toggleTextureCB.setToolTipText("Load textures");
928
+ toggleTextureCB.addItemListener(this);
929
+
930
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
931
+ toggleSwitchCB.setToolTipText("Use switch");
932
+ toggleSwitchCB.addItemListener(this);
933
+
934
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
935
+ autosaveCB.setToolTipText("Auto-save on structure change");
936
+ autosaveCB.addItemListener(this);
937
+
938
+ panel.Return();
939
+ if (Globals.ADVANCED)
940
+ {
766941 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
767942 lookAtCB.setToolTipText("Look-at target");
768943 lookAtCB.addItemListener(this);
944
+ }
769945
770946 }
771947
772948 cGridBag fill = new cGridBag();
773
-
774949 fill.preferredHeight = 200;
950
+ cGridBag fill2 = new cGridBag();
951
+ fill2.preferredHeight = 200;
952
+ cGridBag fill3 = new cGridBag();
953
+ fill3.preferredHeight = 200;
775954
776955 panel.add(fill);
956
+ panel.add(fill2);
957
+ panel.add(fill3);
777958
778959 }
779960
780961 void EditObject(Object3D obj)
781962 {
782963 cRadio radioButton = new cRadio(obj.name);
964
+
965
+ // Patch to avoid bug with transparency.
966
+ radioButton.hadMaterial = obj.material != null;
967
+ if (!radioButton.hadMaterial)
968
+ {
969
+ obj.material = new cMaterial();
970
+ }
971
+
783972 radioButton.SetObject(obj);
784973 radioButton.layout = sevenButton;
785974 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -791,6 +980,8 @@
791980
792981 void SetupViews(ObjEditor oe)
793982 {
983
+ theFrame = this;
984
+
794985 oe.SetupViews();
795986
796987 System.out.println("SetupViews");
....@@ -799,23 +990,27 @@
799990 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
800991 }
801992
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;
993
+ cToggleButton liveCB;
994
+ cCheckBox supportCB;
995
+ cCheckBox localCB;
996
+ cCheckBox crowdCB;
997
+ cCheckBox smoothCB;
998
+ cToggleButton fastCB;
999
+ cCheckBox slowCB;
1000
+ cCheckBox boxCB;
1001
+ cCheckBox zoomBoxCB;
1002
+ //cToggleButton trackCB;
1003
+ cCheckBox trackCB;
1004
+ cCheckBox smoothfocusCB;
8131005 // JCheckBox speakerMocapCB;
814
- JCheckBox speakerCameraCB;
815
- JCheckBox speakerFocusCB;
816
- JCheckBox debugCB;
817
- JCheckBox oeilCB;
818
- JCheckBox lookAtCB;
1006
+ cCheckBox speakerCameraCB;
1007
+ cCheckBox speakerFocusCB;
1008
+ cCheckBox debugCB;
1009
+
1010
+ cCheckBox oeilCB;
1011
+ cCheckBox shadowCB;
1012
+ cCheckBox autosaveCB;
1013
+ cCheckBox lookAtCB;
8191014
8201015 // static int COLOR = 1;
8211016 // static int MATERIAL = 2;
....@@ -823,9 +1018,9 @@
8231018
8241019 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8251020
826
- JCheckBox colorCB;
827
- JCheckBox materialCB;
828
- JCheckBox textureCB;
1021
+ cCheckBox colorCB;
1022
+ cCheckBox materialCB;
1023
+ cCheckBox textureCB;
8291024
8301025 public void itemStateChanged(ItemEvent e)
8311026 {
....@@ -853,6 +1048,7 @@
8531048 } else if(e.getSource() == liveCB)
8541049 {
8551050 cameraView.ToggleLive();
1051
+ refreshContents(false);
8561052 }
8571053 else if(e.getSource() == supportCB)
8581054 {
....@@ -917,6 +1113,14 @@
9171113 {
9181114 cameraView.ToggleOeil();
9191115 }
1116
+ else if(e.getSource() == shadowCB)
1117
+ {
1118
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1119
+ }
1120
+ else if(e.getSource() == autosaveCB)
1121
+ {
1122
+ Globals.SAVEONMAKE ^= true;
1123
+ }
9201124 else if(e.getSource() == lookAtCB)
9211125 {
9221126 cameraView.ToggleLookAt();
....@@ -933,7 +1137,8 @@
9331137
9341138 /**/
9351139 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
936
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1140
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1141
+ TreePath path = objEditor.jTree.getSelectionPath();
9371142 if ((path == null) || (path.getPathCount() <= 1)) {
9381143 // We can't move the root node or an empty selection
9391144 return;
....@@ -1050,23 +1255,33 @@
10501255
10511256 assert target == objEditor.jTree;
10521257 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1258
+ Object3D destinationLeaf;
10531259 try {
1054
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1260
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10551261 } catch (Exception e) {
10561262 System.out.println("destinationPath : " + destinationPath);
10571263 return;
10581264 }
10591265
1060
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1266
+ for (int i=group.selection.size(); --i>=0;)
10611267 {
1268
+ Object3D child = (Object3D)group.selection.elementAt(i);
1269
+
1270
+ // Cannot move into itself
1271
+ if (child == destinationLeaf)
1272
+ return;
1273
+ }
1274
+
1275
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1276
+// {
10621277 loadClipboard(true);
10631278 objEditor.jTree.setSelectionPath(destinationPath);
10641279 pasteInto(false, false);
1065
- } else {
1066
- loadClipboard(false);
1067
- objEditor.jTree.setSelectionPath(destinationPath);
1068
- pasteInto(false, false); // true); // ???
1069
- }
1280
+// } else {
1281
+// loadClipboard(false);
1282
+// objEditor.jTree.setSelectionPath(destinationPath);
1283
+// pasteInto(false, false); // true); // ???
1284
+// }
10701285 }
10711286 public void dropActionChanged(DropTargetDragEvent dtde)
10721287 // Called if the user has modified the current drop gesture
....@@ -1171,22 +1386,30 @@
11711386 {
11721387 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11731388 //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);
1389
+// gridItem = menu.add(new MenuItem("Grid"));
1390
+// gridItem.addActionListener(this);
1391
+// rectoidItem = menu.add(new MenuItem("Box"));
1392
+// rectoidItem.addActionListener(this);
1393
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1394
+// ellipsoidItem.addActionListener(this);
1395
+// coneItem = menu.add(new MenuItem("Cone"));
1396
+// coneItem.addActionListener(this);
1397
+// torusItem = menu.add(new MenuItem("Torus"));
1398
+// torusItem.addActionListener(this);
1399
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1400
+// superItem.addActionListener(this);
1401
+
1402
+ cameraItem = menu.add(new MenuItem("Camera"));
1403
+ cameraItem.addActionListener(this);
1404
+
1405
+ if (!Globals.ADVANCED)
1406
+ {
11861407 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11871408 kleinItem.addActionListener(this);
1188
- particleItem = menu.add(new MenuItem("Particle system"));
1189
- particleItem.addActionListener(this);
1409
+ }
1410
+
1411
+// particleItem = menu.add(new MenuItem("Particle system"));
1412
+// particleItem.addActionListener(this);
11901413 if (Globals.ADVANCED)
11911414 {
11921415 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1212,15 +1435,15 @@
12121435 }
12131436 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12141437 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);
1438
+// overlayItem = menu.add(new MenuItem("Overlay"));
1439
+// overlayItem.addActionListener(this);
1440
+// lightItem = menu.add(new MenuItem("Light"));
1441
+// lightItem.addActionListener(this);
12191442 menu.add("-");
12201443 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12211444 //superLoopItem.addActionListener(this);
1222
- loopItem = menu.add(new MenuItem("Loop"));
1223
- loopItem.addActionListener(this);
1445
+// loopItem = menu.add(new MenuItem("Loop"));
1446
+// loopItem.addActionListener(this);
12241447 doubleItem = menu.add(new MenuItem("Fork"));
12251448 doubleItem.addActionListener(this);
12261449 if (Globals.ADVANCED)
....@@ -1260,7 +1483,7 @@
12601483 memoryItem.addActionListener(this);
12611484 menu.add(analyzeItem = new MenuItem("Analyze"));
12621485 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1486
+ menu.add(dumpItem = new MenuItem("Print"));
12641487 dumpItem.addActionListener(this);
12651488 // menu.add(pathItem = new MenuItem("From-to path"));
12661489 // pathItem.addActionListener(this);
....@@ -1401,6 +1624,7 @@
14011624 shadow.material = new cMaterial(obj.material);
14021625 shadow.material.diffuse = 0.0001f;
14031626 shadow.material.specular = 0.0001f;
1627
+ //shadow.projectedVertices[1].x = 300;
14041628
14051629 makeSomething(shadow);
14061630 }
....@@ -1648,7 +1872,7 @@
16481872 {
16491873 ScreenFit();
16501874 } else
1651
- if (source == switchItem)
1875
+ if (source == switchViewItem)
16521876 {
16531877 cVector v1 = new cVector();
16541878 cVector v2 = new cVector();
....@@ -1657,11 +1881,11 @@
16571881 objEditor.cameraView.renderCamera.setAim(v2, v1);
16581882 objEditor.cameraView.repaint();
16591883 } else
1660
- if (source == rectoidItem)
1884
+ if (source == rectoidItem || source == boxButton)
16611885 {
16621886 makeSomething(new Box());
16631887 } else
1664
- if (source == particleItem)
1888
+ if (source == particleItem || source == particlesButton)
16651889 {
16661890 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16671891 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1740,27 +1964,27 @@
17401964
17411965 makeSomething(obj);
17421966 } else
1743
- if (source == gridItem)
1967
+ if (source == gridItem || source == gridButton)
17441968 {
17451969 makeSomething(new Grid());
17461970 } else
1747
- if (source == ellipsoidItem)
1971
+ if (source == ellipsoidItem || source == sphereButton)
17481972 {
17491973 makeSomething(new Sphere());
17501974 } else
1751
- if (source == coneItem)
1975
+ if (source == coneItem || source == coneButton)
17521976 {
17531977 makeSomething(new Cone());
17541978 } else
1755
- if (source == torusItem)
1979
+ if (source == torusItem || source == torusButton)
17561980 {
17571981 makeSomething(new Torus());
17581982 } else
1759
- if (source == superItem)
1983
+ if (source == superItem || source == superButton)
17601984 {
17611985 makeSomething(new Superellipsoid());
17621986 } else
1763
- if (source == kleinItem)
1987
+ if (source == kleinItem || source == kleinButton)
17641988 {
17651989 makeSomething(new Klein());
17661990 } else
....@@ -1780,7 +2004,7 @@
17802004 {
17812005 makeSomething(new BezierSurface());
17822006 } else
1783
- if (source == overlayItem)
2007
+ if (source == overlayItem || source == overlayButton)
17842008 {
17852009 /*
17862010 Object3D obj = new BezierSurface(5,8);
....@@ -1828,7 +2052,7 @@
18282052 s.setup();
18292053 makeSomething(s);
18302054 } else
1831
- if (source == lightItem)
2055
+ if (source == lightItem || source == lightButton)
18322056 {
18332057 makeSomething(new Light());
18342058 } else
....@@ -1878,7 +2102,7 @@
18782102
18792103 group(g);
18802104 } else
1881
- if (source == loopItem)
2105
+ if (source == loopItem || source == loopButton)
18822106 {
18832107 Composite csg = new GroupLeaf();
18842108 csg.count = 5;
....@@ -1951,6 +2175,30 @@
19512175 {
19522176 DumpObject();
19532177 } else
2178
+ if (source == minButton)
2179
+ {
2180
+ Minimize();
2181
+ } else
2182
+ if (source == maxButton)
2183
+ {
2184
+ Maximize();
2185
+ } else
2186
+ if (source == fullButton)
2187
+ {
2188
+ ToggleFullScreen();
2189
+ } else
2190
+ if (source == undoButton)
2191
+ {
2192
+ Undo();
2193
+ } else
2194
+ if (source == redoButton)
2195
+ {
2196
+ Redo();
2197
+ } else
2198
+ if (source == saveButton)
2199
+ {
2200
+ Save();
2201
+ } else
19542202 if (source == oneStepButton)
19552203 {
19562204 Globals.ONESTEP = true;
....@@ -2004,6 +2252,14 @@
20042252 if (source == cutItem || source == clearButton)
20052253 {
20062254 loadClipboard(true);
2255
+ } else
2256
+ if (source == undoItem)
2257
+ {
2258
+ Undo();
2259
+ } else
2260
+ if (source == redoItem)
2261
+ {
2262
+ Redo();
20072263 } else
20082264 if (source == duplicateItem)
20092265 {
....@@ -2336,9 +2592,9 @@
23362592 {
23372593 ClearSelection(true);
23382594 } else
2339
- if (source == grabItem)
2595
+ if (source == grabItem || source == groupButton)
23402596 {
2341
- group(new cGroup(), true);
2597
+ group(new cGroup(), false); // true);
23422598 } else
23432599 if (source == hideItem)
23442600 {
....@@ -2356,11 +2612,11 @@
23562612 {
23572613 makeSomething(new Camera());
23582614 } else
2359
- if (source == compositeItem)
2615
+ if (source == compositeItem || source == compositeButton)
23602616 {
23612617 group(new Composite());
23622618 } else
2363
- if (source == randomItem)
2619
+ if (source == switchItem || source == switchButton)
23642620 {
23652621 RandomNode random = new RandomNode();
23662622 group(random);
....@@ -2462,7 +2718,7 @@
24622718 {
24632719 group(new cLinker());
24642720 } else
2465
- if (source == textureItem)
2721
+ if (source == textureItem || source == textureButton)
24662722 {
24672723 group(new TextureNode());
24682724 } else
....@@ -2482,7 +2738,7 @@
24822738 {
24832739 CastShadow(2);
24842740 } else
2485
- if (source == ungroupItem)
2741
+ if (source == ungroupItem || source == ungroupButton)
24862742 {
24872743 //ungroup();
24882744 for (int i=0; i<group.selection.size(); i++)
....@@ -2504,7 +2760,7 @@
25042760 } else
25052761 if (source == genNormalsMESHItem)
25062762 {
2507
- GenNormals(true); // TODO
2763
+ GenNormalsMESH();
25082764 } else
25092765 if (source == genNormalsORGANItem)
25102766 {
....@@ -2569,6 +2825,22 @@
25692825 if (source == unmarkleavesItem)
25702826 {
25712827 MarkLeaves(false);
2828
+ } else
2829
+ if (source == rewindleavesItem)
2830
+ {
2831
+ RewindLeaves(true);
2832
+ } else
2833
+ if (source == unrewindleavesItem)
2834
+ {
2835
+ RewindLeaves(false);
2836
+ } else
2837
+ if (source == randomleavesItem)
2838
+ {
2839
+ RandomLeaves(true);
2840
+ } else
2841
+ if (source == unrandomleavesItem)
2842
+ {
2843
+ RandomLeaves(false);
25722844 } else
25732845 if (source == flipVItem)
25742846 {
....@@ -2804,6 +3076,10 @@
28043076 if (source == twoButton)
28053077 {
28063078 radio.layout = twoButton;
3079
+
3080
+ if (CameraPane.FULLSCREEN)
3081
+ fullscreenLayout = radio.layout;
3082
+
28073083 // bug
28083084 //gridPanel.setDividerLocation(1.0);
28093085 //bigPanel.setDividerLocation(0.0);
....@@ -2836,10 +3112,31 @@
28363112 bigThree.ClearUI();
28373113 bigThree.add(centralPanel);
28383114 bigThree.FlushUI();
3115
+
3116
+ cameraView.requestFocusInWindow();
3117
+
3118
+// refreshContents(true);
3119
+//
3120
+// try
3121
+// {
3122
+// java.awt.Robot bot = new java.awt.Robot();
3123
+// int mask = InputEvent.BUTTON1_MASK;
3124
+// bot.mouseMove(100, 100);
3125
+// bot.mousePress(mask);
3126
+// bot.mouseRelease(mask);
3127
+// }
3128
+// catch (Exception e)
3129
+// {
3130
+//
3131
+// }
3132
+
28393133 } else
28403134 if (source == threeButton)
28413135 {
28423136 radio.layout = threeButton;
3137
+
3138
+ if (CameraPane.FULLSCREEN)
3139
+ fullscreenLayout = radio.layout;
28433140
28443141 // bigThree.remove(scenePanel);
28453142 // bigThree.remove(centralPanel);
....@@ -2872,10 +3169,15 @@
28723169 bigThree.add(centralPanel);
28733170 bigThree.add(XYZPanel);
28743171 bigThree.FlushUI();
3172
+
3173
+ cameraView.requestFocusInWindow();
28753174 } else
28763175 if (source == fourButton)
28773176 {
28783177 radio.layout = fourButton;
3178
+
3179
+ if (CameraPane.FULLSCREEN)
3180
+ fullscreenLayout = radio.layout;
28793181
28803182 // bigThree.remove(scenePanel);
28813183 // bigThree.remove(centralPanel);
....@@ -2907,10 +3209,15 @@
29073209 bigThree.ClearUI();
29083210 bigThree.add(scenePanel);
29093211 bigThree.FlushUI();
3212
+
3213
+ cameraView.requestFocusInWindow();
29103214 } else
29113215 if (source == sixButton)
29123216 {
29133217 radio.layout = sixButton;
3218
+
3219
+ if (CameraPane.FULLSCREEN)
3220
+ fullscreenLayout = radio.layout;
29143221
29153222 // bigThree.remove(scenePanel);
29163223 // bigThree.remove(centralPanel);
....@@ -2943,10 +3250,15 @@
29433250 bigThree.add(scenePanel);
29443251 bigThree.add(centralPanel);
29453252 bigThree.FlushUI();
3253
+
3254
+ cameraView.requestFocusInWindow();
29463255 } else
29473256 if (source == sevenButton)
29483257 {
29493258 radio.layout = sevenButton;
3259
+
3260
+ if (CameraPane.FULLSCREEN)
3261
+ fullscreenLayout = radio.layout;
29503262
29513263 // bigThree.remove(scenePanel);
29523264 // bigThree.remove(centralPanel);
....@@ -2980,6 +3292,8 @@
29803292 bigThree.add(centralPanel);
29813293 bigThree.add(XYZPanel);
29823294 bigThree.FlushUI();
3295
+
3296
+ cameraView.requestFocusInWindow();
29833297 } else
29843298 if (source == rootButton)
29853299 {
....@@ -2991,6 +3305,7 @@
29913305 EditObject(obj);
29923306 }
29933307
3308
+ cameraView.requestFocusInWindow();
29943309 refreshContents(true);
29953310 } else
29963311 if (source == closeButton)
....@@ -3000,22 +3315,37 @@
30003315 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30013316 {
30023317 ab = (cRadio)e.nextElement();
3003
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3318
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30043319 {
3320
+ // Patch to avoid bug with transparency.
3321
+ if (!ab.hadMaterial)
3322
+ {
3323
+ ab.object.material = null;
3324
+ }
3325
+
30053326 buttonGroup.remove(ab);
30063327 radioPanel.remove(ab);
30073328
3008
- ab.GetObject().editWindow = null;
3329
+ //ab.GetObject().editWindow = null;
3330
+ ab.GetObject().manipWindow = null;
30093331 // ab.GetObject().objectUI = null; // ?????????
30103332
30113333 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30123334 break;
30133335 }
30143336 }
3337
+
3338
+ cameraView.requestFocusInWindow();
30153339 refreshContents(true);
30163340 } else
30173341 if (source == editItem || source == editButton)
30183342 {
3343
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3344
+ {
3345
+ Object3D child = (Object3D)e.nextElement();
3346
+ child.pinned = true;
3347
+ }
3348
+
30193349 EditSelection(false);
30203350 } else
30213351 if (source == uneditButton)
....@@ -3025,10 +3355,11 @@
30253355 Object3D child = (Object3D)e.nextElement();
30263356 if(child.editWindow != null)
30273357 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3358
+ child.pinned = false;
30283359 child.CloseUI();
30293360 listUI.remove(child);
30303361
3031
- child.editWindow = null; // ???????????
3362
+ //child.editWindow = null; // ???????????
30323363 }
30333364 objEditor.ctrlPanel.FlushUI();
30343365 //objEditor.jTree.clearSelection();
....@@ -3041,6 +3372,7 @@
30413372 //copy.ClearUI();
30423373 for (Object3D obj : listUI)
30433374 {
3375
+ obj.pinned = true;
30443376 obj.CloseUI();
30453377 }
30463378 listUI.clear();
....@@ -3050,7 +3382,7 @@
30503382 {
30513383 assert(copy == group);
30523384
3053
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3385
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30543386
30553387 for (Object3D obj : listUI)
30563388 {
....@@ -3115,7 +3447,9 @@
31153447 sideView.object = group;
31163448 }
31173449
3118
-// fix "+" issue group.editWindow = this;
3450
+// fix "+" issue
3451
+ //group.editWindow = this;
3452
+ group.manipWindow = this;
31193453
31203454 /*
31213455 currentLayout = radio.layout;
....@@ -3128,13 +3462,15 @@
31283462 //group.parent = null; // ROOT
31293463 //group.attributes = -1;
31303464 ResetModel();
3465
+
3466
+ cameraView.requestFocusInWindow();
31313467 refreshContents(true);
31323468 } else if (event.getSource() == editCameraItem)
31333469 {
31343470 cameraView.ProtectCamera();
31353471 cameraView.repaint();
31363472 return;
3137
- } else if (event.getSource() == revertCameraItem)
3473
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31383474 {
31393475 cameraView.RevertCamera();
31403476 cameraView.repaint();
....@@ -3151,7 +3487,6 @@
31513487 }
31523488
31533489 boolean useclient = false;
3154
- cRadio radio;
31553490
31563491 void ToggleRoot()
31573492 {
....@@ -3390,7 +3725,8 @@
33903725
33913726 int size = obj.MemorySize();
33923727
3393
- System.err.println((size/1024) + " KB is the size of " + obj);
3728
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3729
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33943730 }
33953731 }
33963732 catch (Exception e)
....@@ -3471,6 +3807,13 @@
34713807 void GenNormals(boolean crease)
34723808 {
34733809 group.GenNormalsS(crease);
3810
+
3811
+ refreshContents();
3812
+ }
3813
+
3814
+ void GenNormalsMESH()
3815
+ {
3816
+ group.GenNormalsMeshS();
34743817
34753818 refreshContents();
34763819 }
....@@ -4098,6 +4441,18 @@
40984441 refreshContents();
40994442 }
41004443
4444
+ void RewindLeaves(boolean hide)
4445
+ {
4446
+ group.selection.RewindLeaves(hide);
4447
+ refreshContents();
4448
+ }
4449
+
4450
+ void RandomLeaves(boolean hide)
4451
+ {
4452
+ group.selection.RandomLeaves(hide);
4453
+ refreshContents();
4454
+ }
4455
+
41014456 void SetTexRes(int tr)
41024457 {
41034458 group.selection.SetTexRes(tr);
....@@ -4169,10 +4524,6 @@
41694524 // }
41704525 // }
41714526
4172
- static boolean allparams = true;
4173
-
4174
- static Vector<Object3D> listUI = new Vector<Object3D>();
4175
-
41764527 void EditSelection(boolean newWindow)
41774528 {
41784529 // aConstraints.gridy = 0;
....@@ -4180,7 +4531,7 @@
41804531 {
41814532 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41824533 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4534
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41844535
41854536 Object3D elem = (Object3D)group.selection.elementAt(i);
41864537 if(elem != group || !newWindow)
....@@ -4266,6 +4617,17 @@
42664617
42674618 freezemodel = true;
42684619
4620
+ //for (Object3D obj : listUI)
4621
+ for (int i=listUI.size(); --i>=0;)
4622
+ {
4623
+ Object3D obj = listUI.elementAt(i);
4624
+ if (!obj.pinned)
4625
+ {
4626
+ obj.CloseUI();
4627
+ listUI.remove(i);
4628
+ }
4629
+ }
4630
+
42694631 /**/
42704632 //switch (event.id)
42714633 {
....@@ -4273,7 +4635,6 @@
42734635 //case 702: // Event.LIST_DESELECT
42744636 group.deselectAll();
42754637 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774638 if (tps != null)
42784639 {
42794640 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4643,8 @@
42824643
42834644 //if (child.parent != null)
42844645 //child.parent.addSelectee(child);
4646
+ objEditor.SetMaterial(child);
42854647 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894648 }
42904649 }
42914650 // else
....@@ -4295,20 +4654,28 @@
42954654 // System.err.println("info : " + group.GetPath());
42964655 // }
42974656
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4657
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014658 CameraPane.flash = true;
43024659
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4660
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044661 // a camera
43054662 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4663
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4664
+ {
4665
+ CameraPane.camerachangeframe = 0; // don't refuse it
4666
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4667
+ }
43084668 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094669 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104670 }
43114671
4672
+ if (tps != null && tps.length == 1)
4673
+ {
4674
+ EditSelection(false);
4675
+ }
4676
+
4677
+ SetPinStates(tps != null && tps.length > 0);
4678
+
43124679 refreshContents();
43134680 //return true;
43144681 }
....@@ -4317,6 +4684,33 @@
43174684
43184685 freezemodel = false;
43194686 }
4687
+
4688
+ void SetPinStates(boolean enabled)
4689
+ {
4690
+ editButton.setEnabled(enabled);
4691
+ uneditButton.setEnabled(enabled);
4692
+ }
4693
+
4694
+ void refreshContents(boolean cp)
4695
+ {
4696
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4697
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4698
+ {
4699
+ objEditor.ClearInfo(); // .GetMaterial());
4700
+
4701
+ for (int i=0; i < group.selection.Size(); i++)
4702
+ {
4703
+ Object3D child = (Object3D) group.selection.get(i);
4704
+
4705
+ objEditor.AddInfo(child, this, true);
4706
+ System.err.println("info : " + child.GetPath());
4707
+ }
4708
+
4709
+ objEditor.SetText(); // jan 2014
4710
+ }
4711
+
4712
+ super.refreshContents(cp);
4713
+ }
43204714
43214715 void linkSomething(Object3D thing)
43224716 {
....@@ -4388,6 +4782,7 @@
43884782 {
43894783 if (group.selection.isEmpty())
43904784 return;
4785
+
43914786 Grafreed.clipboardIsTempGroup = false;
43924787 Composite tGroup = null;
43934788 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4793,8 @@
43984793
43994794 if (cut)
44004795 {
4796
+ if (Globals.SAVEONMAKE)
4797
+ Save();
44014798 //int indices[] = jList.getSelectedIndices();
44024799 //for (int i = indices.length - 1; i >= 0; i--)
44034800 //jList.remove(indices[i]);
....@@ -4487,8 +4884,10 @@
44874884 }
44884885
44894886 }
4887
+
44904888 if (Grafreed.clipboardIsTempGroup)
44914889 Grafreed.clipboard = tGroup;
4890
+
44924891 if (cut)
44934892 {
44944893 ResetModel();
....@@ -5113,7 +5512,31 @@
51135512 cButton clearpanelButton;
51145513 cButton unselectButton;
51155514
5515
+ cButton restoreCameraButton;
5516
+
5517
+ cButton minButton;
5518
+ cButton maxButton;
5519
+ cButton fullButton;
5520
+ cButton saveButton;
51165521 cButton oneStepButton;
5522
+
5523
+ cButton groupButton;
5524
+ cButton ungroupButton;
5525
+ cButton compositeButton;
5526
+ cButton switchButton;
5527
+ cButton loopButton;
5528
+ cButton textureButton;
5529
+
5530
+ cButton gridButton;
5531
+ cButton boxButton;
5532
+ cButton sphereButton;
5533
+ cButton coneButton;
5534
+ cButton torusButton;
5535
+ cButton superButton;
5536
+ cButton kleinButton;
5537
+ cButton particlesButton;
5538
+ cButton overlayButton;
5539
+ cButton lightButton;
51175540
51185541 cButton screenfitButton;
51195542 cButton screenfitpointButton;
....@@ -5126,14 +5549,6 @@
51265549
51275550 cButton setsupportButton;
51285551
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
-
51375552 //
51385553 //Composite
51395554 Object3D // to do !!
....@@ -5143,9 +5558,11 @@
51435558 //JTree jTree;
51445559 private MenuItem lookAtItem;
51455560 private MenuItem lookFromItem;
5146
- private MenuItem switchItem;
5561
+ private MenuItem switchViewItem;
51475562 private MenuItem cutItem;
5148
- private MenuItem duplicateItem;
5563
+ private MenuItem undoItem;
5564
+ private MenuItem redoItem;
5565
+ private JMenuItem duplicateItem;
51495566 private MenuItem cloneItem;
51505567 private MenuItem cloneSupportItem;
51515568 private MenuItem overwriteGeoItem;
....@@ -5208,6 +5625,10 @@
52085625 private MenuItem showleavesItem;
52095626 private MenuItem markleavesItem;
52105627 private MenuItem unmarkleavesItem;
5628
+ private MenuItem rewindleavesItem;
5629
+ private MenuItem unrewindleavesItem;
5630
+ private MenuItem randomleavesItem;
5631
+ private MenuItem unrandomleavesItem;
52115632
52125633 private MenuItem flipVItem;
52135634 private MenuItem unflipVItem;
....@@ -5229,7 +5650,7 @@
52295650 private MenuItem frontItem;
52305651 private MenuItem cameraItem;
52315652 private MenuItem compositeItem;
5232
- private MenuItem randomItem;
5653
+ private MenuItem switchItem;
52335654 private MenuItem physicsItem;
52345655 private MenuItem frameselectorItem;
52355656 private MenuItem scriptNodeItem;
....@@ -5303,5 +5724,5 @@
53035724
53045725 Menu cameraMenu;
53055726 MenuItem editCameraItem;
5306
- MenuItem revertCameraItem;
5727
+ MenuItem restoreCameraItem;
53075728 }