Normand Briere
2019-06-27 f78dd18c66d607b693c0bf5937fc59181bf5a26b
GroupEditor.java
....@@ -150,6 +150,8 @@
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"));
....@@ -160,7 +162,7 @@
160162 // redoItem = menu.add(new MenuItem("Redo"));
161163 // redoItem.addActionListener(this);
162164 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164166 duplicateItem.addActionListener(this);
165167 cloneItem = menu.add(new MenuItem("Clone"));
166168 cloneItem.addActionListener(this);
....@@ -176,7 +178,6 @@
176178 copyItem.addActionListener(this);
177179 pasteItem = menu.add(new MenuItem("Paste"));
178180 pasteItem.addActionListener(this);
179
- menu.add("-");
180181
181182 menu.add("-");
182183 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -203,21 +204,21 @@
203204 //zBufferItem.addActionListener(this);
204205 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205206 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
207
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
208
+ restoreCameraItem.addActionListener(this);
208209
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- cameraMenu.add("-");
213
-
214
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
- toggleTextureItem.addItemListener(this);
216
- toggleTextureItem.setState(CameraPane.textureon);
217
-
218
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
- toggleSwitchItem.addItemListener(this);
220
- 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);
221222
222223 cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
223224 toggleHandleItem.addItemListener(this);
....@@ -246,7 +247,7 @@
246247
247248 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248249 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
250
+ toggleDebugItem.setState(Globals.DEBUG);
250251
251252 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252253 toggleFrustumItem.addItemListener(this);
....@@ -274,7 +275,7 @@
274275 {
275276 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276277 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
278
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278279 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279280 oe.cameraMenu.add("-");
280281 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +283,7 @@
282283 editLeafItem.addActionListener(this);
283284 lookAtItem.addActionListener(this);
284285 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
286
+ //switchViewItem.addActionListener(this);
286287 }
287288
288289 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +328,29 @@
327328 }
328329
329330 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
332333 backItem = menu.add(new MenuItem("Back"));
333334 backItem.addActionListener(this);
334335 frontItem = menu.add(new MenuItem("Front"));
335336 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
338342 hideItem = menu.add(new MenuItem("Hidden Group"));
339343 hideItem.addActionListener(this);
344
+ }
340345 ungroupItem = menu.add(new MenuItem("Ungroup"));
341346 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- 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
+ {
345354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346355 switchGeoItem.addActionListener(this);
347356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +358,6 @@
349358 morphItem = menu.add(new MenuItem("Morph Group"));
350359 morphItem.addActionListener(this);
351360
352
- if (Globals.ADVANCED)
353
- {
354361 menu.add("-");
355362 physicsItem = menu.add(new MenuItem("Physics"));
356363 physicsItem.addActionListener(this);
....@@ -358,22 +365,20 @@
358365 frameselectorItem.addActionListener(this);
359366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360367 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363368 }
364369
365370 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
368373 billboardItem = menu.add(new MenuItem("Billboard"));
369374 billboardItem.addActionListener(this);
370375 csgItem = menu.add(new MenuItem("CSG"));
371376 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
377
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373378 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
379
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375380 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
381
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377382 shadowZItem.addActionListener(this);
378383 if (Globals.ADVANCED)
379384 {
....@@ -470,6 +475,14 @@
470475 markleavesItem.addActionListener(this);
471476 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472477 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);
473486 menu.add("-");
474487 flipVItem = menu.add(new MenuItem("Flip V"));
475488 flipVItem.addActionListener(this);
....@@ -527,6 +540,18 @@
527540
528541 void SetupUI2(ObjEditor oe)
529542 {
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
+
530555 //new Exception().printStackTrace();
531556
532557 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -555,39 +580,63 @@
555580 oe.radioPanel.add(dummyButton);
556581 oe.buttonGroup.add(dummyButton);
557582 */
583
+ cGridBag copyOptionsPanel = new cGridBag();
584
+
585
+ copyOptionsPanel.preferredHeight = 2;
586
+
558587 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559588
560
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, 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);
561606 undoButton.setToolTipText("Undo changes");
562607 undoButton.addActionListener(this);
608
+ undoButton.setEnabled(false);
563609
564
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565611 redoButton.setToolTipText("Redo changes");
566612 redoButton.addActionListener(this);
613
+ redoButton.setEnabled(false);
567614
568
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569616 saveButton.setToolTipText("Save changes");
570617 saveButton.addActionListener(this);
571618
572
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
619
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
573620 liveCB.setToolTipText("Enable animation");
574621 liveCB.addItemListener(this);
575622
576
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577624 oneStepButton.setToolTipText("Animate one step forward");
578625 oneStepButton.addActionListener(this);
579626
580
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
627
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
581628 fastCB.setToolTipText("Fast mode");
582629 fastCB.addItemListener(this);
583630
584
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
585
- trackCB.setToolTipText("Enable tracking");
586
- trackCB.addItemListener(this);
587
-
588
- 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);
589634 screenfitButton.setToolTipText("Screen fit");
590635 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);
591640
592641 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
593642 // screenfitpointButton.addActionListener(this);
....@@ -599,65 +648,145 @@
599648 snapobjectButton.setToolTipText("Snap Object");
600649 }
601650
602
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- flashSelectionButton.setToolTipText("Show selection");
604
- flashSelectionButton.addActionListener(this);
651
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
605652
606
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
607
-
608
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609654 twoButton.setToolTipText("Show center view only");
610655 twoButton.addActionListener(this);
611
- 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);
612659 fourButton.addActionListener(this);
613660 fourButton.setToolTipText("Show left panel only");
614
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615662 sixButton.setToolTipText("2-column layout left");
616663 sixButton.addActionListener(this);
617
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618665 threeButton.setToolTipText("2-column layout right");
619666 threeButton.addActionListener(this);
620
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621668 sevenButton.setToolTipText("3-column layout");
622669 sevenButton.addActionListener(this);
623670 //
624671
625
- 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);
626673 rootButton.setToolTipText("Edit selection in new tab");
627674 rootButton.addActionListener(this);
628675
629
- 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);
630677 closeButton.setToolTipText("Close tab");
631678 closeButton.addActionListener(this);
632679 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
633680 //clearButton.addActionListener(this);
634
-
635
- 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
+ }
636713
637
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
- 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");
639763 editButton.addActionListener(this);
640764
641
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
- uneditButton.setToolTipText("Unedit selection");
765
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ uneditButton.setToolTipText("Remove selection controls");
643767 uneditButton.addActionListener(this);
644768
645
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
646
- allParamsButton.setToolTipText("Edit all params");
769
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
770
+ allParamsButton.setToolTipText("Show all controle");
647771 allParamsButton.addActionListener(this);
648772
649
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650774 clearPanelButton.setToolTipText("Clear edit panel");
651775 clearPanelButton.addActionListener(this);
652776
653
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654778 unselectButton.setToolTipText("Unselect");
655779 unselectButton.addActionListener(this);
656780
657
- 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);
658784
659
- oe.treePanel.add(commandsPanel);
660
- oe.treePanel.Return();
785
+ editCommandsPanel.preferredHeight = 1;
786
+
787
+ SetPinStates(false);
788
+// oe.treePanel.add(commandsPanel);
789
+// oe.treePanel.Return();
661790
662791 // oe.aConstraints.gridx += 1;
663792 // oe.aConstraints.weighty = 0;
....@@ -674,27 +803,12 @@
674803
675804 JScrollPane jSP;
676805 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
677
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
806
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
678807 ResetModel();
679808
680809 oe.treePanel.add(jSPPanel);
681810 oe.treePanel.Return();
682811
683
- cGridBag copyOptionsPanel = new cGridBag();
684
-
685
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
686
- colorCB.setToolTipText("Copy color when dropped");
687
- colorCB.addItemListener(this);
688
-
689
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
690
- materialCB.setToolTipText("Copy material when dropped");
691
- materialCB.addItemListener(this);
692
-
693
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
694
- textureCB.setToolTipText("Copy texture when dropped");
695
- textureCB.addItemListener(this);
696
-
697
- copyOptionsPanel.preferredHeight = 1;
698812 oe.treePanel.add(copyOptionsPanel);
699813 oe.treePanel.Return();
700814
....@@ -725,12 +839,26 @@
725839
726840 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
727841 {
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
+
728856 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
729857 boxCB.setToolTipText("Display bounding boxes");
730858 boxCB.addItemListener(this);
731859
732860 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
733
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
861
+ zoomBoxCB.setToolTipText("Display only for wheel");
734862 zoomBoxCB.addItemListener(this);
735863
736864 if (true) // Globals.ADVANCED)
....@@ -742,6 +870,8 @@
742870 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
743871 // localCB.addItemListener(this);
744872
873
+ panel.Return();
874
+
745875 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
746876 crowdCB.setToolTipText("Used for crowds");
747877 crowdCB.addItemListener(this);
....@@ -758,6 +888,8 @@
758888 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
759889 // speakerMocapCB.addItemListener(this);
760890
891
+ panel.Return();
892
+
761893 if (false)
762894 {
763895 // handled in scripts
....@@ -772,32 +904,72 @@
772904 //constraints.gridy += 1;
773905 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
774906 smoothfocusCB.addItemListener(this);
907
+ panel.Return();
775908 }
776909
777910 //constraints.gridx += 1;
778911 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
779912 // debugCB.addItemListener(this);
780913
914
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
915
+ trackCB.setToolTipText("Enable tracking target");
916
+ trackCB.addItemListener(this);
917
+
781918 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
919
+ oeilCB.setToolTipText("Move camera when tracking");
782920 oeilCB.addItemListener(this);
783921
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
+ {
784942 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
785943 lookAtCB.setToolTipText("Look-at target");
786944 lookAtCB.addItemListener(this);
945
+ }
787946
788947 }
789948
790949 cGridBag fill = new cGridBag();
791
-
792950 fill.preferredHeight = 200;
951
+ cGridBag fill2 = new cGridBag();
952
+ fill2.preferredHeight = 200;
953
+ cGridBag fill3 = new cGridBag();
954
+ fill3.preferredHeight = 200;
793955
794956 panel.add(fill);
957
+ panel.add(fill2);
958
+ panel.add(fill3);
795959
796960 }
797961
798962 void EditObject(Object3D obj)
799963 {
800964 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
+
801973 radioButton.SetObject(obj);
802974 radioButton.layout = sevenButton;
803975 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -809,6 +981,8 @@
809981
810982 void SetupViews(ObjEditor oe)
811983 {
984
+ theFrame = this;
985
+
812986 oe.SetupViews();
813987
814988 System.out.println("SetupViews");
....@@ -817,23 +991,27 @@
817991 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
818992 }
819993
820
- JCheckBox liveCB;
821
- JCheckBox supportCB;
822
- JCheckBox localCB;
823
- JCheckBox crowdCB;
824
- JCheckBox smoothCB;
825
- JCheckBox fastCB;
826
- JCheckBox slowCB;
827
- JCheckBox boxCB;
828
- JCheckBox zoomBoxCB;
829
- JCheckBox trackCB;
830
- 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;
8311006 // JCheckBox speakerMocapCB;
832
- JCheckBox speakerCameraCB;
833
- JCheckBox speakerFocusCB;
834
- JCheckBox debugCB;
835
- JCheckBox oeilCB;
836
- JCheckBox lookAtCB;
1007
+ cCheckBox speakerCameraCB;
1008
+ cCheckBox speakerFocusCB;
1009
+ cCheckBox debugCB;
1010
+
1011
+ cCheckBox oeilCB;
1012
+ cCheckBox shadowCB;
1013
+ cCheckBox autosaveCB;
1014
+ cCheckBox lookAtCB;
8371015
8381016 // static int COLOR = 1;
8391017 // static int MATERIAL = 2;
....@@ -841,9 +1019,9 @@
8411019
8421020 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8431021
844
- JCheckBox colorCB;
845
- JCheckBox materialCB;
846
- JCheckBox textureCB;
1022
+ cCheckBox colorCB;
1023
+ cCheckBox materialCB;
1024
+ cCheckBox textureCB;
8471025
8481026 public void itemStateChanged(ItemEvent e)
8491027 {
....@@ -871,6 +1049,7 @@
8711049 } else if(e.getSource() == liveCB)
8721050 {
8731051 cameraView.ToggleLive();
1052
+ refreshContents(false);
8741053 }
8751054 else if(e.getSource() == supportCB)
8761055 {
....@@ -935,6 +1114,14 @@
9351114 {
9361115 cameraView.ToggleOeil();
9371116 }
1117
+ else if(e.getSource() == shadowCB)
1118
+ {
1119
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1120
+ }
1121
+ else if(e.getSource() == autosaveCB)
1122
+ {
1123
+ Globals.SAVEONMAKE ^= true;
1124
+ }
9381125 else if(e.getSource() == lookAtCB)
9391126 {
9401127 cameraView.ToggleLookAt();
....@@ -951,7 +1138,8 @@
9511138
9521139 /**/
9531140 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
954
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1141
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1142
+ TreePath path = objEditor.jTree.getSelectionPath();
9551143 if ((path == null) || (path.getPathCount() <= 1)) {
9561144 // We can't move the root node or an empty selection
9571145 return;
....@@ -1068,23 +1256,33 @@
10681256
10691257 assert target == objEditor.jTree;
10701258 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1259
+ Object3D destinationLeaf;
10711260 try {
1072
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1261
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10731262 } catch (Exception e) {
10741263 System.out.println("destinationPath : " + destinationPath);
10751264 return;
10761265 }
10771266
1078
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1267
+ for (int i=group.selection.size(); --i>=0;)
10791268 {
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
+// {
10801278 loadClipboard(true);
10811279 objEditor.jTree.setSelectionPath(destinationPath);
10821280 pasteInto(false, false);
1083
- } else {
1084
- loadClipboard(false);
1085
- objEditor.jTree.setSelectionPath(destinationPath);
1086
- pasteInto(false, false); // true); // ???
1087
- }
1281
+// } else {
1282
+// loadClipboard(false);
1283
+// objEditor.jTree.setSelectionPath(destinationPath);
1284
+// pasteInto(false, false); // true); // ???
1285
+// }
10881286 }
10891287 public void dropActionChanged(DropTargetDragEvent dtde)
10901288 // Called if the user has modified the current drop gesture
....@@ -1189,22 +1387,30 @@
11891387 {
11901388 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11911389 //heightFieldItem.addActionListener(this);
1192
- gridItem = menu.add(new MenuItem("Grid"));
1193
- gridItem.addActionListener(this);
1194
- rectoidItem = menu.add(new MenuItem("Box"));
1195
- rectoidItem.addActionListener(this);
1196
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1197
- ellipsoidItem.addActionListener(this);
1198
- coneItem = menu.add(new MenuItem("Cone"));
1199
- coneItem.addActionListener(this);
1200
- torusItem = menu.add(new MenuItem("Torus"));
1201
- torusItem.addActionListener(this);
1202
- superItem = menu.add(new MenuItem("Superellipsoid"));
1203
- 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
+ {
12041408 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12051409 kleinItem.addActionListener(this);
1206
- particleItem = menu.add(new MenuItem("Particle system"));
1207
- particleItem.addActionListener(this);
1410
+ }
1411
+
1412
+// particleItem = menu.add(new MenuItem("Particle system"));
1413
+// particleItem.addActionListener(this);
12081414 if (Globals.ADVANCED)
12091415 {
12101416 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1230,15 +1436,15 @@
12301436 }
12311437 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12321438 bezierItem.addActionListener(this);
1233
- overlayItem = menu.add(new MenuItem("Overlay"));
1234
- overlayItem.addActionListener(this);
1235
- lightItem = menu.add(new MenuItem("Light"));
1236
- 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);
12371443 menu.add("-");
12381444 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12391445 //superLoopItem.addActionListener(this);
1240
- loopItem = menu.add(new MenuItem("Loop"));
1241
- loopItem.addActionListener(this);
1446
+// loopItem = menu.add(new MenuItem("Loop"));
1447
+// loopItem.addActionListener(this);
12421448 doubleItem = menu.add(new MenuItem("Fork"));
12431449 doubleItem.addActionListener(this);
12441450 if (Globals.ADVANCED)
....@@ -1278,7 +1484,7 @@
12781484 memoryItem.addActionListener(this);
12791485 menu.add(analyzeItem = new MenuItem("Analyze"));
12801486 analyzeItem.addActionListener(this);
1281
- menu.add(dumpItem = new MenuItem("Dump"));
1487
+ menu.add(dumpItem = new MenuItem("Print"));
12821488 dumpItem.addActionListener(this);
12831489 // menu.add(pathItem = new MenuItem("From-to path"));
12841490 // pathItem.addActionListener(this);
....@@ -1419,9 +1625,24 @@
14191625 shadow.material = new cMaterial(obj.material);
14201626 shadow.material.diffuse = 0.0001f;
14211627 shadow.material.specular = 0.0001f;
1628
+ //shadow.projectedVertices[1].x = 300;
14221629
14231630 makeSomething(shadow);
14241631 }
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
+ }
14251646
14261647 /**
14271648 * applyExample
....@@ -1666,7 +1887,7 @@
16661887 {
16671888 ScreenFit();
16681889 } else
1669
- if (source == switchItem)
1890
+ if (source == switchViewItem)
16701891 {
16711892 cVector v1 = new cVector();
16721893 cVector v2 = new cVector();
....@@ -1675,11 +1896,11 @@
16751896 objEditor.cameraView.renderCamera.setAim(v2, v1);
16761897 objEditor.cameraView.repaint();
16771898 } else
1678
- if (source == rectoidItem)
1899
+ if (source == rectoidItem || source == boxButton)
16791900 {
16801901 makeSomething(new Box());
16811902 } else
1682
- if (source == particleItem)
1903
+ if (source == particleItem || source == particlesButton)
16831904 {
16841905 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16851906 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1758,27 +1979,27 @@
17581979
17591980 makeSomething(obj);
17601981 } else
1761
- if (source == gridItem)
1982
+ if (source == gridItem || source == gridButton)
17621983 {
17631984 makeSomething(new Grid());
17641985 } else
1765
- if (source == ellipsoidItem)
1986
+ if (source == ellipsoidItem || source == sphereButton)
17661987 {
17671988 makeSomething(new Sphere());
17681989 } else
1769
- if (source == coneItem)
1990
+ if (source == coneItem || source == coneButton)
17701991 {
17711992 makeSomething(new Cone());
17721993 } else
1773
- if (source == torusItem)
1994
+ if (source == torusItem || source == torusButton)
17741995 {
17751996 makeSomething(new Torus());
17761997 } else
1777
- if (source == superItem)
1998
+ if (source == superItem || source == superButton)
17781999 {
17792000 makeSomething(new Superellipsoid());
17802001 } else
1781
- if (source == kleinItem)
2002
+ if (source == kleinItem || source == kleinButton)
17822003 {
17832004 makeSomething(new Klein());
17842005 } else
....@@ -1798,7 +2019,7 @@
17982019 {
17992020 makeSomething(new BezierSurface());
18002021 } else
1801
- if (source == overlayItem)
2022
+ if (source == overlayItem || source == overlayButton)
18022023 {
18032024 /*
18042025 Object3D obj = new BezierSurface(5,8);
....@@ -1846,7 +2067,7 @@
18462067 s.setup();
18472068 makeSomething(s);
18482069 } else
1849
- if (source == lightItem)
2070
+ if (source == lightItem || source == lightButton)
18502071 {
18512072 makeSomething(new Light());
18522073 } else
....@@ -1896,7 +2117,7 @@
18962117
18972118 group(g);
18982119 } else
1899
- if (source == loopItem)
2120
+ if (source == loopItem || source == loopButton)
19002121 {
19012122 Composite csg = new GroupLeaf();
19022123 csg.count = 5;
....@@ -1968,6 +2189,18 @@
19682189 if (source == dumpItem)
19692190 {
19702191 DumpObject();
2192
+ } 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();
19712204 } else
19722205 if (source == undoButton)
19732206 {
....@@ -2374,9 +2607,9 @@
23742607 {
23752608 ClearSelection(true);
23762609 } else
2377
- if (source == grabItem)
2610
+ if (source == grabItem || source == groupButton)
23782611 {
2379
- group(new cGroup(), true);
2612
+ group(new cGroup(), false); // true);
23802613 } else
23812614 if (source == hideItem)
23822615 {
....@@ -2394,11 +2627,11 @@
23942627 {
23952628 makeSomething(new Camera());
23962629 } else
2397
- if (source == compositeItem)
2630
+ if (source == compositeItem || source == compositeButton)
23982631 {
23992632 group(new Composite());
24002633 } else
2401
- if (source == randomItem)
2634
+ if (source == switchItem || source == switchButton)
24022635 {
24032636 RandomNode random = new RandomNode();
24042637 group(random);
....@@ -2500,7 +2733,7 @@
25002733 {
25012734 group(new cLinker());
25022735 } else
2503
- if (source == textureItem)
2736
+ if (source == textureItem || source == textureButton)
25042737 {
25052738 group(new TextureNode());
25062739 } else
....@@ -2520,7 +2753,7 @@
25202753 {
25212754 CastShadow(2);
25222755 } else
2523
- if (source == ungroupItem)
2756
+ if (source == ungroupItem || source == ungroupButton)
25242757 {
25252758 //ungroup();
25262759 for (int i=0; i<group.selection.size(); i++)
....@@ -2542,7 +2775,7 @@
25422775 } else
25432776 if (source == genNormalsMESHItem)
25442777 {
2545
- GenNormals(true); // TODO
2778
+ GenNormalsMESH();
25462779 } else
25472780 if (source == genNormalsORGANItem)
25482781 {
....@@ -2607,6 +2840,22 @@
26072840 if (source == unmarkleavesItem)
26082841 {
26092842 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);
26102859 } else
26112860 if (source == flipVItem)
26122861 {
....@@ -2842,6 +3091,10 @@
28423091 if (source == twoButton)
28433092 {
28443093 radio.layout = twoButton;
3094
+
3095
+ if (CameraPane.FULLSCREEN)
3096
+ fullscreenLayout = radio.layout;
3097
+
28453098 // bug
28463099 //gridPanel.setDividerLocation(1.0);
28473100 //bigPanel.setDividerLocation(0.0);
....@@ -2874,10 +3127,31 @@
28743127 bigThree.ClearUI();
28753128 bigThree.add(centralPanel);
28763129 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
+
28773148 } else
28783149 if (source == threeButton)
28793150 {
28803151 radio.layout = threeButton;
3152
+
3153
+ if (CameraPane.FULLSCREEN)
3154
+ fullscreenLayout = radio.layout;
28813155
28823156 // bigThree.remove(scenePanel);
28833157 // bigThree.remove(centralPanel);
....@@ -2910,10 +3184,15 @@
29103184 bigThree.add(centralPanel);
29113185 bigThree.add(XYZPanel);
29123186 bigThree.FlushUI();
3187
+
3188
+ cameraView.requestFocusInWindow();
29133189 } else
29143190 if (source == fourButton)
29153191 {
29163192 radio.layout = fourButton;
3193
+
3194
+ if (CameraPane.FULLSCREEN)
3195
+ fullscreenLayout = radio.layout;
29173196
29183197 // bigThree.remove(scenePanel);
29193198 // bigThree.remove(centralPanel);
....@@ -2945,10 +3224,15 @@
29453224 bigThree.ClearUI();
29463225 bigThree.add(scenePanel);
29473226 bigThree.FlushUI();
3227
+
3228
+ cameraView.requestFocusInWindow();
29483229 } else
29493230 if (source == sixButton)
29503231 {
29513232 radio.layout = sixButton;
3233
+
3234
+ if (CameraPane.FULLSCREEN)
3235
+ fullscreenLayout = radio.layout;
29523236
29533237 // bigThree.remove(scenePanel);
29543238 // bigThree.remove(centralPanel);
....@@ -2981,10 +3265,15 @@
29813265 bigThree.add(scenePanel);
29823266 bigThree.add(centralPanel);
29833267 bigThree.FlushUI();
3268
+
3269
+ cameraView.requestFocusInWindow();
29843270 } else
29853271 if (source == sevenButton)
29863272 {
29873273 radio.layout = sevenButton;
3274
+
3275
+ if (CameraPane.FULLSCREEN)
3276
+ fullscreenLayout = radio.layout;
29883277
29893278 // bigThree.remove(scenePanel);
29903279 // bigThree.remove(centralPanel);
....@@ -3018,6 +3307,8 @@
30183307 bigThree.add(centralPanel);
30193308 bigThree.add(XYZPanel);
30203309 bigThree.FlushUI();
3310
+
3311
+ cameraView.requestFocusInWindow();
30213312 } else
30223313 if (source == rootButton)
30233314 {
....@@ -3029,6 +3320,7 @@
30293320 EditObject(obj);
30303321 }
30313322
3323
+ cameraView.requestFocusInWindow();
30323324 refreshContents(true);
30333325 } else
30343326 if (source == closeButton)
....@@ -3038,22 +3330,37 @@
30383330 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30393331 {
30403332 ab = (cRadio)e.nextElement();
3041
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3333
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30423334 {
3335
+ // Patch to avoid bug with transparency.
3336
+ if (!ab.hadMaterial)
3337
+ {
3338
+ ab.object.material = null;
3339
+ }
3340
+
30433341 buttonGroup.remove(ab);
30443342 radioPanel.remove(ab);
30453343
3046
- ab.GetObject().editWindow = null;
3344
+ //ab.GetObject().editWindow = null;
3345
+ ab.GetObject().manipWindow = null;
30473346 // ab.GetObject().objectUI = null; // ?????????
30483347
30493348 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30503349 break;
30513350 }
30523351 }
3352
+
3353
+ cameraView.requestFocusInWindow();
30533354 refreshContents(true);
30543355 } else
30553356 if (source == editItem || source == editButton)
30563357 {
3358
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3359
+ {
3360
+ Object3D child = (Object3D)e.nextElement();
3361
+ child.pinned = true;
3362
+ }
3363
+
30573364 EditSelection(false);
30583365 } else
30593366 if (source == uneditButton)
....@@ -3063,6 +3370,7 @@
30633370 Object3D child = (Object3D)e.nextElement();
30643371 if(child.editWindow != null)
30653372 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3373
+ child.pinned = false;
30663374 child.CloseUI();
30673375 listUI.remove(child);
30683376
....@@ -3079,6 +3387,7 @@
30793387 //copy.ClearUI();
30803388 for (Object3D obj : listUI)
30813389 {
3390
+ obj.pinned = false;
30823391 obj.CloseUI();
30833392 }
30843393 listUI.clear();
....@@ -3088,7 +3397,7 @@
30883397 {
30893398 assert(copy == group);
30903399
3091
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3400
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30923401
30933402 for (Object3D obj : listUI)
30943403 {
....@@ -3154,7 +3463,8 @@
31543463 }
31553464
31563465 // fix "+" issue
3157
- group.editWindow = this;
3466
+ //group.editWindow = this;
3467
+ group.manipWindow = this;
31583468
31593469 /*
31603470 currentLayout = radio.layout;
....@@ -3162,18 +3472,25 @@
31623472 currentLayout = sevenButton;
31633473 */
31643474 radio.layout.doClick();
3475
+
3476
+ ClearUnpinned();
3477
+ SetPinStates(group.selection.size() > 0);
3478
+ if (group.selection.size() == 1)
3479
+ EditSelection(false);
31653480 keepparent = group.parent;
31663481 // PARENT = NULL or not???
31673482 //group.parent = null; // ROOT
31683483 //group.attributes = -1;
31693484 ResetModel();
3485
+
3486
+ cameraView.requestFocusInWindow();
31703487 refreshContents(true);
31713488 } else if (event.getSource() == editCameraItem)
31723489 {
31733490 cameraView.ProtectCamera();
31743491 cameraView.repaint();
31753492 return;
3176
- } else if (event.getSource() == revertCameraItem)
3493
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31773494 {
31783495 cameraView.RevertCamera();
31793496 cameraView.repaint();
....@@ -3190,7 +3507,6 @@
31903507 }
31913508
31923509 boolean useclient = false;
3193
- cRadio radio;
31943510
31953511 void ToggleRoot()
31963512 {
....@@ -3511,6 +3827,13 @@
35113827 void GenNormals(boolean crease)
35123828 {
35133829 group.GenNormalsS(crease);
3830
+
3831
+ refreshContents();
3832
+ }
3833
+
3834
+ void GenNormalsMESH()
3835
+ {
3836
+ group.GenNormalsMeshS();
35143837
35153838 refreshContents();
35163839 }
....@@ -4138,6 +4461,18 @@
41384461 refreshContents();
41394462 }
41404463
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
+
41414476 void SetTexRes(int tr)
41424477 {
41434478 group.selection.SetTexRes(tr);
....@@ -4209,10 +4544,6 @@
42094544 // }
42104545 // }
42114546
4212
- static boolean allparams = true;
4213
-
4214
- static Vector<Object3D> listUI = new Vector<Object3D>();
4215
-
42164547 void EditSelection(boolean newWindow)
42174548 {
42184549 // aConstraints.gridy = 0;
....@@ -4220,7 +4551,7 @@
42204551 {
42214552 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42224553 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4223
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4554
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42244555
42254556 Object3D elem = (Object3D)group.selection.elementAt(i);
42264557 if(elem != group || !newWindow)
....@@ -4305,7 +4636,8 @@
43054636 //new Exception().printStackTrace();
43064637
43074638 freezemodel = true;
4308
-
4639
+ ClearUnpinned();
4640
+
43094641 /**/
43104642 //switch (event.id)
43114643 {
....@@ -4313,7 +4645,6 @@
43134645 //case 702: // Event.LIST_DESELECT
43144646 group.deselectAll();
43154647 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4316
- objEditor.ClearInfo(); // .GetMaterial());
43174648 if (tps != null)
43184649 {
43194650 for (int i=0; i < tps.length; i++)
....@@ -4322,10 +4653,8 @@
43224653
43234654 //if (child.parent != null)
43244655 //child.parent.addSelectee(child);
4656
+ objEditor.SetMaterial(child);
43254657 group.addSelectee(child);
4326
- objEditor.SetMaterial(child); // .GetMaterial());
4327
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4328
- System.err.println("info : " + child.GetPath());
43294658 }
43304659 }
43314660 // else
....@@ -4335,15 +4664,13 @@
43354664 // System.err.println("info : " + group.GetPath());
43364665 // }
43374666
4338
- objEditor.SetText(); // jan 2014
4339
-
43404667 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43414668 CameraPane.flash = true;
43424669
43434670 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43444671 // a camera
43454672 {
4346
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4673
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43474674 {
43484675 CameraPane.camerachangeframe = 0; // don't refuse it
43494676 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4352,6 +4679,13 @@
43524679 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43534680 }
43544681
4682
+ if (tps != null && tps.length == 1)
4683
+ {
4684
+ EditSelection(false);
4685
+ }
4686
+
4687
+ SetPinStates(tps != null && tps.length > 0);
4688
+
43554689 refreshContents();
43564690 //return true;
43574691 }
....@@ -4360,6 +4694,35 @@
43604694
43614695 freezemodel = false;
43624696 }
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
+ }
43634726
43644727 void linkSomething(Object3D thing)
43654728 {
....@@ -4442,6 +4805,7 @@
44424805
44434806 if (cut)
44444807 {
4808
+ if (Globals.SAVEONMAKE)
44454809 Save();
44464810 //int indices[] = jList.getSelectedIndices();
44474811 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -5160,10 +5524,31 @@
51605524 cButton clearpanelButton;
51615525 cButton unselectButton;
51625526
5527
+ cButton restoreCameraButton;
5528
+
5529
+ cButton minButton;
5530
+ cButton maxButton;
5531
+ cButton fullButton;
51635532 cButton saveButton;
5164
- cButton undoButton;
5165
- cButton redoButton;
51665533 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;
51675552
51685553 cButton screenfitButton;
51695554 cButton screenfitpointButton;
....@@ -5176,14 +5561,6 @@
51765561
51775562 cButton setsupportButton;
51785563
5179
- cButton twoButton;
5180
- cButton sixButton;
5181
- cButton threeButton;
5182
- cButton sevenButton;
5183
- cButton fourButton; // full panel
5184
- cButton oneButton; // full XYZ
5185
- //cButton currentLayout;
5186
-
51875564 //
51885565 //Composite
51895566 Object3D // to do !!
....@@ -5193,11 +5570,11 @@
51935570 //JTree jTree;
51945571 private MenuItem lookAtItem;
51955572 private MenuItem lookFromItem;
5196
- private MenuItem switchItem;
5573
+ private MenuItem switchViewItem;
51975574 private MenuItem cutItem;
51985575 private MenuItem undoItem;
51995576 private MenuItem redoItem;
5200
- private MenuItem duplicateItem;
5577
+ private JMenuItem duplicateItem;
52015578 private MenuItem cloneItem;
52025579 private MenuItem cloneSupportItem;
52035580 private MenuItem overwriteGeoItem;
....@@ -5260,6 +5637,10 @@
52605637 private MenuItem showleavesItem;
52615638 private MenuItem markleavesItem;
52625639 private MenuItem unmarkleavesItem;
5640
+ private MenuItem rewindleavesItem;
5641
+ private MenuItem unrewindleavesItem;
5642
+ private MenuItem randomleavesItem;
5643
+ private MenuItem unrandomleavesItem;
52635644
52645645 private MenuItem flipVItem;
52655646 private MenuItem unflipVItem;
....@@ -5281,7 +5662,7 @@
52815662 private MenuItem frontItem;
52825663 private MenuItem cameraItem;
52835664 private MenuItem compositeItem;
5284
- private MenuItem randomItem;
5665
+ private MenuItem switchItem;
52855666 private MenuItem physicsItem;
52865667 private MenuItem frameselectorItem;
52875668 private MenuItem scriptNodeItem;
....@@ -5355,5 +5736,5 @@
53555736
53565737 Menu cameraMenu;
53575738 MenuItem editCameraItem;
5358
- MenuItem revertCameraItem;
5739
+ MenuItem restoreCameraItem;
53595740 }