Normand Briere
2019-06-26 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1
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,63 @@
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
+ undoButton.setEnabled(false);
609
+
610
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ redoButton.setToolTipText("Redo changes");
612
+ redoButton.addActionListener(this);
613
+ redoButton.setEnabled(false);
614
+
615
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ saveButton.setToolTipText("Save changes");
617
+ saveButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
496620 liveCB.setToolTipText("Enable animation");
497621 liveCB.addItemListener(this);
498622
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500624 oneStepButton.setToolTipText("Animate one step forward");
501625 oneStepButton.addActionListener(this);
502626
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
627
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504628 fastCB.setToolTipText("Fast mode");
505629 fastCB.addItemListener(this);
506630
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);
631
+ //oe.toolboxPanel.Return();
632
+
633
+ copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512634 screenfitButton.setToolTipText("Screen fit");
513635 screenfitButton.addActionListener(this);
636
+
637
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
638
+// trackCB.setToolTipText("Enable tracking");
639
+// trackCB.addItemListener(this);
514640
515641 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516642 // screenfitpointButton.addActionListener(this);
....@@ -522,65 +648,144 @@
522648 snapobjectButton.setToolTipText("Snap Object");
523649 }
524650
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
651
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528652
529
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
-
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532654 twoButton.setToolTipText("Show center view only");
533655 twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ this.fullscreenLayout = twoButton;
657
+
658
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535659 fourButton.addActionListener(this);
536660 fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538662 sixButton.setToolTipText("2-column layout left");
539663 sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541665 threeButton.setToolTipText("2-column layout right");
542666 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544668 sevenButton.setToolTipText("3-column layout");
545669 sevenButton.addActionListener(this);
546670 //
547671
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
672
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549673 rootButton.setToolTipText("Edit selection in new tab");
550674 rootButton.addActionListener(this);
551675
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553677 closeButton.setToolTipText("Close tab");
554678 closeButton.addActionListener(this);
555679 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
556680 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
681
+
682
+ // INSERT
683
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ gridButton.setToolTipText("Create grid");
685
+ gridButton.addActionListener(this);
686
+
687
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ boxButton.setToolTipText("Create box");
689
+ boxButton.addActionListener(this);
690
+
691
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
692
+ sphereButton.setToolTipText("Create sphere");
693
+ sphereButton.addActionListener(this);
694
+
695
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ coneButton.setToolTipText("Create cone");
697
+ coneButton.addActionListener(this);
698
+
699
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ torusButton.setToolTipText("Create torus");
701
+ torusButton.addActionListener(this);
702
+
703
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+ superButton.setToolTipText("Create superellipsoid");
705
+ superButton.addActionListener(this);
706
+
707
+ if (Globals.ADVANCED)
708
+ {
709
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
710
+ kleinButton.setToolTipText("Create Klein bottle");
711
+ kleinButton.addActionListener(this);
712
+ }
559713
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
714
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ particlesButton.setToolTipText("Create particle system");
716
+ particlesButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.Return();
719
+
720
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721
+ groupButton.setToolTipText("Create group");
722
+ groupButton.addActionListener(this);
723
+
724
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ compositeButton.setToolTipText("Create composite");
726
+ compositeButton.addActionListener(this);
727
+
728
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ switchButton.setToolTipText("Create switch");
730
+ switchButton.addActionListener(this);
731
+
732
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ loopButton.setToolTipText("Create loop");
734
+ loopButton.addActionListener(this);
735
+
736
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737
+ textureButton.setToolTipText("Create texture");
738
+ textureButton.addActionListener(this);
739
+
740
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ overlayButton.setToolTipText("Create overlay");
742
+ overlayButton.addActionListener(this);
743
+
744
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ lightButton.setToolTipText("Create light");
746
+ lightButton.addActionListener(this);
747
+
748
+ for (int i=6; --i>=0;)
749
+ {
750
+ oe.toolboxPanel.Return();
751
+ oe.toolboxPanel.add(new cGridBag());
752
+ oe.toolboxPanel.add(new cGridBag());
753
+ oe.toolboxPanel.add(new cGridBag());
754
+ oe.toolboxPanel.add(new cGridBag());
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ }
759
+
760
+ // EDIT panel
761
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561762 editButton.setToolTipText("Edit selection");
562763 editButton.addActionListener(this);
563764
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565766 uneditButton.setToolTipText("Unedit selection");
566767 uneditButton.addActionListener(this);
567768
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
769
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569770 allParamsButton.setToolTipText("Edit all params");
570771 allParamsButton.addActionListener(this);
571772
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573774 clearPanelButton.setToolTipText("Clear edit panel");
574775 clearPanelButton.addActionListener(this);
575776
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577778 unselectButton.setToolTipText("Unselect");
578779 unselectButton.addActionListener(this);
579780
580
- commandsPanel.preferredHeight = 1;
781
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
782
+ flashSelectionButton.setToolTipText("Highlight selection");
783
+ flashSelectionButton.addActionListener(this);
581784
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
785
+ editCommandsPanel.preferredHeight = 1;
786
+
787
+// oe.treePanel.add(commandsPanel);
788
+// oe.treePanel.Return();
584789
585790 // oe.aConstraints.gridx += 1;
586791 // oe.aConstraints.weighty = 0;
....@@ -597,27 +802,12 @@
597802
598803 JScrollPane jSP;
599804 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
805
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
601806 ResetModel();
602807
603808 oe.treePanel.add(jSPPanel);
604809 oe.treePanel.Return();
605810
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;
621811 oe.treePanel.add(copyOptionsPanel);
622812 oe.treePanel.Return();
623813
....@@ -648,6 +838,20 @@
648838
649839 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
650840 {
841
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
842
+ colorCB.setToolTipText("Copy color when dropped");
843
+ colorCB.addItemListener(this);
844
+
845
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
846
+ materialCB.setToolTipText("Copy material when dropped");
847
+ materialCB.addItemListener(this);
848
+
849
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
850
+ textureCB.setToolTipText("Copy texture when dropped");
851
+ textureCB.addItemListener(this);
852
+
853
+ panel.Return();
854
+
651855 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
652856 boxCB.setToolTipText("Display bounding boxes");
653857 boxCB.addItemListener(this);
....@@ -665,6 +869,8 @@
665869 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
666870 // localCB.addItemListener(this);
667871
872
+ panel.Return();
873
+
668874 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
669875 crowdCB.setToolTipText("Used for crowds");
670876 crowdCB.addItemListener(this);
....@@ -681,6 +887,8 @@
681887 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
682888 // speakerMocapCB.addItemListener(this);
683889
890
+ panel.Return();
891
+
684892 if (false)
685893 {
686894 // handled in scripts
....@@ -695,32 +903,72 @@
695903 //constraints.gridy += 1;
696904 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
697905 smoothfocusCB.addItemListener(this);
906
+ panel.Return();
698907 }
699908
700909 //constraints.gridx += 1;
701910 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
702911 // debugCB.addItemListener(this);
703912
913
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
914
+ trackCB.setToolTipText("Enable tracking target");
915
+ trackCB.addItemListener(this);
916
+
704917 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
918
+ oeilCB.setToolTipText("Move camera when tracking");
705919 oeilCB.addItemListener(this);
706920
921
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
922
+ shadowCB.setToolTipText("Compute shadows when live");
923
+ shadowCB.addItemListener(this);
924
+
925
+ panel.Return();
926
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
927
+ toggleTextureCB.setToolTipText("Load textures");
928
+ toggleTextureCB.addItemListener(this);
929
+
930
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
931
+ toggleSwitchCB.setToolTipText("Use switch");
932
+ toggleSwitchCB.addItemListener(this);
933
+
934
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
935
+ autosaveCB.setToolTipText("Auto-save on structure change");
936
+ autosaveCB.addItemListener(this);
937
+
938
+ panel.Return();
939
+ if (Globals.ADVANCED)
940
+ {
707941 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708942 lookAtCB.setToolTipText("Look-at target");
709943 lookAtCB.addItemListener(this);
944
+ }
710945
711946 }
712947
713948 cGridBag fill = new cGridBag();
714
-
715949 fill.preferredHeight = 200;
950
+ cGridBag fill2 = new cGridBag();
951
+ fill2.preferredHeight = 200;
952
+ cGridBag fill3 = new cGridBag();
953
+ fill3.preferredHeight = 200;
716954
717955 panel.add(fill);
956
+ panel.add(fill2);
957
+ panel.add(fill3);
718958
719959 }
720960
721961 void EditObject(Object3D obj)
722962 {
723963 cRadio radioButton = new cRadio(obj.name);
964
+
965
+ // Patch to avoid bug with transparency.
966
+ radioButton.hadMaterial = obj.material != null;
967
+ if (!radioButton.hadMaterial)
968
+ {
969
+ obj.material = new cMaterial();
970
+ }
971
+
724972 radioButton.SetObject(obj);
725973 radioButton.layout = sevenButton;
726974 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -732,6 +980,8 @@
732980
733981 void SetupViews(ObjEditor oe)
734982 {
983
+ theFrame = this;
984
+
735985 oe.SetupViews();
736986
737987 System.out.println("SetupViews");
....@@ -740,23 +990,27 @@
740990 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
741991 }
742992
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;
993
+ cToggleButton liveCB;
994
+ cCheckBox supportCB;
995
+ cCheckBox localCB;
996
+ cCheckBox crowdCB;
997
+ cCheckBox smoothCB;
998
+ cToggleButton fastCB;
999
+ cCheckBox slowCB;
1000
+ cCheckBox boxCB;
1001
+ cCheckBox zoomBoxCB;
1002
+ //cToggleButton trackCB;
1003
+ cCheckBox trackCB;
1004
+ cCheckBox smoothfocusCB;
7541005 // JCheckBox speakerMocapCB;
755
- JCheckBox speakerCameraCB;
756
- JCheckBox speakerFocusCB;
757
- JCheckBox debugCB;
758
- JCheckBox oeilCB;
759
- JCheckBox lookAtCB;
1006
+ cCheckBox speakerCameraCB;
1007
+ cCheckBox speakerFocusCB;
1008
+ cCheckBox debugCB;
1009
+
1010
+ cCheckBox oeilCB;
1011
+ cCheckBox shadowCB;
1012
+ cCheckBox autosaveCB;
1013
+ cCheckBox lookAtCB;
7601014
7611015 // static int COLOR = 1;
7621016 // static int MATERIAL = 2;
....@@ -764,9 +1018,9 @@
7641018
7651019 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7661020
767
- JCheckBox colorCB;
768
- JCheckBox materialCB;
769
- JCheckBox textureCB;
1021
+ cCheckBox colorCB;
1022
+ cCheckBox materialCB;
1023
+ cCheckBox textureCB;
7701024
7711025 public void itemStateChanged(ItemEvent e)
7721026 {
....@@ -794,6 +1048,7 @@
7941048 } else if(e.getSource() == liveCB)
7951049 {
7961050 cameraView.ToggleLive();
1051
+ refreshContents(false);
7971052 }
7981053 else if(e.getSource() == supportCB)
7991054 {
....@@ -858,6 +1113,14 @@
8581113 {
8591114 cameraView.ToggleOeil();
8601115 }
1116
+ else if(e.getSource() == shadowCB)
1117
+ {
1118
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1119
+ }
1120
+ else if(e.getSource() == autosaveCB)
1121
+ {
1122
+ Globals.SAVEONMAKE ^= true;
1123
+ }
8611124 else if(e.getSource() == lookAtCB)
8621125 {
8631126 cameraView.ToggleLookAt();
....@@ -874,7 +1137,8 @@
8741137
8751138 /**/
8761139 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
877
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1140
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1141
+ TreePath path = objEditor.jTree.getSelectionPath();
8781142 if ((path == null) || (path.getPathCount() <= 1)) {
8791143 // We can't move the root node or an empty selection
8801144 return;
....@@ -991,23 +1255,33 @@
9911255
9921256 assert target == objEditor.jTree;
9931257 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1258
+ Object3D destinationLeaf;
9941259 try {
995
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1260
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9961261 } catch (Exception e) {
9971262 System.out.println("destinationPath : " + destinationPath);
9981263 return;
9991264 }
10001265
1001
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1266
+ for (int i=group.selection.size(); --i>=0;)
10021267 {
1268
+ Object3D child = (Object3D)group.selection.elementAt(i);
1269
+
1270
+ // Cannot move into itself
1271
+ if (child == destinationLeaf)
1272
+ return;
1273
+ }
1274
+
1275
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1276
+// {
10031277 loadClipboard(true);
10041278 objEditor.jTree.setSelectionPath(destinationPath);
10051279 pasteInto(false, false);
1006
- } else {
1007
- loadClipboard(false);
1008
- objEditor.jTree.setSelectionPath(destinationPath);
1009
- pasteInto(false, false); // true); // ???
1010
- }
1280
+// } else {
1281
+// loadClipboard(false);
1282
+// objEditor.jTree.setSelectionPath(destinationPath);
1283
+// pasteInto(false, false); // true); // ???
1284
+// }
10111285 }
10121286 public void dropActionChanged(DropTargetDragEvent dtde)
10131287 // Called if the user has modified the current drop gesture
....@@ -1112,22 +1386,30 @@
11121386 {
11131387 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11141388 //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);
1389
+// gridItem = menu.add(new MenuItem("Grid"));
1390
+// gridItem.addActionListener(this);
1391
+// rectoidItem = menu.add(new MenuItem("Box"));
1392
+// rectoidItem.addActionListener(this);
1393
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1394
+// ellipsoidItem.addActionListener(this);
1395
+// coneItem = menu.add(new MenuItem("Cone"));
1396
+// coneItem.addActionListener(this);
1397
+// torusItem = menu.add(new MenuItem("Torus"));
1398
+// torusItem.addActionListener(this);
1399
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1400
+// superItem.addActionListener(this);
1401
+
1402
+ cameraItem = menu.add(new MenuItem("Camera"));
1403
+ cameraItem.addActionListener(this);
1404
+
1405
+ if (!Globals.ADVANCED)
1406
+ {
11271407 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11281408 kleinItem.addActionListener(this);
1129
- particleItem = menu.add(new MenuItem("Particle system"));
1130
- particleItem.addActionListener(this);
1409
+ }
1410
+
1411
+// particleItem = menu.add(new MenuItem("Particle system"));
1412
+// particleItem.addActionListener(this);
11311413 if (Globals.ADVANCED)
11321414 {
11331415 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1153,15 +1435,15 @@
11531435 }
11541436 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11551437 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);
1438
+// overlayItem = menu.add(new MenuItem("Overlay"));
1439
+// overlayItem.addActionListener(this);
1440
+// lightItem = menu.add(new MenuItem("Light"));
1441
+// lightItem.addActionListener(this);
11601442 menu.add("-");
11611443 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11621444 //superLoopItem.addActionListener(this);
1163
- loopItem = menu.add(new MenuItem("Loop"));
1164
- loopItem.addActionListener(this);
1445
+// loopItem = menu.add(new MenuItem("Loop"));
1446
+// loopItem.addActionListener(this);
11651447 doubleItem = menu.add(new MenuItem("Fork"));
11661448 doubleItem.addActionListener(this);
11671449 if (Globals.ADVANCED)
....@@ -1201,7 +1483,7 @@
12011483 memoryItem.addActionListener(this);
12021484 menu.add(analyzeItem = new MenuItem("Analyze"));
12031485 analyzeItem.addActionListener(this);
1204
- menu.add(dumpItem = new MenuItem("Dump"));
1486
+ menu.add(dumpItem = new MenuItem("Print"));
12051487 dumpItem.addActionListener(this);
12061488 // menu.add(pathItem = new MenuItem("From-to path"));
12071489 // pathItem.addActionListener(this);
....@@ -1342,6 +1624,7 @@
13421624 shadow.material = new cMaterial(obj.material);
13431625 shadow.material.diffuse = 0.0001f;
13441626 shadow.material.specular = 0.0001f;
1627
+ //shadow.projectedVertices[1].x = 300;
13451628
13461629 makeSomething(shadow);
13471630 }
....@@ -1589,7 +1872,7 @@
15891872 {
15901873 ScreenFit();
15911874 } else
1592
- if (source == switchItem)
1875
+ if (source == switchViewItem)
15931876 {
15941877 cVector v1 = new cVector();
15951878 cVector v2 = new cVector();
....@@ -1598,11 +1881,11 @@
15981881 objEditor.cameraView.renderCamera.setAim(v2, v1);
15991882 objEditor.cameraView.repaint();
16001883 } else
1601
- if (source == rectoidItem)
1884
+ if (source == rectoidItem || source == boxButton)
16021885 {
16031886 makeSomething(new Box());
16041887 } else
1605
- if (source == particleItem)
1888
+ if (source == particleItem || source == particlesButton)
16061889 {
16071890 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16081891 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1681,27 +1964,27 @@
16811964
16821965 makeSomething(obj);
16831966 } else
1684
- if (source == gridItem)
1967
+ if (source == gridItem || source == gridButton)
16851968 {
16861969 makeSomething(new Grid());
16871970 } else
1688
- if (source == ellipsoidItem)
1971
+ if (source == ellipsoidItem || source == sphereButton)
16891972 {
16901973 makeSomething(new Sphere());
16911974 } else
1692
- if (source == coneItem)
1975
+ if (source == coneItem || source == coneButton)
16931976 {
16941977 makeSomething(new Cone());
16951978 } else
1696
- if (source == torusItem)
1979
+ if (source == torusItem || source == torusButton)
16971980 {
16981981 makeSomething(new Torus());
16991982 } else
1700
- if (source == superItem)
1983
+ if (source == superItem || source == superButton)
17011984 {
17021985 makeSomething(new Superellipsoid());
17031986 } else
1704
- if (source == kleinItem)
1987
+ if (source == kleinItem || source == kleinButton)
17051988 {
17061989 makeSomething(new Klein());
17071990 } else
....@@ -1721,7 +2004,7 @@
17212004 {
17222005 makeSomething(new BezierSurface());
17232006 } else
1724
- if (source == overlayItem)
2007
+ if (source == overlayItem || source == overlayButton)
17252008 {
17262009 /*
17272010 Object3D obj = new BezierSurface(5,8);
....@@ -1769,7 +2052,7 @@
17692052 s.setup();
17702053 makeSomething(s);
17712054 } else
1772
- if (source == lightItem)
2055
+ if (source == lightItem || source == lightButton)
17732056 {
17742057 makeSomething(new Light());
17752058 } else
....@@ -1819,7 +2102,7 @@
18192102
18202103 group(g);
18212104 } else
1822
- if (source == loopItem)
2105
+ if (source == loopItem || source == loopButton)
18232106 {
18242107 Composite csg = new GroupLeaf();
18252108 csg.count = 5;
....@@ -1854,31 +2137,6 @@
18542137 child = new cGroup();
18552138 csg.addChild(child);
18562139 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
- }
18822140 } else
18832141 if (source == computeAOItem)
18842142 {
....@@ -1916,6 +2174,30 @@
19162174 if (source == dumpItem)
19172175 {
19182176 DumpObject();
2177
+ } else
2178
+ if (source == minButton)
2179
+ {
2180
+ Minimize();
2181
+ } else
2182
+ if (source == maxButton)
2183
+ {
2184
+ Maximize();
2185
+ } else
2186
+ if (source == fullButton)
2187
+ {
2188
+ ToggleFullScreen();
2189
+ } else
2190
+ if (source == undoButton)
2191
+ {
2192
+ Undo();
2193
+ } else
2194
+ if (source == redoButton)
2195
+ {
2196
+ Redo();
2197
+ } else
2198
+ if (source == saveButton)
2199
+ {
2200
+ Save();
19192201 } else
19202202 if (source == oneStepButton)
19212203 {
....@@ -1970,6 +2252,14 @@
19702252 if (source == cutItem || source == clearButton)
19712253 {
19722254 loadClipboard(true);
2255
+ } else
2256
+ if (source == undoItem)
2257
+ {
2258
+ Undo();
2259
+ } else
2260
+ if (source == redoItem)
2261
+ {
2262
+ Redo();
19732263 } else
19742264 if (source == duplicateItem)
19752265 {
....@@ -2302,9 +2592,9 @@
23022592 {
23032593 ClearSelection(true);
23042594 } else
2305
- if (source == grabItem)
2595
+ if (source == grabItem || source == groupButton)
23062596 {
2307
- group(new cGroup(), true);
2597
+ group(new cGroup(), false); // true);
23082598 } else
23092599 if (source == hideItem)
23102600 {
....@@ -2322,11 +2612,11 @@
23222612 {
23232613 makeSomething(new Camera());
23242614 } else
2325
- if (source == compositeItem)
2615
+ if (source == compositeItem || source == compositeButton)
23262616 {
23272617 group(new Composite());
23282618 } else
2329
- if (source == randomItem)
2619
+ if (source == switchItem || source == switchButton)
23302620 {
23312621 RandomNode random = new RandomNode();
23322622 group(random);
....@@ -2428,7 +2718,7 @@
24282718 {
24292719 group(new cLinker());
24302720 } else
2431
- if (source == textureItem)
2721
+ if (source == textureItem || source == textureButton)
24322722 {
24332723 group(new TextureNode());
24342724 } else
....@@ -2448,7 +2738,7 @@
24482738 {
24492739 CastShadow(2);
24502740 } else
2451
- if (source == ungroupItem)
2741
+ if (source == ungroupItem || source == ungroupButton)
24522742 {
24532743 //ungroup();
24542744 for (int i=0; i<group.selection.size(); i++)
....@@ -2470,7 +2760,7 @@
24702760 } else
24712761 if (source == genNormalsMESHItem)
24722762 {
2473
- GenNormals(true); // TODO
2763
+ GenNormalsMESH();
24742764 } else
24752765 if (source == genNormalsORGANItem)
24762766 {
....@@ -2535,6 +2825,22 @@
25352825 if (source == unmarkleavesItem)
25362826 {
25372827 MarkLeaves(false);
2828
+ } else
2829
+ if (source == rewindleavesItem)
2830
+ {
2831
+ RewindLeaves(true);
2832
+ } else
2833
+ if (source == unrewindleavesItem)
2834
+ {
2835
+ RewindLeaves(false);
2836
+ } else
2837
+ if (source == randomleavesItem)
2838
+ {
2839
+ RandomLeaves(true);
2840
+ } else
2841
+ if (source == unrandomleavesItem)
2842
+ {
2843
+ RandomLeaves(false);
25382844 } else
25392845 if (source == flipVItem)
25402846 {
....@@ -2770,6 +3076,10 @@
27703076 if (source == twoButton)
27713077 {
27723078 radio.layout = twoButton;
3079
+
3080
+ if (CameraPane.FULLSCREEN)
3081
+ fullscreenLayout = radio.layout;
3082
+
27733083 // bug
27743084 //gridPanel.setDividerLocation(1.0);
27753085 //bigPanel.setDividerLocation(0.0);
....@@ -2802,10 +3112,31 @@
28023112 bigThree.ClearUI();
28033113 bigThree.add(centralPanel);
28043114 bigThree.FlushUI();
3115
+
3116
+ cameraView.requestFocusInWindow();
3117
+
3118
+// refreshContents(true);
3119
+//
3120
+// try
3121
+// {
3122
+// java.awt.Robot bot = new java.awt.Robot();
3123
+// int mask = InputEvent.BUTTON1_MASK;
3124
+// bot.mouseMove(100, 100);
3125
+// bot.mousePress(mask);
3126
+// bot.mouseRelease(mask);
3127
+// }
3128
+// catch (Exception e)
3129
+// {
3130
+//
3131
+// }
3132
+
28053133 } else
28063134 if (source == threeButton)
28073135 {
28083136 radio.layout = threeButton;
3137
+
3138
+ if (CameraPane.FULLSCREEN)
3139
+ fullscreenLayout = radio.layout;
28093140
28103141 // bigThree.remove(scenePanel);
28113142 // bigThree.remove(centralPanel);
....@@ -2838,10 +3169,15 @@
28383169 bigThree.add(centralPanel);
28393170 bigThree.add(XYZPanel);
28403171 bigThree.FlushUI();
3172
+
3173
+ cameraView.requestFocusInWindow();
28413174 } else
28423175 if (source == fourButton)
28433176 {
28443177 radio.layout = fourButton;
3178
+
3179
+ if (CameraPane.FULLSCREEN)
3180
+ fullscreenLayout = radio.layout;
28453181
28463182 // bigThree.remove(scenePanel);
28473183 // bigThree.remove(centralPanel);
....@@ -2873,10 +3209,15 @@
28733209 bigThree.ClearUI();
28743210 bigThree.add(scenePanel);
28753211 bigThree.FlushUI();
3212
+
3213
+ cameraView.requestFocusInWindow();
28763214 } else
28773215 if (source == sixButton)
28783216 {
28793217 radio.layout = sixButton;
3218
+
3219
+ if (CameraPane.FULLSCREEN)
3220
+ fullscreenLayout = radio.layout;
28803221
28813222 // bigThree.remove(scenePanel);
28823223 // bigThree.remove(centralPanel);
....@@ -2909,10 +3250,15 @@
29093250 bigThree.add(scenePanel);
29103251 bigThree.add(centralPanel);
29113252 bigThree.FlushUI();
3253
+
3254
+ cameraView.requestFocusInWindow();
29123255 } else
29133256 if (source == sevenButton)
29143257 {
29153258 radio.layout = sevenButton;
3259
+
3260
+ if (CameraPane.FULLSCREEN)
3261
+ fullscreenLayout = radio.layout;
29163262
29173263 // bigThree.remove(scenePanel);
29183264 // bigThree.remove(centralPanel);
....@@ -2946,6 +3292,8 @@
29463292 bigThree.add(centralPanel);
29473293 bigThree.add(XYZPanel);
29483294 bigThree.FlushUI();
3295
+
3296
+ cameraView.requestFocusInWindow();
29493297 } else
29503298 if (source == rootButton)
29513299 {
....@@ -2957,6 +3305,7 @@
29573305 EditObject(obj);
29583306 }
29593307
3308
+ cameraView.requestFocusInWindow();
29603309 refreshContents(true);
29613310 } else
29623311 if (source == closeButton)
....@@ -2966,22 +3315,37 @@
29663315 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29673316 {
29683317 ab = (cRadio)e.nextElement();
2969
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3318
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29703319 {
3320
+ // Patch to avoid bug with transparency.
3321
+ if (!ab.hadMaterial)
3322
+ {
3323
+ ab.object.material = null;
3324
+ }
3325
+
29713326 buttonGroup.remove(ab);
29723327 radioPanel.remove(ab);
29733328
2974
- ab.GetObject().editWindow = null;
3329
+ //ab.GetObject().editWindow = null;
3330
+ ab.GetObject().manipWindow = null;
29753331 // ab.GetObject().objectUI = null; // ?????????
29763332
29773333 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29783334 break;
29793335 }
29803336 }
3337
+
3338
+ cameraView.requestFocusInWindow();
29813339 refreshContents(true);
29823340 } else
29833341 if (source == editItem || source == editButton)
29843342 {
3343
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3344
+ {
3345
+ Object3D child = (Object3D)e.nextElement();
3346
+ child.pinned = true;
3347
+ }
3348
+
29853349 EditSelection(false);
29863350 } else
29873351 if (source == uneditButton)
....@@ -2991,10 +3355,11 @@
29913355 Object3D child = (Object3D)e.nextElement();
29923356 if(child.editWindow != null)
29933357 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3358
+ child.pinned = false;
29943359 child.CloseUI();
29953360 listUI.remove(child);
29963361
2997
- child.editWindow = null; // ???????????
3362
+ //child.editWindow = null; // ???????????
29983363 }
29993364 objEditor.ctrlPanel.FlushUI();
30003365 //objEditor.jTree.clearSelection();
....@@ -3007,6 +3372,7 @@
30073372 //copy.ClearUI();
30083373 for (Object3D obj : listUI)
30093374 {
3375
+ obj.pinned = true;
30103376 obj.CloseUI();
30113377 }
30123378 listUI.clear();
....@@ -3016,7 +3382,7 @@
30163382 {
30173383 assert(copy == group);
30183384
3019
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3385
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30203386
30213387 for (Object3D obj : listUI)
30223388 {
....@@ -3081,7 +3447,9 @@
30813447 sideView.object = group;
30823448 }
30833449
3084
-// fix "+" issue group.editWindow = this;
3450
+// fix "+" issue
3451
+ //group.editWindow = this;
3452
+ group.manipWindow = this;
30853453
30863454 /*
30873455 currentLayout = radio.layout;
....@@ -3094,8 +3462,23 @@
30943462 //group.parent = null; // ROOT
30953463 //group.attributes = -1;
30963464 ResetModel();
3465
+
3466
+ cameraView.requestFocusInWindow();
30973467 refreshContents(true);
3098
- }
3468
+ } else if (event.getSource() == editCameraItem)
3469
+ {
3470
+ cameraView.ProtectCamera();
3471
+ cameraView.repaint();
3472
+ return;
3473
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3474
+ {
3475
+ cameraView.RevertCamera();
3476
+ cameraView.repaint();
3477
+ return;
3478
+ // } else if (event.getSource() == textureButton)
3479
+ // {
3480
+ // return; // true;
3481
+ }
30993482 else
31003483 {
31013484 //return super.action(event, arg);
....@@ -3104,7 +3487,6 @@
31043487 }
31053488
31063489 boolean useclient = false;
3107
- cRadio radio;
31083490
31093491 void ToggleRoot()
31103492 {
....@@ -3343,7 +3725,8 @@
33433725
33443726 int size = obj.MemorySize();
33453727
3346
- System.err.println((size/1024) + " KB is the size of " + obj);
3728
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3729
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33473730 }
33483731 }
33493732 catch (Exception e)
....@@ -3424,6 +3807,13 @@
34243807 void GenNormals(boolean crease)
34253808 {
34263809 group.GenNormalsS(crease);
3810
+
3811
+ refreshContents();
3812
+ }
3813
+
3814
+ void GenNormalsMESH()
3815
+ {
3816
+ group.GenNormalsMeshS();
34273817
34283818 refreshContents();
34293819 }
....@@ -4051,6 +4441,18 @@
40514441 refreshContents();
40524442 }
40534443
4444
+ void RewindLeaves(boolean hide)
4445
+ {
4446
+ group.selection.RewindLeaves(hide);
4447
+ refreshContents();
4448
+ }
4449
+
4450
+ void RandomLeaves(boolean hide)
4451
+ {
4452
+ group.selection.RandomLeaves(hide);
4453
+ refreshContents();
4454
+ }
4455
+
40544456 void SetTexRes(int tr)
40554457 {
40564458 group.selection.SetTexRes(tr);
....@@ -4122,10 +4524,6 @@
41224524 // }
41234525 // }
41244526
4125
- static boolean allparams = true;
4126
-
4127
- static Vector<Object3D> listUI = new Vector<Object3D>();
4128
-
41294527 void EditSelection(boolean newWindow)
41304528 {
41314529 // aConstraints.gridy = 0;
....@@ -4133,7 +4531,7 @@
41334531 {
41344532 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41354533 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4136
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4534
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41374535
41384536 Object3D elem = (Object3D)group.selection.elementAt(i);
41394537 if(elem != group || !newWindow)
....@@ -4219,6 +4617,17 @@
42194617
42204618 freezemodel = true;
42214619
4620
+ //for (Object3D obj : listUI)
4621
+ for (int i=listUI.size(); --i>=0;)
4622
+ {
4623
+ Object3D obj = listUI.elementAt(i);
4624
+ if (!obj.pinned)
4625
+ {
4626
+ obj.CloseUI();
4627
+ listUI.remove(i);
4628
+ }
4629
+ }
4630
+
42224631 /**/
42234632 //switch (event.id)
42244633 {
....@@ -4226,7 +4635,6 @@
42264635 //case 702: // Event.LIST_DESELECT
42274636 group.deselectAll();
42284637 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4229
- objEditor.ClearInfo(); // .GetMaterial());
42304638 if (tps != null)
42314639 {
42324640 for (int i=0; i < tps.length; i++)
....@@ -4235,10 +4643,8 @@
42354643
42364644 //if (child.parent != null)
42374645 //child.parent.addSelectee(child);
4646
+ objEditor.SetMaterial(child);
42384647 group.addSelectee(child);
4239
- objEditor.SetMaterial(child); // .GetMaterial());
4240
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4241
- System.err.println("info : " + child.GetPath());
42424648 }
42434649 }
42444650 // else
....@@ -4248,20 +4654,28 @@
42484654 // System.err.println("info : " + group.GetPath());
42494655 // }
42504656
4251
- objEditor.SetText(); // jan 2014
4252
-
4253
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4657
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42544658 CameraPane.flash = true;
42554659
4256
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4660
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42574661 // a camera
42584662 {
4259
- CameraPane.camerachangeframe = 0; // don't refuse it
4260
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4663
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4664
+ {
4665
+ CameraPane.camerachangeframe = 0; // don't refuse it
4666
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4667
+ }
42614668 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42624669 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42634670 }
42644671
4672
+ if (tps != null && tps.length == 1)
4673
+ {
4674
+ EditSelection(false);
4675
+ }
4676
+
4677
+ SetPinStates(tps != null && tps.length > 0);
4678
+
42654679 refreshContents();
42664680 //return true;
42674681 }
....@@ -4270,6 +4684,33 @@
42704684
42714685 freezemodel = false;
42724686 }
4687
+
4688
+ void SetPinStates(boolean enabled)
4689
+ {
4690
+ editButton.setEnabled(enabled);
4691
+ uneditButton.setEnabled(enabled);
4692
+ }
4693
+
4694
+ void refreshContents(boolean cp)
4695
+ {
4696
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4697
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4698
+ {
4699
+ objEditor.ClearInfo(); // .GetMaterial());
4700
+
4701
+ for (int i=0; i < group.selection.Size(); i++)
4702
+ {
4703
+ Object3D child = (Object3D) group.selection.get(i);
4704
+
4705
+ objEditor.AddInfo(child, this, true);
4706
+ System.err.println("info : " + child.GetPath());
4707
+ }
4708
+
4709
+ objEditor.SetText(); // jan 2014
4710
+ }
4711
+
4712
+ super.refreshContents(cp);
4713
+ }
42734714
42744715 void linkSomething(Object3D thing)
42754716 {
....@@ -4341,6 +4782,7 @@
43414782 {
43424783 if (group.selection.isEmpty())
43434784 return;
4785
+
43444786 Grafreed.clipboardIsTempGroup = false;
43454787 Composite tGroup = null;
43464788 if (group.selection.size() > 0) // 1)
....@@ -4351,6 +4793,8 @@
43514793
43524794 if (cut)
43534795 {
4796
+ if (Globals.SAVEONMAKE)
4797
+ Save();
43544798 //int indices[] = jList.getSelectedIndices();
43554799 //for (int i = indices.length - 1; i >= 0; i--)
43564800 //jList.remove(indices[i]);
....@@ -4440,8 +4884,10 @@
44404884 }
44414885
44424886 }
4887
+
44434888 if (Grafreed.clipboardIsTempGroup)
44444889 Grafreed.clipboard = tGroup;
4890
+
44454891 if (cut)
44464892 {
44474893 ResetModel();
....@@ -4973,21 +5419,6 @@
49735419 }
49745420 */
49755421
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
-
49915422 /*
49925423 public void Callback(Object obj)
49935424 {
....@@ -5011,23 +5442,6 @@
50115442 }
50125443 */
50135444
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
-
50315445 String GetFile(String dialogName)
50325446 {
50335447 if (Grafreed.standAlone)
....@@ -5098,7 +5512,31 @@
50985512 cButton clearpanelButton;
50995513 cButton unselectButton;
51005514
5515
+ cButton restoreCameraButton;
5516
+
5517
+ cButton minButton;
5518
+ cButton maxButton;
5519
+ cButton fullButton;
5520
+ cButton saveButton;
51015521 cButton oneStepButton;
5522
+
5523
+ cButton groupButton;
5524
+ cButton ungroupButton;
5525
+ cButton compositeButton;
5526
+ cButton switchButton;
5527
+ cButton loopButton;
5528
+ cButton textureButton;
5529
+
5530
+ cButton gridButton;
5531
+ cButton boxButton;
5532
+ cButton sphereButton;
5533
+ cButton coneButton;
5534
+ cButton torusButton;
5535
+ cButton superButton;
5536
+ cButton kleinButton;
5537
+ cButton particlesButton;
5538
+ cButton overlayButton;
5539
+ cButton lightButton;
51025540
51035541 cButton screenfitButton;
51045542 cButton screenfitpointButton;
....@@ -5111,14 +5549,6 @@
51115549
51125550 cButton setsupportButton;
51135551
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
-
51225552 //
51235553 //Composite
51245554 Object3D // to do !!
....@@ -5128,9 +5558,11 @@
51285558 //JTree jTree;
51295559 private MenuItem lookAtItem;
51305560 private MenuItem lookFromItem;
5131
- private MenuItem switchItem;
5561
+ private MenuItem switchViewItem;
51325562 private MenuItem cutItem;
5133
- private MenuItem duplicateItem;
5563
+ private MenuItem undoItem;
5564
+ private MenuItem redoItem;
5565
+ private JMenuItem duplicateItem;
51345566 private MenuItem cloneItem;
51355567 private MenuItem cloneSupportItem;
51365568 private MenuItem overwriteGeoItem;
....@@ -5193,6 +5625,10 @@
51935625 private MenuItem showleavesItem;
51945626 private MenuItem markleavesItem;
51955627 private MenuItem unmarkleavesItem;
5628
+ private MenuItem rewindleavesItem;
5629
+ private MenuItem unrewindleavesItem;
5630
+ private MenuItem randomleavesItem;
5631
+ private MenuItem unrandomleavesItem;
51965632
51975633 private MenuItem flipVItem;
51985634 private MenuItem unflipVItem;
....@@ -5214,7 +5650,7 @@
52145650 private MenuItem frontItem;
52155651 private MenuItem cameraItem;
52165652 private MenuItem compositeItem;
5217
- private MenuItem randomItem;
5653
+ private MenuItem switchItem;
52185654 private MenuItem physicsItem;
52195655 private MenuItem frameselectorItem;
52205656 private MenuItem scriptNodeItem;
....@@ -5276,11 +5712,6 @@
52765712 private MenuItem doubleItem;
52775713 private MenuItem tripleItem;
52785714
5279
- private MenuItem importGFDItem;
5280
- private MenuItem importVRMLX3DItem;
5281
- private MenuItem import3DSItem;
5282
- private MenuItem importOBJItem;
5283
-
52845715 private MenuItem computeAOItem;
52855716 private MenuItem recompileItem;
52865717 private MenuItem editScriptItem;
....@@ -5290,4 +5721,8 @@
52905721 private MenuItem analyzeItem;
52915722 private MenuItem dumpItem;
52925723 //boolean freezemodel = false;
5724
+
5725
+ Menu cameraMenu;
5726
+ MenuItem editCameraItem;
5727
+ MenuItem restoreCameraItem;
52935728 }