Normand Briere
2019-06-29 a69bb4474a3264a9a7a7f8b8d8154ea771f167c8
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,23 +204,23 @@
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("-");
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);
212222
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);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222224 toggleHandleItem.addItemListener(this);
223225 toggleHandleItem.setState(CameraPane.HANDLES);
224226
....@@ -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 = 1;
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,145 @@
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);
625
- editButton.setToolTipText("Edit selection");
714
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ particlesButton.setToolTipText("Create particle system");
716
+ particlesButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.Return();
719
+
720
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721
+ groupButton.setToolTipText("Create group");
722
+ groupButton.addActionListener(this);
723
+
724
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ compositeButton.setToolTipText("Create composite");
726
+ compositeButton.addActionListener(this);
727
+
728
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ switchButton.setToolTipText("Create item switcher");
730
+ switchButton.addActionListener(this);
731
+
732
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ loopButton.setToolTipText("Create loop");
734
+ loopButton.addActionListener(this);
735
+
736
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737
+ textureButton.setToolTipText("Create texture");
738
+ textureButton.addActionListener(this);
739
+
740
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ overlayButton.setToolTipText("Create overlay");
742
+ overlayButton.addActionListener(this);
743
+
744
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ lightButton.setToolTipText("Create light");
746
+ lightButton.addActionListener(this);
747
+
748
+ for (int i=6; --i>=0;)
749
+ {
750
+ oe.toolboxPanel.Return();
751
+ oe.toolboxPanel.add(new cGridBag());
752
+ oe.toolboxPanel.add(new cGridBag());
753
+ oe.toolboxPanel.add(new cGridBag());
754
+ oe.toolboxPanel.add(new cGridBag());
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ }
759
+
760
+ // EDIT panel
761
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
+ editButton.setToolTipText("Pin selection controls");
626763 editButton.addActionListener(this);
627764
628
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
- uneditButton.setToolTipText("Unedit selection");
765
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ uneditButton.setToolTipText("Remove selection controls");
630767 uneditButton.addActionListener(this);
631768
632
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
633
- allParamsButton.setToolTipText("Edit all params");
769
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
770
+ allParamsButton.setToolTipText("Show all controle");
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
+ SetPinStates(false);
788
+// oe.treePanel.add(commandsPanel);
789
+// oe.treePanel.Return();
648790
649791 // oe.aConstraints.gridx += 1;
650792 // oe.aConstraints.weighty = 0;
....@@ -661,27 +803,12 @@
661803
662804 JScrollPane jSP;
663805 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
664
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
806
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
665807 ResetModel();
666808
667809 oe.treePanel.add(jSPPanel);
668810 oe.treePanel.Return();
669811
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;
685812 oe.treePanel.add(copyOptionsPanel);
686813 oe.treePanel.Return();
687814
....@@ -712,23 +839,43 @@
712839
713840 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
714841 {
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
+
715856 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
716857 boxCB.setToolTipText("Display bounding boxes");
717858 boxCB.addItemListener(this);
718859
719860 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
720
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
861
+ zoomBoxCB.setToolTipText("Display only for wheel");
721862 zoomBoxCB.addItemListener(this);
722863
723864 if (true) // Globals.ADVANCED)
724865 {
725
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
726
- supportCB.setToolTipText("Enable rigging");
727
- supportCB.addItemListener(this);
866
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
867
+// supportCB.setToolTipText("Enable rigging");
868
+// supportCB.addItemListener(this);
869
+
870
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
871
+ freezeCB.setToolTipText("Fast moving camera");
872
+ freezeCB.addItemListener(this);
728873
729874 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
730875 // localCB.addItemListener(this);
731876
877
+ panel.Return();
878
+
732879 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
733880 crowdCB.setToolTipText("Used for crowds");
734881 crowdCB.addItemListener(this);
....@@ -745,6 +892,8 @@
745892 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
746893 // speakerMocapCB.addItemListener(this);
747894
895
+ panel.Return();
896
+
748897 if (false)
749898 {
750899 // handled in scripts
....@@ -759,32 +908,72 @@
759908 //constraints.gridy += 1;
760909 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
761910 smoothfocusCB.addItemListener(this);
911
+ panel.Return();
762912 }
763913
764914 //constraints.gridx += 1;
765915 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
766916 // debugCB.addItemListener(this);
767917
918
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
919
+ trackCB.setToolTipText("Enable tracking target");
920
+ trackCB.addItemListener(this);
921
+
768922 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
923
+ oeilCB.setToolTipText("Move camera when tracking");
769924 oeilCB.addItemListener(this);
770925
926
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
927
+ shadowCB.setToolTipText("When live compute shadows");
928
+ shadowCB.addItemListener(this);
929
+
930
+ panel.Return();
931
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
932
+ toggleTextureCB.setToolTipText("Load textures");
933
+ toggleTextureCB.addItemListener(this);
934
+
935
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
936
+ toggleSwitchCB.setToolTipText("Choose a single item");
937
+ toggleSwitchCB.addItemListener(this);
938
+
939
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
940
+ autosaveCB.setToolTipText("On structure change");
941
+ autosaveCB.addItemListener(this);
942
+
943
+ panel.Return();
944
+ if (Globals.ADVANCED)
945
+ {
771946 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
772947 lookAtCB.setToolTipText("Look-at target");
773948 lookAtCB.addItemListener(this);
949
+ }
774950
775951 }
776952
777953 cGridBag fill = new cGridBag();
778
-
779954 fill.preferredHeight = 200;
955
+ cGridBag fill2 = new cGridBag();
956
+ fill2.preferredHeight = 200;
957
+ cGridBag fill3 = new cGridBag();
958
+ fill3.preferredHeight = 200;
780959
781960 panel.add(fill);
961
+ panel.add(fill2);
962
+ panel.add(fill3);
782963
783964 }
784965
785966 void EditObject(Object3D obj)
786967 {
787968 cRadio radioButton = new cRadio(obj.name);
969
+
970
+ // Patch to avoid bug with transparency.
971
+ radioButton.hadMaterial = obj.material != null;
972
+ if (!radioButton.hadMaterial)
973
+ {
974
+ obj.material = new cMaterial();
975
+ }
976
+
788977 radioButton.SetObject(obj);
789978 radioButton.layout = sevenButton;
790979 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -796,6 +985,8 @@
796985
797986 void SetupViews(ObjEditor oe)
798987 {
988
+ theFrame = this;
989
+
799990 oe.SetupViews();
800991
801992 System.out.println("SetupViews");
....@@ -804,23 +995,28 @@
804995 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
805996 }
806997
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;
998
+ cToggleButton liveCB;
999
+ cCheckBox supportCB;
1000
+ cCheckBox localCB;
1001
+ cCheckBox crowdCB;
1002
+ cCheckBox smoothCB;
1003
+ cToggleButton fastCB;
1004
+ cCheckBox slowCB;
1005
+ cCheckBox boxCB;
1006
+ cCheckBox zoomBoxCB;
1007
+ cCheckBox freezeCB;
1008
+ //cToggleButton trackCB;
1009
+ cCheckBox trackCB;
1010
+ cCheckBox smoothfocusCB;
8181011 // JCheckBox speakerMocapCB;
819
- JCheckBox speakerCameraCB;
820
- JCheckBox speakerFocusCB;
821
- JCheckBox debugCB;
822
- JCheckBox oeilCB;
823
- JCheckBox lookAtCB;
1012
+ cCheckBox speakerCameraCB;
1013
+ cCheckBox speakerFocusCB;
1014
+ cCheckBox debugCB;
1015
+
1016
+ cCheckBox oeilCB;
1017
+ cCheckBox shadowCB;
1018
+ cCheckBox autosaveCB;
1019
+ cCheckBox lookAtCB;
8241020
8251021 // static int COLOR = 1;
8261022 // static int MATERIAL = 2;
....@@ -828,9 +1024,9 @@
8281024
8291025 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8301026
831
- JCheckBox colorCB;
832
- JCheckBox materialCB;
833
- JCheckBox textureCB;
1027
+ cCheckBox colorCB;
1028
+ cCheckBox materialCB;
1029
+ cCheckBox textureCB;
8341030
8351031 public void itemStateChanged(ItemEvent e)
8361032 {
....@@ -858,6 +1054,7 @@
8581054 } else if(e.getSource() == liveCB)
8591055 {
8601056 cameraView.ToggleLive();
1057
+ refreshContents(false);
8611058 }
8621059 else if(e.getSource() == supportCB)
8631060 {
....@@ -922,6 +1119,18 @@
9221119 {
9231120 cameraView.ToggleOeil();
9241121 }
1122
+ else if(e.getSource() == shadowCB)
1123
+ {
1124
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1125
+ }
1126
+ else if(e.getSource() == freezeCB)
1127
+ {
1128
+ Globals.FREEZEONMOVE ^= true;
1129
+ }
1130
+ else if(e.getSource() == autosaveCB)
1131
+ {
1132
+ Globals.SAVEONMAKE ^= true;
1133
+ }
9251134 else if(e.getSource() == lookAtCB)
9261135 {
9271136 cameraView.ToggleLookAt();
....@@ -938,7 +1147,8 @@
9381147
9391148 /**/
9401149 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
941
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1150
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1151
+ TreePath path = objEditor.jTree.getSelectionPath();
9421152 if ((path == null) || (path.getPathCount() <= 1)) {
9431153 // We can't move the root node or an empty selection
9441154 return;
....@@ -1055,23 +1265,33 @@
10551265
10561266 assert target == objEditor.jTree;
10571267 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1268
+ Object3D destinationLeaf;
10581269 try {
1059
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1270
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10601271 } catch (Exception e) {
10611272 System.out.println("destinationPath : " + destinationPath);
10621273 return;
10631274 }
10641275
1065
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1276
+ for (int i=group.selection.size(); --i>=0;)
10661277 {
1278
+ Object3D child = (Object3D)group.selection.elementAt(i);
1279
+
1280
+ // Cannot move into itself
1281
+ if (child == destinationLeaf)
1282
+ return;
1283
+ }
1284
+
1285
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1286
+// {
10671287 loadClipboard(true);
10681288 objEditor.jTree.setSelectionPath(destinationPath);
10691289 pasteInto(false, false);
1070
- } else {
1071
- loadClipboard(false);
1072
- objEditor.jTree.setSelectionPath(destinationPath);
1073
- pasteInto(false, false); // true); // ???
1074
- }
1290
+// } else {
1291
+// loadClipboard(false);
1292
+// objEditor.jTree.setSelectionPath(destinationPath);
1293
+// pasteInto(false, false); // true); // ???
1294
+// }
10751295 }
10761296 public void dropActionChanged(DropTargetDragEvent dtde)
10771297 // Called if the user has modified the current drop gesture
....@@ -1176,22 +1396,30 @@
11761396 {
11771397 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11781398 //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);
1399
+// gridItem = menu.add(new MenuItem("Grid"));
1400
+// gridItem.addActionListener(this);
1401
+// rectoidItem = menu.add(new MenuItem("Box"));
1402
+// rectoidItem.addActionListener(this);
1403
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1404
+// ellipsoidItem.addActionListener(this);
1405
+// coneItem = menu.add(new MenuItem("Cone"));
1406
+// coneItem.addActionListener(this);
1407
+// torusItem = menu.add(new MenuItem("Torus"));
1408
+// torusItem.addActionListener(this);
1409
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1410
+// superItem.addActionListener(this);
1411
+
1412
+ cameraItem = menu.add(new MenuItem("Camera"));
1413
+ cameraItem.addActionListener(this);
1414
+
1415
+ if (!Globals.ADVANCED)
1416
+ {
11911417 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11921418 kleinItem.addActionListener(this);
1193
- particleItem = menu.add(new MenuItem("Particle system"));
1194
- particleItem.addActionListener(this);
1419
+ }
1420
+
1421
+// particleItem = menu.add(new MenuItem("Particle system"));
1422
+// particleItem.addActionListener(this);
11951423 if (Globals.ADVANCED)
11961424 {
11971425 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1217,15 +1445,15 @@
12171445 }
12181446 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12191447 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);
1448
+// overlayItem = menu.add(new MenuItem("Overlay"));
1449
+// overlayItem.addActionListener(this);
1450
+// lightItem = menu.add(new MenuItem("Light"));
1451
+// lightItem.addActionListener(this);
12241452 menu.add("-");
12251453 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12261454 //superLoopItem.addActionListener(this);
1227
- loopItem = menu.add(new MenuItem("Loop"));
1228
- loopItem.addActionListener(this);
1455
+// loopItem = menu.add(new MenuItem("Loop"));
1456
+// loopItem.addActionListener(this);
12291457 doubleItem = menu.add(new MenuItem("Fork"));
12301458 doubleItem.addActionListener(this);
12311459 if (Globals.ADVANCED)
....@@ -1265,7 +1493,7 @@
12651493 memoryItem.addActionListener(this);
12661494 menu.add(analyzeItem = new MenuItem("Analyze"));
12671495 analyzeItem.addActionListener(this);
1268
- menu.add(dumpItem = new MenuItem("Dump"));
1496
+ menu.add(dumpItem = new MenuItem("Print"));
12691497 dumpItem.addActionListener(this);
12701498 // menu.add(pathItem = new MenuItem("From-to path"));
12711499 // pathItem.addActionListener(this);
....@@ -1406,9 +1634,24 @@
14061634 shadow.material = new cMaterial(obj.material);
14071635 shadow.material.diffuse = 0.0001f;
14081636 shadow.material.specular = 0.0001f;
1637
+ //shadow.projectedVertices[1].x = 300;
14091638
14101639 makeSomething(shadow);
14111640 }
1641
+
1642
+ private void ClearUnpinned()
1643
+ {
1644
+ //for (Object3D obj : listUI)
1645
+ for (int i=listUI.size(); --i>=0;)
1646
+ {
1647
+ Object3D obj = listUI.elementAt(i);
1648
+ if (!obj.pinned)
1649
+ {
1650
+ obj.CloseUI();
1651
+ listUI.remove(i);
1652
+ }
1653
+ }
1654
+ }
14121655
14131656 /**
14141657 * applyExample
....@@ -1653,7 +1896,7 @@
16531896 {
16541897 ScreenFit();
16551898 } else
1656
- if (source == switchItem)
1899
+ if (source == switchViewItem)
16571900 {
16581901 cVector v1 = new cVector();
16591902 cVector v2 = new cVector();
....@@ -1662,11 +1905,11 @@
16621905 objEditor.cameraView.renderCamera.setAim(v2, v1);
16631906 objEditor.cameraView.repaint();
16641907 } else
1665
- if (source == rectoidItem)
1908
+ if (source == rectoidItem || source == boxButton)
16661909 {
16671910 makeSomething(new Box());
16681911 } else
1669
- if (source == particleItem)
1912
+ if (source == particleItem || source == particlesButton)
16701913 {
16711914 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16721915 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1745,27 +1988,27 @@
17451988
17461989 makeSomething(obj);
17471990 } else
1748
- if (source == gridItem)
1991
+ if (source == gridItem || source == gridButton)
17491992 {
17501993 makeSomething(new Grid());
17511994 } else
1752
- if (source == ellipsoidItem)
1995
+ if (source == ellipsoidItem || source == sphereButton)
17531996 {
17541997 makeSomething(new Sphere());
17551998 } else
1756
- if (source == coneItem)
1999
+ if (source == coneItem || source == coneButton)
17572000 {
17582001 makeSomething(new Cone());
17592002 } else
1760
- if (source == torusItem)
2003
+ if (source == torusItem || source == torusButton)
17612004 {
17622005 makeSomething(new Torus());
17632006 } else
1764
- if (source == superItem)
2007
+ if (source == superItem || source == superButton)
17652008 {
17662009 makeSomething(new Superellipsoid());
17672010 } else
1768
- if (source == kleinItem)
2011
+ if (source == kleinItem || source == kleinButton)
17692012 {
17702013 makeSomething(new Klein());
17712014 } else
....@@ -1785,7 +2028,7 @@
17852028 {
17862029 makeSomething(new BezierSurface());
17872030 } else
1788
- if (source == overlayItem)
2031
+ if (source == overlayItem || source == overlayButton)
17892032 {
17902033 /*
17912034 Object3D obj = new BezierSurface(5,8);
....@@ -1833,7 +2076,7 @@
18332076 s.setup();
18342077 makeSomething(s);
18352078 } else
1836
- if (source == lightItem)
2079
+ if (source == lightItem || source == lightButton)
18372080 {
18382081 makeSomething(new Light());
18392082 } else
....@@ -1883,30 +2126,30 @@
18832126
18842127 group(g);
18852128 } else
1886
- if (source == loopItem)
2129
+ if (source == loopItem || source == loopButton)
18872130 {
18882131 Composite csg = new GroupLeaf();
18892132 csg.count = 5;
18902133 group(csg);
1891
- Composite child = new cGroup();
2134
+ Composite child = new cGroup("Branch");
18922135 csg.addChild(child);
18932136 child.addChild(csg);
18942137 } else
18952138 if (source == doubleItem)
18962139 {
1897
- Composite csg = new GroupLeaf();
2140
+ Composite csg = new GroupLeaf("Fork");
18982141 csg.count = 5;
18992142 group(csg);
1900
- Composite child = new cGroup();
2143
+ Composite child = new cGroup("Branch A");
19012144 csg.addChild(child);
19022145 child.addChild(csg);
1903
- child = new cGroup();
2146
+ child = new cGroup("Branch B");
19042147 csg.addChild(child);
19052148 child.addChild(csg);
19062149 } else
19072150 if (source == tripleItem)
19082151 {
1909
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Trident");
19102153 csg.count = 4;
19112154 group(csg);
19122155 Composite child = new cGroup();
....@@ -1955,6 +2198,30 @@
19552198 if (source == dumpItem)
19562199 {
19572200 DumpObject();
2201
+ } else
2202
+ if (source == minButton)
2203
+ {
2204
+ Minimize();
2205
+ } else
2206
+ if (source == maxButton)
2207
+ {
2208
+ Maximize();
2209
+ } else
2210
+ if (source == fullButton)
2211
+ {
2212
+ ToggleFullScreen();
2213
+ } else
2214
+ if (source == undoButton)
2215
+ {
2216
+ Undo();
2217
+ } else
2218
+ if (source == redoButton)
2219
+ {
2220
+ Redo();
2221
+ } else
2222
+ if (source == saveButton)
2223
+ {
2224
+ Save();
19582225 } else
19592226 if (source == oneStepButton)
19602227 {
....@@ -2349,9 +2616,9 @@
23492616 {
23502617 ClearSelection(true);
23512618 } else
2352
- if (source == grabItem)
2619
+ if (source == grabItem || source == groupButton)
23532620 {
2354
- group(new cGroup(), true);
2621
+ group(new cGroup(), false); // true);
23552622 } else
23562623 if (source == hideItem)
23572624 {
....@@ -2369,11 +2636,11 @@
23692636 {
23702637 makeSomething(new Camera());
23712638 } else
2372
- if (source == compositeItem)
2639
+ if (source == compositeItem || source == compositeButton)
23732640 {
23742641 group(new Composite());
23752642 } else
2376
- if (source == randomItem)
2643
+ if (source == switchItem || source == switchButton)
23772644 {
23782645 RandomNode random = new RandomNode();
23792646 group(random);
....@@ -2475,7 +2742,7 @@
24752742 {
24762743 group(new cLinker());
24772744 } else
2478
- if (source == textureItem)
2745
+ if (source == textureItem || source == textureButton)
24792746 {
24802747 group(new TextureNode());
24812748 } else
....@@ -2495,17 +2762,30 @@
24952762 {
24962763 CastShadow(2);
24972764 } else
2498
- if (source == ungroupItem)
2765
+ if (source == ungroupItem || source == ungroupButton)
24992766 {
2500
- //ungroup();
2767
+ boolean hasRoot = false;
2768
+
25012769 for (int i=0; i<group.selection.size(); i++)
25022770 {
2503
- Ungroup(group.selection.get(i));
2771
+ if (group.selection.get(i) == group)
2772
+ {
2773
+ hasRoot = true;
2774
+ break;
2775
+ }
25042776 }
25052777
2506
- ClearSelection(false);
2507
-
2508
- refreshContents();
2778
+ if (!hasRoot)
2779
+ {
2780
+ for (int i=0; i<group.selection.size(); i++)
2781
+ {
2782
+ Ungroup(group.selection.get(i));
2783
+ }
2784
+
2785
+ ClearSelection(false);
2786
+
2787
+ refreshContents();
2788
+ }
25092789 } else
25102790 if (source == genUVItem)
25112791 {
....@@ -2517,7 +2797,7 @@
25172797 } else
25182798 if (source == genNormalsMESHItem)
25192799 {
2520
- GenNormals(true); // TODO
2800
+ GenNormalsMESH();
25212801 } else
25222802 if (source == genNormalsORGANItem)
25232803 {
....@@ -2582,6 +2862,22 @@
25822862 if (source == unmarkleavesItem)
25832863 {
25842864 MarkLeaves(false);
2865
+ } else
2866
+ if (source == rewindleavesItem)
2867
+ {
2868
+ RewindLeaves(true);
2869
+ } else
2870
+ if (source == unrewindleavesItem)
2871
+ {
2872
+ RewindLeaves(false);
2873
+ } else
2874
+ if (source == randomleavesItem)
2875
+ {
2876
+ RandomLeaves(true);
2877
+ } else
2878
+ if (source == unrandomleavesItem)
2879
+ {
2880
+ RandomLeaves(false);
25852881 } else
25862882 if (source == flipVItem)
25872883 {
....@@ -2817,6 +3113,10 @@
28173113 if (source == twoButton)
28183114 {
28193115 radio.layout = twoButton;
3116
+
3117
+ if (CameraPane.FULLSCREEN)
3118
+ fullscreenLayout = radio.layout;
3119
+
28203120 // bug
28213121 //gridPanel.setDividerLocation(1.0);
28223122 //bigPanel.setDividerLocation(0.0);
....@@ -2849,10 +3149,31 @@
28493149 bigThree.ClearUI();
28503150 bigThree.add(centralPanel);
28513151 bigThree.FlushUI();
3152
+
3153
+ cameraView.requestFocusInWindow();
3154
+
3155
+// refreshContents(true);
3156
+//
3157
+// try
3158
+// {
3159
+// java.awt.Robot bot = new java.awt.Robot();
3160
+// int mask = InputEvent.BUTTON1_MASK;
3161
+// bot.mouseMove(100, 100);
3162
+// bot.mousePress(mask);
3163
+// bot.mouseRelease(mask);
3164
+// }
3165
+// catch (Exception e)
3166
+// {
3167
+//
3168
+// }
3169
+
28523170 } else
28533171 if (source == threeButton)
28543172 {
28553173 radio.layout = threeButton;
3174
+
3175
+ if (CameraPane.FULLSCREEN)
3176
+ fullscreenLayout = radio.layout;
28563177
28573178 // bigThree.remove(scenePanel);
28583179 // bigThree.remove(centralPanel);
....@@ -2885,10 +3206,15 @@
28853206 bigThree.add(centralPanel);
28863207 bigThree.add(XYZPanel);
28873208 bigThree.FlushUI();
3209
+
3210
+ cameraView.requestFocusInWindow();
28883211 } else
28893212 if (source == fourButton)
28903213 {
28913214 radio.layout = fourButton;
3215
+
3216
+ if (CameraPane.FULLSCREEN)
3217
+ fullscreenLayout = radio.layout;
28923218
28933219 // bigThree.remove(scenePanel);
28943220 // bigThree.remove(centralPanel);
....@@ -2920,10 +3246,15 @@
29203246 bigThree.ClearUI();
29213247 bigThree.add(scenePanel);
29223248 bigThree.FlushUI();
3249
+
3250
+ cameraView.requestFocusInWindow();
29233251 } else
29243252 if (source == sixButton)
29253253 {
29263254 radio.layout = sixButton;
3255
+
3256
+ if (CameraPane.FULLSCREEN)
3257
+ fullscreenLayout = radio.layout;
29273258
29283259 // bigThree.remove(scenePanel);
29293260 // bigThree.remove(centralPanel);
....@@ -2956,10 +3287,15 @@
29563287 bigThree.add(scenePanel);
29573288 bigThree.add(centralPanel);
29583289 bigThree.FlushUI();
3290
+
3291
+ cameraView.requestFocusInWindow();
29593292 } else
29603293 if (source == sevenButton)
29613294 {
29623295 radio.layout = sevenButton;
3296
+
3297
+ if (CameraPane.FULLSCREEN)
3298
+ fullscreenLayout = radio.layout;
29633299
29643300 // bigThree.remove(scenePanel);
29653301 // bigThree.remove(centralPanel);
....@@ -2993,6 +3329,8 @@
29933329 bigThree.add(centralPanel);
29943330 bigThree.add(XYZPanel);
29953331 bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
29963334 } else
29973335 if (source == rootButton)
29983336 {
....@@ -3004,6 +3342,7 @@
30043342 EditObject(obj);
30053343 }
30063344
3345
+ cameraView.requestFocusInWindow();
30073346 refreshContents(true);
30083347 } else
30093348 if (source == closeButton)
....@@ -3013,22 +3352,37 @@
30133352 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30143353 {
30153354 ab = (cRadio)e.nextElement();
3016
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3355
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30173356 {
3357
+ // Patch to avoid bug with transparency.
3358
+ if (!ab.hadMaterial)
3359
+ {
3360
+ ab.object.material = null;
3361
+ }
3362
+
30183363 buttonGroup.remove(ab);
30193364 radioPanel.remove(ab);
30203365
3021
- ab.GetObject().editWindow = null;
3366
+ //ab.GetObject().editWindow = null;
3367
+ ab.GetObject().manipWindow = null;
30223368 // ab.GetObject().objectUI = null; // ?????????
30233369
30243370 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30253371 break;
30263372 }
30273373 }
3374
+
3375
+ cameraView.requestFocusInWindow();
30283376 refreshContents(true);
30293377 } else
30303378 if (source == editItem || source == editButton)
30313379 {
3380
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3381
+ {
3382
+ Object3D child = (Object3D)e.nextElement();
3383
+ child.pinned = true;
3384
+ }
3385
+
30323386 EditSelection(false);
30333387 } else
30343388 if (source == uneditButton)
....@@ -3038,6 +3392,7 @@
30383392 Object3D child = (Object3D)e.nextElement();
30393393 if(child.editWindow != null)
30403394 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3395
+ child.pinned = false;
30413396 child.CloseUI();
30423397 listUI.remove(child);
30433398
....@@ -3054,6 +3409,7 @@
30543409 //copy.ClearUI();
30553410 for (Object3D obj : listUI)
30563411 {
3412
+ obj.pinned = false;
30573413 obj.CloseUI();
30583414 }
30593415 listUI.clear();
....@@ -3063,7 +3419,7 @@
30633419 {
30643420 assert(copy == group);
30653421
3066
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3422
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30673423
30683424 for (Object3D obj : listUI)
30693425 {
....@@ -3128,7 +3484,9 @@
31283484 sideView.object = group;
31293485 }
31303486
3131
-// fix "+" issue group.editWindow = this;
3487
+// fix "+" issue
3488
+ //group.editWindow = this;
3489
+ group.manipWindow = this;
31323490
31333491 /*
31343492 currentLayout = radio.layout;
....@@ -3136,18 +3494,25 @@
31363494 currentLayout = sevenButton;
31373495 */
31383496 radio.layout.doClick();
3497
+
3498
+ ClearUnpinned();
3499
+ SetPinStates(group.selection.size() > 0);
3500
+ if (group.selection.size() == 1)
3501
+ EditSelection(false);
31393502 keepparent = group.parent;
31403503 // PARENT = NULL or not???
31413504 //group.parent = null; // ROOT
31423505 //group.attributes = -1;
31433506 ResetModel();
3507
+
3508
+ cameraView.requestFocusInWindow();
31443509 refreshContents(true);
31453510 } else if (event.getSource() == editCameraItem)
31463511 {
31473512 cameraView.ProtectCamera();
31483513 cameraView.repaint();
31493514 return;
3150
- } else if (event.getSource() == revertCameraItem)
3515
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31513516 {
31523517 cameraView.RevertCamera();
31533518 cameraView.repaint();
....@@ -3164,7 +3529,6 @@
31643529 }
31653530
31663531 boolean useclient = false;
3167
- cRadio radio;
31683532
31693533 void ToggleRoot()
31703534 {
....@@ -3403,7 +3767,8 @@
34033767
34043768 int size = obj.MemorySize();
34053769
3406
- System.err.println((size/1024) + " KB is the size of " + obj);
3770
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3771
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
34073772 }
34083773 }
34093774 catch (Exception e)
....@@ -3484,6 +3849,13 @@
34843849 void GenNormals(boolean crease)
34853850 {
34863851 group.GenNormalsS(crease);
3852
+
3853
+ refreshContents();
3854
+ }
3855
+
3856
+ void GenNormalsMESH()
3857
+ {
3858
+ group.GenNormalsMeshS();
34873859
34883860 refreshContents();
34893861 }
....@@ -4111,6 +4483,18 @@
41114483 refreshContents();
41124484 }
41134485
4486
+ void RewindLeaves(boolean hide)
4487
+ {
4488
+ group.selection.RewindLeaves(hide);
4489
+ refreshContents();
4490
+ }
4491
+
4492
+ void RandomLeaves(boolean hide)
4493
+ {
4494
+ group.selection.RandomLeaves(hide);
4495
+ refreshContents();
4496
+ }
4497
+
41144498 void SetTexRes(int tr)
41154499 {
41164500 group.selection.SetTexRes(tr);
....@@ -4182,10 +4566,6 @@
41824566 // }
41834567 // }
41844568
4185
- static boolean allparams = true;
4186
-
4187
- static Vector<Object3D> listUI = new Vector<Object3D>();
4188
-
41894569 void EditSelection(boolean newWindow)
41904570 {
41914571 // aConstraints.gridy = 0;
....@@ -4193,7 +4573,7 @@
41934573 {
41944574 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41954575 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4196
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4576
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41974577
41984578 Object3D elem = (Object3D)group.selection.elementAt(i);
41994579 if(elem != group || !newWindow)
....@@ -4278,7 +4658,8 @@
42784658 //new Exception().printStackTrace();
42794659
42804660 freezemodel = true;
4281
-
4661
+ ClearUnpinned();
4662
+
42824663 /**/
42834664 //switch (event.id)
42844665 {
....@@ -4286,7 +4667,6 @@
42864667 //case 702: // Event.LIST_DESELECT
42874668 group.deselectAll();
42884669 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4289
- objEditor.ClearInfo(); // .GetMaterial());
42904670 if (tps != null)
42914671 {
42924672 for (int i=0; i < tps.length; i++)
....@@ -4295,10 +4675,8 @@
42954675
42964676 //if (child.parent != null)
42974677 //child.parent.addSelectee(child);
4678
+ objEditor.SetMaterial(child);
42984679 group.addSelectee(child);
4299
- objEditor.SetMaterial(child); // .GetMaterial());
4300
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4301
- System.err.println("info : " + child.GetPath());
43024680 }
43034681 }
43044682 // else
....@@ -4308,15 +4686,13 @@
43084686 // System.err.println("info : " + group.GetPath());
43094687 // }
43104688
4311
- objEditor.SetText(); // jan 2014
4312
-
43134689 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43144690 CameraPane.flash = true;
43154691
43164692 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43174693 // a camera
43184694 {
4319
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4695
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43204696 {
43214697 CameraPane.camerachangeframe = 0; // don't refuse it
43224698 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4325,6 +4701,13 @@
43254701 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43264702 }
43274703
4704
+ if (tps != null && tps.length == 1)
4705
+ {
4706
+ EditSelection(false);
4707
+ }
4708
+
4709
+ SetPinStates(tps != null && tps.length > 0);
4710
+
43284711 refreshContents();
43294712 //return true;
43304713 }
....@@ -4333,6 +4716,35 @@
43334716
43344717 freezemodel = false;
43354718 }
4719
+
4720
+ void SetPinStates(boolean enabled)
4721
+ {
4722
+ editButton.setEnabled(enabled);
4723
+ uneditButton.setEnabled(enabled);
4724
+ unselectButton.setEnabled(enabled);
4725
+ flashSelectionButton.setEnabled(enabled);
4726
+ }
4727
+
4728
+ void refreshContents(boolean cp)
4729
+ {
4730
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4731
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4732
+ {
4733
+ objEditor.ClearInfo(); // .GetMaterial());
4734
+
4735
+ for (int i=0; i < group.selection.Size(); i++)
4736
+ {
4737
+ Object3D child = (Object3D) group.selection.get(i);
4738
+
4739
+ objEditor.AddInfo(child, this, true);
4740
+ System.err.println("info : " + child.GetPath());
4741
+ }
4742
+
4743
+ objEditor.SetText(); // jan 2014
4744
+ }
4745
+
4746
+ super.refreshContents(cp);
4747
+ }
43364748
43374749 void linkSomething(Object3D thing)
43384750 {
....@@ -4404,6 +4816,7 @@
44044816 {
44054817 if (group.selection.isEmpty())
44064818 return;
4819
+
44074820 Grafreed.clipboardIsTempGroup = false;
44084821 Composite tGroup = null;
44094822 if (group.selection.size() > 0) // 1)
....@@ -4414,6 +4827,8 @@
44144827
44154828 if (cut)
44164829 {
4830
+ if (Globals.SAVEONMAKE)
4831
+ Save();
44174832 //int indices[] = jList.getSelectedIndices();
44184833 //for (int i = indices.length - 1; i >= 0; i--)
44194834 //jList.remove(indices[i]);
....@@ -4503,8 +4918,10 @@
45034918 }
45044919
45054920 }
4921
+
45064922 if (Grafreed.clipboardIsTempGroup)
45074923 Grafreed.clipboard = tGroup;
4924
+
45084925 if (cut)
45094926 {
45104927 ResetModel();
....@@ -5129,7 +5546,28 @@
51295546 cButton clearpanelButton;
51305547 cButton unselectButton;
51315548
5549
+ cButton restoreCameraButton;
5550
+
5551
+ cButton saveButton;
51325552 cButton oneStepButton;
5553
+
5554
+ cButton groupButton;
5555
+ cButton ungroupButton;
5556
+ cButton compositeButton;
5557
+ cButton switchButton;
5558
+ cButton loopButton;
5559
+ cButton textureButton;
5560
+
5561
+ cButton gridButton;
5562
+ cButton boxButton;
5563
+ cButton sphereButton;
5564
+ cButton coneButton;
5565
+ cButton torusButton;
5566
+ cButton superButton;
5567
+ cButton kleinButton;
5568
+ cButton particlesButton;
5569
+ cButton overlayButton;
5570
+ cButton lightButton;
51335571
51345572 cButton screenfitButton;
51355573 cButton screenfitpointButton;
....@@ -5142,14 +5580,6 @@
51425580
51435581 cButton setsupportButton;
51445582
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
-
51535583 //
51545584 //Composite
51555585 Object3D // to do !!
....@@ -5159,11 +5589,11 @@
51595589 //JTree jTree;
51605590 private MenuItem lookAtItem;
51615591 private MenuItem lookFromItem;
5162
- private MenuItem switchItem;
5592
+ private MenuItem switchViewItem;
51635593 private MenuItem cutItem;
51645594 private MenuItem undoItem;
51655595 private MenuItem redoItem;
5166
- private MenuItem duplicateItem;
5596
+ private JMenuItem duplicateItem;
51675597 private MenuItem cloneItem;
51685598 private MenuItem cloneSupportItem;
51695599 private MenuItem overwriteGeoItem;
....@@ -5226,6 +5656,10 @@
52265656 private MenuItem showleavesItem;
52275657 private MenuItem markleavesItem;
52285658 private MenuItem unmarkleavesItem;
5659
+ private MenuItem rewindleavesItem;
5660
+ private MenuItem unrewindleavesItem;
5661
+ private MenuItem randomleavesItem;
5662
+ private MenuItem unrandomleavesItem;
52295663
52305664 private MenuItem flipVItem;
52315665 private MenuItem unflipVItem;
....@@ -5247,7 +5681,7 @@
52475681 private MenuItem frontItem;
52485682 private MenuItem cameraItem;
52495683 private MenuItem compositeItem;
5250
- private MenuItem randomItem;
5684
+ private MenuItem switchItem;
52515685 private MenuItem physicsItem;
52525686 private MenuItem frameselectorItem;
52535687 private MenuItem scriptNodeItem;
....@@ -5321,5 +5755,5 @@
53215755
53225756 Menu cameraMenu;
53235757 MenuItem editCameraItem;
5324
- MenuItem revertCameraItem;
5758
+ MenuItem restoreCameraItem;
53255759 }