Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -74,7 +80,13 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
77
- SetupMenu2(objEditor);
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
89
+ SetupMenu2(this); //objEditor);
7890 SetupUI2(objEditor);
7991 objEditor.SetupUI(true);
8092 SetupViews(objEditor);
....@@ -84,6 +96,10 @@
8496
8597 void CloneSelection(boolean supports)
8698 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
87103 // Object3D keep = GrafreeD.clipboard;
88104 //Object3D obj;
89105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,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"));
....@@ -197,8 +206,8 @@
197206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
198207 // pasteExpandItem.addActionListener(this);
199208 menu.add("-");
200
- clearItem = menu.add(new MenuItem("Clear"));
201
- clearItem.addActionListener(this);
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
202211
203212 if (Globals.ADVANCED)
204213 {
....@@ -206,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"));
....@@ -332,7 +433,7 @@
332433 genNormalsMESHItem.addActionListener(this);
333434 if (Globals.ADVANCED)
334435 {
335
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
336437 genNormalsMINEItem.addActionListener(this);
337438 }
338439 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -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,38 +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
- 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
-
451555 oe.menuBar.add(menu = new Menu("Tools"));
452556 buildToolsMenu(menu);
453557 }
454558
559
+
455560 void SetupUI2(ObjEditor oe)
456561 {
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
+
457574 //new Exception().printStackTrace();
458575
459576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -482,97 +599,230 @@
482599 oe.radioPanel.add(dummyButton);
483600 oe.buttonGroup.add(dummyButton);
484601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
485606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
486607
487
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
488
- 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");
489660 liveCB.addItemListener(this);
490661
491
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492663 oneStepButton.setToolTipText("Animate one step forward");
493664 oneStepButton.addActionListener(this);
494665
495
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
496667 fastCB.setToolTipText("Fast mode");
497668 fastCB.addItemListener(this);
498669
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);
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);
506675
507676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
508677 // screenfitpointButton.addActionListener(this);
509678
510679 if (Globals.ADVANCED)
511680 {
512
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
681
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
513682 snapobjectButton.addActionListener(this);
514683 snapobjectButton.setToolTipText("Snap Object");
515684 }
516685
517
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
518
- flashSelectionButton.setToolTipText("Show selection");
519
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
520687
521
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
522
-
523
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
524
- twoButton.setToolTipText("Show center view only");
525
- twoButton.addActionListener(this);
526
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527689 fourButton.addActionListener(this);
528690 fourButton.setToolTipText("Show left panel only");
529
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
530
- sixButton.setToolTipText("2-column layout left");
691
+
692
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ twoButton.setToolTipText("Show right view only");
694
+ twoButton.addActionListener(this);
695
+ this.fullscreenLayout = twoButton;
696
+
697
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ sixButton.setToolTipText("Show left and right");
531699 sixButton.addActionListener(this);
532
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
533
- threeButton.setToolTipText("2-column layout right");
534
- threeButton.addActionListener(this);
535
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
536
- sevenButton.setToolTipText("3-column layout");
537
- sevenButton.addActionListener(this);
700
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+// threeButton.setToolTipText("2-column layout right");
702
+// threeButton.addActionListener(this);
703
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+// sevenButton.setToolTipText("3-column layout");
705
+// sevenButton.addActionListener(this);
538706 //
539707
540
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
541
- rootButton.setToolTipText("Edit selection in new tab");
708
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ rootButton.setToolTipText("Open selection in new tab");
542710 rootButton.addActionListener(this);
543711
544
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
712
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
545713 closeButton.setToolTipText("Close tab");
546714 closeButton.addActionListener(this);
547715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
548716 //clearButton.addActionListener(this);
549
-
550
- cGridBag commandsPanel = new cGridBag();
717
+
718
+ // INSERT
719
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
720
+ gridButton.setToolTipText("Create grid");
721
+ gridButton.addActionListener(this);
722
+
723
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ boxButton.setToolTipText("Create box");
725
+ boxButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ sphereButton.setToolTipText("Create sphere");
729
+ sphereButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ coneButton.setToolTipText("Create cone");
733
+ coneButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ torusButton.setToolTipText("Create torus");
737
+ torusButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ superButton.setToolTipText("Create superellipsoid");
741
+ superButton.addActionListener(this);
742
+
743
+ if (Globals.ADVANCED)
744
+ {
745
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ kleinButton.setToolTipText("Create Klein bottle");
747
+ kleinButton.addActionListener(this);
748
+ }
551749
552
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
553
- editButton.setToolTipText("Edit selection");
750
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751
+ particlesButton.setToolTipText("Create particle system");
752
+ particlesButton.addActionListener(this);
753
+
754
+ oe.toolboxPanel.Return();
755
+
756
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ groupButton.setToolTipText("Create group");
758
+ groupButton.addActionListener(this);
759
+
760
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ compositeButton.setToolTipText("Create composite");
762
+ compositeButton.addActionListener(this);
763
+
764
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ switchButton.setToolTipText("Create item switcher");
766
+ switchButton.addActionListener(this);
767
+
768
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ loopButton.setToolTipText("Create loop");
770
+ loopButton.addActionListener(this);
771
+
772
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ textureButton.setToolTipText("Create texture");
774
+ textureButton.addActionListener(this);
775
+
776
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ overlayButton.setToolTipText("Create overlay");
778
+ overlayButton.addActionListener(this);
779
+
780
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ lightButton.setToolTipText("Create light");
782
+ lightButton.addActionListener(this);
783
+
784
+ for (int i=6; --i>=0;)
785
+ {
786
+ oe.toolboxPanel.Return();
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ }
795
+
796
+ // EDIT panel
797
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
798
+ editButton.setToolTipText("Pin selection controls");
554799 editButton.addActionListener(this);
555800
556
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
557
- uneditButton.setToolTipText("Unedit selection");
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
558803 uneditButton.addActionListener(this);
559804
560
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
561
- allParamsButton.setToolTipText("Edit all params");
805
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
806
+ allParamsButton.setToolTipText("Show all controle");
562807 allParamsButton.addActionListener(this);
563808
564
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
809
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565810 clearPanelButton.setToolTipText("Clear edit panel");
566811 clearPanelButton.addActionListener(this);
567812
568
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
813
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569814 unselectButton.setToolTipText("Unselect");
570815 unselectButton.addActionListener(this);
571816
572
- commandsPanel.preferredHeight = 1;
817
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
818
+ flashSelectionButton.setToolTipText("Highlight selection");
819
+ flashSelectionButton.addActionListener(this);
573820
574
- oe.treePanel.add(commandsPanel);
575
- oe.treePanel.Return();
821
+ editCommandsPanel.preferredHeight = 1;
822
+
823
+ SetPinStates(false);
824
+// oe.treePanel.add(commandsPanel);
825
+// oe.treePanel.Return();
576826
577827 // oe.aConstraints.gridx += 1;
578828 // oe.aConstraints.weighty = 0;
....@@ -589,29 +839,17 @@
589839
590840 JScrollPane jSP;
591841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
592
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
593843 ResetModel();
594844
595845 oe.treePanel.add(jSPPanel);
596846 oe.treePanel.Return();
597847
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;
613848 oe.treePanel.add(copyOptionsPanel);
614849 oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
615853
616854 // mainPanel.setDividerLocation(0.5); //1.0);
617855 // mainPanel.setResizeWeight(0.5);
....@@ -634,29 +872,49 @@
634872 dgr.addDragGestureListener(this);
635873 }catch(Exception e) {}
636874 */
637
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
638876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
639877 }
640878
641879 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
642880 {
881
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
882
+ colorCB.setToolTipText("Copy color when dropped");
883
+ colorCB.addItemListener(this);
884
+
885
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
886
+ materialCB.setToolTipText("Copy material when dropped");
887
+ materialCB.addItemListener(this);
888
+
889
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
890
+ textureCB.setToolTipText("Copy texture when dropped");
891
+ textureCB.addItemListener(this);
892
+
893
+ panel.Return();
894
+
643895 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
644896 boxCB.setToolTipText("Display bounding boxes");
645897 boxCB.addItemListener(this);
646898
647899 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
648
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
649901 zoomBoxCB.addItemListener(this);
650902
651
- if (Globals.ADVANCED)
903
+ if (true) // Globals.ADVANCED)
652904 {
653
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
654
- supportCB.setToolTipText("Enable rigging");
655
- supportCB.addItemListener(this);
905
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
906
+// supportCB.setToolTipText("Enable rigging");
907
+// supportCB.addItemListener(this);
908
+
909
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
910
+ freezeCB.setToolTipText("Fast moving camera");
911
+ freezeCB.addItemListener(this);
656912
657913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
658914 // localCB.addItemListener(this);
659915
916
+ panel.Return();
917
+
660918 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
661919 crowdCB.setToolTipText("Used for crowds");
662920 crowdCB.addItemListener(this);
....@@ -673,6 +931,8 @@
673931 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
674932 // speakerMocapCB.addItemListener(this);
675933
934
+ panel.Return();
935
+
676936 if (false)
677937 {
678938 // handled in scripts
....@@ -687,42 +947,85 @@
687947 //constraints.gridy += 1;
688948 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
689949 smoothfocusCB.addItemListener(this);
950
+ panel.Return();
690951 }
691952
692953 //constraints.gridx += 1;
693954 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
694955 // debugCB.addItemListener(this);
695956
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
696961 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
962
+ oeilCB.setToolTipText("Move camera when tracking");
697963 oeilCB.addItemListener(this);
698964
965
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
966
+ shadowCB.setToolTipText("When live compute shadows");
967
+ shadowCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
971
+ toggleTextureCB.setToolTipText("Load textures");
972
+ toggleTextureCB.addItemListener(this);
973
+
974
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
975
+ toggleSwitchCB.setToolTipText("Choose a single item");
976
+ toggleSwitchCB.addItemListener(this);
977
+
978
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
979
+ autokeepCB.setToolTipText("On structure change");
980
+ autokeepCB.addItemListener(this);
981
+
982
+ panel.Return();
983
+ if (Globals.ADVANCED)
984
+ {
699985 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
700986 lookAtCB.setToolTipText("Look-at target");
701987 lookAtCB.addItemListener(this);
988
+ }
702989
703990 }
704991
705992 cGridBag fill = new cGridBag();
706
-
707993 fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
708998
709999 panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
7101002
7111003 }
7121004
7131005 void EditObject(Object3D obj)
7141006 {
7151007 cRadio radioButton = new cRadio(obj.name);
1008
+
1009
+ // June 2019. Patch to avoid bug with transparency.
1010
+ radioButton.hadMaterial = obj.material != null;
1011
+ if (!radioButton.hadMaterial)
1012
+ {
1013
+ obj.material = new cMaterial();
1014
+ }
1015
+
7161016 radioButton.SetObject(obj);
717
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
7181018 radioButton.SetCamera(cameraView.renderCamera, false);
7191019 radioButton.addActionListener(this);
7201020 radioPanel.add(radioButton);
7211021 buttonGroup.add(radioButton);
7221022 radioButton.doClick();
7231023 }
1024
+
7241025 void SetupViews(ObjEditor oe)
7251026 {
1027
+ theFrame = this;
1028
+
7261029 oe.SetupViews();
7271030
7281031 System.out.println("SetupViews");
....@@ -731,23 +1034,28 @@
7311034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7321035 }
7331036
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;
1037
+ cToggleButton liveCB;
1038
+ cCheckBox supportCB;
1039
+ cCheckBox localCB;
1040
+ cCheckBox crowdCB;
1041
+ cCheckBox smoothCB;
1042
+ cToggleButton fastCB;
1043
+ cCheckBox slowCB;
1044
+ cCheckBox boxCB;
1045
+ cCheckBox zoomBoxCB;
1046
+ cCheckBox freezeCB;
1047
+ //cToggleButton trackCB;
1048
+ cCheckBox trackCB;
1049
+ cCheckBox smoothfocusCB;
7451050 // JCheckBox speakerMocapCB;
746
- JCheckBox speakerCameraCB;
747
- JCheckBox speakerFocusCB;
748
- JCheckBox debugCB;
749
- JCheckBox oeilCB;
750
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
7511059
7521060 // static int COLOR = 1;
7531061 // static int MATERIAL = 2;
....@@ -755,9 +1063,9 @@
7551063
7561064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7571065
758
- JCheckBox colorCB;
759
- JCheckBox materialCB;
760
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
7611069
7621070 public void itemStateChanged(ItemEvent e)
7631071 {
....@@ -785,6 +1093,7 @@
7851093 } else if(e.getSource() == liveCB)
7861094 {
7871095 cameraView.ToggleLive();
1096
+ refreshContents(false);
7881097 }
7891098 else if(e.getSource() == supportCB)
7901099 {
....@@ -849,6 +1158,18 @@
8491158 {
8501159 cameraView.ToggleOeil();
8511160 }
1161
+ else if(e.getSource() == shadowCB)
1162
+ {
1163
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1164
+ }
1165
+ else if(e.getSource() == freezeCB)
1166
+ {
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
1172
+ }
8521173 else if(e.getSource() == lookAtCB)
8531174 {
8541175 cameraView.ToggleLookAt();
....@@ -865,7 +1186,8 @@
8651186
8661187 /**/
8671188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
868
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
8691191 if ((path == null) || (path.getPathCount() <= 1)) {
8701192 // We can't move the root node or an empty selection
8711193 return;
....@@ -928,8 +1250,6 @@
9281250 }
9291251 }
9301252
931
- String string = (String) object;
932
-
9331253 System.out.println("Transfer = " + object + "; drop : " + target);
9341254 // if( object instanceof java.io.File[])
9351255 // {
....@@ -937,7 +1257,11 @@
9371257 // objEditor.DropFile((java.io.File[]) object, true);
9381258 // return;
9391259 // }
940
- if (string.charAt(0) == '/')
1260
+
1261
+ String string = object.toString();
1262
+
1263
+ // File path for Mac and Windows
1264
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9411265 {
9421266 // file(s)
9431267 String[] names = string.split("\n");
....@@ -964,7 +1288,7 @@
9641288
9651289 flashIt = false;
9661290 CameraPane pane = (CameraPane) target;
967
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1291
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9681292 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9691293
9701294 if (group.selection.size() == 1)
....@@ -980,23 +1304,33 @@
9801304
9811305 assert target == objEditor.jTree;
9821306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
9831308 try {
984
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9851310 } catch (Exception e) {
9861311 System.out.println("destinationPath : " + destinationPath);
9871312 return;
9881313 }
9891314
990
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
9911316 {
1317
+ Object3D child = (Object3D)group.selection.elementAt(i);
1318
+
1319
+ // Cannot move into itself
1320
+ if (child == destinationLeaf)
1321
+ return;
1322
+ }
1323
+
1324
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1325
+// {
9921326 loadClipboard(true);
9931327 objEditor.jTree.setSelectionPath(destinationPath);
9941328 pasteInto(false, false);
995
- } else {
996
- loadClipboard(false);
997
- objEditor.jTree.setSelectionPath(destinationPath);
998
- pasteInto(false, false); // true); // ???
999
- }
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
10001334 }
10011335 public void dropActionChanged(DropTargetDragEvent dtde)
10021336 // Called if the user has modified the current drop gesture
....@@ -1101,22 +1435,30 @@
11011435 {
11021436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11031437 //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);
1438
+// gridItem = menu.add(new MenuItem("Grid"));
1439
+// gridItem.addActionListener(this);
1440
+// rectoidItem = menu.add(new MenuItem("Box"));
1441
+// rectoidItem.addActionListener(this);
1442
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1443
+// ellipsoidItem.addActionListener(this);
1444
+// coneItem = menu.add(new MenuItem("Cone"));
1445
+// coneItem.addActionListener(this);
1446
+// torusItem = menu.add(new MenuItem("Torus"));
1447
+// torusItem.addActionListener(this);
1448
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1449
+// superItem.addActionListener(this);
1450
+
1451
+ cameraItem = menu.add(new MenuItem("Camera"));
1452
+ cameraItem.addActionListener(this);
1453
+
1454
+ if (!Globals.ADVANCED)
1455
+ {
11161456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11171457 kleinItem.addActionListener(this);
1118
- particleItem = menu.add(new MenuItem("Particle system"));
1119
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
11201462 if (Globals.ADVANCED)
11211463 {
11221464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1142,15 +1484,15 @@
11421484 }
11431485 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11441486 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);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
11491491 menu.add("-");
11501492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11511493 //superLoopItem.addActionListener(this);
1152
- loopItem = menu.add(new MenuItem("Loop"));
1153
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
11541496 doubleItem = menu.add(new MenuItem("Fork"));
11551497 doubleItem.addActionListener(this);
11561498 if (Globals.ADVANCED)
....@@ -1166,6 +1508,9 @@
11661508 animationItem.addItemListener(this);
11671509 animationItem.setState(Globals.ANIMATION);
11681510
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
1513
+
11691514 menu.add("-");
11701515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11711516 parseverticesItem.addActionListener(this);
....@@ -1178,6 +1523,8 @@
11781523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11791524 reduce34MorphItem.addActionListener(this);
11801525 menu.add("-");
1526
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1527
+ memoryItem.addActionListener(this);
11811528 menu.add(computeAOItem = new MenuItem("Compute AO"));
11821529 computeAOItem.addActionListener(this);
11831530
....@@ -1186,11 +1533,9 @@
11861533 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11871534 mirrorItem.addActionListener(this);
11881535 menu.add("-");
1189
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1190
- memoryItem.addActionListener(this);
11911536 menu.add(analyzeItem = new MenuItem("Analyze"));
11921537 analyzeItem.addActionListener(this);
1193
- menu.add(dumpItem = new MenuItem("Dump"));
1538
+ menu.add(dumpItem = new MenuItem("Print"));
11941539 dumpItem.addActionListener(this);
11951540 // menu.add(pathItem = new MenuItem("From-to path"));
11961541 // pathItem.addActionListener(this);
....@@ -1331,9 +1676,34 @@
13311676 shadow.material = new cMaterial(obj.material);
13321677 shadow.material.diffuse = 0.0001f;
13331678 shadow.material.specular = 0.0001f;
1679
+ //shadow.projectedVertices[1].x = 300;
13341680
13351681 makeSomething(shadow);
13361682 }
1683
+
1684
+ private void ClearUnpinned()
1685
+ {
1686
+ //for (Object3D obj : listUI)
1687
+ for (int i=listUI.size(); --i>=0;)
1688
+ {
1689
+ Object3D obj = listUI.elementAt(i);
1690
+ if (!obj.pinned)
1691
+ {
1692
+ obj.CloseUI();
1693
+ listUI.remove(i);
1694
+ }
1695
+ }
1696
+ }
1697
+
1698
+ private void EditElement(Object3D elem, boolean newWindow)
1699
+ {
1700
+ // if (!(elem instanceof Composite))
1701
+ // newWindow = false;
1702
+ listUI.add(elem);
1703
+ elem.openEditWindow(this, newWindow); //, false);
1704
+ System.out.println("edit : " + elem);
1705
+ elem.editWindow.refreshContents(true); // ? new
1706
+ }
13371707
13381708 /**
13391709 * applyExample
....@@ -1537,9 +1907,9 @@
15371907
15381908 void Overwrite(int mask)
15391909 {
1540
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1910
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15411911 {
1542
- Object3D content = GrafreeD.clipboard.get(0);
1912
+ Object3D content = Grafreed.clipboard.get(0);
15431913
15441914 if (content instanceof cGroup && ((cGroup)content).transientlink )
15451915 content = ((cGroup)content).get(0);
....@@ -1578,7 +1948,7 @@
15781948 {
15791949 ScreenFit();
15801950 } else
1581
- if (source == switchItem)
1951
+ if (source == switchViewItem)
15821952 {
15831953 cVector v1 = new cVector();
15841954 cVector v2 = new cVector();
....@@ -1587,11 +1957,11 @@
15871957 objEditor.cameraView.renderCamera.setAim(v2, v1);
15881958 objEditor.cameraView.repaint();
15891959 } else
1590
- if (source == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
15911961 {
15921962 makeSomething(new Box());
15931963 } else
1594
- if (source == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
15951965 {
15961966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15971967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1670,27 +2040,27 @@
16702040
16712041 makeSomething(obj);
16722042 } else
1673
- if (source == gridItem)
2043
+ if (source == gridItem || source == gridButton)
16742044 {
16752045 makeSomething(new Grid());
16762046 } else
1677
- if (source == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
16782048 {
16792049 makeSomething(new Sphere());
16802050 } else
1681
- if (source == coneItem)
2051
+ if (source == coneItem || source == coneButton)
16822052 {
16832053 makeSomething(new Cone());
16842054 } else
1685
- if (source == torusItem)
2055
+ if (source == torusItem || source == torusButton)
16862056 {
16872057 makeSomething(new Torus());
16882058 } else
1689
- if (source == superItem)
2059
+ if (source == superItem || source == superButton)
16902060 {
16912061 makeSomething(new Superellipsoid());
16922062 } else
1693
- if (source == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
16942064 {
16952065 makeSomething(new Klein());
16962066 } else
....@@ -1710,7 +2080,7 @@
17102080 {
17112081 makeSomething(new BezierSurface());
17122082 } else
1713
- if (source == overlayItem)
2083
+ if (source == overlayItem || source == overlayButton)
17142084 {
17152085 /*
17162086 Object3D obj = new BezierSurface(5,8);
....@@ -1758,7 +2128,7 @@
17582128 s.setup();
17592129 makeSomething(s);
17602130 } else
1761
- if (source == lightItem)
2131
+ if (source == lightItem || source == lightButton)
17622132 {
17632133 makeSomething(new Light());
17642134 } else
....@@ -1808,30 +2178,30 @@
18082178
18092179 group(g);
18102180 } else
1811
- if (source == loopItem)
2181
+ if (source == loopItem || source == loopButton)
18122182 {
18132183 Composite csg = new GroupLeaf();
18142184 csg.count = 5;
18152185 group(csg);
1816
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
18172187 csg.addChild(child);
18182188 child.addChild(csg);
18192189 } else
18202190 if (source == doubleItem)
18212191 {
1822
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
18232193 csg.count = 5;
18242194 group(csg);
1825
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
18262196 csg.addChild(child);
18272197 child.addChild(csg);
1828
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
18292199 csg.addChild(child);
18302200 child.addChild(csg);
18312201 } else
18322202 if (source == tripleItem)
18332203 {
1834
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
18352205 csg.count = 4;
18362206 group(csg);
18372207 Composite child = new cGroup();
....@@ -1843,23 +2213,6 @@
18432213 child = new cGroup();
18442214 csg.addChild(child);
18452215 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");
18632216 } else
18642217 if (source == computeAOItem)
18652218 {
....@@ -1879,7 +2232,7 @@
18792232 if (source == invariantsItem)
18802233 {
18812234 System.out.println("Invariants:");
1882
- GrafreeD.grafreeD.universe.invariants();
2235
+ Grafreed.grafreeD.universe.invariants();
18832236 } else
18842237 if (source == memoryItem)
18852238 {
....@@ -1898,6 +2251,46 @@
18982251 {
18992252 DumpObject();
19002253 } else
2254
+ if (source == minButton)
2255
+ {
2256
+ Minimize();
2257
+ } else
2258
+ if (source == maxButton)
2259
+ {
2260
+ Maximize();
2261
+ } else
2262
+ if (source == fullButton)
2263
+ {
2264
+ ToggleFullScreen();
2265
+ } else
2266
+ if (source == undoButton)
2267
+ {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2271
+ Undo();
2272
+ } else
2273
+ if (source == restoreButton)
2274
+ {
2275
+ // Restore current version
2276
+ Restore();
2277
+ } else
2278
+ if (source == replaceButton)
2279
+ {
2280
+ // Overwrite current version
2281
+ Replace();
2282
+ } else
2283
+ if (source == redoButton)
2284
+ {
2285
+ // Go to next version
2286
+ Redo();
2287
+ } else
2288
+ if (source == saveButton)
2289
+ {
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
2293
+ } else
19012294 if (source == oneStepButton)
19022295 {
19032296 Globals.ONESTEP = true;
....@@ -1905,17 +2298,14 @@
19052298 } else
19062299 if (source == screenfitButton)
19072300 {
1908
- //Reload(lastConverter, lastFilename, true);
19092301 ScreenFit();
19102302 } else
19112303 if (source == screenfitpointButton)
19122304 {
1913
- //Reload(lastConverter, lastFilename, true);
19142305 ScreenFitPoint();
19152306 } else
19162307 if (source == snapobjectButton)
19172308 {
1918
- //Reload(lastConverter, lastFilename, true);
19192309 SnapObject();
19202310 } else
19212311 // if (event.getSource() == recompileButton)
....@@ -1952,12 +2342,20 @@
19522342 {
19532343 loadClipboard(true);
19542344 } else
2345
+ if (source == undoItem)
2346
+ {
2347
+ Undo();
2348
+ } else
2349
+ if (source == redoItem)
2350
+ {
2351
+ Redo();
2352
+ } else
19552353 if (source == duplicateItem)
19562354 {
1957
- Object3D keep = GrafreeD.clipboard;
2355
+ Object3D keep = Grafreed.clipboard;
19582356 loadClipboard(false);
19592357 paste(false);
1960
- GrafreeD.clipboard = keep;
2358
+ Grafreed.clipboard = keep;
19612359 } else
19622360 if (source == cloneItem)
19632361 {
....@@ -2177,9 +2575,9 @@
21772575 // group.selection.get(0).setMasterThis(content); // should be identity
21782576 // refreshContents();
21792577 // }
2180
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2578
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21812579 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2580
+ Object3D content = Grafreed.clipboard.get(0);
21832581
21842582 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852583 content = ((cGroup)content).get(0);
....@@ -2229,9 +2627,9 @@
22292627 } else
22302628 if (source == setMasterItem)
22312629 {
2232
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2630
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22332631 {
2234
- Object3D content = GrafreeD.clipboard.get(0);
2632
+ Object3D content = Grafreed.clipboard.get(0);
22352633
22362634 if (content instanceof cGroup && ((cGroup)content).transientlink )
22372635 content = ((cGroup)content).get(0);
....@@ -2244,9 +2642,9 @@
22442642 {
22452643 if (group.selection.size() == 1)
22462644 {
2247
- if (GrafreeD.clipboard.size() == 1)
2645
+ if (Grafreed.clipboard.size() == 1)
22482646 {
2249
- Object3D content = GrafreeD.clipboard.get(0);
2647
+ Object3D content = Grafreed.clipboard.get(0);
22502648
22512649 if (content instanceof cGroup && ((cGroup)content).transientlink )
22522650 content = ((cGroup)content).get(0);
....@@ -2263,7 +2661,7 @@
22632661 {
22642662 RevertMeshes();
22652663 } else
2266
- if (source == resetMeshItem)
2664
+ if (source == resetAllItem)
22672665 {
22682666 ResetAll();
22692667 } else
....@@ -2271,7 +2669,7 @@
22712669 {
22722670 StepAll();
22732671 } else
2274
- if (source == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
22752673 {
22762674 //int indices[] = jList.getSelectedIndices();
22772675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2283,9 +2681,9 @@
22832681 {
22842682 ClearSelection(true);
22852683 } else
2286
- if (source == grabItem)
2684
+ if (source == grabItem || source == groupButton)
22872685 {
2288
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
22892687 } else
22902688 if (source == hideItem)
22912689 {
....@@ -2303,11 +2701,11 @@
23032701 {
23042702 makeSomething(new Camera());
23052703 } else
2306
- if (source == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
23072705 {
23082706 group(new Composite());
23092707 } else
2310
- if (source == randomItem)
2708
+ if (source == switchItem || source == switchButton)
23112709 {
23122710 RandomNode random = new RandomNode();
23132711 group(random);
....@@ -2409,7 +2807,7 @@
24092807 {
24102808 group(new cLinker());
24112809 } else
2412
- if (source == textureItem)
2810
+ if (source == textureItem || source == textureButton)
24132811 {
24142812 group(new TextureNode());
24152813 } else
....@@ -2429,17 +2827,30 @@
24292827 {
24302828 CastShadow(2);
24312829 } else
2432
- if (source == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
24332831 {
2434
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
24352834 for (int i=0; i<group.selection.size(); i++)
24362835 {
2437
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
24382841 }
24392842
2440
- ClearSelection(false);
2441
-
2442
- refreshContents();
2843
+ if (!hasRoot)
2844
+ {
2845
+ for (int i=0; i<group.selection.size(); i++)
2846
+ {
2847
+ Ungroup(group.selection.get(i));
2848
+ }
2849
+
2850
+ ClearSelection(false);
2851
+
2852
+ refreshContents();
2853
+ }
24432854 } else
24442855 if (source == genUVItem)
24452856 {
....@@ -2451,7 +2862,7 @@
24512862 } else
24522863 if (source == genNormalsMESHItem)
24532864 {
2454
- GenNormals(true); // TODO
2865
+ GenNormalsMESH();
24552866 } else
24562867 if (source == genNormalsORGANItem)
24572868 {
....@@ -2516,6 +2927,22 @@
25162927 if (source == unmarkleavesItem)
25172928 {
25182929 MarkLeaves(false);
2930
+ } else
2931
+ if (source == rewindleavesItem)
2932
+ {
2933
+ RewindLeaves(true);
2934
+ } else
2935
+ if (source == unrewindleavesItem)
2936
+ {
2937
+ RewindLeaves(false);
2938
+ } else
2939
+ if (source == randomleavesItem)
2940
+ {
2941
+ RandomLeaves(true);
2942
+ } else
2943
+ if (source == unrandomleavesItem)
2944
+ {
2945
+ RandomLeaves(false);
25192946 } else
25202947 if (source == flipVItem)
25212948 {
....@@ -2601,9 +3028,13 @@
26013028 {
26023029 SmoothMesh();
26033030 } else
2604
- if (source == transformgeometryItem)
3031
+ if (source == transformGeometryItem)
26053032 {
26063033 TransformGeometry();
3034
+ } else
3035
+ if (source == transformChildrenItem)
3036
+ {
3037
+ TransformChildren();
26073038 } else
26083039 if (source == resetTransformItem)
26093040 {
....@@ -2611,7 +3042,11 @@
26113042 } else
26123043 if (source == resetCentroidItem)
26133044 {
2614
- ResetCentroid();
3045
+ ResetCentroid(true);
3046
+ } else
3047
+ if (source == resetCentroidXZItem)
3048
+ {
3049
+ ResetCentroid(false);
26153050 } else
26163051 if (source == resetParentItem)
26173052 {
....@@ -2743,6 +3178,10 @@
27433178 if (source == twoButton)
27443179 {
27453180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
27463185 // bug
27473186 //gridPanel.setDividerLocation(1.0);
27483187 //bigPanel.setDividerLocation(0.0);
....@@ -2775,10 +3214,31 @@
27753214 bigThree.ClearUI();
27763215 bigThree.add(centralPanel);
27773216 bigThree.FlushUI();
3217
+
3218
+ cameraView.requestFocusInWindow();
3219
+
3220
+// refreshContents(true);
3221
+//
3222
+// try
3223
+// {
3224
+// java.awt.Robot bot = new java.awt.Robot();
3225
+// int mask = InputEvent.BUTTON1_MASK;
3226
+// bot.mouseMove(100, 100);
3227
+// bot.mousePress(mask);
3228
+// bot.mouseRelease(mask);
3229
+// }
3230
+// catch (Exception e)
3231
+// {
3232
+//
3233
+// }
3234
+
27783235 } else
27793236 if (source == threeButton)
27803237 {
27813238 radio.layout = threeButton;
3239
+
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
27823242
27833243 // bigThree.remove(scenePanel);
27843244 // bigThree.remove(centralPanel);
....@@ -2811,10 +3271,15 @@
28113271 bigThree.add(centralPanel);
28123272 bigThree.add(XYZPanel);
28133273 bigThree.FlushUI();
3274
+
3275
+ cameraView.requestFocusInWindow();
28143276 } else
28153277 if (source == fourButton)
28163278 {
28173279 radio.layout = fourButton;
3280
+
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
28183283
28193284 // bigThree.remove(scenePanel);
28203285 // bigThree.remove(centralPanel);
....@@ -2846,10 +3311,15 @@
28463311 bigThree.ClearUI();
28473312 bigThree.add(scenePanel);
28483313 bigThree.FlushUI();
3314
+
3315
+ cameraView.requestFocusInWindow();
28493316 } else
28503317 if (source == sixButton)
28513318 {
28523319 radio.layout = sixButton;
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
28533323
28543324 // bigThree.remove(scenePanel);
28553325 // bigThree.remove(centralPanel);
....@@ -2882,10 +3352,15 @@
28823352 bigThree.add(scenePanel);
28833353 bigThree.add(centralPanel);
28843354 bigThree.FlushUI();
3355
+
3356
+ cameraView.requestFocusInWindow();
28853357 } else
28863358 if (source == sevenButton)
28873359 {
28883360 radio.layout = sevenButton;
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
28893364
28903365 // bigThree.remove(scenePanel);
28913366 // bigThree.remove(centralPanel);
....@@ -2919,6 +3394,8 @@
29193394 bigThree.add(centralPanel);
29203395 bigThree.add(XYZPanel);
29213396 bigThree.FlushUI();
3397
+
3398
+ cameraView.requestFocusInWindow();
29223399 } else
29233400 if (source == rootButton)
29243401 {
....@@ -2930,6 +3407,7 @@
29303407 EditObject(obj);
29313408 }
29323409
3410
+ cameraView.requestFocusInWindow();
29333411 refreshContents(true);
29343412 } else
29353413 if (source == closeButton)
....@@ -2939,22 +3417,37 @@
29393417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29403418 {
29413419 ab = (cRadio)e.nextElement();
2942
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29433421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
29443428 buttonGroup.remove(ab);
29453429 radioPanel.remove(ab);
29463430
2947
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
29483433 // ab.GetObject().objectUI = null; // ?????????
29493434
29503435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29513436 break;
29523437 }
29533438 }
3439
+
3440
+ cameraView.requestFocusInWindow();
29543441 refreshContents(true);
29553442 } else
29563443 if (source == editItem || source == editButton)
29573444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
29583451 EditSelection(false);
29593452 } else
29603453 if (source == uneditButton)
....@@ -2964,10 +3457,11 @@
29643457 Object3D child = (Object3D)e.nextElement();
29653458 if(child.editWindow != null)
29663459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
29673461 child.CloseUI();
29683462 listUI.remove(child);
29693463
2970
- child.editWindow = null; // ???????????
3464
+ //child.editWindow = null; // ???????????
29713465 }
29723466 objEditor.ctrlPanel.FlushUI();
29733467 //objEditor.jTree.clearSelection();
....@@ -2980,6 +3474,7 @@
29803474 //copy.ClearUI();
29813475 for (Object3D obj : listUI)
29823476 {
3477
+ obj.pinned = false;
29833478 obj.CloseUI();
29843479 }
29853480 listUI.clear();
....@@ -2989,7 +3484,7 @@
29893484 {
29903485 assert(copy == group);
29913486
2992
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29933488
29943489 for (Object3D obj : listUI)
29953490 {
....@@ -3038,6 +3533,9 @@
30383533 }
30393534
30403535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
30413539 //Globals.theRenderer.object = group;
30423540 if(!useclient)
30433541 {
....@@ -3053,20 +3551,46 @@
30533551 frontView.object = group;
30543552 sideView.object = group;
30553553 }
3056
- group.editWindow = this;
3554
+
3555
+// fix "+" issue
3556
+ //group.editWindow = this;
3557
+ group.manipWindow = this;
3558
+
30573559 /*
30583560 currentLayout = radio.layout;
30593561 if (currentLayout == null)
30603562 currentLayout = sevenButton;
30613563 */
30623564 radio.layout.doClick();
3565
+
3566
+ ClearUnpinned();
3567
+ //Grafreed.Assert(group != null);
3568
+ //Grafreed.Assert(group.selection != null);
3569
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3570
+ if (group.selection == null || group.selection.size() == 1)
3571
+ EditSelection(false);
30633572 keepparent = group.parent;
30643573 // PARENT = NULL or not???
30653574 //group.parent = null; // ROOT
30663575 //group.attributes = -1;
30673576 ResetModel();
3577
+
3578
+ cameraView.requestFocusInWindow();
30683579 refreshContents(true);
3069
- }
3580
+ } else if (event.getSource() == editCameraItem)
3581
+ {
3582
+ cameraView.ProtectCamera();
3583
+ cameraView.repaint();
3584
+ return;
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3586
+ {
3587
+ cameraView.RevertCamera();
3588
+ cameraView.repaint();
3589
+ return;
3590
+ // } else if (event.getSource() == textureButton)
3591
+ // {
3592
+ // return; // true;
3593
+ }
30703594 else
30713595 {
30723596 //return super.action(event, arg);
....@@ -3075,7 +3599,6 @@
30753599 }
30763600
30773601 boolean useclient = false;
3078
- cRadio radio;
30793602
30803603 void ToggleRoot()
30813604 {
....@@ -3127,6 +3650,28 @@
31273650 refreshContents();
31283651 }
31293652
3653
+ void TransformChildren()
3654
+ {
3655
+ Object3D obj;
3656
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3657
+ {
3658
+ obj = (Object3D)e.nextElement();
3659
+ obj.KeepTextureMatrices();
3660
+ obj.TransformChildren();
3661
+ obj.RestoreTextureMatrices();
3662
+
3663
+// if (obj.parent == null)
3664
+// {
3665
+// System.out.println("NULL PARENT!");
3666
+// new Exception().printStackTrace();
3667
+// }
3668
+// else
3669
+// TouchTransform(obj);
3670
+// //obj.parent.Touch();
3671
+ }
3672
+
3673
+ refreshContents();
3674
+ }
31303675
31313676 void ResetTransform()
31323677 {
....@@ -3239,7 +3784,7 @@
32393784 refreshContents();
32403785 }
32413786
3242
- void ResetCentroid()
3787
+ void ResetCentroid(boolean full)
32433788 {
32443789 Object3D obj;
32453790 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3254,12 +3799,16 @@
32543799 LA.matIdentity(Object3D.mat);
32553800 obj.getBounds(minima, maxima, false);
32563801 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3257
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3802
+ if (full)
3803
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32583804 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32593805 obj.TransformMesh(Object3D.mat);
3806
+
32603807 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3261
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3808
+ if (full)
3809
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32623810 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3811
+
32633812 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32643813 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32653814 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3288,7 +3837,8 @@
32883837
32893838 int size = obj.MemorySize();
32903839
3291
- System.err.println((size/1024) + " KB is the size of " + obj);
3840
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3841
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32923842 }
32933843 }
32943844 catch (Exception e)
....@@ -3325,9 +3875,9 @@
33253875 obj = (Object3D)e.nextElement();
33263876
33273877 System.out.println("Object is: " + obj);
3328
- GrafreeD.AnalyzeObject(obj);
3878
+ Grafreed.AnalyzeObject(obj);
33293879 System.out.println("Boundary rep: " + obj.bRep);
3330
- GrafreeD.AnalyzeObject(obj.bRep);
3880
+ Grafreed.AnalyzeObject(obj.bRep);
33313881
33323882 // System.err.println((size/1024) + " KB is the size of " + obj);
33333883 }
....@@ -3369,6 +3919,13 @@
33693919 void GenNormals(boolean crease)
33703920 {
33713921 group.GenNormalsS(crease);
3922
+
3923
+ refreshContents();
3924
+ }
3925
+
3926
+ void GenNormalsMESH()
3927
+ {
3928
+ group.GenNormalsMeshS();
33723929
33733930 refreshContents();
33743931 }
....@@ -3541,8 +4098,8 @@
35414098
35424099 void ParseVertices()
35434100 {
3544
- boolean epsequal = GrafreeD.epsequal;
3545
- GrafreeD.epsequal = true;
4101
+ boolean epsequal = Grafreed.epsequal;
4102
+ Grafreed.epsequal = true;
35464103
35474104 for (int i=0; i<group.selection.size(); i++)
35484105 {
....@@ -3567,7 +4124,7 @@
35674124 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35684125 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35694126
3570
- g.add(GrafreeD.clipboard);
4127
+ g.add(Grafreed.clipboard);
35714128
35724129 buffer.add(g);
35734130 }
....@@ -3582,7 +4139,7 @@
35824139 makeSomething(buffer, i==group.selection.size()-1);
35834140 }
35844141
3585
- GrafreeD.epsequal = epsequal;
4142
+ Grafreed.epsequal = epsequal;
35864143
35874144 refreshContents();
35884145 }
....@@ -3600,7 +4157,16 @@
36004157 String pigment = Object3D.GetPigment(tex);
36014158 //String bump = Object3D.GetBump(tex);
36024159
3603
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4160
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4161
+
4162
+ try
4163
+ {
4164
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4165
+ }
4166
+ catch (Exception e)
4167
+ {
4168
+ System.err.println("FAIL: " + node);
4169
+ }
36044170
36054171 double s = v.s;
36064172
....@@ -3732,7 +4298,7 @@
37324298 return;
37334299
37344300 Object3D poses = group.selection.get(0);
3735
- Object3D ref = GrafreeD.clipboard.get(0);
4301
+ Object3D ref = Grafreed.clipboard.get(0);
37364302
37374303 Object3D newgroup = new Object3D("Po:" + poses.name);
37384304
....@@ -3926,9 +4492,9 @@
39264492
39274493 void ClipMesh()
39284494 {
3929
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4495
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39304496 {
3931
- Object3D content = GrafreeD.clipboard.get(0);
4497
+ Object3D content = Grafreed.clipboard.get(0);
39324498
39334499 if (content instanceof cGroup && ((cGroup)content).transientlink )
39344500 content = ((cGroup)content).get(0);
....@@ -3937,7 +4503,7 @@
39374503 // {
39384504 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39394505 // }
3940
- group.selection.ClipMesh(GrafreeD.clipboard);
4506
+ group.selection.ClipMesh(Grafreed.clipboard);
39414507 }
39424508 // group.selection.ClipMesh(GrafreeD.clipboard);
39434509 System.out.println("DONE.");
....@@ -3984,6 +4550,18 @@
39844550 void MarkLeaves(boolean hide)
39854551 {
39864552 group.selection.MarkLeaves(hide);
4553
+ refreshContents();
4554
+ }
4555
+
4556
+ void RewindLeaves(boolean hide)
4557
+ {
4558
+ group.selection.RewindLeaves(hide);
4559
+ refreshContents();
4560
+ }
4561
+
4562
+ void RandomLeaves(boolean hide)
4563
+ {
4564
+ group.selection.RandomLeaves(hide);
39874565 refreshContents();
39884566 }
39894567
....@@ -4058,28 +4636,25 @@
40584636 // }
40594637 // }
40604638
4061
- static boolean allparams = true;
4062
-
4063
- static Vector<Object3D> listUI = new Vector<Object3D>();
4064
-
40654639 void EditSelection(boolean newWindow)
40664640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
40674647 // aConstraints.gridy = 0;
40684648 for (int i=0; i<group.selection.size(); i++)
40694649 {
40704650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40714651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4072
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40734653
40744654 Object3D elem = (Object3D)group.selection.elementAt(i);
4075
- if(elem != group)
4655
+ if(elem != group || !newWindow)
40764656 {
4077
- // if (!(elem instanceof Composite))
4078
- // newWindow = false;
4079
- listUI.add(elem);
4080
- elem.openEditWindow(this, newWindow); //, false);
4081
- System.out.println("edit : " + elem);
4082
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
40834658 }
40844659 }
40854660 }
....@@ -4154,7 +4729,8 @@
41544729 //new Exception().printStackTrace();
41554730
41564731 freezemodel = true;
4157
-
4732
+ ClearUnpinned();
4733
+
41584734 /**/
41594735 //switch (event.id)
41604736 {
....@@ -4162,7 +4738,6 @@
41624738 //case 702: // Event.LIST_DESELECT
41634739 group.deselectAll();
41644740 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4165
- objEditor.ClearInfo(); // .GetMaterial());
41664741 if (tps != null)
41674742 {
41684743 for (int i=0; i < tps.length; i++)
....@@ -4171,10 +4746,8 @@
41714746
41724747 //if (child.parent != null)
41734748 //child.parent.addSelectee(child);
4749
+ objEditor.SetMaterial(child);
41744750 group.addSelectee(child);
4175
- objEditor.SetMaterial(child); // .GetMaterial());
4176
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4177
- System.err.println("info : " + child.GetPath());
41784751 }
41794752 }
41804753 // else
....@@ -4184,20 +4757,28 @@
41844757 // System.err.println("info : " + group.GetPath());
41854758 // }
41864759
4187
- objEditor.SetText(); // jan 2014
4188
-
4189
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4760
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41904761 CameraPane.flash = true;
41914762
4192
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4763
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41934764 // a camera
41944765 {
4195
- CameraPane.camerachangeframe = 0; // don't refuse it
4196
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4767
+ {
4768
+ CameraPane.camerachangeframe = 0; // don't refuse it
4769
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4770
+ }
41974771 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41984772 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41994773 }
42004774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
42014782 refreshContents();
42024783 //return true;
42034784 }
....@@ -4206,6 +4787,35 @@
42064787
42074788 freezemodel = false;
42084789 }
4790
+
4791
+ void SetPinStates(boolean enabled)
4792
+ {
4793
+ editButton.setEnabled(enabled);
4794
+ uneditButton.setEnabled(enabled);
4795
+ unselectButton.setEnabled(enabled);
4796
+ flashSelectionButton.setEnabled(enabled);
4797
+ }
4798
+
4799
+ void refreshContents(boolean cp)
4800
+ {
4801
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4803
+ {
4804
+ objEditor.ClearInfo(); // .GetMaterial());
4805
+
4806
+ for (int i=0; i < group.selection.Size(); i++)
4807
+ {
4808
+ Object3D child = (Object3D) group.selection.get(i);
4809
+
4810
+ objEditor.AddInfo(child, this, true);
4811
+ System.err.println("info : " + child.GetPath());
4812
+ }
4813
+
4814
+ objEditor.SetText(); // jan 2014
4815
+ }
4816
+
4817
+ super.refreshContents(cp);
4818
+ }
42094819
42104820 void linkSomething(Object3D thing)
42114821 {
....@@ -4277,16 +4887,19 @@
42774887 {
42784888 if (group.selection.isEmpty())
42794889 return;
4280
- GrafreeD.clipboardIsTempGroup = false;
4890
+
4891
+ Grafreed.clipboardIsTempGroup = false;
42814892 Composite tGroup = null;
42824893 if (group.selection.size() > 0) // 1)
42834894 {
42844895 tGroup = new cGroup();
4285
- GrafreeD.clipboardIsTempGroup = true;
4896
+ Grafreed.clipboardIsTempGroup = true;
42864897 }
42874898
42884899 if (cut)
42894900 {
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
42904903 //int indices[] = jList.getSelectedIndices();
42914904 //for (int i = indices.length - 1; i >= 0; i--)
42924905 //jList.remove(indices[i]);
....@@ -4322,16 +4935,16 @@
43224935 //System.out.println("cut " + child);
43234936 //System.out.println("parent = " + child.parent);
43244937 // tmp.addChild(child);
4325
- if (GrafreeD.clipboardIsTempGroup)
4938
+ if (Grafreed.clipboardIsTempGroup)
43264939 tGroup.add/*Child*/(tmp);
43274940 else
4328
- GrafreeD.clipboard = tmp;
4941
+ Grafreed.clipboard = tmp;
43294942 }
43304943 else
4331
- if (GrafreeD.clipboardIsTempGroup)
4944
+ if (Grafreed.clipboardIsTempGroup)
43324945 tGroup.add/*Child*/(child);
43334946 else
4334
- GrafreeD.clipboard = child;
4947
+ Grafreed.clipboard = child;
43354948 }
43364949
43374950 //ResetModel();
....@@ -4363,21 +4976,23 @@
43634976 //System.out.println("cut " + elem);
43644977 //System.out.println("parent = " + elem.parent);
43654978 // tmp.addChild(elem);
4366
- if (GrafreeD.clipboardIsTempGroup)
4979
+ if (Grafreed.clipboardIsTempGroup)
43674980 tGroup.add/*Child*/(tmp);
43684981 else
4369
- GrafreeD.clipboard = tmp;
4982
+ Grafreed.clipboard = tmp;
43704983 }
43714984 else
4372
- if (GrafreeD.clipboardIsTempGroup)
4985
+ if (Grafreed.clipboardIsTempGroup)
43734986 tGroup.add/*Child*/(child);
43744987 else
4375
- GrafreeD.clipboard = child;
4988
+ Grafreed.clipboard = child;
43764989 }
43774990
43784991 }
4379
- if (GrafreeD.clipboardIsTempGroup)
4380
- GrafreeD.clipboard = tGroup;
4992
+
4993
+ if (Grafreed.clipboardIsTempGroup)
4994
+ Grafreed.clipboard = tGroup;
4995
+
43814996 if (cut)
43824997 {
43834998 ResetModel();
....@@ -4387,11 +5002,15 @@
43875002
43885003 void paste(boolean expand)
43895004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
43905009 // if (GrafreeD.clipboard == null)
43915010 // return;
43925011 boolean first = true;
43935012
4394
- if (GrafreeD.clipboardIsTempGroup)
5013
+ if (Grafreed.clipboardIsTempGroup)
43955014 {
43965015 Composite temp;
43975016
....@@ -4402,7 +5021,7 @@
44025021 temp = (Composite)Applet3D.clipboard.deepCopy();
44035022 */
44045023 Object3D elem;
4405
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5024
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44065025 {
44075026 Object3D child = (Object3D)e.nextElement();
44085027
....@@ -4436,16 +5055,17 @@
44365055 //Object3D cb = Applet3D.clipboard;
44375056 //temp.addChild(cb);
44385057 //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());
5058
+ assert(Grafreed.clipboard.parent == null);
5059
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5060
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5061
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5062
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44445063 else
4445
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4446
- GrafreeD.clipboard.get(0).parent = keepparent;
5064
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5065
+ Grafreed.clipboard.get(0).parent = keepparent;
44475066 }
44485067
5068
+ Globals.REPLACEONMAKE = keep;
44495069 ResetModel();
44505070 refreshContents();
44515071 }
....@@ -4492,9 +5112,9 @@
44925112 {
44935113 boolean first = true;
44945114
4495
- if (GrafreeD.clipboardIsTempGroup)
5115
+ if (Grafreed.clipboardIsTempGroup)
44965116 {
4497
- Composite temp = (Composite)GrafreeD.clipboard;
5117
+ Composite temp = (Composite)Grafreed.clipboard;
44985118 Object3D copy;
44995119 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45005120 {
....@@ -4504,7 +5124,7 @@
45045124 }
45055125 } else
45065126 {
4507
- linkSomething(GrafreeD.clipboard); //.get(0));
5127
+ linkSomething(Grafreed.clipboard); //.get(0));
45085128 }
45095129 }
45105130 }
....@@ -4581,6 +5201,10 @@
45815201
45825202 void group(Object3D csg, boolean grab)
45835203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
45845208 if (//false) // why??
45855209 !group.selection.isEmpty())
45865210 {
....@@ -4694,10 +5318,15 @@
46945318 //node.add(csg);
46955319 //makeSomething(node);
46965320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
46975322 }
46985323
46995324 void Ungroup(Object3D g)
47005325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
47015330 if (g instanceof HiddenObject)
47025331 {
47035332 HiddenObject h = (HiddenObject) g;
....@@ -4714,6 +5343,7 @@
47145343 objEditor.makeSomething(g.get(i), false);
47155344 }
47165345 }
5346
+ Globals.REPLACEONMAKE = keep;
47175347 }
47185348
47195349 void ungroup()
....@@ -4909,21 +5539,6 @@
49095539 }
49105540 */
49115541
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
-
49275542 /*
49285543 public void Callback(Object obj)
49295544 {
....@@ -4947,26 +5562,9 @@
49475562 }
49485563 */
49495564
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
-
49675565 String GetFile(String dialogName)
49685566 {
4969
- if (GrafreeD.standAlone)
5567
+ if (Grafreed.standAlone)
49705568 {
49715569 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49725570 browser.show();
....@@ -5034,7 +5632,28 @@
50345632 cButton clearpanelButton;
50355633 cButton unselectButton;
50365634
5635
+ cButton restoreCameraButton;
5636
+
5637
+ cButton saveButton;
50375638 cButton oneStepButton;
5639
+
5640
+ cButton groupButton;
5641
+ cButton ungroupButton;
5642
+ cButton compositeButton;
5643
+ cButton switchButton;
5644
+ cButton loopButton;
5645
+ cButton textureButton;
5646
+
5647
+ cButton gridButton;
5648
+ cButton boxButton;
5649
+ cButton sphereButton;
5650
+ cButton coneButton;
5651
+ cButton torusButton;
5652
+ cButton superButton;
5653
+ cButton kleinButton;
5654
+ cButton particlesButton;
5655
+ cButton overlayButton;
5656
+ cButton lightButton;
50385657
50395658 cButton screenfitButton;
50405659 cButton screenfitpointButton;
....@@ -5047,14 +5666,6 @@
50475666
50485667 cButton setsupportButton;
50495668
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
-
50585669 //
50595670 //Composite
50605671 Object3D // to do !!
....@@ -5064,9 +5675,11 @@
50645675 //JTree jTree;
50655676 private MenuItem lookAtItem;
50665677 private MenuItem lookFromItem;
5067
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
50685679 private MenuItem cutItem;
5069
- private MenuItem duplicateItem;
5680
+ private MenuItem undoItem;
5681
+ private MenuItem redoItem;
5682
+ private JMenuItem duplicateItem;
50705683 private MenuItem cloneItem;
50715684 private MenuItem cloneSupportItem;
50725685 private MenuItem overwriteGeoItem;
....@@ -5079,7 +5692,7 @@
50795692 private MenuItem linkverticesItem;
50805693 private MenuItem relinkverticesItem;
50815694 private MenuItem setMasterItem;
5082
- private MenuItem resetMeshItem;
5695
+ private MenuItem resetAllItem;
50835696 private MenuItem stepAllItem;
50845697 private MenuItem revertMeshItem;
50855698 private MenuItem poseMeshItem;
....@@ -5094,7 +5707,7 @@
50945707 private MenuItem pasteLinkItem;
50955708 private MenuItem pasteCloneItem;
50965709 private MenuItem pasteExpandItem;
5097
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
50985711 private MenuItem clearAllItem;
50995712 private MenuItem genUVItem;
51005713 private MenuItem genNormalsMESHItem;
....@@ -5129,6 +5742,10 @@
51295742 private MenuItem showleavesItem;
51305743 private MenuItem markleavesItem;
51315744 private MenuItem unmarkleavesItem;
5745
+ private MenuItem rewindleavesItem;
5746
+ private MenuItem unrewindleavesItem;
5747
+ private MenuItem randomleavesItem;
5748
+ private MenuItem unrandomleavesItem;
51325749
51335750 private MenuItem flipVItem;
51345751 private MenuItem unflipVItem;
....@@ -5140,15 +5757,17 @@
51405757 private MenuItem panoTexturesItem;
51415758
51425759 private MenuItem resetCentroidItem;
5143
- private MenuItem transformgeometryItem;
5760
+ private MenuItem resetCentroidXZItem;
51445761 private MenuItem resetTransformItem;
5762
+ private MenuItem transformGeometryItem;
5763
+ private MenuItem transformChildrenItem;
51455764 private MenuItem hideItem;
51465765 private MenuItem grabItem;
51475766 private MenuItem backItem;
51485767 private MenuItem frontItem;
51495768 private MenuItem cameraItem;
51505769 private MenuItem compositeItem;
5151
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
51525771 private MenuItem physicsItem;
51535772 private MenuItem frameselectorItem;
51545773 private MenuItem scriptNodeItem;
....@@ -5210,11 +5829,6 @@
52105829 private MenuItem doubleItem;
52115830 private MenuItem tripleItem;
52125831
5213
- private MenuItem importGFDItem;
5214
- private MenuItem importVRMLX3DItem;
5215
- private MenuItem import3DSItem;
5216
- private MenuItem importOBJItem;
5217
-
52185832 private MenuItem computeAOItem;
52195833 private MenuItem recompileItem;
52205834 private MenuItem editScriptItem;
....@@ -5224,4 +5838,8 @@
52245838 private MenuItem analyzeItem;
52255839 private MenuItem dumpItem;
52265840 //boolean freezemodel = false;
5841
+
5842
+ Menu cameraMenu;
5843
+ MenuItem editCameraItem;
5844
+ MenuItem restoreCameraItem;
52275845 }