Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -74,7 +80,13 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
77
- SetupMenu2(objEditor);
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
89
+ SetupMenu2(this); //objEditor);
7890 SetupUI2(objEditor);
7991 objEditor.SetupUI(true);
8092 SetupViews(objEditor);
....@@ -84,6 +96,10 @@
8496
8597 void CloneSelection(boolean supports)
8698 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
87103 // Object3D keep = GrafreeD.clipboard;
88104 //Object3D obj;
89105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +110,19 @@
94110
95111 makeSomething(clone, i==group.selection.size()-1);
96112 }
113
+ Globals.REPLACEONMAKE = keep;
97114 }
98115
99116 void CloneClipboard(boolean supports)
100117 {
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));
118
+ assert(Grafreed.clipboard.parent == null);
119
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
120
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
121
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
122
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106123 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
124
+ makeSomething(CloneObject(Grafreed.clipboard, false));
125
+ Grafreed.clipboard.get(0).parent = keepparent;
109126 }
110127
111128 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +136,7 @@
119136 // obj.support = null;
120137 if (!supports)
121138 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
139
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123140 obj.parent = parent;
124141 // obj.support = support;
125142 // clone.support = support; // aout 2013
....@@ -148,28 +165,21 @@
148165
149166 //JTextField nameField;
150167
151
- void SetupMenu2(ObjEditor oe)
168
+ void SetupMenu2(GroupEditor oe)
152169 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
170
+ oe.jTree = new cTree();
171
+
168172 Menu menu;
169173 oe.menuBar.add(menu = new Menu("Edit"));
170174 //editItem = menu.add(new MenuItem("Edit"));
171175 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
176
+
177
+// undoItem = menu.add(new MenuItem("Undo"));
178
+// undoItem.addActionListener(this);
179
+// redoItem = menu.add(new MenuItem("Redo"));
180
+// redoItem.addActionListener(this);
181
+// menu.add("-");
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173183 duplicateItem.addActionListener(this);
174184 cloneItem = menu.add(new MenuItem("Clone"));
175185 cloneItem.addActionListener(this);
....@@ -185,7 +195,6 @@
185195 copyItem.addActionListener(this);
186196 pasteItem = menu.add(new MenuItem("Paste"));
187197 pasteItem.addActionListener(this);
188
- menu.add("-");
189198
190199 menu.add("-");
191200 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -206,14 +215,97 @@
206215 clearAllItem = menu.add(new MenuItem("Clear All"));
207216 clearAllItem.addActionListener(this);
208217 }
218
+
219
+ menuBar.add(cameraMenu = new Menu("View"));
220
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
221
+ //zBufferItem.addActionListener(this);
222
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
223
+ //normalLensItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
226
+
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
239
+
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
241
+ toggleHandleItem.addItemListener(this);
242
+ toggleHandleItem.setState(CameraPane.HANDLES);
243
+
244
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
245
+ togglePaintItem.addItemListener(this);
246
+ togglePaintItem.setState(CameraPane.PAINTMODE);
247
+
248
+ if (Globals.ADVANCED)
249
+ {
250
+ cameraMenu.add("-");
251
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
252
+ toggleLiveItem.addItemListener(this);
253
+ toggleLiveItem.setState(Globals.isLIVE());
209254
255
+ cameraMenu.add(stepItem = new MenuItem("Step"));
256
+ stepItem.addActionListener(this);
257
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
258
+ // toggleDLItem.addItemListener(this);
259
+ // toggleDLItem.setState(false);
260
+
261
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
262
+ toggleRenderItem.addItemListener(this);
263
+ toggleRenderItem.setState(!CameraPane.frozen);
264
+
265
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
266
+ toggleDebugItem.addItemListener(this);
267
+ toggleDebugItem.setState(Globals.DEBUG);
268
+
269
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
270
+ toggleFrustumItem.addItemListener(this);
271
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
272
+
273
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
274
+ toggleFootContactItem.addItemListener(this);
275
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
276
+
277
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
278
+ toggleTimelineItem.addItemListener(this);
279
+ }
280
+
281
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
282
+// toggleRootItem.addItemListener(this);
283
+// toggleRootItem.setState(false);
284
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
285
+// animationItem.addItemListener(this);
286
+// animationItem.setState(CameraPane.ANIMATION);
287
+ cameraMenu.add("-");
288
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
289
+ editCameraItem.addActionListener(this);
290
+
291
+ if (Globals.ADVANCED)
292
+ {
293
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
294
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
296
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
297
+ oe.cameraMenu.add("-");
298
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
299
+ openWindowItem.addActionListener(this);
300
+ editLeafItem.addActionListener(this);
301
+ lookAtItem.addActionListener(this);
302
+ //lookFromItem.addActinoListener(this);
303
+ //switchViewItem.addActionListener(this);
304
+ }
305
+
210306 oe.menuBar.add(menu = new Menu("Setting"));
211307 if (Globals.ADVANCED)
212308 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217309 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218310 revertMeshItem.addActionListener(this);
219311 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +345,29 @@
253345 }
254346
255347 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
258350 backItem = menu.add(new MenuItem("Back"));
259351 backItem.addActionListener(this);
260352 frontItem = menu.add(new MenuItem("Front"));
261353 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
264359 hideItem = menu.add(new MenuItem("Hidden Group"));
265360 hideItem.addActionListener(this);
361
+ }
266362 ungroupItem = menu.add(new MenuItem("Ungroup"));
267363 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- randomItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
271371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272372 switchGeoItem.addActionListener(this);
273373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +375,6 @@
275375 morphItem = menu.add(new MenuItem("Morph Group"));
276376 morphItem.addActionListener(this);
277377
278
- if (Globals.ADVANCED)
279
- {
280378 menu.add("-");
281379 physicsItem = menu.add(new MenuItem("Physics"));
282380 physicsItem.addActionListener(this);
....@@ -284,30 +382,29 @@
284382 frameselectorItem.addActionListener(this);
285383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286384 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289385 }
290386
291387 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
294390 billboardItem = menu.add(new MenuItem("Billboard"));
295391 billboardItem.addActionListener(this);
296392 csgItem = menu.add(new MenuItem("CSG"));
297393 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299395 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301397 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
304403 if (Globals.ADVANCED)
305404 {
306405 menu.add("-");
307406 linkerItem = menu.add(new MenuItem("Linker"));
308407 linkerItem.addActionListener(this);
309
- attributeItem = menu.add(new MenuItem("Attribute"));
310
- attributeItem.addActionListener(this);
311408 templateItem = menu.add(new MenuItem("Template"));
312409 templateItem.addActionListener(this);
313410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -318,8 +415,12 @@
318415 resetTransformItem.addActionListener(this);
319416 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
320417 resetCentroidItem.addActionListener(this);
321
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
- transformgeometryItem.addActionListener(this);
418
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
419
+ resetCentroidXZItem.addActionListener(this);
420
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
421
+ transformGeometryItem.addActionListener(this);
422
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
423
+ transformChildrenItem.addActionListener(this);
323424
324425 oe.menuBar.add(menu = new Menu("Geometry"));
325426 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -368,6 +469,10 @@
368469 oe.menuBar.add(menu = new Menu("Attributes"));
369470 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370471 clearMaterialsItem.addActionListener(this);
472
+ resetAllItem = menu.add(new MenuItem("Reset All"));
473
+ resetAllItem.addActionListener(this);
474
+ stepAllItem = menu.add(new MenuItem("Step All"));
475
+ stepAllItem.addActionListener(this);
371476 menu.add("-");
372477 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
373478 liveleavesItem.addActionListener(this);
....@@ -388,6 +493,14 @@
388493 markleavesItem.addActionListener(this);
389494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
390495 unmarkleavesItem.addActionListener(this);
496
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
497
+ rewindleavesItem.addActionListener(this);
498
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
499
+ unrewindleavesItem.addActionListener(this);
500
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
501
+ randomleavesItem.addActionListener(this);
502
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
503
+ unrandomleavesItem.addActionListener(this);
391504 menu.add("-");
392505 flipVItem = menu.add(new MenuItem("Flip V"));
393506 flipVItem.addActionListener(this);
....@@ -422,41 +535,42 @@
422535 sortbysizeItem.addActionListener(this);
423536 sortbynameItem = menu.add(new MenuItem("Sort by name"));
424537 sortbynameItem.addActionListener(this);
538
+ menu.add("-");
539
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
540
+ shareGeometriesItem.addActionListener(this);
541
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
542
+ mergeGeometriesItem.addActionListener(this);
425543 if (Globals.ADVANCED)
426544 {
427
- menu.add("-");
545
+ // Pretty much the same as duplicate and clone.
428546 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429547 extractGeometriesItem.addActionListener(this);
430548 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431549 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);
436550 }
437551
438552 oe.menuBar.add(menu = new Menu("Insert"));
439553 buildCreateMenu(menu);
440554
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
-
454555 oe.menuBar.add(menu = new Menu("Tools"));
455556 buildToolsMenu(menu);
456557 }
457558
559
+
458560 void SetupUI2(ObjEditor oe)
459561 {
562
+ // June 2019
563
+ if (oe == null)
564
+ {
565
+ //super.SetupUI2(this);
566
+ //return;
567
+ }
568
+
569
+ if (copy != group)
570
+ {
571
+ //super.SetupUI2(this);
572
+ }
573
+
460574 //new Exception().printStackTrace();
461575
462576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -485,97 +599,229 @@
485599 oe.radioPanel.add(dummyButton);
486600 oe.buttonGroup.add(dummyButton);
487601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
488606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
489607
490
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
491
- liveCB.setToolTipText("Enabled animation");
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
611
+
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
618
+
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ fullButton.setToolTipText("Full-screen window");
621
+ fullButton.addActionListener(this);
622
+
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
630
+
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
633
+ saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
639
+
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
659
+ liveCB.setToolTipText("Enable animation");
492660 liveCB.addItemListener(this);
493661
494
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
495663 oneStepButton.setToolTipText("Animate one step forward");
496664 oneStepButton.addActionListener(this);
497665
498
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
499667 fastCB.setToolTipText("Fast mode");
500668 fastCB.addItemListener(this);
501669
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);
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
509675
510676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
511677 // screenfitpointButton.addActionListener(this);
512678
513679 if (Globals.ADVANCED)
514680 {
515
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
681
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
516682 snapobjectButton.addActionListener(this);
517683 snapobjectButton.setToolTipText("Snap Object");
518684 }
519685
520
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
521
- flashSelectionButton.setToolTipText("Show selection");
522
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
523687
524
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
525
-
526
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527689 twoButton.setToolTipText("Show center view only");
528690 twoButton.addActionListener(this);
529
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
691
+ this.fullscreenLayout = twoButton;
692
+
693
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530694 fourButton.addActionListener(this);
531695 fourButton.setToolTipText("Show left panel only");
532
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
696
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
533697 sixButton.setToolTipText("2-column layout left");
534698 sixButton.addActionListener(this);
535
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
536700 threeButton.setToolTipText("2-column layout right");
537701 threeButton.addActionListener(this);
538
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
702
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
539703 sevenButton.setToolTipText("3-column layout");
540704 sevenButton.addActionListener(this);
541705 //
542706
543
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
707
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544708 rootButton.setToolTipText("Edit selection in new tab");
545709 rootButton.addActionListener(this);
546710
547
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
711
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
548712 closeButton.setToolTipText("Close tab");
549713 closeButton.addActionListener(this);
550714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
551715 //clearButton.addActionListener(this);
552
-
553
- cGridBag commandsPanel = new cGridBag();
716
+
717
+ // INSERT
718
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ gridButton.setToolTipText("Create grid");
720
+ gridButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ boxButton.setToolTipText("Create box");
724
+ boxButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ sphereButton.setToolTipText("Create sphere");
728
+ sphereButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ coneButton.setToolTipText("Create cone");
732
+ coneButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ torusButton.setToolTipText("Create torus");
736
+ torusButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ superButton.setToolTipText("Create superellipsoid");
740
+ superButton.addActionListener(this);
741
+
742
+ if (Globals.ADVANCED)
743
+ {
744
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ kleinButton.setToolTipText("Create Klein bottle");
746
+ kleinButton.addActionListener(this);
747
+ }
554748
555
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
556
- editButton.setToolTipText("Edit selection");
749
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ particlesButton.setToolTipText("Create particle system");
751
+ particlesButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.Return();
754
+
755
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ groupButton.setToolTipText("Create group");
757
+ groupButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ compositeButton.setToolTipText("Create composite");
761
+ compositeButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ switchButton.setToolTipText("Create item switcher");
765
+ switchButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ loopButton.setToolTipText("Create loop");
769
+ loopButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ textureButton.setToolTipText("Create texture");
773
+ textureButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ overlayButton.setToolTipText("Create overlay");
777
+ overlayButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ lightButton.setToolTipText("Create light");
781
+ lightButton.addActionListener(this);
782
+
783
+ for (int i=6; --i>=0;)
784
+ {
785
+ oe.toolboxPanel.Return();
786
+ oe.toolboxPanel.add(new cGridBag());
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ }
794
+
795
+ // EDIT panel
796
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ editButton.setToolTipText("Pin selection controls");
557798 editButton.addActionListener(this);
558799
559
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
560
- uneditButton.setToolTipText("Unedit selection");
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
561802 uneditButton.addActionListener(this);
562803
563
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
564
- allParamsButton.setToolTipText("Edit all params");
804
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
805
+ allParamsButton.setToolTipText("Show all controle");
565806 allParamsButton.addActionListener(this);
566807
567
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
808
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
568809 clearPanelButton.setToolTipText("Clear edit panel");
569810 clearPanelButton.addActionListener(this);
570811
571
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
812
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
572813 unselectButton.setToolTipText("Unselect");
573814 unselectButton.addActionListener(this);
574815
575
- commandsPanel.preferredHeight = 1;
816
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ flashSelectionButton.setToolTipText("Highlight selection");
818
+ flashSelectionButton.addActionListener(this);
576819
577
- oe.treePanel.add(commandsPanel);
578
- oe.treePanel.Return();
820
+ editCommandsPanel.preferredHeight = 1;
821
+
822
+ SetPinStates(false);
823
+// oe.treePanel.add(commandsPanel);
824
+// oe.treePanel.Return();
579825
580826 // oe.aConstraints.gridx += 1;
581827 // oe.aConstraints.weighty = 0;
....@@ -592,29 +838,17 @@
592838
593839 JScrollPane jSP;
594840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
595
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
596842 ResetModel();
597843
598844 oe.treePanel.add(jSPPanel);
599845 oe.treePanel.Return();
600846
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;
616847 oe.treePanel.add(copyOptionsPanel);
617848 oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
618852
619853 // mainPanel.setDividerLocation(0.5); //1.0);
620854 // mainPanel.setResizeWeight(0.5);
....@@ -643,23 +877,43 @@
643877
644878 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
645879 {
880
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
881
+ colorCB.setToolTipText("Copy color when dropped");
882
+ colorCB.addItemListener(this);
883
+
884
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
885
+ materialCB.setToolTipText("Copy material when dropped");
886
+ materialCB.addItemListener(this);
887
+
888
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
889
+ textureCB.setToolTipText("Copy texture when dropped");
890
+ textureCB.addItemListener(this);
891
+
892
+ panel.Return();
893
+
646894 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
647895 boxCB.setToolTipText("Display bounding boxes");
648896 boxCB.addItemListener(this);
649897
650898 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
651
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
652900 zoomBoxCB.addItemListener(this);
653901
654
- if (Globals.ADVANCED)
902
+ if (true) // Globals.ADVANCED)
655903 {
656
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
657
- supportCB.setToolTipText("Enable rigging");
658
- supportCB.addItemListener(this);
904
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
905
+// supportCB.setToolTipText("Enable rigging");
906
+// supportCB.addItemListener(this);
907
+
908
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
909
+ freezeCB.setToolTipText("Fast moving camera");
910
+ freezeCB.addItemListener(this);
659911
660912 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
661913 // localCB.addItemListener(this);
662914
915
+ panel.Return();
916
+
663917 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
664918 crowdCB.setToolTipText("Used for crowds");
665919 crowdCB.addItemListener(this);
....@@ -676,6 +930,8 @@
676930 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
677931 // speakerMocapCB.addItemListener(this);
678932
933
+ panel.Return();
934
+
679935 if (false)
680936 {
681937 // handled in scripts
....@@ -690,32 +946,72 @@
690946 //constraints.gridy += 1;
691947 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
692948 smoothfocusCB.addItemListener(this);
949
+ panel.Return();
693950 }
694951
695952 //constraints.gridx += 1;
696953 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
697954 // debugCB.addItemListener(this);
698955
956
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
957
+ trackCB.setToolTipText("Enable tracking target");
958
+ trackCB.addItemListener(this);
959
+
699960 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
961
+ oeilCB.setToolTipText("Move camera when tracking");
700962 oeilCB.addItemListener(this);
701963
964
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
965
+ shadowCB.setToolTipText("When live compute shadows");
966
+ shadowCB.addItemListener(this);
967
+
968
+ panel.Return();
969
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
970
+ toggleTextureCB.setToolTipText("Load textures");
971
+ toggleTextureCB.addItemListener(this);
972
+
973
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
974
+ toggleSwitchCB.setToolTipText("Choose a single item");
975
+ toggleSwitchCB.addItemListener(this);
976
+
977
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
978
+ autokeepCB.setToolTipText("On structure change");
979
+ autokeepCB.addItemListener(this);
980
+
981
+ panel.Return();
982
+ if (Globals.ADVANCED)
983
+ {
702984 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
703985 lookAtCB.setToolTipText("Look-at target");
704986 lookAtCB.addItemListener(this);
987
+ }
705988
706989 }
707990
708991 cGridBag fill = new cGridBag();
709
-
710992 fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
711997
712998 panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
7131001
7141002 }
7151003
7161004 void EditObject(Object3D obj)
7171005 {
7181006 cRadio radioButton = new cRadio(obj.name);
1007
+
1008
+ // June 2019. Patch to avoid bug with transparency.
1009
+ radioButton.hadMaterial = obj.material != null;
1010
+ if (!radioButton.hadMaterial)
1011
+ {
1012
+ obj.material = new cMaterial();
1013
+ }
1014
+
7191015 radioButton.SetObject(obj);
7201016 radioButton.layout = sevenButton;
7211017 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -724,8 +1020,11 @@
7241020 buttonGroup.add(radioButton);
7251021 radioButton.doClick();
7261022 }
1023
+
7271024 void SetupViews(ObjEditor oe)
7281025 {
1026
+ theFrame = this;
1027
+
7291028 oe.SetupViews();
7301029
7311030 System.out.println("SetupViews");
....@@ -734,23 +1033,28 @@
7341033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7351034 }
7361035
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;
1036
+ cToggleButton liveCB;
1037
+ cCheckBox supportCB;
1038
+ cCheckBox localCB;
1039
+ cCheckBox crowdCB;
1040
+ cCheckBox smoothCB;
1041
+ cToggleButton fastCB;
1042
+ cCheckBox slowCB;
1043
+ cCheckBox boxCB;
1044
+ cCheckBox zoomBoxCB;
1045
+ cCheckBox freezeCB;
1046
+ //cToggleButton trackCB;
1047
+ cCheckBox trackCB;
1048
+ cCheckBox smoothfocusCB;
7481049 // JCheckBox speakerMocapCB;
749
- JCheckBox speakerCameraCB;
750
- JCheckBox speakerFocusCB;
751
- JCheckBox debugCB;
752
- JCheckBox oeilCB;
753
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
7541058
7551059 // static int COLOR = 1;
7561060 // static int MATERIAL = 2;
....@@ -758,9 +1062,9 @@
7581062
7591063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7601064
761
- JCheckBox colorCB;
762
- JCheckBox materialCB;
763
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
7641068
7651069 public void itemStateChanged(ItemEvent e)
7661070 {
....@@ -788,6 +1092,7 @@
7881092 } else if(e.getSource() == liveCB)
7891093 {
7901094 cameraView.ToggleLive();
1095
+ refreshContents(false);
7911096 }
7921097 else if(e.getSource() == supportCB)
7931098 {
....@@ -852,6 +1157,18 @@
8521157 {
8531158 cameraView.ToggleOeil();
8541159 }
1160
+ else if(e.getSource() == shadowCB)
1161
+ {
1162
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1163
+ }
1164
+ else if(e.getSource() == freezeCB)
1165
+ {
1166
+ Globals.FREEZEONMOVE ^= true;
1167
+ }
1168
+ else if(e.getSource() == autokeepCB)
1169
+ {
1170
+ Globals.REPLACEONMAKE ^= true;
1171
+ }
8551172 else if(e.getSource() == lookAtCB)
8561173 {
8571174 cameraView.ToggleLookAt();
....@@ -868,7 +1185,8 @@
8681185
8691186 /**/
8701187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
871
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
8721190 if ((path == null) || (path.getPathCount() <= 1)) {
8731191 // We can't move the root node or an empty selection
8741192 return;
....@@ -931,8 +1249,6 @@
9311249 }
9321250 }
9331251
934
- String string = (String) object;
935
-
9361252 System.out.println("Transfer = " + object + "; drop : " + target);
9371253 // if( object instanceof java.io.File[])
9381254 // {
....@@ -940,7 +1256,11 @@
9401256 // objEditor.DropFile((java.io.File[]) object, true);
9411257 // return;
9421258 // }
943
- if (string.charAt(0) == '/')
1259
+
1260
+ String string = object.toString();
1261
+
1262
+ // File path for Mac and Windows
1263
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9441264 {
9451265 // file(s)
9461266 String[] names = string.split("\n");
....@@ -967,7 +1287,7 @@
9671287
9681288 flashIt = false;
9691289 CameraPane pane = (CameraPane) target;
970
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1290
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9711291 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9721292
9731293 if (group.selection.size() == 1)
....@@ -983,23 +1303,33 @@
9831303
9841304 assert target == objEditor.jTree;
9851305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
9861307 try {
987
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9881309 } catch (Exception e) {
9891310 System.out.println("destinationPath : " + destinationPath);
9901311 return;
9911312 }
9921313
993
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
9941315 {
1316
+ Object3D child = (Object3D)group.selection.elementAt(i);
1317
+
1318
+ // Cannot move into itself
1319
+ if (child == destinationLeaf)
1320
+ return;
1321
+ }
1322
+
1323
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1324
+// {
9951325 loadClipboard(true);
9961326 objEditor.jTree.setSelectionPath(destinationPath);
9971327 pasteInto(false, false);
998
- } else {
999
- loadClipboard(false);
1000
- objEditor.jTree.setSelectionPath(destinationPath);
1001
- pasteInto(false, false); // true); // ???
1002
- }
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
10031333 }
10041334 public void dropActionChanged(DropTargetDragEvent dtde)
10051335 // Called if the user has modified the current drop gesture
....@@ -1104,22 +1434,30 @@
11041434 {
11051435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11061436 //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);
1437
+// gridItem = menu.add(new MenuItem("Grid"));
1438
+// gridItem.addActionListener(this);
1439
+// rectoidItem = menu.add(new MenuItem("Box"));
1440
+// rectoidItem.addActionListener(this);
1441
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1442
+// ellipsoidItem.addActionListener(this);
1443
+// coneItem = menu.add(new MenuItem("Cone"));
1444
+// coneItem.addActionListener(this);
1445
+// torusItem = menu.add(new MenuItem("Torus"));
1446
+// torusItem.addActionListener(this);
1447
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1448
+// superItem.addActionListener(this);
1449
+
1450
+ cameraItem = menu.add(new MenuItem("Camera"));
1451
+ cameraItem.addActionListener(this);
1452
+
1453
+ if (!Globals.ADVANCED)
1454
+ {
11191455 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11201456 kleinItem.addActionListener(this);
1121
- particleItem = menu.add(new MenuItem("Particle system"));
1122
- particleItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
11231461 if (Globals.ADVANCED)
11241462 {
11251463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1145,15 +1483,15 @@
11451483 }
11461484 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11471485 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);
1486
+// overlayItem = menu.add(new MenuItem("Overlay"));
1487
+// overlayItem.addActionListener(this);
1488
+// lightItem = menu.add(new MenuItem("Light"));
1489
+// lightItem.addActionListener(this);
11521490 menu.add("-");
11531491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11541492 //superLoopItem.addActionListener(this);
1155
- loopItem = menu.add(new MenuItem("Loop"));
1156
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
11571495 doubleItem = menu.add(new MenuItem("Fork"));
11581496 doubleItem.addActionListener(this);
11591497 if (Globals.ADVANCED)
....@@ -1169,6 +1507,9 @@
11691507 animationItem.addItemListener(this);
11701508 animationItem.setState(Globals.ANIMATION);
11711509
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
1512
+
11721513 menu.add("-");
11731514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11741515 parseverticesItem.addActionListener(this);
....@@ -1181,6 +1522,8 @@
11811522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11821523 reduce34MorphItem.addActionListener(this);
11831524 menu.add("-");
1525
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1526
+ memoryItem.addActionListener(this);
11841527 menu.add(computeAOItem = new MenuItem("Compute AO"));
11851528 computeAOItem.addActionListener(this);
11861529
....@@ -1189,11 +1532,9 @@
11891532 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11901533 mirrorItem.addActionListener(this);
11911534 menu.add("-");
1192
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1193
- memoryItem.addActionListener(this);
11941535 menu.add(analyzeItem = new MenuItem("Analyze"));
11951536 analyzeItem.addActionListener(this);
1196
- menu.add(dumpItem = new MenuItem("Dump"));
1537
+ menu.add(dumpItem = new MenuItem("Print"));
11971538 dumpItem.addActionListener(this);
11981539 // menu.add(pathItem = new MenuItem("From-to path"));
11991540 // pathItem.addActionListener(this);
....@@ -1334,9 +1675,24 @@
13341675 shadow.material = new cMaterial(obj.material);
13351676 shadow.material.diffuse = 0.0001f;
13361677 shadow.material.specular = 0.0001f;
1678
+ //shadow.projectedVertices[1].x = 300;
13371679
13381680 makeSomething(shadow);
13391681 }
1682
+
1683
+ private void ClearUnpinned()
1684
+ {
1685
+ //for (Object3D obj : listUI)
1686
+ for (int i=listUI.size(); --i>=0;)
1687
+ {
1688
+ Object3D obj = listUI.elementAt(i);
1689
+ if (!obj.pinned)
1690
+ {
1691
+ obj.CloseUI();
1692
+ listUI.remove(i);
1693
+ }
1694
+ }
1695
+ }
13401696
13411697 /**
13421698 * applyExample
....@@ -1540,9 +1896,9 @@
15401896
15411897 void Overwrite(int mask)
15421898 {
1543
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1899
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15441900 {
1545
- Object3D content = GrafreeD.clipboard.get(0);
1901
+ Object3D content = Grafreed.clipboard.get(0);
15461902
15471903 if (content instanceof cGroup && ((cGroup)content).transientlink )
15481904 content = ((cGroup)content).get(0);
....@@ -1581,7 +1937,7 @@
15811937 {
15821938 ScreenFit();
15831939 } else
1584
- if (source == switchItem)
1940
+ if (source == switchViewItem)
15851941 {
15861942 cVector v1 = new cVector();
15871943 cVector v2 = new cVector();
....@@ -1590,11 +1946,11 @@
15901946 objEditor.cameraView.renderCamera.setAim(v2, v1);
15911947 objEditor.cameraView.repaint();
15921948 } else
1593
- if (source == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
15941950 {
15951951 makeSomething(new Box());
15961952 } else
1597
- if (source == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
15981954 {
15991955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16001956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1673,27 +2029,27 @@
16732029
16742030 makeSomething(obj);
16752031 } else
1676
- if (source == gridItem)
2032
+ if (source == gridItem || source == gridButton)
16772033 {
16782034 makeSomething(new Grid());
16792035 } else
1680
- if (source == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
16812037 {
16822038 makeSomething(new Sphere());
16832039 } else
1684
- if (source == coneItem)
2040
+ if (source == coneItem || source == coneButton)
16852041 {
16862042 makeSomething(new Cone());
16872043 } else
1688
- if (source == torusItem)
2044
+ if (source == torusItem || source == torusButton)
16892045 {
16902046 makeSomething(new Torus());
16912047 } else
1692
- if (source == superItem)
2048
+ if (source == superItem || source == superButton)
16932049 {
16942050 makeSomething(new Superellipsoid());
16952051 } else
1696
- if (source == kleinItem)
2052
+ if (source == kleinItem || source == kleinButton)
16972053 {
16982054 makeSomething(new Klein());
16992055 } else
....@@ -1713,7 +2069,7 @@
17132069 {
17142070 makeSomething(new BezierSurface());
17152071 } else
1716
- if (source == overlayItem)
2072
+ if (source == overlayItem || source == overlayButton)
17172073 {
17182074 /*
17192075 Object3D obj = new BezierSurface(5,8);
....@@ -1761,7 +2117,7 @@
17612117 s.setup();
17622118 makeSomething(s);
17632119 } else
1764
- if (source == lightItem)
2120
+ if (source == lightItem || source == lightButton)
17652121 {
17662122 makeSomething(new Light());
17672123 } else
....@@ -1811,30 +2167,30 @@
18112167
18122168 group(g);
18132169 } else
1814
- if (source == loopItem)
2170
+ if (source == loopItem || source == loopButton)
18152171 {
18162172 Composite csg = new GroupLeaf();
18172173 csg.count = 5;
18182174 group(csg);
1819
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
18202176 csg.addChild(child);
18212177 child.addChild(csg);
18222178 } else
18232179 if (source == doubleItem)
18242180 {
1825
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
18262182 csg.count = 5;
18272183 group(csg);
1828
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
18292185 csg.addChild(child);
18302186 child.addChild(csg);
1831
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
18322188 csg.addChild(child);
18332189 child.addChild(csg);
18342190 } else
18352191 if (source == tripleItem)
18362192 {
1837
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
18382194 csg.count = 4;
18392195 group(csg);
18402196 Composite child = new cGroup();
....@@ -1846,31 +2202,6 @@
18462202 child = new cGroup();
18472203 csg.addChild(child);
18482204 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
- }
18742205 } else
18752206 if (source == computeAOItem)
18762207 {
....@@ -1890,7 +2221,7 @@
18902221 if (source == invariantsItem)
18912222 {
18922223 System.out.println("Invariants:");
1893
- GrafreeD.grafreeD.universe.invariants();
2224
+ Grafreed.grafreeD.universe.invariants();
18942225 } else
18952226 if (source == memoryItem)
18962227 {
....@@ -1909,6 +2240,46 @@
19092240 {
19102241 DumpObject();
19112242 } else
2243
+ if (source == minButton)
2244
+ {
2245
+ Minimize();
2246
+ } else
2247
+ if (source == maxButton)
2248
+ {
2249
+ Maximize();
2250
+ } else
2251
+ if (source == fullButton)
2252
+ {
2253
+ ToggleFullScreen();
2254
+ } else
2255
+ if (source == undoButton)
2256
+ {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2260
+ Undo();
2261
+ } else
2262
+ if (source == restoreButton)
2263
+ {
2264
+ // Restore current version
2265
+ Restore();
2266
+ } else
2267
+ if (source == replaceButton)
2268
+ {
2269
+ // Overwrite current version
2270
+ Replace();
2271
+ } else
2272
+ if (source == redoButton)
2273
+ {
2274
+ // Go to next version
2275
+ Redo();
2276
+ } else
2277
+ if (source == saveButton)
2278
+ {
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
2282
+ } else
19122283 if (source == oneStepButton)
19132284 {
19142285 Globals.ONESTEP = true;
....@@ -1916,17 +2287,14 @@
19162287 } else
19172288 if (source == screenfitButton)
19182289 {
1919
- //Reload(lastConverter, lastFilename, true);
19202290 ScreenFit();
19212291 } else
19222292 if (source == screenfitpointButton)
19232293 {
1924
- //Reload(lastConverter, lastFilename, true);
19252294 ScreenFitPoint();
19262295 } else
19272296 if (source == snapobjectButton)
19282297 {
1929
- //Reload(lastConverter, lastFilename, true);
19302298 SnapObject();
19312299 } else
19322300 // if (event.getSource() == recompileButton)
....@@ -1963,12 +2331,20 @@
19632331 {
19642332 loadClipboard(true);
19652333 } else
2334
+ if (source == undoItem)
2335
+ {
2336
+ Undo();
2337
+ } else
2338
+ if (source == redoItem)
2339
+ {
2340
+ Redo();
2341
+ } else
19662342 if (source == duplicateItem)
19672343 {
1968
- Object3D keep = GrafreeD.clipboard;
2344
+ Object3D keep = Grafreed.clipboard;
19692345 loadClipboard(false);
19702346 paste(false);
1971
- GrafreeD.clipboard = keep;
2347
+ Grafreed.clipboard = keep;
19722348 } else
19732349 if (source == cloneItem)
19742350 {
....@@ -2188,9 +2564,9 @@
21882564 // group.selection.get(0).setMasterThis(content); // should be identity
21892565 // refreshContents();
21902566 // }
2191
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2567
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21922568 {
2193
- Object3D content = GrafreeD.clipboard.get(0);
2569
+ Object3D content = Grafreed.clipboard.get(0);
21942570
21952571 if (content instanceof cGroup && ((cGroup)content).transientlink )
21962572 content = ((cGroup)content).get(0);
....@@ -2240,9 +2616,9 @@
22402616 } else
22412617 if (source == setMasterItem)
22422618 {
2243
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2619
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22442620 {
2245
- Object3D content = GrafreeD.clipboard.get(0);
2621
+ Object3D content = Grafreed.clipboard.get(0);
22462622
22472623 if (content instanceof cGroup && ((cGroup)content).transientlink )
22482624 content = ((cGroup)content).get(0);
....@@ -2255,9 +2631,9 @@
22552631 {
22562632 if (group.selection.size() == 1)
22572633 {
2258
- if (GrafreeD.clipboard.size() == 1)
2634
+ if (Grafreed.clipboard.size() == 1)
22592635 {
2260
- Object3D content = GrafreeD.clipboard.get(0);
2636
+ Object3D content = Grafreed.clipboard.get(0);
22612637
22622638 if (content instanceof cGroup && ((cGroup)content).transientlink )
22632639 content = ((cGroup)content).get(0);
....@@ -2274,7 +2650,7 @@
22742650 {
22752651 RevertMeshes();
22762652 } else
2277
- if (source == resetMeshItem)
2653
+ if (source == resetAllItem)
22782654 {
22792655 ResetAll();
22802656 } else
....@@ -2294,9 +2670,9 @@
22942670 {
22952671 ClearSelection(true);
22962672 } else
2297
- if (source == grabItem)
2673
+ if (source == grabItem || source == groupButton)
22982674 {
2299
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
23002676 } else
23012677 if (source == hideItem)
23022678 {
....@@ -2314,11 +2690,11 @@
23142690 {
23152691 makeSomething(new Camera());
23162692 } else
2317
- if (source == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
23182694 {
23192695 group(new Composite());
23202696 } else
2321
- if (source == randomItem)
2697
+ if (source == switchItem || source == switchButton)
23222698 {
23232699 RandomNode random = new RandomNode();
23242700 group(random);
....@@ -2420,7 +2796,7 @@
24202796 {
24212797 group(new cLinker());
24222798 } else
2423
- if (source == textureItem)
2799
+ if (source == textureItem || source == textureButton)
24242800 {
24252801 group(new TextureNode());
24262802 } else
....@@ -2440,17 +2816,30 @@
24402816 {
24412817 CastShadow(2);
24422818 } else
2443
- if (source == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
24442820 {
2445
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
24462823 for (int i=0; i<group.selection.size(); i++)
24472824 {
2448
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
24492830 }
24502831
2451
- ClearSelection(false);
2452
-
2453
- refreshContents();
2832
+ if (!hasRoot)
2833
+ {
2834
+ for (int i=0; i<group.selection.size(); i++)
2835
+ {
2836
+ Ungroup(group.selection.get(i));
2837
+ }
2838
+
2839
+ ClearSelection(false);
2840
+
2841
+ refreshContents();
2842
+ }
24542843 } else
24552844 if (source == genUVItem)
24562845 {
....@@ -2462,7 +2851,7 @@
24622851 } else
24632852 if (source == genNormalsMESHItem)
24642853 {
2465
- GenNormals(true); // TODO
2854
+ GenNormalsMESH();
24662855 } else
24672856 if (source == genNormalsORGANItem)
24682857 {
....@@ -2527,6 +2916,22 @@
25272916 if (source == unmarkleavesItem)
25282917 {
25292918 MarkLeaves(false);
2919
+ } else
2920
+ if (source == rewindleavesItem)
2921
+ {
2922
+ RewindLeaves(true);
2923
+ } else
2924
+ if (source == unrewindleavesItem)
2925
+ {
2926
+ RewindLeaves(false);
2927
+ } else
2928
+ if (source == randomleavesItem)
2929
+ {
2930
+ RandomLeaves(true);
2931
+ } else
2932
+ if (source == unrandomleavesItem)
2933
+ {
2934
+ RandomLeaves(false);
25302935 } else
25312936 if (source == flipVItem)
25322937 {
....@@ -2612,9 +3017,13 @@
26123017 {
26133018 SmoothMesh();
26143019 } else
2615
- if (source == transformgeometryItem)
3020
+ if (source == transformGeometryItem)
26163021 {
26173022 TransformGeometry();
3023
+ } else
3024
+ if (source == transformChildrenItem)
3025
+ {
3026
+ TransformChildren();
26183027 } else
26193028 if (source == resetTransformItem)
26203029 {
....@@ -2622,7 +3031,11 @@
26223031 } else
26233032 if (source == resetCentroidItem)
26243033 {
2625
- ResetCentroid();
3034
+ ResetCentroid(true);
3035
+ } else
3036
+ if (source == resetCentroidXZItem)
3037
+ {
3038
+ ResetCentroid(false);
26263039 } else
26273040 if (source == resetParentItem)
26283041 {
....@@ -2754,6 +3167,10 @@
27543167 if (source == twoButton)
27553168 {
27563169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
27573174 // bug
27583175 //gridPanel.setDividerLocation(1.0);
27593176 //bigPanel.setDividerLocation(0.0);
....@@ -2786,10 +3203,31 @@
27863203 bigThree.ClearUI();
27873204 bigThree.add(centralPanel);
27883205 bigThree.FlushUI();
3206
+
3207
+ cameraView.requestFocusInWindow();
3208
+
3209
+// refreshContents(true);
3210
+//
3211
+// try
3212
+// {
3213
+// java.awt.Robot bot = new java.awt.Robot();
3214
+// int mask = InputEvent.BUTTON1_MASK;
3215
+// bot.mouseMove(100, 100);
3216
+// bot.mousePress(mask);
3217
+// bot.mouseRelease(mask);
3218
+// }
3219
+// catch (Exception e)
3220
+// {
3221
+//
3222
+// }
3223
+
27893224 } else
27903225 if (source == threeButton)
27913226 {
27923227 radio.layout = threeButton;
3228
+
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
27933231
27943232 // bigThree.remove(scenePanel);
27953233 // bigThree.remove(centralPanel);
....@@ -2822,10 +3260,15 @@
28223260 bigThree.add(centralPanel);
28233261 bigThree.add(XYZPanel);
28243262 bigThree.FlushUI();
3263
+
3264
+ cameraView.requestFocusInWindow();
28253265 } else
28263266 if (source == fourButton)
28273267 {
28283268 radio.layout = fourButton;
3269
+
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
28293272
28303273 // bigThree.remove(scenePanel);
28313274 // bigThree.remove(centralPanel);
....@@ -2857,10 +3300,15 @@
28573300 bigThree.ClearUI();
28583301 bigThree.add(scenePanel);
28593302 bigThree.FlushUI();
3303
+
3304
+ cameraView.requestFocusInWindow();
28603305 } else
28613306 if (source == sixButton)
28623307 {
28633308 radio.layout = sixButton;
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
28643312
28653313 // bigThree.remove(scenePanel);
28663314 // bigThree.remove(centralPanel);
....@@ -2893,10 +3341,15 @@
28933341 bigThree.add(scenePanel);
28943342 bigThree.add(centralPanel);
28953343 bigThree.FlushUI();
3344
+
3345
+ cameraView.requestFocusInWindow();
28963346 } else
28973347 if (source == sevenButton)
28983348 {
28993349 radio.layout = sevenButton;
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
29003353
29013354 // bigThree.remove(scenePanel);
29023355 // bigThree.remove(centralPanel);
....@@ -2930,6 +3383,8 @@
29303383 bigThree.add(centralPanel);
29313384 bigThree.add(XYZPanel);
29323385 bigThree.FlushUI();
3386
+
3387
+ cameraView.requestFocusInWindow();
29333388 } else
29343389 if (source == rootButton)
29353390 {
....@@ -2941,6 +3396,7 @@
29413396 EditObject(obj);
29423397 }
29433398
3399
+ cameraView.requestFocusInWindow();
29443400 refreshContents(true);
29453401 } else
29463402 if (source == closeButton)
....@@ -2950,22 +3406,37 @@
29503406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29513407 {
29523408 ab = (cRadio)e.nextElement();
2953
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29543410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
29553417 buttonGroup.remove(ab);
29563418 radioPanel.remove(ab);
29573419
2958
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
29593422 // ab.GetObject().objectUI = null; // ?????????
29603423
29613424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29623425 break;
29633426 }
29643427 }
3428
+
3429
+ cameraView.requestFocusInWindow();
29653430 refreshContents(true);
29663431 } else
29673432 if (source == editItem || source == editButton)
29683433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
29693440 EditSelection(false);
29703441 } else
29713442 if (source == uneditButton)
....@@ -2975,10 +3446,11 @@
29753446 Object3D child = (Object3D)e.nextElement();
29763447 if(child.editWindow != null)
29773448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
29783450 child.CloseUI();
29793451 listUI.remove(child);
29803452
2981
- child.editWindow = null; // ???????????
3453
+ //child.editWindow = null; // ???????????
29823454 }
29833455 objEditor.ctrlPanel.FlushUI();
29843456 //objEditor.jTree.clearSelection();
....@@ -2991,6 +3463,7 @@
29913463 //copy.ClearUI();
29923464 for (Object3D obj : listUI)
29933465 {
3466
+ obj.pinned = false;
29943467 obj.CloseUI();
29953468 }
29963469 listUI.clear();
....@@ -3000,7 +3473,7 @@
30003473 {
30013474 assert(copy == group);
30023475
3003
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30043477
30053478 for (Object3D obj : listUI)
30063479 {
....@@ -3049,6 +3522,9 @@
30493522 }
30503523
30513524 copy = group;
3525
+
3526
+ SetUndoStates();
3527
+
30523528 //Globals.theRenderer.object = group;
30533529 if(!useclient)
30543530 {
....@@ -3064,20 +3540,46 @@
30643540 frontView.object = group;
30653541 sideView.object = group;
30663542 }
3067
- group.editWindow = this;
3543
+
3544
+// fix "+" issue
3545
+ //group.editWindow = this;
3546
+ group.manipWindow = this;
3547
+
30683548 /*
30693549 currentLayout = radio.layout;
30703550 if (currentLayout == null)
30713551 currentLayout = sevenButton;
30723552 */
30733553 radio.layout.doClick();
3554
+
3555
+ ClearUnpinned();
3556
+ Grafreed.Assert(group != null);
3557
+ Grafreed.Assert(group.selection != null);
3558
+ SetPinStates(group.selection.size() > 0);
3559
+ if (group.selection.size() == 1)
3560
+ EditSelection(false);
30743561 keepparent = group.parent;
30753562 // PARENT = NULL or not???
30763563 //group.parent = null; // ROOT
30773564 //group.attributes = -1;
30783565 ResetModel();
3566
+
3567
+ cameraView.requestFocusInWindow();
30793568 refreshContents(true);
3080
- }
3569
+ } else if (event.getSource() == editCameraItem)
3570
+ {
3571
+ cameraView.ProtectCamera();
3572
+ cameraView.repaint();
3573
+ return;
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3575
+ {
3576
+ cameraView.RevertCamera();
3577
+ cameraView.repaint();
3578
+ return;
3579
+ // } else if (event.getSource() == textureButton)
3580
+ // {
3581
+ // return; // true;
3582
+ }
30813583 else
30823584 {
30833585 //return super.action(event, arg);
....@@ -3086,7 +3588,6 @@
30863588 }
30873589
30883590 boolean useclient = false;
3089
- cRadio radio;
30903591
30913592 void ToggleRoot()
30923593 {
....@@ -3138,6 +3639,28 @@
31383639 refreshContents();
31393640 }
31403641
3642
+ void TransformChildren()
3643
+ {
3644
+ Object3D obj;
3645
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3646
+ {
3647
+ obj = (Object3D)e.nextElement();
3648
+ obj.KeepTextureMatrices();
3649
+ obj.TransformChildren();
3650
+ obj.RestoreTextureMatrices();
3651
+
3652
+// if (obj.parent == null)
3653
+// {
3654
+// System.out.println("NULL PARENT!");
3655
+// new Exception().printStackTrace();
3656
+// }
3657
+// else
3658
+// TouchTransform(obj);
3659
+// //obj.parent.Touch();
3660
+ }
3661
+
3662
+ refreshContents();
3663
+ }
31413664
31423665 void ResetTransform()
31433666 {
....@@ -3250,7 +3773,7 @@
32503773 refreshContents();
32513774 }
32523775
3253
- void ResetCentroid()
3776
+ void ResetCentroid(boolean full)
32543777 {
32553778 Object3D obj;
32563779 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3265,12 +3788,16 @@
32653788 LA.matIdentity(Object3D.mat);
32663789 obj.getBounds(minima, maxima, false);
32673790 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3268
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3791
+ if (full)
3792
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32693793 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32703794 obj.TransformMesh(Object3D.mat);
3795
+
32713796 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3272
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3797
+ if (full)
3798
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32733799 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3800
+
32743801 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32753802 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32763803 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3299,7 +3826,8 @@
32993826
33003827 int size = obj.MemorySize();
33013828
3302
- System.err.println((size/1024) + " KB is the size of " + obj);
3829
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3830
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33033831 }
33043832 }
33053833 catch (Exception e)
....@@ -3336,9 +3864,9 @@
33363864 obj = (Object3D)e.nextElement();
33373865
33383866 System.out.println("Object is: " + obj);
3339
- GrafreeD.AnalyzeObject(obj);
3867
+ Grafreed.AnalyzeObject(obj);
33403868 System.out.println("Boundary rep: " + obj.bRep);
3341
- GrafreeD.AnalyzeObject(obj.bRep);
3869
+ Grafreed.AnalyzeObject(obj.bRep);
33423870
33433871 // System.err.println((size/1024) + " KB is the size of " + obj);
33443872 }
....@@ -3380,6 +3908,13 @@
33803908 void GenNormals(boolean crease)
33813909 {
33823910 group.GenNormalsS(crease);
3911
+
3912
+ refreshContents();
3913
+ }
3914
+
3915
+ void GenNormalsMESH()
3916
+ {
3917
+ group.GenNormalsMeshS();
33833918
33843919 refreshContents();
33853920 }
....@@ -3552,8 +4087,8 @@
35524087
35534088 void ParseVertices()
35544089 {
3555
- boolean epsequal = GrafreeD.epsequal;
3556
- GrafreeD.epsequal = true;
4090
+ boolean epsequal = Grafreed.epsequal;
4091
+ Grafreed.epsequal = true;
35574092
35584093 for (int i=0; i<group.selection.size(); i++)
35594094 {
....@@ -3578,7 +4113,7 @@
35784113 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35794114 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35804115
3581
- g.add(GrafreeD.clipboard);
4116
+ g.add(Grafreed.clipboard);
35824117
35834118 buffer.add(g);
35844119 }
....@@ -3593,7 +4128,7 @@
35934128 makeSomething(buffer, i==group.selection.size()-1);
35944129 }
35954130
3596
- GrafreeD.epsequal = epsequal;
4131
+ Grafreed.epsequal = epsequal;
35974132
35984133 refreshContents();
35994134 }
....@@ -3611,7 +4146,16 @@
36114146 String pigment = Object3D.GetPigment(tex);
36124147 //String bump = Object3D.GetBump(tex);
36134148
3614
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4149
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4150
+
4151
+ try
4152
+ {
4153
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4154
+ }
4155
+ catch (Exception e)
4156
+ {
4157
+ System.err.println("FAIL: " + node);
4158
+ }
36154159
36164160 double s = v.s;
36174161
....@@ -3743,7 +4287,7 @@
37434287 return;
37444288
37454289 Object3D poses = group.selection.get(0);
3746
- Object3D ref = GrafreeD.clipboard.get(0);
4290
+ Object3D ref = Grafreed.clipboard.get(0);
37474291
37484292 Object3D newgroup = new Object3D("Po:" + poses.name);
37494293
....@@ -3937,9 +4481,9 @@
39374481
39384482 void ClipMesh()
39394483 {
3940
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4484
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39414485 {
3942
- Object3D content = GrafreeD.clipboard.get(0);
4486
+ Object3D content = Grafreed.clipboard.get(0);
39434487
39444488 if (content instanceof cGroup && ((cGroup)content).transientlink )
39454489 content = ((cGroup)content).get(0);
....@@ -3948,7 +4492,7 @@
39484492 // {
39494493 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39504494 // }
3951
- group.selection.ClipMesh(GrafreeD.clipboard);
4495
+ group.selection.ClipMesh(Grafreed.clipboard);
39524496 }
39534497 // group.selection.ClipMesh(GrafreeD.clipboard);
39544498 System.out.println("DONE.");
....@@ -3995,6 +4539,18 @@
39954539 void MarkLeaves(boolean hide)
39964540 {
39974541 group.selection.MarkLeaves(hide);
4542
+ refreshContents();
4543
+ }
4544
+
4545
+ void RewindLeaves(boolean hide)
4546
+ {
4547
+ group.selection.RewindLeaves(hide);
4548
+ refreshContents();
4549
+ }
4550
+
4551
+ void RandomLeaves(boolean hide)
4552
+ {
4553
+ group.selection.RandomLeaves(hide);
39984554 refreshContents();
39994555 }
40004556
....@@ -4069,10 +4625,6 @@
40694625 // }
40704626 // }
40714627
4072
- static boolean allparams = true;
4073
-
4074
- static Vector<Object3D> listUI = new Vector<Object3D>();
4075
-
40764628 void EditSelection(boolean newWindow)
40774629 {
40784630 // aConstraints.gridy = 0;
....@@ -4080,10 +4632,10 @@
40804632 {
40814633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40824634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4083
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40844636
40854637 Object3D elem = (Object3D)group.selection.elementAt(i);
4086
- if(elem != group)
4638
+ if(elem != group || !newWindow)
40874639 {
40884640 // if (!(elem instanceof Composite))
40894641 // newWindow = false;
....@@ -4165,7 +4717,8 @@
41654717 //new Exception().printStackTrace();
41664718
41674719 freezemodel = true;
4168
-
4720
+ ClearUnpinned();
4721
+
41694722 /**/
41704723 //switch (event.id)
41714724 {
....@@ -4173,7 +4726,6 @@
41734726 //case 702: // Event.LIST_DESELECT
41744727 group.deselectAll();
41754728 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4176
- objEditor.ClearInfo(); // .GetMaterial());
41774729 if (tps != null)
41784730 {
41794731 for (int i=0; i < tps.length; i++)
....@@ -4182,10 +4734,8 @@
41824734
41834735 //if (child.parent != null)
41844736 //child.parent.addSelectee(child);
4737
+ objEditor.SetMaterial(child);
41854738 group.addSelectee(child);
4186
- objEditor.SetMaterial(child); // .GetMaterial());
4187
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4188
- System.err.println("info : " + child.GetPath());
41894739 }
41904740 }
41914741 // else
....@@ -4195,20 +4745,28 @@
41954745 // System.err.println("info : " + group.GetPath());
41964746 // }
41974747
4198
- objEditor.SetText(); // jan 2014
4199
-
4200
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4748
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42014749 CameraPane.flash = true;
42024750
4203
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4751
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42044752 // a camera
42054753 {
4206
- CameraPane.camerachangeframe = 0; // don't refuse it
4207
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4755
+ {
4756
+ CameraPane.camerachangeframe = 0; // don't refuse it
4757
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4758
+ }
42084759 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42094760 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42104761 }
42114762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
42124770 refreshContents();
42134771 //return true;
42144772 }
....@@ -4217,6 +4775,35 @@
42174775
42184776 freezemodel = false;
42194777 }
4778
+
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
4787
+ void refreshContents(boolean cp)
4788
+ {
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4791
+ {
4792
+ objEditor.ClearInfo(); // .GetMaterial());
4793
+
4794
+ for (int i=0; i < group.selection.Size(); i++)
4795
+ {
4796
+ Object3D child = (Object3D) group.selection.get(i);
4797
+
4798
+ objEditor.AddInfo(child, this, true);
4799
+ System.err.println("info : " + child.GetPath());
4800
+ }
4801
+
4802
+ objEditor.SetText(); // jan 2014
4803
+ }
4804
+
4805
+ super.refreshContents(cp);
4806
+ }
42204807
42214808 void linkSomething(Object3D thing)
42224809 {
....@@ -4288,16 +4875,19 @@
42884875 {
42894876 if (group.selection.isEmpty())
42904877 return;
4291
- GrafreeD.clipboardIsTempGroup = false;
4878
+
4879
+ Grafreed.clipboardIsTempGroup = false;
42924880 Composite tGroup = null;
42934881 if (group.selection.size() > 0) // 1)
42944882 {
42954883 tGroup = new cGroup();
4296
- GrafreeD.clipboardIsTempGroup = true;
4884
+ Grafreed.clipboardIsTempGroup = true;
42974885 }
42984886
42994887 if (cut)
43004888 {
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
43014891 //int indices[] = jList.getSelectedIndices();
43024892 //for (int i = indices.length - 1; i >= 0; i--)
43034893 //jList.remove(indices[i]);
....@@ -4333,16 +4923,16 @@
43334923 //System.out.println("cut " + child);
43344924 //System.out.println("parent = " + child.parent);
43354925 // tmp.addChild(child);
4336
- if (GrafreeD.clipboardIsTempGroup)
4926
+ if (Grafreed.clipboardIsTempGroup)
43374927 tGroup.add/*Child*/(tmp);
43384928 else
4339
- GrafreeD.clipboard = tmp;
4929
+ Grafreed.clipboard = tmp;
43404930 }
43414931 else
4342
- if (GrafreeD.clipboardIsTempGroup)
4932
+ if (Grafreed.clipboardIsTempGroup)
43434933 tGroup.add/*Child*/(child);
43444934 else
4345
- GrafreeD.clipboard = child;
4935
+ Grafreed.clipboard = child;
43464936 }
43474937
43484938 //ResetModel();
....@@ -4374,21 +4964,23 @@
43744964 //System.out.println("cut " + elem);
43754965 //System.out.println("parent = " + elem.parent);
43764966 // tmp.addChild(elem);
4377
- if (GrafreeD.clipboardIsTempGroup)
4967
+ if (Grafreed.clipboardIsTempGroup)
43784968 tGroup.add/*Child*/(tmp);
43794969 else
4380
- GrafreeD.clipboard = tmp;
4970
+ Grafreed.clipboard = tmp;
43814971 }
43824972 else
4383
- if (GrafreeD.clipboardIsTempGroup)
4973
+ if (Grafreed.clipboardIsTempGroup)
43844974 tGroup.add/*Child*/(child);
43854975 else
4386
- GrafreeD.clipboard = child;
4976
+ Grafreed.clipboard = child;
43874977 }
43884978
43894979 }
4390
- if (GrafreeD.clipboardIsTempGroup)
4391
- GrafreeD.clipboard = tGroup;
4980
+
4981
+ if (Grafreed.clipboardIsTempGroup)
4982
+ Grafreed.clipboard = tGroup;
4983
+
43924984 if (cut)
43934985 {
43944986 ResetModel();
....@@ -4398,11 +4990,15 @@
43984990
43994991 void paste(boolean expand)
44004992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
44014997 // if (GrafreeD.clipboard == null)
44024998 // return;
44034999 boolean first = true;
44045000
4405
- if (GrafreeD.clipboardIsTempGroup)
5001
+ if (Grafreed.clipboardIsTempGroup)
44065002 {
44075003 Composite temp;
44085004
....@@ -4413,7 +5009,7 @@
44135009 temp = (Composite)Applet3D.clipboard.deepCopy();
44145010 */
44155011 Object3D elem;
4416
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5012
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44175013 {
44185014 Object3D child = (Object3D)e.nextElement();
44195015
....@@ -4447,16 +5043,17 @@
44475043 //Object3D cb = Applet3D.clipboard;
44485044 //temp.addChild(cb);
44495045 //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());
5046
+ assert(Grafreed.clipboard.parent == null);
5047
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5048
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5049
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5050
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44555051 else
4456
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4457
- GrafreeD.clipboard.get(0).parent = keepparent;
5052
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5053
+ Grafreed.clipboard.get(0).parent = keepparent;
44585054 }
44595055
5056
+ Globals.REPLACEONMAKE = keep;
44605057 ResetModel();
44615058 refreshContents();
44625059 }
....@@ -4503,9 +5100,9 @@
45035100 {
45045101 boolean first = true;
45055102
4506
- if (GrafreeD.clipboardIsTempGroup)
5103
+ if (Grafreed.clipboardIsTempGroup)
45075104 {
4508
- Composite temp = (Composite)GrafreeD.clipboard;
5105
+ Composite temp = (Composite)Grafreed.clipboard;
45095106 Object3D copy;
45105107 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45115108 {
....@@ -4515,7 +5112,7 @@
45155112 }
45165113 } else
45175114 {
4518
- linkSomething(GrafreeD.clipboard); //.get(0));
5115
+ linkSomething(Grafreed.clipboard); //.get(0));
45195116 }
45205117 }
45215118 }
....@@ -4592,6 +5189,10 @@
45925189
45935190 void group(Object3D csg, boolean grab)
45945191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
45955196 if (//false) // why??
45965197 !group.selection.isEmpty())
45975198 {
....@@ -4705,10 +5306,15 @@
47055306 //node.add(csg);
47065307 //makeSomething(node);
47075308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
47085310 }
47095311
47105312 void Ungroup(Object3D g)
47115313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
47125318 if (g instanceof HiddenObject)
47135319 {
47145320 HiddenObject h = (HiddenObject) g;
....@@ -4725,6 +5331,7 @@
47255331 objEditor.makeSomething(g.get(i), false);
47265332 }
47275333 }
5334
+ Globals.REPLACEONMAKE = keep;
47285335 }
47295336
47305337 void ungroup()
....@@ -4920,21 +5527,6 @@
49205527 }
49215528 */
49225529
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
-
49385530 /*
49395531 public void Callback(Object obj)
49405532 {
....@@ -4958,26 +5550,9 @@
49585550 }
49595551 */
49605552
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
-
49785553 String GetFile(String dialogName)
49795554 {
4980
- if (GrafreeD.standAlone)
5555
+ if (Grafreed.standAlone)
49815556 {
49825557 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49835558 browser.show();
....@@ -5045,7 +5620,28 @@
50455620 cButton clearpanelButton;
50465621 cButton unselectButton;
50475622
5623
+ cButton restoreCameraButton;
5624
+
5625
+ cButton saveButton;
50485626 cButton oneStepButton;
5627
+
5628
+ cButton groupButton;
5629
+ cButton ungroupButton;
5630
+ cButton compositeButton;
5631
+ cButton switchButton;
5632
+ cButton loopButton;
5633
+ cButton textureButton;
5634
+
5635
+ cButton gridButton;
5636
+ cButton boxButton;
5637
+ cButton sphereButton;
5638
+ cButton coneButton;
5639
+ cButton torusButton;
5640
+ cButton superButton;
5641
+ cButton kleinButton;
5642
+ cButton particlesButton;
5643
+ cButton overlayButton;
5644
+ cButton lightButton;
50495645
50505646 cButton screenfitButton;
50515647 cButton screenfitpointButton;
....@@ -5058,14 +5654,6 @@
50585654
50595655 cButton setsupportButton;
50605656
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
-
50695657 //
50705658 //Composite
50715659 Object3D // to do !!
....@@ -5075,9 +5663,11 @@
50755663 //JTree jTree;
50765664 private MenuItem lookAtItem;
50775665 private MenuItem lookFromItem;
5078
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
50795667 private MenuItem cutItem;
5080
- private MenuItem duplicateItem;
5668
+ private MenuItem undoItem;
5669
+ private MenuItem redoItem;
5670
+ private JMenuItem duplicateItem;
50815671 private MenuItem cloneItem;
50825672 private MenuItem cloneSupportItem;
50835673 private MenuItem overwriteGeoItem;
....@@ -5090,7 +5680,7 @@
50905680 private MenuItem linkverticesItem;
50915681 private MenuItem relinkverticesItem;
50925682 private MenuItem setMasterItem;
5093
- private MenuItem resetMeshItem;
5683
+ private MenuItem resetAllItem;
50945684 private MenuItem stepAllItem;
50955685 private MenuItem revertMeshItem;
50965686 private MenuItem poseMeshItem;
....@@ -5140,6 +5730,10 @@
51405730 private MenuItem showleavesItem;
51415731 private MenuItem markleavesItem;
51425732 private MenuItem unmarkleavesItem;
5733
+ private MenuItem rewindleavesItem;
5734
+ private MenuItem unrewindleavesItem;
5735
+ private MenuItem randomleavesItem;
5736
+ private MenuItem unrandomleavesItem;
51435737
51445738 private MenuItem flipVItem;
51455739 private MenuItem unflipVItem;
....@@ -5151,15 +5745,17 @@
51515745 private MenuItem panoTexturesItem;
51525746
51535747 private MenuItem resetCentroidItem;
5154
- private MenuItem transformgeometryItem;
5748
+ private MenuItem resetCentroidXZItem;
51555749 private MenuItem resetTransformItem;
5750
+ private MenuItem transformGeometryItem;
5751
+ private MenuItem transformChildrenItem;
51565752 private MenuItem hideItem;
51575753 private MenuItem grabItem;
51585754 private MenuItem backItem;
51595755 private MenuItem frontItem;
51605756 private MenuItem cameraItem;
51615757 private MenuItem compositeItem;
5162
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
51635759 private MenuItem physicsItem;
51645760 private MenuItem frameselectorItem;
51655761 private MenuItem scriptNodeItem;
....@@ -5221,11 +5817,6 @@
52215817 private MenuItem doubleItem;
52225818 private MenuItem tripleItem;
52235819
5224
- private MenuItem importGFDItem;
5225
- private MenuItem importVRMLX3DItem;
5226
- private MenuItem import3DSItem;
5227
- private MenuItem importOBJItem;
5228
-
52295820 private MenuItem computeAOItem;
52305821 private MenuItem recompileItem;
52315822 private MenuItem editScriptItem;
....@@ -5235,4 +5826,8 @@
52355826 private MenuItem analyzeItem;
52365827 private MenuItem dumpItem;
52375828 //boolean freezemodel = false;
5829
+
5830
+ Menu cameraMenu;
5831
+ MenuItem editCameraItem;
5832
+ MenuItem restoreCameraItem;
52385833 }