Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -74,6 +80,12 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
7789 SetupMenu2(this); //objEditor);
7890 SetupUI2(objEditor);
7991 objEditor.SetupUI(true);
....@@ -84,6 +96,10 @@
8496
8597 void CloneSelection(boolean supports)
8698 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
87103 // Object3D keep = GrafreeD.clipboard;
88104 //Object3D obj;
89105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +110,7 @@
94110
95111 makeSomething(clone, i==group.selection.size()-1);
96112 }
113
+ Globals.REPLACEONMAKE = keep;
97114 }
98115
99116 void CloneClipboard(boolean supports)
....@@ -150,11 +167,19 @@
150167
151168 void SetupMenu2(GroupEditor oe)
152169 {
170
+ oe.jTree = new cTree();
171
+
153172 Menu menu;
154173 oe.menuBar.add(menu = new Menu("Edit"));
155174 //editItem = menu.add(new MenuItem("Edit"));
156175 //editItem.addActionListener(this);
157
- duplicateItem = menu.add(new MenuItem("Duplicate"));
176
+
177
+// undoItem = menu.add(new MenuItem("Undo"));
178
+// undoItem.addActionListener(this);
179
+// redoItem = menu.add(new MenuItem("Redo"));
180
+// redoItem.addActionListener(this);
181
+// menu.add("-");
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
158183 duplicateItem.addActionListener(this);
159184 cloneItem = menu.add(new MenuItem("Clone"));
160185 cloneItem.addActionListener(this);
....@@ -170,7 +195,6 @@
170195 copyItem.addActionListener(this);
171196 pasteItem = menu.add(new MenuItem("Paste"));
172197 pasteItem.addActionListener(this);
173
- menu.add("-");
174198
175199 menu.add("-");
176200 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -182,8 +206,8 @@
182206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
183207 // pasteExpandItem.addActionListener(this);
184208 menu.add("-");
185
- clearItem = menu.add(new MenuItem("Clear"));
186
- clearItem.addActionListener(this);
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
187211
188212 if (Globals.ADVANCED)
189213 {
....@@ -197,23 +221,23 @@
197221 //zBufferItem.addActionListener(this);
198222 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
199223 //normalLensItem.addActionListener(this);
200
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
201
- revertCameraItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
202226
203
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
204
- toggleFullScreenItem.addItemListener(this);
205
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
206
- cameraMenu.add("-");
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
207239
208
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
209
- toggleTextureItem.addItemListener(this);
210
- toggleTextureItem.setState(CameraPane.textureon);
211
-
212
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
213
- toggleSwitchItem.addItemListener(this);
214
- toggleSwitchItem.setState(CameraPane.SWITCH);
215
-
216
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
217241 toggleHandleItem.addItemListener(this);
218242 toggleHandleItem.setState(CameraPane.HANDLES);
219243
....@@ -240,7 +264,7 @@
240264
241265 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
242266 toggleDebugItem.addItemListener(this);
243
- toggleDebugItem.setState(CameraPane.DEBUG);
267
+ toggleDebugItem.setState(Globals.DEBUG);
244268
245269 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
246270 toggleFrustumItem.addItemListener(this);
....@@ -261,14 +285,14 @@
261285 // animationItem.addItemListener(this);
262286 // animationItem.setState(CameraPane.ANIMATION);
263287 cameraMenu.add("-");
264
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
288
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
265289 editCameraItem.addActionListener(this);
266290
267291 if (Globals.ADVANCED)
268292 {
269293 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
270294 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
271
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
272296 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
273297 oe.cameraMenu.add("-");
274298 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -276,7 +300,7 @@
276300 editLeafItem.addActionListener(this);
277301 lookAtItem.addActionListener(this);
278302 //lookFromItem.addActinoListener(this);
279
- //switchItem.addActionListener(this);
303
+ //switchViewItem.addActionListener(this);
280304 }
281305
282306 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -321,21 +345,29 @@
321345 }
322346
323347 oe.menuBar.add(menu = new Menu("Group"));
324
- grabItem = menu.add(new MenuItem("Grab"));
325
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
326350 backItem = menu.add(new MenuItem("Back"));
327351 backItem.addActionListener(this);
328352 frontItem = menu.add(new MenuItem("Front"));
329353 frontItem.addActionListener(this);
330
- compositeItem = menu.add(new MenuItem("Composite"));
331
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
332359 hideItem = menu.add(new MenuItem("Hidden Group"));
333360 hideItem.addActionListener(this);
361
+ }
334362 ungroupItem = menu.add(new MenuItem("Ungroup"));
335363 ungroupItem.addActionListener(this);
336
- menu.add("-");
337
- randomItem = menu.add(new MenuItem("Switch node"));
338
- randomItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
339371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
340372 switchGeoItem.addActionListener(this);
341373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -343,8 +375,6 @@
343375 morphItem = menu.add(new MenuItem("Morph Group"));
344376 morphItem.addActionListener(this);
345377
346
- if (Globals.ADVANCED)
347
- {
348378 menu.add("-");
349379 physicsItem = menu.add(new MenuItem("Physics"));
350380 physicsItem.addActionListener(this);
....@@ -352,30 +382,29 @@
352382 frameselectorItem.addActionListener(this);
353383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
354384 scriptNodeItem.addActionListener(this);
355
- cameraItem = menu.add(new MenuItem("Camera"));
356
- cameraItem.addActionListener(this);
357385 }
358386
359387 oe.menuBar.add(menu = new Menu("Object"));
360
- textureItem = menu.add(new MenuItem("Texture"));
361
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
362390 billboardItem = menu.add(new MenuItem("Billboard"));
363391 billboardItem.addActionListener(this);
364392 csgItem = menu.add(new MenuItem("CSG"));
365393 csgItem.addActionListener(this);
366
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
367395 shadowXItem.addActionListener(this);
368
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
369397 shadowYItem.addActionListener(this);
370
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
371399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
372403 if (Globals.ADVANCED)
373404 {
374405 menu.add("-");
375406 linkerItem = menu.add(new MenuItem("Linker"));
376407 linkerItem.addActionListener(this);
377
- attributeItem = menu.add(new MenuItem("Attribute"));
378
- attributeItem.addActionListener(this);
379408 templateItem = menu.add(new MenuItem("Template"));
380409 templateItem.addActionListener(this);
381410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -404,7 +433,7 @@
404433 genNormalsMESHItem.addActionListener(this);
405434 if (Globals.ADVANCED)
406435 {
407
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
408437 genNormalsMINEItem.addActionListener(this);
409438 }
410439 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -464,6 +493,14 @@
464493 markleavesItem.addActionListener(this);
465494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
466495 unmarkleavesItem.addActionListener(this);
496
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
497
+ rewindleavesItem.addActionListener(this);
498
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
499
+ unrewindleavesItem.addActionListener(this);
500
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
501
+ randomleavesItem.addActionListener(this);
502
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
503
+ unrandomleavesItem.addActionListener(this);
467504 menu.add("-");
468505 flipVItem = menu.add(new MenuItem("Flip V"));
469506 flipVItem.addActionListener(this);
....@@ -519,8 +556,21 @@
519556 buildToolsMenu(menu);
520557 }
521558
559
+
522560 void SetupUI2(ObjEditor oe)
523561 {
562
+ // June 2019
563
+ if (oe == null)
564
+ {
565
+ //super.SetupUI2(this);
566
+ //return;
567
+ }
568
+
569
+ if (copy != group)
570
+ {
571
+ //super.SetupUI2(this);
572
+ }
573
+
524574 //new Exception().printStackTrace();
525575
526576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -549,27 +599,79 @@
549599 oe.radioPanel.add(dummyButton);
550600 oe.buttonGroup.add(dummyButton);
551601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
552606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
553607
554
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
611
+
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
618
+
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ fullButton.setToolTipText("Full-screen window");
621
+ fullButton.addActionListener(this);
622
+
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
630
+
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
633
+ saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
639
+
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
555659 liveCB.setToolTipText("Enable animation");
556660 liveCB.addItemListener(this);
557661
558
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
559663 oneStepButton.setToolTipText("Animate one step forward");
560664 oneStepButton.addActionListener(this);
561665
562
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
563667 fastCB.setToolTipText("Fast mode");
564668 fastCB.addItemListener(this);
565669
566
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
567
- trackCB.setToolTipText("Enable tracking");
568
- trackCB.addItemListener(this);
569
-
570
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
571
- screenfitButton.setToolTipText("Screen fit");
572
- screenfitButton.addActionListener(this);
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
573675
574676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
575677 // screenfitpointButton.addActionListener(this);
....@@ -581,65 +683,146 @@
581683 snapobjectButton.setToolTipText("Snap Object");
582684 }
583685
584
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- flashSelectionButton.setToolTipText("Show selection");
586
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
587687
588
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
589
-
590
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591
- twoButton.setToolTipText("Show center view only");
592
- twoButton.addActionListener(this);
593
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594689 fourButton.addActionListener(this);
595690 fourButton.setToolTipText("Show left panel only");
596
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- sixButton.setToolTipText("2-column layout left");
691
+
692
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ twoButton.setToolTipText("Show right view only");
694
+ twoButton.addActionListener(this);
695
+ this.fullscreenLayout = twoButton;
696
+
697
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ sixButton.setToolTipText("Show left and right");
598699 sixButton.addActionListener(this);
599
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- threeButton.setToolTipText("2-column layout right");
601
- threeButton.addActionListener(this);
602
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- sevenButton.setToolTipText("3-column layout");
604
- sevenButton.addActionListener(this);
700
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+// threeButton.setToolTipText("2-column layout right");
702
+// threeButton.addActionListener(this);
703
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+// sevenButton.setToolTipText("3-column layout");
705
+// sevenButton.addActionListener(this);
605706 //
606707
607
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- rootButton.setToolTipText("Edit selection in new tab");
708
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ rootButton.setToolTipText("Open selection in new tab");
609710 rootButton.addActionListener(this);
610711
611
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
712
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612713 closeButton.setToolTipText("Close tab");
613714 closeButton.addActionListener(this);
614715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
615716 //clearButton.addActionListener(this);
616
-
617
- cGridBag commandsPanel = new cGridBag();
717
+
718
+ // INSERT
719
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
720
+ gridButton.setToolTipText("Create grid");
721
+ gridButton.addActionListener(this);
722
+
723
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ boxButton.setToolTipText("Create box");
725
+ boxButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ sphereButton.setToolTipText("Create sphere");
729
+ sphereButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ coneButton.setToolTipText("Create cone");
733
+ coneButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ torusButton.setToolTipText("Create torus");
737
+ torusButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ superButton.setToolTipText("Create superellipsoid");
741
+ superButton.addActionListener(this);
742
+
743
+ if (Globals.ADVANCED)
744
+ {
745
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ kleinButton.setToolTipText("Create Klein bottle");
747
+ kleinButton.addActionListener(this);
748
+ }
618749
619
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- editButton.setToolTipText("Edit selection");
750
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751
+ particlesButton.setToolTipText("Create particle system");
752
+ particlesButton.addActionListener(this);
753
+
754
+ oe.toolboxPanel.Return();
755
+
756
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ groupButton.setToolTipText("Create group");
758
+ groupButton.addActionListener(this);
759
+
760
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ compositeButton.setToolTipText("Create composite");
762
+ compositeButton.addActionListener(this);
763
+
764
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ switchButton.setToolTipText("Create item switcher");
766
+ switchButton.addActionListener(this);
767
+
768
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ loopButton.setToolTipText("Create loop");
770
+ loopButton.addActionListener(this);
771
+
772
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ textureButton.setToolTipText("Create texture");
774
+ textureButton.addActionListener(this);
775
+
776
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ overlayButton.setToolTipText("Create overlay");
778
+ overlayButton.addActionListener(this);
779
+
780
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ lightButton.setToolTipText("Create light");
782
+ lightButton.addActionListener(this);
783
+
784
+ for (int i=6; --i>=0;)
785
+ {
786
+ oe.toolboxPanel.Return();
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ }
795
+
796
+ // EDIT panel
797
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
798
+ editButton.setToolTipText("Pin selection controls");
621799 editButton.addActionListener(this);
622800
623
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
- uneditButton.setToolTipText("Unedit selection");
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
625803 uneditButton.addActionListener(this);
626804
627
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
628
- allParamsButton.setToolTipText("Edit all params");
805
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
806
+ allParamsButton.setToolTipText("Show all controle");
629807 allParamsButton.addActionListener(this);
630808
631
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632810 clearPanelButton.setToolTipText("Clear edit panel");
633811 clearPanelButton.addActionListener(this);
634812
635
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636814 unselectButton.setToolTipText("Unselect");
637815 unselectButton.addActionListener(this);
638816
639
- commandsPanel.preferredHeight = 1;
817
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
818
+ flashSelectionButton.setToolTipText("Highlight selection");
819
+ flashSelectionButton.addActionListener(this);
640820
641
- oe.treePanel.add(commandsPanel);
642
- oe.treePanel.Return();
821
+ editCommandsPanel.preferredHeight = 1;
822
+
823
+ SetPinStates(false);
824
+// oe.treePanel.add(commandsPanel);
825
+// oe.treePanel.Return();
643826
644827 // oe.aConstraints.gridx += 1;
645828 // oe.aConstraints.weighty = 0;
....@@ -656,29 +839,17 @@
656839
657840 JScrollPane jSP;
658841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
659
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
660843 ResetModel();
661844
662845 oe.treePanel.add(jSPPanel);
663846 oe.treePanel.Return();
664847
665
- cGridBag copyOptionsPanel = new cGridBag();
666
-
667
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
668
- colorCB.setToolTipText("Copy color when dropped");
669
- colorCB.addItemListener(this);
670
-
671
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
672
- materialCB.setToolTipText("Copy material when dropped");
673
- materialCB.addItemListener(this);
674
-
675
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
676
- textureCB.setToolTipText("Copy texture when dropped");
677
- textureCB.addItemListener(this);
678
-
679
- copyOptionsPanel.preferredHeight = 1;
680848 oe.treePanel.add(copyOptionsPanel);
681849 oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
682853
683854 // mainPanel.setDividerLocation(0.5); //1.0);
684855 // mainPanel.setResizeWeight(0.5);
....@@ -701,29 +872,49 @@
701872 dgr.addDragGestureListener(this);
702873 }catch(Exception e) {}
703874 */
704
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
705876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
706877 }
707878
708879 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
709880 {
881
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
882
+ colorCB.setToolTipText("Copy color when dropped");
883
+ colorCB.addItemListener(this);
884
+
885
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
886
+ materialCB.setToolTipText("Copy material when dropped");
887
+ materialCB.addItemListener(this);
888
+
889
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
890
+ textureCB.setToolTipText("Copy texture when dropped");
891
+ textureCB.addItemListener(this);
892
+
893
+ panel.Return();
894
+
710895 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
711896 boxCB.setToolTipText("Display bounding boxes");
712897 boxCB.addItemListener(this);
713898
714899 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
715
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
716901 zoomBoxCB.addItemListener(this);
717902
718903 if (true) // Globals.ADVANCED)
719904 {
720
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
721
- supportCB.setToolTipText("Enable rigging");
722
- supportCB.addItemListener(this);
905
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
906
+// supportCB.setToolTipText("Enable rigging");
907
+// supportCB.addItemListener(this);
908
+
909
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
910
+ freezeCB.setToolTipText("Fast moving camera");
911
+ freezeCB.addItemListener(this);
723912
724913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
725914 // localCB.addItemListener(this);
726915
916
+ panel.Return();
917
+
727918 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
728919 crowdCB.setToolTipText("Used for crowds");
729920 crowdCB.addItemListener(this);
....@@ -740,6 +931,8 @@
740931 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
741932 // speakerMocapCB.addItemListener(this);
742933
934
+ panel.Return();
935
+
743936 if (false)
744937 {
745938 // handled in scripts
....@@ -754,34 +947,74 @@
754947 //constraints.gridy += 1;
755948 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
756949 smoothfocusCB.addItemListener(this);
950
+ panel.Return();
757951 }
758952
759953 //constraints.gridx += 1;
760954 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
761955 // debugCB.addItemListener(this);
762956
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
763961 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
962
+ oeilCB.setToolTipText("Move camera when tracking");
764963 oeilCB.addItemListener(this);
765964
965
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
966
+ shadowCB.setToolTipText("When live compute shadows");
967
+ shadowCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
971
+ toggleTextureCB.setToolTipText("Load textures");
972
+ toggleTextureCB.addItemListener(this);
973
+
974
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
975
+ toggleSwitchCB.setToolTipText("Choose a single item");
976
+ toggleSwitchCB.addItemListener(this);
977
+
978
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
979
+ autokeepCB.setToolTipText("On structure change");
980
+ autokeepCB.addItemListener(this);
981
+
982
+ panel.Return();
983
+ if (Globals.ADVANCED)
984
+ {
766985 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
767986 lookAtCB.setToolTipText("Look-at target");
768987 lookAtCB.addItemListener(this);
988
+ }
769989
770990 }
771991
772992 cGridBag fill = new cGridBag();
773
-
774993 fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
775998
776999 panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
7771002
7781003 }
7791004
7801005 void EditObject(Object3D obj)
7811006 {
7821007 cRadio radioButton = new cRadio(obj.name);
1008
+
1009
+ // June 2019. Patch to avoid bug with transparency.
1010
+ radioButton.hadMaterial = obj.material != null;
1011
+ if (!radioButton.hadMaterial)
1012
+ {
1013
+ obj.material = new cMaterial();
1014
+ }
1015
+
7831016 radioButton.SetObject(obj);
784
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
7851018 radioButton.SetCamera(cameraView.renderCamera, false);
7861019 radioButton.addActionListener(this);
7871020 radioPanel.add(radioButton);
....@@ -791,6 +1024,8 @@
7911024
7921025 void SetupViews(ObjEditor oe)
7931026 {
1027
+ theFrame = this;
1028
+
7941029 oe.SetupViews();
7951030
7961031 System.out.println("SetupViews");
....@@ -799,23 +1034,28 @@
7991034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8001035 }
8011036
802
- JCheckBox liveCB;
803
- JCheckBox supportCB;
804
- JCheckBox localCB;
805
- JCheckBox crowdCB;
806
- JCheckBox smoothCB;
807
- JCheckBox fastCB;
808
- JCheckBox slowCB;
809
- JCheckBox boxCB;
810
- JCheckBox zoomBoxCB;
811
- JCheckBox trackCB;
812
- JCheckBox smoothfocusCB;
1037
+ cToggleButton liveCB;
1038
+ cCheckBox supportCB;
1039
+ cCheckBox localCB;
1040
+ cCheckBox crowdCB;
1041
+ cCheckBox smoothCB;
1042
+ cToggleButton fastCB;
1043
+ cCheckBox slowCB;
1044
+ cCheckBox boxCB;
1045
+ cCheckBox zoomBoxCB;
1046
+ cCheckBox freezeCB;
1047
+ //cToggleButton trackCB;
1048
+ cCheckBox trackCB;
1049
+ cCheckBox smoothfocusCB;
8131050 // JCheckBox speakerMocapCB;
814
- JCheckBox speakerCameraCB;
815
- JCheckBox speakerFocusCB;
816
- JCheckBox debugCB;
817
- JCheckBox oeilCB;
818
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
8191059
8201060 // static int COLOR = 1;
8211061 // static int MATERIAL = 2;
....@@ -823,9 +1063,9 @@
8231063
8241064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8251065
826
- JCheckBox colorCB;
827
- JCheckBox materialCB;
828
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
8291069
8301070 public void itemStateChanged(ItemEvent e)
8311071 {
....@@ -853,6 +1093,7 @@
8531093 } else if(e.getSource() == liveCB)
8541094 {
8551095 cameraView.ToggleLive();
1096
+ refreshContents(false);
8561097 }
8571098 else if(e.getSource() == supportCB)
8581099 {
....@@ -917,6 +1158,18 @@
9171158 {
9181159 cameraView.ToggleOeil();
9191160 }
1161
+ else if(e.getSource() == shadowCB)
1162
+ {
1163
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1164
+ }
1165
+ else if(e.getSource() == freezeCB)
1166
+ {
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
1172
+ }
9201173 else if(e.getSource() == lookAtCB)
9211174 {
9221175 cameraView.ToggleLookAt();
....@@ -933,7 +1186,8 @@
9331186
9341187 /**/
9351188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
936
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
9371191 if ((path == null) || (path.getPathCount() <= 1)) {
9381192 // We can't move the root node or an empty selection
9391193 return;
....@@ -996,8 +1250,6 @@
9961250 }
9971251 }
9981252
999
- String string = (String) object;
1000
-
10011253 System.out.println("Transfer = " + object + "; drop : " + target);
10021254 // if( object instanceof java.io.File[])
10031255 // {
....@@ -1005,6 +1257,8 @@
10051257 // objEditor.DropFile((java.io.File[]) object, true);
10061258 // return;
10071259 // }
1260
+
1261
+ String string = object.toString();
10081262
10091263 // File path for Mac and Windows
10101264 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1050,23 +1304,33 @@
10501304
10511305 assert target == objEditor.jTree;
10521306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
10531308 try {
1054
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10551310 } catch (Exception e) {
10561311 System.out.println("destinationPath : " + destinationPath);
10571312 return;
10581313 }
10591314
1060
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
10611316 {
1317
+ Object3D child = (Object3D)group.selection.elementAt(i);
1318
+
1319
+ // Cannot move into itself
1320
+ if (child == destinationLeaf)
1321
+ return;
1322
+ }
1323
+
1324
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1325
+// {
10621326 loadClipboard(true);
10631327 objEditor.jTree.setSelectionPath(destinationPath);
10641328 pasteInto(false, false);
1065
- } else {
1066
- loadClipboard(false);
1067
- objEditor.jTree.setSelectionPath(destinationPath);
1068
- pasteInto(false, false); // true); // ???
1069
- }
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
10701334 }
10711335 public void dropActionChanged(DropTargetDragEvent dtde)
10721336 // Called if the user has modified the current drop gesture
....@@ -1171,22 +1435,30 @@
11711435 {
11721436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11731437 //heightFieldItem.addActionListener(this);
1174
- gridItem = menu.add(new MenuItem("Grid"));
1175
- gridItem.addActionListener(this);
1176
- rectoidItem = menu.add(new MenuItem("Box"));
1177
- rectoidItem.addActionListener(this);
1178
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1179
- ellipsoidItem.addActionListener(this);
1180
- coneItem = menu.add(new MenuItem("Cone"));
1181
- coneItem.addActionListener(this);
1182
- torusItem = menu.add(new MenuItem("Torus"));
1183
- torusItem.addActionListener(this);
1184
- superItem = menu.add(new MenuItem("Superellipsoid"));
1185
- superItem.addActionListener(this);
1438
+// gridItem = menu.add(new MenuItem("Grid"));
1439
+// gridItem.addActionListener(this);
1440
+// rectoidItem = menu.add(new MenuItem("Box"));
1441
+// rectoidItem.addActionListener(this);
1442
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1443
+// ellipsoidItem.addActionListener(this);
1444
+// coneItem = menu.add(new MenuItem("Cone"));
1445
+// coneItem.addActionListener(this);
1446
+// torusItem = menu.add(new MenuItem("Torus"));
1447
+// torusItem.addActionListener(this);
1448
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1449
+// superItem.addActionListener(this);
1450
+
1451
+ cameraItem = menu.add(new MenuItem("Camera"));
1452
+ cameraItem.addActionListener(this);
1453
+
1454
+ if (!Globals.ADVANCED)
1455
+ {
11861456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11871457 kleinItem.addActionListener(this);
1188
- particleItem = menu.add(new MenuItem("Particle system"));
1189
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
11901462 if (Globals.ADVANCED)
11911463 {
11921464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1212,15 +1484,15 @@
12121484 }
12131485 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12141486 bezierItem.addActionListener(this);
1215
- overlayItem = menu.add(new MenuItem("Overlay"));
1216
- overlayItem.addActionListener(this);
1217
- lightItem = menu.add(new MenuItem("Light"));
1218
- lightItem.addActionListener(this);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
12191491 menu.add("-");
12201492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12211493 //superLoopItem.addActionListener(this);
1222
- loopItem = menu.add(new MenuItem("Loop"));
1223
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
12241496 doubleItem = menu.add(new MenuItem("Fork"));
12251497 doubleItem.addActionListener(this);
12261498 if (Globals.ADVANCED)
....@@ -1236,6 +1508,9 @@
12361508 animationItem.addItemListener(this);
12371509 animationItem.setState(Globals.ANIMATION);
12381510
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
1513
+
12391514 menu.add("-");
12401515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12411516 parseverticesItem.addActionListener(this);
....@@ -1248,6 +1523,8 @@
12481523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12491524 reduce34MorphItem.addActionListener(this);
12501525 menu.add("-");
1526
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1527
+ memoryItem.addActionListener(this);
12511528 menu.add(computeAOItem = new MenuItem("Compute AO"));
12521529 computeAOItem.addActionListener(this);
12531530
....@@ -1256,11 +1533,9 @@
12561533 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12571534 mirrorItem.addActionListener(this);
12581535 menu.add("-");
1259
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1260
- memoryItem.addActionListener(this);
12611536 menu.add(analyzeItem = new MenuItem("Analyze"));
12621537 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1538
+ menu.add(dumpItem = new MenuItem("Print"));
12641539 dumpItem.addActionListener(this);
12651540 // menu.add(pathItem = new MenuItem("From-to path"));
12661541 // pathItem.addActionListener(this);
....@@ -1401,9 +1676,34 @@
14011676 shadow.material = new cMaterial(obj.material);
14021677 shadow.material.diffuse = 0.0001f;
14031678 shadow.material.specular = 0.0001f;
1679
+ //shadow.projectedVertices[1].x = 300;
14041680
14051681 makeSomething(shadow);
14061682 }
1683
+
1684
+ private void ClearUnpinned()
1685
+ {
1686
+ //for (Object3D obj : listUI)
1687
+ for (int i=listUI.size(); --i>=0;)
1688
+ {
1689
+ Object3D obj = listUI.elementAt(i);
1690
+ if (!obj.pinned)
1691
+ {
1692
+ obj.CloseUI();
1693
+ listUI.remove(i);
1694
+ }
1695
+ }
1696
+ }
1697
+
1698
+ private void EditElement(Object3D elem, boolean newWindow)
1699
+ {
1700
+ // if (!(elem instanceof Composite))
1701
+ // newWindow = false;
1702
+ listUI.add(elem);
1703
+ elem.openEditWindow(this, newWindow); //, false);
1704
+ System.out.println("edit : " + elem);
1705
+ elem.editWindow.refreshContents(true); // ? new
1706
+ }
14071707
14081708 /**
14091709 * applyExample
....@@ -1648,7 +1948,7 @@
16481948 {
16491949 ScreenFit();
16501950 } else
1651
- if (source == switchItem)
1951
+ if (source == switchViewItem)
16521952 {
16531953 cVector v1 = new cVector();
16541954 cVector v2 = new cVector();
....@@ -1657,11 +1957,11 @@
16571957 objEditor.cameraView.renderCamera.setAim(v2, v1);
16581958 objEditor.cameraView.repaint();
16591959 } else
1660
- if (source == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
16611961 {
16621962 makeSomething(new Box());
16631963 } else
1664
- if (source == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
16651965 {
16661966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16671967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1740,27 +2040,27 @@
17402040
17412041 makeSomething(obj);
17422042 } else
1743
- if (source == gridItem)
2043
+ if (source == gridItem || source == gridButton)
17442044 {
17452045 makeSomething(new Grid());
17462046 } else
1747
- if (source == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
17482048 {
17492049 makeSomething(new Sphere());
17502050 } else
1751
- if (source == coneItem)
2051
+ if (source == coneItem || source == coneButton)
17522052 {
17532053 makeSomething(new Cone());
17542054 } else
1755
- if (source == torusItem)
2055
+ if (source == torusItem || source == torusButton)
17562056 {
17572057 makeSomething(new Torus());
17582058 } else
1759
- if (source == superItem)
2059
+ if (source == superItem || source == superButton)
17602060 {
17612061 makeSomething(new Superellipsoid());
17622062 } else
1763
- if (source == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
17642064 {
17652065 makeSomething(new Klein());
17662066 } else
....@@ -1780,7 +2080,7 @@
17802080 {
17812081 makeSomething(new BezierSurface());
17822082 } else
1783
- if (source == overlayItem)
2083
+ if (source == overlayItem || source == overlayButton)
17842084 {
17852085 /*
17862086 Object3D obj = new BezierSurface(5,8);
....@@ -1828,7 +2128,7 @@
18282128 s.setup();
18292129 makeSomething(s);
18302130 } else
1831
- if (source == lightItem)
2131
+ if (source == lightItem || source == lightButton)
18322132 {
18332133 makeSomething(new Light());
18342134 } else
....@@ -1878,30 +2178,30 @@
18782178
18792179 group(g);
18802180 } else
1881
- if (source == loopItem)
2181
+ if (source == loopItem || source == loopButton)
18822182 {
18832183 Composite csg = new GroupLeaf();
18842184 csg.count = 5;
18852185 group(csg);
1886
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
18872187 csg.addChild(child);
18882188 child.addChild(csg);
18892189 } else
18902190 if (source == doubleItem)
18912191 {
1892
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
18932193 csg.count = 5;
18942194 group(csg);
1895
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
18962196 csg.addChild(child);
18972197 child.addChild(csg);
1898
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
18992199 csg.addChild(child);
19002200 child.addChild(csg);
19012201 } else
19022202 if (source == tripleItem)
19032203 {
1904
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
19052205 csg.count = 4;
19062206 group(csg);
19072207 Composite child = new cGroup();
....@@ -1951,6 +2251,46 @@
19512251 {
19522252 DumpObject();
19532253 } else
2254
+ if (source == minButton)
2255
+ {
2256
+ Minimize();
2257
+ } else
2258
+ if (source == maxButton)
2259
+ {
2260
+ Maximize();
2261
+ } else
2262
+ if (source == fullButton)
2263
+ {
2264
+ ToggleFullScreen();
2265
+ } else
2266
+ if (source == undoButton)
2267
+ {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2271
+ Undo();
2272
+ } else
2273
+ if (source == restoreButton)
2274
+ {
2275
+ // Restore current version
2276
+ Restore();
2277
+ } else
2278
+ if (source == replaceButton)
2279
+ {
2280
+ // Overwrite current version
2281
+ Replace();
2282
+ } else
2283
+ if (source == redoButton)
2284
+ {
2285
+ // Go to next version
2286
+ Redo();
2287
+ } else
2288
+ if (source == saveButton)
2289
+ {
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
2293
+ } else
19542294 if (source == oneStepButton)
19552295 {
19562296 Globals.ONESTEP = true;
....@@ -1958,17 +2298,14 @@
19582298 } else
19592299 if (source == screenfitButton)
19602300 {
1961
- //Reload(lastConverter, lastFilename, true);
19622301 ScreenFit();
19632302 } else
19642303 if (source == screenfitpointButton)
19652304 {
1966
- //Reload(lastConverter, lastFilename, true);
19672305 ScreenFitPoint();
19682306 } else
19692307 if (source == snapobjectButton)
19702308 {
1971
- //Reload(lastConverter, lastFilename, true);
19722309 SnapObject();
19732310 } else
19742311 // if (event.getSource() == recompileButton)
....@@ -2004,6 +2341,14 @@
20042341 if (source == cutItem || source == clearButton)
20052342 {
20062343 loadClipboard(true);
2344
+ } else
2345
+ if (source == undoItem)
2346
+ {
2347
+ Undo();
2348
+ } else
2349
+ if (source == redoItem)
2350
+ {
2351
+ Redo();
20072352 } else
20082353 if (source == duplicateItem)
20092354 {
....@@ -2324,7 +2669,7 @@
23242669 {
23252670 StepAll();
23262671 } else
2327
- if (source == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
23282673 {
23292674 //int indices[] = jList.getSelectedIndices();
23302675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2336,9 +2681,9 @@
23362681 {
23372682 ClearSelection(true);
23382683 } else
2339
- if (source == grabItem)
2684
+ if (source == grabItem || source == groupButton)
23402685 {
2341
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
23422687 } else
23432688 if (source == hideItem)
23442689 {
....@@ -2356,11 +2701,11 @@
23562701 {
23572702 makeSomething(new Camera());
23582703 } else
2359
- if (source == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
23602705 {
23612706 group(new Composite());
23622707 } else
2363
- if (source == randomItem)
2708
+ if (source == switchItem || source == switchButton)
23642709 {
23652710 RandomNode random = new RandomNode();
23662711 group(random);
....@@ -2462,7 +2807,7 @@
24622807 {
24632808 group(new cLinker());
24642809 } else
2465
- if (source == textureItem)
2810
+ if (source == textureItem || source == textureButton)
24662811 {
24672812 group(new TextureNode());
24682813 } else
....@@ -2482,17 +2827,30 @@
24822827 {
24832828 CastShadow(2);
24842829 } else
2485
- if (source == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
24862831 {
2487
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
24882834 for (int i=0; i<group.selection.size(); i++)
24892835 {
2490
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
24912841 }
24922842
2493
- ClearSelection(false);
2494
-
2495
- refreshContents();
2843
+ if (!hasRoot)
2844
+ {
2845
+ for (int i=0; i<group.selection.size(); i++)
2846
+ {
2847
+ Ungroup(group.selection.get(i));
2848
+ }
2849
+
2850
+ ClearSelection(false);
2851
+
2852
+ refreshContents();
2853
+ }
24962854 } else
24972855 if (source == genUVItem)
24982856 {
....@@ -2504,7 +2862,7 @@
25042862 } else
25052863 if (source == genNormalsMESHItem)
25062864 {
2507
- GenNormals(true); // TODO
2865
+ GenNormalsMESH();
25082866 } else
25092867 if (source == genNormalsORGANItem)
25102868 {
....@@ -2569,6 +2927,22 @@
25692927 if (source == unmarkleavesItem)
25702928 {
25712929 MarkLeaves(false);
2930
+ } else
2931
+ if (source == rewindleavesItem)
2932
+ {
2933
+ RewindLeaves(true);
2934
+ } else
2935
+ if (source == unrewindleavesItem)
2936
+ {
2937
+ RewindLeaves(false);
2938
+ } else
2939
+ if (source == randomleavesItem)
2940
+ {
2941
+ RandomLeaves(true);
2942
+ } else
2943
+ if (source == unrandomleavesItem)
2944
+ {
2945
+ RandomLeaves(false);
25722946 } else
25732947 if (source == flipVItem)
25742948 {
....@@ -2804,6 +3178,10 @@
28043178 if (source == twoButton)
28053179 {
28063180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
28073185 // bug
28083186 //gridPanel.setDividerLocation(1.0);
28093187 //bigPanel.setDividerLocation(0.0);
....@@ -2836,10 +3214,31 @@
28363214 bigThree.ClearUI();
28373215 bigThree.add(centralPanel);
28383216 bigThree.FlushUI();
3217
+
3218
+ cameraView.requestFocusInWindow();
3219
+
3220
+// refreshContents(true);
3221
+//
3222
+// try
3223
+// {
3224
+// java.awt.Robot bot = new java.awt.Robot();
3225
+// int mask = InputEvent.BUTTON1_MASK;
3226
+// bot.mouseMove(100, 100);
3227
+// bot.mousePress(mask);
3228
+// bot.mouseRelease(mask);
3229
+// }
3230
+// catch (Exception e)
3231
+// {
3232
+//
3233
+// }
3234
+
28393235 } else
28403236 if (source == threeButton)
28413237 {
28423238 radio.layout = threeButton;
3239
+
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
28433242
28443243 // bigThree.remove(scenePanel);
28453244 // bigThree.remove(centralPanel);
....@@ -2872,10 +3271,15 @@
28723271 bigThree.add(centralPanel);
28733272 bigThree.add(XYZPanel);
28743273 bigThree.FlushUI();
3274
+
3275
+ cameraView.requestFocusInWindow();
28753276 } else
28763277 if (source == fourButton)
28773278 {
28783279 radio.layout = fourButton;
3280
+
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
28793283
28803284 // bigThree.remove(scenePanel);
28813285 // bigThree.remove(centralPanel);
....@@ -2907,10 +3311,15 @@
29073311 bigThree.ClearUI();
29083312 bigThree.add(scenePanel);
29093313 bigThree.FlushUI();
3314
+
3315
+ cameraView.requestFocusInWindow();
29103316 } else
29113317 if (source == sixButton)
29123318 {
29133319 radio.layout = sixButton;
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
29143323
29153324 // bigThree.remove(scenePanel);
29163325 // bigThree.remove(centralPanel);
....@@ -2943,10 +3352,15 @@
29433352 bigThree.add(scenePanel);
29443353 bigThree.add(centralPanel);
29453354 bigThree.FlushUI();
3355
+
3356
+ cameraView.requestFocusInWindow();
29463357 } else
29473358 if (source == sevenButton)
29483359 {
29493360 radio.layout = sevenButton;
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
29503364
29513365 // bigThree.remove(scenePanel);
29523366 // bigThree.remove(centralPanel);
....@@ -2980,6 +3394,8 @@
29803394 bigThree.add(centralPanel);
29813395 bigThree.add(XYZPanel);
29823396 bigThree.FlushUI();
3397
+
3398
+ cameraView.requestFocusInWindow();
29833399 } else
29843400 if (source == rootButton)
29853401 {
....@@ -2991,6 +3407,7 @@
29913407 EditObject(obj);
29923408 }
29933409
3410
+ cameraView.requestFocusInWindow();
29943411 refreshContents(true);
29953412 } else
29963413 if (source == closeButton)
....@@ -3000,22 +3417,37 @@
30003417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30013418 {
30023419 ab = (cRadio)e.nextElement();
3003
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30043421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
30053428 buttonGroup.remove(ab);
30063429 radioPanel.remove(ab);
30073430
3008
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
30093433 // ab.GetObject().objectUI = null; // ?????????
30103434
30113435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30123436 break;
30133437 }
30143438 }
3439
+
3440
+ cameraView.requestFocusInWindow();
30153441 refreshContents(true);
30163442 } else
30173443 if (source == editItem || source == editButton)
30183444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
30193451 EditSelection(false);
30203452 } else
30213453 if (source == uneditButton)
....@@ -3025,10 +3457,11 @@
30253457 Object3D child = (Object3D)e.nextElement();
30263458 if(child.editWindow != null)
30273459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
30283461 child.CloseUI();
30293462 listUI.remove(child);
30303463
3031
- child.editWindow = null; // ???????????
3464
+ //child.editWindow = null; // ???????????
30323465 }
30333466 objEditor.ctrlPanel.FlushUI();
30343467 //objEditor.jTree.clearSelection();
....@@ -3041,6 +3474,7 @@
30413474 //copy.ClearUI();
30423475 for (Object3D obj : listUI)
30433476 {
3477
+ obj.pinned = false;
30443478 obj.CloseUI();
30453479 }
30463480 listUI.clear();
....@@ -3050,7 +3484,7 @@
30503484 {
30513485 assert(copy == group);
30523486
3053
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30543488
30553489 for (Object3D obj : listUI)
30563490 {
....@@ -3099,6 +3533,9 @@
30993533 }
31003534
31013535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
31023539 //Globals.theRenderer.object = group;
31033540 if(!useclient)
31043541 {
....@@ -3115,7 +3552,9 @@
31153552 sideView.object = group;
31163553 }
31173554
3118
-// fix "+" issue group.editWindow = this;
3555
+// fix "+" issue
3556
+ //group.editWindow = this;
3557
+ group.manipWindow = this;
31193558
31203559 /*
31213560 currentLayout = radio.layout;
....@@ -3123,18 +3562,27 @@
31233562 currentLayout = sevenButton;
31243563 */
31253564 radio.layout.doClick();
3565
+
3566
+ ClearUnpinned();
3567
+ //Grafreed.Assert(group != null);
3568
+ //Grafreed.Assert(group.selection != null);
3569
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3570
+ if (group.selection == null || group.selection.size() == 1)
3571
+ EditSelection(false);
31263572 keepparent = group.parent;
31273573 // PARENT = NULL or not???
31283574 //group.parent = null; // ROOT
31293575 //group.attributes = -1;
31303576 ResetModel();
3577
+
3578
+ cameraView.requestFocusInWindow();
31313579 refreshContents(true);
31323580 } else if (event.getSource() == editCameraItem)
31333581 {
31343582 cameraView.ProtectCamera();
31353583 cameraView.repaint();
31363584 return;
3137
- } else if (event.getSource() == revertCameraItem)
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31383586 {
31393587 cameraView.RevertCamera();
31403588 cameraView.repaint();
....@@ -3151,7 +3599,6 @@
31513599 }
31523600
31533601 boolean useclient = false;
3154
- cRadio radio;
31553602
31563603 void ToggleRoot()
31573604 {
....@@ -3390,7 +3837,8 @@
33903837
33913838 int size = obj.MemorySize();
33923839
3393
- System.err.println((size/1024) + " KB is the size of " + obj);
3840
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3841
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33943842 }
33953843 }
33963844 catch (Exception e)
....@@ -3471,6 +3919,13 @@
34713919 void GenNormals(boolean crease)
34723920 {
34733921 group.GenNormalsS(crease);
3922
+
3923
+ refreshContents();
3924
+ }
3925
+
3926
+ void GenNormalsMESH()
3927
+ {
3928
+ group.GenNormalsMeshS();
34743929
34753930 refreshContents();
34763931 }
....@@ -4098,6 +4553,18 @@
40984553 refreshContents();
40994554 }
41004555
4556
+ void RewindLeaves(boolean hide)
4557
+ {
4558
+ group.selection.RewindLeaves(hide);
4559
+ refreshContents();
4560
+ }
4561
+
4562
+ void RandomLeaves(boolean hide)
4563
+ {
4564
+ group.selection.RandomLeaves(hide);
4565
+ refreshContents();
4566
+ }
4567
+
41014568 void SetTexRes(int tr)
41024569 {
41034570 group.selection.SetTexRes(tr);
....@@ -4169,28 +4636,25 @@
41694636 // }
41704637 // }
41714638
4172
- static boolean allparams = true;
4173
-
4174
- static Vector<Object3D> listUI = new Vector<Object3D>();
4175
-
41764639 void EditSelection(boolean newWindow)
41774640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
41784647 // aConstraints.gridy = 0;
41794648 for (int i=0; i<group.selection.size(); i++)
41804649 {
41814650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41824651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41844653
41854654 Object3D elem = (Object3D)group.selection.elementAt(i);
41864655 if(elem != group || !newWindow)
41874656 {
4188
- // if (!(elem instanceof Composite))
4189
- // newWindow = false;
4190
- listUI.add(elem);
4191
- elem.openEditWindow(this, newWindow); //, false);
4192
- System.out.println("edit : " + elem);
4193
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
41944658 }
41954659 }
41964660 }
....@@ -4265,7 +4729,8 @@
42654729 //new Exception().printStackTrace();
42664730
42674731 freezemodel = true;
4268
-
4732
+ ClearUnpinned();
4733
+
42694734 /**/
42704735 //switch (event.id)
42714736 {
....@@ -4273,7 +4738,6 @@
42734738 //case 702: // Event.LIST_DESELECT
42744739 group.deselectAll();
42754740 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774741 if (tps != null)
42784742 {
42794743 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4746,8 @@
42824746
42834747 //if (child.parent != null)
42844748 //child.parent.addSelectee(child);
4749
+ objEditor.SetMaterial(child);
42854750 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894751 }
42904752 }
42914753 // else
....@@ -4295,20 +4757,28 @@
42954757 // System.err.println("info : " + group.GetPath());
42964758 // }
42974759
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4760
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014761 CameraPane.flash = true;
43024762
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4763
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044764 // a camera
43054765 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4767
+ {
4768
+ CameraPane.camerachangeframe = 0; // don't refuse it
4769
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4770
+ }
43084771 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094772 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104773 }
43114774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
43124782 refreshContents();
43134783 //return true;
43144784 }
....@@ -4317,6 +4787,35 @@
43174787
43184788 freezemodel = false;
43194789 }
4790
+
4791
+ void SetPinStates(boolean enabled)
4792
+ {
4793
+ editButton.setEnabled(enabled);
4794
+ uneditButton.setEnabled(enabled);
4795
+ unselectButton.setEnabled(enabled);
4796
+ flashSelectionButton.setEnabled(enabled);
4797
+ }
4798
+
4799
+ void refreshContents(boolean cp)
4800
+ {
4801
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4803
+ {
4804
+ objEditor.ClearInfo(); // .GetMaterial());
4805
+
4806
+ for (int i=0; i < group.selection.Size(); i++)
4807
+ {
4808
+ Object3D child = (Object3D) group.selection.get(i);
4809
+
4810
+ objEditor.AddInfo(child, this, true);
4811
+ System.err.println("info : " + child.GetPath());
4812
+ }
4813
+
4814
+ objEditor.SetText(); // jan 2014
4815
+ }
4816
+
4817
+ super.refreshContents(cp);
4818
+ }
43204819
43214820 void linkSomething(Object3D thing)
43224821 {
....@@ -4388,6 +4887,7 @@
43884887 {
43894888 if (group.selection.isEmpty())
43904889 return;
4890
+
43914891 Grafreed.clipboardIsTempGroup = false;
43924892 Composite tGroup = null;
43934893 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4898,8 @@
43984898
43994899 if (cut)
44004900 {
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
44014903 //int indices[] = jList.getSelectedIndices();
44024904 //for (int i = indices.length - 1; i >= 0; i--)
44034905 //jList.remove(indices[i]);
....@@ -4487,8 +4989,10 @@
44874989 }
44884990
44894991 }
4992
+
44904993 if (Grafreed.clipboardIsTempGroup)
44914994 Grafreed.clipboard = tGroup;
4995
+
44924996 if (cut)
44934997 {
44944998 ResetModel();
....@@ -4498,6 +5002,10 @@
44985002
44995003 void paste(boolean expand)
45005004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
45015009 // if (GrafreeD.clipboard == null)
45025010 // return;
45035011 boolean first = true;
....@@ -4557,6 +5065,7 @@
45575065 Grafreed.clipboard.get(0).parent = keepparent;
45585066 }
45595067
5068
+ Globals.REPLACEONMAKE = keep;
45605069 ResetModel();
45615070 refreshContents();
45625071 }
....@@ -4692,6 +5201,10 @@
46925201
46935202 void group(Object3D csg, boolean grab)
46945203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
46955208 if (//false) // why??
46965209 !group.selection.isEmpty())
46975210 {
....@@ -4805,10 +5318,15 @@
48055318 //node.add(csg);
48065319 //makeSomething(node);
48075320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
48085322 }
48095323
48105324 void Ungroup(Object3D g)
48115325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
48125330 if (g instanceof HiddenObject)
48135331 {
48145332 HiddenObject h = (HiddenObject) g;
....@@ -4825,6 +5343,7 @@
48255343 objEditor.makeSomething(g.get(i), false);
48265344 }
48275345 }
5346
+ Globals.REPLACEONMAKE = keep;
48285347 }
48295348
48305349 void ungroup()
....@@ -5113,7 +5632,28 @@
51135632 cButton clearpanelButton;
51145633 cButton unselectButton;
51155634
5635
+ cButton restoreCameraButton;
5636
+
5637
+ cButton saveButton;
51165638 cButton oneStepButton;
5639
+
5640
+ cButton groupButton;
5641
+ cButton ungroupButton;
5642
+ cButton compositeButton;
5643
+ cButton switchButton;
5644
+ cButton loopButton;
5645
+ cButton textureButton;
5646
+
5647
+ cButton gridButton;
5648
+ cButton boxButton;
5649
+ cButton sphereButton;
5650
+ cButton coneButton;
5651
+ cButton torusButton;
5652
+ cButton superButton;
5653
+ cButton kleinButton;
5654
+ cButton particlesButton;
5655
+ cButton overlayButton;
5656
+ cButton lightButton;
51175657
51185658 cButton screenfitButton;
51195659 cButton screenfitpointButton;
....@@ -5126,14 +5666,6 @@
51265666
51275667 cButton setsupportButton;
51285668
5129
- cButton twoButton;
5130
- cButton sixButton;
5131
- cButton threeButton;
5132
- cButton sevenButton;
5133
- cButton fourButton; // full panel
5134
- cButton oneButton; // full XYZ
5135
- //cButton currentLayout;
5136
-
51375669 //
51385670 //Composite
51395671 Object3D // to do !!
....@@ -5143,9 +5675,11 @@
51435675 //JTree jTree;
51445676 private MenuItem lookAtItem;
51455677 private MenuItem lookFromItem;
5146
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
51475679 private MenuItem cutItem;
5148
- private MenuItem duplicateItem;
5680
+ private MenuItem undoItem;
5681
+ private MenuItem redoItem;
5682
+ private JMenuItem duplicateItem;
51495683 private MenuItem cloneItem;
51505684 private MenuItem cloneSupportItem;
51515685 private MenuItem overwriteGeoItem;
....@@ -5173,7 +5707,7 @@
51735707 private MenuItem pasteLinkItem;
51745708 private MenuItem pasteCloneItem;
51755709 private MenuItem pasteExpandItem;
5176
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
51775711 private MenuItem clearAllItem;
51785712 private MenuItem genUVItem;
51795713 private MenuItem genNormalsMESHItem;
....@@ -5208,6 +5742,10 @@
52085742 private MenuItem showleavesItem;
52095743 private MenuItem markleavesItem;
52105744 private MenuItem unmarkleavesItem;
5745
+ private MenuItem rewindleavesItem;
5746
+ private MenuItem unrewindleavesItem;
5747
+ private MenuItem randomleavesItem;
5748
+ private MenuItem unrandomleavesItem;
52115749
52125750 private MenuItem flipVItem;
52135751 private MenuItem unflipVItem;
....@@ -5229,7 +5767,7 @@
52295767 private MenuItem frontItem;
52305768 private MenuItem cameraItem;
52315769 private MenuItem compositeItem;
5232
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
52335771 private MenuItem physicsItem;
52345772 private MenuItem frameselectorItem;
52355773 private MenuItem scriptNodeItem;
....@@ -5303,5 +5841,5 @@
53035841
53045842 Menu cameraMenu;
53055843 MenuItem editCameraItem;
5306
- MenuItem revertCameraItem;
5844
+ MenuItem restoreCameraItem;
53075845 }