Normand Briere
2019-07-21 d32f24f147068e6cbecb31c7f98047f68bc8b58a
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -74,16 +80,28 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
77
- SetupMenu2(objEditor);
83
+ SetupMenu2(this); //objEditor);
7884 SetupUI2(objEditor);
7985 objEditor.SetupUI(true);
8086 SetupViews(objEditor);
8187
8288 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
89
+
90
+ if (copy.versions == null)
91
+ {
92
+ copy.versions = new byte[100][];
93
+ copy.versionindex = -1;
94
+
95
+ Save(true);
96
+ }
8397 }
8498
8599 void CloneSelection(boolean supports)
86100 {
101
+ if (Globals.REPLACEONMAKE)
102
+ Save();
103
+ boolean keep = Globals.REPLACEONMAKE;
104
+ Globals.REPLACEONMAKE = false;
87105 // Object3D keep = GrafreeD.clipboard;
88106 //Object3D obj;
89107 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +112,7 @@
94112
95113 makeSomething(clone, i==group.selection.size()-1);
96114 }
115
+ Globals.REPLACEONMAKE = keep;
97116 }
98117
99118 void CloneClipboard(boolean supports)
....@@ -148,28 +167,21 @@
148167
149168 //JTextField nameField;
150169
151
- void SetupMenu2(ObjEditor oe)
170
+ void SetupMenu2(GroupEditor oe)
152171 {
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
-
172
+ oe.jTree = new cTree();
173
+
168174 Menu menu;
169175 oe.menuBar.add(menu = new Menu("Edit"));
170176 //editItem = menu.add(new MenuItem("Edit"));
171177 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
178
+
179
+// undoItem = menu.add(new MenuItem("Undo"));
180
+// undoItem.addActionListener(this);
181
+// redoItem = menu.add(new MenuItem("Redo"));
182
+// redoItem.addActionListener(this);
183
+// menu.add("-");
184
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173185 duplicateItem.addActionListener(this);
174186 cloneItem = menu.add(new MenuItem("Clone"));
175187 cloneItem.addActionListener(this);
....@@ -185,7 +197,6 @@
185197 copyItem.addActionListener(this);
186198 pasteItem = menu.add(new MenuItem("Paste"));
187199 pasteItem.addActionListener(this);
188
- menu.add("-");
189200
190201 menu.add("-");
191202 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,8 +208,8 @@
197208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
198209 // pasteExpandItem.addActionListener(this);
199210 menu.add("-");
200
- clearItem = menu.add(new MenuItem("Clear"));
201
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
202213
203214 if (Globals.ADVANCED)
204215 {
....@@ -206,7 +217,94 @@
206217 clearAllItem = menu.add(new MenuItem("Clear All"));
207218 clearAllItem.addActionListener(this);
208219 }
220
+
221
+ menuBar.add(cameraMenu = new Menu("View"));
222
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
223
+ //zBufferItem.addActionListener(this);
224
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
225
+ //normalLensItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
228
+
229
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
230
+// toggleFullScreenItem.addItemListener(this);
231
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
232
+// cameraMenu.add("-");
233
+//
234
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
235
+// toggleTextureItem.addItemListener(this);
236
+// toggleTextureItem.setState(CameraPane.textureon);
237
+//
238
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
239
+// toggleSwitchItem.addItemListener(this);
240
+// toggleSwitchItem.setState(CameraPane.SWITCH);
241
+
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
243
+ toggleHandleItem.addItemListener(this);
244
+ toggleHandleItem.setState(CameraPane.HANDLES);
245
+
246
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
247
+ togglePaintItem.addItemListener(this);
248
+ togglePaintItem.setState(CameraPane.PAINTMODE);
249
+
250
+ if (Globals.ADVANCED)
251
+ {
252
+ cameraMenu.add("-");
253
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
254
+ toggleLiveItem.addItemListener(this);
255
+ toggleLiveItem.setState(Globals.isLIVE());
209256
257
+ cameraMenu.add(stepItem = new MenuItem("Step"));
258
+ stepItem.addActionListener(this);
259
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
260
+ // toggleDLItem.addItemListener(this);
261
+ // toggleDLItem.setState(false);
262
+
263
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
264
+ toggleRenderItem.addItemListener(this);
265
+ toggleRenderItem.setState(!CameraPane.frozen);
266
+
267
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
268
+ toggleDebugItem.addItemListener(this);
269
+ toggleDebugItem.setState(Globals.DEBUG);
270
+
271
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
272
+ toggleFrustumItem.addItemListener(this);
273
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
274
+
275
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
276
+ toggleFootContactItem.addItemListener(this);
277
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
278
+
279
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
280
+ toggleTimelineItem.addItemListener(this);
281
+ }
282
+
283
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
284
+// toggleRootItem.addItemListener(this);
285
+// toggleRootItem.setState(false);
286
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
287
+// animationItem.addItemListener(this);
288
+// animationItem.setState(CameraPane.ANIMATION);
289
+ cameraMenu.add("-");
290
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
291
+ editCameraItem.addActionListener(this);
292
+
293
+ if (Globals.ADVANCED)
294
+ {
295
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
296
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
298
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
299
+ oe.cameraMenu.add("-");
300
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
301
+ openWindowItem.addActionListener(this);
302
+ editLeafItem.addActionListener(this);
303
+ lookAtItem.addActionListener(this);
304
+ //lookFromItem.addActinoListener(this);
305
+ //switchViewItem.addActionListener(this);
306
+ }
307
+
210308 oe.menuBar.add(menu = new Menu("Setting"));
211309 if (Globals.ADVANCED)
212310 {
....@@ -249,21 +347,29 @@
249347 }
250348
251349 oe.menuBar.add(menu = new Menu("Group"));
252
- grabItem = menu.add(new MenuItem("Grab"));
253
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
254352 backItem = menu.add(new MenuItem("Back"));
255353 backItem.addActionListener(this);
256354 frontItem = menu.add(new MenuItem("Front"));
257355 frontItem.addActionListener(this);
258
- compositeItem = menu.add(new MenuItem("Composite"));
259
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
260361 hideItem = menu.add(new MenuItem("Hidden Group"));
261362 hideItem.addActionListener(this);
363
+ }
262364 ungroupItem = menu.add(new MenuItem("Ungroup"));
263365 ungroupItem.addActionListener(this);
264
- menu.add("-");
265
- randomItem = menu.add(new MenuItem("Switch node"));
266
- randomItem.addActionListener(this);
366
+
367
+// menu.add("-");
368
+//
369
+// switchItem = menu.add(new MenuItem("Switch node"));
370
+// switchItem.addActionListener(this);
371
+ if (Globals.ADVANCED)
372
+ {
267373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
268374 switchGeoItem.addActionListener(this);
269375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -271,8 +377,6 @@
271377 morphItem = menu.add(new MenuItem("Morph Group"));
272378 morphItem.addActionListener(this);
273379
274
- if (Globals.ADVANCED)
275
- {
276380 menu.add("-");
277381 physicsItem = menu.add(new MenuItem("Physics"));
278382 physicsItem.addActionListener(this);
....@@ -280,30 +384,29 @@
280384 frameselectorItem.addActionListener(this);
281385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
282386 scriptNodeItem.addActionListener(this);
283
- cameraItem = menu.add(new MenuItem("Camera"));
284
- cameraItem.addActionListener(this);
285387 }
286388
287389 oe.menuBar.add(menu = new Menu("Object"));
288
- textureItem = menu.add(new MenuItem("Texture"));
289
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
290392 billboardItem = menu.add(new MenuItem("Billboard"));
291393 billboardItem.addActionListener(this);
292394 csgItem = menu.add(new MenuItem("CSG"));
293395 csgItem.addActionListener(this);
294
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
295397 shadowXItem.addActionListener(this);
296
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
297399 shadowYItem.addActionListener(this);
298
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
299401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
300405 if (Globals.ADVANCED)
301406 {
302407 menu.add("-");
303408 linkerItem = menu.add(new MenuItem("Linker"));
304409 linkerItem.addActionListener(this);
305
- attributeItem = menu.add(new MenuItem("Attribute"));
306
- attributeItem.addActionListener(this);
307410 templateItem = menu.add(new MenuItem("Template"));
308411 templateItem.addActionListener(this);
309412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -332,7 +435,7 @@
332435 genNormalsMESHItem.addActionListener(this);
333436 if (Globals.ADVANCED)
334437 {
335
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
336439 genNormalsMINEItem.addActionListener(this);
337440 }
338441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -392,6 +495,14 @@
392495 markleavesItem.addActionListener(this);
393496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394497 unmarkleavesItem.addActionListener(this);
498
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
499
+ rewindleavesItem.addActionListener(this);
500
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
501
+ unrewindleavesItem.addActionListener(this);
502
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
503
+ randomleavesItem.addActionListener(this);
504
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
505
+ unrandomleavesItem.addActionListener(this);
395506 menu.add("-");
396507 flipVItem = menu.add(new MenuItem("Flip V"));
397508 flipVItem.addActionListener(this);
....@@ -443,25 +554,25 @@
443554 oe.menuBar.add(menu = new Menu("Insert"));
444555 buildCreateMenu(menu);
445556
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
-
459557 oe.menuBar.add(menu = new Menu("Tools"));
460558 buildToolsMenu(menu);
461559 }
462560
561
+
463562 void SetupUI2(ObjEditor oe)
464563 {
564
+ // June 2019
565
+ if (oe == null)
566
+ {
567
+ //super.SetupUI2(this);
568
+ //return;
569
+ }
570
+
571
+ if (copy != group)
572
+ {
573
+ //super.SetupUI2(this);
574
+ }
575
+
465576 //new Exception().printStackTrace();
466577
467578 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +601,79 @@
490601 oe.radioPanel.add(dummyButton);
491602 oe.buttonGroup.add(dummyButton);
492603 */
604
+ cGridBag copyOptionsPanel = new cGridBag();
605
+
606
+ copyOptionsPanel.preferredHeight = 1;
607
+
493608 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494609
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
610
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ //minButton.setToolTipText("Minimize window");
612
+ //minButton.addActionListener(this);
613
+
614
+ if (Globals.ADVANCED)
615
+ {
616
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
+ maxButton.setToolTipText("Maximize window");
618
+ maxButton.addActionListener(this);
619
+ }
620
+
621
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622
+ fullButton.setToolTipText("Full-screen window");
623
+ fullButton.addActionListener(this);
624
+
625
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ screenfitButton.setToolTipText("Screen fit");
627
+ screenfitButton.addActionListener(this);
628
+
629
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreCameraButton.setToolTipText("Restore viewpoint");
631
+ restoreCameraButton.addActionListener(this);
632
+
633
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ saveButton.setToolTipText("New version");
635
+ saveButton.addActionListener(this);
636
+
637
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
+ undoButton.setToolTipText("Previous version");
639
+ undoButton.addActionListener(this);
640
+ undoButton.setEnabled(false);
641
+
642
+ cGridBag updown = new cGridBag().setVertical(true);
643
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ restoreButton.setToolTipText("Restore current");
645
+ restoreButton.addActionListener(this);
646
+ restoreButton.setEnabled(false);
647
+
648
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ replaceButton.setToolTipText("Replace current");
650
+ replaceButton.addActionListener(this);
651
+ replaceButton.setEnabled(false);
652
+
653
+ copyOptionsPanel.add(updown);
654
+
655
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ redoButton.setToolTipText("Next version");
657
+ redoButton.addActionListener(this);
658
+ redoButton.setEnabled(false);
659
+
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
496661 liveCB.setToolTipText("Enable animation");
497662 liveCB.addItemListener(this);
498663
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500665 oneStepButton.setToolTipText("Animate one step forward");
501666 oneStepButton.addActionListener(this);
502667
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504669 fastCB.setToolTipText("Fast mode");
505670 fastCB.addItemListener(this);
506671
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);
672
+ //oe.toolboxPanel.Return();
673
+
674
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
675
+// trackCB.setToolTipText("Enable tracking");
676
+// trackCB.addItemListener(this);
514677
515678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516679 // screenfitpointButton.addActionListener(this);
....@@ -522,65 +685,146 @@
522685 snapobjectButton.setToolTipText("Snap Object");
523686 }
524687
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
688
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528689
529
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
-
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532
- twoButton.setToolTipText("Show center view only");
533
- twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535691 fourButton.addActionListener(this);
536692 fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538
- sixButton.setToolTipText("2-column layout left");
693
+
694
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ twoButton.setToolTipText("Show right view only");
696
+ twoButton.addActionListener(this);
697
+ this.fullscreenLayout = twoButton;
698
+
699
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ sixButton.setToolTipText("Show left and right");
539701 sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541
- threeButton.setToolTipText("2-column layout right");
542
- threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544
- sevenButton.setToolTipText("3-column layout");
545
- sevenButton.addActionListener(this);
702
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+// threeButton.setToolTipText("2-column layout right");
704
+// threeButton.addActionListener(this);
705
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
706
+// sevenButton.setToolTipText("3-column layout");
707
+// sevenButton.addActionListener(this);
546708 //
547709
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549
- rootButton.setToolTipText("Edit selection in new tab");
710
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ rootButton.setToolTipText("Open selection in new tab");
550712 rootButton.addActionListener(this);
551713
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
714
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553715 closeButton.setToolTipText("Close tab");
554716 closeButton.addActionListener(this);
555717 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
556718 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
719
+
720
+ // INSERT
721
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
722
+ gridButton.setToolTipText("Create grid");
723
+ gridButton.addActionListener(this);
724
+
725
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
+ boxButton.setToolTipText("Create box");
727
+ boxButton.addActionListener(this);
728
+
729
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ sphereButton.setToolTipText("Create sphere");
731
+ sphereButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ coneButton.setToolTipText("Create cone");
735
+ coneButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ torusButton.setToolTipText("Create torus");
739
+ torusButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ superButton.setToolTipText("Create superellipsoid");
743
+ superButton.addActionListener(this);
744
+
745
+ if (Globals.ADVANCED)
746
+ {
747
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ kleinButton.setToolTipText("Create Klein bottle");
749
+ kleinButton.addActionListener(this);
750
+ }
559751
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- editButton.setToolTipText("Edit selection");
752
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ particlesButton.setToolTipText("Create particle system");
754
+ particlesButton.addActionListener(this);
755
+
756
+ oe.toolboxPanel.Return();
757
+
758
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
759
+ groupButton.setToolTipText("Create group");
760
+ groupButton.addActionListener(this);
761
+
762
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
763
+ compositeButton.setToolTipText("Create composite");
764
+ compositeButton.addActionListener(this);
765
+
766
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
767
+ switchButton.setToolTipText("Create item switcher");
768
+ switchButton.addActionListener(this);
769
+
770
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ loopButton.setToolTipText("Create loop");
772
+ loopButton.addActionListener(this);
773
+
774
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ textureButton.setToolTipText("Create texture");
776
+ textureButton.addActionListener(this);
777
+
778
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
779
+ overlayButton.setToolTipText("Create overlay");
780
+ overlayButton.addActionListener(this);
781
+
782
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ lightButton.setToolTipText("Create light");
784
+ lightButton.addActionListener(this);
785
+
786
+ for (int i=6; --i>=0;)
787
+ {
788
+ oe.toolboxPanel.Return();
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ }
797
+
798
+ // EDIT panel
799
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editButton.setToolTipText("Pin selection controls");
562801 editButton.addActionListener(this);
563802
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
566805 uneditButton.addActionListener(this);
567806
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
807
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
808
+ allParamsButton.setToolTipText("Show all controle");
570809 allParamsButton.addActionListener(this);
571810
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
811
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573812 clearPanelButton.setToolTipText("Clear edit panel");
574813 clearPanelButton.addActionListener(this);
575814
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
815
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577816 unselectButton.setToolTipText("Unselect");
578817 unselectButton.addActionListener(this);
579818
580
- commandsPanel.preferredHeight = 1;
819
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ flashSelectionButton.setToolTipText("Highlight selection");
821
+ flashSelectionButton.addActionListener(this);
581822
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
823
+ editCommandsPanel.preferredHeight = 1;
824
+
825
+ SetPinStates(false);
826
+// oe.treePanel.add(commandsPanel);
827
+// oe.treePanel.Return();
584828
585829 // oe.aConstraints.gridx += 1;
586830 // oe.aConstraints.weighty = 0;
....@@ -597,29 +841,17 @@
597841
598842 JScrollPane jSP;
599843 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
844
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
601845 ResetModel();
602846
603847 oe.treePanel.add(jSPPanel);
604848 oe.treePanel.Return();
605849
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;
621850 oe.treePanel.add(copyOptionsPanel);
622851 oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
623855
624856 // mainPanel.setDividerLocation(0.5); //1.0);
625857 // mainPanel.setResizeWeight(0.5);
....@@ -642,29 +874,49 @@
642874 dgr.addDragGestureListener(this);
643875 }catch(Exception e) {}
644876 */
645
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
646878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
647879 }
648880
649881 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
650882 {
883
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
884
+ colorCB.setToolTipText("Copy color when dropped");
885
+ colorCB.addItemListener(this);
886
+
887
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
888
+ materialCB.setToolTipText("Copy material when dropped");
889
+ materialCB.addItemListener(this);
890
+
891
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
892
+ textureCB.setToolTipText("Copy texture when dropped");
893
+ textureCB.addItemListener(this);
894
+
895
+ panel.Return();
896
+
651897 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
652898 boxCB.setToolTipText("Display bounding boxes");
653899 boxCB.addItemListener(this);
654900
655901 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
657903 zoomBoxCB.addItemListener(this);
658904
659905 if (true) // Globals.ADVANCED)
660906 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- supportCB.addItemListener(this);
907
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
908
+// supportCB.setToolTipText("Enable rigging");
909
+// supportCB.addItemListener(this);
910
+
911
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
912
+ freezeCB.setToolTipText("Fast moving camera");
913
+ freezeCB.addItemListener(this);
664914
665915 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
666916 // localCB.addItemListener(this);
667917
918
+ panel.Return();
919
+
668920 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
669921 crowdCB.setToolTipText("Used for crowds");
670922 crowdCB.addItemListener(this);
....@@ -681,6 +933,8 @@
681933 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
682934 // speakerMocapCB.addItemListener(this);
683935
936
+ panel.Return();
937
+
684938 if (false)
685939 {
686940 // handled in scripts
....@@ -695,34 +949,74 @@
695949 //constraints.gridy += 1;
696950 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
697951 smoothfocusCB.addItemListener(this);
952
+ panel.Return();
698953 }
699954
700955 //constraints.gridx += 1;
701956 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
702957 // debugCB.addItemListener(this);
703958
959
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
960
+ trackCB.setToolTipText("Enable tracking target");
961
+ trackCB.addItemListener(this);
962
+
704963 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
964
+ oeilCB.setToolTipText("Move camera when tracking");
705965 oeilCB.addItemListener(this);
706966
967
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
968
+ shadowCB.setToolTipText("When live compute shadows");
969
+ shadowCB.addItemListener(this);
970
+
971
+ panel.Return();
972
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
973
+ toggleTextureCB.setToolTipText("Load textures");
974
+ toggleTextureCB.addItemListener(this);
975
+
976
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
978
+ toggleSwitchCB.addItemListener(this);
979
+
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
983
+
984
+ panel.Return();
985
+ if (Globals.ADVANCED)
986
+ {
707987 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708988 lookAtCB.setToolTipText("Look-at target");
709989 lookAtCB.addItemListener(this);
990
+ }
710991
711992 }
712993
713994 cGridBag fill = new cGridBag();
714
-
715995 fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
7161000
7171001 panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
7181004
7191005 }
7201006
7211007 void EditObject(Object3D obj)
7221008 {
7231009 cRadio radioButton = new cRadio(obj.name);
1010
+
1011
+ // June 2019. Patch to avoid bug with transparency.
1012
+ radioButton.hadMaterial = obj.material != null;
1013
+ if (!radioButton.hadMaterial)
1014
+ {
1015
+ obj.material = new cMaterial();
1016
+ }
1017
+
7241018 radioButton.SetObject(obj);
725
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
7261020 radioButton.SetCamera(cameraView.renderCamera, false);
7271021 radioButton.addActionListener(this);
7281022 radioPanel.add(radioButton);
....@@ -732,6 +1026,8 @@
7321026
7331027 void SetupViews(ObjEditor oe)
7341028 {
1029
+ theFrame = this;
1030
+
7351031 oe.SetupViews();
7361032
7371033 System.out.println("SetupViews");
....@@ -740,23 +1036,28 @@
7401036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7411037 }
7421038
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;
1039
+ cToggleButton liveCB;
1040
+ cCheckBox supportCB;
1041
+ cCheckBox localCB;
1042
+ cCheckBox crowdCB;
1043
+ cCheckBox smoothCB;
1044
+ cToggleButton fastCB;
1045
+ cCheckBox slowCB;
1046
+ cCheckBox boxCB;
1047
+ cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
1049
+ //cToggleButton trackCB;
1050
+ cCheckBox trackCB;
1051
+ cCheckBox smoothfocusCB;
7541052 // JCheckBox speakerMocapCB;
755
- JCheckBox speakerCameraCB;
756
- JCheckBox speakerFocusCB;
757
- JCheckBox debugCB;
758
- JCheckBox oeilCB;
759
- JCheckBox lookAtCB;
1053
+ cCheckBox speakerCameraCB;
1054
+ cCheckBox speakerFocusCB;
1055
+ cCheckBox debugCB;
1056
+
1057
+ cCheckBox oeilCB;
1058
+ cCheckBox shadowCB;
1059
+ cCheckBox autokeepCB;
1060
+ cCheckBox lookAtCB;
7601061
7611062 // static int COLOR = 1;
7621063 // static int MATERIAL = 2;
....@@ -764,9 +1065,9 @@
7641065
7651066 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7661067
767
- JCheckBox colorCB;
768
- JCheckBox materialCB;
769
- JCheckBox textureCB;
1068
+ cCheckBox colorCB;
1069
+ cCheckBox materialCB;
1070
+ cCheckBox textureCB;
7701071
7711072 public void itemStateChanged(ItemEvent e)
7721073 {
....@@ -794,6 +1095,7 @@
7941095 } else if(e.getSource() == liveCB)
7951096 {
7961097 cameraView.ToggleLive();
1098
+ refreshContents(false);
7971099 }
7981100 else if(e.getSource() == supportCB)
7991101 {
....@@ -858,6 +1160,18 @@
8581160 {
8591161 cameraView.ToggleOeil();
8601162 }
1163
+ else if(e.getSource() == shadowCB)
1164
+ {
1165
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1166
+ }
1167
+ else if(e.getSource() == freezeCB)
1168
+ {
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
1174
+ }
8611175 else if(e.getSource() == lookAtCB)
8621176 {
8631177 cameraView.ToggleLookAt();
....@@ -874,7 +1188,8 @@
8741188
8751189 /**/
8761190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
877
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
8781193 if ((path == null) || (path.getPathCount() <= 1)) {
8791194 // We can't move the root node or an empty selection
8801195 return;
....@@ -937,8 +1252,6 @@
9371252 }
9381253 }
9391254
940
- String string = (String) object;
941
-
9421255 System.out.println("Transfer = " + object + "; drop : " + target);
9431256 // if( object instanceof java.io.File[])
9441257 // {
....@@ -946,6 +1259,8 @@
9461259 // objEditor.DropFile((java.io.File[]) object, true);
9471260 // return;
9481261 // }
1262
+
1263
+ String string = object.toString();
9491264
9501265 // File path for Mac and Windows
9511266 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -991,23 +1306,33 @@
9911306
9921307 assert target == objEditor.jTree;
9931308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
9941310 try {
995
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9961312 } catch (Exception e) {
9971313 System.out.println("destinationPath : " + destinationPath);
9981314 return;
9991315 }
10001316
1001
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
10021318 {
1319
+ Object3D child = (Object3D)group.selection.elementAt(i);
1320
+
1321
+ // Cannot move into itself
1322
+ if (child == destinationLeaf)
1323
+ return;
1324
+ }
1325
+
1326
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1327
+// {
10031328 loadClipboard(true);
10041329 objEditor.jTree.setSelectionPath(destinationPath);
10051330 pasteInto(false, false);
1006
- } else {
1007
- loadClipboard(false);
1008
- objEditor.jTree.setSelectionPath(destinationPath);
1009
- pasteInto(false, false); // true); // ???
1010
- }
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
10111336 }
10121337 public void dropActionChanged(DropTargetDragEvent dtde)
10131338 // Called if the user has modified the current drop gesture
....@@ -1112,22 +1437,30 @@
11121437 {
11131438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11141439 //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);
1440
+// gridItem = menu.add(new MenuItem("Grid"));
1441
+// gridItem.addActionListener(this);
1442
+// rectoidItem = menu.add(new MenuItem("Box"));
1443
+// rectoidItem.addActionListener(this);
1444
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1445
+// ellipsoidItem.addActionListener(this);
1446
+// coneItem = menu.add(new MenuItem("Cone"));
1447
+// coneItem.addActionListener(this);
1448
+// torusItem = menu.add(new MenuItem("Torus"));
1449
+// torusItem.addActionListener(this);
1450
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1451
+// superItem.addActionListener(this);
1452
+
1453
+ cameraItem = menu.add(new MenuItem("Camera"));
1454
+ cameraItem.addActionListener(this);
1455
+
1456
+ if (!Globals.ADVANCED)
1457
+ {
11271458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11281459 kleinItem.addActionListener(this);
1129
- particleItem = menu.add(new MenuItem("Particle system"));
1130
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
11311464 if (Globals.ADVANCED)
11321465 {
11331466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1153,15 +1486,15 @@
11531486 }
11541487 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11551488 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);
1489
+// overlayItem = menu.add(new MenuItem("Overlay"));
1490
+// overlayItem.addActionListener(this);
1491
+// lightItem = menu.add(new MenuItem("Light"));
1492
+// lightItem.addActionListener(this);
11601493 menu.add("-");
11611494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11621495 //superLoopItem.addActionListener(this);
1163
- loopItem = menu.add(new MenuItem("Loop"));
1164
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
11651498 doubleItem = menu.add(new MenuItem("Fork"));
11661499 doubleItem.addActionListener(this);
11671500 if (Globals.ADVANCED)
....@@ -1177,6 +1510,9 @@
11771510 animationItem.addItemListener(this);
11781511 animationItem.setState(Globals.ANIMATION);
11791512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
11801516 menu.add("-");
11811517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11821518 parseverticesItem.addActionListener(this);
....@@ -1189,6 +1525,8 @@
11891525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11901526 reduce34MorphItem.addActionListener(this);
11911527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
11921530 menu.add(computeAOItem = new MenuItem("Compute AO"));
11931531 computeAOItem.addActionListener(this);
11941532
....@@ -1197,11 +1535,9 @@
11971535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11981536 mirrorItem.addActionListener(this);
11991537 menu.add("-");
1200
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1201
- memoryItem.addActionListener(this);
12021538 menu.add(analyzeItem = new MenuItem("Analyze"));
12031539 analyzeItem.addActionListener(this);
1204
- menu.add(dumpItem = new MenuItem("Dump"));
1540
+ menu.add(dumpItem = new MenuItem("Print"));
12051541 dumpItem.addActionListener(this);
12061542 // menu.add(pathItem = new MenuItem("From-to path"));
12071543 // pathItem.addActionListener(this);
....@@ -1342,9 +1678,34 @@
13421678 shadow.material = new cMaterial(obj.material);
13431679 shadow.material.diffuse = 0.0001f;
13441680 shadow.material.specular = 0.0001f;
1681
+ //shadow.projectedVertices[1].x = 300;
13451682
13461683 makeSomething(shadow);
13471684 }
1685
+
1686
+ private void ClearUnpinned()
1687
+ {
1688
+ //for (Object3D obj : listUI)
1689
+ for (int i=listUI.size(); --i>=0;)
1690
+ {
1691
+ Object3D obj = listUI.elementAt(i);
1692
+ if (!obj.pinned)
1693
+ {
1694
+ obj.CloseUI();
1695
+ listUI.remove(i);
1696
+ }
1697
+ }
1698
+ }
1699
+
1700
+ private void EditElement(Object3D elem, boolean newWindow)
1701
+ {
1702
+ // if (!(elem instanceof Composite))
1703
+ // newWindow = false;
1704
+ listUI.add(elem);
1705
+ elem.openEditWindow(this, newWindow); //, false);
1706
+ System.out.println("edit : " + elem);
1707
+ elem.editWindow.refreshContents(true); // ? new
1708
+ }
13481709
13491710 /**
13501711 * applyExample
....@@ -1589,7 +1950,7 @@
15891950 {
15901951 ScreenFit();
15911952 } else
1592
- if (source == switchItem)
1953
+ if (source == switchViewItem)
15931954 {
15941955 cVector v1 = new cVector();
15951956 cVector v2 = new cVector();
....@@ -1598,11 +1959,11 @@
15981959 objEditor.cameraView.renderCamera.setAim(v2, v1);
15991960 objEditor.cameraView.repaint();
16001961 } else
1601
- if (source == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
16021963 {
16031964 makeSomething(new Box());
16041965 } else
1605
- if (source == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
16061967 {
16071968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16081969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1681,27 +2042,27 @@
16812042
16822043 makeSomething(obj);
16832044 } else
1684
- if (source == gridItem)
2045
+ if (source == gridItem || source == gridButton)
16852046 {
16862047 makeSomething(new Grid());
16872048 } else
1688
- if (source == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
16892050 {
16902051 makeSomething(new Sphere());
16912052 } else
1692
- if (source == coneItem)
2053
+ if (source == coneItem || source == coneButton)
16932054 {
16942055 makeSomething(new Cone());
16952056 } else
1696
- if (source == torusItem)
2057
+ if (source == torusItem || source == torusButton)
16972058 {
16982059 makeSomething(new Torus());
16992060 } else
1700
- if (source == superItem)
2061
+ if (source == superItem || source == superButton)
17012062 {
17022063 makeSomething(new Superellipsoid());
17032064 } else
1704
- if (source == kleinItem)
2065
+ if (source == kleinItem || source == kleinButton)
17052066 {
17062067 makeSomething(new Klein());
17072068 } else
....@@ -1721,7 +2082,7 @@
17212082 {
17222083 makeSomething(new BezierSurface());
17232084 } else
1724
- if (source == overlayItem)
2085
+ if (source == overlayItem || source == overlayButton)
17252086 {
17262087 /*
17272088 Object3D obj = new BezierSurface(5,8);
....@@ -1769,7 +2130,7 @@
17692130 s.setup();
17702131 makeSomething(s);
17712132 } else
1772
- if (source == lightItem)
2133
+ if (source == lightItem || source == lightButton)
17732134 {
17742135 makeSomething(new Light());
17752136 } else
....@@ -1819,30 +2180,30 @@
18192180
18202181 group(g);
18212182 } else
1822
- if (source == loopItem)
2183
+ if (source == loopItem || source == loopButton)
18232184 {
18242185 Composite csg = new GroupLeaf();
18252186 csg.count = 5;
18262187 group(csg);
1827
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
18282189 csg.addChild(child);
18292190 child.addChild(csg);
18302191 } else
18312192 if (source == doubleItem)
18322193 {
1833
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
18342195 csg.count = 5;
18352196 group(csg);
1836
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
18372198 csg.addChild(child);
18382199 child.addChild(csg);
1839
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
18402201 csg.addChild(child);
18412202 child.addChild(csg);
18422203 } else
18432204 if (source == tripleItem)
18442205 {
1845
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
18462207 csg.count = 4;
18472208 group(csg);
18482209 Composite child = new cGroup();
....@@ -1854,31 +2215,6 @@
18542215 child = new cGroup();
18552216 csg.addChild(child);
18562217 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
- }
18822218 } else
18832219 if (source == computeAOItem)
18842220 {
....@@ -1917,6 +2253,46 @@
19172253 {
19182254 DumpObject();
19192255 } else
2256
+ if (source == minButton)
2257
+ {
2258
+ Minimize();
2259
+ } else
2260
+ if (source == maxButton)
2261
+ {
2262
+ Maximize();
2263
+ } else
2264
+ if (source == fullButton)
2265
+ {
2266
+ ToggleFullScreen();
2267
+ } else
2268
+ if (source == undoButton)
2269
+ {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2273
+ Undo();
2274
+ } else
2275
+ if (source == restoreButton)
2276
+ {
2277
+ // Restore current version
2278
+ Restore();
2279
+ } else
2280
+ if (source == replaceButton)
2281
+ {
2282
+ // Overwrite current version
2283
+ Replace();
2284
+ } else
2285
+ if (source == redoButton)
2286
+ {
2287
+ // Go to next version
2288
+ Redo();
2289
+ } else
2290
+ if (source == saveButton)
2291
+ {
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
2295
+ } else
19202296 if (source == oneStepButton)
19212297 {
19222298 Globals.ONESTEP = true;
....@@ -1924,17 +2300,14 @@
19242300 } else
19252301 if (source == screenfitButton)
19262302 {
1927
- //Reload(lastConverter, lastFilename, true);
19282303 ScreenFit();
19292304 } else
19302305 if (source == screenfitpointButton)
19312306 {
1932
- //Reload(lastConverter, lastFilename, true);
19332307 ScreenFitPoint();
19342308 } else
19352309 if (source == snapobjectButton)
19362310 {
1937
- //Reload(lastConverter, lastFilename, true);
19382311 SnapObject();
19392312 } else
19402313 // if (event.getSource() == recompileButton)
....@@ -1970,6 +2343,14 @@
19702343 if (source == cutItem || source == clearButton)
19712344 {
19722345 loadClipboard(true);
2346
+ } else
2347
+ if (source == undoItem)
2348
+ {
2349
+ Undo();
2350
+ } else
2351
+ if (source == redoItem)
2352
+ {
2353
+ Redo();
19732354 } else
19742355 if (source == duplicateItem)
19752356 {
....@@ -2290,7 +2671,7 @@
22902671 {
22912672 StepAll();
22922673 } else
2293
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
22942675 {
22952676 //int indices[] = jList.getSelectedIndices();
22962677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2302,9 +2683,9 @@
23022683 {
23032684 ClearSelection(true);
23042685 } else
2305
- if (source == grabItem)
2686
+ if (source == grabItem || source == groupButton)
23062687 {
2307
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
23082689 } else
23092690 if (source == hideItem)
23102691 {
....@@ -2322,11 +2703,11 @@
23222703 {
23232704 makeSomething(new Camera());
23242705 } else
2325
- if (source == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
23262707 {
23272708 group(new Composite());
23282709 } else
2329
- if (source == randomItem)
2710
+ if (source == switchItem || source == switchButton)
23302711 {
23312712 RandomNode random = new RandomNode();
23322713 group(random);
....@@ -2428,7 +2809,7 @@
24282809 {
24292810 group(new cLinker());
24302811 } else
2431
- if (source == textureItem)
2812
+ if (source == textureItem || source == textureButton)
24322813 {
24332814 group(new TextureNode());
24342815 } else
....@@ -2448,17 +2829,30 @@
24482829 {
24492830 CastShadow(2);
24502831 } else
2451
- if (source == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
24522833 {
2453
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
24542836 for (int i=0; i<group.selection.size(); i++)
24552837 {
2456
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
24572843 }
24582844
2459
- ClearSelection(false);
2460
-
2461
- refreshContents();
2845
+ if (!hasRoot)
2846
+ {
2847
+ for (int i=0; i<group.selection.size(); i++)
2848
+ {
2849
+ Ungroup(group.selection.get(i));
2850
+ }
2851
+
2852
+ ClearSelection(false);
2853
+
2854
+ refreshContents();
2855
+ }
24622856 } else
24632857 if (source == genUVItem)
24642858 {
....@@ -2470,7 +2864,7 @@
24702864 } else
24712865 if (source == genNormalsMESHItem)
24722866 {
2473
- GenNormals(true); // TODO
2867
+ GenNormalsMESH();
24742868 } else
24752869 if (source == genNormalsORGANItem)
24762870 {
....@@ -2535,6 +2929,22 @@
25352929 if (source == unmarkleavesItem)
25362930 {
25372931 MarkLeaves(false);
2932
+ } else
2933
+ if (source == rewindleavesItem)
2934
+ {
2935
+ RewindLeaves(true);
2936
+ } else
2937
+ if (source == unrewindleavesItem)
2938
+ {
2939
+ RewindLeaves(false);
2940
+ } else
2941
+ if (source == randomleavesItem)
2942
+ {
2943
+ RandomLeaves(true);
2944
+ } else
2945
+ if (source == unrandomleavesItem)
2946
+ {
2947
+ RandomLeaves(false);
25382948 } else
25392949 if (source == flipVItem)
25402950 {
....@@ -2743,7 +3153,7 @@
27433153 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27443154 {
27453155 obj = (Object3D)e.nextElement();
2746
- obj.SetBumpTexture(null);
3156
+ obj.ResetBumpTexture();
27473157 }
27483158
27493159 refreshContents();
....@@ -2770,6 +3180,10 @@
27703180 if (source == twoButton)
27713181 {
27723182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
27733187 // bug
27743188 //gridPanel.setDividerLocation(1.0);
27753189 //bigPanel.setDividerLocation(0.0);
....@@ -2802,10 +3216,31 @@
28023216 bigThree.ClearUI();
28033217 bigThree.add(centralPanel);
28043218 bigThree.FlushUI();
3219
+
3220
+ cameraView.requestFocusInWindow();
3221
+
3222
+// refreshContents(true);
3223
+//
3224
+// try
3225
+// {
3226
+// java.awt.Robot bot = new java.awt.Robot();
3227
+// int mask = InputEvent.BUTTON1_MASK;
3228
+// bot.mouseMove(100, 100);
3229
+// bot.mousePress(mask);
3230
+// bot.mouseRelease(mask);
3231
+// }
3232
+// catch (Exception e)
3233
+// {
3234
+//
3235
+// }
3236
+
28053237 } else
28063238 if (source == threeButton)
28073239 {
28083240 radio.layout = threeButton;
3241
+
3242
+ if (CameraPane.FULLSCREEN)
3243
+ fullscreenLayout = radio.layout;
28093244
28103245 // bigThree.remove(scenePanel);
28113246 // bigThree.remove(centralPanel);
....@@ -2838,10 +3273,15 @@
28383273 bigThree.add(centralPanel);
28393274 bigThree.add(XYZPanel);
28403275 bigThree.FlushUI();
3276
+
3277
+ cameraView.requestFocusInWindow();
28413278 } else
28423279 if (source == fourButton)
28433280 {
28443281 radio.layout = fourButton;
3282
+
3283
+ if (CameraPane.FULLSCREEN)
3284
+ fullscreenLayout = radio.layout;
28453285
28463286 // bigThree.remove(scenePanel);
28473287 // bigThree.remove(centralPanel);
....@@ -2873,10 +3313,15 @@
28733313 bigThree.ClearUI();
28743314 bigThree.add(scenePanel);
28753315 bigThree.FlushUI();
3316
+
3317
+ cameraView.requestFocusInWindow();
28763318 } else
28773319 if (source == sixButton)
28783320 {
28793321 radio.layout = sixButton;
3322
+
3323
+ if (CameraPane.FULLSCREEN)
3324
+ fullscreenLayout = radio.layout;
28803325
28813326 // bigThree.remove(scenePanel);
28823327 // bigThree.remove(centralPanel);
....@@ -2909,10 +3354,15 @@
29093354 bigThree.add(scenePanel);
29103355 bigThree.add(centralPanel);
29113356 bigThree.FlushUI();
3357
+
3358
+ cameraView.requestFocusInWindow();
29123359 } else
29133360 if (source == sevenButton)
29143361 {
29153362 radio.layout = sevenButton;
3363
+
3364
+ if (CameraPane.FULLSCREEN)
3365
+ fullscreenLayout = radio.layout;
29163366
29173367 // bigThree.remove(scenePanel);
29183368 // bigThree.remove(centralPanel);
....@@ -2946,6 +3396,8 @@
29463396 bigThree.add(centralPanel);
29473397 bigThree.add(XYZPanel);
29483398 bigThree.FlushUI();
3399
+
3400
+ cameraView.requestFocusInWindow();
29493401 } else
29503402 if (source == rootButton)
29513403 {
....@@ -2957,6 +3409,7 @@
29573409 EditObject(obj);
29583410 }
29593411
3412
+ cameraView.requestFocusInWindow();
29603413 refreshContents(true);
29613414 } else
29623415 if (source == closeButton)
....@@ -2966,22 +3419,37 @@
29663419 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29673420 {
29683421 ab = (cRadio)e.nextElement();
2969
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3422
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29703423 {
3424
+ // Patch to avoid bug with transparency.
3425
+ if (!ab.hadMaterial)
3426
+ {
3427
+ ab.object.material = null;
3428
+ }
3429
+
29713430 buttonGroup.remove(ab);
29723431 radioPanel.remove(ab);
29733432
2974
- ab.GetObject().editWindow = null;
3433
+ //ab.GetObject().editWindow = null;
3434
+ ab.GetObject().manipWindow = null;
29753435 // ab.GetObject().objectUI = null; // ?????????
29763436
29773437 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29783438 break;
29793439 }
29803440 }
3441
+
3442
+ cameraView.requestFocusInWindow();
29813443 refreshContents(true);
29823444 } else
29833445 if (source == editItem || source == editButton)
29843446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
29853453 EditSelection(false);
29863454 } else
29873455 if (source == uneditButton)
....@@ -2991,10 +3459,11 @@
29913459 Object3D child = (Object3D)e.nextElement();
29923460 if(child.editWindow != null)
29933461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
29943463 child.CloseUI();
29953464 listUI.remove(child);
29963465
2997
- child.editWindow = null; // ???????????
3466
+ //child.editWindow = null; // ???????????
29983467 }
29993468 objEditor.ctrlPanel.FlushUI();
30003469 //objEditor.jTree.clearSelection();
....@@ -3007,6 +3476,7 @@
30073476 //copy.ClearUI();
30083477 for (Object3D obj : listUI)
30093478 {
3479
+ obj.pinned = false;
30103480 obj.CloseUI();
30113481 }
30123482 listUI.clear();
....@@ -3016,7 +3486,7 @@
30163486 {
30173487 assert(copy == group);
30183488
3019
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30203490
30213491 for (Object3D obj : listUI)
30223492 {
....@@ -3065,6 +3535,9 @@
30653535 }
30663536
30673537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
30683541 //Globals.theRenderer.object = group;
30693542 if(!useclient)
30703543 {
....@@ -3081,7 +3554,9 @@
30813554 sideView.object = group;
30823555 }
30833556
3084
-// fix "+" issue group.editWindow = this;
3557
+// fix "+" issue
3558
+ //group.editWindow = this;
3559
+ group.manipWindow = this;
30853560
30863561 /*
30873562 currentLayout = radio.layout;
....@@ -3089,13 +3564,35 @@
30893564 currentLayout = sevenButton;
30903565 */
30913566 radio.layout.doClick();
3567
+
3568
+ ClearUnpinned();
3569
+ //Grafreed.Assert(group != null);
3570
+ //Grafreed.Assert(group.selection != null);
3571
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3572
+ if (group.selection == null || group.selection.size() == 1)
3573
+ EditSelection(false);
30923574 keepparent = group.parent;
30933575 // PARENT = NULL or not???
30943576 //group.parent = null; // ROOT
30953577 //group.attributes = -1;
30963578 ResetModel();
3579
+
3580
+ cameraView.requestFocusInWindow();
30973581 refreshContents(true);
3098
- }
3582
+ } else if (event.getSource() == editCameraItem)
3583
+ {
3584
+ cameraView.ProtectCamera();
3585
+ cameraView.repaint();
3586
+ return;
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3588
+ {
3589
+ cameraView.RevertCamera();
3590
+ cameraView.repaint();
3591
+ return;
3592
+ // } else if (event.getSource() == textureButton)
3593
+ // {
3594
+ // return; // true;
3595
+ }
30993596 else
31003597 {
31013598 //return super.action(event, arg);
....@@ -3104,7 +3601,6 @@
31043601 }
31053602
31063603 boolean useclient = false;
3107
- cRadio radio;
31083604
31093605 void ToggleRoot()
31103606 {
....@@ -3343,7 +3839,8 @@
33433839
33443840 int size = obj.MemorySize();
33453841
3346
- System.err.println((size/1024) + " KB is the size of " + obj);
3842
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3843
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33473844 }
33483845 }
33493846 catch (Exception e)
....@@ -3424,6 +3921,13 @@
34243921 void GenNormals(boolean crease)
34253922 {
34263923 group.GenNormalsS(crease);
3924
+
3925
+ refreshContents();
3926
+ }
3927
+
3928
+ void GenNormalsMESH()
3929
+ {
3930
+ group.GenNormalsMeshS();
34273931
34283932 refreshContents();
34293933 }
....@@ -3659,7 +4163,7 @@
36594163
36604164 try
36614165 {
3662
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4166
+ texturedata = Globals.theRenderer.GetTextureData(tex.pigmenttexture, pigment, false, node.texres);
36634167 }
36644168 catch (Exception e)
36654169 {
....@@ -4051,6 +4555,18 @@
40514555 refreshContents();
40524556 }
40534557
4558
+ void RewindLeaves(boolean hide)
4559
+ {
4560
+ group.selection.RewindLeaves(hide);
4561
+ refreshContents();
4562
+ }
4563
+
4564
+ void RandomLeaves(boolean hide)
4565
+ {
4566
+ group.selection.RandomLeaves(hide);
4567
+ refreshContents();
4568
+ }
4569
+
40544570 void SetTexRes(int tr)
40554571 {
40564572 group.selection.SetTexRes(tr);
....@@ -4122,28 +4638,25 @@
41224638 // }
41234639 // }
41244640
4125
- static boolean allparams = true;
4126
-
4127
- static Vector<Object3D> listUI = new Vector<Object3D>();
4128
-
41294641 void EditSelection(boolean newWindow)
41304642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
41314649 // aConstraints.gridy = 0;
41324650 for (int i=0; i<group.selection.size(); i++)
41334651 {
41344652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41354653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4136
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41374655
41384656 Object3D elem = (Object3D)group.selection.elementAt(i);
41394657 if(elem != group || !newWindow)
41404658 {
4141
- // if (!(elem instanceof Composite))
4142
- // newWindow = false;
4143
- listUI.add(elem);
4144
- elem.openEditWindow(this, newWindow); //, false);
4145
- System.out.println("edit : " + elem);
4146
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
41474660 }
41484661 }
41494662 }
....@@ -4218,7 +4731,8 @@
42184731 //new Exception().printStackTrace();
42194732
42204733 freezemodel = true;
4221
-
4734
+ ClearUnpinned();
4735
+
42224736 /**/
42234737 //switch (event.id)
42244738 {
....@@ -4226,7 +4740,6 @@
42264740 //case 702: // Event.LIST_DESELECT
42274741 group.deselectAll();
42284742 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4229
- objEditor.ClearInfo(); // .GetMaterial());
42304743 if (tps != null)
42314744 {
42324745 for (int i=0; i < tps.length; i++)
....@@ -4235,10 +4748,8 @@
42354748
42364749 //if (child.parent != null)
42374750 //child.parent.addSelectee(child);
4751
+ objEditor.SetMaterial(child);
42384752 group.addSelectee(child);
4239
- objEditor.SetMaterial(child); // .GetMaterial());
4240
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4241
- System.err.println("info : " + child.GetPath());
42424753 }
42434754 }
42444755 // else
....@@ -4248,20 +4759,28 @@
42484759 // System.err.println("info : " + group.GetPath());
42494760 // }
42504761
4251
- objEditor.SetText(); // jan 2014
4252
-
4253
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4762
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42544763 CameraPane.flash = true;
42554764
4256
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4765
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42574766 // a camera
42584767 {
4259
- CameraPane.camerachangeframe = 0; // don't refuse it
4260
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4769
+ {
4770
+ CameraPane.camerachangeframe = 0; // don't refuse it
4771
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4772
+ }
42614773 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42624774 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42634775 }
42644776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
42654784 refreshContents();
42664785 //return true;
42674786 }
....@@ -4270,6 +4789,35 @@
42704789
42714790 freezemodel = false;
42724791 }
4792
+
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
4801
+ void refreshContents(boolean cp)
4802
+ {
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4805
+ {
4806
+ objEditor.ClearInfo(); // .GetMaterial());
4807
+
4808
+ for (int i=0; i < group.selection.Size(); i++)
4809
+ {
4810
+ Object3D child = (Object3D) group.selection.get(i);
4811
+
4812
+ objEditor.AddInfo(child, this, true);
4813
+ System.err.println("info : " + child.GetPath());
4814
+ }
4815
+
4816
+ objEditor.SetText(); // jan 2014
4817
+ }
4818
+
4819
+ super.refreshContents(cp);
4820
+ }
42734821
42744822 void linkSomething(Object3D thing)
42754823 {
....@@ -4341,6 +4889,7 @@
43414889 {
43424890 if (group.selection.isEmpty())
43434891 return;
4892
+
43444893 Grafreed.clipboardIsTempGroup = false;
43454894 Composite tGroup = null;
43464895 if (group.selection.size() > 0) // 1)
....@@ -4351,6 +4900,8 @@
43514900
43524901 if (cut)
43534902 {
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
43544905 //int indices[] = jList.getSelectedIndices();
43554906 //for (int i = indices.length - 1; i >= 0; i--)
43564907 //jList.remove(indices[i]);
....@@ -4440,8 +4991,10 @@
44404991 }
44414992
44424993 }
4994
+
44434995 if (Grafreed.clipboardIsTempGroup)
44444996 Grafreed.clipboard = tGroup;
4997
+
44454998 if (cut)
44464999 {
44475000 ResetModel();
....@@ -4451,6 +5004,10 @@
44515004
44525005 void paste(boolean expand)
44535006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
44545011 // if (GrafreeD.clipboard == null)
44555012 // return;
44565013 boolean first = true;
....@@ -4510,6 +5067,7 @@
45105067 Grafreed.clipboard.get(0).parent = keepparent;
45115068 }
45125069
5070
+ Globals.REPLACEONMAKE = keep;
45135071 ResetModel();
45145072 refreshContents();
45155073 }
....@@ -4645,6 +5203,10 @@
46455203
46465204 void group(Object3D csg, boolean grab)
46475205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
46485210 if (//false) // why??
46495211 !group.selection.isEmpty())
46505212 {
....@@ -4758,10 +5320,15 @@
47585320 //node.add(csg);
47595321 //makeSomething(node);
47605322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
47615324 }
47625325
47635326 void Ungroup(Object3D g)
47645327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
47655332 if (g instanceof HiddenObject)
47665333 {
47675334 HiddenObject h = (HiddenObject) g;
....@@ -4778,6 +5345,7 @@
47785345 objEditor.makeSomething(g.get(i), false);
47795346 }
47805347 }
5348
+ Globals.REPLACEONMAKE = keep;
47815349 }
47825350
47835351 void ungroup()
....@@ -4973,21 +5541,6 @@
49735541 }
49745542 */
49755543
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
-
49915544 /*
49925545 public void Callback(Object obj)
49935546 {
....@@ -5011,23 +5564,6 @@
50115564 }
50125565 */
50135566
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
-
50315567 String GetFile(String dialogName)
50325568 {
50335569 if (Grafreed.standAlone)
....@@ -5098,7 +5634,28 @@
50985634 cButton clearpanelButton;
50995635 cButton unselectButton;
51005636
5637
+ cButton restoreCameraButton;
5638
+
5639
+ cButton saveButton;
51015640 cButton oneStepButton;
5641
+
5642
+ cButton groupButton;
5643
+ cButton ungroupButton;
5644
+ cButton compositeButton;
5645
+ cButton switchButton;
5646
+ cButton loopButton;
5647
+ cButton textureButton;
5648
+
5649
+ cButton gridButton;
5650
+ cButton boxButton;
5651
+ cButton sphereButton;
5652
+ cButton coneButton;
5653
+ cButton torusButton;
5654
+ cButton superButton;
5655
+ cButton kleinButton;
5656
+ cButton particlesButton;
5657
+ cButton overlayButton;
5658
+ cButton lightButton;
51025659
51035660 cButton screenfitButton;
51045661 cButton screenfitpointButton;
....@@ -5111,14 +5668,6 @@
51115668
51125669 cButton setsupportButton;
51135670
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
-
51225671 //
51235672 //Composite
51245673 Object3D // to do !!
....@@ -5128,9 +5677,11 @@
51285677 //JTree jTree;
51295678 private MenuItem lookAtItem;
51305679 private MenuItem lookFromItem;
5131
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
51325681 private MenuItem cutItem;
5133
- private MenuItem duplicateItem;
5682
+ private MenuItem undoItem;
5683
+ private MenuItem redoItem;
5684
+ private JMenuItem duplicateItem;
51345685 private MenuItem cloneItem;
51355686 private MenuItem cloneSupportItem;
51365687 private MenuItem overwriteGeoItem;
....@@ -5158,7 +5709,7 @@
51585709 private MenuItem pasteLinkItem;
51595710 private MenuItem pasteCloneItem;
51605711 private MenuItem pasteExpandItem;
5161
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
51625713 private MenuItem clearAllItem;
51635714 private MenuItem genUVItem;
51645715 private MenuItem genNormalsMESHItem;
....@@ -5193,6 +5744,10 @@
51935744 private MenuItem showleavesItem;
51945745 private MenuItem markleavesItem;
51955746 private MenuItem unmarkleavesItem;
5747
+ private MenuItem rewindleavesItem;
5748
+ private MenuItem unrewindleavesItem;
5749
+ private MenuItem randomleavesItem;
5750
+ private MenuItem unrandomleavesItem;
51965751
51975752 private MenuItem flipVItem;
51985753 private MenuItem unflipVItem;
....@@ -5214,7 +5769,7 @@
52145769 private MenuItem frontItem;
52155770 private MenuItem cameraItem;
52165771 private MenuItem compositeItem;
5217
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
52185773 private MenuItem physicsItem;
52195774 private MenuItem frameselectorItem;
52205775 private MenuItem scriptNodeItem;
....@@ -5276,11 +5831,6 @@
52765831 private MenuItem doubleItem;
52775832 private MenuItem tripleItem;
52785833
5279
- private MenuItem importGFDItem;
5280
- private MenuItem importVRMLX3DItem;
5281
- private MenuItem import3DSItem;
5282
- private MenuItem importOBJItem;
5283
-
52845834 private MenuItem computeAOItem;
52855835 private MenuItem recompileItem;
52865836 private MenuItem editScriptItem;
....@@ -5290,4 +5840,8 @@
52905840 private MenuItem analyzeItem;
52915841 private MenuItem dumpItem;
52925842 //boolean freezemodel = false;
5843
+
5844
+ Menu cameraMenu;
5845
+ MenuItem editCameraItem;
5846
+ MenuItem restoreCameraItem;
52935847 }