Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.REPLACEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.REPLACEONMAKE;
90
+ Globals.REPLACEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +98,19 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.REPLACEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
100105 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
106
+ assert(Grafreed.clipboard.parent == null);
107
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
108
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
109
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
110
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106111 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
112
+ makeSomething(CloneObject(Grafreed.clipboard, false));
113
+ Grafreed.clipboard.get(0).parent = keepparent;
109114 }
110115
111116 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +124,7 @@
119124 // obj.support = null;
120125 if (!supports)
121126 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
127
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123128 obj.parent = parent;
124129 // obj.support = support;
125130 // clone.support = support; // aout 2013
....@@ -148,28 +153,21 @@
148153
149154 //JTextField nameField;
150155
151
- void SetupMenu2(ObjEditor oe)
156
+ void SetupMenu2(GroupEditor oe)
152157 {
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
-
158
+ oe.jTree = new cTree();
159
+
168160 Menu menu;
169161 oe.menuBar.add(menu = new Menu("Edit"));
170162 //editItem = menu.add(new MenuItem("Edit"));
171163 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+
165
+// undoItem = menu.add(new MenuItem("Undo"));
166
+// undoItem.addActionListener(this);
167
+// redoItem = menu.add(new MenuItem("Redo"));
168
+// redoItem.addActionListener(this);
169
+// menu.add("-");
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173171 duplicateItem.addActionListener(this);
174172 cloneItem = menu.add(new MenuItem("Clone"));
175173 cloneItem.addActionListener(this);
....@@ -185,7 +183,6 @@
185183 copyItem.addActionListener(this);
186184 pasteItem = menu.add(new MenuItem("Paste"));
187185 pasteItem.addActionListener(this);
188
- menu.add("-");
189186
190187 menu.add("-");
191188 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -206,14 +203,97 @@
206203 clearAllItem = menu.add(new MenuItem("Clear All"));
207204 clearAllItem.addActionListener(this);
208205 }
206
+
207
+ menuBar.add(cameraMenu = new Menu("View"));
208
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
209
+ //zBufferItem.addActionListener(this);
210
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
211
+ //normalLensItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
214
+
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
227
+
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
229
+ toggleHandleItem.addItemListener(this);
230
+ toggleHandleItem.setState(CameraPane.HANDLES);
231
+
232
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
233
+ togglePaintItem.addItemListener(this);
234
+ togglePaintItem.setState(CameraPane.PAINTMODE);
235
+
236
+ if (Globals.ADVANCED)
237
+ {
238
+ cameraMenu.add("-");
239
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
240
+ toggleLiveItem.addItemListener(this);
241
+ toggleLiveItem.setState(Globals.isLIVE());
209242
243
+ cameraMenu.add(stepItem = new MenuItem("Step"));
244
+ stepItem.addActionListener(this);
245
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
246
+ // toggleDLItem.addItemListener(this);
247
+ // toggleDLItem.setState(false);
248
+
249
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
250
+ toggleRenderItem.addItemListener(this);
251
+ toggleRenderItem.setState(!CameraPane.frozen);
252
+
253
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
254
+ toggleDebugItem.addItemListener(this);
255
+ toggleDebugItem.setState(Globals.DEBUG);
256
+
257
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
258
+ toggleFrustumItem.addItemListener(this);
259
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
260
+
261
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
262
+ toggleFootContactItem.addItemListener(this);
263
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
264
+
265
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
266
+ toggleTimelineItem.addItemListener(this);
267
+ }
268
+
269
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
270
+// toggleRootItem.addItemListener(this);
271
+// toggleRootItem.setState(false);
272
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
273
+// animationItem.addItemListener(this);
274
+// animationItem.setState(CameraPane.ANIMATION);
275
+ cameraMenu.add("-");
276
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
277
+ editCameraItem.addActionListener(this);
278
+
279
+ if (Globals.ADVANCED)
280
+ {
281
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
282
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
284
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
285
+ oe.cameraMenu.add("-");
286
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
287
+ openWindowItem.addActionListener(this);
288
+ editLeafItem.addActionListener(this);
289
+ lookAtItem.addActionListener(this);
290
+ //lookFromItem.addActinoListener(this);
291
+ //switchViewItem.addActionListener(this);
292
+ }
293
+
210294 oe.menuBar.add(menu = new Menu("Setting"));
211295 if (Globals.ADVANCED)
212296 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217297 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218298 revertMeshItem.addActionListener(this);
219299 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +333,29 @@
253333 }
254334
255335 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
258338 backItem = menu.add(new MenuItem("Back"));
259339 backItem.addActionListener(this);
260340 frontItem = menu.add(new MenuItem("Front"));
261341 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
264347 hideItem = menu.add(new MenuItem("Hidden Group"));
265348 hideItem.addActionListener(this);
349
+ }
266350 ungroupItem = menu.add(new MenuItem("Ungroup"));
267351 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- randomItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
271359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272360 switchGeoItem.addActionListener(this);
273361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +363,6 @@
275363 morphItem = menu.add(new MenuItem("Morph Group"));
276364 morphItem.addActionListener(this);
277365
278
- if (Globals.ADVANCED)
279
- {
280366 menu.add("-");
281367 physicsItem = menu.add(new MenuItem("Physics"));
282368 physicsItem.addActionListener(this);
....@@ -284,30 +370,29 @@
284370 frameselectorItem.addActionListener(this);
285371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286372 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289373 }
290374
291375 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
294378 billboardItem = menu.add(new MenuItem("Billboard"));
295379 billboardItem.addActionListener(this);
296380 csgItem = menu.add(new MenuItem("CSG"));
297381 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299383 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301385 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
304391 if (Globals.ADVANCED)
305392 {
306393 menu.add("-");
307394 linkerItem = menu.add(new MenuItem("Linker"));
308395 linkerItem.addActionListener(this);
309
- attributeItem = menu.add(new MenuItem("Attribute"));
310
- attributeItem.addActionListener(this);
311396 templateItem = menu.add(new MenuItem("Template"));
312397 templateItem.addActionListener(this);
313398 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -318,8 +403,12 @@
318403 resetTransformItem.addActionListener(this);
319404 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
320405 resetCentroidItem.addActionListener(this);
321
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
- transformgeometryItem.addActionListener(this);
406
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
407
+ resetCentroidXZItem.addActionListener(this);
408
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
409
+ transformGeometryItem.addActionListener(this);
410
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
411
+ transformChildrenItem.addActionListener(this);
323412
324413 oe.menuBar.add(menu = new Menu("Geometry"));
325414 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -368,6 +457,10 @@
368457 oe.menuBar.add(menu = new Menu("Attributes"));
369458 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370459 clearMaterialsItem.addActionListener(this);
460
+ resetAllItem = menu.add(new MenuItem("Reset All"));
461
+ resetAllItem.addActionListener(this);
462
+ stepAllItem = menu.add(new MenuItem("Step All"));
463
+ stepAllItem.addActionListener(this);
371464 menu.add("-");
372465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
373466 liveleavesItem.addActionListener(this);
....@@ -388,6 +481,14 @@
388481 markleavesItem.addActionListener(this);
389482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
390483 unmarkleavesItem.addActionListener(this);
484
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
485
+ rewindleavesItem.addActionListener(this);
486
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
487
+ unrewindleavesItem.addActionListener(this);
488
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
489
+ randomleavesItem.addActionListener(this);
490
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
491
+ unrandomleavesItem.addActionListener(this);
391492 menu.add("-");
392493 flipVItem = menu.add(new MenuItem("Flip V"));
393494 flipVItem.addActionListener(this);
....@@ -422,41 +523,42 @@
422523 sortbysizeItem.addActionListener(this);
423524 sortbynameItem = menu.add(new MenuItem("Sort by name"));
424525 sortbynameItem.addActionListener(this);
526
+ menu.add("-");
527
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
528
+ shareGeometriesItem.addActionListener(this);
529
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
530
+ mergeGeometriesItem.addActionListener(this);
425531 if (Globals.ADVANCED)
426532 {
427
- menu.add("-");
533
+ // Pretty much the same as duplicate and clone.
428534 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429535 extractGeometriesItem.addActionListener(this);
430536 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431537 cloneGeometriesItem.addActionListener(this);
432
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
433
- shareGeometriesItem.addActionListener(this);
434
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
435
- mergeGeometriesItem.addActionListener(this);
436538 }
437539
438540 oe.menuBar.add(menu = new Menu("Insert"));
439541 buildCreateMenu(menu);
440542
441
- oe.menuBar.add(menu = new Menu("Include"));
442
- importOBJItem = menu.add(new MenuItem("OBJ file..."));
443
- importOBJItem.addActionListener(this);
444
- menu.add("-");
445
- import3DSItem = menu.add(new MenuItem("3DS file..."));
446
- import3DSItem.addActionListener(this);
447
- menu.add("-");
448
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
449
- importVRMLX3DItem.addActionListener(this);
450
- menu.add("-");
451
- importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
452
- importGFDItem.addActionListener(this);
453
-
454543 oe.menuBar.add(menu = new Menu("Tools"));
455544 buildToolsMenu(menu);
456545 }
457546
547
+
458548 void SetupUI2(ObjEditor oe)
459549 {
550
+ // June 2019
551
+ if (oe == null)
552
+ {
553
+ //super.SetupUI2(this);
554
+ //return;
555
+ }
556
+
557
+ if (copy != group)
558
+ {
559
+ //super.SetupUI2(this);
560
+ }
561
+
460562 //new Exception().printStackTrace();
461563
462564 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -485,97 +587,229 @@
485587 oe.radioPanel.add(dummyButton);
486588 oe.buttonGroup.add(dummyButton);
487589 */
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
593
+
488594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
489595
490
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
491
- liveCB.setToolTipText("Enabled animation");
596
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ //minButton.setToolTipText("Minimize window");
598
+ //minButton.addActionListener(this);
599
+
600
+ if (Globals.ADVANCED)
601
+ {
602
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ maxButton.setToolTipText("Maximize window");
604
+ maxButton.addActionListener(this);
605
+ }
606
+
607
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ fullButton.setToolTipText("Full-screen window");
609
+ fullButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ screenfitButton.setToolTipText("Screen fit");
613
+ screenfitButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ restoreCameraButton.setToolTipText("Restore viewpoint");
617
+ restoreCameraButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
621
+ saveButton.addActionListener(this);
622
+
623
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ undoButton.setToolTipText("Previous version");
625
+ undoButton.addActionListener(this);
626
+ undoButton.setEnabled(false);
627
+
628
+ cGridBag updown = new cGridBag().setVertical(true);
629
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreButton.setToolTipText("Restore current");
631
+ restoreButton.addActionListener(this);
632
+ restoreButton.setEnabled(false);
633
+
634
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ replaceButton.setToolTipText("Replace current");
636
+ replaceButton.addActionListener(this);
637
+ replaceButton.setEnabled(false);
638
+
639
+ copyOptionsPanel.add(updown);
640
+
641
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ redoButton.setToolTipText("Next version");
643
+ redoButton.addActionListener(this);
644
+ redoButton.setEnabled(false);
645
+
646
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
647
+ liveCB.setToolTipText("Enable animation");
492648 liveCB.addItemListener(this);
493649
494
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
495651 oneStepButton.setToolTipText("Animate one step forward");
496652 oneStepButton.addActionListener(this);
497653
498
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
499655 fastCB.setToolTipText("Fast mode");
500656 fastCB.addItemListener(this);
501657
502
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
503
- trackCB.setToolTipText("Enable tracking");
504
- trackCB.addItemListener(this);
505
-
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
507
- screenfitButton.setToolTipText("Screen fit");
508
- screenfitButton.addActionListener(this);
658
+ //oe.toolboxPanel.Return();
659
+
660
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
661
+// trackCB.setToolTipText("Enable tracking");
662
+// trackCB.addItemListener(this);
509663
510664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
511665 // screenfitpointButton.addActionListener(this);
512666
513667 if (Globals.ADVANCED)
514668 {
515
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
669
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
516670 snapobjectButton.addActionListener(this);
517671 snapobjectButton.setToolTipText("Snap Object");
518672 }
519673
520
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
521
- flashSelectionButton.setToolTipText("Show selection");
522
- flashSelectionButton.addActionListener(this);
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
523675
524
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
525
-
526
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527677 twoButton.setToolTipText("Show center view only");
528678 twoButton.addActionListener(this);
529
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
679
+ this.fullscreenLayout = twoButton;
680
+
681
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530682 fourButton.addActionListener(this);
531683 fourButton.setToolTipText("Show left panel only");
532
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
533685 sixButton.setToolTipText("2-column layout left");
534686 sixButton.addActionListener(this);
535
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
536688 threeButton.setToolTipText("2-column layout right");
537689 threeButton.addActionListener(this);
538
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
539691 sevenButton.setToolTipText("3-column layout");
540692 sevenButton.addActionListener(this);
541693 //
542694
543
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
695
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544696 rootButton.setToolTipText("Edit selection in new tab");
545697 rootButton.addActionListener(this);
546698
547
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
548700 closeButton.setToolTipText("Close tab");
549701 closeButton.addActionListener(this);
550702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
551703 //clearButton.addActionListener(this);
552
-
553
- cGridBag commandsPanel = new cGridBag();
704
+
705
+ // INSERT
706
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ gridButton.setToolTipText("Create grid");
708
+ gridButton.addActionListener(this);
709
+
710
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ boxButton.setToolTipText("Create box");
712
+ boxButton.addActionListener(this);
713
+
714
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ sphereButton.setToolTipText("Create sphere");
716
+ sphereButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ coneButton.setToolTipText("Create cone");
720
+ coneButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ torusButton.setToolTipText("Create torus");
724
+ torusButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ superButton.setToolTipText("Create superellipsoid");
728
+ superButton.addActionListener(this);
729
+
730
+ if (Globals.ADVANCED)
731
+ {
732
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ kleinButton.setToolTipText("Create Klein bottle");
734
+ kleinButton.addActionListener(this);
735
+ }
554736
555
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
556
- editButton.setToolTipText("Edit selection");
737
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ particlesButton.setToolTipText("Create particle system");
739
+ particlesButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.Return();
742
+
743
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ groupButton.setToolTipText("Create group");
745
+ groupButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ compositeButton.setToolTipText("Create composite");
749
+ compositeButton.addActionListener(this);
750
+
751
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
+ switchButton.setToolTipText("Create item switcher");
753
+ switchButton.addActionListener(this);
754
+
755
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ loopButton.setToolTipText("Create loop");
757
+ loopButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ textureButton.setToolTipText("Create texture");
761
+ textureButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ overlayButton.setToolTipText("Create overlay");
765
+ overlayButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ lightButton.setToolTipText("Create light");
769
+ lightButton.addActionListener(this);
770
+
771
+ for (int i=6; --i>=0;)
772
+ {
773
+ oe.toolboxPanel.Return();
774
+ oe.toolboxPanel.add(new cGridBag());
775
+ oe.toolboxPanel.add(new cGridBag());
776
+ oe.toolboxPanel.add(new cGridBag());
777
+ oe.toolboxPanel.add(new cGridBag());
778
+ oe.toolboxPanel.add(new cGridBag());
779
+ oe.toolboxPanel.add(new cGridBag());
780
+ oe.toolboxPanel.add(new cGridBag());
781
+ }
782
+
783
+ // EDIT panel
784
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ editButton.setToolTipText("Pin selection controls");
557786 editButton.addActionListener(this);
558787
559
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
560
- uneditButton.setToolTipText("Unedit selection");
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
561790 uneditButton.addActionListener(this);
562791
563
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
564
- allParamsButton.setToolTipText("Edit all params");
792
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
793
+ allParamsButton.setToolTipText("Show all controle");
565794 allParamsButton.addActionListener(this);
566795
567
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
796
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
568797 clearPanelButton.setToolTipText("Clear edit panel");
569798 clearPanelButton.addActionListener(this);
570799
571
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
800
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
572801 unselectButton.setToolTipText("Unselect");
573802 unselectButton.addActionListener(this);
574803
575
- commandsPanel.preferredHeight = 1;
804
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ flashSelectionButton.setToolTipText("Highlight selection");
806
+ flashSelectionButton.addActionListener(this);
576807
577
- oe.treePanel.add(commandsPanel);
578
- oe.treePanel.Return();
808
+ editCommandsPanel.preferredHeight = 1;
809
+
810
+ SetPinStates(false);
811
+// oe.treePanel.add(commandsPanel);
812
+// oe.treePanel.Return();
579813
580814 // oe.aConstraints.gridx += 1;
581815 // oe.aConstraints.weighty = 0;
....@@ -592,29 +826,17 @@
592826
593827 JScrollPane jSP;
594828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
595
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
596830 ResetModel();
597831
598832 oe.treePanel.add(jSPPanel);
599833 oe.treePanel.Return();
600834
601
- cGridBag copyOptionsPanel = new cGridBag();
602
-
603
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
604
- colorCB.setToolTipText("Copy color when dropped");
605
- colorCB.addItemListener(this);
606
-
607
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
608
- materialCB.setToolTipText("Copy material when dropped");
609
- materialCB.addItemListener(this);
610
-
611
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
612
- textureCB.setToolTipText("Copy texture when dropped");
613
- textureCB.addItemListener(this);
614
-
615
- copyOptionsPanel.preferredHeight = 1;
616835 oe.treePanel.add(copyOptionsPanel);
617836 oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
618840
619841 // mainPanel.setDividerLocation(0.5); //1.0);
620842 // mainPanel.setResizeWeight(0.5);
....@@ -643,23 +865,43 @@
643865
644866 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
645867 {
868
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
869
+ colorCB.setToolTipText("Copy color when dropped");
870
+ colorCB.addItemListener(this);
871
+
872
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
873
+ materialCB.setToolTipText("Copy material when dropped");
874
+ materialCB.addItemListener(this);
875
+
876
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
877
+ textureCB.setToolTipText("Copy texture when dropped");
878
+ textureCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
646882 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
647883 boxCB.setToolTipText("Display bounding boxes");
648884 boxCB.addItemListener(this);
649885
650886 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
651
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
652888 zoomBoxCB.addItemListener(this);
653889
654
- if (Globals.ADVANCED)
890
+ if (true) // Globals.ADVANCED)
655891 {
656
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
657
- supportCB.setToolTipText("Enable rigging");
658
- supportCB.addItemListener(this);
892
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
893
+// supportCB.setToolTipText("Enable rigging");
894
+// supportCB.addItemListener(this);
895
+
896
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
897
+ freezeCB.setToolTipText("Fast moving camera");
898
+ freezeCB.addItemListener(this);
659899
660900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
661901 // localCB.addItemListener(this);
662902
903
+ panel.Return();
904
+
663905 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
664906 crowdCB.setToolTipText("Used for crowds");
665907 crowdCB.addItemListener(this);
....@@ -676,6 +918,8 @@
676918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
677919 // speakerMocapCB.addItemListener(this);
678920
921
+ panel.Return();
922
+
679923 if (false)
680924 {
681925 // handled in scripts
....@@ -690,32 +934,72 @@
690934 //constraints.gridy += 1;
691935 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
692936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
693938 }
694939
695940 //constraints.gridx += 1;
696941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
697942 // debugCB.addItemListener(this);
698943
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
699948 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
949
+ oeilCB.setToolTipText("Move camera when tracking");
700950 oeilCB.addItemListener(this);
701951
952
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
953
+ shadowCB.setToolTipText("When live compute shadows");
954
+ shadowCB.addItemListener(this);
955
+
956
+ panel.Return();
957
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
958
+ toggleTextureCB.setToolTipText("Load textures");
959
+ toggleTextureCB.addItemListener(this);
960
+
961
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
962
+ toggleSwitchCB.setToolTipText("Choose a single item");
963
+ toggleSwitchCB.addItemListener(this);
964
+
965
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
966
+ autokeepCB.setToolTipText("On structure change");
967
+ autokeepCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ if (Globals.ADVANCED)
971
+ {
702972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
703973 lookAtCB.setToolTipText("Look-at target");
704974 lookAtCB.addItemListener(this);
975
+ }
705976
706977 }
707978
708979 cGridBag fill = new cGridBag();
709
-
710980 fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
711985
712986 panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
713989
714990 }
715991
716992 void EditObject(Object3D obj)
717993 {
718994 cRadio radioButton = new cRadio(obj.name);
995
+
996
+ // June 2019. Patch to avoid bug with transparency.
997
+ radioButton.hadMaterial = obj.material != null;
998
+ if (!radioButton.hadMaterial)
999
+ {
1000
+ obj.material = new cMaterial();
1001
+ }
1002
+
7191003 radioButton.SetObject(obj);
7201004 radioButton.layout = sevenButton;
7211005 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -724,8 +1008,11 @@
7241008 buttonGroup.add(radioButton);
7251009 radioButton.doClick();
7261010 }
1011
+
7271012 void SetupViews(ObjEditor oe)
7281013 {
1014
+ theFrame = this;
1015
+
7291016 oe.SetupViews();
7301017
7311018 System.out.println("SetupViews");
....@@ -734,23 +1021,28 @@
7341021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7351022 }
7361023
737
- JCheckBox liveCB;
738
- JCheckBox supportCB;
739
- JCheckBox localCB;
740
- JCheckBox crowdCB;
741
- JCheckBox smoothCB;
742
- JCheckBox fastCB;
743
- JCheckBox slowCB;
744
- JCheckBox boxCB;
745
- JCheckBox zoomBoxCB;
746
- JCheckBox trackCB;
747
- JCheckBox smoothfocusCB;
1024
+ cToggleButton liveCB;
1025
+ cCheckBox supportCB;
1026
+ cCheckBox localCB;
1027
+ cCheckBox crowdCB;
1028
+ cCheckBox smoothCB;
1029
+ cToggleButton fastCB;
1030
+ cCheckBox slowCB;
1031
+ cCheckBox boxCB;
1032
+ cCheckBox zoomBoxCB;
1033
+ cCheckBox freezeCB;
1034
+ //cToggleButton trackCB;
1035
+ cCheckBox trackCB;
1036
+ cCheckBox smoothfocusCB;
7481037 // JCheckBox speakerMocapCB;
749
- JCheckBox speakerCameraCB;
750
- JCheckBox speakerFocusCB;
751
- JCheckBox debugCB;
752
- JCheckBox oeilCB;
753
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
7541046
7551047 // static int COLOR = 1;
7561048 // static int MATERIAL = 2;
....@@ -758,9 +1050,9 @@
7581050
7591051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7601052
761
- JCheckBox colorCB;
762
- JCheckBox materialCB;
763
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
7641056
7651057 public void itemStateChanged(ItemEvent e)
7661058 {
....@@ -788,6 +1080,7 @@
7881080 } else if(e.getSource() == liveCB)
7891081 {
7901082 cameraView.ToggleLive();
1083
+ refreshContents(false);
7911084 }
7921085 else if(e.getSource() == supportCB)
7931086 {
....@@ -852,6 +1145,18 @@
8521145 {
8531146 cameraView.ToggleOeil();
8541147 }
1148
+ else if(e.getSource() == shadowCB)
1149
+ {
1150
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1151
+ }
1152
+ else if(e.getSource() == freezeCB)
1153
+ {
1154
+ Globals.FREEZEONMOVE ^= true;
1155
+ }
1156
+ else if(e.getSource() == autokeepCB)
1157
+ {
1158
+ Globals.REPLACEONMAKE ^= true;
1159
+ }
8551160 else if(e.getSource() == lookAtCB)
8561161 {
8571162 cameraView.ToggleLookAt();
....@@ -868,7 +1173,8 @@
8681173
8691174 /**/
8701175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
871
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
8721178 if ((path == null) || (path.getPathCount() <= 1)) {
8731179 // We can't move the root node or an empty selection
8741180 return;
....@@ -931,8 +1237,6 @@
9311237 }
9321238 }
9331239
934
- String string = (String) object;
935
-
9361240 System.out.println("Transfer = " + object + "; drop : " + target);
9371241 // if( object instanceof java.io.File[])
9381242 // {
....@@ -940,7 +1244,11 @@
9401244 // objEditor.DropFile((java.io.File[]) object, true);
9411245 // return;
9421246 // }
943
- if (string.charAt(0) == '/')
1247
+
1248
+ String string = object.toString();
1249
+
1250
+ // File path for Mac and Windows
1251
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9441252 {
9451253 // file(s)
9461254 String[] names = string.split("\n");
....@@ -967,7 +1275,7 @@
9671275
9681276 flashIt = false;
9691277 CameraPane pane = (CameraPane) target;
970
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1278
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9711279 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9721280
9731281 if (group.selection.size() == 1)
....@@ -983,23 +1291,33 @@
9831291
9841292 assert target == objEditor.jTree;
9851293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
9861295 try {
987
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9881297 } catch (Exception e) {
9891298 System.out.println("destinationPath : " + destinationPath);
9901299 return;
9911300 }
9921301
993
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
9941303 {
1304
+ Object3D child = (Object3D)group.selection.elementAt(i);
1305
+
1306
+ // Cannot move into itself
1307
+ if (child == destinationLeaf)
1308
+ return;
1309
+ }
1310
+
1311
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1312
+// {
9951313 loadClipboard(true);
9961314 objEditor.jTree.setSelectionPath(destinationPath);
9971315 pasteInto(false, false);
998
- } else {
999
- loadClipboard(false);
1000
- objEditor.jTree.setSelectionPath(destinationPath);
1001
- pasteInto(false, false); // true); // ???
1002
- }
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
10031321 }
10041322 public void dropActionChanged(DropTargetDragEvent dtde)
10051323 // Called if the user has modified the current drop gesture
....@@ -1104,22 +1422,30 @@
11041422 {
11051423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11061424 //heightFieldItem.addActionListener(this);
1107
- gridItem = menu.add(new MenuItem("Grid"));
1108
- gridItem.addActionListener(this);
1109
- rectoidItem = menu.add(new MenuItem("Box"));
1110
- rectoidItem.addActionListener(this);
1111
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1112
- ellipsoidItem.addActionListener(this);
1113
- coneItem = menu.add(new MenuItem("Cone"));
1114
- coneItem.addActionListener(this);
1115
- torusItem = menu.add(new MenuItem("Torus"));
1116
- torusItem.addActionListener(this);
1117
- superItem = menu.add(new MenuItem("Superellipsoid"));
1118
- superItem.addActionListener(this);
1425
+// gridItem = menu.add(new MenuItem("Grid"));
1426
+// gridItem.addActionListener(this);
1427
+// rectoidItem = menu.add(new MenuItem("Box"));
1428
+// rectoidItem.addActionListener(this);
1429
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1430
+// ellipsoidItem.addActionListener(this);
1431
+// coneItem = menu.add(new MenuItem("Cone"));
1432
+// coneItem.addActionListener(this);
1433
+// torusItem = menu.add(new MenuItem("Torus"));
1434
+// torusItem.addActionListener(this);
1435
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1436
+// superItem.addActionListener(this);
1437
+
1438
+ cameraItem = menu.add(new MenuItem("Camera"));
1439
+ cameraItem.addActionListener(this);
1440
+
1441
+ if (!Globals.ADVANCED)
1442
+ {
11191443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11201444 kleinItem.addActionListener(this);
1121
- particleItem = menu.add(new MenuItem("Particle system"));
1122
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
11231449 if (Globals.ADVANCED)
11241450 {
11251451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1145,15 +1471,15 @@
11451471 }
11461472 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11471473 bezierItem.addActionListener(this);
1148
- overlayItem = menu.add(new MenuItem("Overlay"));
1149
- overlayItem.addActionListener(this);
1150
- lightItem = menu.add(new MenuItem("Light"));
1151
- lightItem.addActionListener(this);
1474
+// overlayItem = menu.add(new MenuItem("Overlay"));
1475
+// overlayItem.addActionListener(this);
1476
+// lightItem = menu.add(new MenuItem("Light"));
1477
+// lightItem.addActionListener(this);
11521478 menu.add("-");
11531479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11541480 //superLoopItem.addActionListener(this);
1155
- loopItem = menu.add(new MenuItem("Loop"));
1156
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
11571483 doubleItem = menu.add(new MenuItem("Fork"));
11581484 doubleItem.addActionListener(this);
11591485 if (Globals.ADVANCED)
....@@ -1169,6 +1495,9 @@
11691495 animationItem.addItemListener(this);
11701496 animationItem.setState(Globals.ANIMATION);
11711497
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
1500
+
11721501 menu.add("-");
11731502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11741503 parseverticesItem.addActionListener(this);
....@@ -1181,6 +1510,8 @@
11811510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11821511 reduce34MorphItem.addActionListener(this);
11831512 menu.add("-");
1513
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1514
+ memoryItem.addActionListener(this);
11841515 menu.add(computeAOItem = new MenuItem("Compute AO"));
11851516 computeAOItem.addActionListener(this);
11861517
....@@ -1189,11 +1520,9 @@
11891520 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11901521 mirrorItem.addActionListener(this);
11911522 menu.add("-");
1192
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1193
- memoryItem.addActionListener(this);
11941523 menu.add(analyzeItem = new MenuItem("Analyze"));
11951524 analyzeItem.addActionListener(this);
1196
- menu.add(dumpItem = new MenuItem("Dump"));
1525
+ menu.add(dumpItem = new MenuItem("Print"));
11971526 dumpItem.addActionListener(this);
11981527 // menu.add(pathItem = new MenuItem("From-to path"));
11991528 // pathItem.addActionListener(this);
....@@ -1334,9 +1663,24 @@
13341663 shadow.material = new cMaterial(obj.material);
13351664 shadow.material.diffuse = 0.0001f;
13361665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
13371667
13381668 makeSomething(shadow);
13391669 }
1670
+
1671
+ private void ClearUnpinned()
1672
+ {
1673
+ //for (Object3D obj : listUI)
1674
+ for (int i=listUI.size(); --i>=0;)
1675
+ {
1676
+ Object3D obj = listUI.elementAt(i);
1677
+ if (!obj.pinned)
1678
+ {
1679
+ obj.CloseUI();
1680
+ listUI.remove(i);
1681
+ }
1682
+ }
1683
+ }
13401684
13411685 /**
13421686 * applyExample
....@@ -1540,9 +1884,9 @@
15401884
15411885 void Overwrite(int mask)
15421886 {
1543
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1887
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15441888 {
1545
- Object3D content = GrafreeD.clipboard.get(0);
1889
+ Object3D content = Grafreed.clipboard.get(0);
15461890
15471891 if (content instanceof cGroup && ((cGroup)content).transientlink )
15481892 content = ((cGroup)content).get(0);
....@@ -1581,7 +1925,7 @@
15811925 {
15821926 ScreenFit();
15831927 } else
1584
- if (source == switchItem)
1928
+ if (source == switchViewItem)
15851929 {
15861930 cVector v1 = new cVector();
15871931 cVector v2 = new cVector();
....@@ -1590,11 +1934,11 @@
15901934 objEditor.cameraView.renderCamera.setAim(v2, v1);
15911935 objEditor.cameraView.repaint();
15921936 } else
1593
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
15941938 {
15951939 makeSomething(new Box());
15961940 } else
1597
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
15981942 {
15991943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16001944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1673,27 +2017,27 @@
16732017
16742018 makeSomething(obj);
16752019 } else
1676
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
16772021 {
16782022 makeSomething(new Grid());
16792023 } else
1680
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
16812025 {
16822026 makeSomething(new Sphere());
16832027 } else
1684
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
16852029 {
16862030 makeSomething(new Cone());
16872031 } else
1688
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
16892033 {
16902034 makeSomething(new Torus());
16912035 } else
1692
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
16932037 {
16942038 makeSomething(new Superellipsoid());
16952039 } else
1696
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
16972041 {
16982042 makeSomething(new Klein());
16992043 } else
....@@ -1713,7 +2057,7 @@
17132057 {
17142058 makeSomething(new BezierSurface());
17152059 } else
1716
- if (source == overlayItem)
2060
+ if (source == overlayItem || source == overlayButton)
17172061 {
17182062 /*
17192063 Object3D obj = new BezierSurface(5,8);
....@@ -1761,7 +2105,7 @@
17612105 s.setup();
17622106 makeSomething(s);
17632107 } else
1764
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
17652109 {
17662110 makeSomething(new Light());
17672111 } else
....@@ -1811,30 +2155,30 @@
18112155
18122156 group(g);
18132157 } else
1814
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
18152159 {
18162160 Composite csg = new GroupLeaf();
18172161 csg.count = 5;
18182162 group(csg);
1819
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
18202164 csg.addChild(child);
18212165 child.addChild(csg);
18222166 } else
18232167 if (source == doubleItem)
18242168 {
1825
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
18262170 csg.count = 5;
18272171 group(csg);
1828
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
18292173 csg.addChild(child);
18302174 child.addChild(csg);
1831
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
18322176 csg.addChild(child);
18332177 child.addChild(csg);
18342178 } else
18352179 if (source == tripleItem)
18362180 {
1837
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
18382182 csg.count = 4;
18392183 group(csg);
18402184 Composite child = new cGroup();
....@@ -1846,31 +2190,6 @@
18462190 child = new cGroup();
18472191 csg.addChild(child);
18482192 child.addChild(csg);
1849
- } else
1850
-
1851
- if (source == importGFDItem)
1852
- {
1853
- ImportGFD();
1854
- } else
1855
- if (source == importVRMLX3DItem)
1856
- {
1857
- ImportVRMLX3D();
1858
- } else
1859
- if (source == import3DSItem)
1860
- {
1861
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1862
- } else
1863
- if (source == importOBJItem)
1864
- {
1865
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1866
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1867
- browser.setVisible(true);
1868
- String filename = browser.getFile();
1869
- if (filename != null && filename.length() > 0)
1870
- {
1871
- String fullname = browser.getDirectory() + filename;
1872
- makeSomething(ReadOBJ(fullname), true);
1873
- }
18742193 } else
18752194 if (source == computeAOItem)
18762195 {
....@@ -1890,7 +2209,7 @@
18902209 if (source == invariantsItem)
18912210 {
18922211 System.out.println("Invariants:");
1893
- GrafreeD.grafreeD.universe.invariants();
2212
+ Grafreed.grafreeD.universe.invariants();
18942213 } else
18952214 if (source == memoryItem)
18962215 {
....@@ -1909,6 +2228,46 @@
19092228 {
19102229 DumpObject();
19112230 } else
2231
+ if (source == minButton)
2232
+ {
2233
+ Minimize();
2234
+ } else
2235
+ if (source == maxButton)
2236
+ {
2237
+ Maximize();
2238
+ } else
2239
+ if (source == fullButton)
2240
+ {
2241
+ ToggleFullScreen();
2242
+ } else
2243
+ if (source == undoButton)
2244
+ {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2248
+ Undo();
2249
+ } else
2250
+ if (source == restoreButton)
2251
+ {
2252
+ // Restore current version
2253
+ Restore();
2254
+ } else
2255
+ if (source == replaceButton)
2256
+ {
2257
+ // Overwrite current version
2258
+ Replace();
2259
+ } else
2260
+ if (source == redoButton)
2261
+ {
2262
+ // Go to next version
2263
+ Redo();
2264
+ } else
2265
+ if (source == saveButton)
2266
+ {
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
2270
+ } else
19122271 if (source == oneStepButton)
19132272 {
19142273 Globals.ONESTEP = true;
....@@ -1916,17 +2275,14 @@
19162275 } else
19172276 if (source == screenfitButton)
19182277 {
1919
- //Reload(lastConverter, lastFilename, true);
19202278 ScreenFit();
19212279 } else
19222280 if (source == screenfitpointButton)
19232281 {
1924
- //Reload(lastConverter, lastFilename, true);
19252282 ScreenFitPoint();
19262283 } else
19272284 if (source == snapobjectButton)
19282285 {
1929
- //Reload(lastConverter, lastFilename, true);
19302286 SnapObject();
19312287 } else
19322288 // if (event.getSource() == recompileButton)
....@@ -1963,12 +2319,20 @@
19632319 {
19642320 loadClipboard(true);
19652321 } else
2322
+ if (source == undoItem)
2323
+ {
2324
+ Undo();
2325
+ } else
2326
+ if (source == redoItem)
2327
+ {
2328
+ Redo();
2329
+ } else
19662330 if (source == duplicateItem)
19672331 {
1968
- Object3D keep = GrafreeD.clipboard;
2332
+ Object3D keep = Grafreed.clipboard;
19692333 loadClipboard(false);
19702334 paste(false);
1971
- GrafreeD.clipboard = keep;
2335
+ Grafreed.clipboard = keep;
19722336 } else
19732337 if (source == cloneItem)
19742338 {
....@@ -2188,9 +2552,9 @@
21882552 // group.selection.get(0).setMasterThis(content); // should be identity
21892553 // refreshContents();
21902554 // }
2191
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2555
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21922556 {
2193
- Object3D content = GrafreeD.clipboard.get(0);
2557
+ Object3D content = Grafreed.clipboard.get(0);
21942558
21952559 if (content instanceof cGroup && ((cGroup)content).transientlink )
21962560 content = ((cGroup)content).get(0);
....@@ -2240,9 +2604,9 @@
22402604 } else
22412605 if (source == setMasterItem)
22422606 {
2243
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2607
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22442608 {
2245
- Object3D content = GrafreeD.clipboard.get(0);
2609
+ Object3D content = Grafreed.clipboard.get(0);
22462610
22472611 if (content instanceof cGroup && ((cGroup)content).transientlink )
22482612 content = ((cGroup)content).get(0);
....@@ -2255,9 +2619,9 @@
22552619 {
22562620 if (group.selection.size() == 1)
22572621 {
2258
- if (GrafreeD.clipboard.size() == 1)
2622
+ if (Grafreed.clipboard.size() == 1)
22592623 {
2260
- Object3D content = GrafreeD.clipboard.get(0);
2624
+ Object3D content = Grafreed.clipboard.get(0);
22612625
22622626 if (content instanceof cGroup && ((cGroup)content).transientlink )
22632627 content = ((cGroup)content).get(0);
....@@ -2274,7 +2638,7 @@
22742638 {
22752639 RevertMeshes();
22762640 } else
2277
- if (source == resetMeshItem)
2641
+ if (source == resetAllItem)
22782642 {
22792643 ResetAll();
22802644 } else
....@@ -2294,9 +2658,9 @@
22942658 {
22952659 ClearSelection(true);
22962660 } else
2297
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
22982662 {
2299
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
23002664 } else
23012665 if (source == hideItem)
23022666 {
....@@ -2314,11 +2678,11 @@
23142678 {
23152679 makeSomething(new Camera());
23162680 } else
2317
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
23182682 {
23192683 group(new Composite());
23202684 } else
2321
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
23222686 {
23232687 RandomNode random = new RandomNode();
23242688 group(random);
....@@ -2420,7 +2784,7 @@
24202784 {
24212785 group(new cLinker());
24222786 } else
2423
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
24242788 {
24252789 group(new TextureNode());
24262790 } else
....@@ -2440,17 +2804,30 @@
24402804 {
24412805 CastShadow(2);
24422806 } else
2443
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
24442808 {
2445
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
24462811 for (int i=0; i<group.selection.size(); i++)
24472812 {
2448
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
24492818 }
24502819
2451
- ClearSelection(false);
2452
-
2453
- refreshContents();
2820
+ if (!hasRoot)
2821
+ {
2822
+ for (int i=0; i<group.selection.size(); i++)
2823
+ {
2824
+ Ungroup(group.selection.get(i));
2825
+ }
2826
+
2827
+ ClearSelection(false);
2828
+
2829
+ refreshContents();
2830
+ }
24542831 } else
24552832 if (source == genUVItem)
24562833 {
....@@ -2462,7 +2839,7 @@
24622839 } else
24632840 if (source == genNormalsMESHItem)
24642841 {
2465
- GenNormals(true); // TODO
2842
+ GenNormalsMESH();
24662843 } else
24672844 if (source == genNormalsORGANItem)
24682845 {
....@@ -2527,6 +2904,22 @@
25272904 if (source == unmarkleavesItem)
25282905 {
25292906 MarkLeaves(false);
2907
+ } else
2908
+ if (source == rewindleavesItem)
2909
+ {
2910
+ RewindLeaves(true);
2911
+ } else
2912
+ if (source == unrewindleavesItem)
2913
+ {
2914
+ RewindLeaves(false);
2915
+ } else
2916
+ if (source == randomleavesItem)
2917
+ {
2918
+ RandomLeaves(true);
2919
+ } else
2920
+ if (source == unrandomleavesItem)
2921
+ {
2922
+ RandomLeaves(false);
25302923 } else
25312924 if (source == flipVItem)
25322925 {
....@@ -2612,9 +3005,13 @@
26123005 {
26133006 SmoothMesh();
26143007 } else
2615
- if (source == transformgeometryItem)
3008
+ if (source == transformGeometryItem)
26163009 {
26173010 TransformGeometry();
3011
+ } else
3012
+ if (source == transformChildrenItem)
3013
+ {
3014
+ TransformChildren();
26183015 } else
26193016 if (source == resetTransformItem)
26203017 {
....@@ -2622,7 +3019,11 @@
26223019 } else
26233020 if (source == resetCentroidItem)
26243021 {
2625
- ResetCentroid();
3022
+ ResetCentroid(true);
3023
+ } else
3024
+ if (source == resetCentroidXZItem)
3025
+ {
3026
+ ResetCentroid(false);
26263027 } else
26273028 if (source == resetParentItem)
26283029 {
....@@ -2754,6 +3155,10 @@
27543155 if (source == twoButton)
27553156 {
27563157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
27573162 // bug
27583163 //gridPanel.setDividerLocation(1.0);
27593164 //bigPanel.setDividerLocation(0.0);
....@@ -2786,10 +3191,31 @@
27863191 bigThree.ClearUI();
27873192 bigThree.add(centralPanel);
27883193 bigThree.FlushUI();
3194
+
3195
+ cameraView.requestFocusInWindow();
3196
+
3197
+// refreshContents(true);
3198
+//
3199
+// try
3200
+// {
3201
+// java.awt.Robot bot = new java.awt.Robot();
3202
+// int mask = InputEvent.BUTTON1_MASK;
3203
+// bot.mouseMove(100, 100);
3204
+// bot.mousePress(mask);
3205
+// bot.mouseRelease(mask);
3206
+// }
3207
+// catch (Exception e)
3208
+// {
3209
+//
3210
+// }
3211
+
27893212 } else
27903213 if (source == threeButton)
27913214 {
27923215 radio.layout = threeButton;
3216
+
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
27933219
27943220 // bigThree.remove(scenePanel);
27953221 // bigThree.remove(centralPanel);
....@@ -2822,10 +3248,15 @@
28223248 bigThree.add(centralPanel);
28233249 bigThree.add(XYZPanel);
28243250 bigThree.FlushUI();
3251
+
3252
+ cameraView.requestFocusInWindow();
28253253 } else
28263254 if (source == fourButton)
28273255 {
28283256 radio.layout = fourButton;
3257
+
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
28293260
28303261 // bigThree.remove(scenePanel);
28313262 // bigThree.remove(centralPanel);
....@@ -2857,10 +3288,15 @@
28573288 bigThree.ClearUI();
28583289 bigThree.add(scenePanel);
28593290 bigThree.FlushUI();
3291
+
3292
+ cameraView.requestFocusInWindow();
28603293 } else
28613294 if (source == sixButton)
28623295 {
28633296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
28643300
28653301 // bigThree.remove(scenePanel);
28663302 // bigThree.remove(centralPanel);
....@@ -2893,10 +3329,15 @@
28933329 bigThree.add(scenePanel);
28943330 bigThree.add(centralPanel);
28953331 bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
28963334 } else
28973335 if (source == sevenButton)
28983336 {
28993337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
29003341
29013342 // bigThree.remove(scenePanel);
29023343 // bigThree.remove(centralPanel);
....@@ -2930,6 +3371,8 @@
29303371 bigThree.add(centralPanel);
29313372 bigThree.add(XYZPanel);
29323373 bigThree.FlushUI();
3374
+
3375
+ cameraView.requestFocusInWindow();
29333376 } else
29343377 if (source == rootButton)
29353378 {
....@@ -2941,6 +3384,7 @@
29413384 EditObject(obj);
29423385 }
29433386
3387
+ cameraView.requestFocusInWindow();
29443388 refreshContents(true);
29453389 } else
29463390 if (source == closeButton)
....@@ -2950,22 +3394,37 @@
29503394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29513395 {
29523396 ab = (cRadio)e.nextElement();
2953
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29543398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
29553405 buttonGroup.remove(ab);
29563406 radioPanel.remove(ab);
29573407
2958
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
29593410 // ab.GetObject().objectUI = null; // ?????????
29603411
29613412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29623413 break;
29633414 }
29643415 }
3416
+
3417
+ cameraView.requestFocusInWindow();
29653418 refreshContents(true);
29663419 } else
29673420 if (source == editItem || source == editButton)
29683421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
29693428 EditSelection(false);
29703429 } else
29713430 if (source == uneditButton)
....@@ -2975,10 +3434,11 @@
29753434 Object3D child = (Object3D)e.nextElement();
29763435 if(child.editWindow != null)
29773436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
29783438 child.CloseUI();
29793439 listUI.remove(child);
29803440
2981
- child.editWindow = null; // ???????????
3441
+ //child.editWindow = null; // ???????????
29823442 }
29833443 objEditor.ctrlPanel.FlushUI();
29843444 //objEditor.jTree.clearSelection();
....@@ -2991,6 +3451,7 @@
29913451 //copy.ClearUI();
29923452 for (Object3D obj : listUI)
29933453 {
3454
+ obj.pinned = false;
29943455 obj.CloseUI();
29953456 }
29963457 listUI.clear();
....@@ -3000,7 +3461,7 @@
30003461 {
30013462 assert(copy == group);
30023463
3003
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30043465
30053466 for (Object3D obj : listUI)
30063467 {
....@@ -3049,6 +3510,9 @@
30493510 }
30503511
30513512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
30523516 //Globals.theRenderer.object = group;
30533517 if(!useclient)
30543518 {
....@@ -3064,20 +3528,44 @@
30643528 frontView.object = group;
30653529 sideView.object = group;
30663530 }
3067
- group.editWindow = this;
3531
+
3532
+// fix "+" issue
3533
+ //group.editWindow = this;
3534
+ group.manipWindow = this;
3535
+
30683536 /*
30693537 currentLayout = radio.layout;
30703538 if (currentLayout == null)
30713539 currentLayout = sevenButton;
30723540 */
30733541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
30743547 keepparent = group.parent;
30753548 // PARENT = NULL or not???
30763549 //group.parent = null; // ROOT
30773550 //group.attributes = -1;
30783551 ResetModel();
3552
+
3553
+ cameraView.requestFocusInWindow();
30793554 refreshContents(true);
3080
- }
3555
+ } else if (event.getSource() == editCameraItem)
3556
+ {
3557
+ cameraView.ProtectCamera();
3558
+ cameraView.repaint();
3559
+ return;
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3561
+ {
3562
+ cameraView.RevertCamera();
3563
+ cameraView.repaint();
3564
+ return;
3565
+ // } else if (event.getSource() == textureButton)
3566
+ // {
3567
+ // return; // true;
3568
+ }
30813569 else
30823570 {
30833571 //return super.action(event, arg);
....@@ -3086,7 +3574,6 @@
30863574 }
30873575
30883576 boolean useclient = false;
3089
- cRadio radio;
30903577
30913578 void ToggleRoot()
30923579 {
....@@ -3138,6 +3625,28 @@
31383625 refreshContents();
31393626 }
31403627
3628
+ void TransformChildren()
3629
+ {
3630
+ Object3D obj;
3631
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3632
+ {
3633
+ obj = (Object3D)e.nextElement();
3634
+ obj.KeepTextureMatrices();
3635
+ obj.TransformChildren();
3636
+ obj.RestoreTextureMatrices();
3637
+
3638
+// if (obj.parent == null)
3639
+// {
3640
+// System.out.println("NULL PARENT!");
3641
+// new Exception().printStackTrace();
3642
+// }
3643
+// else
3644
+// TouchTransform(obj);
3645
+// //obj.parent.Touch();
3646
+ }
3647
+
3648
+ refreshContents();
3649
+ }
31413650
31423651 void ResetTransform()
31433652 {
....@@ -3250,7 +3759,7 @@
32503759 refreshContents();
32513760 }
32523761
3253
- void ResetCentroid()
3762
+ void ResetCentroid(boolean full)
32543763 {
32553764 Object3D obj;
32563765 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3265,12 +3774,16 @@
32653774 LA.matIdentity(Object3D.mat);
32663775 obj.getBounds(minima, maxima, false);
32673776 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3268
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3777
+ if (full)
3778
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32693779 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32703780 obj.TransformMesh(Object3D.mat);
3781
+
32713782 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3272
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3783
+ if (full)
3784
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32733785 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3786
+
32743787 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32753788 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32763789 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3299,7 +3812,8 @@
32993812
33003813 int size = obj.MemorySize();
33013814
3302
- System.err.println((size/1024) + " KB is the size of " + obj);
3815
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3816
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33033817 }
33043818 }
33053819 catch (Exception e)
....@@ -3336,9 +3850,9 @@
33363850 obj = (Object3D)e.nextElement();
33373851
33383852 System.out.println("Object is: " + obj);
3339
- GrafreeD.AnalyzeObject(obj);
3853
+ Grafreed.AnalyzeObject(obj);
33403854 System.out.println("Boundary rep: " + obj.bRep);
3341
- GrafreeD.AnalyzeObject(obj.bRep);
3855
+ Grafreed.AnalyzeObject(obj.bRep);
33423856
33433857 // System.err.println((size/1024) + " KB is the size of " + obj);
33443858 }
....@@ -3380,6 +3894,13 @@
33803894 void GenNormals(boolean crease)
33813895 {
33823896 group.GenNormalsS(crease);
3897
+
3898
+ refreshContents();
3899
+ }
3900
+
3901
+ void GenNormalsMESH()
3902
+ {
3903
+ group.GenNormalsMeshS();
33833904
33843905 refreshContents();
33853906 }
....@@ -3552,8 +4073,8 @@
35524073
35534074 void ParseVertices()
35544075 {
3555
- boolean epsequal = GrafreeD.epsequal;
3556
- GrafreeD.epsequal = true;
4076
+ boolean epsequal = Grafreed.epsequal;
4077
+ Grafreed.epsequal = true;
35574078
35584079 for (int i=0; i<group.selection.size(); i++)
35594080 {
....@@ -3578,7 +4099,7 @@
35784099 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35794100 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35804101
3581
- g.add(GrafreeD.clipboard);
4102
+ g.add(Grafreed.clipboard);
35824103
35834104 buffer.add(g);
35844105 }
....@@ -3593,7 +4114,7 @@
35934114 makeSomething(buffer, i==group.selection.size()-1);
35944115 }
35954116
3596
- GrafreeD.epsequal = epsequal;
4117
+ Grafreed.epsequal = epsequal;
35974118
35984119 refreshContents();
35994120 }
....@@ -3611,7 +4132,16 @@
36114132 String pigment = Object3D.GetPigment(tex);
36124133 //String bump = Object3D.GetBump(tex);
36134134
3614
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4135
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4136
+
4137
+ try
4138
+ {
4139
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4140
+ }
4141
+ catch (Exception e)
4142
+ {
4143
+ System.err.println("FAIL: " + node);
4144
+ }
36154145
36164146 double s = v.s;
36174147
....@@ -3743,7 +4273,7 @@
37434273 return;
37444274
37454275 Object3D poses = group.selection.get(0);
3746
- Object3D ref = GrafreeD.clipboard.get(0);
4276
+ Object3D ref = Grafreed.clipboard.get(0);
37474277
37484278 Object3D newgroup = new Object3D("Po:" + poses.name);
37494279
....@@ -3937,9 +4467,9 @@
39374467
39384468 void ClipMesh()
39394469 {
3940
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4470
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39414471 {
3942
- Object3D content = GrafreeD.clipboard.get(0);
4472
+ Object3D content = Grafreed.clipboard.get(0);
39434473
39444474 if (content instanceof cGroup && ((cGroup)content).transientlink )
39454475 content = ((cGroup)content).get(0);
....@@ -3948,7 +4478,7 @@
39484478 // {
39494479 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39504480 // }
3951
- group.selection.ClipMesh(GrafreeD.clipboard);
4481
+ group.selection.ClipMesh(Grafreed.clipboard);
39524482 }
39534483 // group.selection.ClipMesh(GrafreeD.clipboard);
39544484 System.out.println("DONE.");
....@@ -3995,6 +4525,18 @@
39954525 void MarkLeaves(boolean hide)
39964526 {
39974527 group.selection.MarkLeaves(hide);
4528
+ refreshContents();
4529
+ }
4530
+
4531
+ void RewindLeaves(boolean hide)
4532
+ {
4533
+ group.selection.RewindLeaves(hide);
4534
+ refreshContents();
4535
+ }
4536
+
4537
+ void RandomLeaves(boolean hide)
4538
+ {
4539
+ group.selection.RandomLeaves(hide);
39984540 refreshContents();
39994541 }
40004542
....@@ -4069,10 +4611,6 @@
40694611 // }
40704612 // }
40714613
4072
- static boolean allparams = true;
4073
-
4074
- static Vector<Object3D> listUI = new Vector<Object3D>();
4075
-
40764614 void EditSelection(boolean newWindow)
40774615 {
40784616 // aConstraints.gridy = 0;
....@@ -4080,10 +4618,10 @@
40804618 {
40814619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40824620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4083
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40844622
40854623 Object3D elem = (Object3D)group.selection.elementAt(i);
4086
- if(elem != group)
4624
+ if(elem != group || !newWindow)
40874625 {
40884626 // if (!(elem instanceof Composite))
40894627 // newWindow = false;
....@@ -4165,7 +4703,8 @@
41654703 //new Exception().printStackTrace();
41664704
41674705 freezemodel = true;
4168
-
4706
+ ClearUnpinned();
4707
+
41694708 /**/
41704709 //switch (event.id)
41714710 {
....@@ -4173,7 +4712,6 @@
41734712 //case 702: // Event.LIST_DESELECT
41744713 group.deselectAll();
41754714 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4176
- objEditor.ClearInfo(); // .GetMaterial());
41774715 if (tps != null)
41784716 {
41794717 for (int i=0; i < tps.length; i++)
....@@ -4182,10 +4720,8 @@
41824720
41834721 //if (child.parent != null)
41844722 //child.parent.addSelectee(child);
4723
+ objEditor.SetMaterial(child);
41854724 group.addSelectee(child);
4186
- objEditor.SetMaterial(child); // .GetMaterial());
4187
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4188
- System.err.println("info : " + child.GetPath());
41894725 }
41904726 }
41914727 // else
....@@ -4195,20 +4731,28 @@
41954731 // System.err.println("info : " + group.GetPath());
41964732 // }
41974733
4198
- objEditor.SetText(); // jan 2014
4199
-
4200
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4734
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42014735 CameraPane.flash = true;
42024736
4203
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4737
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42044738 // a camera
42054739 {
4206
- CameraPane.camerachangeframe = 0; // don't refuse it
4207
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4741
+ {
4742
+ CameraPane.camerachangeframe = 0; // don't refuse it
4743
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4744
+ }
42084745 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42094746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42104747 }
42114748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
42124756 refreshContents();
42134757 //return true;
42144758 }
....@@ -4217,6 +4761,35 @@
42174761
42184762 freezemodel = false;
42194763 }
4764
+
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
4773
+ void refreshContents(boolean cp)
4774
+ {
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4777
+ {
4778
+ objEditor.ClearInfo(); // .GetMaterial());
4779
+
4780
+ for (int i=0; i < group.selection.Size(); i++)
4781
+ {
4782
+ Object3D child = (Object3D) group.selection.get(i);
4783
+
4784
+ objEditor.AddInfo(child, this, true);
4785
+ System.err.println("info : " + child.GetPath());
4786
+ }
4787
+
4788
+ objEditor.SetText(); // jan 2014
4789
+ }
4790
+
4791
+ super.refreshContents(cp);
4792
+ }
42204793
42214794 void linkSomething(Object3D thing)
42224795 {
....@@ -4288,16 +4861,19 @@
42884861 {
42894862 if (group.selection.isEmpty())
42904863 return;
4291
- GrafreeD.clipboardIsTempGroup = false;
4864
+
4865
+ Grafreed.clipboardIsTempGroup = false;
42924866 Composite tGroup = null;
42934867 if (group.selection.size() > 0) // 1)
42944868 {
42954869 tGroup = new cGroup();
4296
- GrafreeD.clipboardIsTempGroup = true;
4870
+ Grafreed.clipboardIsTempGroup = true;
42974871 }
42984872
42994873 if (cut)
43004874 {
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
43014877 //int indices[] = jList.getSelectedIndices();
43024878 //for (int i = indices.length - 1; i >= 0; i--)
43034879 //jList.remove(indices[i]);
....@@ -4333,16 +4909,16 @@
43334909 //System.out.println("cut " + child);
43344910 //System.out.println("parent = " + child.parent);
43354911 // tmp.addChild(child);
4336
- if (GrafreeD.clipboardIsTempGroup)
4912
+ if (Grafreed.clipboardIsTempGroup)
43374913 tGroup.add/*Child*/(tmp);
43384914 else
4339
- GrafreeD.clipboard = tmp;
4915
+ Grafreed.clipboard = tmp;
43404916 }
43414917 else
4342
- if (GrafreeD.clipboardIsTempGroup)
4918
+ if (Grafreed.clipboardIsTempGroup)
43434919 tGroup.add/*Child*/(child);
43444920 else
4345
- GrafreeD.clipboard = child;
4921
+ Grafreed.clipboard = child;
43464922 }
43474923
43484924 //ResetModel();
....@@ -4374,21 +4950,23 @@
43744950 //System.out.println("cut " + elem);
43754951 //System.out.println("parent = " + elem.parent);
43764952 // tmp.addChild(elem);
4377
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
43784954 tGroup.add/*Child*/(tmp);
43794955 else
4380
- GrafreeD.clipboard = tmp;
4956
+ Grafreed.clipboard = tmp;
43814957 }
43824958 else
4383
- if (GrafreeD.clipboardIsTempGroup)
4959
+ if (Grafreed.clipboardIsTempGroup)
43844960 tGroup.add/*Child*/(child);
43854961 else
4386
- GrafreeD.clipboard = child;
4962
+ Grafreed.clipboard = child;
43874963 }
43884964
43894965 }
4390
- if (GrafreeD.clipboardIsTempGroup)
4391
- GrafreeD.clipboard = tGroup;
4966
+
4967
+ if (Grafreed.clipboardIsTempGroup)
4968
+ Grafreed.clipboard = tGroup;
4969
+
43924970 if (cut)
43934971 {
43944972 ResetModel();
....@@ -4398,11 +4976,15 @@
43984976
43994977 void paste(boolean expand)
44004978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
44014983 // if (GrafreeD.clipboard == null)
44024984 // return;
44034985 boolean first = true;
44044986
4405
- if (GrafreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
44064988 {
44074989 Composite temp;
44084990
....@@ -4413,7 +4995,7 @@
44134995 temp = (Composite)Applet3D.clipboard.deepCopy();
44144996 */
44154997 Object3D elem;
4416
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4998
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44174999 {
44185000 Object3D child = (Object3D)e.nextElement();
44195001
....@@ -4447,16 +5029,17 @@
44475029 //Object3D cb = Applet3D.clipboard;
44485030 //temp.addChild(cb);
44495031 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4450
- assert(GrafreeD.clipboard.parent == null);
4451
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4452
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4453
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4454
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5032
+ assert(Grafreed.clipboard.parent == null);
5033
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5034
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5035
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5036
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44555037 else
4456
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4457
- GrafreeD.clipboard.get(0).parent = keepparent;
5038
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5039
+ Grafreed.clipboard.get(0).parent = keepparent;
44585040 }
44595041
5042
+ Globals.REPLACEONMAKE = keep;
44605043 ResetModel();
44615044 refreshContents();
44625045 }
....@@ -4503,9 +5086,9 @@
45035086 {
45045087 boolean first = true;
45055088
4506
- if (GrafreeD.clipboardIsTempGroup)
5089
+ if (Grafreed.clipboardIsTempGroup)
45075090 {
4508
- Composite temp = (Composite)GrafreeD.clipboard;
5091
+ Composite temp = (Composite)Grafreed.clipboard;
45095092 Object3D copy;
45105093 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45115094 {
....@@ -4515,7 +5098,7 @@
45155098 }
45165099 } else
45175100 {
4518
- linkSomething(GrafreeD.clipboard); //.get(0));
5101
+ linkSomething(Grafreed.clipboard); //.get(0));
45195102 }
45205103 }
45215104 }
....@@ -4592,6 +5175,10 @@
45925175
45935176 void group(Object3D csg, boolean grab)
45945177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
45955182 if (//false) // why??
45965183 !group.selection.isEmpty())
45975184 {
....@@ -4705,10 +5292,15 @@
47055292 //node.add(csg);
47065293 //makeSomething(node);
47075294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
47085296 }
47095297
47105298 void Ungroup(Object3D g)
47115299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
47125304 if (g instanceof HiddenObject)
47135305 {
47145306 HiddenObject h = (HiddenObject) g;
....@@ -4725,6 +5317,7 @@
47255317 objEditor.makeSomething(g.get(i), false);
47265318 }
47275319 }
5320
+ Globals.REPLACEONMAKE = keep;
47285321 }
47295322
47305323 void ungroup()
....@@ -4920,21 +5513,6 @@
49205513 }
49215514 */
49225515
4923
- void ImportGFD()
4924
- {
4925
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4926
- browser.show();
4927
- String filename = browser.getFile();
4928
- if (filename != null && filename.length() > 0)
4929
- {
4930
- String fullname = browser.getDirectory() + filename;
4931
-
4932
- //Object3D readobj =
4933
- objEditor.ReadGFD(fullname, objEditor);
4934
- //makeSomething(readobj);
4935
- }
4936
- }
4937
-
49385516 /*
49395517 public void Callback(Object obj)
49405518 {
....@@ -4958,26 +5536,9 @@
49585536 }
49595537 */
49605538
4961
- void ImportVRMLX3D()
4962
- {
4963
- if (GrafreeD.standAlone)
4964
- {
4965
- /**/
4966
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4967
- browser.show();
4968
- String filename = browser.getFile();
4969
- if (filename != null && filename.length() > 0)
4970
- {
4971
- String fullname = browser.getDirectory() + filename;
4972
- LoadVRMLX3D(fullname);
4973
- }
4974
- /**/
4975
- }
4976
- }
4977
-
49785539 String GetFile(String dialogName)
49795540 {
4980
- if (GrafreeD.standAlone)
5541
+ if (Grafreed.standAlone)
49815542 {
49825543 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49835544 browser.show();
....@@ -5045,7 +5606,28 @@
50455606 cButton clearpanelButton;
50465607 cButton unselectButton;
50475608
5609
+ cButton restoreCameraButton;
5610
+
5611
+ cButton saveButton;
50485612 cButton oneStepButton;
5613
+
5614
+ cButton groupButton;
5615
+ cButton ungroupButton;
5616
+ cButton compositeButton;
5617
+ cButton switchButton;
5618
+ cButton loopButton;
5619
+ cButton textureButton;
5620
+
5621
+ cButton gridButton;
5622
+ cButton boxButton;
5623
+ cButton sphereButton;
5624
+ cButton coneButton;
5625
+ cButton torusButton;
5626
+ cButton superButton;
5627
+ cButton kleinButton;
5628
+ cButton particlesButton;
5629
+ cButton overlayButton;
5630
+ cButton lightButton;
50495631
50505632 cButton screenfitButton;
50515633 cButton screenfitpointButton;
....@@ -5058,14 +5640,6 @@
50585640
50595641 cButton setsupportButton;
50605642
5061
- cButton twoButton;
5062
- cButton sixButton;
5063
- cButton threeButton;
5064
- cButton sevenButton;
5065
- cButton fourButton; // full panel
5066
- cButton oneButton; // full XYZ
5067
- //cButton currentLayout;
5068
-
50695643 //
50705644 //Composite
50715645 Object3D // to do !!
....@@ -5075,9 +5649,11 @@
50755649 //JTree jTree;
50765650 private MenuItem lookAtItem;
50775651 private MenuItem lookFromItem;
5078
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
50795653 private MenuItem cutItem;
5080
- private MenuItem duplicateItem;
5654
+ private MenuItem undoItem;
5655
+ private MenuItem redoItem;
5656
+ private JMenuItem duplicateItem;
50815657 private MenuItem cloneItem;
50825658 private MenuItem cloneSupportItem;
50835659 private MenuItem overwriteGeoItem;
....@@ -5090,7 +5666,7 @@
50905666 private MenuItem linkverticesItem;
50915667 private MenuItem relinkverticesItem;
50925668 private MenuItem setMasterItem;
5093
- private MenuItem resetMeshItem;
5669
+ private MenuItem resetAllItem;
50945670 private MenuItem stepAllItem;
50955671 private MenuItem revertMeshItem;
50965672 private MenuItem poseMeshItem;
....@@ -5140,6 +5716,10 @@
51405716 private MenuItem showleavesItem;
51415717 private MenuItem markleavesItem;
51425718 private MenuItem unmarkleavesItem;
5719
+ private MenuItem rewindleavesItem;
5720
+ private MenuItem unrewindleavesItem;
5721
+ private MenuItem randomleavesItem;
5722
+ private MenuItem unrandomleavesItem;
51435723
51445724 private MenuItem flipVItem;
51455725 private MenuItem unflipVItem;
....@@ -5151,15 +5731,17 @@
51515731 private MenuItem panoTexturesItem;
51525732
51535733 private MenuItem resetCentroidItem;
5154
- private MenuItem transformgeometryItem;
5734
+ private MenuItem resetCentroidXZItem;
51555735 private MenuItem resetTransformItem;
5736
+ private MenuItem transformGeometryItem;
5737
+ private MenuItem transformChildrenItem;
51565738 private MenuItem hideItem;
51575739 private MenuItem grabItem;
51585740 private MenuItem backItem;
51595741 private MenuItem frontItem;
51605742 private MenuItem cameraItem;
51615743 private MenuItem compositeItem;
5162
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
51635745 private MenuItem physicsItem;
51645746 private MenuItem frameselectorItem;
51655747 private MenuItem scriptNodeItem;
....@@ -5221,11 +5803,6 @@
52215803 private MenuItem doubleItem;
52225804 private MenuItem tripleItem;
52235805
5224
- private MenuItem importGFDItem;
5225
- private MenuItem importVRMLX3DItem;
5226
- private MenuItem import3DSItem;
5227
- private MenuItem importOBJItem;
5228
-
52295806 private MenuItem computeAOItem;
52305807 private MenuItem recompileItem;
52315808 private MenuItem editScriptItem;
....@@ -5235,4 +5812,8 @@
52355812 private MenuItem analyzeItem;
52365813 private MenuItem dumpItem;
52375814 //boolean freezemodel = false;
5815
+
5816
+ Menu cameraMenu;
5817
+ MenuItem editCameraItem;
5818
+ MenuItem restoreCameraItem;
52385819 }