Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
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.REPLACEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.REPLACEONMAKE;
90
+ Globals.REPLACEONMAKE = 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.REPLACEONMAKE = 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,25 @@
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
547
+
463548 void SetupUI2(ObjEditor oe)
464549 {
550
+ // June 2019
551
+ if (oe == null)
552
+ {
553
+ //super.SetupUI2(this);
554
+ //return;
555
+ }
556
+
557
+ if (copy != group)
558
+ {
559
+ //super.SetupUI2(this);
560
+ }
561
+
465562 //new Exception().printStackTrace();
466563
467564 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +587,79 @@
490587 oe.radioPanel.add(dummyButton);
491588 oe.buttonGroup.add(dummyButton);
492589 */
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
593
+
493594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494595
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
596
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ //minButton.setToolTipText("Minimize window");
598
+ //minButton.addActionListener(this);
599
+
600
+ if (Globals.ADVANCED)
601
+ {
602
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ maxButton.setToolTipText("Maximize window");
604
+ maxButton.addActionListener(this);
605
+ }
606
+
607
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ fullButton.setToolTipText("Full-screen window");
609
+ fullButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ screenfitButton.setToolTipText("Screen fit");
613
+ screenfitButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ restoreCameraButton.setToolTipText("Restore viewpoint");
617
+ restoreCameraButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
621
+ saveButton.addActionListener(this);
622
+
623
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ undoButton.setToolTipText("Previous version");
625
+ undoButton.addActionListener(this);
626
+ undoButton.setEnabled(false);
627
+
628
+ cGridBag updown = new cGridBag().setVertical(true);
629
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreButton.setToolTipText("Restore current");
631
+ restoreButton.addActionListener(this);
632
+ restoreButton.setEnabled(false);
633
+
634
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ replaceButton.setToolTipText("Replace current");
636
+ replaceButton.addActionListener(this);
637
+ replaceButton.setEnabled(false);
638
+
639
+ copyOptionsPanel.add(updown);
640
+
641
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ redoButton.setToolTipText("Next version");
643
+ redoButton.addActionListener(this);
644
+ redoButton.setEnabled(false);
645
+
646
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
496647 liveCB.setToolTipText("Enable animation");
497648 liveCB.addItemListener(this);
498649
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500651 oneStepButton.setToolTipText("Animate one step forward");
501652 oneStepButton.addActionListener(this);
502653
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504655 fastCB.setToolTipText("Fast mode");
505656 fastCB.addItemListener(this);
506657
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);
658
+ //oe.toolboxPanel.Return();
659
+
660
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
661
+// trackCB.setToolTipText("Enable tracking");
662
+// trackCB.addItemListener(this);
514663
515664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516665 // screenfitpointButton.addActionListener(this);
....@@ -522,65 +671,145 @@
522671 snapobjectButton.setToolTipText("Snap Object");
523672 }
524673
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528675
529
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
-
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532677 twoButton.setToolTipText("Show center view only");
533678 twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ this.fullscreenLayout = twoButton;
680
+
681
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535682 fourButton.addActionListener(this);
536683 fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538685 sixButton.setToolTipText("2-column layout left");
539686 sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541688 threeButton.setToolTipText("2-column layout right");
542689 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544691 sevenButton.setToolTipText("3-column layout");
545692 sevenButton.addActionListener(this);
546693 //
547694
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549696 rootButton.setToolTipText("Edit selection in new tab");
550697 rootButton.addActionListener(this);
551698
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553700 closeButton.setToolTipText("Close tab");
554701 closeButton.addActionListener(this);
555702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
556703 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
704
+
705
+ // INSERT
706
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ gridButton.setToolTipText("Create grid");
708
+ gridButton.addActionListener(this);
709
+
710
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ boxButton.setToolTipText("Create box");
712
+ boxButton.addActionListener(this);
713
+
714
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ sphereButton.setToolTipText("Create sphere");
716
+ sphereButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ coneButton.setToolTipText("Create cone");
720
+ coneButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ torusButton.setToolTipText("Create torus");
724
+ torusButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ superButton.setToolTipText("Create superellipsoid");
728
+ superButton.addActionListener(this);
729
+
730
+ if (Globals.ADVANCED)
731
+ {
732
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ kleinButton.setToolTipText("Create Klein bottle");
734
+ kleinButton.addActionListener(this);
735
+ }
559736
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- editButton.setToolTipText("Edit selection");
737
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ particlesButton.setToolTipText("Create particle system");
739
+ particlesButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.Return();
742
+
743
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ groupButton.setToolTipText("Create group");
745
+ groupButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ compositeButton.setToolTipText("Create composite");
749
+ compositeButton.addActionListener(this);
750
+
751
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
+ switchButton.setToolTipText("Create item switcher");
753
+ switchButton.addActionListener(this);
754
+
755
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ loopButton.setToolTipText("Create loop");
757
+ loopButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ textureButton.setToolTipText("Create texture");
761
+ textureButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ overlayButton.setToolTipText("Create overlay");
765
+ overlayButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ lightButton.setToolTipText("Create light");
769
+ lightButton.addActionListener(this);
770
+
771
+ for (int i=6; --i>=0;)
772
+ {
773
+ oe.toolboxPanel.Return();
774
+ oe.toolboxPanel.add(new cGridBag());
775
+ oe.toolboxPanel.add(new cGridBag());
776
+ oe.toolboxPanel.add(new cGridBag());
777
+ oe.toolboxPanel.add(new cGridBag());
778
+ oe.toolboxPanel.add(new cGridBag());
779
+ oe.toolboxPanel.add(new cGridBag());
780
+ oe.toolboxPanel.add(new cGridBag());
781
+ }
782
+
783
+ // EDIT panel
784
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ editButton.setToolTipText("Pin selection controls");
562786 editButton.addActionListener(this);
563787
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
566790 uneditButton.addActionListener(this);
567791
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
792
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
793
+ allParamsButton.setToolTipText("Show all controle");
570794 allParamsButton.addActionListener(this);
571795
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
796
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573797 clearPanelButton.setToolTipText("Clear edit panel");
574798 clearPanelButton.addActionListener(this);
575799
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577801 unselectButton.setToolTipText("Unselect");
578802 unselectButton.addActionListener(this);
579803
580
- commandsPanel.preferredHeight = 1;
804
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ flashSelectionButton.setToolTipText("Highlight selection");
806
+ flashSelectionButton.addActionListener(this);
581807
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
808
+ editCommandsPanel.preferredHeight = 1;
809
+
810
+ SetPinStates(false);
811
+// oe.treePanel.add(commandsPanel);
812
+// oe.treePanel.Return();
584813
585814 // oe.aConstraints.gridx += 1;
586815 // oe.aConstraints.weighty = 0;
....@@ -597,29 +826,17 @@
597826
598827 JScrollPane jSP;
599828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
601830 ResetModel();
602831
603832 oe.treePanel.add(jSPPanel);
604833 oe.treePanel.Return();
605834
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;
621835 oe.treePanel.add(copyOptionsPanel);
622836 oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
623840
624841 // mainPanel.setDividerLocation(0.5); //1.0);
625842 // mainPanel.setResizeWeight(0.5);
....@@ -648,23 +865,43 @@
648865
649866 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
650867 {
868
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
869
+ colorCB.setToolTipText("Copy color when dropped");
870
+ colorCB.addItemListener(this);
871
+
872
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
873
+ materialCB.setToolTipText("Copy material when dropped");
874
+ materialCB.addItemListener(this);
875
+
876
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
877
+ textureCB.setToolTipText("Copy texture when dropped");
878
+ textureCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
651882 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
652883 boxCB.setToolTipText("Display bounding boxes");
653884 boxCB.addItemListener(this);
654885
655886 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
657888 zoomBoxCB.addItemListener(this);
658889
659890 if (true) // Globals.ADVANCED)
660891 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- supportCB.addItemListener(this);
892
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
893
+// supportCB.setToolTipText("Enable rigging");
894
+// supportCB.addItemListener(this);
895
+
896
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
897
+ freezeCB.setToolTipText("Fast moving camera");
898
+ freezeCB.addItemListener(this);
664899
665900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
666901 // localCB.addItemListener(this);
667902
903
+ panel.Return();
904
+
668905 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
669906 crowdCB.setToolTipText("Used for crowds");
670907 crowdCB.addItemListener(this);
....@@ -681,6 +918,8 @@
681918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
682919 // speakerMocapCB.addItemListener(this);
683920
921
+ panel.Return();
922
+
684923 if (false)
685924 {
686925 // handled in scripts
....@@ -695,32 +934,72 @@
695934 //constraints.gridy += 1;
696935 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
697936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
698938 }
699939
700940 //constraints.gridx += 1;
701941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
702942 // debugCB.addItemListener(this);
703943
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
704948 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
949
+ oeilCB.setToolTipText("Move camera when tracking");
705950 oeilCB.addItemListener(this);
706951
952
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
953
+ shadowCB.setToolTipText("When live compute shadows");
954
+ shadowCB.addItemListener(this);
955
+
956
+ panel.Return();
957
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
958
+ toggleTextureCB.setToolTipText("Load textures");
959
+ toggleTextureCB.addItemListener(this);
960
+
961
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
962
+ toggleSwitchCB.setToolTipText("Choose a single item");
963
+ toggleSwitchCB.addItemListener(this);
964
+
965
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
966
+ autokeepCB.setToolTipText("On structure change");
967
+ autokeepCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ if (Globals.ADVANCED)
971
+ {
707972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708973 lookAtCB.setToolTipText("Look-at target");
709974 lookAtCB.addItemListener(this);
975
+ }
710976
711977 }
712978
713979 cGridBag fill = new cGridBag();
714
-
715980 fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
716985
717986 panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
718989
719990 }
720991
721992 void EditObject(Object3D obj)
722993 {
723994 cRadio radioButton = new cRadio(obj.name);
995
+
996
+ // June 2019. Patch to avoid bug with transparency.
997
+ radioButton.hadMaterial = obj.material != null;
998
+ if (!radioButton.hadMaterial)
999
+ {
1000
+ obj.material = new cMaterial();
1001
+ }
1002
+
7241003 radioButton.SetObject(obj);
7251004 radioButton.layout = sevenButton;
7261005 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -732,6 +1011,8 @@
7321011
7331012 void SetupViews(ObjEditor oe)
7341013 {
1014
+ theFrame = this;
1015
+
7351016 oe.SetupViews();
7361017
7371018 System.out.println("SetupViews");
....@@ -740,23 +1021,28 @@
7401021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7411022 }
7421023
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;
1024
+ cToggleButton liveCB;
1025
+ cCheckBox supportCB;
1026
+ cCheckBox localCB;
1027
+ cCheckBox crowdCB;
1028
+ cCheckBox smoothCB;
1029
+ cToggleButton fastCB;
1030
+ cCheckBox slowCB;
1031
+ cCheckBox boxCB;
1032
+ cCheckBox zoomBoxCB;
1033
+ cCheckBox freezeCB;
1034
+ //cToggleButton trackCB;
1035
+ cCheckBox trackCB;
1036
+ cCheckBox smoothfocusCB;
7541037 // JCheckBox speakerMocapCB;
755
- JCheckBox speakerCameraCB;
756
- JCheckBox speakerFocusCB;
757
- JCheckBox debugCB;
758
- JCheckBox oeilCB;
759
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
7601046
7611047 // static int COLOR = 1;
7621048 // static int MATERIAL = 2;
....@@ -764,9 +1050,9 @@
7641050
7651051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7661052
767
- JCheckBox colorCB;
768
- JCheckBox materialCB;
769
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
7701056
7711057 public void itemStateChanged(ItemEvent e)
7721058 {
....@@ -794,6 +1080,7 @@
7941080 } else if(e.getSource() == liveCB)
7951081 {
7961082 cameraView.ToggleLive();
1083
+ refreshContents(false);
7971084 }
7981085 else if(e.getSource() == supportCB)
7991086 {
....@@ -858,6 +1145,18 @@
8581145 {
8591146 cameraView.ToggleOeil();
8601147 }
1148
+ else if(e.getSource() == shadowCB)
1149
+ {
1150
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1151
+ }
1152
+ else if(e.getSource() == freezeCB)
1153
+ {
1154
+ Globals.FREEZEONMOVE ^= true;
1155
+ }
1156
+ else if(e.getSource() == autokeepCB)
1157
+ {
1158
+ Globals.REPLACEONMAKE ^= true;
1159
+ }
8611160 else if(e.getSource() == lookAtCB)
8621161 {
8631162 cameraView.ToggleLookAt();
....@@ -874,7 +1173,8 @@
8741173
8751174 /**/
8761175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
877
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
8781178 if ((path == null) || (path.getPathCount() <= 1)) {
8791179 // We can't move the root node or an empty selection
8801180 return;
....@@ -937,8 +1237,6 @@
9371237 }
9381238 }
9391239
940
- String string = (String) object;
941
-
9421240 System.out.println("Transfer = " + object + "; drop : " + target);
9431241 // if( object instanceof java.io.File[])
9441242 // {
....@@ -946,6 +1244,8 @@
9461244 // objEditor.DropFile((java.io.File[]) object, true);
9471245 // return;
9481246 // }
1247
+
1248
+ String string = object.toString();
9491249
9501250 // File path for Mac and Windows
9511251 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -991,23 +1291,33 @@
9911291
9921292 assert target == objEditor.jTree;
9931293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
9941295 try {
995
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9961297 } catch (Exception e) {
9971298 System.out.println("destinationPath : " + destinationPath);
9981299 return;
9991300 }
10001301
1001
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
10021303 {
1304
+ Object3D child = (Object3D)group.selection.elementAt(i);
1305
+
1306
+ // Cannot move into itself
1307
+ if (child == destinationLeaf)
1308
+ return;
1309
+ }
1310
+
1311
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1312
+// {
10031313 loadClipboard(true);
10041314 objEditor.jTree.setSelectionPath(destinationPath);
10051315 pasteInto(false, false);
1006
- } else {
1007
- loadClipboard(false);
1008
- objEditor.jTree.setSelectionPath(destinationPath);
1009
- pasteInto(false, false); // true); // ???
1010
- }
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
10111321 }
10121322 public void dropActionChanged(DropTargetDragEvent dtde)
10131323 // Called if the user has modified the current drop gesture
....@@ -1112,22 +1422,30 @@
11121422 {
11131423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11141424 //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);
1425
+// gridItem = menu.add(new MenuItem("Grid"));
1426
+// gridItem.addActionListener(this);
1427
+// rectoidItem = menu.add(new MenuItem("Box"));
1428
+// rectoidItem.addActionListener(this);
1429
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1430
+// ellipsoidItem.addActionListener(this);
1431
+// coneItem = menu.add(new MenuItem("Cone"));
1432
+// coneItem.addActionListener(this);
1433
+// torusItem = menu.add(new MenuItem("Torus"));
1434
+// torusItem.addActionListener(this);
1435
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1436
+// superItem.addActionListener(this);
1437
+
1438
+ cameraItem = menu.add(new MenuItem("Camera"));
1439
+ cameraItem.addActionListener(this);
1440
+
1441
+ if (!Globals.ADVANCED)
1442
+ {
11271443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11281444 kleinItem.addActionListener(this);
1129
- particleItem = menu.add(new MenuItem("Particle system"));
1130
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
11311449 if (Globals.ADVANCED)
11321450 {
11331451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1153,15 +1471,15 @@
11531471 }
11541472 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11551473 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);
1474
+// overlayItem = menu.add(new MenuItem("Overlay"));
1475
+// overlayItem.addActionListener(this);
1476
+// lightItem = menu.add(new MenuItem("Light"));
1477
+// lightItem.addActionListener(this);
11601478 menu.add("-");
11611479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11621480 //superLoopItem.addActionListener(this);
1163
- loopItem = menu.add(new MenuItem("Loop"));
1164
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
11651483 doubleItem = menu.add(new MenuItem("Fork"));
11661484 doubleItem.addActionListener(this);
11671485 if (Globals.ADVANCED)
....@@ -1177,6 +1495,9 @@
11771495 animationItem.addItemListener(this);
11781496 animationItem.setState(Globals.ANIMATION);
11791497
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
1500
+
11801501 menu.add("-");
11811502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11821503 parseverticesItem.addActionListener(this);
....@@ -1189,6 +1510,8 @@
11891510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11901511 reduce34MorphItem.addActionListener(this);
11911512 menu.add("-");
1513
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1514
+ memoryItem.addActionListener(this);
11921515 menu.add(computeAOItem = new MenuItem("Compute AO"));
11931516 computeAOItem.addActionListener(this);
11941517
....@@ -1197,11 +1520,9 @@
11971520 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11981521 mirrorItem.addActionListener(this);
11991522 menu.add("-");
1200
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1201
- memoryItem.addActionListener(this);
12021523 menu.add(analyzeItem = new MenuItem("Analyze"));
12031524 analyzeItem.addActionListener(this);
1204
- menu.add(dumpItem = new MenuItem("Dump"));
1525
+ menu.add(dumpItem = new MenuItem("Print"));
12051526 dumpItem.addActionListener(this);
12061527 // menu.add(pathItem = new MenuItem("From-to path"));
12071528 // pathItem.addActionListener(this);
....@@ -1342,9 +1663,24 @@
13421663 shadow.material = new cMaterial(obj.material);
13431664 shadow.material.diffuse = 0.0001f;
13441665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
13451667
13461668 makeSomething(shadow);
13471669 }
1670
+
1671
+ private void ClearUnpinned()
1672
+ {
1673
+ //for (Object3D obj : listUI)
1674
+ for (int i=listUI.size(); --i>=0;)
1675
+ {
1676
+ Object3D obj = listUI.elementAt(i);
1677
+ if (!obj.pinned)
1678
+ {
1679
+ obj.CloseUI();
1680
+ listUI.remove(i);
1681
+ }
1682
+ }
1683
+ }
13481684
13491685 /**
13501686 * applyExample
....@@ -1589,7 +1925,7 @@
15891925 {
15901926 ScreenFit();
15911927 } else
1592
- if (source == switchItem)
1928
+ if (source == switchViewItem)
15931929 {
15941930 cVector v1 = new cVector();
15951931 cVector v2 = new cVector();
....@@ -1598,11 +1934,11 @@
15981934 objEditor.cameraView.renderCamera.setAim(v2, v1);
15991935 objEditor.cameraView.repaint();
16001936 } else
1601
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
16021938 {
16031939 makeSomething(new Box());
16041940 } else
1605
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
16061942 {
16071943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16081944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1681,27 +2017,27 @@
16812017
16822018 makeSomething(obj);
16832019 } else
1684
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
16852021 {
16862022 makeSomething(new Grid());
16872023 } else
1688
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
16892025 {
16902026 makeSomething(new Sphere());
16912027 } else
1692
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
16932029 {
16942030 makeSomething(new Cone());
16952031 } else
1696
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
16972033 {
16982034 makeSomething(new Torus());
16992035 } else
1700
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
17012037 {
17022038 makeSomething(new Superellipsoid());
17032039 } else
1704
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
17052041 {
17062042 makeSomething(new Klein());
17072043 } else
....@@ -1721,7 +2057,7 @@
17212057 {
17222058 makeSomething(new BezierSurface());
17232059 } else
1724
- if (source == overlayItem)
2060
+ if (source == overlayItem || source == overlayButton)
17252061 {
17262062 /*
17272063 Object3D obj = new BezierSurface(5,8);
....@@ -1769,7 +2105,7 @@
17692105 s.setup();
17702106 makeSomething(s);
17712107 } else
1772
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
17732109 {
17742110 makeSomething(new Light());
17752111 } else
....@@ -1819,30 +2155,30 @@
18192155
18202156 group(g);
18212157 } else
1822
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
18232159 {
18242160 Composite csg = new GroupLeaf();
18252161 csg.count = 5;
18262162 group(csg);
1827
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
18282164 csg.addChild(child);
18292165 child.addChild(csg);
18302166 } else
18312167 if (source == doubleItem)
18322168 {
1833
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
18342170 csg.count = 5;
18352171 group(csg);
1836
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
18372173 csg.addChild(child);
18382174 child.addChild(csg);
1839
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
18402176 csg.addChild(child);
18412177 child.addChild(csg);
18422178 } else
18432179 if (source == tripleItem)
18442180 {
1845
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
18462182 csg.count = 4;
18472183 group(csg);
18482184 Composite child = new cGroup();
....@@ -1854,31 +2190,6 @@
18542190 child = new cGroup();
18552191 csg.addChild(child);
18562192 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
- }
18822193 } else
18832194 if (source == computeAOItem)
18842195 {
....@@ -1917,6 +2228,46 @@
19172228 {
19182229 DumpObject();
19192230 } else
2231
+ if (source == minButton)
2232
+ {
2233
+ Minimize();
2234
+ } else
2235
+ if (source == maxButton)
2236
+ {
2237
+ Maximize();
2238
+ } else
2239
+ if (source == fullButton)
2240
+ {
2241
+ ToggleFullScreen();
2242
+ } else
2243
+ if (source == undoButton)
2244
+ {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2248
+ Undo();
2249
+ } else
2250
+ if (source == restoreButton)
2251
+ {
2252
+ // Restore current version
2253
+ Restore();
2254
+ } else
2255
+ if (source == replaceButton)
2256
+ {
2257
+ // Overwrite current version
2258
+ Replace();
2259
+ } else
2260
+ if (source == redoButton)
2261
+ {
2262
+ // Go to next version
2263
+ Redo();
2264
+ } else
2265
+ if (source == saveButton)
2266
+ {
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
2270
+ } else
19202271 if (source == oneStepButton)
19212272 {
19222273 Globals.ONESTEP = true;
....@@ -1924,17 +2275,14 @@
19242275 } else
19252276 if (source == screenfitButton)
19262277 {
1927
- //Reload(lastConverter, lastFilename, true);
19282278 ScreenFit();
19292279 } else
19302280 if (source == screenfitpointButton)
19312281 {
1932
- //Reload(lastConverter, lastFilename, true);
19332282 ScreenFitPoint();
19342283 } else
19352284 if (source == snapobjectButton)
19362285 {
1937
- //Reload(lastConverter, lastFilename, true);
19382286 SnapObject();
19392287 } else
19402288 // if (event.getSource() == recompileButton)
....@@ -1970,6 +2318,14 @@
19702318 if (source == cutItem || source == clearButton)
19712319 {
19722320 loadClipboard(true);
2321
+ } else
2322
+ if (source == undoItem)
2323
+ {
2324
+ Undo();
2325
+ } else
2326
+ if (source == redoItem)
2327
+ {
2328
+ Redo();
19732329 } else
19742330 if (source == duplicateItem)
19752331 {
....@@ -2302,9 +2658,9 @@
23022658 {
23032659 ClearSelection(true);
23042660 } else
2305
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
23062662 {
2307
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
23082664 } else
23092665 if (source == hideItem)
23102666 {
....@@ -2322,11 +2678,11 @@
23222678 {
23232679 makeSomething(new Camera());
23242680 } else
2325
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
23262682 {
23272683 group(new Composite());
23282684 } else
2329
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
23302686 {
23312687 RandomNode random = new RandomNode();
23322688 group(random);
....@@ -2428,7 +2784,7 @@
24282784 {
24292785 group(new cLinker());
24302786 } else
2431
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
24322788 {
24332789 group(new TextureNode());
24342790 } else
....@@ -2448,17 +2804,30 @@
24482804 {
24492805 CastShadow(2);
24502806 } else
2451
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
24522808 {
2453
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
24542811 for (int i=0; i<group.selection.size(); i++)
24552812 {
2456
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
24572818 }
24582819
2459
- ClearSelection(false);
2460
-
2461
- refreshContents();
2820
+ if (!hasRoot)
2821
+ {
2822
+ for (int i=0; i<group.selection.size(); i++)
2823
+ {
2824
+ Ungroup(group.selection.get(i));
2825
+ }
2826
+
2827
+ ClearSelection(false);
2828
+
2829
+ refreshContents();
2830
+ }
24622831 } else
24632832 if (source == genUVItem)
24642833 {
....@@ -2470,7 +2839,7 @@
24702839 } else
24712840 if (source == genNormalsMESHItem)
24722841 {
2473
- GenNormals(true); // TODO
2842
+ GenNormalsMESH();
24742843 } else
24752844 if (source == genNormalsORGANItem)
24762845 {
....@@ -2535,6 +2904,22 @@
25352904 if (source == unmarkleavesItem)
25362905 {
25372906 MarkLeaves(false);
2907
+ } else
2908
+ if (source == rewindleavesItem)
2909
+ {
2910
+ RewindLeaves(true);
2911
+ } else
2912
+ if (source == unrewindleavesItem)
2913
+ {
2914
+ RewindLeaves(false);
2915
+ } else
2916
+ if (source == randomleavesItem)
2917
+ {
2918
+ RandomLeaves(true);
2919
+ } else
2920
+ if (source == unrandomleavesItem)
2921
+ {
2922
+ RandomLeaves(false);
25382923 } else
25392924 if (source == flipVItem)
25402925 {
....@@ -2770,6 +3155,10 @@
27703155 if (source == twoButton)
27713156 {
27723157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
27733162 // bug
27743163 //gridPanel.setDividerLocation(1.0);
27753164 //bigPanel.setDividerLocation(0.0);
....@@ -2802,10 +3191,31 @@
28023191 bigThree.ClearUI();
28033192 bigThree.add(centralPanel);
28043193 bigThree.FlushUI();
3194
+
3195
+ cameraView.requestFocusInWindow();
3196
+
3197
+// refreshContents(true);
3198
+//
3199
+// try
3200
+// {
3201
+// java.awt.Robot bot = new java.awt.Robot();
3202
+// int mask = InputEvent.BUTTON1_MASK;
3203
+// bot.mouseMove(100, 100);
3204
+// bot.mousePress(mask);
3205
+// bot.mouseRelease(mask);
3206
+// }
3207
+// catch (Exception e)
3208
+// {
3209
+//
3210
+// }
3211
+
28053212 } else
28063213 if (source == threeButton)
28073214 {
28083215 radio.layout = threeButton;
3216
+
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
28093219
28103220 // bigThree.remove(scenePanel);
28113221 // bigThree.remove(centralPanel);
....@@ -2838,10 +3248,15 @@
28383248 bigThree.add(centralPanel);
28393249 bigThree.add(XYZPanel);
28403250 bigThree.FlushUI();
3251
+
3252
+ cameraView.requestFocusInWindow();
28413253 } else
28423254 if (source == fourButton)
28433255 {
28443256 radio.layout = fourButton;
3257
+
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
28453260
28463261 // bigThree.remove(scenePanel);
28473262 // bigThree.remove(centralPanel);
....@@ -2873,10 +3288,15 @@
28733288 bigThree.ClearUI();
28743289 bigThree.add(scenePanel);
28753290 bigThree.FlushUI();
3291
+
3292
+ cameraView.requestFocusInWindow();
28763293 } else
28773294 if (source == sixButton)
28783295 {
28793296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
28803300
28813301 // bigThree.remove(scenePanel);
28823302 // bigThree.remove(centralPanel);
....@@ -2909,10 +3329,15 @@
29093329 bigThree.add(scenePanel);
29103330 bigThree.add(centralPanel);
29113331 bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
29123334 } else
29133335 if (source == sevenButton)
29143336 {
29153337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
29163341
29173342 // bigThree.remove(scenePanel);
29183343 // bigThree.remove(centralPanel);
....@@ -2946,6 +3371,8 @@
29463371 bigThree.add(centralPanel);
29473372 bigThree.add(XYZPanel);
29483373 bigThree.FlushUI();
3374
+
3375
+ cameraView.requestFocusInWindow();
29493376 } else
29503377 if (source == rootButton)
29513378 {
....@@ -2957,6 +3384,7 @@
29573384 EditObject(obj);
29583385 }
29593386
3387
+ cameraView.requestFocusInWindow();
29603388 refreshContents(true);
29613389 } else
29623390 if (source == closeButton)
....@@ -2966,22 +3394,37 @@
29663394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29673395 {
29683396 ab = (cRadio)e.nextElement();
2969
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29703398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
29713405 buttonGroup.remove(ab);
29723406 radioPanel.remove(ab);
29733407
2974
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
29753410 // ab.GetObject().objectUI = null; // ?????????
29763411
29773412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29783413 break;
29793414 }
29803415 }
3416
+
3417
+ cameraView.requestFocusInWindow();
29813418 refreshContents(true);
29823419 } else
29833420 if (source == editItem || source == editButton)
29843421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
29853428 EditSelection(false);
29863429 } else
29873430 if (source == uneditButton)
....@@ -2991,10 +3434,11 @@
29913434 Object3D child = (Object3D)e.nextElement();
29923435 if(child.editWindow != null)
29933436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
29943438 child.CloseUI();
29953439 listUI.remove(child);
29963440
2997
- child.editWindow = null; // ???????????
3441
+ //child.editWindow = null; // ???????????
29983442 }
29993443 objEditor.ctrlPanel.FlushUI();
30003444 //objEditor.jTree.clearSelection();
....@@ -3007,6 +3451,7 @@
30073451 //copy.ClearUI();
30083452 for (Object3D obj : listUI)
30093453 {
3454
+ obj.pinned = false;
30103455 obj.CloseUI();
30113456 }
30123457 listUI.clear();
....@@ -3016,7 +3461,7 @@
30163461 {
30173462 assert(copy == group);
30183463
3019
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30203465
30213466 for (Object3D obj : listUI)
30223467 {
....@@ -3065,6 +3510,9 @@
30653510 }
30663511
30673512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
30683516 //Globals.theRenderer.object = group;
30693517 if(!useclient)
30703518 {
....@@ -3081,7 +3529,9 @@
30813529 sideView.object = group;
30823530 }
30833531
3084
-// fix "+" issue group.editWindow = this;
3532
+// fix "+" issue
3533
+ //group.editWindow = this;
3534
+ group.manipWindow = this;
30853535
30863536 /*
30873537 currentLayout = radio.layout;
....@@ -3089,13 +3539,33 @@
30893539 currentLayout = sevenButton;
30903540 */
30913541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
30923547 keepparent = group.parent;
30933548 // PARENT = NULL or not???
30943549 //group.parent = null; // ROOT
30953550 //group.attributes = -1;
30963551 ResetModel();
3552
+
3553
+ cameraView.requestFocusInWindow();
30973554 refreshContents(true);
3098
- }
3555
+ } else if (event.getSource() == editCameraItem)
3556
+ {
3557
+ cameraView.ProtectCamera();
3558
+ cameraView.repaint();
3559
+ return;
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3561
+ {
3562
+ cameraView.RevertCamera();
3563
+ cameraView.repaint();
3564
+ return;
3565
+ // } else if (event.getSource() == textureButton)
3566
+ // {
3567
+ // return; // true;
3568
+ }
30993569 else
31003570 {
31013571 //return super.action(event, arg);
....@@ -3104,7 +3574,6 @@
31043574 }
31053575
31063576 boolean useclient = false;
3107
- cRadio radio;
31083577
31093578 void ToggleRoot()
31103579 {
....@@ -3343,7 +3812,8 @@
33433812
33443813 int size = obj.MemorySize();
33453814
3346
- System.err.println((size/1024) + " KB is the size of " + obj);
3815
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3816
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33473817 }
33483818 }
33493819 catch (Exception e)
....@@ -3424,6 +3894,13 @@
34243894 void GenNormals(boolean crease)
34253895 {
34263896 group.GenNormalsS(crease);
3897
+
3898
+ refreshContents();
3899
+ }
3900
+
3901
+ void GenNormalsMESH()
3902
+ {
3903
+ group.GenNormalsMeshS();
34273904
34283905 refreshContents();
34293906 }
....@@ -4051,6 +4528,18 @@
40514528 refreshContents();
40524529 }
40534530
4531
+ void RewindLeaves(boolean hide)
4532
+ {
4533
+ group.selection.RewindLeaves(hide);
4534
+ refreshContents();
4535
+ }
4536
+
4537
+ void RandomLeaves(boolean hide)
4538
+ {
4539
+ group.selection.RandomLeaves(hide);
4540
+ refreshContents();
4541
+ }
4542
+
40544543 void SetTexRes(int tr)
40554544 {
40564545 group.selection.SetTexRes(tr);
....@@ -4122,10 +4611,6 @@
41224611 // }
41234612 // }
41244613
4125
- static boolean allparams = true;
4126
-
4127
- static Vector<Object3D> listUI = new Vector<Object3D>();
4128
-
41294614 void EditSelection(boolean newWindow)
41304615 {
41314616 // aConstraints.gridy = 0;
....@@ -4133,7 +4618,7 @@
41334618 {
41344619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41354620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4136
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41374622
41384623 Object3D elem = (Object3D)group.selection.elementAt(i);
41394624 if(elem != group || !newWindow)
....@@ -4218,7 +4703,8 @@
42184703 //new Exception().printStackTrace();
42194704
42204705 freezemodel = true;
4221
-
4706
+ ClearUnpinned();
4707
+
42224708 /**/
42234709 //switch (event.id)
42244710 {
....@@ -4226,7 +4712,6 @@
42264712 //case 702: // Event.LIST_DESELECT
42274713 group.deselectAll();
42284714 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4229
- objEditor.ClearInfo(); // .GetMaterial());
42304715 if (tps != null)
42314716 {
42324717 for (int i=0; i < tps.length; i++)
....@@ -4235,10 +4720,8 @@
42354720
42364721 //if (child.parent != null)
42374722 //child.parent.addSelectee(child);
4723
+ objEditor.SetMaterial(child);
42384724 group.addSelectee(child);
4239
- objEditor.SetMaterial(child); // .GetMaterial());
4240
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4241
- System.err.println("info : " + child.GetPath());
42424725 }
42434726 }
42444727 // else
....@@ -4248,20 +4731,28 @@
42484731 // System.err.println("info : " + group.GetPath());
42494732 // }
42504733
4251
- objEditor.SetText(); // jan 2014
4252
-
4253
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4734
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42544735 CameraPane.flash = true;
42554736
4256
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4737
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42574738 // a camera
42584739 {
4259
- CameraPane.camerachangeframe = 0; // don't refuse it
4260
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4741
+ {
4742
+ CameraPane.camerachangeframe = 0; // don't refuse it
4743
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4744
+ }
42614745 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42624746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42634747 }
42644748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
42654756 refreshContents();
42664757 //return true;
42674758 }
....@@ -4270,6 +4761,35 @@
42704761
42714762 freezemodel = false;
42724763 }
4764
+
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
4773
+ void refreshContents(boolean cp)
4774
+ {
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4777
+ {
4778
+ objEditor.ClearInfo(); // .GetMaterial());
4779
+
4780
+ for (int i=0; i < group.selection.Size(); i++)
4781
+ {
4782
+ Object3D child = (Object3D) group.selection.get(i);
4783
+
4784
+ objEditor.AddInfo(child, this, true);
4785
+ System.err.println("info : " + child.GetPath());
4786
+ }
4787
+
4788
+ objEditor.SetText(); // jan 2014
4789
+ }
4790
+
4791
+ super.refreshContents(cp);
4792
+ }
42734793
42744794 void linkSomething(Object3D thing)
42754795 {
....@@ -4341,6 +4861,7 @@
43414861 {
43424862 if (group.selection.isEmpty())
43434863 return;
4864
+
43444865 Grafreed.clipboardIsTempGroup = false;
43454866 Composite tGroup = null;
43464867 if (group.selection.size() > 0) // 1)
....@@ -4351,6 +4872,8 @@
43514872
43524873 if (cut)
43534874 {
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
43544877 //int indices[] = jList.getSelectedIndices();
43554878 //for (int i = indices.length - 1; i >= 0; i--)
43564879 //jList.remove(indices[i]);
....@@ -4440,8 +4963,10 @@
44404963 }
44414964
44424965 }
4966
+
44434967 if (Grafreed.clipboardIsTempGroup)
44444968 Grafreed.clipboard = tGroup;
4969
+
44454970 if (cut)
44464971 {
44474972 ResetModel();
....@@ -4451,6 +4976,10 @@
44514976
44524977 void paste(boolean expand)
44534978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
44544983 // if (GrafreeD.clipboard == null)
44554984 // return;
44564985 boolean first = true;
....@@ -4510,6 +5039,7 @@
45105039 Grafreed.clipboard.get(0).parent = keepparent;
45115040 }
45125041
5042
+ Globals.REPLACEONMAKE = keep;
45135043 ResetModel();
45145044 refreshContents();
45155045 }
....@@ -4645,6 +5175,10 @@
46455175
46465176 void group(Object3D csg, boolean grab)
46475177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
46485182 if (//false) // why??
46495183 !group.selection.isEmpty())
46505184 {
....@@ -4758,10 +5292,15 @@
47585292 //node.add(csg);
47595293 //makeSomething(node);
47605294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
47615296 }
47625297
47635298 void Ungroup(Object3D g)
47645299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
47655304 if (g instanceof HiddenObject)
47665305 {
47675306 HiddenObject h = (HiddenObject) g;
....@@ -4778,6 +5317,7 @@
47785317 objEditor.makeSomething(g.get(i), false);
47795318 }
47805319 }
5320
+ Globals.REPLACEONMAKE = keep;
47815321 }
47825322
47835323 void ungroup()
....@@ -4973,21 +5513,6 @@
49735513 }
49745514 */
49755515
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
-
49915516 /*
49925517 public void Callback(Object obj)
49935518 {
....@@ -5011,23 +5536,6 @@
50115536 }
50125537 */
50135538
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
-
50315539 String GetFile(String dialogName)
50325540 {
50335541 if (Grafreed.standAlone)
....@@ -5098,7 +5606,28 @@
50985606 cButton clearpanelButton;
50995607 cButton unselectButton;
51005608
5609
+ cButton restoreCameraButton;
5610
+
5611
+ cButton saveButton;
51015612 cButton oneStepButton;
5613
+
5614
+ cButton groupButton;
5615
+ cButton ungroupButton;
5616
+ cButton compositeButton;
5617
+ cButton switchButton;
5618
+ cButton loopButton;
5619
+ cButton textureButton;
5620
+
5621
+ cButton gridButton;
5622
+ cButton boxButton;
5623
+ cButton sphereButton;
5624
+ cButton coneButton;
5625
+ cButton torusButton;
5626
+ cButton superButton;
5627
+ cButton kleinButton;
5628
+ cButton particlesButton;
5629
+ cButton overlayButton;
5630
+ cButton lightButton;
51025631
51035632 cButton screenfitButton;
51045633 cButton screenfitpointButton;
....@@ -5111,14 +5640,6 @@
51115640
51125641 cButton setsupportButton;
51135642
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
-
51225643 //
51235644 //Composite
51245645 Object3D // to do !!
....@@ -5128,9 +5649,11 @@
51285649 //JTree jTree;
51295650 private MenuItem lookAtItem;
51305651 private MenuItem lookFromItem;
5131
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
51325653 private MenuItem cutItem;
5133
- private MenuItem duplicateItem;
5654
+ private MenuItem undoItem;
5655
+ private MenuItem redoItem;
5656
+ private JMenuItem duplicateItem;
51345657 private MenuItem cloneItem;
51355658 private MenuItem cloneSupportItem;
51365659 private MenuItem overwriteGeoItem;
....@@ -5193,6 +5716,10 @@
51935716 private MenuItem showleavesItem;
51945717 private MenuItem markleavesItem;
51955718 private MenuItem unmarkleavesItem;
5719
+ private MenuItem rewindleavesItem;
5720
+ private MenuItem unrewindleavesItem;
5721
+ private MenuItem randomleavesItem;
5722
+ private MenuItem unrandomleavesItem;
51965723
51975724 private MenuItem flipVItem;
51985725 private MenuItem unflipVItem;
....@@ -5214,7 +5741,7 @@
52145741 private MenuItem frontItem;
52155742 private MenuItem cameraItem;
52165743 private MenuItem compositeItem;
5217
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
52185745 private MenuItem physicsItem;
52195746 private MenuItem frameselectorItem;
52205747 private MenuItem scriptNodeItem;
....@@ -5276,11 +5803,6 @@
52765803 private MenuItem doubleItem;
52775804 private MenuItem tripleItem;
52785805
5279
- private MenuItem importGFDItem;
5280
- private MenuItem importVRMLX3DItem;
5281
- private MenuItem import3DSItem;
5282
- private MenuItem importOBJItem;
5283
-
52845806 private MenuItem computeAOItem;
52855807 private MenuItem recompileItem;
52865808 private MenuItem editScriptItem;
....@@ -5290,4 +5812,8 @@
52905812 private MenuItem analyzeItem;
52915813 private MenuItem dumpItem;
52925814 //boolean freezemodel = false;
5815
+
5816
+ Menu cameraMenu;
5817
+ MenuItem editCameraItem;
5818
+ MenuItem restoreCameraItem;
52935819 }