Normand Briere
2019-06-25 829f93f305ce15893aada126a98d9068b1cdefed
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);
....@@ -729,8 +963,11 @@
729963 buttonGroup.add(radioButton);
730964 radioButton.doClick();
731965 }
966
+
732967 void SetupViews(ObjEditor oe)
733968 {
969
+ theFrame = this;
970
+
734971 oe.SetupViews();
735972
736973 System.out.println("SetupViews");
....@@ -739,23 +976,27 @@
739976 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
740977 }
741978
742
- JCheckBox liveCB;
743
- JCheckBox supportCB;
744
- JCheckBox localCB;
745
- JCheckBox crowdCB;
746
- JCheckBox smoothCB;
747
- JCheckBox fastCB;
748
- JCheckBox slowCB;
749
- JCheckBox boxCB;
750
- JCheckBox zoomBoxCB;
751
- JCheckBox trackCB;
752
- JCheckBox smoothfocusCB;
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;
753991 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
992
+ cCheckBox speakerCameraCB;
993
+ cCheckBox speakerFocusCB;
994
+ cCheckBox debugCB;
995
+
996
+ cCheckBox oeilCB;
997
+ cCheckBox shadowCB;
998
+ cCheckBox autosaveCB;
999
+ cCheckBox lookAtCB;
7591000
7601001 // static int COLOR = 1;
7611002 // static int MATERIAL = 2;
....@@ -763,9 +1004,9 @@
7631004
7641005 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7651006
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
1007
+ cCheckBox colorCB;
1008
+ cCheckBox materialCB;
1009
+ cCheckBox textureCB;
7691010
7701011 public void itemStateChanged(ItemEvent e)
7711012 {
....@@ -793,6 +1034,7 @@
7931034 } else if(e.getSource() == liveCB)
7941035 {
7951036 cameraView.ToggleLive();
1037
+ refreshContents(false);
7961038 }
7971039 else if(e.getSource() == supportCB)
7981040 {
....@@ -857,6 +1099,14 @@
8571099 {
8581100 cameraView.ToggleOeil();
8591101 }
1102
+ else if(e.getSource() == shadowCB)
1103
+ {
1104
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1105
+ }
1106
+ else if(e.getSource() == autosaveCB)
1107
+ {
1108
+ Globals.SAVEONMAKE ^= true;
1109
+ }
8601110 else if(e.getSource() == lookAtCB)
8611111 {
8621112 cameraView.ToggleLookAt();
....@@ -873,7 +1123,8 @@
8731123
8741124 /**/
8751125 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
876
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1126
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1127
+ TreePath path = objEditor.jTree.getSelectionPath();
8771128 if ((path == null) || (path.getPathCount() <= 1)) {
8781129 // We can't move the root node or an empty selection
8791130 return;
....@@ -990,23 +1241,33 @@
9901241
9911242 assert target == objEditor.jTree;
9921243 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1244
+ Object3D destinationLeaf;
9931245 try {
994
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1246
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9951247 } catch (Exception e) {
9961248 System.out.println("destinationPath : " + destinationPath);
9971249 return;
9981250 }
9991251
1000
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1252
+ for (int i=group.selection.size(); --i>=0;)
10011253 {
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
+// {
10021263 loadClipboard(true);
10031264 objEditor.jTree.setSelectionPath(destinationPath);
10041265 pasteInto(false, false);
1005
- } else {
1006
- loadClipboard(false);
1007
- objEditor.jTree.setSelectionPath(destinationPath);
1008
- pasteInto(false, false); // true); // ???
1009
- }
1266
+// } else {
1267
+// loadClipboard(false);
1268
+// objEditor.jTree.setSelectionPath(destinationPath);
1269
+// pasteInto(false, false); // true); // ???
1270
+// }
10101271 }
10111272 public void dropActionChanged(DropTargetDragEvent dtde)
10121273 // Called if the user has modified the current drop gesture
....@@ -1111,22 +1372,30 @@
11111372 {
11121373 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11131374 //heightFieldItem.addActionListener(this);
1114
- gridItem = menu.add(new MenuItem("Grid"));
1115
- gridItem.addActionListener(this);
1116
- rectoidItem = menu.add(new MenuItem("Box"));
1117
- rectoidItem.addActionListener(this);
1118
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1119
- ellipsoidItem.addActionListener(this);
1120
- coneItem = menu.add(new MenuItem("Cone"));
1121
- coneItem.addActionListener(this);
1122
- torusItem = menu.add(new MenuItem("Torus"));
1123
- torusItem.addActionListener(this);
1124
- superItem = menu.add(new MenuItem("Superellipsoid"));
1125
- superItem.addActionListener(this);
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
+ {
11261393 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11271394 kleinItem.addActionListener(this);
1128
- particleItem = menu.add(new MenuItem("Particle system"));
1129
- particleItem.addActionListener(this);
1395
+ }
1396
+
1397
+// particleItem = menu.add(new MenuItem("Particle system"));
1398
+// particleItem.addActionListener(this);
11301399 if (Globals.ADVANCED)
11311400 {
11321401 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1152,15 +1421,15 @@
11521421 }
11531422 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11541423 bezierItem.addActionListener(this);
1155
- overlayItem = menu.add(new MenuItem("Overlay"));
1156
- overlayItem.addActionListener(this);
1157
- lightItem = menu.add(new MenuItem("Light"));
1158
- lightItem.addActionListener(this);
1424
+// overlayItem = menu.add(new MenuItem("Overlay"));
1425
+// overlayItem.addActionListener(this);
1426
+// lightItem = menu.add(new MenuItem("Light"));
1427
+// lightItem.addActionListener(this);
11591428 menu.add("-");
11601429 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11611430 //superLoopItem.addActionListener(this);
1162
- loopItem = menu.add(new MenuItem("Loop"));
1163
- loopItem.addActionListener(this);
1431
+// loopItem = menu.add(new MenuItem("Loop"));
1432
+// loopItem.addActionListener(this);
11641433 doubleItem = menu.add(new MenuItem("Fork"));
11651434 doubleItem.addActionListener(this);
11661435 if (Globals.ADVANCED)
....@@ -1200,7 +1469,7 @@
12001469 memoryItem.addActionListener(this);
12011470 menu.add(analyzeItem = new MenuItem("Analyze"));
12021471 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1472
+ menu.add(dumpItem = new MenuItem("Print"));
12041473 dumpItem.addActionListener(this);
12051474 // menu.add(pathItem = new MenuItem("From-to path"));
12061475 // pathItem.addActionListener(this);
....@@ -1341,6 +1610,7 @@
13411610 shadow.material = new cMaterial(obj.material);
13421611 shadow.material.diffuse = 0.0001f;
13431612 shadow.material.specular = 0.0001f;
1613
+ //shadow.projectedVertices[1].x = 300;
13441614
13451615 makeSomething(shadow);
13461616 }
....@@ -1588,7 +1858,7 @@
15881858 {
15891859 ScreenFit();
15901860 } else
1591
- if (source == switchItem)
1861
+ if (source == switchViewItem)
15921862 {
15931863 cVector v1 = new cVector();
15941864 cVector v2 = new cVector();
....@@ -1597,11 +1867,11 @@
15971867 objEditor.cameraView.renderCamera.setAim(v2, v1);
15981868 objEditor.cameraView.repaint();
15991869 } else
1600
- if (source == rectoidItem)
1870
+ if (source == rectoidItem || source == boxButton)
16011871 {
16021872 makeSomething(new Box());
16031873 } else
1604
- if (source == particleItem)
1874
+ if (source == particleItem || source == particlesButton)
16051875 {
16061876 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16071877 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1680,27 +1950,27 @@
16801950
16811951 makeSomething(obj);
16821952 } else
1683
- if (source == gridItem)
1953
+ if (source == gridItem || source == gridButton)
16841954 {
16851955 makeSomething(new Grid());
16861956 } else
1687
- if (source == ellipsoidItem)
1957
+ if (source == ellipsoidItem || source == sphereButton)
16881958 {
16891959 makeSomething(new Sphere());
16901960 } else
1691
- if (source == coneItem)
1961
+ if (source == coneItem || source == coneButton)
16921962 {
16931963 makeSomething(new Cone());
16941964 } else
1695
- if (source == torusItem)
1965
+ if (source == torusItem || source == torusButton)
16961966 {
16971967 makeSomething(new Torus());
16981968 } else
1699
- if (source == superItem)
1969
+ if (source == superItem || source == superButton)
17001970 {
17011971 makeSomething(new Superellipsoid());
17021972 } else
1703
- if (source == kleinItem)
1973
+ if (source == kleinItem || source == kleinButton)
17041974 {
17051975 makeSomething(new Klein());
17061976 } else
....@@ -1720,7 +1990,7 @@
17201990 {
17211991 makeSomething(new BezierSurface());
17221992 } else
1723
- if (source == overlayItem)
1993
+ if (source == overlayItem || source == overlayButton)
17241994 {
17251995 /*
17261996 Object3D obj = new BezierSurface(5,8);
....@@ -1768,7 +2038,7 @@
17682038 s.setup();
17692039 makeSomething(s);
17702040 } else
1771
- if (source == lightItem)
2041
+ if (source == lightItem || source == lightButton)
17722042 {
17732043 makeSomething(new Light());
17742044 } else
....@@ -1818,7 +2088,7 @@
18182088
18192089 group(g);
18202090 } else
1821
- if (source == loopItem)
2091
+ if (source == loopItem || source == loopButton)
18222092 {
18232093 Composite csg = new GroupLeaf();
18242094 csg.count = 5;
....@@ -1853,31 +2123,6 @@
18532123 child = new cGroup();
18542124 csg.addChild(child);
18552125 child.addChild(csg);
1856
- } else
1857
-
1858
- if (source == importGFDItem)
1859
- {
1860
- ImportGFD();
1861
- } else
1862
- if (source == importVRMLX3DItem)
1863
- {
1864
- ImportVRMLX3D();
1865
- } else
1866
- if (source == import3DSItem)
1867
- {
1868
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1869
- } else
1870
- if (source == importOBJItem)
1871
- {
1872
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1874
- browser.setVisible(true);
1875
- String filename = browser.getFile();
1876
- if (filename != null && filename.length() > 0)
1877
- {
1878
- String fullname = browser.getDirectory() + filename;
1879
- makeSomething(ReadOBJ(fullname), true);
1880
- }
18812126 } else
18822127 if (source == computeAOItem)
18832128 {
....@@ -1915,6 +2160,30 @@
19152160 if (source == dumpItem)
19162161 {
19172162 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();
19182187 } else
19192188 if (source == oneStepButton)
19202189 {
....@@ -1969,6 +2238,14 @@
19692238 if (source == cutItem || source == clearButton)
19702239 {
19712240 loadClipboard(true);
2241
+ } else
2242
+ if (source == undoItem)
2243
+ {
2244
+ Undo();
2245
+ } else
2246
+ if (source == redoItem)
2247
+ {
2248
+ Redo();
19722249 } else
19732250 if (source == duplicateItem)
19742251 {
....@@ -2301,9 +2578,9 @@
23012578 {
23022579 ClearSelection(true);
23032580 } else
2304
- if (source == grabItem)
2581
+ if (source == grabItem || source == groupButton)
23052582 {
2306
- group(new cGroup(), true);
2583
+ group(new cGroup(), false); // true);
23072584 } else
23082585 if (source == hideItem)
23092586 {
....@@ -2321,11 +2598,11 @@
23212598 {
23222599 makeSomething(new Camera());
23232600 } else
2324
- if (source == compositeItem)
2601
+ if (source == compositeItem || source == compositeButton)
23252602 {
23262603 group(new Composite());
23272604 } else
2328
- if (source == randomItem)
2605
+ if (source == switchItem || source == switchButton)
23292606 {
23302607 RandomNode random = new RandomNode();
23312608 group(random);
....@@ -2427,7 +2704,7 @@
24272704 {
24282705 group(new cLinker());
24292706 } else
2430
- if (source == textureItem)
2707
+ if (source == textureItem || source == textureButton)
24312708 {
24322709 group(new TextureNode());
24332710 } else
....@@ -2447,7 +2724,7 @@
24472724 {
24482725 CastShadow(2);
24492726 } else
2450
- if (source == ungroupItem)
2727
+ if (source == ungroupItem || source == ungroupButton)
24512728 {
24522729 //ungroup();
24532730 for (int i=0; i<group.selection.size(); i++)
....@@ -2469,7 +2746,7 @@
24692746 } else
24702747 if (source == genNormalsMESHItem)
24712748 {
2472
- GenNormals(true); // TODO
2749
+ GenNormalsMESH();
24732750 } else
24742751 if (source == genNormalsORGANItem)
24752752 {
....@@ -2534,6 +2811,22 @@
25342811 if (source == unmarkleavesItem)
25352812 {
25362813 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);
25372830 } else
25382831 if (source == flipVItem)
25392832 {
....@@ -2769,6 +3062,10 @@
27693062 if (source == twoButton)
27703063 {
27713064 radio.layout = twoButton;
3065
+
3066
+ if (CameraPane.FULLSCREEN)
3067
+ fullscreenLayout = radio.layout;
3068
+
27723069 // bug
27733070 //gridPanel.setDividerLocation(1.0);
27743071 //bigPanel.setDividerLocation(0.0);
....@@ -2801,10 +3098,31 @@
28013098 bigThree.ClearUI();
28023099 bigThree.add(centralPanel);
28033100 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
+
28043119 } else
28053120 if (source == threeButton)
28063121 {
28073122 radio.layout = threeButton;
3123
+
3124
+ if (CameraPane.FULLSCREEN)
3125
+ fullscreenLayout = radio.layout;
28083126
28093127 // bigThree.remove(scenePanel);
28103128 // bigThree.remove(centralPanel);
....@@ -2837,10 +3155,15 @@
28373155 bigThree.add(centralPanel);
28383156 bigThree.add(XYZPanel);
28393157 bigThree.FlushUI();
3158
+
3159
+ cameraView.requestFocusInWindow();
28403160 } else
28413161 if (source == fourButton)
28423162 {
28433163 radio.layout = fourButton;
3164
+
3165
+ if (CameraPane.FULLSCREEN)
3166
+ fullscreenLayout = radio.layout;
28443167
28453168 // bigThree.remove(scenePanel);
28463169 // bigThree.remove(centralPanel);
....@@ -2872,10 +3195,15 @@
28723195 bigThree.ClearUI();
28733196 bigThree.add(scenePanel);
28743197 bigThree.FlushUI();
3198
+
3199
+ cameraView.requestFocusInWindow();
28753200 } else
28763201 if (source == sixButton)
28773202 {
28783203 radio.layout = sixButton;
3204
+
3205
+ if (CameraPane.FULLSCREEN)
3206
+ fullscreenLayout = radio.layout;
28793207
28803208 // bigThree.remove(scenePanel);
28813209 // bigThree.remove(centralPanel);
....@@ -2908,10 +3236,15 @@
29083236 bigThree.add(scenePanel);
29093237 bigThree.add(centralPanel);
29103238 bigThree.FlushUI();
3239
+
3240
+ cameraView.requestFocusInWindow();
29113241 } else
29123242 if (source == sevenButton)
29133243 {
29143244 radio.layout = sevenButton;
3245
+
3246
+ if (CameraPane.FULLSCREEN)
3247
+ fullscreenLayout = radio.layout;
29153248
29163249 // bigThree.remove(scenePanel);
29173250 // bigThree.remove(centralPanel);
....@@ -2945,6 +3278,8 @@
29453278 bigThree.add(centralPanel);
29463279 bigThree.add(XYZPanel);
29473280 bigThree.FlushUI();
3281
+
3282
+ cameraView.requestFocusInWindow();
29483283 } else
29493284 if (source == rootButton)
29503285 {
....@@ -2956,6 +3291,7 @@
29563291 EditObject(obj);
29573292 }
29583293
3294
+ cameraView.requestFocusInWindow();
29593295 refreshContents(true);
29603296 } else
29613297 if (source == closeButton)
....@@ -2965,18 +3301,27 @@
29653301 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663302 {
29673303 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3304
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693305 {
3306
+ // Patch to avoid bug with transparency.
3307
+ if (!ab.hadMaterial)
3308
+ {
3309
+ ab.object.material = null;
3310
+ }
3311
+
29703312 buttonGroup.remove(ab);
29713313 radioPanel.remove(ab);
29723314
2973
- ab.GetObject().editWindow = null;
3315
+ //ab.GetObject().editWindow = null;
3316
+ ab.GetObject().manipWindow = null;
29743317 // ab.GetObject().objectUI = null; // ?????????
29753318
29763319 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773320 break;
29783321 }
29793322 }
3323
+
3324
+ cameraView.requestFocusInWindow();
29803325 refreshContents(true);
29813326 } else
29823327 if (source == editItem || source == editButton)
....@@ -2993,7 +3338,7 @@
29933338 child.CloseUI();
29943339 listUI.remove(child);
29953340
2996
- child.editWindow = null; // ???????????
3341
+ //child.editWindow = null; // ???????????
29973342 }
29983343 objEditor.ctrlPanel.FlushUI();
29993344 //objEditor.jTree.clearSelection();
....@@ -3079,7 +3424,11 @@
30793424 frontView.object = group;
30803425 sideView.object = group;
30813426 }
3082
- group.editWindow = this;
3427
+
3428
+// fix "+" issue
3429
+ //group.editWindow = this;
3430
+ group.manipWindow = this;
3431
+
30833432 /*
30843433 currentLayout = radio.layout;
30853434 if (currentLayout == null)
....@@ -3091,8 +3440,23 @@
30913440 //group.parent = null; // ROOT
30923441 //group.attributes = -1;
30933442 ResetModel();
3443
+
3444
+ cameraView.requestFocusInWindow();
30943445 refreshContents(true);
3095
- }
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
+ }
30963460 else
30973461 {
30983462 //return super.action(event, arg);
....@@ -3101,7 +3465,6 @@
31013465 }
31023466
31033467 boolean useclient = false;
3104
- cRadio radio;
31053468
31063469 void ToggleRoot()
31073470 {
....@@ -3340,7 +3703,8 @@
33403703
33413704 int size = obj.MemorySize();
33423705
3343
- 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)");
33443708 }
33453709 }
33463710 catch (Exception e)
....@@ -3421,6 +3785,13 @@
34213785 void GenNormals(boolean crease)
34223786 {
34233787 group.GenNormalsS(crease);
3788
+
3789
+ refreshContents();
3790
+ }
3791
+
3792
+ void GenNormalsMESH()
3793
+ {
3794
+ group.GenNormalsMeshS();
34243795
34253796 refreshContents();
34263797 }
....@@ -4048,6 +4419,18 @@
40484419 refreshContents();
40494420 }
40504421
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
+
40514434 void SetTexRes(int tr)
40524435 {
40534436 group.selection.SetTexRes(tr);
....@@ -4130,10 +4513,10 @@
41304513 {
41314514 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41324515 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4133
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4516
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41344517
41354518 Object3D elem = (Object3D)group.selection.elementAt(i);
4136
- if(elem != group)
4519
+ if(elem != group || !newWindow)
41374520 {
41384521 // if (!(elem instanceof Composite))
41394522 // newWindow = false;
....@@ -4223,7 +4606,6 @@
42234606 //case 702: // Event.LIST_DESELECT
42244607 group.deselectAll();
42254608 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4226
- objEditor.ClearInfo(); // .GetMaterial());
42274609 if (tps != null)
42284610 {
42294611 for (int i=0; i < tps.length; i++)
....@@ -4232,10 +4614,8 @@
42324614
42334615 //if (child.parent != null)
42344616 //child.parent.addSelectee(child);
4617
+ objEditor.SetMaterial(child);
42354618 group.addSelectee(child);
4236
- objEditor.SetMaterial(child); // .GetMaterial());
4237
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4238
- System.err.println("info : " + child.GetPath());
42394619 }
42404620 }
42414621 // else
....@@ -4245,16 +4625,17 @@
42454625 // System.err.println("info : " + group.GetPath());
42464626 // }
42474627
4248
- objEditor.SetText(); // jan 2014
4249
-
4250
- 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))
42514629 CameraPane.flash = true;
42524630
4253
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4631
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42544632 // a camera
42554633 {
4256
- CameraPane.camerachangeframe = 0; // don't refuse it
4257
- 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
+ }
42584639 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42594640 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42604641 }
....@@ -4267,6 +4648,27 @@
42674648
42684649 freezemodel = false;
42694650 }
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
+ }
42704672
42714673 void linkSomething(Object3D thing)
42724674 {
....@@ -4338,6 +4740,7 @@
43384740 {
43394741 if (group.selection.isEmpty())
43404742 return;
4743
+
43414744 Grafreed.clipboardIsTempGroup = false;
43424745 Composite tGroup = null;
43434746 if (group.selection.size() > 0) // 1)
....@@ -4348,6 +4751,8 @@
43484751
43494752 if (cut)
43504753 {
4754
+ if (Globals.SAVEONMAKE)
4755
+ Save();
43514756 //int indices[] = jList.getSelectedIndices();
43524757 //for (int i = indices.length - 1; i >= 0; i--)
43534758 //jList.remove(indices[i]);
....@@ -4437,8 +4842,10 @@
44374842 }
44384843
44394844 }
4845
+
44404846 if (Grafreed.clipboardIsTempGroup)
44414847 Grafreed.clipboard = tGroup;
4848
+
44424849 if (cut)
44434850 {
44444851 ResetModel();
....@@ -4970,21 +5377,6 @@
49705377 }
49715378 */
49725379
4973
- void ImportGFD()
4974
- {
4975
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4976
- browser.show();
4977
- String filename = browser.getFile();
4978
- if (filename != null && filename.length() > 0)
4979
- {
4980
- String fullname = browser.getDirectory() + filename;
4981
-
4982
- //Object3D readobj =
4983
- objEditor.ReadGFD(fullname, objEditor);
4984
- //makeSomething(readobj);
4985
- }
4986
- }
4987
-
49885380 /*
49895381 public void Callback(Object obj)
49905382 {
....@@ -5008,23 +5400,6 @@
50085400 }
50095401 */
50105402
5011
- void ImportVRMLX3D()
5012
- {
5013
- if (Grafreed.standAlone)
5014
- {
5015
- /**/
5016
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5017
- browser.show();
5018
- String filename = browser.getFile();
5019
- if (filename != null && filename.length() > 0)
5020
- {
5021
- String fullname = browser.getDirectory() + filename;
5022
- LoadVRMLX3D(fullname);
5023
- }
5024
- /**/
5025
- }
5026
- }
5027
-
50285403 String GetFile(String dialogName)
50295404 {
50305405 if (Grafreed.standAlone)
....@@ -5095,7 +5470,33 @@
50955470 cButton clearpanelButton;
50965471 cButton unselectButton;
50975472
5473
+ cButton restoreCameraButton;
5474
+
5475
+ cButton minButton;
5476
+ cButton maxButton;
5477
+ cButton fullButton;
5478
+ cButton undoButton;
5479
+ cButton redoButton;
5480
+ cButton saveButton;
50985481 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;
50995500
51005501 cButton screenfitButton;
51015502 cButton screenfitpointButton;
....@@ -5108,14 +5509,6 @@
51085509
51095510 cButton setsupportButton;
51105511
5111
- cButton twoButton;
5112
- cButton sixButton;
5113
- cButton threeButton;
5114
- cButton sevenButton;
5115
- cButton fourButton; // full panel
5116
- cButton oneButton; // full XYZ
5117
- //cButton currentLayout;
5118
-
51195512 //
51205513 //Composite
51215514 Object3D // to do !!
....@@ -5125,9 +5518,11 @@
51255518 //JTree jTree;
51265519 private MenuItem lookAtItem;
51275520 private MenuItem lookFromItem;
5128
- private MenuItem switchItem;
5521
+ private MenuItem switchViewItem;
51295522 private MenuItem cutItem;
5130
- private MenuItem duplicateItem;
5523
+ private MenuItem undoItem;
5524
+ private MenuItem redoItem;
5525
+ private JMenuItem duplicateItem;
51315526 private MenuItem cloneItem;
51325527 private MenuItem cloneSupportItem;
51335528 private MenuItem overwriteGeoItem;
....@@ -5190,6 +5585,10 @@
51905585 private MenuItem showleavesItem;
51915586 private MenuItem markleavesItem;
51925587 private MenuItem unmarkleavesItem;
5588
+ private MenuItem rewindleavesItem;
5589
+ private MenuItem unrewindleavesItem;
5590
+ private MenuItem randomleavesItem;
5591
+ private MenuItem unrandomleavesItem;
51935592
51945593 private MenuItem flipVItem;
51955594 private MenuItem unflipVItem;
....@@ -5211,7 +5610,7 @@
52115610 private MenuItem frontItem;
52125611 private MenuItem cameraItem;
52135612 private MenuItem compositeItem;
5214
- private MenuItem randomItem;
5613
+ private MenuItem switchItem;
52155614 private MenuItem physicsItem;
52165615 private MenuItem frameselectorItem;
52175616 private MenuItem scriptNodeItem;
....@@ -5273,11 +5672,6 @@
52735672 private MenuItem doubleItem;
52745673 private MenuItem tripleItem;
52755674
5276
- private MenuItem importGFDItem;
5277
- private MenuItem importVRMLX3DItem;
5278
- private MenuItem import3DSItem;
5279
- private MenuItem importOBJItem;
5280
-
52815675 private MenuItem computeAOItem;
52825676 private MenuItem recompileItem;
52835677 private MenuItem editScriptItem;
....@@ -5287,4 +5681,8 @@
52875681 private MenuItem analyzeItem;
52885682 private MenuItem dumpItem;
52895683 //boolean freezemodel = false;
5684
+
5685
+ Menu cameraMenu;
5686
+ MenuItem editCameraItem;
5687
+ MenuItem restoreCameraItem;
52905688 }