Normand Briere
2019-06-25 26b24f5b623e709a88e91e9bce0864f9d5e8f084
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);
....@@ -148,28 +148,21 @@
148148
149149 //JTextField nameField;
150150
151
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
152152 {
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
-
153
+ oe.jTree = new cTree();
154
+
168155 Menu menu;
169156 oe.menuBar.add(menu = new Menu("Edit"));
170157 //editItem = menu.add(new MenuItem("Edit"));
171158 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
159
+
160
+// undoItem = menu.add(new MenuItem("Undo"));
161
+// undoItem.addActionListener(this);
162
+// redoItem = menu.add(new MenuItem("Redo"));
163
+// redoItem.addActionListener(this);
164
+// menu.add("-");
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173166 duplicateItem.addActionListener(this);
174167 cloneItem = menu.add(new MenuItem("Clone"));
175168 cloneItem.addActionListener(this);
....@@ -185,7 +178,6 @@
185178 copyItem.addActionListener(this);
186179 pasteItem = menu.add(new MenuItem("Paste"));
187180 pasteItem.addActionListener(this);
188
- menu.add("-");
189181
190182 menu.add("-");
191183 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -206,7 +198,94 @@
206198 clearAllItem = menu.add(new MenuItem("Clear All"));
207199 clearAllItem.addActionListener(this);
208200 }
201
+
202
+ menuBar.add(cameraMenu = new Menu("View"));
203
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
204
+ //zBufferItem.addActionListener(this);
205
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
206
+ //normalLensItem.addActionListener(this);
207
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
208
+ restoreCameraItem.addActionListener(this);
209
+
210
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
+// toggleFullScreenItem.addItemListener(this);
212
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
+// cameraMenu.add("-");
214
+//
215
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
216
+// toggleTextureItem.addItemListener(this);
217
+// toggleTextureItem.setState(CameraPane.textureon);
218
+//
219
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
220
+// toggleSwitchItem.addItemListener(this);
221
+// toggleSwitchItem.setState(CameraPane.SWITCH);
222
+
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
224
+ toggleHandleItem.addItemListener(this);
225
+ toggleHandleItem.setState(CameraPane.HANDLES);
226
+
227
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
228
+ togglePaintItem.addItemListener(this);
229
+ togglePaintItem.setState(CameraPane.PAINTMODE);
230
+
231
+ if (Globals.ADVANCED)
232
+ {
233
+ cameraMenu.add("-");
234
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
235
+ toggleLiveItem.addItemListener(this);
236
+ toggleLiveItem.setState(Globals.isLIVE());
209237
238
+ cameraMenu.add(stepItem = new MenuItem("Step"));
239
+ stepItem.addActionListener(this);
240
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
241
+ // toggleDLItem.addItemListener(this);
242
+ // toggleDLItem.setState(false);
243
+
244
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
245
+ toggleRenderItem.addItemListener(this);
246
+ toggleRenderItem.setState(!CameraPane.frozen);
247
+
248
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
249
+ toggleDebugItem.addItemListener(this);
250
+ toggleDebugItem.setState(Globals.DEBUG);
251
+
252
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
253
+ toggleFrustumItem.addItemListener(this);
254
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
255
+
256
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
257
+ toggleFootContactItem.addItemListener(this);
258
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
259
+
260
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
261
+ toggleTimelineItem.addItemListener(this);
262
+ }
263
+
264
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
265
+// toggleRootItem.addItemListener(this);
266
+// toggleRootItem.setState(false);
267
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
268
+// animationItem.addItemListener(this);
269
+// animationItem.setState(CameraPane.ANIMATION);
270
+ cameraMenu.add("-");
271
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
272
+ editCameraItem.addActionListener(this);
273
+
274
+ if (Globals.ADVANCED)
275
+ {
276
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
277
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
278
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
279
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
280
+ oe.cameraMenu.add("-");
281
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
282
+ openWindowItem.addActionListener(this);
283
+ editLeafItem.addActionListener(this);
284
+ lookAtItem.addActionListener(this);
285
+ //lookFromItem.addActinoListener(this);
286
+ //switchViewItem.addActionListener(this);
287
+ }
288
+
210289 oe.menuBar.add(menu = new Menu("Setting"));
211290 if (Globals.ADVANCED)
212291 {
....@@ -249,21 +328,29 @@
249328 }
250329
251330 oe.menuBar.add(menu = new Menu("Group"));
252
- grabItem = menu.add(new MenuItem("Grab"));
253
- grabItem.addActionListener(this);
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
254333 backItem = menu.add(new MenuItem("Back"));
255334 backItem.addActionListener(this);
256335 frontItem = menu.add(new MenuItem("Front"));
257336 frontItem.addActionListener(this);
258
- compositeItem = menu.add(new MenuItem("Composite"));
259
- compositeItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
260342 hideItem = menu.add(new MenuItem("Hidden Group"));
261343 hideItem.addActionListener(this);
344
+ }
262345 ungroupItem = menu.add(new MenuItem("Ungroup"));
263346 ungroupItem.addActionListener(this);
264
- menu.add("-");
265
- randomItem = menu.add(new MenuItem("Switch node"));
266
- randomItem.addActionListener(this);
347
+
348
+// menu.add("-");
349
+//
350
+// switchItem = menu.add(new MenuItem("Switch node"));
351
+// switchItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
267354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
268355 switchGeoItem.addActionListener(this);
269356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -271,8 +358,6 @@
271358 morphItem = menu.add(new MenuItem("Morph Group"));
272359 morphItem.addActionListener(this);
273360
274
- if (Globals.ADVANCED)
275
- {
276361 menu.add("-");
277362 physicsItem = menu.add(new MenuItem("Physics"));
278363 physicsItem.addActionListener(this);
....@@ -280,22 +365,20 @@
280365 frameselectorItem.addActionListener(this);
281366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
282367 scriptNodeItem.addActionListener(this);
283
- cameraItem = menu.add(new MenuItem("Camera"));
284
- cameraItem.addActionListener(this);
285368 }
286369
287370 oe.menuBar.add(menu = new Menu("Object"));
288
- textureItem = menu.add(new MenuItem("Texture"));
289
- textureItem.addActionListener(this);
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
290373 billboardItem = menu.add(new MenuItem("Billboard"));
291374 billboardItem.addActionListener(this);
292375 csgItem = menu.add(new MenuItem("CSG"));
293376 csgItem.addActionListener(this);
294
- shadowXItem = menu.add(new MenuItem("Shadow X"));
377
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
295378 shadowXItem.addActionListener(this);
296
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
379
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
297380 shadowYItem.addActionListener(this);
298
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
381
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
299382 shadowZItem.addActionListener(this);
300383 if (Globals.ADVANCED)
301384 {
....@@ -392,6 +475,14 @@
392475 markleavesItem.addActionListener(this);
393476 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394477 unmarkleavesItem.addActionListener(this);
478
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
479
+ rewindleavesItem.addActionListener(this);
480
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
481
+ unrewindleavesItem.addActionListener(this);
482
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
483
+ randomleavesItem.addActionListener(this);
484
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
485
+ unrandomleavesItem.addActionListener(this);
395486 menu.add("-");
396487 flipVItem = menu.add(new MenuItem("Flip V"));
397488 flipVItem.addActionListener(this);
....@@ -443,25 +534,24 @@
443534 oe.menuBar.add(menu = new Menu("Insert"));
444535 buildCreateMenu(menu);
445536
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
-
459537 oe.menuBar.add(menu = new Menu("Tools"));
460538 buildToolsMenu(menu);
461539 }
462540
463541 void SetupUI2(ObjEditor oe)
464542 {
543
+ // June 2019
544
+ if (oe == null)
545
+ {
546
+ //super.SetupUI2(this);
547
+ //return;
548
+ }
549
+
550
+ if (copy != group)
551
+ {
552
+ //super.SetupUI2(this);
553
+ }
554
+
465555 //new Exception().printStackTrace();
466556
467557 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +580,61 @@
490580 oe.radioPanel.add(dummyButton);
491581 oe.buttonGroup.add(dummyButton);
492582 */
583
+ cGridBag copyOptionsPanel = new cGridBag();
584
+
585
+ copyOptionsPanel.preferredHeight = 2;
586
+
493587 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494588
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
589
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
+ //minButton.setToolTipText("Minimize window");
591
+ //minButton.addActionListener(this);
592
+
593
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
+ maxButton.setToolTipText("Maximize window");
595
+ maxButton.addActionListener(this);
596
+
597
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598
+ fullButton.setToolTipText("Full-screen window");
599
+ fullButton.addActionListener(this);
600
+
601
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ restoreCameraButton.setToolTipText("Restore viewpoint");
603
+ restoreCameraButton.addActionListener(this);
604
+
605
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
+ undoButton.setToolTipText("Undo changes");
607
+ undoButton.addActionListener(this);
608
+
609
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610
+ redoButton.setToolTipText("Redo changes");
611
+ redoButton.addActionListener(this);
612
+
613
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614
+ saveButton.setToolTipText("Save changes");
615
+ saveButton.addActionListener(this);
616
+
617
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
496618 liveCB.setToolTipText("Enable animation");
497619 liveCB.addItemListener(this);
498620
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500622 oneStepButton.setToolTipText("Animate one step forward");
501623 oneStepButton.addActionListener(this);
502624
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
625
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504626 fastCB.setToolTipText("Fast mode");
505627 fastCB.addItemListener(this);
506628
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);
629
+ //oe.toolboxPanel.Return();
630
+
631
+ copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512632 screenfitButton.setToolTipText("Screen fit");
513633 screenfitButton.addActionListener(this);
634
+
635
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
636
+// trackCB.setToolTipText("Enable tracking");
637
+// trackCB.addItemListener(this);
514638
515639 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516640 // screenfitpointButton.addActionListener(this);
....@@ -522,65 +646,132 @@
522646 snapobjectButton.setToolTipText("Snap Object");
523647 }
524648
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
649
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528650
529
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
-
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532652 twoButton.setToolTipText("Show center view only");
533653 twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ this.fullscreenLayout = twoButton;
655
+
656
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535657 fourButton.addActionListener(this);
536658 fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
659
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538660 sixButton.setToolTipText("2-column layout left");
539661 sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541663 threeButton.setToolTipText("2-column layout right");
542664 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544666 sevenButton.setToolTipText("3-column layout");
545667 sevenButton.addActionListener(this);
546668 //
547669
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549671 rootButton.setToolTipText("Edit selection in new tab");
550672 rootButton.addActionListener(this);
551673
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553675 closeButton.setToolTipText("Close tab");
554676 closeButton.addActionListener(this);
555677 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
556678 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
679
+
680
+ // INSERT
681
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ gridButton.setToolTipText("Create grid");
683
+ gridButton.addActionListener(this);
684
+
685
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686
+ boxButton.setToolTipText("Create box");
687
+ boxButton.addActionListener(this);
688
+
689
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
690
+ sphereButton.setToolTipText("Create sphere");
691
+ sphereButton.addActionListener(this);
692
+
693
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ coneButton.setToolTipText("Create cone");
695
+ coneButton.addActionListener(this);
696
+
697
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ torusButton.setToolTipText("Create torus");
699
+ torusButton.addActionListener(this);
700
+
701
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
702
+ superButton.setToolTipText("Create superellipsoid");
703
+ superButton.addActionListener(this);
704
+
705
+ if (Globals.ADVANCED)
706
+ {
707
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ kleinButton.setToolTipText("Create Klein bottle");
709
+ kleinButton.addActionListener(this);
710
+ }
559711
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
712
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ particlesButton.setToolTipText("Create particle system");
714
+ particlesButton.addActionListener(this);
715
+
716
+ oe.toolboxPanel.Return();
717
+
718
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ groupButton.setToolTipText("Create group");
720
+ groupButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ compositeButton.setToolTipText("Create composite");
724
+ compositeButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ switchButton.setToolTipText("Create switch");
728
+ switchButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ loopButton.setToolTipText("Create loop");
732
+ loopButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ textureButton.setToolTipText("Create texture");
736
+ textureButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ overlayButton.setToolTipText("Create overlay");
740
+ overlayButton.addActionListener(this);
741
+
742
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
743
+ lightButton.setToolTipText("Create light");
744
+ lightButton.addActionListener(this);
745
+
746
+ // EDIT panel
747
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561748 editButton.setToolTipText("Edit selection");
562749 editButton.addActionListener(this);
563750
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565752 uneditButton.setToolTipText("Unedit selection");
566753 uneditButton.addActionListener(this);
567754
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
755
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569756 allParamsButton.setToolTipText("Edit all params");
570757 allParamsButton.addActionListener(this);
571758
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
759
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573760 clearPanelButton.setToolTipText("Clear edit panel");
574761 clearPanelButton.addActionListener(this);
575762
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
763
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577764 unselectButton.setToolTipText("Unselect");
578765 unselectButton.addActionListener(this);
579766
580
- commandsPanel.preferredHeight = 1;
767
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ flashSelectionButton.setToolTipText("Highlight selection");
769
+ flashSelectionButton.addActionListener(this);
581770
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
771
+ editCommandsPanel.preferredHeight = 1;
772
+
773
+// oe.treePanel.add(commandsPanel);
774
+// oe.treePanel.Return();
584775
585776 // oe.aConstraints.gridx += 1;
586777 // oe.aConstraints.weighty = 0;
....@@ -597,27 +788,12 @@
597788
598789 JScrollPane jSP;
599790 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
791
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
601792 ResetModel();
602793
603794 oe.treePanel.add(jSPPanel);
604795 oe.treePanel.Return();
605796
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;
621797 oe.treePanel.add(copyOptionsPanel);
622798 oe.treePanel.Return();
623799
....@@ -648,6 +824,20 @@
648824
649825 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
650826 {
827
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
828
+ colorCB.setToolTipText("Copy color when dropped");
829
+ colorCB.addItemListener(this);
830
+
831
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
832
+ materialCB.setToolTipText("Copy material when dropped");
833
+ materialCB.addItemListener(this);
834
+
835
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
836
+ textureCB.setToolTipText("Copy texture when dropped");
837
+ textureCB.addItemListener(this);
838
+
839
+ panel.Return();
840
+
651841 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
652842 boxCB.setToolTipText("Display bounding boxes");
653843 boxCB.addItemListener(this);
....@@ -665,6 +855,8 @@
665855 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
666856 // localCB.addItemListener(this);
667857
858
+ panel.Return();
859
+
668860 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
669861 crowdCB.setToolTipText("Used for crowds");
670862 crowdCB.addItemListener(this);
....@@ -681,6 +873,8 @@
681873 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
682874 // speakerMocapCB.addItemListener(this);
683875
876
+ panel.Return();
877
+
684878 if (false)
685879 {
686880 // handled in scripts
....@@ -695,32 +889,72 @@
695889 //constraints.gridy += 1;
696890 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
697891 smoothfocusCB.addItemListener(this);
892
+ panel.Return();
698893 }
699894
700895 //constraints.gridx += 1;
701896 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
702897 // debugCB.addItemListener(this);
703898
899
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
900
+ trackCB.setToolTipText("Enable tracking target");
901
+ trackCB.addItemListener(this);
902
+
704903 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
904
+ oeilCB.setToolTipText("Move camera when tracking");
705905 oeilCB.addItemListener(this);
706906
907
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
908
+ shadowCB.setToolTipText("Compute shadows when live");
909
+ shadowCB.addItemListener(this);
910
+
911
+ panel.Return();
912
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
913
+ toggleTextureCB.setToolTipText("Load textures");
914
+ toggleTextureCB.addItemListener(this);
915
+
916
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
917
+ toggleSwitchCB.setToolTipText("Use switch");
918
+ toggleSwitchCB.addItemListener(this);
919
+
920
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
921
+ autosaveCB.setToolTipText("Auto-save on structure change");
922
+ autosaveCB.addItemListener(this);
923
+
924
+ panel.Return();
925
+ if (Globals.ADVANCED)
926
+ {
707927 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708928 lookAtCB.setToolTipText("Look-at target");
709929 lookAtCB.addItemListener(this);
930
+ }
710931
711932 }
712933
713934 cGridBag fill = new cGridBag();
714
-
715935 fill.preferredHeight = 200;
936
+ cGridBag fill2 = new cGridBag();
937
+ fill2.preferredHeight = 200;
938
+ cGridBag fill3 = new cGridBag();
939
+ fill3.preferredHeight = 200;
716940
717941 panel.add(fill);
942
+ panel.add(fill2);
943
+ panel.add(fill3);
718944
719945 }
720946
721947 void EditObject(Object3D obj)
722948 {
723949 cRadio radioButton = new cRadio(obj.name);
950
+
951
+ // Patch to avoid bug with transparency.
952
+ radioButton.hadMaterial = obj.material != null;
953
+ if (!radioButton.hadMaterial)
954
+ {
955
+ obj.material = new cMaterial();
956
+ }
957
+
724958 radioButton.SetObject(obj);
725959 radioButton.layout = sevenButton;
726960 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -732,6 +966,8 @@
732966
733967 void SetupViews(ObjEditor oe)
734968 {
969
+ theFrame = this;
970
+
735971 oe.SetupViews();
736972
737973 System.out.println("SetupViews");
....@@ -740,23 +976,27 @@
740976 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
741977 }
742978
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;
979
+ cToggleButton liveCB;
980
+ cCheckBox supportCB;
981
+ cCheckBox localCB;
982
+ cCheckBox crowdCB;
983
+ cCheckBox smoothCB;
984
+ cToggleButton fastCB;
985
+ cCheckBox slowCB;
986
+ cCheckBox boxCB;
987
+ cCheckBox zoomBoxCB;
988
+ //cToggleButton trackCB;
989
+ cCheckBox trackCB;
990
+ cCheckBox smoothfocusCB;
754991 // JCheckBox speakerMocapCB;
755
- JCheckBox speakerCameraCB;
756
- JCheckBox speakerFocusCB;
757
- JCheckBox debugCB;
758
- JCheckBox oeilCB;
759
- JCheckBox lookAtCB;
992
+ cCheckBox speakerCameraCB;
993
+ cCheckBox speakerFocusCB;
994
+ cCheckBox debugCB;
995
+
996
+ cCheckBox oeilCB;
997
+ cCheckBox shadowCB;
998
+ cCheckBox autosaveCB;
999
+ cCheckBox lookAtCB;
7601000
7611001 // static int COLOR = 1;
7621002 // static int MATERIAL = 2;
....@@ -764,9 +1004,9 @@
7641004
7651005 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7661006
767
- JCheckBox colorCB;
768
- JCheckBox materialCB;
769
- JCheckBox textureCB;
1007
+ cCheckBox colorCB;
1008
+ cCheckBox materialCB;
1009
+ cCheckBox textureCB;
7701010
7711011 public void itemStateChanged(ItemEvent e)
7721012 {
....@@ -794,6 +1034,7 @@
7941034 } else if(e.getSource() == liveCB)
7951035 {
7961036 cameraView.ToggleLive();
1037
+ refreshContents(false);
7971038 }
7981039 else if(e.getSource() == supportCB)
7991040 {
....@@ -858,6 +1099,14 @@
8581099 {
8591100 cameraView.ToggleOeil();
8601101 }
1102
+ else if(e.getSource() == shadowCB)
1103
+ {
1104
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1105
+ }
1106
+ else if(e.getSource() == autosaveCB)
1107
+ {
1108
+ Globals.SAVEONMAKE ^= true;
1109
+ }
8611110 else if(e.getSource() == lookAtCB)
8621111 {
8631112 cameraView.ToggleLookAt();
....@@ -874,7 +1123,8 @@
8741123
8751124 /**/
8761125 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
877
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1126
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1127
+ TreePath path = objEditor.jTree.getSelectionPath();
8781128 if ((path == null) || (path.getPathCount() <= 1)) {
8791129 // We can't move the root node or an empty selection
8801130 return;
....@@ -991,23 +1241,33 @@
9911241
9921242 assert target == objEditor.jTree;
9931243 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1244
+ Object3D destinationLeaf;
9941245 try {
995
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1246
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9961247 } catch (Exception e) {
9971248 System.out.println("destinationPath : " + destinationPath);
9981249 return;
9991250 }
10001251
1001
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1252
+ for (int i=group.selection.size(); --i>=0;)
10021253 {
1254
+ Object3D child = (Object3D)group.selection.elementAt(i);
1255
+
1256
+ // Cannot move into itself
1257
+ if (child == destinationLeaf)
1258
+ return;
1259
+ }
1260
+
1261
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1262
+// {
10031263 loadClipboard(true);
10041264 objEditor.jTree.setSelectionPath(destinationPath);
10051265 pasteInto(false, false);
1006
- } else {
1007
- loadClipboard(false);
1008
- objEditor.jTree.setSelectionPath(destinationPath);
1009
- pasteInto(false, false); // true); // ???
1010
- }
1266
+// } else {
1267
+// loadClipboard(false);
1268
+// objEditor.jTree.setSelectionPath(destinationPath);
1269
+// pasteInto(false, false); // true); // ???
1270
+// }
10111271 }
10121272 public void dropActionChanged(DropTargetDragEvent dtde)
10131273 // Called if the user has modified the current drop gesture
....@@ -1112,22 +1372,30 @@
11121372 {
11131373 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11141374 //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);
1375
+// gridItem = menu.add(new MenuItem("Grid"));
1376
+// gridItem.addActionListener(this);
1377
+// rectoidItem = menu.add(new MenuItem("Box"));
1378
+// rectoidItem.addActionListener(this);
1379
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1380
+// ellipsoidItem.addActionListener(this);
1381
+// coneItem = menu.add(new MenuItem("Cone"));
1382
+// coneItem.addActionListener(this);
1383
+// torusItem = menu.add(new MenuItem("Torus"));
1384
+// torusItem.addActionListener(this);
1385
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1386
+// superItem.addActionListener(this);
1387
+
1388
+ cameraItem = menu.add(new MenuItem("Camera"));
1389
+ cameraItem.addActionListener(this);
1390
+
1391
+ if (!Globals.ADVANCED)
1392
+ {
11271393 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11281394 kleinItem.addActionListener(this);
1129
- particleItem = menu.add(new MenuItem("Particle system"));
1130
- particleItem.addActionListener(this);
1395
+ }
1396
+
1397
+// particleItem = menu.add(new MenuItem("Particle system"));
1398
+// particleItem.addActionListener(this);
11311399 if (Globals.ADVANCED)
11321400 {
11331401 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1153,15 +1421,15 @@
11531421 }
11541422 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11551423 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);
1424
+// overlayItem = menu.add(new MenuItem("Overlay"));
1425
+// overlayItem.addActionListener(this);
1426
+// lightItem = menu.add(new MenuItem("Light"));
1427
+// lightItem.addActionListener(this);
11601428 menu.add("-");
11611429 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11621430 //superLoopItem.addActionListener(this);
1163
- loopItem = menu.add(new MenuItem("Loop"));
1164
- loopItem.addActionListener(this);
1431
+// loopItem = menu.add(new MenuItem("Loop"));
1432
+// loopItem.addActionListener(this);
11651433 doubleItem = menu.add(new MenuItem("Fork"));
11661434 doubleItem.addActionListener(this);
11671435 if (Globals.ADVANCED)
....@@ -1201,7 +1469,7 @@
12011469 memoryItem.addActionListener(this);
12021470 menu.add(analyzeItem = new MenuItem("Analyze"));
12031471 analyzeItem.addActionListener(this);
1204
- menu.add(dumpItem = new MenuItem("Dump"));
1472
+ menu.add(dumpItem = new MenuItem("Print"));
12051473 dumpItem.addActionListener(this);
12061474 // menu.add(pathItem = new MenuItem("From-to path"));
12071475 // pathItem.addActionListener(this);
....@@ -1342,6 +1610,7 @@
13421610 shadow.material = new cMaterial(obj.material);
13431611 shadow.material.diffuse = 0.0001f;
13441612 shadow.material.specular = 0.0001f;
1613
+ //shadow.projectedVertices[1].x = 300;
13451614
13461615 makeSomething(shadow);
13471616 }
....@@ -1589,7 +1858,7 @@
15891858 {
15901859 ScreenFit();
15911860 } else
1592
- if (source == switchItem)
1861
+ if (source == switchViewItem)
15931862 {
15941863 cVector v1 = new cVector();
15951864 cVector v2 = new cVector();
....@@ -1598,11 +1867,11 @@
15981867 objEditor.cameraView.renderCamera.setAim(v2, v1);
15991868 objEditor.cameraView.repaint();
16001869 } else
1601
- if (source == rectoidItem)
1870
+ if (source == rectoidItem || source == boxButton)
16021871 {
16031872 makeSomething(new Box());
16041873 } else
1605
- if (source == particleItem)
1874
+ if (source == particleItem || source == particlesButton)
16061875 {
16071876 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16081877 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1681,27 +1950,27 @@
16811950
16821951 makeSomething(obj);
16831952 } else
1684
- if (source == gridItem)
1953
+ if (source == gridItem || source == gridButton)
16851954 {
16861955 makeSomething(new Grid());
16871956 } else
1688
- if (source == ellipsoidItem)
1957
+ if (source == ellipsoidItem || source == sphereButton)
16891958 {
16901959 makeSomething(new Sphere());
16911960 } else
1692
- if (source == coneItem)
1961
+ if (source == coneItem || source == coneButton)
16931962 {
16941963 makeSomething(new Cone());
16951964 } else
1696
- if (source == torusItem)
1965
+ if (source == torusItem || source == torusButton)
16971966 {
16981967 makeSomething(new Torus());
16991968 } else
1700
- if (source == superItem)
1969
+ if (source == superItem || source == superButton)
17011970 {
17021971 makeSomething(new Superellipsoid());
17031972 } else
1704
- if (source == kleinItem)
1973
+ if (source == kleinItem || source == kleinButton)
17051974 {
17061975 makeSomething(new Klein());
17071976 } else
....@@ -1721,7 +1990,7 @@
17211990 {
17221991 makeSomething(new BezierSurface());
17231992 } else
1724
- if (source == overlayItem)
1993
+ if (source == overlayItem || source == overlayButton)
17251994 {
17261995 /*
17271996 Object3D obj = new BezierSurface(5,8);
....@@ -1769,7 +2038,7 @@
17692038 s.setup();
17702039 makeSomething(s);
17712040 } else
1772
- if (source == lightItem)
2041
+ if (source == lightItem || source == lightButton)
17732042 {
17742043 makeSomething(new Light());
17752044 } else
....@@ -1819,7 +2088,7 @@
18192088
18202089 group(g);
18212090 } else
1822
- if (source == loopItem)
2091
+ if (source == loopItem || source == loopButton)
18232092 {
18242093 Composite csg = new GroupLeaf();
18252094 csg.count = 5;
....@@ -1854,31 +2123,6 @@
18542123 child = new cGroup();
18552124 csg.addChild(child);
18562125 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
- }
18822126 } else
18832127 if (source == computeAOItem)
18842128 {
....@@ -1916,6 +2160,30 @@
19162160 if (source == dumpItem)
19172161 {
19182162 DumpObject();
2163
+ } else
2164
+ if (source == minButton)
2165
+ {
2166
+ Minimize();
2167
+ } else
2168
+ if (source == maxButton)
2169
+ {
2170
+ Maximize();
2171
+ } else
2172
+ if (source == fullButton)
2173
+ {
2174
+ ToggleFullScreen();
2175
+ } else
2176
+ if (source == undoButton)
2177
+ {
2178
+ Undo();
2179
+ } else
2180
+ if (source == redoButton)
2181
+ {
2182
+ Redo();
2183
+ } else
2184
+ if (source == saveButton)
2185
+ {
2186
+ Save();
19192187 } else
19202188 if (source == oneStepButton)
19212189 {
....@@ -1970,6 +2238,14 @@
19702238 if (source == cutItem || source == clearButton)
19712239 {
19722240 loadClipboard(true);
2241
+ } else
2242
+ if (source == undoItem)
2243
+ {
2244
+ Undo();
2245
+ } else
2246
+ if (source == redoItem)
2247
+ {
2248
+ Redo();
19732249 } else
19742250 if (source == duplicateItem)
19752251 {
....@@ -2302,9 +2578,9 @@
23022578 {
23032579 ClearSelection(true);
23042580 } else
2305
- if (source == grabItem)
2581
+ if (source == grabItem || source == groupButton)
23062582 {
2307
- group(new cGroup(), true);
2583
+ group(new cGroup(), false); // true);
23082584 } else
23092585 if (source == hideItem)
23102586 {
....@@ -2322,11 +2598,11 @@
23222598 {
23232599 makeSomething(new Camera());
23242600 } else
2325
- if (source == compositeItem)
2601
+ if (source == compositeItem || source == compositeButton)
23262602 {
23272603 group(new Composite());
23282604 } else
2329
- if (source == randomItem)
2605
+ if (source == switchItem || source == switchButton)
23302606 {
23312607 RandomNode random = new RandomNode();
23322608 group(random);
....@@ -2428,7 +2704,7 @@
24282704 {
24292705 group(new cLinker());
24302706 } else
2431
- if (source == textureItem)
2707
+ if (source == textureItem || source == textureButton)
24322708 {
24332709 group(new TextureNode());
24342710 } else
....@@ -2448,7 +2724,7 @@
24482724 {
24492725 CastShadow(2);
24502726 } else
2451
- if (source == ungroupItem)
2727
+ if (source == ungroupItem || source == ungroupButton)
24522728 {
24532729 //ungroup();
24542730 for (int i=0; i<group.selection.size(); i++)
....@@ -2470,7 +2746,7 @@
24702746 } else
24712747 if (source == genNormalsMESHItem)
24722748 {
2473
- GenNormals(true); // TODO
2749
+ GenNormalsMESH();
24742750 } else
24752751 if (source == genNormalsORGANItem)
24762752 {
....@@ -2535,6 +2811,22 @@
25352811 if (source == unmarkleavesItem)
25362812 {
25372813 MarkLeaves(false);
2814
+ } else
2815
+ if (source == rewindleavesItem)
2816
+ {
2817
+ RewindLeaves(true);
2818
+ } else
2819
+ if (source == unrewindleavesItem)
2820
+ {
2821
+ RewindLeaves(false);
2822
+ } else
2823
+ if (source == randomleavesItem)
2824
+ {
2825
+ RandomLeaves(true);
2826
+ } else
2827
+ if (source == unrandomleavesItem)
2828
+ {
2829
+ RandomLeaves(false);
25382830 } else
25392831 if (source == flipVItem)
25402832 {
....@@ -2770,6 +3062,10 @@
27703062 if (source == twoButton)
27713063 {
27723064 radio.layout = twoButton;
3065
+
3066
+ if (CameraPane.FULLSCREEN)
3067
+ fullscreenLayout = radio.layout;
3068
+
27733069 // bug
27743070 //gridPanel.setDividerLocation(1.0);
27753071 //bigPanel.setDividerLocation(0.0);
....@@ -2802,10 +3098,31 @@
28023098 bigThree.ClearUI();
28033099 bigThree.add(centralPanel);
28043100 bigThree.FlushUI();
3101
+
3102
+ cameraView.requestFocusInWindow();
3103
+
3104
+// refreshContents(true);
3105
+//
3106
+// try
3107
+// {
3108
+// java.awt.Robot bot = new java.awt.Robot();
3109
+// int mask = InputEvent.BUTTON1_MASK;
3110
+// bot.mouseMove(100, 100);
3111
+// bot.mousePress(mask);
3112
+// bot.mouseRelease(mask);
3113
+// }
3114
+// catch (Exception e)
3115
+// {
3116
+//
3117
+// }
3118
+
28053119 } else
28063120 if (source == threeButton)
28073121 {
28083122 radio.layout = threeButton;
3123
+
3124
+ if (CameraPane.FULLSCREEN)
3125
+ fullscreenLayout = radio.layout;
28093126
28103127 // bigThree.remove(scenePanel);
28113128 // bigThree.remove(centralPanel);
....@@ -2838,10 +3155,15 @@
28383155 bigThree.add(centralPanel);
28393156 bigThree.add(XYZPanel);
28403157 bigThree.FlushUI();
3158
+
3159
+ cameraView.requestFocusInWindow();
28413160 } else
28423161 if (source == fourButton)
28433162 {
28443163 radio.layout = fourButton;
3164
+
3165
+ if (CameraPane.FULLSCREEN)
3166
+ fullscreenLayout = radio.layout;
28453167
28463168 // bigThree.remove(scenePanel);
28473169 // bigThree.remove(centralPanel);
....@@ -2873,10 +3195,15 @@
28733195 bigThree.ClearUI();
28743196 bigThree.add(scenePanel);
28753197 bigThree.FlushUI();
3198
+
3199
+ cameraView.requestFocusInWindow();
28763200 } else
28773201 if (source == sixButton)
28783202 {
28793203 radio.layout = sixButton;
3204
+
3205
+ if (CameraPane.FULLSCREEN)
3206
+ fullscreenLayout = radio.layout;
28803207
28813208 // bigThree.remove(scenePanel);
28823209 // bigThree.remove(centralPanel);
....@@ -2909,10 +3236,15 @@
29093236 bigThree.add(scenePanel);
29103237 bigThree.add(centralPanel);
29113238 bigThree.FlushUI();
3239
+
3240
+ cameraView.requestFocusInWindow();
29123241 } else
29133242 if (source == sevenButton)
29143243 {
29153244 radio.layout = sevenButton;
3245
+
3246
+ if (CameraPane.FULLSCREEN)
3247
+ fullscreenLayout = radio.layout;
29163248
29173249 // bigThree.remove(scenePanel);
29183250 // bigThree.remove(centralPanel);
....@@ -2946,6 +3278,8 @@
29463278 bigThree.add(centralPanel);
29473279 bigThree.add(XYZPanel);
29483280 bigThree.FlushUI();
3281
+
3282
+ cameraView.requestFocusInWindow();
29493283 } else
29503284 if (source == rootButton)
29513285 {
....@@ -2957,6 +3291,7 @@
29573291 EditObject(obj);
29583292 }
29593293
3294
+ cameraView.requestFocusInWindow();
29603295 refreshContents(true);
29613296 } else
29623297 if (source == closeButton)
....@@ -2966,18 +3301,27 @@
29663301 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29673302 {
29683303 ab = (cRadio)e.nextElement();
2969
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3304
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29703305 {
3306
+ // Patch to avoid bug with transparency.
3307
+ if (!ab.hadMaterial)
3308
+ {
3309
+ ab.object.material = null;
3310
+ }
3311
+
29713312 buttonGroup.remove(ab);
29723313 radioPanel.remove(ab);
29733314
2974
- ab.GetObject().editWindow = null;
3315
+ //ab.GetObject().editWindow = null;
3316
+ ab.GetObject().manipWindow = null;
29753317 // ab.GetObject().objectUI = null; // ?????????
29763318
29773319 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29783320 break;
29793321 }
29803322 }
3323
+
3324
+ cameraView.requestFocusInWindow();
29813325 refreshContents(true);
29823326 } else
29833327 if (source == editItem || source == editButton)
....@@ -2994,7 +3338,7 @@
29943338 child.CloseUI();
29953339 listUI.remove(child);
29963340
2997
- child.editWindow = null; // ???????????
3341
+ //child.editWindow = null; // ???????????
29983342 }
29993343 objEditor.ctrlPanel.FlushUI();
30003344 //objEditor.jTree.clearSelection();
....@@ -3081,7 +3425,9 @@
30813425 sideView.object = group;
30823426 }
30833427
3084
-// fix "+" issue group.editWindow = this;
3428
+// fix "+" issue
3429
+ //group.editWindow = this;
3430
+ group.manipWindow = this;
30853431
30863432 /*
30873433 currentLayout = radio.layout;
....@@ -3094,8 +3440,23 @@
30943440 //group.parent = null; // ROOT
30953441 //group.attributes = -1;
30963442 ResetModel();
3443
+
3444
+ cameraView.requestFocusInWindow();
30973445 refreshContents(true);
3098
- }
3446
+ } else if (event.getSource() == editCameraItem)
3447
+ {
3448
+ cameraView.ProtectCamera();
3449
+ cameraView.repaint();
3450
+ return;
3451
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3452
+ {
3453
+ cameraView.RevertCamera();
3454
+ cameraView.repaint();
3455
+ return;
3456
+ // } else if (event.getSource() == textureButton)
3457
+ // {
3458
+ // return; // true;
3459
+ }
30993460 else
31003461 {
31013462 //return super.action(event, arg);
....@@ -3104,7 +3465,6 @@
31043465 }
31053466
31063467 boolean useclient = false;
3107
- cRadio radio;
31083468
31093469 void ToggleRoot()
31103470 {
....@@ -3343,7 +3703,8 @@
33433703
33443704 int size = obj.MemorySize();
33453705
3346
- System.err.println((size/1024) + " KB is the size of " + obj);
3706
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3707
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33473708 }
33483709 }
33493710 catch (Exception e)
....@@ -3424,6 +3785,13 @@
34243785 void GenNormals(boolean crease)
34253786 {
34263787 group.GenNormalsS(crease);
3788
+
3789
+ refreshContents();
3790
+ }
3791
+
3792
+ void GenNormalsMESH()
3793
+ {
3794
+ group.GenNormalsMeshS();
34273795
34283796 refreshContents();
34293797 }
....@@ -4051,6 +4419,18 @@
40514419 refreshContents();
40524420 }
40534421
4422
+ void RewindLeaves(boolean hide)
4423
+ {
4424
+ group.selection.RewindLeaves(hide);
4425
+ refreshContents();
4426
+ }
4427
+
4428
+ void RandomLeaves(boolean hide)
4429
+ {
4430
+ group.selection.RandomLeaves(hide);
4431
+ refreshContents();
4432
+ }
4433
+
40544434 void SetTexRes(int tr)
40554435 {
40564436 group.selection.SetTexRes(tr);
....@@ -4133,7 +4513,7 @@
41334513 {
41344514 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41354515 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4136
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4516
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41374517
41384518 Object3D elem = (Object3D)group.selection.elementAt(i);
41394519 if(elem != group || !newWindow)
....@@ -4226,7 +4606,6 @@
42264606 //case 702: // Event.LIST_DESELECT
42274607 group.deselectAll();
42284608 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4229
- objEditor.ClearInfo(); // .GetMaterial());
42304609 if (tps != null)
42314610 {
42324611 for (int i=0; i < tps.length; i++)
....@@ -4235,10 +4614,8 @@
42354614
42364615 //if (child.parent != null)
42374616 //child.parent.addSelectee(child);
4617
+ objEditor.SetMaterial(child);
42384618 group.addSelectee(child);
4239
- objEditor.SetMaterial(child); // .GetMaterial());
4240
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4241
- System.err.println("info : " + child.GetPath());
42424619 }
42434620 }
42444621 // else
....@@ -4248,16 +4625,17 @@
42484625 // System.err.println("info : " + group.GetPath());
42494626 // }
42504627
4251
- objEditor.SetText(); // jan 2014
4252
-
4253
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4628
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42544629 CameraPane.flash = true;
42554630
4256
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4631
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42574632 // a camera
42584633 {
4259
- CameraPane.camerachangeframe = 0; // don't refuse it
4260
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4634
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4635
+ {
4636
+ CameraPane.camerachangeframe = 0; // don't refuse it
4637
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4638
+ }
42614639 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42624640 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42634641 }
....@@ -4270,6 +4648,27 @@
42704648
42714649 freezemodel = false;
42724650 }
4651
+
4652
+ void refreshContents(boolean cp)
4653
+ {
4654
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4655
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4656
+ {
4657
+ objEditor.ClearInfo(); // .GetMaterial());
4658
+
4659
+ for (int i=0; i < group.selection.Size(); i++)
4660
+ {
4661
+ Object3D child = (Object3D) group.selection.get(i);
4662
+
4663
+ objEditor.AddInfo(child, this, true);
4664
+ System.err.println("info : " + child.GetPath());
4665
+ }
4666
+
4667
+ objEditor.SetText(); // jan 2014
4668
+ }
4669
+
4670
+ super.refreshContents(cp);
4671
+ }
42734672
42744673 void linkSomething(Object3D thing)
42754674 {
....@@ -4341,6 +4740,7 @@
43414740 {
43424741 if (group.selection.isEmpty())
43434742 return;
4743
+
43444744 Grafreed.clipboardIsTempGroup = false;
43454745 Composite tGroup = null;
43464746 if (group.selection.size() > 0) // 1)
....@@ -4351,6 +4751,8 @@
43514751
43524752 if (cut)
43534753 {
4754
+ if (Globals.SAVEONMAKE)
4755
+ Save();
43544756 //int indices[] = jList.getSelectedIndices();
43554757 //for (int i = indices.length - 1; i >= 0; i--)
43564758 //jList.remove(indices[i]);
....@@ -4440,8 +4842,10 @@
44404842 }
44414843
44424844 }
4845
+
44434846 if (Grafreed.clipboardIsTempGroup)
44444847 Grafreed.clipboard = tGroup;
4848
+
44454849 if (cut)
44464850 {
44474851 ResetModel();
....@@ -4973,21 +5377,6 @@
49735377 }
49745378 */
49755379
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
-
49915380 /*
49925381 public void Callback(Object obj)
49935382 {
....@@ -5011,23 +5400,6 @@
50115400 }
50125401 */
50135402
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
-
50315403 String GetFile(String dialogName)
50325404 {
50335405 if (Grafreed.standAlone)
....@@ -5098,7 +5470,33 @@
50985470 cButton clearpanelButton;
50995471 cButton unselectButton;
51005472
5473
+ cButton restoreCameraButton;
5474
+
5475
+ cButton minButton;
5476
+ cButton maxButton;
5477
+ cButton fullButton;
5478
+ cButton undoButton;
5479
+ cButton redoButton;
5480
+ cButton saveButton;
51015481 cButton oneStepButton;
5482
+
5483
+ cButton groupButton;
5484
+ cButton ungroupButton;
5485
+ cButton compositeButton;
5486
+ cButton switchButton;
5487
+ cButton loopButton;
5488
+ cButton textureButton;
5489
+
5490
+ cButton gridButton;
5491
+ cButton boxButton;
5492
+ cButton sphereButton;
5493
+ cButton coneButton;
5494
+ cButton torusButton;
5495
+ cButton superButton;
5496
+ cButton kleinButton;
5497
+ cButton particlesButton;
5498
+ cButton overlayButton;
5499
+ cButton lightButton;
51025500
51035501 cButton screenfitButton;
51045502 cButton screenfitpointButton;
....@@ -5111,14 +5509,6 @@
51115509
51125510 cButton setsupportButton;
51135511
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
-
51225512 //
51235513 //Composite
51245514 Object3D // to do !!
....@@ -5128,9 +5518,11 @@
51285518 //JTree jTree;
51295519 private MenuItem lookAtItem;
51305520 private MenuItem lookFromItem;
5131
- private MenuItem switchItem;
5521
+ private MenuItem switchViewItem;
51325522 private MenuItem cutItem;
5133
- private MenuItem duplicateItem;
5523
+ private MenuItem undoItem;
5524
+ private MenuItem redoItem;
5525
+ private JMenuItem duplicateItem;
51345526 private MenuItem cloneItem;
51355527 private MenuItem cloneSupportItem;
51365528 private MenuItem overwriteGeoItem;
....@@ -5193,6 +5585,10 @@
51935585 private MenuItem showleavesItem;
51945586 private MenuItem markleavesItem;
51955587 private MenuItem unmarkleavesItem;
5588
+ private MenuItem rewindleavesItem;
5589
+ private MenuItem unrewindleavesItem;
5590
+ private MenuItem randomleavesItem;
5591
+ private MenuItem unrandomleavesItem;
51965592
51975593 private MenuItem flipVItem;
51985594 private MenuItem unflipVItem;
....@@ -5214,7 +5610,7 @@
52145610 private MenuItem frontItem;
52155611 private MenuItem cameraItem;
52165612 private MenuItem compositeItem;
5217
- private MenuItem randomItem;
5613
+ private MenuItem switchItem;
52185614 private MenuItem physicsItem;
52195615 private MenuItem frameselectorItem;
52205616 private MenuItem scriptNodeItem;
....@@ -5276,11 +5672,6 @@
52765672 private MenuItem doubleItem;
52775673 private MenuItem tripleItem;
52785674
5279
- private MenuItem importGFDItem;
5280
- private MenuItem importVRMLX3DItem;
5281
- private MenuItem import3DSItem;
5282
- private MenuItem importOBJItem;
5283
-
52845675 private MenuItem computeAOItem;
52855676 private MenuItem recompileItem;
52865677 private MenuItem editScriptItem;
....@@ -5290,4 +5681,8 @@
52905681 private MenuItem analyzeItem;
52915682 private MenuItem dumpItem;
52925683 //boolean freezemodel = false;
5684
+
5685
+ Menu cameraMenu;
5686
+ MenuItem editCameraItem;
5687
+ MenuItem restoreCameraItem;
52935688 }