Normand Briere
2019-06-26 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1
GroupEditor.java
....@@ -150,16 +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
- undoItem = menu.add(new MenuItem("Undo"));
158
- undoItem.addActionListener(this);
159
- redoItem = menu.add(new MenuItem("Redo"));
160
- redoItem.addActionListener(this);
161
- menu.add("-");
162
- 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"));
163166 duplicateItem.addActionListener(this);
164167 cloneItem = menu.add(new MenuItem("Clone"));
165168 cloneItem.addActionListener(this);
....@@ -175,7 +178,6 @@
175178 copyItem.addActionListener(this);
176179 pasteItem = menu.add(new MenuItem("Paste"));
177180 pasteItem.addActionListener(this);
178
- menu.add("-");
179181
180182 menu.add("-");
181183 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -202,21 +204,21 @@
202204 //zBufferItem.addActionListener(this);
203205 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204206 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Camera"));
206
- revertCameraItem.addActionListener(this);
207
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
208
+ restoreCameraItem.addActionListener(this);
207209
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
212
-
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- 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);
220222
221223 cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
222224 toggleHandleItem.addItemListener(this);
....@@ -245,7 +247,7 @@
245247
246248 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247249 toggleDebugItem.addItemListener(this);
248
- toggleDebugItem.setState(CameraPane.DEBUG);
250
+ toggleDebugItem.setState(Globals.DEBUG);
249251
250252 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251253 toggleFrustumItem.addItemListener(this);
....@@ -266,14 +268,14 @@
266268 // animationItem.addItemListener(this);
267269 // animationItem.setState(CameraPane.ANIMATION);
268270 cameraMenu.add("-");
269
- cameraMenu.add(editCameraItem = new MenuItem("Save Camera"));
271
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270272 editCameraItem.addActionListener(this);
271273
272274 if (Globals.ADVANCED)
273275 {
274276 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275277 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
278
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277279 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278280 oe.cameraMenu.add("-");
279281 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +283,7 @@
281283 editLeafItem.addActionListener(this);
282284 lookAtItem.addActionListener(this);
283285 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
286
+ //switchViewItem.addActionListener(this);
285287 }
286288
287289 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +328,29 @@
326328 }
327329
328330 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
331333 backItem = menu.add(new MenuItem("Back"));
332334 backItem.addActionListener(this);
333335 frontItem = menu.add(new MenuItem("Front"));
334336 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
337342 hideItem = menu.add(new MenuItem("Hidden Group"));
338343 hideItem.addActionListener(this);
344
+ }
339345 ungroupItem = menu.add(new MenuItem("Ungroup"));
340346 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- 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
+ {
344354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345355 switchGeoItem.addActionListener(this);
346356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +358,6 @@
348358 morphItem = menu.add(new MenuItem("Morph Group"));
349359 morphItem.addActionListener(this);
350360
351
- if (Globals.ADVANCED)
352
- {
353361 menu.add("-");
354362 physicsItem = menu.add(new MenuItem("Physics"));
355363 physicsItem.addActionListener(this);
....@@ -357,22 +365,20 @@
357365 frameselectorItem.addActionListener(this);
358366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359367 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362368 }
363369
364370 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
367373 billboardItem = menu.add(new MenuItem("Billboard"));
368374 billboardItem.addActionListener(this);
369375 csgItem = menu.add(new MenuItem("CSG"));
370376 csgItem.addActionListener(this);
371
- shadowXItem = menu.add(new MenuItem("Shadow X"));
377
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
372378 shadowXItem.addActionListener(this);
373
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
379
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
374380 shadowYItem.addActionListener(this);
375
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
381
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376382 shadowZItem.addActionListener(this);
377383 if (Globals.ADVANCED)
378384 {
....@@ -469,6 +475,14 @@
469475 markleavesItem.addActionListener(this);
470476 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
471477 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);
472486 menu.add("-");
473487 flipVItem = menu.add(new MenuItem("Flip V"));
474488 flipVItem.addActionListener(this);
....@@ -526,6 +540,18 @@
526540
527541 void SetupUI2(ObjEditor oe)
528542 {
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
+
529555 //new Exception().printStackTrace();
530556
531557 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -554,27 +580,63 @@
554580 oe.radioPanel.add(dummyButton);
555581 oe.buttonGroup.add(dummyButton);
556582 */
583
+ cGridBag copyOptionsPanel = new cGridBag();
584
+
585
+ copyOptionsPanel.preferredHeight = 2;
586
+
557587 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
558588
559
- 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);
560620 liveCB.setToolTipText("Enable animation");
561621 liveCB.addItemListener(this);
562622
563
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
564624 oneStepButton.setToolTipText("Animate one step forward");
565625 oneStepButton.addActionListener(this);
566626
567
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
627
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
568628 fastCB.setToolTipText("Fast mode");
569629 fastCB.addItemListener(this);
570630
571
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
572
- trackCB.setToolTipText("Enable tracking");
573
- trackCB.addItemListener(this);
574
-
575
- 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);
576634 screenfitButton.setToolTipText("Screen fit");
577635 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);
578640
579641 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
580642 // screenfitpointButton.addActionListener(this);
....@@ -586,65 +648,144 @@
586648 snapobjectButton.setToolTipText("Snap Object");
587649 }
588650
589
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
- flashSelectionButton.setToolTipText("Show selection");
591
- flashSelectionButton.addActionListener(this);
651
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
592652
593
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
594
-
595
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596654 twoButton.setToolTipText("Show center view only");
597655 twoButton.addActionListener(this);
598
- 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);
599659 fourButton.addActionListener(this);
600660 fourButton.setToolTipText("Show left panel only");
601
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602662 sixButton.setToolTipText("2-column layout left");
603663 sixButton.addActionListener(this);
604
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605665 threeButton.setToolTipText("2-column layout right");
606666 threeButton.addActionListener(this);
607
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608668 sevenButton.setToolTipText("3-column layout");
609669 sevenButton.addActionListener(this);
610670 //
611671
612
- 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);
613673 rootButton.setToolTipText("Edit selection in new tab");
614674 rootButton.addActionListener(this);
615675
616
- 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);
617677 closeButton.setToolTipText("Close tab");
618678 closeButton.addActionListener(this);
619679 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
620680 //clearButton.addActionListener(this);
621
-
622
- 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
+ }
623713
624
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
714
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ particlesButton.setToolTipText("Create particle system");
716
+ particlesButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.Return();
719
+
720
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721
+ groupButton.setToolTipText("Create group");
722
+ groupButton.addActionListener(this);
723
+
724
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ compositeButton.setToolTipText("Create composite");
726
+ compositeButton.addActionListener(this);
727
+
728
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ switchButton.setToolTipText("Create switch");
730
+ switchButton.addActionListener(this);
731
+
732
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ loopButton.setToolTipText("Create loop");
734
+ loopButton.addActionListener(this);
735
+
736
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737
+ textureButton.setToolTipText("Create texture");
738
+ textureButton.addActionListener(this);
739
+
740
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ overlayButton.setToolTipText("Create overlay");
742
+ overlayButton.addActionListener(this);
743
+
744
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ lightButton.setToolTipText("Create light");
746
+ lightButton.addActionListener(this);
747
+
748
+ for (int i=6; --i>=0;)
749
+ {
750
+ oe.toolboxPanel.Return();
751
+ oe.toolboxPanel.add(new cGridBag());
752
+ oe.toolboxPanel.add(new cGridBag());
753
+ oe.toolboxPanel.add(new cGridBag());
754
+ oe.toolboxPanel.add(new cGridBag());
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ }
759
+
760
+ // EDIT panel
761
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
625762 editButton.setToolTipText("Edit selection");
626763 editButton.addActionListener(this);
627764
628
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629766 uneditButton.setToolTipText("Unedit selection");
630767 uneditButton.addActionListener(this);
631768
632
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
769
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
633770 allParamsButton.setToolTipText("Edit all params");
634771 allParamsButton.addActionListener(this);
635772
636
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637774 clearPanelButton.setToolTipText("Clear edit panel");
638775 clearPanelButton.addActionListener(this);
639776
640
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641778 unselectButton.setToolTipText("Unselect");
642779 unselectButton.addActionListener(this);
643780
644
- 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);
645784
646
- oe.treePanel.add(commandsPanel);
647
- oe.treePanel.Return();
785
+ editCommandsPanel.preferredHeight = 1;
786
+
787
+// oe.treePanel.add(commandsPanel);
788
+// oe.treePanel.Return();
648789
649790 // oe.aConstraints.gridx += 1;
650791 // oe.aConstraints.weighty = 0;
....@@ -661,27 +802,12 @@
661802
662803 JScrollPane jSP;
663804 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
664
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
805
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
665806 ResetModel();
666807
667808 oe.treePanel.add(jSPPanel);
668809 oe.treePanel.Return();
669810
670
- cGridBag copyOptionsPanel = new cGridBag();
671
-
672
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
673
- colorCB.setToolTipText("Copy color when dropped");
674
- colorCB.addItemListener(this);
675
-
676
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
677
- materialCB.setToolTipText("Copy material when dropped");
678
- materialCB.addItemListener(this);
679
-
680
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
681
- textureCB.setToolTipText("Copy texture when dropped");
682
- textureCB.addItemListener(this);
683
-
684
- copyOptionsPanel.preferredHeight = 1;
685811 oe.treePanel.add(copyOptionsPanel);
686812 oe.treePanel.Return();
687813
....@@ -712,6 +838,20 @@
712838
713839 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
714840 {
841
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
842
+ colorCB.setToolTipText("Copy color when dropped");
843
+ colorCB.addItemListener(this);
844
+
845
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
846
+ materialCB.setToolTipText("Copy material when dropped");
847
+ materialCB.addItemListener(this);
848
+
849
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
850
+ textureCB.setToolTipText("Copy texture when dropped");
851
+ textureCB.addItemListener(this);
852
+
853
+ panel.Return();
854
+
715855 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
716856 boxCB.setToolTipText("Display bounding boxes");
717857 boxCB.addItemListener(this);
....@@ -729,6 +869,8 @@
729869 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
730870 // localCB.addItemListener(this);
731871
872
+ panel.Return();
873
+
732874 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
733875 crowdCB.setToolTipText("Used for crowds");
734876 crowdCB.addItemListener(this);
....@@ -745,6 +887,8 @@
745887 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
746888 // speakerMocapCB.addItemListener(this);
747889
890
+ panel.Return();
891
+
748892 if (false)
749893 {
750894 // handled in scripts
....@@ -759,32 +903,72 @@
759903 //constraints.gridy += 1;
760904 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
761905 smoothfocusCB.addItemListener(this);
906
+ panel.Return();
762907 }
763908
764909 //constraints.gridx += 1;
765910 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
766911 // debugCB.addItemListener(this);
767912
913
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
914
+ trackCB.setToolTipText("Enable tracking target");
915
+ trackCB.addItemListener(this);
916
+
768917 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
918
+ oeilCB.setToolTipText("Move camera when tracking");
769919 oeilCB.addItemListener(this);
770920
921
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
922
+ shadowCB.setToolTipText("Compute shadows when live");
923
+ shadowCB.addItemListener(this);
924
+
925
+ panel.Return();
926
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
927
+ toggleTextureCB.setToolTipText("Load textures");
928
+ toggleTextureCB.addItemListener(this);
929
+
930
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
931
+ toggleSwitchCB.setToolTipText("Use switch");
932
+ toggleSwitchCB.addItemListener(this);
933
+
934
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
935
+ autosaveCB.setToolTipText("Auto-save on structure change");
936
+ autosaveCB.addItemListener(this);
937
+
938
+ panel.Return();
939
+ if (Globals.ADVANCED)
940
+ {
771941 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
772942 lookAtCB.setToolTipText("Look-at target");
773943 lookAtCB.addItemListener(this);
944
+ }
774945
775946 }
776947
777948 cGridBag fill = new cGridBag();
778
-
779949 fill.preferredHeight = 200;
950
+ cGridBag fill2 = new cGridBag();
951
+ fill2.preferredHeight = 200;
952
+ cGridBag fill3 = new cGridBag();
953
+ fill3.preferredHeight = 200;
780954
781955 panel.add(fill);
956
+ panel.add(fill2);
957
+ panel.add(fill3);
782958
783959 }
784960
785961 void EditObject(Object3D obj)
786962 {
787963 cRadio radioButton = new cRadio(obj.name);
964
+
965
+ // Patch to avoid bug with transparency.
966
+ radioButton.hadMaterial = obj.material != null;
967
+ if (!radioButton.hadMaterial)
968
+ {
969
+ obj.material = new cMaterial();
970
+ }
971
+
788972 radioButton.SetObject(obj);
789973 radioButton.layout = sevenButton;
790974 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -796,6 +980,8 @@
796980
797981 void SetupViews(ObjEditor oe)
798982 {
983
+ theFrame = this;
984
+
799985 oe.SetupViews();
800986
801987 System.out.println("SetupViews");
....@@ -804,23 +990,27 @@
804990 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
805991 }
806992
807
- JCheckBox liveCB;
808
- JCheckBox supportCB;
809
- JCheckBox localCB;
810
- JCheckBox crowdCB;
811
- JCheckBox smoothCB;
812
- JCheckBox fastCB;
813
- JCheckBox slowCB;
814
- JCheckBox boxCB;
815
- JCheckBox zoomBoxCB;
816
- JCheckBox trackCB;
817
- JCheckBox smoothfocusCB;
993
+ cToggleButton liveCB;
994
+ cCheckBox supportCB;
995
+ cCheckBox localCB;
996
+ cCheckBox crowdCB;
997
+ cCheckBox smoothCB;
998
+ cToggleButton fastCB;
999
+ cCheckBox slowCB;
1000
+ cCheckBox boxCB;
1001
+ cCheckBox zoomBoxCB;
1002
+ //cToggleButton trackCB;
1003
+ cCheckBox trackCB;
1004
+ cCheckBox smoothfocusCB;
8181005 // JCheckBox speakerMocapCB;
819
- JCheckBox speakerCameraCB;
820
- JCheckBox speakerFocusCB;
821
- JCheckBox debugCB;
822
- JCheckBox oeilCB;
823
- JCheckBox lookAtCB;
1006
+ cCheckBox speakerCameraCB;
1007
+ cCheckBox speakerFocusCB;
1008
+ cCheckBox debugCB;
1009
+
1010
+ cCheckBox oeilCB;
1011
+ cCheckBox shadowCB;
1012
+ cCheckBox autosaveCB;
1013
+ cCheckBox lookAtCB;
8241014
8251015 // static int COLOR = 1;
8261016 // static int MATERIAL = 2;
....@@ -828,9 +1018,9 @@
8281018
8291019 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8301020
831
- JCheckBox colorCB;
832
- JCheckBox materialCB;
833
- JCheckBox textureCB;
1021
+ cCheckBox colorCB;
1022
+ cCheckBox materialCB;
1023
+ cCheckBox textureCB;
8341024
8351025 public void itemStateChanged(ItemEvent e)
8361026 {
....@@ -858,6 +1048,7 @@
8581048 } else if(e.getSource() == liveCB)
8591049 {
8601050 cameraView.ToggleLive();
1051
+ refreshContents(false);
8611052 }
8621053 else if(e.getSource() == supportCB)
8631054 {
....@@ -922,6 +1113,14 @@
9221113 {
9231114 cameraView.ToggleOeil();
9241115 }
1116
+ else if(e.getSource() == shadowCB)
1117
+ {
1118
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1119
+ }
1120
+ else if(e.getSource() == autosaveCB)
1121
+ {
1122
+ Globals.SAVEONMAKE ^= true;
1123
+ }
9251124 else if(e.getSource() == lookAtCB)
9261125 {
9271126 cameraView.ToggleLookAt();
....@@ -938,7 +1137,8 @@
9381137
9391138 /**/
9401139 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
941
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1140
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1141
+ TreePath path = objEditor.jTree.getSelectionPath();
9421142 if ((path == null) || (path.getPathCount() <= 1)) {
9431143 // We can't move the root node or an empty selection
9441144 return;
....@@ -1055,23 +1255,33 @@
10551255
10561256 assert target == objEditor.jTree;
10571257 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1258
+ Object3D destinationLeaf;
10581259 try {
1059
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1260
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10601261 } catch (Exception e) {
10611262 System.out.println("destinationPath : " + destinationPath);
10621263 return;
10631264 }
10641265
1065
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1266
+ for (int i=group.selection.size(); --i>=0;)
10661267 {
1268
+ Object3D child = (Object3D)group.selection.elementAt(i);
1269
+
1270
+ // Cannot move into itself
1271
+ if (child == destinationLeaf)
1272
+ return;
1273
+ }
1274
+
1275
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1276
+// {
10671277 loadClipboard(true);
10681278 objEditor.jTree.setSelectionPath(destinationPath);
10691279 pasteInto(false, false);
1070
- } else {
1071
- loadClipboard(false);
1072
- objEditor.jTree.setSelectionPath(destinationPath);
1073
- pasteInto(false, false); // true); // ???
1074
- }
1280
+// } else {
1281
+// loadClipboard(false);
1282
+// objEditor.jTree.setSelectionPath(destinationPath);
1283
+// pasteInto(false, false); // true); // ???
1284
+// }
10751285 }
10761286 public void dropActionChanged(DropTargetDragEvent dtde)
10771287 // Called if the user has modified the current drop gesture
....@@ -1176,22 +1386,30 @@
11761386 {
11771387 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11781388 //heightFieldItem.addActionListener(this);
1179
- gridItem = menu.add(new MenuItem("Grid"));
1180
- gridItem.addActionListener(this);
1181
- rectoidItem = menu.add(new MenuItem("Box"));
1182
- rectoidItem.addActionListener(this);
1183
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1184
- ellipsoidItem.addActionListener(this);
1185
- coneItem = menu.add(new MenuItem("Cone"));
1186
- coneItem.addActionListener(this);
1187
- torusItem = menu.add(new MenuItem("Torus"));
1188
- torusItem.addActionListener(this);
1189
- superItem = menu.add(new MenuItem("Superellipsoid"));
1190
- superItem.addActionListener(this);
1389
+// gridItem = menu.add(new MenuItem("Grid"));
1390
+// gridItem.addActionListener(this);
1391
+// rectoidItem = menu.add(new MenuItem("Box"));
1392
+// rectoidItem.addActionListener(this);
1393
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1394
+// ellipsoidItem.addActionListener(this);
1395
+// coneItem = menu.add(new MenuItem("Cone"));
1396
+// coneItem.addActionListener(this);
1397
+// torusItem = menu.add(new MenuItem("Torus"));
1398
+// torusItem.addActionListener(this);
1399
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1400
+// superItem.addActionListener(this);
1401
+
1402
+ cameraItem = menu.add(new MenuItem("Camera"));
1403
+ cameraItem.addActionListener(this);
1404
+
1405
+ if (!Globals.ADVANCED)
1406
+ {
11911407 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11921408 kleinItem.addActionListener(this);
1193
- particleItem = menu.add(new MenuItem("Particle system"));
1194
- particleItem.addActionListener(this);
1409
+ }
1410
+
1411
+// particleItem = menu.add(new MenuItem("Particle system"));
1412
+// particleItem.addActionListener(this);
11951413 if (Globals.ADVANCED)
11961414 {
11971415 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1217,15 +1435,15 @@
12171435 }
12181436 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12191437 bezierItem.addActionListener(this);
1220
- overlayItem = menu.add(new MenuItem("Overlay"));
1221
- overlayItem.addActionListener(this);
1222
- lightItem = menu.add(new MenuItem("Light"));
1223
- lightItem.addActionListener(this);
1438
+// overlayItem = menu.add(new MenuItem("Overlay"));
1439
+// overlayItem.addActionListener(this);
1440
+// lightItem = menu.add(new MenuItem("Light"));
1441
+// lightItem.addActionListener(this);
12241442 menu.add("-");
12251443 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12261444 //superLoopItem.addActionListener(this);
1227
- loopItem = menu.add(new MenuItem("Loop"));
1228
- loopItem.addActionListener(this);
1445
+// loopItem = menu.add(new MenuItem("Loop"));
1446
+// loopItem.addActionListener(this);
12291447 doubleItem = menu.add(new MenuItem("Fork"));
12301448 doubleItem.addActionListener(this);
12311449 if (Globals.ADVANCED)
....@@ -1265,7 +1483,7 @@
12651483 memoryItem.addActionListener(this);
12661484 menu.add(analyzeItem = new MenuItem("Analyze"));
12671485 analyzeItem.addActionListener(this);
1268
- menu.add(dumpItem = new MenuItem("Dump"));
1486
+ menu.add(dumpItem = new MenuItem("Print"));
12691487 dumpItem.addActionListener(this);
12701488 // menu.add(pathItem = new MenuItem("From-to path"));
12711489 // pathItem.addActionListener(this);
....@@ -1406,6 +1624,7 @@
14061624 shadow.material = new cMaterial(obj.material);
14071625 shadow.material.diffuse = 0.0001f;
14081626 shadow.material.specular = 0.0001f;
1627
+ //shadow.projectedVertices[1].x = 300;
14091628
14101629 makeSomething(shadow);
14111630 }
....@@ -1653,7 +1872,7 @@
16531872 {
16541873 ScreenFit();
16551874 } else
1656
- if (source == switchItem)
1875
+ if (source == switchViewItem)
16571876 {
16581877 cVector v1 = new cVector();
16591878 cVector v2 = new cVector();
....@@ -1662,11 +1881,11 @@
16621881 objEditor.cameraView.renderCamera.setAim(v2, v1);
16631882 objEditor.cameraView.repaint();
16641883 } else
1665
- if (source == rectoidItem)
1884
+ if (source == rectoidItem || source == boxButton)
16661885 {
16671886 makeSomething(new Box());
16681887 } else
1669
- if (source == particleItem)
1888
+ if (source == particleItem || source == particlesButton)
16701889 {
16711890 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16721891 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1745,27 +1964,27 @@
17451964
17461965 makeSomething(obj);
17471966 } else
1748
- if (source == gridItem)
1967
+ if (source == gridItem || source == gridButton)
17491968 {
17501969 makeSomething(new Grid());
17511970 } else
1752
- if (source == ellipsoidItem)
1971
+ if (source == ellipsoidItem || source == sphereButton)
17531972 {
17541973 makeSomething(new Sphere());
17551974 } else
1756
- if (source == coneItem)
1975
+ if (source == coneItem || source == coneButton)
17571976 {
17581977 makeSomething(new Cone());
17591978 } else
1760
- if (source == torusItem)
1979
+ if (source == torusItem || source == torusButton)
17611980 {
17621981 makeSomething(new Torus());
17631982 } else
1764
- if (source == superItem)
1983
+ if (source == superItem || source == superButton)
17651984 {
17661985 makeSomething(new Superellipsoid());
17671986 } else
1768
- if (source == kleinItem)
1987
+ if (source == kleinItem || source == kleinButton)
17691988 {
17701989 makeSomething(new Klein());
17711990 } else
....@@ -1785,7 +2004,7 @@
17852004 {
17862005 makeSomething(new BezierSurface());
17872006 } else
1788
- if (source == overlayItem)
2007
+ if (source == overlayItem || source == overlayButton)
17892008 {
17902009 /*
17912010 Object3D obj = new BezierSurface(5,8);
....@@ -1833,7 +2052,7 @@
18332052 s.setup();
18342053 makeSomething(s);
18352054 } else
1836
- if (source == lightItem)
2055
+ if (source == lightItem || source == lightButton)
18372056 {
18382057 makeSomething(new Light());
18392058 } else
....@@ -1883,7 +2102,7 @@
18832102
18842103 group(g);
18852104 } else
1886
- if (source == loopItem)
2105
+ if (source == loopItem || source == loopButton)
18872106 {
18882107 Composite csg = new GroupLeaf();
18892108 csg.count = 5;
....@@ -1955,6 +2174,30 @@
19552174 if (source == dumpItem)
19562175 {
19572176 DumpObject();
2177
+ } else
2178
+ if (source == minButton)
2179
+ {
2180
+ Minimize();
2181
+ } else
2182
+ if (source == maxButton)
2183
+ {
2184
+ Maximize();
2185
+ } else
2186
+ if (source == fullButton)
2187
+ {
2188
+ ToggleFullScreen();
2189
+ } else
2190
+ if (source == undoButton)
2191
+ {
2192
+ Undo();
2193
+ } else
2194
+ if (source == redoButton)
2195
+ {
2196
+ Redo();
2197
+ } else
2198
+ if (source == saveButton)
2199
+ {
2200
+ Save();
19582201 } else
19592202 if (source == oneStepButton)
19602203 {
....@@ -2349,9 +2592,9 @@
23492592 {
23502593 ClearSelection(true);
23512594 } else
2352
- if (source == grabItem)
2595
+ if (source == grabItem || source == groupButton)
23532596 {
2354
- group(new cGroup(), true);
2597
+ group(new cGroup(), false); // true);
23552598 } else
23562599 if (source == hideItem)
23572600 {
....@@ -2369,11 +2612,11 @@
23692612 {
23702613 makeSomething(new Camera());
23712614 } else
2372
- if (source == compositeItem)
2615
+ if (source == compositeItem || source == compositeButton)
23732616 {
23742617 group(new Composite());
23752618 } else
2376
- if (source == randomItem)
2619
+ if (source == switchItem || source == switchButton)
23772620 {
23782621 RandomNode random = new RandomNode();
23792622 group(random);
....@@ -2475,7 +2718,7 @@
24752718 {
24762719 group(new cLinker());
24772720 } else
2478
- if (source == textureItem)
2721
+ if (source == textureItem || source == textureButton)
24792722 {
24802723 group(new TextureNode());
24812724 } else
....@@ -2495,7 +2738,7 @@
24952738 {
24962739 CastShadow(2);
24972740 } else
2498
- if (source == ungroupItem)
2741
+ if (source == ungroupItem || source == ungroupButton)
24992742 {
25002743 //ungroup();
25012744 for (int i=0; i<group.selection.size(); i++)
....@@ -2517,7 +2760,7 @@
25172760 } else
25182761 if (source == genNormalsMESHItem)
25192762 {
2520
- GenNormals(true); // TODO
2763
+ GenNormalsMESH();
25212764 } else
25222765 if (source == genNormalsORGANItem)
25232766 {
....@@ -2582,6 +2825,22 @@
25822825 if (source == unmarkleavesItem)
25832826 {
25842827 MarkLeaves(false);
2828
+ } else
2829
+ if (source == rewindleavesItem)
2830
+ {
2831
+ RewindLeaves(true);
2832
+ } else
2833
+ if (source == unrewindleavesItem)
2834
+ {
2835
+ RewindLeaves(false);
2836
+ } else
2837
+ if (source == randomleavesItem)
2838
+ {
2839
+ RandomLeaves(true);
2840
+ } else
2841
+ if (source == unrandomleavesItem)
2842
+ {
2843
+ RandomLeaves(false);
25852844 } else
25862845 if (source == flipVItem)
25872846 {
....@@ -2817,6 +3076,10 @@
28173076 if (source == twoButton)
28183077 {
28193078 radio.layout = twoButton;
3079
+
3080
+ if (CameraPane.FULLSCREEN)
3081
+ fullscreenLayout = radio.layout;
3082
+
28203083 // bug
28213084 //gridPanel.setDividerLocation(1.0);
28223085 //bigPanel.setDividerLocation(0.0);
....@@ -2849,10 +3112,31 @@
28493112 bigThree.ClearUI();
28503113 bigThree.add(centralPanel);
28513114 bigThree.FlushUI();
3115
+
3116
+ cameraView.requestFocusInWindow();
3117
+
3118
+// refreshContents(true);
3119
+//
3120
+// try
3121
+// {
3122
+// java.awt.Robot bot = new java.awt.Robot();
3123
+// int mask = InputEvent.BUTTON1_MASK;
3124
+// bot.mouseMove(100, 100);
3125
+// bot.mousePress(mask);
3126
+// bot.mouseRelease(mask);
3127
+// }
3128
+// catch (Exception e)
3129
+// {
3130
+//
3131
+// }
3132
+
28523133 } else
28533134 if (source == threeButton)
28543135 {
28553136 radio.layout = threeButton;
3137
+
3138
+ if (CameraPane.FULLSCREEN)
3139
+ fullscreenLayout = radio.layout;
28563140
28573141 // bigThree.remove(scenePanel);
28583142 // bigThree.remove(centralPanel);
....@@ -2885,10 +3169,15 @@
28853169 bigThree.add(centralPanel);
28863170 bigThree.add(XYZPanel);
28873171 bigThree.FlushUI();
3172
+
3173
+ cameraView.requestFocusInWindow();
28883174 } else
28893175 if (source == fourButton)
28903176 {
28913177 radio.layout = fourButton;
3178
+
3179
+ if (CameraPane.FULLSCREEN)
3180
+ fullscreenLayout = radio.layout;
28923181
28933182 // bigThree.remove(scenePanel);
28943183 // bigThree.remove(centralPanel);
....@@ -2920,10 +3209,15 @@
29203209 bigThree.ClearUI();
29213210 bigThree.add(scenePanel);
29223211 bigThree.FlushUI();
3212
+
3213
+ cameraView.requestFocusInWindow();
29233214 } else
29243215 if (source == sixButton)
29253216 {
29263217 radio.layout = sixButton;
3218
+
3219
+ if (CameraPane.FULLSCREEN)
3220
+ fullscreenLayout = radio.layout;
29273221
29283222 // bigThree.remove(scenePanel);
29293223 // bigThree.remove(centralPanel);
....@@ -2956,10 +3250,15 @@
29563250 bigThree.add(scenePanel);
29573251 bigThree.add(centralPanel);
29583252 bigThree.FlushUI();
3253
+
3254
+ cameraView.requestFocusInWindow();
29593255 } else
29603256 if (source == sevenButton)
29613257 {
29623258 radio.layout = sevenButton;
3259
+
3260
+ if (CameraPane.FULLSCREEN)
3261
+ fullscreenLayout = radio.layout;
29633262
29643263 // bigThree.remove(scenePanel);
29653264 // bigThree.remove(centralPanel);
....@@ -2993,6 +3292,8 @@
29933292 bigThree.add(centralPanel);
29943293 bigThree.add(XYZPanel);
29953294 bigThree.FlushUI();
3295
+
3296
+ cameraView.requestFocusInWindow();
29963297 } else
29973298 if (source == rootButton)
29983299 {
....@@ -3004,6 +3305,7 @@
30043305 EditObject(obj);
30053306 }
30063307
3308
+ cameraView.requestFocusInWindow();
30073309 refreshContents(true);
30083310 } else
30093311 if (source == closeButton)
....@@ -3013,22 +3315,37 @@
30133315 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30143316 {
30153317 ab = (cRadio)e.nextElement();
3016
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3318
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30173319 {
3320
+ // Patch to avoid bug with transparency.
3321
+ if (!ab.hadMaterial)
3322
+ {
3323
+ ab.object.material = null;
3324
+ }
3325
+
30183326 buttonGroup.remove(ab);
30193327 radioPanel.remove(ab);
30203328
3021
- ab.GetObject().editWindow = null;
3329
+ //ab.GetObject().editWindow = null;
3330
+ ab.GetObject().manipWindow = null;
30223331 // ab.GetObject().objectUI = null; // ?????????
30233332
30243333 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30253334 break;
30263335 }
30273336 }
3337
+
3338
+ cameraView.requestFocusInWindow();
30283339 refreshContents(true);
30293340 } else
30303341 if (source == editItem || source == editButton)
30313342 {
3343
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3344
+ {
3345
+ Object3D child = (Object3D)e.nextElement();
3346
+ child.pinned = true;
3347
+ }
3348
+
30323349 EditSelection(false);
30333350 } else
30343351 if (source == uneditButton)
....@@ -3038,6 +3355,7 @@
30383355 Object3D child = (Object3D)e.nextElement();
30393356 if(child.editWindow != null)
30403357 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3358
+ child.pinned = false;
30413359 child.CloseUI();
30423360 listUI.remove(child);
30433361
....@@ -3054,6 +3372,7 @@
30543372 //copy.ClearUI();
30553373 for (Object3D obj : listUI)
30563374 {
3375
+ obj.pinned = true;
30573376 obj.CloseUI();
30583377 }
30593378 listUI.clear();
....@@ -3063,7 +3382,7 @@
30633382 {
30643383 assert(copy == group);
30653384
3066
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3385
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30673386
30683387 for (Object3D obj : listUI)
30693388 {
....@@ -3128,7 +3447,9 @@
31283447 sideView.object = group;
31293448 }
31303449
3131
-// fix "+" issue group.editWindow = this;
3450
+// fix "+" issue
3451
+ //group.editWindow = this;
3452
+ group.manipWindow = this;
31323453
31333454 /*
31343455 currentLayout = radio.layout;
....@@ -3141,13 +3462,15 @@
31413462 //group.parent = null; // ROOT
31423463 //group.attributes = -1;
31433464 ResetModel();
3465
+
3466
+ cameraView.requestFocusInWindow();
31443467 refreshContents(true);
31453468 } else if (event.getSource() == editCameraItem)
31463469 {
31473470 cameraView.ProtectCamera();
31483471 cameraView.repaint();
31493472 return;
3150
- } else if (event.getSource() == revertCameraItem)
3473
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31513474 {
31523475 cameraView.RevertCamera();
31533476 cameraView.repaint();
....@@ -3164,7 +3487,6 @@
31643487 }
31653488
31663489 boolean useclient = false;
3167
- cRadio radio;
31683490
31693491 void ToggleRoot()
31703492 {
....@@ -3403,7 +3725,8 @@
34033725
34043726 int size = obj.MemorySize();
34053727
3406
- System.err.println((size/1024) + " KB is the size of " + obj);
3728
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3729
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
34073730 }
34083731 }
34093732 catch (Exception e)
....@@ -3484,6 +3807,13 @@
34843807 void GenNormals(boolean crease)
34853808 {
34863809 group.GenNormalsS(crease);
3810
+
3811
+ refreshContents();
3812
+ }
3813
+
3814
+ void GenNormalsMESH()
3815
+ {
3816
+ group.GenNormalsMeshS();
34873817
34883818 refreshContents();
34893819 }
....@@ -4111,6 +4441,18 @@
41114441 refreshContents();
41124442 }
41134443
4444
+ void RewindLeaves(boolean hide)
4445
+ {
4446
+ group.selection.RewindLeaves(hide);
4447
+ refreshContents();
4448
+ }
4449
+
4450
+ void RandomLeaves(boolean hide)
4451
+ {
4452
+ group.selection.RandomLeaves(hide);
4453
+ refreshContents();
4454
+ }
4455
+
41144456 void SetTexRes(int tr)
41154457 {
41164458 group.selection.SetTexRes(tr);
....@@ -4182,10 +4524,6 @@
41824524 // }
41834525 // }
41844526
4185
- static boolean allparams = true;
4186
-
4187
- static Vector<Object3D> listUI = new Vector<Object3D>();
4188
-
41894527 void EditSelection(boolean newWindow)
41904528 {
41914529 // aConstraints.gridy = 0;
....@@ -4193,7 +4531,7 @@
41934531 {
41944532 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41954533 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4196
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4534
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41974535
41984536 Object3D elem = (Object3D)group.selection.elementAt(i);
41994537 if(elem != group || !newWindow)
....@@ -4279,6 +4617,17 @@
42794617
42804618 freezemodel = true;
42814619
4620
+ //for (Object3D obj : listUI)
4621
+ for (int i=listUI.size(); --i>=0;)
4622
+ {
4623
+ Object3D obj = listUI.elementAt(i);
4624
+ if (!obj.pinned)
4625
+ {
4626
+ obj.CloseUI();
4627
+ listUI.remove(i);
4628
+ }
4629
+ }
4630
+
42824631 /**/
42834632 //switch (event.id)
42844633 {
....@@ -4286,7 +4635,6 @@
42864635 //case 702: // Event.LIST_DESELECT
42874636 group.deselectAll();
42884637 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4289
- objEditor.ClearInfo(); // .GetMaterial());
42904638 if (tps != null)
42914639 {
42924640 for (int i=0; i < tps.length; i++)
....@@ -4295,10 +4643,8 @@
42954643
42964644 //if (child.parent != null)
42974645 //child.parent.addSelectee(child);
4646
+ objEditor.SetMaterial(child);
42984647 group.addSelectee(child);
4299
- objEditor.SetMaterial(child); // .GetMaterial());
4300
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4301
- System.err.println("info : " + child.GetPath());
43024648 }
43034649 }
43044650 // else
....@@ -4308,15 +4654,13 @@
43084654 // System.err.println("info : " + group.GetPath());
43094655 // }
43104656
4311
- objEditor.SetText(); // jan 2014
4312
-
43134657 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43144658 CameraPane.flash = true;
43154659
43164660 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43174661 // a camera
43184662 {
4319
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4663
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43204664 {
43214665 CameraPane.camerachangeframe = 0; // don't refuse it
43224666 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4325,6 +4669,13 @@
43254669 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43264670 }
43274671
4672
+ if (tps != null && tps.length == 1)
4673
+ {
4674
+ EditSelection(false);
4675
+ }
4676
+
4677
+ SetPinStates(tps != null && tps.length > 0);
4678
+
43284679 refreshContents();
43294680 //return true;
43304681 }
....@@ -4333,6 +4684,33 @@
43334684
43344685 freezemodel = false;
43354686 }
4687
+
4688
+ void SetPinStates(boolean enabled)
4689
+ {
4690
+ editButton.setEnabled(enabled);
4691
+ uneditButton.setEnabled(enabled);
4692
+ }
4693
+
4694
+ void refreshContents(boolean cp)
4695
+ {
4696
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4697
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4698
+ {
4699
+ objEditor.ClearInfo(); // .GetMaterial());
4700
+
4701
+ for (int i=0; i < group.selection.Size(); i++)
4702
+ {
4703
+ Object3D child = (Object3D) group.selection.get(i);
4704
+
4705
+ objEditor.AddInfo(child, this, true);
4706
+ System.err.println("info : " + child.GetPath());
4707
+ }
4708
+
4709
+ objEditor.SetText(); // jan 2014
4710
+ }
4711
+
4712
+ super.refreshContents(cp);
4713
+ }
43364714
43374715 void linkSomething(Object3D thing)
43384716 {
....@@ -4404,6 +4782,7 @@
44044782 {
44054783 if (group.selection.isEmpty())
44064784 return;
4785
+
44074786 Grafreed.clipboardIsTempGroup = false;
44084787 Composite tGroup = null;
44094788 if (group.selection.size() > 0) // 1)
....@@ -4414,6 +4793,8 @@
44144793
44154794 if (cut)
44164795 {
4796
+ if (Globals.SAVEONMAKE)
4797
+ Save();
44174798 //int indices[] = jList.getSelectedIndices();
44184799 //for (int i = indices.length - 1; i >= 0; i--)
44194800 //jList.remove(indices[i]);
....@@ -4503,8 +4884,10 @@
45034884 }
45044885
45054886 }
4887
+
45064888 if (Grafreed.clipboardIsTempGroup)
45074889 Grafreed.clipboard = tGroup;
4890
+
45084891 if (cut)
45094892 {
45104893 ResetModel();
....@@ -5129,7 +5512,31 @@
51295512 cButton clearpanelButton;
51305513 cButton unselectButton;
51315514
5515
+ cButton restoreCameraButton;
5516
+
5517
+ cButton minButton;
5518
+ cButton maxButton;
5519
+ cButton fullButton;
5520
+ cButton saveButton;
51325521 cButton oneStepButton;
5522
+
5523
+ cButton groupButton;
5524
+ cButton ungroupButton;
5525
+ cButton compositeButton;
5526
+ cButton switchButton;
5527
+ cButton loopButton;
5528
+ cButton textureButton;
5529
+
5530
+ cButton gridButton;
5531
+ cButton boxButton;
5532
+ cButton sphereButton;
5533
+ cButton coneButton;
5534
+ cButton torusButton;
5535
+ cButton superButton;
5536
+ cButton kleinButton;
5537
+ cButton particlesButton;
5538
+ cButton overlayButton;
5539
+ cButton lightButton;
51335540
51345541 cButton screenfitButton;
51355542 cButton screenfitpointButton;
....@@ -5142,14 +5549,6 @@
51425549
51435550 cButton setsupportButton;
51445551
5145
- cButton twoButton;
5146
- cButton sixButton;
5147
- cButton threeButton;
5148
- cButton sevenButton;
5149
- cButton fourButton; // full panel
5150
- cButton oneButton; // full XYZ
5151
- //cButton currentLayout;
5152
-
51535552 //
51545553 //Composite
51555554 Object3D // to do !!
....@@ -5159,11 +5558,11 @@
51595558 //JTree jTree;
51605559 private MenuItem lookAtItem;
51615560 private MenuItem lookFromItem;
5162
- private MenuItem switchItem;
5561
+ private MenuItem switchViewItem;
51635562 private MenuItem cutItem;
51645563 private MenuItem undoItem;
51655564 private MenuItem redoItem;
5166
- private MenuItem duplicateItem;
5565
+ private JMenuItem duplicateItem;
51675566 private MenuItem cloneItem;
51685567 private MenuItem cloneSupportItem;
51695568 private MenuItem overwriteGeoItem;
....@@ -5226,6 +5625,10 @@
52265625 private MenuItem showleavesItem;
52275626 private MenuItem markleavesItem;
52285627 private MenuItem unmarkleavesItem;
5628
+ private MenuItem rewindleavesItem;
5629
+ private MenuItem unrewindleavesItem;
5630
+ private MenuItem randomleavesItem;
5631
+ private MenuItem unrandomleavesItem;
52295632
52305633 private MenuItem flipVItem;
52315634 private MenuItem unflipVItem;
....@@ -5247,7 +5650,7 @@
52475650 private MenuItem frontItem;
52485651 private MenuItem cameraItem;
52495652 private MenuItem compositeItem;
5250
- private MenuItem randomItem;
5653
+ private MenuItem switchItem;
52515654 private MenuItem physicsItem;
52525655 private MenuItem frameselectorItem;
52535656 private MenuItem scriptNodeItem;
....@@ -5321,5 +5724,5 @@
53215724
53225725 Menu cameraMenu;
53235726 MenuItem editCameraItem;
5324
- MenuItem revertCameraItem;
5727
+ MenuItem restoreCameraItem;
53255728 }