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,6 +167,8 @@
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"));
....@@ -160,7 +179,7 @@
160179 // redoItem = menu.add(new MenuItem("Redo"));
161180 // redoItem.addActionListener(this);
162181 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164183 duplicateItem.addActionListener(this);
165184 cloneItem = menu.add(new MenuItem("Clone"));
166185 cloneItem.addActionListener(this);
....@@ -176,7 +195,6 @@
176195 copyItem.addActionListener(this);
177196 pasteItem = menu.add(new MenuItem("Paste"));
178197 pasteItem.addActionListener(this);
179
- menu.add("-");
180198
181199 menu.add("-");
182200 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -188,8 +206,8 @@
188206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
189207 // pasteExpandItem.addActionListener(this);
190208 menu.add("-");
191
- clearItem = menu.add(new MenuItem("Clear"));
192
- clearItem.addActionListener(this);
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
193211
194212 if (Globals.ADVANCED)
195213 {
....@@ -203,23 +221,23 @@
203221 //zBufferItem.addActionListener(this);
204222 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205223 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
208226
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- 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);
213239
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"));
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223241 toggleHandleItem.addItemListener(this);
224242 toggleHandleItem.setState(CameraPane.HANDLES);
225243
....@@ -246,7 +264,7 @@
246264
247265 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248266 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
267
+ toggleDebugItem.setState(Globals.DEBUG);
250268
251269 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252270 toggleFrustumItem.addItemListener(this);
....@@ -274,7 +292,7 @@
274292 {
275293 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276294 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278296 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279297 oe.cameraMenu.add("-");
280298 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +300,7 @@
282300 editLeafItem.addActionListener(this);
283301 lookAtItem.addActionListener(this);
284302 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
303
+ //switchViewItem.addActionListener(this);
286304 }
287305
288306 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +345,29 @@
327345 }
328346
329347 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
332350 backItem = menu.add(new MenuItem("Back"));
333351 backItem.addActionListener(this);
334352 frontItem = menu.add(new MenuItem("Front"));
335353 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
338359 hideItem = menu.add(new MenuItem("Hidden Group"));
339360 hideItem.addActionListener(this);
361
+ }
340362 ungroupItem = menu.add(new MenuItem("Ungroup"));
341363 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- 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
+ {
345371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346372 switchGeoItem.addActionListener(this);
347373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +375,6 @@
349375 morphItem = menu.add(new MenuItem("Morph Group"));
350376 morphItem.addActionListener(this);
351377
352
- if (Globals.ADVANCED)
353
- {
354378 menu.add("-");
355379 physicsItem = menu.add(new MenuItem("Physics"));
356380 physicsItem.addActionListener(this);
....@@ -358,30 +382,29 @@
358382 frameselectorItem.addActionListener(this);
359383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360384 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363385 }
364386
365387 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
368390 billboardItem = menu.add(new MenuItem("Billboard"));
369391 billboardItem.addActionListener(this);
370392 csgItem = menu.add(new MenuItem("CSG"));
371393 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373395 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375397 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
378403 if (Globals.ADVANCED)
379404 {
380405 menu.add("-");
381406 linkerItem = menu.add(new MenuItem("Linker"));
382407 linkerItem.addActionListener(this);
383
- attributeItem = menu.add(new MenuItem("Attribute"));
384
- attributeItem.addActionListener(this);
385408 templateItem = menu.add(new MenuItem("Template"));
386409 templateItem.addActionListener(this);
387410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -410,7 +433,7 @@
410433 genNormalsMESHItem.addActionListener(this);
411434 if (Globals.ADVANCED)
412435 {
413
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
414437 genNormalsMINEItem.addActionListener(this);
415438 }
416439 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -470,6 +493,14 @@
470493 markleavesItem.addActionListener(this);
471494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472495 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);
473504 menu.add("-");
474505 flipVItem = menu.add(new MenuItem("Flip V"));
475506 flipVItem.addActionListener(this);
....@@ -525,8 +556,21 @@
525556 buildToolsMenu(menu);
526557 }
527558
559
+
528560 void SetupUI2(ObjEditor oe)
529561 {
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
+
530574 //new Exception().printStackTrace();
531575
532576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -555,39 +599,79 @@
555599 oe.radioPanel.add(dummyButton);
556600 oe.buttonGroup.add(dummyButton);
557601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
558606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559607
560
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- undoButton.setToolTipText("Undo changes");
562
- undoButton.addActionListener(this);
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
563611
564
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- redoButton.setToolTipText("Redo changes");
566
- redoButton.addActionListener(this);
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
+ }
567618
568
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
- saveButton.setToolTipText("Save changes");
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");
570633 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);
571639
572
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
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);
573659 liveCB.setToolTipText("Enable animation");
574660 liveCB.addItemListener(this);
575661
576
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577663 oneStepButton.setToolTipText("Animate one step forward");
578664 oneStepButton.addActionListener(this);
579665
580
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
581667 fastCB.setToolTipText("Fast mode");
582668 fastCB.addItemListener(this);
583669
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);
589
- screenfitButton.setToolTipText("Screen fit");
590
- 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);
591675
592676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
593677 // screenfitpointButton.addActionListener(this);
....@@ -599,65 +683,146 @@
599683 snapobjectButton.setToolTipText("Snap Object");
600684 }
601685
602
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- flashSelectionButton.setToolTipText("Show selection");
604
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
605687
606
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
607
-
608
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
- twoButton.setToolTipText("Show center view only");
610
- twoButton.addActionListener(this);
611
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612689 fourButton.addActionListener(this);
613690 fourButton.setToolTipText("Show left panel only");
614
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
- 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");
616699 sixButton.addActionListener(this);
617
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618
- threeButton.setToolTipText("2-column layout right");
619
- threeButton.addActionListener(this);
620
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
- sevenButton.setToolTipText("3-column layout");
622
- 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);
623706 //
624707
625
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
- 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");
627710 rootButton.addActionListener(this);
628711
629
- 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);
630713 closeButton.setToolTipText("Close tab");
631714 closeButton.addActionListener(this);
632715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
633716 //clearButton.addActionListener(this);
634
-
635
- 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
+ }
636749
637
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
- 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");
639799 editButton.addActionListener(this);
640800
641
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
- uneditButton.setToolTipText("Unedit selection");
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
643803 uneditButton.addActionListener(this);
644804
645
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
646
- allParamsButton.setToolTipText("Edit all params");
805
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
806
+ allParamsButton.setToolTipText("Show all controle");
647807 allParamsButton.addActionListener(this);
648808
649
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650810 clearPanelButton.setToolTipText("Clear edit panel");
651811 clearPanelButton.addActionListener(this);
652812
653
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654814 unselectButton.setToolTipText("Unselect");
655815 unselectButton.addActionListener(this);
656816
657
- 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);
658820
659
- oe.treePanel.add(commandsPanel);
660
- oe.treePanel.Return();
821
+ editCommandsPanel.preferredHeight = 1;
822
+
823
+ SetPinStates(false);
824
+// oe.treePanel.add(commandsPanel);
825
+// oe.treePanel.Return();
661826
662827 // oe.aConstraints.gridx += 1;
663828 // oe.aConstraints.weighty = 0;
....@@ -674,29 +839,17 @@
674839
675840 JScrollPane jSP;
676841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
677
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
678843 ResetModel();
679844
680845 oe.treePanel.add(jSPPanel);
681846 oe.treePanel.Return();
682847
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;
698848 oe.treePanel.add(copyOptionsPanel);
699849 oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
700853
701854 // mainPanel.setDividerLocation(0.5); //1.0);
702855 // mainPanel.setResizeWeight(0.5);
....@@ -719,29 +872,49 @@
719872 dgr.addDragGestureListener(this);
720873 }catch(Exception e) {}
721874 */
722
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
723876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
724877 }
725878
726879 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
727880 {
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
+
728895 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
729896 boxCB.setToolTipText("Display bounding boxes");
730897 boxCB.addItemListener(this);
731898
732899 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
733
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
734901 zoomBoxCB.addItemListener(this);
735902
736903 if (true) // Globals.ADVANCED)
737904 {
738
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
739
- supportCB.setToolTipText("Enable rigging");
740
- 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);
741912
742913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
743914 // localCB.addItemListener(this);
744915
916
+ panel.Return();
917
+
745918 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
746919 crowdCB.setToolTipText("Used for crowds");
747920 crowdCB.addItemListener(this);
....@@ -758,6 +931,8 @@
758931 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
759932 // speakerMocapCB.addItemListener(this);
760933
934
+ panel.Return();
935
+
761936 if (false)
762937 {
763938 // handled in scripts
....@@ -772,34 +947,74 @@
772947 //constraints.gridy += 1;
773948 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
774949 smoothfocusCB.addItemListener(this);
950
+ panel.Return();
775951 }
776952
777953 //constraints.gridx += 1;
778954 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
779955 // debugCB.addItemListener(this);
780956
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
781961 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
962
+ oeilCB.setToolTipText("Move camera when tracking");
782963 oeilCB.addItemListener(this);
783964
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
+ {
784985 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
785986 lookAtCB.setToolTipText("Look-at target");
786987 lookAtCB.addItemListener(this);
988
+ }
787989
788990 }
789991
790992 cGridBag fill = new cGridBag();
791
-
792993 fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
793998
794999 panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
7951002
7961003 }
7971004
7981005 void EditObject(Object3D obj)
7991006 {
8001007 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
+
8011016 radioButton.SetObject(obj);
802
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
8031018 radioButton.SetCamera(cameraView.renderCamera, false);
8041019 radioButton.addActionListener(this);
8051020 radioPanel.add(radioButton);
....@@ -809,6 +1024,8 @@
8091024
8101025 void SetupViews(ObjEditor oe)
8111026 {
1027
+ theFrame = this;
1028
+
8121029 oe.SetupViews();
8131030
8141031 System.out.println("SetupViews");
....@@ -817,23 +1034,28 @@
8171034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8181035 }
8191036
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;
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;
8311050 // JCheckBox speakerMocapCB;
832
- JCheckBox speakerCameraCB;
833
- JCheckBox speakerFocusCB;
834
- JCheckBox debugCB;
835
- JCheckBox oeilCB;
836
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
8371059
8381060 // static int COLOR = 1;
8391061 // static int MATERIAL = 2;
....@@ -841,9 +1063,9 @@
8411063
8421064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8431065
844
- JCheckBox colorCB;
845
- JCheckBox materialCB;
846
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
8471069
8481070 public void itemStateChanged(ItemEvent e)
8491071 {
....@@ -871,6 +1093,7 @@
8711093 } else if(e.getSource() == liveCB)
8721094 {
8731095 cameraView.ToggleLive();
1096
+ refreshContents(false);
8741097 }
8751098 else if(e.getSource() == supportCB)
8761099 {
....@@ -935,6 +1158,18 @@
9351158 {
9361159 cameraView.ToggleOeil();
9371160 }
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
+ }
9381173 else if(e.getSource() == lookAtCB)
9391174 {
9401175 cameraView.ToggleLookAt();
....@@ -951,7 +1186,8 @@
9511186
9521187 /**/
9531188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
954
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
9551191 if ((path == null) || (path.getPathCount() <= 1)) {
9561192 // We can't move the root node or an empty selection
9571193 return;
....@@ -1014,8 +1250,6 @@
10141250 }
10151251 }
10161252
1017
- String string = (String) object;
1018
-
10191253 System.out.println("Transfer = " + object + "; drop : " + target);
10201254 // if( object instanceof java.io.File[])
10211255 // {
....@@ -1023,6 +1257,8 @@
10231257 // objEditor.DropFile((java.io.File[]) object, true);
10241258 // return;
10251259 // }
1260
+
1261
+ String string = object.toString();
10261262
10271263 // File path for Mac and Windows
10281264 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1068,23 +1304,33 @@
10681304
10691305 assert target == objEditor.jTree;
10701306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
10711308 try {
1072
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10731310 } catch (Exception e) {
10741311 System.out.println("destinationPath : " + destinationPath);
10751312 return;
10761313 }
10771314
1078
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
10791316 {
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
+// {
10801326 loadClipboard(true);
10811327 objEditor.jTree.setSelectionPath(destinationPath);
10821328 pasteInto(false, false);
1083
- } else {
1084
- loadClipboard(false);
1085
- objEditor.jTree.setSelectionPath(destinationPath);
1086
- pasteInto(false, false); // true); // ???
1087
- }
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
10881334 }
10891335 public void dropActionChanged(DropTargetDragEvent dtde)
10901336 // Called if the user has modified the current drop gesture
....@@ -1189,22 +1435,30 @@
11891435 {
11901436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11911437 //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);
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
+ {
12041456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12051457 kleinItem.addActionListener(this);
1206
- particleItem = menu.add(new MenuItem("Particle system"));
1207
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
12081462 if (Globals.ADVANCED)
12091463 {
12101464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1230,15 +1484,15 @@
12301484 }
12311485 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12321486 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);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
12371491 menu.add("-");
12381492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12391493 //superLoopItem.addActionListener(this);
1240
- loopItem = menu.add(new MenuItem("Loop"));
1241
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
12421496 doubleItem = menu.add(new MenuItem("Fork"));
12431497 doubleItem.addActionListener(this);
12441498 if (Globals.ADVANCED)
....@@ -1254,6 +1508,9 @@
12541508 animationItem.addItemListener(this);
12551509 animationItem.setState(Globals.ANIMATION);
12561510
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
1513
+
12571514 menu.add("-");
12581515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12591516 parseverticesItem.addActionListener(this);
....@@ -1266,6 +1523,8 @@
12661523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12671524 reduce34MorphItem.addActionListener(this);
12681525 menu.add("-");
1526
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1527
+ memoryItem.addActionListener(this);
12691528 menu.add(computeAOItem = new MenuItem("Compute AO"));
12701529 computeAOItem.addActionListener(this);
12711530
....@@ -1274,11 +1533,9 @@
12741533 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12751534 mirrorItem.addActionListener(this);
12761535 menu.add("-");
1277
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1278
- memoryItem.addActionListener(this);
12791536 menu.add(analyzeItem = new MenuItem("Analyze"));
12801537 analyzeItem.addActionListener(this);
1281
- menu.add(dumpItem = new MenuItem("Dump"));
1538
+ menu.add(dumpItem = new MenuItem("Print"));
12821539 dumpItem.addActionListener(this);
12831540 // menu.add(pathItem = new MenuItem("From-to path"));
12841541 // pathItem.addActionListener(this);
....@@ -1419,9 +1676,34 @@
14191676 shadow.material = new cMaterial(obj.material);
14201677 shadow.material.diffuse = 0.0001f;
14211678 shadow.material.specular = 0.0001f;
1679
+ //shadow.projectedVertices[1].x = 300;
14221680
14231681 makeSomething(shadow);
14241682 }
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
+ }
14251707
14261708 /**
14271709 * applyExample
....@@ -1666,7 +1948,7 @@
16661948 {
16671949 ScreenFit();
16681950 } else
1669
- if (source == switchItem)
1951
+ if (source == switchViewItem)
16701952 {
16711953 cVector v1 = new cVector();
16721954 cVector v2 = new cVector();
....@@ -1675,11 +1957,11 @@
16751957 objEditor.cameraView.renderCamera.setAim(v2, v1);
16761958 objEditor.cameraView.repaint();
16771959 } else
1678
- if (source == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
16791961 {
16801962 makeSomething(new Box());
16811963 } else
1682
- if (source == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
16831965 {
16841966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16851967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1758,27 +2040,27 @@
17582040
17592041 makeSomething(obj);
17602042 } else
1761
- if (source == gridItem)
2043
+ if (source == gridItem || source == gridButton)
17622044 {
17632045 makeSomething(new Grid());
17642046 } else
1765
- if (source == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
17662048 {
17672049 makeSomething(new Sphere());
17682050 } else
1769
- if (source == coneItem)
2051
+ if (source == coneItem || source == coneButton)
17702052 {
17712053 makeSomething(new Cone());
17722054 } else
1773
- if (source == torusItem)
2055
+ if (source == torusItem || source == torusButton)
17742056 {
17752057 makeSomething(new Torus());
17762058 } else
1777
- if (source == superItem)
2059
+ if (source == superItem || source == superButton)
17782060 {
17792061 makeSomething(new Superellipsoid());
17802062 } else
1781
- if (source == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
17822064 {
17832065 makeSomething(new Klein());
17842066 } else
....@@ -1798,7 +2080,7 @@
17982080 {
17992081 makeSomething(new BezierSurface());
18002082 } else
1801
- if (source == overlayItem)
2083
+ if (source == overlayItem || source == overlayButton)
18022084 {
18032085 /*
18042086 Object3D obj = new BezierSurface(5,8);
....@@ -1846,7 +2128,7 @@
18462128 s.setup();
18472129 makeSomething(s);
18482130 } else
1849
- if (source == lightItem)
2131
+ if (source == lightItem || source == lightButton)
18502132 {
18512133 makeSomething(new Light());
18522134 } else
....@@ -1896,30 +2178,30 @@
18962178
18972179 group(g);
18982180 } else
1899
- if (source == loopItem)
2181
+ if (source == loopItem || source == loopButton)
19002182 {
19012183 Composite csg = new GroupLeaf();
19022184 csg.count = 5;
19032185 group(csg);
1904
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
19052187 csg.addChild(child);
19062188 child.addChild(csg);
19072189 } else
19082190 if (source == doubleItem)
19092191 {
1910
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
19112193 csg.count = 5;
19122194 group(csg);
1913
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
19142196 csg.addChild(child);
19152197 child.addChild(csg);
1916
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
19172199 csg.addChild(child);
19182200 child.addChild(csg);
19192201 } else
19202202 if (source == tripleItem)
19212203 {
1922
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
19232205 csg.count = 4;
19242206 group(csg);
19252207 Composite child = new cGroup();
....@@ -1969,17 +2251,45 @@
19692251 {
19702252 DumpObject();
19712253 } 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
19722266 if (source == undoButton)
19732267 {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
19742271 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();
19752282 } else
19762283 if (source == redoButton)
19772284 {
2285
+ // Go to next version
19782286 Redo();
19792287 } else
19802288 if (source == saveButton)
19812289 {
1982
- Save();
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
19832293 } else
19842294 if (source == oneStepButton)
19852295 {
....@@ -1988,17 +2298,14 @@
19882298 } else
19892299 if (source == screenfitButton)
19902300 {
1991
- //Reload(lastConverter, lastFilename, true);
19922301 ScreenFit();
19932302 } else
19942303 if (source == screenfitpointButton)
19952304 {
1996
- //Reload(lastConverter, lastFilename, true);
19972305 ScreenFitPoint();
19982306 } else
19992307 if (source == snapobjectButton)
20002308 {
2001
- //Reload(lastConverter, lastFilename, true);
20022309 SnapObject();
20032310 } else
20042311 // if (event.getSource() == recompileButton)
....@@ -2362,7 +2669,7 @@
23622669 {
23632670 StepAll();
23642671 } else
2365
- if (source == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
23662673 {
23672674 //int indices[] = jList.getSelectedIndices();
23682675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2374,9 +2681,9 @@
23742681 {
23752682 ClearSelection(true);
23762683 } else
2377
- if (source == grabItem)
2684
+ if (source == grabItem || source == groupButton)
23782685 {
2379
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
23802687 } else
23812688 if (source == hideItem)
23822689 {
....@@ -2394,11 +2701,11 @@
23942701 {
23952702 makeSomething(new Camera());
23962703 } else
2397
- if (source == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
23982705 {
23992706 group(new Composite());
24002707 } else
2401
- if (source == randomItem)
2708
+ if (source == switchItem || source == switchButton)
24022709 {
24032710 RandomNode random = new RandomNode();
24042711 group(random);
....@@ -2500,7 +2807,7 @@
25002807 {
25012808 group(new cLinker());
25022809 } else
2503
- if (source == textureItem)
2810
+ if (source == textureItem || source == textureButton)
25042811 {
25052812 group(new TextureNode());
25062813 } else
....@@ -2520,17 +2827,30 @@
25202827 {
25212828 CastShadow(2);
25222829 } else
2523
- if (source == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
25242831 {
2525
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
25262834 for (int i=0; i<group.selection.size(); i++)
25272835 {
2528
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
25292841 }
25302842
2531
- ClearSelection(false);
2532
-
2533
- 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
+ }
25342854 } else
25352855 if (source == genUVItem)
25362856 {
....@@ -2542,7 +2862,7 @@
25422862 } else
25432863 if (source == genNormalsMESHItem)
25442864 {
2545
- GenNormals(true); // TODO
2865
+ GenNormalsMESH();
25462866 } else
25472867 if (source == genNormalsORGANItem)
25482868 {
....@@ -2607,6 +2927,22 @@
26072927 if (source == unmarkleavesItem)
26082928 {
26092929 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);
26102946 } else
26112947 if (source == flipVItem)
26122948 {
....@@ -2842,6 +3178,10 @@
28423178 if (source == twoButton)
28433179 {
28443180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
28453185 // bug
28463186 //gridPanel.setDividerLocation(1.0);
28473187 //bigPanel.setDividerLocation(0.0);
....@@ -2874,10 +3214,31 @@
28743214 bigThree.ClearUI();
28753215 bigThree.add(centralPanel);
28763216 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
+
28773235 } else
28783236 if (source == threeButton)
28793237 {
28803238 radio.layout = threeButton;
3239
+
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
28813242
28823243 // bigThree.remove(scenePanel);
28833244 // bigThree.remove(centralPanel);
....@@ -2910,10 +3271,15 @@
29103271 bigThree.add(centralPanel);
29113272 bigThree.add(XYZPanel);
29123273 bigThree.FlushUI();
3274
+
3275
+ cameraView.requestFocusInWindow();
29133276 } else
29143277 if (source == fourButton)
29153278 {
29163279 radio.layout = fourButton;
3280
+
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
29173283
29183284 // bigThree.remove(scenePanel);
29193285 // bigThree.remove(centralPanel);
....@@ -2945,10 +3311,15 @@
29453311 bigThree.ClearUI();
29463312 bigThree.add(scenePanel);
29473313 bigThree.FlushUI();
3314
+
3315
+ cameraView.requestFocusInWindow();
29483316 } else
29493317 if (source == sixButton)
29503318 {
29513319 radio.layout = sixButton;
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
29523323
29533324 // bigThree.remove(scenePanel);
29543325 // bigThree.remove(centralPanel);
....@@ -2981,10 +3352,15 @@
29813352 bigThree.add(scenePanel);
29823353 bigThree.add(centralPanel);
29833354 bigThree.FlushUI();
3355
+
3356
+ cameraView.requestFocusInWindow();
29843357 } else
29853358 if (source == sevenButton)
29863359 {
29873360 radio.layout = sevenButton;
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
29883364
29893365 // bigThree.remove(scenePanel);
29903366 // bigThree.remove(centralPanel);
....@@ -3018,6 +3394,8 @@
30183394 bigThree.add(centralPanel);
30193395 bigThree.add(XYZPanel);
30203396 bigThree.FlushUI();
3397
+
3398
+ cameraView.requestFocusInWindow();
30213399 } else
30223400 if (source == rootButton)
30233401 {
....@@ -3029,6 +3407,7 @@
30293407 EditObject(obj);
30303408 }
30313409
3410
+ cameraView.requestFocusInWindow();
30323411 refreshContents(true);
30333412 } else
30343413 if (source == closeButton)
....@@ -3038,22 +3417,37 @@
30383417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30393418 {
30403419 ab = (cRadio)e.nextElement();
3041
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30423421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
30433428 buttonGroup.remove(ab);
30443429 radioPanel.remove(ab);
30453430
3046
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
30473433 // ab.GetObject().objectUI = null; // ?????????
30483434
30493435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30503436 break;
30513437 }
30523438 }
3439
+
3440
+ cameraView.requestFocusInWindow();
30533441 refreshContents(true);
30543442 } else
30553443 if (source == editItem || source == editButton)
30563444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
30573451 EditSelection(false);
30583452 } else
30593453 if (source == uneditButton)
....@@ -3063,6 +3457,7 @@
30633457 Object3D child = (Object3D)e.nextElement();
30643458 if(child.editWindow != null)
30653459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
30663461 child.CloseUI();
30673462 listUI.remove(child);
30683463
....@@ -3079,6 +3474,7 @@
30793474 //copy.ClearUI();
30803475 for (Object3D obj : listUI)
30813476 {
3477
+ obj.pinned = false;
30823478 obj.CloseUI();
30833479 }
30843480 listUI.clear();
....@@ -3088,7 +3484,7 @@
30883484 {
30893485 assert(copy == group);
30903486
3091
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30923488
30933489 for (Object3D obj : listUI)
30943490 {
....@@ -3137,6 +3533,9 @@
31373533 }
31383534
31393535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
31403539 //Globals.theRenderer.object = group;
31413540 if(!useclient)
31423541 {
....@@ -3154,7 +3553,8 @@
31543553 }
31553554
31563555 // fix "+" issue
3157
- group.editWindow = this;
3556
+ //group.editWindow = this;
3557
+ group.manipWindow = this;
31583558
31593559 /*
31603560 currentLayout = radio.layout;
....@@ -3162,18 +3562,27 @@
31623562 currentLayout = sevenButton;
31633563 */
31643564 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);
31653572 keepparent = group.parent;
31663573 // PARENT = NULL or not???
31673574 //group.parent = null; // ROOT
31683575 //group.attributes = -1;
31693576 ResetModel();
3577
+
3578
+ cameraView.requestFocusInWindow();
31703579 refreshContents(true);
31713580 } else if (event.getSource() == editCameraItem)
31723581 {
31733582 cameraView.ProtectCamera();
31743583 cameraView.repaint();
31753584 return;
3176
- } else if (event.getSource() == revertCameraItem)
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31773586 {
31783587 cameraView.RevertCamera();
31793588 cameraView.repaint();
....@@ -3190,7 +3599,6 @@
31903599 }
31913600
31923601 boolean useclient = false;
3193
- cRadio radio;
31943602
31953603 void ToggleRoot()
31963604 {
....@@ -3429,7 +3837,8 @@
34293837
34303838 int size = obj.MemorySize();
34313839
3432
- 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)");
34333842 }
34343843 }
34353844 catch (Exception e)
....@@ -3510,6 +3919,13 @@
35103919 void GenNormals(boolean crease)
35113920 {
35123921 group.GenNormalsS(crease);
3922
+
3923
+ refreshContents();
3924
+ }
3925
+
3926
+ void GenNormalsMESH()
3927
+ {
3928
+ group.GenNormalsMeshS();
35133929
35143930 refreshContents();
35153931 }
....@@ -4137,6 +4553,18 @@
41374553 refreshContents();
41384554 }
41394555
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
+
41404568 void SetTexRes(int tr)
41414569 {
41424570 group.selection.SetTexRes(tr);
....@@ -4208,28 +4636,25 @@
42084636 // }
42094637 // }
42104638
4211
- static boolean allparams = true;
4212
-
4213
- static Vector<Object3D> listUI = new Vector<Object3D>();
4214
-
42154639 void EditSelection(boolean newWindow)
42164640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
42174647 // aConstraints.gridy = 0;
42184648 for (int i=0; i<group.selection.size(); i++)
42194649 {
42204650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42214651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4222
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42234653
42244654 Object3D elem = (Object3D)group.selection.elementAt(i);
42254655 if(elem != group || !newWindow)
42264656 {
4227
- // if (!(elem instanceof Composite))
4228
- // newWindow = false;
4229
- listUI.add(elem);
4230
- elem.openEditWindow(this, newWindow); //, false);
4231
- System.out.println("edit : " + elem);
4232
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
42334658 }
42344659 }
42354660 }
....@@ -4304,7 +4729,8 @@
43044729 //new Exception().printStackTrace();
43054730
43064731 freezemodel = true;
4307
-
4732
+ ClearUnpinned();
4733
+
43084734 /**/
43094735 //switch (event.id)
43104736 {
....@@ -4312,7 +4738,6 @@
43124738 //case 702: // Event.LIST_DESELECT
43134739 group.deselectAll();
43144740 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4315
- objEditor.ClearInfo(); // .GetMaterial());
43164741 if (tps != null)
43174742 {
43184743 for (int i=0; i < tps.length; i++)
....@@ -4321,10 +4746,8 @@
43214746
43224747 //if (child.parent != null)
43234748 //child.parent.addSelectee(child);
4749
+ objEditor.SetMaterial(child);
43244750 group.addSelectee(child);
4325
- objEditor.SetMaterial(child); // .GetMaterial());
4326
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4327
- System.err.println("info : " + child.GetPath());
43284751 }
43294752 }
43304753 // else
....@@ -4334,15 +4757,13 @@
43344757 // System.err.println("info : " + group.GetPath());
43354758 // }
43364759
4337
- objEditor.SetText(); // jan 2014
4338
-
43394760 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43404761 CameraPane.flash = true;
43414762
43424763 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43434764 // a camera
43444765 {
4345
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43464767 {
43474768 CameraPane.camerachangeframe = 0; // don't refuse it
43484769 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4351,6 +4772,13 @@
43514772 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43524773 }
43534774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
43544782 refreshContents();
43554783 //return true;
43564784 }
....@@ -4359,6 +4787,35 @@
43594787
43604788 freezemodel = false;
43614789 }
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
+ }
43624819
43634820 void linkSomething(Object3D thing)
43644821 {
....@@ -4441,7 +4898,8 @@
44414898
44424899 if (cut)
44434900 {
4444
- Save();
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
44454903 //int indices[] = jList.getSelectedIndices();
44464904 //for (int i = indices.length - 1; i >= 0; i--)
44474905 //jList.remove(indices[i]);
....@@ -4544,6 +5002,10 @@
45445002
45455003 void paste(boolean expand)
45465004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
45475009 // if (GrafreeD.clipboard == null)
45485010 // return;
45495011 boolean first = true;
....@@ -4603,6 +5065,7 @@
46035065 Grafreed.clipboard.get(0).parent = keepparent;
46045066 }
46055067
5068
+ Globals.REPLACEONMAKE = keep;
46065069 ResetModel();
46075070 refreshContents();
46085071 }
....@@ -4738,6 +5201,10 @@
47385201
47395202 void group(Object3D csg, boolean grab)
47405203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
47415208 if (//false) // why??
47425209 !group.selection.isEmpty())
47435210 {
....@@ -4851,10 +5318,15 @@
48515318 //node.add(csg);
48525319 //makeSomething(node);
48535320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
48545322 }
48555323
48565324 void Ungroup(Object3D g)
48575325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
48585330 if (g instanceof HiddenObject)
48595331 {
48605332 HiddenObject h = (HiddenObject) g;
....@@ -4871,6 +5343,7 @@
48715343 objEditor.makeSomething(g.get(i), false);
48725344 }
48735345 }
5346
+ Globals.REPLACEONMAKE = keep;
48745347 }
48755348
48765349 void ungroup()
....@@ -5159,10 +5632,28 @@
51595632 cButton clearpanelButton;
51605633 cButton unselectButton;
51615634
5635
+ cButton restoreCameraButton;
5636
+
51625637 cButton saveButton;
5163
- cButton undoButton;
5164
- cButton redoButton;
51655638 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;
51665657
51675658 cButton screenfitButton;
51685659 cButton screenfitpointButton;
....@@ -5175,14 +5666,6 @@
51755666
51765667 cButton setsupportButton;
51775668
5178
- cButton twoButton;
5179
- cButton sixButton;
5180
- cButton threeButton;
5181
- cButton sevenButton;
5182
- cButton fourButton; // full panel
5183
- cButton oneButton; // full XYZ
5184
- //cButton currentLayout;
5185
-
51865669 //
51875670 //Composite
51885671 Object3D // to do !!
....@@ -5192,11 +5675,11 @@
51925675 //JTree jTree;
51935676 private MenuItem lookAtItem;
51945677 private MenuItem lookFromItem;
5195
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
51965679 private MenuItem cutItem;
51975680 private MenuItem undoItem;
51985681 private MenuItem redoItem;
5199
- private MenuItem duplicateItem;
5682
+ private JMenuItem duplicateItem;
52005683 private MenuItem cloneItem;
52015684 private MenuItem cloneSupportItem;
52025685 private MenuItem overwriteGeoItem;
....@@ -5224,7 +5707,7 @@
52245707 private MenuItem pasteLinkItem;
52255708 private MenuItem pasteCloneItem;
52265709 private MenuItem pasteExpandItem;
5227
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
52285711 private MenuItem clearAllItem;
52295712 private MenuItem genUVItem;
52305713 private MenuItem genNormalsMESHItem;
....@@ -5259,6 +5742,10 @@
52595742 private MenuItem showleavesItem;
52605743 private MenuItem markleavesItem;
52615744 private MenuItem unmarkleavesItem;
5745
+ private MenuItem rewindleavesItem;
5746
+ private MenuItem unrewindleavesItem;
5747
+ private MenuItem randomleavesItem;
5748
+ private MenuItem unrandomleavesItem;
52625749
52635750 private MenuItem flipVItem;
52645751 private MenuItem unflipVItem;
....@@ -5280,7 +5767,7 @@
52805767 private MenuItem frontItem;
52815768 private MenuItem cameraItem;
52825769 private MenuItem compositeItem;
5283
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
52845771 private MenuItem physicsItem;
52855772 private MenuItem frameselectorItem;
52865773 private MenuItem scriptNodeItem;
....@@ -5354,5 +5841,5 @@
53545841
53555842 Menu cameraMenu;
53565843 MenuItem editCameraItem;
5357
- MenuItem revertCameraItem;
5844
+ MenuItem restoreCameraItem;
53585845 }