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);
....@@ -729,8 +991,11 @@
729991 buttonGroup.add(radioButton);
730992 radioButton.doClick();
731993 }
994
+
732995 void SetupViews(ObjEditor oe)
733996 {
997
+ theFrame = this;
998
+
734999 oe.SetupViews();
7351000
7361001 System.out.println("SetupViews");
....@@ -739,23 +1004,28 @@
7391004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7401005 }
7411006
742
- JCheckBox liveCB;
743
- JCheckBox supportCB;
744
- JCheckBox localCB;
745
- JCheckBox crowdCB;
746
- JCheckBox smoothCB;
747
- JCheckBox fastCB;
748
- JCheckBox slowCB;
749
- JCheckBox boxCB;
750
- JCheckBox zoomBoxCB;
751
- JCheckBox trackCB;
752
- 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;
7531020 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
7591029
7601030 // static int COLOR = 1;
7611031 // static int MATERIAL = 2;
....@@ -763,9 +1033,9 @@
7631033
7641034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7651035
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
7691039
7701040 public void itemStateChanged(ItemEvent e)
7711041 {
....@@ -793,6 +1063,7 @@
7931063 } else if(e.getSource() == liveCB)
7941064 {
7951065 cameraView.ToggleLive();
1066
+ refreshContents(false);
7961067 }
7971068 else if(e.getSource() == supportCB)
7981069 {
....@@ -857,6 +1128,18 @@
8571128 {
8581129 cameraView.ToggleOeil();
8591130 }
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
+ }
8601143 else if(e.getSource() == lookAtCB)
8611144 {
8621145 cameraView.ToggleLookAt();
....@@ -873,7 +1156,8 @@
8731156
8741157 /**/
8751158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
876
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
8771161 if ((path == null) || (path.getPathCount() <= 1)) {
8781162 // We can't move the root node or an empty selection
8791163 return;
....@@ -936,8 +1220,6 @@
9361220 }
9371221 }
9381222
939
- String string = (String) object;
940
-
9411223 System.out.println("Transfer = " + object + "; drop : " + target);
9421224 // if( object instanceof java.io.File[])
9431225 // {
....@@ -945,6 +1227,8 @@
9451227 // objEditor.DropFile((java.io.File[]) object, true);
9461228 // return;
9471229 // }
1230
+
1231
+ String string = object.toString();
9481232
9491233 // File path for Mac and Windows
9501234 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -990,23 +1274,33 @@
9901274
9911275 assert target == objEditor.jTree;
9921276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
9931278 try {
994
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9951280 } catch (Exception e) {
9961281 System.out.println("destinationPath : " + destinationPath);
9971282 return;
9981283 }
9991284
1000
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
10011286 {
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
+// {
10021296 loadClipboard(true);
10031297 objEditor.jTree.setSelectionPath(destinationPath);
10041298 pasteInto(false, false);
1005
- } else {
1006
- loadClipboard(false);
1007
- objEditor.jTree.setSelectionPath(destinationPath);
1008
- pasteInto(false, false); // true); // ???
1009
- }
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
10101304 }
10111305 public void dropActionChanged(DropTargetDragEvent dtde)
10121306 // Called if the user has modified the current drop gesture
....@@ -1111,22 +1405,30 @@
11111405 {
11121406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11131407 //heightFieldItem.addActionListener(this);
1114
- gridItem = menu.add(new MenuItem("Grid"));
1115
- gridItem.addActionListener(this);
1116
- rectoidItem = menu.add(new MenuItem("Box"));
1117
- rectoidItem.addActionListener(this);
1118
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1119
- ellipsoidItem.addActionListener(this);
1120
- coneItem = menu.add(new MenuItem("Cone"));
1121
- coneItem.addActionListener(this);
1122
- torusItem = menu.add(new MenuItem("Torus"));
1123
- torusItem.addActionListener(this);
1124
- superItem = menu.add(new MenuItem("Superellipsoid"));
1125
- 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
+ {
11261426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11271427 kleinItem.addActionListener(this);
1128
- particleItem = menu.add(new MenuItem("Particle system"));
1129
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
11301432 if (Globals.ADVANCED)
11311433 {
11321434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1152,15 +1454,15 @@
11521454 }
11531455 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11541456 bezierItem.addActionListener(this);
1155
- overlayItem = menu.add(new MenuItem("Overlay"));
1156
- overlayItem.addActionListener(this);
1157
- lightItem = menu.add(new MenuItem("Light"));
1158
- 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);
11591461 menu.add("-");
11601462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11611463 //superLoopItem.addActionListener(this);
1162
- loopItem = menu.add(new MenuItem("Loop"));
1163
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
11641466 doubleItem = menu.add(new MenuItem("Fork"));
11651467 doubleItem.addActionListener(this);
11661468 if (Globals.ADVANCED)
....@@ -1176,6 +1478,9 @@
11761478 animationItem.addItemListener(this);
11771479 animationItem.setState(Globals.ANIMATION);
11781480
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
1483
+
11791484 menu.add("-");
11801485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11811486 parseverticesItem.addActionListener(this);
....@@ -1188,6 +1493,8 @@
11881493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11891494 reduce34MorphItem.addActionListener(this);
11901495 menu.add("-");
1496
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1497
+ memoryItem.addActionListener(this);
11911498 menu.add(computeAOItem = new MenuItem("Compute AO"));
11921499 computeAOItem.addActionListener(this);
11931500
....@@ -1196,11 +1503,9 @@
11961503 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11971504 mirrorItem.addActionListener(this);
11981505 menu.add("-");
1199
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1200
- memoryItem.addActionListener(this);
12011506 menu.add(analyzeItem = new MenuItem("Analyze"));
12021507 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1508
+ menu.add(dumpItem = new MenuItem("Print"));
12041509 dumpItem.addActionListener(this);
12051510 // menu.add(pathItem = new MenuItem("From-to path"));
12061511 // pathItem.addActionListener(this);
....@@ -1341,9 +1646,24 @@
13411646 shadow.material = new cMaterial(obj.material);
13421647 shadow.material.diffuse = 0.0001f;
13431648 shadow.material.specular = 0.0001f;
1649
+ //shadow.projectedVertices[1].x = 300;
13441650
13451651 makeSomething(shadow);
13461652 }
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
+ }
13471667
13481668 /**
13491669 * applyExample
....@@ -1588,7 +1908,7 @@
15881908 {
15891909 ScreenFit();
15901910 } else
1591
- if (source == switchItem)
1911
+ if (source == switchViewItem)
15921912 {
15931913 cVector v1 = new cVector();
15941914 cVector v2 = new cVector();
....@@ -1597,11 +1917,11 @@
15971917 objEditor.cameraView.renderCamera.setAim(v2, v1);
15981918 objEditor.cameraView.repaint();
15991919 } else
1600
- if (source == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
16011921 {
16021922 makeSomething(new Box());
16031923 } else
1604
- if (source == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
16051925 {
16061926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16071927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1680,27 +2000,27 @@
16802000
16812001 makeSomething(obj);
16822002 } else
1683
- if (source == gridItem)
2003
+ if (source == gridItem || source == gridButton)
16842004 {
16852005 makeSomething(new Grid());
16862006 } else
1687
- if (source == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
16882008 {
16892009 makeSomething(new Sphere());
16902010 } else
1691
- if (source == coneItem)
2011
+ if (source == coneItem || source == coneButton)
16922012 {
16932013 makeSomething(new Cone());
16942014 } else
1695
- if (source == torusItem)
2015
+ if (source == torusItem || source == torusButton)
16962016 {
16972017 makeSomething(new Torus());
16982018 } else
1699
- if (source == superItem)
2019
+ if (source == superItem || source == superButton)
17002020 {
17012021 makeSomething(new Superellipsoid());
17022022 } else
1703
- if (source == kleinItem)
2023
+ if (source == kleinItem || source == kleinButton)
17042024 {
17052025 makeSomething(new Klein());
17062026 } else
....@@ -1720,7 +2040,7 @@
17202040 {
17212041 makeSomething(new BezierSurface());
17222042 } else
1723
- if (source == overlayItem)
2043
+ if (source == overlayItem || source == overlayButton)
17242044 {
17252045 /*
17262046 Object3D obj = new BezierSurface(5,8);
....@@ -1768,7 +2088,7 @@
17682088 s.setup();
17692089 makeSomething(s);
17702090 } else
1771
- if (source == lightItem)
2091
+ if (source == lightItem || source == lightButton)
17722092 {
17732093 makeSomething(new Light());
17742094 } else
....@@ -1818,30 +2138,30 @@
18182138
18192139 group(g);
18202140 } else
1821
- if (source == loopItem)
2141
+ if (source == loopItem || source == loopButton)
18222142 {
18232143 Composite csg = new GroupLeaf();
18242144 csg.count = 5;
18252145 group(csg);
1826
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
18272147 csg.addChild(child);
18282148 child.addChild(csg);
18292149 } else
18302150 if (source == doubleItem)
18312151 {
1832
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
18332153 csg.count = 5;
18342154 group(csg);
1835
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
18362156 csg.addChild(child);
18372157 child.addChild(csg);
1838
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
18392159 csg.addChild(child);
18402160 child.addChild(csg);
18412161 } else
18422162 if (source == tripleItem)
18432163 {
1844
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
18452165 csg.count = 4;
18462166 group(csg);
18472167 Composite child = new cGroup();
....@@ -1853,31 +2173,6 @@
18532173 child = new cGroup();
18542174 csg.addChild(child);
18552175 child.addChild(csg);
1856
- } else
1857
-
1858
- if (source == importGFDItem)
1859
- {
1860
- ImportGFD();
1861
- } else
1862
- if (source == importVRMLX3DItem)
1863
- {
1864
- ImportVRMLX3D();
1865
- } else
1866
- if (source == import3DSItem)
1867
- {
1868
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1869
- } else
1870
- if (source == importOBJItem)
1871
- {
1872
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1874
- browser.setVisible(true);
1875
- String filename = browser.getFile();
1876
- if (filename != null && filename.length() > 0)
1877
- {
1878
- String fullname = browser.getDirectory() + filename;
1879
- makeSomething(ReadOBJ(fullname), true);
1880
- }
18812176 } else
18822177 if (source == computeAOItem)
18832178 {
....@@ -1916,6 +2211,32 @@
19162211 {
19172212 DumpObject();
19182213 } 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
19192240 if (source == oneStepButton)
19202241 {
19212242 Globals.ONESTEP = true;
....@@ -1923,17 +2244,14 @@
19232244 } else
19242245 if (source == screenfitButton)
19252246 {
1926
- //Reload(lastConverter, lastFilename, true);
19272247 ScreenFit();
19282248 } else
19292249 if (source == screenfitpointButton)
19302250 {
1931
- //Reload(lastConverter, lastFilename, true);
19322251 ScreenFitPoint();
19332252 } else
19342253 if (source == snapobjectButton)
19352254 {
1936
- //Reload(lastConverter, lastFilename, true);
19372255 SnapObject();
19382256 } else
19392257 // if (event.getSource() == recompileButton)
....@@ -1969,6 +2287,14 @@
19692287 if (source == cutItem || source == clearButton)
19702288 {
19712289 loadClipboard(true);
2290
+ } else
2291
+ if (source == undoItem)
2292
+ {
2293
+ Undo();
2294
+ } else
2295
+ if (source == redoItem)
2296
+ {
2297
+ Redo();
19722298 } else
19732299 if (source == duplicateItem)
19742300 {
....@@ -2301,9 +2627,9 @@
23012627 {
23022628 ClearSelection(true);
23032629 } else
2304
- if (source == grabItem)
2630
+ if (source == grabItem || source == groupButton)
23052631 {
2306
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
23072633 } else
23082634 if (source == hideItem)
23092635 {
....@@ -2321,11 +2647,11 @@
23212647 {
23222648 makeSomething(new Camera());
23232649 } else
2324
- if (source == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
23252651 {
23262652 group(new Composite());
23272653 } else
2328
- if (source == randomItem)
2654
+ if (source == switchItem || source == switchButton)
23292655 {
23302656 RandomNode random = new RandomNode();
23312657 group(random);
....@@ -2427,7 +2753,7 @@
24272753 {
24282754 group(new cLinker());
24292755 } else
2430
- if (source == textureItem)
2756
+ if (source == textureItem || source == textureButton)
24312757 {
24322758 group(new TextureNode());
24332759 } else
....@@ -2447,17 +2773,30 @@
24472773 {
24482774 CastShadow(2);
24492775 } else
2450
- if (source == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
24512777 {
2452
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
24532780 for (int i=0; i<group.selection.size(); i++)
24542781 {
2455
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
24562787 }
24572788
2458
- ClearSelection(false);
2459
-
2460
- 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
+ }
24612800 } else
24622801 if (source == genUVItem)
24632802 {
....@@ -2469,7 +2808,7 @@
24692808 } else
24702809 if (source == genNormalsMESHItem)
24712810 {
2472
- GenNormals(true); // TODO
2811
+ GenNormalsMESH();
24732812 } else
24742813 if (source == genNormalsORGANItem)
24752814 {
....@@ -2534,6 +2873,22 @@
25342873 if (source == unmarkleavesItem)
25352874 {
25362875 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);
25372892 } else
25382893 if (source == flipVItem)
25392894 {
....@@ -2769,6 +3124,10 @@
27693124 if (source == twoButton)
27703125 {
27713126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
27723131 // bug
27733132 //gridPanel.setDividerLocation(1.0);
27743133 //bigPanel.setDividerLocation(0.0);
....@@ -2801,10 +3160,31 @@
28013160 bigThree.ClearUI();
28023161 bigThree.add(centralPanel);
28033162 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
+
28043181 } else
28053182 if (source == threeButton)
28063183 {
28073184 radio.layout = threeButton;
3185
+
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
28083188
28093189 // bigThree.remove(scenePanel);
28103190 // bigThree.remove(centralPanel);
....@@ -2837,10 +3217,15 @@
28373217 bigThree.add(centralPanel);
28383218 bigThree.add(XYZPanel);
28393219 bigThree.FlushUI();
3220
+
3221
+ cameraView.requestFocusInWindow();
28403222 } else
28413223 if (source == fourButton)
28423224 {
28433225 radio.layout = fourButton;
3226
+
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
28443229
28453230 // bigThree.remove(scenePanel);
28463231 // bigThree.remove(centralPanel);
....@@ -2872,10 +3257,15 @@
28723257 bigThree.ClearUI();
28733258 bigThree.add(scenePanel);
28743259 bigThree.FlushUI();
3260
+
3261
+ cameraView.requestFocusInWindow();
28753262 } else
28763263 if (source == sixButton)
28773264 {
28783265 radio.layout = sixButton;
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
28793269
28803270 // bigThree.remove(scenePanel);
28813271 // bigThree.remove(centralPanel);
....@@ -2908,10 +3298,15 @@
29083298 bigThree.add(scenePanel);
29093299 bigThree.add(centralPanel);
29103300 bigThree.FlushUI();
3301
+
3302
+ cameraView.requestFocusInWindow();
29113303 } else
29123304 if (source == sevenButton)
29133305 {
29143306 radio.layout = sevenButton;
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
29153310
29163311 // bigThree.remove(scenePanel);
29173312 // bigThree.remove(centralPanel);
....@@ -2945,6 +3340,8 @@
29453340 bigThree.add(centralPanel);
29463341 bigThree.add(XYZPanel);
29473342 bigThree.FlushUI();
3343
+
3344
+ cameraView.requestFocusInWindow();
29483345 } else
29493346 if (source == rootButton)
29503347 {
....@@ -2956,6 +3353,7 @@
29563353 EditObject(obj);
29573354 }
29583355
3356
+ cameraView.requestFocusInWindow();
29593357 refreshContents(true);
29603358 } else
29613359 if (source == closeButton)
....@@ -2965,22 +3363,37 @@
29653363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663364 {
29673365 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
29703374 buttonGroup.remove(ab);
29713375 radioPanel.remove(ab);
29723376
2973
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
29743379 // ab.GetObject().objectUI = null; // ?????????
29753380
29763381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773382 break;
29783383 }
29793384 }
3385
+
3386
+ cameraView.requestFocusInWindow();
29803387 refreshContents(true);
29813388 } else
29823389 if (source == editItem || source == editButton)
29833390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
29843397 EditSelection(false);
29853398 } else
29863399 if (source == uneditButton)
....@@ -2990,10 +3403,11 @@
29903403 Object3D child = (Object3D)e.nextElement();
29913404 if(child.editWindow != null)
29923405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
29933407 child.CloseUI();
29943408 listUI.remove(child);
29953409
2996
- child.editWindow = null; // ???????????
3410
+ //child.editWindow = null; // ???????????
29973411 }
29983412 objEditor.ctrlPanel.FlushUI();
29993413 //objEditor.jTree.clearSelection();
....@@ -3006,6 +3420,7 @@
30063420 //copy.ClearUI();
30073421 for (Object3D obj : listUI)
30083422 {
3423
+ obj.pinned = false;
30093424 obj.CloseUI();
30103425 }
30113426 listUI.clear();
....@@ -3015,7 +3430,7 @@
30153430 {
30163431 assert(copy == group);
30173432
3018
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30193434
30203435 for (Object3D obj : listUI)
30213436 {
....@@ -3079,20 +3494,44 @@
30793494 frontView.object = group;
30803495 sideView.object = group;
30813496 }
3082
- group.editWindow = this;
3497
+
3498
+// fix "+" issue
3499
+ //group.editWindow = this;
3500
+ group.manipWindow = this;
3501
+
30833502 /*
30843503 currentLayout = radio.layout;
30853504 if (currentLayout == null)
30863505 currentLayout = sevenButton;
30873506 */
30883507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
30893513 keepparent = group.parent;
30903514 // PARENT = NULL or not???
30913515 //group.parent = null; // ROOT
30923516 //group.attributes = -1;
30933517 ResetModel();
3518
+
3519
+ cameraView.requestFocusInWindow();
30943520 refreshContents(true);
3095
- }
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
+ }
30963535 else
30973536 {
30983537 //return super.action(event, arg);
....@@ -3101,7 +3540,6 @@
31013540 }
31023541
31033542 boolean useclient = false;
3104
- cRadio radio;
31053543
31063544 void ToggleRoot()
31073545 {
....@@ -3340,7 +3778,8 @@
33403778
33413779 int size = obj.MemorySize();
33423780
3343
- 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)");
33443783 }
33453784 }
33463785 catch (Exception e)
....@@ -3421,6 +3860,13 @@
34213860 void GenNormals(boolean crease)
34223861 {
34233862 group.GenNormalsS(crease);
3863
+
3864
+ refreshContents();
3865
+ }
3866
+
3867
+ void GenNormalsMESH()
3868
+ {
3869
+ group.GenNormalsMeshS();
34243870
34253871 refreshContents();
34263872 }
....@@ -4048,6 +4494,18 @@
40484494 refreshContents();
40494495 }
40504496
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
+
40514509 void SetTexRes(int tr)
40524510 {
40534511 group.selection.SetTexRes(tr);
....@@ -4119,10 +4577,6 @@
41194577 // }
41204578 // }
41214579
4122
- static boolean allparams = true;
4123
-
4124
- static Vector<Object3D> listUI = new Vector<Object3D>();
4125
-
41264580 void EditSelection(boolean newWindow)
41274581 {
41284582 // aConstraints.gridy = 0;
....@@ -4130,10 +4584,10 @@
41304584 {
41314585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41324586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4133
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41344588
41354589 Object3D elem = (Object3D)group.selection.elementAt(i);
4136
- if(elem != group)
4590
+ if(elem != group || !newWindow)
41374591 {
41384592 // if (!(elem instanceof Composite))
41394593 // newWindow = false;
....@@ -4215,7 +4669,8 @@
42154669 //new Exception().printStackTrace();
42164670
42174671 freezemodel = true;
4218
-
4672
+ ClearUnpinned();
4673
+
42194674 /**/
42204675 //switch (event.id)
42214676 {
....@@ -4223,7 +4678,6 @@
42234678 //case 702: // Event.LIST_DESELECT
42244679 group.deselectAll();
42254680 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4226
- objEditor.ClearInfo(); // .GetMaterial());
42274681 if (tps != null)
42284682 {
42294683 for (int i=0; i < tps.length; i++)
....@@ -4232,10 +4686,8 @@
42324686
42334687 //if (child.parent != null)
42344688 //child.parent.addSelectee(child);
4689
+ objEditor.SetMaterial(child);
42354690 group.addSelectee(child);
4236
- objEditor.SetMaterial(child); // .GetMaterial());
4237
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4238
- System.err.println("info : " + child.GetPath());
42394691 }
42404692 }
42414693 // else
....@@ -4245,20 +4697,28 @@
42454697 // System.err.println("info : " + group.GetPath());
42464698 // }
42474699
4248
- objEditor.SetText(); // jan 2014
4249
-
4250
- 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))
42514701 CameraPane.flash = true;
42524702
4253
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4703
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42544704 // a camera
42554705 {
4256
- CameraPane.camerachangeframe = 0; // don't refuse it
4257
- 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
+ }
42584711 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42594712 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42604713 }
42614714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
42624722 refreshContents();
42634723 //return true;
42644724 }
....@@ -4267,6 +4727,35 @@
42674727
42684728 freezemodel = false;
42694729 }
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
+ }
42704759
42714760 void linkSomething(Object3D thing)
42724761 {
....@@ -4338,6 +4827,7 @@
43384827 {
43394828 if (group.selection.isEmpty())
43404829 return;
4830
+
43414831 Grafreed.clipboardIsTempGroup = false;
43424832 Composite tGroup = null;
43434833 if (group.selection.size() > 0) // 1)
....@@ -4348,6 +4838,8 @@
43484838
43494839 if (cut)
43504840 {
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
43514843 //int indices[] = jList.getSelectedIndices();
43524844 //for (int i = indices.length - 1; i >= 0; i--)
43534845 //jList.remove(indices[i]);
....@@ -4437,8 +4929,10 @@
44374929 }
44384930
44394931 }
4932
+
44404933 if (Grafreed.clipboardIsTempGroup)
44414934 Grafreed.clipboard = tGroup;
4935
+
44424936 if (cut)
44434937 {
44444938 ResetModel();
....@@ -4448,6 +4942,10 @@
44484942
44494943 void paste(boolean expand)
44504944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
44514949 // if (GrafreeD.clipboard == null)
44524950 // return;
44534951 boolean first = true;
....@@ -4507,6 +5005,7 @@
45075005 Grafreed.clipboard.get(0).parent = keepparent;
45085006 }
45095007
5008
+ Globals.SAVEONMAKE = keep;
45105009 ResetModel();
45115010 refreshContents();
45125011 }
....@@ -4642,6 +5141,10 @@
46425141
46435142 void group(Object3D csg, boolean grab)
46445143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
46455148 if (//false) // why??
46465149 !group.selection.isEmpty())
46475150 {
....@@ -4755,10 +5258,15 @@
47555258 //node.add(csg);
47565259 //makeSomething(node);
47575260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
47585262 }
47595263
47605264 void Ungroup(Object3D g)
47615265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
47625270 if (g instanceof HiddenObject)
47635271 {
47645272 HiddenObject h = (HiddenObject) g;
....@@ -4775,6 +5283,7 @@
47755283 objEditor.makeSomething(g.get(i), false);
47765284 }
47775285 }
5286
+ Globals.SAVEONMAKE = keep;
47785287 }
47795288
47805289 void ungroup()
....@@ -4970,21 +5479,6 @@
49705479 }
49715480 */
49725481
4973
- void ImportGFD()
4974
- {
4975
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4976
- browser.show();
4977
- String filename = browser.getFile();
4978
- if (filename != null && filename.length() > 0)
4979
- {
4980
- String fullname = browser.getDirectory() + filename;
4981
-
4982
- //Object3D readobj =
4983
- objEditor.ReadGFD(fullname, objEditor);
4984
- //makeSomething(readobj);
4985
- }
4986
- }
4987
-
49885482 /*
49895483 public void Callback(Object obj)
49905484 {
....@@ -5008,23 +5502,6 @@
50085502 }
50095503 */
50105504
5011
- void ImportVRMLX3D()
5012
- {
5013
- if (Grafreed.standAlone)
5014
- {
5015
- /**/
5016
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5017
- browser.show();
5018
- String filename = browser.getFile();
5019
- if (filename != null && filename.length() > 0)
5020
- {
5021
- String fullname = browser.getDirectory() + filename;
5022
- LoadVRMLX3D(fullname);
5023
- }
5024
- /**/
5025
- }
5026
- }
5027
-
50285505 String GetFile(String dialogName)
50295506 {
50305507 if (Grafreed.standAlone)
....@@ -5095,7 +5572,28 @@
50955572 cButton clearpanelButton;
50965573 cButton unselectButton;
50975574
5575
+ cButton restoreCameraButton;
5576
+
5577
+ cButton saveButton;
50985578 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;
50995597
51005598 cButton screenfitButton;
51015599 cButton screenfitpointButton;
....@@ -5108,14 +5606,6 @@
51085606
51095607 cButton setsupportButton;
51105608
5111
- cButton twoButton;
5112
- cButton sixButton;
5113
- cButton threeButton;
5114
- cButton sevenButton;
5115
- cButton fourButton; // full panel
5116
- cButton oneButton; // full XYZ
5117
- //cButton currentLayout;
5118
-
51195609 //
51205610 //Composite
51215611 Object3D // to do !!
....@@ -5125,9 +5615,11 @@
51255615 //JTree jTree;
51265616 private MenuItem lookAtItem;
51275617 private MenuItem lookFromItem;
5128
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
51295619 private MenuItem cutItem;
5130
- private MenuItem duplicateItem;
5620
+ private MenuItem undoItem;
5621
+ private MenuItem redoItem;
5622
+ private JMenuItem duplicateItem;
51315623 private MenuItem cloneItem;
51325624 private MenuItem cloneSupportItem;
51335625 private MenuItem overwriteGeoItem;
....@@ -5190,6 +5682,10 @@
51905682 private MenuItem showleavesItem;
51915683 private MenuItem markleavesItem;
51925684 private MenuItem unmarkleavesItem;
5685
+ private MenuItem rewindleavesItem;
5686
+ private MenuItem unrewindleavesItem;
5687
+ private MenuItem randomleavesItem;
5688
+ private MenuItem unrandomleavesItem;
51935689
51945690 private MenuItem flipVItem;
51955691 private MenuItem unflipVItem;
....@@ -5211,7 +5707,7 @@
52115707 private MenuItem frontItem;
52125708 private MenuItem cameraItem;
52135709 private MenuItem compositeItem;
5214
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
52155711 private MenuItem physicsItem;
52165712 private MenuItem frameselectorItem;
52175713 private MenuItem scriptNodeItem;
....@@ -5273,11 +5769,6 @@
52735769 private MenuItem doubleItem;
52745770 private MenuItem tripleItem;
52755771
5276
- private MenuItem importGFDItem;
5277
- private MenuItem importVRMLX3DItem;
5278
- private MenuItem import3DSItem;
5279
- private MenuItem importOBJItem;
5280
-
52815772 private MenuItem computeAOItem;
52825773 private MenuItem recompileItem;
52835774 private MenuItem editScriptItem;
....@@ -5287,4 +5778,8 @@
52875778 private MenuItem analyzeItem;
52885779 private MenuItem dumpItem;
52895780 //boolean freezemodel = false;
5781
+
5782
+ Menu cameraMenu;
5783
+ MenuItem editCameraItem;
5784
+ MenuItem restoreCameraItem;
52905785 }