Normand Briere
2019-06-29 a69bb4474a3264a9a7a7f8b8d8154ea771f167c8
GroupEditor.java
....@@ -150,6 +150,8 @@
150150
151151 void SetupMenu2(GroupEditor oe)
152152 {
153
+ oe.jTree = new cTree();
154
+
153155 Menu menu;
154156 oe.menuBar.add(menu = new Menu("Edit"));
155157 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +162,7 @@
160162 // redoItem = menu.add(new MenuItem("Redo"));
161163 // redoItem.addActionListener(this);
162164 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164166 duplicateItem.addActionListener(this);
165167 cloneItem = menu.add(new MenuItem("Clone"));
166168 cloneItem.addActionListener(this);
....@@ -176,7 +178,6 @@
176178 copyItem.addActionListener(this);
177179 pasteItem = menu.add(new MenuItem("Paste"));
178180 pasteItem.addActionListener(this);
179
- menu.add("-");
180181
181182 menu.add("-");
182183 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -203,23 +204,23 @@
203204 //zBufferItem.addActionListener(this);
204205 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205206 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
207
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
208
+ restoreCameraItem.addActionListener(this);
208209
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- cameraMenu.add("-");
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);
213222
214
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
- toggleTextureItem.addItemListener(this);
216
- toggleTextureItem.setState(CameraPane.textureon);
217
-
218
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
- toggleSwitchItem.addItemListener(this);
220
- toggleSwitchItem.setState(CameraPane.SWITCH);
221
-
222
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223224 toggleHandleItem.addItemListener(this);
224225 toggleHandleItem.setState(CameraPane.HANDLES);
225226
....@@ -246,7 +247,7 @@
246247
247248 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248249 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
250
+ toggleDebugItem.setState(Globals.DEBUG);
250251
251252 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252253 toggleFrustumItem.addItemListener(this);
....@@ -274,7 +275,7 @@
274275 {
275276 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276277 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
278
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278279 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279280 oe.cameraMenu.add("-");
280281 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +283,7 @@
282283 editLeafItem.addActionListener(this);
283284 lookAtItem.addActionListener(this);
284285 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
286
+ //switchViewItem.addActionListener(this);
286287 }
287288
288289 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +328,29 @@
327328 }
328329
329330 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
332333 backItem = menu.add(new MenuItem("Back"));
333334 backItem.addActionListener(this);
334335 frontItem = menu.add(new MenuItem("Front"));
335336 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
338342 hideItem = menu.add(new MenuItem("Hidden Group"));
339343 hideItem.addActionListener(this);
344
+ }
340345 ungroupItem = menu.add(new MenuItem("Ungroup"));
341346 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- randomItem.addActionListener(this);
347
+
348
+// menu.add("-");
349
+//
350
+// switchItem = menu.add(new MenuItem("Switch node"));
351
+// switchItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
345354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346355 switchGeoItem.addActionListener(this);
347356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +358,6 @@
349358 morphItem = menu.add(new MenuItem("Morph Group"));
350359 morphItem.addActionListener(this);
351360
352
- if (Globals.ADVANCED)
353
- {
354361 menu.add("-");
355362 physicsItem = menu.add(new MenuItem("Physics"));
356363 physicsItem.addActionListener(this);
....@@ -358,22 +365,20 @@
358365 frameselectorItem.addActionListener(this);
359366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360367 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363368 }
364369
365370 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
368373 billboardItem = menu.add(new MenuItem("Billboard"));
369374 billboardItem.addActionListener(this);
370375 csgItem = menu.add(new MenuItem("CSG"));
371376 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
377
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373378 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
379
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375380 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
381
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377382 shadowZItem.addActionListener(this);
378383 if (Globals.ADVANCED)
379384 {
....@@ -470,6 +475,14 @@
470475 markleavesItem.addActionListener(this);
471476 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472477 unmarkleavesItem.addActionListener(this);
478
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
479
+ rewindleavesItem.addActionListener(this);
480
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
481
+ unrewindleavesItem.addActionListener(this);
482
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
483
+ randomleavesItem.addActionListener(this);
484
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
485
+ unrandomleavesItem.addActionListener(this);
473486 menu.add("-");
474487 flipVItem = menu.add(new MenuItem("Flip V"));
475488 flipVItem.addActionListener(this);
....@@ -527,6 +540,18 @@
527540
528541 void SetupUI2(ObjEditor oe)
529542 {
543
+ // June 2019
544
+ if (oe == null)
545
+ {
546
+ //super.SetupUI2(this);
547
+ //return;
548
+ }
549
+
550
+ if (copy != group)
551
+ {
552
+ //super.SetupUI2(this);
553
+ }
554
+
530555 //new Exception().printStackTrace();
531556
532557 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -555,39 +580,63 @@
555580 oe.radioPanel.add(dummyButton);
556581 oe.buttonGroup.add(dummyButton);
557582 */
583
+ cGridBag copyOptionsPanel = new cGridBag();
584
+
585
+ copyOptionsPanel.preferredHeight = 1;
586
+
558587 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559588
560
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
+ //minButton.setToolTipText("Minimize window");
591
+ //minButton.addActionListener(this);
592
+
593
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
+ maxButton.setToolTipText("Maximize window");
595
+ maxButton.addActionListener(this);
596
+
597
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598
+ fullButton.setToolTipText("Full-screen window");
599
+ fullButton.addActionListener(this);
600
+
601
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ restoreCameraButton.setToolTipText("Restore viewpoint");
603
+ restoreCameraButton.addActionListener(this);
604
+
605
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561606 undoButton.setToolTipText("Undo changes");
562607 undoButton.addActionListener(this);
608
+ undoButton.setEnabled(false);
563609
564
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565611 redoButton.setToolTipText("Redo changes");
566612 redoButton.addActionListener(this);
613
+ redoButton.setEnabled(false);
567614
568
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569616 saveButton.setToolTipText("Save changes");
570617 saveButton.addActionListener(this);
571618
572
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
619
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
573620 liveCB.setToolTipText("Enable animation");
574621 liveCB.addItemListener(this);
575622
576
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577624 oneStepButton.setToolTipText("Animate one step forward");
578625 oneStepButton.addActionListener(this);
579626
580
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
627
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
581628 fastCB.setToolTipText("Fast mode");
582629 fastCB.addItemListener(this);
583630
584
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
585
- trackCB.setToolTipText("Enable tracking");
586
- trackCB.addItemListener(this);
587
-
588
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
631
+ //oe.toolboxPanel.Return();
632
+
633
+ copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589634 screenfitButton.setToolTipText("Screen fit");
590635 screenfitButton.addActionListener(this);
636
+
637
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
638
+// trackCB.setToolTipText("Enable tracking");
639
+// trackCB.addItemListener(this);
591640
592641 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
593642 // screenfitpointButton.addActionListener(this);
....@@ -599,65 +648,145 @@
599648 snapobjectButton.setToolTipText("Snap Object");
600649 }
601650
602
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- flashSelectionButton.setToolTipText("Show selection");
604
- flashSelectionButton.addActionListener(this);
651
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
605652
606
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
607
-
608
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609654 twoButton.setToolTipText("Show center view only");
610655 twoButton.addActionListener(this);
611
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ this.fullscreenLayout = twoButton;
657
+
658
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612659 fourButton.addActionListener(this);
613660 fourButton.setToolTipText("Show left panel only");
614
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615662 sixButton.setToolTipText("2-column layout left");
616663 sixButton.addActionListener(this);
617
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618665 threeButton.setToolTipText("2-column layout right");
619666 threeButton.addActionListener(this);
620
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621668 sevenButton.setToolTipText("3-column layout");
622669 sevenButton.addActionListener(this);
623670 //
624671
625
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
672
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626673 rootButton.setToolTipText("Edit selection in new tab");
627674 rootButton.addActionListener(this);
628675
629
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630677 closeButton.setToolTipText("Close tab");
631678 closeButton.addActionListener(this);
632679 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
633680 //clearButton.addActionListener(this);
634
-
635
- cGridBag commandsPanel = new cGridBag();
681
+
682
+ // INSERT
683
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ gridButton.setToolTipText("Create grid");
685
+ gridButton.addActionListener(this);
686
+
687
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ boxButton.setToolTipText("Create box");
689
+ boxButton.addActionListener(this);
690
+
691
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
692
+ sphereButton.setToolTipText("Create sphere");
693
+ sphereButton.addActionListener(this);
694
+
695
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ coneButton.setToolTipText("Create cone");
697
+ coneButton.addActionListener(this);
698
+
699
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ torusButton.setToolTipText("Create torus");
701
+ torusButton.addActionListener(this);
702
+
703
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+ superButton.setToolTipText("Create superellipsoid");
705
+ superButton.addActionListener(this);
706
+
707
+ if (Globals.ADVANCED)
708
+ {
709
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
710
+ kleinButton.setToolTipText("Create Klein bottle");
711
+ kleinButton.addActionListener(this);
712
+ }
636713
637
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
- editButton.setToolTipText("Edit selection");
714
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ particlesButton.setToolTipText("Create particle system");
716
+ particlesButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.Return();
719
+
720
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721
+ groupButton.setToolTipText("Create group");
722
+ groupButton.addActionListener(this);
723
+
724
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ compositeButton.setToolTipText("Create composite");
726
+ compositeButton.addActionListener(this);
727
+
728
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ switchButton.setToolTipText("Create 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");
639763 editButton.addActionListener(this);
640764
641
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
- uneditButton.setToolTipText("Unedit selection");
765
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ uneditButton.setToolTipText("Remove selection controls");
643767 uneditButton.addActionListener(this);
644768
645
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
646
- allParamsButton.setToolTipText("Edit all params");
769
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
770
+ allParamsButton.setToolTipText("Show all controle");
647771 allParamsButton.addActionListener(this);
648772
649
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650774 clearPanelButton.setToolTipText("Clear edit panel");
651775 clearPanelButton.addActionListener(this);
652776
653
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654778 unselectButton.setToolTipText("Unselect");
655779 unselectButton.addActionListener(this);
656780
657
- commandsPanel.preferredHeight = 1;
781
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
782
+ flashSelectionButton.setToolTipText("Highlight selection");
783
+ flashSelectionButton.addActionListener(this);
658784
659
- oe.treePanel.add(commandsPanel);
660
- oe.treePanel.Return();
785
+ editCommandsPanel.preferredHeight = 1;
786
+
787
+ SetPinStates(false);
788
+// oe.treePanel.add(commandsPanel);
789
+// oe.treePanel.Return();
661790
662791 // oe.aConstraints.gridx += 1;
663792 // oe.aConstraints.weighty = 0;
....@@ -674,27 +803,12 @@
674803
675804 JScrollPane jSP;
676805 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
677
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
806
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
678807 ResetModel();
679808
680809 oe.treePanel.add(jSPPanel);
681810 oe.treePanel.Return();
682811
683
- cGridBag copyOptionsPanel = new cGridBag();
684
-
685
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
686
- colorCB.setToolTipText("Copy color when dropped");
687
- colorCB.addItemListener(this);
688
-
689
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
690
- materialCB.setToolTipText("Copy material when dropped");
691
- materialCB.addItemListener(this);
692
-
693
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
694
- textureCB.setToolTipText("Copy texture when dropped");
695
- textureCB.addItemListener(this);
696
-
697
- copyOptionsPanel.preferredHeight = 1;
698812 oe.treePanel.add(copyOptionsPanel);
699813 oe.treePanel.Return();
700814
....@@ -725,23 +839,43 @@
725839
726840 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
727841 {
842
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
843
+ colorCB.setToolTipText("Copy color when dropped");
844
+ colorCB.addItemListener(this);
845
+
846
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
847
+ materialCB.setToolTipText("Copy material when dropped");
848
+ materialCB.addItemListener(this);
849
+
850
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
851
+ textureCB.setToolTipText("Copy texture when dropped");
852
+ textureCB.addItemListener(this);
853
+
854
+ panel.Return();
855
+
728856 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
729857 boxCB.setToolTipText("Display bounding boxes");
730858 boxCB.addItemListener(this);
731859
732860 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
733
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
861
+ zoomBoxCB.setToolTipText("Display only for wheel");
734862 zoomBoxCB.addItemListener(this);
735863
736864 if (true) // Globals.ADVANCED)
737865 {
738
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
739
- supportCB.setToolTipText("Enable rigging");
740
- 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);
741873
742874 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
743875 // localCB.addItemListener(this);
744876
877
+ panel.Return();
878
+
745879 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
746880 crowdCB.setToolTipText("Used for crowds");
747881 crowdCB.addItemListener(this);
....@@ -758,6 +892,8 @@
758892 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
759893 // speakerMocapCB.addItemListener(this);
760894
895
+ panel.Return();
896
+
761897 if (false)
762898 {
763899 // handled in scripts
....@@ -772,32 +908,72 @@
772908 //constraints.gridy += 1;
773909 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
774910 smoothfocusCB.addItemListener(this);
911
+ panel.Return();
775912 }
776913
777914 //constraints.gridx += 1;
778915 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
779916 // debugCB.addItemListener(this);
780917
918
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
919
+ trackCB.setToolTipText("Enable tracking target");
920
+ trackCB.addItemListener(this);
921
+
781922 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
923
+ oeilCB.setToolTipText("Move camera when tracking");
782924 oeilCB.addItemListener(this);
783925
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
+ {
784946 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
785947 lookAtCB.setToolTipText("Look-at target");
786948 lookAtCB.addItemListener(this);
949
+ }
787950
788951 }
789952
790953 cGridBag fill = new cGridBag();
791
-
792954 fill.preferredHeight = 200;
955
+ cGridBag fill2 = new cGridBag();
956
+ fill2.preferredHeight = 200;
957
+ cGridBag fill3 = new cGridBag();
958
+ fill3.preferredHeight = 200;
793959
794960 panel.add(fill);
961
+ panel.add(fill2);
962
+ panel.add(fill3);
795963
796964 }
797965
798966 void EditObject(Object3D obj)
799967 {
800968 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
+
801977 radioButton.SetObject(obj);
802978 radioButton.layout = sevenButton;
803979 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -809,6 +985,8 @@
809985
810986 void SetupViews(ObjEditor oe)
811987 {
988
+ theFrame = this;
989
+
812990 oe.SetupViews();
813991
814992 System.out.println("SetupViews");
....@@ -817,23 +995,28 @@
817995 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
818996 }
819997
820
- JCheckBox liveCB;
821
- JCheckBox supportCB;
822
- JCheckBox localCB;
823
- JCheckBox crowdCB;
824
- JCheckBox smoothCB;
825
- JCheckBox fastCB;
826
- JCheckBox slowCB;
827
- JCheckBox boxCB;
828
- JCheckBox zoomBoxCB;
829
- JCheckBox trackCB;
830
- JCheckBox smoothfocusCB;
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;
8311011 // JCheckBox speakerMocapCB;
832
- JCheckBox speakerCameraCB;
833
- JCheckBox speakerFocusCB;
834
- JCheckBox debugCB;
835
- JCheckBox oeilCB;
836
- JCheckBox lookAtCB;
1012
+ cCheckBox speakerCameraCB;
1013
+ cCheckBox speakerFocusCB;
1014
+ cCheckBox debugCB;
1015
+
1016
+ cCheckBox oeilCB;
1017
+ cCheckBox shadowCB;
1018
+ cCheckBox autosaveCB;
1019
+ cCheckBox lookAtCB;
8371020
8381021 // static int COLOR = 1;
8391022 // static int MATERIAL = 2;
....@@ -841,9 +1024,9 @@
8411024
8421025 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8431026
844
- JCheckBox colorCB;
845
- JCheckBox materialCB;
846
- JCheckBox textureCB;
1027
+ cCheckBox colorCB;
1028
+ cCheckBox materialCB;
1029
+ cCheckBox textureCB;
8471030
8481031 public void itemStateChanged(ItemEvent e)
8491032 {
....@@ -871,6 +1054,7 @@
8711054 } else if(e.getSource() == liveCB)
8721055 {
8731056 cameraView.ToggleLive();
1057
+ refreshContents(false);
8741058 }
8751059 else if(e.getSource() == supportCB)
8761060 {
....@@ -935,6 +1119,18 @@
9351119 {
9361120 cameraView.ToggleOeil();
9371121 }
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
+ }
9381134 else if(e.getSource() == lookAtCB)
9391135 {
9401136 cameraView.ToggleLookAt();
....@@ -951,7 +1147,8 @@
9511147
9521148 /**/
9531149 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
954
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1150
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1151
+ TreePath path = objEditor.jTree.getSelectionPath();
9551152 if ((path == null) || (path.getPathCount() <= 1)) {
9561153 // We can't move the root node or an empty selection
9571154 return;
....@@ -1068,23 +1265,33 @@
10681265
10691266 assert target == objEditor.jTree;
10701267 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1268
+ Object3D destinationLeaf;
10711269 try {
1072
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1270
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10731271 } catch (Exception e) {
10741272 System.out.println("destinationPath : " + destinationPath);
10751273 return;
10761274 }
10771275
1078
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1276
+ for (int i=group.selection.size(); --i>=0;)
10791277 {
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
+// {
10801287 loadClipboard(true);
10811288 objEditor.jTree.setSelectionPath(destinationPath);
10821289 pasteInto(false, false);
1083
- } else {
1084
- loadClipboard(false);
1085
- objEditor.jTree.setSelectionPath(destinationPath);
1086
- pasteInto(false, false); // true); // ???
1087
- }
1290
+// } else {
1291
+// loadClipboard(false);
1292
+// objEditor.jTree.setSelectionPath(destinationPath);
1293
+// pasteInto(false, false); // true); // ???
1294
+// }
10881295 }
10891296 public void dropActionChanged(DropTargetDragEvent dtde)
10901297 // Called if the user has modified the current drop gesture
....@@ -1189,22 +1396,30 @@
11891396 {
11901397 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11911398 //heightFieldItem.addActionListener(this);
1192
- gridItem = menu.add(new MenuItem("Grid"));
1193
- gridItem.addActionListener(this);
1194
- rectoidItem = menu.add(new MenuItem("Box"));
1195
- rectoidItem.addActionListener(this);
1196
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1197
- ellipsoidItem.addActionListener(this);
1198
- coneItem = menu.add(new MenuItem("Cone"));
1199
- coneItem.addActionListener(this);
1200
- torusItem = menu.add(new MenuItem("Torus"));
1201
- torusItem.addActionListener(this);
1202
- superItem = menu.add(new MenuItem("Superellipsoid"));
1203
- superItem.addActionListener(this);
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
+ {
12041417 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12051418 kleinItem.addActionListener(this);
1206
- particleItem = menu.add(new MenuItem("Particle system"));
1207
- particleItem.addActionListener(this);
1419
+ }
1420
+
1421
+// particleItem = menu.add(new MenuItem("Particle system"));
1422
+// particleItem.addActionListener(this);
12081423 if (Globals.ADVANCED)
12091424 {
12101425 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1230,15 +1445,15 @@
12301445 }
12311446 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12321447 bezierItem.addActionListener(this);
1233
- overlayItem = menu.add(new MenuItem("Overlay"));
1234
- overlayItem.addActionListener(this);
1235
- lightItem = menu.add(new MenuItem("Light"));
1236
- lightItem.addActionListener(this);
1448
+// overlayItem = menu.add(new MenuItem("Overlay"));
1449
+// overlayItem.addActionListener(this);
1450
+// lightItem = menu.add(new MenuItem("Light"));
1451
+// lightItem.addActionListener(this);
12371452 menu.add("-");
12381453 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12391454 //superLoopItem.addActionListener(this);
1240
- loopItem = menu.add(new MenuItem("Loop"));
1241
- loopItem.addActionListener(this);
1455
+// loopItem = menu.add(new MenuItem("Loop"));
1456
+// loopItem.addActionListener(this);
12421457 doubleItem = menu.add(new MenuItem("Fork"));
12431458 doubleItem.addActionListener(this);
12441459 if (Globals.ADVANCED)
....@@ -1278,7 +1493,7 @@
12781493 memoryItem.addActionListener(this);
12791494 menu.add(analyzeItem = new MenuItem("Analyze"));
12801495 analyzeItem.addActionListener(this);
1281
- menu.add(dumpItem = new MenuItem("Dump"));
1496
+ menu.add(dumpItem = new MenuItem("Print"));
12821497 dumpItem.addActionListener(this);
12831498 // menu.add(pathItem = new MenuItem("From-to path"));
12841499 // pathItem.addActionListener(this);
....@@ -1419,9 +1634,24 @@
14191634 shadow.material = new cMaterial(obj.material);
14201635 shadow.material.diffuse = 0.0001f;
14211636 shadow.material.specular = 0.0001f;
1637
+ //shadow.projectedVertices[1].x = 300;
14221638
14231639 makeSomething(shadow);
14241640 }
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
+ }
14251655
14261656 /**
14271657 * applyExample
....@@ -1666,7 +1896,7 @@
16661896 {
16671897 ScreenFit();
16681898 } else
1669
- if (source == switchItem)
1899
+ if (source == switchViewItem)
16701900 {
16711901 cVector v1 = new cVector();
16721902 cVector v2 = new cVector();
....@@ -1675,11 +1905,11 @@
16751905 objEditor.cameraView.renderCamera.setAim(v2, v1);
16761906 objEditor.cameraView.repaint();
16771907 } else
1678
- if (source == rectoidItem)
1908
+ if (source == rectoidItem || source == boxButton)
16791909 {
16801910 makeSomething(new Box());
16811911 } else
1682
- if (source == particleItem)
1912
+ if (source == particleItem || source == particlesButton)
16831913 {
16841914 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16851915 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1758,27 +1988,27 @@
17581988
17591989 makeSomething(obj);
17601990 } else
1761
- if (source == gridItem)
1991
+ if (source == gridItem || source == gridButton)
17621992 {
17631993 makeSomething(new Grid());
17641994 } else
1765
- if (source == ellipsoidItem)
1995
+ if (source == ellipsoidItem || source == sphereButton)
17661996 {
17671997 makeSomething(new Sphere());
17681998 } else
1769
- if (source == coneItem)
1999
+ if (source == coneItem || source == coneButton)
17702000 {
17712001 makeSomething(new Cone());
17722002 } else
1773
- if (source == torusItem)
2003
+ if (source == torusItem || source == torusButton)
17742004 {
17752005 makeSomething(new Torus());
17762006 } else
1777
- if (source == superItem)
2007
+ if (source == superItem || source == superButton)
17782008 {
17792009 makeSomething(new Superellipsoid());
17802010 } else
1781
- if (source == kleinItem)
2011
+ if (source == kleinItem || source == kleinButton)
17822012 {
17832013 makeSomething(new Klein());
17842014 } else
....@@ -1798,7 +2028,7 @@
17982028 {
17992029 makeSomething(new BezierSurface());
18002030 } else
1801
- if (source == overlayItem)
2031
+ if (source == overlayItem || source == overlayButton)
18022032 {
18032033 /*
18042034 Object3D obj = new BezierSurface(5,8);
....@@ -1846,7 +2076,7 @@
18462076 s.setup();
18472077 makeSomething(s);
18482078 } else
1849
- if (source == lightItem)
2079
+ if (source == lightItem || source == lightButton)
18502080 {
18512081 makeSomething(new Light());
18522082 } else
....@@ -1896,30 +2126,30 @@
18962126
18972127 group(g);
18982128 } else
1899
- if (source == loopItem)
2129
+ if (source == loopItem || source == loopButton)
19002130 {
19012131 Composite csg = new GroupLeaf();
19022132 csg.count = 5;
19032133 group(csg);
1904
- Composite child = new cGroup();
2134
+ Composite child = new cGroup("Branch");
19052135 csg.addChild(child);
19062136 child.addChild(csg);
19072137 } else
19082138 if (source == doubleItem)
19092139 {
1910
- Composite csg = new GroupLeaf();
2140
+ Composite csg = new GroupLeaf("Fork");
19112141 csg.count = 5;
19122142 group(csg);
1913
- Composite child = new cGroup();
2143
+ Composite child = new cGroup("Branch A");
19142144 csg.addChild(child);
19152145 child.addChild(csg);
1916
- child = new cGroup();
2146
+ child = new cGroup("Branch B");
19172147 csg.addChild(child);
19182148 child.addChild(csg);
19192149 } else
19202150 if (source == tripleItem)
19212151 {
1922
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Trident");
19232153 csg.count = 4;
19242154 group(csg);
19252155 Composite child = new cGroup();
....@@ -1968,6 +2198,18 @@
19682198 if (source == dumpItem)
19692199 {
19702200 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();
19712213 } else
19722214 if (source == undoButton)
19732215 {
....@@ -2374,9 +2616,9 @@
23742616 {
23752617 ClearSelection(true);
23762618 } else
2377
- if (source == grabItem)
2619
+ if (source == grabItem || source == groupButton)
23782620 {
2379
- group(new cGroup(), true);
2621
+ group(new cGroup(), false); // true);
23802622 } else
23812623 if (source == hideItem)
23822624 {
....@@ -2394,11 +2636,11 @@
23942636 {
23952637 makeSomething(new Camera());
23962638 } else
2397
- if (source == compositeItem)
2639
+ if (source == compositeItem || source == compositeButton)
23982640 {
23992641 group(new Composite());
24002642 } else
2401
- if (source == randomItem)
2643
+ if (source == switchItem || source == switchButton)
24022644 {
24032645 RandomNode random = new RandomNode();
24042646 group(random);
....@@ -2500,7 +2742,7 @@
25002742 {
25012743 group(new cLinker());
25022744 } else
2503
- if (source == textureItem)
2745
+ if (source == textureItem || source == textureButton)
25042746 {
25052747 group(new TextureNode());
25062748 } else
....@@ -2520,17 +2762,30 @@
25202762 {
25212763 CastShadow(2);
25222764 } else
2523
- if (source == ungroupItem)
2765
+ if (source == ungroupItem || source == ungroupButton)
25242766 {
2525
- //ungroup();
2767
+ boolean hasRoot = false;
2768
+
25262769 for (int i=0; i<group.selection.size(); i++)
25272770 {
2528
- Ungroup(group.selection.get(i));
2771
+ if (group.selection.get(i) == group)
2772
+ {
2773
+ hasRoot = true;
2774
+ break;
2775
+ }
25292776 }
25302777
2531
- ClearSelection(false);
2532
-
2533
- 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
+ }
25342789 } else
25352790 if (source == genUVItem)
25362791 {
....@@ -2542,7 +2797,7 @@
25422797 } else
25432798 if (source == genNormalsMESHItem)
25442799 {
2545
- GenNormals(true); // TODO
2800
+ GenNormalsMESH();
25462801 } else
25472802 if (source == genNormalsORGANItem)
25482803 {
....@@ -2607,6 +2862,22 @@
26072862 if (source == unmarkleavesItem)
26082863 {
26092864 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);
26102881 } else
26112882 if (source == flipVItem)
26122883 {
....@@ -2842,6 +3113,10 @@
28423113 if (source == twoButton)
28433114 {
28443115 radio.layout = twoButton;
3116
+
3117
+ if (CameraPane.FULLSCREEN)
3118
+ fullscreenLayout = radio.layout;
3119
+
28453120 // bug
28463121 //gridPanel.setDividerLocation(1.0);
28473122 //bigPanel.setDividerLocation(0.0);
....@@ -2874,10 +3149,31 @@
28743149 bigThree.ClearUI();
28753150 bigThree.add(centralPanel);
28763151 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
+
28773170 } else
28783171 if (source == threeButton)
28793172 {
28803173 radio.layout = threeButton;
3174
+
3175
+ if (CameraPane.FULLSCREEN)
3176
+ fullscreenLayout = radio.layout;
28813177
28823178 // bigThree.remove(scenePanel);
28833179 // bigThree.remove(centralPanel);
....@@ -2910,10 +3206,15 @@
29103206 bigThree.add(centralPanel);
29113207 bigThree.add(XYZPanel);
29123208 bigThree.FlushUI();
3209
+
3210
+ cameraView.requestFocusInWindow();
29133211 } else
29143212 if (source == fourButton)
29153213 {
29163214 radio.layout = fourButton;
3215
+
3216
+ if (CameraPane.FULLSCREEN)
3217
+ fullscreenLayout = radio.layout;
29173218
29183219 // bigThree.remove(scenePanel);
29193220 // bigThree.remove(centralPanel);
....@@ -2945,10 +3246,15 @@
29453246 bigThree.ClearUI();
29463247 bigThree.add(scenePanel);
29473248 bigThree.FlushUI();
3249
+
3250
+ cameraView.requestFocusInWindow();
29483251 } else
29493252 if (source == sixButton)
29503253 {
29513254 radio.layout = sixButton;
3255
+
3256
+ if (CameraPane.FULLSCREEN)
3257
+ fullscreenLayout = radio.layout;
29523258
29533259 // bigThree.remove(scenePanel);
29543260 // bigThree.remove(centralPanel);
....@@ -2981,10 +3287,15 @@
29813287 bigThree.add(scenePanel);
29823288 bigThree.add(centralPanel);
29833289 bigThree.FlushUI();
3290
+
3291
+ cameraView.requestFocusInWindow();
29843292 } else
29853293 if (source == sevenButton)
29863294 {
29873295 radio.layout = sevenButton;
3296
+
3297
+ if (CameraPane.FULLSCREEN)
3298
+ fullscreenLayout = radio.layout;
29883299
29893300 // bigThree.remove(scenePanel);
29903301 // bigThree.remove(centralPanel);
....@@ -3018,6 +3329,8 @@
30183329 bigThree.add(centralPanel);
30193330 bigThree.add(XYZPanel);
30203331 bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
30213334 } else
30223335 if (source == rootButton)
30233336 {
....@@ -3029,6 +3342,7 @@
30293342 EditObject(obj);
30303343 }
30313344
3345
+ cameraView.requestFocusInWindow();
30323346 refreshContents(true);
30333347 } else
30343348 if (source == closeButton)
....@@ -3038,22 +3352,37 @@
30383352 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30393353 {
30403354 ab = (cRadio)e.nextElement();
3041
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3355
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30423356 {
3357
+ // Patch to avoid bug with transparency.
3358
+ if (!ab.hadMaterial)
3359
+ {
3360
+ ab.object.material = null;
3361
+ }
3362
+
30433363 buttonGroup.remove(ab);
30443364 radioPanel.remove(ab);
30453365
3046
- ab.GetObject().editWindow = null;
3366
+ //ab.GetObject().editWindow = null;
3367
+ ab.GetObject().manipWindow = null;
30473368 // ab.GetObject().objectUI = null; // ?????????
30483369
30493370 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30503371 break;
30513372 }
30523373 }
3374
+
3375
+ cameraView.requestFocusInWindow();
30533376 refreshContents(true);
30543377 } else
30553378 if (source == editItem || source == editButton)
30563379 {
3380
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3381
+ {
3382
+ Object3D child = (Object3D)e.nextElement();
3383
+ child.pinned = true;
3384
+ }
3385
+
30573386 EditSelection(false);
30583387 } else
30593388 if (source == uneditButton)
....@@ -3063,6 +3392,7 @@
30633392 Object3D child = (Object3D)e.nextElement();
30643393 if(child.editWindow != null)
30653394 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3395
+ child.pinned = false;
30663396 child.CloseUI();
30673397 listUI.remove(child);
30683398
....@@ -3079,6 +3409,7 @@
30793409 //copy.ClearUI();
30803410 for (Object3D obj : listUI)
30813411 {
3412
+ obj.pinned = false;
30823413 obj.CloseUI();
30833414 }
30843415 listUI.clear();
....@@ -3088,7 +3419,7 @@
30883419 {
30893420 assert(copy == group);
30903421
3091
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3422
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30923423
30933424 for (Object3D obj : listUI)
30943425 {
....@@ -3154,7 +3485,8 @@
31543485 }
31553486
31563487 // fix "+" issue
3157
- group.editWindow = this;
3488
+ //group.editWindow = this;
3489
+ group.manipWindow = this;
31583490
31593491 /*
31603492 currentLayout = radio.layout;
....@@ -3162,18 +3494,25 @@
31623494 currentLayout = sevenButton;
31633495 */
31643496 radio.layout.doClick();
3497
+
3498
+ ClearUnpinned();
3499
+ SetPinStates(group.selection.size() > 0);
3500
+ if (group.selection.size() == 1)
3501
+ EditSelection(false);
31653502 keepparent = group.parent;
31663503 // PARENT = NULL or not???
31673504 //group.parent = null; // ROOT
31683505 //group.attributes = -1;
31693506 ResetModel();
3507
+
3508
+ cameraView.requestFocusInWindow();
31703509 refreshContents(true);
31713510 } else if (event.getSource() == editCameraItem)
31723511 {
31733512 cameraView.ProtectCamera();
31743513 cameraView.repaint();
31753514 return;
3176
- } else if (event.getSource() == revertCameraItem)
3515
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31773516 {
31783517 cameraView.RevertCamera();
31793518 cameraView.repaint();
....@@ -3190,7 +3529,6 @@
31903529 }
31913530
31923531 boolean useclient = false;
3193
- cRadio radio;
31943532
31953533 void ToggleRoot()
31963534 {
....@@ -3511,6 +3849,13 @@
35113849 void GenNormals(boolean crease)
35123850 {
35133851 group.GenNormalsS(crease);
3852
+
3853
+ refreshContents();
3854
+ }
3855
+
3856
+ void GenNormalsMESH()
3857
+ {
3858
+ group.GenNormalsMeshS();
35143859
35153860 refreshContents();
35163861 }
....@@ -4138,6 +4483,18 @@
41384483 refreshContents();
41394484 }
41404485
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
+
41414498 void SetTexRes(int tr)
41424499 {
41434500 group.selection.SetTexRes(tr);
....@@ -4209,10 +4566,6 @@
42094566 // }
42104567 // }
42114568
4212
- static boolean allparams = true;
4213
-
4214
- static Vector<Object3D> listUI = new Vector<Object3D>();
4215
-
42164569 void EditSelection(boolean newWindow)
42174570 {
42184571 // aConstraints.gridy = 0;
....@@ -4220,7 +4573,7 @@
42204573 {
42214574 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42224575 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4223
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4576
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42244577
42254578 Object3D elem = (Object3D)group.selection.elementAt(i);
42264579 if(elem != group || !newWindow)
....@@ -4305,7 +4658,8 @@
43054658 //new Exception().printStackTrace();
43064659
43074660 freezemodel = true;
4308
-
4661
+ ClearUnpinned();
4662
+
43094663 /**/
43104664 //switch (event.id)
43114665 {
....@@ -4313,7 +4667,6 @@
43134667 //case 702: // Event.LIST_DESELECT
43144668 group.deselectAll();
43154669 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4316
- objEditor.ClearInfo(); // .GetMaterial());
43174670 if (tps != null)
43184671 {
43194672 for (int i=0; i < tps.length; i++)
....@@ -4322,10 +4675,8 @@
43224675
43234676 //if (child.parent != null)
43244677 //child.parent.addSelectee(child);
4678
+ objEditor.SetMaterial(child);
43254679 group.addSelectee(child);
4326
- objEditor.SetMaterial(child); // .GetMaterial());
4327
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4328
- System.err.println("info : " + child.GetPath());
43294680 }
43304681 }
43314682 // else
....@@ -4335,15 +4686,13 @@
43354686 // System.err.println("info : " + group.GetPath());
43364687 // }
43374688
4338
- objEditor.SetText(); // jan 2014
4339
-
43404689 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43414690 CameraPane.flash = true;
43424691
43434692 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43444693 // a camera
43454694 {
4346
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4695
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43474696 {
43484697 CameraPane.camerachangeframe = 0; // don't refuse it
43494698 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4352,6 +4701,13 @@
43524701 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43534702 }
43544703
4704
+ if (tps != null && tps.length == 1)
4705
+ {
4706
+ EditSelection(false);
4707
+ }
4708
+
4709
+ SetPinStates(tps != null && tps.length > 0);
4710
+
43554711 refreshContents();
43564712 //return true;
43574713 }
....@@ -4360,6 +4716,35 @@
43604716
43614717 freezemodel = false;
43624718 }
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
+ }
43634748
43644749 void linkSomething(Object3D thing)
43654750 {
....@@ -4442,6 +4827,7 @@
44424827
44434828 if (cut)
44444829 {
4830
+ if (Globals.SAVEONMAKE)
44454831 Save();
44464832 //int indices[] = jList.getSelectedIndices();
44474833 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -5160,10 +5546,28 @@
51605546 cButton clearpanelButton;
51615547 cButton unselectButton;
51625548
5549
+ cButton restoreCameraButton;
5550
+
51635551 cButton saveButton;
5164
- cButton undoButton;
5165
- cButton redoButton;
51665552 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;
51675571
51685572 cButton screenfitButton;
51695573 cButton screenfitpointButton;
....@@ -5176,14 +5580,6 @@
51765580
51775581 cButton setsupportButton;
51785582
5179
- cButton twoButton;
5180
- cButton sixButton;
5181
- cButton threeButton;
5182
- cButton sevenButton;
5183
- cButton fourButton; // full panel
5184
- cButton oneButton; // full XYZ
5185
- //cButton currentLayout;
5186
-
51875583 //
51885584 //Composite
51895585 Object3D // to do !!
....@@ -5193,11 +5589,11 @@
51935589 //JTree jTree;
51945590 private MenuItem lookAtItem;
51955591 private MenuItem lookFromItem;
5196
- private MenuItem switchItem;
5592
+ private MenuItem switchViewItem;
51975593 private MenuItem cutItem;
51985594 private MenuItem undoItem;
51995595 private MenuItem redoItem;
5200
- private MenuItem duplicateItem;
5596
+ private JMenuItem duplicateItem;
52015597 private MenuItem cloneItem;
52025598 private MenuItem cloneSupportItem;
52035599 private MenuItem overwriteGeoItem;
....@@ -5260,6 +5656,10 @@
52605656 private MenuItem showleavesItem;
52615657 private MenuItem markleavesItem;
52625658 private MenuItem unmarkleavesItem;
5659
+ private MenuItem rewindleavesItem;
5660
+ private MenuItem unrewindleavesItem;
5661
+ private MenuItem randomleavesItem;
5662
+ private MenuItem unrandomleavesItem;
52635663
52645664 private MenuItem flipVItem;
52655665 private MenuItem unflipVItem;
....@@ -5281,7 +5681,7 @@
52815681 private MenuItem frontItem;
52825682 private MenuItem cameraItem;
52835683 private MenuItem compositeItem;
5284
- private MenuItem randomItem;
5684
+ private MenuItem switchItem;
52855685 private MenuItem physicsItem;
52865686 private MenuItem frameselectorItem;
52875687 private MenuItem scriptNodeItem;
....@@ -5355,5 +5755,5 @@
53555755
53565756 Menu cameraMenu;
53575757 MenuItem editCameraItem;
5358
- MenuItem revertCameraItem;
5758
+ MenuItem restoreCameraItem;
53595759 }