Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
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,7 +80,13 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
77
- SetupMenu2(objEditor);
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
89
+ SetupMenu2(this); //objEditor);
7890 SetupUI2(objEditor);
7991 objEditor.SetupUI(true);
8092 SetupViews(objEditor);
....@@ -84,6 +96,10 @@
8496
8597 void CloneSelection(boolean supports)
8698 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
87103 // Object3D keep = GrafreeD.clipboard;
88104 //Object3D obj;
89105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +110,7 @@
94110
95111 makeSomething(clone, i==group.selection.size()-1);
96112 }
113
+ Globals.REPLACEONMAKE = keep;
97114 }
98115
99116 void CloneClipboard(boolean supports)
....@@ -148,28 +165,21 @@
148165
149166 //JTextField nameField;
150167
151
- void SetupMenu2(ObjEditor oe)
168
+ void SetupMenu2(GroupEditor oe)
152169 {
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
-
170
+ oe.jTree = new cTree();
171
+
168172 Menu menu;
169173 oe.menuBar.add(menu = new Menu("Edit"));
170174 //editItem = menu.add(new MenuItem("Edit"));
171175 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
176
+
177
+// undoItem = menu.add(new MenuItem("Undo"));
178
+// undoItem.addActionListener(this);
179
+// redoItem = menu.add(new MenuItem("Redo"));
180
+// redoItem.addActionListener(this);
181
+// menu.add("-");
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173183 duplicateItem.addActionListener(this);
174184 cloneItem = menu.add(new MenuItem("Clone"));
175185 cloneItem.addActionListener(this);
....@@ -185,7 +195,6 @@
185195 copyItem.addActionListener(this);
186196 pasteItem = menu.add(new MenuItem("Paste"));
187197 pasteItem.addActionListener(this);
188
- menu.add("-");
189198
190199 menu.add("-");
191200 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,8 +206,8 @@
197206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
198207 // pasteExpandItem.addActionListener(this);
199208 menu.add("-");
200
- clearItem = menu.add(new MenuItem("Clear"));
201
- clearItem.addActionListener(this);
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
202211
203212 if (Globals.ADVANCED)
204213 {
....@@ -206,7 +215,94 @@
206215 clearAllItem = menu.add(new MenuItem("Clear All"));
207216 clearAllItem.addActionListener(this);
208217 }
218
+
219
+ menuBar.add(cameraMenu = new Menu("View"));
220
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
221
+ //zBufferItem.addActionListener(this);
222
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
223
+ //normalLensItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
226
+
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
239
+
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
241
+ toggleHandleItem.addItemListener(this);
242
+ toggleHandleItem.setState(CameraPane.HANDLES);
243
+
244
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
245
+ togglePaintItem.addItemListener(this);
246
+ togglePaintItem.setState(CameraPane.PAINTMODE);
247
+
248
+ if (Globals.ADVANCED)
249
+ {
250
+ cameraMenu.add("-");
251
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
252
+ toggleLiveItem.addItemListener(this);
253
+ toggleLiveItem.setState(Globals.isLIVE());
209254
255
+ cameraMenu.add(stepItem = new MenuItem("Step"));
256
+ stepItem.addActionListener(this);
257
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
258
+ // toggleDLItem.addItemListener(this);
259
+ // toggleDLItem.setState(false);
260
+
261
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
262
+ toggleRenderItem.addItemListener(this);
263
+ toggleRenderItem.setState(!CameraPane.frozen);
264
+
265
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
266
+ toggleDebugItem.addItemListener(this);
267
+ toggleDebugItem.setState(Globals.DEBUG);
268
+
269
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
270
+ toggleFrustumItem.addItemListener(this);
271
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
272
+
273
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
274
+ toggleFootContactItem.addItemListener(this);
275
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
276
+
277
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
278
+ toggleTimelineItem.addItemListener(this);
279
+ }
280
+
281
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
282
+// toggleRootItem.addItemListener(this);
283
+// toggleRootItem.setState(false);
284
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
285
+// animationItem.addItemListener(this);
286
+// animationItem.setState(CameraPane.ANIMATION);
287
+ cameraMenu.add("-");
288
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
289
+ editCameraItem.addActionListener(this);
290
+
291
+ if (Globals.ADVANCED)
292
+ {
293
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
294
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
296
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
297
+ oe.cameraMenu.add("-");
298
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
299
+ openWindowItem.addActionListener(this);
300
+ editLeafItem.addActionListener(this);
301
+ lookAtItem.addActionListener(this);
302
+ //lookFromItem.addActinoListener(this);
303
+ //switchViewItem.addActionListener(this);
304
+ }
305
+
210306 oe.menuBar.add(menu = new Menu("Setting"));
211307 if (Globals.ADVANCED)
212308 {
....@@ -249,21 +345,29 @@
249345 }
250346
251347 oe.menuBar.add(menu = new Menu("Group"));
252
- grabItem = menu.add(new MenuItem("Grab"));
253
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
254350 backItem = menu.add(new MenuItem("Back"));
255351 backItem.addActionListener(this);
256352 frontItem = menu.add(new MenuItem("Front"));
257353 frontItem.addActionListener(this);
258
- compositeItem = menu.add(new MenuItem("Composite"));
259
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
260359 hideItem = menu.add(new MenuItem("Hidden Group"));
261360 hideItem.addActionListener(this);
361
+ }
262362 ungroupItem = menu.add(new MenuItem("Ungroup"));
263363 ungroupItem.addActionListener(this);
264
- menu.add("-");
265
- randomItem = menu.add(new MenuItem("Switch node"));
266
- randomItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
267371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
268372 switchGeoItem.addActionListener(this);
269373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -271,8 +375,6 @@
271375 morphItem = menu.add(new MenuItem("Morph Group"));
272376 morphItem.addActionListener(this);
273377
274
- if (Globals.ADVANCED)
275
- {
276378 menu.add("-");
277379 physicsItem = menu.add(new MenuItem("Physics"));
278380 physicsItem.addActionListener(this);
....@@ -280,30 +382,29 @@
280382 frameselectorItem.addActionListener(this);
281383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
282384 scriptNodeItem.addActionListener(this);
283
- cameraItem = menu.add(new MenuItem("Camera"));
284
- cameraItem.addActionListener(this);
285385 }
286386
287387 oe.menuBar.add(menu = new Menu("Object"));
288
- textureItem = menu.add(new MenuItem("Texture"));
289
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
290390 billboardItem = menu.add(new MenuItem("Billboard"));
291391 billboardItem.addActionListener(this);
292392 csgItem = menu.add(new MenuItem("CSG"));
293393 csgItem.addActionListener(this);
294
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
295395 shadowXItem.addActionListener(this);
296
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
297397 shadowYItem.addActionListener(this);
298
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
299399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
300403 if (Globals.ADVANCED)
301404 {
302405 menu.add("-");
303406 linkerItem = menu.add(new MenuItem("Linker"));
304407 linkerItem.addActionListener(this);
305
- attributeItem = menu.add(new MenuItem("Attribute"));
306
- attributeItem.addActionListener(this);
307408 templateItem = menu.add(new MenuItem("Template"));
308409 templateItem.addActionListener(this);
309410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -332,7 +433,7 @@
332433 genNormalsMESHItem.addActionListener(this);
333434 if (Globals.ADVANCED)
334435 {
335
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
336437 genNormalsMINEItem.addActionListener(this);
337438 }
338439 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -392,6 +493,14 @@
392493 markleavesItem.addActionListener(this);
393494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394495 unmarkleavesItem.addActionListener(this);
496
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
497
+ rewindleavesItem.addActionListener(this);
498
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
499
+ unrewindleavesItem.addActionListener(this);
500
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
501
+ randomleavesItem.addActionListener(this);
502
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
503
+ unrandomleavesItem.addActionListener(this);
395504 menu.add("-");
396505 flipVItem = menu.add(new MenuItem("Flip V"));
397506 flipVItem.addActionListener(this);
....@@ -443,25 +552,25 @@
443552 oe.menuBar.add(menu = new Menu("Insert"));
444553 buildCreateMenu(menu);
445554
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
-
459555 oe.menuBar.add(menu = new Menu("Tools"));
460556 buildToolsMenu(menu);
461557 }
462558
559
+
463560 void SetupUI2(ObjEditor oe)
464561 {
562
+ // June 2019
563
+ if (oe == null)
564
+ {
565
+ //super.SetupUI2(this);
566
+ //return;
567
+ }
568
+
569
+ if (copy != group)
570
+ {
571
+ //super.SetupUI2(this);
572
+ }
573
+
465574 //new Exception().printStackTrace();
466575
467576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +599,79 @@
490599 oe.radioPanel.add(dummyButton);
491600 oe.buttonGroup.add(dummyButton);
492601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
493606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494607
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
611
+
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
618
+
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ fullButton.setToolTipText("Full-screen window");
621
+ fullButton.addActionListener(this);
622
+
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
630
+
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
633
+ saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
639
+
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
496659 liveCB.setToolTipText("Enable animation");
497660 liveCB.addItemListener(this);
498661
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500663 oneStepButton.setToolTipText("Animate one step forward");
501664 oneStepButton.addActionListener(this);
502665
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504667 fastCB.setToolTipText("Fast mode");
505668 fastCB.addItemListener(this);
506669
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);
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
514675
515676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516677 // screenfitpointButton.addActionListener(this);
....@@ -522,65 +683,146 @@
522683 snapobjectButton.setToolTipText("Snap Object");
523684 }
524685
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528687
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);
688
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535689 fourButton.addActionListener(this);
536690 fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538
- sixButton.setToolTipText("2-column layout left");
691
+
692
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ twoButton.setToolTipText("Show right view only");
694
+ twoButton.addActionListener(this);
695
+ this.fullscreenLayout = twoButton;
696
+
697
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ sixButton.setToolTipText("Show left and right");
539699 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);
700
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+// threeButton.setToolTipText("2-column layout right");
702
+// threeButton.addActionListener(this);
703
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+// sevenButton.setToolTipText("3-column layout");
705
+// sevenButton.addActionListener(this);
546706 //
547707
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549
- rootButton.setToolTipText("Edit selection in new tab");
708
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ rootButton.setToolTipText("Open selection in new tab");
550710 rootButton.addActionListener(this);
551711
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
712
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553713 closeButton.setToolTipText("Close tab");
554714 closeButton.addActionListener(this);
555715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
556716 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
717
+
718
+ // INSERT
719
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
720
+ gridButton.setToolTipText("Create grid");
721
+ gridButton.addActionListener(this);
722
+
723
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ boxButton.setToolTipText("Create box");
725
+ boxButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ sphereButton.setToolTipText("Create sphere");
729
+ sphereButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ coneButton.setToolTipText("Create cone");
733
+ coneButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ torusButton.setToolTipText("Create torus");
737
+ torusButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ superButton.setToolTipText("Create superellipsoid");
741
+ superButton.addActionListener(this);
742
+
743
+ if (Globals.ADVANCED)
744
+ {
745
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ kleinButton.setToolTipText("Create Klein bottle");
747
+ kleinButton.addActionListener(this);
748
+ }
559749
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- editButton.setToolTipText("Edit selection");
750
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751
+ particlesButton.setToolTipText("Create particle system");
752
+ particlesButton.addActionListener(this);
753
+
754
+ oe.toolboxPanel.Return();
755
+
756
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ groupButton.setToolTipText("Create group");
758
+ groupButton.addActionListener(this);
759
+
760
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ compositeButton.setToolTipText("Create composite");
762
+ compositeButton.addActionListener(this);
763
+
764
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ switchButton.setToolTipText("Create item switcher");
766
+ switchButton.addActionListener(this);
767
+
768
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ loopButton.setToolTipText("Create loop");
770
+ loopButton.addActionListener(this);
771
+
772
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ textureButton.setToolTipText("Create texture");
774
+ textureButton.addActionListener(this);
775
+
776
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ overlayButton.setToolTipText("Create overlay");
778
+ overlayButton.addActionListener(this);
779
+
780
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ lightButton.setToolTipText("Create light");
782
+ lightButton.addActionListener(this);
783
+
784
+ for (int i=6; --i>=0;)
785
+ {
786
+ oe.toolboxPanel.Return();
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
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
+ }
795
+
796
+ // EDIT panel
797
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
798
+ editButton.setToolTipText("Pin selection controls");
562799 editButton.addActionListener(this);
563800
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
566803 uneditButton.addActionListener(this);
567804
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
805
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
806
+ allParamsButton.setToolTipText("Show all controle");
570807 allParamsButton.addActionListener(this);
571808
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573810 clearPanelButton.setToolTipText("Clear edit panel");
574811 clearPanelButton.addActionListener(this);
575812
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577814 unselectButton.setToolTipText("Unselect");
578815 unselectButton.addActionListener(this);
579816
580
- commandsPanel.preferredHeight = 1;
817
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
818
+ flashSelectionButton.setToolTipText("Highlight selection");
819
+ flashSelectionButton.addActionListener(this);
581820
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
821
+ editCommandsPanel.preferredHeight = 1;
822
+
823
+ SetPinStates(false);
824
+// oe.treePanel.add(commandsPanel);
825
+// oe.treePanel.Return();
584826
585827 // oe.aConstraints.gridx += 1;
586828 // oe.aConstraints.weighty = 0;
....@@ -597,29 +839,17 @@
597839
598840 JScrollPane jSP;
599841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
601843 ResetModel();
602844
603845 oe.treePanel.add(jSPPanel);
604846 oe.treePanel.Return();
605847
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;
621848 oe.treePanel.add(copyOptionsPanel);
622849 oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
623853
624854 // mainPanel.setDividerLocation(0.5); //1.0);
625855 // mainPanel.setResizeWeight(0.5);
....@@ -642,29 +872,49 @@
642872 dgr.addDragGestureListener(this);
643873 }catch(Exception e) {}
644874 */
645
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
646876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
647877 }
648878
649879 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
650880 {
881
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
882
+ colorCB.setToolTipText("Copy color when dropped");
883
+ colorCB.addItemListener(this);
884
+
885
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
886
+ materialCB.setToolTipText("Copy material when dropped");
887
+ materialCB.addItemListener(this);
888
+
889
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
890
+ textureCB.setToolTipText("Copy texture when dropped");
891
+ textureCB.addItemListener(this);
892
+
893
+ panel.Return();
894
+
651895 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
652896 boxCB.setToolTipText("Display bounding boxes");
653897 boxCB.addItemListener(this);
654898
655899 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
657901 zoomBoxCB.addItemListener(this);
658902
659903 if (true) // Globals.ADVANCED)
660904 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- supportCB.addItemListener(this);
905
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
906
+// supportCB.setToolTipText("Enable rigging");
907
+// supportCB.addItemListener(this);
908
+
909
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
910
+ freezeCB.setToolTipText("Fast moving camera");
911
+ freezeCB.addItemListener(this);
664912
665913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
666914 // localCB.addItemListener(this);
667915
916
+ panel.Return();
917
+
668918 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
669919 crowdCB.setToolTipText("Used for crowds");
670920 crowdCB.addItemListener(this);
....@@ -681,6 +931,8 @@
681931 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
682932 // speakerMocapCB.addItemListener(this);
683933
934
+ panel.Return();
935
+
684936 if (false)
685937 {
686938 // handled in scripts
....@@ -695,42 +947,85 @@
695947 //constraints.gridy += 1;
696948 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
697949 smoothfocusCB.addItemListener(this);
950
+ panel.Return();
698951 }
699952
700953 //constraints.gridx += 1;
701954 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
702955 // debugCB.addItemListener(this);
703956
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
704961 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
962
+ oeilCB.setToolTipText("Move camera when tracking");
705963 oeilCB.addItemListener(this);
706964
965
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
966
+ shadowCB.setToolTipText("When live compute shadows");
967
+ shadowCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
971
+ toggleTextureCB.setToolTipText("Load textures");
972
+ toggleTextureCB.addItemListener(this);
973
+
974
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
975
+ toggleSwitchCB.setToolTipText("Choose a single item");
976
+ toggleSwitchCB.addItemListener(this);
977
+
978
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
979
+ autokeepCB.setToolTipText("On structure change");
980
+ autokeepCB.addItemListener(this);
981
+
982
+ panel.Return();
983
+ if (Globals.ADVANCED)
984
+ {
707985 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708986 lookAtCB.setToolTipText("Look-at target");
709987 lookAtCB.addItemListener(this);
988
+ }
710989
711990 }
712991
713992 cGridBag fill = new cGridBag();
714
-
715993 fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
716998
717999 panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
7181002
7191003 }
7201004
7211005 void EditObject(Object3D obj)
7221006 {
7231007 cRadio radioButton = new cRadio(obj.name);
1008
+
1009
+ // June 2019. Patch to avoid bug with transparency.
1010
+ radioButton.hadMaterial = obj.material != null;
1011
+ if (!radioButton.hadMaterial)
1012
+ {
1013
+ obj.material = new cMaterial();
1014
+ }
1015
+
7241016 radioButton.SetObject(obj);
725
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
7261018 radioButton.SetCamera(cameraView.renderCamera, false);
7271019 radioButton.addActionListener(this);
7281020 radioPanel.add(radioButton);
7291021 buttonGroup.add(radioButton);
7301022 radioButton.doClick();
7311023 }
1024
+
7321025 void SetupViews(ObjEditor oe)
7331026 {
1027
+ theFrame = this;
1028
+
7341029 oe.SetupViews();
7351030
7361031 System.out.println("SetupViews");
....@@ -739,23 +1034,28 @@
7391034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7401035 }
7411036
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;
1037
+ cToggleButton liveCB;
1038
+ cCheckBox supportCB;
1039
+ cCheckBox localCB;
1040
+ cCheckBox crowdCB;
1041
+ cCheckBox smoothCB;
1042
+ cToggleButton fastCB;
1043
+ cCheckBox slowCB;
1044
+ cCheckBox boxCB;
1045
+ cCheckBox zoomBoxCB;
1046
+ cCheckBox freezeCB;
1047
+ //cToggleButton trackCB;
1048
+ cCheckBox trackCB;
1049
+ cCheckBox smoothfocusCB;
7531050 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
7591059
7601060 // static int COLOR = 1;
7611061 // static int MATERIAL = 2;
....@@ -763,9 +1063,9 @@
7631063
7641064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7651065
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
7691069
7701070 public void itemStateChanged(ItemEvent e)
7711071 {
....@@ -793,6 +1093,7 @@
7931093 } else if(e.getSource() == liveCB)
7941094 {
7951095 cameraView.ToggleLive();
1096
+ refreshContents(false);
7961097 }
7971098 else if(e.getSource() == supportCB)
7981099 {
....@@ -857,6 +1158,18 @@
8571158 {
8581159 cameraView.ToggleOeil();
8591160 }
1161
+ else if(e.getSource() == shadowCB)
1162
+ {
1163
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1164
+ }
1165
+ else if(e.getSource() == freezeCB)
1166
+ {
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
1172
+ }
8601173 else if(e.getSource() == lookAtCB)
8611174 {
8621175 cameraView.ToggleLookAt();
....@@ -873,7 +1186,8 @@
8731186
8741187 /**/
8751188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
876
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
8771191 if ((path == null) || (path.getPathCount() <= 1)) {
8781192 // We can't move the root node or an empty selection
8791193 return;
....@@ -936,8 +1250,6 @@
9361250 }
9371251 }
9381252
939
- String string = (String) object;
940
-
9411253 System.out.println("Transfer = " + object + "; drop : " + target);
9421254 // if( object instanceof java.io.File[])
9431255 // {
....@@ -945,6 +1257,8 @@
9451257 // objEditor.DropFile((java.io.File[]) object, true);
9461258 // return;
9471259 // }
1260
+
1261
+ String string = object.toString();
9481262
9491263 // File path for Mac and Windows
9501264 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -990,23 +1304,33 @@
9901304
9911305 assert target == objEditor.jTree;
9921306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
9931308 try {
994
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9951310 } catch (Exception e) {
9961311 System.out.println("destinationPath : " + destinationPath);
9971312 return;
9981313 }
9991314
1000
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
10011316 {
1317
+ Object3D child = (Object3D)group.selection.elementAt(i);
1318
+
1319
+ // Cannot move into itself
1320
+ if (child == destinationLeaf)
1321
+ return;
1322
+ }
1323
+
1324
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1325
+// {
10021326 loadClipboard(true);
10031327 objEditor.jTree.setSelectionPath(destinationPath);
10041328 pasteInto(false, false);
1005
- } else {
1006
- loadClipboard(false);
1007
- objEditor.jTree.setSelectionPath(destinationPath);
1008
- pasteInto(false, false); // true); // ???
1009
- }
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
10101334 }
10111335 public void dropActionChanged(DropTargetDragEvent dtde)
10121336 // Called if the user has modified the current drop gesture
....@@ -1111,22 +1435,30 @@
11111435 {
11121436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11131437 //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);
1438
+// gridItem = menu.add(new MenuItem("Grid"));
1439
+// gridItem.addActionListener(this);
1440
+// rectoidItem = menu.add(new MenuItem("Box"));
1441
+// rectoidItem.addActionListener(this);
1442
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1443
+// ellipsoidItem.addActionListener(this);
1444
+// coneItem = menu.add(new MenuItem("Cone"));
1445
+// coneItem.addActionListener(this);
1446
+// torusItem = menu.add(new MenuItem("Torus"));
1447
+// torusItem.addActionListener(this);
1448
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1449
+// superItem.addActionListener(this);
1450
+
1451
+ cameraItem = menu.add(new MenuItem("Camera"));
1452
+ cameraItem.addActionListener(this);
1453
+
1454
+ if (!Globals.ADVANCED)
1455
+ {
11261456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11271457 kleinItem.addActionListener(this);
1128
- particleItem = menu.add(new MenuItem("Particle system"));
1129
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
11301462 if (Globals.ADVANCED)
11311463 {
11321464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1152,15 +1484,15 @@
11521484 }
11531485 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11541486 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);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
11591491 menu.add("-");
11601492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11611493 //superLoopItem.addActionListener(this);
1162
- loopItem = menu.add(new MenuItem("Loop"));
1163
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
11641496 doubleItem = menu.add(new MenuItem("Fork"));
11651497 doubleItem.addActionListener(this);
11661498 if (Globals.ADVANCED)
....@@ -1176,6 +1508,9 @@
11761508 animationItem.addItemListener(this);
11771509 animationItem.setState(Globals.ANIMATION);
11781510
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
1513
+
11791514 menu.add("-");
11801515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11811516 parseverticesItem.addActionListener(this);
....@@ -1188,6 +1523,8 @@
11881523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11891524 reduce34MorphItem.addActionListener(this);
11901525 menu.add("-");
1526
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1527
+ memoryItem.addActionListener(this);
11911528 menu.add(computeAOItem = new MenuItem("Compute AO"));
11921529 computeAOItem.addActionListener(this);
11931530
....@@ -1196,11 +1533,9 @@
11961533 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11971534 mirrorItem.addActionListener(this);
11981535 menu.add("-");
1199
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1200
- memoryItem.addActionListener(this);
12011536 menu.add(analyzeItem = new MenuItem("Analyze"));
12021537 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1538
+ menu.add(dumpItem = new MenuItem("Print"));
12041539 dumpItem.addActionListener(this);
12051540 // menu.add(pathItem = new MenuItem("From-to path"));
12061541 // pathItem.addActionListener(this);
....@@ -1341,9 +1676,34 @@
13411676 shadow.material = new cMaterial(obj.material);
13421677 shadow.material.diffuse = 0.0001f;
13431678 shadow.material.specular = 0.0001f;
1679
+ //shadow.projectedVertices[1].x = 300;
13441680
13451681 makeSomething(shadow);
13461682 }
1683
+
1684
+ private void ClearUnpinned()
1685
+ {
1686
+ //for (Object3D obj : listUI)
1687
+ for (int i=listUI.size(); --i>=0;)
1688
+ {
1689
+ Object3D obj = listUI.elementAt(i);
1690
+ if (!obj.pinned)
1691
+ {
1692
+ obj.CloseUI();
1693
+ listUI.remove(i);
1694
+ }
1695
+ }
1696
+ }
1697
+
1698
+ private void EditElement(Object3D elem, boolean newWindow)
1699
+ {
1700
+ // if (!(elem instanceof Composite))
1701
+ // newWindow = false;
1702
+ listUI.add(elem);
1703
+ elem.openEditWindow(this, newWindow); //, false);
1704
+ System.out.println("edit : " + elem);
1705
+ elem.editWindow.refreshContents(true); // ? new
1706
+ }
13471707
13481708 /**
13491709 * applyExample
....@@ -1588,7 +1948,7 @@
15881948 {
15891949 ScreenFit();
15901950 } else
1591
- if (source == switchItem)
1951
+ if (source == switchViewItem)
15921952 {
15931953 cVector v1 = new cVector();
15941954 cVector v2 = new cVector();
....@@ -1597,11 +1957,11 @@
15971957 objEditor.cameraView.renderCamera.setAim(v2, v1);
15981958 objEditor.cameraView.repaint();
15991959 } else
1600
- if (source == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
16011961 {
16021962 makeSomething(new Box());
16031963 } else
1604
- if (source == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
16051965 {
16061966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16071967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1680,27 +2040,27 @@
16802040
16812041 makeSomething(obj);
16822042 } else
1683
- if (source == gridItem)
2043
+ if (source == gridItem || source == gridButton)
16842044 {
16852045 makeSomething(new Grid());
16862046 } else
1687
- if (source == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
16882048 {
16892049 makeSomething(new Sphere());
16902050 } else
1691
- if (source == coneItem)
2051
+ if (source == coneItem || source == coneButton)
16922052 {
16932053 makeSomething(new Cone());
16942054 } else
1695
- if (source == torusItem)
2055
+ if (source == torusItem || source == torusButton)
16962056 {
16972057 makeSomething(new Torus());
16982058 } else
1699
- if (source == superItem)
2059
+ if (source == superItem || source == superButton)
17002060 {
17012061 makeSomething(new Superellipsoid());
17022062 } else
1703
- if (source == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
17042064 {
17052065 makeSomething(new Klein());
17062066 } else
....@@ -1720,7 +2080,7 @@
17202080 {
17212081 makeSomething(new BezierSurface());
17222082 } else
1723
- if (source == overlayItem)
2083
+ if (source == overlayItem || source == overlayButton)
17242084 {
17252085 /*
17262086 Object3D obj = new BezierSurface(5,8);
....@@ -1768,7 +2128,7 @@
17682128 s.setup();
17692129 makeSomething(s);
17702130 } else
1771
- if (source == lightItem)
2131
+ if (source == lightItem || source == lightButton)
17722132 {
17732133 makeSomething(new Light());
17742134 } else
....@@ -1818,30 +2178,30 @@
18182178
18192179 group(g);
18202180 } else
1821
- if (source == loopItem)
2181
+ if (source == loopItem || source == loopButton)
18222182 {
18232183 Composite csg = new GroupLeaf();
18242184 csg.count = 5;
18252185 group(csg);
1826
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
18272187 csg.addChild(child);
18282188 child.addChild(csg);
18292189 } else
18302190 if (source == doubleItem)
18312191 {
1832
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
18332193 csg.count = 5;
18342194 group(csg);
1835
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
18362196 csg.addChild(child);
18372197 child.addChild(csg);
1838
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
18392199 csg.addChild(child);
18402200 child.addChild(csg);
18412201 } else
18422202 if (source == tripleItem)
18432203 {
1844
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
18452205 csg.count = 4;
18462206 group(csg);
18472207 Composite child = new cGroup();
....@@ -1853,31 +2213,6 @@
18532213 child = new cGroup();
18542214 csg.addChild(child);
18552215 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
- }
18812216 } else
18822217 if (source == computeAOItem)
18832218 {
....@@ -1916,6 +2251,46 @@
19162251 {
19172252 DumpObject();
19182253 } else
2254
+ if (source == minButton)
2255
+ {
2256
+ Minimize();
2257
+ } else
2258
+ if (source == maxButton)
2259
+ {
2260
+ Maximize();
2261
+ } else
2262
+ if (source == fullButton)
2263
+ {
2264
+ ToggleFullScreen();
2265
+ } else
2266
+ if (source == undoButton)
2267
+ {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2271
+ Undo();
2272
+ } else
2273
+ if (source == restoreButton)
2274
+ {
2275
+ // Restore current version
2276
+ Restore();
2277
+ } else
2278
+ if (source == replaceButton)
2279
+ {
2280
+ // Overwrite current version
2281
+ Replace();
2282
+ } else
2283
+ if (source == redoButton)
2284
+ {
2285
+ // Go to next version
2286
+ Redo();
2287
+ } else
2288
+ if (source == saveButton)
2289
+ {
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
2293
+ } else
19192294 if (source == oneStepButton)
19202295 {
19212296 Globals.ONESTEP = true;
....@@ -1923,17 +2298,14 @@
19232298 } else
19242299 if (source == screenfitButton)
19252300 {
1926
- //Reload(lastConverter, lastFilename, true);
19272301 ScreenFit();
19282302 } else
19292303 if (source == screenfitpointButton)
19302304 {
1931
- //Reload(lastConverter, lastFilename, true);
19322305 ScreenFitPoint();
19332306 } else
19342307 if (source == snapobjectButton)
19352308 {
1936
- //Reload(lastConverter, lastFilename, true);
19372309 SnapObject();
19382310 } else
19392311 // if (event.getSource() == recompileButton)
....@@ -1969,6 +2341,14 @@
19692341 if (source == cutItem || source == clearButton)
19702342 {
19712343 loadClipboard(true);
2344
+ } else
2345
+ if (source == undoItem)
2346
+ {
2347
+ Undo();
2348
+ } else
2349
+ if (source == redoItem)
2350
+ {
2351
+ Redo();
19722352 } else
19732353 if (source == duplicateItem)
19742354 {
....@@ -2289,7 +2669,7 @@
22892669 {
22902670 StepAll();
22912671 } else
2292
- if (source == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
22932673 {
22942674 //int indices[] = jList.getSelectedIndices();
22952675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2301,9 +2681,9 @@
23012681 {
23022682 ClearSelection(true);
23032683 } else
2304
- if (source == grabItem)
2684
+ if (source == grabItem || source == groupButton)
23052685 {
2306
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
23072687 } else
23082688 if (source == hideItem)
23092689 {
....@@ -2321,11 +2701,11 @@
23212701 {
23222702 makeSomething(new Camera());
23232703 } else
2324
- if (source == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
23252705 {
23262706 group(new Composite());
23272707 } else
2328
- if (source == randomItem)
2708
+ if (source == switchItem || source == switchButton)
23292709 {
23302710 RandomNode random = new RandomNode();
23312711 group(random);
....@@ -2427,7 +2807,7 @@
24272807 {
24282808 group(new cLinker());
24292809 } else
2430
- if (source == textureItem)
2810
+ if (source == textureItem || source == textureButton)
24312811 {
24322812 group(new TextureNode());
24332813 } else
....@@ -2447,17 +2827,30 @@
24472827 {
24482828 CastShadow(2);
24492829 } else
2450
- if (source == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
24512831 {
2452
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
24532834 for (int i=0; i<group.selection.size(); i++)
24542835 {
2455
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
24562841 }
24572842
2458
- ClearSelection(false);
2459
-
2460
- refreshContents();
2843
+ if (!hasRoot)
2844
+ {
2845
+ for (int i=0; i<group.selection.size(); i++)
2846
+ {
2847
+ Ungroup(group.selection.get(i));
2848
+ }
2849
+
2850
+ ClearSelection(false);
2851
+
2852
+ refreshContents();
2853
+ }
24612854 } else
24622855 if (source == genUVItem)
24632856 {
....@@ -2469,7 +2862,7 @@
24692862 } else
24702863 if (source == genNormalsMESHItem)
24712864 {
2472
- GenNormals(true); // TODO
2865
+ GenNormalsMESH();
24732866 } else
24742867 if (source == genNormalsORGANItem)
24752868 {
....@@ -2534,6 +2927,22 @@
25342927 if (source == unmarkleavesItem)
25352928 {
25362929 MarkLeaves(false);
2930
+ } else
2931
+ if (source == rewindleavesItem)
2932
+ {
2933
+ RewindLeaves(true);
2934
+ } else
2935
+ if (source == unrewindleavesItem)
2936
+ {
2937
+ RewindLeaves(false);
2938
+ } else
2939
+ if (source == randomleavesItem)
2940
+ {
2941
+ RandomLeaves(true);
2942
+ } else
2943
+ if (source == unrandomleavesItem)
2944
+ {
2945
+ RandomLeaves(false);
25372946 } else
25382947 if (source == flipVItem)
25392948 {
....@@ -2769,6 +3178,10 @@
27693178 if (source == twoButton)
27703179 {
27713180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
27723185 // bug
27733186 //gridPanel.setDividerLocation(1.0);
27743187 //bigPanel.setDividerLocation(0.0);
....@@ -2801,10 +3214,31 @@
28013214 bigThree.ClearUI();
28023215 bigThree.add(centralPanel);
28033216 bigThree.FlushUI();
3217
+
3218
+ cameraView.requestFocusInWindow();
3219
+
3220
+// refreshContents(true);
3221
+//
3222
+// try
3223
+// {
3224
+// java.awt.Robot bot = new java.awt.Robot();
3225
+// int mask = InputEvent.BUTTON1_MASK;
3226
+// bot.mouseMove(100, 100);
3227
+// bot.mousePress(mask);
3228
+// bot.mouseRelease(mask);
3229
+// }
3230
+// catch (Exception e)
3231
+// {
3232
+//
3233
+// }
3234
+
28043235 } else
28053236 if (source == threeButton)
28063237 {
28073238 radio.layout = threeButton;
3239
+
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
28083242
28093243 // bigThree.remove(scenePanel);
28103244 // bigThree.remove(centralPanel);
....@@ -2837,10 +3271,15 @@
28373271 bigThree.add(centralPanel);
28383272 bigThree.add(XYZPanel);
28393273 bigThree.FlushUI();
3274
+
3275
+ cameraView.requestFocusInWindow();
28403276 } else
28413277 if (source == fourButton)
28423278 {
28433279 radio.layout = fourButton;
3280
+
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
28443283
28453284 // bigThree.remove(scenePanel);
28463285 // bigThree.remove(centralPanel);
....@@ -2872,10 +3311,15 @@
28723311 bigThree.ClearUI();
28733312 bigThree.add(scenePanel);
28743313 bigThree.FlushUI();
3314
+
3315
+ cameraView.requestFocusInWindow();
28753316 } else
28763317 if (source == sixButton)
28773318 {
28783319 radio.layout = sixButton;
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
28793323
28803324 // bigThree.remove(scenePanel);
28813325 // bigThree.remove(centralPanel);
....@@ -2908,10 +3352,15 @@
29083352 bigThree.add(scenePanel);
29093353 bigThree.add(centralPanel);
29103354 bigThree.FlushUI();
3355
+
3356
+ cameraView.requestFocusInWindow();
29113357 } else
29123358 if (source == sevenButton)
29133359 {
29143360 radio.layout = sevenButton;
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
29153364
29163365 // bigThree.remove(scenePanel);
29173366 // bigThree.remove(centralPanel);
....@@ -2945,6 +3394,8 @@
29453394 bigThree.add(centralPanel);
29463395 bigThree.add(XYZPanel);
29473396 bigThree.FlushUI();
3397
+
3398
+ cameraView.requestFocusInWindow();
29483399 } else
29493400 if (source == rootButton)
29503401 {
....@@ -2956,6 +3407,7 @@
29563407 EditObject(obj);
29573408 }
29583409
3410
+ cameraView.requestFocusInWindow();
29593411 refreshContents(true);
29603412 } else
29613413 if (source == closeButton)
....@@ -2965,22 +3417,37 @@
29653417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663418 {
29673419 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
29703428 buttonGroup.remove(ab);
29713429 radioPanel.remove(ab);
29723430
2973
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
29743433 // ab.GetObject().objectUI = null; // ?????????
29753434
29763435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773436 break;
29783437 }
29793438 }
3439
+
3440
+ cameraView.requestFocusInWindow();
29803441 refreshContents(true);
29813442 } else
29823443 if (source == editItem || source == editButton)
29833444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
29843451 EditSelection(false);
29853452 } else
29863453 if (source == uneditButton)
....@@ -2990,10 +3457,11 @@
29903457 Object3D child = (Object3D)e.nextElement();
29913458 if(child.editWindow != null)
29923459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
29933461 child.CloseUI();
29943462 listUI.remove(child);
29953463
2996
- child.editWindow = null; // ???????????
3464
+ //child.editWindow = null; // ???????????
29973465 }
29983466 objEditor.ctrlPanel.FlushUI();
29993467 //objEditor.jTree.clearSelection();
....@@ -3006,6 +3474,7 @@
30063474 //copy.ClearUI();
30073475 for (Object3D obj : listUI)
30083476 {
3477
+ obj.pinned = false;
30093478 obj.CloseUI();
30103479 }
30113480 listUI.clear();
....@@ -3015,7 +3484,7 @@
30153484 {
30163485 assert(copy == group);
30173486
3018
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30193488
30203489 for (Object3D obj : listUI)
30213490 {
....@@ -3064,6 +3533,9 @@
30643533 }
30653534
30663535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
30673539 //Globals.theRenderer.object = group;
30683540 if(!useclient)
30693541 {
....@@ -3079,20 +3551,46 @@
30793551 frontView.object = group;
30803552 sideView.object = group;
30813553 }
3082
- group.editWindow = this;
3554
+
3555
+// fix "+" issue
3556
+ //group.editWindow = this;
3557
+ group.manipWindow = this;
3558
+
30833559 /*
30843560 currentLayout = radio.layout;
30853561 if (currentLayout == null)
30863562 currentLayout = sevenButton;
30873563 */
30883564 radio.layout.doClick();
3565
+
3566
+ ClearUnpinned();
3567
+ //Grafreed.Assert(group != null);
3568
+ //Grafreed.Assert(group.selection != null);
3569
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3570
+ if (group.selection == null || group.selection.size() == 1)
3571
+ EditSelection(false);
30893572 keepparent = group.parent;
30903573 // PARENT = NULL or not???
30913574 //group.parent = null; // ROOT
30923575 //group.attributes = -1;
30933576 ResetModel();
3577
+
3578
+ cameraView.requestFocusInWindow();
30943579 refreshContents(true);
3095
- }
3580
+ } else if (event.getSource() == editCameraItem)
3581
+ {
3582
+ cameraView.ProtectCamera();
3583
+ cameraView.repaint();
3584
+ return;
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3586
+ {
3587
+ cameraView.RevertCamera();
3588
+ cameraView.repaint();
3589
+ return;
3590
+ // } else if (event.getSource() == textureButton)
3591
+ // {
3592
+ // return; // true;
3593
+ }
30963594 else
30973595 {
30983596 //return super.action(event, arg);
....@@ -3101,7 +3599,6 @@
31013599 }
31023600
31033601 boolean useclient = false;
3104
- cRadio radio;
31053602
31063603 void ToggleRoot()
31073604 {
....@@ -3340,7 +3837,8 @@
33403837
33413838 int size = obj.MemorySize();
33423839
3343
- System.err.println((size/1024) + " KB is the size of " + obj);
3840
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3841
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33443842 }
33453843 }
33463844 catch (Exception e)
....@@ -3421,6 +3919,13 @@
34213919 void GenNormals(boolean crease)
34223920 {
34233921 group.GenNormalsS(crease);
3922
+
3923
+ refreshContents();
3924
+ }
3925
+
3926
+ void GenNormalsMESH()
3927
+ {
3928
+ group.GenNormalsMeshS();
34243929
34253930 refreshContents();
34263931 }
....@@ -4048,6 +4553,18 @@
40484553 refreshContents();
40494554 }
40504555
4556
+ void RewindLeaves(boolean hide)
4557
+ {
4558
+ group.selection.RewindLeaves(hide);
4559
+ refreshContents();
4560
+ }
4561
+
4562
+ void RandomLeaves(boolean hide)
4563
+ {
4564
+ group.selection.RandomLeaves(hide);
4565
+ refreshContents();
4566
+ }
4567
+
40514568 void SetTexRes(int tr)
40524569 {
40534570 group.selection.SetTexRes(tr);
....@@ -4119,28 +4636,25 @@
41194636 // }
41204637 // }
41214638
4122
- static boolean allparams = true;
4123
-
4124
- static Vector<Object3D> listUI = new Vector<Object3D>();
4125
-
41264639 void EditSelection(boolean newWindow)
41274640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
41284647 // aConstraints.gridy = 0;
41294648 for (int i=0; i<group.selection.size(); i++)
41304649 {
41314650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41324651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4133
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41344653
41354654 Object3D elem = (Object3D)group.selection.elementAt(i);
4136
- if(elem != group)
4655
+ if(elem != group || !newWindow)
41374656 {
4138
- // if (!(elem instanceof Composite))
4139
- // newWindow = false;
4140
- listUI.add(elem);
4141
- elem.openEditWindow(this, newWindow); //, false);
4142
- System.out.println("edit : " + elem);
4143
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
41444658 }
41454659 }
41464660 }
....@@ -4215,7 +4729,8 @@
42154729 //new Exception().printStackTrace();
42164730
42174731 freezemodel = true;
4218
-
4732
+ ClearUnpinned();
4733
+
42194734 /**/
42204735 //switch (event.id)
42214736 {
....@@ -4223,7 +4738,6 @@
42234738 //case 702: // Event.LIST_DESELECT
42244739 group.deselectAll();
42254740 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4226
- objEditor.ClearInfo(); // .GetMaterial());
42274741 if (tps != null)
42284742 {
42294743 for (int i=0; i < tps.length; i++)
....@@ -4232,10 +4746,8 @@
42324746
42334747 //if (child.parent != null)
42344748 //child.parent.addSelectee(child);
4749
+ objEditor.SetMaterial(child);
42354750 group.addSelectee(child);
4236
- objEditor.SetMaterial(child); // .GetMaterial());
4237
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4238
- System.err.println("info : " + child.GetPath());
42394751 }
42404752 }
42414753 // else
....@@ -4245,20 +4757,28 @@
42454757 // System.err.println("info : " + group.GetPath());
42464758 // }
42474759
4248
- objEditor.SetText(); // jan 2014
4249
-
4250
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4760
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42514761 CameraPane.flash = true;
42524762
4253
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4763
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42544764 // a camera
42554765 {
4256
- CameraPane.camerachangeframe = 0; // don't refuse it
4257
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4767
+ {
4768
+ CameraPane.camerachangeframe = 0; // don't refuse it
4769
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4770
+ }
42584771 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42594772 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42604773 }
42614774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
42624782 refreshContents();
42634783 //return true;
42644784 }
....@@ -4267,6 +4787,35 @@
42674787
42684788 freezemodel = false;
42694789 }
4790
+
4791
+ void SetPinStates(boolean enabled)
4792
+ {
4793
+ editButton.setEnabled(enabled);
4794
+ uneditButton.setEnabled(enabled);
4795
+ unselectButton.setEnabled(enabled);
4796
+ flashSelectionButton.setEnabled(enabled);
4797
+ }
4798
+
4799
+ void refreshContents(boolean cp)
4800
+ {
4801
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4803
+ {
4804
+ objEditor.ClearInfo(); // .GetMaterial());
4805
+
4806
+ for (int i=0; i < group.selection.Size(); i++)
4807
+ {
4808
+ Object3D child = (Object3D) group.selection.get(i);
4809
+
4810
+ objEditor.AddInfo(child, this, true);
4811
+ System.err.println("info : " + child.GetPath());
4812
+ }
4813
+
4814
+ objEditor.SetText(); // jan 2014
4815
+ }
4816
+
4817
+ super.refreshContents(cp);
4818
+ }
42704819
42714820 void linkSomething(Object3D thing)
42724821 {
....@@ -4338,6 +4887,7 @@
43384887 {
43394888 if (group.selection.isEmpty())
43404889 return;
4890
+
43414891 Grafreed.clipboardIsTempGroup = false;
43424892 Composite tGroup = null;
43434893 if (group.selection.size() > 0) // 1)
....@@ -4348,6 +4898,8 @@
43484898
43494899 if (cut)
43504900 {
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
43514903 //int indices[] = jList.getSelectedIndices();
43524904 //for (int i = indices.length - 1; i >= 0; i--)
43534905 //jList.remove(indices[i]);
....@@ -4437,8 +4989,10 @@
44374989 }
44384990
44394991 }
4992
+
44404993 if (Grafreed.clipboardIsTempGroup)
44414994 Grafreed.clipboard = tGroup;
4995
+
44424996 if (cut)
44434997 {
44444998 ResetModel();
....@@ -4448,6 +5002,10 @@
44485002
44495003 void paste(boolean expand)
44505004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
44515009 // if (GrafreeD.clipboard == null)
44525010 // return;
44535011 boolean first = true;
....@@ -4507,6 +5065,7 @@
45075065 Grafreed.clipboard.get(0).parent = keepparent;
45085066 }
45095067
5068
+ Globals.REPLACEONMAKE = keep;
45105069 ResetModel();
45115070 refreshContents();
45125071 }
....@@ -4642,6 +5201,10 @@
46425201
46435202 void group(Object3D csg, boolean grab)
46445203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
46455208 if (//false) // why??
46465209 !group.selection.isEmpty())
46475210 {
....@@ -4755,10 +5318,15 @@
47555318 //node.add(csg);
47565319 //makeSomething(node);
47575320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
47585322 }
47595323
47605324 void Ungroup(Object3D g)
47615325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
47625330 if (g instanceof HiddenObject)
47635331 {
47645332 HiddenObject h = (HiddenObject) g;
....@@ -4775,6 +5343,7 @@
47755343 objEditor.makeSomething(g.get(i), false);
47765344 }
47775345 }
5346
+ Globals.REPLACEONMAKE = keep;
47785347 }
47795348
47805349 void ungroup()
....@@ -4970,21 +5539,6 @@
49705539 }
49715540 */
49725541
4973
- void ImportGFD()
4974
- {
4975
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4976
- browser.show();
4977
- String filename = browser.getFile();
4978
- if (filename != null && filename.length() > 0)
4979
- {
4980
- String fullname = browser.getDirectory() + filename;
4981
-
4982
- //Object3D readobj =
4983
- objEditor.ReadGFD(fullname, objEditor);
4984
- //makeSomething(readobj);
4985
- }
4986
- }
4987
-
49885542 /*
49895543 public void Callback(Object obj)
49905544 {
....@@ -5008,23 +5562,6 @@
50085562 }
50095563 */
50105564
5011
- void ImportVRMLX3D()
5012
- {
5013
- if (Grafreed.standAlone)
5014
- {
5015
- /**/
5016
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5017
- browser.show();
5018
- String filename = browser.getFile();
5019
- if (filename != null && filename.length() > 0)
5020
- {
5021
- String fullname = browser.getDirectory() + filename;
5022
- LoadVRMLX3D(fullname);
5023
- }
5024
- /**/
5025
- }
5026
- }
5027
-
50285565 String GetFile(String dialogName)
50295566 {
50305567 if (Grafreed.standAlone)
....@@ -5095,7 +5632,28 @@
50955632 cButton clearpanelButton;
50965633 cButton unselectButton;
50975634
5635
+ cButton restoreCameraButton;
5636
+
5637
+ cButton saveButton;
50985638 cButton oneStepButton;
5639
+
5640
+ cButton groupButton;
5641
+ cButton ungroupButton;
5642
+ cButton compositeButton;
5643
+ cButton switchButton;
5644
+ cButton loopButton;
5645
+ cButton textureButton;
5646
+
5647
+ cButton gridButton;
5648
+ cButton boxButton;
5649
+ cButton sphereButton;
5650
+ cButton coneButton;
5651
+ cButton torusButton;
5652
+ cButton superButton;
5653
+ cButton kleinButton;
5654
+ cButton particlesButton;
5655
+ cButton overlayButton;
5656
+ cButton lightButton;
50995657
51005658 cButton screenfitButton;
51015659 cButton screenfitpointButton;
....@@ -5108,14 +5666,6 @@
51085666
51095667 cButton setsupportButton;
51105668
5111
- cButton twoButton;
5112
- cButton sixButton;
5113
- cButton threeButton;
5114
- cButton sevenButton;
5115
- cButton fourButton; // full panel
5116
- cButton oneButton; // full XYZ
5117
- //cButton currentLayout;
5118
-
51195669 //
51205670 //Composite
51215671 Object3D // to do !!
....@@ -5125,9 +5675,11 @@
51255675 //JTree jTree;
51265676 private MenuItem lookAtItem;
51275677 private MenuItem lookFromItem;
5128
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
51295679 private MenuItem cutItem;
5130
- private MenuItem duplicateItem;
5680
+ private MenuItem undoItem;
5681
+ private MenuItem redoItem;
5682
+ private JMenuItem duplicateItem;
51315683 private MenuItem cloneItem;
51325684 private MenuItem cloneSupportItem;
51335685 private MenuItem overwriteGeoItem;
....@@ -5155,7 +5707,7 @@
51555707 private MenuItem pasteLinkItem;
51565708 private MenuItem pasteCloneItem;
51575709 private MenuItem pasteExpandItem;
5158
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
51595711 private MenuItem clearAllItem;
51605712 private MenuItem genUVItem;
51615713 private MenuItem genNormalsMESHItem;
....@@ -5190,6 +5742,10 @@
51905742 private MenuItem showleavesItem;
51915743 private MenuItem markleavesItem;
51925744 private MenuItem unmarkleavesItem;
5745
+ private MenuItem rewindleavesItem;
5746
+ private MenuItem unrewindleavesItem;
5747
+ private MenuItem randomleavesItem;
5748
+ private MenuItem unrandomleavesItem;
51935749
51945750 private MenuItem flipVItem;
51955751 private MenuItem unflipVItem;
....@@ -5211,7 +5767,7 @@
52115767 private MenuItem frontItem;
52125768 private MenuItem cameraItem;
52135769 private MenuItem compositeItem;
5214
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
52155771 private MenuItem physicsItem;
52165772 private MenuItem frameselectorItem;
52175773 private MenuItem scriptNodeItem;
....@@ -5273,11 +5829,6 @@
52735829 private MenuItem doubleItem;
52745830 private MenuItem tripleItem;
52755831
5276
- private MenuItem importGFDItem;
5277
- private MenuItem importVRMLX3DItem;
5278
- private MenuItem import3DSItem;
5279
- private MenuItem importOBJItem;
5280
-
52815832 private MenuItem computeAOItem;
52825833 private MenuItem recompileItem;
52835834 private MenuItem editScriptItem;
....@@ -5287,4 +5838,8 @@
52875838 private MenuItem analyzeItem;
52885839 private MenuItem dumpItem;
52895840 //boolean freezemodel = false;
5841
+
5842
+ Menu cameraMenu;
5843
+ MenuItem editCameraItem;
5844
+ MenuItem restoreCameraItem;
52905845 }