Normand Briere
2019-07-07 46dbce888e7c3eff8969f1ddbe22e144410b67f4
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,14 +198,97 @@
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("Show 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 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217292 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218293 revertMeshItem.addActionListener(this);
219294 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +328,29 @@
253328 }
254329
255330 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
258333 backItem = menu.add(new MenuItem("Back"));
259334 backItem.addActionListener(this);
260335 frontItem = menu.add(new MenuItem("Front"));
261336 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
264342 hideItem = menu.add(new MenuItem("Hidden Group"));
265343 hideItem.addActionListener(this);
344
+ }
266345 ungroupItem = menu.add(new MenuItem("Ungroup"));
267346 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- 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
+ {
271354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272355 switchGeoItem.addActionListener(this);
273356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +358,6 @@
275358 morphItem = menu.add(new MenuItem("Morph Group"));
276359 morphItem.addActionListener(this);
277360
278
- if (Globals.ADVANCED)
279
- {
280361 menu.add("-");
281362 physicsItem = menu.add(new MenuItem("Physics"));
282363 physicsItem.addActionListener(this);
....@@ -284,23 +365,22 @@
284365 frameselectorItem.addActionListener(this);
285366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286367 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289368 }
290369
291370 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
294373 billboardItem = menu.add(new MenuItem("Billboard"));
295374 billboardItem.addActionListener(this);
296375 csgItem = menu.add(new MenuItem("CSG"));
297376 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
377
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299378 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
379
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301380 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
381
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303382 shadowZItem.addActionListener(this);
383
+
304384 if (Globals.ADVANCED)
305385 {
306386 menu.add("-");
....@@ -372,6 +452,10 @@
372452 oe.menuBar.add(menu = new Menu("Attributes"));
373453 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
374454 clearMaterialsItem.addActionListener(this);
455
+ resetAllItem = menu.add(new MenuItem("Reset All"));
456
+ resetAllItem.addActionListener(this);
457
+ stepAllItem = menu.add(new MenuItem("Step All"));
458
+ stepAllItem.addActionListener(this);
375459 menu.add("-");
376460 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
377461 liveleavesItem.addActionListener(this);
....@@ -392,6 +476,14 @@
392476 markleavesItem.addActionListener(this);
393477 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394478 unmarkleavesItem.addActionListener(this);
479
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
480
+ rewindleavesItem.addActionListener(this);
481
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
482
+ unrewindleavesItem.addActionListener(this);
483
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
484
+ randomleavesItem.addActionListener(this);
485
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
486
+ unrandomleavesItem.addActionListener(this);
395487 menu.add("-");
396488 flipVItem = menu.add(new MenuItem("Flip V"));
397489 flipVItem.addActionListener(this);
....@@ -443,25 +535,24 @@
443535 oe.menuBar.add(menu = new Menu("Insert"));
444536 buildCreateMenu(menu);
445537
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
-
459538 oe.menuBar.add(menu = new Menu("Tools"));
460539 buildToolsMenu(menu);
461540 }
462541
463542 void SetupUI2(ObjEditor oe)
464543 {
544
+ // June 2019
545
+ if (oe == null)
546
+ {
547
+ //super.SetupUI2(this);
548
+ //return;
549
+ }
550
+
551
+ if (copy != group)
552
+ {
553
+ //super.SetupUI2(this);
554
+ }
555
+
465556 //new Exception().printStackTrace();
466557
467558 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +581,66 @@
490581 oe.radioPanel.add(dummyButton);
491582 oe.buttonGroup.add(dummyButton);
492583 */
584
+ cGridBag copyOptionsPanel = new cGridBag();
585
+
586
+ copyOptionsPanel.preferredHeight = 1;
587
+
493588 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494589
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
496
- liveCB.setToolTipText("Enabled animation");
590
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591
+ //minButton.setToolTipText("Minimize window");
592
+ //minButton.addActionListener(this);
593
+
594
+ if (Globals.ADVANCED)
595
+ {
596
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ maxButton.setToolTipText("Maximize window");
598
+ maxButton.addActionListener(this);
599
+ }
600
+
601
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ fullButton.setToolTipText("Full-screen window");
603
+ fullButton.addActionListener(this);
604
+
605
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
+ screenfitButton.setToolTipText("Screen fit");
607
+ screenfitButton.addActionListener(this);
608
+
609
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610
+ restoreCameraButton.setToolTipText("Restore viewpoint");
611
+ restoreCameraButton.addActionListener(this);
612
+
613
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614
+ undoButton.setToolTipText("Undo changes");
615
+ undoButton.addActionListener(this);
616
+ undoButton.setEnabled(false);
617
+
618
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ redoButton.setToolTipText("Redo changes");
620
+ redoButton.addActionListener(this);
621
+ redoButton.setEnabled(false);
622
+
623
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ saveButton.setToolTipText("Save changes");
625
+ saveButton.addActionListener(this);
626
+
627
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
628
+ liveCB.setToolTipText("Enable animation");
497629 liveCB.addItemListener(this);
498630
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
631
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500632 oneStepButton.setToolTipText("Animate one step forward");
501633 oneStepButton.addActionListener(this);
502634
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
635
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504636 fastCB.setToolTipText("Fast mode");
505637 fastCB.addItemListener(this);
506638
507
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
508
- trackCB.setToolTipText("Enable tracking");
509
- trackCB.addItemListener(this);
510
-
511
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512
- screenfitButton.setToolTipText("Screen fit");
513
- screenfitButton.addActionListener(this);
639
+ //oe.toolboxPanel.Return();
640
+
641
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
642
+// trackCB.setToolTipText("Enable tracking");
643
+// trackCB.addItemListener(this);
514644
515645 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516646 // screenfitpointButton.addActionListener(this);
....@@ -522,65 +652,145 @@
522652 snapobjectButton.setToolTipText("Snap Object");
523653 }
524654
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
655
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528656
529
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
-
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532658 twoButton.setToolTipText("Show center view only");
533659 twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
660
+ this.fullscreenLayout = twoButton;
661
+
662
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535663 fourButton.addActionListener(this);
536664 fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538666 sixButton.setToolTipText("2-column layout left");
539667 sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541669 threeButton.setToolTipText("2-column layout right");
542670 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544672 sevenButton.setToolTipText("3-column layout");
545673 sevenButton.addActionListener(this);
546674 //
547675
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549677 rootButton.setToolTipText("Edit selection in new tab");
550678 rootButton.addActionListener(this);
551679
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
680
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553681 closeButton.setToolTipText("Close tab");
554682 closeButton.addActionListener(this);
555683 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
556684 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
685
+
686
+ // INSERT
687
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ gridButton.setToolTipText("Create grid");
689
+ gridButton.addActionListener(this);
690
+
691
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
692
+ boxButton.setToolTipText("Create box");
693
+ boxButton.addActionListener(this);
694
+
695
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ sphereButton.setToolTipText("Create sphere");
697
+ sphereButton.addActionListener(this);
698
+
699
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ coneButton.setToolTipText("Create cone");
701
+ coneButton.addActionListener(this);
702
+
703
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+ torusButton.setToolTipText("Create torus");
705
+ torusButton.addActionListener(this);
706
+
707
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ superButton.setToolTipText("Create superellipsoid");
709
+ superButton.addActionListener(this);
710
+
711
+ if (Globals.ADVANCED)
712
+ {
713
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
714
+ kleinButton.setToolTipText("Create Klein bottle");
715
+ kleinButton.addActionListener(this);
716
+ }
559717
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- editButton.setToolTipText("Edit selection");
718
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ particlesButton.setToolTipText("Create particle system");
720
+ particlesButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.Return();
723
+
724
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ groupButton.setToolTipText("Create group");
726
+ groupButton.addActionListener(this);
727
+
728
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ compositeButton.setToolTipText("Create composite");
730
+ compositeButton.addActionListener(this);
731
+
732
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ switchButton.setToolTipText("Create item switcher");
734
+ switchButton.addActionListener(this);
735
+
736
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737
+ loopButton.setToolTipText("Create loop");
738
+ loopButton.addActionListener(this);
739
+
740
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ textureButton.setToolTipText("Create texture");
742
+ textureButton.addActionListener(this);
743
+
744
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ overlayButton.setToolTipText("Create overlay");
746
+ overlayButton.addActionListener(this);
747
+
748
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
749
+ lightButton.setToolTipText("Create light");
750
+ lightButton.addActionListener(this);
751
+
752
+ for (int i=6; --i>=0;)
753
+ {
754
+ oe.toolboxPanel.Return();
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ oe.toolboxPanel.add(new cGridBag());
759
+ oe.toolboxPanel.add(new cGridBag());
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ oe.toolboxPanel.add(new cGridBag());
762
+ }
763
+
764
+ // EDIT panel
765
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ editButton.setToolTipText("Pin selection controls");
562767 editButton.addActionListener(this);
563768
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
769
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
770
+ uneditButton.setToolTipText("Remove selection controls");
566771 uneditButton.addActionListener(this);
567772
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
773
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
774
+ allParamsButton.setToolTipText("Show all controle");
570775 allParamsButton.addActionListener(this);
571776
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573778 clearPanelButton.setToolTipText("Clear edit panel");
574779 clearPanelButton.addActionListener(this);
575780
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577782 unselectButton.setToolTipText("Unselect");
578783 unselectButton.addActionListener(this);
579784
580
- commandsPanel.preferredHeight = 1;
785
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
786
+ flashSelectionButton.setToolTipText("Highlight selection");
787
+ flashSelectionButton.addActionListener(this);
581788
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
789
+ editCommandsPanel.preferredHeight = 1;
790
+
791
+ SetPinStates(false);
792
+// oe.treePanel.add(commandsPanel);
793
+// oe.treePanel.Return();
584794
585795 // oe.aConstraints.gridx += 1;
586796 // oe.aConstraints.weighty = 0;
....@@ -597,27 +807,12 @@
597807
598808 JScrollPane jSP;
599809 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
810
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
601811 ResetModel();
602812
603813 oe.treePanel.add(jSPPanel);
604814 oe.treePanel.Return();
605815
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;
621816 oe.treePanel.add(copyOptionsPanel);
622817 oe.treePanel.Return();
623818
....@@ -648,23 +843,43 @@
648843
649844 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
650845 {
846
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
847
+ colorCB.setToolTipText("Copy color when dropped");
848
+ colorCB.addItemListener(this);
849
+
850
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
851
+ materialCB.setToolTipText("Copy material when dropped");
852
+ materialCB.addItemListener(this);
853
+
854
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
855
+ textureCB.setToolTipText("Copy texture when dropped");
856
+ textureCB.addItemListener(this);
857
+
858
+ panel.Return();
859
+
651860 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
652861 boxCB.setToolTipText("Display bounding boxes");
653862 boxCB.addItemListener(this);
654863
655864 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
865
+ zoomBoxCB.setToolTipText("Display only for wheel");
657866 zoomBoxCB.addItemListener(this);
658867
659868 if (true) // Globals.ADVANCED)
660869 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- supportCB.addItemListener(this);
870
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
871
+// supportCB.setToolTipText("Enable rigging");
872
+// supportCB.addItemListener(this);
873
+
874
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
875
+ freezeCB.setToolTipText("Fast moving camera");
876
+ freezeCB.addItemListener(this);
664877
665878 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
666879 // localCB.addItemListener(this);
667880
881
+ panel.Return();
882
+
668883 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
669884 crowdCB.setToolTipText("Used for crowds");
670885 crowdCB.addItemListener(this);
....@@ -681,6 +896,8 @@
681896 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
682897 // speakerMocapCB.addItemListener(this);
683898
899
+ panel.Return();
900
+
684901 if (false)
685902 {
686903 // handled in scripts
....@@ -695,32 +912,72 @@
695912 //constraints.gridy += 1;
696913 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
697914 smoothfocusCB.addItemListener(this);
915
+ panel.Return();
698916 }
699917
700918 //constraints.gridx += 1;
701919 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
702920 // debugCB.addItemListener(this);
703921
922
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
923
+ trackCB.setToolTipText("Enable tracking target");
924
+ trackCB.addItemListener(this);
925
+
704926 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
927
+ oeilCB.setToolTipText("Move camera when tracking");
705928 oeilCB.addItemListener(this);
706929
930
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
931
+ shadowCB.setToolTipText("When live compute shadows");
932
+ shadowCB.addItemListener(this);
933
+
934
+ panel.Return();
935
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
936
+ toggleTextureCB.setToolTipText("Load textures");
937
+ toggleTextureCB.addItemListener(this);
938
+
939
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
940
+ toggleSwitchCB.setToolTipText("Choose a single item");
941
+ toggleSwitchCB.addItemListener(this);
942
+
943
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
944
+ autosaveCB.setToolTipText("On structure change");
945
+ autosaveCB.addItemListener(this);
946
+
947
+ panel.Return();
948
+ if (Globals.ADVANCED)
949
+ {
707950 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708951 lookAtCB.setToolTipText("Look-at target");
709952 lookAtCB.addItemListener(this);
953
+ }
710954
711955 }
712956
713957 cGridBag fill = new cGridBag();
714
-
715958 fill.preferredHeight = 200;
959
+ cGridBag fill2 = new cGridBag();
960
+ fill2.preferredHeight = 200;
961
+ cGridBag fill3 = new cGridBag();
962
+ fill3.preferredHeight = 200;
716963
717964 panel.add(fill);
965
+ panel.add(fill2);
966
+ panel.add(fill3);
718967
719968 }
720969
721970 void EditObject(Object3D obj)
722971 {
723972 cRadio radioButton = new cRadio(obj.name);
973
+
974
+ // Patch to avoid bug with transparency.
975
+ radioButton.hadMaterial = obj.material != null;
976
+ if (!radioButton.hadMaterial)
977
+ {
978
+ obj.material = new cMaterial();
979
+ }
980
+
724981 radioButton.SetObject(obj);
725982 radioButton.layout = sevenButton;
726983 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -729,8 +986,11 @@
729986 buttonGroup.add(radioButton);
730987 radioButton.doClick();
731988 }
989
+
732990 void SetupViews(ObjEditor oe)
733991 {
992
+ theFrame = this;
993
+
734994 oe.SetupViews();
735995
736996 System.out.println("SetupViews");
....@@ -739,23 +999,28 @@
739999 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7401000 }
7411001
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;
1002
+ cToggleButton liveCB;
1003
+ cCheckBox supportCB;
1004
+ cCheckBox localCB;
1005
+ cCheckBox crowdCB;
1006
+ cCheckBox smoothCB;
1007
+ cToggleButton fastCB;
1008
+ cCheckBox slowCB;
1009
+ cCheckBox boxCB;
1010
+ cCheckBox zoomBoxCB;
1011
+ cCheckBox freezeCB;
1012
+ //cToggleButton trackCB;
1013
+ cCheckBox trackCB;
1014
+ cCheckBox smoothfocusCB;
7531015 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
1016
+ cCheckBox speakerCameraCB;
1017
+ cCheckBox speakerFocusCB;
1018
+ cCheckBox debugCB;
1019
+
1020
+ cCheckBox oeilCB;
1021
+ cCheckBox shadowCB;
1022
+ cCheckBox autosaveCB;
1023
+ cCheckBox lookAtCB;
7591024
7601025 // static int COLOR = 1;
7611026 // static int MATERIAL = 2;
....@@ -763,9 +1028,9 @@
7631028
7641029 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7651030
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
1031
+ cCheckBox colorCB;
1032
+ cCheckBox materialCB;
1033
+ cCheckBox textureCB;
7691034
7701035 public void itemStateChanged(ItemEvent e)
7711036 {
....@@ -793,6 +1058,7 @@
7931058 } else if(e.getSource() == liveCB)
7941059 {
7951060 cameraView.ToggleLive();
1061
+ refreshContents(false);
7961062 }
7971063 else if(e.getSource() == supportCB)
7981064 {
....@@ -857,6 +1123,18 @@
8571123 {
8581124 cameraView.ToggleOeil();
8591125 }
1126
+ else if(e.getSource() == shadowCB)
1127
+ {
1128
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1129
+ }
1130
+ else if(e.getSource() == freezeCB)
1131
+ {
1132
+ Globals.FREEZEONMOVE ^= true;
1133
+ }
1134
+ else if(e.getSource() == autosaveCB)
1135
+ {
1136
+ Globals.SAVEONMAKE ^= true;
1137
+ }
8601138 else if(e.getSource() == lookAtCB)
8611139 {
8621140 cameraView.ToggleLookAt();
....@@ -873,7 +1151,8 @@
8731151
8741152 /**/
8751153 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
876
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1154
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1155
+ TreePath path = objEditor.jTree.getSelectionPath();
8771156 if ((path == null) || (path.getPathCount() <= 1)) {
8781157 // We can't move the root node or an empty selection
8791158 return;
....@@ -936,8 +1215,6 @@
9361215 }
9371216 }
9381217
939
- String string = (String) object;
940
-
9411218 System.out.println("Transfer = " + object + "; drop : " + target);
9421219 // if( object instanceof java.io.File[])
9431220 // {
....@@ -945,6 +1222,8 @@
9451222 // objEditor.DropFile((java.io.File[]) object, true);
9461223 // return;
9471224 // }
1225
+
1226
+ String string = (String) object;
9481227
9491228 // File path for Mac and Windows
9501229 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -990,23 +1269,33 @@
9901269
9911270 assert target == objEditor.jTree;
9921271 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1272
+ Object3D destinationLeaf;
9931273 try {
994
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1274
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9951275 } catch (Exception e) {
9961276 System.out.println("destinationPath : " + destinationPath);
9971277 return;
9981278 }
9991279
1000
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1280
+ for (int i=group.selection.size(); --i>=0;)
10011281 {
1282
+ Object3D child = (Object3D)group.selection.elementAt(i);
1283
+
1284
+ // Cannot move into itself
1285
+ if (child == destinationLeaf)
1286
+ return;
1287
+ }
1288
+
1289
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1290
+// {
10021291 loadClipboard(true);
10031292 objEditor.jTree.setSelectionPath(destinationPath);
10041293 pasteInto(false, false);
1005
- } else {
1006
- loadClipboard(false);
1007
- objEditor.jTree.setSelectionPath(destinationPath);
1008
- pasteInto(false, false); // true); // ???
1009
- }
1294
+// } else {
1295
+// loadClipboard(false);
1296
+// objEditor.jTree.setSelectionPath(destinationPath);
1297
+// pasteInto(false, false); // true); // ???
1298
+// }
10101299 }
10111300 public void dropActionChanged(DropTargetDragEvent dtde)
10121301 // Called if the user has modified the current drop gesture
....@@ -1111,22 +1400,30 @@
11111400 {
11121401 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11131402 //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);
1403
+// gridItem = menu.add(new MenuItem("Grid"));
1404
+// gridItem.addActionListener(this);
1405
+// rectoidItem = menu.add(new MenuItem("Box"));
1406
+// rectoidItem.addActionListener(this);
1407
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1408
+// ellipsoidItem.addActionListener(this);
1409
+// coneItem = menu.add(new MenuItem("Cone"));
1410
+// coneItem.addActionListener(this);
1411
+// torusItem = menu.add(new MenuItem("Torus"));
1412
+// torusItem.addActionListener(this);
1413
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1414
+// superItem.addActionListener(this);
1415
+
1416
+ cameraItem = menu.add(new MenuItem("Camera"));
1417
+ cameraItem.addActionListener(this);
1418
+
1419
+ if (!Globals.ADVANCED)
1420
+ {
11261421 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11271422 kleinItem.addActionListener(this);
1128
- particleItem = menu.add(new MenuItem("Particle system"));
1129
- particleItem.addActionListener(this);
1423
+ }
1424
+
1425
+// particleItem = menu.add(new MenuItem("Particle system"));
1426
+// particleItem.addActionListener(this);
11301427 if (Globals.ADVANCED)
11311428 {
11321429 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1152,15 +1449,15 @@
11521449 }
11531450 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11541451 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);
1452
+// overlayItem = menu.add(new MenuItem("Overlay"));
1453
+// overlayItem.addActionListener(this);
1454
+// lightItem = menu.add(new MenuItem("Light"));
1455
+// lightItem.addActionListener(this);
11591456 menu.add("-");
11601457 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11611458 //superLoopItem.addActionListener(this);
1162
- loopItem = menu.add(new MenuItem("Loop"));
1163
- loopItem.addActionListener(this);
1459
+// loopItem = menu.add(new MenuItem("Loop"));
1460
+// loopItem.addActionListener(this);
11641461 doubleItem = menu.add(new MenuItem("Fork"));
11651462 doubleItem.addActionListener(this);
11661463 if (Globals.ADVANCED)
....@@ -1175,6 +1472,9 @@
11751472 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11761473 animationItem.addItemListener(this);
11771474 animationItem.setState(Globals.ANIMATION);
1475
+
1476
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1477
+ archiveItem.addActionListener(this);
11781478
11791479 menu.add("-");
11801480 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
....@@ -1200,7 +1500,7 @@
12001500 memoryItem.addActionListener(this);
12011501 menu.add(analyzeItem = new MenuItem("Analyze"));
12021502 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1503
+ menu.add(dumpItem = new MenuItem("Print"));
12041504 dumpItem.addActionListener(this);
12051505 // menu.add(pathItem = new MenuItem("From-to path"));
12061506 // pathItem.addActionListener(this);
....@@ -1341,9 +1641,24 @@
13411641 shadow.material = new cMaterial(obj.material);
13421642 shadow.material.diffuse = 0.0001f;
13431643 shadow.material.specular = 0.0001f;
1644
+ //shadow.projectedVertices[1].x = 300;
13441645
13451646 makeSomething(shadow);
13461647 }
1648
+
1649
+ private void ClearUnpinned()
1650
+ {
1651
+ //for (Object3D obj : listUI)
1652
+ for (int i=listUI.size(); --i>=0;)
1653
+ {
1654
+ Object3D obj = listUI.elementAt(i);
1655
+ if (!obj.pinned)
1656
+ {
1657
+ obj.CloseUI();
1658
+ listUI.remove(i);
1659
+ }
1660
+ }
1661
+ }
13471662
13481663 /**
13491664 * applyExample
....@@ -1588,7 +1903,7 @@
15881903 {
15891904 ScreenFit();
15901905 } else
1591
- if (source == switchItem)
1906
+ if (source == switchViewItem)
15921907 {
15931908 cVector v1 = new cVector();
15941909 cVector v2 = new cVector();
....@@ -1597,11 +1912,11 @@
15971912 objEditor.cameraView.renderCamera.setAim(v2, v1);
15981913 objEditor.cameraView.repaint();
15991914 } else
1600
- if (source == rectoidItem)
1915
+ if (source == rectoidItem || source == boxButton)
16011916 {
16021917 makeSomething(new Box());
16031918 } else
1604
- if (source == particleItem)
1919
+ if (source == particleItem || source == particlesButton)
16051920 {
16061921 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16071922 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1680,27 +1995,27 @@
16801995
16811996 makeSomething(obj);
16821997 } else
1683
- if (source == gridItem)
1998
+ if (source == gridItem || source == gridButton)
16841999 {
16852000 makeSomething(new Grid());
16862001 } else
1687
- if (source == ellipsoidItem)
2002
+ if (source == ellipsoidItem || source == sphereButton)
16882003 {
16892004 makeSomething(new Sphere());
16902005 } else
1691
- if (source == coneItem)
2006
+ if (source == coneItem || source == coneButton)
16922007 {
16932008 makeSomething(new Cone());
16942009 } else
1695
- if (source == torusItem)
2010
+ if (source == torusItem || source == torusButton)
16962011 {
16972012 makeSomething(new Torus());
16982013 } else
1699
- if (source == superItem)
2014
+ if (source == superItem || source == superButton)
17002015 {
17012016 makeSomething(new Superellipsoid());
17022017 } else
1703
- if (source == kleinItem)
2018
+ if (source == kleinItem || source == kleinButton)
17042019 {
17052020 makeSomething(new Klein());
17062021 } else
....@@ -1720,7 +2035,7 @@
17202035 {
17212036 makeSomething(new BezierSurface());
17222037 } else
1723
- if (source == overlayItem)
2038
+ if (source == overlayItem || source == overlayButton)
17242039 {
17252040 /*
17262041 Object3D obj = new BezierSurface(5,8);
....@@ -1768,7 +2083,7 @@
17682083 s.setup();
17692084 makeSomething(s);
17702085 } else
1771
- if (source == lightItem)
2086
+ if (source == lightItem || source == lightButton)
17722087 {
17732088 makeSomething(new Light());
17742089 } else
....@@ -1818,30 +2133,30 @@
18182133
18192134 group(g);
18202135 } else
1821
- if (source == loopItem)
2136
+ if (source == loopItem || source == loopButton)
18222137 {
18232138 Composite csg = new GroupLeaf();
18242139 csg.count = 5;
18252140 group(csg);
1826
- Composite child = new cGroup();
2141
+ Composite child = new cGroup("Branch");
18272142 csg.addChild(child);
18282143 child.addChild(csg);
18292144 } else
18302145 if (source == doubleItem)
18312146 {
1832
- Composite csg = new GroupLeaf();
2147
+ Composite csg = new GroupLeaf("Fork");
18332148 csg.count = 5;
18342149 group(csg);
1835
- Composite child = new cGroup();
2150
+ Composite child = new cGroup("Branch A");
18362151 csg.addChild(child);
18372152 child.addChild(csg);
1838
- child = new cGroup();
2153
+ child = new cGroup("Branch B");
18392154 csg.addChild(child);
18402155 child.addChild(csg);
18412156 } else
18422157 if (source == tripleItem)
18432158 {
1844
- Composite csg = new GroupLeaf();
2159
+ Composite csg = new GroupLeaf("Trident");
18452160 csg.count = 4;
18462161 group(csg);
18472162 Composite child = new cGroup();
....@@ -1853,31 +2168,6 @@
18532168 child = new cGroup();
18542169 csg.addChild(child);
18552170 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
- }
18812171 } else
18822172 if (source == computeAOItem)
18832173 {
....@@ -1916,6 +2206,32 @@
19162206 {
19172207 DumpObject();
19182208 } else
2209
+ if (source == minButton)
2210
+ {
2211
+ Minimize();
2212
+ } else
2213
+ if (source == maxButton)
2214
+ {
2215
+ Maximize();
2216
+ } else
2217
+ if (source == fullButton)
2218
+ {
2219
+ ToggleFullScreen();
2220
+ } else
2221
+ if (source == undoButton)
2222
+ {
2223
+ if (!Undo())
2224
+ java.awt.Toolkit.getDefaultToolkit().beep();
2225
+ } else
2226
+ if (source == redoButton)
2227
+ {
2228
+ Redo();
2229
+ } else
2230
+ if (source == saveButton)
2231
+ {
2232
+ if (!Save(true))
2233
+ java.awt.Toolkit.getDefaultToolkit().beep();
2234
+ } else
19192235 if (source == oneStepButton)
19202236 {
19212237 Globals.ONESTEP = true;
....@@ -1923,17 +2239,14 @@
19232239 } else
19242240 if (source == screenfitButton)
19252241 {
1926
- //Reload(lastConverter, lastFilename, true);
19272242 ScreenFit();
19282243 } else
19292244 if (source == screenfitpointButton)
19302245 {
1931
- //Reload(lastConverter, lastFilename, true);
19322246 ScreenFitPoint();
19332247 } else
19342248 if (source == snapobjectButton)
19352249 {
1936
- //Reload(lastConverter, lastFilename, true);
19372250 SnapObject();
19382251 } else
19392252 // if (event.getSource() == recompileButton)
....@@ -1969,6 +2282,14 @@
19692282 if (source == cutItem || source == clearButton)
19702283 {
19712284 loadClipboard(true);
2285
+ } else
2286
+ if (source == undoItem)
2287
+ {
2288
+ Undo();
2289
+ } else
2290
+ if (source == redoItem)
2291
+ {
2292
+ Redo();
19722293 } else
19732294 if (source == duplicateItem)
19742295 {
....@@ -2281,7 +2602,7 @@
22812602 {
22822603 RevertMeshes();
22832604 } else
2284
- if (source == resetMeshItem)
2605
+ if (source == resetAllItem)
22852606 {
22862607 ResetAll();
22872608 } else
....@@ -2301,9 +2622,9 @@
23012622 {
23022623 ClearSelection(true);
23032624 } else
2304
- if (source == grabItem)
2625
+ if (source == grabItem || source == groupButton)
23052626 {
2306
- group(new cGroup(), true);
2627
+ group(new cGroup(), false); // true);
23072628 } else
23082629 if (source == hideItem)
23092630 {
....@@ -2321,11 +2642,11 @@
23212642 {
23222643 makeSomething(new Camera());
23232644 } else
2324
- if (source == compositeItem)
2645
+ if (source == compositeItem || source == compositeButton)
23252646 {
23262647 group(new Composite());
23272648 } else
2328
- if (source == randomItem)
2649
+ if (source == switchItem || source == switchButton)
23292650 {
23302651 RandomNode random = new RandomNode();
23312652 group(random);
....@@ -2427,7 +2748,7 @@
24272748 {
24282749 group(new cLinker());
24292750 } else
2430
- if (source == textureItem)
2751
+ if (source == textureItem || source == textureButton)
24312752 {
24322753 group(new TextureNode());
24332754 } else
....@@ -2447,17 +2768,30 @@
24472768 {
24482769 CastShadow(2);
24492770 } else
2450
- if (source == ungroupItem)
2771
+ if (source == ungroupItem || source == ungroupButton)
24512772 {
2452
- //ungroup();
2773
+ boolean hasRoot = false;
2774
+
24532775 for (int i=0; i<group.selection.size(); i++)
24542776 {
2455
- Ungroup(group.selection.get(i));
2777
+ if (group.selection.get(i) == group)
2778
+ {
2779
+ hasRoot = true;
2780
+ break;
2781
+ }
24562782 }
24572783
2458
- ClearSelection(false);
2459
-
2460
- refreshContents();
2784
+ if (!hasRoot)
2785
+ {
2786
+ for (int i=0; i<group.selection.size(); i++)
2787
+ {
2788
+ Ungroup(group.selection.get(i));
2789
+ }
2790
+
2791
+ ClearSelection(false);
2792
+
2793
+ refreshContents();
2794
+ }
24612795 } else
24622796 if (source == genUVItem)
24632797 {
....@@ -2469,7 +2803,7 @@
24692803 } else
24702804 if (source == genNormalsMESHItem)
24712805 {
2472
- GenNormals(true); // TODO
2806
+ GenNormalsMESH();
24732807 } else
24742808 if (source == genNormalsORGANItem)
24752809 {
....@@ -2534,6 +2868,22 @@
25342868 if (source == unmarkleavesItem)
25352869 {
25362870 MarkLeaves(false);
2871
+ } else
2872
+ if (source == rewindleavesItem)
2873
+ {
2874
+ RewindLeaves(true);
2875
+ } else
2876
+ if (source == unrewindleavesItem)
2877
+ {
2878
+ RewindLeaves(false);
2879
+ } else
2880
+ if (source == randomleavesItem)
2881
+ {
2882
+ RandomLeaves(true);
2883
+ } else
2884
+ if (source == unrandomleavesItem)
2885
+ {
2886
+ RandomLeaves(false);
25372887 } else
25382888 if (source == flipVItem)
25392889 {
....@@ -2769,6 +3119,10 @@
27693119 if (source == twoButton)
27703120 {
27713121 radio.layout = twoButton;
3122
+
3123
+ if (CameraPane.FULLSCREEN)
3124
+ fullscreenLayout = radio.layout;
3125
+
27723126 // bug
27733127 //gridPanel.setDividerLocation(1.0);
27743128 //bigPanel.setDividerLocation(0.0);
....@@ -2801,10 +3155,31 @@
28013155 bigThree.ClearUI();
28023156 bigThree.add(centralPanel);
28033157 bigThree.FlushUI();
3158
+
3159
+ cameraView.requestFocusInWindow();
3160
+
3161
+// refreshContents(true);
3162
+//
3163
+// try
3164
+// {
3165
+// java.awt.Robot bot = new java.awt.Robot();
3166
+// int mask = InputEvent.BUTTON1_MASK;
3167
+// bot.mouseMove(100, 100);
3168
+// bot.mousePress(mask);
3169
+// bot.mouseRelease(mask);
3170
+// }
3171
+// catch (Exception e)
3172
+// {
3173
+//
3174
+// }
3175
+
28043176 } else
28053177 if (source == threeButton)
28063178 {
28073179 radio.layout = threeButton;
3180
+
3181
+ if (CameraPane.FULLSCREEN)
3182
+ fullscreenLayout = radio.layout;
28083183
28093184 // bigThree.remove(scenePanel);
28103185 // bigThree.remove(centralPanel);
....@@ -2837,10 +3212,15 @@
28373212 bigThree.add(centralPanel);
28383213 bigThree.add(XYZPanel);
28393214 bigThree.FlushUI();
3215
+
3216
+ cameraView.requestFocusInWindow();
28403217 } else
28413218 if (source == fourButton)
28423219 {
28433220 radio.layout = fourButton;
3221
+
3222
+ if (CameraPane.FULLSCREEN)
3223
+ fullscreenLayout = radio.layout;
28443224
28453225 // bigThree.remove(scenePanel);
28463226 // bigThree.remove(centralPanel);
....@@ -2872,10 +3252,15 @@
28723252 bigThree.ClearUI();
28733253 bigThree.add(scenePanel);
28743254 bigThree.FlushUI();
3255
+
3256
+ cameraView.requestFocusInWindow();
28753257 } else
28763258 if (source == sixButton)
28773259 {
28783260 radio.layout = sixButton;
3261
+
3262
+ if (CameraPane.FULLSCREEN)
3263
+ fullscreenLayout = radio.layout;
28793264
28803265 // bigThree.remove(scenePanel);
28813266 // bigThree.remove(centralPanel);
....@@ -2908,10 +3293,15 @@
29083293 bigThree.add(scenePanel);
29093294 bigThree.add(centralPanel);
29103295 bigThree.FlushUI();
3296
+
3297
+ cameraView.requestFocusInWindow();
29113298 } else
29123299 if (source == sevenButton)
29133300 {
29143301 radio.layout = sevenButton;
3302
+
3303
+ if (CameraPane.FULLSCREEN)
3304
+ fullscreenLayout = radio.layout;
29153305
29163306 // bigThree.remove(scenePanel);
29173307 // bigThree.remove(centralPanel);
....@@ -2945,6 +3335,8 @@
29453335 bigThree.add(centralPanel);
29463336 bigThree.add(XYZPanel);
29473337 bigThree.FlushUI();
3338
+
3339
+ cameraView.requestFocusInWindow();
29483340 } else
29493341 if (source == rootButton)
29503342 {
....@@ -2956,6 +3348,7 @@
29563348 EditObject(obj);
29573349 }
29583350
3351
+ cameraView.requestFocusInWindow();
29593352 refreshContents(true);
29603353 } else
29613354 if (source == closeButton)
....@@ -2965,22 +3358,37 @@
29653358 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663359 {
29673360 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3361
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693362 {
3363
+ // Patch to avoid bug with transparency.
3364
+ if (!ab.hadMaterial)
3365
+ {
3366
+ ab.object.material = null;
3367
+ }
3368
+
29703369 buttonGroup.remove(ab);
29713370 radioPanel.remove(ab);
29723371
2973
- ab.GetObject().editWindow = null;
3372
+ //ab.GetObject().editWindow = null;
3373
+ ab.GetObject().manipWindow = null;
29743374 // ab.GetObject().objectUI = null; // ?????????
29753375
29763376 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773377 break;
29783378 }
29793379 }
3380
+
3381
+ cameraView.requestFocusInWindow();
29803382 refreshContents(true);
29813383 } else
29823384 if (source == editItem || source == editButton)
29833385 {
3386
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3387
+ {
3388
+ Object3D child = (Object3D)e.nextElement();
3389
+ child.pinned = true;
3390
+ }
3391
+
29843392 EditSelection(false);
29853393 } else
29863394 if (source == uneditButton)
....@@ -2990,10 +3398,11 @@
29903398 Object3D child = (Object3D)e.nextElement();
29913399 if(child.editWindow != null)
29923400 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3401
+ child.pinned = false;
29933402 child.CloseUI();
29943403 listUI.remove(child);
29953404
2996
- child.editWindow = null; // ???????????
3405
+ //child.editWindow = null; // ???????????
29973406 }
29983407 objEditor.ctrlPanel.FlushUI();
29993408 //objEditor.jTree.clearSelection();
....@@ -3006,6 +3415,7 @@
30063415 //copy.ClearUI();
30073416 for (Object3D obj : listUI)
30083417 {
3418
+ obj.pinned = false;
30093419 obj.CloseUI();
30103420 }
30113421 listUI.clear();
....@@ -3015,7 +3425,7 @@
30153425 {
30163426 assert(copy == group);
30173427
3018
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3428
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30193429
30203430 for (Object3D obj : listUI)
30213431 {
....@@ -3079,20 +3489,44 @@
30793489 frontView.object = group;
30803490 sideView.object = group;
30813491 }
3082
- group.editWindow = this;
3492
+
3493
+// fix "+" issue
3494
+ //group.editWindow = this;
3495
+ group.manipWindow = this;
3496
+
30833497 /*
30843498 currentLayout = radio.layout;
30853499 if (currentLayout == null)
30863500 currentLayout = sevenButton;
30873501 */
30883502 radio.layout.doClick();
3503
+
3504
+ ClearUnpinned();
3505
+ SetPinStates(group.selection.size() > 0);
3506
+ if (group.selection.size() == 1)
3507
+ EditSelection(false);
30893508 keepparent = group.parent;
30903509 // PARENT = NULL or not???
30913510 //group.parent = null; // ROOT
30923511 //group.attributes = -1;
30933512 ResetModel();
3513
+
3514
+ cameraView.requestFocusInWindow();
30943515 refreshContents(true);
3095
- }
3516
+ } else if (event.getSource() == editCameraItem)
3517
+ {
3518
+ cameraView.ProtectCamera();
3519
+ cameraView.repaint();
3520
+ return;
3521
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3522
+ {
3523
+ cameraView.RevertCamera();
3524
+ cameraView.repaint();
3525
+ return;
3526
+ // } else if (event.getSource() == textureButton)
3527
+ // {
3528
+ // return; // true;
3529
+ }
30963530 else
30973531 {
30983532 //return super.action(event, arg);
....@@ -3101,7 +3535,6 @@
31013535 }
31023536
31033537 boolean useclient = false;
3104
- cRadio radio;
31053538
31063539 void ToggleRoot()
31073540 {
....@@ -3340,7 +3773,8 @@
33403773
33413774 int size = obj.MemorySize();
33423775
3343
- System.err.println((size/1024) + " KB is the size of " + obj);
3776
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3777
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33443778 }
33453779 }
33463780 catch (Exception e)
....@@ -3421,6 +3855,13 @@
34213855 void GenNormals(boolean crease)
34223856 {
34233857 group.GenNormalsS(crease);
3858
+
3859
+ refreshContents();
3860
+ }
3861
+
3862
+ void GenNormalsMESH()
3863
+ {
3864
+ group.GenNormalsMeshS();
34243865
34253866 refreshContents();
34263867 }
....@@ -3652,7 +4093,16 @@
36524093 String pigment = Object3D.GetPigment(tex);
36534094 //String bump = Object3D.GetBump(tex);
36544095
3655
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4096
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4097
+
4098
+ try
4099
+ {
4100
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4101
+ }
4102
+ catch (Exception e)
4103
+ {
4104
+ System.err.println("FAIL: " + node);
4105
+ }
36564106
36574107 double s = v.s;
36584108
....@@ -4039,6 +4489,18 @@
40394489 refreshContents();
40404490 }
40414491
4492
+ void RewindLeaves(boolean hide)
4493
+ {
4494
+ group.selection.RewindLeaves(hide);
4495
+ refreshContents();
4496
+ }
4497
+
4498
+ void RandomLeaves(boolean hide)
4499
+ {
4500
+ group.selection.RandomLeaves(hide);
4501
+ refreshContents();
4502
+ }
4503
+
40424504 void SetTexRes(int tr)
40434505 {
40444506 group.selection.SetTexRes(tr);
....@@ -4110,10 +4572,6 @@
41104572 // }
41114573 // }
41124574
4113
- static boolean allparams = true;
4114
-
4115
- static Vector<Object3D> listUI = new Vector<Object3D>();
4116
-
41174575 void EditSelection(boolean newWindow)
41184576 {
41194577 // aConstraints.gridy = 0;
....@@ -4121,10 +4579,10 @@
41214579 {
41224580 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41234581 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4124
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4582
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41254583
41264584 Object3D elem = (Object3D)group.selection.elementAt(i);
4127
- if(elem != group)
4585
+ if(elem != group || !newWindow)
41284586 {
41294587 // if (!(elem instanceof Composite))
41304588 // newWindow = false;
....@@ -4206,7 +4664,8 @@
42064664 //new Exception().printStackTrace();
42074665
42084666 freezemodel = true;
4209
-
4667
+ ClearUnpinned();
4668
+
42104669 /**/
42114670 //switch (event.id)
42124671 {
....@@ -4214,7 +4673,6 @@
42144673 //case 702: // Event.LIST_DESELECT
42154674 group.deselectAll();
42164675 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4217
- objEditor.ClearInfo(); // .GetMaterial());
42184676 if (tps != null)
42194677 {
42204678 for (int i=0; i < tps.length; i++)
....@@ -4223,10 +4681,8 @@
42234681
42244682 //if (child.parent != null)
42254683 //child.parent.addSelectee(child);
4684
+ objEditor.SetMaterial(child);
42264685 group.addSelectee(child);
4227
- objEditor.SetMaterial(child); // .GetMaterial());
4228
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4229
- System.err.println("info : " + child.GetPath());
42304686 }
42314687 }
42324688 // else
....@@ -4236,20 +4692,28 @@
42364692 // System.err.println("info : " + group.GetPath());
42374693 // }
42384694
4239
- objEditor.SetText(); // jan 2014
4240
-
4241
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4695
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42424696 CameraPane.flash = true;
42434697
4244
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4698
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42454699 // a camera
42464700 {
4247
- CameraPane.camerachangeframe = 0; // don't refuse it
4248
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4701
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4702
+ {
4703
+ CameraPane.camerachangeframe = 0; // don't refuse it
4704
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4705
+ }
42494706 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42504707 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42514708 }
42524709
4710
+ if (tps != null && tps.length == 1)
4711
+ {
4712
+ EditSelection(false);
4713
+ }
4714
+
4715
+ SetPinStates(tps != null && tps.length > 0);
4716
+
42534717 refreshContents();
42544718 //return true;
42554719 }
....@@ -4258,6 +4722,35 @@
42584722
42594723 freezemodel = false;
42604724 }
4725
+
4726
+ void SetPinStates(boolean enabled)
4727
+ {
4728
+ editButton.setEnabled(enabled);
4729
+ uneditButton.setEnabled(enabled);
4730
+ unselectButton.setEnabled(enabled);
4731
+ flashSelectionButton.setEnabled(enabled);
4732
+ }
4733
+
4734
+ void refreshContents(boolean cp)
4735
+ {
4736
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4737
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4738
+ {
4739
+ objEditor.ClearInfo(); // .GetMaterial());
4740
+
4741
+ for (int i=0; i < group.selection.Size(); i++)
4742
+ {
4743
+ Object3D child = (Object3D) group.selection.get(i);
4744
+
4745
+ objEditor.AddInfo(child, this, true);
4746
+ System.err.println("info : " + child.GetPath());
4747
+ }
4748
+
4749
+ objEditor.SetText(); // jan 2014
4750
+ }
4751
+
4752
+ super.refreshContents(cp);
4753
+ }
42614754
42624755 void linkSomething(Object3D thing)
42634756 {
....@@ -4329,6 +4822,7 @@
43294822 {
43304823 if (group.selection.isEmpty())
43314824 return;
4825
+
43324826 Grafreed.clipboardIsTempGroup = false;
43334827 Composite tGroup = null;
43344828 if (group.selection.size() > 0) // 1)
....@@ -4339,6 +4833,8 @@
43394833
43404834 if (cut)
43414835 {
4836
+ if (Globals.SAVEONMAKE)
4837
+ Save();
43424838 //int indices[] = jList.getSelectedIndices();
43434839 //for (int i = indices.length - 1; i >= 0; i--)
43444840 //jList.remove(indices[i]);
....@@ -4428,8 +4924,10 @@
44284924 }
44294925
44304926 }
4927
+
44314928 if (Grafreed.clipboardIsTempGroup)
44324929 Grafreed.clipboard = tGroup;
4930
+
44334931 if (cut)
44344932 {
44354933 ResetModel();
....@@ -4961,21 +5459,6 @@
49615459 }
49625460 */
49635461
4964
- void ImportGFD()
4965
- {
4966
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4967
- browser.show();
4968
- String filename = browser.getFile();
4969
- if (filename != null && filename.length() > 0)
4970
- {
4971
- String fullname = browser.getDirectory() + filename;
4972
-
4973
- //Object3D readobj =
4974
- objEditor.ReadGFD(fullname, objEditor);
4975
- //makeSomething(readobj);
4976
- }
4977
- }
4978
-
49795462 /*
49805463 public void Callback(Object obj)
49815464 {
....@@ -4999,23 +5482,6 @@
49995482 }
50005483 */
50015484
5002
- void ImportVRMLX3D()
5003
- {
5004
- if (Grafreed.standAlone)
5005
- {
5006
- /**/
5007
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5008
- browser.show();
5009
- String filename = browser.getFile();
5010
- if (filename != null && filename.length() > 0)
5011
- {
5012
- String fullname = browser.getDirectory() + filename;
5013
- LoadVRMLX3D(fullname);
5014
- }
5015
- /**/
5016
- }
5017
- }
5018
-
50195485 String GetFile(String dialogName)
50205486 {
50215487 if (Grafreed.standAlone)
....@@ -5086,7 +5552,28 @@
50865552 cButton clearpanelButton;
50875553 cButton unselectButton;
50885554
5555
+ cButton restoreCameraButton;
5556
+
5557
+ cButton saveButton;
50895558 cButton oneStepButton;
5559
+
5560
+ cButton groupButton;
5561
+ cButton ungroupButton;
5562
+ cButton compositeButton;
5563
+ cButton switchButton;
5564
+ cButton loopButton;
5565
+ cButton textureButton;
5566
+
5567
+ cButton gridButton;
5568
+ cButton boxButton;
5569
+ cButton sphereButton;
5570
+ cButton coneButton;
5571
+ cButton torusButton;
5572
+ cButton superButton;
5573
+ cButton kleinButton;
5574
+ cButton particlesButton;
5575
+ cButton overlayButton;
5576
+ cButton lightButton;
50905577
50915578 cButton screenfitButton;
50925579 cButton screenfitpointButton;
....@@ -5099,14 +5586,6 @@
50995586
51005587 cButton setsupportButton;
51015588
5102
- cButton twoButton;
5103
- cButton sixButton;
5104
- cButton threeButton;
5105
- cButton sevenButton;
5106
- cButton fourButton; // full panel
5107
- cButton oneButton; // full XYZ
5108
- //cButton currentLayout;
5109
-
51105589 //
51115590 //Composite
51125591 Object3D // to do !!
....@@ -5116,9 +5595,11 @@
51165595 //JTree jTree;
51175596 private MenuItem lookAtItem;
51185597 private MenuItem lookFromItem;
5119
- private MenuItem switchItem;
5598
+ private MenuItem switchViewItem;
51205599 private MenuItem cutItem;
5121
- private MenuItem duplicateItem;
5600
+ private MenuItem undoItem;
5601
+ private MenuItem redoItem;
5602
+ private JMenuItem duplicateItem;
51225603 private MenuItem cloneItem;
51235604 private MenuItem cloneSupportItem;
51245605 private MenuItem overwriteGeoItem;
....@@ -5131,7 +5612,7 @@
51315612 private MenuItem linkverticesItem;
51325613 private MenuItem relinkverticesItem;
51335614 private MenuItem setMasterItem;
5134
- private MenuItem resetMeshItem;
5615
+ private MenuItem resetAllItem;
51355616 private MenuItem stepAllItem;
51365617 private MenuItem revertMeshItem;
51375618 private MenuItem poseMeshItem;
....@@ -5181,6 +5662,10 @@
51815662 private MenuItem showleavesItem;
51825663 private MenuItem markleavesItem;
51835664 private MenuItem unmarkleavesItem;
5665
+ private MenuItem rewindleavesItem;
5666
+ private MenuItem unrewindleavesItem;
5667
+ private MenuItem randomleavesItem;
5668
+ private MenuItem unrandomleavesItem;
51845669
51855670 private MenuItem flipVItem;
51865671 private MenuItem unflipVItem;
....@@ -5202,7 +5687,7 @@
52025687 private MenuItem frontItem;
52035688 private MenuItem cameraItem;
52045689 private MenuItem compositeItem;
5205
- private MenuItem randomItem;
5690
+ private MenuItem switchItem;
52065691 private MenuItem physicsItem;
52075692 private MenuItem frameselectorItem;
52085693 private MenuItem scriptNodeItem;
....@@ -5264,11 +5749,6 @@
52645749 private MenuItem doubleItem;
52655750 private MenuItem tripleItem;
52665751
5267
- private MenuItem importGFDItem;
5268
- private MenuItem importVRMLX3DItem;
5269
- private MenuItem import3DSItem;
5270
- private MenuItem importOBJItem;
5271
-
52725752 private MenuItem computeAOItem;
52735753 private MenuItem recompileItem;
52745754 private MenuItem editScriptItem;
....@@ -5278,4 +5758,8 @@
52785758 private MenuItem analyzeItem;
52795759 private MenuItem dumpItem;
52805760 //boolean freezemodel = false;
5761
+
5762
+ Menu cameraMenu;
5763
+ MenuItem editCameraItem;
5764
+ MenuItem restoreCameraItem;
52815765 }