Normand Briere
2019-06-29 a69bb4474a3264a9a7a7f8b8d8154ea771f167c8
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,23 +204,23 @@
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("-");
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);
207222
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);
215
-
216
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
217224 toggleHandleItem.addItemListener(this);
218225 toggleHandleItem.setState(CameraPane.HANDLES);
219226
....@@ -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 = 1;
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 item switcher");
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,23 +839,43 @@
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)
719865 {
720
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
721
- supportCB.setToolTipText("Enable rigging");
722
- supportCB.addItemListener(this);
866
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
867
+// supportCB.setToolTipText("Enable rigging");
868
+// supportCB.addItemListener(this);
869
+
870
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
871
+ freezeCB.setToolTipText("Fast moving camera");
872
+ freezeCB.addItemListener(this);
723873
724874 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
725875 // localCB.addItemListener(this);
726876
877
+ panel.Return();
878
+
727879 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
728880 crowdCB.setToolTipText("Used for crowds");
729881 crowdCB.addItemListener(this);
....@@ -740,6 +892,8 @@
740892 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
741893 // speakerMocapCB.addItemListener(this);
742894
895
+ panel.Return();
896
+
743897 if (false)
744898 {
745899 // handled in scripts
....@@ -754,32 +908,72 @@
754908 //constraints.gridy += 1;
755909 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
756910 smoothfocusCB.addItemListener(this);
911
+ panel.Return();
757912 }
758913
759914 //constraints.gridx += 1;
760915 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
761916 // debugCB.addItemListener(this);
762917
918
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
919
+ trackCB.setToolTipText("Enable tracking target");
920
+ trackCB.addItemListener(this);
921
+
763922 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
923
+ oeilCB.setToolTipText("Move camera when tracking");
764924 oeilCB.addItemListener(this);
765925
926
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
927
+ shadowCB.setToolTipText("When live compute shadows");
928
+ shadowCB.addItemListener(this);
929
+
930
+ panel.Return();
931
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
932
+ toggleTextureCB.setToolTipText("Load textures");
933
+ toggleTextureCB.addItemListener(this);
934
+
935
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
936
+ toggleSwitchCB.setToolTipText("Choose a single item");
937
+ toggleSwitchCB.addItemListener(this);
938
+
939
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
940
+ autosaveCB.setToolTipText("On structure change");
941
+ autosaveCB.addItemListener(this);
942
+
943
+ panel.Return();
944
+ if (Globals.ADVANCED)
945
+ {
766946 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
767947 lookAtCB.setToolTipText("Look-at target");
768948 lookAtCB.addItemListener(this);
949
+ }
769950
770951 }
771952
772953 cGridBag fill = new cGridBag();
773
-
774954 fill.preferredHeight = 200;
955
+ cGridBag fill2 = new cGridBag();
956
+ fill2.preferredHeight = 200;
957
+ cGridBag fill3 = new cGridBag();
958
+ fill3.preferredHeight = 200;
775959
776960 panel.add(fill);
961
+ panel.add(fill2);
962
+ panel.add(fill3);
777963
778964 }
779965
780966 void EditObject(Object3D obj)
781967 {
782968 cRadio radioButton = new cRadio(obj.name);
969
+
970
+ // Patch to avoid bug with transparency.
971
+ radioButton.hadMaterial = obj.material != null;
972
+ if (!radioButton.hadMaterial)
973
+ {
974
+ obj.material = new cMaterial();
975
+ }
976
+
783977 radioButton.SetObject(obj);
784978 radioButton.layout = sevenButton;
785979 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -791,6 +985,8 @@
791985
792986 void SetupViews(ObjEditor oe)
793987 {
988
+ theFrame = this;
989
+
794990 oe.SetupViews();
795991
796992 System.out.println("SetupViews");
....@@ -799,23 +995,28 @@
799995 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
800996 }
801997
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;
998
+ cToggleButton liveCB;
999
+ cCheckBox supportCB;
1000
+ cCheckBox localCB;
1001
+ cCheckBox crowdCB;
1002
+ cCheckBox smoothCB;
1003
+ cToggleButton fastCB;
1004
+ cCheckBox slowCB;
1005
+ cCheckBox boxCB;
1006
+ cCheckBox zoomBoxCB;
1007
+ cCheckBox freezeCB;
1008
+ //cToggleButton trackCB;
1009
+ cCheckBox trackCB;
1010
+ cCheckBox smoothfocusCB;
8131011 // JCheckBox speakerMocapCB;
814
- JCheckBox speakerCameraCB;
815
- JCheckBox speakerFocusCB;
816
- JCheckBox debugCB;
817
- JCheckBox oeilCB;
818
- JCheckBox lookAtCB;
1012
+ cCheckBox speakerCameraCB;
1013
+ cCheckBox speakerFocusCB;
1014
+ cCheckBox debugCB;
1015
+
1016
+ cCheckBox oeilCB;
1017
+ cCheckBox shadowCB;
1018
+ cCheckBox autosaveCB;
1019
+ cCheckBox lookAtCB;
8191020
8201021 // static int COLOR = 1;
8211022 // static int MATERIAL = 2;
....@@ -823,9 +1024,9 @@
8231024
8241025 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8251026
826
- JCheckBox colorCB;
827
- JCheckBox materialCB;
828
- JCheckBox textureCB;
1027
+ cCheckBox colorCB;
1028
+ cCheckBox materialCB;
1029
+ cCheckBox textureCB;
8291030
8301031 public void itemStateChanged(ItemEvent e)
8311032 {
....@@ -853,6 +1054,7 @@
8531054 } else if(e.getSource() == liveCB)
8541055 {
8551056 cameraView.ToggleLive();
1057
+ refreshContents(false);
8561058 }
8571059 else if(e.getSource() == supportCB)
8581060 {
....@@ -917,6 +1119,18 @@
9171119 {
9181120 cameraView.ToggleOeil();
9191121 }
1122
+ else if(e.getSource() == shadowCB)
1123
+ {
1124
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1125
+ }
1126
+ else if(e.getSource() == freezeCB)
1127
+ {
1128
+ Globals.FREEZEONMOVE ^= true;
1129
+ }
1130
+ else if(e.getSource() == autosaveCB)
1131
+ {
1132
+ Globals.SAVEONMAKE ^= true;
1133
+ }
9201134 else if(e.getSource() == lookAtCB)
9211135 {
9221136 cameraView.ToggleLookAt();
....@@ -933,7 +1147,8 @@
9331147
9341148 /**/
9351149 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
936
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1150
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1151
+ TreePath path = objEditor.jTree.getSelectionPath();
9371152 if ((path == null) || (path.getPathCount() <= 1)) {
9381153 // We can't move the root node or an empty selection
9391154 return;
....@@ -1050,23 +1265,33 @@
10501265
10511266 assert target == objEditor.jTree;
10521267 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1268
+ Object3D destinationLeaf;
10531269 try {
1054
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1270
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10551271 } catch (Exception e) {
10561272 System.out.println("destinationPath : " + destinationPath);
10571273 return;
10581274 }
10591275
1060
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1276
+ for (int i=group.selection.size(); --i>=0;)
10611277 {
1278
+ Object3D child = (Object3D)group.selection.elementAt(i);
1279
+
1280
+ // Cannot move into itself
1281
+ if (child == destinationLeaf)
1282
+ return;
1283
+ }
1284
+
1285
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1286
+// {
10621287 loadClipboard(true);
10631288 objEditor.jTree.setSelectionPath(destinationPath);
10641289 pasteInto(false, false);
1065
- } else {
1066
- loadClipboard(false);
1067
- objEditor.jTree.setSelectionPath(destinationPath);
1068
- pasteInto(false, false); // true); // ???
1069
- }
1290
+// } else {
1291
+// loadClipboard(false);
1292
+// objEditor.jTree.setSelectionPath(destinationPath);
1293
+// pasteInto(false, false); // true); // ???
1294
+// }
10701295 }
10711296 public void dropActionChanged(DropTargetDragEvent dtde)
10721297 // Called if the user has modified the current drop gesture
....@@ -1171,22 +1396,30 @@
11711396 {
11721397 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11731398 //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);
1399
+// gridItem = menu.add(new MenuItem("Grid"));
1400
+// gridItem.addActionListener(this);
1401
+// rectoidItem = menu.add(new MenuItem("Box"));
1402
+// rectoidItem.addActionListener(this);
1403
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1404
+// ellipsoidItem.addActionListener(this);
1405
+// coneItem = menu.add(new MenuItem("Cone"));
1406
+// coneItem.addActionListener(this);
1407
+// torusItem = menu.add(new MenuItem("Torus"));
1408
+// torusItem.addActionListener(this);
1409
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1410
+// superItem.addActionListener(this);
1411
+
1412
+ cameraItem = menu.add(new MenuItem("Camera"));
1413
+ cameraItem.addActionListener(this);
1414
+
1415
+ if (!Globals.ADVANCED)
1416
+ {
11861417 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11871418 kleinItem.addActionListener(this);
1188
- particleItem = menu.add(new MenuItem("Particle system"));
1189
- particleItem.addActionListener(this);
1419
+ }
1420
+
1421
+// particleItem = menu.add(new MenuItem("Particle system"));
1422
+// particleItem.addActionListener(this);
11901423 if (Globals.ADVANCED)
11911424 {
11921425 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1212,15 +1445,15 @@
12121445 }
12131446 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12141447 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);
1448
+// overlayItem = menu.add(new MenuItem("Overlay"));
1449
+// overlayItem.addActionListener(this);
1450
+// lightItem = menu.add(new MenuItem("Light"));
1451
+// lightItem.addActionListener(this);
12191452 menu.add("-");
12201453 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12211454 //superLoopItem.addActionListener(this);
1222
- loopItem = menu.add(new MenuItem("Loop"));
1223
- loopItem.addActionListener(this);
1455
+// loopItem = menu.add(new MenuItem("Loop"));
1456
+// loopItem.addActionListener(this);
12241457 doubleItem = menu.add(new MenuItem("Fork"));
12251458 doubleItem.addActionListener(this);
12261459 if (Globals.ADVANCED)
....@@ -1260,7 +1493,7 @@
12601493 memoryItem.addActionListener(this);
12611494 menu.add(analyzeItem = new MenuItem("Analyze"));
12621495 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1496
+ menu.add(dumpItem = new MenuItem("Print"));
12641497 dumpItem.addActionListener(this);
12651498 // menu.add(pathItem = new MenuItem("From-to path"));
12661499 // pathItem.addActionListener(this);
....@@ -1401,9 +1634,24 @@
14011634 shadow.material = new cMaterial(obj.material);
14021635 shadow.material.diffuse = 0.0001f;
14031636 shadow.material.specular = 0.0001f;
1637
+ //shadow.projectedVertices[1].x = 300;
14041638
14051639 makeSomething(shadow);
14061640 }
1641
+
1642
+ private void ClearUnpinned()
1643
+ {
1644
+ //for (Object3D obj : listUI)
1645
+ for (int i=listUI.size(); --i>=0;)
1646
+ {
1647
+ Object3D obj = listUI.elementAt(i);
1648
+ if (!obj.pinned)
1649
+ {
1650
+ obj.CloseUI();
1651
+ listUI.remove(i);
1652
+ }
1653
+ }
1654
+ }
14071655
14081656 /**
14091657 * applyExample
....@@ -1648,7 +1896,7 @@
16481896 {
16491897 ScreenFit();
16501898 } else
1651
- if (source == switchItem)
1899
+ if (source == switchViewItem)
16521900 {
16531901 cVector v1 = new cVector();
16541902 cVector v2 = new cVector();
....@@ -1657,11 +1905,11 @@
16571905 objEditor.cameraView.renderCamera.setAim(v2, v1);
16581906 objEditor.cameraView.repaint();
16591907 } else
1660
- if (source == rectoidItem)
1908
+ if (source == rectoidItem || source == boxButton)
16611909 {
16621910 makeSomething(new Box());
16631911 } else
1664
- if (source == particleItem)
1912
+ if (source == particleItem || source == particlesButton)
16651913 {
16661914 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16671915 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1740,27 +1988,27 @@
17401988
17411989 makeSomething(obj);
17421990 } else
1743
- if (source == gridItem)
1991
+ if (source == gridItem || source == gridButton)
17441992 {
17451993 makeSomething(new Grid());
17461994 } else
1747
- if (source == ellipsoidItem)
1995
+ if (source == ellipsoidItem || source == sphereButton)
17481996 {
17491997 makeSomething(new Sphere());
17501998 } else
1751
- if (source == coneItem)
1999
+ if (source == coneItem || source == coneButton)
17522000 {
17532001 makeSomething(new Cone());
17542002 } else
1755
- if (source == torusItem)
2003
+ if (source == torusItem || source == torusButton)
17562004 {
17572005 makeSomething(new Torus());
17582006 } else
1759
- if (source == superItem)
2007
+ if (source == superItem || source == superButton)
17602008 {
17612009 makeSomething(new Superellipsoid());
17622010 } else
1763
- if (source == kleinItem)
2011
+ if (source == kleinItem || source == kleinButton)
17642012 {
17652013 makeSomething(new Klein());
17662014 } else
....@@ -1780,7 +2028,7 @@
17802028 {
17812029 makeSomething(new BezierSurface());
17822030 } else
1783
- if (source == overlayItem)
2031
+ if (source == overlayItem || source == overlayButton)
17842032 {
17852033 /*
17862034 Object3D obj = new BezierSurface(5,8);
....@@ -1828,7 +2076,7 @@
18282076 s.setup();
18292077 makeSomething(s);
18302078 } else
1831
- if (source == lightItem)
2079
+ if (source == lightItem || source == lightButton)
18322080 {
18332081 makeSomething(new Light());
18342082 } else
....@@ -1878,30 +2126,30 @@
18782126
18792127 group(g);
18802128 } else
1881
- if (source == loopItem)
2129
+ if (source == loopItem || source == loopButton)
18822130 {
18832131 Composite csg = new GroupLeaf();
18842132 csg.count = 5;
18852133 group(csg);
1886
- Composite child = new cGroup();
2134
+ Composite child = new cGroup("Branch");
18872135 csg.addChild(child);
18882136 child.addChild(csg);
18892137 } else
18902138 if (source == doubleItem)
18912139 {
1892
- Composite csg = new GroupLeaf();
2140
+ Composite csg = new GroupLeaf("Fork");
18932141 csg.count = 5;
18942142 group(csg);
1895
- Composite child = new cGroup();
2143
+ Composite child = new cGroup("Branch A");
18962144 csg.addChild(child);
18972145 child.addChild(csg);
1898
- child = new cGroup();
2146
+ child = new cGroup("Branch B");
18992147 csg.addChild(child);
19002148 child.addChild(csg);
19012149 } else
19022150 if (source == tripleItem)
19032151 {
1904
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Trident");
19052153 csg.count = 4;
19062154 group(csg);
19072155 Composite child = new cGroup();
....@@ -1950,6 +2198,30 @@
19502198 if (source == dumpItem)
19512199 {
19522200 DumpObject();
2201
+ } else
2202
+ if (source == minButton)
2203
+ {
2204
+ Minimize();
2205
+ } else
2206
+ if (source == maxButton)
2207
+ {
2208
+ Maximize();
2209
+ } else
2210
+ if (source == fullButton)
2211
+ {
2212
+ ToggleFullScreen();
2213
+ } else
2214
+ if (source == undoButton)
2215
+ {
2216
+ Undo();
2217
+ } else
2218
+ if (source == redoButton)
2219
+ {
2220
+ Redo();
2221
+ } else
2222
+ if (source == saveButton)
2223
+ {
2224
+ Save();
19532225 } else
19542226 if (source == oneStepButton)
19552227 {
....@@ -2004,6 +2276,14 @@
20042276 if (source == cutItem || source == clearButton)
20052277 {
20062278 loadClipboard(true);
2279
+ } else
2280
+ if (source == undoItem)
2281
+ {
2282
+ Undo();
2283
+ } else
2284
+ if (source == redoItem)
2285
+ {
2286
+ Redo();
20072287 } else
20082288 if (source == duplicateItem)
20092289 {
....@@ -2336,9 +2616,9 @@
23362616 {
23372617 ClearSelection(true);
23382618 } else
2339
- if (source == grabItem)
2619
+ if (source == grabItem || source == groupButton)
23402620 {
2341
- group(new cGroup(), true);
2621
+ group(new cGroup(), false); // true);
23422622 } else
23432623 if (source == hideItem)
23442624 {
....@@ -2356,11 +2636,11 @@
23562636 {
23572637 makeSomething(new Camera());
23582638 } else
2359
- if (source == compositeItem)
2639
+ if (source == compositeItem || source == compositeButton)
23602640 {
23612641 group(new Composite());
23622642 } else
2363
- if (source == randomItem)
2643
+ if (source == switchItem || source == switchButton)
23642644 {
23652645 RandomNode random = new RandomNode();
23662646 group(random);
....@@ -2462,7 +2742,7 @@
24622742 {
24632743 group(new cLinker());
24642744 } else
2465
- if (source == textureItem)
2745
+ if (source == textureItem || source == textureButton)
24662746 {
24672747 group(new TextureNode());
24682748 } else
....@@ -2482,17 +2762,30 @@
24822762 {
24832763 CastShadow(2);
24842764 } else
2485
- if (source == ungroupItem)
2765
+ if (source == ungroupItem || source == ungroupButton)
24862766 {
2487
- //ungroup();
2767
+ boolean hasRoot = false;
2768
+
24882769 for (int i=0; i<group.selection.size(); i++)
24892770 {
2490
- Ungroup(group.selection.get(i));
2771
+ if (group.selection.get(i) == group)
2772
+ {
2773
+ hasRoot = true;
2774
+ break;
2775
+ }
24912776 }
24922777
2493
- ClearSelection(false);
2494
-
2495
- refreshContents();
2778
+ if (!hasRoot)
2779
+ {
2780
+ for (int i=0; i<group.selection.size(); i++)
2781
+ {
2782
+ Ungroup(group.selection.get(i));
2783
+ }
2784
+
2785
+ ClearSelection(false);
2786
+
2787
+ refreshContents();
2788
+ }
24962789 } else
24972790 if (source == genUVItem)
24982791 {
....@@ -2504,7 +2797,7 @@
25042797 } else
25052798 if (source == genNormalsMESHItem)
25062799 {
2507
- GenNormals(true); // TODO
2800
+ GenNormalsMESH();
25082801 } else
25092802 if (source == genNormalsORGANItem)
25102803 {
....@@ -2569,6 +2862,22 @@
25692862 if (source == unmarkleavesItem)
25702863 {
25712864 MarkLeaves(false);
2865
+ } else
2866
+ if (source == rewindleavesItem)
2867
+ {
2868
+ RewindLeaves(true);
2869
+ } else
2870
+ if (source == unrewindleavesItem)
2871
+ {
2872
+ RewindLeaves(false);
2873
+ } else
2874
+ if (source == randomleavesItem)
2875
+ {
2876
+ RandomLeaves(true);
2877
+ } else
2878
+ if (source == unrandomleavesItem)
2879
+ {
2880
+ RandomLeaves(false);
25722881 } else
25732882 if (source == flipVItem)
25742883 {
....@@ -2804,6 +3113,10 @@
28043113 if (source == twoButton)
28053114 {
28063115 radio.layout = twoButton;
3116
+
3117
+ if (CameraPane.FULLSCREEN)
3118
+ fullscreenLayout = radio.layout;
3119
+
28073120 // bug
28083121 //gridPanel.setDividerLocation(1.0);
28093122 //bigPanel.setDividerLocation(0.0);
....@@ -2836,10 +3149,31 @@
28363149 bigThree.ClearUI();
28373150 bigThree.add(centralPanel);
28383151 bigThree.FlushUI();
3152
+
3153
+ cameraView.requestFocusInWindow();
3154
+
3155
+// refreshContents(true);
3156
+//
3157
+// try
3158
+// {
3159
+// java.awt.Robot bot = new java.awt.Robot();
3160
+// int mask = InputEvent.BUTTON1_MASK;
3161
+// bot.mouseMove(100, 100);
3162
+// bot.mousePress(mask);
3163
+// bot.mouseRelease(mask);
3164
+// }
3165
+// catch (Exception e)
3166
+// {
3167
+//
3168
+// }
3169
+
28393170 } else
28403171 if (source == threeButton)
28413172 {
28423173 radio.layout = threeButton;
3174
+
3175
+ if (CameraPane.FULLSCREEN)
3176
+ fullscreenLayout = radio.layout;
28433177
28443178 // bigThree.remove(scenePanel);
28453179 // bigThree.remove(centralPanel);
....@@ -2872,10 +3206,15 @@
28723206 bigThree.add(centralPanel);
28733207 bigThree.add(XYZPanel);
28743208 bigThree.FlushUI();
3209
+
3210
+ cameraView.requestFocusInWindow();
28753211 } else
28763212 if (source == fourButton)
28773213 {
28783214 radio.layout = fourButton;
3215
+
3216
+ if (CameraPane.FULLSCREEN)
3217
+ fullscreenLayout = radio.layout;
28793218
28803219 // bigThree.remove(scenePanel);
28813220 // bigThree.remove(centralPanel);
....@@ -2907,10 +3246,15 @@
29073246 bigThree.ClearUI();
29083247 bigThree.add(scenePanel);
29093248 bigThree.FlushUI();
3249
+
3250
+ cameraView.requestFocusInWindow();
29103251 } else
29113252 if (source == sixButton)
29123253 {
29133254 radio.layout = sixButton;
3255
+
3256
+ if (CameraPane.FULLSCREEN)
3257
+ fullscreenLayout = radio.layout;
29143258
29153259 // bigThree.remove(scenePanel);
29163260 // bigThree.remove(centralPanel);
....@@ -2943,10 +3287,15 @@
29433287 bigThree.add(scenePanel);
29443288 bigThree.add(centralPanel);
29453289 bigThree.FlushUI();
3290
+
3291
+ cameraView.requestFocusInWindow();
29463292 } else
29473293 if (source == sevenButton)
29483294 {
29493295 radio.layout = sevenButton;
3296
+
3297
+ if (CameraPane.FULLSCREEN)
3298
+ fullscreenLayout = radio.layout;
29503299
29513300 // bigThree.remove(scenePanel);
29523301 // bigThree.remove(centralPanel);
....@@ -2980,6 +3329,8 @@
29803329 bigThree.add(centralPanel);
29813330 bigThree.add(XYZPanel);
29823331 bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
29833334 } else
29843335 if (source == rootButton)
29853336 {
....@@ -2991,6 +3342,7 @@
29913342 EditObject(obj);
29923343 }
29933344
3345
+ cameraView.requestFocusInWindow();
29943346 refreshContents(true);
29953347 } else
29963348 if (source == closeButton)
....@@ -3000,22 +3352,37 @@
30003352 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30013353 {
30023354 ab = (cRadio)e.nextElement();
3003
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3355
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30043356 {
3357
+ // Patch to avoid bug with transparency.
3358
+ if (!ab.hadMaterial)
3359
+ {
3360
+ ab.object.material = null;
3361
+ }
3362
+
30053363 buttonGroup.remove(ab);
30063364 radioPanel.remove(ab);
30073365
3008
- ab.GetObject().editWindow = null;
3366
+ //ab.GetObject().editWindow = null;
3367
+ ab.GetObject().manipWindow = null;
30093368 // ab.GetObject().objectUI = null; // ?????????
30103369
30113370 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30123371 break;
30133372 }
30143373 }
3374
+
3375
+ cameraView.requestFocusInWindow();
30153376 refreshContents(true);
30163377 } else
30173378 if (source == editItem || source == editButton)
30183379 {
3380
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3381
+ {
3382
+ Object3D child = (Object3D)e.nextElement();
3383
+ child.pinned = true;
3384
+ }
3385
+
30193386 EditSelection(false);
30203387 } else
30213388 if (source == uneditButton)
....@@ -3025,10 +3392,11 @@
30253392 Object3D child = (Object3D)e.nextElement();
30263393 if(child.editWindow != null)
30273394 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3395
+ child.pinned = false;
30283396 child.CloseUI();
30293397 listUI.remove(child);
30303398
3031
- child.editWindow = null; // ???????????
3399
+ //child.editWindow = null; // ???????????
30323400 }
30333401 objEditor.ctrlPanel.FlushUI();
30343402 //objEditor.jTree.clearSelection();
....@@ -3041,6 +3409,7 @@
30413409 //copy.ClearUI();
30423410 for (Object3D obj : listUI)
30433411 {
3412
+ obj.pinned = false;
30443413 obj.CloseUI();
30453414 }
30463415 listUI.clear();
....@@ -3050,7 +3419,7 @@
30503419 {
30513420 assert(copy == group);
30523421
3053
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3422
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30543423
30553424 for (Object3D obj : listUI)
30563425 {
....@@ -3115,7 +3484,9 @@
31153484 sideView.object = group;
31163485 }
31173486
3118
-// fix "+" issue group.editWindow = this;
3487
+// fix "+" issue
3488
+ //group.editWindow = this;
3489
+ group.manipWindow = this;
31193490
31203491 /*
31213492 currentLayout = radio.layout;
....@@ -3123,18 +3494,25 @@
31233494 currentLayout = sevenButton;
31243495 */
31253496 radio.layout.doClick();
3497
+
3498
+ ClearUnpinned();
3499
+ SetPinStates(group.selection.size() > 0);
3500
+ if (group.selection.size() == 1)
3501
+ EditSelection(false);
31263502 keepparent = group.parent;
31273503 // PARENT = NULL or not???
31283504 //group.parent = null; // ROOT
31293505 //group.attributes = -1;
31303506 ResetModel();
3507
+
3508
+ cameraView.requestFocusInWindow();
31313509 refreshContents(true);
31323510 } else if (event.getSource() == editCameraItem)
31333511 {
31343512 cameraView.ProtectCamera();
31353513 cameraView.repaint();
31363514 return;
3137
- } else if (event.getSource() == revertCameraItem)
3515
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31383516 {
31393517 cameraView.RevertCamera();
31403518 cameraView.repaint();
....@@ -3151,7 +3529,6 @@
31513529 }
31523530
31533531 boolean useclient = false;
3154
- cRadio radio;
31553532
31563533 void ToggleRoot()
31573534 {
....@@ -3390,7 +3767,8 @@
33903767
33913768 int size = obj.MemorySize();
33923769
3393
- System.err.println((size/1024) + " KB is the size of " + obj);
3770
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3771
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33943772 }
33953773 }
33963774 catch (Exception e)
....@@ -3471,6 +3849,13 @@
34713849 void GenNormals(boolean crease)
34723850 {
34733851 group.GenNormalsS(crease);
3852
+
3853
+ refreshContents();
3854
+ }
3855
+
3856
+ void GenNormalsMESH()
3857
+ {
3858
+ group.GenNormalsMeshS();
34743859
34753860 refreshContents();
34763861 }
....@@ -4098,6 +4483,18 @@
40984483 refreshContents();
40994484 }
41004485
4486
+ void RewindLeaves(boolean hide)
4487
+ {
4488
+ group.selection.RewindLeaves(hide);
4489
+ refreshContents();
4490
+ }
4491
+
4492
+ void RandomLeaves(boolean hide)
4493
+ {
4494
+ group.selection.RandomLeaves(hide);
4495
+ refreshContents();
4496
+ }
4497
+
41014498 void SetTexRes(int tr)
41024499 {
41034500 group.selection.SetTexRes(tr);
....@@ -4169,10 +4566,6 @@
41694566 // }
41704567 // }
41714568
4172
- static boolean allparams = true;
4173
-
4174
- static Vector<Object3D> listUI = new Vector<Object3D>();
4175
-
41764569 void EditSelection(boolean newWindow)
41774570 {
41784571 // aConstraints.gridy = 0;
....@@ -4180,7 +4573,7 @@
41804573 {
41814574 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41824575 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4576
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41844577
41854578 Object3D elem = (Object3D)group.selection.elementAt(i);
41864579 if(elem != group || !newWindow)
....@@ -4265,7 +4658,8 @@
42654658 //new Exception().printStackTrace();
42664659
42674660 freezemodel = true;
4268
-
4661
+ ClearUnpinned();
4662
+
42694663 /**/
42704664 //switch (event.id)
42714665 {
....@@ -4273,7 +4667,6 @@
42734667 //case 702: // Event.LIST_DESELECT
42744668 group.deselectAll();
42754669 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774670 if (tps != null)
42784671 {
42794672 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4675,8 @@
42824675
42834676 //if (child.parent != null)
42844677 //child.parent.addSelectee(child);
4678
+ objEditor.SetMaterial(child);
42854679 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894680 }
42904681 }
42914682 // else
....@@ -4295,20 +4686,28 @@
42954686 // System.err.println("info : " + group.GetPath());
42964687 // }
42974688
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4689
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014690 CameraPane.flash = true;
43024691
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4692
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044693 // a camera
43054694 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4695
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4696
+ {
4697
+ CameraPane.camerachangeframe = 0; // don't refuse it
4698
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4699
+ }
43084700 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094701 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104702 }
43114703
4704
+ if (tps != null && tps.length == 1)
4705
+ {
4706
+ EditSelection(false);
4707
+ }
4708
+
4709
+ SetPinStates(tps != null && tps.length > 0);
4710
+
43124711 refreshContents();
43134712 //return true;
43144713 }
....@@ -4317,6 +4716,35 @@
43174716
43184717 freezemodel = false;
43194718 }
4719
+
4720
+ void SetPinStates(boolean enabled)
4721
+ {
4722
+ editButton.setEnabled(enabled);
4723
+ uneditButton.setEnabled(enabled);
4724
+ unselectButton.setEnabled(enabled);
4725
+ flashSelectionButton.setEnabled(enabled);
4726
+ }
4727
+
4728
+ void refreshContents(boolean cp)
4729
+ {
4730
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4731
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4732
+ {
4733
+ objEditor.ClearInfo(); // .GetMaterial());
4734
+
4735
+ for (int i=0; i < group.selection.Size(); i++)
4736
+ {
4737
+ Object3D child = (Object3D) group.selection.get(i);
4738
+
4739
+ objEditor.AddInfo(child, this, true);
4740
+ System.err.println("info : " + child.GetPath());
4741
+ }
4742
+
4743
+ objEditor.SetText(); // jan 2014
4744
+ }
4745
+
4746
+ super.refreshContents(cp);
4747
+ }
43204748
43214749 void linkSomething(Object3D thing)
43224750 {
....@@ -4388,6 +4816,7 @@
43884816 {
43894817 if (group.selection.isEmpty())
43904818 return;
4819
+
43914820 Grafreed.clipboardIsTempGroup = false;
43924821 Composite tGroup = null;
43934822 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4827,8 @@
43984827
43994828 if (cut)
44004829 {
4830
+ if (Globals.SAVEONMAKE)
4831
+ Save();
44014832 //int indices[] = jList.getSelectedIndices();
44024833 //for (int i = indices.length - 1; i >= 0; i--)
44034834 //jList.remove(indices[i]);
....@@ -4487,8 +4918,10 @@
44874918 }
44884919
44894920 }
4921
+
44904922 if (Grafreed.clipboardIsTempGroup)
44914923 Grafreed.clipboard = tGroup;
4924
+
44924925 if (cut)
44934926 {
44944927 ResetModel();
....@@ -5113,7 +5546,28 @@
51135546 cButton clearpanelButton;
51145547 cButton unselectButton;
51155548
5549
+ cButton restoreCameraButton;
5550
+
5551
+ cButton saveButton;
51165552 cButton oneStepButton;
5553
+
5554
+ cButton groupButton;
5555
+ cButton ungroupButton;
5556
+ cButton compositeButton;
5557
+ cButton switchButton;
5558
+ cButton loopButton;
5559
+ cButton textureButton;
5560
+
5561
+ cButton gridButton;
5562
+ cButton boxButton;
5563
+ cButton sphereButton;
5564
+ cButton coneButton;
5565
+ cButton torusButton;
5566
+ cButton superButton;
5567
+ cButton kleinButton;
5568
+ cButton particlesButton;
5569
+ cButton overlayButton;
5570
+ cButton lightButton;
51175571
51185572 cButton screenfitButton;
51195573 cButton screenfitpointButton;
....@@ -5126,14 +5580,6 @@
51265580
51275581 cButton setsupportButton;
51285582
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
-
51375583 //
51385584 //Composite
51395585 Object3D // to do !!
....@@ -5143,9 +5589,11 @@
51435589 //JTree jTree;
51445590 private MenuItem lookAtItem;
51455591 private MenuItem lookFromItem;
5146
- private MenuItem switchItem;
5592
+ private MenuItem switchViewItem;
51475593 private MenuItem cutItem;
5148
- private MenuItem duplicateItem;
5594
+ private MenuItem undoItem;
5595
+ private MenuItem redoItem;
5596
+ private JMenuItem duplicateItem;
51495597 private MenuItem cloneItem;
51505598 private MenuItem cloneSupportItem;
51515599 private MenuItem overwriteGeoItem;
....@@ -5208,6 +5656,10 @@
52085656 private MenuItem showleavesItem;
52095657 private MenuItem markleavesItem;
52105658 private MenuItem unmarkleavesItem;
5659
+ private MenuItem rewindleavesItem;
5660
+ private MenuItem unrewindleavesItem;
5661
+ private MenuItem randomleavesItem;
5662
+ private MenuItem unrandomleavesItem;
52115663
52125664 private MenuItem flipVItem;
52135665 private MenuItem unflipVItem;
....@@ -5229,7 +5681,7 @@
52295681 private MenuItem frontItem;
52305682 private MenuItem cameraItem;
52315683 private MenuItem compositeItem;
5232
- private MenuItem randomItem;
5684
+ private MenuItem switchItem;
52335685 private MenuItem physicsItem;
52345686 private MenuItem frameselectorItem;
52355687 private MenuItem scriptNodeItem;
....@@ -5303,5 +5755,5 @@
53035755
53045756 Menu cameraMenu;
53055757 MenuItem editCameraItem;
5306
- MenuItem revertCameraItem;
5758
+ MenuItem restoreCameraItem;
53075759 }