Normand Briere
2019-06-24 914255f70cf047897212839cbf3a6722703f4457
GroupEditor.java
....@@ -176,7 +176,6 @@
176176 copyItem.addActionListener(this);
177177 pasteItem = menu.add(new MenuItem("Paste"));
178178 pasteItem.addActionListener(this);
179
- menu.add("-");
180179
181180 menu.add("-");
182181 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -369,11 +368,11 @@
369368 billboardItem.addActionListener(this);
370369 csgItem = menu.add(new MenuItem("CSG"));
371370 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
371
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373372 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
373
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375374 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
375
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377376 shadowZItem.addActionListener(this);
378377 if (Globals.ADVANCED)
379378 {
....@@ -581,43 +580,43 @@
581580 //minButton.setToolTipText("Minimize window");
582581 //minButton.addActionListener(this);
583582
584
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
583
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585584 maxButton.setToolTipText("Maximize window");
586585 maxButton.addActionListener(this);
587586
588
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
587
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589588 fullButton.setToolTipText("Full-screen window");
590589 fullButton.addActionListener(this);
591590
592
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591
+ oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
593592 undoButton.setToolTipText("Undo changes");
594593 undoButton.addActionListener(this);
595594
596
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
595
+ oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597596 redoButton.setToolTipText("Redo changes");
598597 redoButton.addActionListener(this);
599598
600
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
599
+ oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601600 saveButton.setToolTipText("Save changes");
602601 saveButton.addActionListener(this);
603602
604
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
603
+ oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
605604 liveCB.setToolTipText("Enable animation");
606605 liveCB.addItemListener(this);
607606
608
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
- oneStepButton.setToolTipText("Animate one step forward");
610
- oneStepButton.addActionListener(this);
611
-
612
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
607
+ oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
613608 fastCB.setToolTipText("Fast mode");
614609 fastCB.addItemListener(this);
615610
616
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
611
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ oneStepButton.setToolTipText("Animate one step forward");
613
+ oneStepButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
617616 trackCB.setToolTipText("Enable tracking");
618617 trackCB.addItemListener(this);
619618
620
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621620 screenfitButton.setToolTipText("Screen fit");
622621 screenfitButton.addActionListener(this);
623622
....@@ -631,25 +630,25 @@
631630 snapobjectButton.setToolTipText("Snap Object");
632631 }
633632
634
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
- flashSelectionButton.setToolTipText("Show selection");
633
+ oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ flashSelectionButton.setToolTipText("Highlight selection");
636635 flashSelectionButton.addActionListener(this);
637636
638637 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
639638
640
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
639
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641640 twoButton.setToolTipText("Show center view only");
642641 twoButton.addActionListener(this);
643
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644643 fourButton.addActionListener(this);
645644 fourButton.setToolTipText("Show left panel only");
646
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
645
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647646 sixButton.setToolTipText("2-column layout left");
648647 sixButton.addActionListener(this);
649
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
648
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650649 threeButton.setToolTipText("2-column layout right");
651650 threeButton.addActionListener(this);
652
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653652 sevenButton.setToolTipText("3-column layout");
654653 sevenButton.addActionListener(this);
655654 //
....@@ -664,32 +663,30 @@
664663 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
665664 //clearButton.addActionListener(this);
666665
667
- cGridBag commandsPanel = new cGridBag();
668
-
669
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
666
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670667 editButton.setToolTipText("Edit selection");
671668 editButton.addActionListener(this);
672669
673
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674671 uneditButton.setToolTipText("Unedit selection");
675672 uneditButton.addActionListener(this);
676673
677
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
674
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
678675 allParamsButton.setToolTipText("Edit all params");
679676 allParamsButton.addActionListener(this);
680677
681
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
678
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682679 clearPanelButton.setToolTipText("Clear edit panel");
683680 clearPanelButton.addActionListener(this);
684681
685
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686683 unselectButton.setToolTipText("Unselect");
687684 unselectButton.addActionListener(this);
688685
689
- commandsPanel.preferredHeight = 1;
686
+ editCommandsPanel.preferredHeight = 1;
690687
691
- oe.treePanel.add(commandsPanel);
692
- oe.treePanel.Return();
688
+// oe.treePanel.add(commandsPanel);
689
+// oe.treePanel.Return();
693690
694691 // oe.aConstraints.gridx += 1;
695692 // oe.aConstraints.weighty = 0;
....@@ -811,11 +808,23 @@
811808 // debugCB.addItemListener(this);
812809
813810 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
+ oeilCB.setToolTipText("Move camera when tracking target");
814812 oeilCB.addItemListener(this);
815813
814
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
+ shadowCB.setToolTipText("Compute shadows when live");
816
+ shadowCB.addItemListener(this);
817
+
818
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
+ autosaveCB.setToolTipText("Auto-save on structure change");
820
+ autosaveCB.addItemListener(this);
821
+
822
+ if (Globals.ADVANCED)
823
+ {
816824 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
817825 lookAtCB.setToolTipText("Look-at target");
818826 lookAtCB.addItemListener(this);
827
+ }
819828
820829 }
821830
....@@ -830,6 +839,14 @@
830839 void EditObject(Object3D obj)
831840 {
832841 cRadio radioButton = new cRadio(obj.name);
842
+
843
+ // Patch to avoid bug with transparency.
844
+ radioButton.hadMaterial = obj.material != null;
845
+ if (!radioButton.hadMaterial)
846
+ {
847
+ obj.material = new cMaterial();
848
+ }
849
+
833850 radioButton.SetObject(obj);
834851 radioButton.layout = sevenButton;
835852 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -851,23 +868,26 @@
851868 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
852869 }
853870
854
- JCheckBox liveCB;
855
- JCheckBox supportCB;
856
- JCheckBox localCB;
857
- JCheckBox crowdCB;
858
- JCheckBox smoothCB;
859
- JCheckBox fastCB;
860
- JCheckBox slowCB;
861
- JCheckBox boxCB;
862
- JCheckBox zoomBoxCB;
863
- JCheckBox trackCB;
864
- JCheckBox smoothfocusCB;
871
+ cCheckBox liveCB;
872
+ cCheckBox supportCB;
873
+ cCheckBox localCB;
874
+ cCheckBox crowdCB;
875
+ cCheckBox smoothCB;
876
+ cCheckBox fastCB;
877
+ cCheckBox slowCB;
878
+ cCheckBox boxCB;
879
+ cCheckBox zoomBoxCB;
880
+ cCheckBox trackCB;
881
+ cCheckBox smoothfocusCB;
865882 // JCheckBox speakerMocapCB;
866
- JCheckBox speakerCameraCB;
867
- JCheckBox speakerFocusCB;
868
- JCheckBox debugCB;
869
- JCheckBox oeilCB;
870
- JCheckBox lookAtCB;
883
+ cCheckBox speakerCameraCB;
884
+ cCheckBox speakerFocusCB;
885
+ cCheckBox debugCB;
886
+
887
+ cCheckBox oeilCB;
888
+ cCheckBox shadowCB;
889
+ cCheckBox autosaveCB;
890
+ cCheckBox lookAtCB;
871891
872892 // static int COLOR = 1;
873893 // static int MATERIAL = 2;
....@@ -875,9 +895,9 @@
875895
876896 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
877897
878
- JCheckBox colorCB;
879
- JCheckBox materialCB;
880
- JCheckBox textureCB;
898
+ cCheckBox colorCB;
899
+ cCheckBox materialCB;
900
+ cCheckBox textureCB;
881901
882902 public void itemStateChanged(ItemEvent e)
883903 {
....@@ -969,6 +989,14 @@
969989 else if(e.getSource() == oeilCB)
970990 {
971991 cameraView.ToggleOeil();
992
+ }
993
+ else if(e.getSource() == shadowCB)
994
+ {
995
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
996
+ }
997
+ else if(e.getSource() == autosaveCB)
998
+ {
999
+ Globals.SAVEONMAKE ^= true;
9721000 }
9731001 else if(e.getSource() == lookAtCB)
9741002 {
....@@ -1454,6 +1482,7 @@
14541482 shadow.material = new cMaterial(obj.material);
14551483 shadow.material.diffuse = 0.0001f;
14561484 shadow.material.specular = 0.0001f;
1485
+ //shadow.projectedVertices[1].x = 300;
14571486
14581487 makeSomething(shadow);
14591488 }
....@@ -3128,12 +3157,19 @@
31283157 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31293158 {
31303159 ab = (cRadio)e.nextElement();
3131
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3160
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31323161 {
3162
+ // Patch to avoid bug with transparency.
3163
+ if (!ab.hadMaterial)
3164
+ {
3165
+ ab.object.material = null;
3166
+ }
3167
+
31333168 buttonGroup.remove(ab);
31343169 radioPanel.remove(ab);
31353170
3136
- ab.GetObject().editWindow = null;
3171
+ //ab.GetObject().editWindow = null;
3172
+ ab.GetObject().manipWindow = null;
31373173 // ab.GetObject().objectUI = null; // ?????????
31383174
31393175 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3247,6 +3283,7 @@
32473283
32483284 // fix "+" issue
32493285 //group.editWindow = this;
3286
+ group.manipWindow = this;
32503287
32513288 /*
32523289 currentLayout = radio.layout;
....@@ -4569,6 +4606,7 @@
45694606
45704607 if (cut)
45714608 {
4609
+ if (Globals.SAVEONMAKE)
45724610 Save();
45734611 //int indices[] = jList.getSelectedIndices();
45744612 //for (int i = indices.length - 1; i >= 0; i--)