Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +98,7 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.SAVEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
....@@ -148,28 +153,21 @@
148153
149154 //JTextField nameField;
150155
151
- void SetupMenu2(ObjEditor oe)
156
+ void SetupMenu2(GroupEditor oe)
152157 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
158
+ oe.jTree = new cTree();
159
+
168160 Menu menu;
169161 oe.menuBar.add(menu = new Menu("Edit"));
170162 //editItem = menu.add(new MenuItem("Edit"));
171163 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+
165
+// undoItem = menu.add(new MenuItem("Undo"));
166
+// undoItem.addActionListener(this);
167
+// redoItem = menu.add(new MenuItem("Redo"));
168
+// redoItem.addActionListener(this);
169
+// menu.add("-");
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173171 duplicateItem.addActionListener(this);
174172 cloneItem = menu.add(new MenuItem("Clone"));
175173 cloneItem.addActionListener(this);
....@@ -185,7 +183,6 @@
185183 copyItem.addActionListener(this);
186184 pasteItem = menu.add(new MenuItem("Paste"));
187185 pasteItem.addActionListener(this);
188
- menu.add("-");
189186
190187 menu.add("-");
191188 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -206,7 +203,94 @@
206203 clearAllItem = menu.add(new MenuItem("Clear All"));
207204 clearAllItem.addActionListener(this);
208205 }
206
+
207
+ menuBar.add(cameraMenu = new Menu("View"));
208
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
209
+ //zBufferItem.addActionListener(this);
210
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
211
+ //normalLensItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
214
+
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
227
+
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
229
+ toggleHandleItem.addItemListener(this);
230
+ toggleHandleItem.setState(CameraPane.HANDLES);
231
+
232
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
233
+ togglePaintItem.addItemListener(this);
234
+ togglePaintItem.setState(CameraPane.PAINTMODE);
235
+
236
+ if (Globals.ADVANCED)
237
+ {
238
+ cameraMenu.add("-");
239
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
240
+ toggleLiveItem.addItemListener(this);
241
+ toggleLiveItem.setState(Globals.isLIVE());
209242
243
+ cameraMenu.add(stepItem = new MenuItem("Step"));
244
+ stepItem.addActionListener(this);
245
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
246
+ // toggleDLItem.addItemListener(this);
247
+ // toggleDLItem.setState(false);
248
+
249
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
250
+ toggleRenderItem.addItemListener(this);
251
+ toggleRenderItem.setState(!CameraPane.frozen);
252
+
253
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
254
+ toggleDebugItem.addItemListener(this);
255
+ toggleDebugItem.setState(Globals.DEBUG);
256
+
257
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
258
+ toggleFrustumItem.addItemListener(this);
259
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
260
+
261
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
262
+ toggleFootContactItem.addItemListener(this);
263
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
264
+
265
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
266
+ toggleTimelineItem.addItemListener(this);
267
+ }
268
+
269
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
270
+// toggleRootItem.addItemListener(this);
271
+// toggleRootItem.setState(false);
272
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
273
+// animationItem.addItemListener(this);
274
+// animationItem.setState(CameraPane.ANIMATION);
275
+ cameraMenu.add("-");
276
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
277
+ editCameraItem.addActionListener(this);
278
+
279
+ if (Globals.ADVANCED)
280
+ {
281
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
282
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
284
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
285
+ oe.cameraMenu.add("-");
286
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
287
+ openWindowItem.addActionListener(this);
288
+ editLeafItem.addActionListener(this);
289
+ lookAtItem.addActionListener(this);
290
+ //lookFromItem.addActinoListener(this);
291
+ //switchViewItem.addActionListener(this);
292
+ }
293
+
210294 oe.menuBar.add(menu = new Menu("Setting"));
211295 if (Globals.ADVANCED)
212296 {
....@@ -249,21 +333,29 @@
249333 }
250334
251335 oe.menuBar.add(menu = new Menu("Group"));
252
- grabItem = menu.add(new MenuItem("Grab"));
253
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
254338 backItem = menu.add(new MenuItem("Back"));
255339 backItem.addActionListener(this);
256340 frontItem = menu.add(new MenuItem("Front"));
257341 frontItem.addActionListener(this);
258
- compositeItem = menu.add(new MenuItem("Composite"));
259
- compositeItem.addActionListener(this);
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
260347 hideItem = menu.add(new MenuItem("Hidden Group"));
261348 hideItem.addActionListener(this);
349
+ }
262350 ungroupItem = menu.add(new MenuItem("Ungroup"));
263351 ungroupItem.addActionListener(this);
264
- menu.add("-");
265
- randomItem = menu.add(new MenuItem("Switch node"));
266
- randomItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
267359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
268360 switchGeoItem.addActionListener(this);
269361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -271,8 +363,6 @@
271363 morphItem = menu.add(new MenuItem("Morph Group"));
272364 morphItem.addActionListener(this);
273365
274
- if (Globals.ADVANCED)
275
- {
276366 menu.add("-");
277367 physicsItem = menu.add(new MenuItem("Physics"));
278368 physicsItem.addActionListener(this);
....@@ -280,30 +370,29 @@
280370 frameselectorItem.addActionListener(this);
281371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
282372 scriptNodeItem.addActionListener(this);
283
- cameraItem = menu.add(new MenuItem("Camera"));
284
- cameraItem.addActionListener(this);
285373 }
286374
287375 oe.menuBar.add(menu = new Menu("Object"));
288
- textureItem = menu.add(new MenuItem("Texture"));
289
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
290378 billboardItem = menu.add(new MenuItem("Billboard"));
291379 billboardItem.addActionListener(this);
292380 csgItem = menu.add(new MenuItem("CSG"));
293381 csgItem.addActionListener(this);
294
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
295383 shadowXItem.addActionListener(this);
296
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
297385 shadowYItem.addActionListener(this);
298
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
299387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
300391 if (Globals.ADVANCED)
301392 {
302393 menu.add("-");
303394 linkerItem = menu.add(new MenuItem("Linker"));
304395 linkerItem.addActionListener(this);
305
- attributeItem = menu.add(new MenuItem("Attribute"));
306
- attributeItem.addActionListener(this);
307396 templateItem = menu.add(new MenuItem("Template"));
308397 templateItem.addActionListener(this);
309398 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -392,6 +481,14 @@
392481 markleavesItem.addActionListener(this);
393482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394483 unmarkleavesItem.addActionListener(this);
484
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
485
+ rewindleavesItem.addActionListener(this);
486
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
487
+ unrewindleavesItem.addActionListener(this);
488
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
489
+ randomleavesItem.addActionListener(this);
490
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
491
+ unrandomleavesItem.addActionListener(this);
395492 menu.add("-");
396493 flipVItem = menu.add(new MenuItem("Flip V"));
397494 flipVItem.addActionListener(this);
....@@ -443,25 +540,24 @@
443540 oe.menuBar.add(menu = new Menu("Insert"));
444541 buildCreateMenu(menu);
445542
446
- oe.menuBar.add(menu = new Menu("Include"));
447
- importOBJItem = menu.add(new MenuItem("OBJ file..."));
448
- importOBJItem.addActionListener(this);
449
- menu.add("-");
450
- import3DSItem = menu.add(new MenuItem("3DS file..."));
451
- import3DSItem.addActionListener(this);
452
- menu.add("-");
453
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
454
- importVRMLX3DItem.addActionListener(this);
455
- menu.add("-");
456
- importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
457
- importGFDItem.addActionListener(this);
458
-
459543 oe.menuBar.add(menu = new Menu("Tools"));
460544 buildToolsMenu(menu);
461545 }
462546
463547 void SetupUI2(ObjEditor oe)
464548 {
549
+ // June 2019
550
+ if (oe == null)
551
+ {
552
+ //super.SetupUI2(this);
553
+ //return;
554
+ }
555
+
556
+ if (copy != group)
557
+ {
558
+ //super.SetupUI2(this);
559
+ }
560
+
465561 //new Exception().printStackTrace();
466562
467563 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +586,66 @@
490586 oe.radioPanel.add(dummyButton);
491587 oe.buttonGroup.add(dummyButton);
492588 */
589
+ cGridBag copyOptionsPanel = new cGridBag();
590
+
591
+ copyOptionsPanel.preferredHeight = 1;
592
+
493593 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494594
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
595
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ //minButton.setToolTipText("Minimize window");
597
+ //minButton.addActionListener(this);
598
+
599
+ if (Globals.ADVANCED)
600
+ {
601
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ maxButton.setToolTipText("Maximize window");
603
+ maxButton.addActionListener(this);
604
+ }
605
+
606
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ fullButton.setToolTipText("Full-screen window");
608
+ fullButton.addActionListener(this);
609
+
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ screenfitButton.setToolTipText("Screen fit");
612
+ screenfitButton.addActionListener(this);
613
+
614
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ restoreCameraButton.setToolTipText("Restore viewpoint");
616
+ restoreCameraButton.addActionListener(this);
617
+
618
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ undoButton.setToolTipText("Undo changes");
620
+ undoButton.addActionListener(this);
621
+ undoButton.setEnabled(false);
622
+
623
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ redoButton.setToolTipText("Redo changes");
625
+ redoButton.addActionListener(this);
626
+ redoButton.setEnabled(false);
627
+
628
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ saveButton.setToolTipText("Save changes");
630
+ saveButton.addActionListener(this);
631
+
632
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
496633 liveCB.setToolTipText("Enable animation");
497634 liveCB.addItemListener(this);
498635
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500637 oneStepButton.setToolTipText("Animate one step forward");
501638 oneStepButton.addActionListener(this);
502639
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
640
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504641 fastCB.setToolTipText("Fast mode");
505642 fastCB.addItemListener(this);
506643
507
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
508
- trackCB.setToolTipText("Enable tracking");
509
- trackCB.addItemListener(this);
510
-
511
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512
- screenfitButton.setToolTipText("Screen fit");
513
- screenfitButton.addActionListener(this);
644
+ //oe.toolboxPanel.Return();
645
+
646
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
647
+// trackCB.setToolTipText("Enable tracking");
648
+// trackCB.addItemListener(this);
514649
515650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516651 // screenfitpointButton.addActionListener(this);
....@@ -522,65 +657,145 @@
522657 snapobjectButton.setToolTipText("Snap Object");
523658 }
524659
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
660
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528661
529
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
-
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532663 twoButton.setToolTipText("Show center view only");
533664 twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ this.fullscreenLayout = twoButton;
666
+
667
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535668 fourButton.addActionListener(this);
536669 fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538671 sixButton.setToolTipText("2-column layout left");
539672 sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
673
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541674 threeButton.setToolTipText("2-column layout right");
542675 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544677 sevenButton.setToolTipText("3-column layout");
545678 sevenButton.addActionListener(this);
546679 //
547680
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
681
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549682 rootButton.setToolTipText("Edit selection in new tab");
550683 rootButton.addActionListener(this);
551684
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
685
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553686 closeButton.setToolTipText("Close tab");
554687 closeButton.addActionListener(this);
555688 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
556689 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
690
+
691
+ // INSERT
692
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ gridButton.setToolTipText("Create grid");
694
+ gridButton.addActionListener(this);
695
+
696
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ boxButton.setToolTipText("Create box");
698
+ boxButton.addActionListener(this);
699
+
700
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+ sphereButton.setToolTipText("Create sphere");
702
+ sphereButton.addActionListener(this);
703
+
704
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ coneButton.setToolTipText("Create cone");
706
+ coneButton.addActionListener(this);
707
+
708
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ torusButton.setToolTipText("Create torus");
710
+ torusButton.addActionListener(this);
711
+
712
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ superButton.setToolTipText("Create superellipsoid");
714
+ superButton.addActionListener(this);
715
+
716
+ if (Globals.ADVANCED)
717
+ {
718
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ kleinButton.setToolTipText("Create Klein bottle");
720
+ kleinButton.addActionListener(this);
721
+ }
559722
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- editButton.setToolTipText("Edit selection");
723
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ particlesButton.setToolTipText("Create particle system");
725
+ particlesButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.Return();
728
+
729
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ groupButton.setToolTipText("Create group");
731
+ groupButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ compositeButton.setToolTipText("Create composite");
735
+ compositeButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ switchButton.setToolTipText("Create item switcher");
739
+ switchButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ loopButton.setToolTipText("Create loop");
743
+ loopButton.addActionListener(this);
744
+
745
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ textureButton.setToolTipText("Create texture");
747
+ textureButton.addActionListener(this);
748
+
749
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ overlayButton.setToolTipText("Create overlay");
751
+ overlayButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ lightButton.setToolTipText("Create light");
755
+ lightButton.addActionListener(this);
756
+
757
+ for (int i=6; --i>=0;)
758
+ {
759
+ oe.toolboxPanel.Return();
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ oe.toolboxPanel.add(new cGridBag());
762
+ oe.toolboxPanel.add(new cGridBag());
763
+ oe.toolboxPanel.add(new cGridBag());
764
+ oe.toolboxPanel.add(new cGridBag());
765
+ oe.toolboxPanel.add(new cGridBag());
766
+ oe.toolboxPanel.add(new cGridBag());
767
+ }
768
+
769
+ // EDIT panel
770
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ editButton.setToolTipText("Pin selection controls");
562772 editButton.addActionListener(this);
563773
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
566776 uneditButton.addActionListener(this);
567777
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
778
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
779
+ allParamsButton.setToolTipText("Show all controle");
570780 allParamsButton.addActionListener(this);
571781
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
782
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573783 clearPanelButton.setToolTipText("Clear edit panel");
574784 clearPanelButton.addActionListener(this);
575785
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
786
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577787 unselectButton.setToolTipText("Unselect");
578788 unselectButton.addActionListener(this);
579789
580
- commandsPanel.preferredHeight = 1;
790
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
791
+ flashSelectionButton.setToolTipText("Highlight selection");
792
+ flashSelectionButton.addActionListener(this);
581793
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
794
+ editCommandsPanel.preferredHeight = 1;
795
+
796
+ SetPinStates(false);
797
+// oe.treePanel.add(commandsPanel);
798
+// oe.treePanel.Return();
584799
585800 // oe.aConstraints.gridx += 1;
586801 // oe.aConstraints.weighty = 0;
....@@ -597,27 +812,12 @@
597812
598813 JScrollPane jSP;
599814 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
815
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
601816 ResetModel();
602817
603818 oe.treePanel.add(jSPPanel);
604819 oe.treePanel.Return();
605820
606
- cGridBag copyOptionsPanel = new cGridBag();
607
-
608
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
609
- colorCB.setToolTipText("Copy color when dropped");
610
- colorCB.addItemListener(this);
611
-
612
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
613
- materialCB.setToolTipText("Copy material when dropped");
614
- materialCB.addItemListener(this);
615
-
616
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
617
- textureCB.setToolTipText("Copy texture when dropped");
618
- textureCB.addItemListener(this);
619
-
620
- copyOptionsPanel.preferredHeight = 1;
621821 oe.treePanel.add(copyOptionsPanel);
622822 oe.treePanel.Return();
623823
....@@ -648,23 +848,43 @@
648848
649849 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
650850 {
851
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
852
+ colorCB.setToolTipText("Copy color when dropped");
853
+ colorCB.addItemListener(this);
854
+
855
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
856
+ materialCB.setToolTipText("Copy material when dropped");
857
+ materialCB.addItemListener(this);
858
+
859
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
860
+ textureCB.setToolTipText("Copy texture when dropped");
861
+ textureCB.addItemListener(this);
862
+
863
+ panel.Return();
864
+
651865 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
652866 boxCB.setToolTipText("Display bounding boxes");
653867 boxCB.addItemListener(this);
654868
655869 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
870
+ zoomBoxCB.setToolTipText("Display only for wheel");
657871 zoomBoxCB.addItemListener(this);
658872
659873 if (true) // Globals.ADVANCED)
660874 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- supportCB.addItemListener(this);
875
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
876
+// supportCB.setToolTipText("Enable rigging");
877
+// supportCB.addItemListener(this);
878
+
879
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
880
+ freezeCB.setToolTipText("Fast moving camera");
881
+ freezeCB.addItemListener(this);
664882
665883 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
666884 // localCB.addItemListener(this);
667885
886
+ panel.Return();
887
+
668888 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
669889 crowdCB.setToolTipText("Used for crowds");
670890 crowdCB.addItemListener(this);
....@@ -681,6 +901,8 @@
681901 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
682902 // speakerMocapCB.addItemListener(this);
683903
904
+ panel.Return();
905
+
684906 if (false)
685907 {
686908 // handled in scripts
....@@ -695,32 +917,72 @@
695917 //constraints.gridy += 1;
696918 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
697919 smoothfocusCB.addItemListener(this);
920
+ panel.Return();
698921 }
699922
700923 //constraints.gridx += 1;
701924 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
702925 // debugCB.addItemListener(this);
703926
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
704931 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
932
+ oeilCB.setToolTipText("Move camera when tracking");
705933 oeilCB.addItemListener(this);
706934
935
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
936
+ shadowCB.setToolTipText("When live compute shadows");
937
+ shadowCB.addItemListener(this);
938
+
939
+ panel.Return();
940
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
941
+ toggleTextureCB.setToolTipText("Load textures");
942
+ toggleTextureCB.addItemListener(this);
943
+
944
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
945
+ toggleSwitchCB.setToolTipText("Choose a single item");
946
+ toggleSwitchCB.addItemListener(this);
947
+
948
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
+ autosaveCB.setToolTipText("On structure change");
950
+ autosaveCB.addItemListener(this);
951
+
952
+ panel.Return();
953
+ if (Globals.ADVANCED)
954
+ {
707955 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708956 lookAtCB.setToolTipText("Look-at target");
709957 lookAtCB.addItemListener(this);
958
+ }
710959
711960 }
712961
713962 cGridBag fill = new cGridBag();
714
-
715963 fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
716968
717969 panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
718972
719973 }
720974
721975 void EditObject(Object3D obj)
722976 {
723977 cRadio radioButton = new cRadio(obj.name);
978
+
979
+ // June 2019. Patch to avoid bug with transparency.
980
+ radioButton.hadMaterial = obj.material != null;
981
+ if (!radioButton.hadMaterial)
982
+ {
983
+ obj.material = new cMaterial();
984
+ }
985
+
724986 radioButton.SetObject(obj);
725987 radioButton.layout = sevenButton;
726988 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -732,6 +994,8 @@
732994
733995 void SetupViews(ObjEditor oe)
734996 {
997
+ theFrame = this;
998
+
735999 oe.SetupViews();
7361000
7371001 System.out.println("SetupViews");
....@@ -740,23 +1004,28 @@
7401004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7411005 }
7421006
743
- JCheckBox liveCB;
744
- JCheckBox supportCB;
745
- JCheckBox localCB;
746
- JCheckBox crowdCB;
747
- JCheckBox smoothCB;
748
- JCheckBox fastCB;
749
- JCheckBox slowCB;
750
- JCheckBox boxCB;
751
- JCheckBox zoomBoxCB;
752
- JCheckBox trackCB;
753
- JCheckBox smoothfocusCB;
1007
+ cToggleButton liveCB;
1008
+ cCheckBox supportCB;
1009
+ cCheckBox localCB;
1010
+ cCheckBox crowdCB;
1011
+ cCheckBox smoothCB;
1012
+ cToggleButton fastCB;
1013
+ cCheckBox slowCB;
1014
+ cCheckBox boxCB;
1015
+ cCheckBox zoomBoxCB;
1016
+ cCheckBox freezeCB;
1017
+ //cToggleButton trackCB;
1018
+ cCheckBox trackCB;
1019
+ cCheckBox smoothfocusCB;
7541020 // JCheckBox speakerMocapCB;
755
- JCheckBox speakerCameraCB;
756
- JCheckBox speakerFocusCB;
757
- JCheckBox debugCB;
758
- JCheckBox oeilCB;
759
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
7601029
7611030 // static int COLOR = 1;
7621031 // static int MATERIAL = 2;
....@@ -764,9 +1033,9 @@
7641033
7651034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7661035
767
- JCheckBox colorCB;
768
- JCheckBox materialCB;
769
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
7701039
7711040 public void itemStateChanged(ItemEvent e)
7721041 {
....@@ -794,6 +1063,7 @@
7941063 } else if(e.getSource() == liveCB)
7951064 {
7961065 cameraView.ToggleLive();
1066
+ refreshContents(false);
7971067 }
7981068 else if(e.getSource() == supportCB)
7991069 {
....@@ -858,6 +1128,18 @@
8581128 {
8591129 cameraView.ToggleOeil();
8601130 }
1131
+ else if(e.getSource() == shadowCB)
1132
+ {
1133
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1134
+ }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
1139
+ else if(e.getSource() == autosaveCB)
1140
+ {
1141
+ Globals.SAVEONMAKE ^= true;
1142
+ }
8611143 else if(e.getSource() == lookAtCB)
8621144 {
8631145 cameraView.ToggleLookAt();
....@@ -874,7 +1156,8 @@
8741156
8751157 /**/
8761158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
877
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
8781161 if ((path == null) || (path.getPathCount() <= 1)) {
8791162 // We can't move the root node or an empty selection
8801163 return;
....@@ -937,8 +1220,6 @@
9371220 }
9381221 }
9391222
940
- String string = (String) object;
941
-
9421223 System.out.println("Transfer = " + object + "; drop : " + target);
9431224 // if( object instanceof java.io.File[])
9441225 // {
....@@ -946,6 +1227,8 @@
9461227 // objEditor.DropFile((java.io.File[]) object, true);
9471228 // return;
9481229 // }
1230
+
1231
+ String string = object.toString();
9491232
9501233 // File path for Mac and Windows
9511234 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -991,23 +1274,33 @@
9911274
9921275 assert target == objEditor.jTree;
9931276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
9941278 try {
995
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9961280 } catch (Exception e) {
9971281 System.out.println("destinationPath : " + destinationPath);
9981282 return;
9991283 }
10001284
1001
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
10021286 {
1287
+ Object3D child = (Object3D)group.selection.elementAt(i);
1288
+
1289
+ // Cannot move into itself
1290
+ if (child == destinationLeaf)
1291
+ return;
1292
+ }
1293
+
1294
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1295
+// {
10031296 loadClipboard(true);
10041297 objEditor.jTree.setSelectionPath(destinationPath);
10051298 pasteInto(false, false);
1006
- } else {
1007
- loadClipboard(false);
1008
- objEditor.jTree.setSelectionPath(destinationPath);
1009
- pasteInto(false, false); // true); // ???
1010
- }
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
10111304 }
10121305 public void dropActionChanged(DropTargetDragEvent dtde)
10131306 // Called if the user has modified the current drop gesture
....@@ -1112,22 +1405,30 @@
11121405 {
11131406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11141407 //heightFieldItem.addActionListener(this);
1115
- gridItem = menu.add(new MenuItem("Grid"));
1116
- gridItem.addActionListener(this);
1117
- rectoidItem = menu.add(new MenuItem("Box"));
1118
- rectoidItem.addActionListener(this);
1119
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1120
- ellipsoidItem.addActionListener(this);
1121
- coneItem = menu.add(new MenuItem("Cone"));
1122
- coneItem.addActionListener(this);
1123
- torusItem = menu.add(new MenuItem("Torus"));
1124
- torusItem.addActionListener(this);
1125
- superItem = menu.add(new MenuItem("Superellipsoid"));
1126
- superItem.addActionListener(this);
1408
+// gridItem = menu.add(new MenuItem("Grid"));
1409
+// gridItem.addActionListener(this);
1410
+// rectoidItem = menu.add(new MenuItem("Box"));
1411
+// rectoidItem.addActionListener(this);
1412
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1413
+// ellipsoidItem.addActionListener(this);
1414
+// coneItem = menu.add(new MenuItem("Cone"));
1415
+// coneItem.addActionListener(this);
1416
+// torusItem = menu.add(new MenuItem("Torus"));
1417
+// torusItem.addActionListener(this);
1418
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1419
+// superItem.addActionListener(this);
1420
+
1421
+ cameraItem = menu.add(new MenuItem("Camera"));
1422
+ cameraItem.addActionListener(this);
1423
+
1424
+ if (!Globals.ADVANCED)
1425
+ {
11271426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11281427 kleinItem.addActionListener(this);
1129
- particleItem = menu.add(new MenuItem("Particle system"));
1130
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
11311432 if (Globals.ADVANCED)
11321433 {
11331434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1153,15 +1454,15 @@
11531454 }
11541455 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11551456 bezierItem.addActionListener(this);
1156
- overlayItem = menu.add(new MenuItem("Overlay"));
1157
- overlayItem.addActionListener(this);
1158
- lightItem = menu.add(new MenuItem("Light"));
1159
- lightItem.addActionListener(this);
1457
+// overlayItem = menu.add(new MenuItem("Overlay"));
1458
+// overlayItem.addActionListener(this);
1459
+// lightItem = menu.add(new MenuItem("Light"));
1460
+// lightItem.addActionListener(this);
11601461 menu.add("-");
11611462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11621463 //superLoopItem.addActionListener(this);
1163
- loopItem = menu.add(new MenuItem("Loop"));
1164
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
11651466 doubleItem = menu.add(new MenuItem("Fork"));
11661467 doubleItem.addActionListener(this);
11671468 if (Globals.ADVANCED)
....@@ -1177,6 +1478,9 @@
11771478 animationItem.addItemListener(this);
11781479 animationItem.setState(Globals.ANIMATION);
11791480
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
1483
+
11801484 menu.add("-");
11811485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11821486 parseverticesItem.addActionListener(this);
....@@ -1189,6 +1493,8 @@
11891493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11901494 reduce34MorphItem.addActionListener(this);
11911495 menu.add("-");
1496
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1497
+ memoryItem.addActionListener(this);
11921498 menu.add(computeAOItem = new MenuItem("Compute AO"));
11931499 computeAOItem.addActionListener(this);
11941500
....@@ -1197,11 +1503,9 @@
11971503 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11981504 mirrorItem.addActionListener(this);
11991505 menu.add("-");
1200
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1201
- memoryItem.addActionListener(this);
12021506 menu.add(analyzeItem = new MenuItem("Analyze"));
12031507 analyzeItem.addActionListener(this);
1204
- menu.add(dumpItem = new MenuItem("Dump"));
1508
+ menu.add(dumpItem = new MenuItem("Print"));
12051509 dumpItem.addActionListener(this);
12061510 // menu.add(pathItem = new MenuItem("From-to path"));
12071511 // pathItem.addActionListener(this);
....@@ -1342,9 +1646,24 @@
13421646 shadow.material = new cMaterial(obj.material);
13431647 shadow.material.diffuse = 0.0001f;
13441648 shadow.material.specular = 0.0001f;
1649
+ //shadow.projectedVertices[1].x = 300;
13451650
13461651 makeSomething(shadow);
13471652 }
1653
+
1654
+ private void ClearUnpinned()
1655
+ {
1656
+ //for (Object3D obj : listUI)
1657
+ for (int i=listUI.size(); --i>=0;)
1658
+ {
1659
+ Object3D obj = listUI.elementAt(i);
1660
+ if (!obj.pinned)
1661
+ {
1662
+ obj.CloseUI();
1663
+ listUI.remove(i);
1664
+ }
1665
+ }
1666
+ }
13481667
13491668 /**
13501669 * applyExample
....@@ -1589,7 +1908,7 @@
15891908 {
15901909 ScreenFit();
15911910 } else
1592
- if (source == switchItem)
1911
+ if (source == switchViewItem)
15931912 {
15941913 cVector v1 = new cVector();
15951914 cVector v2 = new cVector();
....@@ -1598,11 +1917,11 @@
15981917 objEditor.cameraView.renderCamera.setAim(v2, v1);
15991918 objEditor.cameraView.repaint();
16001919 } else
1601
- if (source == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
16021921 {
16031922 makeSomething(new Box());
16041923 } else
1605
- if (source == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
16061925 {
16071926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16081927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1681,27 +2000,27 @@
16812000
16822001 makeSomething(obj);
16832002 } else
1684
- if (source == gridItem)
2003
+ if (source == gridItem || source == gridButton)
16852004 {
16862005 makeSomething(new Grid());
16872006 } else
1688
- if (source == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
16892008 {
16902009 makeSomething(new Sphere());
16912010 } else
1692
- if (source == coneItem)
2011
+ if (source == coneItem || source == coneButton)
16932012 {
16942013 makeSomething(new Cone());
16952014 } else
1696
- if (source == torusItem)
2015
+ if (source == torusItem || source == torusButton)
16972016 {
16982017 makeSomething(new Torus());
16992018 } else
1700
- if (source == superItem)
2019
+ if (source == superItem || source == superButton)
17012020 {
17022021 makeSomething(new Superellipsoid());
17032022 } else
1704
- if (source == kleinItem)
2023
+ if (source == kleinItem || source == kleinButton)
17052024 {
17062025 makeSomething(new Klein());
17072026 } else
....@@ -1721,7 +2040,7 @@
17212040 {
17222041 makeSomething(new BezierSurface());
17232042 } else
1724
- if (source == overlayItem)
2043
+ if (source == overlayItem || source == overlayButton)
17252044 {
17262045 /*
17272046 Object3D obj = new BezierSurface(5,8);
....@@ -1769,7 +2088,7 @@
17692088 s.setup();
17702089 makeSomething(s);
17712090 } else
1772
- if (source == lightItem)
2091
+ if (source == lightItem || source == lightButton)
17732092 {
17742093 makeSomething(new Light());
17752094 } else
....@@ -1819,30 +2138,30 @@
18192138
18202139 group(g);
18212140 } else
1822
- if (source == loopItem)
2141
+ if (source == loopItem || source == loopButton)
18232142 {
18242143 Composite csg = new GroupLeaf();
18252144 csg.count = 5;
18262145 group(csg);
1827
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
18282147 csg.addChild(child);
18292148 child.addChild(csg);
18302149 } else
18312150 if (source == doubleItem)
18322151 {
1833
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
18342153 csg.count = 5;
18352154 group(csg);
1836
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
18372156 csg.addChild(child);
18382157 child.addChild(csg);
1839
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
18402159 csg.addChild(child);
18412160 child.addChild(csg);
18422161 } else
18432162 if (source == tripleItem)
18442163 {
1845
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
18462165 csg.count = 4;
18472166 group(csg);
18482167 Composite child = new cGroup();
....@@ -1854,31 +2173,6 @@
18542173 child = new cGroup();
18552174 csg.addChild(child);
18562175 child.addChild(csg);
1857
- } else
1858
-
1859
- if (source == importGFDItem)
1860
- {
1861
- ImportGFD();
1862
- } else
1863
- if (source == importVRMLX3DItem)
1864
- {
1865
- ImportVRMLX3D();
1866
- } else
1867
- if (source == import3DSItem)
1868
- {
1869
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1870
- } else
1871
- if (source == importOBJItem)
1872
- {
1873
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1874
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1875
- browser.setVisible(true);
1876
- String filename = browser.getFile();
1877
- if (filename != null && filename.length() > 0)
1878
- {
1879
- String fullname = browser.getDirectory() + filename;
1880
- makeSomething(ReadOBJ(fullname), true);
1881
- }
18822176 } else
18832177 if (source == computeAOItem)
18842178 {
....@@ -1917,6 +2211,32 @@
19172211 {
19182212 DumpObject();
19192213 } else
2214
+ if (source == minButton)
2215
+ {
2216
+ Minimize();
2217
+ } else
2218
+ if (source == maxButton)
2219
+ {
2220
+ Maximize();
2221
+ } else
2222
+ if (source == fullButton)
2223
+ {
2224
+ ToggleFullScreen();
2225
+ } else
2226
+ if (source == undoButton)
2227
+ {
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
2230
+ } else
2231
+ if (source == redoButton)
2232
+ {
2233
+ Redo();
2234
+ } else
2235
+ if (source == saveButton)
2236
+ {
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
2239
+ } else
19202240 if (source == oneStepButton)
19212241 {
19222242 Globals.ONESTEP = true;
....@@ -1924,17 +2244,14 @@
19242244 } else
19252245 if (source == screenfitButton)
19262246 {
1927
- //Reload(lastConverter, lastFilename, true);
19282247 ScreenFit();
19292248 } else
19302249 if (source == screenfitpointButton)
19312250 {
1932
- //Reload(lastConverter, lastFilename, true);
19332251 ScreenFitPoint();
19342252 } else
19352253 if (source == snapobjectButton)
19362254 {
1937
- //Reload(lastConverter, lastFilename, true);
19382255 SnapObject();
19392256 } else
19402257 // if (event.getSource() == recompileButton)
....@@ -1970,6 +2287,14 @@
19702287 if (source == cutItem || source == clearButton)
19712288 {
19722289 loadClipboard(true);
2290
+ } else
2291
+ if (source == undoItem)
2292
+ {
2293
+ Undo();
2294
+ } else
2295
+ if (source == redoItem)
2296
+ {
2297
+ Redo();
19732298 } else
19742299 if (source == duplicateItem)
19752300 {
....@@ -2302,9 +2627,9 @@
23022627 {
23032628 ClearSelection(true);
23042629 } else
2305
- if (source == grabItem)
2630
+ if (source == grabItem || source == groupButton)
23062631 {
2307
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
23082633 } else
23092634 if (source == hideItem)
23102635 {
....@@ -2322,11 +2647,11 @@
23222647 {
23232648 makeSomething(new Camera());
23242649 } else
2325
- if (source == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
23262651 {
23272652 group(new Composite());
23282653 } else
2329
- if (source == randomItem)
2654
+ if (source == switchItem || source == switchButton)
23302655 {
23312656 RandomNode random = new RandomNode();
23322657 group(random);
....@@ -2428,7 +2753,7 @@
24282753 {
24292754 group(new cLinker());
24302755 } else
2431
- if (source == textureItem)
2756
+ if (source == textureItem || source == textureButton)
24322757 {
24332758 group(new TextureNode());
24342759 } else
....@@ -2448,17 +2773,30 @@
24482773 {
24492774 CastShadow(2);
24502775 } else
2451
- if (source == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
24522777 {
2453
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
24542780 for (int i=0; i<group.selection.size(); i++)
24552781 {
2456
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
24572787 }
24582788
2459
- ClearSelection(false);
2460
-
2461
- refreshContents();
2789
+ if (!hasRoot)
2790
+ {
2791
+ for (int i=0; i<group.selection.size(); i++)
2792
+ {
2793
+ Ungroup(group.selection.get(i));
2794
+ }
2795
+
2796
+ ClearSelection(false);
2797
+
2798
+ refreshContents();
2799
+ }
24622800 } else
24632801 if (source == genUVItem)
24642802 {
....@@ -2470,7 +2808,7 @@
24702808 } else
24712809 if (source == genNormalsMESHItem)
24722810 {
2473
- GenNormals(true); // TODO
2811
+ GenNormalsMESH();
24742812 } else
24752813 if (source == genNormalsORGANItem)
24762814 {
....@@ -2535,6 +2873,22 @@
25352873 if (source == unmarkleavesItem)
25362874 {
25372875 MarkLeaves(false);
2876
+ } else
2877
+ if (source == rewindleavesItem)
2878
+ {
2879
+ RewindLeaves(true);
2880
+ } else
2881
+ if (source == unrewindleavesItem)
2882
+ {
2883
+ RewindLeaves(false);
2884
+ } else
2885
+ if (source == randomleavesItem)
2886
+ {
2887
+ RandomLeaves(true);
2888
+ } else
2889
+ if (source == unrandomleavesItem)
2890
+ {
2891
+ RandomLeaves(false);
25382892 } else
25392893 if (source == flipVItem)
25402894 {
....@@ -2770,6 +3124,10 @@
27703124 if (source == twoButton)
27713125 {
27723126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
27733131 // bug
27743132 //gridPanel.setDividerLocation(1.0);
27753133 //bigPanel.setDividerLocation(0.0);
....@@ -2802,10 +3160,31 @@
28023160 bigThree.ClearUI();
28033161 bigThree.add(centralPanel);
28043162 bigThree.FlushUI();
3163
+
3164
+ cameraView.requestFocusInWindow();
3165
+
3166
+// refreshContents(true);
3167
+//
3168
+// try
3169
+// {
3170
+// java.awt.Robot bot = new java.awt.Robot();
3171
+// int mask = InputEvent.BUTTON1_MASK;
3172
+// bot.mouseMove(100, 100);
3173
+// bot.mousePress(mask);
3174
+// bot.mouseRelease(mask);
3175
+// }
3176
+// catch (Exception e)
3177
+// {
3178
+//
3179
+// }
3180
+
28053181 } else
28063182 if (source == threeButton)
28073183 {
28083184 radio.layout = threeButton;
3185
+
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
28093188
28103189 // bigThree.remove(scenePanel);
28113190 // bigThree.remove(centralPanel);
....@@ -2838,10 +3217,15 @@
28383217 bigThree.add(centralPanel);
28393218 bigThree.add(XYZPanel);
28403219 bigThree.FlushUI();
3220
+
3221
+ cameraView.requestFocusInWindow();
28413222 } else
28423223 if (source == fourButton)
28433224 {
28443225 radio.layout = fourButton;
3226
+
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
28453229
28463230 // bigThree.remove(scenePanel);
28473231 // bigThree.remove(centralPanel);
....@@ -2873,10 +3257,15 @@
28733257 bigThree.ClearUI();
28743258 bigThree.add(scenePanel);
28753259 bigThree.FlushUI();
3260
+
3261
+ cameraView.requestFocusInWindow();
28763262 } else
28773263 if (source == sixButton)
28783264 {
28793265 radio.layout = sixButton;
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
28803269
28813270 // bigThree.remove(scenePanel);
28823271 // bigThree.remove(centralPanel);
....@@ -2909,10 +3298,15 @@
29093298 bigThree.add(scenePanel);
29103299 bigThree.add(centralPanel);
29113300 bigThree.FlushUI();
3301
+
3302
+ cameraView.requestFocusInWindow();
29123303 } else
29133304 if (source == sevenButton)
29143305 {
29153306 radio.layout = sevenButton;
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
29163310
29173311 // bigThree.remove(scenePanel);
29183312 // bigThree.remove(centralPanel);
....@@ -2946,6 +3340,8 @@
29463340 bigThree.add(centralPanel);
29473341 bigThree.add(XYZPanel);
29483342 bigThree.FlushUI();
3343
+
3344
+ cameraView.requestFocusInWindow();
29493345 } else
29503346 if (source == rootButton)
29513347 {
....@@ -2957,6 +3353,7 @@
29573353 EditObject(obj);
29583354 }
29593355
3356
+ cameraView.requestFocusInWindow();
29603357 refreshContents(true);
29613358 } else
29623359 if (source == closeButton)
....@@ -2966,22 +3363,37 @@
29663363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29673364 {
29683365 ab = (cRadio)e.nextElement();
2969
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29703367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
29713374 buttonGroup.remove(ab);
29723375 radioPanel.remove(ab);
29733376
2974
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
29753379 // ab.GetObject().objectUI = null; // ?????????
29763380
29773381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29783382 break;
29793383 }
29803384 }
3385
+
3386
+ cameraView.requestFocusInWindow();
29813387 refreshContents(true);
29823388 } else
29833389 if (source == editItem || source == editButton)
29843390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
29853397 EditSelection(false);
29863398 } else
29873399 if (source == uneditButton)
....@@ -2991,10 +3403,11 @@
29913403 Object3D child = (Object3D)e.nextElement();
29923404 if(child.editWindow != null)
29933405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
29943407 child.CloseUI();
29953408 listUI.remove(child);
29963409
2997
- child.editWindow = null; // ???????????
3410
+ //child.editWindow = null; // ???????????
29983411 }
29993412 objEditor.ctrlPanel.FlushUI();
30003413 //objEditor.jTree.clearSelection();
....@@ -3007,6 +3420,7 @@
30073420 //copy.ClearUI();
30083421 for (Object3D obj : listUI)
30093422 {
3423
+ obj.pinned = false;
30103424 obj.CloseUI();
30113425 }
30123426 listUI.clear();
....@@ -3016,7 +3430,7 @@
30163430 {
30173431 assert(copy == group);
30183432
3019
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30203434
30213435 for (Object3D obj : listUI)
30223436 {
....@@ -3081,7 +3495,9 @@
30813495 sideView.object = group;
30823496 }
30833497
3084
-// fix "+" issue group.editWindow = this;
3498
+// fix "+" issue
3499
+ //group.editWindow = this;
3500
+ group.manipWindow = this;
30853501
30863502 /*
30873503 currentLayout = radio.layout;
....@@ -3089,13 +3505,33 @@
30893505 currentLayout = sevenButton;
30903506 */
30913507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
30923513 keepparent = group.parent;
30933514 // PARENT = NULL or not???
30943515 //group.parent = null; // ROOT
30953516 //group.attributes = -1;
30963517 ResetModel();
3518
+
3519
+ cameraView.requestFocusInWindow();
30973520 refreshContents(true);
3098
- }
3521
+ } else if (event.getSource() == editCameraItem)
3522
+ {
3523
+ cameraView.ProtectCamera();
3524
+ cameraView.repaint();
3525
+ return;
3526
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3527
+ {
3528
+ cameraView.RevertCamera();
3529
+ cameraView.repaint();
3530
+ return;
3531
+ // } else if (event.getSource() == textureButton)
3532
+ // {
3533
+ // return; // true;
3534
+ }
30993535 else
31003536 {
31013537 //return super.action(event, arg);
....@@ -3104,7 +3540,6 @@
31043540 }
31053541
31063542 boolean useclient = false;
3107
- cRadio radio;
31083543
31093544 void ToggleRoot()
31103545 {
....@@ -3343,7 +3778,8 @@
33433778
33443779 int size = obj.MemorySize();
33453780
3346
- System.err.println((size/1024) + " KB is the size of " + obj);
3781
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3782
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33473783 }
33483784 }
33493785 catch (Exception e)
....@@ -3424,6 +3860,13 @@
34243860 void GenNormals(boolean crease)
34253861 {
34263862 group.GenNormalsS(crease);
3863
+
3864
+ refreshContents();
3865
+ }
3866
+
3867
+ void GenNormalsMESH()
3868
+ {
3869
+ group.GenNormalsMeshS();
34273870
34283871 refreshContents();
34293872 }
....@@ -4051,6 +4494,18 @@
40514494 refreshContents();
40524495 }
40534496
4497
+ void RewindLeaves(boolean hide)
4498
+ {
4499
+ group.selection.RewindLeaves(hide);
4500
+ refreshContents();
4501
+ }
4502
+
4503
+ void RandomLeaves(boolean hide)
4504
+ {
4505
+ group.selection.RandomLeaves(hide);
4506
+ refreshContents();
4507
+ }
4508
+
40544509 void SetTexRes(int tr)
40554510 {
40564511 group.selection.SetTexRes(tr);
....@@ -4122,10 +4577,6 @@
41224577 // }
41234578 // }
41244579
4125
- static boolean allparams = true;
4126
-
4127
- static Vector<Object3D> listUI = new Vector<Object3D>();
4128
-
41294580 void EditSelection(boolean newWindow)
41304581 {
41314582 // aConstraints.gridy = 0;
....@@ -4133,7 +4584,7 @@
41334584 {
41344585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41354586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4136
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41374588
41384589 Object3D elem = (Object3D)group.selection.elementAt(i);
41394590 if(elem != group || !newWindow)
....@@ -4218,7 +4669,8 @@
42184669 //new Exception().printStackTrace();
42194670
42204671 freezemodel = true;
4221
-
4672
+ ClearUnpinned();
4673
+
42224674 /**/
42234675 //switch (event.id)
42244676 {
....@@ -4226,7 +4678,6 @@
42264678 //case 702: // Event.LIST_DESELECT
42274679 group.deselectAll();
42284680 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4229
- objEditor.ClearInfo(); // .GetMaterial());
42304681 if (tps != null)
42314682 {
42324683 for (int i=0; i < tps.length; i++)
....@@ -4235,10 +4686,8 @@
42354686
42364687 //if (child.parent != null)
42374688 //child.parent.addSelectee(child);
4689
+ objEditor.SetMaterial(child);
42384690 group.addSelectee(child);
4239
- objEditor.SetMaterial(child); // .GetMaterial());
4240
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4241
- System.err.println("info : " + child.GetPath());
42424691 }
42434692 }
42444693 // else
....@@ -4248,20 +4697,28 @@
42484697 // System.err.println("info : " + group.GetPath());
42494698 // }
42504699
4251
- objEditor.SetText(); // jan 2014
4252
-
4253
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4700
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42544701 CameraPane.flash = true;
42554702
4256
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4703
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42574704 // a camera
42584705 {
4259
- CameraPane.camerachangeframe = 0; // don't refuse it
4260
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4706
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4707
+ {
4708
+ CameraPane.camerachangeframe = 0; // don't refuse it
4709
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4710
+ }
42614711 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42624712 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42634713 }
42644714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
42654722 refreshContents();
42664723 //return true;
42674724 }
....@@ -4270,6 +4727,35 @@
42704727
42714728 freezemodel = false;
42724729 }
4730
+
4731
+ void SetPinStates(boolean enabled)
4732
+ {
4733
+ editButton.setEnabled(enabled);
4734
+ uneditButton.setEnabled(enabled);
4735
+ unselectButton.setEnabled(enabled);
4736
+ flashSelectionButton.setEnabled(enabled);
4737
+ }
4738
+
4739
+ void refreshContents(boolean cp)
4740
+ {
4741
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4743
+ {
4744
+ objEditor.ClearInfo(); // .GetMaterial());
4745
+
4746
+ for (int i=0; i < group.selection.Size(); i++)
4747
+ {
4748
+ Object3D child = (Object3D) group.selection.get(i);
4749
+
4750
+ objEditor.AddInfo(child, this, true);
4751
+ System.err.println("info : " + child.GetPath());
4752
+ }
4753
+
4754
+ objEditor.SetText(); // jan 2014
4755
+ }
4756
+
4757
+ super.refreshContents(cp);
4758
+ }
42734759
42744760 void linkSomething(Object3D thing)
42754761 {
....@@ -4341,6 +4827,7 @@
43414827 {
43424828 if (group.selection.isEmpty())
43434829 return;
4830
+
43444831 Grafreed.clipboardIsTempGroup = false;
43454832 Composite tGroup = null;
43464833 if (group.selection.size() > 0) // 1)
....@@ -4351,6 +4838,8 @@
43514838
43524839 if (cut)
43534840 {
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
43544843 //int indices[] = jList.getSelectedIndices();
43554844 //for (int i = indices.length - 1; i >= 0; i--)
43564845 //jList.remove(indices[i]);
....@@ -4440,8 +4929,10 @@
44404929 }
44414930
44424931 }
4932
+
44434933 if (Grafreed.clipboardIsTempGroup)
44444934 Grafreed.clipboard = tGroup;
4935
+
44454936 if (cut)
44464937 {
44474938 ResetModel();
....@@ -4451,6 +4942,10 @@
44514942
44524943 void paste(boolean expand)
44534944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
44544949 // if (GrafreeD.clipboard == null)
44554950 // return;
44564951 boolean first = true;
....@@ -4510,6 +5005,7 @@
45105005 Grafreed.clipboard.get(0).parent = keepparent;
45115006 }
45125007
5008
+ Globals.SAVEONMAKE = keep;
45135009 ResetModel();
45145010 refreshContents();
45155011 }
....@@ -4645,6 +5141,10 @@
46455141
46465142 void group(Object3D csg, boolean grab)
46475143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
46485148 if (//false) // why??
46495149 !group.selection.isEmpty())
46505150 {
....@@ -4758,10 +5258,15 @@
47585258 //node.add(csg);
47595259 //makeSomething(node);
47605260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
47615262 }
47625263
47635264 void Ungroup(Object3D g)
47645265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
47655270 if (g instanceof HiddenObject)
47665271 {
47675272 HiddenObject h = (HiddenObject) g;
....@@ -4778,6 +5283,7 @@
47785283 objEditor.makeSomething(g.get(i), false);
47795284 }
47805285 }
5286
+ Globals.SAVEONMAKE = keep;
47815287 }
47825288
47835289 void ungroup()
....@@ -4973,21 +5479,6 @@
49735479 }
49745480 */
49755481
4976
- void ImportGFD()
4977
- {
4978
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4979
- browser.show();
4980
- String filename = browser.getFile();
4981
- if (filename != null && filename.length() > 0)
4982
- {
4983
- String fullname = browser.getDirectory() + filename;
4984
-
4985
- //Object3D readobj =
4986
- objEditor.ReadGFD(fullname, objEditor);
4987
- //makeSomething(readobj);
4988
- }
4989
- }
4990
-
49915482 /*
49925483 public void Callback(Object obj)
49935484 {
....@@ -5011,23 +5502,6 @@
50115502 }
50125503 */
50135504
5014
- void ImportVRMLX3D()
5015
- {
5016
- if (Grafreed.standAlone)
5017
- {
5018
- /**/
5019
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5020
- browser.show();
5021
- String filename = browser.getFile();
5022
- if (filename != null && filename.length() > 0)
5023
- {
5024
- String fullname = browser.getDirectory() + filename;
5025
- LoadVRMLX3D(fullname);
5026
- }
5027
- /**/
5028
- }
5029
- }
5030
-
50315505 String GetFile(String dialogName)
50325506 {
50335507 if (Grafreed.standAlone)
....@@ -5098,7 +5572,28 @@
50985572 cButton clearpanelButton;
50995573 cButton unselectButton;
51005574
5575
+ cButton restoreCameraButton;
5576
+
5577
+ cButton saveButton;
51015578 cButton oneStepButton;
5579
+
5580
+ cButton groupButton;
5581
+ cButton ungroupButton;
5582
+ cButton compositeButton;
5583
+ cButton switchButton;
5584
+ cButton loopButton;
5585
+ cButton textureButton;
5586
+
5587
+ cButton gridButton;
5588
+ cButton boxButton;
5589
+ cButton sphereButton;
5590
+ cButton coneButton;
5591
+ cButton torusButton;
5592
+ cButton superButton;
5593
+ cButton kleinButton;
5594
+ cButton particlesButton;
5595
+ cButton overlayButton;
5596
+ cButton lightButton;
51025597
51035598 cButton screenfitButton;
51045599 cButton screenfitpointButton;
....@@ -5111,14 +5606,6 @@
51115606
51125607 cButton setsupportButton;
51135608
5114
- cButton twoButton;
5115
- cButton sixButton;
5116
- cButton threeButton;
5117
- cButton sevenButton;
5118
- cButton fourButton; // full panel
5119
- cButton oneButton; // full XYZ
5120
- //cButton currentLayout;
5121
-
51225609 //
51235610 //Composite
51245611 Object3D // to do !!
....@@ -5128,9 +5615,11 @@
51285615 //JTree jTree;
51295616 private MenuItem lookAtItem;
51305617 private MenuItem lookFromItem;
5131
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
51325619 private MenuItem cutItem;
5133
- private MenuItem duplicateItem;
5620
+ private MenuItem undoItem;
5621
+ private MenuItem redoItem;
5622
+ private JMenuItem duplicateItem;
51345623 private MenuItem cloneItem;
51355624 private MenuItem cloneSupportItem;
51365625 private MenuItem overwriteGeoItem;
....@@ -5193,6 +5682,10 @@
51935682 private MenuItem showleavesItem;
51945683 private MenuItem markleavesItem;
51955684 private MenuItem unmarkleavesItem;
5685
+ private MenuItem rewindleavesItem;
5686
+ private MenuItem unrewindleavesItem;
5687
+ private MenuItem randomleavesItem;
5688
+ private MenuItem unrandomleavesItem;
51965689
51975690 private MenuItem flipVItem;
51985691 private MenuItem unflipVItem;
....@@ -5214,7 +5707,7 @@
52145707 private MenuItem frontItem;
52155708 private MenuItem cameraItem;
52165709 private MenuItem compositeItem;
5217
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
52185711 private MenuItem physicsItem;
52195712 private MenuItem frameselectorItem;
52205713 private MenuItem scriptNodeItem;
....@@ -5276,11 +5769,6 @@
52765769 private MenuItem doubleItem;
52775770 private MenuItem tripleItem;
52785771
5279
- private MenuItem importGFDItem;
5280
- private MenuItem importVRMLX3DItem;
5281
- private MenuItem import3DSItem;
5282
- private MenuItem importOBJItem;
5283
-
52845772 private MenuItem computeAOItem;
52855773 private MenuItem recompileItem;
52865774 private MenuItem editScriptItem;
....@@ -5290,4 +5778,8 @@
52905778 private MenuItem analyzeItem;
52915779 private MenuItem dumpItem;
52925780 //boolean freezemodel = false;
5781
+
5782
+ Menu cameraMenu;
5783
+ MenuItem editCameraItem;
5784
+ MenuItem restoreCameraItem;
52935785 }