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,38 +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
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
443
- importGFDItem.addActionListener(this);
444
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
445
- importVRMLX3DItem.addActionListener(this);
446
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
447
- importOBJItem.addActionListener(this);
448
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
449
- import3DSItem.addActionListener(this);
450
-
451543 oe.menuBar.add(menu = new Menu("Tools"));
452544 buildToolsMenu(menu);
453545 }
454546
547
+
455548 void SetupUI2(ObjEditor oe)
456549 {
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
+
457562 //new Exception().printStackTrace();
458563
459564 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -482,97 +587,229 @@
482587 oe.radioPanel.add(dummyButton);
483588 oe.buttonGroup.add(dummyButton);
484589 */
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
593
+
485594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
486595
487
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
488
- 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");
489648 liveCB.addItemListener(this);
490649
491
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492651 oneStepButton.setToolTipText("Animate one step forward");
493652 oneStepButton.addActionListener(this);
494653
495
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
496655 fastCB.setToolTipText("Fast mode");
497656 fastCB.addItemListener(this);
498657
499
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
500
- trackCB.setToolTipText("Enable tracking");
501
- trackCB.addItemListener(this);
502
-
503
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
504
- screenfitButton.setToolTipText("Screen fit");
505
- 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);
506663
507664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
508665 // screenfitpointButton.addActionListener(this);
509666
510667 if (Globals.ADVANCED)
511668 {
512
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
669
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
513670 snapobjectButton.addActionListener(this);
514671 snapobjectButton.setToolTipText("Snap Object");
515672 }
516673
517
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
518
- flashSelectionButton.setToolTipText("Show selection");
519
- flashSelectionButton.addActionListener(this);
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
520675
521
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
522
-
523
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
524677 twoButton.setToolTipText("Show center view only");
525678 twoButton.addActionListener(this);
526
- 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);
527682 fourButton.addActionListener(this);
528683 fourButton.setToolTipText("Show left panel only");
529
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530685 sixButton.setToolTipText("2-column layout left");
531686 sixButton.addActionListener(this);
532
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
533688 threeButton.setToolTipText("2-column layout right");
534689 threeButton.addActionListener(this);
535
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
536691 sevenButton.setToolTipText("3-column layout");
537692 sevenButton.addActionListener(this);
538693 //
539694
540
- 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);
541696 rootButton.setToolTipText("Edit selection in new tab");
542697 rootButton.addActionListener(this);
543698
544
- 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);
545700 closeButton.setToolTipText("Close tab");
546701 closeButton.addActionListener(this);
547702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
548703 //clearButton.addActionListener(this);
549
-
550
- 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
+ }
551736
552
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
553
- 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");
554786 editButton.addActionListener(this);
555787
556
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
557
- uneditButton.setToolTipText("Unedit selection");
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
558790 uneditButton.addActionListener(this);
559791
560
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
561
- allParamsButton.setToolTipText("Edit all params");
792
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
793
+ allParamsButton.setToolTipText("Show all controle");
562794 allParamsButton.addActionListener(this);
563795
564
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
796
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565797 clearPanelButton.setToolTipText("Clear edit panel");
566798 clearPanelButton.addActionListener(this);
567799
568
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
800
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569801 unselectButton.setToolTipText("Unselect");
570802 unselectButton.addActionListener(this);
571803
572
- 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);
573807
574
- oe.treePanel.add(commandsPanel);
575
- oe.treePanel.Return();
808
+ editCommandsPanel.preferredHeight = 1;
809
+
810
+ SetPinStates(false);
811
+// oe.treePanel.add(commandsPanel);
812
+// oe.treePanel.Return();
576813
577814 // oe.aConstraints.gridx += 1;
578815 // oe.aConstraints.weighty = 0;
....@@ -589,29 +826,17 @@
589826
590827 JScrollPane jSP;
591828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
592
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
593830 ResetModel();
594831
595832 oe.treePanel.add(jSPPanel);
596833 oe.treePanel.Return();
597834
598
- cGridBag copyOptionsPanel = new cGridBag();
599
-
600
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
601
- colorCB.setToolTipText("Copy color when dropped");
602
- colorCB.addItemListener(this);
603
-
604
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
605
- materialCB.setToolTipText("Copy material when dropped");
606
- materialCB.addItemListener(this);
607
-
608
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
609
- textureCB.setToolTipText("Copy texture when dropped");
610
- textureCB.addItemListener(this);
611
-
612
- copyOptionsPanel.preferredHeight = 1;
613835 oe.treePanel.add(copyOptionsPanel);
614836 oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
615840
616841 // mainPanel.setDividerLocation(0.5); //1.0);
617842 // mainPanel.setResizeWeight(0.5);
....@@ -640,23 +865,43 @@
640865
641866 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
642867 {
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
+
643882 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
644883 boxCB.setToolTipText("Display bounding boxes");
645884 boxCB.addItemListener(this);
646885
647886 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
648
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
649888 zoomBoxCB.addItemListener(this);
650889
651
- if (Globals.ADVANCED)
890
+ if (true) // Globals.ADVANCED)
652891 {
653
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
654
- supportCB.setToolTipText("Enable rigging");
655
- 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);
656899
657900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
658901 // localCB.addItemListener(this);
659902
903
+ panel.Return();
904
+
660905 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
661906 crowdCB.setToolTipText("Used for crowds");
662907 crowdCB.addItemListener(this);
....@@ -673,6 +918,8 @@
673918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
674919 // speakerMocapCB.addItemListener(this);
675920
921
+ panel.Return();
922
+
676923 if (false)
677924 {
678925 // handled in scripts
....@@ -687,32 +934,72 @@
687934 //constraints.gridy += 1;
688935 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
689936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
690938 }
691939
692940 //constraints.gridx += 1;
693941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
694942 // debugCB.addItemListener(this);
695943
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
696948 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
949
+ oeilCB.setToolTipText("Move camera when tracking");
697950 oeilCB.addItemListener(this);
698951
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
+ {
699972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
700973 lookAtCB.setToolTipText("Look-at target");
701974 lookAtCB.addItemListener(this);
975
+ }
702976
703977 }
704978
705979 cGridBag fill = new cGridBag();
706
-
707980 fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
708985
709986 panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
710989
711990 }
712991
713992 void EditObject(Object3D obj)
714993 {
715994 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
+
7161003 radioButton.SetObject(obj);
7171004 radioButton.layout = sevenButton;
7181005 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -721,8 +1008,11 @@
7211008 buttonGroup.add(radioButton);
7221009 radioButton.doClick();
7231010 }
1011
+
7241012 void SetupViews(ObjEditor oe)
7251013 {
1014
+ theFrame = this;
1015
+
7261016 oe.SetupViews();
7271017
7281018 System.out.println("SetupViews");
....@@ -731,23 +1021,28 @@
7311021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7321022 }
7331023
734
- JCheckBox liveCB;
735
- JCheckBox supportCB;
736
- JCheckBox localCB;
737
- JCheckBox crowdCB;
738
- JCheckBox smoothCB;
739
- JCheckBox fastCB;
740
- JCheckBox slowCB;
741
- JCheckBox boxCB;
742
- JCheckBox zoomBoxCB;
743
- JCheckBox trackCB;
744
- 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;
7451037 // JCheckBox speakerMocapCB;
746
- JCheckBox speakerCameraCB;
747
- JCheckBox speakerFocusCB;
748
- JCheckBox debugCB;
749
- JCheckBox oeilCB;
750
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
7511046
7521047 // static int COLOR = 1;
7531048 // static int MATERIAL = 2;
....@@ -755,9 +1050,9 @@
7551050
7561051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7571052
758
- JCheckBox colorCB;
759
- JCheckBox materialCB;
760
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
7611056
7621057 public void itemStateChanged(ItemEvent e)
7631058 {
....@@ -785,6 +1080,7 @@
7851080 } else if(e.getSource() == liveCB)
7861081 {
7871082 cameraView.ToggleLive();
1083
+ refreshContents(false);
7881084 }
7891085 else if(e.getSource() == supportCB)
7901086 {
....@@ -849,6 +1145,18 @@
8491145 {
8501146 cameraView.ToggleOeil();
8511147 }
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
+ }
8521160 else if(e.getSource() == lookAtCB)
8531161 {
8541162 cameraView.ToggleLookAt();
....@@ -865,7 +1173,8 @@
8651173
8661174 /**/
8671175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
868
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
8691178 if ((path == null) || (path.getPathCount() <= 1)) {
8701179 // We can't move the root node or an empty selection
8711180 return;
....@@ -928,8 +1237,6 @@
9281237 }
9291238 }
9301239
931
- String string = (String) object;
932
-
9331240 System.out.println("Transfer = " + object + "; drop : " + target);
9341241 // if( object instanceof java.io.File[])
9351242 // {
....@@ -937,7 +1244,11 @@
9371244 // objEditor.DropFile((java.io.File[]) object, true);
9381245 // return;
9391246 // }
940
- 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) == ':')
9411252 {
9421253 // file(s)
9431254 String[] names = string.split("\n");
....@@ -964,7 +1275,7 @@
9641275
9651276 flashIt = false;
9661277 CameraPane pane = (CameraPane) target;
967
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1278
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9681279 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9691280
9701281 if (group.selection.size() == 1)
....@@ -980,23 +1291,33 @@
9801291
9811292 assert target == objEditor.jTree;
9821293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
9831295 try {
984
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9851297 } catch (Exception e) {
9861298 System.out.println("destinationPath : " + destinationPath);
9871299 return;
9881300 }
9891301
990
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
9911303 {
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
+// {
9921313 loadClipboard(true);
9931314 objEditor.jTree.setSelectionPath(destinationPath);
9941315 pasteInto(false, false);
995
- } else {
996
- loadClipboard(false);
997
- objEditor.jTree.setSelectionPath(destinationPath);
998
- pasteInto(false, false); // true); // ???
999
- }
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
10001321 }
10011322 public void dropActionChanged(DropTargetDragEvent dtde)
10021323 // Called if the user has modified the current drop gesture
....@@ -1101,22 +1422,30 @@
11011422 {
11021423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11031424 //heightFieldItem.addActionListener(this);
1104
- gridItem = menu.add(new MenuItem("Grid"));
1105
- gridItem.addActionListener(this);
1106
- rectoidItem = menu.add(new MenuItem("Box"));
1107
- rectoidItem.addActionListener(this);
1108
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1109
- ellipsoidItem.addActionListener(this);
1110
- coneItem = menu.add(new MenuItem("Cone"));
1111
- coneItem.addActionListener(this);
1112
- torusItem = menu.add(new MenuItem("Torus"));
1113
- torusItem.addActionListener(this);
1114
- superItem = menu.add(new MenuItem("Superellipsoid"));
1115
- 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
+ {
11161443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11171444 kleinItem.addActionListener(this);
1118
- particleItem = menu.add(new MenuItem("Particle system"));
1119
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
11201449 if (Globals.ADVANCED)
11211450 {
11221451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1142,15 +1471,15 @@
11421471 }
11431472 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11441473 bezierItem.addActionListener(this);
1145
- overlayItem = menu.add(new MenuItem("Overlay"));
1146
- overlayItem.addActionListener(this);
1147
- lightItem = menu.add(new MenuItem("Light"));
1148
- 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);
11491478 menu.add("-");
11501479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11511480 //superLoopItem.addActionListener(this);
1152
- loopItem = menu.add(new MenuItem("Loop"));
1153
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
11541483 doubleItem = menu.add(new MenuItem("Fork"));
11551484 doubleItem.addActionListener(this);
11561485 if (Globals.ADVANCED)
....@@ -1166,6 +1495,9 @@
11661495 animationItem.addItemListener(this);
11671496 animationItem.setState(Globals.ANIMATION);
11681497
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
1500
+
11691501 menu.add("-");
11701502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11711503 parseverticesItem.addActionListener(this);
....@@ -1178,6 +1510,8 @@
11781510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11791511 reduce34MorphItem.addActionListener(this);
11801512 menu.add("-");
1513
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1514
+ memoryItem.addActionListener(this);
11811515 menu.add(computeAOItem = new MenuItem("Compute AO"));
11821516 computeAOItem.addActionListener(this);
11831517
....@@ -1186,11 +1520,9 @@
11861520 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11871521 mirrorItem.addActionListener(this);
11881522 menu.add("-");
1189
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1190
- memoryItem.addActionListener(this);
11911523 menu.add(analyzeItem = new MenuItem("Analyze"));
11921524 analyzeItem.addActionListener(this);
1193
- menu.add(dumpItem = new MenuItem("Dump"));
1525
+ menu.add(dumpItem = new MenuItem("Print"));
11941526 dumpItem.addActionListener(this);
11951527 // menu.add(pathItem = new MenuItem("From-to path"));
11961528 // pathItem.addActionListener(this);
....@@ -1331,9 +1663,24 @@
13311663 shadow.material = new cMaterial(obj.material);
13321664 shadow.material.diffuse = 0.0001f;
13331665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
13341667
13351668 makeSomething(shadow);
13361669 }
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
+ }
13371684
13381685 /**
13391686 * applyExample
....@@ -1537,9 +1884,9 @@
15371884
15381885 void Overwrite(int mask)
15391886 {
1540
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1887
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15411888 {
1542
- Object3D content = GrafreeD.clipboard.get(0);
1889
+ Object3D content = Grafreed.clipboard.get(0);
15431890
15441891 if (content instanceof cGroup && ((cGroup)content).transientlink )
15451892 content = ((cGroup)content).get(0);
....@@ -1578,7 +1925,7 @@
15781925 {
15791926 ScreenFit();
15801927 } else
1581
- if (source == switchItem)
1928
+ if (source == switchViewItem)
15821929 {
15831930 cVector v1 = new cVector();
15841931 cVector v2 = new cVector();
....@@ -1587,11 +1934,11 @@
15871934 objEditor.cameraView.renderCamera.setAim(v2, v1);
15881935 objEditor.cameraView.repaint();
15891936 } else
1590
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
15911938 {
15921939 makeSomething(new Box());
15931940 } else
1594
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
15951942 {
15961943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15971944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1670,27 +2017,27 @@
16702017
16712018 makeSomething(obj);
16722019 } else
1673
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
16742021 {
16752022 makeSomething(new Grid());
16762023 } else
1677
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
16782025 {
16792026 makeSomething(new Sphere());
16802027 } else
1681
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
16822029 {
16832030 makeSomething(new Cone());
16842031 } else
1685
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
16862033 {
16872034 makeSomething(new Torus());
16882035 } else
1689
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
16902037 {
16912038 makeSomething(new Superellipsoid());
16922039 } else
1693
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
16942041 {
16952042 makeSomething(new Klein());
16962043 } else
....@@ -1710,7 +2057,7 @@
17102057 {
17112058 makeSomething(new BezierSurface());
17122059 } else
1713
- if (source == overlayItem)
2060
+ if (source == overlayItem || source == overlayButton)
17142061 {
17152062 /*
17162063 Object3D obj = new BezierSurface(5,8);
....@@ -1758,7 +2105,7 @@
17582105 s.setup();
17592106 makeSomething(s);
17602107 } else
1761
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
17622109 {
17632110 makeSomething(new Light());
17642111 } else
....@@ -1808,30 +2155,30 @@
18082155
18092156 group(g);
18102157 } else
1811
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
18122159 {
18132160 Composite csg = new GroupLeaf();
18142161 csg.count = 5;
18152162 group(csg);
1816
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
18172164 csg.addChild(child);
18182165 child.addChild(csg);
18192166 } else
18202167 if (source == doubleItem)
18212168 {
1822
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
18232170 csg.count = 5;
18242171 group(csg);
1825
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
18262173 csg.addChild(child);
18272174 child.addChild(csg);
1828
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
18292176 csg.addChild(child);
18302177 child.addChild(csg);
18312178 } else
18322179 if (source == tripleItem)
18332180 {
1834
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
18352182 csg.count = 4;
18362183 group(csg);
18372184 Composite child = new cGroup();
....@@ -1843,23 +2190,6 @@
18432190 child = new cGroup();
18442191 csg.addChild(child);
18452192 child.addChild(csg);
1846
- } else
1847
-
1848
- if (source == importGFDItem)
1849
- {
1850
- ImportGFD();
1851
- } else
1852
- if (source == importVRMLX3DItem)
1853
- {
1854
- ImportVRMLX3D();
1855
- } else
1856
- if (source == import3DSItem)
1857
- {
1858
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1859
- } else
1860
- if (source == importOBJItem)
1861
- {
1862
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
18632193 } else
18642194 if (source == computeAOItem)
18652195 {
....@@ -1879,7 +2209,7 @@
18792209 if (source == invariantsItem)
18802210 {
18812211 System.out.println("Invariants:");
1882
- GrafreeD.grafreeD.universe.invariants();
2212
+ Grafreed.grafreeD.universe.invariants();
18832213 } else
18842214 if (source == memoryItem)
18852215 {
....@@ -1898,6 +2228,46 @@
18982228 {
18992229 DumpObject();
19002230 } 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
19012271 if (source == oneStepButton)
19022272 {
19032273 Globals.ONESTEP = true;
....@@ -1905,17 +2275,14 @@
19052275 } else
19062276 if (source == screenfitButton)
19072277 {
1908
- //Reload(lastConverter, lastFilename, true);
19092278 ScreenFit();
19102279 } else
19112280 if (source == screenfitpointButton)
19122281 {
1913
- //Reload(lastConverter, lastFilename, true);
19142282 ScreenFitPoint();
19152283 } else
19162284 if (source == snapobjectButton)
19172285 {
1918
- //Reload(lastConverter, lastFilename, true);
19192286 SnapObject();
19202287 } else
19212288 // if (event.getSource() == recompileButton)
....@@ -1952,12 +2319,20 @@
19522319 {
19532320 loadClipboard(true);
19542321 } else
2322
+ if (source == undoItem)
2323
+ {
2324
+ Undo();
2325
+ } else
2326
+ if (source == redoItem)
2327
+ {
2328
+ Redo();
2329
+ } else
19552330 if (source == duplicateItem)
19562331 {
1957
- Object3D keep = GrafreeD.clipboard;
2332
+ Object3D keep = Grafreed.clipboard;
19582333 loadClipboard(false);
19592334 paste(false);
1960
- GrafreeD.clipboard = keep;
2335
+ Grafreed.clipboard = keep;
19612336 } else
19622337 if (source == cloneItem)
19632338 {
....@@ -2177,9 +2552,9 @@
21772552 // group.selection.get(0).setMasterThis(content); // should be identity
21782553 // refreshContents();
21792554 // }
2180
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2555
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21812556 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2557
+ Object3D content = Grafreed.clipboard.get(0);
21832558
21842559 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852560 content = ((cGroup)content).get(0);
....@@ -2229,9 +2604,9 @@
22292604 } else
22302605 if (source == setMasterItem)
22312606 {
2232
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2607
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22332608 {
2234
- Object3D content = GrafreeD.clipboard.get(0);
2609
+ Object3D content = Grafreed.clipboard.get(0);
22352610
22362611 if (content instanceof cGroup && ((cGroup)content).transientlink )
22372612 content = ((cGroup)content).get(0);
....@@ -2244,9 +2619,9 @@
22442619 {
22452620 if (group.selection.size() == 1)
22462621 {
2247
- if (GrafreeD.clipboard.size() == 1)
2622
+ if (Grafreed.clipboard.size() == 1)
22482623 {
2249
- Object3D content = GrafreeD.clipboard.get(0);
2624
+ Object3D content = Grafreed.clipboard.get(0);
22502625
22512626 if (content instanceof cGroup && ((cGroup)content).transientlink )
22522627 content = ((cGroup)content).get(0);
....@@ -2263,7 +2638,7 @@
22632638 {
22642639 RevertMeshes();
22652640 } else
2266
- if (source == resetMeshItem)
2641
+ if (source == resetAllItem)
22672642 {
22682643 ResetAll();
22692644 } else
....@@ -2283,9 +2658,9 @@
22832658 {
22842659 ClearSelection(true);
22852660 } else
2286
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
22872662 {
2288
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
22892664 } else
22902665 if (source == hideItem)
22912666 {
....@@ -2303,11 +2678,11 @@
23032678 {
23042679 makeSomething(new Camera());
23052680 } else
2306
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
23072682 {
23082683 group(new Composite());
23092684 } else
2310
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
23112686 {
23122687 RandomNode random = new RandomNode();
23132688 group(random);
....@@ -2409,7 +2784,7 @@
24092784 {
24102785 group(new cLinker());
24112786 } else
2412
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
24132788 {
24142789 group(new TextureNode());
24152790 } else
....@@ -2429,17 +2804,30 @@
24292804 {
24302805 CastShadow(2);
24312806 } else
2432
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
24332808 {
2434
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
24352811 for (int i=0; i<group.selection.size(); i++)
24362812 {
2437
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
24382818 }
24392819
2440
- ClearSelection(false);
2441
-
2442
- 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
+ }
24432831 } else
24442832 if (source == genUVItem)
24452833 {
....@@ -2451,7 +2839,7 @@
24512839 } else
24522840 if (source == genNormalsMESHItem)
24532841 {
2454
- GenNormals(true); // TODO
2842
+ GenNormalsMESH();
24552843 } else
24562844 if (source == genNormalsORGANItem)
24572845 {
....@@ -2516,6 +2904,22 @@
25162904 if (source == unmarkleavesItem)
25172905 {
25182906 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);
25192923 } else
25202924 if (source == flipVItem)
25212925 {
....@@ -2601,9 +3005,13 @@
26013005 {
26023006 SmoothMesh();
26033007 } else
2604
- if (source == transformgeometryItem)
3008
+ if (source == transformGeometryItem)
26053009 {
26063010 TransformGeometry();
3011
+ } else
3012
+ if (source == transformChildrenItem)
3013
+ {
3014
+ TransformChildren();
26073015 } else
26083016 if (source == resetTransformItem)
26093017 {
....@@ -2611,7 +3019,11 @@
26113019 } else
26123020 if (source == resetCentroidItem)
26133021 {
2614
- ResetCentroid();
3022
+ ResetCentroid(true);
3023
+ } else
3024
+ if (source == resetCentroidXZItem)
3025
+ {
3026
+ ResetCentroid(false);
26153027 } else
26163028 if (source == resetParentItem)
26173029 {
....@@ -2743,6 +3155,10 @@
27433155 if (source == twoButton)
27443156 {
27453157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
27463162 // bug
27473163 //gridPanel.setDividerLocation(1.0);
27483164 //bigPanel.setDividerLocation(0.0);
....@@ -2775,10 +3191,31 @@
27753191 bigThree.ClearUI();
27763192 bigThree.add(centralPanel);
27773193 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
+
27783212 } else
27793213 if (source == threeButton)
27803214 {
27813215 radio.layout = threeButton;
3216
+
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
27823219
27833220 // bigThree.remove(scenePanel);
27843221 // bigThree.remove(centralPanel);
....@@ -2811,10 +3248,15 @@
28113248 bigThree.add(centralPanel);
28123249 bigThree.add(XYZPanel);
28133250 bigThree.FlushUI();
3251
+
3252
+ cameraView.requestFocusInWindow();
28143253 } else
28153254 if (source == fourButton)
28163255 {
28173256 radio.layout = fourButton;
3257
+
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
28183260
28193261 // bigThree.remove(scenePanel);
28203262 // bigThree.remove(centralPanel);
....@@ -2846,10 +3288,15 @@
28463288 bigThree.ClearUI();
28473289 bigThree.add(scenePanel);
28483290 bigThree.FlushUI();
3291
+
3292
+ cameraView.requestFocusInWindow();
28493293 } else
28503294 if (source == sixButton)
28513295 {
28523296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
28533300
28543301 // bigThree.remove(scenePanel);
28553302 // bigThree.remove(centralPanel);
....@@ -2882,10 +3329,15 @@
28823329 bigThree.add(scenePanel);
28833330 bigThree.add(centralPanel);
28843331 bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
28853334 } else
28863335 if (source == sevenButton)
28873336 {
28883337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
28893341
28903342 // bigThree.remove(scenePanel);
28913343 // bigThree.remove(centralPanel);
....@@ -2919,6 +3371,8 @@
29193371 bigThree.add(centralPanel);
29203372 bigThree.add(XYZPanel);
29213373 bigThree.FlushUI();
3374
+
3375
+ cameraView.requestFocusInWindow();
29223376 } else
29233377 if (source == rootButton)
29243378 {
....@@ -2930,6 +3384,7 @@
29303384 EditObject(obj);
29313385 }
29323386
3387
+ cameraView.requestFocusInWindow();
29333388 refreshContents(true);
29343389 } else
29353390 if (source == closeButton)
....@@ -2939,22 +3394,37 @@
29393394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29403395 {
29413396 ab = (cRadio)e.nextElement();
2942
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29433398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
29443405 buttonGroup.remove(ab);
29453406 radioPanel.remove(ab);
29463407
2947
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
29483410 // ab.GetObject().objectUI = null; // ?????????
29493411
29503412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29513413 break;
29523414 }
29533415 }
3416
+
3417
+ cameraView.requestFocusInWindow();
29543418 refreshContents(true);
29553419 } else
29563420 if (source == editItem || source == editButton)
29573421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
29583428 EditSelection(false);
29593429 } else
29603430 if (source == uneditButton)
....@@ -2964,10 +3434,11 @@
29643434 Object3D child = (Object3D)e.nextElement();
29653435 if(child.editWindow != null)
29663436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
29673438 child.CloseUI();
29683439 listUI.remove(child);
29693440
2970
- child.editWindow = null; // ???????????
3441
+ //child.editWindow = null; // ???????????
29713442 }
29723443 objEditor.ctrlPanel.FlushUI();
29733444 //objEditor.jTree.clearSelection();
....@@ -2980,6 +3451,7 @@
29803451 //copy.ClearUI();
29813452 for (Object3D obj : listUI)
29823453 {
3454
+ obj.pinned = false;
29833455 obj.CloseUI();
29843456 }
29853457 listUI.clear();
....@@ -2989,7 +3461,7 @@
29893461 {
29903462 assert(copy == group);
29913463
2992
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29933465
29943466 for (Object3D obj : listUI)
29953467 {
....@@ -3038,6 +3510,9 @@
30383510 }
30393511
30403512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
30413516 //Globals.theRenderer.object = group;
30423517 if(!useclient)
30433518 {
....@@ -3053,20 +3528,44 @@
30533528 frontView.object = group;
30543529 sideView.object = group;
30553530 }
3056
- group.editWindow = this;
3531
+
3532
+// fix "+" issue
3533
+ //group.editWindow = this;
3534
+ group.manipWindow = this;
3535
+
30573536 /*
30583537 currentLayout = radio.layout;
30593538 if (currentLayout == null)
30603539 currentLayout = sevenButton;
30613540 */
30623541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
30633547 keepparent = group.parent;
30643548 // PARENT = NULL or not???
30653549 //group.parent = null; // ROOT
30663550 //group.attributes = -1;
30673551 ResetModel();
3552
+
3553
+ cameraView.requestFocusInWindow();
30683554 refreshContents(true);
3069
- }
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
+ }
30703569 else
30713570 {
30723571 //return super.action(event, arg);
....@@ -3075,7 +3574,6 @@
30753574 }
30763575
30773576 boolean useclient = false;
3078
- cRadio radio;
30793577
30803578 void ToggleRoot()
30813579 {
....@@ -3127,6 +3625,28 @@
31273625 refreshContents();
31283626 }
31293627
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
+ }
31303650
31313651 void ResetTransform()
31323652 {
....@@ -3239,7 +3759,7 @@
32393759 refreshContents();
32403760 }
32413761
3242
- void ResetCentroid()
3762
+ void ResetCentroid(boolean full)
32433763 {
32443764 Object3D obj;
32453765 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3254,12 +3774,16 @@
32543774 LA.matIdentity(Object3D.mat);
32553775 obj.getBounds(minima, maxima, false);
32563776 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3257
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3777
+ if (full)
3778
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32583779 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32593780 obj.TransformMesh(Object3D.mat);
3781
+
32603782 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3261
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3783
+ if (full)
3784
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32623785 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3786
+
32633787 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32643788 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32653789 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3288,7 +3812,8 @@
32883812
32893813 int size = obj.MemorySize();
32903814
3291
- 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)");
32923817 }
32933818 }
32943819 catch (Exception e)
....@@ -3325,9 +3850,9 @@
33253850 obj = (Object3D)e.nextElement();
33263851
33273852 System.out.println("Object is: " + obj);
3328
- GrafreeD.AnalyzeObject(obj);
3853
+ Grafreed.AnalyzeObject(obj);
33293854 System.out.println("Boundary rep: " + obj.bRep);
3330
- GrafreeD.AnalyzeObject(obj.bRep);
3855
+ Grafreed.AnalyzeObject(obj.bRep);
33313856
33323857 // System.err.println((size/1024) + " KB is the size of " + obj);
33333858 }
....@@ -3369,6 +3894,13 @@
33693894 void GenNormals(boolean crease)
33703895 {
33713896 group.GenNormalsS(crease);
3897
+
3898
+ refreshContents();
3899
+ }
3900
+
3901
+ void GenNormalsMESH()
3902
+ {
3903
+ group.GenNormalsMeshS();
33723904
33733905 refreshContents();
33743906 }
....@@ -3541,8 +4073,8 @@
35414073
35424074 void ParseVertices()
35434075 {
3544
- boolean epsequal = GrafreeD.epsequal;
3545
- GrafreeD.epsequal = true;
4076
+ boolean epsequal = Grafreed.epsequal;
4077
+ Grafreed.epsequal = true;
35464078
35474079 for (int i=0; i<group.selection.size(); i++)
35484080 {
....@@ -3567,7 +4099,7 @@
35674099 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35684100 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35694101
3570
- g.add(GrafreeD.clipboard);
4102
+ g.add(Grafreed.clipboard);
35714103
35724104 buffer.add(g);
35734105 }
....@@ -3582,7 +4114,7 @@
35824114 makeSomething(buffer, i==group.selection.size()-1);
35834115 }
35844116
3585
- GrafreeD.epsequal = epsequal;
4117
+ Grafreed.epsequal = epsequal;
35864118
35874119 refreshContents();
35884120 }
....@@ -3600,7 +4132,16 @@
36004132 String pigment = Object3D.GetPigment(tex);
36014133 //String bump = Object3D.GetBump(tex);
36024134
3603
- 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
+ }
36044145
36054146 double s = v.s;
36064147
....@@ -3732,7 +4273,7 @@
37324273 return;
37334274
37344275 Object3D poses = group.selection.get(0);
3735
- Object3D ref = GrafreeD.clipboard.get(0);
4276
+ Object3D ref = Grafreed.clipboard.get(0);
37364277
37374278 Object3D newgroup = new Object3D("Po:" + poses.name);
37384279
....@@ -3926,9 +4467,9 @@
39264467
39274468 void ClipMesh()
39284469 {
3929
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4470
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39304471 {
3931
- Object3D content = GrafreeD.clipboard.get(0);
4472
+ Object3D content = Grafreed.clipboard.get(0);
39324473
39334474 if (content instanceof cGroup && ((cGroup)content).transientlink )
39344475 content = ((cGroup)content).get(0);
....@@ -3937,7 +4478,7 @@
39374478 // {
39384479 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39394480 // }
3940
- group.selection.ClipMesh(GrafreeD.clipboard);
4481
+ group.selection.ClipMesh(Grafreed.clipboard);
39414482 }
39424483 // group.selection.ClipMesh(GrafreeD.clipboard);
39434484 System.out.println("DONE.");
....@@ -3984,6 +4525,18 @@
39844525 void MarkLeaves(boolean hide)
39854526 {
39864527 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);
39874540 refreshContents();
39884541 }
39894542
....@@ -4058,10 +4611,6 @@
40584611 // }
40594612 // }
40604613
4061
- static boolean allparams = true;
4062
-
4063
- static Vector<Object3D> listUI = new Vector<Object3D>();
4064
-
40654614 void EditSelection(boolean newWindow)
40664615 {
40674616 // aConstraints.gridy = 0;
....@@ -4069,10 +4618,10 @@
40694618 {
40704619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40714620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4072
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40734622
40744623 Object3D elem = (Object3D)group.selection.elementAt(i);
4075
- if(elem != group)
4624
+ if(elem != group || !newWindow)
40764625 {
40774626 // if (!(elem instanceof Composite))
40784627 // newWindow = false;
....@@ -4154,7 +4703,8 @@
41544703 //new Exception().printStackTrace();
41554704
41564705 freezemodel = true;
4157
-
4706
+ ClearUnpinned();
4707
+
41584708 /**/
41594709 //switch (event.id)
41604710 {
....@@ -4162,7 +4712,6 @@
41624712 //case 702: // Event.LIST_DESELECT
41634713 group.deselectAll();
41644714 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4165
- objEditor.ClearInfo(); // .GetMaterial());
41664715 if (tps != null)
41674716 {
41684717 for (int i=0; i < tps.length; i++)
....@@ -4171,10 +4720,8 @@
41714720
41724721 //if (child.parent != null)
41734722 //child.parent.addSelectee(child);
4723
+ objEditor.SetMaterial(child);
41744724 group.addSelectee(child);
4175
- objEditor.SetMaterial(child); // .GetMaterial());
4176
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4177
- System.err.println("info : " + child.GetPath());
41784725 }
41794726 }
41804727 // else
....@@ -4184,20 +4731,28 @@
41844731 // System.err.println("info : " + group.GetPath());
41854732 // }
41864733
4187
- objEditor.SetText(); // jan 2014
4188
-
4189
- 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))
41904735 CameraPane.flash = true;
41914736
4192
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4737
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41934738 // a camera
41944739 {
4195
- CameraPane.camerachangeframe = 0; // don't refuse it
4196
- 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
+ }
41974745 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41984746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41994747 }
42004748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
42014756 refreshContents();
42024757 //return true;
42034758 }
....@@ -4206,6 +4761,35 @@
42064761
42074762 freezemodel = false;
42084763 }
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
+ }
42094793
42104794 void linkSomething(Object3D thing)
42114795 {
....@@ -4277,16 +4861,19 @@
42774861 {
42784862 if (group.selection.isEmpty())
42794863 return;
4280
- GrafreeD.clipboardIsTempGroup = false;
4864
+
4865
+ Grafreed.clipboardIsTempGroup = false;
42814866 Composite tGroup = null;
42824867 if (group.selection.size() > 0) // 1)
42834868 {
42844869 tGroup = new cGroup();
4285
- GrafreeD.clipboardIsTempGroup = true;
4870
+ Grafreed.clipboardIsTempGroup = true;
42864871 }
42874872
42884873 if (cut)
42894874 {
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
42904877 //int indices[] = jList.getSelectedIndices();
42914878 //for (int i = indices.length - 1; i >= 0; i--)
42924879 //jList.remove(indices[i]);
....@@ -4322,16 +4909,16 @@
43224909 //System.out.println("cut " + child);
43234910 //System.out.println("parent = " + child.parent);
43244911 // tmp.addChild(child);
4325
- if (GrafreeD.clipboardIsTempGroup)
4912
+ if (Grafreed.clipboardIsTempGroup)
43264913 tGroup.add/*Child*/(tmp);
43274914 else
4328
- GrafreeD.clipboard = tmp;
4915
+ Grafreed.clipboard = tmp;
43294916 }
43304917 else
4331
- if (GrafreeD.clipboardIsTempGroup)
4918
+ if (Grafreed.clipboardIsTempGroup)
43324919 tGroup.add/*Child*/(child);
43334920 else
4334
- GrafreeD.clipboard = child;
4921
+ Grafreed.clipboard = child;
43354922 }
43364923
43374924 //ResetModel();
....@@ -4363,21 +4950,23 @@
43634950 //System.out.println("cut " + elem);
43644951 //System.out.println("parent = " + elem.parent);
43654952 // tmp.addChild(elem);
4366
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
43674954 tGroup.add/*Child*/(tmp);
43684955 else
4369
- GrafreeD.clipboard = tmp;
4956
+ Grafreed.clipboard = tmp;
43704957 }
43714958 else
4372
- if (GrafreeD.clipboardIsTempGroup)
4959
+ if (Grafreed.clipboardIsTempGroup)
43734960 tGroup.add/*Child*/(child);
43744961 else
4375
- GrafreeD.clipboard = child;
4962
+ Grafreed.clipboard = child;
43764963 }
43774964
43784965 }
4379
- if (GrafreeD.clipboardIsTempGroup)
4380
- GrafreeD.clipboard = tGroup;
4966
+
4967
+ if (Grafreed.clipboardIsTempGroup)
4968
+ Grafreed.clipboard = tGroup;
4969
+
43814970 if (cut)
43824971 {
43834972 ResetModel();
....@@ -4387,11 +4976,15 @@
43874976
43884977 void paste(boolean expand)
43894978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
43904983 // if (GrafreeD.clipboard == null)
43914984 // return;
43924985 boolean first = true;
43934986
4394
- if (GrafreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
43954988 {
43964989 Composite temp;
43974990
....@@ -4402,7 +4995,7 @@
44024995 temp = (Composite)Applet3D.clipboard.deepCopy();
44034996 */
44044997 Object3D elem;
4405
- 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))
44064999 {
44075000 Object3D child = (Object3D)e.nextElement();
44085001
....@@ -4436,16 +5029,17 @@
44365029 //Object3D cb = Applet3D.clipboard;
44375030 //temp.addChild(cb);
44385031 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4439
- assert(GrafreeD.clipboard.parent == null);
4440
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4441
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4442
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4443
- 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());
44445037 else
4445
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4446
- GrafreeD.clipboard.get(0).parent = keepparent;
5038
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5039
+ Grafreed.clipboard.get(0).parent = keepparent;
44475040 }
44485041
5042
+ Globals.REPLACEONMAKE = keep;
44495043 ResetModel();
44505044 refreshContents();
44515045 }
....@@ -4492,9 +5086,9 @@
44925086 {
44935087 boolean first = true;
44945088
4495
- if (GrafreeD.clipboardIsTempGroup)
5089
+ if (Grafreed.clipboardIsTempGroup)
44965090 {
4497
- Composite temp = (Composite)GrafreeD.clipboard;
5091
+ Composite temp = (Composite)Grafreed.clipboard;
44985092 Object3D copy;
44995093 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45005094 {
....@@ -4504,7 +5098,7 @@
45045098 }
45055099 } else
45065100 {
4507
- linkSomething(GrafreeD.clipboard); //.get(0));
5101
+ linkSomething(Grafreed.clipboard); //.get(0));
45085102 }
45095103 }
45105104 }
....@@ -4581,6 +5175,10 @@
45815175
45825176 void group(Object3D csg, boolean grab)
45835177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
45845182 if (//false) // why??
45855183 !group.selection.isEmpty())
45865184 {
....@@ -4694,10 +5292,15 @@
46945292 //node.add(csg);
46955293 //makeSomething(node);
46965294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
46975296 }
46985297
46995298 void Ungroup(Object3D g)
47005299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
47015304 if (g instanceof HiddenObject)
47025305 {
47035306 HiddenObject h = (HiddenObject) g;
....@@ -4714,6 +5317,7 @@
47145317 objEditor.makeSomething(g.get(i), false);
47155318 }
47165319 }
5320
+ Globals.REPLACEONMAKE = keep;
47175321 }
47185322
47195323 void ungroup()
....@@ -4909,21 +5513,6 @@
49095513 }
49105514 */
49115515
4912
- void ImportGFD()
4913
- {
4914
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4915
- browser.show();
4916
- String filename = browser.getFile();
4917
- if (filename != null && filename.length() > 0)
4918
- {
4919
- String fullname = browser.getDirectory() + filename;
4920
-
4921
- //Object3D readobj =
4922
- objEditor.ReadGFD(fullname, objEditor);
4923
- //makeSomething(readobj);
4924
- }
4925
- }
4926
-
49275516 /*
49285517 public void Callback(Object obj)
49295518 {
....@@ -4947,26 +5536,9 @@
49475536 }
49485537 */
49495538
4950
- void ImportVRMLX3D()
4951
- {
4952
- if (GrafreeD.standAlone)
4953
- {
4954
- /**/
4955
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4956
- browser.show();
4957
- String filename = browser.getFile();
4958
- if (filename != null && filename.length() > 0)
4959
- {
4960
- String fullname = browser.getDirectory() + filename;
4961
- LoadVRMLX3D(fullname);
4962
- }
4963
- /**/
4964
- }
4965
- }
4966
-
49675539 String GetFile(String dialogName)
49685540 {
4969
- if (GrafreeD.standAlone)
5541
+ if (Grafreed.standAlone)
49705542 {
49715543 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49725544 browser.show();
....@@ -5034,7 +5606,28 @@
50345606 cButton clearpanelButton;
50355607 cButton unselectButton;
50365608
5609
+ cButton restoreCameraButton;
5610
+
5611
+ cButton saveButton;
50375612 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;
50385631
50395632 cButton screenfitButton;
50405633 cButton screenfitpointButton;
....@@ -5047,14 +5640,6 @@
50475640
50485641 cButton setsupportButton;
50495642
5050
- cButton twoButton;
5051
- cButton sixButton;
5052
- cButton threeButton;
5053
- cButton sevenButton;
5054
- cButton fourButton; // full panel
5055
- cButton oneButton; // full XYZ
5056
- //cButton currentLayout;
5057
-
50585643 //
50595644 //Composite
50605645 Object3D // to do !!
....@@ -5064,9 +5649,11 @@
50645649 //JTree jTree;
50655650 private MenuItem lookAtItem;
50665651 private MenuItem lookFromItem;
5067
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
50685653 private MenuItem cutItem;
5069
- private MenuItem duplicateItem;
5654
+ private MenuItem undoItem;
5655
+ private MenuItem redoItem;
5656
+ private JMenuItem duplicateItem;
50705657 private MenuItem cloneItem;
50715658 private MenuItem cloneSupportItem;
50725659 private MenuItem overwriteGeoItem;
....@@ -5079,7 +5666,7 @@
50795666 private MenuItem linkverticesItem;
50805667 private MenuItem relinkverticesItem;
50815668 private MenuItem setMasterItem;
5082
- private MenuItem resetMeshItem;
5669
+ private MenuItem resetAllItem;
50835670 private MenuItem stepAllItem;
50845671 private MenuItem revertMeshItem;
50855672 private MenuItem poseMeshItem;
....@@ -5129,6 +5716,10 @@
51295716 private MenuItem showleavesItem;
51305717 private MenuItem markleavesItem;
51315718 private MenuItem unmarkleavesItem;
5719
+ private MenuItem rewindleavesItem;
5720
+ private MenuItem unrewindleavesItem;
5721
+ private MenuItem randomleavesItem;
5722
+ private MenuItem unrandomleavesItem;
51325723
51335724 private MenuItem flipVItem;
51345725 private MenuItem unflipVItem;
....@@ -5140,15 +5731,17 @@
51405731 private MenuItem panoTexturesItem;
51415732
51425733 private MenuItem resetCentroidItem;
5143
- private MenuItem transformgeometryItem;
5734
+ private MenuItem resetCentroidXZItem;
51445735 private MenuItem resetTransformItem;
5736
+ private MenuItem transformGeometryItem;
5737
+ private MenuItem transformChildrenItem;
51455738 private MenuItem hideItem;
51465739 private MenuItem grabItem;
51475740 private MenuItem backItem;
51485741 private MenuItem frontItem;
51495742 private MenuItem cameraItem;
51505743 private MenuItem compositeItem;
5151
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
51525745 private MenuItem physicsItem;
51535746 private MenuItem frameselectorItem;
51545747 private MenuItem scriptNodeItem;
....@@ -5210,11 +5803,6 @@
52105803 private MenuItem doubleItem;
52115804 private MenuItem tripleItem;
52125805
5213
- private MenuItem importGFDItem;
5214
- private MenuItem importVRMLX3DItem;
5215
- private MenuItem import3DSItem;
5216
- private MenuItem importOBJItem;
5217
-
52185806 private MenuItem computeAOItem;
52195807 private MenuItem recompileItem;
52205808 private MenuItem editScriptItem;
....@@ -5224,4 +5812,8 @@
52245812 private MenuItem analyzeItem;
52255813 private MenuItem dumpItem;
52265814 //boolean freezemodel = false;
5815
+
5816
+ Menu cameraMenu;
5817
+ MenuItem editCameraItem;
5818
+ MenuItem restoreCameraItem;
52275819 }