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,16 +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
- undoItem = menu.add(new MenuItem("Undo"));
158
- undoItem.addActionListener(this);
159
- redoItem = menu.add(new MenuItem("Redo"));
160
- redoItem.addActionListener(this);
161
- menu.add("-");
162
- duplicateItem = menu.add(new MenuItem("Duplicate"));
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"));
163183 duplicateItem.addActionListener(this);
164184 cloneItem = menu.add(new MenuItem("Clone"));
165185 cloneItem.addActionListener(this);
....@@ -175,7 +195,6 @@
175195 copyItem.addActionListener(this);
176196 pasteItem = menu.add(new MenuItem("Paste"));
177197 pasteItem.addActionListener(this);
178
- menu.add("-");
179198
180199 menu.add("-");
181200 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -187,8 +206,8 @@
187206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188207 // pasteExpandItem.addActionListener(this);
189208 menu.add("-");
190
- clearItem = menu.add(new MenuItem("Clear"));
191
- clearItem.addActionListener(this);
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
192211
193212 if (Globals.ADVANCED)
194213 {
....@@ -202,23 +221,23 @@
202221 //zBufferItem.addActionListener(this);
203222 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204223 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Camera"));
206
- revertCameraItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
207226
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- 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);
212239
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- toggleSwitchItem.setState(CameraPane.SWITCH);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222241 toggleHandleItem.addItemListener(this);
223242 toggleHandleItem.setState(CameraPane.HANDLES);
224243
....@@ -245,7 +264,7 @@
245264
246265 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247266 toggleDebugItem.addItemListener(this);
248
- toggleDebugItem.setState(CameraPane.DEBUG);
267
+ toggleDebugItem.setState(Globals.DEBUG);
249268
250269 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251270 toggleFrustumItem.addItemListener(this);
....@@ -266,14 +285,14 @@
266285 // animationItem.addItemListener(this);
267286 // animationItem.setState(CameraPane.ANIMATION);
268287 cameraMenu.add("-");
269
- cameraMenu.add(editCameraItem = new MenuItem("Save Camera"));
288
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270289 editCameraItem.addActionListener(this);
271290
272291 if (Globals.ADVANCED)
273292 {
274293 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275294 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277296 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278297 oe.cameraMenu.add("-");
279298 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +300,7 @@
281300 editLeafItem.addActionListener(this);
282301 lookAtItem.addActionListener(this);
283302 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
303
+ //switchViewItem.addActionListener(this);
285304 }
286305
287306 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +345,29 @@
326345 }
327346
328347 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
331350 backItem = menu.add(new MenuItem("Back"));
332351 backItem.addActionListener(this);
333352 frontItem = menu.add(new MenuItem("Front"));
334353 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
337359 hideItem = menu.add(new MenuItem("Hidden Group"));
338360 hideItem.addActionListener(this);
361
+ }
339362 ungroupItem = menu.add(new MenuItem("Ungroup"));
340363 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- 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
+ {
344371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345372 switchGeoItem.addActionListener(this);
346373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +375,6 @@
348375 morphItem = menu.add(new MenuItem("Morph Group"));
349376 morphItem.addActionListener(this);
350377
351
- if (Globals.ADVANCED)
352
- {
353378 menu.add("-");
354379 physicsItem = menu.add(new MenuItem("Physics"));
355380 physicsItem.addActionListener(this);
....@@ -357,30 +382,29 @@
357382 frameselectorItem.addActionListener(this);
358383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359384 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362385 }
363386
364387 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
367390 billboardItem = menu.add(new MenuItem("Billboard"));
368391 billboardItem.addActionListener(this);
369392 csgItem = menu.add(new MenuItem("CSG"));
370393 csgItem.addActionListener(this);
371
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
372395 shadowXItem.addActionListener(this);
373
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
374397 shadowYItem.addActionListener(this);
375
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
377403 if (Globals.ADVANCED)
378404 {
379405 menu.add("-");
380406 linkerItem = menu.add(new MenuItem("Linker"));
381407 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384408 templateItem = menu.add(new MenuItem("Template"));
385409 templateItem.addActionListener(this);
386410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -409,7 +433,7 @@
409433 genNormalsMESHItem.addActionListener(this);
410434 if (Globals.ADVANCED)
411435 {
412
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
413437 genNormalsMINEItem.addActionListener(this);
414438 }
415439 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -469,6 +493,14 @@
469493 markleavesItem.addActionListener(this);
470494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
471495 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);
472504 menu.add("-");
473505 flipVItem = menu.add(new MenuItem("Flip V"));
474506 flipVItem.addActionListener(this);
....@@ -524,8 +556,21 @@
524556 buildToolsMenu(menu);
525557 }
526558
559
+
527560 void SetupUI2(ObjEditor oe)
528561 {
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
+
529574 //new Exception().printStackTrace();
530575
531576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -554,27 +599,79 @@
554599 oe.radioPanel.add(dummyButton);
555600 oe.buttonGroup.add(dummyButton);
556601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
557606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
558607
559
- 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);
560659 liveCB.setToolTipText("Enable animation");
561660 liveCB.addItemListener(this);
562661
563
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
564663 oneStepButton.setToolTipText("Animate one step forward");
565664 oneStepButton.addActionListener(this);
566665
567
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
568667 fastCB.setToolTipText("Fast mode");
569668 fastCB.addItemListener(this);
570669
571
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
572
- trackCB.setToolTipText("Enable tracking");
573
- trackCB.addItemListener(this);
574
-
575
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
576
- screenfitButton.setToolTipText("Screen fit");
577
- 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);
578675
579676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
580677 // screenfitpointButton.addActionListener(this);
....@@ -586,65 +683,146 @@
586683 snapobjectButton.setToolTipText("Snap Object");
587684 }
588685
589
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
- flashSelectionButton.setToolTipText("Show selection");
591
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
592687
593
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
594
-
595
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- twoButton.setToolTipText("Show center view only");
597
- twoButton.addActionListener(this);
598
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
599689 fourButton.addActionListener(this);
600690 fourButton.setToolTipText("Show left panel only");
601
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
- 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");
603699 sixButton.addActionListener(this);
604
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605
- threeButton.setToolTipText("2-column layout right");
606
- threeButton.addActionListener(this);
607
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- sevenButton.setToolTipText("3-column layout");
609
- 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);
610706 //
611707
612
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
613
- 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");
614710 rootButton.addActionListener(this);
615711
616
- 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);
617713 closeButton.setToolTipText("Close tab");
618714 closeButton.addActionListener(this);
619715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
620716 //clearButton.addActionListener(this);
621
-
622
- 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
+ }
623749
624
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
625
- 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");
626799 editButton.addActionListener(this);
627800
628
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
- uneditButton.setToolTipText("Unedit selection");
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
630803 uneditButton.addActionListener(this);
631804
632
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
633
- allParamsButton.setToolTipText("Edit all params");
805
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
806
+ allParamsButton.setToolTipText("Show all controle");
634807 allParamsButton.addActionListener(this);
635808
636
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637810 clearPanelButton.setToolTipText("Clear edit panel");
638811 clearPanelButton.addActionListener(this);
639812
640
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641814 unselectButton.setToolTipText("Unselect");
642815 unselectButton.addActionListener(this);
643816
644
- 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);
645820
646
- oe.treePanel.add(commandsPanel);
647
- oe.treePanel.Return();
821
+ editCommandsPanel.preferredHeight = 1;
822
+
823
+ SetPinStates(false);
824
+// oe.treePanel.add(commandsPanel);
825
+// oe.treePanel.Return();
648826
649827 // oe.aConstraints.gridx += 1;
650828 // oe.aConstraints.weighty = 0;
....@@ -661,29 +839,17 @@
661839
662840 JScrollPane jSP;
663841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
664
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
665843 ResetModel();
666844
667845 oe.treePanel.add(jSPPanel);
668846 oe.treePanel.Return();
669847
670
- cGridBag copyOptionsPanel = new cGridBag();
671
-
672
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
673
- colorCB.setToolTipText("Copy color when dropped");
674
- colorCB.addItemListener(this);
675
-
676
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
677
- materialCB.setToolTipText("Copy material when dropped");
678
- materialCB.addItemListener(this);
679
-
680
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
681
- textureCB.setToolTipText("Copy texture when dropped");
682
- textureCB.addItemListener(this);
683
-
684
- copyOptionsPanel.preferredHeight = 1;
685848 oe.treePanel.add(copyOptionsPanel);
686849 oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
687853
688854 // mainPanel.setDividerLocation(0.5); //1.0);
689855 // mainPanel.setResizeWeight(0.5);
....@@ -706,29 +872,49 @@
706872 dgr.addDragGestureListener(this);
707873 }catch(Exception e) {}
708874 */
709
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
710876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
711877 }
712878
713879 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
714880 {
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
+
715895 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
716896 boxCB.setToolTipText("Display bounding boxes");
717897 boxCB.addItemListener(this);
718898
719899 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
720
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
721901 zoomBoxCB.addItemListener(this);
722902
723903 if (true) // Globals.ADVANCED)
724904 {
725
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
726
- supportCB.setToolTipText("Enable rigging");
727
- 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);
728912
729913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
730914 // localCB.addItemListener(this);
731915
916
+ panel.Return();
917
+
732918 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
733919 crowdCB.setToolTipText("Used for crowds");
734920 crowdCB.addItemListener(this);
....@@ -745,6 +931,8 @@
745931 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
746932 // speakerMocapCB.addItemListener(this);
747933
934
+ panel.Return();
935
+
748936 if (false)
749937 {
750938 // handled in scripts
....@@ -759,34 +947,74 @@
759947 //constraints.gridy += 1;
760948 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
761949 smoothfocusCB.addItemListener(this);
950
+ panel.Return();
762951 }
763952
764953 //constraints.gridx += 1;
765954 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
766955 // debugCB.addItemListener(this);
767956
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
768961 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
962
+ oeilCB.setToolTipText("Move camera when tracking");
769963 oeilCB.addItemListener(this);
770964
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
+ {
771985 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
772986 lookAtCB.setToolTipText("Look-at target");
773987 lookAtCB.addItemListener(this);
988
+ }
774989
775990 }
776991
777992 cGridBag fill = new cGridBag();
778
-
779993 fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
780998
781999 panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
7821002
7831003 }
7841004
7851005 void EditObject(Object3D obj)
7861006 {
7871007 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
+
7881016 radioButton.SetObject(obj);
789
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
7901018 radioButton.SetCamera(cameraView.renderCamera, false);
7911019 radioButton.addActionListener(this);
7921020 radioPanel.add(radioButton);
....@@ -796,6 +1024,8 @@
7961024
7971025 void SetupViews(ObjEditor oe)
7981026 {
1027
+ theFrame = this;
1028
+
7991029 oe.SetupViews();
8001030
8011031 System.out.println("SetupViews");
....@@ -804,23 +1034,28 @@
8041034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8051035 }
8061036
807
- JCheckBox liveCB;
808
- JCheckBox supportCB;
809
- JCheckBox localCB;
810
- JCheckBox crowdCB;
811
- JCheckBox smoothCB;
812
- JCheckBox fastCB;
813
- JCheckBox slowCB;
814
- JCheckBox boxCB;
815
- JCheckBox zoomBoxCB;
816
- JCheckBox trackCB;
817
- JCheckBox smoothfocusCB;
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;
8181050 // JCheckBox speakerMocapCB;
819
- JCheckBox speakerCameraCB;
820
- JCheckBox speakerFocusCB;
821
- JCheckBox debugCB;
822
- JCheckBox oeilCB;
823
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
8241059
8251060 // static int COLOR = 1;
8261061 // static int MATERIAL = 2;
....@@ -828,9 +1063,9 @@
8281063
8291064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8301065
831
- JCheckBox colorCB;
832
- JCheckBox materialCB;
833
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
8341069
8351070 public void itemStateChanged(ItemEvent e)
8361071 {
....@@ -858,6 +1093,7 @@
8581093 } else if(e.getSource() == liveCB)
8591094 {
8601095 cameraView.ToggleLive();
1096
+ refreshContents(false);
8611097 }
8621098 else if(e.getSource() == supportCB)
8631099 {
....@@ -922,6 +1158,18 @@
9221158 {
9231159 cameraView.ToggleOeil();
9241160 }
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
+ }
9251173 else if(e.getSource() == lookAtCB)
9261174 {
9271175 cameraView.ToggleLookAt();
....@@ -938,7 +1186,8 @@
9381186
9391187 /**/
9401188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
941
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
9421191 if ((path == null) || (path.getPathCount() <= 1)) {
9431192 // We can't move the root node or an empty selection
9441193 return;
....@@ -1001,8 +1250,6 @@
10011250 }
10021251 }
10031252
1004
- String string = (String) object;
1005
-
10061253 System.out.println("Transfer = " + object + "; drop : " + target);
10071254 // if( object instanceof java.io.File[])
10081255 // {
....@@ -1010,6 +1257,8 @@
10101257 // objEditor.DropFile((java.io.File[]) object, true);
10111258 // return;
10121259 // }
1260
+
1261
+ String string = object.toString();
10131262
10141263 // File path for Mac and Windows
10151264 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1055,23 +1304,33 @@
10551304
10561305 assert target == objEditor.jTree;
10571306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
10581308 try {
1059
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10601310 } catch (Exception e) {
10611311 System.out.println("destinationPath : " + destinationPath);
10621312 return;
10631313 }
10641314
1065
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
10661316 {
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
+// {
10671326 loadClipboard(true);
10681327 objEditor.jTree.setSelectionPath(destinationPath);
10691328 pasteInto(false, false);
1070
- } else {
1071
- loadClipboard(false);
1072
- objEditor.jTree.setSelectionPath(destinationPath);
1073
- pasteInto(false, false); // true); // ???
1074
- }
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
10751334 }
10761335 public void dropActionChanged(DropTargetDragEvent dtde)
10771336 // Called if the user has modified the current drop gesture
....@@ -1176,22 +1435,30 @@
11761435 {
11771436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11781437 //heightFieldItem.addActionListener(this);
1179
- gridItem = menu.add(new MenuItem("Grid"));
1180
- gridItem.addActionListener(this);
1181
- rectoidItem = menu.add(new MenuItem("Box"));
1182
- rectoidItem.addActionListener(this);
1183
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1184
- ellipsoidItem.addActionListener(this);
1185
- coneItem = menu.add(new MenuItem("Cone"));
1186
- coneItem.addActionListener(this);
1187
- torusItem = menu.add(new MenuItem("Torus"));
1188
- torusItem.addActionListener(this);
1189
- superItem = menu.add(new MenuItem("Superellipsoid"));
1190
- superItem.addActionListener(this);
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
+ {
11911456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11921457 kleinItem.addActionListener(this);
1193
- particleItem = menu.add(new MenuItem("Particle system"));
1194
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
11951462 if (Globals.ADVANCED)
11961463 {
11971464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1217,15 +1484,15 @@
12171484 }
12181485 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12191486 bezierItem.addActionListener(this);
1220
- overlayItem = menu.add(new MenuItem("Overlay"));
1221
- overlayItem.addActionListener(this);
1222
- lightItem = menu.add(new MenuItem("Light"));
1223
- lightItem.addActionListener(this);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
12241491 menu.add("-");
12251492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12261493 //superLoopItem.addActionListener(this);
1227
- loopItem = menu.add(new MenuItem("Loop"));
1228
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
12291496 doubleItem = menu.add(new MenuItem("Fork"));
12301497 doubleItem.addActionListener(this);
12311498 if (Globals.ADVANCED)
....@@ -1241,6 +1508,9 @@
12411508 animationItem.addItemListener(this);
12421509 animationItem.setState(Globals.ANIMATION);
12431510
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
1513
+
12441514 menu.add("-");
12451515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12461516 parseverticesItem.addActionListener(this);
....@@ -1253,6 +1523,8 @@
12531523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12541524 reduce34MorphItem.addActionListener(this);
12551525 menu.add("-");
1526
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1527
+ memoryItem.addActionListener(this);
12561528 menu.add(computeAOItem = new MenuItem("Compute AO"));
12571529 computeAOItem.addActionListener(this);
12581530
....@@ -1261,11 +1533,9 @@
12611533 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12621534 mirrorItem.addActionListener(this);
12631535 menu.add("-");
1264
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1265
- memoryItem.addActionListener(this);
12661536 menu.add(analyzeItem = new MenuItem("Analyze"));
12671537 analyzeItem.addActionListener(this);
1268
- menu.add(dumpItem = new MenuItem("Dump"));
1538
+ menu.add(dumpItem = new MenuItem("Print"));
12691539 dumpItem.addActionListener(this);
12701540 // menu.add(pathItem = new MenuItem("From-to path"));
12711541 // pathItem.addActionListener(this);
....@@ -1406,9 +1676,34 @@
14061676 shadow.material = new cMaterial(obj.material);
14071677 shadow.material.diffuse = 0.0001f;
14081678 shadow.material.specular = 0.0001f;
1679
+ //shadow.projectedVertices[1].x = 300;
14091680
14101681 makeSomething(shadow);
14111682 }
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
+ }
14121707
14131708 /**
14141709 * applyExample
....@@ -1653,7 +1948,7 @@
16531948 {
16541949 ScreenFit();
16551950 } else
1656
- if (source == switchItem)
1951
+ if (source == switchViewItem)
16571952 {
16581953 cVector v1 = new cVector();
16591954 cVector v2 = new cVector();
....@@ -1662,11 +1957,11 @@
16621957 objEditor.cameraView.renderCamera.setAim(v2, v1);
16631958 objEditor.cameraView.repaint();
16641959 } else
1665
- if (source == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
16661961 {
16671962 makeSomething(new Box());
16681963 } else
1669
- if (source == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
16701965 {
16711966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16721967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1745,27 +2040,27 @@
17452040
17462041 makeSomething(obj);
17472042 } else
1748
- if (source == gridItem)
2043
+ if (source == gridItem || source == gridButton)
17492044 {
17502045 makeSomething(new Grid());
17512046 } else
1752
- if (source == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
17532048 {
17542049 makeSomething(new Sphere());
17552050 } else
1756
- if (source == coneItem)
2051
+ if (source == coneItem || source == coneButton)
17572052 {
17582053 makeSomething(new Cone());
17592054 } else
1760
- if (source == torusItem)
2055
+ if (source == torusItem || source == torusButton)
17612056 {
17622057 makeSomething(new Torus());
17632058 } else
1764
- if (source == superItem)
2059
+ if (source == superItem || source == superButton)
17652060 {
17662061 makeSomething(new Superellipsoid());
17672062 } else
1768
- if (source == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
17692064 {
17702065 makeSomething(new Klein());
17712066 } else
....@@ -1785,7 +2080,7 @@
17852080 {
17862081 makeSomething(new BezierSurface());
17872082 } else
1788
- if (source == overlayItem)
2083
+ if (source == overlayItem || source == overlayButton)
17892084 {
17902085 /*
17912086 Object3D obj = new BezierSurface(5,8);
....@@ -1833,7 +2128,7 @@
18332128 s.setup();
18342129 makeSomething(s);
18352130 } else
1836
- if (source == lightItem)
2131
+ if (source == lightItem || source == lightButton)
18372132 {
18382133 makeSomething(new Light());
18392134 } else
....@@ -1883,30 +2178,30 @@
18832178
18842179 group(g);
18852180 } else
1886
- if (source == loopItem)
2181
+ if (source == loopItem || source == loopButton)
18872182 {
18882183 Composite csg = new GroupLeaf();
18892184 csg.count = 5;
18902185 group(csg);
1891
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
18922187 csg.addChild(child);
18932188 child.addChild(csg);
18942189 } else
18952190 if (source == doubleItem)
18962191 {
1897
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
18982193 csg.count = 5;
18992194 group(csg);
1900
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
19012196 csg.addChild(child);
19022197 child.addChild(csg);
1903
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
19042199 csg.addChild(child);
19052200 child.addChild(csg);
19062201 } else
19072202 if (source == tripleItem)
19082203 {
1909
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
19102205 csg.count = 4;
19112206 group(csg);
19122207 Composite child = new cGroup();
....@@ -1956,6 +2251,46 @@
19562251 {
19572252 DumpObject();
19582253 } 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
19592294 if (source == oneStepButton)
19602295 {
19612296 Globals.ONESTEP = true;
....@@ -1963,17 +2298,14 @@
19632298 } else
19642299 if (source == screenfitButton)
19652300 {
1966
- //Reload(lastConverter, lastFilename, true);
19672301 ScreenFit();
19682302 } else
19692303 if (source == screenfitpointButton)
19702304 {
1971
- //Reload(lastConverter, lastFilename, true);
19722305 ScreenFitPoint();
19732306 } else
19742307 if (source == snapobjectButton)
19752308 {
1976
- //Reload(lastConverter, lastFilename, true);
19772309 SnapObject();
19782310 } else
19792311 // if (event.getSource() == recompileButton)
....@@ -2337,7 +2669,7 @@
23372669 {
23382670 StepAll();
23392671 } else
2340
- if (source == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
23412673 {
23422674 //int indices[] = jList.getSelectedIndices();
23432675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2349,9 +2681,9 @@
23492681 {
23502682 ClearSelection(true);
23512683 } else
2352
- if (source == grabItem)
2684
+ if (source == grabItem || source == groupButton)
23532685 {
2354
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
23552687 } else
23562688 if (source == hideItem)
23572689 {
....@@ -2369,11 +2701,11 @@
23692701 {
23702702 makeSomething(new Camera());
23712703 } else
2372
- if (source == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
23732705 {
23742706 group(new Composite());
23752707 } else
2376
- if (source == randomItem)
2708
+ if (source == switchItem || source == switchButton)
23772709 {
23782710 RandomNode random = new RandomNode();
23792711 group(random);
....@@ -2475,7 +2807,7 @@
24752807 {
24762808 group(new cLinker());
24772809 } else
2478
- if (source == textureItem)
2810
+ if (source == textureItem || source == textureButton)
24792811 {
24802812 group(new TextureNode());
24812813 } else
....@@ -2495,17 +2827,30 @@
24952827 {
24962828 CastShadow(2);
24972829 } else
2498
- if (source == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
24992831 {
2500
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
25012834 for (int i=0; i<group.selection.size(); i++)
25022835 {
2503
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
25042841 }
25052842
2506
- ClearSelection(false);
2507
-
2508
- 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
+ }
25092854 } else
25102855 if (source == genUVItem)
25112856 {
....@@ -2517,7 +2862,7 @@
25172862 } else
25182863 if (source == genNormalsMESHItem)
25192864 {
2520
- GenNormals(true); // TODO
2865
+ GenNormalsMESH();
25212866 } else
25222867 if (source == genNormalsORGANItem)
25232868 {
....@@ -2582,6 +2927,22 @@
25822927 if (source == unmarkleavesItem)
25832928 {
25842929 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);
25852946 } else
25862947 if (source == flipVItem)
25872948 {
....@@ -2817,6 +3178,10 @@
28173178 if (source == twoButton)
28183179 {
28193180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
28203185 // bug
28213186 //gridPanel.setDividerLocation(1.0);
28223187 //bigPanel.setDividerLocation(0.0);
....@@ -2849,10 +3214,31 @@
28493214 bigThree.ClearUI();
28503215 bigThree.add(centralPanel);
28513216 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
+
28523235 } else
28533236 if (source == threeButton)
28543237 {
28553238 radio.layout = threeButton;
3239
+
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
28563242
28573243 // bigThree.remove(scenePanel);
28583244 // bigThree.remove(centralPanel);
....@@ -2885,10 +3271,15 @@
28853271 bigThree.add(centralPanel);
28863272 bigThree.add(XYZPanel);
28873273 bigThree.FlushUI();
3274
+
3275
+ cameraView.requestFocusInWindow();
28883276 } else
28893277 if (source == fourButton)
28903278 {
28913279 radio.layout = fourButton;
3280
+
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
28923283
28933284 // bigThree.remove(scenePanel);
28943285 // bigThree.remove(centralPanel);
....@@ -2920,10 +3311,15 @@
29203311 bigThree.ClearUI();
29213312 bigThree.add(scenePanel);
29223313 bigThree.FlushUI();
3314
+
3315
+ cameraView.requestFocusInWindow();
29233316 } else
29243317 if (source == sixButton)
29253318 {
29263319 radio.layout = sixButton;
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
29273323
29283324 // bigThree.remove(scenePanel);
29293325 // bigThree.remove(centralPanel);
....@@ -2956,10 +3352,15 @@
29563352 bigThree.add(scenePanel);
29573353 bigThree.add(centralPanel);
29583354 bigThree.FlushUI();
3355
+
3356
+ cameraView.requestFocusInWindow();
29593357 } else
29603358 if (source == sevenButton)
29613359 {
29623360 radio.layout = sevenButton;
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
29633364
29643365 // bigThree.remove(scenePanel);
29653366 // bigThree.remove(centralPanel);
....@@ -2993,6 +3394,8 @@
29933394 bigThree.add(centralPanel);
29943395 bigThree.add(XYZPanel);
29953396 bigThree.FlushUI();
3397
+
3398
+ cameraView.requestFocusInWindow();
29963399 } else
29973400 if (source == rootButton)
29983401 {
....@@ -3004,6 +3407,7 @@
30043407 EditObject(obj);
30053408 }
30063409
3410
+ cameraView.requestFocusInWindow();
30073411 refreshContents(true);
30083412 } else
30093413 if (source == closeButton)
....@@ -3013,22 +3417,37 @@
30133417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30143418 {
30153419 ab = (cRadio)e.nextElement();
3016
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30173421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
30183428 buttonGroup.remove(ab);
30193429 radioPanel.remove(ab);
30203430
3021
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
30223433 // ab.GetObject().objectUI = null; // ?????????
30233434
30243435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30253436 break;
30263437 }
30273438 }
3439
+
3440
+ cameraView.requestFocusInWindow();
30283441 refreshContents(true);
30293442 } else
30303443 if (source == editItem || source == editButton)
30313444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
30323451 EditSelection(false);
30333452 } else
30343453 if (source == uneditButton)
....@@ -3038,6 +3457,7 @@
30383457 Object3D child = (Object3D)e.nextElement();
30393458 if(child.editWindow != null)
30403459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
30413461 child.CloseUI();
30423462 listUI.remove(child);
30433463
....@@ -3054,6 +3474,7 @@
30543474 //copy.ClearUI();
30553475 for (Object3D obj : listUI)
30563476 {
3477
+ obj.pinned = false;
30573478 obj.CloseUI();
30583479 }
30593480 listUI.clear();
....@@ -3063,7 +3484,7 @@
30633484 {
30643485 assert(copy == group);
30653486
3066
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30673488
30683489 for (Object3D obj : listUI)
30693490 {
....@@ -3112,6 +3533,9 @@
31123533 }
31133534
31143535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
31153539 //Globals.theRenderer.object = group;
31163540 if(!useclient)
31173541 {
....@@ -3128,7 +3552,9 @@
31283552 sideView.object = group;
31293553 }
31303554
3131
-// fix "+" issue group.editWindow = this;
3555
+// fix "+" issue
3556
+ //group.editWindow = this;
3557
+ group.manipWindow = this;
31323558
31333559 /*
31343560 currentLayout = radio.layout;
....@@ -3136,18 +3562,27 @@
31363562 currentLayout = sevenButton;
31373563 */
31383564 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);
31393572 keepparent = group.parent;
31403573 // PARENT = NULL or not???
31413574 //group.parent = null; // ROOT
31423575 //group.attributes = -1;
31433576 ResetModel();
3577
+
3578
+ cameraView.requestFocusInWindow();
31443579 refreshContents(true);
31453580 } else if (event.getSource() == editCameraItem)
31463581 {
31473582 cameraView.ProtectCamera();
31483583 cameraView.repaint();
31493584 return;
3150
- } else if (event.getSource() == revertCameraItem)
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31513586 {
31523587 cameraView.RevertCamera();
31533588 cameraView.repaint();
....@@ -3164,7 +3599,6 @@
31643599 }
31653600
31663601 boolean useclient = false;
3167
- cRadio radio;
31683602
31693603 void ToggleRoot()
31703604 {
....@@ -3403,7 +3837,8 @@
34033837
34043838 int size = obj.MemorySize();
34053839
3406
- 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)");
34073842 }
34083843 }
34093844 catch (Exception e)
....@@ -3484,6 +3919,13 @@
34843919 void GenNormals(boolean crease)
34853920 {
34863921 group.GenNormalsS(crease);
3922
+
3923
+ refreshContents();
3924
+ }
3925
+
3926
+ void GenNormalsMESH()
3927
+ {
3928
+ group.GenNormalsMeshS();
34873929
34883930 refreshContents();
34893931 }
....@@ -4111,6 +4553,18 @@
41114553 refreshContents();
41124554 }
41134555
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
+
41144568 void SetTexRes(int tr)
41154569 {
41164570 group.selection.SetTexRes(tr);
....@@ -4182,28 +4636,25 @@
41824636 // }
41834637 // }
41844638
4185
- static boolean allparams = true;
4186
-
4187
- static Vector<Object3D> listUI = new Vector<Object3D>();
4188
-
41894639 void EditSelection(boolean newWindow)
41904640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
41914647 // aConstraints.gridy = 0;
41924648 for (int i=0; i<group.selection.size(); i++)
41934649 {
41944650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41954651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4196
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41974653
41984654 Object3D elem = (Object3D)group.selection.elementAt(i);
41994655 if(elem != group || !newWindow)
42004656 {
4201
- // if (!(elem instanceof Composite))
4202
- // newWindow = false;
4203
- listUI.add(elem);
4204
- elem.openEditWindow(this, newWindow); //, false);
4205
- System.out.println("edit : " + elem);
4206
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
42074658 }
42084659 }
42094660 }
....@@ -4278,7 +4729,8 @@
42784729 //new Exception().printStackTrace();
42794730
42804731 freezemodel = true;
4281
-
4732
+ ClearUnpinned();
4733
+
42824734 /**/
42834735 //switch (event.id)
42844736 {
....@@ -4286,7 +4738,6 @@
42864738 //case 702: // Event.LIST_DESELECT
42874739 group.deselectAll();
42884740 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4289
- objEditor.ClearInfo(); // .GetMaterial());
42904741 if (tps != null)
42914742 {
42924743 for (int i=0; i < tps.length; i++)
....@@ -4295,10 +4746,8 @@
42954746
42964747 //if (child.parent != null)
42974748 //child.parent.addSelectee(child);
4749
+ objEditor.SetMaterial(child);
42984750 group.addSelectee(child);
4299
- objEditor.SetMaterial(child); // .GetMaterial());
4300
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4301
- System.err.println("info : " + child.GetPath());
43024751 }
43034752 }
43044753 // else
....@@ -4308,15 +4757,13 @@
43084757 // System.err.println("info : " + group.GetPath());
43094758 // }
43104759
4311
- objEditor.SetText(); // jan 2014
4312
-
43134760 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43144761 CameraPane.flash = true;
43154762
43164763 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43174764 // a camera
43184765 {
4319
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43204767 {
43214768 CameraPane.camerachangeframe = 0; // don't refuse it
43224769 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4325,6 +4772,13 @@
43254772 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43264773 }
43274774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
43284782 refreshContents();
43294783 //return true;
43304784 }
....@@ -4333,6 +4787,35 @@
43334787
43344788 freezemodel = false;
43354789 }
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
+ }
43364819
43374820 void linkSomething(Object3D thing)
43384821 {
....@@ -4404,6 +4887,7 @@
44044887 {
44054888 if (group.selection.isEmpty())
44064889 return;
4890
+
44074891 Grafreed.clipboardIsTempGroup = false;
44084892 Composite tGroup = null;
44094893 if (group.selection.size() > 0) // 1)
....@@ -4414,6 +4898,8 @@
44144898
44154899 if (cut)
44164900 {
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
44174903 //int indices[] = jList.getSelectedIndices();
44184904 //for (int i = indices.length - 1; i >= 0; i--)
44194905 //jList.remove(indices[i]);
....@@ -4503,8 +4989,10 @@
45034989 }
45044990
45054991 }
4992
+
45064993 if (Grafreed.clipboardIsTempGroup)
45074994 Grafreed.clipboard = tGroup;
4995
+
45084996 if (cut)
45094997 {
45104998 ResetModel();
....@@ -4514,6 +5002,10 @@
45145002
45155003 void paste(boolean expand)
45165004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
45175009 // if (GrafreeD.clipboard == null)
45185010 // return;
45195011 boolean first = true;
....@@ -4573,6 +5065,7 @@
45735065 Grafreed.clipboard.get(0).parent = keepparent;
45745066 }
45755067
5068
+ Globals.REPLACEONMAKE = keep;
45765069 ResetModel();
45775070 refreshContents();
45785071 }
....@@ -4708,6 +5201,10 @@
47085201
47095202 void group(Object3D csg, boolean grab)
47105203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
47115208 if (//false) // why??
47125209 !group.selection.isEmpty())
47135210 {
....@@ -4821,10 +5318,15 @@
48215318 //node.add(csg);
48225319 //makeSomething(node);
48235320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
48245322 }
48255323
48265324 void Ungroup(Object3D g)
48275325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
48285330 if (g instanceof HiddenObject)
48295331 {
48305332 HiddenObject h = (HiddenObject) g;
....@@ -4841,6 +5343,7 @@
48415343 objEditor.makeSomething(g.get(i), false);
48425344 }
48435345 }
5346
+ Globals.REPLACEONMAKE = keep;
48445347 }
48455348
48465349 void ungroup()
....@@ -5129,7 +5632,28 @@
51295632 cButton clearpanelButton;
51305633 cButton unselectButton;
51315634
5635
+ cButton restoreCameraButton;
5636
+
5637
+ cButton saveButton;
51325638 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;
51335657
51345658 cButton screenfitButton;
51355659 cButton screenfitpointButton;
....@@ -5142,14 +5666,6 @@
51425666
51435667 cButton setsupportButton;
51445668
5145
- cButton twoButton;
5146
- cButton sixButton;
5147
- cButton threeButton;
5148
- cButton sevenButton;
5149
- cButton fourButton; // full panel
5150
- cButton oneButton; // full XYZ
5151
- //cButton currentLayout;
5152
-
51535669 //
51545670 //Composite
51555671 Object3D // to do !!
....@@ -5159,11 +5675,11 @@
51595675 //JTree jTree;
51605676 private MenuItem lookAtItem;
51615677 private MenuItem lookFromItem;
5162
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
51635679 private MenuItem cutItem;
51645680 private MenuItem undoItem;
51655681 private MenuItem redoItem;
5166
- private MenuItem duplicateItem;
5682
+ private JMenuItem duplicateItem;
51675683 private MenuItem cloneItem;
51685684 private MenuItem cloneSupportItem;
51695685 private MenuItem overwriteGeoItem;
....@@ -5191,7 +5707,7 @@
51915707 private MenuItem pasteLinkItem;
51925708 private MenuItem pasteCloneItem;
51935709 private MenuItem pasteExpandItem;
5194
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
51955711 private MenuItem clearAllItem;
51965712 private MenuItem genUVItem;
51975713 private MenuItem genNormalsMESHItem;
....@@ -5226,6 +5742,10 @@
52265742 private MenuItem showleavesItem;
52275743 private MenuItem markleavesItem;
52285744 private MenuItem unmarkleavesItem;
5745
+ private MenuItem rewindleavesItem;
5746
+ private MenuItem unrewindleavesItem;
5747
+ private MenuItem randomleavesItem;
5748
+ private MenuItem unrandomleavesItem;
52295749
52305750 private MenuItem flipVItem;
52315751 private MenuItem unflipVItem;
....@@ -5247,7 +5767,7 @@
52475767 private MenuItem frontItem;
52485768 private MenuItem cameraItem;
52495769 private MenuItem compositeItem;
5250
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
52515771 private MenuItem physicsItem;
52525772 private MenuItem frameselectorItem;
52535773 private MenuItem scriptNodeItem;
....@@ -5321,5 +5841,5 @@
53215841
53225842 Menu cameraMenu;
53235843 MenuItem editCameraItem;
5324
- MenuItem revertCameraItem;
5844
+ MenuItem restoreCameraItem;
53255845 }