Normand Briere
2019-06-27 1807e7752960ac229cddd34b100e92cadbac9459
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,145 @@
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);
620
- editButton.setToolTipText("Edit selection");
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 = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
+ editButton.setToolTipText("Pin selection controls");
621763 editButton.addActionListener(this);
622764
623
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
- uneditButton.setToolTipText("Unedit selection");
765
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ uneditButton.setToolTipText("Remove selection controls");
625767 uneditButton.addActionListener(this);
626768
627
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
628
- allParamsButton.setToolTipText("Edit all params");
769
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
770
+ allParamsButton.setToolTipText("Show all controle");
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
+ SetPinStates(false);
788
+// oe.treePanel.add(commandsPanel);
789
+// oe.treePanel.Return();
643790
644791 // oe.aConstraints.gridx += 1;
645792 // oe.aConstraints.weighty = 0;
....@@ -656,27 +803,12 @@
656803
657804 JScrollPane jSP;
658805 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
659
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
806
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
660807 ResetModel();
661808
662809 oe.treePanel.add(jSPPanel);
663810 oe.treePanel.Return();
664811
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;
680812 oe.treePanel.add(copyOptionsPanel);
681813 oe.treePanel.Return();
682814
....@@ -707,12 +839,26 @@
707839
708840 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
709841 {
842
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
843
+ colorCB.setToolTipText("Copy color when dropped");
844
+ colorCB.addItemListener(this);
845
+
846
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
847
+ materialCB.setToolTipText("Copy material when dropped");
848
+ materialCB.addItemListener(this);
849
+
850
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
851
+ textureCB.setToolTipText("Copy texture when dropped");
852
+ textureCB.addItemListener(this);
853
+
854
+ panel.Return();
855
+
710856 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
711857 boxCB.setToolTipText("Display bounding boxes");
712858 boxCB.addItemListener(this);
713859
714860 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
715
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
861
+ zoomBoxCB.setToolTipText("Display only for wheel");
716862 zoomBoxCB.addItemListener(this);
717863
718864 if (true) // Globals.ADVANCED)
....@@ -724,6 +870,8 @@
724870 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
725871 // localCB.addItemListener(this);
726872
873
+ panel.Return();
874
+
727875 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
728876 crowdCB.setToolTipText("Used for crowds");
729877 crowdCB.addItemListener(this);
....@@ -740,6 +888,8 @@
740888 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
741889 // speakerMocapCB.addItemListener(this);
742890
891
+ panel.Return();
892
+
743893 if (false)
744894 {
745895 // handled in scripts
....@@ -754,32 +904,72 @@
754904 //constraints.gridy += 1;
755905 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
756906 smoothfocusCB.addItemListener(this);
907
+ panel.Return();
757908 }
758909
759910 //constraints.gridx += 1;
760911 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
761912 // debugCB.addItemListener(this);
762913
914
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
915
+ trackCB.setToolTipText("Enable tracking target");
916
+ trackCB.addItemListener(this);
917
+
763918 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
919
+ oeilCB.setToolTipText("Move camera when tracking");
764920 oeilCB.addItemListener(this);
765921
922
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
923
+ shadowCB.setToolTipText("When live compute shadows");
924
+ shadowCB.addItemListener(this);
925
+
926
+ panel.Return();
927
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
928
+ toggleTextureCB.setToolTipText("Load textures");
929
+ toggleTextureCB.addItemListener(this);
930
+
931
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
932
+ toggleSwitchCB.setToolTipText("Use switch");
933
+ toggleSwitchCB.addItemListener(this);
934
+
935
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
936
+ autosaveCB.setToolTipText("On structure change");
937
+ autosaveCB.addItemListener(this);
938
+
939
+ panel.Return();
940
+ if (Globals.ADVANCED)
941
+ {
766942 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
767943 lookAtCB.setToolTipText("Look-at target");
768944 lookAtCB.addItemListener(this);
945
+ }
769946
770947 }
771948
772949 cGridBag fill = new cGridBag();
773
-
774950 fill.preferredHeight = 200;
951
+ cGridBag fill2 = new cGridBag();
952
+ fill2.preferredHeight = 200;
953
+ cGridBag fill3 = new cGridBag();
954
+ fill3.preferredHeight = 200;
775955
776956 panel.add(fill);
957
+ panel.add(fill2);
958
+ panel.add(fill3);
777959
778960 }
779961
780962 void EditObject(Object3D obj)
781963 {
782964 cRadio radioButton = new cRadio(obj.name);
965
+
966
+ // Patch to avoid bug with transparency.
967
+ radioButton.hadMaterial = obj.material != null;
968
+ if (!radioButton.hadMaterial)
969
+ {
970
+ obj.material = new cMaterial();
971
+ }
972
+
783973 radioButton.SetObject(obj);
784974 radioButton.layout = sevenButton;
785975 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -791,6 +981,8 @@
791981
792982 void SetupViews(ObjEditor oe)
793983 {
984
+ theFrame = this;
985
+
794986 oe.SetupViews();
795987
796988 System.out.println("SetupViews");
....@@ -799,23 +991,27 @@
799991 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
800992 }
801993
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;
994
+ cToggleButton liveCB;
995
+ cCheckBox supportCB;
996
+ cCheckBox localCB;
997
+ cCheckBox crowdCB;
998
+ cCheckBox smoothCB;
999
+ cToggleButton fastCB;
1000
+ cCheckBox slowCB;
1001
+ cCheckBox boxCB;
1002
+ cCheckBox zoomBoxCB;
1003
+ //cToggleButton trackCB;
1004
+ cCheckBox trackCB;
1005
+ cCheckBox smoothfocusCB;
8131006 // JCheckBox speakerMocapCB;
814
- JCheckBox speakerCameraCB;
815
- JCheckBox speakerFocusCB;
816
- JCheckBox debugCB;
817
- JCheckBox oeilCB;
818
- JCheckBox lookAtCB;
1007
+ cCheckBox speakerCameraCB;
1008
+ cCheckBox speakerFocusCB;
1009
+ cCheckBox debugCB;
1010
+
1011
+ cCheckBox oeilCB;
1012
+ cCheckBox shadowCB;
1013
+ cCheckBox autosaveCB;
1014
+ cCheckBox lookAtCB;
8191015
8201016 // static int COLOR = 1;
8211017 // static int MATERIAL = 2;
....@@ -823,9 +1019,9 @@
8231019
8241020 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8251021
826
- JCheckBox colorCB;
827
- JCheckBox materialCB;
828
- JCheckBox textureCB;
1022
+ cCheckBox colorCB;
1023
+ cCheckBox materialCB;
1024
+ cCheckBox textureCB;
8291025
8301026 public void itemStateChanged(ItemEvent e)
8311027 {
....@@ -853,6 +1049,7 @@
8531049 } else if(e.getSource() == liveCB)
8541050 {
8551051 cameraView.ToggleLive();
1052
+ refreshContents(false);
8561053 }
8571054 else if(e.getSource() == supportCB)
8581055 {
....@@ -917,6 +1114,14 @@
9171114 {
9181115 cameraView.ToggleOeil();
9191116 }
1117
+ else if(e.getSource() == shadowCB)
1118
+ {
1119
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1120
+ }
1121
+ else if(e.getSource() == autosaveCB)
1122
+ {
1123
+ Globals.SAVEONMAKE ^= true;
1124
+ }
9201125 else if(e.getSource() == lookAtCB)
9211126 {
9221127 cameraView.ToggleLookAt();
....@@ -933,7 +1138,8 @@
9331138
9341139 /**/
9351140 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
936
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1141
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1142
+ TreePath path = objEditor.jTree.getSelectionPath();
9371143 if ((path == null) || (path.getPathCount() <= 1)) {
9381144 // We can't move the root node or an empty selection
9391145 return;
....@@ -1050,23 +1256,33 @@
10501256
10511257 assert target == objEditor.jTree;
10521258 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1259
+ Object3D destinationLeaf;
10531260 try {
1054
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1261
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10551262 } catch (Exception e) {
10561263 System.out.println("destinationPath : " + destinationPath);
10571264 return;
10581265 }
10591266
1060
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1267
+ for (int i=group.selection.size(); --i>=0;)
10611268 {
1269
+ Object3D child = (Object3D)group.selection.elementAt(i);
1270
+
1271
+ // Cannot move into itself
1272
+ if (child == destinationLeaf)
1273
+ return;
1274
+ }
1275
+
1276
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1277
+// {
10621278 loadClipboard(true);
10631279 objEditor.jTree.setSelectionPath(destinationPath);
10641280 pasteInto(false, false);
1065
- } else {
1066
- loadClipboard(false);
1067
- objEditor.jTree.setSelectionPath(destinationPath);
1068
- pasteInto(false, false); // true); // ???
1069
- }
1281
+// } else {
1282
+// loadClipboard(false);
1283
+// objEditor.jTree.setSelectionPath(destinationPath);
1284
+// pasteInto(false, false); // true); // ???
1285
+// }
10701286 }
10711287 public void dropActionChanged(DropTargetDragEvent dtde)
10721288 // Called if the user has modified the current drop gesture
....@@ -1171,22 +1387,30 @@
11711387 {
11721388 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11731389 //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);
1390
+// gridItem = menu.add(new MenuItem("Grid"));
1391
+// gridItem.addActionListener(this);
1392
+// rectoidItem = menu.add(new MenuItem("Box"));
1393
+// rectoidItem.addActionListener(this);
1394
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1395
+// ellipsoidItem.addActionListener(this);
1396
+// coneItem = menu.add(new MenuItem("Cone"));
1397
+// coneItem.addActionListener(this);
1398
+// torusItem = menu.add(new MenuItem("Torus"));
1399
+// torusItem.addActionListener(this);
1400
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1401
+// superItem.addActionListener(this);
1402
+
1403
+ cameraItem = menu.add(new MenuItem("Camera"));
1404
+ cameraItem.addActionListener(this);
1405
+
1406
+ if (!Globals.ADVANCED)
1407
+ {
11861408 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11871409 kleinItem.addActionListener(this);
1188
- particleItem = menu.add(new MenuItem("Particle system"));
1189
- particleItem.addActionListener(this);
1410
+ }
1411
+
1412
+// particleItem = menu.add(new MenuItem("Particle system"));
1413
+// particleItem.addActionListener(this);
11901414 if (Globals.ADVANCED)
11911415 {
11921416 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1212,15 +1436,15 @@
12121436 }
12131437 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12141438 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);
1439
+// overlayItem = menu.add(new MenuItem("Overlay"));
1440
+// overlayItem.addActionListener(this);
1441
+// lightItem = menu.add(new MenuItem("Light"));
1442
+// lightItem.addActionListener(this);
12191443 menu.add("-");
12201444 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12211445 //superLoopItem.addActionListener(this);
1222
- loopItem = menu.add(new MenuItem("Loop"));
1223
- loopItem.addActionListener(this);
1446
+// loopItem = menu.add(new MenuItem("Loop"));
1447
+// loopItem.addActionListener(this);
12241448 doubleItem = menu.add(new MenuItem("Fork"));
12251449 doubleItem.addActionListener(this);
12261450 if (Globals.ADVANCED)
....@@ -1260,7 +1484,7 @@
12601484 memoryItem.addActionListener(this);
12611485 menu.add(analyzeItem = new MenuItem("Analyze"));
12621486 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1487
+ menu.add(dumpItem = new MenuItem("Print"));
12641488 dumpItem.addActionListener(this);
12651489 // menu.add(pathItem = new MenuItem("From-to path"));
12661490 // pathItem.addActionListener(this);
....@@ -1401,9 +1625,24 @@
14011625 shadow.material = new cMaterial(obj.material);
14021626 shadow.material.diffuse = 0.0001f;
14031627 shadow.material.specular = 0.0001f;
1628
+ //shadow.projectedVertices[1].x = 300;
14041629
14051630 makeSomething(shadow);
14061631 }
1632
+
1633
+ private void ClearUnpinned()
1634
+ {
1635
+ //for (Object3D obj : listUI)
1636
+ for (int i=listUI.size(); --i>=0;)
1637
+ {
1638
+ Object3D obj = listUI.elementAt(i);
1639
+ if (!obj.pinned)
1640
+ {
1641
+ obj.CloseUI();
1642
+ listUI.remove(i);
1643
+ }
1644
+ }
1645
+ }
14071646
14081647 /**
14091648 * applyExample
....@@ -1648,7 +1887,7 @@
16481887 {
16491888 ScreenFit();
16501889 } else
1651
- if (source == switchItem)
1890
+ if (source == switchViewItem)
16521891 {
16531892 cVector v1 = new cVector();
16541893 cVector v2 = new cVector();
....@@ -1657,11 +1896,11 @@
16571896 objEditor.cameraView.renderCamera.setAim(v2, v1);
16581897 objEditor.cameraView.repaint();
16591898 } else
1660
- if (source == rectoidItem)
1899
+ if (source == rectoidItem || source == boxButton)
16611900 {
16621901 makeSomething(new Box());
16631902 } else
1664
- if (source == particleItem)
1903
+ if (source == particleItem || source == particlesButton)
16651904 {
16661905 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16671906 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1740,27 +1979,27 @@
17401979
17411980 makeSomething(obj);
17421981 } else
1743
- if (source == gridItem)
1982
+ if (source == gridItem || source == gridButton)
17441983 {
17451984 makeSomething(new Grid());
17461985 } else
1747
- if (source == ellipsoidItem)
1986
+ if (source == ellipsoidItem || source == sphereButton)
17481987 {
17491988 makeSomething(new Sphere());
17501989 } else
1751
- if (source == coneItem)
1990
+ if (source == coneItem || source == coneButton)
17521991 {
17531992 makeSomething(new Cone());
17541993 } else
1755
- if (source == torusItem)
1994
+ if (source == torusItem || source == torusButton)
17561995 {
17571996 makeSomething(new Torus());
17581997 } else
1759
- if (source == superItem)
1998
+ if (source == superItem || source == superButton)
17601999 {
17612000 makeSomething(new Superellipsoid());
17622001 } else
1763
- if (source == kleinItem)
2002
+ if (source == kleinItem || source == kleinButton)
17642003 {
17652004 makeSomething(new Klein());
17662005 } else
....@@ -1780,7 +2019,7 @@
17802019 {
17812020 makeSomething(new BezierSurface());
17822021 } else
1783
- if (source == overlayItem)
2022
+ if (source == overlayItem || source == overlayButton)
17842023 {
17852024 /*
17862025 Object3D obj = new BezierSurface(5,8);
....@@ -1828,7 +2067,7 @@
18282067 s.setup();
18292068 makeSomething(s);
18302069 } else
1831
- if (source == lightItem)
2070
+ if (source == lightItem || source == lightButton)
18322071 {
18332072 makeSomething(new Light());
18342073 } else
....@@ -1878,7 +2117,7 @@
18782117
18792118 group(g);
18802119 } else
1881
- if (source == loopItem)
2120
+ if (source == loopItem || source == loopButton)
18822121 {
18832122 Composite csg = new GroupLeaf();
18842123 csg.count = 5;
....@@ -1951,6 +2190,30 @@
19512190 {
19522191 DumpObject();
19532192 } else
2193
+ if (source == minButton)
2194
+ {
2195
+ Minimize();
2196
+ } else
2197
+ if (source == maxButton)
2198
+ {
2199
+ Maximize();
2200
+ } else
2201
+ if (source == fullButton)
2202
+ {
2203
+ ToggleFullScreen();
2204
+ } else
2205
+ if (source == undoButton)
2206
+ {
2207
+ Undo();
2208
+ } else
2209
+ if (source == redoButton)
2210
+ {
2211
+ Redo();
2212
+ } else
2213
+ if (source == saveButton)
2214
+ {
2215
+ Save();
2216
+ } else
19542217 if (source == oneStepButton)
19552218 {
19562219 Globals.ONESTEP = true;
....@@ -2004,6 +2267,14 @@
20042267 if (source == cutItem || source == clearButton)
20052268 {
20062269 loadClipboard(true);
2270
+ } else
2271
+ if (source == undoItem)
2272
+ {
2273
+ Undo();
2274
+ } else
2275
+ if (source == redoItem)
2276
+ {
2277
+ Redo();
20072278 } else
20082279 if (source == duplicateItem)
20092280 {
....@@ -2336,9 +2607,9 @@
23362607 {
23372608 ClearSelection(true);
23382609 } else
2339
- if (source == grabItem)
2610
+ if (source == grabItem || source == groupButton)
23402611 {
2341
- group(new cGroup(), true);
2612
+ group(new cGroup(), false); // true);
23422613 } else
23432614 if (source == hideItem)
23442615 {
....@@ -2356,11 +2627,11 @@
23562627 {
23572628 makeSomething(new Camera());
23582629 } else
2359
- if (source == compositeItem)
2630
+ if (source == compositeItem || source == compositeButton)
23602631 {
23612632 group(new Composite());
23622633 } else
2363
- if (source == randomItem)
2634
+ if (source == switchItem || source == switchButton)
23642635 {
23652636 RandomNode random = new RandomNode();
23662637 group(random);
....@@ -2462,7 +2733,7 @@
24622733 {
24632734 group(new cLinker());
24642735 } else
2465
- if (source == textureItem)
2736
+ if (source == textureItem || source == textureButton)
24662737 {
24672738 group(new TextureNode());
24682739 } else
....@@ -2482,7 +2753,7 @@
24822753 {
24832754 CastShadow(2);
24842755 } else
2485
- if (source == ungroupItem)
2756
+ if (source == ungroupItem || source == ungroupButton)
24862757 {
24872758 //ungroup();
24882759 for (int i=0; i<group.selection.size(); i++)
....@@ -2504,7 +2775,7 @@
25042775 } else
25052776 if (source == genNormalsMESHItem)
25062777 {
2507
- GenNormals(true); // TODO
2778
+ GenNormalsMESH();
25082779 } else
25092780 if (source == genNormalsORGANItem)
25102781 {
....@@ -2569,6 +2840,22 @@
25692840 if (source == unmarkleavesItem)
25702841 {
25712842 MarkLeaves(false);
2843
+ } else
2844
+ if (source == rewindleavesItem)
2845
+ {
2846
+ RewindLeaves(true);
2847
+ } else
2848
+ if (source == unrewindleavesItem)
2849
+ {
2850
+ RewindLeaves(false);
2851
+ } else
2852
+ if (source == randomleavesItem)
2853
+ {
2854
+ RandomLeaves(true);
2855
+ } else
2856
+ if (source == unrandomleavesItem)
2857
+ {
2858
+ RandomLeaves(false);
25722859 } else
25732860 if (source == flipVItem)
25742861 {
....@@ -2804,6 +3091,10 @@
28043091 if (source == twoButton)
28053092 {
28063093 radio.layout = twoButton;
3094
+
3095
+ if (CameraPane.FULLSCREEN)
3096
+ fullscreenLayout = radio.layout;
3097
+
28073098 // bug
28083099 //gridPanel.setDividerLocation(1.0);
28093100 //bigPanel.setDividerLocation(0.0);
....@@ -2836,10 +3127,31 @@
28363127 bigThree.ClearUI();
28373128 bigThree.add(centralPanel);
28383129 bigThree.FlushUI();
3130
+
3131
+ cameraView.requestFocusInWindow();
3132
+
3133
+// refreshContents(true);
3134
+//
3135
+// try
3136
+// {
3137
+// java.awt.Robot bot = new java.awt.Robot();
3138
+// int mask = InputEvent.BUTTON1_MASK;
3139
+// bot.mouseMove(100, 100);
3140
+// bot.mousePress(mask);
3141
+// bot.mouseRelease(mask);
3142
+// }
3143
+// catch (Exception e)
3144
+// {
3145
+//
3146
+// }
3147
+
28393148 } else
28403149 if (source == threeButton)
28413150 {
28423151 radio.layout = threeButton;
3152
+
3153
+ if (CameraPane.FULLSCREEN)
3154
+ fullscreenLayout = radio.layout;
28433155
28443156 // bigThree.remove(scenePanel);
28453157 // bigThree.remove(centralPanel);
....@@ -2872,10 +3184,15 @@
28723184 bigThree.add(centralPanel);
28733185 bigThree.add(XYZPanel);
28743186 bigThree.FlushUI();
3187
+
3188
+ cameraView.requestFocusInWindow();
28753189 } else
28763190 if (source == fourButton)
28773191 {
28783192 radio.layout = fourButton;
3193
+
3194
+ if (CameraPane.FULLSCREEN)
3195
+ fullscreenLayout = radio.layout;
28793196
28803197 // bigThree.remove(scenePanel);
28813198 // bigThree.remove(centralPanel);
....@@ -2907,10 +3224,15 @@
29073224 bigThree.ClearUI();
29083225 bigThree.add(scenePanel);
29093226 bigThree.FlushUI();
3227
+
3228
+ cameraView.requestFocusInWindow();
29103229 } else
29113230 if (source == sixButton)
29123231 {
29133232 radio.layout = sixButton;
3233
+
3234
+ if (CameraPane.FULLSCREEN)
3235
+ fullscreenLayout = radio.layout;
29143236
29153237 // bigThree.remove(scenePanel);
29163238 // bigThree.remove(centralPanel);
....@@ -2943,10 +3265,15 @@
29433265 bigThree.add(scenePanel);
29443266 bigThree.add(centralPanel);
29453267 bigThree.FlushUI();
3268
+
3269
+ cameraView.requestFocusInWindow();
29463270 } else
29473271 if (source == sevenButton)
29483272 {
29493273 radio.layout = sevenButton;
3274
+
3275
+ if (CameraPane.FULLSCREEN)
3276
+ fullscreenLayout = radio.layout;
29503277
29513278 // bigThree.remove(scenePanel);
29523279 // bigThree.remove(centralPanel);
....@@ -2980,6 +3307,8 @@
29803307 bigThree.add(centralPanel);
29813308 bigThree.add(XYZPanel);
29823309 bigThree.FlushUI();
3310
+
3311
+ cameraView.requestFocusInWindow();
29833312 } else
29843313 if (source == rootButton)
29853314 {
....@@ -2991,6 +3320,7 @@
29913320 EditObject(obj);
29923321 }
29933322
3323
+ cameraView.requestFocusInWindow();
29943324 refreshContents(true);
29953325 } else
29963326 if (source == closeButton)
....@@ -3000,22 +3330,37 @@
30003330 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30013331 {
30023332 ab = (cRadio)e.nextElement();
3003
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3333
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30043334 {
3335
+ // Patch to avoid bug with transparency.
3336
+ if (!ab.hadMaterial)
3337
+ {
3338
+ ab.object.material = null;
3339
+ }
3340
+
30053341 buttonGroup.remove(ab);
30063342 radioPanel.remove(ab);
30073343
3008
- ab.GetObject().editWindow = null;
3344
+ //ab.GetObject().editWindow = null;
3345
+ ab.GetObject().manipWindow = null;
30093346 // ab.GetObject().objectUI = null; // ?????????
30103347
30113348 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30123349 break;
30133350 }
30143351 }
3352
+
3353
+ cameraView.requestFocusInWindow();
30153354 refreshContents(true);
30163355 } else
30173356 if (source == editItem || source == editButton)
30183357 {
3358
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3359
+ {
3360
+ Object3D child = (Object3D)e.nextElement();
3361
+ child.pinned = true;
3362
+ }
3363
+
30193364 EditSelection(false);
30203365 } else
30213366 if (source == uneditButton)
....@@ -3025,10 +3370,11 @@
30253370 Object3D child = (Object3D)e.nextElement();
30263371 if(child.editWindow != null)
30273372 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3373
+ child.pinned = false;
30283374 child.CloseUI();
30293375 listUI.remove(child);
30303376
3031
- child.editWindow = null; // ???????????
3377
+ //child.editWindow = null; // ???????????
30323378 }
30333379 objEditor.ctrlPanel.FlushUI();
30343380 //objEditor.jTree.clearSelection();
....@@ -3041,6 +3387,7 @@
30413387 //copy.ClearUI();
30423388 for (Object3D obj : listUI)
30433389 {
3390
+ obj.pinned = false;
30443391 obj.CloseUI();
30453392 }
30463393 listUI.clear();
....@@ -3050,7 +3397,7 @@
30503397 {
30513398 assert(copy == group);
30523399
3053
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3400
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30543401
30553402 for (Object3D obj : listUI)
30563403 {
....@@ -3115,7 +3462,9 @@
31153462 sideView.object = group;
31163463 }
31173464
3118
-// fix "+" issue group.editWindow = this;
3465
+// fix "+" issue
3466
+ //group.editWindow = this;
3467
+ group.manipWindow = this;
31193468
31203469 /*
31213470 currentLayout = radio.layout;
....@@ -3123,18 +3472,25 @@
31233472 currentLayout = sevenButton;
31243473 */
31253474 radio.layout.doClick();
3475
+
3476
+ ClearUnpinned();
3477
+ SetPinStates(group.selection.size() > 0);
3478
+ if (group.selection.size() == 1)
3479
+ EditSelection(false);
31263480 keepparent = group.parent;
31273481 // PARENT = NULL or not???
31283482 //group.parent = null; // ROOT
31293483 //group.attributes = -1;
31303484 ResetModel();
3485
+
3486
+ cameraView.requestFocusInWindow();
31313487 refreshContents(true);
31323488 } else if (event.getSource() == editCameraItem)
31333489 {
31343490 cameraView.ProtectCamera();
31353491 cameraView.repaint();
31363492 return;
3137
- } else if (event.getSource() == revertCameraItem)
3493
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31383494 {
31393495 cameraView.RevertCamera();
31403496 cameraView.repaint();
....@@ -3151,7 +3507,6 @@
31513507 }
31523508
31533509 boolean useclient = false;
3154
- cRadio radio;
31553510
31563511 void ToggleRoot()
31573512 {
....@@ -3390,7 +3745,8 @@
33903745
33913746 int size = obj.MemorySize();
33923747
3393
- System.err.println((size/1024) + " KB is the size of " + obj);
3748
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3749
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33943750 }
33953751 }
33963752 catch (Exception e)
....@@ -3471,6 +3827,13 @@
34713827 void GenNormals(boolean crease)
34723828 {
34733829 group.GenNormalsS(crease);
3830
+
3831
+ refreshContents();
3832
+ }
3833
+
3834
+ void GenNormalsMESH()
3835
+ {
3836
+ group.GenNormalsMeshS();
34743837
34753838 refreshContents();
34763839 }
....@@ -4098,6 +4461,18 @@
40984461 refreshContents();
40994462 }
41004463
4464
+ void RewindLeaves(boolean hide)
4465
+ {
4466
+ group.selection.RewindLeaves(hide);
4467
+ refreshContents();
4468
+ }
4469
+
4470
+ void RandomLeaves(boolean hide)
4471
+ {
4472
+ group.selection.RandomLeaves(hide);
4473
+ refreshContents();
4474
+ }
4475
+
41014476 void SetTexRes(int tr)
41024477 {
41034478 group.selection.SetTexRes(tr);
....@@ -4169,10 +4544,6 @@
41694544 // }
41704545 // }
41714546
4172
- static boolean allparams = true;
4173
-
4174
- static Vector<Object3D> listUI = new Vector<Object3D>();
4175
-
41764547 void EditSelection(boolean newWindow)
41774548 {
41784549 // aConstraints.gridy = 0;
....@@ -4180,7 +4551,7 @@
41804551 {
41814552 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41824553 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4554
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41844555
41854556 Object3D elem = (Object3D)group.selection.elementAt(i);
41864557 if(elem != group || !newWindow)
....@@ -4265,7 +4636,8 @@
42654636 //new Exception().printStackTrace();
42664637
42674638 freezemodel = true;
4268
-
4639
+ ClearUnpinned();
4640
+
42694641 /**/
42704642 //switch (event.id)
42714643 {
....@@ -4273,7 +4645,6 @@
42734645 //case 702: // Event.LIST_DESELECT
42744646 group.deselectAll();
42754647 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774648 if (tps != null)
42784649 {
42794650 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4653,8 @@
42824653
42834654 //if (child.parent != null)
42844655 //child.parent.addSelectee(child);
4656
+ objEditor.SetMaterial(child);
42854657 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894658 }
42904659 }
42914660 // else
....@@ -4295,20 +4664,28 @@
42954664 // System.err.println("info : " + group.GetPath());
42964665 // }
42974666
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4667
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014668 CameraPane.flash = true;
43024669
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4670
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044671 // a camera
43054672 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4673
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4674
+ {
4675
+ CameraPane.camerachangeframe = 0; // don't refuse it
4676
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4677
+ }
43084678 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094679 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104680 }
43114681
4682
+ if (tps != null && tps.length == 1)
4683
+ {
4684
+ EditSelection(false);
4685
+ }
4686
+
4687
+ SetPinStates(tps != null && tps.length > 0);
4688
+
43124689 refreshContents();
43134690 //return true;
43144691 }
....@@ -4317,6 +4694,35 @@
43174694
43184695 freezemodel = false;
43194696 }
4697
+
4698
+ void SetPinStates(boolean enabled)
4699
+ {
4700
+ editButton.setEnabled(enabled);
4701
+ uneditButton.setEnabled(enabled);
4702
+ unselectButton.setEnabled(enabled);
4703
+ flashSelectionButton.setEnabled(enabled);
4704
+ }
4705
+
4706
+ void refreshContents(boolean cp)
4707
+ {
4708
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4709
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4710
+ {
4711
+ objEditor.ClearInfo(); // .GetMaterial());
4712
+
4713
+ for (int i=0; i < group.selection.Size(); i++)
4714
+ {
4715
+ Object3D child = (Object3D) group.selection.get(i);
4716
+
4717
+ objEditor.AddInfo(child, this, true);
4718
+ System.err.println("info : " + child.GetPath());
4719
+ }
4720
+
4721
+ objEditor.SetText(); // jan 2014
4722
+ }
4723
+
4724
+ super.refreshContents(cp);
4725
+ }
43204726
43214727 void linkSomething(Object3D thing)
43224728 {
....@@ -4388,6 +4794,7 @@
43884794 {
43894795 if (group.selection.isEmpty())
43904796 return;
4797
+
43914798 Grafreed.clipboardIsTempGroup = false;
43924799 Composite tGroup = null;
43934800 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4805,8 @@
43984805
43994806 if (cut)
44004807 {
4808
+ if (Globals.SAVEONMAKE)
4809
+ Save();
44014810 //int indices[] = jList.getSelectedIndices();
44024811 //for (int i = indices.length - 1; i >= 0; i--)
44034812 //jList.remove(indices[i]);
....@@ -4487,8 +4896,10 @@
44874896 }
44884897
44894898 }
4899
+
44904900 if (Grafreed.clipboardIsTempGroup)
44914901 Grafreed.clipboard = tGroup;
4902
+
44924903 if (cut)
44934904 {
44944905 ResetModel();
....@@ -5113,7 +5524,31 @@
51135524 cButton clearpanelButton;
51145525 cButton unselectButton;
51155526
5527
+ cButton restoreCameraButton;
5528
+
5529
+ cButton minButton;
5530
+ cButton maxButton;
5531
+ cButton fullButton;
5532
+ cButton saveButton;
51165533 cButton oneStepButton;
5534
+
5535
+ cButton groupButton;
5536
+ cButton ungroupButton;
5537
+ cButton compositeButton;
5538
+ cButton switchButton;
5539
+ cButton loopButton;
5540
+ cButton textureButton;
5541
+
5542
+ cButton gridButton;
5543
+ cButton boxButton;
5544
+ cButton sphereButton;
5545
+ cButton coneButton;
5546
+ cButton torusButton;
5547
+ cButton superButton;
5548
+ cButton kleinButton;
5549
+ cButton particlesButton;
5550
+ cButton overlayButton;
5551
+ cButton lightButton;
51175552
51185553 cButton screenfitButton;
51195554 cButton screenfitpointButton;
....@@ -5126,14 +5561,6 @@
51265561
51275562 cButton setsupportButton;
51285563
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
-
51375564 //
51385565 //Composite
51395566 Object3D // to do !!
....@@ -5143,9 +5570,11 @@
51435570 //JTree jTree;
51445571 private MenuItem lookAtItem;
51455572 private MenuItem lookFromItem;
5146
- private MenuItem switchItem;
5573
+ private MenuItem switchViewItem;
51475574 private MenuItem cutItem;
5148
- private MenuItem duplicateItem;
5575
+ private MenuItem undoItem;
5576
+ private MenuItem redoItem;
5577
+ private JMenuItem duplicateItem;
51495578 private MenuItem cloneItem;
51505579 private MenuItem cloneSupportItem;
51515580 private MenuItem overwriteGeoItem;
....@@ -5208,6 +5637,10 @@
52085637 private MenuItem showleavesItem;
52095638 private MenuItem markleavesItem;
52105639 private MenuItem unmarkleavesItem;
5640
+ private MenuItem rewindleavesItem;
5641
+ private MenuItem unrewindleavesItem;
5642
+ private MenuItem randomleavesItem;
5643
+ private MenuItem unrandomleavesItem;
52115644
52125645 private MenuItem flipVItem;
52135646 private MenuItem unflipVItem;
....@@ -5229,7 +5662,7 @@
52295662 private MenuItem frontItem;
52305663 private MenuItem cameraItem;
52315664 private MenuItem compositeItem;
5232
- private MenuItem randomItem;
5665
+ private MenuItem switchItem;
52335666 private MenuItem physicsItem;
52345667 private MenuItem frameselectorItem;
52355668 private MenuItem scriptNodeItem;
....@@ -5303,5 +5736,5 @@
53035736
53045737 Menu cameraMenu;
53055738 MenuItem editCameraItem;
5306
- MenuItem revertCameraItem;
5739
+ MenuItem restoreCameraItem;
53075740 }